/* ==========================================================================
   FleetDesk — design tokens
   Base UI is monochrome (black / white). Colour is reserved for data visuals.
   Layouts: desktop (sidebar) · tablet (icon rail) · phone (top bar + tab bar,
   cards instead of tables, bottom sheets instead of dialogs).
   ========================================================================== */
:root {
  /* Light (default) */
  --bg: #f7f7f5;
  --bg-blur: rgba(247, 247, 245, 0.82);
  --panel: #ffffff;
  --panel-2: #f4f4f2;
  --panel-3: #ebebe8;
  --line: rgba(10, 10, 10, 0.08);
  --line-2: rgba(10, 10, 10, 0.13);
  --line-3: rgba(10, 10, 10, 0.24);
  --text: #0a0a0a;
  --muted: #56565d;
  --faint: #8e8e95;
  --ink: #0a0a0a;
  --ink-inv: #ffffff;
  --soft: rgba(10, 10, 10, 0.05);
  --ring: rgba(10, 10, 10, 0.1);
  --hover: rgba(10, 10, 10, 0.04);
  --hover-2: rgba(10, 10, 10, 0.06);
  --hover-soft: rgba(10, 10, 10, 0.02);
  --track: rgba(10, 10, 10, 0.06);
  --switch-off: rgba(10, 10, 10, 0.16);
  --sidebar-bg: rgba(255, 255, 255, 0.75);
  --backdrop: rgba(10, 10, 12, 0.32);
  --shadow: 0 1px 2px rgba(10, 10, 10, 0.04), 0 16px 36px -20px rgba(10, 10, 10, 0.22);
  --shadow-lg: 0 40px 80px -30px rgba(10, 10, 10, 0.35);

  /* Buttons: black in light mode */
  --btn-bg: linear-gradient(180deg, #2a2a2e 0%, #0a0a0b 100%);
  --btn-text: #ffffff;
  --btn-shadow: 0 10px 22px -12px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --green: #0f5c45;
  --green-2: #137a5b;
  --green-soft: rgba(15, 92, 69, 0.1);
  --green-ink: #0f5c45;

  /* Brand (logo only) */
  --brand-grad: linear-gradient(135deg, #8b6cff 0%, #5b8cff 55%, #22d3ee 100%);
  --brand: #7c5cff;

  /* Data-visual palette */
  --c-indigo: #5b5bd6;
  --c-teal: #0e9f8e;
  --c-amber: #d4911c;
  --c-rose: #e0526b;
  --c-emerald: #1f9d6b;
  --vehicles: linear-gradient(90deg, #4f46e5, #7c7cf0);
  --drivers: linear-gradient(90deg, #0d8f80, #2cc5b0);
  --leave: #e3a032;
  --leave-ink: #a86a0b;
  --leave-soft: rgba(227, 160, 50, 0.14);
  --idle-ink: #4f46e5;
  --heat: 227, 160, 50;

  --ok: #0f7a55;
  --danger: #d43c58;
  --danger-soft: rgba(212, 60, 88, 0.1);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #09090a;
  --bg-blur: rgba(9, 9, 10, 0.8);
  --panel: #111113;
  --panel-2: #17171a;
  --panel-3: #1f1f23;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-3: rgba(255, 255, 255, 0.22);
  --text: #f4f4f3;
  --muted: #a3a3ab;
  --faint: #6c6c75;
  --ink: #fafafa;
  --ink-inv: #0a0a0b;
  --soft: rgba(255, 255, 255, 0.06);
  --ring: rgba(255, 255, 255, 0.12);
  --hover: rgba(255, 255, 255, 0.04);
  --hover-2: rgba(255, 255, 255, 0.07);
  --hover-soft: rgba(255, 255, 255, 0.02);
  --track: rgba(255, 255, 255, 0.06);
  --switch-off: rgba(255, 255, 255, 0.14);
  --sidebar-bg: rgba(9, 9, 10, 0.7);
  --backdrop: rgba(0, 0, 0, 0.6);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 24px 48px -24px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 40px 80px -20px rgba(0, 0, 0, 0.85);

  /* Buttons: deep green in dark mode */
  --btn-bg: linear-gradient(180deg, #17795a 0%, #0d4c39 100%);
  --btn-shadow: 0 10px 24px -12px rgba(16, 122, 88, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --green: #17795a;
  --green-2: #1f9670;
  --green-soft: rgba(31, 150, 112, 0.16);
  --green-ink: #5fd3a6;

  --c-indigo: #8b8cf6;
  --c-teal: #2dd4bf;
  --c-amber: #f2b552;
  --c-rose: #f47a8e;
  --c-emerald: #4ade9b;
  --vehicles: linear-gradient(90deg, #5b5bd6, #8b8cf6);
  --drivers: linear-gradient(90deg, #119c8b, #2dd4bf);
  --leave: #f0ae45;
  --leave-ink: #f6c46f;
  --leave-soft: rgba(240, 174, 69, 0.14);
  --idle-ink: #a5a6fa;
  --heat: 240, 174, 69;

  --ok: #4ade9b;
  --danger: #f47a8e;
  --danger-soft: rgba(244, 122, 142, 0.12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'cv11', 'ss01';
}
body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { touch-action: manipulation; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.faint { color: var(--faint); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

.i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.i.xs { width: 13px; height: 13px; stroke-width: 2.2; }
.i.lg { width: 26px; height: 26px; stroke-width: 1.6; }
.i.chev { margin-left: auto; color: var(--faint); }

.booting { min-height: 100vh; display: grid; place-items: center; }
.boot-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--ink);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Brand
   ========================================================================== */
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; text-decoration: none; }
.logo {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand-grad); color: #6b78ff;
  box-shadow: 0 8px 18px -8px rgba(110, 108, 255, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.logo-glyph { width: 21px; height: 21px; }
.wordmark { font-size: 19px; font-weight: 700; letter-spacing: -0.04em; color: var(--text); line-height: 1; }
.wordmark i { font-style: normal; color: var(--brand); }

.footnote {
  display: flex; align-items: center; gap: 6px; margin-top: 36px;
  font-size: 12px; font-weight: 600; color: var(--faint); letter-spacing: -0.01em;
}
.footnote .i { width: 11px; height: 11px; stroke-width: 2.2; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: transform 0.15s var(--ease), background 0.15s, border-color 0.15s, box-shadow 0.2s, filter 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--panel-2); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; height: 46px; font-size: 14.5px; }

.btn.primary { border-color: transparent; background: var(--btn-bg); color: var(--btn-text); box-shadow: var(--btn-shadow); }
.btn.primary:hover { filter: brightness(1.15); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--hover); }
.btn.danger { border-color: transparent; background: #c8304d; color: #fff; }
.btn.danger:hover { background: #dc3d5b; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--hover-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.link-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; text-decoration: underline;
  text-decoration-color: var(--line-3); text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: currentColor; }

kbd {
  font-family: var(--font); font-size: 11px; font-weight: 600; color: var(--faint);
  padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2);
}

/* ==========================================================================
   Shell (desktop)
   ========================================================================== */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 26px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  backdrop-filter: blur(16px);
  z-index: 5;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--hover); }
.nav-link.active { color: var(--ink); background: var(--soft); font-weight: 600; }
.nav-link.active::before {
  content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--ink);
}
.nav-badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
  color: var(--leave-ink); background: var(--leave-soft);
}

.me {
  margin-top: auto; display: flex; align-items: center; gap: 6px;
  padding: 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel);
}
.me .avatar { margin-right: 4px; }
.me-meta { min-width: 0; flex: 1; }
.me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  --c: var(--c-indigo);
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 26%, transparent);
}
.avatar.xs { width: 24px; height: 24px; border-radius: 7px; font-size: 10px; }
.avatar.xxs { width: 18px; height: 18px; border-radius: 5px; font-size: 8.5px; }

.main { min-width: 0; padding: 28px 36px 28px; display: flex; flex-direction: column; min-height: 100vh; }
.view { flex: 1; animation: rise 0.35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; min-height: 40px; }
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title .logo { display: none; }
.topbar h1 { font-size: 25px; letter-spacing: -0.03em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.search-trigger {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 12px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--faint);
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.search-trigger:hover { border-color: var(--line-3); color: var(--text); }
.st-label { font-size: 13px; margin-right: 18px; }

.view-only {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line-2); background: var(--panel);
}

.tabbar { display: none; }

/* ==========================================================================
   Cards & overview
   ========================================================================== */
.card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow); }
.card.pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { --tone: var(--c-indigo); padding: 18px 20px; position: relative; overflow: hidden; }
.kpi::after {
  content: ''; position: absolute; inset: auto -40px -60px auto; width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--tone) 16%, transparent), transparent 70%);
  pointer-events: none;
}
.kpi-icon {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; margin-bottom: 16px;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent);
}
.tone-indigo { --tone: var(--c-indigo); }
.tone-teal { --tone: var(--c-teal); }
.tone-amber { --tone: var(--c-amber); }
.tone-emerald { --tone: var(--c-emerald); }
.tone-rose { --tone: var(--c-rose); }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.035em; margin-top: 2px; font-variant-numeric: tabular-nums; display: inline-block; }
.kpi-sub { font-size: 12px; color: var(--faint); margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }

.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span, .legend-note { display: inline-flex; align-items: center; gap: 6px; }
.legend-note { font-size: 12px; }
.lg { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.lg.v { background: var(--vehicles); }
.lg.d { background: var(--drivers); }
.lg.l { background: var(--leave); }
.lg.idle { background: repeating-linear-gradient(135deg, var(--c-indigo) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--c-indigo); }

.prog-row + .prog-row { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.prog-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: 13px; flex-wrap: wrap; }
.prog-row-head .meta { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bar-line { display: grid; grid-template-columns: minmax(0, 1fr) 84px; align-items: center; gap: 12px; }
.bar-line + .bar-line { margin-top: 8px; }
.track { display: flex; height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.fill { height: 100%; width: var(--w); flex: none; animation: grow 0.7s var(--ease); }
.fill.v { background: var(--vehicles); }
.fill.d { background: var(--drivers); }
.fill.l { background: var(--leave); }
.fill.idle { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c-indigo) 70%, transparent) 0 3px, transparent 3px 6px); }
@keyframes grow { from { width: 0; } }
.val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.val-total { color: var(--faint); font-weight: 500; }

.svc-row + .svc-row { margin-top: 16px; }
.svc-row-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 13px; }
.svc-row-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-row-val { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.svc-row-val b { color: var(--text); }
.meter { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.meter > div { height: 100%; width: var(--w); border-radius: inherit; background: var(--vehicles); animation: grow 0.7s var(--ease); }
.mini-empty { color: var(--faint); font-size: 13px; padding: 24px 0; text-align: center; }

/* Needs attention */
.attention { margin-bottom: 16px; border-color: color-mix(in srgb, var(--c-rose) 30%, var(--line)); }
.attention .card-head { margin-bottom: 10px; }
.attention .card-head h2 .i { color: var(--c-rose); }
.count-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; color: var(--c-rose); background: color-mix(in srgb, var(--c-rose) 12%, transparent); }
.attention-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attention-list li + li { border-top: 1px solid var(--line); }
.attention-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 6px; border: 0; background: none;
  text-align: left; cursor: pointer; border-radius: 10px; transition: background 0.15s;
}
.attention-item:hover { background: var(--hover); }
.att-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.att-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-issues { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.issue {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  color: var(--c-rose); background: color-mix(in srgb, var(--c-rose) 11%, transparent);
}
.issue.avail { color: var(--leave-ink); background: var(--leave-soft); }
.issues { display: flex; gap: 6px; flex-wrap: wrap; }
.warn-dot { display: inline-flex; margin-left: 6px; color: var(--c-rose); vertical-align: -1px; }

/* ==========================================================================
   Chips & tags
   ========================================================================== */
.dot { --c: var(--c-indigo); width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); flex: none; }

.chip {
  --c: var(--c-indigo);
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 26px; padding: 0 10px; border-radius: 99px; max-width: 100%;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--c) 26%, transparent);
  background: color-mix(in srgb, var(--c) 8%, transparent);
}
.chip .dot { background: var(--c); width: 6px; height: 6px; box-shadow: none; }
.chip-mode { display: inline-flex; color: var(--muted); }

.mode-tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 7px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
}
.mode-tag.linked { color: var(--c-indigo); background: color-mix(in srgb, var(--c-indigo) 12%, transparent); }
.mode-tag.separate { color: var(--c-teal); background: color-mix(in srgb, var(--c-teal) 12%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.svc-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; max-width: 100%;
  height: 24px; padding: 0 4px 0 9px; border-radius: 7px;
  font-size: 12px; color: var(--text); white-space: nowrap;
  background: var(--hover); border: 1px solid var(--line);
}
.svc-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.svc-chip b {
  flex: none; font-weight: 600; font-size: 11px; color: var(--muted);
  padding: 1px 6px; border-radius: 5px; background: var(--hover-2);
  font-variant-numeric: tabular-nums;
}
.chips.nowrap { flex-wrap: nowrap; max-width: 260px; }
.chips.nowrap .svc-chip:not(.more) { flex: 0 1 auto; min-width: 0; }
.svc-chip.more { padding: 0 8px; font-weight: 700; color: var(--muted); cursor: default; }

.cell-stack { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.linked-val { display: inline-flex; }
.linked-val .i { color: var(--c-indigo); }
.leave-badge, .idle-mini {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.leave-badge { color: var(--leave-ink); background: var(--leave-soft); }
.idle-mini { color: var(--idle-ink); background: color-mix(in srgb, var(--c-indigo) 11%, transparent); }
.active-fleet-val { color: var(--c-indigo); }
.active-val { color: var(--c-teal); }

.active-badge, .dt-badge, .idle-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px;
  font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.active-badge { background: color-mix(in srgb, var(--c-teal) 10%, transparent); }
.active-badge .i { color: var(--c-teal); }
.active-badge b { color: var(--text); font-variant-numeric: tabular-nums; }
.active-badge.fleet { background: color-mix(in srgb, var(--c-indigo) 10%, transparent); }
.active-badge.fleet .i { color: var(--c-indigo); }
.dt-badge { background: var(--hover); }
.dt-badge b { font-variant-numeric: tabular-nums; color: var(--c-emerald); }
.dt-badge.neg b { color: var(--c-rose); }
.idle-badge { background: var(--hover); transition: color 0.2s, background 0.2s; }
.idle-badge b { font-variant-numeric: tabular-nums; color: var(--text); }
.idle-badge.on { color: var(--idle-ink); background: color-mix(in srgb, var(--c-indigo) 12%, transparent); }
.idle-badge.on b { color: inherit; }
.idle-note { color: var(--faint); font-weight: 500; }
.idle-badge.on .idle-note { color: inherit; opacity: 0.8; }
.dt-val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--c-emerald); }
.dt-val.neg { color: var(--c-rose); }
.dt-val.zero { color: var(--faint); }
.meta-count { white-space: nowrap; }

.owner { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); flex-wrap: wrap; }

/* ==========================================================================
   Toolbar & tables
   ========================================================================== */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }
.result-count { font-size: 12.5px; color: var(--faint); white-space: nowrap; }

.search {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px; width: 260px; max-width: 100%;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel);
  color: var(--faint); transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within { border-color: var(--line-3); box-shadow: 0 0 0 4px var(--ring); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%; }

.seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; flex: none;
  background: var(--panel-2); border: 1px solid var(--line); max-width: 100%;
}
.seg.scroll { overflow-x: auto; scrollbar-width: none; flex: 0 1 auto; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg button {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 30px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-weight: 500; font-size: 13px;
  cursor: pointer; white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.on, .seg button[aria-selected='true'] {
  background: var(--panel); color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--line);
}
:root[data-theme='dark'] .seg button.on,
:root[data-theme='dark'] .seg button[aria-selected='true'] { background: var(--panel-3); }
.seg .dot { width: 6px; height: 6px; box-shadow: none; }

.table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-weight: 600; font-size: 11.5px; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 14px 18px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--hover-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.table .actions { width: 1%; padding-left: 4px; padding-right: 12px; text-align: right; }
.cell-title { font-weight: 600; }

/* DSP table: columns hug their content; Services absorbs the spare width. */
.dsp-table th, .dsp-table td { white-space: nowrap; }
.dsp-table .col-dsp, .dsp-table .col-program, .dsp-table .num, .dsp-table .col-updated { width: 1%; }
.dsp-table .col-dsp { padding-right: 28px; }
.dsp-table .col-program { padding-right: 10px; }
.dsp-table .num { padding-left: 14px; padding-right: 14px; }
.dsp-table .col-services { width: auto; padding-left: 26px; }
.dsp-table [aria-expanded='true'] { background: var(--hover-2); color: var(--text); }

.row-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: 0.6; transition: opacity 0.15s; }
tr:hover .row-actions, .row-actions:focus-within, .tile:hover .row-actions { opacity: 1; }

.updated { display: flex; flex-direction: column; gap: 3px; white-space: nowrap; }
.updated-time { font-size: 13px; font-weight: 500; }
.updated-by { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }

.role-select {
  height: 32px; padding: 0 30px 0 10px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e95' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.role-select:disabled { opacity: 0.6; cursor: not-allowed; }
.you { font-size: 11px; font-weight: 700; color: var(--ink-inv); background: var(--ink); padding: 2px 7px; border-radius: 6px; }
.reset-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--leave-ink); background: var(--leave-soft); padding: 2px 7px; border-radius: 6px; }

/* DSP cards (phones) */
.dsp-mobile { display: none; }
.dsp-cards { display: flex; flex-direction: column; gap: 12px; }
.dsp-card { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.dsp-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dsp-card-title { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.dsp-card-title h3 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dsp-card .icon-btn { width: 40px; height: 40px; margin: -6px -6px 0 0; }
.dsp-metrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); overflow: hidden;
}
.dsp-metrics > div { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.dsp-metrics > div + div { border-left: 1px solid var(--line); }
.dsp-metrics dt { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.dsp-metrics dd { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.dsp-metrics dd .val-total { font-size: 13px; }
.dsp-card .chips.nowrap { max-width: 100%; }
.dsp-card-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }

/* ==========================================================================
   Tiles (programs / services)
   ========================================================================== */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile { --c: var(--c-indigo); padding: 20px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.tile::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--c), transparent 80%); opacity: 0.85; }
.tile-top { display: flex; align-items: center; justify-content: space-between; }
.tile-badge {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
}
.tile h3 { font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stats dt { font-size: 11.5px; color: var(--faint); }
.stats dd { margin: 2px 0 0; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats dd .val-total { font-size: 12px; }

.add-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 190px; border-radius: var(--r-lg);
  border: 1.5px dashed var(--line-2); background: transparent; color: var(--muted);
  font-weight: 600; cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.add-tile:hover { border-color: var(--line-3); color: var(--ink); background: var(--hover); }
.add-tile .plus { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--ink); color: var(--ink-inv); }

/* ==========================================================================
   Vacation
   ========================================================================== */
.leave-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.leave-card { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 14px; transition: border-color 0.2s; }
.leave-card.has-leave { border-color: color-mix(in srgb, var(--leave) 35%, var(--line)); }
.leave-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.leave-title { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.leave-title h3 { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.leave-tags { display: flex; align-items: center; gap: 6px; flex: none; }
.avail-pill, .planned-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.avail-pill { color: var(--c-emerald); background: color-mix(in srgb, var(--c-emerald) 11%, transparent); }
.avail-pill.low { color: var(--c-rose); background: color-mix(in srgb, var(--c-rose) 11%, transparent); }
.planned-pill { color: var(--leave-ink); background: var(--leave-soft); }

.flip-counter {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch;
  border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); overflow: hidden;
}
.leave-card.readonly .flip-counter { grid-template-columns: 1fr 1px 1fr; }
.fc-divider { background: var(--line); }
.fc-side { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; perspective: 300px; }
.fc-side.leave { text-align: right; align-items: flex-end; background: linear-gradient(270deg, var(--leave-soft), transparent); }
.fc-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.fc-side.active .fc-label .i { color: var(--c-teal); }
.fc-side.leave .fc-label .i { color: var(--leave-ink); }
.fc-num { font-size: 30px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.1; display: inline-block; transform-origin: 50% 60%; }
.fc-side.leave .fc-num { color: var(--leave-ink); }
.fc-controls { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 8px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.fc-btn {
  display: grid; place-items: center; width: 38px; height: 32px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text); cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s, border-color 0.15s;
}
.fc-btn:hover:not(:disabled) { background: var(--ink); color: var(--ink-inv); border-color: var(--ink); }
.fc-btn:active:not(:disabled) { transform: scale(0.92); }
.fc-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.flip { animation: flipNum 0.45s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes flipNum { 0% { transform: rotateX(-90deg); opacity: 0.2; } 100% { transform: rotateX(0); opacity: 1; } }

.split-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--track); gap: 2px; }
.split-bar > div { width: var(--w); transition: width 0.45s var(--ease); }
.split-bar .seg-a { background: var(--drivers); border-radius: 99px 0 0 99px; }
.split-bar .seg-l { background: var(--leave); border-radius: 0 99px 99px 0; }

.leave-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
.leave-foot-actions { display: inline-flex; align-items: center; gap: 2px; }
.save-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--faint); margin-right: 4px; transition: opacity 0.3s; }
.save-state:empty { opacity: 0; }
.save-state.saved { color: var(--ok); }
.spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--muted); animation: spin 0.7s linear infinite; }

/* Planner */
.planner-section { margin-top: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.section-tools { display: flex; align-items: center; gap: 6px; }
.planner-card { padding: 0; overflow: hidden; }
.planner-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.planner { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.planner th, .planner td { padding: 0; }
.planner thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.pl-corner, .pl-name {
  position: sticky; left: 0; z-index: 2; background: var(--panel); text-align: left;
  min-width: 190px; max-width: 220px; border-right: 1px solid var(--line);
}
.pl-corner { padding: 10px 14px !important; font-size: 11.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; vertical-align: bottom; z-index: 3; }
.pl-name { padding: 8px 14px !important; font-weight: 600; font-size: 13px; white-space: nowrap; }
.pl-name .dot { width: 6px; height: 6px; box-shadow: none; display: inline-block; vertical-align: middle; margin-right: 8px; }
.pl-label { display: inline-flex; flex-direction: column; vertical-align: middle; min-width: 0; max-width: calc(100% - 16px); }
.pl-dsp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-sub { font-size: 11px; font-weight: 500; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day { width: 40px; min-width: 40px; text-align: center; padding: 8px 0 6px !important; scroll-snap-align: start; border-bottom: 1px solid var(--line); }
.day .mon { display: block; height: 13px; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.day .dow { display: block; font-size: 10.5px; font-weight: 600; color: var(--faint); }
.day .dom { display: block; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day.wkend .dow, .day.wkend .dom { color: var(--faint); }
.day.today .dom { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--ink); color: var(--ink-inv); margin-top: 1px; }
.cell {
  width: 40px; min-width: 40px; height: 40px; text-align: center; vertical-align: middle;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--line); border-left: 1px solid var(--hover-2);
  color: var(--leave-ink);
}
.cell.wkend { background: var(--hover-soft); }
.cell.today { box-shadow: inset 0 0 0 1px var(--line-3); }
.cell.today:not(.on) { background: var(--hover); }
.cell.on { background: rgba(var(--heat), calc(0.12 + var(--a) * 0.6)); }
.cell.on[style*='--a:1.000'] { color: #fff; }
.planner tbody tr:last-child th, .planner tbody tr:last-child td { border-bottom: 0; }
.planner tbody tr:hover .pl-name, .planner tbody tr:hover .cell:not(.on) { background-color: var(--hover-soft); }

.planned-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.planned-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
}
.pi-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none;
  width: 46px; height: 50px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line);
}
.pi-date.live { background: var(--leave-soft); border-color: color-mix(in srgb, var(--leave) 40%, transparent); }
.pi-mon { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; }
.pi-day { font-size: 18px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pi-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pi-sub { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pi-count { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--leave-ink); }
.pi-note { color: var(--faint); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { flex: none; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; color: var(--muted); background: var(--hover-2); }
.status-pill.live { color: var(--leave-ink); background: var(--leave-soft); }
.planned-empty {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; padding: 22px;
  border: 1.5px dashed var(--line-2); border-radius: 14px; color: var(--faint); flex-wrap: wrap;
}

/* ==========================================================================
   Activity feed
   ========================================================================== */
.feed-card { padding: 8px 22px; }
.feed, .feed-items { list-style: none; margin: 0; padding: 0; }
.feed-group + .feed-group { border-top: 1px solid var(--line); }
.feed-day { font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; padding: 16px 0 6px; }
.feed-item { position: relative; display: flex; gap: 14px; padding: 10px 0; }
.feed-items .feed-item:not(:last-child)::after {
  content: ''; position: absolute; left: 15px; top: 42px; bottom: -10px; width: 1px; background: var(--line);
}
.feed-icon {
  --c: var(--c-indigo);
  display: grid; place-items: center; flex: none; width: 31px; height: 31px; border-radius: 10px;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
}
.feed-icon.leave { --c: var(--c-amber); }
.feed-icon.dsp { --c: var(--c-teal); }
.feed-icon.config { --c: var(--c-indigo); }
.feed-icon.team { --c: var(--c-rose); }
.feed-body { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex: 1; min-width: 0; padding-top: 5px; }
.feed-body p { color: var(--muted); }
.feed-body b { color: var(--text); font-weight: 600; }
.feed-dsp { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; margin-left: 2px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--text); background: var(--hover-2); }
.feed-body time { flex: none; font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 64px 24px; }
.empty-icon {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; margin-bottom: 6px;
  color: var(--ink); background: var(--soft);
  box-shadow: 0 0 0 8px var(--hover-soft), 0 0 0 16px var(--hover-soft);
}
.empty h3 { font-size: 17px; }
.empty p { color: var(--muted); max-width: 320px; }
.empty .btn { margin-top: 10px; }

/* ==========================================================================
   Overlay: modal + drawer (bottom sheets on phones)
   ========================================================================== */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; }
.overlay.modal { align-items: center; justify-content: center; padding: 20px; }
.overlay.drawer { justify-content: flex-end; }

.backdrop {
  position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.22s var(--ease);
}
.overlay.open .backdrop { opacity: 1; }

.panel {
  position: relative; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s var(--ease), opacity 0.22s var(--ease);
}
.modal .panel { width: 480px; max-width: 100%; max-height: calc(100vh - 40px); border-radius: 20px; opacity: 0; transform: translateY(10px) scale(0.98); }
.modal.open .panel { opacity: 1; transform: none; }
.drawer .panel { width: 560px; max-width: 100%; height: 100%; border-radius: 20px 0 0 20px; border-right: 0; transform: translateX(100%); }
.drawer.open .panel { transform: none; }
.sheet-handle { display: none; }

.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 4px; }
.panel-head h2 { font-size: 18px; letter-spacing: -0.02em; font-weight: 700; }
.panel-body { padding: 18px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 20px; overscroll-behavior: contain; }
/* Long forms scroll; never squash a section (overflow:hidden children would otherwise shrink to 0). */
.panel-body > * { flex-shrink: 0; }
.panel-foot { display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
.panel-foot .form-error { margin-right: auto; }
.confirm-msg { color: var(--muted); }

/* More sheet */
.account-row { display: flex; align-items: center; gap: 12px; padding: 4px 2px 6px; }
.account-row .avatar { width: 44px; height: 44px; border-radius: 13px; font-size: 14px; }
.sheet-nav { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--panel); }
.sheet-link {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px;
  border: 0; background: none; text-align: left; text-decoration: none; font-size: 15px; font-weight: 500; cursor: pointer;
}
.sheet-link + .sheet-link { border-top: 1px solid var(--line); }
.sheet-link:active, .sheet-link:hover { background: var(--hover); }
.sheet-link.active { font-weight: 600; }
.sheet-link.danger { color: var(--danger); }
.sheet-link-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--hover-2); color: var(--text); flex: none; }
.sheet-link.danger .sheet-link-icon { background: var(--danger-soft); color: var(--danger); }
.sheet-value { margin-left: auto; font-size: 13px; color: var(--faint); }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > label, .field > legend {
  display: flex; align-items: center; gap: 8px; padding: 0;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.field > legend { margin-bottom: 8px; width: 100%; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.field-row.three .stepper { grid-template-columns: 34px 1fr 34px; }
.field-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-teal); font-weight: 500; }
.count { margin-left: auto; font-size: 11.5px; color: var(--faint); font-weight: 500; }

.field input[type='text'], .field input[type='password'], .field input[type='date'], .field input:not([type]) {
  height: 44px; padding: 0 14px; border-radius: 11px; width: 100%;
  border: 1px solid var(--line-2); background: var(--panel-2); outline: 0;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field input:focus { border-color: var(--line-3); box-shadow: 0 0 0 4px var(--ring); background: var(--panel); }
.field input::placeholder { color: var(--faint); }
.date-input { font-variant-numeric: tabular-nums; }
.date-input::-webkit-calendar-picker-indicator { opacity: 0.6; cursor: pointer; }
:root[data-theme='dark'] .date-input::-webkit-calendar-picker-indicator { filter: invert(1); }

input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.option { position: relative; cursor: pointer; min-width: 0; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-body {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; height: 100%;
  border: 1px solid var(--line-2); background: var(--panel-2);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.option:hover .option-body { border-color: var(--line-3); }
.option input:checked + .option-body { border-color: var(--ink); background: var(--panel); box-shadow: 0 0 0 3px var(--ring); }
.option input:focus-visible + .option-body { outline: 2px solid var(--ink); outline-offset: 2px; }
/* Multi-pick tiles (DSP access): a check badge marks the picked ones; the rest lock at the cap. */
.dsp-pick .option-body { padding-right: 40px; }
.pick-check {
  position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 6px;
  display: grid; place-items: center; border: 1px solid var(--line-3); color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.option input:checked + .option-body .pick-check { background: var(--ink); border-color: var(--ink); color: var(--ink-inv); }
.option.is-capped { cursor: not-allowed; }
.option.is-capped .option-body { opacity: 0.45; }
.option.is-capped:hover .option-body { border-color: var(--line-2); }
.option-title { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card { position: relative; cursor: pointer; }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card-body {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 14px; height: 100%;
  border: 1px solid var(--line-2); background: var(--panel-2);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.mode-card-body .tile-badge { width: 34px; height: 34px; margin-bottom: 8px; }
.mode-card.linked { --c: var(--c-indigo); }
.mode-card.separate { --c: var(--c-teal); }
.mode-card input:checked + .mode-card-body { border-color: var(--ink); background: var(--panel); box-shadow: 0 0 0 3px var(--ring); }
.mode-card input:focus-visible + .mode-card-body { outline: 2px solid var(--ink); outline-offset: 2px; }
.mode-card.disabled { opacity: 0.45; cursor: not-allowed; }
.mode-title { font-weight: 700; }
.mode-sub { font-size: 12.5px; color: var(--muted); }

.stepper {
  display: grid; grid-template-columns: 40px 1fr 40px; height: 46px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.2s;
}
.stepper:focus-within { border-color: var(--line-3); box-shadow: 0 0 0 4px var(--ring); }
.stepper input { min-width: 0; border: 0; outline: 0; background: transparent; text-align: center; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.step { border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.step:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.step:active:not(:disabled) { background: var(--hover-2); }
.step:disabled { cursor: not-allowed; }
.stepper-field.locked .stepper { background: repeating-linear-gradient(135deg, var(--hover) 0 8px, transparent 8px 16px), var(--panel-2); }
.stepper-field.locked .stepper input { color: var(--muted); }
.stepper-field.locked .step { opacity: 0.3; }
.stepper-field.leave .stepper { background: linear-gradient(90deg, transparent, var(--leave-soft)), var(--panel-2); }
.stepper-field.leave .stepper input { color: var(--leave-ink); }
.sync-pill { display: inline-flex; align-items: center; margin-left: auto; color: var(--ink-inv); background: var(--ink); padding: 2px 6px; border-radius: 99px; }

.readout { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-self: end; height: 46px; border-radius: 12px; border: 1px dashed var(--line-2); overflow: hidden; }
.readout.wide { align-self: stretch; height: 54px; }
.readout > div { display: flex; flex-direction: column; justify-content: center; padding: 0 12px; min-width: 0; }
.readout > div + div { border-left: 1px dashed var(--line-2); }
.readout span { font-size: 10.5px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout b { font-size: 15px; font-variant-numeric: tabular-nums; }
.readout .idle b, .readout .fleet b { color: var(--idle-ink); }
.readout .dt b { color: var(--c-emerald); }
.readout .dt.neg b { color: var(--c-rose); }

.svc-list { display: flex; flex-direction: column; gap: 8px; }
.svc { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); transition: border-color 0.15s, background 0.15s; }
.svc.on { border-color: color-mix(in srgb, var(--green) 45%, transparent); background: var(--green-soft); }
.svc-toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; flex: 1; min-width: 0; min-height: 30px; }
.svc-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.switch { appearance: none; flex: none; position: relative; margin: 0; cursor: pointer; width: 38px; height: 22px; border-radius: 99px; background: var(--switch-off); transition: background 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: transform 0.2s var(--ease); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(16px); }

.hours { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px 0 4px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); transition: opacity 0.2s; }
.hours input { width: 52px; border: 0; outline: 0; background: transparent; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.hours span { font-size: 12px; color: var(--faint); }
.hours:focus-within { border-color: var(--line-3); }
.hours.off { opacity: 0.35; }
.hours.wide { height: 44px; padding: 0 14px 0 6px; width: 100%; }
.hours.wide input { width: auto; flex: 1; text-align: left; padding-left: 8px; }

.inline-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line-2); color: var(--muted); font-size: 13px; }
.inline-note a { color: var(--ink); font-weight: 700; text-decoration: none; }
.inline-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--faint); }
.form-error { color: var(--danger); font-size: 13px; min-height: 1em; }
.form-error:empty { display: none; }
.code-input, .field input.code-input { font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }

/* ==========================================================================
   Row menu (popover) + action sheet (phones)
   ========================================================================== */
.menu {
  position: fixed; z-index: 60; min-width: 176px; padding: 6px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel);
  box-shadow: var(--shadow-lg); animation: menuIn 0.14s var(--ease);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 38px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font-weight: 500; text-align: left; cursor: pointer;
}
.menu-item .i { color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover-2); outline: none; }
.menu-item.danger, .menu-item.danger .i { color: var(--danger); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--danger-soft); }
.menu-backdrop { position: fixed; inset: 0; z-index: 59; background: var(--backdrop); opacity: 0; transition: opacity 0.2s; }
.menu-backdrop.open { opacity: 1; }
.menu-title { padding: 10px 12px 8px; font-size: 12px; font-weight: 600; color: var(--faint); text-align: center; }

/* ==========================================================================
   Command palette
   ========================================================================== */
.palette-overlay { align-items: flex-start; justify-content: center; padding: 12vh 20px 20px; z-index: 70; }
.palette {
  position: relative; width: 620px; max-width: 100%; max-height: 70vh; display: flex; flex-direction: column;
  border-radius: 18px; border: 1px solid var(--line-2); background: var(--panel); box-shadow: var(--shadow-lg);
  overflow: hidden; opacity: 0; transform: translateY(-8px) scale(0.98); transition: opacity 0.16s, transform 0.2s var(--ease);
}
.palette-overlay.open .palette { opacity: 1; transform: none; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 14px 0 18px; height: 58px; border-bottom: 1px solid var(--line); color: var(--faint); }
.palette-input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--text); }
.palette-esc { border: 1px solid var(--line-2); background: var(--panel-2); color: var(--faint); font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 7px; cursor: pointer; }
.palette-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; }
.palette-group { padding: 10px 12px 4px; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; }
.palette-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; cursor: pointer; }
.palette-item.active { background: var(--hover-2); }
.palette-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--panel-2); color: var(--muted); flex: none; }
.palette-item.active .palette-icon { background: var(--ink); color: var(--ink-inv); }
.palette-label { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }
.palette-empty { padding: 28px; text-align: center; color: var(--faint); }

/* ==========================================================================
   Auth — art panel is always dark for a premium split screen
   ========================================================================== */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; min-height: 100dvh; }
.auth-art {
  --text: #f4f4f3; --muted: #a3a3ab; --faint: #6c6c75;
  --line: rgba(255, 255, 255, 0.08); --panel: rgba(20, 20, 23, 0.75);
  --shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.9);
  --c-indigo: #8b8cf6; --c-teal: #2dd4bf; --c-emerald: #4ade9b;
  position: relative; overflow: hidden; padding: 40px 48px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  color: var(--text);
  background:
    radial-gradient(700px 420px at 20% 0%, rgba(255, 255, 255, 0.07), transparent 60%),
    radial-gradient(520px 420px at 90% 100%, rgba(23, 121, 90, 0.28), transparent 65%),
    #0a0a0b;
}
.auth-art::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.auth-art > * { position: relative; }
.auth-art .brand { padding: 0; }
.auth-art .wordmark { color: #fafafa; }
.auth-art::after {
  /* soft light sweep behind the preview */
  content: ''; position: absolute; width: 620px; height: 620px; right: -180px; top: 22%; border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 140, 246, 0.16), transparent 62%); filter: blur(10px); pointer-events: none;
}
.art-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.art-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px;
  font-size: 12px; font-weight: 600; color: #d4d4d8; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04);
}
.art-hero { display: flex; flex-direction: column; gap: 14px; }
.auth-headline { font-size: clamp(36px, 3.6vw, 52px); line-height: 1.04; letter-spacing: -0.045em; font-weight: 700; max-width: 560px; }
.auth-headline span { background: linear-gradient(92deg, #ffffff 10%, #7d7d86 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.art-sub { font-size: 15px; color: var(--muted); letter-spacing: -0.01em; }

/* Product preview (decorative) */
.art-stage { position: relative; width: 100%; max-width: 540px; margin: 28px 0 48px; }
.mock {
  border-radius: 18px; padding: 14px; border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, rgba(30, 30, 35, 0.92), rgba(15, 15, 18, 0.94));
  box-shadow: 0 50px 90px -40px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transform: perspective(1600px) rotateY(-7deg) rotateX(4deg); transform-origin: left center;
}
.mock-bar { display: flex; align-items: center; gap: 6px; padding: 2px 4px 12px; }
.mock-bar i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.mock-bar span { margin-left: 10px; font-size: 11.5px; font-weight: 600; color: var(--faint); }
.mock-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mock-kpis > div {
  display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06); background: rgba(255, 255, 255, 0.03);
}
.mock-kpis span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.mock-kpis b { font-size: 24px; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.mock-kpis b.pos { color: var(--c-emerald); }
.mock-kpis em { font-style: normal; font-size: 11px; color: var(--faint); }
.mock-list { margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.06); background: rgba(255, 255, 255, 0.02); display: flex; flex-direction: column; gap: 10px; }
.mock-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.mock-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 40px; align-items: center; gap: 12px; font-size: 12.5px; }
.mock-name { display: flex; align-items: center; gap: 8px; color: #e4e4e7; white-space: nowrap; overflow: hidden; }
.mock-name i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); flex: none; }
.mock-track { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.mock-track span { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), #ffffff); }
.mock-row b { text-align: right; font-variant-numeric: tabular-nums; }

.float-card {
  position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(24, 24, 28, 0.82); backdrop-filter: blur(14px);
  box-shadow: 0 24px 40px -18px rgba(0, 0, 0, 0.9); font-size: 12.5px; white-space: nowrap;
  animation: float-y 7s ease-in-out infinite alternate;
}
.float-card > span:last-child { display: flex; flex-direction: column; gap: 1px; }
.float-card em { font-style: normal; font-size: 11px; color: var(--faint); }
.fc-1 { right: -26px; top: -30px; }
.fc-2 { right: 56px; bottom: -46px; animation-delay: -3.5s; }
.fc-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; }
.fc-icon.rose { color: #fb7185; background: rgba(251, 113, 133, 0.14); }
.fc-icon.amber { color: #f0b44c; background: rgba(240, 180, 76, 0.14); }
@keyframes float-y { from { transform: translateY(0); } to { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .float-card { animation: none; } }

.art-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.art-features { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.art-features li {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 99px;
  font-size: 12px; font-weight: 600; color: #d4d4d8; border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.03);
}
.art-copy { font-size: 12px; color: var(--faint); }

/* Form side */
.auth-panel {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 20px;
  background: radial-gradient(600px 360px at 50% 0%, var(--hover), transparent 70%);
}
.auth-top { position: absolute; top: 24px; left: 24px; right: 24px; display: flex; align-items: center; justify-content: flex-end; }
.auth-top .brand { display: none; padding: 0; }
.auth-mhero { display: none; }
.auth-card { width: 384px; max-width: 100%; display: flex; flex-direction: column; gap: 18px; }
.auth-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 4px; }
.auth-head .back { margin-bottom: 10px; text-decoration: none; color: var(--muted); }
.auth-head .back:hover { color: var(--text); }
.auth-eyebrow {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; height: 26px; padding: 0 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; color: var(--green-ink); background: var(--green-soft);
}
.auth-h { font-size: 30px; line-height: 1.1; letter-spacing: -0.04em; font-weight: 700; }
.auth-sub { color: var(--muted); font-size: 14px; }
.auth-card .seg { width: 100%; }
.auth-card .seg button { flex: 1; justify-content: center; height: 36px; }

.input-wrap { position: relative; }
.input-wrap > .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--faint); pointer-events: none; transition: color 0.15s; }
.input-wrap:focus-within > .i { color: var(--text); }
.field .input-wrap input { padding-left: 42px; height: 48px; font-size: 14.5px; }
.field .input-wrap.has-toggle input { padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; border: 0; background: transparent; color: var(--faint); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--hover); }
.pw-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.field label .count.ok { display: inline-flex; align-items: center; gap: 4px; color: var(--green-ink); font-weight: 600; }
.caps-hint { display: flex; align-items: center; gap: 6px; margin-top: -8px; font-size: 12.5px; font-weight: 600; color: var(--leave-ink); }
.caps-hint[hidden] { display: none; }

.auth-submit { height: 50px; margin-top: 4px; gap: 10px; }
.auth-submit .i { transition: transform 0.2s var(--ease); }
.auth-submit:hover .i { transform: translateX(3px); }
.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--btn-text) 30%, transparent); border-top-color: var(--btn-text);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-note { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--faint); }
.auth-secure { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); }
.auth-foot { display: none; }
.hint { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--green-ink); padding: 10px 12px; border-radius: 10px; background: var(--green-soft); }

/* ==========================================================================
   Team
   ========================================================================== */
.team-section + .team-section { margin-top: 28px; }
.team-section .empty { padding: 36px 24px; }
.access-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.access-chip.admin { color: var(--ink-inv); background: var(--ink); }
.access-chip.user { color: var(--c-indigo); background: color-mix(in srgb, var(--c-indigo) 11%, transparent); }
.access-chip.dsp { color: var(--c-teal); background: color-mix(in srgb, var(--c-teal) 11%, transparent); }
/* A 2-DSP chip ("DSP · A · B") wraps instead of widening the table on narrow screens. */
.access-chip.dsp { white-space: normal; height: auto; min-height: 26px; padding-block: 4px; line-height: 1.3; max-width: 100%; overflow-wrap: anywhere; }
.access-chip.dsp svg { flex: none; }
.code-hint { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.settings-card { max-width: 760px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.setting-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.setting-sub { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.setting-control { display: flex; align-items: center; gap: 10px; flex: none; }
.setting-control .hours { height: 38px; }

.invite-reveal { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 8px 0 4px; text-align: center; }
.invite-code {
  display: block; width: 100%; padding: 18px 12px; border-radius: 14px;
  border: 1px dashed var(--line-3); background: var(--panel-2);
  font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: 0.1em; user-select: all; word-break: break-all;
}
.invite-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ==========================================================================
   Toasts
   ========================================================================== */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 12px; border-radius: 12px;
  background: var(--ink); color: var(--ink-inv); box-shadow: 0 20px 40px -14px rgba(0, 0, 0, 0.5);
  font-weight: 600; opacity: 0; transform: translateY(8px); transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast .i { padding: 3px; width: 22px; height: 22px; border-radius: 7px; }
.toast.ok .i { color: #fff; background: var(--green-2); }
.toast.err .i { color: #fff; background: #c8304d; }

/* ==========================================================================
   Theme flip toggle
   ========================================================================== */
.theme-flip { position: relative; flex: none; width: 40px; height: 40px; padding: 0; border: 0; background: transparent; cursor: pointer; perspective: 500px; border-radius: 12px; }
.flip-inner { position: absolute; inset: 0; display: block; transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(0.34, 1.4, 0.5, 1); }
.flip-face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line-2); backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: border-color 0.2s; }
.flip-face .i { width: 18px; height: 18px; }
.flip-face.front { color: #b7791f; background: radial-gradient(circle at 30% 25%, #ffffff, #f1f1ee 80%); box-shadow: inset 0 1px 0 #fff, 0 8px 18px -10px rgba(0, 0, 0, 0.35); }
.flip-face.back { color: #e8e8ec; background: radial-gradient(circle at 30% 25%, #2a2a2f, #0b0b0c 75%); border-color: rgba(255, 255, 255, 0.12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 20px -10px rgba(0, 0, 0, 0.9); transform: rotateY(180deg); }
:root[data-theme='dark'] .flip-inner { transform: rotateY(180deg); }
.theme-flip:hover .flip-face { border-color: var(--line-3); }
.theme-flip:hover .flip-face .i { animation: wobble 0.6s var(--ease); }
@keyframes wobble { 30% { transform: rotate(-14deg) scale(1.08); } 65% { transform: rotate(8deg); } }

::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ==========================================================================
   Skeleton loading
   ========================================================================== */
.sk {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--hover-2) 0%, var(--hover) 40%, var(--hover-2) 80%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-line { height: 12px; margin-top: 10px; }
.sk-line.tall { height: 24px; }
.sk-line.sq { width: 36px; height: 36px; border-radius: 10px; margin: 0 0 6px; }
.sk-brand { height: 34px; width: 140px; margin: 0 8px 8px; }
.sk-nav { height: 34px; margin: 0 4px 4px; }
.sk-block { height: 260px; }
.skeleton .topbar { height: 40px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* Tablet: icon rail */
/* Small laptops + tablets: icon rail so the content (and the DSP table) gets the width. */
@media (max-width: 1200px) and (min-width: 761px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 18px 10px; align-items: center; }
  .sidebar .wordmark, .nav-link span, .me-meta, .me [data-action='change-password'] { display: none; }
  .sidebar .brand { padding: 0; }
  .nav { width: 100%; }
  .nav-link { justify-content: center; padding: 0; height: 44px; }
  .nav-link.active::before { left: -10px; }
  .nav-link .nav-badge { position: absolute; top: 5px; right: 8px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 9.5px; }
  .me { flex-direction: column; padding: 8px 6px; gap: 6px; }
  .me .avatar { margin: 0; }
  .main { padding: 24px 24px; }
  .st-label, .search-trigger kbd { display: none; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; }
}

/* Tablets: the full table doesn't fit; use the card layout, two per row. */
@media (max-width: 1024px) and (min-width: 761px) {
  .dsp-desktop { display: none; }
  .dsp-mobile { display: block; }
  .dsp-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phone */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .main { padding: 0 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); min-height: 100dvh; }

  /* Sticky, blurred app bar */
  .topbar {
    position: sticky; top: 0; z-index: 20;
    margin: 0 -16px 16px; padding: calc(10px + var(--safe-t)) 16px 10px; min-height: 0;
    background: var(--bg-blur); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px);
    border-bottom: 1px solid var(--line);
  }
  .topbar-title .logo { display: grid; width: 30px; height: 30px; border-radius: 9px; }
  .topbar-title .logo-glyph { width: 18px; height: 18px; }
  .topbar h1 { font-size: 19px; }
  .topbar-actions { gap: 6px; }
  .topbar .theme-flip, .st-label, .search-trigger kbd, .topbar .btn-label, .view-only span { display: none; }
  .search-trigger, .topbar .btn { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; }
  .view-only { width: 34px; height: 34px; padding: 0; justify-content: center; }

  /* Bottom tab bar */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding: 6px 6px var(--safe-b);
    background: var(--bg-blur); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px);
    border-top: 1px solid var(--line);
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: none; color: var(--faint); text-decoration: none; cursor: pointer; min-width: 0;
    font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em; border-radius: 12px;
  }
  .tab-icon { position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: 99px; transition: background 0.2s, color 0.2s; }
  .tab-icon .i { width: 21px; height: 21px; }
  .tab.active { color: var(--ink); }
  .tab.active .tab-icon { background: var(--soft); }
  .tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-badge.dot {
    position: absolute; top: -3px; left: calc(50% + 6px); right: auto;
    min-width: 16px; height: 16px; padding: 0 4px; margin: 0; font-size: 9.5px; line-height: 1;
    color: #fff; background: var(--leave); box-shadow: 0 0 0 2px var(--bg);
  }

  /* Content */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
  .kpi { padding: 14px; border-radius: 16px; }
  .kpi-icon { width: 30px; height: 30px; border-radius: 9px; margin-bottom: 10px; }
  .kpi-icon .i { width: 16px; height: 16px; }
  .kpi-label { font-size: 12.5px; }
  .kpi-value { font-size: 23px; }
  .card.pad { padding: 16px; }
  .grid-2 { gap: 12px; }
  .legend { gap: 10px; font-size: 11.5px; }
  .bar-line { grid-template-columns: minmax(0, 1fr) 70px; }
  .attention-item { flex-wrap: wrap; padding: 12px 4px; }
  .att-issues { justify-content: flex-start; flex-basis: 100%; order: 3; }

  .toolbar { gap: 8px; }
  .search { flex: 1 1 100%; width: auto; height: 44px; border-radius: 12px; }
  .search input { font-size: 16px; }
  .seg.scroll { flex: 1 1 0; min-width: 0; }
  .seg button { height: 34px; }
  .toolbar .btn { height: 40px; width: 40px; padding: 0; flex: none; }
  .toolbar .btn .btn-label { display: none; }
  .toolbar-spacer { display: none; }
  .result-count { display: none; }

  .dsp-metrics > div { padding: 10px; }
  .dsp-metrics dt { white-space: normal; line-height: 1.25; font-size: 10px; letter-spacing: 0.04em; min-height: 2.5em; align-items: flex-start; }
  .dsp-metrics dt .i { display: none; }

  .dsp-desktop { display: none; }
  .dsp-mobile { display: block; }

  .tile-grid, .leave-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .leave-card { padding: 16px 16px 12px; }
  .fc-num { font-size: 34px; }
  .fc-controls { gap: 8px; padding: 8px 10px; }
  .fc-btn { width: 48px; height: 40px; border-radius: 11px; }
  .leave-foot .icon-btn { width: 40px; height: 40px; }
  .stats.four { grid-template-columns: repeat(2, 1fr); row-gap: 12px; }

  .pl-corner, .pl-name { min-width: 128px; max-width: 128px; width: 128px; }
  .pl-name { padding: 8px 10px !important; }
  .day, .cell { width: 38px; min-width: 38px; }
  .planned-item { gap: 10px; padding: 10px; align-items: flex-start; }
  .pi-main { gap: 4px; }
  .pi-sub { gap: 4px 10px; font-size: 12px; }
  .pi-note { max-width: 100%; flex-basis: 100%; }
  .status-pill { align-self: center; }
  .planned-item .icon-btn { width: 38px; height: 38px; align-self: center; }

  .feed-card { padding: 4px 16px; }
  .feed-body { flex-direction: column; gap: 2px; }

  .hide-sm { display: none; }
  .team-table td, .team-table th { padding: 12px 12px; }
  .setting-row { flex-direction: column; align-items: stretch; }
  .setting-control { justify-content: space-between; }

  /* Bottom sheets */
  .overlay.modal, .overlay.drawer { align-items: flex-end; justify-content: stretch; padding: 0; }
  .modal .panel, .drawer .panel {
    width: 100%; max-width: 100%; height: auto; max-height: calc(100dvh - var(--safe-t) - 16px);
    border-radius: 24px 24px 0 0; border: 1px solid var(--line-2); border-bottom: 0;
    opacity: 1; transform: translateY(100%);
  }
  .drawer .panel { height: calc(100dvh - var(--safe-t) - 10px); }
  .modal.open .panel, .drawer.open .panel { transform: none; }
  .sheet-handle { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line-3); margin: 8px auto 0; flex: none; }
  .panel-head { padding: 12px 18px 2px; }
  .panel-body { padding: 14px 18px; }
  .panel-foot { flex-wrap: wrap; padding: 12px 18px calc(12px + var(--safe-b)); }
  .panel-foot .form-error { flex-basis: 100%; order: -1; margin: 0; }
  .panel-foot .btn { flex: 1; height: 48px; font-size: 15px; }
  .more-sheet .panel-foot { display: none; }
  .more-sheet .panel-body { padding-bottom: calc(18px + var(--safe-b)); gap: 14px; }
  .confirm .panel-body { padding-top: 6px; }

  .field input[type='text'], .field input[type='password'], .field input[type='date'], .field input:not([type]) { height: 48px; font-size: 16px; }
  .stepper { height: 50px; }
  .stepper input, .hours input { font-size: 16px; }
  .field-row, .field-row.three, .mode-grid { grid-template-columns: minmax(0, 1fr); }
  .field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .field-row.three .stepper { grid-template-columns: 30px 1fr 30px; }
  .readout.wide { height: auto; grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); }
  .readout.wide > div { padding: 8px 12px; }
  .readout.wide > div:nth-child(odd) { border-left: 0; }
  .readout.wide > div:nth-child(n + 3) { border-top: 1px dashed var(--line-2); }
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .svc { padding: 12px; }

  /* Action sheet */
  .menu.sheet {
    left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + var(--safe-b));
    min-width: 0; padding: 6px; border-radius: 18px; animation: none;
    transform: translateY(110%); transition: transform 0.28s var(--ease);
  }
  .menu.sheet.open { transform: none; }
  .menu.sheet .menu-item { height: 52px; justify-content: center; font-size: 16px; border-radius: 12px; }
  .menu.sheet .menu-item + .menu-item { border-top: 1px solid var(--line); border-radius: 0; }
  .menu.sheet .menu-item.cancel { margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; font-weight: 700; background: var(--panel-2); }

  /* Palette: full-screen sheet */
  .palette-overlay { padding: 0; }
  .palette { width: 100%; max-height: none; height: 100dvh; border-radius: 0; border: 0; padding-top: var(--safe-t); }
  .palette-input { height: 60px; }
  .palette-item { min-height: 52px; }

  .toasts { left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); align-items: center; }
  .toast { max-width: 100%; }

  .footnote { margin-top: 28px; justify-content: center; }

  /* Auth on phones */
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-panel { justify-content: flex-start; gap: 20px; padding: calc(16px + var(--safe-t)) 20px calc(24px + var(--safe-b)); min-height: 100dvh; }
  .auth-top { position: static; width: 100%; max-width: 400px; justify-content: space-between; }
  .auth-top .brand { display: flex; }
  /* Compact dark hero on phones, echoing the desktop art panel */
  .auth-mhero {
    display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 400px; padding: 22px 20px; border-radius: 20px;
    position: relative; overflow: hidden; color: #f4f4f3;
    background:
      radial-gradient(320px 200px at 100% 0%, rgba(139, 140, 246, 0.25), transparent 65%),
      radial-gradient(280px 200px at 0% 100%, rgba(23, 121, 90, 0.3), transparent 65%),
      #0a0a0b;
    border: 1px solid rgba(255, 255, 255, 0.06);
  }
  .auth-mhero .auth-headline { font-size: 27px; }
  .auth-mhero .art-features li { height: 26px; font-size: 11.5px; }
  .auth-card { width: 100%; max-width: 400px; }
  .auth-h { font-size: 26px; }
  .auth-secure { margin-top: -4px; }
  .auth-foot { display: block; margin-top: auto; padding-top: 8px; }
}

@media (max-width: 380px) {
  .kpi-value { font-size: 21px; }
  .dsp-metrics dd { font-size: 18px; }
  .tab-icon { width: 44px; }
}

@media (hover: none) {
  .row-actions { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   Service split (expands under a DSP row / card)
   ========================================================================== */
.dsp-row { cursor: pointer; }
.dsp-row.open, .dsp-row.open:hover { background: var(--hover-soft); }
.dsp-row.open td { border-bottom-color: transparent; }
.cell-title { display: inline-flex; align-items: center; gap: 6px; }
.expand-btn {
  display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; margin-left: -6px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--faint); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.expand-btn:hover { background: var(--hover-2); color: var(--text); }
.expand-btn .i, .split-toggle .i { transition: transform 0.25s var(--ease); }
[data-expand-btn][aria-expanded='true'] .i { transform: rotate(90deg); }

.split-row td { padding: 0 18px 16px !important; border-bottom: 1px solid var(--line); white-space: normal !important; }
.split-row:hover { background: transparent !important; }
.split-panel {
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); overflow: hidden;
  animation: splitIn 0.28s var(--ease);
}
@keyframes splitIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.split-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px;
  font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em;
  border-bottom: 1px solid var(--line);
}
.split-head > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.split-head .faint { text-transform: none; letter-spacing: 0; font-weight: 500; }
.split-lines { display: flex; flex-direction: column; }
.split-line {
  display: grid; grid-template-columns: minmax(160px, 1.3fr) minmax(140px, 1fr) minmax(140px, 1fr) 96px;
  align-items: center; gap: 18px; padding: 12px 16px;
}
.split-line + .split-line { border-top: 1px solid var(--line); }
.split-line.muted .sl-title { color: var(--faint); font-style: italic; }
.sl-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sl-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-hours { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--faint); }
.sl-metric { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sl-label { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; }
.sl-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.sl-bar .track { height: 6px; }
.sl-bar b { font-variant-numeric: tabular-nums; font-size: 14px; min-width: 2ch; text-align: right; }
.sl-dt { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.sl-dt b { font-size: 14px; }
.split-foot {
  display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 10px 16px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); background: var(--panel);
}
.split-foot b { color: var(--text); font-variant-numeric: tabular-nums; }
.split-warn { display: inline-flex; align-items: center; gap: 6px; color: var(--leave-ink); font-weight: 500; }

/* Cards */
.dsp-card { cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; }
.dsp-card.open { border-color: var(--line-3); }
.dsp-card .split-panel { cursor: default; }
.dsp-card .split-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; }
.dsp-card .sl-name { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 10px; }
.dsp-card .sl-dt { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
.dsp-card-foot { justify-content: space-between; }
.dsp-card-foot > span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.split-toggle {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 8px 0 12px; flex: none;
  border: 1px solid var(--line-2); border-radius: 99px; background: var(--panel); color: var(--text);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.split-toggle:hover { border-color: var(--line-3); }

/* ==========================================================================
   DSP form: per-service counts, merge dialog
   ========================================================================== */
.svc { flex-direction: column; align-items: stretch; gap: 10px; }
.svc-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.svc-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); animation: splitIn 0.22s var(--ease); }
.stepper-field.mini > label { font-size: 11.5px; }
.stepper-field.mini .stepper { height: 40px; grid-template-columns: 34px 1fr 34px; background: var(--panel); }
.stepper-field.mini .stepper input { font-size: 15px; }
.stepper-field.mini.locked .stepper { background: repeating-linear-gradient(135deg, var(--hover) 0 8px, transparent 8px 16px), var(--panel); }
.sum-pill {
  display: inline-grid; place-items: center; margin-left: auto; width: 20px; height: 18px; border-radius: 99px;
  font-size: 11px; font-weight: 800; color: var(--ink-inv); background: var(--ink);
}
.sync-pill + .sum-pill { margin-left: 4px; }
.field-hint.warn { color: var(--leave-ink); }

.merge-hero { display: flex; align-items: center; gap: 14px; }
.merge-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.merge-sub { font-size: 13px; color: var(--muted); }
.merge-compare { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
.mc-col {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; min-width: 0;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2);
}
.mc-col.incoming { border-style: dashed; border-color: var(--line-3); background: var(--panel); }
.mc-label { font-size: 10.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-nums { display: flex; gap: 12px; font-size: 13px; color: var(--muted); }
.mc-nums span { display: inline-flex; align-items: center; gap: 5px; }
.mc-nums b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.mc-col .chips { width: 100%; }
.mc-col .svc-chip { max-width: 100%; }
.mc-col .svc-chip-name { flex: 0 1 auto; min-width: 0; }
.mc-plus { display: grid; place-items: center; align-self: center; width: 30px; height: 30px; border-radius: 99px; background: var(--ink); color: var(--ink-inv); }
.mc-plus .i { width: 15px; height: 15px; stroke-width: 2.4; }
.svc-chip.is-new b { color: var(--green-ink); background: var(--green-soft); }
.svc-chip.is-same b { color: var(--leave-ink); background: var(--leave-soft); }
.inline-meta.ok { color: var(--green-ink); }

@media (max-width: 760px) {
  .split-row td { padding: 0 12px 12px !important; }
  .merge-compare { grid-template-columns: minmax(0, 1fr); }
  .mc-plus { justify-self: center; }
  .svc-counts { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   Planner: tap a day to plan leave · service-type pick
   ========================================================================== */
.cell.tap { padding: 0; }
.cell-btn {
  display: grid; place-items: center; width: 100%; height: 40px; padding: 0; border: 0; background: transparent;
  font: inherit; color: inherit; cursor: pointer; transition: background 0.15s, box-shadow 0.15s;
}
.cell-btn:hover { background: var(--hover-2); }
.cell.on .cell-btn:hover { background: rgba(0, 0, 0, 0.06); }
.cell-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; border-radius: 6px; }
.cell-plus { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: var(--faint); opacity: 0; transition: opacity 0.15s; }
.cell-btn:hover .cell-plus, .cell-btn:focus-visible .cell-plus { opacity: 1; background: var(--ink); color: var(--ink-inv); }
@media (hover: none) { .cell-plus { opacity: 0.35; } }

.svc-avail { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--c-teal); }
.svc-avail:empty { display: none; }
.pi-svc { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--c-indigo); }
.option-title .ot-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Vacation card: "Serving" service-type chip
   ========================================================================== */
.serving-chip {
  display: flex; align-items: center; gap: 7px; width: 100%; min-height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-2); border-radius: 11px; background: var(--panel); color: var(--text);
  font-size: 12.5px; cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s;
}
.serving-chip:hover { border-color: var(--line-3); background: var(--hover-soft); }
.serving-chip[aria-expanded='true'] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }
.serving-chip > .i:first-child { color: var(--c-indigo); }
.sc-label { font-size: 10.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; flex: none; }
.sc-name { font-weight: 600; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-off { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 20px; padding: 0 7px; border-radius: 99px; font-size: 11px; font-weight: 700; color: var(--leave-ink); background: var(--leave-soft); }
.sc-chev { flex: none; color: var(--faint); transform: rotate(90deg); }
@media (max-width: 760px) { .serving-chip { min-height: 42px; font-size: 13.5px; } }
@media (max-width: 760px) {
  .menu.sheet .menu-item:not(.cancel) { justify-content: flex-start; height: auto; min-height: 52px; padding: 12px 16px; text-align: left; line-height: 1.3; gap: 12px; }
  .menu.sheet .menu-item .i { flex: none; }
}

/* ==========================================================================
   DSP table + service split: fit the screen on computers
   ========================================================================== */
/* One grid for all lines so names align; the name column only takes what the names need. */
.split-lines { display: grid; grid-template-columns: fit-content(240px) minmax(0, 1fr) minmax(0, 1fr) auto; }
.split-line { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; gap: 0 24px; }
.sl-dt { min-width: 84px; }

/* Cards keep their own stacked layout. */
.dsp-card .split-lines { display: flex; flex-direction: column; }
.dsp-card .split-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; }

/* If the table ever has to scroll (very narrow windows), keep the split pinned to the visible width. */
.split-row .split-panel { position: sticky; left: 18px; max-width: var(--table-visible, 100%); }

.dsp-name { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* Narrower laptop widths: tighten instead of scrolling. */
@media (max-width: 1440px) and (min-width: 1025px) {
  .dsp-name { max-width: 180px; }
  /* Number headers may break onto two lines ("ACTIVE / DRIVERS") so their columns stay narrow. */
  .dsp-table th.num { white-space: normal; line-height: 1.25; vertical-align: bottom; }
  .dsp-table th, .dsp-table td { padding-left: 12px; padding-right: 12px; }
  .dsp-table .col-dsp { padding-right: 16px; }
  .dsp-table .col-services { padding-left: 14px; }
  .dsp-table .chips.nowrap { max-width: 210px; }
  .split-row td { padding: 0 12px 14px !important; }
  .split-line { gap: 0 18px; }
}
@media (max-width: 1280px) and (min-width: 1025px) {
  .dsp-name { max-width: 140px; }
  .dsp-table .updated-by { display: none; }           /* name stays in the tooltip */
  .dsp-table .chips.nowrap { max-width: 170px; }
  .dsp-table th { letter-spacing: 0.05em; font-size: 11px; }
  .split-lines { grid-template-columns: fit-content(180px) minmax(0, 1fr) minmax(0, 1fr) auto; }
}
@media (max-width: 1440px) and (min-width: 1025px) {
  .dsp-table .chips.nowrap { max-width: 190px; }
}
@media (max-width: 1280px) and (min-width: 1025px) {
  .dsp-table .chips.nowrap { max-width: 160px; }
}
/* Smallest laptop windows (icon rail): tightest spacing before any scroll. */
@media (max-width: 1150px) and (min-width: 1025px) {
  .dsp-name { max-width: 110px; }
  .dsp-table .chips.nowrap { max-width: 130px; }
  .dsp-table th, .dsp-table td { padding-left: 9px; padding-right: 9px; }
  .dsp-table .col-dsp { padding-right: 10px; }
  .dsp-table .col-services { padding-left: 10px; }
  .dsp-table .chip { padding: 0 8px; gap: 6px; }
  .split-lines { grid-template-columns: fit-content(150px) minmax(0, 1fr) minmax(0, 1fr) auto; }
  .split-line { gap: 0 14px; }
}
.svc-compact { display: none; }
@media (max-width: 1150px) and (min-width: 1025px) {
  .dsp-table .svc-full { display: none; }
  .dsp-table .svc-compact { display: block; }
  .dsp-table .svc-compact .chips.nowrap { max-width: 150px; }
}

/* ==========================================================================
   Plan leave form
   ========================================================================== */
.svc-avail { margin-top: 2px; }
.svc-avail.full { color: var(--danger); }
.option.is-full { cursor: not-allowed; }
.option.is-full .option-body { opacity: 0.55; background: repeating-linear-gradient(135deg, var(--hover) 0 8px, transparent 8px 16px), var(--panel-2); }
.option.is-full:hover .option-body { border-color: var(--line-2); }

.range-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: -8px; }
.range-presets button {
  height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel);
  font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.range-presets button:hover { border-color: var(--line-3); color: var(--text); }
.range-presets button[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--ink-inv); }
@media (max-width: 760px) { .range-presets button { height: 36px; flex: 1; } }
@media (max-width: 760px) {
  /* Full service names on phones: one per row. */
  [data-svc-options].option-grid { grid-template-columns: minmax(0, 1fr); }
  [data-svc-options] .option-body { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
  [data-svc-options] .svc-avail { margin-top: 0; flex: none; }
}

/* ==========================================================================
   Vehicles (temporary off-road requests)
   ========================================================================== */
.r-mechanical { --rc: var(--c-amber); }
.r-accident { --rc: var(--c-rose); }
.r-servicing { --rc: var(--c-indigo); }

.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; gap: 6px; border-radius: 9px; }
.btn.sm .i { width: 14px; height: 14px; }

.nav-badge.alert { color: var(--c-rose); background: color-mix(in srgb, var(--c-rose) 13%, transparent); }
.road-mini {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 99px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  color: var(--c-rose); background: color-mix(in srgb, var(--c-rose) 11%, transparent);
}
.sl-name .road-mini { margin-left: 2px; }
.issue.road { color: var(--c-amber); background: color-mix(in srgb, var(--c-amber) 13%, transparent); }
.feed-icon.vehicle { --c: var(--c-rose); }

.seg-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--hover-2);
}
.seg-count.hot { color: var(--c-rose); background: color-mix(in srgb, var(--c-rose) 13%, transparent); }
.reason-seg { margin-bottom: 14px; }
.reason-seg button .i { width: 13px; height: 13px; }

/* Request card */
.vr-list { display: flex; flex-direction: column; gap: 12px; }
.vr-card {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start;
  padding: 18px 20px; overflow: hidden;
}
.vr-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--rc); opacity: 0.9; }
.vr-card.closed::before { opacity: 0.25; }
.vr-card.closed .vr-icon { filter: grayscale(0.6); opacity: 0.7; }
.vr-icon {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px;
  color: var(--rc); background: color-mix(in srgb, var(--rc) 12%, transparent);
}
.vr-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vr-title { margin: 0; font-size: 15px; font-weight: 500; display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.vr-title b { font-weight: 700; }
.vr-dot { color: var(--faint); }
.vr-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.reason-tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; color: var(--rc); background: color-mix(in srgb, var(--rc) 11%, transparent);
}
.vr-dates { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.vr-dates span { display: inline-flex; align-items: center; gap: 5px; }
.vr-dates .late { color: var(--c-rose); font-weight: 600; }
.vr-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.vr-flag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 7px;
  font-size: 11.5px; font-weight: 600; color: var(--c-rose); background: color-mix(in srgb, var(--c-rose) 10%, transparent);
}
.vr-flag.ok { color: var(--c-emerald); background: color-mix(in srgb, var(--c-emerald) 11%, transparent); }
.vr-flag.plain { color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); font-weight: 500; }
.vr-flag.plain b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.vr-note { margin: 0; font-size: 13px; color: var(--text); padding: 8px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.vr-note.decision { display: flex; align-items: center; gap: 6px; color: var(--muted); background: transparent; border-style: dashed; }
.vr-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--faint); }
.vr-by { display: inline-flex; align-items: center; gap: 6px; }
.vr-decision::before { content: '·'; margin-right: 12px; }
.vr-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.vr-status {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap; color: var(--muted); background: var(--hover-2);
}
.vr-status.pending { color: var(--leave-ink); background: var(--leave-soft); }
.vr-status.offroad, .vr-status.overdue { color: var(--c-rose); background: color-mix(in srgb, var(--c-rose) 12%, transparent); }
.vr-status.returned { color: var(--c-emerald); background: color-mix(in srgb, var(--c-emerald) 12%, transparent); }

/* Dialog recap */
.vr-summary {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--panel-2);
}
.vr-summary .vr-icon { width: 34px; height: 34px; border-radius: 10px; }
.vr-summary > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.vr-summary b { font-size: 14px; color: var(--text); }

/* Report form */
.mode-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reason-card { --c: var(--rc); }
.reason-card .mode-card-body { padding: 14px; }
.accident-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: end; }
.accident-fields[hidden] { display: none; }
.pill-pick { display: inline-flex; gap: 6px; }
.pill-pick label { position: relative; cursor: pointer; }
.pill-pick input { position: absolute; opacity: 0; pointer-events: none; }
.pill-pick span {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; color: var(--muted);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.pill-pick input:checked + span { border-color: var(--ink); background: var(--panel); color: var(--text); box-shadow: 0 0 0 3px var(--ring); }
.pill-pick input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Overview banner */
.pending-banner {
  display: flex; align-items: center; gap: 14px; width: 100%; margin-bottom: 16px; padding: 14px 18px;
  text-align: left; cursor: pointer; color: inherit; font: inherit;
  border-color: color-mix(in srgb, var(--c-amber) 35%, var(--line));
  transition: border-color 0.15s, background 0.15s;
}
.pending-banner:hover { background: var(--panel-2); border-color: var(--c-amber); }
.pb-icon {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px;
  color: var(--c-amber); background: color-mix(in srgb, var(--c-amber) 13%, transparent);
}
.pb-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: 13px; }
.pb-text b { font-size: 14px; }

@media (max-width: 760px) {
  .vr-card { grid-template-columns: auto minmax(0, 1fr); padding: 16px; gap: 12px; }
  .vr-actions { grid-column: 1 / -1; justify-content: stretch; }
  .vr-actions .btn { flex: 1; height: 40px; }
  .vr-icon { width: 36px; height: 36px; }
  .mode-grid.three { grid-template-columns: minmax(0, 1fr); }
  .reason-card .mode-card-body { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
  .reason-card .mode-card-body .tile-badge { margin-bottom: 0; }
  .reason-card .mode-sub { margin-left: auto; }
  .accident-fields { grid-template-columns: minmax(0, 1fr); }
  .vr-decision::before { display: none; }
}
