/* =========================================================================
   Staff Board · design system
   Light by default; dark via [data-theme="dark"] on <html>.
   ========================================================================= */

:root {
  color-scheme: light;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Archivo", "Inter", system-ui, sans-serif;

  --bg: #f6f6f7;
  --bg-subtle: #efeff1;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-hover: #f4f4f6;
  --border: #e7e7ea;
  --border-strong: #d6d6dc;
  --text: #111114;
  --text-2: #4a4a54;
  --text-3: #85858f;
  --overlay: rgba(17, 17, 20, .38);

  --accent: #ec3013;
  --accent-hover: #d42a10;
  --accent-text: #c4260e;
  --accent-soft: #fdeeea;
  --accent-ring: rgba(236, 48, 19, .22);

  --success: #15924a; --success-soft: #e8f6ee;
  --warning: #b86e00; --warning-soft: #fdf3e2;
  --danger: #d92d20;  --danger-soft: #fdeceb;

  --st-front: #475569; --st-cook: #ec3013; --st-grill: #f59e0b; --st-wash: #0d9488; --st-backup: #8b5cf6; --st-bench: #a1a1aa;

  --floor-tile: #fbfaf8; --floor-line: #eeebe6; --floor-edge: #2b2b30;
  --zone-fill: rgba(17, 17, 20, .025); --zone-kitchen: rgba(236, 48, 19, .055); --zone-stroke: #b9b9c0;
  --fixture-fill: rgba(17, 17, 20, .05); --fixture-stroke: rgba(17, 17, 20, .22);
  --bench-band: #f2f1ef;

  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px;
  --sh-xs: 0 1px 2px rgba(16, 16, 20, .05);
  --sh-sm: 0 1px 2px rgba(16, 16, 20, .04), 0 2px 8px rgba(16, 16, 20, .05);
  --sh-md: 0 2px 4px rgba(16, 16, 20, .04), 0 8px 24px rgba(16, 16, 20, .08);
  --sh-lg: 0 8px 16px rgba(16, 16, 20, .06), 0 24px 64px rgba(16, 16, 20, .14);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --sidebar-w: 252px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0c0e;
  --bg-subtle: #121215;
  --surface: #151518;
  --surface-2: #19191d;
  --surface-hover: #1e1e23;
  --border: #26262c;
  --border-strong: #35353d;
  --text: #f3f3f5;
  --text-2: #b5b5bf;
  --text-3: #7f7f8b;
  --overlay: rgba(0, 0, 0, .6);

  --accent: #f0462a;
  --accent-hover: #ff5a3d;
  --accent-text: #ff7d66;
  --accent-soft: rgba(240, 70, 42, .14);
  --accent-ring: rgba(240, 70, 42, .35);

  --success: #3ccf7b; --success-soft: rgba(60, 207, 123, .13);
  --warning: #f5b544; --warning-soft: rgba(245, 181, 68, .13);
  --danger: #ff6b5e;  --danger-soft: rgba(255, 107, 94, .13);

  --st-front: #94a3b8;

  --floor-tile: #18181c; --floor-line: #222228; --floor-edge: #4a4a54;
  --zone-fill: rgba(255, 255, 255, .025); --zone-kitchen: rgba(240, 70, 42, .08); --zone-stroke: #3c3c45;
  --fixture-fill: rgba(255, 255, 255, .04); --fixture-stroke: rgba(255, 255, 255, .18);
  --bench-band: #111114;

  --sh-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
  --sh-md: 0 2px 4px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .4);
  --sh-lg: 0 8px 16px rgba(0, 0, 0, .4), 0 24px 64px rgba(0, 0, 0, .55);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.icon { flex: none; display: block; }
.muted { color: var(--text-3); }
.grow { flex: 1; min-width: 0; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.sidebar {
  display: flex; flex-direction: column; gap: 24px; padding: 20px 14px 16px;
  background: var(--surface); border-inline-end: 1px solid var(--border); overflow-y: auto; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--text); text-decoration: none !important; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, #ff6b4d, var(--accent) 60%, #b8230c);
  box-shadow: 0 6px 16px -4px rgba(236, 48, 19, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-name { font: 800 15px/1.1 var(--font-display); letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }
.nav-label { padding: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; text-decoration: none; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav a.active .icon { color: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.account { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.account-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(140deg, #3f3f46, #18181b); flex: none; }
.account-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-toggle { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg-subtle); border: 1px solid var(--border); }
.theme-toggle button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--text-3); font-size: 12px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.theme-toggle button:hover { color: var(--text); }
:root:not([data-theme="dark"]) .theme-toggle .t-light,
:root[data-theme="dark"] .theme-toggle .t-dark { background: var(--surface); color: var(--text); box-shadow: var(--sh-xs); }

.main { min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.main-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.topbar { display: none; }
.scrim { display: none; }

/* ---------- Page scaffolding ---------- */
.page { padding: 28px 32px 40px; max-width: 1560px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; animation: fade-up .45s var(--ease); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.page-title { margin: 4px 0 0; font: 800 30px/1.1 var(--font-display); letter-spacing: -.02em; }
.page-sub { margin: 6px 0 0; color: var(--text-2); }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-xs); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-title { margin: 0; font-size: 14px; font-weight: 600; }
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.card-body { padding: 16px 20px 20px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; transition: transform .25s var(--ease), box-shadow .25s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--bg-subtle); color: var(--text-2); }
.kpi-icon.is-accent { background: var(--accent-soft); color: var(--accent); }
.kpi-value { font: 800 28px/1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-value small { font: 600 14px var(--font); color: var(--text-3); letter-spacing: 0; margin-inline-start: 4px; }
.kpi-meta { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid transparent; font-size: 13.5px; font-weight: 600; white-space: nowrap;
  cursor: pointer; text-decoration: none !important; user-select: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .12s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.18), 0 4px 12px -4px var(--accent-ring); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--sh-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.94); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14.5px; }
.btn-block { width: 100%; }
.icon-btn { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.is-bordered { border-color: var(--border); background: var(--surface); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text); }
.field-hint { font-size: 12px; color: var(--text-3); }
.input, .select {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; box-shadow: var(--sh-xs);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover { border-color: var(--text-3); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.input.invalid, .input.modified.invalid { border-color: var(--danger); }
.input.invalid:focus { box-shadow: 0 0 0 4px var(--danger-soft); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2385858f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon, .input-wrap > .affix { position: absolute; inset-inline-start: 12px; color: var(--text-3); pointer-events: none; }
.input-wrap > .affix { font-size: 12.5px; font-weight: 600; }
.input-wrap .input { padding-inline-start: 38px; }
.input-wrap.has-affix .input { padding-inline-start: 50px; }
.validation-message { font-size: 12.5px; color: var(--danger); display: flex; align-items: center; gap: 6px; }
.validation-errors { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }

/* Segmented choice (stations) */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 44px; text-align: start;
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s, transform .15s;
}
.choice:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-hover); }
.choice.is-current { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-ring); }
.choice:disabled { cursor: default; }
.choice-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--c, var(--st-bench)); flex: none; }
.choice.is-wide { grid-column: 1 / -1; }

/* ---------- Badges & status ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg-subtle); color: var(--text-2); border: 1px solid var(--border); }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-outline { background: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, currentColor); flex: none; }
.dot-live { position: relative; }
.dot-live::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: inherit; opacity: .35; animation: ping 1.8s var(--ease) infinite; }
.role-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--text-3); }

/* ---------- Avatars ---------- */
.avatar { position: relative; flex: none; width: var(--s, 32px); height: var(--s, 32px); border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: linear-gradient(140deg, var(--surface-hover), var(--border)); color: var(--text-2); font-weight: 700; font-size: calc(var(--s, 32px) * .36); background-size: cover; background-position: center top; box-shadow: 0 0 0 1px var(--border); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); margin-inline-start: -8px; }
.avatar-stack .avatar:first-child { margin-inline-start: 0; }
.avatar-more { background: var(--bg-subtle); color: var(--text-2); font-size: 11px; }

/* ---------- Charts ---------- */
.donut { position: relative; flex: none; width: var(--s, 64px); height: var(--s, 64px); }
.donut svg { transform: rotate(-90deg); display: block; }
.donut-track { stroke: var(--bg-subtle); }
.donut-seg { transition: stroke-dasharray .8s var(--ease), stroke-dashoffset .8s var(--ease); }
.donut-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font: 800 16px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.donut-label small { display: block; font: 500 10.5px var(--font); color: var(--text-3); margin-top: 3px; }
.stackbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-subtle); gap: 2px; }
.stackbar > span { background: var(--c); min-width: 4px; transition: flex-grow .6s var(--ease); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.barlist { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 52px; align-items: center; gap: 12px; font-size: 13px; }
.bar-name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-subtle); }
.bar-track > span { background: var(--c, var(--accent)); transition: width .7s var(--ease); }
.bar-track > span + span { opacity: .35; }
.bar-val { text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; }
.columns { display: flex; align-items: flex-end; gap: 10px; height: 132px; padding-top: 8px; }
.column { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.column-bar { width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 70%, transparent)); transition: height .7s var(--ease); min-height: 4px; }
.column-val { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.column-name { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.charts { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 16px; }
.donut-row { display: flex; align-items: center; gap: 20px; }
.donut-row .legend { flex-direction: column; gap: 8px; }
.donut-row .legend > span { justify-content: space-between; gap: 16px; }

/* ---------- Table ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .input-wrap { flex: 1 1 260px; max-width: 360px; }
.toolbar .select { width: auto; min-width: 160px; }
.toolbar-count { margin-inline-start: auto; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.table-wrap { overflow: auto; max-height: min(68vh, 760px); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
  position: sticky; top: 0; z-index: 1; text-align: start; font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 0 16px; height: 40px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl th.right, .tbl td.right { text-align: end; }
.sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.sort:hover, .sort.is-active { color: var(--text); }
.sort .icon { opacity: .5; }
.sort.is-active .icon { opacity: 1; color: var(--accent); }
.tbl td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr { cursor: pointer; transition: background .12s; }
.tbl tbody tr:hover td { background: var(--surface-hover); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.person { display: flex; align-items: center; gap: 12px; }
.person-name { font-weight: 600; color: var(--text); }
.person-sub { font-size: 12.5px; color: var(--text-3); }
.row-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.tbl tr:hover .row-actions, .tbl tr:focus-within .row-actions { opacity: 1; }

/* ---------- Empty / skeleton ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 24px; color: var(--text-2); }
.empty-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--bg-subtle); color: var(--text-3); border: 1px solid var(--border); }
.empty-state h3 { margin: 6px 0 0; font-size: 15px; color: var(--text); }
.empty-state p { margin: 0; max-width: 320px; font-size: 13px; color: var(--text-3); }
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--surface-hover) 37%, var(--bg-subtle) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }

/* ---------- Modal & drawer ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); animation: fade .2s var(--ease); }
.modal {
  position: relative; width: min(480px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--sh-lg); animation: pop .28s var(--spring);
}
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 0; }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.modal-head p { margin: 4px 0 0; font-size: 13px; color: var(--text-3); }
.modal-body { padding: 20px; overflow-y: auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--danger-soft); color: var(--danger); }
.modal-root.is-drawer { place-items: stretch end; padding: 12px; }
.is-drawer .modal { width: min(560px, 100%); max-height: none; height: calc(100vh - 24px); height: calc(100dvh - 24px); animation: slide-in .35s var(--ease); }
.is-drawer .modal-body { flex: 1; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px; padding-inline-start: 14px;
  background: var(--text); color: var(--bg); border-radius: var(--r-md); box-shadow: var(--sh-lg); font-size: 13.5px; font-weight: 500;
  animation: toast-in .35s var(--spring);
}
.toast .icon { color: var(--success); }
.toast.is-error .icon { color: #ff8a7a; }
:root[data-theme="dark"] .toast { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.toast .btn { margin-inline-start: auto; height: 28px; background: transparent; color: inherit; border: 1px solid color-mix(in srgb, currentColor 30%, transparent); }
.toast .btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.board-summary { display: grid; grid-template-columns: 1.05fr 1.6fr 1.05fr; gap: 16px; }
.summary-card { padding: 16px 18px; display: flex; align-items: center; gap: 16px; min-width: 0; }
.summary-card .grow { display: flex; flex-direction: column; gap: 8px; }
.summary-title { font-size: 13px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.summary-big { font: 800 22px/1 var(--font-display); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.summary-big small { font: 500 12.5px var(--font); color: var(--text-3); margin-inline-start: 6px; }

.branches { display: flex; align-items: stretch; gap: 8px; }
.branch-strip { flex: 1; min-width: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(168px, 1fr); gap: 8px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; padding: 2px; }
.branch-strip::-webkit-scrollbar { display: none; }
.branch {
  scroll-snap-align: start; position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; text-align: start;
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease), background .15s;
}
.branch:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--sh-sm); }
.branch.is-current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.branch.is-drop-target { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-3px) scale(1.02); box-shadow: 0 0 0 4px var(--accent-ring), var(--sh-md); }
.branch-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.branch-meta { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.meter { height: 4px; border-radius: 999px; background: var(--bg-subtle); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s var(--ease); }
.branches .icon-btn { height: auto; }

.stage-card { overflow: hidden; }
.stage-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.stage-fit { position: relative; width: 100%; overflow: hidden; background: var(--surface-2); }
.stage { position: absolute; left: 0; top: 0; width: 1000px; height: 640px; transform-origin: 0 0; user-select: none; touch-action: none; }
.stage::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 112px; background: var(--bench-band); border-bottom: 1px dashed var(--border-strong); transition: background .25s; }
.stage.over-bench::before { background: color-mix(in srgb, var(--st-bench) 22%, var(--bench-band)); }
.stage-svg { position: absolute; inset: 0; pointer-events: none; }
.tile-bg { fill: var(--floor-tile); }
.tile-line { stroke: var(--floor-line); }
.floor { fill: url(#floor-tiles); stroke: var(--floor-edge); stroke-width: 1.5; filter: drop-shadow(0 16px 22px rgba(16,16,20,.12)); }
.zone { fill: var(--zone-fill); stroke: var(--zone-stroke); stroke-width: 1.2; transition: fill .2s, stroke .2s, stroke-width .2s; }
.zone-kitchen { fill: var(--zone-kitchen); }
.zone-backup { stroke-dasharray: 6 5; }
.zone.is-hot { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: var(--accent); stroke-width: 2.5; }
.fixture { fill: var(--fixture-fill); stroke: var(--fixture-stroke); stroke-width: 1; }
.pass { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 14 9; stroke-linecap: round; animation: march 1.8s linear infinite; }
.zone-label {
  position: absolute; translate: 0 -100%; scale: var(--ts, 1); transform-origin: left bottom; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 6px; border-radius: 999px; pointer-events: none; white-space: nowrap;
  font-size: 11px; font-weight: 600; color: var(--text-2); background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--border); box-shadow: var(--sh-xs);
}
.zone-label b { color: var(--text); font-variant-numeric: tabular-nums; }
.fixture-label { position: absolute; transform: translate(-50%, -50%); font-size: 10px; font-weight: 600; letter-spacing: .04em; color: var(--text-3); pointer-events: none; white-space: nowrap; }
.bench-label { scale: var(--ts, 1); transform-origin: left top; position: absolute; left: 16px; top: 12px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); pointer-events: none; }

.token { position: absolute; display: flex; flex-direction: column; align-items: center; cursor: grab; transition: left .45s var(--spring), top .45s var(--spring); outline: none; }
.token:hover, .token.is-dragging, .token:focus-visible { z-index: 900 !important; }
.token-inner { scale: var(--ts, 1); display: flex; flex-direction: column; align-items: center; gap: 4px; animation: pop-in .5s var(--spring) both; animation-delay: var(--d, 0ms); transition: transform .22s var(--spring); }
.token:hover .token-inner { transform: translateY(-3px) scale(1.07); }
.token.is-dragging { transition: none; cursor: grabbing; }
.token.is-dragging .token-inner { transform: scale(1.16) rotate(-3deg); }
.token-ring { position: relative; width: 56px; height: 56px; border-radius: 50%; padding: 3px; box-shadow: 0 4px 12px rgba(16,16,20,.18); transition: box-shadow .2s; }
.token.is-dragging .token-ring { box-shadow: 0 18px 32px rgba(16,16,20,.32); }
.token.is-selected .token-ring { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent), 0 10px 22px var(--accent-ring); }
.token.is-selected .token-ring::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent); animation: halo 1.8s ease-out infinite; }
.ring-kitchen .token-ring { background: linear-gradient(145deg, #ff6b4d, #ec3013 55%, #a8220d); }
.ring-front .token-ring { background: linear-gradient(145deg, #ffffff, #ececef); box-shadow: 0 0 0 1px var(--border-strong), 0 4px 12px rgba(16,16,20,.16); }
.ring-bench .token-ring { background: linear-gradient(145deg, #c4c4ca, #8e8e96); }
.token-face { width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--surface); display: grid; place-items: center; background: linear-gradient(145deg, var(--surface-hover), var(--border)) center/cover; background-size: cover; background-position: center top; }
.token-face span { font-weight: 700; font-size: 15px; color: var(--text-2); }
.ring-bench .token-face { filter: saturate(.6); }
.token-label { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--sh-xs); }
.ring-kitchen .token-label { background: var(--accent); border-color: transparent; color: #fff; }
.ring-bench .token-label { color: var(--text-3); }
.token-card {
  scale: var(--ts, 1); position: absolute; bottom: calc(100% + 8px); left: 50%; width: 220px; padding: 10px; display: flex; gap: 10px; align-items: center; text-align: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-lg);
  opacity: 0; transform: translate(-50%, 6px) scale(.97); pointer-events: none; transition: opacity .15s, transform .2s var(--spring);
}
.token:hover .token-card { opacity: 1; transform: translate(-50%, 0) scale(1); transition-delay: .25s; }
.token-bench .token-card { top: calc(100% + 8px); bottom: auto; }
.stage.is-dragging-any .token-card { opacity: 0 !important; }
.token-card .avatar { --s: 52px; }
.token-card strong { display: block; font-size: 13px; line-height: 1.25; }
.token-card span { display: block; font-size: 12px; color: var(--text-3); }
.spark { position: absolute; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; z-index: 1000; background: var(--accent); animation: spark .7s var(--ease) forwards; }
.spark:nth-child(3n) { background: #ffb199; } .spark:nth-child(3n+1) { background: #fbbf24; }
.ripple { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 2px solid var(--accent); pointer-events: none; z-index: 999; animation: ripple .65s var(--ease) forwards; }
.stage-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ring-key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.ring-key.k-kitchen { background: var(--accent); } .ring-key.k-front { background: #fff; box-shadow: 0 0 0 1px var(--border-strong); } .ring-key.k-bench { background: var(--st-bench); }

/* Inspector */
.inspector { position: sticky; top: 20px; display: flex; flex-direction: column; overflow: hidden; }
.inspector-empty { padding: 40px 24px; }
.profile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 24px 20px 20px; background: radial-gradient(120% 80% at 50% 0%, var(--accent-soft), transparent 70%); border-bottom: 1px solid var(--border); animation: fade-up .3s var(--ease); }
.photo-btn { position: relative; border: 0; padding: 4px; border-radius: 50%; cursor: pointer; background: var(--ring, var(--st-bench)); box-shadow: var(--sh-md); transition: transform .25s var(--spring); }
.photo-btn:hover { transform: scale(1.03); }
.photo-btn .avatar { --s: 104px; box-shadow: 0 0 0 3px var(--surface); }
.photo-btn .avatar span { font-size: 34px; }
.photo-cta { position: absolute; inset: 4px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.5); color: #fff; font-size: 12px; font-weight: 600; opacity: 0; transition: opacity .2s; }
.photo-btn:hover .photo-cta, .photo-btn:focus-within .photo-cta { opacity: 1; }
.photo-badge { position: absolute; inset-inline-end: 2px; bottom: 6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--sh-sm); }
.photo-btn.is-busy .photo-cta { opacity: 1; }
.profile-name { margin: 0; font: 800 20px/1.2 var(--font-display); letter-spacing: -.01em; }
.profile-sub { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; color: var(--text-2); }
.section { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.section:last-child { border-bottom: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.fact { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.fact dt { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.fact dd { margin: 3px 0 0; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact.is-wide { grid-column: 1 / -1; }
.fact.is-accent dd { color: var(--accent-text); }
.transfer { display: flex; gap: 8px; }

/* ---------- Identity (sign-in) pages, restyled via _LoginPartial ---------- */
body.idp { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font); }
body.idp > header, body.idp > footer { display: none !important; }
body.idp > .container { grid-column: 2; grid-row: 1; max-width: none !important; width: 100%; padding: 0 !important; margin: 0; display: grid; place-items: center; }
.idp-hero { grid-column: 1; grid-row: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; color: #fff; background: radial-gradient(120% 90% at 0% 0%, #2a2a31 0%, #111114 60%); }
.idp-hero::after { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -180px; border-radius: 50%; background: radial-gradient(circle, rgba(236,48,19,.55), transparent 65%); filter: blur(10px); animation: drift 12s ease-in-out infinite alternate; }
.idp-hero .brand { color: #fff; position: relative; z-index: 1; }
.idp-hero .brand-sub { color: rgba(255,255,255,.55); }
.idp-copy { position: relative; z-index: 1; max-width: 460px; }
.idp-copy h2 { margin: 0 0 12px; font: 800 40px/1.08 var(--font-display); letter-spacing: -.025em; }
.idp-copy p { margin: 0; color: rgba(255,255,255,.7); font-size: 15px; }
.idp-points { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; margin: 28px 0 0; padding: 0; list-style: none; color: rgba(255,255,255,.82); font-size: 14px; }
.idp-points li { display: flex; align-items: center; gap: 10px; }
.idp-points .icon { color: #ff8a73; }
.idp-mini { position: relative; z-index: 1; display: flex; gap: 10px; }
.idp-mini span { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #ec3013; background: rgba(255,255,255,.1); display: grid; place-items: center; font-weight: 700; font-size: 13px; animation: float 4s ease-in-out infinite; }
.idp-mini span:nth-child(2) { border-color: #fff; animation-delay: .6s; } .idp-mini span:nth-child(3) { border-color: #8e8e96; animation-delay: 1.2s; } .idp-mini span:nth-child(4) { animation-delay: 1.8s; }
body.idp main { width: min(400px, calc(100vw - 40px)); padding: 40px 0 !important; animation: fade-up .5s var(--ease); }
body.idp main > h1 { margin: 0; font: 800 28px/1.15 var(--font-display); letter-spacing: -.02em; }
body.idp main > h1 + .idp-lede, .idp-lede { margin: 6px 0 28px; color: var(--text-2); }
body.idp .row { display: block; margin: 0; }
body.idp .row > [class*="col-"] { width: 100%; max-width: none; padding: 0; flex: none; }
body.idp form h2, body.idp form hr, body.idp .col-md-6 { display: none; }
body.idp hr { border-color: var(--border); }
body.idp .form-floating { position: relative; display: flex; flex-direction: column-reverse; gap: 6px; margin-bottom: 16px !important; }
body.idp .form-floating > label { position: static !important; transform: none !important; padding: 0 !important; height: auto !important; opacity: 1 !important; font-size: 13px; font-weight: 500; color: var(--text); border: 0 !important; }
body.idp .form-floating > label::after { display: none !important; }
body.idp .form-control { height: 42px !important; min-height: 0 !important; padding: 0 12px !important; border-radius: var(--r-sm) !important; border: 1px solid var(--border-strong) !important; background: var(--surface) !important; color: var(--text) !important; box-shadow: var(--sh-xs) !important; font-size: 14px; }
body.idp .form-control::placeholder { color: var(--text-3) !important; }
body.idp .form-control:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 4px var(--accent-ring) !important; outline: none; }
body.idp .text-danger, body.idp .validation-summary-errors { color: var(--danger) !important; font-size: 12.5px; }
body.idp .validation-summary-errors ul { margin: 0 0 16px; padding: 10px 12px 10px 30px; border-radius: var(--r-sm); background: var(--danger-soft); }
body.idp .checkbox label { display: inline-flex !important; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; }
body.idp .form-check-input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
body.idp .btn.btn-primary { height: 44px; border-radius: var(--r-sm); border: 0; background: var(--accent); font-weight: 600; font-size: 14.5px; box-shadow: 0 6px 16px -6px var(--accent-ring); transition: background .15s, transform .12s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
body.idp .btn.btn-primary:hover { background: var(--accent-hover); }
body.idp .btn.btn-primary:active { transform: translateY(1px); }
body.idp #account p { margin: 16px 0 0; text-align: center; font-size: 13px; }
body.idp #account a[href*="Register"], body.idp #account a[href*="ResendEmail"] { display: none; }
body.idp a { color: var(--accent-text); }
.pw-toggle { position: absolute; inset-inline-end: 6px; bottom: 5px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer; }
.pw-toggle:hover { color: var(--text); background: var(--surface-hover); }
.idp-theme { position: fixed; top: 16px; inset-inline-end: 16px; z-index: 5; }

/* ---------- Motion ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes slide-in { from { opacity: .4; transform: translateX(40px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.4) translateY(10px); } }
@keyframes halo { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.45); } }
@keyframes march { to { stroke-dashoffset: -46; } }
@keyframes spark { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.2); } }
@keyframes ripple { from { opacity: .9; transform: scale(.4); } to { opacity: 0; transform: scale(4.2); } }
@keyframes ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes drift { to { transform: translate(-60px, -40px) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .board { grid-template-columns: minmax(0, 1fr) 320px; }
  .charts { grid-template-columns: 1fr 1fr; }
  .charts > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .board { grid-template-columns: 1fr; }
  .inspector { position: static; }
  .board-summary { grid-template-columns: 1fr 1fr; }
  .board-summary > :nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--sh-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: var(--overlay); animation: fade .2s; }
  .topbar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
  .page { padding: 20px 16px 32px; }
  .charts { grid-template-columns: 1fr; }
  body.idp { grid-template-columns: 1fr; }
  .idp-hero { display: none; }
  body.idp > .container { grid-column: 1; }
}
@media (max-width: 680px) {
  .page-title { font-size: 24px; }
  .board-summary, .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .board-summary > :nth-child(2) { grid-column: 1 / -1; }
  .summary-card { padding: 14px; gap: 12px; }
  .summary-card .avatar-stack { display: none; }
  .summary-card .donut { --s: 52px !important; }
  .summary-card .donut svg { width: 52px; height: 52px; }
  .page-actions.is-status { display: none; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 92px 1fr 40px; }
  .toolbar .input-wrap { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1; min-width: 0; }
  .toolbar-count { margin-inline-start: 0; }
  .table-wrap { max-height: none; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 12px 16px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
  .tbl td { padding: 0; border: 0; white-space: normal; }
  .tbl td[data-label]:not(.cell-person)::before { content: attr(data-label) " · "; color: var(--text-3); font-size: 12px; }
  .tbl td.cell-person { grid-column: 1 / -1; }
  .tbl td.right { text-align: start; }
  .row-actions { opacity: 1; }
  .tbl tbody tr:hover td { background: transparent; }
  .tbl tbody tr:active { background: var(--surface-hover); }
  .modal-root { padding: 0; place-items: end stretch; }
  .modal { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; animation: sheet-up .35s var(--ease); }
  .modal-foot { border-radius: 0; }
  .is-drawer .modal { height: auto; max-height: 94vh; max-height: 94dvh; }
  .modal-root.is-drawer { padding: 0; place-items: end stretch; }
  .toasts { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .stage-toolbar .hint { display: none; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .5; } }

/* ---------- Skills & branches ---------- */
.skills { display: flex; flex-wrap: wrap; gap: 6px; }
.skill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; padding-inline-start: 4px; border-radius: 999px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); }
.skill-ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; }
.skill-icons { display: flex !important; gap: 4px; margin-top: 4px; }
.skill-dot { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; background: var(--c); color: #fff; font-style: normal; }
.skill-dot .icon { width: 11px; height: 11px; }
.skill-count { font-size: 12px; color: var(--text-3); margin-inline-start: 4px; font-variant-numeric: tabular-nums; }
.choice .grow { display: flex; flex-direction: column; line-height: 1.2; }
.choice-note { font-size: 11px; font-weight: 500; color: var(--warning); }
.choice-check { color: var(--success); display: grid; place-items: center; }
.choice.is-untrained:not(.is-current) .choice-icon { opacity: .55; }
.choice-box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: #fff; transition: background .15s, border-color .15s; flex: none; }
.choice.is-on { border-color: var(--accent); background: var(--accent-soft); }
.choice.is-on .choice-box { background: var(--accent); border-color: var(--accent); }
.branch-add { align-items: center; justify-content: center; flex-direction: row; gap: 8px; border-style: dashed; color: var(--text-2); font-weight: 600; font-size: 13px; background: transparent; }
.branch-add:hover { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); }
.stage-empty { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); scale: var(--ts, 1); z-index: 2; width: 360px; padding: 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-md); }
.stage-empty h3 { margin: 4px 0 0; font-size: 15px; }
.stage-empty p { margin: 0; font-size: 13px; color: var(--text-3); }
.zone.is-skill { fill: color-mix(in srgb, var(--success) 10%, transparent); stroke: var(--success); stroke-dasharray: 5 4; }
.zone.is-hot.is-untrained { fill: color-mix(in srgb, var(--warning) 18%, transparent); stroke: var(--warning); stroke-dasharray: none; }
.zone.is-hot.is-skill { fill: color-mix(in srgb, var(--success) 20%, transparent); stroke: var(--success); stroke-width: 2.5; stroke-dasharray: none; }
.toast.is-warn .icon { color: #f5b544; }
.branch-strip.is-auto-scrolling { scroll-snap-type: none; }

/* =========================================================================
   Language switch + Arabic / right-to-left
   Most of the layout already uses logical properties (start/end), so it mirrors on its own;
   what follows covers fonts, spacing for Arabic letterforms and the things that need a hand.
   ========================================================================= */
.lang-toggle button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--sh-xs); }
.lang-toggle button[lang="ar"] { font-family: "IBM Plex Sans Arabic", "Cairo", "Segoe UI", Tahoma, sans-serif; font-size: 13px; }
.topbar-lang { margin-inline-start: auto; }
.idp-lang { position: fixed; top: 16px; inset-inline-end: 64px; z-index: 5; width: auto; padding: 0 12px; font-weight: 600; font-size: 13px; }

html[lang="ar"] {
  --font: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-display: "Cairo", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
html[dir="rtl"] body { font-size: 14.5px; line-height: 1.7; font-feature-settings: normal; }
/* Letter-spacing and upper-casing break Arabic joining, so switch them off everywhere. */
html[dir="rtl"] *, html[dir="rtl"] *::before, html[dir="rtl"] *::after { letter-spacing: 0 !important; text-transform: none !important; }
/* Arabic glyphs are taller than Latin ones: give big numbers and titles room. */
html[dir="rtl"] .page-title { line-height: 1.4; }
html[dir="rtl"] .kpi-value, html[dir="rtl"] .summary-big, html[dir="rtl"] .brand-name,
html[dir="rtl"] .donut-label, html[dir="rtl"] .modal-head h2 { line-height: 1.35; }
html[dir="rtl"] .idp-copy h2, html[dir="rtl"] body.idp main > h1 { line-height: 1.35; }
html[dir="rtl"] .brand-sub, html[dir="rtl"] .card-sub, html[dir="rtl"] .person-sub, html[dir="rtl"] .kpi-meta,
html[dir="rtl"] .hint, html[dir="rtl"] .branch-meta, html[dir="rtl"] .field-hint { font-size: 13px; }

/* Arrows and chevrons that point "forward" must point the other way */
html[dir="rtl"] .flip-rtl .icon { transform: scaleX(-1); }

/* Dropdown arrow moves to the start side */
html[dir="rtl"] .select { padding-right: 12px; padding-left: 34px; background-position: left 10px center; }

/* Latin e-mail addresses inside the RTL account card: keep them readable and cut off at the end, not the start */
html[dir="rtl"] .account-name { unicode-bidi: plaintext; text-align: right; }

/* Charts read from the right; the ring starts at 12 o'clock and runs anticlockwise */
html[dir="rtl"] .donut svg { transform: scaleX(-1) rotate(-90deg); }

/* Floor plan: the geometry itself is mirrored in code; only the little labels need anchoring on the other side */
html[dir="rtl"] .zone-label { translate: -100% -100%; transform-origin: right bottom; padding: 3px 6px 3px 8px; font-size: 12px; }
html[dir="rtl"] .bench-label { left: auto; right: 16px; transform-origin: right top; }
html[dir="rtl"] .token-label { font-size: 11.5px; }
html[dir="rtl"] .fixture-label { font-size: 11px; }

/* Drawer enters from the left edge in RTL */
@keyframes slide-in-rtl { from { opacity: .4; transform: translateX(-40px); } }
html[dir="rtl"] .is-drawer .modal { animation-name: slide-in-rtl; }

/* Sign-in page */
html[dir="rtl"] body.idp .validation-summary-errors ul { padding: 10px 30px 10px 12px; }
html[dir="rtl"] .idp-hero { background: radial-gradient(120% 90% at 100% 0%, #2a2a31 0%, #111114 60%); }
html[dir="rtl"] .idp-hero::after { right: auto; left: -160px; }

/* Slide-out menu on phones comes from the right */
@media (max-width: 960px) {
  html[dir="rtl"] .sidebar { inset: 0 0 0 auto; transform: translateX(100%); }
  html[dir="rtl"] .app.nav-open .sidebar { transform: none; }
}

/* =========================================================================
   Branch Duty upgrade: status, duty states, global filter, work areas, schedules
   ========================================================================= */
:root {
  --vac: #2563eb; --vac-soft: #e8f0fe;
  --half: #9333ea; --half-soft: #f4e9fd;
  --split: #0e7490; --split-soft: #e0f4f8;
  --off: #6b6b76; --off-soft: #efeff1;
}
:root[data-theme="dark"] {
  --vac: #7ab0ff; --vac-soft: rgba(122, 176, 255, .14);
  --half: #c792ff; --half-soft: rgba(199, 146, 255, .14);
  --split: #4fd1e8; --split-soft: rgba(79, 209, 232, .13);
  --off: #9a9aa6; --off-soft: rgba(255, 255, 255, .06);
}

/* ---------- Badges: employee status and duty state ---------- */
.status-badge, .duty-badge, .chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; line-height: 1;
}
.status-badge.is-active { background: var(--success-soft); color: var(--success); }
.status-badge.is-vacation { background: var(--vac-soft); color: var(--vac); }
.duty-badge.tone-on { background: var(--success-soft); color: var(--success); }
.duty-badge.tone-wait { background: var(--warning-soft); color: var(--warning); }
.duty-badge.tone-done { background: var(--off-soft); color: var(--text-2); }
.duty-badge.tone-off { background: var(--off-soft); color: var(--off); }
.duty-badge.tone-vac { background: var(--vac-soft); color: var(--vac); }
.duty-badge.tone-half { background: var(--half-soft); color: var(--half); }
.duty-badge.tone-split { background: var(--split-soft); color: var(--split); }
.badge-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.chip { background: var(--bg-subtle); color: var(--text-2); border-color: var(--border); }
.chip-split { background: var(--split-soft); color: var(--split); border-color: transparent; }
.chip-remove { cursor: pointer; background: var(--accent-soft); color: var(--accent-text); border-color: transparent; transition: filter .15s, transform .15s; }
.chip-remove:hover { filter: brightness(.96); transform: translateY(-1px); }
.chip-remove b { font-weight: 700; }
.kpi-icon.is-success { background: var(--success-soft); color: var(--success); }
.kpi-icon.is-vac { background: var(--vac-soft); color: var(--vac); }
.area-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); white-space: nowrap; }
.area-chip .icon { color: var(--c); }
.area-chip small { font-weight: 500; color: var(--text-3); }
.dot[style*="--vac"] { background: var(--vac); }

/* ---------- Segmented control ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg-subtle); border: 1px solid var(--border); max-width: 100%; }
.seg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-on { background: var(--surface); color: var(--text); box-shadow: var(--sh-xs); }
.seg-btn.s-active.is-on { color: var(--success); }
.seg-btn.s-vacation.is-on { color: var(--vac); }
.seg-btn b { font-weight: 600; color: var(--text-3); font-size: 11.5px; }
.seg-btn.k-working.is-on { color: var(--success); }
.seg-btn.k-halfday.is-on { color: var(--half); }
.seg-btn.k-dayoff.is-on { color: var(--off); }
.day-seg .seg-btn { padding: 0 9px; position: relative; }
.day-seg .seg-btn.is-today::after { content: ""; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.page-actions.is-status { flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Global filter bar ---------- */
.filterbar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-xs); padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; transition: border-color .2s, box-shadow .2s; }
.filterbar.is-active { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 0 0 3px var(--accent-ring), var(--sh-xs); }
.fb-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; }
.fb-title { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; align-self: center; }
.fb-n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-inline-start: 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.fb-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fb-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.fb-field .select { height: 34px; min-width: 170px; }
.fb-count { margin-inline-start: auto; font-size: 12.5px; color: var(--text-3); align-self: center; white-space: nowrap; }
.fb-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; padding-top: 10px; border-top: 1px dashed var(--border); animation: fade-up .25s var(--ease); }
.fb-chips .chip { height: 26px; }

/* ---------- Branch Duty page ---------- */
.duty-summary { display: grid; grid-template-columns: .9fr 1.15fr 1.4fr 1fr; gap: 16px; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); }
.mini-stats.subtle { color: var(--text-3); font-size: 12px; }
.mini { display: inline-flex; align-items: center; gap: 6px; }
.mini b { color: var(--text); font-weight: 700; }
.mini-stats:not(.subtle) .mini b { font-size: 16px; }
.branch-all { border-style: solid; }
.branch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.branch-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; text-align: start; cursor: pointer; color: var(--text); transition: transform .2s var(--ease), box-shadow .2s, border-color .15s; }
.branch-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--border-strong); }
.bc-head { display: flex; align-items: center; justify-content: space-between; }
.bc-head h3 { margin: 0; font: 700 16px/1.2 var(--font-display); }
.bc-open { color: var(--text-3); display: grid; transition: transform .2s var(--ease), color .15s; }
.branch-card:hover .bc-open { color: var(--accent); transform: translateX(3px); }
html[dir="rtl"] .branch-card:hover .bc-open { transform: translateX(-3px); }
.bc-nums { display: flex; align-items: baseline; gap: 10px; }
.bc-big { font: 800 28px/1 var(--font-display); }
.bc-big small { font: 600 14px var(--font); color: var(--text-3); margin-inline-start: 4px; }
.bc-badges { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.bc-areas { display: flex; flex-wrap: wrap; gap: 6px; }
.bc-area { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: color-mix(in srgb, var(--c) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); max-width: 100%; }
.bc-area .icon { color: var(--c); }
.bc-area span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.bc-area b { font-variant-numeric: tabular-nums; }

/* ---------- Floor: areas tinted with their own colour ---------- */
.zone { fill: color-mix(in srgb, var(--ac, #888) 5%, transparent); stroke: color-mix(in srgb, var(--ac, #888) 45%, var(--zone-stroke)); }
.zone-kitchen { fill: color-mix(in srgb, var(--ac, #888) 9%, transparent); }
.zone.is-dim { opacity: .28; }
.zone-label.is-dim, .fixture-label.is-dim { opacity: .4; }
.zone-label .of { color: var(--text-3); font-weight: 500; }
.fixture-label { z-index: 1; }
.stage.is-dragging-any .zone:not(.is-hot):not(.is-skill) { stroke-dasharray: 5 4; stroke: color-mix(in srgb, var(--accent) 55%, var(--zone-stroke)); }
.token-ghost { opacity: .32; filter: grayscale(1); pointer-events: none !important; transition: none !important; }
.token-ghost .token-card { display: none; }
.token-ghost .token-inner { animation: none; }
.stage-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.is-on { background: var(--accent); color: #fff; border-color: transparent; }
.btn.is-on:hover:not(:disabled) { background: var(--accent-hover); }
.btn .fb-n { margin-inline-start: 2px; }
.layout-banner { display: flex; align-items: center; gap: 8px; padding: 9px 16px; font-size: 12.5px; background: var(--accent-soft); color: var(--accent-text); border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.stage.is-layout .zone { stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 6 4; }
.stage.is-layout .zone.is-bad { stroke: var(--danger); fill: var(--danger-soft); }
.stage.is-layout .token { pointer-events: none; opacity: .5; }
.area-grip {
  position: absolute; z-index: 960; translate: -50% -50%; scale: var(--ts, 1); display: inline-flex; align-items: center; gap: 6px; max-width: 220px; height: 28px; padding: 0 12px 0 8px;
  border-radius: 999px; background: var(--surface); color: var(--text); border: 1.5px solid var(--accent); box-shadow: var(--sh-md);
  font-size: 11.5px; font-weight: 700; cursor: move; touch-action: none;
}
.area-grip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-grip .icon { color: var(--accent); }
.area-resize { position: absolute; z-index: 961; translate: -50% -50%; scale: var(--ts, 1); width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: var(--sh-md); cursor: nwse-resize; touch-action: none; }
html[dir="rtl"] .area-resize { cursor: nesw-resize; }
.area-grip:hover, .area-resize:hover { filter: brightness(1.05); }

/* ---------- Tokens: duty state markers ---------- */
.token-state { position: absolute; inset-inline-end: -3px; bottom: -3px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 2px solid var(--surface); box-shadow: var(--sh-xs); }
.token-state.tone-on { background: var(--success); }
.token-state.tone-wait { background: var(--warning); }
.token-state.tone-done { background: var(--off); }
.token-state.tone-off { background: var(--off); }
.token-state.tone-vac { background: var(--vac); }
.token-half { position: absolute; inset-inline-start: -3px; bottom: -3px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--half); border: 2px solid var(--surface); box-shadow: var(--sh-xs); }
.token.is-off .token-face { filter: saturate(.55); }
.token.is-off .token-inner { opacity: .72; }
.token.is-off:hover .token-inner, .token.is-selected .token-inner { opacity: 1; }
.token-card .tc-duty { font-weight: 600; }
.token-card .tc-duty.tone-on { color: var(--success); }
.token-card .tc-duty.tone-wait { color: var(--warning); }
.token-card .tc-duty.tone-vac { color: var(--vac); }
.token-card > div { min-width: 0; }
.tstate { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.tstate.tone-on { background: var(--success); } .tstate.tone-wait { background: var(--warning); } .tstate.tone-off { background: var(--off); } .tstate.tone-vac { background: var(--vac); }
.bench-label .more { color: var(--text-3); font-weight: 500; }
html[dir="rtl"] .area-grip { padding: 0 8px 0 12px; }

/* ---------- Roster ---------- */
.roster-search { flex: 0 1 280px; }
.roster .card-head { flex-wrap: wrap; }
.roster-tbl tbody tr.is-selected td { background: var(--accent-soft); }
.roster-more { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--border); }
.roster-tbl td { white-space: nowrap; }

/* ---------- Status picker ---------- */
.status-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.status-pick.compact { gap: 8px; }
.status-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: start; border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.status-opt:hover:not(:disabled):not(.is-on) { border-color: var(--border-strong); background: var(--surface-hover); }
.status-opt:disabled { cursor: default; }
.status-opt .grow { display: flex; flex-direction: column; gap: 2px; }
.status-opt b { font-size: 13.5px; }
.status-opt small { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.status-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.status-opt.is-active .status-ic { background: var(--success-soft); color: var(--success); }
.status-opt.is-vacation .status-ic { background: var(--vac-soft); color: var(--vac); }
.status-opt.is-active.is-on { border-color: var(--success); background: var(--success-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }
.status-opt.is-vacation.is-on { border-color: var(--vac); background: var(--vac-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vac) 18%, transparent); }
.status-pick.compact .status-opt { padding: 9px 12px; }
.status-pick.compact .status-ic { width: 28px; height: 28px; }

/* ---------- Weekly schedule editor ---------- */
.week-editor { display: flex; flex-direction: column; gap: 10px; }
.week-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.week-presets { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-inline-start: auto; font-size: 12px; }
.week-day { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, background .15s; border-inline-start: 4px solid var(--success); }
.week-day.kind-halfday { border-inline-start-color: var(--half); }
.week-day.kind-dayoff { border-inline-start-color: var(--off); background: var(--surface-2); }
.week-day.is-today { box-shadow: 0 0 0 2px var(--accent-ring); }
.wd-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wd-name { font-weight: 700; font-size: 13.5px; min-width: 96px; display: inline-flex; align-items: center; gap: 8px; }
.today-tag { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); }
.wd-total { margin-inline-start: auto; font-weight: 700; color: var(--text-2); font-size: 13px; }
.wd-body { display: flex; flex-direction: column; gap: 8px; }
.wd-periods { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.period { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 6px; border-radius: 10px; background: var(--bg-subtle); border: 1px solid transparent; }
.period.is-bad { border-color: var(--danger); background: var(--danger-soft); }
.period .icon-btn { width: 26px; height: 26px; }
.input.time { width: 112px; height: 32px; padding: 0 8px; text-align: center; font-variant-numeric: tabular-nums; }
.period-len { font-size: 12px; min-width: 42px; text-align: center; }
.tl { position: relative; height: 8px; border-radius: 999px; background: var(--bg-subtle); overflow: hidden; }
.tl-seg { position: absolute; top: 0; bottom: 0; background: var(--success); border-radius: 999px; min-width: 3px; }
.week-day.kind-halfday .tl-seg { background: var(--half); }
.tl-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--surface); opacity: .8; }
.wd-off { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; }
.week-day .validation-message { margin-top: -2px; }

/* ---------- Week strip (read-only) ---------- */
.week-strip { display: flex; flex-direction: column; gap: 4px; }
.ws-day { display: grid; grid-template-columns: 38px 22px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; font-size: 12.5px; background: var(--surface-2); border: 1px solid transparent; }
.ws-day.is-today { border-color: var(--accent); background: var(--accent-soft); }
.ws-name { font-weight: 700; color: var(--text-2); }
.ws-mark { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: #fff; }
.ws-work .ws-mark { background: var(--success); }
.ws-half .ws-mark { background: var(--half); }
.ws-off .ws-mark { background: var(--off); }
.ws-vac .ws-mark { background: var(--vac); }
.ws-hours { text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[dir="rtl"] .ws-hours { text-align: right; }
.ws-split { color: var(--split); display: grid; }

/* ---------- Forms, banners ---------- */
.modal-root.is-wide .modal { width: min(720px, 100%); }
.foot-error { margin-inline-end: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--danger); font-size: 12.5px; max-width: 60%; }
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin-bottom: 14px; border-radius: var(--r-md); font-size: 13px; }
.banner .icon { margin-top: 2px; }
.banner.is-error { background: var(--danger-soft); color: var(--danger); }
.banner.is-warn { background: var(--warning-soft); color: var(--warning); }
.modal-icon.is-warn { background: var(--warning-soft); color: var(--warning); }
.card-soft { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; }

/* ---------- Work area manager ---------- */
.area-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.area-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); transition: opacity .2s, background .2s; flex-wrap: wrap; }
.area-row.is-hidden { background: var(--surface-2); border-style: dashed; }
.area-row.is-hidden .area-swatch, .area-row.is-hidden .area-name { opacity: .55; }
.area-swatch { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--c); flex: none; }
.area-main { flex: 1 1 160px; min-width: 0; }
.area-name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.area-meta { font-size: 12px; color: var(--text-3); }
.area-meta .keep { color: var(--vac); }
.area-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-inline-start: auto; }
.area-form .form-section-title { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.area-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; transition: transform .15s var(--spring), box-shadow .15s; }
.swatch:hover { transform: scale(1.12); }
.swatch.is-on { box-shadow: 0 0 0 2px var(--accent); transform: scale(1.1); }
.swatch-ic { width: 34px; height: 34px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-2); transition: border-color .15s, background .15s; }
.swatch-ic:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.swatch-ic.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Right-click menu ---------- */
.ctx-backdrop { position: fixed; inset: 0; z-index: 150; }
.ctxmenu { position: fixed; z-index: 160; width: 236px; max-height: min(80vh, 520px); overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-lg); animation: menu-in .16s var(--ease) both; }
@keyframes menu-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
.ctx-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ctx-head b { display: block; font-size: 13px; line-height: 1.2; }
.ctx-head small { display: block; font-size: 11.5px; color: var(--text-3); }
.ctx-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 13px; text-align: start; cursor: pointer; }
.ctx-item:hover:not(:disabled) { background: var(--surface-hover); }
.ctx-item:disabled { opacity: .4; cursor: default; }
.ctx-item .choice-note { margin-inline-start: auto; }
.ctx-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ---------- Dashboard charts ---------- */
.charts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.charts > .span-2 { grid-column: span 2; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bar-track.seg3 > span:nth-child(1) { background: var(--success); opacity: 1; }
.bar-track.seg3 > span:nth-child(2) { background: var(--text-3); opacity: .45; }
.bar-track.seg3 > span:nth-child(3) { background: var(--vac); opacity: 1; }
.week-cols { height: 150px; }
.week-cols .column.is-today .column-bar { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000)); }
.week-cols .column.is-today .column-name { color: var(--accent-text); font-weight: 700; }

/* ---------- Responsive additions ---------- */
@media (max-width: 1280px) {
  .duty-summary { grid-template-columns: 1fr 1fr; }
  .charts { grid-template-columns: 1fr 1fr; }
  .charts > :first-child { grid-column: auto; }
  .charts > .span-2 { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .charts { grid-template-columns: 1fr; }
  .charts > .span-2 { grid-column: auto; }
  .fb-count { margin-inline-start: 0; }
  .week-presets { margin-inline-start: 0; }
}
@media (max-width: 680px) {
  .duty-summary { grid-template-columns: 1fr 1fr; gap: 10px; }
  .page-actions.is-status { display: flex; width: 100%; justify-content: space-between; }
  .page-actions.is-status .badge { display: none; }
  .day-seg { overflow-x: auto; scrollbar-width: none; }
  .fb-field { flex: 1 1 140px; }
  .fb-field .select { width: 100%; min-width: 0; }
  .fb-field .seg { width: 100%; }
  .fb-field .seg .seg-btn { flex: 1; padding: 0 6px; }
  .status-pick { grid-template-columns: 1fr; }
  .wd-name { min-width: 0; }
  .wd-total { margin-inline-start: 0; }
  .input.time { width: 100px; }
  .roster-search { flex-basis: 100%; }
  .roster-tbl td { white-space: normal; }
  .area-actions { margin-inline-start: 0; width: 100%; }
  .foot-error { max-width: 100%; margin-inline-end: 0; }
  .modal-foot { flex-wrap: wrap; }
  .ctxmenu { width: min(260px, 92vw); }
}

/* ---------- Shift report and annual leave planner ---------- */
.week-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.week-label { display: flex; flex-direction: column; min-width: 190px; text-align: center; }
.week-label b { font-size: 15px; }
.week-pick { width: auto; min-width: 150px; }
.year-pick { display: inline-flex; align-items: center; gap: 8px; }
.year-label { font-size: 17px; min-width: 52px; text-align: center; }

.report-card { padding: 0; overflow: hidden; }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.report-head h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.report-wrap { max-height: none; }
.rep-tbl tbody tr { cursor: default; }
.rep-tbl td, .rep-tbl th { padding: 9px 10px; }
.rep-person { min-width: 220px; position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }
.rep-day { text-align: center; min-width: 108px; }
.rep-day span { display: block; font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.rep-day b { font-size: 14px; }
.rep-day.is-today { color: var(--accent); }
.rep-cell { text-align: center; vertical-align: middle; }
.rep-cell.is-today, .rep-day.is-today { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.rep-total { font-weight: 700; }
.rep-tbl tfoot th { border-top: 1px solid var(--border); background: var(--bg-subtle); font-size: 12.5px; }
.rc { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 8px; border-radius: 8px; font-size: 12.5px; line-height: 1.25; }
.rc-work { background: var(--bg-subtle); color: var(--text); }
.rc-half { background: var(--half-soft); color: var(--half); }
.rc-off { background: transparent; color: var(--text-3); border: 1px dashed var(--border); flex-direction: row; }
.rc-leave { background: var(--vac-soft); color: var(--vac); flex-direction: row; gap: 5px; font-weight: 600; }
.rc-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; opacity: .85; }
.rc-tag.is-split { color: var(--accent); }
.rep-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: var(--text-3); }
.rep-legend .rc { flex-direction: row; gap: 5px; }
.rep-note { margin: 0; font-size: 12px; color: var(--text-3); }

.leave-page .card-head, .vision-page .card-head { align-items: flex-start; padding: 16px 16px 8px; }
.leave-page .card-head, .vision-page .card-head h2 { margin: 0; font-size: 15px; }
.leave-page .card-head, .vision-page .card-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); }
.switch-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap; }

.away-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; padding: 8px 16px 18px; }
.away-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.away-dates { display: flex; align-items: center; gap: 10px; }
.away-dates > div:not(.away-arrow) { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.away-dates b { font-size: 13.5px; }
.away-dates.is-missing { color: var(--warning); gap: 8px; font-size: 13px; }
.away-arrow { color: var(--text-3); display: grid; place-items: center; }
.away-bar { height: 6px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; }
.away-bar span { display: block; height: 100%; background: var(--vac); border-radius: 99px; }
.away-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.away-foot .icon-btn, .away-foot .btn { margin-inline-start: auto; }
.badge.tone-vac { background: var(--vac-soft); color: var(--vac); border-color: transparent; }
.badge.tone-wait { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.badge.tone-done { background: var(--bg-subtle); color: var(--text-3); }
.leave-mini { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg-subtle); }
.leave-mini > div:not(.away-arrow) { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: 13px; }
.leave-mini.is-active { background: var(--vac-soft); }
.leave-mini.is-missing { color: var(--text-2); font-size: 12.5px; gap: 8px; }
.section-link { margin-inline-start: auto; font-size: 12px; color: var(--accent); text-decoration: none; }
.leave-summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: 4px 0 12px; border-radius: 12px; background: var(--vac-soft); color: var(--vac); font-size: 13px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.ly-scroll { overflow-x: auto; padding: 0 16px 16px; }
.ly { min-width: 860px; }
.ly-row { display: grid; grid-template-columns: 220px 1fr; align-items: center; border-top: 1px solid var(--border); }
.ly-row.ly-head { border-top: 0; }
.ly-name { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 0; min-width: 0; }
.ly-name .person-name, .ly-name .person-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ly-add { opacity: 0; transition: opacity .12s; }
.ly-row:hover .ly-add, .ly-add:focus-visible { opacity: 1; }
.ly-track { position: relative; height: 38px; }
.ly-head .ly-track, .ly-foot .ly-track { height: 30px; }
.ly-month { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.ly-month.is-zero { opacity: .35; }
.ly-foot .ly-month { color: var(--text-2); font-size: 12.5px; }
.ly-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.ly-today { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--accent); z-index: 2; border-radius: 2px; }
.ly-bar { position: absolute; top: 9px; height: 20px; border: 0; padding: 0; border-radius: 7px; background: var(--vac); cursor: pointer; z-index: 1; transition: transform .12s, filter .12s; min-width: 6px; }
.ly-bar:hover:not(:disabled) { filter: brightness(1.1); transform: scaleY(1.15); }
.ly-bar:disabled { cursor: default; }
.ly-bar.st-onleave { background: var(--accent); }
.ly-bar.st-past { background: var(--text-3); opacity: .55; }

@media (max-width: 720px) {
  .week-label { min-width: 0; flex: 1; }
  .field-row { grid-template-columns: 1fr; }
  .ly-row { grid-template-columns: 150px 1fr; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .sidebar, .topbar, .scrim, .no-print, .toasts, .week-bar { display: none !important; }
  .app, .main, .main-scroll { display: block !important; height: auto !important; overflow: visible !important; }
  body { background: #fff !important; }
  .page { padding: 0 !important; max-width: none !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; margin-bottom: 10px; }
  .rep-person { position: static !important; }
  .rep-tbl td, .rep-tbl th { padding: 4px 5px !important; font-size: 10.5px !important; }
  .rc { padding: 2px 4px !important; font-size: 10px !important; }
  .table-wrap { overflow: visible !important; max-height: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* The weekly grid stays a real table on phones (it scrolls sideways) instead of turning into cards. */
@media (max-width: 860px) {
  .rep-grid { display: table; width: max-content; min-width: 100%; }
  .rep-grid thead { display: table-header-group; }
  .rep-grid tbody { display: table-row-group; }
  .rep-grid tfoot { display: table-footer-group; }
  .rep-grid tr { display: table-row; padding: 0; border: 0; }
  .rep-grid th, .rep-grid td { display: table-cell; width: auto; padding: 8px 8px; white-space: nowrap; }
  .rep-grid td::before { content: none !important; }
  .rep-grid .rep-person { min-width: 190px; }
  .rep-grid .rep-day { min-width: 104px; }
  .week-label b { white-space: nowrap; font-size: 14px; }
  .week-pick { flex: 1 1 100%; }
}

/* ---------- Camera tracking pilot ---------- */
.vision-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.vision-side { display: flex; flex-direction: column; gap: 16px; }
.vision-map-card { padding-bottom: 8px; position: relative; }
.vmap { display: block; width: 100%; height: auto; }
.vm-floor { fill: var(--bg-subtle); stroke: var(--border-strong); stroke-width: 1.2; }
.vm-zone { fill: color-mix(in srgb, var(--ac) 16%, transparent); stroke: color-mix(in srgb, var(--ac) 55%, transparent); stroke-width: 1.2; }
.vm-label { font-size: 13px; font-weight: 600; fill: var(--text-2); pointer-events: none; }
.vm-core { fill: var(--text-3); stroke: var(--surface); stroke-width: 2.5; }
.vm-dot.is-linked .vm-core { fill: var(--accent); }
.vm-pulse { fill: var(--accent); opacity: .25; transform-box: fill-box; transform-origin: center; animation: vm-pulse 1.8s ease-out infinite; }
.vm-dot:not(.is-linked) .vm-pulse { fill: var(--text-3); }
.vm-init { font-size: 11px; font-weight: 700; fill: #fff; pointer-events: none; }
.vm-tag { font-size: 12px; font-weight: 600; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; pointer-events: none; }
.vm-dot { transition: transform .9s linear; }
.vmap-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-size: 14px; }
@keyframes vm-pulse { 0% { transform: scale(1); opacity: .35; } 100% { transform: scale(2.2); opacity: 0; } }

.cam-list { list-style: none; margin: 0; padding: 0 16px 12px; display: flex; flex-direction: column; }
.cam-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.cam-item:first-child { border-top: 0; }
.cam-item .row-actions { opacity: 1; }          /* the edit and delete buttons were hidden until a table row was hovered; a camera is not a table row */
.cam-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warning); flex: none; }
.cam-dot.is-on { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.cam-dot.is-off { background: var(--text-3); }
.setup-help { padding: 0 16px 16px; }
.setup-help p { margin: 0 0 8px; font-size: 12.5px; }
.setup-help code { display: block; padding: 10px 12px; border-radius: 10px; background: var(--bg-subtle); font-size: 12px; overflow-x: auto; white-space: nowrap; }
.walk-list { list-style: none; margin: 0; padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.walk-list li { display: flex; align-items: center; gap: 10px; }
.walk-bar { height: 5px; margin-top: 4px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; }
.walk-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.token.token-live { transition: left 1s linear, top 1s linear; }
.token-livedot { position: absolute; inset-inline-end: 1px; top: 1px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid var(--surface); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: live-pulse 1.6s ease-out infinite; z-index: 3; }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.token-walk { position: absolute; top: -10px; inset-inline-start: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 99px; font-size: 10.5px; font-weight: 700; white-space: nowrap; background: var(--text); color: var(--surface); box-shadow: var(--sh-xs); z-index: 3; }
html[dir="rtl"] .token-walk { transform: translateX(50%); }
@media (max-width: 960px) { .vision-grid { grid-template-columns: 1fr; } }
.vision-page .page-sub { max-width: 62ch; }
.setup-help code { white-space: pre-wrap; word-break: break-all; }
