:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1a1d21;
  --muted: #6b7280;
  --line: #ececf0;
  --accent: #0f766e;
  --accent-soft: #e6f1ef;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e14; --card: #151a22; --ink: #e8eaed; --muted: #9aa3af;
    --line: #232a35; --accent: #2dd4bf; --accent-soft: #16302d;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
}
.card {
  width: 100%;
  max-width: 880px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
}
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 6px;
}
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.02em; }
.subtitle { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}
.panel { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 680px) { .columns { grid-template-columns: 1fr; } }
.muted { color: var(--muted); font-size: 14px; }

.kv { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 9px;
}
.chip.ok { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }

ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 14px;
}
ul.list li > span:first-child { min-width: 0; overflow-wrap: anywhere; }   /* label shrinks/wraps; amount tag stays on-screen */
.tag {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: var(--bg); border-radius: 6px; padding: 2px 7px; white-space: nowrap;
}
.tag.cogs { background: var(--accent-soft); color: var(--accent); }
/* fixed-cost provenance tags (ACCRUED / ASSUMED / PARKED) */
.tag.accrued { background: var(--accent-soft); color: var(--accent); }
.tag.assumed { background: rgba(245, 158, 11, .16); color: #b45309; }
.tag.parked  { background: var(--bg); color: var(--muted); text-decoration: line-through; }

/* Prime Cost stat cards */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 6px; }
@media (max-width: 680px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px 16px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px;
}
.stat .k {
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
}
.stat .v { font-family: var(--mono); font-size: 16px; font-variant-numeric: tabular-nums; }
.stat.emphasize { background: var(--accent-soft); border-color: var(--accent-soft); }
.stat.emphasize .v { color: var(--accent); font-weight: 700; }
.subhead { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }

/* Flash P&L statement (piece 3) */
.flash-stmt { margin-top: 8px; }
.fl-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 56px; gap: 14px; align-items: baseline;
  padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.fl-row .fl-label { min-width: 0; overflow-wrap: anywhere; }   /* shrink/wrap; never force the amount off-screen */
.fl-row .fl-amt { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.fl-row .fl-pct { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.fl-row.fl-indent .fl-label { padding-left: 18px; color: var(--muted); }
.fl-row.fl-sub { border-top: 2px solid var(--line); border-bottom: none; font-weight: 700; margin-top: 2px; }
.fl-row.fl-flash {
  border: 0; border-top: 2px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 0 10px 10px; padding: 13px 10px; margin-top: 2px;
}
.fl-row.fl-flash .fl-label, .fl-row.fl-flash .fl-amt { color: var(--accent); font-weight: 700; font-size: 15px; }

/* --- purchase-entry form --- */
form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
form input, form select {
  font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink);
}
form input:focus, form select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 680px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
/* let grid cells shrink below their content's min-content so nothing overflows */
.form-grid > label { min-width: 0; }
.form-grid input, .form-grid select, .line-row .line-cat, .line-row .line-amt { width: 100%; min-width: 0; }

.lines-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
#scan-line-hint { flex: 1 1 auto; min-width: 0; }
.line-row { display: grid; grid-template-columns: 1fr 150px 38px; gap: 10px; margin-bottom: 8px; align-items: center; }
.line-del {
  height: 38px; border: 1px solid var(--line); background: var(--bg);
  border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 17px; line-height: 1;
}
.line-del:hover { color: #c5221f; }
.btn-sm {
  font-size: 12px; padding: 6px 11px; border: 1px solid var(--line);
  background: var(--bg); border-radius: 8px; cursor: pointer; color: var(--ink);
}
.totals { display: flex; align-items: center; gap: 18px; margin-top: 14px; flex-wrap: wrap; font-size: 14px; }
.totals label { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.totals input { width: 130px; }
.warn { color: #c5221f; font-size: 12.5px; }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 20px; }
#save-btn {
  font-size: 14px; font-weight: 600; padding: 10px 18px; border: 0;
  border-radius: 9px; background: var(--accent); color: #fff; cursor: pointer;
}
#save-btn:disabled { opacity: .5; cursor: default; }
#form-msg { font-size: 13px; }
#form-msg.err { color: #c5221f; }
#form-msg.ok { color: var(--accent); }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; margin-bottom: 14px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); font-size: 13px;
}
.banner button {
  font-size: 12px; padding: 6px 12px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); border-radius: 8px; cursor: pointer; white-space: nowrap;
}

/* --- top-right drawer buttons (Managers, Fixed Costs) + drawers --- */
header { position: relative; }
.header-actions { position: absolute; top: 0; right: 0; display: flex; gap: 8px; }
.drawer-btn {
  font-size: 13px; font-weight: 600; padding: 8px 14px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 9px; cursor: pointer;
}
.drawer-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Mobile: the header action buttons are absolute top-right on desktop; on narrow
   screens that overlaps the (wrapping) long title. Drop them back into flow so they
   sit BELOW the title and wrap, with comfortable tap targets. */
@media (max-width: 720px) {
  .header-actions { position: static; margin-top: 12px; flex-wrap: wrap; }
  header h1 { font-size: 20px; }
  .drawer-btn { padding: 10px 14px; }
}
/* The 4 view-toggle labels overflow a single row on phones (~390px); wrap to 2x2. */
@media (max-width: 480px) {
  .master-toggle { flex-wrap: wrap; }
  .master-toggle button { flex: 1 1 calc(50% - 2px); }
  body { padding: 16px 10px; }        /* reclaim ~40px of content width on phones */
  .card { padding: 18px 16px; }
  .fl-row { gap: 8px; }               /* tighter columns so amount + pct fit */
}
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 60; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 94vw);
  background: var(--card); border-left: 1px solid var(--line);
  box-shadow: -8px 0 40px rgba(0, 0, 0, .28); z-index: 61; padding: 22px; overflow-y: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drawer-head h2 { margin: 0; font-size: 16px; }
#mgr-summary { margin-bottom: 12px; font-size: 13px; }
.mgr-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.mgr-actions button { margin-left: 6px; }
#mgr-form label, .mgr-settings label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
#mgr-form label.chk { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 13px; }
#mgr-form input[type=text], #mgr-form input[type=number], .mgr-settings input {
  width: 100%; font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); margin-top: 3px;
}
#mgr-form label.chk input { width: auto; margin: 0; }
.mgr-settings { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.mgr-settings label { flex: 1; min-width: 120px; }
#mgr-save { font-size: 14px; font-weight: 600; padding: 9px 16px; border: 0; border-radius: 9px; background: var(--accent); color: #fff; cursor: pointer; }
#mgr-form-msg, #set-msg { font-size: 13px; color: var(--accent); }

/* --- global date-range control --- */
.range-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.range-bar label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.range-bar input {
  font-family: inherit; font-size: 14px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.range-presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Contract-labor attribution section (revealed only for a gl-6130 line). */
.cl-attr { margin: 10px 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.cl-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.cl-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cl-presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cl-presets .muted { font-weight: 600; }
/* "Last Week" is the arrears norm -> prominent. */
.cl-primary { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }

/* Phase 2.5a multi-invoice / single-payment. Default: single-only shows, mi-only hides.
   In multi-mode (class on #purchase-form), flip them. Author display rules override the
   `hidden` attribute + the default .mi-only hide. */
.mi-chk { margin-left: auto; font-size: 12px; }
.mi-only { display: none; }
#purchase-form.multi-mode .single-only { display: none !important; }
#purchase-form.multi-mode #mi-section { display: block; }
#purchase-form.multi-mode label .mi-only,
#purchase-form.multi-mode span.mi-only { display: inline; }
.mi-invoice { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.mi-invoice.bad { border-color: #f3b4af; }
.mi-inv-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.mi-inv-head label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.mi-inv-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mi-inv-title .subhead { margin: 0; }
.mi-lines { margin-top: 8px; }
.mi-subcheck { margin-top: 6px; font-size: 12px; font-weight: 600; }
.mi-subcheck.ok { color: var(--accent); }
.mi-subcheck.bad { color: #b42318; }
.mi-inv-del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.mi-inv-del:hover { color: #b42318; }
.mi-detail-inv { margin-bottom: 10px; }
.mi-detail-head { font-size: 12px; font-weight: 700; color: var(--muted); margin: 2px 0 4px; }
/* Phase 2.75 batch-scan LOCK: while a serial read is in flight (.scanning on the form),
   dim + block the per-block STRUCTURAL buttons (add line / remove invoice / remove row) so
   they can't mutate blocks mid-append. Value inputs, selects, and the verify pill stay
   interactive -- the operator reviews early blocks while later ones read. Top-level
   buttons are truly .disabled in JS; the handler guards back up the keyboard path. */
#purchase-form.scanning .mi-add-line,
#purchase-form.scanning .mi-inv-del,
#purchase-form.scanning .mi-lines .line-del,
#purchase-form.scanning .mi-charges .line-del { pointer-events: none; opacity: .4; }

/* Phase 2.5 charge row -- its OWN labeled layout (NOT the goods .line-row grid, whose CSS
   keys on .line-* classes the charge row doesn't use). One clear row: Description |
   Category | Amount $ | remove. align-items:end so the unlabeled × lines up with the inputs. */
.mi-charge-row { display: grid; grid-template-columns: 1fr 160px 130px 32px; gap: 10px; align-items: end; margin-bottom: 8px; }
.mi-ch-fld { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.mi-ch-fld input, .mi-ch-fld select { width: 100%; min-width: 0; }
.mi-amt { position: relative; display: block; }
.mi-amt-sym { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.mi-amt .charge-amt { padding-left: 18px; }
/* dollar field: drop the tiny up/down spinner so it reads as money, not a stepper */
.charge-amt { -moz-appearance: textfield; }
.charge-amt::-webkit-outer-spin-button, .charge-amt::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
@media (max-width: 680px) { .mi-charge-row { grid-template-columns: 1fr 1fr; } }

/* Jump-to-error: the field a blocked save lands on gets a red outline until touched. */
.field-error { outline: 2px solid #d33 !important; outline-offset: 1px; border-radius: 4px; }
/* Phase 2.75 batch-scan: per-block receipt thumbnail (click to enlarge), AI note, flagged row. */
.mi-receipt { margin: 6px 0; }
.mi-thumb { max-height: 90px; border: 1px solid var(--line); border-radius: 6px; cursor: zoom-in; }
.mi-thumb.big { max-height: 600px; max-width: 100%; cursor: zoom-out; }
.mi-thumb-hint { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mi-note { margin: 4px 0; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 6px; }
.mi-note.warn { background: #fdf0d5; color: #92600a; }
.mi-note.bad { background: #fde2e1; color: #b42318; }
.line-row.flagged-row { outline: 2px solid #e7c98a; outline-offset: 1px; border-radius: 4px; }
/* The native date-picker icon ships black -- nearly invisible on the dark UI.
   invert(1) turns it white/light so it reads on the dark inputs. */
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

/* --- confirmation modal --- */
/* Default hidden. The `display:flex` author rule used to override the `hidden`
   attribute's UA `display:none`, so the modal showed on load and trapped clicks.
   Scoping the flex to :not([hidden]) lets `hidden` actually hide it. */
.modal {
  position: fixed; inset: 0; z-index: 50; padding: 20px;
  background: rgba(10, 14, 20, .55);
  display: none; align-items: center; justify-content: center;
}
.modal:not([hidden]) { display: flex; }
/* Scroll-lock the page behind an open modal so the wheel/touch scrolls the modal
   box (which now has its own overflow), not the background. Pure CSS via :has() --
   covers every .modal automatically, no per-call-site JS. */
body:has(.modal:not([hidden])) { overflow: hidden; }
.modal-box {
  width: 100%; max-width: 520px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  /* Cap to the viewport and let the box scroll itself, so a long line-item list
     (e.g. a ~25-line Baldor scan) never pushes the action buttons off-screen.
     dvh handles the mobile address bar; vh is the fallback. */
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;   /* smooth momentum scroll on iOS */
}
.modal-box h3 { margin: 0 0 14px; font-size: 17px; }
/* Sticky footer INSIDE the scrolling box: the approve/cancel buttons stay
   reachable no matter how long the list is. Background + top border keep content
   from showing through as it scrolls under. */
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: -24px;            /* flush to the box's padded bottom edge */
  margin: 20px -24px -24px;                    /* span the box's horizontal padding */
  padding: 14px 24px; background: var(--card);
  border-top: 1px solid var(--line);
  border-radius: 0 0 16px 16px;
}
#confirm-ok {
  font-size: 14px; font-weight: 600; padding: 10px 18px; border: 0;
  border-radius: 9px; background: var(--accent); color: #fff; cursor: pointer;
}
.confirm-line {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.confirm-line span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.confirm-total { display: flex; justify-content: space-between; margin-top: 12px; font-weight: 700; font-size: 15px; }
.confirm-total span:last-child { font-family: var(--mono); }
.confirm-credit { color: #c5221f; font-size: 13px; margin-top: 10px; }

/* --- master view toggle + embedded Sales & Labor (iframe) --- */
.master-toggle {
  display: flex; gap: 4px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 11px; padding: 4px; margin-bottom: 24px;
}
.master-toggle button {
  flex: 1; appearance: none; border: 0; background: transparent; color: var(--muted);
  font-family: inherit; font-size: 14px; font-weight: 600; padding: 10px 8px;
  border-radius: 8px; cursor: pointer; transition: background .15s ease, color .15s ease;
}
.master-toggle button:hover { color: var(--ink); }
.master-toggle button[aria-pressed="true"] {
  background: var(--card); color: var(--accent); box-shadow: 0 1px 2px rgba(16,24,40,.12);
}
.sales-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

/* === Sales & Labor report (folded in from the retired dsr-view.html iframe) =====
   ALL rules scoped under .dsr-report so (a) they never collide with the app's bare
   .card/.stat/.row/etc. (11 collisions found in this file) and (b) the report's own
   color palette stays inside the report subtree -- the .sales-bar buttons (a sibling
   of #sales-body, styled by the app above) are NOT affected. Palette vars live ON
   .dsr-report (not :root) for the same containment. */
.dsr-report {
  --bg: #f4f5f7; --card: #ffffff; --ink: #1a1d21; --muted: #6b7280; --faint: #aeb4bd;
  --line: #ececf0; --accent: #0f766e; --accent-soft: #e6f1ef; --total-bg: #f0f7f5;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--ink); max-width: 960px;
}
@media (prefers-color-scheme: dark) {
  .dsr-report {
    --bg: #0b0e14; --card: #151a22; --ink: #e8eaed; --muted: #9aa3af; --faint: #5b6470;
    --line: #232a35; --accent: #2dd4bf; --accent-soft: #16302d; --total-bg: #142a27;
  }
}
.dsr-report .subtitle { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.dsr-report .columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 720px) { .dsr-report .columns { grid-template-columns: 1fr; gap: 28px; } }
.dsr-report .col h2 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.dsr-report .recon { margin-top: 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; }
.dsr-report .recon .r { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 2px 0; }
.dsr-report .recon .r .amt { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dsr-report .pill { display: inline-block; margin-top: 10px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.dsr-report .pill.pass { background: #e6f4ea; color: #137333; }
.dsr-report .pill.fail { background: #fce8e6; color: #c5221f; }
@media (prefers-color-scheme: dark) {
  .dsr-report .pill.pass { background: #10331c; color: #5bd98a; }
  .dsr-report .pill.fail { background: #3a1816; color: #f2918c; }
}
.dsr-report .labor { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.dsr-report .labor h2 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.dsr-report .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 720px) { .dsr-report .stats { grid-template-columns: repeat(2, 1fr); } }
.dsr-report .stat { display: flex; flex-direction: column; gap: 5px; padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.dsr-report .stat .k { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.dsr-report .stat .v { font-family: var(--mono); font-size: 18px; font-variant-numeric: tabular-nums; }
.dsr-report .stat.emphasize { background: var(--total-bg); border-color: var(--accent-soft); }
.dsr-report .stat.emphasize .v { color: var(--accent); font-weight: 700; }
.dsr-report .daytable { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13.5px; }
.dsr-report .daytable th, .dsr-report .daytable td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.dsr-report .daytable th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.dsr-report .daytable td.num, .dsr-report .daytable th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dsr-report .daytable tbody tr:hover td { background: var(--bg); }
.dsr-report .pill.sm { margin: 0; padding: 2px 9px; font-size: 11px; }
.dsr-report .segmented { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 4px; margin: 18px 0 8px; }
.dsr-report .segmented button { flex: 1; appearance: none; border: 0; background: transparent; color: var(--muted); font-family: inherit; font-size: 13.5px; font-weight: 600; padding: 9px 8px; border-radius: 8px; cursor: pointer; transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.dsr-report .segmented button:hover { color: var(--ink); }
.dsr-report .segmented button[aria-pressed="true"] { background: var(--card); color: var(--accent); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.dsr-report .meta { display: flex; align-items: center; justify-content: space-between; margin: 18px 2px 10px; }
.dsr-report .meta .view-name { font-weight: 600; font-size: 15px; }
.dsr-report .badge { font-size: 12.5px; color: var(--muted); background: var(--accent-soft); border-radius: 999px; padding: 4px 11px; font-weight: 600; }
.dsr-report .lines { display: flex; flex-direction: column; }
.dsr-report .row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.dsr-report .row .name { font-size: 14.5px; }
.dsr-report .row .amt { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dsr-report .row.zero { opacity: .38; }
.dsr-report .total { display: flex; align-items: baseline; justify-content: space-between; margin-top: 16px; padding: 16px 18px; background: var(--total-bg); border: 1px solid var(--line); border-radius: 12px; }
.dsr-report .total .label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dsr-report .total .amt { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.dsr-report .subtotal { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; padding: 4px 18px 0; color: var(--muted); }
.dsr-report .subtotal .label { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.dsr-report .subtotal .amt { font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }
.dsr-report .report-foot { margin-top: 22px; color: var(--faint); font-size: 12px; }
.dsr-report .empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14.5px; }
.dsr-report .bad { color: #c5221f; padding: 16px 0; font-size: 14px; }

/* --- add-vendor inline form --- */
.link-btn {
  margin-top: 6px; align-self: flex-start; background: none; border: 0;
  color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0;
}
.addvendor {
  margin: 4px 0; padding: 14px 16px; border: 1px dashed var(--line);
  border-radius: 12px; background: var(--bg);
}
.av-grid { display: grid; grid-template-columns: 2fr 1.5fr 1fr; gap: 12px; }
@media (max-width: 680px) { .av-grid { grid-template-columns: 1fr 1fr; } }
.av-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
#av-msg { font-size: 13px; }
#av-msg.err { color: #c5221f; }
#av-msg.ok { color: var(--accent); }

/* --- saved-purchase view/edit --- */
.modal-box.wide { max-width: 760px; }
.recent-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.recent-controls .chk { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
#recent-body { max-height: 60vh; overflow-y: auto; }
.recent-search { flex: 1 1 240px; min-width: 180px; box-sizing: border-box; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
/* Collapsed purchase rows: click to expand line-item detail. */
tr.prow { cursor: pointer; }
tr.prow.nolines { cursor: default; }
tr.prow:hover td { background: var(--bg); }
td.caret { color: var(--muted); width: 18px; }
td.ract { white-space: nowrap; text-align: right; }
td.ract .btn-sm { padding: 2px 8px; font-size: 11.5px; }
tr.detail-row > td { background: var(--bg); padding: 0; }
/* Expanded line items: item name leads, GL category demoted to a muted tag. */
.plines { padding: 6px 10px 10px; }
.pline { display: flex; align-items: baseline; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.pline:last-child { border-bottom: none; }
.pline-item { flex: 1; }
.lname { font-weight: 600; }
.lmeta { color: var(--muted); font-size: 12px; font-family: var(--mono); white-space: nowrap; }
.gltag { font-size: 11px; color: var(--muted); background: var(--card); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 7px; white-space: nowrap; }
.pline-amt { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 80px; text-align: right; }

/* --- recent-purchases table --- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
table.tbl td.num, table.tbl th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- QBO vendor mapping drawer --- */
.qbov-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.qbov-row:last-child { border-bottom: none; }
.qbov-name { margin-bottom: 4px; }
.qbov-sugg { margin: 4px 0 4px 14px; }
.qbov-manual { margin: 6px 0 4px 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.qbov-manual select { max-width: 210px; }
.qbov-msg { display: block; margin: 4px 0 0 14px; }

/* spinner — used by the New-purchase Scan "Reading invoice…" status */
.spin { display: inline-block; animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- New-purchase entry: manual / scan modes + receipt-alongside (Phase 2) --- */
.entry-modes { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 14px; }
.mode-btn {
  font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.mode-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* During a scan's read state the whole purchase form is hidden -- there's no
   invoice to edit yet, so the lines section, + Add line, totals, validate/override,
   and Save are all suppressed. The receipt preview + "Reading invoice…" spinner
   live OUTSIDE the form, so they remain visible. Revealed, populated, on completion. */
#purchase-form.reading { display: none; }
.entry-cols { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
/* minmax(0, …) on BOTH tracks so the form column can shrink below its content's
   min-content instead of spilling off-screen. min-width:0 on the children too. */
.entry-cols.scanning { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
.entry-cols > .receipt-col, .entry-cols > .form-col { min-width: 0; }
@media (max-width: 760px) { .entry-cols.scanning { grid-template-columns: 1fr; } }
/* in scan mode the form shares width with the receipt — reflow header to 2 cols */
.entry-cols.scanning .form-grid { grid-template-columns: repeat(2, 1fr); }
.receipt-col { position: sticky; top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); max-height: calc(100vh - 40px); overflow: auto; }
.receipt-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.receipt-view img { width: 100%; border: 1px solid var(--line); border-radius: 8px; display: block; }
.receipt-view .pdf-note { padding: 24px 12px; text-align: center; }
/* After extraction the source image collapses to a tappable thumbnail so the form +
   extracted lines are visible -- MOBILE ONLY; desktop keeps the alongside-verify column
   (Phase 2). Tap the receipt to toggle full/thumbnail. */
.receipt-hint { display: none; }
@media (max-width: 760px) {
  .receipt-col.thumb { position: static; max-height: none; cursor: zoom-in; }
  .receipt-col.thumb .receipt-view img { max-height: 90px; width: auto; }
  .receipt-col.thumb .receipt-view .pdf-note { padding: 6px; font-size: 12px; }
  .receipt-col.thumb .receipt-hint { display: inline; }
}

/* sum-to-total validation banner */
.scan-validate { margin: 6px 0 4px; padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.scan-validate.ok { background: var(--accent-soft); color: var(--accent); }
.scan-validate.bad { background: #fde2e1; color: #b42318; border: 1px solid #f3b4af; }
.scan-validate.warn { background: #fdf0d5; color: #92600a; border: 1px solid #e7c98a; }   /* minor variance / likely rounding -- softer than a red error */
.scan-validate .v-detail { display: block; font-weight: 400; font-size: 12px; margin-top: 3px; }
/* Deliberate override button (replaced the old passive "save anyway" checkbox).
   Clicking it fires an "Are you sure?" confirm -- it's a conscious two-step action,
   not permanent red text to ignore. Styled as a restrained danger-secondary so it
   reads as an override, not the primary Save. */
/* Scope display to :not([hidden]) so the `hidden` attribute actually hides it --
   otherwise the override button paints on the empty/reading form regardless of
   JS (same gotcha already fixed for .modal and the old .scan-ack). It then appears
   and disappears in lockstep with the red mismatch warning -- both gated by
   updateScanGate on (extraction done && real lines && total > 0 && lines != total). */
.btn-override:not([hidden]) { display: inline-block; margin: 6px 0 8px; padding: 7px 14px; font-size: 13px; font-weight: 600;
  color: #b42318; background: #fff; border: 1px solid #f3b4af; border-radius: 8px; cursor: pointer; }
.btn-override:hover { background: #fde2e1; }

/* per-line review state in the shared form: a 4th column for the state pill.
   Every SCANNED line gets one (flagged or not) -- the operator is final authority
   on every line; the AI flag only emphasises where to look first. */
.line-row.scan-row { grid-template-columns: 1fr 150px auto 38px; row-gap: 2px; }
/* The description is ONE shared editable input, full-width above the category +
   amount controls, in BOTH manual and scanned rows -- so every line (typed by
   hand or pre-filled by the scan) is identifiable against the receipt and fully
   editable. Manual rows previously had no description; now they do. */
.line-row .line-desc { grid-column: 1 / -1; width: 100%; min-width: 0; font-size: 13px; }
#scan-line-hint { font-size: 12px; }
.line-row.flagged-row { outline: 2px solid rgba(180, 35, 24, .40); outline-offset: 1px; border-radius: 6px; }
.line-row.st-row-verified { outline: 2px solid rgba(15, 118, 110, .35); outline-offset: 1px; border-radius: 6px; }
.line-row.st-row-edited { outline: 2px dashed rgba(37, 99, 235, .50); outline-offset: 1px; border-radius: 6px; }
.line-state {
  font-size: 10px; font-weight: 700; text-transform: uppercase; cursor: pointer;
  border-radius: 4px; padding: 2px 6px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
}
.line-state.st-unrev { color: #92600a; border-color: #e7c98a; background: #fdf0d5; }       /* 🟡 needs eyes */
.line-state.st-verified { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); } /* 🟢 verified */
.line-state.st-edited { color: #1d4ed8; border-color: #9db4f0; background: #e7eefc; }       /* ✏️ edited */

/* AI free-text note (e.g. a reprint warning) surfaced in scan mode */
.scan-note { margin: 4px 0 6px; font-size: 12.5px; padding: 8px 12px; border-radius: 8px; background: #fdf0d5; color: #92600a; border: 1px solid #e7c98a; }

/* vendor-match hint under the vendor field (scan mode) */
/* :not([hidden]) so the `hidden` toggle actually hides it (same display-overrides-
   hidden gotcha as .modal / .btn-override). */
.vendor-hint:not([hidden]) { margin-top: 6px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vendor-hint .vh-label { color: var(--muted); }
.vendor-hint .vh-ok { color: var(--accent); font-weight: 600; }
.vh-chip {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.vh-chip:hover { border-color: var(--accent); color: var(--accent); }
.vh-chip.vh-add { border-style: dashed; }

/* --- Ask the Analyst (AI query layer) ------------------------------------- */
.wide-drawer { width: min(640px, 96vw); }
#ask-q { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); }
.ask-examples { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 14px; }
.ask-ex { font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.ask-ex:hover { border-color: var(--accent); color: var(--accent); }
/* answer prose: rendered from markdown-ish text, headings/bold/lists */
.ask-prose { font-size: 14px; line-height: 1.5; }
.ask-prose h3 { font-size: 14px; margin: 14px 0 4px; }
.ask-prose ul { margin: 4px 0 10px; padding-left: 20px; }
.ask-prose li { margin: 2px 0; }
.ask-prose strong { font-weight: 700; }
.ask-unverified { background: #fdecea; border: 1px solid #f3b4ad; color: #a52015;
  border-radius: 9px; padding: 9px 12px; margin: 12px 0; font-size: 12.5px; }
.ask-figures { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.ask-fig-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; margin: 12px 0 6px; }
.ask-fig-sub { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
table.ask-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 6px; }
table.ask-tbl th, table.ask-tbl td { text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--line); }
table.ask-tbl th:first-child, table.ask-tbl td:first-child { text-align: left; }
table.ask-tbl thead th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.ask-up { color: #c5221f; } .ask-down { color: var(--accent); }
.ask-trace { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* --- Cash Flow Analysis ---------------------------------------------------- */
.cash-summary { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.cash-crunch { margin-top: 12px; background: #fdecea; border: 1px solid #f3b4ad; color: #a52015;
  border-radius: 9px; padding: 10px 13px; font-size: 13px; }
.cash-timeline { display: flex; flex-direction: column; gap: 4px; }
.cash-day { border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: var(--bg); }
.cash-day.empty { opacity: .5; padding: 5px 11px; }
.cash-day.crunch { border-color: #f3b4ad; background: #fdf3f2; opacity: 1; }
.cash-day-head { display: flex; justify-content: space-between; align-items: baseline; }
.cash-date { font-size: 13px; font-weight: 600; }
.cash-bal { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cash-bal.neg { color: #c5221f; }
.cash-events { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.cash-ev { display: flex; justify-content: space-between; font-size: 12.5px; gap: 12px; }
.cash-ev .cash-ev-amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.cash-ev.in .cash-ev-amt { color: var(--accent); }
.cash-ev.out .cash-ev-amt { color: #b3401c; }
.cash-config { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--card); }
.cash-config > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.cash-config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-top: 14px; }
.cash-form .subhead { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.cash-form label { display: block; font-size: 12.5px; margin: 6px 0; }
.cash-form input { width: 100%; box-sizing: border-box; }
.cash-timing-wrap { grid-column: 1 / -1; }
/* Taller list, and NO horizontal scroll -- rows wrap within the container width. */
#cash-timing { max-height: 60vh; overflow-y: auto; overflow-x: hidden; }
.ct-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px;
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.ct-name { flex: 1 1 220px; min-width: 0; }            /* shrinkable; never forces overflow */
.ct-title { font-weight: 600; }
.ct-ctrl { flex: 0 1 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.ct-lbl { font-size: 11px; color: var(--muted); }
.ct-ctrl select, .ct-ctrl input[type="date"] { max-width: 150px; }
.ct-ctrl input[type="number"] { width: 52px; }
.ct-basis { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--bg); border-radius: 5px; padding: 1px 6px; margin-left: 4px; }
.ct-basis.ok { color: var(--accent); background: var(--accent-soft); }
.ct-flag { font-size: 11px; font-weight: 600; color: #a52015; background: #fdecea;
  border: 1px solid #f3b4ad; border-radius: 5px; padding: 1px 6px; margin-left: 6px; }
/* Filter/search box -- find a bill instantly among ~40. */
.cash-timing-filter { width: 100%; box-sizing: border-box; margin-bottom: 8px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
/* Post-save confirmation showing the DERIVED placement. */
.cash-timing-confirm { margin-bottom: 8px; padding: 7px 11px; border-radius: 7px; font-size: 12.5px; }
.cash-timing-confirm.ok { background: var(--accent-soft); border: 1px solid var(--accent-soft); color: var(--accent); }
.cash-timing-confirm.bad { background: #fdecea; border: 1px solid #f3b4ad; color: #a52015; }

/* Inline bank anchor bar (forecast starting point, always visible at top) */
.cash-anchor-bar { margin-top: 12px; padding: 11px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; }
.cash-anchor-active { font-size: 13.5px; margin-bottom: 8px; }
.cash-anchor-active.warn { color: #a52015; font-weight: 600; }
.cash-anchor-label { font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); }
.cash-anchor-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; }
.cash-anchor-fields label { display: flex; flex-direction: column; font-size: 12px; gap: 3px; }
.cash-anchor-fields input { box-sizing: border-box; }

/* Calm all-clear state (no projected crunch in the window) */
.cash-clear { margin-bottom: 16px; background: var(--accent-soft); border: 1px solid var(--accent-soft);
  color: var(--accent); border-radius: 9px; padding: 10px 13px; font-size: 13px; }
.cash-crunch { font-weight: 600; }

/* Forward forecast TABLE: date | opening | inflows | AP out | fixed out | closing */
.cf-table-wrap { overflow-x: auto; }
.cf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cf-table th, .cf-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.cf-table th { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cf-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cf-row.anchor { color: var(--muted); }
.cf-row.crunch { background: #fdf3f2; }
.cf-row.crunch td { border-bottom-color: #f3b4ad; }
.cf-date { font-weight: 600; }
.cf-tag { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); background: var(--bg); border-radius: 5px; padding: 1px 5px; margin-left: 5px; }
.cf-tag.bad { color: #fff; background: #c5221f; }
.cf-in { color: var(--accent); font-weight: 600; }
.cf-out { color: #b3401c; font-weight: 600; }
.cf-z { color: var(--muted); }
.cf-close { font-weight: 700; }
.cf-close.neg { color: #c5221f; }
.cf-note { margin-top: 10px; font-size: 12px; }

/* --- contextual QBO prompt + quiet config access -------------------------- */
.terms-hint { margin: 4px 0 12px; padding: 8px 12px; font-size: 12.5px;
  background: var(--accent-soft); border: 1px solid var(--accent-soft); border-radius: 8px; color: var(--ink); }
.terms-hint .link-btn { margin-left: 4px; }
.entry-config { margin-top: 12px; font-size: 12px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }

/* --- Fixed-cost schedule editor ------------------------------------------- */
.fixed-editor, .fixed-confirm { border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px; background: var(--bg); }
.fe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 8px 0; }
.fe-grid label { display: block; font-size: 12.5px; }
.fe-grid input, .fe-grid select { width: 100%; box-sizing: border-box; }
.fixed-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fixed-row-actions { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.fixed-row-actions .btn-sm { padding: 2px 7px; font-size: 11.5px; }
.fc-derived { font-size: 14px; padding: 8px 0; }
.fc-version { background: var(--accent-soft); border-radius: 8px; padding: 8px 11px; margin-bottom: 10px; font-size: 12.5px; }

/* --- login gate (Supabase Auth) ------------------------------------------- */
/* Full-screen, visible by default so the app never flashes before auth; app.js
   sets [hidden] once a session exists. */
.login-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center;
  justify-content: center; padding: 20px; background: var(--bg); }
.login-overlay[hidden] { display: none; }
.login-card { width: 340px; max-width: 92vw; display: flex; flex-direction: column; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px 30px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18); }
.login-card h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.login-card .subtitle { margin: 0 0 4px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.login-card input { font-family: inherit; font-size: 15px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.login-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
#login-submit { margin-top: 4px; font-size: 14px; font-weight: 600; padding: 10px 18px; border: 0;
  border-radius: 9px; background: var(--accent); color: #fff; cursor: pointer; }
.login-msg { min-height: 1em; font-size: 12.5px; color: #c5221f; }
