/* Go Go Ops - visual design.
   Brand: Go Go orange (matches gogoportapottyplus.com), Archivo headings, Inter text.
   Everything is driven by the tokens below; light and dark follow the device setting. */

@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/archivo-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/archivo-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/archivo-latin-800-normal.woff2') format('woff2'); }

:root {
  /* Surfaces */
  --bg: #f7f4ef;            /* warm off-white, like the website */
  --bg-2: #efe9e1;          /* hover / subtle fills */
  --panel: #ffffff;
  --ink: #1b1712;
  --muted: #6b6259;
  --line: #e7e0d6;
  --line-strong: #d6ccbf;

  /* Brand */
  --brand: #f26b0f;         /* accents: bars, rings, icons, big numbers */
  --brand-strong: #c24d06;  /* button fill with white text (AA contrast) */
  --brand-hover: #a94204;
  --brand-ink: #ffffff;     /* text on --brand-strong */
  --brand-text: #b34605;    /* orange text/links on light surfaces (AA) */
  --brand-soft: #fff0e5;
  --brand-glow: rgba(242, 107, 15, .28);

  /* Status */
  --ok: #136c3a;    --ok-soft: #e3f5ea;
  --warn: #8a5300;  --warn-soft: #fff1d6;
  --bad: #b42318;   --bad-soft: #fde8e6;
  --info: #1e4fb8;  --info-soft: #e7eeff;
  --violet: #5b34c7; --violet-soft: #efe9ff;
  --teal: #0f6b62;  --teal-soft: #ddf5f2;
  --gray: #57514a;  --gray-soft: #efebe6;

  /* Shape & depth */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(40, 25, 10, .06);
  --shadow: 0 1px 2px rgba(40, 25, 10, .05), 0 4px 14px rgba(40, 25, 10, .06);
  --shadow-lg: 0 10px 30px rgba(40, 25, 10, .14);

  /* Spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Archivo', 'Inter', system-ui, sans-serif;
  font-family: var(--font);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f; --bg-2: #211c17; --panel: #1d1915; --ink: #f3eee8; --muted: #a89f95;
    --line: #2f2822; --line-strong: #40372f;
    --brand: #ff8a3d; --brand-strong: #ff8a3d; --brand-hover: #ffa463; --brand-ink: #1a0e05;
    --brand-text: #ffa463; --brand-soft: #3a2414; --brand-glow: rgba(255, 138, 61, .30);
    --ok: #5fd08f; --ok-soft: #12321f; --warn: #ffc56b; --warn-soft: #3a2a0e;
    --bad: #ff8b7e; --bad-soft: #3d1714; --info: #8db4ff; --info-soft: #152442;
    --violet: #b9a3ff; --violet-soft: #2a1f4d; --teal: #6ed9cb; --teal-soft: #0f302c;
    --gray: #c9c0b5; --gray-soft: #2a241f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .28);
    --shadow-lg: 0 12px 34px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-text); text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 800; margin: 0 0 var(--s1); }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 var(--s4); }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 var(--s2); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.boot { padding: 40px; color: var(--muted); }
::selection { background: var(--brand-soft); }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.shell.grace-open { grid-template-columns: 236px 1fr 380px; }
.shell > div { min-width: 0; }
.main { padding: var(--s8) var(--s8) 48px; min-width: 0; max-width: 1280px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-sub { margin: -14px 0 var(--s5); }
.mobile-bar { display: none; }

/* ---------- Sidebar ---------- */
.nav { background: var(--panel); border-right: 1px solid var(--line); padding: var(--s5) var(--s3); display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav .brand { display: flex; align-items: center; gap: var(--s3); padding: 2px var(--s2) var(--s5); font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.nav .brand img { width: 36px; height: 36px; border-radius: 10px; box-shadow: var(--shadow-sm); }
.nav .brand small { display: block; font-family: var(--font); font-weight: 500; color: var(--muted); font-size: 11.5px; letter-spacing: 0; }
.nav button { position: relative; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
.nav button:hover { background: var(--bg-2); color: var(--ink); }
.nav button.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.nav button.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.nav .spacer { flex: 1; }
.nav .who { font-size: 13px; color: var(--muted); padding: var(--s3) var(--s2) 0; border-top: 1px solid var(--line); margin-top: var(--s3); display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }

/* ---------- Cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5) var(--s6); box-shadow: var(--shadow); margin-bottom: var(--s5); }
.card .card { box-shadow: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.stat { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-sm { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: var(--s8) var(--s4); color: var(--muted); }
.empty p { margin: 0 0 var(--s4); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 calc(var(--s2) * -1); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px var(--s2); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding-top: 6px; }
tr.click { cursor: pointer; transition: background .12s; }
tr.click:hover td { background: var(--bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: var(--s2) var(--s3); margin: 0 0 var(--s4); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--panel); border: 1px solid var(--line-strong); padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; }
.btn:hover { border-color: var(--muted); background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand-strong); color: var(--brand-ink); border-color: var(--brand-strong); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 12px var(--brand-glow); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: var(--radius-xs); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Forms ---------- */
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea { color: var(--ink); font-weight: 400; font-size: 15px; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; min-height: 42px; transition: border-color .15s, box-shadow .15s; }
input[type=checkbox] { min-height: 0; width: 18px; height: 18px; accent-color: var(--brand-strong); }
textarea { min-height: 84px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
button:focus-visible, a:focus-visible, .tile:focus-visible, .stage:focus-visible { outline: 3px solid var(--brand-glow); outline-offset: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s4); }
.check { display: flex; gap: var(--s2); align-items: center; font-size: 14px; color: var(--ink); font-weight: 500; }
/* Checkboxes keep their size next to long text (e.g. the e-sign consent). */
.check input[type="checkbox"] { flex-shrink: 0; width: 20px; height: 20px; }
.check.consent { align-items: flex-start; }
.req { color: var(--bad); }
.bad-text { color: var(--bad); }
.field-error { color: var(--bad); font-size: 12.5px; font-weight: 500; }
label.field.invalid > input, label.field.invalid > select { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); }
.toolbar { margin-bottom: var(--s3); }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.matches { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s3); }
.matches:empty { display: none; }

/* ---------- Pills & notices ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gray-soft); color: var(--gray); white-space: nowrap; line-height: 1.5; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
/* Each job stage gets its own color */
.pill.st-new { background: var(--info-soft); color: var(--info); }
.pill.st-quoted { background: var(--violet-soft); color: var(--violet); }
.pill.st-sold { background: var(--teal-soft); color: var(--teal); }
.pill.st-signed { background: var(--brand-soft); color: var(--brand-text); }
.pill.st-paid { background: var(--ok-soft); color: var(--ok); }
.pill.st-dispatched { background: var(--warn-soft); color: var(--warn); }
.pill.st-delivered { background: var(--ok-soft); color: var(--ok); }
.pill.st-closed { background: var(--gray-soft); color: var(--gray); }
.pill.st-cancelled { background: var(--bad-soft); color: var(--bad); }
.notice { padding: var(--s3) var(--s4); border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info); margin: var(--s2) 0 var(--s4); border: 1px solid color-mix(in srgb, var(--info) 18%, transparent); font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.notice ul { margin: 6px 0 0 18px; padding: 0; }
.linkbox { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; background: var(--bg); border: 1px dashed var(--line-strong); padding: var(--s3); border-radius: var(--radius-xs); }
pre.json { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: var(--bg); padding: var(--s2); border-radius: var(--radius-xs); margin: 0; }

/* ---------- Sign-in screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s4);
  background: radial-gradient(1200px 500px at 15% -10%, var(--brand-soft), transparent 60%), var(--bg); }
.auth .card { width: 100%; max-width: 420px; padding: var(--s8); box-shadow: var(--shadow-lg); border-top: 4px solid var(--brand); }
.auth h1 { color: var(--brand-text); }
.qr { display: block; margin: var(--s2) auto; width: 200px; height: 200px; background: #fff; padding: var(--s2); border-radius: var(--radius-sm); }

/* ---------- Dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }
.tile { position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s5) var(--s4) calc(var(--s5) + 2px); box-shadow: var(--shadow); text-align: left; display: flex; flex-direction: column; gap: 4px; }
.tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.tile.click { cursor: pointer; transition: transform .12s, box-shadow .15s, border-color .15s; }
.tile.click:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.tile.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-glow), var(--shadow); }
.tile .muted.small:first-child { text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; font-weight: 600; }
.pipeline { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.stage { position: relative; background: var(--panel); border: 0; border-right: 1px solid var(--line); padding: var(--s4) var(--s2); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: background .15s; }
.stage:last-child { border-right: 0; }
.stage:hover { background: var(--brand-soft); }
.stage:hover .stage-n { color: var(--brand-text); }
.stage-n { font-family: var(--font-display); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.attn { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attn li + li { border-top: 1px solid var(--line); }
.attn-row { width: 100%; background: none; border: 0; padding: 11px 6px; display: flex; gap: var(--s3); align-items: center; text-align: left; cursor: pointer; border-radius: var(--radius-xs); transition: background .12s; }
.attn-row:hover { background: var(--bg); }
.badge-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.badge-count { display: flex; align-items: center; gap: var(--s2); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; transition: border-color .15s; }
.badge-count:hover { border-color: var(--line-strong); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: -6px 0 var(--s4); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 12px; cursor: pointer; white-space: nowrap; color: var(--muted); display: flex; gap: 6px; align-items: center; font-weight: 500; transition: color .15s; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-text); border-bottom-color: var(--brand); font-weight: 600; }
.tab-n { font-size: 12px; background: var(--bg-2); border-radius: 999px; padding: 0 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tab.active .tab-n { background: var(--brand-soft); color: var(--brand-text); }

/* Anything marked hidden stays hidden, even if its class sets a display (e.g. .pill). */
[hidden] { display: none !important; }

/* ---------- Money pages ---------- */
.row.spread { justify-content: space-between; }
tr.selected td { background: var(--brand-soft); }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.chip { border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }
.chip.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); font-weight: 600; }
.neg { color: var(--bad); }
.struck { text-decoration: line-through; color: var(--muted); }
ul.plain { list-style: none; padding: 0; margin: var(--s2) 0; }
.card-element { padding: var(--s3) 0; min-height: 120px; }
.period-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s3); margin: var(--s3) 0; }
.period-card { text-align: left; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s3); cursor: pointer; display: flex; flex-direction: column; gap: var(--s2); }
.period-card:hover { border-color: var(--line-strong); }
.period-card.selected { border-color: var(--brand); background: var(--brand-soft); }
.period-head { display: flex; flex-direction: column; }
.period-lines { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s3); margin: 0; font-size: 14px; }
.period-lines dt { color: var(--muted); }
.period-lines dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.period-net { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: var(--s2); }
.margin-box { border-left: 4px solid var(--line-strong); }
.margin-box.ok { border-left-color: var(--ok); }
.margin-box.warn { border-left-color: var(--warn); background: linear-gradient(var(--warn-soft), var(--warn-soft)) top / 100% 4px no-repeat, var(--panel); }
.margin-box.bad { border-left-color: var(--bad); background: linear-gradient(var(--bad-soft), var(--bad-soft)) top / 100% 4px no-repeat, var(--panel); }
.margin-box table { width: 100%; }
.margin-box tr.total td { border-top: 1px solid var(--line-strong); padding-top: var(--s2); }

/* ---------- Grace panel ---------- */
.grace { background: var(--panel); border-left: 1px solid var(--line); display: none; flex-direction: column; height: 100vh; position: sticky; top: 0; }
.shell.grace-open .grace { display: flex; }
.grace-head { padding: 14px var(--s4); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.grace-head .title { font-family: var(--font-display); font-weight: 800; font-size: 17px; display: inline-flex; align-items: center; gap: var(--s2); }
.grace-head .title::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.mode-chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--info-soft); color: var(--info); font-weight: 600; }
.mode-chip.voice { background: var(--brand-soft); color: var(--brand-text); }
.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; font-weight: 500; }
.grace-log { flex: 1; overflow-y: auto; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); background: linear-gradient(var(--panel), var(--bg)); }
.msg { padding: 10px 14px; border-radius: 16px; max-width: 90%; white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; box-shadow: var(--shadow-sm); }
.msg.grace-msg { background: var(--panel); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.user-msg { background: var(--brand-strong); color: var(--brand-ink); align-self: flex-end; border-bottom-right-radius: 6px; }
.msg .acts { margin-top: var(--s2); display: flex; gap: 6px; flex-wrap: wrap; }
.grace-form { border-top: 1px solid var(--line); padding: var(--s3); display: flex; gap: var(--s2); position: relative; background: var(--panel); }
.grace-form input { flex: 1; border-radius: 999px; padding-left: 16px; }
.grace-form .btn { border-radius: 999px; }
.talk { position: absolute; right: var(--s4); bottom: 76px; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--brand-strong); color: var(--brand-ink); font-weight: 700; font-size: 11px; cursor: pointer; box-shadow: 0 6px 18px var(--brand-glow); transition: transform .12s, background .15s; }
.talk:hover { transform: scale(1.05); }
.talk.listening { animation: talk-pulse 1.6s ease-in-out infinite; }
.talk.paused { background: var(--muted); box-shadow: var(--shadow); }
@keyframes talk-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--brand-glow), 0 6px 18px var(--brand-glow); }
  50% { box-shadow: 0 0 0 12px rgba(242, 107, 15, 0), 0 6px 18px var(--brand-glow); }
}
/* Grace's icon: bottom right on every screen size, hidden while she is open. */
.grace-fab { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 29; width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; background: var(--brand-strong); color: var(--brand-ink); box-shadow: 0 8px 22px var(--brand-glow); transition: transform .15s; }
.grace-fab:hover { transform: scale(1.06); }
.grace-fab:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Toast & dialogs ---------- */
.toast { position: fixed; bottom: var(--s5); left: 50%; transform: translate(-50%, 8px); background: var(--ink); color: var(--panel); padding: 11px 18px; border-radius: var(--radius-sm); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); z-index: 50; font-weight: 500; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); max-width: 520px; width: calc(100% - 32px); padding: var(--s6); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(20, 12, 5, .45); backdrop-filter: blur(2px); }

/* ---------- Settings ---------- */
.setting { padding: var(--s4) 0; border-top: 1px solid var(--line); }
.card h2 + .setting { border-top: 0; padding-top: 2px; }
.setting-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; }
.setting-head strong { font-weight: 600; }
.setting-help { margin: 4px 0 var(--s2); max-width: 70ch; }
.setting-text { white-space: pre-line; font-weight: 500; }
.setting-edit { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s4); max-width: 780px; }
.setting-edit textarea { width: 100%; }
.setting-edit > input[type=text] { width: 100%; }
.with-unit { display: inline-flex; align-items: center; gap: 6px; }
.with-unit input { width: 120px; }
.unit { color: var(--muted); font-size: 14px; font-weight: 500; }
input.rate { width: 90px; }
.tax-table td { padding: var(--s3) var(--s2); vertical-align: top; }
.tax-table td:first-child { width: 120px; }
.county-list:empty { display: none; }
.history { list-style: none; margin: 0 0 var(--s4); padding: 0; display: flex; flex-direction: column; gap: var(--s3); max-height: 60vh; overflow-y: auto; }
.history li { border-left: 3px solid var(--brand); padding-left: var(--s3); }
.footer-link { margin: var(--s1) 0 var(--s6); text-align: center; }

/* ---------- Install prompt & offline ---------- */
.install-banner { position: fixed; left: var(--s4); bottom: var(--s4); z-index: 45; max-width: 440px; width: calc(100% - 32px);
  display: grid; grid-template-columns: 48px 1fr; gap: 10px var(--s3); align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--radius); padding: var(--s4); box-shadow: var(--shadow-lg); }
.install-icon { width: 48px; height: 48px; border-radius: 12px; }
.install-text .small { color: var(--muted); margin-top: 2px; }
.install-actions { grid-column: 1 / -1; display: flex; gap: var(--s2); justify-content: flex-end; }
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 60; background: var(--warn-soft); color: var(--warn); text-align: center; padding: var(--s2) var(--s4); font-size: 14px; font-weight: 500; border-bottom: 1px solid var(--line); }
@media (display-mode: standalone) { .install-banner { display: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 220px 1fr; }
  .shell.grace-open { grid-template-columns: 200px 1fr 320px; }   /* still side by side, a little narrower */
  .main { padding: var(--s6); }
}
/* Too narrow to sit beside the work: Grace opens full-screen with a big ✕ back to it. */
@media (max-width: 900px) {
  .shell.grace-open { grid-template-columns: 220px 1fr; }
  .shell.grace-open .grace { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 50; border-left: 0; }
  .shell.grace-open .close-grace { font-size: 18px; padding: 8px 14px; }
}
@media (max-width: 900px) { .pipeline { grid-template-columns: repeat(4, 1fr); } .stage:nth-child(4) { border-right: 0; } .stage:nth-child(-n+4) { border-bottom: 1px solid var(--line); } }
@media (max-width: 760px) {
  .shell, .shell.grace-open { grid-template-columns: 1fr; }
  .nav { display: none; position: fixed; inset: 0 25% 0 0; z-index: 40; box-shadow: var(--shadow-lg); height: 100vh; }
  .nav.open { display: flex; }
  .mobile-bar { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s4); background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; font-family: var(--font-display); }
  .main { padding: var(--s5) var(--s4) 96px; }
  h1 { font-size: 22px; }
  .card { padding: var(--s4); border-radius: var(--radius-sm); }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; gap: var(--s3); }
  .stat { font-size: 24px; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .stage { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .stage:nth-child(2n) { border-right: 0; }
  .kv { grid-template-columns: 110px 1fr; }
  th.hide-sm, td.hide-sm { display: none; }
  .with-unit input { width: 100px; }
  .tax-table td:first-child { width: 90px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Preferred vendors ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.card-head h2 { margin: 0; }
.rank { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-text); font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; }
a.attn-row { color: inherit; text-decoration: none; }
.flag { font-size: 12.5px; font-weight: 600; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.flag::before { content: '⚑'; }
.flag-coi_expired, .flag-on_time_slipping { color: var(--bad); }
.flag-coi_expiring { color: var(--warn); }
.link-item { padding: var(--s3) 0; border-top: 1px solid var(--line); }

/* ---------- Leads (permits) ---------- */
.pill.st-contacted { background: var(--violet-soft); color: var(--violet); }
.pill.st-converted { background: var(--ok-soft); color: var(--ok); }
.pill.st-dead { background: var(--gray-soft); color: var(--gray); }
.script { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); counter-reset: step; }
.script li { background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); }
.script-step { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-text); margin-bottom: 4px; }
.script p { margin: 0; font-size: 16px; line-height: 1.55; }
details summary { cursor: pointer; color: var(--brand-text); }
.show-sm { display: none; }
@media (max-width: 760px) { .show-sm { display: block; } }

/* ---------- Proof of delivery ---------- */
.pod-sub { padding: var(--s3) 0; border-top: 1px solid var(--line); }
.pod-msg { margin: 6px 0 var(--s3); font-weight: 500; }
.pod-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s3); }
.pod-photos figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pod-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); }
.pay-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); padding-top: var(--s3); margin-top: var(--s3); border-top: 1px solid var(--line); }
.pay-line .row { margin-left: auto; }
.btn.big { padding: 14px 18px; font-size: 16px; width: 100%; }
.pod-page { max-width: 480px; }

/* ---------- Call numbers (side menu) ---------- */
.call-panel { margin: var(--s4) var(--s1) 0; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.call-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-text); margin-bottom: var(--s2); }
.call-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.call-list li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); font-size: 13px; }
.call-market { color: var(--muted); font-weight: 500; }
.call-number { font-variant-numeric: tabular-nums; font-weight: 600; text-decoration: none; white-space: nowrap; }
.call-tip { margin-top: var(--s2); }

/* ---------- Documents & templates ---------- */
.doc-section { padding-top: var(--s3); }
.doc-section + .doc-section { border-top: 1px solid var(--line); margin-top: var(--s3); }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s2) 0; border-top: 1px solid var(--line); }
.doc-list .doc-row:first-child { border-top: 0; }
.blocked-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.tpl-grid { align-items: start; }
.tpl-body { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.5; min-height: 60vh; }
.slot-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.slot-list li { display: flex; flex-direction: column; gap: 2px; }
.slot { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; cursor: pointer; text-align: left; align-self: flex-start; }
.slot:hover { border-color: var(--brand); color: var(--brand-text); }
