/* CMD-HR Portal · BOSS Light (mobile-first)
   Stand: 2025-12-27
   Fokus: Header + Burger + Menü, stabile Cards, responsive Forms & Tables
*/

:root{
  --bg:#eef2f6;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#dbe3ee;

  --primary:#f07d00;       /* Boss Orange */
  --primaryText:#ffffff;

  --dark:#0b1220;          /* Boss Black */
  --darkText:#ffffff;

  --radius-card:18px;
  --radius-ctl:16px;

  --shadow:0 14px 36px rgba(2,6,23,.10);

  --ctl-h:44px;
  --wrap:1100px;
  --header-h:64px;
}

*{box-sizing:border-box}
html,body{height:100%}
html{color-scheme:light}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  -webkit-text-size-adjust:100%;
}

a{color:inherit;text-decoration:none}
h1,h2,h3{margin:0}
small,.small{color:var(--muted)}
.muted{color:var(--muted)}

button,input,select,textarea{font:inherit}
input,select,textarea{
  width:100%;
  min-height:var(--ctl-h);
  padding:12px 14px;
  border-radius:var(--radius-ctl);
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  outline:none;
}
input::placeholder{color:#94a3b8}
input:focus,select:focus,textarea:focus{
  border-color:rgba(240,125,0,.55);
  box-shadow:0 0 0 4px rgba(240,125,0,.18);
}
textarea{resize:vertical}

:focus:not(:focus-visible){outline:none}
:focus-visible{
  outline:2px solid rgba(240,125,0,.35);
  outline-offset:2px;
}

/* Global SVG: stroke-only, never filled */
svg{width:20px;height:20px;display:block}
svg, svg *{
  fill:none !important;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}

/* Layout containers */
.portal-main{
  max-width:var(--wrap);
  margin:0 auto;
  padding:18px;
}

/* Legacy helper: some pages still wrap inside portal-main */
.wrap{
  max-width:var(--wrap);
  margin:0 auto;
  padding:18px;
}
.portal-main .wrap{
  max-width:100%;
  padding:0;
}

.portal-narrow{
  max-width:720px;
  margin:0 auto;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius-card);
  box-shadow:var(--shadow);
  padding:18px;
  margin:14px 0;
}
.card-title{font-weight:1000;font-size:18px;margin-bottom:6px}
.card-sub{color:var(--muted);font-size:14px}

/* Rows & grids */
.row{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}
.spacer{flex:1}

.grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
@media (max-width: 900px){
  .grid{grid-template-columns:1fr}
}

/* Tile header (card head with action button) */
.tile-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.tile-head strong{font-weight:1000}
.tile-head > div{min-width:0}
.tile-head .muted{max-width:100%}

/* Notices */
.notice{
  border:1px solid var(--line);
  background:#fff;
  border-radius:14px;
  padding:12px 14px;
  font-weight:800;
}
.notice.err{
  border-color:rgba(220,38,38,.35);
  background:rgba(220,38,38,.08);
  color:#991b1b;
}
.notice.ok{
  border-color:rgba(22,163,74,.35);
  background:rgba(22,163,74,.08);
  color:#166534;
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:var(--ctl-h);
  padding:12px 16px;
  border-radius:var(--radius-ctl);
  border:0;
  cursor:pointer;
  font-weight:900;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
}
.btn.primary, .btn-primary{background:var(--primary);color:var(--primaryText)}
.btn.secondary, .btn-dark{background:var(--dark);color:var(--darkText)}
.btn.ghost, .btn-ghost{background:#fff;color:var(--text);border:1px solid var(--line)}
.btn.block{width:100%}

.btn:disabled{opacity:.55;cursor:not-allowed}
.btn:active{transform:translateY(1px)}

.btn-icon,
.portal-header-btn{
  width:var(--ctl-h);
  height:var(--ctl-h);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:var(--radius-ctl);
  border:0;
  cursor:pointer;
  background:var(--dark);
  color:var(--darkText);
  box-shadow:0 10px 26px rgba(2,6,23,.18);
  -webkit-tap-highlight-color:transparent;
}
.btn-icon-small,
.portal-header-btn-small{
  width:36px;
  height:36px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:var(--radius-ctl);
  border:0;
  cursor:pointer;
  background:var(--dark);
  color:var(--darkText);
  box-shadow:0 10px 26px rgba(2,6,23,.18);
  -webkit-tap-highlight-color:transparent;
}
a.portal-header-btn{display:inline-flex}
.btn-icon.ghost{
  background:#fff;
  color:var(--text);
  border:1px solid var(--line);
  box-shadow:none;
}
.btn-icon:active,
.portal-header-btn:active{transform:translateY(1px)}

/* Input icons */
.input-icon{position:relative}
.input-icon input{padding-right:44px}
.input-icon .icon{
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  width:18px;height:18px;
  color:var(--muted);
  pointer-events:none;
}
.input-icon .icon svg{width:18px;height:18px}

/* Chrome/WebKit: keep date picker clickable but hide native icon */
.input-icon input[type="date"]::-webkit-calendar-picker-indicator{
  opacity:0;
  position:absolute;
  right:8px;
  width:36px;height:36px;
  cursor:pointer;
}

/* Pills */
.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:2px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  color:var(--text);
  font-size:12px;
  line-height:18px;
  margin-left:8px;
  white-space:nowrap;
}

/* =========================
   HEADER + MENU (Portal)
   Markup (lib/portal_layout.php):
   <header class="portal-header">
     <button class="portal-header-btn" id="btnMenu">...</button>
     <div class="portal-titlewrap">...</div>
     <a class="portal-header-btn" ...>...</a>
   </header>
   <div class="portal-backdrop" id="menuBack"></div>
   <nav class="portal-menu" id="menuNav">...</nav>
   ========================= */

.portal-header{
  position:sticky;
  top:0;
  z-index:200;
  background:rgba(238,242,246,.92);
  backdrop-filter:saturate(180%) blur(10px);
  -webkit-backdrop-filter:saturate(180%) blur(10px);
  border-bottom:1px solid var(--line);

  display:grid;
  grid-template-columns:var(--ctl-h) 1fr var(--ctl-h);
  gap:12px;
  align-items:center;
  padding:10px 14px;
  min-height:var(--header-h);
}

.portal-titlewrap{
  min-width:0;
  text-align:center;
  line-height:1.15;
}
.portal-brand{
  font-weight:900;
  font-size:13px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.portal-title{
  font-weight:1000;
  font-size:18px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.portal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(2,6,23,.28);
  z-index:220;
  display:none;
}
.portal-backdrop.show,
.portal-backdrop.is-open{display:block}

.portal-menu{
  position:fixed;
  top:calc(var(--header-h) + 8px);
  left:12px;
  width:min(380px, calc(100vw - 24px));
  max-height:calc(100vh - (var(--header-h) + 24px));
  overflow:auto;
  -webkit-overflow-scrolling:touch;

  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:var(--shadow);
  z-index:230;
  display:none;
}
.portal-menu.open,
.portal-menu.is-open{display:block}

.portal-menu a,
.portal-menu .portal-menu-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 14px;
  font-weight:1000;
  border-bottom:1px solid var(--line);
  background:#fff;
}
.portal-menu a:last-child,
.portal-menu .portal-menu-item:last-child{border-bottom:0}

.portal-menu a.active,
.portal-menu .portal-menu-item.active{
  background:var(--primary);
  color:#fff;
  border-bottom-color:rgba(255,255,255,.22);
}

.portal-menu a:active{filter:brightness(.99)}

/* Tables */
.table-wrap{
  width:100%;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  overflow:hidden;
}
.table th,.table td{
  padding:12px 12px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:top;
  font-size:14px;
}
.table th{
  background:#f8fafc;
  font-weight:1000;
  color:var(--text);
}
.table tr:last-child td{border-bottom:0}

/* Center helper (used by clock.php table headers/cells) */
.table th.cell-center,
.table td.cell-center{
  text-align:center;
}

/* Actions wrapper (clock.php): force horizontal alignment */
.table td.cell-center .row-actions{
  display:flex !important;
  flex-direction:row !important;
  gap:8px;
  justify-content:center;
  align-items:center;
  flex-wrap:nowrap;
  white-space:nowrap;
}
.table td.cell-center .row-actions-form{
  display:inline-flex !important;
  margin:0 !important;
}
.table td.cell-center .row-actions-form button{
  display:inline-flex;
}

/* Responsive refinements */
@media (max-width: 720px){
  .portal-main{padding:12px}
  .wrap{padding:12px}
  .card{padding:14px}
  .portal-header{padding:10px 12px;gap:10px}
  .portal-title{font-size:16px}

  .table th,.table td{padding:10px 10px;font-size:13px}

  /* On very small screens allow wrapping in cells */
  .table td{word-break:break-word}
}

@media (prefers-reduced-motion: reduce){
  *{scroll-behavior:auto}
}

/* === Clock/Portal Tables: Aktionen nebeneinander (Mobile-Fix) === */
.table th.cell-center:last-child,
.table td.cell-center:last-child{
  min-width: 92px;              /* Platz für 2×36px + Gap */
  white-space: nowrap;
}

.table td.cell-center .row-actions{
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap !important;
  white-space: nowrap;
}

.table td.cell-center .row-actions-form{
  display: inline-flex !important;
  margin: 0 !important;
}

/* iOS/Safari: Buttons zuverlässig „custom styled“ */
.table td.cell-center .row-actions a.btn-icon-small,
.table td.cell-center .row-actions button.btn-icon-small{
  display: inline-flex !important;
  -webkit-appearance: none;
  appearance: none;
}

/* === Clock/Portal Tables: Aktionen nebeneinander (Mobile-Fix) === */
.table th.cell-center:last-child,
.table td.cell-center:last-child{
  min-width: 92px;              /* Platz für 2×36px + Gap */
  white-space: nowrap;
}

.table td.cell-center .row-actions{
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap !important;
  white-space: nowrap;
}

.table td.cell-center .row-actions-form{
  display: inline-flex !important;
  margin: 0 !important;
}

/* iOS/Safari: Buttons zuverlässig „custom styled“ */
.table td.cell-center .row-actions a.btn-icon-small,
.table td.cell-center .row-actions button.btn-icon-small{
  display: inline-flex !important;
  -webkit-appearance: none;
  appearance: none;
}
