/* ═══════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════ */
:root {
  --ink:        #073f3a;
  --bg:         #ffffff;
  --paper:      #ffffff;
  --sidebar-bg: #ffffff;
  --hover:      #e6f5f2;
  --hover-dk:   #cce8e3;
  --primary:    #0d9488;
  --primary-dk: #0f766e;
  --blue:       #0d9488;
  --blue-lt:    #e6f5f2;
  --red:        #0f766e;
  --red-lt:     #e6f5f2;
  --green:      #0d9488;
  --green-lt:   #e6f5f2;
  --border:     #86cfc7;
  --border-lt:  #d7efec;
  --muted:      #0f766e;
  --faint:      #3d9d94;

  --font-body: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist', system-ui, -apple-system, sans-serif;

  --r:    6px;
  --r-sm: 5px;
  --r-lg: 8px;

  --sh-sm: 0 1px 2px rgba(13,148,136,.06);
  --sh:    0 3px 8px rgba(13,148,136,.08);
  --sh-md: 0 8px 18px rgba(13,148,136,.10);
  --sh-lg: 0 18px 38px rgba(13,148,136,.12);

  --topbar-h:    58px;
  --sidebar-w:   252px;
  --sidebar-w-col: 64px;
  --footer-h:    28px;
  --control-h:   34px;
  --record-row-h: 46px;
}

/* Dark theme */
:root[data-theme="dark"] {
  --ink:       #073f3a;
  --bg:        #ffffff;
  --paper:     #ffffff;
  --hover:      #e6f5f2;
  --hover-dk:   #cce8e3;
  --primary:    #0d9488;
  --primary-dk: #0f766e;
  --blue:      #0d9488;
  --blue-lt:   #e6f5f2;
  --red:       #0f766e;
  --red-lt:    #e6f5f2;
  --green:     #0d9488;
  --green-lt:  #e6f5f2;
  --border:    #86cfc7;
  --border-lt: #d7efec;
  --muted:     #0f766e;
  --sidebar-bg: #ffffff;
  --faint:     #3d9d94;
  --sh-sm: 0 1px 2px rgba(13,148,136,.06);
  --sh:    0 3px 8px rgba(13,148,136,.08);
  --sh-md: 0 8px 18px rgba(13,148,136,.10);
  --sh-lg: 0 18px 38px rgba(13,148,136,.12);
}
:root[data-theme="dark"] body {
  background-image: none;
}

/* ═══════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  height: 100%; margin: 0;
  color: var(--ink); font-family: var(--font-body); font-size: 13px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: transparent; padding: 0; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; transition: border-color .12s, background .12s, color .12s, box-shadow .12s; }
svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.hidden { display: none !important; }

/* ═══════════════════════════════════════
   LOADING BAR
═══════════════════════════════════════ */
#app.loading::before {
  content: '';
  position: fixed;
  top: 0; left: -40%; width: 40%; height: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  z-index: 9999;
  pointer-events: none;
  animation: load-slide .9s ease-in-out infinite;
}
@keyframes load-slide {
  0%   { left: -40%; }
  100% { left: 110%; }
}
#app.loading .btn { pointer-events: none; opacity: .5; }

/* ═══════════════════════════════════════
   APP SHELL
═══════════════════════════════════════ */
.app {
  height: 100vh; display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0,1fr);
  grid-template-rows: var(--topbar-h) minmax(0,1fr) var(--footer-h);
  position: relative; z-index: 1;
}
.app.sidebar-collapsed { grid-template-columns: var(--sidebar-w-col) minmax(0,1fr); }

/* ═══════════════════════════════════════
   BOOT SCREEN
═══════════════════════════════════════ */
.boot-screen {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--paper); gap: 18px;
}
.boot-spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border-lt);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: boot-spin .75s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }
.boot-label {
  font-family: var(--font-mono); font-size: 18px; font-weight: 700;
  letter-spacing: .04em; color: var(--ink);
}
.boot-done .boot-label { color: var(--green); }

/* ═══════════════════════════════════════
   AUTH SCREEN
═══════════════════════════════════════ */
.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background-color: var(--bg);
  background-image: none;
}
.auth-card {
  width: min(380px, 100%);
  background: var(--paper);
  border: 1px solid var(--border-lt);
  border-radius: var(--r-lg);
  padding: 28px 28px 24px;
  box-shadow: var(--sh-lg);
  display: grid; gap: 16px;
}
.auth-mark {
  width: 44px; height: 44px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 15px; font-weight: 700; letter-spacing: .04em;
}
.auth-head-row { display: flex; align-items: center; gap: 12px; }
.auth-head-row h1 { font-size: 20px; font-weight: 700; letter-spacing: .02em; margin: 0; }
.auth-btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.auth-card p { margin: 0; color: var(--muted); font-size: 13px; }
.auth-card form { display: grid; gap: 14px; }
.auth-card .input-group { gap: 5px; }
.auth-card .input-label { font-family: var(--font-mono); font-size: 11px; font-weight: 400; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.auth-card input { height: 40px; border: 1px solid var(--border); border-radius: var(--r); padding: 0 12px; outline: 0; background: var(--paper); font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.auth-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.13); }
.auth-btn-row .btn { height: 32px; padding: 0 16px; border-radius: var(--r); font-size: 12px; font-weight: 700; border: 1px solid var(--border-lt); background: var(--paper); color: var(--ink); }
.auth-btn-row .btn:hover { background: var(--hover); border-color: var(--primary); box-shadow: none; }
.auth-btn-row .btn-primary { background: var(--primary); border-color: var(--primary); color: var(--paper); box-shadow: none; }
.auth-btn-row .btn-primary:hover { background: var(--primary-dk); box-shadow: none; }
.status-line { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.error-banner { background: var(--hover); border: 1px solid var(--border); border-left: 4px solid var(--primary); color: var(--primary-dk); padding: 11px 16px; border-radius: var(--r); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.banner-dismiss { color: var(--red); font-size: 18px; font-weight: 700; line-height: 1; padding: 0 4px; flex-shrink: 0; opacity: .55; }
.banner-dismiss:hover { opacity: 1; }

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
  grid-column: 1/-1;
  background: var(--paper);
  border-bottom: 1px solid var(--border-lt);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 100; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; height: 100%; }

.logo-btn {
  width: 34px; height: 30px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  flex-shrink: 0; user-select: none;
}

.brand-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--ink); text-transform: uppercase; }
.brand-divider { height: 20px; border-left: 1px solid var(--border-lt); }
.brand-context {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: var(--bg);
  border: 1px solid var(--border-lt); padding: 3px 10px; border-radius: var(--r-sm);
}

.topbar-right { display: flex; align-items: center; gap: 4px; height: 100%; }
.topbar-right button {
  height: 32px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--muted); gap: 6px; font-size: 12px;
  background: transparent; border: 0;
}
.topbar-right button:hover { background: var(--bg); color: var(--ink); }
.topbar-right button svg { width: 16px; height: 16px; overflow: visible; }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  border-left: 1px solid var(--border-lt);
  border-right: 1px solid var(--border-lt);
  padding: 0 14px; height: 100%;
  color: var(--ink); font-size: 12px; font-weight: 600;
}
.topbar-user svg { width: 16px; height: 16px; overflow: visible; color: var(--faint); }
.topbar-logout { color: var(--faint) !important; }
.topbar-logout:hover { color: var(--red) !important; background: var(--red-lt) !important; }

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
.sidebar { grid-row: 2; background: var(--sidebar-bg); border-right: 1px solid var(--border-lt); display: flex; flex-direction: column; overflow: visible; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 10px 10px; scrollbar-width: thin; scrollbar-color: var(--border-lt) transparent; }
.sidebar-footer { flex-shrink: 0; border-top: 1px solid var(--border-lt); padding: 8px 10px; background: var(--sidebar-bg); }

/* Group labels */
.nav-group-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--faint);
  padding: 14px 10px 4px; display: block;
}

/* Divider between groups */
.rule { border: 0; border-top: 1px solid var(--border-lt); margin: 8px 0; }

/* Nav buttons */
nav { display: flex; flex-direction: column; gap: 2px; }
nav button {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); font-size: 13px; font-weight: 400;
  text-align: left; width: 100%;
  padding: 8px 10px; border-radius: 6px;
  transition: background .12s, color .12s;
}
nav button svg { width: 16px; height: 16px; flex-shrink: 0; overflow: visible; color: var(--muted); }
nav button:hover { background: var(--hover); color: var(--ink); }
nav button:hover svg { color: var(--ink); }
nav button.active { background: var(--primary); color: var(--paper); font-weight: 600; box-shadow: var(--sh-sm); }
nav button.active svg { color: var(--paper); }

.nav-count { margin-left: auto; background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; line-height: 1; }

/* Sidebar footer actions */
.sidebar-logout-btn { width: 100%; color: var(--faint) !important; font-size: 12px; padding: 7px 10px; border-radius: 6px; }
.sidebar-logout-btn:hover { color: var(--red) !important; background: var(--red-lt) !important; }

/* ═══════════════════════════════════════
   FOOTER
═══════════════════════════════════════ */
.footer { grid-column: 1/-1; height: var(--footer-h); border-top: 1px solid var(--border-lt); background: var(--paper); font-family: var(--font-mono); font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 20px; padding: 0 18px; }

/* ═══════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════ */
.main { padding: 26px; overflow: auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.drill-page { animation: drill-in .18s ease; }
@keyframes drill-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
.page-title { font-size: 16px; letter-spacing: .04em; font-weight: 700; text-transform: uppercase; }
.page-sub { margin-top: 4px; color: var(--muted); font-size: 13px; }
.search-box { position: relative; }
.search-box input { width: 240px; height: 34px; border: 1px solid var(--border-lt); border-radius: var(--r); background: var(--paper); padding: 0 32px 0 12px; color: var(--ink); font-size: 13px; }
.search-box svg { position: absolute; right: 9px; top: 9px; width: 15px; height: 15px; color: var(--faint); }

/* ═══════════════════════════════════════
   SECTIONS & GRID
═══════════════════════════════════════ */
.section { margin-bottom: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .12em; color: var(--faint); text-transform: uppercase; }
.view-link { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; background: transparent; border: 0; }
.view-link:hover { color: var(--ink); }
.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4,minmax(0,1fr)); }
.span-2 { grid-column: span 2; }

/* ═══════════════════════════════════════
   CARDS
═══════════════════════════════════════ */
.card { background: var(--paper); border: 1px solid var(--border-lt); border-radius: var(--r); box-shadow: none; transition: border-color .12s, box-shadow .12s; }
.card:hover { border-color: var(--border); box-shadow: var(--sh-sm); }

.metric { padding: 9px 12px; }
.metric-label { font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: .1em; color: var(--faint); text-transform: uppercase; }
.metric-value { font-size: 18px; font-weight: 700; letter-spacing: -.01em; margin-top: 5px; }
.metric-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.metric.pos .metric-value { color: var(--green); }
.metric.neg .metric-value { color: var(--red); }

.accent-card { display: flex; overflow: hidden; }
.card.archived { opacity: 0.55; filter: grayscale(0.4); }
.accent-bar { width: 26px; flex: 0 0 26px; display: grid; place-items: center; writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--font-mono); font-size: 8px; font-weight: 700; letter-spacing: .14em; color: #fff; text-transform: uppercase; }
.accent-blue { background: var(--blue); }
.accent-red { background: var(--red); }
.accent-green { background: var(--green); }
.accent-yellow { background: var(--primary); color: #fff; }
.accent-body { padding: 8px 11px; flex: 1; }
.card-title { font-weight: 700; font-size: 12px; margin-bottom: 2px; }
.card-sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em; color: var(--faint); text-transform: uppercase; margin-bottom: 6px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border-lt); padding-bottom: 5px; margin-bottom: 6px; }
.field-label { display: block; font-family: var(--font-mono); font-size: 9px; color: var(--faint); letter-spacing: .1em; text-transform: uppercase; }
.field-value { font-weight: 700; font-size: 12px; }

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-lt); font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--paper); }
.badge-yellow  { background: var(--hover); border-color: var(--border); color: var(--primary-dk); }
.badge-blue    { background: var(--hover); border-color: var(--border); color: var(--primary-dk); }
/* active → teal/green */
.badge-active  { background: var(--hover); border-color: var(--border); color: var(--primary-dk); }
/* inactive → amber */
.badge-inactive { background: var(--paper); border-color: var(--border); color: var(--primary-dk); }
/* archived / archive → muted grey */
.badge-archived, .badge-archive { background: var(--paper); border-color: var(--border-lt); color: var(--muted); }
/* draft → blue */
.badge-draft   { background: var(--hover); border-color: var(--border); color: var(--primary-dk); }
/* pending → amber */
.badge-pending { background: var(--paper); border-color: var(--border); color: var(--primary-dk); }
/* approved → green */
.badge-approved { background: var(--hover); border-color: var(--border); color: var(--primary-dk); }
/* cancelled / canceled → red */
.badge-cancelled, .badge-canceled { background: var(--paper); border-color: var(--border); color: var(--primary-dk); }
/* deleted → red */
.badge-deleted { background: var(--paper); border-color: var(--border); color: var(--primary-dk); }
/* needs_client / needs_service / needs_review → orange */
.badge-needs_client, .badge-needs_service, .badge-needs_review { background: var(--hover); border-color: var(--border); color: var(--primary-dk); }
/* allocated → teal */
.badge-allocated { background: var(--hover); border-color: var(--border); color: var(--primary-dk); }
/* confirmed → teal */
.badge-confirmed { background: var(--hover); border-color: var(--border); color: var(--primary-dk); }
.badge-green   { background: var(--hover); border-color: var(--border); color: var(--primary-dk); }
.badge-red     { background: var(--paper); border-color: var(--border); color: var(--primary-dk); }
.badge-muted   { background: var(--paper); color: var(--muted); }
[data-theme="dark"] .badge-yellow,
[data-theme="dark"] .badge-active,
[data-theme="dark"] .badge-inactive,
[data-theme="dark"] .badge-archived,
[data-theme="dark"] .badge-archive,
[data-theme="dark"] .badge-draft,
[data-theme="dark"] .badge-pending,
[data-theme="dark"] .badge-approved,
[data-theme="dark"] .badge-muted { background: var(--paper); border-color: var(--border-lt); color: var(--primary-dk); }
[data-theme="dark"] .badge-muted    { background: var(--paper); }

/* ═══════════════════════════════════════
   BUTTONS & FORMS
═══════════════════════════════════════ */
.btn-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.btn { position: relative; overflow: hidden; height: 28px; border: 1px solid var(--border-lt); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); padding: 0 11px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .035em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.btn svg { width: 15px; height: 15px; }
.btn.active { border-color: var(--primary); background: var(--hover); box-shadow: none; }
.btn:hover { border-color: var(--primary); background: var(--hover); box-shadow: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--paper); box-shadow: none; }
.btn-primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); box-shadow: none; }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-red { color: var(--red); border-color: #efc6cc; background: var(--red-lt); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary::after { content: none; }
.btn-primary:not(:disabled):hover::after { animation: none; }
@keyframes btn-shine { from { left: -130%; } to { left: 210%; } }

.btn-green:not(:disabled):hover { animation: none; }
@keyframes btn-green-pulse {
  0%,100% { box-shadow: var(--sh-sm), 0 0 0 0 rgba(0,138,94,.35); }
  50%      { box-shadow: var(--sh),    0 0 0 6px rgba(0,138,94,.12); }
}
:root[data-theme="dark"] .btn-green:not(:disabled):hover { animation: none; }
@keyframes btn-green-pulse-dk {
  0%,100% { box-shadow: var(--sh-sm), 0 0 0 0 rgba(0,196,126,.4); }
  50%      { box-shadow: var(--sh),    0 0 0 6px rgba(0,196,126,.14); }
}

.btn-primary:active { transform: none; box-shadow: none !important; }
.btn-green:active   { transform: none; box-shadow: none !important; }

.btn-ripple { position: absolute; border-radius: 50%; transform: scale(0); opacity: 1; pointer-events: none; animation: btn-ripple .55s ease-out forwards; }
.btn-primary .btn-ripple { background: rgba(255,255,255,.65); }
.btn-green   .btn-ripple { background: rgba(255,255,255,.55); }
@keyframes btn-ripple { to { transform: scale(1); opacity: 0; } }

.toolbar { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.config-nav-tiles { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.config-nav-tile { padding: 6px 14px; border-radius: var(--r); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; border: 1px solid var(--border-lt); background: var(--paper); color: var(--ink); transition: border-color .12s, background .12s; user-select: none; }
.config-nav-tile:hover { border-color: var(--primary); background: var(--hover); }
.config-nav-tile.lt-red    { border-left: 3px solid var(--red); }
.config-nav-tile.lt-yellow { border-left: 3px solid var(--primary); }
.config-nav-tile.lt-blue   { border-left: 3px solid var(--blue); }
.config-nav-tile.lt-green  { border-left: 3px solid var(--green); }
.config-nav-tile.lt-faint  { border-left: 3px solid var(--faint); }

.input-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.input-label { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
input, select, textarea { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid var(--border-lt); border-radius: var(--r); background: var(--paper); min-height: 34px; padding: 6px 10px; color: var(--ink); font-size: 13.5px; outline: 0; transition: border-color .15s, background .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,148,136,.13); }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 15px; height: 15px; min-height: auto; padding: 0; cursor: pointer; flex-shrink: 0; }
.input-group:has(input[type="checkbox"]) { flex-direction: row; align-items: center; gap: 8px; }

/* ═══════════════════════════════════════
   TABLES (classic + list)
═══════════════════════════════════════ */
.table-wrap { background: transparent; border: none; overflow-x: auto; overflow-y: visible; max-width: 100%; scrollbar-width: thin; scrollbar-color: var(--border-lt) transparent; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 700; text-align: left; border-bottom: 1px solid var(--border-lt); padding: 8px 10px; }
td { border-bottom: 1px solid var(--border-lt); padding: 6px 10px; vertical-align: middle; }
.list-table tbody tr { min-height: var(--record-row-h); }
.list-table tbody td { height: var(--record-row-h); }
:not(.list-table) > tbody > tr:last-child td { border-bottom: 0; }
.empty { border: 1px dashed var(--border-lt); border-radius: var(--r); background: rgba(255,255,255,.5); padding: 22px; text-align: center; color: var(--faint); font-family: var(--font-mono); font-size: 11px; }
[data-theme="dark"] .empty { background: var(--paper); }

.actions-cell, .actions-head { text-align: left !important; white-space: nowrap; }
.actions-cell { vertical-align: middle; }
.actions-inline { display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap; min-height: var(--control-h); }
.actions-inline .btn,
.btn-small {
  height: var(--control-h);
  padding: 0 14px;
  font-size: 10px;
  letter-spacing: .06em;
}

/* ── List-table tile rows (free-standing, no outer box) ── */
.list-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  border: 1px solid var(--border-lt);
  border-radius: var(--r);
  background: var(--paper);
}
.list-table { width: 100%; border-collapse: collapse; border-spacing: 0; }

.list-table thead th {
  height: 34px;
  background: var(--bg);
  border: 0;
  border-bottom: 1px solid var(--border-lt);
  padding: 0 14px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
}
.list-table thead th:first-child { padding-left: 18px; }

/* Each row is a self-contained tile */
.list-table tbody tr {
  background: transparent;
  transition: box-shadow .1s ease, transform .08s ease;
}
.list-table tbody tr.clickable-row { cursor: pointer; }
.list-table tbody tr:nth-child(even) td { background: var(--bg); }
.list-table tbody tr:hover { box-shadow: none; }
.list-table tbody tr:hover td { border-color: transparent; background: var(--hover); }
.list-table tbody tr.clickable-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.list-table td {
  height: 42px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  vertical-align: middle; font-size: 12px; color: var(--ink);
}
.list-table td:first-child {
  border: 0;
  border-radius: 0;
  padding-left: 18px;
}
.list-table td:last-child {
  border: 0;
  border-radius: 0;
}
.list-table .badge { min-height: 22px; padding: 3px 9px; font-size: 10px; }

/* Status-driven left accent colours */
.lt-blue   td:first-child { border-left-color: var(--blue);      }
.lt-green  td:first-child { border-left-color: var(--green);     }
.lt-yellow td:first-child { border-left-color: var(--primary-dk); }
.lt-red    td:first-child { border-left-color: var(--red);       }
.lt-faint  td:first-child { border-left-color: var(--border-lt); }
.lt-dim { opacity: 0.45; }

/* Two-line primary cell */
.lt-title { display: block; font-weight: 700; font-size: 13px; color: var(--ink); }
.lt-sub   { display: block; font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.lt-mono  { font-size: 11px; color: var(--muted); }

/* ═══════════════════════════════════════
   NOTICE & DRAWER
═══════════════════════════════════════ */
.notice { border: 1px solid var(--border-lt); background: var(--paper); border-left: 4px solid var(--primary); padding: 12px 14px; margin-bottom: 14px; color: var(--muted); font-size: 13px; border-radius: var(--r); word-break: break-word; overflow-wrap: break-word; min-width: 0; }
.atr-preview { background: var(--bg); border-left-color: var(--green); margin-bottom: 0; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(13,148,136,.16); z-index: 9; }
.drawer { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(480px,calc(100vw - 32px)); max-height: 88vh; overflow-y: auto; overflow-x: hidden; background: var(--paper); border: 1px solid var(--border-lt); box-shadow: var(--sh-lg); border-radius: var(--r-lg); z-index: 10; padding: 20px; display:flex; flex-direction:column; gap:0; }
.drawer-wide { width: min(720px,calc(100vw - 32px)); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.drawer-body { flex:1; }
.drawer-footer { margin-top:20px; padding-top:16px; border-top:1px solid var(--border-lt); justify-content:flex-end; }
.drawer-title { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex:1; }
.drawer-x { display:flex; align-items:center; justify-content:center; width:28px; height:28px; border:none; background:transparent; cursor:pointer; color:var(--muted); border-radius:var(--r-sm); flex-shrink:0; }
.drawer-x:hover { background:var(--hover); color:var(--ink); }
.drawer-x svg { width:16px; height:16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.form-grid .full { grid-column: 1/3; }
.btn-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; max-width: 100%; }

/* ═══════════════════════════════════════
   PANEL — transparent wrapper, no box
═══════════════════════════════════════ */
.panel {
  background: transparent;
  border: none;
  border-radius: 0;
  margin-bottom: 20px;
  overflow: visible;
  box-shadow: none;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 0 8px 0;
  border-bottom: none;
  background: transparent;
}
.panel-title {
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint);
}
.panel-sub {
  font-size: 10px;
  color: var(--faint);
  margin-top: 2px;
}

/* ═══════════════════════════════════════
   FILTERBAR / FOOTERBAR / PAGER
═══════════════════════════════════════ */
.filterbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.control-bar { margin-bottom: 10px; }
.control-bar input,
.control-bar select,
.control-bar .btn,
.actions-inline .btn,
.footerbar select,
.footerbar .btn {
  height: var(--control-h);
  min-height: var(--control-h);
}
.control-bar .btn,
.actions-inline .btn {
  padding: 0 12px;
  font-size: 10px;
  gap: 8px;
}
.control-bar-left > .input-group {
  flex: 0 0 auto;
}
.control-bar-left input {
  width: 260px;
}
.control-bar-left {
  flex: 0 0 auto;
}
.control-bar-middle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 220px;
}
.control-panel-host {
  position: relative;
  z-index: 6;
}
.control-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--border-lt);
  background: var(--paper);
  padding: 10px;
  margin: -2px 0 14px;
  box-shadow: var(--sh-sm);
}
.control-panel .input-group {
  flex: 0 0 auto;
  min-width: 160px;
}
.control-panel input,
.control-panel select {
  min-height: var(--control-h);
  height: var(--control-h);
}
.column-panel {
  align-items: flex-start;
}
.column-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-h);
  border: 1px solid var(--border-lt);
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
}
.column-option input {
  width: 15px;
  min-height: auto;
  height: 15px;
}
.filterbar::-webkit-scrollbar { display: none; }
.filterbar .input-group { flex-direction: row; align-items: center; gap: 0; }
.filterbar .table-filter-actions {
  margin-left: auto;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.toolbar-split {
  width: 100%;
  justify-content: space-between;
  align-items: center;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.toolbar-left::-webkit-scrollbar { display: none; }
.toolbar-actions,
.toolbar-split > .roster-header-actions {
  margin-left: auto;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.toolbar-left > input { width: 240px; flex: 0 0 auto; }
.toolbar-left > select,
.toolbar-select { width: 300px; max-width: min(300px, 42vw); flex: 0 0 auto; }
.footerbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-top: 1px solid var(--border-lt);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.footer-info {
  align-items: center;
  gap: 6px;
}
.footer-info .page-sub { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.pager { display: flex; gap: 4px; align-items: center; }
.page-btn {
  min-width: var(--control-h); height: var(--control-h);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-lt);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 6px;
  transition: border-color .12s, background .12s;
}
.page-btn:hover { background: var(--hover); color: var(--ink); border-color: var(--primary); }
.page-btn.active { background: var(--hover); color: var(--ink); border-color: var(--primary); box-shadow: none; }
.page-btn:disabled { opacity: .3; cursor: not-allowed; }

/* ═══════════════════════════════════════
   STAT CARD
═══════════════════════════════════════ */
.stat {
  background: var(--paper);
  border: 1px solid var(--border-lt);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: none;
  transition: border-color .12s;
}
.stat:hover { border-color: var(--border); }
.stat-label {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--faint); margin-bottom: 6px;
}
.stat-value {
  font-size: 20px; font-weight: 700;
  color: var(--ink); letter-spacing: -.02em; line-height: 1.2;
}
.stat-note { font-size: 11px; color: var(--faint); margin-top: 4px; }

/* ═══════════════════════════════════════
   TAB BAR
═══════════════════════════════════════ */
.tab-bar {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border-lt);
  margin-bottom: 16px;
  overflow-x: auto; scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  border: 0; background: transparent;
  color: var(--faint);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ═══════════════════════════════════════
   SKELETON LOADER
═══════════════════════════════════════ */
.skeleton-wrap { padding: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.skeleton-row {
  height: 14px;
  background: linear-gradient(90deg, var(--bg) 25%, var(--border-lt) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  border-radius: var(--r);
  animation: shimmer 1.4s infinite;
}
.skeleton-row.short { width: 55%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ═══════════════════════════════════════
   CHARTS
═══════════════════════════════════════ */
.chart-wrap { padding: 12px 14px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.chart-val { font-size: 18px; font-weight: 700; margin-top: 3px; letter-spacing: -.01em; }
.chart-delta { font-family: var(--font-mono); font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-sm); }
.chart-delta.pos { color: var(--green); background: var(--green-lt); }
.chart-delta.neg { color: var(--red); background: var(--red-lt); }
.chart-donut-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.chart-legend { display: flex; flex-direction: column; gap: 5px; }
.legend-item { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-label { font-family: var(--font-mono); font-size: 10px; color: var(--muted); letter-spacing: .04em; }
.chart-empty { padding: 24px; text-align: center; color: var(--faint); font-family: var(--font-mono); font-size: 11px; }

/* ═══════════════════════════════════════
   CALENDAR
═══════════════════════════════════════ */
.cal-table { table-layout: fixed; width: 100%; }
.cal-table th { text-align: center; padding: 6px 4px; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.cal-table th.cal-week-th { width: 110px; background: var(--bg); color: var(--muted); }
.cal-table td { vertical-align: top; padding: 5px 6px; height: 66px; border: 1px solid var(--border-lt); }
.cal-cell { background: var(--paper); }
.cal-other { opacity: 0.3; background: var(--bg); }
.cal-win { background: var(--green-lt); border-left: 2px solid var(--green) !important; }
.cal-loss { background: var(--red-lt); border-left: 2px solid var(--red) !important; }
.cal-date { font-size: 10px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.cal-pnl { font-size: 11px; font-weight: 700; line-height: 1.2; }
.cal-win .cal-pnl { color: var(--green); }
.cal-loss .cal-pnl { color: var(--red); }
.cal-count { font-size: 9px; color: var(--faint); margin-top: 2px; }
.cal-week-summary { background: var(--bg); border-left: 2px solid var(--border-lt) !important; vertical-align: middle; text-align: center; padding: 6px 8px; }
.cal-week-pnl { font-size: 12px; font-weight: 700; }
.cal-week-pnl.pos { color: var(--green); }
.cal-week-pnl.neg { color: var(--red); }
.cal-week-detail { font-size: 9px; color: var(--faint); margin-top: 3px; letter-spacing: .04em; }

/* ═══════════════════════════════════════
   CRM SPLIT LAYOUT
═══════════════════════════════════════ */
.split { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.entity-list {
  background: var(--paper); border: 1px solid var(--border-lt);
  border-radius: var(--r); padding: 8px;
  position: sticky; top: 16px; box-shadow: var(--sh-sm);
}
.entity-btn {
  width: 100%; border: 0; background: transparent;
  text-align: left; border-radius: var(--r);
  padding: 7px 10px; margin: 1px 0;
  cursor: pointer; color: var(--muted); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .12s, color .12s;
}
.entity-btn:hover { background: var(--hover); color: var(--ink); }
.entity-btn.active { background: var(--primary); color: #fff; font-weight: 700; }

/* ═══════════════════════════════════════
   BREADCRUMB
═══════════════════════════════════════ */
.breadcrumb { margin-bottom: 8px; }
.breadcrumb .btn { font-size: 11px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; background: none; border: none; padding: 0; margin: 0; font-size: 13px; font-weight: 400; font-family: var(--font); text-transform: none; letter-spacing: 0; color: var(--muted); cursor: pointer; height: auto; border-radius: 0; }
.back-link:hover { color: var(--ink); background: none; border: none; box-shadow: none; text-transform: none; }

.record-link {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-decoration: none;
  font-weight: 400;
}
.record-link:hover { color: var(--primary); background: transparent; text-decoration: none; }

.client-directory-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.client-directory-search { width: min(380px, 100%); }
.client-directory-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border-lt);
  border-radius: var(--r);
  background: var(--paper);
}
.client-directory-item {
  min-height: var(--control-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.client-directory-item:hover {
  background: var(--hover);
}
.client-directory-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.client-directory-name {
  flex: 0 0 auto;
  font-size: 15px;
  line-height: 1;
}
.client-directory-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════
   CLIENT PROFILE
═══════════════════════════════════════ */
.profile-actions { margin-bottom: 16px; }
.client-portal-jump {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 720px;
}
.client-portal-jump .btn {
  height: var(--control-h);
  min-height: var(--control-h);
  padding: 0 10px;
  font-size: 9px;
}
.client-portal-jump .btn.active {
  border-color: var(--primary);
  color: var(--primary-dk);
  background: var(--hover);
}
.portal-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-lt);
  padding: 0 0 12px;
  margin-bottom: 12px;
}
.portal-metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.client-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.client-overview-grid-secondary { margin-bottom: 18px; }
.client-overview-tile {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--border-lt);
  border-radius: var(--r);
  background: var(--paper);
  padding: 16px;
}
.client-overview-tile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-lt);
  padding-bottom: 10px;
}
.client-overview-tile-head .btn {
  height: 28px;
  min-height: 28px;
}
.client-overview-lines { display: grid; gap: 8px; }
.client-overview-line {
  display: grid;
  grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-lt);
}
.client-overview-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.client-overview-line span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.client-overview-line strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.portal-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.portal-tile,
.note-tile {
  border: 1px solid var(--border-lt);
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 12px;
}
.portal-tile-meta,
.note-meta,
.note-date {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
}
.portal-tile-title,
.note-title {
  margin-top: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}
.portal-tile-body,
.note-body {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.note-timeline {
  display: grid;
  gap: 8px;
}
.note-tile {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
}
.client-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.profile-field {
  background: transparent; border: none;
  border-bottom: 1px solid var(--border-lt);
  padding: 8px 0;
}
.profile-key {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); margin-bottom: 3px;
}
.profile-val { font-size: 13px; color: var(--ink); word-break: break-word; font-weight: 500; }

/* ═══════════════════════════════════════
   QUOTE PREVIEW SUMMARY
═══════════════════════════════════════ */
.quote-preview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════
   QUOTE GROUPED PRINT LAYOUT
═══════════════════════════════════════ */
.quote-grouped { display: flex; flex-direction: column; gap: 24px; }

.quote-service-section { border: 1px solid var(--border-lt); border-radius: var(--r-lg); overflow: hidden; }

.quote-service-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg); border-bottom: 1px solid var(--border-lt);
}
.quote-service-name { font-size: 13px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .04em; }
.quote-service-subtotal { font-size: 13px; font-weight: 700; color: var(--muted); }

.quote-subtotal-row td { background: var(--bg); border-top: 1px solid var(--border-lt) !important; font-weight: 700; }
.quote-subtotal-label { text-align: right !important; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.quote-subtotal-cell { text-align: right !important; color: var(--ink); font-size: 13px; }

.quote-grand-total {
  display: flex; align-items: center; justify-content: flex-end; gap: 24px;
  padding: 14px 16px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-lg);
}
.quote-grand-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.quote-grand-amount { font-size: 20px; font-weight: 700; }

/* ═══════════════════════════════════════
   AFTER-HOURS PANEL
═══════════════════════════════════════ */
.after-hours-panel {
  border: 1px solid var(--border-lt);
  border-radius: var(--r);
  background: var(--bg);
  padding: 14px;
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
}
.after-hours-title { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--muted); margin: 0; text-transform: uppercase; letter-spacing: .08em; }
.after-hours-row {
  display: grid;
  grid-template-columns: 130px repeat(5, minmax(0, 1fr));
  gap: 8px; align-items: end;
  border: 1px solid var(--border-lt);
  border-radius: var(--r);
  background: var(--paper); padding: 10px;
}
.after-hours-check {
  display: flex; gap: 7px; align-items: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  color: var(--muted); padding-bottom: 7px; white-space: nowrap;
}
.after-hours-check input { width: 14px; height: 14px; min-height: auto; margin: 0; }

/* ═══════════════════════════════════════
   PREDICTION CARD
═══════════════════════════════════════ */
.prediction-card {
  border: 1px solid var(--border-lt);
  border-radius: var(--r);
  background: var(--bg);
  padding: 12px; grid-column: 1 / -1;
}
.prediction-title {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700;
  color: var(--primary-dk); text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: 8px;
}
.prediction-line { font-size: 12px; color: var(--muted); margin: 4px 0; font-family: var(--font-mono); }

/* ═══════════════════════════════════════
   INVOICE LINE EDITOR
═══════════════════════════════════════ */
.invoice-line-editor {
  border: 1px solid var(--border-lt);
  border-radius: var(--r);
  background: var(--bg);
  padding: 12px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; align-items: end;
}
.invoice-line-title {
  grid-column: 1 / -1;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--muted); letter-spacing: .06em;
}

/* ═══════════════════════════════════════
   ROSTER BOARD
═══════════════════════════════════════ */
.roster-action-row {
  display: flex; align-items: flex-end;
  justify-content: space-between; gap: 14px;
}
.roster-filter-left { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.roster-action-row .roster-header-actions,
.roster-action-row .table-filter-actions {
  margin-left: auto; display: flex;
  align-items: flex-end; justify-content: flex-end; gap: 8px;
}
.table-filter-actions { margin-left: auto; align-self: flex-end; justify-content: flex-end; }
.roster-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.roster-filterbar input { width: 240px; flex-shrink: 0; }
.roster-filterbar select { width: 180px; flex-shrink: 0; }

.roster-board {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(150px, 1fr));
  overflow-x: auto;
  background: transparent;
  width: 100%;
}
.roster-corner, .roster-day-head {
  position: sticky; top: 0; z-index: 4;
  background: var(--bg);
  border-bottom: 1px solid var(--border-lt);
  min-height: 42px; padding: 10px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
}
.roster-corner { left: 0; z-index: 5; border-right: 1px solid var(--border-lt); }
.roster-day-head { border-left: 1px solid var(--border-lt); display: flex; align-items: center; justify-content: center; }
.roster-time-rail {
  display: grid; grid-template-rows: repeat(13, 72px);
  background: var(--bg); border-right: 1px solid var(--border-lt);
  grid-column: 1; grid-row: 2; min-width: 72px;
}
.roster-time-block {
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 10px 10px 0 4px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--muted); white-space: nowrap;
  border-bottom: 1px solid var(--border-lt);
  min-height: 72px;
}
.roster-day-column {
  position: relative;
  display: grid; grid-template-rows: repeat(13, 72px);
  border-left: 1px solid var(--border-lt);
  background: var(--paper);
  grid-row: 2; min-width: 150px;
}
.roster-day-column.drag-over {
  background: var(--hover);
  box-shadow: inset 0 0 0 2px rgba(13,148,136,.22);
}
.roster-slot { min-height: 72px; border-bottom: 1px solid var(--border-lt); pointer-events: none; }
.roster-slot:nth-child(odd) { background: var(--paper); }
[data-theme="dark"] .roster-slot:nth-child(odd) { background: var(--paper); }

.roster-shift-card {
  position: absolute; left: 5px; right: 5px; min-height: 34px;
  border: 1px solid var(--border-lt);
  border-radius: var(--r); padding: 8px;
  background: var(--paper);
  cursor: grab; overflow: hidden; z-index: 3;
  box-shadow: var(--sh-sm);
  transition: border-color .1s, box-shadow .1s;
}
.roster-shift-card:hover { border-color: var(--primary); box-shadow: var(--sh); z-index: 4; }
.roster-shift-card.dragging { opacity: .6; cursor: grabbing; }
.roster-shift-card.resizing { cursor: ns-resize; z-index: 6; }
.roster-shift-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(13,148,136,.18); background: var(--hover); }
[data-theme="dark"] .roster-shift-card.selected { background: #0d2420; }

.roster-resize-handle {
  position: absolute; left: 18px; right: 18px; height: 2px;
  border: 0; border-radius: 999px;
  background: var(--border); cursor: ns-resize; padding: 0; opacity: .6;
}
.roster-resize-start { top: 3px; }
.roster-resize-end { bottom: 3px; }
.roster-resize-handle:hover { opacity: 1; background: var(--primary); }
.roster-select-tick {
  position: absolute; top: 4px; right: 6px;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 14px; font-weight: 900;
  line-height: 1; pointer-events: all; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 4px;
  background: var(--paper); z-index: 5;
}
.roster-shift-card.selected .roster-select-tick { background: var(--primary); color: #fff; border-color: var(--primary); }
.roster-select-tick:hover { border-color: var(--primary); }
.bulk-shift-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* floating multi-select bulk action bar */
.roster-bulk-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 9998;
  background: var(--ink); color: var(--paper);
  border-radius: 999px;
  padding: 8px 16px; gap: 10px;
  display: flex; align-items: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  animation: fadeInScale .12s ease;
}
.roster-bulk-bar .btn { border-radius: 999px; font-size: 12px; padding: 4px 12px; }
.roster-bulk-bar .btn.plain { color: var(--paper); opacity: .7; }
.roster-bulk-bar .btn.plain:hover { opacity: 1; background: rgba(255,255,255,.1); }
.roster-bulk-count { font-size: 13px; font-weight: 600; white-space: nowrap; margin-right: 4px; }

.roster-shift-badges { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.roster-travel-badge {
  display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .3px;
  padding: 1px 5px; border-radius: 999px;
  background: #d1fae5; color: #065f46;
  white-space: nowrap;
}
[data-theme="dark"] .roster-travel-badge { background: #064e3b; color: #6ee7b7; }

.shift-float-menu {
  position: fixed; z-index: 9999;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-lg, 0 8px 24px rgba(0,0,0,.18));
  padding: 6px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 170px;
  animation: fadeInScale .1s ease;
}
.shift-float-menu .btn { width: 100%; text-align: left; justify-content: flex-start; font-size: 13px; padding: 6px 10px; }
@keyframes fadeInScale { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

.roster-shift-time {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.roster-shift-service {
  font-size: 13px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.roster-shift-meta {
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
.roster-shift-billing {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}

/* ═══════════════════════════════════════
   APPEARANCE SETTINGS
═══════════════════════════════════════ */
.appearance-card { max-width: 720px; padding: 4px 0 14px; }
.appearance-title {
  font-family: var(--font-mono); font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
}
.appearance-copy { color: var(--muted); max-width: 620px; margin-bottom: 14px; }
.appearance-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ═══════════════════════════════════════
   DASHBOARD COMMAND CENTRE
═══════════════════════════════════════ */
.dashboard-command { display: flex; flex-direction: column; gap: 26px; width: 100%; }
.dashboard-command-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  border-top: 1px solid var(--border-lt);
  border-bottom: 1px solid var(--border-lt);
  padding: 14px 0;
}
.dashboard-section {
  width: 100%;
  border-top: 1px solid var(--border-lt);
  border-bottom: 1px solid var(--border-lt);
  padding: 18px 0 20px;
  background: transparent;
}
.dashboard-section-head {
  display: flex; justify-content: space-between;
  align-items: flex-end; gap: 16px; margin-bottom: 14px;
}
.dashboard-section-head h2 {
  margin: 0; font-family: var(--font-mono);
  font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.dashboard-section-head p { margin: 4px 0 0; color: var(--muted); max-width: 920px; font-size: 13px; }
.dashboard-finance-grid { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 16px; }
.dashboard-chart-card {
  background: transparent;
  border-top: 1px solid var(--border-lt);
  border-bottom: 1px solid var(--border-lt);
  padding: 14px 0; min-width: 0;
}
.dashboard-chart-title {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 12px;
}
.dashboard-donut { width: 162px; height: 162px; border-radius: 50%; display: grid; place-items: center; margin: 6px auto 12px; }
.dashboard-donut-inner {
  width: 106px; height: 106px; border-radius: 50%;
  background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid var(--border-lt);
}
.dashboard-donut-inner strong { font-size: 26px; line-height: 1; }
.dashboard-donut-inner span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.dashboard-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.dashboard-bar-row {
  display: grid; grid-template-columns: minmax(100px, 1fr) 1.6fr minmax(76px, auto);
  gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border-lt);
}
.dashboard-bar-row:last-child { border-bottom: 0; }
.dashboard-bar-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.dashboard-bar-track { height: 10px; background: var(--bg); border: 1px solid var(--border-lt); overflow: hidden; }
.dashboard-bar-fill { height: 100%; background: var(--red); }
.dashboard-bar-value { text-align: right; font-weight: 700; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.dashboard-sparkline { height: 170px; display: flex; align-items: flex-end; gap: 8px; padding: 8px 0 14px; border-bottom: 1px solid var(--border-lt); }
.dashboard-sparkbar { flex: 1; min-width: 8px; background: var(--red); border: 1px solid var(--border); }
.dashboard-work-grid { display: grid; grid-template-columns: repeat(3, minmax(200px, 1fr)); gap: 16px; }
.dashboard-work-card { padding: 12px 0; }

/* dashboard command strip stat overrides */
.dashboard-command-strip .stat,
.dashboard-work-grid .stat,
.dashboard-chart-card .stat {
  border: 0; border-radius: 0; box-shadow: none;
  background: transparent;
  border-bottom: 1px solid var(--border-lt);
}

/* ═══════════════════════════════════════
   PRINT STYLES
═══════════════════════════════════════ */
.print-record { background: #fff; color: #171717; }
.print-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.print-detail-row {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr;
  gap: 14px; border-bottom: 1px solid #d7d7d7; padding: 8px 0;
}
.print-detail-label { font-weight: 700; text-transform: uppercase; font-size: 11px; color: #57534e; font-family: var(--font-mono); }
.print-detail-value { font-weight: 600; overflow-wrap: anywhere; }
.print-body { display: flex; flex-direction: column; gap: 16px; padding: 4px 0; }
.print-meta {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px; padding: 12px 0 16px;
  margin-bottom: 0; border-bottom: 1px solid #171717; color: #171717;
}
.print-meta strong { font-weight: 700; }

.print-template-document { background: #fff; color: #171717; }
.og-template-head {
  border-top: 6px solid var(--red);
  border-bottom: 1px solid #171717;
  padding: 16px 0 12px; margin-bottom: 16px;
}
.og-template-title {
  font-family: var(--font-mono); font-size: 22px; font-weight: 700;
  text-transform: uppercase; letter-spacing: -.02em;
}
.og-template-sub { color: var(--muted); font-size: 12px; margin-top: 4px; text-transform: uppercase; font-family: var(--font-mono); }
.print-template-section { border-bottom: 1px solid #171717; padding: 10px 0 14px; margin-bottom: 14px; }
.print-template-body { font-size: 14px; line-height: 1.6; }
.print-template-footer { border-bottom: 0; color: #57534e; font-size: 12px; }
.template-line { padding: 3px 0; white-space: pre-wrap; }
.template-spacer { height: 10px; }
.og-template-details { border-top: 1px solid #171717; margin-top: 12px; }
.client-workflow-head { justify-content: flex-end; margin: 8px 0 12px; }

@media print {
  @page { margin: 14mm; }
  html, body, #app, .app, .main, .drawer-backdrop, .drawer, .print-area {
    background: #fff !important; color: #171717 !important;
  }
  body { margin: 0 !important; }
  body * { visibility: hidden !important; background-color: transparent !important; box-shadow: none !important; }
  .print-area, .print-area * { visibility: visible !important; }
  .print-area {
    position: fixed !important; left: 0 !important; top: 0 !important;
    width: 100% !important; min-height: auto !important;
    overflow: visible !important; background: #fff !important;
  }
  .drawer-backdrop { display: block !important; padding: 0 !important; background: #fff !important; }
  .print-area .drawer-head { position: static !important; background: #fff !important; }
  .print-area .drawer-head button,
  .print-area .btn-row .btn,
  .print-area .filterbar,
  .print-area .footerbar,
  .print-area .actions-head,
  .print-area .actions-cell { display: none !important; }
  .og-template-head { break-before: avoid !important; }
  .print-template-section, .og-template-details { break-inside: avoid !important; }
  html, body, body *, .print-area, .print-area * { color-scheme: light !important; }
}

/* ═══════════════════════════════════════
   ROSTER WORKFLOW (rw-*)
═══════════════════════════════════════ */
.rw-planned-toolbar { display:flex; align-items:center; gap:8px; flex-wrap:nowrap; margin-bottom:12px; }
.rw-planned-toolbar .input-label { margin:0; white-space:nowrap; }
.btn.sm { height:28px; padding:0 10px !important; font-size:10px !important; }
.budget-cap-hint { margin-top:-6px; margin-bottom:4px; font-size:11px; }
.budget-cap-over { color:var(--red) !important; font-weight:600; }

.rw-routine-modal {
  width: min(480px, calc(100vw - 32px));
  padding: 24px;
}
.rw-routine-modal .drawer-head {
  align-items: flex-start;
  margin-bottom: 24px;
}
.rw-routine-form {
  display: grid;
  gap: 18px;
}
.rw-field-full {
  width: 100%;
}
.rw-modal-days {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.rw-day-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-lt);
  border-radius: var(--r);
  background: var(--paper);
  cursor: pointer;
  font-size: 13px;
}
.rw-day-chip-all {
  font-weight: 700;
}
.rw-day-chip input {
  margin: 0;
}
.rw-routine-modal .rw-time-row {
  display: grid;
  grid-template-columns: minmax(120px, 140px) minmax(120px, 140px) minmax(180px, 1fr);
  gap: 16px;
  align-items: end;
  margin-top: 0;
}
.rw-routine-modal .page-sub {
  min-height: 18px;
  margin: -4px 0 0;
}
.rw-routine-footer {
  margin-top: 8px;
  justify-content: flex-start;
}

.rw-day-checks { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.rw-day-check, .rw-day-check-all { display:inline-flex; align-items:center; gap:4px; font-size:12px; cursor:pointer; padding:4px 8px; border:1px solid var(--border-lt); border-radius:4px; }
.rw-day-check-all { font-weight:700; background:var(--bg-alt); }
.rw-day-check input, .rw-day-check-all input { margin:0; cursor:pointer; }

.rw-time-row { display:flex; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-top:4px; }
.rw-time-row .input-group { flex:0 0 auto; }

.rw-participant-list { display:flex; flex-direction:column; gap:6px; margin:8px 0; }
.rw-participant-row { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; background:var(--bg-alt); border:1px solid var(--border-lt); border-radius:6px; }
.rw-participant-archived { opacity:0.65; }
.rw-participant-name { font-size:14px; font-weight:500; }
.rw-participant-archived-section { margin-top:14px; }
.rw-participant-add { margin-top:4px; }
.rw-participant-checklist { display:flex; flex-direction:column; gap:2px; max-height:240px; overflow-y:auto; padding:4px 0; }
.rw-participant-check-row { display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:5px; cursor:pointer; }
.rw-participant-check-row:hover { background:var(--bg-alt); }
.rw-participant-check-row input[type=checkbox] { width:16px; height:16px; accent-color:var(--accent); cursor:pointer; flex-shrink:0; }
.rw-participant-check-row label { font-size:14px; cursor:pointer; flex:1; }
.rw-add-participant-row { display:flex; align-items:center; gap:8px; margin-top:6px; }
.rw-add-participant-row select { flex:1; }

.rw-status-bar { display:flex; align-items:center; gap:12px; padding:8px 12px; background:var(--bg-alt); border:1px solid var(--border-lt); border-radius:6px; margin-bottom:12px; font-size:12px; }
.rw-status-house { font-weight:600; }
.rw-status-note { color:var(--muted); }

.rw-legend { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.rw-badge { display:inline-flex; align-items:center; padding:3px 8px; border-radius:4px; font-size:11px; font-weight:600; font-family:var(--font-mono); }
.rw-HL,
.rw-CP,
.rw-SL,
.rw-ET { background: var(--hover); color: var(--primary-dk); }

.rw-grid-wrap { overflow-x:auto; margin-top:8px; user-select:none; }
.rw-grid { border-collapse:collapse; width:100%; min-width:700px; font-size:12px; }
.rw-grid th { background:var(--bg-alt); border:1px solid var(--border-lt); padding:6px 8px; font-size:11px; font-weight:700; text-align:center; text-transform:uppercase; letter-spacing:.05em; position:sticky; top:0; z-index:1; }
.rw-grid td { border:1px solid var(--border-lt); padding:1px 2px; vertical-align:top; min-width:90px; }
.rw-time-col { font-family:var(--font-mono); font-size:10px; color:var(--muted); text-align:right; padding:2px 6px; white-space:nowrap; min-width:44px; width:44px; background:var(--bg-alt); }
.rw-cell { cursor:pointer; min-height:22px; height:22px; transition:background .08s; }
.rw-cell:hover { background:var(--bg-alt); }
.rw-cell-HL,
.rw-cell-CP,
.rw-cell-SL,
.rw-cell-ET { background: var(--hover); }
.rw-half .rw-cell { border-top:1px dashed var(--border-lt); }
.rw-cell-selected { background: #c7d9ff !important; outline: 2px solid var(--primary) !important; outline-offset:-1px; }
.rw-cell-drag { background: #dce9ff !important; outline: 1px dashed var(--primary) !important; outline-offset:-1px; }
:root[data-theme="dark"] .rw-cell-selected { background: #2a3f6f !important; }
:root[data-theme="dark"] .rw-cell-drag { background: #1e3058 !important; }

/* Selection action bar */
.rw-sel-bar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:8px 10px; background:var(--primary); border-radius:var(--r); margin-bottom:8px; transition:opacity .15s, transform .15s; }
.rw-sel-bar-hidden { display:none; }
.rw-sel-count { font-size:12px; font-weight:700; color:#fff; white-space:nowrap; }
.rw-sel-svc { height:28px; font-size:11px; flex:1; min-width:160px; max-width:260px; }
.rw-sel-bar .btn { flex-shrink:0; }
.rw-grid-chip { display:flex; align-items:center; gap:3px; padding:1px 4px; border-radius:3px; font-size:10px; }
.rw-chip-code { font-weight:700; font-family:var(--font-mono); }
.rw-chip-ratio { color:var(--muted); }

.rw-staff-bar { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-bottom:12px; }
.rw-staff-day { background:var(--bg-alt); border:1px solid var(--border-lt); border-radius:6px; padding:8px; font-size:12px; }
.rw-staff-label { font-weight:600; font-size:11px; text-transform:uppercase; margin-bottom:4px; font-family:var(--font-mono); color:var(--muted); }
.rw-staff-count { font-size:22px; font-weight:700; color:var(--ink); }

.rw-lane-card { position:absolute; left:2px; right:2px; border-radius:4px; overflow:hidden; display:flex; flex-direction:column; justify-content:flex-start; padding:3px 6px; font-size:11px; border:1px solid var(--border-lt); }
.rw-svc-HL,
.rw-svc-CP,
.rw-svc-SL,
.rw-svc-ET { background: var(--hover); color: var(--primary-dk); border-color: var(--border); }
.rw-card-type { font-weight:700; font-family:var(--font-mono); font-size:10px; }
.rw-card-time { font-size:9px; color:inherit; opacity:.75; }
.rw-ratio-badge {
  display:inline-block; font-size:9px; font-weight:700; font-family:var(--font-mono);
  padding:0 3px; border-radius:3px; margin-left:2px;
  background:rgba(0,0,0,.12); color:inherit; opacity:.9;
  white-space:nowrap;
}

/* ═══════════════════════════════════════
   MISC UTILITIES
═══════════════════════════════════════ */
.page-kicker {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--red); margin-bottom: 4px;
}
.danger-text { color: var(--red) !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-lt) transparent; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-thumb { background: var(--border-lt); border-radius: 2px; }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media(max-width:980px){
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-head { flex-direction: column; }
  .search-box input { width: 100%; }
  .main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .split { grid-template-columns: 1fr; }
  .quote-preview-summary { grid-template-columns: repeat(2, 1fr); }
  .after-hours-row { grid-template-columns: 1fr 1fr; }
  .after-hours-check { grid-column: 1/-1; padding-bottom: 0; }
  .invoice-line-editor { grid-template-columns: 1fr; }
  .client-profile-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-metric-row, .portal-tile-grid, .client-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-portal-jump { justify-content: flex-start; max-width: none; }
  .dashboard-command-strip { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .dashboard-finance-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .dashboard-work-grid { grid-template-columns: repeat(2, minmax(200px, 1fr)); }
  .roster-action-row { align-items: stretch; }
  .roster-filter-left, .roster-action-row .roster-header-actions { width: 100%; }
  .roster-action-row .roster-header-actions { justify-content: flex-start; }
  .print-meta { grid-template-columns: 1fr; }
}
@media(max-width:600px){
  .app { grid-template-columns: var(--sidebar-w-col) minmax(0,1fr); }
  .sidebar-nav { padding: 18px 8px 10px; }
  .sidebar-footer { padding: 8px 8px 10px; }
  .group-title { font-size: 0; height: 0; margin: 0; overflow: hidden; }
  nav button { justify-content: center; gap: 0; padding: 9px 0; }
  nav button span { display: none; }
  nav button svg { width: 18px; height: 18px; }
  .nav-count { display: none; }
  .quote-preview-summary { grid-template-columns: 1fr; }
  .client-profile-grid { grid-template-columns: 1fr; }
  .portal-metric-row, .portal-tile-grid, .client-overview-grid, .note-tile { grid-template-columns: 1fr; }
  .client-directory-controls { align-items: stretch; flex-direction: column; }
  .client-directory-item { align-items: center; flex-direction: row; }
  .client-directory-main { gap: 10px; }
  .client-directory-search { width: 100%; }
  .dashboard-command-strip, .dashboard-finance-grid, .dashboard-work-grid { grid-template-columns: 1fr; }
  .dashboard-bar-row { grid-template-columns: 1fr; gap: 6px; }
  .dashboard-bar-value { text-align: left; }
}

/* ── color-scheme declarations ── */
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }
html[data-theme="light"] body, html[data-theme="dark"] body { background-color: var(--bg); color: var(--ink); }
