/*
 * Expense App V3 stylesheet.
 * Ported from the V1 mockup (Expense-App/preview/v1-preview.html) so the real
 * app looks the same: same colour tokens (light + dark), layout, and components.
 * Changes from the mockup: fonts are self-hosted; nav items are links; mockup-only
 * pieces (identity switcher, access-code modal) removed; login page, flash
 * messages and a phone layout added at the end.
 */

/* ---------- Fonts (local files, no external requests) ---------- */
@font-face { font-family: 'Oswald'; font-weight: 500; font-display: swap; src: url("../fonts/oswald-latin-500-normal.8af401f8e32b.woff2") format('woff2'); }
@font-face { font-family: 'Oswald'; font-weight: 600; font-display: swap; src: url("../fonts/oswald-latin-600-normal.3ab06adc1658.woff2") format('woff2'); }
@font-face { font-family: 'Oswald'; font-weight: 700; font-display: swap; src: url("../fonts/oswald-latin-700-normal.665f37b2d0e8.woff2") format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.77bc02670657.woff2") format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.f7016cd446d2.woff2") format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.196e3cbc5fee.woff2") format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-700-normal.c277d7b83f8a.woff2") format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.79936b18df9f.woff2") format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.b1c8a895f5fd.woff2") format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-600-normal.5a2ce7798732.woff2") format('woff2'); }

/* ---------- Colour tokens (identical to the mockup) ---------- */
:root {
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #ECF0F7;
  --ink: #10182E;
  --ink-muted: #545F7D;
  --ink-faint: #8B93AC;
  --accent: #00126B;
  --accent-strong: #000C4D;
  --accent-tint: #E4E7F5;
  --line: #DBE0EE;
  --brand-red: #A80000;
  --brand-red-tint: #F6E1DE;
  --status-approved: #3860B2;
  --status-approved-tint: #E4EAF6;
  --status-processing: #6B3FA0;
  --status-processing-tint: #EFE7F7;
  --success: #5A962D;
  --success-tint: #E7EFDD;
  --gold: #8A6A08;
  --gold-tint: #FBF2D6;
  --neutral: #6C7488;
  --neutral-tint: #ECEEF3;
  --shadow: 0 1px 2px rgba(16,24,46,.06), 0 6px 20px -8px rgba(16,24,46,.18);
  --focus: #A80000;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111827; --surface: #1F2937; --surface-2: #273244;
    --ink: #E8EAF5; --ink-muted: #9AA2C0; --ink-faint: #656C88;
    --accent: #6B84D9; --accent-strong: #8CA0E6; --accent-tint: #1B2140;
    --line: #374151; --brand-red: #E0615C; --brand-red-tint: #331E1D;
    --status-approved: #7A9BDE; --status-approved-tint: #1B2740; --status-processing: #B794E0; --status-processing-tint: #261B36;
    --success: #8FC15E; --success-tint: #1E2A16;
    --gold: #E3BE5A; --gold-tint: #2E2712;
    --neutral: #9AA2C0; --neutral-tint: #1C2136;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.55);
    --focus: #E0615C;
  }
}
:root[data-theme="dark"] {
  --bg: #111827; --surface: #1F2937; --surface-2: #273244;
  --ink: #E8EAF5; --ink-muted: #9AA2C0; --ink-faint: #656C88;
  --accent: #6B84D9; --accent-strong: #8CA0E6; --accent-tint: #1B2140;
  --line: #374151; --brand-red: #E0615C; --brand-red-tint: #331E1D;
  --status-approved: #7A9BDE; --status-approved-tint: #1B2740; --status-processing: #B794E0; --status-processing-tint: #261B36;
  --success: #8FC15E; --success-tint: #1E2A16;
  --gold: #E3BE5A; --gold-tint: #2E2712;
  --neutral: #9AA2C0; --neutral-tint: #1C2136;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.55);
  --focus: #E0615C;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 14px; line-height: 1.5; }
h1, h2, h3, .display { font-family: 'Oswald', 'IBM Plex Sans', sans-serif; text-transform: uppercase; letter-spacing: .02em; text-wrap: balance; font-weight: 600; color: var(--ink); }
.mono, .tnum { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
a { color: inherit; }
button, select, input { font-family: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- Shell: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; gap: 18px; }
/* The left menu is always dark slate #111827, whichever theme the main window uses
   (dark mode's background is the same colour): white text, the current page in a lighter band. */
.sidebar {
  --surface: #111827; --surface-2: rgba(255,255,255,.08);
  --ink: #FFFFFF; --ink-muted: #C9D0EC; --ink-faint: #8E98C2;
  --accent: #FFFFFF; --accent-tint: rgba(255,255,255,.14);
  --line: rgba(255,255,255,.14); --brand-red: #A80000; --focus: #FFFFFF;
  color: var(--ink);
  border-right-color: rgba(255,255,255,.08);  /* keeps it apart from the dark main window */
}
/* The JOH logo (same as the sign-in page), centred at the top of the menu. Its navy ribbon
   would disappear on the dark menu, so it sits on a white rounded tile. */
.sidebar .brand img { background: #FFFFFF; border-radius: 10px; padding: 8px 12px; box-sizing: border-box; }
.brand { padding: 4px 6px 14px; border-bottom: 1px solid var(--line); text-align: center; }
.brand img { display: block; width: 170px; max-width: 100%; height: auto; margin: 0 auto; }
.brand span { display: block; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-muted); margin-top: 10px; font-weight: 600; }

nav.primary { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); padding: 10px 10px 4px; }
.navlink { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; background: transparent; border: none; color: var(--ink-muted); font-size: 13.5px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; width: 100%; }
.navlink:hover { background: var(--surface-2); color: var(--ink); }
.navlink[aria-current="page"] { background: var(--accent-tint); color: var(--accent); font-weight: 700; }
.navlink .ico { width: 16px; text-align: center; flex: none; opacity: .85; }
.navlink .badge-count { margin-left: auto; background: var(--brand-red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; }

/* Everything under the logo; on phones it folds away behind the menu button. */
.sidebar-body { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.menu-toggle { display: none; }  /* phones only, see the narrow-screen block */
.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); }
.sidebar-foot .lbl { font-size: 9.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.whoami-name { font-size: 13px; font-weight: 700; }
.whoami-role { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.reset-link { display: block; margin-top: 10px; font-size: 11px; color: var(--ink-faint); background: none; border: none; cursor: pointer; text-decoration: underline; padding: 0; }
.reset-link:hover { color: var(--brand-red); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h1 { font-size: 19px; margin: 0; }
.local-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--gold-tint); color: var(--gold); padding: 5px 9px; border-radius: 5px; }
.local-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
/* Light/dark switch (static/js/theme.js). */
.theme-toggle { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; color: var(--ink-muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-faint); }
.theme-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.content { padding: 26px 28px 60px; flex: 1; }
.view { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Cards, stats, tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.scope-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 13px; margin-bottom: 18px; }
.scope-note b { color: var(--ink); }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 10px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-tile { padding: 16px 18px; }
.stat-tile .val { font-family: 'Oswald', sans-serif; font-size: 26px; font-weight: 600; }
.stat-tile .lbl { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
th { text-align: left; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.amt { text-align: right; }
.empty-row td { text-align: center; color: var(--ink-faint); padding: 28px 14px; font-size: 12.5px; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.pill.draft { background: var(--neutral-tint); color: var(--neutral); } .pill.draft::before { background: var(--neutral); }
.pill.submitted { background: var(--gold-tint); color: var(--gold); } .pill.submitted::before { background: var(--gold); }
.pill.approved { background: var(--status-approved-tint); color: var(--status-approved); } .pill.approved::before { background: var(--status-approved); }
.pill.rejected { background: var(--brand-red-tint); color: var(--brand-red); } .pill.rejected::before { background: var(--brand-red); }
.pill.exported { background: var(--status-processing-tint); color: var(--status-processing); } .pill.exported::before { background: var(--status-processing); }
.pill.paid { background: var(--success-tint); color: var(--success); } .pill.paid::before { background: var(--success); }
.pill.reason { background: var(--gold-tint); color: var(--gold); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 9px 16px; border-radius: 7px; border: 1px solid transparent; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-critical-ghost { background: transparent; color: var(--brand-red); border-color: var(--brand-red); }
.btn-critical-ghost:hover:not(:disabled) { background: var(--brand-red-tint); }
/* Full-width dashed "add another" bar under a table (Add Expense). Softened accent: a faint
   tint and a light dashed border at rest, full tint and border on hover. */
.add-row-bar { display: flex; align-items: center; justify-content: center; gap: 8px; width: calc(100% - 36px); margin: 12px 18px 0; padding: 12px; font-size: 13px; font-weight: 700; color: color-mix(in srgb, var(--accent) 80%, var(--ink)); background: color-mix(in srgb, var(--accent-tint) 55%, transparent); border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 8px; cursor: pointer; }
.add-row-bar:hover { background: var(--accent-tint); border-color: var(--accent); }
.add-row-bar .plus { font-size: 16px; line-height: 1; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-icon { padding: 5px 8px; font-size: 12px; line-height: 1; }

/* ---------- Panels & forms ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 14px; margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }

label { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-muted); margin-bottom: 5px; letter-spacing: .02em; }
input, select, textarea { width: 100%; font-size: 13.3px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
input:disabled, input[readonly] { color: var(--ink-muted); background: var(--surface-2); }
input[type=checkbox], input[type=radio] { width: auto; }  /* never stretched like text boxes */
textarea { resize: vertical; min-height: 60px; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.field-row.cols3 { grid-template-columns: repeat(3, 1fr); }
.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--brand-red); font-size: 12px; }
td.tnum .errorlist { font-family: 'IBM Plex Sans', system-ui, sans-serif; }

.receipt-toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 8px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; font-weight: 600; white-space: nowrap; }
.receipt-toggle.attached { background: var(--success-tint); color: var(--success); }
.receipt-toggle.required { background: var(--brand-red-tint); color: var(--brand-red); }
.receipt-toggle.none { background: var(--neutral-tint); color: var(--neutral); }
.receipt-thumb-row { display: flex; flex-wrap: wrap; gap: 10px; }
.receipt-thumb { width: 68px; height: 68px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); position: relative; background: var(--surface-2); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.receipt-thumb-file { font-size: 9px; text-align: center; color: var(--ink-muted); line-height: 1.3; padding: 4px; word-break: break-word; }
.receipt-thumb-file .ico { font-size: 18px; display: block; margin-bottom: 2px; }
.receipt-item { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; }
.receipt-item label { font-weight: 500; margin: 0; display: flex; gap: 4px; align-items: center; }
.receipt-item input { width: auto; }
.ooo-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--gold-tint); color: var(--gold); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 12.5px; font-weight: 600; }
.ooo-banner button { background: none; border: none; color: inherit; text-decoration: underline; cursor: pointer; font-size: 12px; font-weight: 700; }
.acting-banner { display: flex; align-items: center; justify-content: space-between; background: var(--status-approved-tint); color: var(--status-approved); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 12.5px; font-weight: 600; }
.problem-box { background: var(--brand-red-tint); color: var(--brand-red); border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; font-size: 13px; }
.problem-box ul { margin: 6px 0 0; padding-left: 18px; }
.line-form tr.main-row td { vertical-align: top; }
.line-form.deleted { display: none; }
/* Each expense reads as one block: a bar down its left edge joins the line to its open panel
   (accent while open, red when something needs fixing), and the panel closes the block off. */
/* While a panel is open, a fine dark line above and below its block separates it from the
   other expenses (made from the text colour, so it's light in dark mode). */
.line-form { --block-edge: color-mix(in srgb, var(--ink) 55%, transparent); }
.line-form td:first-child { box-shadow: inset 3px 0 0 transparent; }
.line-form.open td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.line-form.has-issue td:first-child { box-shadow: inset 3px 0 0 var(--brand-red); }
.line-form.open tr.main-row td { background: color-mix(in srgb, var(--accent-tint) 45%, transparent); border-bottom-color: transparent;
  box-shadow: inset 0 1px 0 var(--block-edge); }
.line-form.open tr.main-row td:first-child { box-shadow: inset 3px 0 0 var(--accent), inset 0 1px 0 var(--block-edge); }
.line-form.open.has-issue tr.main-row td:first-child { box-shadow: inset 3px 0 0 var(--brand-red), inset 0 1px 0 var(--block-edge); }
.line-form tr.detail-row td { border-bottom: 1px solid var(--line); }
.line-form.open tr.detail-row td { border-bottom-color: var(--block-edge); }
.line-form:target tr.main-row td, .line-form.flash tr.main-row td,
tr.flash > td, tr:target > td { animation: line-flash 1.6s ease-out; }
.flag-list { margin: 0 0 6px; padding-left: 18px; list-style: none; }
.flag-list li { margin: 2px 0; text-indent: -14px; }
@keyframes line-flash { from { background: var(--accent-tint); } }
.line-category { display: flex; align-items: center; gap: 8px; }
.line-no { flex: none; min-width: 26px; font-size: 12px; font-weight: 700; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
/* Sub-category row: reads as part of the line above it (no line between them). The dropdown lines up with */
/* the Category dropdown (past the #number), the "Other" box with Description. */
.line-form:has(tr.analysis-row:not([hidden])) tr.main-row td { border-bottom-color: transparent; }
.line-form tr.analysis-row td { padding-top: 0; vertical-align: top; }
.line-form.open tr.analysis-row td { background: color-mix(in srgb, var(--accent-tint) 45%, transparent); border-bottom-color: transparent; }
.line-analysis { margin-left: 34px; }
td + td > .line-analysis { margin-left: 0; }
.line-analysis label { margin-bottom: 2px; }
.line-analysis .req { color: var(--brand-red); font-weight: 700; }
.line-analysis select, .line-analysis input { width: 100%; }
/* Finance re-filing an "Other" line: one row of controls, wrapping on narrow screens. */
.subcat-fix { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 6px 0 10px; padding: 10px 12px;
              border-radius: 8px; background: color-mix(in srgb, var(--accent-tint) 55%, transparent); }
.subcat-fix .field { margin: 0; flex: 1 1 200px; }
.subcat-fix .field select, .subcat-fix .field input { width: 100%; }
.subcat-finance-only { display: flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink); white-space: nowrap; padding-bottom: 8px; }
.subcat-fix-wrap + .subcat-fix-wrap { border-top: 1px solid var(--line); padding-top: 8px; }
.subcat-save { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
/* A message for one Finance Console card (saved / refused / "save first"); stays put, unlike a toast. */
.card-notice { padding: 8px 12px; border-radius: 6px; margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.card-notice.error { background: var(--brand-red-tint); color: var(--brand-red); }
.card-notice.success { background: color-mix(in srgb, var(--accent-tint) 70%, transparent); color: var(--ink); }
.card-notice.info { background: var(--surface-2); color: var(--ink); }
.line-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0 34px; }
.receipt-cell { display: flex; align-items: center; gap: 6px; }
.row-thumb { flex: none; width: 28px; height: 28px; border-radius: 5px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.line-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.line-panel-title { font-size: 12.5px; color: var(--ink-muted); }
.line-panel-title b { color: var(--ink); }
.line-issue { background: var(--brand-red-tint); color: var(--brand-red); border-radius: 7px; padding: 8px 12px; margin-bottom: 8px; font-size: 12.5px; font-weight: 600; }
.line-duplicate { background: var(--gold-tint); border-radius: 7px; padding: 10px 12px; margin-bottom: 12px; }
.line-duplicate label.needs-answer { color: var(--brand-red); }
/* ---- Receipts: on a line, being added, coming off; the picked-files tray; the library ---- */
.receipt-list { margin-bottom: 10px; }
.receipt-item { position: relative; max-width: 96px; }
.receipt-name { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.receipt-note { font-size: 10.5px; color: var(--ink-muted); text-align: center; line-height: 1.3; }
.receipt-item.adding .receipt-thumb { border: 1px dashed var(--accent); }
.receipt-item.adding .receipt-note { color: var(--accent); }
.receipt-item.removing .receipt-thumb { opacity: .35; }
.receipt-item.removing .receipt-name { text-decoration: line-through; color: var(--ink-muted); }
/* The × on a thumbnail's corner. */
.receipt-x { position: absolute; top: -7px; right: 6px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-muted); font-size: 13px; line-height: 1; cursor: pointer; padding: 0; box-shadow: var(--shadow); }
.receipt-x:hover { color: var(--brand-red); border-color: var(--brand-red); }
.link-btn { background: none; border: none; padding: 0; color: var(--accent); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
/* A file input dressed as a button (the input itself is invisible but still clickable). */
/* Upload buttons: a <label> around a file input. The input is tucked away (not laid over the button): Chrome
   shows an arrow, not a hand, over a file input's own "Choose files" part, so the button only looked
   clickable on its right-hand side (1 Dec 2026). Clicking the label still opens the picker. */
.file-btn { position: relative; overflow: hidden; cursor: pointer; user-select: none; }
.file-btn input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-btn:active { transform: translateY(1px); filter: brightness(.92); }
/* "Opening…" while Windows / the phone brings up its file picker, which can take a second or two (app.js). */
.file-btn.is-opening { filter: brightness(.92); cursor: progress; }
.file-btn.is-opening::after { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 2px solid currentColor;
  border-right-color: transparent; animation: file-btn-spin .7s linear infinite; }
@keyframes file-btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .file-btn.is-opening::after { animation-duration: 2s; } }
.file-btn.disabled { opacity: .5; pointer-events: none; }
.receipt-add { margin-bottom: 10px; }
.receipt-add .helper { margin-top: 6px; }
.stage-tray { margin: 10px 0 4px; padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 8px;
  background: color-mix(in srgb, var(--accent-tint) 50%, transparent); }
.stage-list { display: flex; flex-direction: column; gap: 8px; }
.stage-item { display: flex; align-items: center; gap: 10px; }
.stage-item .receipt-thumb { width: 52px; height: 52px; flex: none; }
.stage-field { flex: 1; min-width: 0; }
.stage-field label { margin: 0 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.library-pick .receipt-thumb-row { gap: 8px; }
.library-choice { display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none; padding: 4px;
  border-radius: 8px; cursor: pointer; font-size: 11px; color: var(--ink); }
.library-choice .receipt-thumb { width: 56px; height: 56px; }
.library-choice:hover { background: var(--accent-tint); }
.library-choice:hover .receipt-thumb { border-color: var(--accent); }
.library-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 14px; }
.library-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.library-item .receipt-thumb { width: 56px; height: 56px; flex: none; }
.library-info { flex: 1; min-width: 0; }
.library-rename { display: flex; gap: 6px; align-items: center; }
.library-rename input { flex: 1; min-width: 0; }
.library-table .thumb-cell { width: 1%; padding-right: 4px; }
.library-table th:last-child, .library-table td:last-child { width: 1%; }
.library-table .receipt-thumb { width: 44px; height: 44px; }
.library-table .receipt-thumb-file .ico { font-size: 20px; }
.library-table tfoot td, .totals-table tfoot td { border-top: 2px solid var(--line); }
.library-row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.library-row-actions form { margin: 0; }
.details-preview { display: flex; justify-content: center; margin: 0 0 12px; }
.details-preview img { max-width: 100%; max-height: 220px; border-radius: 6px; border: 1px solid var(--line); }
.details-preview .receipt-thumb-file { padding: 14px; }
.details-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.attachment-list { list-style: none; margin: 0 0 12px; padding: 0; }
.attachment-list:empty { display: none; }
.attachment-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.attachment-list li:last-child { border-bottom: none; }
.attachment-list li .helper { margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-ico { font-size: 15px; }
.attachment-add { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.attachment-add .field { margin: 0; min-width: 170px; }
.attachment-add .attachment-name { flex: 1; min-width: 220px; }
.attachment-add .file-btn { margin-bottom: 2px; }
.loose-end-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.loose-end-actions form { margin: 0; }
.settle-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.settle-form .field { margin: 0; width: 150px; }
.settle-form .settle-note { flex: 1; min-width: 200px; width: auto; }
.status-reasons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rate-replaced { opacity: .55; }
.rate-replaced .tnum { text-decoration: line-through; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; }
.check-inline { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink); margin: 0 0 8px; white-space: nowrap; }
.paper-lines td { vertical-align: middle; }
.paper-outcome { margin-bottom: 14px; }
.paper-outcome .radio-line { font-size: 13px; font-weight: 600; color: var(--ink); align-items: center; }
.paper-lines td:nth-child(1) { width: 40%; }
.paper-lines input.amt { text-align: right; }
.pill.paper { background: var(--surface-2); color: var(--ink-muted); border: 1px solid var(--line); }
.pill.paper::before { display: none; }
.allocate-dialog.handover-dialog { width: min(640px, calc(100vw - 32px)); }
.handover-table th { white-space: nowrap; }
.handover-all .field { margin-bottom: 12px; }
.handover-table { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.handover-table td, .handover-table th { padding: 6px 10px; }
.handover-table .search-select { min-width: 220px; }
.handover-all { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* Type-to-search drop-downs (search-select.js) */
.search-select { position: relative; }
.search-select-native { display: none; }
.search-select-input { background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%), linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
.search-select-list { position: fixed; z-index: 1000; margin: 0; padding: 4px 0; list-style: none; max-height: 240px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; }
.search-select-list li { padding: 6px 10px; cursor: pointer; }
.search-select-list li.active, .search-select-list li:hover { background: var(--accent-tint); color: var(--accent); }
.search-select-list li.note { color: var(--ink-faint); cursor: default; font-size: 12px; background: none; }
.kind-choice { display: flex; gap: 10px; flex-wrap: wrap; }
.kind-choice label { flex: 1; min-width: 200px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; cursor: pointer; font-size: 13px; color: var(--ink); font-weight: 600; }
.kind-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.kind-choice input { width: auto; margin-top: 3px; }
.kind-choice .helper { font-weight: 400; display: block; margin: 4px 0 0; }
.kind-choice .kind-title { display: block; font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.kind-choice .kind-what { display: block; font-weight: 400; line-height: 1.45; }
.kind-choice .kind-what b { font-weight: 700; }
.not-sure-note { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 10px; }  /* New Report: read before picking */
.not-sure-note b { font-weight: 800; }
.history { list-style: none; margin: 0; padding: 0; font-size: 12.8px; }
.history li { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.history li:last-child { border-bottom: none; }

.week-table th, .week-table td { text-align: center; }
.week-table td:first-child, .week-table th:first-child { text-align: left; white-space: nowrap; }
.week-table input[type=text] { text-align: center; padding: 5px; width: 54px; margin: 0 auto; display: block; }
.week-table input[type=checkbox] { width: auto; margin: 0 auto; display: block; }
.cell-date { font-size: 9.5px; color: var(--ink-faint); text-align: center; margin-bottom: 3px; font-family: 'IBM Plex Mono', monospace; }
.cell-date.faint { opacity: .55; }
.cell-disabled { display: block; text-align: center; color: var(--ink-faint); font-size: 13px; }

.gl-chip { display: inline-block; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-muted); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
.fixed-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--success-tint); color: var(--success); padding: 2px 7px; border-radius: 4px; }
.helper { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.note-box { background: var(--gold-tint); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); border-radius: 8px; padding: 10px 13px; font-size: 12.5px; color: var(--ink); display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.note-box .dot { color: var(--gold); font-weight: 700; }
/* A box with its unit inside the right edge, e.g. [ 312   mi ]. */
.unit-input { position: relative; display: inline-block; width: 140px; }
.unit-input input { width: 100%; padding-right: 34px; text-align: right; }
.unit-input .unit { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--ink-faint); pointer-events: none; }
/* Business miles on the report editor: label, box, and an information line underneath. */
.miles-field { padding: 14px 18px; }
.info-note { display: flex; align-items: flex-start; gap: 7px; margin: 8px 0 0; font-size: 12px; color: var(--ink-muted); }
.info-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-top: 1px; border-radius: 50%; border: 1.5px solid currentColor; font: italic 700 10px/1 Georgia, serif; }
.total-strip { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; background: var(--accent-tint); border-top: 1px solid var(--line); }
.total-strip .amount { font-family: 'Oswald', sans-serif; font-size: 22px; color: var(--accent); }

.two-col-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--ink-muted); }
.kv span:last-child { text-align: right; }

.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn { padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--ink-muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.filter-bar { display: flex; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: flex-end; }
.filter-field { min-width: 140px; }
.filter-field label { margin-bottom: 4px; }
th a.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
th a.sort-link:hover { color: var(--ink); }

.check-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.check-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; background: var(--surface); margin: 0; color: var(--ink); font-weight: 500; }
.check-chip input { width: auto; margin: 0; }
.check-chip:has(input:checked) { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-muted); }
.row-problem td { background: var(--brand-red-tint); }
.row-warning td { background: var(--gold-tint); }
.pill.stale { background: var(--surface); color: var(--gold); border: 1px solid var(--gold); margin-left: 4px; }
.pill.stale::before { background: var(--gold); }
.inactive td { opacity: .55; }

.scope-chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.scope-chip { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--accent-tint); color: var(--accent); text-decoration: none; }
.scope-chip.cc { background: var(--surface-2); color: var(--ink-muted); font-weight: 600; }
a.scope-chip:hover { filter: brightness(0.94); }
.scope-chip.active { background: var(--accent); color: #fff; }
.scope-chip.cc.active { background: var(--ink-muted); color: var(--surface); }
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: -6px 0 16px; background: var(--surface); }
.view-switch a { padding: 6px 16px; font-size: 12.5px; font-weight: 600; color: var(--ink-muted); text-decoration: none; }
.view-switch a + a { border-left: 1px solid var(--line); }
.view-switch a:hover { color: var(--ink); }
.view-switch a.active { background: var(--accent); color: #fff; }

.dash-layout { display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: start; }
.dash-layout > * { min-width: 0; }  /* let the wide grid scroll inside its card instead of widening the page */
/* Phones: the Expense Type list becomes a dropdown (templates/dashboards/dashboard.html).
   Computers can fold the list away ("Hide"), which shows the same dropdown above the grid. */
.slicer-select { display: none; }
.slicer-head { display: flex; align-items: center; gap: 6px; }
.slicer-fold { margin-left: auto; font-size: 10.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-muted);
  background: transparent; border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; cursor: pointer; }
.slicer-fold:hover { color: var(--ink); background: var(--surface-2); }
.slicer-select .slicer-fold { margin-left: 8px; }
.dash-layout.slicer-folded { grid-template-columns: 1fr; }
.dash-layout.slicer-folded .slicer { display: none; }
.dash-layout.slicer-folded .slicer-select { display: block; max-width: 320px; margin: 0; }
.dash-layout.slicer-folded .slicer-select .slicer-head { padding: 0 0 6px; }
@media (max-width: 720px) {
  .dash-layout { grid-template-columns: 1fr; }
  .slicer { display: none; }
  .slicer-select { display: block; margin: 0; }
  .slicer-select .slicer-head { padding: 0 0 6px; }
  .slicer-fold { display: none; }  /* phones always use the dropdown */
  .dash-layout.slicer-folded .slicer-select { max-width: none; }
  .slicer-select select { width: 100%; min-height: 44px; font-size: 15px; }
}
.slicer { padding: 6px; position: sticky; top: 16px; }
.slicer-head { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); padding: 8px 10px 6px; }
.slicer-item { display: block; width: 100%; text-align: left; font-size: 12.8px; font-weight: 600; color: var(--ink); background: transparent; border: none; border-radius: 6px; padding: 8px 10px; cursor: pointer; margin-bottom: 1px; text-decoration: none; }
.slicer-item:hover { background: var(--surface-2); }
.slicer-item.active { background: var(--accent); color: #fff; }

.grid-table th, .grid-table td { text-align: right; white-space: nowrap; }
.grid-table th:first-child, .grid-table td:first-child { text-align: left; white-space: normal; }
.grid-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: none; background: var(--surface-2); }
.grid-table td.total-col, .grid-table th.total-col { border-left: 1px solid var(--line); font-weight: 700; }
.grid-table td.left, .grid-table th.left { text-align: left; }
a.tab-btn { text-decoration: none; }

.export-group { border-top: 1px solid var(--line); }
.export-group:first-child { border-top: none; }
.export-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px; background: var(--surface-2); flex-wrap: wrap; }
.export-group-head label { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; margin: 0; color: var(--ink); font-size: 13px; }
.export-group-head input, td input[type=checkbox] { width: auto; }

.detail-row td { background: var(--surface-2); padding: 16px 18px; }
.line-detail { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.line-detail-row { display: flex; justify-content: space-between; gap: 10px; }
.comment-box { background: var(--brand-red-tint); color: var(--brand-red); border-radius: 6px; padding: 8px 11px; font-size: 12.5px; margin-top: 8px; }
.comment-box.neutral { background: var(--surface-2); color: var(--ink-muted); }

/* ---------- Flash messages (the mockup's "toasts") ---------- */
#toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--accent); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow); animation: toast-in .25s ease both; max-width: 320px; }
.toast.critical, .toast.error, .toast.warning { background: var(--brand-red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

footer.credit { padding: 22px 28px 40px; font-size: 11.5px; color: var(--ink-faint); }

/* ---------- Additions: sign-in page (templates/registration/login.html) ---------- */
/* Option D, picked by Shane 23 Nov 2026: a paper receipt (torn bottom edge, itemised lines) on JOH navy with
   faint stripes and a red band. Chosen to look nothing like other JOH teams' sign-in pages. Colours come from
   the JOH logo: navy #0A2041 (the ribbon) and red #BF2F38. Always light (doesn't follow the dark-mode switch). */
.signin-body { margin: 0; background: #0A2041; }
.signin {
  --ink: #10182E; --ink-muted: #545F7D; --ink-faint: #8B93AC; --line: #DBE0EE; --surface: #FFFFFF; --surface-2: #ECF0F7;
  --brand-red: #A80000; --brand-red-tint: #F6E1DE; --focus: #0A2041;
  --joh-navy: #0A2041; --joh-red: #BF2F38;
  position: relative; overflow: hidden; min-height: 100vh; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px 24px;
  background: var(--joh-navy); color: var(--ink);
}
/* Faint diagonal stripes, and a soft red band across the lower part. */
.signin::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 2px, transparent 2px 22px); }
.signin::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: 14%; height: 70px; transform: rotate(-6deg); pointer-events: none;
  background: linear-gradient(90deg, rgba(191,47,56,0), rgba(191,47,56,.55) 30%, rgba(191,47,56,.55) 70%, rgba(191,47,56,0)); }

/* The receipt: white paper, red strip on top, torn (zig-zag) bottom edge. */
.signin-receipt {
  position: relative; z-index: 1; width: 100%; max-width: 380px; box-sizing: border-box; padding: 30px 30px 40px;
  background: #FFFFFF; text-align: center; filter: drop-shadow(0 22px 40px rgba(0,0,0,.45));
  -webkit-mask: linear-gradient(#000 0 0) top/100% calc(100% - 12px) no-repeat,
                conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) bottom/24px 12px repeat-x;
          mask: linear-gradient(#000 0 0) top/100% calc(100% - 12px) no-repeat,
                conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) bottom/24px 12px repeat-x;
}
.signin-receipt::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--joh-red); }
.signin-logo { display: block; width: 170px; max-width: 70%; height: auto; margin: 0 auto 14px; }
.signin-name { font-family: 'Oswald', 'IBM Plex Sans', sans-serif; font-weight: 700; font-size: 24px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--joh-navy); margin: 0; }
.signin-tag { font-size: 14px; color: var(--ink-muted); margin: 6px 0 0; }
.signin-rule { border: none; border-top: 2px dashed #CBD0DB; margin: 16px 0; }
.signin-items { list-style: none; margin: 0; padding: 0; }
.signin-items li, .signin-total { display: flex; justify-content: space-between; gap: 8px; }
.signin-items li { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; color: var(--ink-muted); line-height: 1.7; }
.signin-total { font: 600 13px 'IBM Plex Mono', ui-monospace, monospace; color: var(--ink); margin-bottom: 18px; }
.signin-receipt .form-error { text-align: left; }

/* "Sign in with Microsoft": navy, so it stands out on the white paper; Microsoft's four-colour logo. */
.signin-ms {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; box-sizing: border-box; padding: 13px 18px;
  border: 1px solid var(--joh-navy); border-radius: 8px; background: var(--joh-navy); color: #FFFFFF;
  font: 600 15px 'IBM Plex Sans', system-ui, sans-serif; text-decoration: none; box-shadow: 0 1px 2px rgba(10,32,65,.10);
}
.signin-ms:hover { background: #13305C; }
.signin-ms:active { transform: translateY(1px); }
.signin-ms:focus-visible { outline: 3px solid var(--joh-red); outline-offset: 3px; }
.signin-ms-logo { flex: none; }
.signin-note { font-size: 12px; color: var(--ink-faint); margin: 12px 0 0; }
.signin-help { font-size: 12.5px; color: var(--ink-muted); margin: 16px 0 0; }
.signin-help a { color: var(--joh-navy); font-weight: 600; }

/* Developer PCs only: the email/password form, folded away. */
.signin-dev { margin-top: 22px; text-align: left; border-top: 1px dashed #CBD0DB; padding-top: 14px; }
.signin-dev summary { cursor: pointer; font-size: 12px; color: var(--ink-faint); text-align: center; list-style: none; }
.signin-dev summary::-webkit-details-marker { display: none; }
.signin-dev[open] summary { margin-bottom: 14px; }
.signin-dev .btn { width: 100%; justify-content: center; }

/* Under the receipt: copyright, and a quiet "built by Finance". */
.signin-foot { position: relative; z-index: 1; margin: 22px 0 0; font-size: 11.5px; color: #9CA8C7; text-align: center; }

@media (max-width: 480px) {
  .signin { padding: 28px 14px 20px; }
  .signin-receipt { padding: 28px 22px 38px; }
}
.form-error { background: var(--brand-red-tint); color: var(--brand-red); border-radius: 6px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 14px; }

/* ---------- Additions: approval review "Expanded view" and line flags ---------- */
/* Make the HTML `hidden` attribute win over classes like .btn/.pill that set a display. */
[hidden] { display: none !important; }
.pill.flagged { background: var(--brand-red-tint); color: var(--brand-red); }
.pill.flagged::before { display: none; }
tr.flagged-row td { background: color-mix(in srgb, var(--brand-red-tint) 55%, transparent); }
.flag-note { color: var(--brand-red); font-size: 12.5px; font-weight: 600; padding-top: 6px; padding-bottom: 6px; }

.pill.duplicate { background: var(--gold-tint); color: var(--gold); }
.pill.duplicate::before { display: none; }
tr.duplicate-row td { background: color-mix(in srgb, var(--gold-tint) 70%, transparent); }
.duplicate-note { color: var(--gold); font-size: 12.5px; font-weight: 600; }
.duplicate-note a { color: inherit; }
#rv-detail .duplicate-note { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--gold-tint); }
.review-card.needs { border-color: color-mix(in srgb, var(--brand-red) 45%, var(--line)); }
.review-actions { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 12px 18px 14px; }
.rule-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; font-weight: 600; }
.rule-line input { width: auto; }
.money-input { display: inline-flex; align-items: center; gap: 4px; }
.no-receipt-hint { font-size: 12px; color: var(--ink-muted); }
.no-receipt-hint.over { color: var(--brand-red); font-weight: 700; }
.pill.allocated { background: var(--accent-tint); color: var(--accent); }
.pill.allocated::before { display: none; }
.allocation-note { color: var(--accent); font-size: 12.5px; font-weight: 600; }
tr.allocation-row td { padding-top: 0; }
.allocate-btn { margin-top: 6px; }
.allocate-dialog { border: none; border-radius: 12px; padding: 22px 24px; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.allocate-dialog::backdrop { background: rgba(16, 24, 46, .45); }
.allocate-dialog h2 { font-size: 16px; margin: 0 0 4px; }
.dialog-x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px; background: transparent; color: var(--ink-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.dialog-x:hover { background: var(--surface-2); color: var(--ink); }
.allocate-mode { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.allocate-mode label { display: flex; gap: 6px; align-items: center; margin: 0; font-size: 13.5px; color: var(--ink); font-weight: 600; }
.allocate-mode input { width: auto; }
.allocate-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.allocate-row { display: grid; grid-template-columns: 1fr 110px 18px auto; gap: 8px; align-items: center; }
.allocate-unit { color: var(--ink-muted); font-weight: 700; }
.allocate-home { font-weight: 700; color: var(--accent); margin: 12px 0 6px; }
.line-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* Left: the line and its flag. Right: the receipt. The whole review fits the window
   (each side scrolls on its own) so Approve / Reject stay in view. */
.review-split { display: grid; grid-template-columns: minmax(300px, 2fr) 3fr; height: max(480px, calc(100vh - 330px)); }
.review-left { padding: 16px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; }
.rv-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rv-cat { font-family: 'Oswald', sans-serif; font-size: 17px; font-weight: 600; text-transform: uppercase; }
.rv-amount { font-family: 'Oswald', sans-serif; font-size: 28px; color: var(--accent); margin: 6px 0 4px; }
.flag-box { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.flag-box label { color: var(--brand-red); }
.rv-list { list-style: none; margin: 0 0 16px; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.rv-list li { border-bottom: 1px solid var(--line); }
.rv-list li:last-child { border-bottom: none; }
.rv-list button { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; background: none; border: none; padding: 8px 10px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.rv-list button span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-list button:hover { background: var(--surface-2); }
.rv-list li.flagged button { color: var(--brand-red); font-weight: 600; }
.rv-list li.current button { background: var(--accent-tint); box-shadow: inset 3px 0 0 var(--accent); }
.receipt-pane { display: flex; flex-direction: column; background: var(--surface-2); min-width: 0; min-height: 0; }
.receipt-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
/* The receipt scrolls inside its own box. review.js sets the image's width (Fit / Fit width / zoom);
   margin:auto centres it when it's smaller than the box and lets it scroll when it's bigger. */
.receipt-view { flex: 1; min-height: 0; overflow: auto; display: flex; padding: 16px; }
.receipt-view img { display: block; flex: none; max-width: none; height: auto; margin: auto; box-shadow: var(--shadow); background: #fff; }
.zoom-tools { display: flex; gap: 4px; align-items: center; }
.zoom-label { font-size: 11.5px; color: var(--ink-muted); min-width: 42px; text-align: center; }
.receipt-view iframe { flex: 1; width: 100%; border: none; background: #fff; border-radius: 4px; }
.receipt-view.pdf { padding: 0; }
.receipt-empty { margin: auto; padding: 30px; text-align: center; color: var(--ink-muted); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.review-decision { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); }
.review-decision textarea { min-height: 40px; }
/* Only phones stack the two sides (top / bottom). */
@media (max-width: 760px) {
  .review-split { grid-template-columns: 1fr; height: auto; }
  .review-left { border-right: none; border-bottom: 1px solid var(--line); overflow: visible; }
  .receipt-view { min-height: 70vh; }
}

/* ---------- Additions: Expense Dashboard charts (plain HTML/CSS bars) ---------- */
/* One series per chart -> one colour (the accent). Values and labels use ink colours,
   never the bar colour. Bars <= 24px thick, 4px rounded at the tip, square at the base. */
.chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 18px; align-items: start; }
.chart-card { padding: 16px 18px; min-width: 0; }
.hbar-chart { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hbar-row { display: grid; grid-template-columns: minmax(80px, 38%) 1fr; gap: 10px; align-items: center; padding: 3px 4px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 12.5px; }
a.hbar-row:hover, a.hbar-row:focus-visible { background: var(--surface-2); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hbar { position: relative; height: 18px; min-width: 2px; background: var(--accent); border-radius: 0 4px 4px 0; flex: none; }
.hbar-value { font-size: 11.5px; color: var(--ink-muted); white-space: nowrap; }
.col-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; height: 170px; align-items: end; }
.col-slot { display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.col-area { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-height: 0; }
.col-bar { position: relative; width: 100%; max-width: 24px; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.col-bar.empty { background: var(--line); }
.col-value { font-size: 10.5px; color: var(--ink-muted); white-space: nowrap; margin-bottom: 3px; }
.col-label { font-size: 10px; color: var(--ink-faint); margin-top: 5px; white-space: nowrap; }
/* Hover tooltip: the exact amount (the grid below is the full table view). */
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--surface); font-size: 11.5px; font-weight: 600; white-space: nowrap;
  padding: 4px 8px; border-radius: 5px; pointer-events: none; z-index: 5;
}
.hbar[data-tip]:hover::after { left: auto; right: 0; transform: none; }

/* ---------- Additions: phones / narrow screens ---------- */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  /* The menu becomes a slim bar: logo on the left, the menu button (☰) on the right. The button
     opens the compact menu below the bar (links side by side, then Sign out); static/js/app.js. */
  .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--line); gap: 0; padding: 8px 16px; }
  .brand { display: flex; align-items: center; gap: 10px; padding: 0; border-bottom: none; text-align: left; }
  .brand img { width: 104px; margin: 0; }
  .sidebar .brand img { padding: 5px 8px; border-radius: 8px; }
  .brand span { margin: 0; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; position: relative; margin-left: auto;
    width: 44px; height: 44px; font-size: 22px; line-height: 1; color: var(--ink); background: transparent;
    border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
  .menu-toggle:hover, .sidebar.open .menu-toggle { background: var(--surface-2); }
  .menu-dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: #E0362C; box-shadow: 0 0 0 2px var(--surface); }
  .sidebar-body { display: none; padding: 10px 0 6px; }
  .sidebar.open .sidebar-body { display: flex; gap: 10px; }
  nav.primary { flex-direction: row; flex-wrap: wrap; }
  .nav-group-label { display: none; }
  .navlink { width: auto; }
  .sidebar-foot { margin-top: 0; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .stat-row, .grid-2, .two-col-cards, .field-row, .field-row.cols3 { grid-template-columns: 1fr; }
}

/* Spending Analysis: the Period row (quick picks + From/To months) */
.range-row { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; margin: -6px 0 14px; }
.range-label { font-size: 11.5px; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em; margin-right: 2px; }
.range-field { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-muted); margin-left: 6px; }
.range-field input { width: 150px; padding: 4px 8px; font-size: 12.5px; }

/* Finance's "Send back" box on an approved report */
.send-back summary { cursor: pointer; }
.radio-line { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; margin: 6px 0; }
.radio-line input { width: auto; margin: 0; }


/* Home: auto allowance & gas vs. IRS miles - totals get a rule above, rate lines are indented */
.overage-card .kv.sum { border-top: 1px solid var(--line); }
.overage-card .kv.rate span:first-child { padding-left: 12px; color: var(--ink-muted); }
/* ---------- Additions: Spending Analysis extras (23 Nov 2026) ---------- */
/* Business Miles: not a category, so italic and set apart at the end of the Expense Type list. */
.slicer-extra { font-style: italic; font-weight: 500; margin-top: 6px; border-top: 1px dashed var(--line); border-radius: 0 0 6px 6px; padding-top: 10px; }
.slicer-extra.active { border-top-color: transparent; border-radius: 6px; }
/* Last submitted: red when it's been more than 60 days. */
.grid-table td.stale { color: var(--brand-red); font-weight: 700; }
.days-since { color: var(--ink-faint); font-size: 11px; font-weight: 500; margin-left: 4px; }
td.stale .days-since { color: var(--brand-red); }
/* Click-to-sort headings (static/js/table-sort.js): a faint arrow on hover, a solid one on the sorted column. */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sortable:focus-visible { color: var(--ink); background: var(--surface-2); }
th.sortable::after { content: "\2195"; margin-left: 4px; opacity: 0; font-size: 10px; }
th.sortable:hover::after { opacity: .45; }
th.sortable[aria-sort="ascending"]::after { content: "\25B2"; opacity: .8; }
th.sortable[aria-sort="descending"]::after { content: "\25BC"; opacity: .8; }
/* Monthly-only rule: "All cost centers" or "Only these" + the codes box (greyed out until picked). */
.cc-choice .cc-option { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); margin: 6px 0; }
.cc-choice .cc-option input { width: auto; }
.cc-choice .cc-codes { margin: 2px 0 0 26px; }
.cc-choice .cc-codes input:disabled { opacity: .55; cursor: not-allowed; }
/* ---------- Additions: receipts pop-up and missing receipts (23 Nov 2026) ---------- */
/* A line's "Receipts & details" panel, opened from the line: a pop-up over a greyed-out page until Done or
   Cancel (report-form.js). The row stays inside the form (its boxes still save); only its look changes. */
/* Centred on screen. The page behind still scrolls (Shane, 23 Nov 2026): scrolling outside the window moves
   the report; inside it, the window (never taller than the screen). */
.line-form tr.detail-row.modal { display: flex; position: fixed; inset: 0; z-index: 60; align-items: center; justify-content: center;
  padding: 16px; background: rgba(15, 23, 42, .55); }
.line-form tr.detail-row.modal > td { display: block; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.35); padding: 18px 20px; }
.line-panel-actions { display: flex; gap: 8px; flex: none; }
.btn.is-waiting { opacity: .55; }
.detail-row [data-panel-error] { margin: 0 0 12px; }
/* "I don't have a receipt" and the list of missing ones. */
.missing-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.missing-tick { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.missing-box > .helper { display: block; margin: 2px 0 0 22px; }
.missing-summary { margin: 8px 0 0 22px; font-size: 13px; }
.missing-summary ol { margin: 0 0 4px; padding-left: 18px; }
.missing-summary li { margin: 2px 0; }
/* The "Missing receipts" pop-up: one row per receipt (why + amount). */
.missing-dialog { width: min(560px, calc(100vw - 32px)); }
.missing-rows { display: grid; gap: 10px; margin: 4px 0 14px; max-height: 50vh; overflow: auto; }
.missing-row { display: grid; grid-template-columns: 82px 1fr 120px; gap: 10px; align-items: end; }
.missing-row label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.missing-no { font-weight: 700; font-size: 13px; padding-bottom: 9px; }
.missing-amount input { text-align: right; }
@media (max-width: 560px) {
  .missing-row { grid-template-columns: 1fr 110px; }
  .missing-no { grid-column: 1 / -1; padding: 0; }
  .line-form tr.detail-row.modal { padding: 0; align-items: stretch; }
  .line-form tr.detail-row.modal > td { width: 100%; max-height: none; height: 100%; border-radius: 0; }
}
.missing-list { margin: 2px 0 4px; padding-left: 20px; }
.pre-lines { white-space: pre-line; }
/* ---------- Additions: Receipt Library viewer (23 Nov 2026) ---------- */
.library-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 18px 0 10px; }
.view-switch { display: inline-flex; gap: 4px; }
.view-switch .btn.active, .lv-zoom .btn.active { background: var(--accent-tint); color: var(--accent); font-weight: 700; }
/* List on the left; the receipt (details above it) on the right. */
.library-viewer { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 72vh; overflow: hidden; }
.lv-list { list-style: none; margin: 0; padding: 8px; border-right: 1px solid var(--line); overflow: auto; max-height: 82vh; }
.lv-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 7px 8px; border: none; border-radius: 7px;
  background: transparent; color: var(--ink); cursor: pointer; font: inherit; }
.lv-item:hover { background: var(--surface-2); }
.lv-item.active { background: var(--accent-tint); box-shadow: inset 3px 0 0 var(--accent); }
.lv-thumb { flex: none; width: 38px; height: 46px; border-radius: 4px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-size: 18px; }
.lv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lv-text { min-width: 0; display: flex; flex-direction: column; font-size: 12.8px; }
.lv-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-text .helper { margin: 1px 0 0; }
.lv-main { display: flex; flex-direction: column; min-width: 0; }
.lv-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.lv-pos { font-size: 13px; color: var(--ink-muted); }
.lv-zoom { margin-left: auto; }
.lv-slide { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.lv-details { padding: 14px 18px 12px; border-bottom: 1px solid var(--line); }
.lv-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lv-title h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.lv-actions { display: flex; gap: 8px; align-items: center; }
.lv-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px 18px; margin: 12px 0 0; }
.lv-facts dt { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.lv-facts dd { margin: 2px 0 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-view { background: var(--surface-2); min-height: 56vh; }
.lv-view.pdf iframe { min-height: 70vh; }
@media (max-width: 760px) {
  .library-viewer { grid-template-columns: 1fr; }
  .lv-list { display: none; }  /* phones: Prev / Next */
  .lv-zoom { margin-left: 0; }
  .lv-view { min-height: 60vh; }
}
/* ---------- Additions: certifications on submit and approve (23 Nov 2026) ---------- */
.certification { margin-top: 18px; padding: 14px 18px; font-size: 13px; line-height: 1.55; color: var(--ink-muted); }
.certification p { margin: 0 0 8px; }
.certification ul { margin: 0 0 8px; padding-left: 20px; }
.certification li { margin: 3px 0; }
.certify-tick { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; color: var(--ink); margin-top: 4px; cursor: pointer; }
.certify-tick input { width: auto; margin-top: 3px; flex: none; }
.certification.compact { margin: 0 0 12px; padding: 0; font-size: 12.5px; }
.rv-cert { flex-basis: 100%; }
.cert-pill { font-size: 10.5px; margin-left: 4px; }
/* ---------- Additions: phone polish (23 Nov 2026) ---------- */
/* A: on the wide Spending Analysis grids the first column (person / category) stays put while the months
   scroll sideways. It needs its own solid background to cover what scrolls under it. */
.grid-table th:first-child, .grid-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface);
  box-shadow: 1px 0 0 var(--line); }
.grid-table tbody tr.clickable:hover td:first-child { background: var(--surface-2); }
.grid-table tfoot td:first-child { background: var(--surface-2); }
/* B: a table that scrolls sideways fades out at the edge that has more to show (static/js/app.js). */
.table-wrap.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.table-wrap.more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.table-wrap.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
@media (max-width: 760px) {
  /* C: bigger things to tap on phones (about 40-44px, the usual finger size). */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding: 8px 12px; }
  .btn-icon { min-height: 40px; min-width: 40px; justify-content: center; }
  .link-btn { padding: 8px 2px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .sort-link, th.sortable { padding-top: 12px; padding-bottom: 12px; }
  /* D: iPhones zoom in on any text box with text under 16px; 16px stops that. */
  input, select, textarea { font-size: 16px; }
}
/* Spending Analysis: the Hide / Show charts button sits just above the charts, on the right. */
.charts-toggle-bar { display: flex; justify-content: flex-end; margin: 0 0 6px; }
/* ---------- Additions: the language button (Spanish, 23 Nov 2026) ---------- */
.lang-form { margin: 0; }
.lang-toggle { font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-muted); background: transparent;
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.lang-toggle:hover { color: var(--ink); background: var(--surface-2); }
