/* =================================================================
   Northern Medical Products · styles.css
   Flat, readable operations hub. NMP green + grey. Fluid layout with a
   left sidebar (drawer + bottom tab bar on narrow screens). Theme-aware
   via [data-theme]. Feature styles follow, one section per module.
   ================================================================= */

/* ─── Reset (minimal) ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; }

/* =================================================================
   TYPE SYSTEM
     --t-ui      : Inter            → everything on screen
     --t-display : Inter (heavier)  → headings
     --t-prose   : Source Serif 4   → the paper preview + long notes only
     --t-num     : IBM Plex Mono    → numbers, codes, IDs, money
   ================================================================= */
:root {
  --t-ui:      'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --t-display: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --t-prose:   'Source Serif 4', Georgia, 'Times New Roman', serif;
  --t-num:     'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sb-w: 248px;
}

/* ─── Color tokens (dark default) ─────────────────────────────── */
:root {
  /* Greys with a faint green undertone */
  --bg:           oklch(0.17 0.006 160);
  --bg-2:         oklch(0.20 0.007 160);
  --surface:      oklch(0.215 0.007 160);
  --surface-2:    oklch(0.26 0.008 160);
  --line:         oklch(1 0 0 / 0.10);
  --line-2:       oklch(1 0 0 / 0.16);

  /* Legacy names used by the feature styles → map onto the flat surfaces */
  --glass:        var(--surface);
  --glass-2:      var(--surface-2);
  --glass-sheen:  transparent;
  --glass-stroke: var(--line);
  --centerline:   transparent;

  /* Sidebar: deep NMP green-grey in both themes */
  --sb-bg:        oklch(0.19 0.022 160);
  --sb-line:      oklch(1 0 0 / 0.10);
  --sb-hover:     oklch(1 0 0 / 0.06);
  --sb-ink:       oklch(0.96 0.005 155);
  --sb-ink-2:     oklch(0.78 0.012 155);
  --sb-ink-3:     oklch(0.58 0.014 155);

  /* Type ink */
  --ink:          oklch(0.955 0.005 155);
  --ink-2:        oklch(0.80 0.010 155);
  --ink-3:        oklch(0.63 0.012 155);
  --ink-mute:     oklch(0.48 0.012 155);

  /* PRIMARY ACCENT — NMP green, sampled from the logo */
  --accent:       oklch(0.72 0.15 156);
  --accent-2:     oklch(0.78 0.13 156);
  --accent-soft:  oklch(0.72 0.15 156 / 0.16);
  --accent-ring:  oklch(0.72 0.15 156 / 0.45);
  --accent-ink:   oklch(0.18 0.04 155);

  /* Secondary highlight — amber, sparingly ("edited" markers) */
  --gold:         oklch(0.80 0.13 70);
  --gold-soft:    oklch(0.80 0.13 70 / 0.18);

  /* Status */
  --ok:           oklch(0.78 0.10 150);
  --ok-soft:      oklch(0.78 0.10 150 / 0.18);
  --warn:         oklch(0.80 0.11 80);
  --warn-soft:    oklch(0.80 0.11 80 / 0.18);
  --rust:         oklch(0.66 0.14 35);
  --rust-soft:    oklch(0.66 0.14 35 / 0.18);
  --info:         oklch(0.75 0.08 220);
  --info-soft:    oklch(0.75 0.08 220 / 0.18);

  /* Printable paper (invoice / estimate preview) */
  --paper:        oklch(0.985 0.006 85);
  --paper-ink:    oklch(0.22 0.012 60);
  --paper-rule:   oklch(0.88 0.008 70);

  /* Geometry */
  --r-sm:  6px;
  --r:     8px;
  --r-lg:  12px;
  --r-xl:  18px;
  --shadow-1: 0 1px 2px oklch(0 0 0 / 0.25);
  --shadow-2: 0 12px 40px -16px oklch(0 0 0 / 0.6);
  --ring:     0 0 0 3px var(--accent-ring);
}

[data-theme="light"] {
  --bg:           oklch(0.965 0.004 160);        /* light grey */
  --bg-2:         oklch(0.94 0.005 160);
  --surface:      oklch(1 0 0);
  --surface-2:    oklch(0.955 0.004 160);
  --line:         oklch(0 0 0 / 0.10);
  --line-2:       oklch(0 0 0 / 0.16);

  --sb-bg:        oklch(0.24 0.024 160);
  --sb-line:      oklch(1 0 0 / 0.10);
  --sb-hover:     oklch(1 0 0 / 0.07);

  --ink:          oklch(0.21 0.012 155);
  --ink-2:        oklch(0.38 0.010 155);
  --ink-3:        oklch(0.52 0.010 155);
  --ink-mute:     oklch(0.68 0.010 155);

  --accent:       oklch(0.50 0.15 156);          /* darker green for contrast on light grey */
  --accent-2:     oklch(0.56 0.14 156);
  --accent-soft:  oklch(0.50 0.15 156 / 0.12);
  --accent-ring:  oklch(0.50 0.15 156 / 0.35);
  --accent-ink:   oklch(0.99 0.005 156);

  --gold:         oklch(0.62 0.13 70);
  --gold-soft:    oklch(0.80 0.13 70 / 0.22);
  --ok:           oklch(0.52 0.12 150);
  --ok-soft:      oklch(0.78 0.10 150 / 0.20);
  --warn:         oklch(0.60 0.13 75);
  --warn-soft:    oklch(0.80 0.11 80 / 0.24);
  --rust:         oklch(0.52 0.16 35);
  --rust-soft:    oklch(0.62 0.14 35 / 0.16);
  --info:         oklch(0.50 0.10 220);
  --info-soft:    oklch(0.75 0.08 220 / 0.18);

  --shadow-1: 0 1px 2px oklch(0 0 0 / 0.06);
  --shadow-2: 0 12px 32px -16px oklch(0 0 0 / 0.22);
}
/* The sidebar keeps its own light text in both themes */
[data-theme="light"] .sidebar { --accent: oklch(0.72 0.15 156); --accent-2: oklch(0.80 0.13 156); --accent-soft: oklch(0.72 0.15 156 / 0.18); }

/* Inset "pocket" backgrounds (period banner, summary rows, line rows, aging
   rows, action bars) use a dark translucent overlay in the default dark
   theme. Flip those to a subtle grey overlay in light mode. */
[data-theme="light"] .inv-period,
[data-theme="light"] .inv-summary,
[data-theme="light"] .inv-line-row,
[data-theme="light"] .inv-line-list,
[data-theme="light"] .aging-row,
[data-theme="light"] .dash-cov-row,
[data-theme="light"] .dash-activity-row,
[data-theme="light"] .est-pip-stat,
[data-theme="light"] .q-session-row,
[data-theme="light"] .q-tech-unit,
[data-theme="light"] .users-access,
[data-theme="light"] .qr-row,
[data-theme="light"] .qr-summary,
[data-theme="light"] .qr-mode-banner,
[data-theme="light"] .compose-unit,
[data-theme="light"] .compose-pre,
[data-theme="light"] .recipient-row,
[data-theme="light"] .catpick-row,
[data-theme="light"] .bulk-dim-list,
[data-theme="light"] .access-row:hover,
[data-theme="light"] .bay-label:focus,
[data-theme="light"] .bay-notes:focus,
[data-theme="light"] .est-title:focus,
[data-theme="light"] .est-num-input:focus {
  background: oklch(0 0 0 / 0.045) !important;
}
[data-theme="light"] .inv-line-row:hover { background: oklch(0 0 0 / 0.07) !important; }
[data-theme="light"] .inv-line-row.is-on,
[data-theme="light"] .qr-row.is-on,
[data-theme="light"] .compose-unit.is-on { background: var(--accent-soft) !important; }

/* Cards that used to be tinted glass → plain surfaces */
[data-theme="light"] .inv-tab,
[data-theme="light"] .facility-card,
[data-theme="light"] .est-card,
[data-theme="light"] .user-card,
[data-theme="light"] .q-director-card,
[data-theme="light"] .inv-batch-card,
[data-theme="light"] .q-tile,
[data-theme="light"] .bay,
[data-theme="light"] .cf-slot,
[data-theme="light"] .cf-unit,
[data-theme="light"] .ca-exc li,
[data-theme="light"] .theme-card,
[data-theme="light"] .cal-cell { background: var(--surface-2); border-color: var(--line); }

/* ─── Body base ───────────────────────────────────────────────── */
body {
  font-family: var(--t-ui);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* =================================================================
   APP SHELL · sidebar + content column
   ================================================================= */
.shell {
  display: grid;
  grid-template-columns: var(--sb-w) minmax(0, 1fr);
  height: 100vh; height: 100dvh;
}

.sidebar {
  display: flex; flex-direction: column;
  background: var(--sb-bg);
  color: var(--sb-ink);
  border-right: 1px solid var(--sb-line);
  min-height: 0;
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; }
.sb-logo { width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; flex-shrink: 0; }
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sb-brand-name { font-weight: 600; font-size: 13px; letter-spacing: -0.005em; color: var(--sb-ink); }
.sb-brand-sub { font-size: 10px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sb-ink-3); }
.icon-btn.sb-close { display: none; margin-left: auto; color: var(--sb-ink-2); }

.sb-nav { flex: 1; overflow-y: auto; padding: 6px 10px 10px; min-height: 0; }
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--sb-line); border-radius: 3px; }
.sb-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.sb-group-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sb-ink-3); padding: 10px 10px 6px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r);
  color: var(--sb-ink-2); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  transition: background-color .12s, color .12s;
}
.sb-item .ico { flex-shrink: 0; opacity: .85; }
.sb-item:hover { background: var(--sb-hover); color: var(--sb-ink); }
.sb-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-2); }
.sb-item[aria-current="page"] .ico { opacity: 1; }

.sb-foot { padding: 10px; border-top: 1px solid var(--sb-line); display: flex; flex-direction: column; gap: 8px; }
.sb-foot .curtain-pill { align-self: flex-start; margin: 2px 4px 0; }
.sb-user {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: var(--r); text-align: left;
  color: var(--sb-ink);
}
.sb-user:hover { background: var(--sb-hover); }
.sb-user > svg { color: var(--sb-ink-3); margin-left: auto; }
.sb-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.sb-user-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sb-user-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-role { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sb-ink-3); }

.content { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 24px; min-height: 60px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.icon-btn.topbar-menu { display: none; }
.topbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.topbar-eyebrow { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); min-height: 13px; }
.topbar-h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-actions:empty { display: none; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r);
  display: grid; place-items: center;
  color: var(--ink-2); border: 1px solid transparent;
  transition: background-color .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.view {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 36px;
  scroll-padding-top: 20px;
}
.view::-webkit-scrollbar { width: 8px; }
.view::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

.tabbar { display: none; }

/* Two-col split (rail + main) — shared layout primitive. The rail stays put
   while the main pane scrolls with the page. */
.split {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.split > aside, .split > .inv-rail {
  position: sticky; top: 0;
  max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px);
  overflow-y: auto;
}
body.responsive-route .split { grid-template-columns: 1fr; }
body.responsive-route .split > aside, body.responsive-route .split > .inv-rail { position: static; max-height: none; overflow: visible; }

/* ─── Account menu ───────────────────────────────────────────── */
.menu {
  position: fixed; z-index: 70; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; line-height: 1.25; }
.menu-name { font-weight: 600; font-size: 13px; }
.menu-email { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.menu-item {
  display: block; width: 100%; text-align: left; text-decoration: none;
  padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--ink);
}
.menu-item:hover { background: var(--surface-2); }
.menu-danger { color: var(--rust); }

/* ─── Narrow screens: drawer + tab bar ───────────────────────── */
body.narrow .shell { grid-template-columns: 1fr; }
body.narrow .sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: min(300px, 86vw);
  transform: translateX(-100%);
  transition: transform .2s ease-out;
  box-shadow: var(--shadow-2);
}
body.narrow.drawer-open .sidebar { transform: none; }
body.narrow .icon-btn.sb-close { display: grid; }
.sb-scrim { position: fixed; inset: 0; z-index: 55; background: oklch(0 0 0 / 0.5); }
body.narrow .topbar { padding: 8px 12px; min-height: 54px; gap: 8px; }
body.narrow .icon-btn.topbar-menu { display: grid; }
body.narrow .topbar-h1 { font-size: 16px; }
body.narrow .topbar-quick span { display: none; }
body.narrow .topbar-quick { padding: 8px 10px; }
body.narrow .view { padding: 14px 14px 24px; }
body.narrow .tabbar {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 2px; padding: 6px 6px max(env(safe-area-inset-bottom), 6px);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; border-radius: var(--r);
  font-size: 10.5px; font-weight: 500; color: var(--ink-3); text-decoration: none;
}
.tab[aria-current="page"] { color: var(--accent); }
.tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ─── Card ───────────────────────────────────────────────────── */
.glass, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  position: relative;
}
.card { padding: 16px; }
.card-pad { padding: 20px; }

/* =================================================================
   TYPE PRIMITIVES
   ================================================================= */
.h-eyebrow {
  font-family: var(--t-ui);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3);
}
.h-display {
  font-family: var(--t-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
}
/* The old editorial italic ornament reads as plain text now */
.h-display em { font-style: normal; font-weight: inherit; color: inherit; }
.h1 { font-size: 24px; }
.h2 { font-size: 18px; }
.h3 { font-size: 15px; font-weight: 600; }

.num   { font-family: var(--t-num); font-variant-numeric: tabular-nums; font-weight: 500; }
.label { font-family: var(--t-ui); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.mute  { color: var(--ink-3); }

.prose { font-family: var(--t-prose); font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.prose em { color: var(--accent); }

/* Help / empty-state copy */
.empty { font-family: var(--t-ui); color: var(--ink-3); font-size: 13.5px; line-height: 1.5; }

/* =================================================================
   BUTTONS
   ================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r);
  font-family: var(--t-ui);
  font-size: 13px; font-weight: 500;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: background-color .12s, color .12s, border-color .12s, transform .05s, box-shadow .12s;
}
.btn:hover { border-color: var(--line-2); background: var(--surface-2); filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); color: var(--accent-ink); filter: none; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; }
.btn-danger { color: var(--rust); }
.btn-danger:hover { background: var(--rust-soft); color: var(--rust); border-color: transparent; }
.btn-gold { color: var(--gold); }
.btn-gold:hover { background: var(--gold-soft); color: var(--gold); border-color: transparent; }

.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 13px 18px; font-size: 14px; }
.btn-caps { text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.btn .ico { flex-shrink: 0; }

/* =================================================================
   INPUTS
   ================================================================= */
.field { display: flex; flex-direction: column; gap: 6px; font-family: var(--t-ui); }
.field > span {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3);
}
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="tel"], input[type="url"],
input:not([type]), textarea, select {
  font-family: var(--t-ui);
  font-size: 14px;
  padding: 9px 11px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
textarea { line-height: 1.5; resize: vertical; }
select { padding-right: 28px; }
::placeholder { color: var(--ink-mute); }

/* Toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  width: 38px; height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2);
  position: relative; transition: background-color .15s; flex-shrink: 0;
}
.switch i::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ink-3); transition: transform .15s, background-color .15s;
}
.switch input:checked + i { background: var(--accent); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(16px); background: var(--accent-ink); }
.switch input:focus-visible + i { box-shadow: var(--ring); }

/* =================================================================
   PILLS / STATUS
   ================================================================= */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-family: var(--t-ui); font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill-ok      { background: var(--ok-soft);     color: var(--ok);     border-color: transparent; }
.pill-warn    { background: var(--warn-soft);   color: var(--warn);   border-color: transparent; }
.pill-rust    { background: var(--rust-soft);   color: var(--rust);   border-color: transparent; }
.pill-info    { background: var(--info-soft);   color: var(--info);   border-color: transparent; }
.pill-accent  { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-gold    { background: var(--gold-soft);   color: var(--gold);   border-color: transparent; }
.pill-brand   { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* =================================================================
   BARS
   ================================================================= */
.bar { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .35s cubic-bezier(.2,.7,.2,1); }
.bar.ok    > i { background: var(--ok); }
.bar.warn  > i { background: var(--warn); }
.bar.gold  > i { background: var(--gold); }

/* =================================================================
   TABLES (shared)
   ================================================================= */
.table { width: 100%; border-collapse: collapse; font-family: var(--t-ui); font-size: 13px; }
.table th { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 8px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num-col { text-align: right; }
.table-wrap { overflow-x: auto; }

/* =================================================================
   LOGIN / BOOT
   ================================================================= */
.login-screen { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 32px; background: var(--bg); }
.login-card { width: min(400px, 100%); padding: 32px; }
.login-mark { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-mark img { width: 130px; }
.login-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
#login-form { display: flex; flex-direction: column; gap: 14px; }
.login-submit { justify-content: center; padding: 12px; font-size: 13px; font-weight: 600; }
.login-error { min-height: 18px; font-size: 12px; color: var(--rust); text-align: center; }

.boot-screen { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; background: var(--bg); }
.boot-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: .35; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.6); box-shadow: 0 0 20px var(--accent); }
}

/* =================================================================
   TOASTS
   ================================================================= */
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
body.narrow .toast-region { right: 12px; left: 12px; bottom: 76px; align-items: center; }
.toast {
  pointer-events: auto;
  padding: 11px 14px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-2);
  font-size: 13px; font-weight: 500; color: var(--ink);
  max-width: 360px;
  animation: toast-in .2s cubic-bezier(.2,.7,.2,1);
}
.toast.ok    { color: var(--ok); }
.toast.warn  { color: var(--warn); }
.toast.rust  { color: var(--rust); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* =================================================================
   MODALS
   ================================================================= */
.modal-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: oklch(0 0 0 / 0.55);
  display: grid; place-items: center; padding: 24px;
}
.modal { width: min(720px, 100%); max-height: 88vh; overflow: auto; padding: 24px; box-shadow: var(--shadow-2); }
.modal-lg { width: min(960px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-title { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.modal-form { display: grid; gap: 14px; }

/* =================================================================
   UTIL
   ================================================================= */
[hidden] { display: none !important; }
code { font-family: var(--t-num); font-size: 0.92em; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.page { display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.callout { padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.callout-warn { border-color: var(--warn); }
.callout-ok { border-color: var(--ok); }
.callout b { color: var(--ink); }

/* Chips (facility access, selections) */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--t-ui); font-size: 11.5px; color: var(--ink-2);
  transition: background-color .12s, color .12s, border-color .12s;
}
button.chip:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.chip.is-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* =================================================================
   RESPONSIVE OVERRIDES (body.responsive-route = narrow viewport)
   ================================================================= */
body.responsive-route .h1 { font-size: 21px; }
body.responsive-route .modal { width: min(720px, 96vw); padding: 18px; }
body.responsive-route .modal-form-2col { grid-template-columns: 1fr; }
body.responsive-route .page-head { flex-direction: column; align-items: stretch; }
@media (max-width: 720px) {
  body.responsive-route .h-display.h1 { font-size: 20px; }
  body.responsive-route .h-display.h2 { font-size: 17px; }
  body.responsive-route .card-pad { padding: 16px; }
}
@media (max-width: 480px) {
  body.responsive-route .modal { padding: 14px; max-height: 92vh; }
  .modal-scrim { padding: 10px; align-items: end; }
}

/* =================================================================
   PRINT — hide app chrome, show only the paper preview at actual size.
   ================================================================= */
@media print {
  body { background: white !important; overflow: visible; }
  .sidebar, .topbar, .tabbar, .sb-scrim, .toast-region, .modal-scrim, .menu,
  .inv-rail, .inv-top, .inv-batch-header, .inv-action-row, .inv-grid, .inv-search-row,
  .paper-action-bar, .est-rail, .est-editor-head, .est-editor-footer { display: none !important; }
  .shell, .content, .view, .split, .invoices-split, .estimates-split, .inv-main, .est-editor {
    display: block !important;
    position: static !important;
    width: auto !important; height: auto !important;
    overflow: visible !important;
    padding: 0 !important; margin: 0 !important;
  }
  .paper {
    background: white !important; color: black !important;
    box-shadow: none !important; border: none !important;
    max-width: none !important; padding: 0 !important;
    page-break-inside: avoid;
  }
  .paper-vendor, .paper-bill, .paper-meta-grid, .paper-lines, .paper-totals, .paper-footer { color: black !important; }
}

/* =================================================================
   HOME (home.js) — the hub
   ================================================================= */
.hub { display: flex; flex-direction: column; gap: 18px; max-width: 1320px; }
.hub-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.hub-greet { margin: 2px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }
.hub-date { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

.hub-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
.hub-action {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; text-align: left;
  transition: border-color .12s, background-color .12s;
}
.hub-action:hover { border-color: var(--accent); background: var(--accent-soft); }
.hub-action .ico { color: var(--accent); flex-shrink: 0; }
.hub-action-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.hub-action-title { font-weight: 600; font-size: 13.5px; }
.hub-action-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-action-big { padding: 20px 16px; }
.hub-action-big .hub-action-title { font-size: 16px; }

.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.hub-card { display: flex; flex-direction: column; gap: 10px; }
.hub-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hub-kpi { font-family: var(--t-num); font-size: 28px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
.hub-kpi-sub { font-size: 12px; color: var(--ink-3); }
.hub-list { display: flex; flex-direction: column; gap: 6px; }
.hub-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: var(--r); background: var(--surface-2);
  font-size: 13px; text-decoration: none; color: inherit;
}
a.hub-row:hover { outline: 1px solid var(--accent); }
.hub-row-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-row-sub { display: block; font-size: 11.5px; color: var(--ink-3); white-space: normal; }
.hub-row-side { display: flex; align-items: center; gap: 8px; }

.hub-attn { display: flex; flex-direction: column; gap: 8px; }
.hub-attn-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface);
  text-decoration: none; color: inherit;
}
.hub-attn-row:hover { border-color: var(--accent); }
.hub-attn-row.is-warn { border-left: 3px solid var(--warn); }
.hub-attn-row.is-rust { border-left: 3px solid var(--rust); }
.hub-attn-row.is-ok   { border-left: 3px solid var(--ok); }
.hub-attn-row.is-info { border-left: 3px solid var(--info); }
.hub-attn-text { flex: 1; font-size: 13px; min-width: 0; }
.hub-attn-text b { font-weight: 600; }
.hub-attn-text small { display: block; color: var(--ink-3); font-size: 11.5px; }

.aging-bars { display: flex; flex-direction: column; gap: 6px; }
.aging-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 6px 10px; background: var(--surface-2); border-radius: var(--r-sm); }
.aging-row .label { font-size: 11px; }
.aging-row-amt { font-size: 12px; color: var(--ink-2); }
.dash-sparkline { display: flex; align-items: flex-end; gap: 6px; height: 72px; padding-top: 8px; }
.dash-spark-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.dash-spark-bar { background: var(--accent); width: 100%; max-width: 26px; border-radius: 3px 3px 0 0; min-height: 4px; }
.dash-spark-label { font-size: 9.5px; color: var(--ink-3); text-transform: uppercase; }
.dash-cov-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: var(--surface-2); border-radius: var(--r-sm); font-size: 12.5px; }
.dash-activity-row { display: grid; grid-template-columns: 86px 1fr auto; gap: 10px; align-items: center; padding: 6px 8px; background: var(--surface-2); border-radius: var(--r-sm); font-size: 12.5px; }
.dash-activity-summary { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aging-table { width: 100%; border-collapse: collapse; font-family: var(--t-ui); font-size: 13px; }
.aging-table th { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.aging-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.aging-table .num-col { text-align: right; }

body.responsive-route .hub-grid { grid-template-columns: 1fr; }
body.responsive-route .hub-actions { grid-template-columns: repeat(2, 1fr); }
body.responsive-route .dash-activity-row { grid-template-columns: auto 1fr; }
body.responsive-route .dash-activity-row .mute { display: none; }

/* =================================================================
   USERS (users.js)
   ================================================================= */
.users-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.users-role { padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.users-role b { display: block; color: var(--ink); margin-bottom: 2px; font-size: 13px; }
.users-table td select { padding: 6px 28px 6px 8px; font-size: 12.5px; }
.users-name { font-weight: 600; }
.users-email { font-size: 12px; color: var(--ink-3); }
.users-you { font-size: 10px; margin-left: 6px; }
.access-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.access-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.access-row:hover { background: var(--surface-2); }
body.responsive-route .users-table th:nth-child(2), body.responsive-route .users-table td:nth-child(2) { display: none; }

/* =================================================================
   QUICK INVOICE (invoice-quick.js)
   ================================================================= */
.qi-tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r); background: var(--surface-2); margin-bottom: 14px; }
.qi-tab { flex: 1; padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.qi-tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.qi-lines { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.qi-line { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid transparent; cursor: pointer; font-size: 13px; }
.qi-line:hover { border-color: var(--line-2); }
.qi-line.is-on { background: var(--accent-soft); border-color: var(--accent); }
.qi-line-desc { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qi-line-sub { font-size: 11.5px; color: var(--ink-3); }
.qi-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); font-size: 13px; }
.qi-summary .num { font-size: 16px; font-weight: 600; color: var(--accent); }

/* =================================================================
   SETTINGS additions (settings.js) — the rest is in its own section below
   ================================================================= */
.set-section { display: flex; flex-direction: column; gap: 14px; }
.set-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.set-head p { margin: 4px 0 0; max-width: 60ch; }
.set-kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 14px; align-items: center; font-size: 13.5px; }
.set-kv dt { color: var(--ink-3); margin: 0; }
.set-kv dd { margin: 0; }
.set-save { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.set-billing-row td select { max-width: 360px; width: 100%; }
.set-status { display: inline-flex; align-items: center; gap: 6px; }
.set-vars { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.set-vars code { cursor: default; }
body.responsive-route .set-kv { grid-template-columns: 1fr; gap: 4px 0; }
body.responsive-route .set-kv dt { margin-top: 8px; }


/* =============================================================================
   Feature styles — one section per feature module.
   ============================================================================= */

/* (dashboard.js was replaced by home.js — its styles live in the HOME section above) */

/* ─── settings.js ─────────────────────────────────────────────── */

.settings-split { grid-template-columns: 240px 1fr; min-height: 0; }
.settings-rail { display: flex; flex-direction: column; }
.settings-nav { display: flex; flex-direction: column; gap: 4px; }
.settings-nav-item {
  display: block; text-decoration: none;
  padding: 9px 12px; border-radius: var(--r);
  background: transparent; text-align: left;
  font-family: var(--t-ui); font-size: 13px; font-weight: 500;
  color: var(--ink-2); border: 1px solid transparent;
  transition: background-color .12s, color .12s, border-color .12s;
}
.settings-nav-item:hover { background: var(--surface-2); color: var(--ink); }
.settings-nav-item.is-active { background: var(--accent-soft); color: var(--accent); }

.settings-main { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; padding-right: 4px; }
.settings-main::-webkit-scrollbar { width: 6px; }
.settings-main::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }
.settings-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-form .field:has(textarea), .settings-form .field:nth-child(odd):last-child { grid-column: 1/-1; }
.settings-row { display: flex; align-items: center; gap: 10px; }

.settings-theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.theme-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: var(--r);
  background: var(--glass); border: 1px solid var(--glass-stroke);
  text-align: left; transition: background-color .12s, border-color .12s, transform .05s;
}
.theme-card:hover { background: var(--glass-2); }
.theme-card:active { transform: translateY(1px); }
.theme-card.is-on { border-color: var(--accent); background: var(--accent-soft); }
.theme-card-swatch { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--glass-stroke); flex-shrink: 0; }
.theme-card-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; }
.theme-card-label { font-family: var(--t-display); font-weight: 600; font-size: 14px; color: var(--ink); }
.theme-card-desc { font-family: var(--t-ui); font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.settings-rate { display: grid; grid-template-columns: 2fr 1fr auto; gap: 10px; align-items: end; }
.settings-rate-input { display: flex; align-items: center; gap: 6px; }
body.responsive-route .settings-rate { grid-template-columns: 1fr; }

body.responsive-route .settings-split { grid-template-columns: 1fr; }
body.responsive-route .settings-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
body.responsive-route .settings-nav-item { padding: 8px 14px; font-size: 12px; }
body.responsive-route .settings-form { grid-template-columns: 1fr; }

/* ─── estimates.js ─────────────────────────────────────────────── */

.estimates-split { grid-template-columns: 320px 1fr; min-height: 0; }
.est-rail { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.est-pipeline { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.est-pip-stat { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: oklch(0 0 0 / 0.18); border-radius: var(--r); font-family: var(--t-ui); font-size: 11px; }
.est-pip-count { color: var(--ink-2); }
.est-new { width: 100%; padding: 11px; }
.est-search-row { display: flex; flex-direction: column; gap: 4px; }
.est-search { width: 100%; }
.est-search-count { font-size: 11.5px; padding-left: 2px; }
.est-search-count:empty { display: none; }
.est-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; padding-right: 4px; flex: 1; min-height: 0; }
.est-list::-webkit-scrollbar { width: 6px; }
.est-list::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }

.est-card { padding: 10px 12px; border-radius: var(--r); background: var(--glass); border: 1px solid transparent; text-align: left; transition: background-color .12s, border-color .12s; }
.est-card:hover { background: var(--glass-2); }
.est-card.is-active { background: var(--accent-soft); border-color: var(--accent); }
.est-card-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.est-card-num { font-size: 12px; color: var(--ink-2); }
.est-card-title { font-family: var(--t-display); font-weight: 600; font-size: 14px; margin: 4px 0; line-height: 1.25; }
.est-card-sub { font-size: 12px; font-family: var(--t-ui); }

.est-empty { padding: 64px 24px; text-align: center; }

.est-editor { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; min-height: 0; }
.est-editor::-webkit-scrollbar { width: 6px; }
.est-editor-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding-bottom: 16px; border-bottom: 1px solid var(--glass-stroke); }
.est-editor-head-l { flex: 1; min-width: 0; }
.est-title { font-family: var(--t-display); font-weight: 600; font-size: 26px; letter-spacing: -0.015em; background: transparent; border: 1px solid transparent; padding: 4px 6px; border-radius: 6px; margin: 6px 0 10px; width: 100%; color: var(--ink); }
.est-title:hover { border-color: var(--glass-stroke); }
.est-title:focus { background: oklch(0 0 0 / 0.20); border-color: var(--accent); }
.est-meta-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.est-meta-row .field { font-size: 13px; }
.est-meta-row input { padding: 7px 10px; }
.est-days-until { font-family: var(--t-ui); font-size: 11px; padding: 4px 10px; background: var(--info-soft); color: var(--info); border-radius: 999px; font-weight: 600; }
.est-days-until.is-overdue { background: var(--rust-soft); color: var(--rust); }

.est-editor-head-r { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; min-width: 220px; }
.est-total { font-family: var(--t-num); font-size: 24px; font-weight: 500; color: var(--ink); }
.est-save-state { display: flex; align-items: center; gap: 8px; }
.est-save-state .pill { animation: pulse-soft 1.4s ease-in-out infinite; }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }
.est-status-actions { display: flex; gap: 6px; align-items: center; }
.est-status-actions select { padding: 6px 10px; font-size: 12px; }

.est-body { display: flex; flex-direction: column; gap: 16px; }
.est-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.est-lines-table { width: 100%; border-collapse: collapse; font-family: var(--t-ui); font-size: 13px; margin-bottom: 8px; }
.est-lines-table th { color: var(--ink-3); font-weight: 600; font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--glass-stroke); }
.est-lines-table td { padding: 6px 4px; border-bottom: 1px solid var(--glass-stroke); }
.est-lines-table .num-col { text-align: right; }
.est-lines-table input { width: 100%; padding: 6px 8px; }
.est-lines-table textarea.est-detail { width: 100%; padding: 6px 8px; resize: vertical; min-height: 32px; font: inherit; }

/* Quick-fill suggestion chips (standard notes/terms phrases) */
.suggest-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: -8px 0 0; }
.chip {
  padding: 4px 10px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-stroke);
  font-family: var(--t-ui); font-size: 11px; color: var(--ink-2);
  transition: background-color .12s, color .12s, border-color .12s;
}
.chip:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.est-num-field { display: flex; flex-direction: column; gap: 2px; }
.est-num-input { width: 160px; padding: 4px 6px; font-family: var(--t-num); font-size: 13px; background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--ink-2); }
.est-num-input:hover { border-color: var(--glass-stroke); }
.est-num-input:focus { background: oklch(0 0 0 / 0.20); border-color: var(--accent); color: var(--ink); }

.est-editor-footer { display: flex; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--glass-stroke); }

/* ─── Responsive ───────────────────────────────────────────── */
body.responsive-route .estimates-split { grid-template-columns: 1fr; gap: 14px; height: auto; }
body.responsive-route .est-rail { max-height: none; overflow: visible; }
body.responsive-route .est-list { max-height: 320px; }
body.responsive-route .est-editor { overflow: visible; }
body.responsive-route .est-editor-head { flex-direction: column; gap: 14px; }
body.responsive-route .est-editor-head-r { align-items: stretch; min-width: 0; }
body.responsive-route .est-total { font-size: 20px; text-align: left; }
body.responsive-route .est-status-actions { flex-wrap: wrap; }
body.responsive-route .est-cols { grid-template-columns: 1fr; }
body.responsive-route .est-pipeline { grid-template-columns: repeat(2, 1fr); }
body.responsive-route .est-lines-table { font-size: 12px; }
/* Hide the Detail column on phones — 2nd column since the Ref column was
   removed (Desc / Detail / Amount / ×). */
body.responsive-route .est-lines-table th:nth-child(2),
body.responsive-route .est-lines-table td:nth-child(2) { display: none; }

/* ─── invoices.js ─────────────────────────────────────────────── */

.inv-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

/* Search-all-invoices box + dropdown */
.inv-find { position: relative; flex: 1 1 280px; max-width: 520px; min-width: 220px; }
.inv-find-input { width: 100%; }
.inv-find-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  max-height: min(60vh, 520px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2); padding: 6px;
}
.inv-find-head { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 6px 8px; }
.inv-find-empty { padding: 12px; font-size: 13px; color: var(--ink-3); }
.inv-find-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--r-sm); font-size: 13px;
}
.inv-find-row:hover, .inv-find-row:focus-visible { background: var(--accent-soft); outline: none; }
.inv-find-main, .inv-find-side { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.inv-find-main > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-find-side { align-items: flex-end; }
.inv-find-sub { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.responsive-route .inv-find { order: -1; flex-basis: 100%; max-width: none; }
body.responsive-route .inv-find-side .inv-find-sub { display: none; }
.inv-tpl-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.inv-tpl-tab {
  padding: 8px 14px; border-radius: var(--r);
  background: var(--glass); border: 1px solid var(--glass-stroke);
  font-family: var(--t-ui); font-size: 12px; font-weight: 500;
  color: var(--ink-2);
  transition: background-color .12s, color .12s, border-color .12s;
}
.inv-tpl-tab:hover { background: var(--glass-2); color: var(--ink); }
.inv-tpl-tab.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.invoices-split { grid-template-columns: 320px 1fr; min-height: 0; }
.inv-rail { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 6px; }
.inv-rail::-webkit-scrollbar { width: 6px; }
.inv-rail::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }
.inv-rail-head .h-eyebrow { color: var(--accent); }
.inv-period { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; background: oklch(0 0 0 / 0.2); border-radius: var(--r); }
.inv-period-label { font-family: var(--t-display); font-weight: 600; text-align: center; font-size: 15px; }

.inv-line-picker { display: flex; flex-direction: column; gap: 6px; }
.inv-line-picker-head { display: flex; align-items: center; justify-content: space-between; }
.inv-line-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto; padding-right: 2px; }
.inv-line-list::-webkit-scrollbar { width: 6px; }
.inv-line-list::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }
.inv-line-row {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 6px; background: oklch(0 0 0 / 0.18); cursor: pointer;
  transition: background-color .12s, border-color .12s;
  border: 1px solid transparent;
}
.inv-line-row:hover { background: oklch(0 0 0 / 0.26); }
.inv-line-row.is-on { background: var(--accent-soft); border-color: var(--accent); }
.inv-line-row.is-on .inv-line-desc { color: var(--accent); }
.inv-line-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.inv-line-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inv-line-desc { font-family: var(--t-ui); font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-line-amt { font-size: 11px; color: var(--ink-2); }

.inv-summary { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; background: oklch(0 0 0 / 0.18); border-radius: var(--r); }
.inv-summary-row { display: flex; justify-content: space-between; align-items: center; font-family: var(--t-ui); font-size: 12px; }
.inv-summary-row .label { color: var(--ink-3); }
.inv-summary-row .num { color: var(--ink); }
.inv-summary-total { padding-top: 6px; margin-top: 2px; border-top: 1px solid var(--glass-stroke); }
.inv-summary-total .label { color: var(--ink-2); font-weight: 700; }
.inv-summary-total .num { color: var(--accent); font-size: 14px; font-weight: 600; }

.inv-generate { width: 100%; padding: 12px; font-size: 12px; }
.inv-rail-section { display: flex; flex-direction: column; min-height: 0; }
.inv-batches { display: flex; flex-direction: column; gap: 6px; }

.inv-batch-card {
  padding: 10px 12px; border-radius: var(--r);
  background: var(--glass); border: 1px solid transparent;
  text-align: left;
  transition: background-color .12s, border-color .12s;
}
.inv-batch-card:hover { background: var(--glass-2); }
.inv-batch-card.is-active { background: var(--accent-soft); border-color: var(--accent); }
.inv-batch-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.inv-batch-label { font-family: var(--t-display); font-weight: 600; }
.inv-batch-total { color: var(--ink-2); font-size: 13px; }
.inv-batch-pills { margin-top: 4px; gap: 4px; flex-wrap: wrap; }

.inv-main { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 2px; min-height: 0; }
.inv-main::-webkit-scrollbar { width: 6px; }
.inv-main::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }

.inv-main-empty { padding: 64px 24px; text-align: center; }

.inv-batch-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.inv-batch-dates { display: flex; gap: 12px; align-items: flex-end; }
.inv-batch-dates input { padding: 8px 10px; font-size: 13px; }

.inv-action-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 14px 18px; }

.inv-search-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.inv-search { flex: 1; padding: 8px 12px; font-size: 13px; }
.batch-exists-summary { display: flex; flex-direction: column; gap: 4px; }

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.inv-grid-compact { grid-template-columns: repeat(5, 1fr); }
.inv-tab {
  padding: 10px 12px; border-radius: var(--r);
  background: var(--glass); border: 1px solid transparent;
  text-align: left;
  transition: background-color .12s, border-color .12s;
}
.inv-tab:hover { background: var(--glass-2); }
.inv-tab.is-active { background: var(--accent-soft); border-color: var(--accent); }
.inv-tab-num { font-family: var(--t-ui); font-weight: 600; font-size: 12px; color: var(--ink); }
.inv-tab-recipient { font-family: var(--t-prose); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-tab-row { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 12px; }
.inv-edit-mark { color: var(--gold); margin-left: 4px; }

.paper-action-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; }
.paper-action-meta { display: flex; align-items: center; gap: 10px; font-family: var(--t-ui); font-size: 13px; }
.paper-action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* The cream paper preview — looks like the PDF */
.paper {
  background: var(--paper); color: var(--paper-ink);
  padding: 44px 48px; border-radius: var(--r-lg);
  max-width: 760px; margin: 0 auto;
  font-family: var(--t-prose); font-size: 13px; line-height: 1.5;
  box-shadow: var(--shadow-2);
}
.paper-head { display: flex; justify-content: space-between; align-items: flex-start; }
.paper-logo { height: 48px; width: auto; }
.paper-vendor { text-align: right; font-family: var(--t-display); }
.paper-vendor-name { font-weight: 700; font-size: 13px; }
.paper-vendor-addr { font-family: var(--t-ui); font-size: 11px; color: var(--ink-mute); }
.paper-divider { border-top: 1px solid var(--paper-rule); margin: 28px 0 0; }
.paper-title-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; }
.paper-title { font-family: var(--t-display); font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -0.01em; color: var(--paper-ink); }
.paper-title-meta { font-family: var(--t-num); color: oklch(0.45 0.012 60); }
.paper-eyebrow { font-family: var(--t-ui); font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: oklch(0.50 0.01 60); }

.paper-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin: 24px 0; }
.paper-bill-name { font-family: var(--t-display); font-weight: 700; font-size: 14px; margin-top: 4px; }
.paper-bill-sub  { font-family: var(--t-prose); }
.paper-bill-line { font-family: var(--t-prose); }
.paper-meta-grid { display: grid; grid-template-columns: auto auto; gap: 4px 16px; margin: 0; justify-content: end; }
.paper-meta-grid dt { font-family: var(--t-ui); font-size: 10px; font-weight: 700; letter-spacing: 0.10em; text-transform: uppercase; color: oklch(0.50 0.01 60); text-align: right; }
.paper-meta-grid dd { margin: 0; text-align: right; font-family: var(--t-ui); font-size: 13px; }
.paper-balance-label, .paper-balance-value { font-weight: 700; }
.paper-balance-value { font-family: var(--t-num); font-size: 15px; }

.paper-lines { width: 100%; border-collapse: collapse; margin: 18px 0 12px; }
.paper-lines th { font-family: var(--t-ui); font-size: 9px; font-weight: 700; letter-spacing: 0.10em; text-transform: uppercase; color: oklch(0.50 0.01 60); padding: 8px 0; border-bottom: 1px solid var(--paper-rule); text-align: left; }
.paper-lines th.num-col, .paper-lines td.num-col { text-align: right; padding-left: 8px; }
.paper-lines td { padding: 12px 0; vertical-align: top; }
.paper-line-desc { font-family: var(--t-display); font-weight: 600; }
.paper-line-detail { font-family: var(--t-prose); font-size: 12px; color: oklch(0.45 0.012 60); margin-top: 2px; }

.paper-totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-family: var(--t-ui); font-size: 13px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--paper-rule); }
.paper-totals > div { display: grid; grid-template-columns: auto 100px; gap: 12px; }
.paper-totals .num { text-align: right; }
.paper-balance { font-weight: 700; font-size: 15px; }

.paper-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--paper-rule); }
.paper-notes div, .paper-term, .paper-remit-addr { font-family: var(--t-prose); font-size: 12px; line-height: 1.5; }
.paper-notes div { white-space: pre-line; }
.paper-remit-head { font-family: var(--t-display); font-weight: 700; font-size: 12px; margin-top: 4px; }
.paper-term { margin-top: 4px; }

/* Email + template modals */
.modal-form-2col { grid-template-columns: 1fr 1fr; }
.email-recipients { display: flex; flex-direction: column; gap: 6px; }
.recipient-row { display: grid; grid-template-columns: auto 1fr 1fr auto auto; gap: 8px; align-items: center; padding: 6px 8px; background: oklch(0 0 0 / 0.18); border-radius: 6px; }
.recipient-row input[type=text], .recipient-row input[type=email] { padding: 6px 8px; }
.recipient-primary { font-family: var(--t-ui); font-size: 11px; color: var(--ink-3); display: flex; gap: 4px; align-items: center; }

.billed-to, .remit-block, .lines-block { border: 1px solid var(--glass-stroke); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.billed-to legend, .remit-block legend, .lines-block legend { padding: 0 6px; font-family: var(--t-ui); }
.template-lines, .invoice-lines { grid-column: 1/-1; display: flex; flex-direction: column; gap: 6px; }
.template-line, .invoice-line { display: grid; grid-template-columns: 120px 1fr 1fr 100px auto; gap: 6px; align-items: center; }
.template-line.has-billedto { border-left: 3px solid var(--info); padding-left: 6px; border-radius: 4px; }
.lines-block [data-add-line] { grid-column: 1/-1; justify-self: start; }
.invoice-lines-foot { grid-column: 1/-1; display: flex; justify-content: space-between; align-items: center; padding-top: 8px; }
.invoice-lines-total { display: flex; align-items: center; gap: 10px; }
.invoice-lines-total .num { font-family: var(--t-num); font-size: 16px; font-weight: 600; color: var(--accent); }

/* ─── Responsive (narrow viewport + tech mode) ───────────────── */
body.responsive-route .invoices-split {
  grid-template-columns: 1fr;
  gap: 14px;
  height: auto;
}
body.responsive-route .inv-rail {
  max-height: none;
  overflow: visible;
}
body.responsive-route .inv-line-list { max-height: 220px; }
body.responsive-route .inv-batches { max-height: 320px; }
body.responsive-route .inv-main { overflow: visible; }
body.responsive-route .inv-tpl-tabs {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
}
body.responsive-route .inv-tpl-tabs::-webkit-scrollbar { display: none; }
body.responsive-route .inv-tpl-tab { flex-shrink: 0; }
body.responsive-route .inv-batch-header { flex-direction: column; align-items: stretch; }
body.responsive-route .inv-batch-dates { gap: 8px; }
body.responsive-route .inv-grid-compact { grid-template-columns: repeat(2, 1fr); }
body.responsive-route .inv-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
body.responsive-route .paper { padding: 24px 22px; font-size: 12px; max-width: 100%; }
body.responsive-route .paper-grid { grid-template-columns: 1fr; gap: 16px; }
body.responsive-route .paper-meta-grid { justify-content: start; }
body.responsive-route .paper-footer { grid-template-columns: 1fr; gap: 16px; }
body.responsive-route .paper-title { font-size: 22px; }
body.responsive-route .paper-action-bar { flex-direction: column; align-items: stretch; gap: 8px; }
body.responsive-route .paper-action-btns { flex-wrap: wrap; }
body.responsive-route .modal-form-2col { grid-template-columns: 1fr; }
body.responsive-route .billed-to, body.responsive-route .remit-block, body.responsive-route .lines-block { grid-template-columns: 1fr; }
body.responsive-route .template-line { grid-template-columns: 1fr 1fr; }
body.responsive-route .template-line input[data-l-amount] { grid-column: 1 / span 2; }

/* ─── all-invoices.js ─────────────────────────────────────────────── */

.ai-wrap { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 0; padding-right: 4px; }
.ai-wrap::-webkit-scrollbar { width: 6px; }
.ai-wrap::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }

.ai-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ai-toolbar-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-search { padding: 8px 12px; font-size: 13px; min-width: 280px; }
.ai-toolbar-r select { padding: 8px 10px; font-size: 12px; }

.ai-selbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; }
.ai-selbar-hint { padding: 6px 4px; font-size: 12px; }
.ai-selbar-active { flex-wrap: wrap; }
.ai-selbar-l { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-selbar-r { display: flex; gap: 6px; }

.ai-table-wrap { overflow-x: auto; }
.ai-table { width: 100%; border-collapse: collapse; font-family: var(--t-ui); font-size: 13px; }
.ai-table th { font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-3); padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--glass-stroke); white-space: nowrap; }
.ai-table td { padding: 9px 10px; border-bottom: 1px solid var(--glass-stroke); }
.ai-table .num-col { text-align: right; }
.ai-table .num { font-family: var(--t-num); }
.ai-sortable { cursor: pointer; user-select: none; }
.ai-sortable:hover { color: var(--ink); }
.ai-check-col { width: 36px; text-align: center; }
.ai-check-col input { width: 16px; height: 16px; accent-color: var(--accent); }
.ai-table tr.is-selected { background: var(--accent-soft); }
.ai-table tbody tr:hover { background: var(--glass-2); }

body.responsive-route .ai-toolbar { flex-direction: column; align-items: stretch; }
body.responsive-route .ai-search { min-width: 0; width: 100%; }
body.responsive-route .ai-table th:nth-child(4),
body.responsive-route .ai-table td:nth-child(4),
body.responsive-route .ai-table th:nth-child(6),
body.responsive-route .ai-table td:nth-child(6) { display: none; }

/* ─── facilities.js ─────────────────────────────────────────────── */

.facilities-split { grid-template-columns: 320px 1fr; }
body.responsive-route .facilities-split { grid-template-columns: 1fr; gap: 14px; }

.facilities-rail { display: flex; flex-direction: column; min-height: 0; }
.rail-head { margin-bottom: 14px; }
.rail-list { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.rail-list::-webkit-scrollbar { width: 6px; }
.rail-list::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }
.rail-section { margin: 4px 4px 4px; }
.rail-cta { margin-top: 14px; }

.facility-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--glass);
  border: 1px solid transparent;
  text-align: left;
  transition: background-color .15s, border-color .15s;
}
.facility-card:hover { background: var(--glass-2); }
.facility-card.is-active { background: var(--accent-soft); border-color: var(--accent); }
.facility-card.is-active .facility-card-name { color: var(--accent); }
.facility-card-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.facility-card-name { font-family: var(--t-display); font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.25; }

.facilities-main { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; min-height: 0; padding-right: 2px; }
.facilities-main::-webkit-scrollbar { width: 6px; }
.facilities-main::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }

.facility-detail .facility-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-stroke);
  margin-bottom: 16px;
}
.facility-meta { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-family: var(--t-ui); font-size: 13px; margin-top: 6px; }
.facility-actions { display: flex; gap: 6px; }
.facility-address { font-family: var(--t-prose); }

.units-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.units-empty { padding: 24px; text-align: center; }
.units-table { width: 100%; border-collapse: collapse; font-family: var(--t-ui); font-size: 13px; }
.units-table th, .units-table td { padding: 10px 8px; text-align: left; }
.units-table th { color: var(--ink-3); font-weight: 600; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.units-table td { border-top: 1px solid var(--glass-stroke); }
.units-table .num-col { text-align: right; }
.units-table .actions-col { text-align: right; width: 100px; }
.unit-row { cursor: pointer; transition: background-color .12s; }
.unit-row:hover { background: var(--glass); }
.unit-row.is-open { background: var(--accent-soft); }
.unit-row.is-open .unit-name { color: var(--accent); font-weight: 600; }
.unit-name { font-family: var(--t-display); font-weight: 500; color: var(--ink); }

.unit-detail-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-stroke);
  margin-bottom: 16px;
}
.unit-detail-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.bay-grid-empty { padding: 32px; text-align: center; }
.bay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
body.responsive-route .bay-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.bay {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  border-radius: var(--r);
  background: var(--glass);
  border: 1px solid var(--glass-stroke);
  transition: background-color .15s, border-color .15s, opacity .15s;
}
.bay.is-saving { opacity: 0.6; }
.bay:focus-within { border-color: var(--accent); }
.bay-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.bay-label { flex: 1; padding: 6px 8px; font-family: var(--t-display); font-weight: 600; font-size: 14px; background: transparent; border: 1px solid transparent; border-radius: 6px; }
.bay-label:hover { border-color: var(--glass-stroke); }
.bay-label:focus { background: oklch(0 0 0 / 0.20); border-color: var(--accent); }
.bay-dims { display: flex; gap: 8px; }
.bay-dim { display: flex; align-items: center; gap: 4px; flex: 1; font-family: var(--t-ui); font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.bay-dim input { width: 100%; padding: 6px 8px; text-align: right; }
.bay-notes { padding: 6px 8px; font-family: var(--t-prose); font-size: 13px; color: var(--ink-2); background: transparent; border: 1px solid transparent; border-radius: 6px; }
.bay-notes:hover { border-color: var(--glass-stroke); }
.bay-notes:focus { background: oklch(0 0 0 / 0.20); border-color: var(--accent); color: var(--ink); }

/* Modals */
.modal-form { display: grid; gap: 14px; }
.bulk-dim { display: grid; gap: 18px; }
.bulk-dim-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bulk-dim-pick { display: flex; flex-direction: column; gap: 6px; }
.bulk-dim-list {
  max-height: 280px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px; border-radius: var(--r); background: oklch(0 0 0 / 0.2);
}
.bulk-dim-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.bulk-dim-row:hover { background: var(--glass); }
.bulk-dim-label { font-family: var(--t-display); font-weight: 500; }

/* ─── reports.js ─────────────────────────────────────────────── */

.reports-head { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: end; }
.reports-period { display: flex; align-items: center; gap: 12px; }
.reports-period-label { font-family: var(--t-display); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; }
.reports-filter .field { min-width: 200px; }
.reports-actions { display: flex; gap: 6px; }

.reports-cal { margin-top: 14px; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 8px 0 6px; }
.cal-dow > div { font-family: var(--t-ui); font-size: 10px; font-weight: 700; letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-3); text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { background: var(--glass); border: 1px solid var(--glass-stroke); border-radius: var(--r); min-height: 72px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell-out { background: transparent; border-color: transparent; }
.cal-cell.has-items { border-color: var(--accent); }
.cal-day-num { font-family: var(--t-num); font-size: 11px; color: var(--ink-3); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; }
.cal-chip { display: flex; gap: 4px; align-items: baseline; padding: 2px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-family: var(--t-ui); font-size: 10px; line-height: 1.2; }
.cal-chip-fac { font-weight: 700; }
.cal-chip-unit { opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-family: var(--t-ui); font-size: 10px; color: var(--ink-3); padding-left: 6px; }

.reports-summary { margin-top: 14px; }
.reports-summary-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.reports-stat { display: flex; gap: 8px; align-items: baseline; margin-top: 6px; }
.reports-stat-num { font-size: 26px; color: var(--ok); }
.reports-row { display: flex; justify-content: space-between; padding: 4px 0; font-family: var(--t-ui); font-size: 13px; border-bottom: 1px solid var(--glass-stroke); }

/* ─── Responsive ──────────────────────────────────────────── */
body.responsive-route .reports-head { grid-template-columns: 1fr; gap: 10px; }
body.responsive-route .reports-actions { justify-content: stretch; }
body.responsive-route .reports-actions .btn { flex: 1; }
body.responsive-route .cal-cell { min-height: 56px; padding: 4px; }
body.responsive-route .cal-chip { font-size: 9px; padding: 1px 4px; }
body.responsive-route .cal-chip-unit { display: none; }
body.responsive-route .cal-day-num { font-size: 10px; }
body.responsive-route .reports-summary-cols { grid-template-columns: 1fr; gap: 16px; }

/* ─── quarterly.js ─────────────────────────────────────────────── */

.q-split { grid-template-columns: 320px 1fr; min-height: 0; }
.q-rail { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.q-rail-actions { display: flex; flex-direction: column; gap: 6px; }
.q-rail-cta { padding: 11px; }
.q-director-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-right: 4px; flex: 1; min-height: 0; }
.q-director-list::-webkit-scrollbar { width: 6px; }
.q-director-list::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }
.q-director-card { padding: 10px 12px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--glass-stroke); }
.q-director-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.q-director-name { font-family: var(--t-display); font-weight: 600; font-size: 13px; }
.q-director-sub { font-family: var(--t-ui); font-size: 12px; margin-top: 2px; }

.q-main { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; padding-right: 2px; }
.q-main::-webkit-scrollbar { width: 6px; }
.q-period { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 18px; }
.q-period-label { text-align: center; font-family: var(--t-display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }

.q-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 18px; }
.q-kpi-num { font-size: 26px; margin-top: 4px; }
.q-kpi-ok { color: var(--ok); }
.q-kpi-warn { color: var(--warn); }
.q-kpi-bar { display: flex; flex-direction: column; justify-content: flex-start; }

.q-matrix-facility { margin-top: 14px; }
.q-matrix-fac-name { font-family: var(--t-display); font-weight: 600; font-size: 14px; margin: 6px 0; }
.q-matrix-tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.q-tile {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--r);
  background: var(--glass); border: 1px solid var(--glass-stroke);
  font-family: var(--t-ui); font-size: 12px;
}
.q-tile.is-covered { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.q-tile-icon { font-size: 13px; }

.q-session-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.q-session-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; background: oklch(0 0 0 / 0.18); border-radius: var(--r); }
.q-session-date { color: var(--ink-2); }
.q-session-director { font-family: var(--t-display); font-weight: 600; font-size: 13px; }
.q-session-units { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.q-unit-chip { padding: 2px 8px; border-radius: 999px; background: var(--glass); font-family: var(--t-ui); font-size: 11px; color: var(--ink-2); }

.q-completions-table { width: 100%; border-collapse: collapse; font-family: var(--t-ui); font-size: 13px; margin-top: 10px; }
.q-completions-table th { color: var(--ink-3); font-weight: 600; font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--glass-stroke); }
.q-completions-table td { padding: 8px 6px; border-bottom: 1px solid var(--glass-stroke); }

/* Compose modal */
.compose { display: grid; gap: 16px; }
.compose-fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.compose-unit-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.compose-unit { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 6px; cursor: pointer; background: oklch(0 0 0 / 0.18); }
.compose-unit.is-on { background: var(--accent-soft); color: var(--accent); }
.compose-add { display: flex; gap: 6px; margin-top: 6px; }
.compose-add input { flex: 1; }
.compose-pre { font-family: var(--t-num); font-size: 12px; line-height: 1.5; background: oklch(0 0 0 / 0.25); padding: 12px; border-radius: var(--r); white-space: pre-wrap; max-height: 280px; overflow-y: auto; color: var(--ink-2); }

/* Quarterly report modal */
.qr { display: grid; gap: 14px; }
.qr-fields { display: grid; grid-template-columns: 2fr auto auto; gap: 12px; align-items: end; }
.qr-mode-banner {
  padding: 10px 14px; border-radius: var(--r);
  background: oklch(0 0 0 / 0.18);
  font-family: var(--t-ui); font-size: 12px; color: var(--ink-2);
  display: flex; align-items: center; gap: 10px;
}
.qr-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-radius: var(--r);
  background: var(--glass);
  font-family: var(--t-ui); font-size: 12px; color: var(--ink-3);
}
.qr-units {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 380px; overflow-y: auto; padding-right: 4px;
}
.qr-units::-webkit-scrollbar { width: 6px; }
.qr-units::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }
.qr-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 8px 12px; border-radius: var(--r);
  background: oklch(0 0 0 / 0.18);
  border: 1px solid transparent;
  transition: background-color .12s, border-color .12s;
}
.qr-row.is-on { background: var(--accent-soft); border-color: var(--accent); }
.qr-row-include { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.qr-row-include input[type=checkbox] { accent-color: var(--accent); }
.qr-unit-name { font-family: var(--t-display); font-weight: 500; }
.qr-row-month, .qr-row-date { display: flex; align-items: center; gap: 8px; }
.qr-row-month select, .qr-row-date input { padding: 6px 8px; font-size: 12px; min-width: 140px; }

/* Editor modal */
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.editor-col { display: flex; flex-direction: column; gap: 8px; }
.editor-col-head { display: flex; align-items: center; justify-content: space-between; }
.editor-list { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow-y: auto; }
.editor-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 6px; align-items: center; }
.editor-row input, .editor-row select { padding: 6px 8px; font-size: 13px; }

/* Tech view */
.q-tech { display: flex; flex-direction: column; gap: 16px; max-width: 720px; margin: 0 auto; }
.q-tech-head { padding: 0 4px; }
.q-tech-day { display: flex; flex-direction: column; gap: 8px; }
.q-tech-day-label { font-family: var(--t-display); font-size: 14px; font-weight: 600; color: var(--ink-3); margin: 8px 0 4px; text-transform: uppercase; letter-spacing: 0.08em; }
.q-tech-session { display: flex; flex-direction: column; gap: 12px; }
.q-tech-session-head { display: flex; justify-content: space-between; align-items: flex-start; }
.q-tech-session-fac { font-family: var(--t-display); font-weight: 600; font-size: 15px; }
.q-tech-units { display: flex; flex-direction: column; gap: 8px; }
.q-tech-unit { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--glass-stroke); cursor: pointer; }
.q-tech-unit.is-done { opacity: 0.5; }
.q-tech-unit input[type=checkbox] { width: 20px; height: 20px; margin-top: 4px; }
.q-tech-unit-name { font-family: var(--t-display); font-weight: 600; font-size: 15px; }
.q-tech-unit-notes { width: 100%; margin-top: 6px; padding: 6px 8px; }
.q-tech-session-footer { display: flex; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--glass-stroke); }
.pill-sm { padding: 2px 6px; font-size: 9px; }

/* ─── Responsive ──────────────────────────────────────────── */
body.responsive-route .q-split { grid-template-columns: 1fr; gap: 14px; height: auto; }
body.responsive-route .q-rail { max-height: none; overflow: visible; }
body.responsive-route .q-director-list { max-height: 320px; }
body.responsive-route .q-main { overflow: visible; }
body.responsive-route .q-kpis { grid-template-columns: repeat(2, 1fr); padding: 14px; gap: 10px; }
body.responsive-route .q-kpi-num { font-size: 22px; }
body.responsive-route .compose-fields { grid-template-columns: 1fr; }
body.responsive-route .editor-grid { grid-template-columns: 1fr; }
body.responsive-route .editor-row { grid-template-columns: 1fr 1fr auto; }
body.responsive-route .q-session-row { grid-template-columns: auto 1fr; gap: 8px; }
body.responsive-route .q-session-status { grid-column: 1/-1; justify-self: end; }
body.responsive-route .q-completions-table th:nth-child(2),
body.responsive-route .q-completions-table td:nth-child(2) { display: none; }


/* ─── catalog-picker.js (shared item/client picker modal) ──────────────────── */

.catpick { display: flex; flex-direction: column; gap: 10px; }
.catpick-search { padding: 10px 12px; font-size: 14px; }
.catpick-list { display: flex; flex-direction: column; gap: 4px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.catpick-list::-webkit-scrollbar { width: 6px; }
.catpick-list::-webkit-scrollbar-thumb { background: var(--glass-stroke); border-radius: 3px; }
.catpick-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r);
  background: oklch(0 0 0 / 0.18); border: 1px solid transparent;
  text-align: left; transition: background-color .12s, border-color .12s;
}
.catpick-row:hover { background: var(--accent-soft); border-color: var(--accent); }
.catpick-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.catpick-name { font-family: var(--t-ui); font-weight: 600; font-size: 13px; color: var(--ink); }
.catpick-desc { font-family: var(--t-prose); font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.catpick-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.catpick-price { font-family: var(--t-num); font-size: 13px; color: var(--accent); }
.catpick-cat { font-size: 9px; }

.est-lines-actions { display: flex; gap: 8px; align-items: center; }
body.responsive-route .catpick-desc { max-width: 24ch; }


/* ─── curtains*.js (Curtain Changeout portal) ──────────────────────────────── */

/* Sync pill (nav + scanner) — honest: green only when nothing is queued */
.curtain-pill { white-space: nowrap; text-transform: none; letter-spacing: 0.02em; text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 10px; }
body.responsive-route .nav-user .curtain-pill { font-size: 10px; padding: 3px 8px; }
@media (max-width: 480px) { body.responsive-route .nav-user .curtain-pill { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; } }

/* Scanner — the one full-bleed, dark, chrome-free screen */
body.curtain-scanning .sidebar, body.curtain-scanning .topbar, body.curtain-scanning .tabbar { visibility: hidden; }
.cs-scan {
  position: fixed; inset: 0; z-index: 30;
  background: #000; color: #fff; overflow: hidden;
  font-family: var(--t-ui);
}
.cs-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cs-aim { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cs-aim i { width: min(64vw, 280px); aspect-ratio: 1; border: 4px solid oklch(1 0 0 / 0.7); border-radius: 22px; box-shadow: 0 0 0 100vmax oklch(0 0 0 / 0.25); }
.cs-top {
  position: absolute; inset: 0 0 auto 0; z-index: 5;   /* above the flash + camera-error panels: Exit always reachable */
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(env(safe-area-inset-top), 12px) 14px 12px;
  background: linear-gradient(180deg, oklch(0 0 0 / 0.65), transparent);
}
.cs-top-link { color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; padding: 8px 4px; }
.cs-bottom {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  padding: 16px 16px max(env(safe-area-inset-bottom), 18px);
  background: linear-gradient(0deg, oklch(0 0 0 / 0.75), transparent);
}
.cs-context { font-size: 14px; opacity: 0.92; }
.cs-hint { font-size: 12px; opacity: 0.7; margin-top: 2px; }
.cs-manual { display: inline-block; margin-top: 6px; font-size: 12px; color: #fff; opacity: 0.85; }
.cs-flash {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; animation: cs-in .12s ease-out;
}
.cs-flash-green { background: oklch(0.58 0.15 152); }
.cs-flash-amber { background: oklch(0.72 0.16 70); color: oklch(0.2 0.03 70); }
.cs-flash-red   { background: oklch(0.55 0.19 28); }
.cs-flash-mark  { font-size: 120px; line-height: 1; font-weight: 700; }
.cs-flash-title { font-family: var(--t-num); font-size: 30px; font-weight: 600; margin-top: 14px; }
.cs-flash-sub   { font-size: 18px; margin-top: 6px; max-width: 30ch; }
@keyframes cs-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.cs-sheet {
  position: absolute; inset: auto 0 0 0; z-index: 4;
  background: var(--bg-2); color: var(--ink);
  border-radius: 18px 18px 0 0; padding: 20px 18px max(env(safe-area-inset-bottom), 20px);
  box-shadow: 0 -12px 40px oklch(0 0 0 / 0.5);
}
.cs-sheet-title { font-size: 20px; font-weight: 600; }
.cs-sheet p { font-family: var(--t-prose); margin: 6px 0 16px; }
.cs-sheet-actions, .cf-sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cs-camera-error {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 32px; text-align: center;
  background: var(--bg); color: var(--ink);
}
.cs-camerr-title { font-family: var(--t-display); font-size: 20px; font-weight: 600; }
.cs-camera-error p { font-family: var(--t-prose); color: var(--ink-2); max-width: 36ch; margin: 0; }

/* Field screens (progress, unit, completion, exception, manual, landings) */
.cf { max-width: 720px; margin: 0 auto; padding-bottom: 32px; }
.cf-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.cf-nav a { text-decoration: none; }
.cf-head { margin-bottom: 14px; }
.cf-title { font-size: 22px; margin: 2px 0 0; line-height: 1.25; }
.cf-body { display: flex; flex-direction: column; gap: 12px; }
.cf-wide { width: 100%; justify-content: center; text-align: center; display: flex; }
.cf-help { font-size: 13px; margin: 2px 0 8px; }
.cf-foot { font-family: var(--t-ui); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cf-units { display: flex; flex-direction: column; gap: 10px; }
.cf-unit { display: flex; gap: 14px; align-items: center; padding: 14px; text-decoration: none; color: inherit; }
.cf-unit:hover { background: var(--glass-2); }
.cf-unit-text { min-width: 0; }
.cf-unit-name { font-family: var(--t-display); font-weight: 600; font-size: 15px; }
.cf-unit-sub { font-family: var(--t-ui); font-size: 13px; }
.cf-unit-rooms { font-family: var(--t-num); font-size: 12px; margin-top: 4px; color: var(--ink-2); }
.cf-unit-hero { display: flex; gap: 16px; align-items: center; }
.cf-ring { flex-shrink: 0; }
.cf-ring-text { font-family: var(--t-num); font-size: 13px; fill: var(--ink); }
.cf-section { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.cf-slots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cf-slot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--glass-stroke);
}
.cf-slot.is-flagged { border-color: var(--warn); background: var(--warn-soft); }
.cf-slot-code { font-size: 14px; }
.cf-slot select, .cf-note { padding: 8px 10px; font-size: 13px; }
.cf-note { flex-basis: 100%; }
.cf-mark { font-size: 17px; padding: 18px 20px; }
.cf-warn { font-family: var(--t-ui); font-size: 13px; color: var(--warn); }
.cf-done-title { font-family: var(--t-display); font-weight: 600; font-size: 19px; color: var(--ok); margin-bottom: 6px; }
.cf-done p { font-family: var(--t-prose); margin: 0 0 14px; }
.cf-sheet-scrim { position: fixed; inset: 0; z-index: 45; background: oklch(0 0 0 / 0.55); display: flex; align-items: flex-end; justify-content: center; }
.cf-sheet { width: min(720px, 100%); border-radius: 18px 18px 0 0; padding: 20px 18px max(env(safe-area-inset-bottom), 20px); background: var(--bg-2); }
.cf-sheet p { font-family: var(--t-prose); font-size: 17px; margin: 0 0 16px; }
.cf-exc { display: flex; flex-direction: column; gap: 14px; }
.cf-reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cf-reason { display: flex; }
.cf-reason input { position: absolute; opacity: 0; pointer-events: none; }
.cf-reason span {
  flex: 1; padding: 12px; border-radius: var(--r); text-align: center;
  background: var(--glass); border: 1px solid var(--glass-stroke);
  font-family: var(--t-ui); font-size: 13px; font-weight: 600; cursor: pointer;
}
.cf-reason input:checked + span { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.cf-reason input:focus-visible + span { box-shadow: var(--ring); }
.cf-photo small { font-family: var(--t-ui); font-size: 11px; }
.cf-photo-preview { max-height: 180px; border-radius: var(--r); object-fit: cover; }
.cf-manual { display: flex; flex-direction: column; gap: 12px; }
.cf-pick { padding: 12px 14px; }
.cf-pick summary { cursor: pointer; font-family: var(--t-ui); font-weight: 600; }
.cf-pick-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cf-landing { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.cf-landing-mark { font-size: 72px; line-height: 1; font-weight: 700; }
.cf-landing-green .cf-landing-mark { color: var(--ok); }
.cf-landing-amber .cf-landing-mark { color: var(--warn); }
.cf-landing-red .cf-landing-mark { color: var(--rust); }
.cf-landing p { font-family: var(--t-prose); margin: 0; }
.cf-failed-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 12px; padding: 6px 0; border-top: 1px solid var(--glass-stroke); }

/* Admin screens */
.ca { display: flex; flex-direction: column; gap: 16px; }
.ca-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ca-head-r { display: flex; align-items: flex-end; gap: 10px; }
.ca-head-r a { text-decoration: none; }
.ca-fac select { min-width: 240px; }
.ca-tabs { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.ca-tab {
  padding: 8px 14px; border-radius: var(--r); text-decoration: none;
  font-family: var(--t-ui); font-size: 12px; font-weight: 500; letter-spacing: 0.04em; color: var(--ink-3);
}
.ca-tab:hover { color: var(--ink); background: var(--glass); }
.ca-tab[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); }
.ca-main > div { display: flex; flex-direction: column; gap: 16px; }
.ca-help { font-size: 13px; margin: 4px 0 12px; }
.ca-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ca-kpi-n { font-size: 28px; margin: 4px 0 0; color: var(--ink); }
.ca-kpi .mute { font-family: var(--t-ui); font-size: 12px; }
.ca-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ca-grid-structure { grid-template-columns: 320px 1fr; }
.ca-table { width: 100%; border-collapse: collapse; font-family: var(--t-ui); font-size: 13px; margin-top: 8px; }
.ca-table th, .ca-table td { padding: 8px 6px; text-align: left; vertical-align: middle; }
.ca-table th { color: var(--ink-3); font-weight: 600; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.ca-table td { border-top: 1px solid var(--glass-stroke); }
.ca-table .num-col { text-align: right; }
.ca-table .actions-col { text-align: right; white-space: nowrap; }
.ca-table tr.is-retired td { opacity: 0.5; }
.ca-units { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ca-unit {
  display: grid; grid-template-columns: 1fr auto 36px; gap: 8px; align-items: center;
  padding: 8px 10px; border-radius: var(--r); cursor: pointer;
  font-family: var(--t-ui); font-size: 13px;
}
.ca-unit:hover { background: var(--glass); }
.ca-unit.is-open { background: var(--accent-soft); color: var(--accent); }
.ca-unit .num { text-align: right; }
.ca-panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ca-code { display: flex; gap: 8px; align-items: flex-end; }
.ca-add { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0 4px; }
.ca-add .field input, .ca-add .field select { min-width: 90px; }
.ca-csv { width: 100%; font-family: var(--t-num); font-size: 12px; padding: 10px; }
.ca-import-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ca-import-actions label.btn { cursor: pointer; }
.ca-plan { font-family: var(--t-ui); font-size: 13px; margin: 10px 0 0; padding-left: 18px; }
.ca-exc { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ca-exc li { padding: 10px 12px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--glass-stroke); }
.ca-exc-note { font-family: var(--t-prose); font-size: 13px; margin-top: 4px; }
.ca-exc-meta { font-family: var(--t-ui); font-size: 11px; margin-top: 2px; }
.ca-exc-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
.ca-table .ca-date { padding: 4px 6px; font-family: var(--t-num); font-size: 12px; }
.ca-period-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; margin-top: 10px; }
.ca-period-form .field:first-child { grid-column: 1 / -1; }
.ca-report-form, .ca-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.ca-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ca-chips .chip { font-size: 12px; padding: 6px 12px; }
.ca-chips .chip .num { color: var(--ink-3); margin-left: 4px; }
.chip.is-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.ca-warnbox { border-color: var(--warn); color: var(--ink-2); font-family: var(--t-ui); font-size: 13px; }
.ca-warnbox b { color: var(--warn); }
.ca-guidance ul { margin: 8px 0 0; padding-left: 18px; font-family: var(--t-prose); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }

body.responsive-route .ca { height: auto; overflow: visible; }
body.responsive-route .ca-grid,
body.responsive-route .ca-grid-structure { grid-template-columns: 1fr; }
body.responsive-route .ca-kpis { grid-template-columns: 1fr 1fr; }
body.responsive-route .ca-fac select { min-width: 0; width: 100%; }

/* ─── Panel scanner (curtains-scan.js) ───────────────────────────────────── */
.cs-type { font-size: 14px; font-weight: 600; text-align: center; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-end { background: oklch(1 0 0 / 0.16); border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer; font-family: inherit; }
.cs-panel {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 14px max(env(safe-area-inset-bottom), 14px);
  background: oklch(0.16 0 0 / 0.86); backdrop-filter: blur(8px);
  border-radius: 18px 18px 0 0;
}
.cs-big { font-size: 22px; font-weight: 700; }
.cs-camerr { font-size: 13px; padding: 8px 10px; border-radius: 10px; background: oklch(0.55 0.19 28 / 0.9); }
.cs-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.cs-count { min-width: 74px; padding: 6px 10px; border-radius: 12px; background: oklch(1 0 0 / 0.1); text-align: center; }
.cs-count.is-met { background: oklch(0.58 0.15 152); }
.cs-count-class { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; opacity: 0.9; }
.cs-count-n { font-size: 24px; font-weight: 700; line-height: 1.1; }
.cs-count-n span { font-size: 15px; opacity: 0.75; font-weight: 600; }
.cs-sub { font-size: 12px; opacity: 0.75; }
.cs-counts.is-light .cs-count { background: var(--glass-2); color: var(--ink); }
.cs-counts.is-light .cs-count.is-met { background: var(--ok); color: #fff; }
.cs-last { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 14px; min-height: 34px; }
.cs-last-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-undo { flex-shrink: 0; }
.cs-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cs-toggle input { width: 20px; height: 20px; }
.cs-manual-form { display: flex; gap: 8px; }
.cs-manual-form input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid oklch(1 0 0 / 0.25);
  background: oklch(1 0 0 / 0.08); color: #fff; font-family: var(--t-num); font-size: 15px; text-transform: uppercase;
}
.cs-manual-form input::placeholder { color: oklch(1 0 0 / 0.55); text-transform: none; font-family: var(--t-ui); }
.cs-flash-blue { background: oklch(0.5 0.13 250); }
.cs-flash-word { font-size: 34px; font-weight: 800; letter-spacing: 0.06em; }
.cs-flash-size { font-size: 110px; font-weight: 800; line-height: 1; margin-top: 10px; }
.cs-flash-size:empty, .cs-flash-id:empty { display: none; }
.cs-flash-id { font-family: var(--t-num); font-size: 30px; font-weight: 600; margin-top: 8px; letter-spacing: 0.04em; }
.cs-skips { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.cs-skip { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }
.cs-skip input[name=note] { grid-column: 1 / 3; }
.cs-skip button { grid-column: 3; grid-row: 1; }
.cs-skip input, .cs-skip select { padding: 9px 10px; font-size: 14px; }
.cs-sheet-3 { grid-template-columns: 1fr 1fr 1fr; }
.cs-exc-list { margin: 6px 0 0; padding-left: 18px; font-family: var(--t-ui); font-size: 14px; }
.cs-pick-title { font-family: var(--t-display); font-weight: 600; font-size: 18px; }
.cs-pick-btn { padding: 14px; font-size: 16px; }
.cs-pick-row { display: flex; gap: 8px; margin-top: 10px; }
.cs-pick-row select { flex: 1; min-width: 0; }
.cs-pick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cs-landing-size { font-family: var(--t-display); font-size: 64px; font-weight: 700; line-height: 1.05; margin-bottom: 10px; }

/* ─── Signed-out panel page (curtains-public.js) ─────────────────────────── */
.pp { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.pp-card { width: min(420px, 100%); text-align: center; padding: 28px 22px; border-radius: 18px; background: var(--bg-2); border: 1px solid var(--glass-stroke); font-family: var(--t-ui); color: var(--ink); }
.pp-logo { display: block; height: 40px; margin: 0 auto 18px; }
.pp-eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.pp-size { font-size: 88px; font-weight: 800; line-height: 1; margin: 10px 0 4px; }
.pp-id { font-size: 20px; letter-spacing: 0.06em; margin-bottom: 16px; }
.pp-kv { display: flex; justify-content: center; gap: 8px; margin: 0 0 14px; font-size: 15px; }
.pp-kv dt { color: var(--ink-3); }
.pp-kv dd { margin: 0; font-weight: 600; }
.pp-note { font-size: 13px; color: var(--ink-2); margin: 0 0 14px; }
.ca-missing-unit { margin-top: 12px; }
.ca-missing-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-family: var(--t-ui); font-size: 14px; }
.ca-quarter { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-family: var(--t-ui); font-size: 15px; }
.ca-kpis-4 { grid-template-columns: repeat(4, 1fr); margin-top: 12px; }
@media (max-width: 700px) { .ca-kpis-4 { grid-template-columns: repeat(2, 1fr); } }
.ca-sub { font-size: 12px; margin-top: 2px; }
.ca-exc-row td { border-top: 0; padding-top: 0; }
.ca-exc-row .pill { margin: 0 4px 4px 0; }
.ca-table tr.is-retired-soft td { opacity: 0.8; }
.set-checklist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.set-check { display: flex; align-items: center; gap: 10px; font-family: var(--t-ui); font-size: 14px; cursor: pointer; }
.set-check input { width: 18px; height: 18px; }
