/* ============================================================================
   Ad Holic Finance — "the ledger"
   Same family as the Team CRM (Inter + Space Grotesk, Ad Holic gradient), but
   tuned for money: tabular figures everywhere, green for in, red for out, and
   nothing decorative competing with a number.
   ========================================================================== */

:root {
  --ink: #14172a;
  --ink-soft: #2c3350;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e7e9f1;
  --line-soft: #f0f2f8;
  --canvas: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfcff;

  --brand: #2e5bff;
  --brand-ink: #1e3eb8;
  --brand-tint: #eef2ff;
  --magenta: #c0117a;
  --grad: linear-gradient(115deg, #c0117a 0%, #6d3ae0 46%, #2e5bff 100%);

  /* Money has exactly two directions. They never change colour. */
  --in: #12855c;
  --in-tint: #e6f6ef;
  --out: #d1454a;
  --out-tint: #fdecec;
  --amber: #b76e00;
  --amber-tint: #fff4e5;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-num: "Inter", system-ui, sans-serif;

  --radius: 16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 23, 42, .05);
  --shadow: 0 1px 2px rgba(20, 23, 42, .04), 0 6px 20px rgba(20, 23, 42, .06);
  --shadow-lg: 0 12px 40px rgba(20, 23, 42, .16);

  --nav-h: 62px;

  font-family: var(--font-body);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.02em; margin: 0; }
a { color: var(--brand); }
::selection { background: rgba(109, 58, 224, .16); }
:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(46, 91, 255, .38); border-radius: var(--radius-xs); }
.hidden { display: none !important; }

/* Every figure in the app is tabular, so columns of money line up. */
.num, td.num, .amount, input[inputmode="decimal"] {
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}

/* ---------------------------------------------------------------- Top bar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(14px, 4vw, 28px); background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
  letter-spacing: -.03em; display: flex; align-items: center; gap: 9px; white-space: nowrap;
}
.brand .accent {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  color: transparent; font-weight: 700;
}
.brand-logo { height: 28px; width: auto; display: block; }

.tabs { display: none; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; color: var(--muted); font-family: var(--font-body);
  font-size: 14.5px; font-weight: 600; padding: 8px 13px; border-radius: 999px;
  cursor: pointer; white-space: nowrap; transition: background .14s, color .14s;
}
.tab:hover { color: var(--ink); background: var(--line-soft); }
.tab.active { background: var(--brand-tint); color: var(--brand-ink); }
.spacer { flex: 1 1 auto; }

.auth-area { display: flex; align-items: center; gap: 10px; margin-left: auto; }
/* Your name in the top bar IS the account menu — the first place anyone looks
   for "sign out". It stays a button on phones too, just icon-tight. */
.who {
  text-align: right; line-height: 1.25; font: inherit; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 5px 10px; color: var(--ink); transition: background .14s, border-color .14s;
}
.who:hover { background: var(--line-soft); border-color: var(--line); }
.who b { display: block; font-size: 13.5px; }
.who span { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  font: inherit; font-weight: 600; font-size: 14px; padding: 9px 15px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, transform .06s;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: var(--line-soft); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-soft); color: var(--ink); }
.btn.danger { color: var(--out); border-color: #f6d5d6; background: var(--out-tint); }
.btn.danger:hover { background: #fbdcdd; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: var(--radius-xs); }
.btn.in { background: var(--in); border-color: var(--in); color: #fff; }
.btn.out { background: var(--out); border-color: var(--out); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ------------------------------------------------------------------ Layout */
.view {
  padding: clamp(16px, 3vw, 26px) clamp(14px, 4vw, 28px) calc(var(--nav-h) + 74px);
  max-width: 1240px; margin: 0 auto;
}
@media (min-width: 900px) { .view { padding-bottom: 40px; } }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1 { font-size: clamp(21px, 3vw, 27px); }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { font-size: 15.5px; }
.card-head .sub { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: 1fr; }
.grid.c3 { grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid.c2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .grid.c3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .grid.c2-3 { grid-template-columns: 3fr 2fr; } }

/* ------------------------------------------------------------------- Stats */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin-bottom: 18px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .v {
  font-family: var(--font-display); font-size: clamp(20px, 3.4vw, 27px); font-weight: 700;
  letter-spacing: -.025em; margin-top: 5px; font-variant-numeric: tabular-nums;
}
.stat .v small { font-size: .55em; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat .d { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat.hero { background: linear-gradient(160deg, #1b1f38 0%, #262b4d 100%); border-color: #262b4d; color: #fff; }
.stat.hero .k { color: rgba(255,255,255,.62); }
.stat.hero .d { color: rgba(255,255,255,.66); }
.stat.pos .v { color: var(--in); }
.stat.neg .v { color: var(--out); }
/* A stat you can open. The chevron is the only hint it needs — the whole tile
   is the target, which is what makes it usable with a thumb. */
.stat.tappable { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.stat.tappable:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.stat.tappable:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.stat .chev { font-weight: 700; margin-left: 2px; }
/* A retainer's cycles, indented under the contract they belong to so the list
   reads as "this contract, these months" rather than a flat run of rows. */
.cycles { margin: 2px 0 12px 14px; padding-left: 12px; border-left: 2px solid var(--line); }
.cycles .kv { padding: 5px 0; }
/* Committed more than we hold. On the dark hero tile the normal red is
   unreadable, so lift it rather than reuse --out. */
.stat.hero .d.short { color: #ff9ea1; font-weight: 600; }
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--in); }
.delta.down { color: var(--out); }

/* ------------------------------------------------------------------ Alerts */
.alerts { display: grid; gap: 8px; margin-bottom: 18px; }
.alert {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; border: 1px solid transparent;
}
.alert.warn { background: var(--out-tint); color: #93262a; border-color: #f6d5d6; }
.alert.info { background: var(--brand-tint); color: var(--brand-ink); border-color: #dbe3ff; }
.alert .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-top: 6px; flex: none; }

/* ------------------------------------------------------------------ Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; padding: 11px 14px; white-space: nowrap;
  border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--surface-2); }
table.data .r { text-align: right; white-space: nowrap; }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: var(--surface-2); }
table.data tr.voided td { opacity: .45; text-decoration: line-through; }
.t-main { font-weight: 600; }
.t-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Sortable column headings. The arrow only appears on the column in use, so a
   table that is not sorted by anything does not look like it is. */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); background: var(--line-soft); }
th.sortable.on { color: var(--brand-ink); }
th.sortable .arrow { margin-left: 4px; font-size: 11px; }

/* A hairline share-of-revenue bar, sized to sit inside a table cell without
   stretching the row. */
.share-mini {
  height: 5px; border-radius: 999px; background: var(--line-soft);
  overflow: hidden; margin-left: auto; width: 72px;
}
.share-mini > span { display: block; height: 100%; border-radius: 999px; background: var(--grad); }

.amt { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt.in { color: var(--in); }
.amt.out { color: var(--out); }
.amt.zero { color: var(--faint); }

/* ------------------------------------------------------------------- Pills */
.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px;
  font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.pill.PAID, .pill.ACTIVE, .pill.APPROVED, .pill.EXCELLENT { background: var(--in-tint); color: var(--in); }
.pill.PARTIAL, .pill.DRAFT, .pill.HOLD, .pill.PAUSED, .pill.STABLE { background: var(--amber-tint); color: var(--amber); }
.pill.OVERDUE, .pill.AT_RISK, .pill.CHURNED { background: var(--out-tint); color: var(--out); }
.pill.SENT, .pill.ENDED, .pill.VOID, .pill.NOT_OPENED { background: var(--line-soft); color: var(--muted); }
.pill.blue { background: var(--brand-tint); color: var(--brand-ink); }

/* ------------------------------------------------------------------ Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .lbl {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700;
}
input, select, textarea {
  font: inherit; font-size: 14.5px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px;
  width: 100%; transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(46, 91, 255, .13);
}
input:disabled, select:disabled { background: var(--line-soft); color: var(--muted); }
textarea { resize: vertical; min-height: 74px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px; padding-right: 32px; }
.filters input, .filters select { width: auto; min-width: 130px; }
input.err, select.err { border-color: var(--out); box-shadow: 0 0 0 3px rgba(209, 69, 74, .13); }

.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .form-grid.c2 { grid-template-columns: 1fr 1fr; } }
.form-grid .full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); }
.hint.warn { color: var(--amber); font-weight: 600; }

/* Segmented control — the money-in / money-out / transfer switch */
.seg { display: flex; gap: 4px; background: var(--line-soft); padding: 4px; border-radius: var(--radius-sm); }
.seg button {
  flex: 1; border: 0; background: transparent; font: inherit; font-weight: 650; font-size: 14px;
  padding: 9px 10px; border-radius: var(--radius-xs); cursor: pointer; color: var(--muted);
  transition: background .14s, color .14s;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button.on[data-dir="IN"]  { color: var(--in); }
.seg button.on[data-dir="OUT"] { color: var(--out); }

/* Big amount input on the record sheet */
.amount-box { position: relative; }
.amount-box input {
  font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  padding: 14px 62px 14px 14px; text-align: right;
}
.amount-box .cur {
  position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
  font-weight: 700; color: var(--muted); font-size: 15px; pointer-events: none;
}

/* --------------------------------------------------------------- Empty state */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h3 { font-size: 16px; color: var(--ink-soft); margin-bottom: 5px; }
.empty p { font-size: 13.5px; margin: 0 0 14px; }

.skeleton { padding: 40px; text-align: center; color: var(--faint); font-size: 14px; }

/* ------------------------------------------------------------ Loading bar */
/* Screens no longer blank while they load — the old numbers stay on screen and
   this hairline runs across the top instead. It only appears if a request is
   actually in flight, and a cached screen never triggers it at all. */
#progress {
  position: fixed; inset: 0 0 auto 0; height: 2.5px; z-index: 100;
  background: var(--grad); transform-origin: 0 50%;
  transform: scaleX(0); opacity: 0;
  transition: transform .35s cubic-bezier(.2, .8, .3, 1), opacity .2s .1s;
  pointer-events: none;
}
/* Creeps forward while waiting, so a slow request still feels like progress. */
body.loading #progress {
  opacity: 1; transform: scaleX(.75);
  transition: transform 2.4s cubic-bezier(.1, .7, .2, 1), opacity .12s;
}
@media (prefers-reduced-motion: reduce) {
  #progress, body.loading #progress { transition: opacity .12s; }
}

/* ------------------------------------------------------------------ Drawer */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20, 23, 42, .42); backdrop-filter: blur(2px); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(560px, 100%);
  background: var(--canvas); box-shadow: var(--shadow-lg); overflow-y: auto;
  animation: slidein .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes slidein { from { transform: translateX(22px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-close {
  position: absolute; top: 12px; right: 14px; z-index: 2; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 15px; cursor: pointer; line-height: 1;
}
.drawer-close:hover { background: var(--line-soft); color: var(--ink); }
.drawer-body { padding: 20px clamp(16px, 4vw, 24px) 40px; }
.drawer-body h2 { font-size: 19px; margin-bottom: 4px; padding-right: 40px; }
.drawer-body .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.drawer-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px;
  padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.drawer-actions .left { margin-right: auto; }

.section-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  font-weight: 700; margin: 22px 0 9px;
}
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv.clickable { cursor: pointer; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--radius-xs); }
.kv.clickable:hover { background: var(--surface-2); }
.kv .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* Pick-list rows (open invoices, employees to pay, …) */
.pick {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; margin-bottom: 7px;
  transition: border-color .14s, background .14s;
}
.pick:hover { border-color: var(--brand); background: var(--brand-tint); }
.pick.on { border-color: var(--brand); background: var(--brand-tint); }
.pick input[type="checkbox"] { width: auto; margin: 0; flex: none; }
.pick .body { flex: 1; min-width: 0; }
.pick .body b { display: block; font-size: 14px; }
.pick .body span { font-size: 12px; color: var(--muted); }
.pick-icon { flex: none; display: flex; color: var(--muted); }
.pick-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.pick.on .pick-icon { color: var(--brand-ink); }

/* ------------------------------------------------------------------ Charts */
/* Bars are plain divs — no chart library, nothing to load, nothing to break. */
.chart { display: flex; align-items: flex-end; gap: clamp(3px, 1.2vw, 10px); height: 190px; padding: 8px 2px 0; }
/* Each column fills the chart's height, so a bar's % height means % of the chart. */
.chart .col { flex: 1; align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; min-width: 0; }
.chart .bars { display: flex; align-items: flex-end; gap: 2px; width: 100%; flex: 1; min-height: 0; justify-content: center; }
.chart .bar { width: 42%; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .3s; }
.chart .bar.in { background: var(--in); opacity: .85; }
.chart .bar.out { background: var(--out); opacity: .8; }
.chart .lbl-x { font-size: 10.5px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* A simple horizontal share bar, for "where the money went" */
.share-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.share-row:last-child { border-bottom: 0; }
.share-row .nm { font-weight: 600; font-size: 14px; }
.share-row .vl { font-weight: 700; font-variant-numeric: tabular-nums; }
.share-row .track { grid-column: 1 / -1; height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.share-row .fill { height: 100%; border-radius: 999px; background: var(--grad); }

/* ------------------------------------------------------- Mobile navigation */
.mobile-nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .93); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; z-index: 40;
}
.mobile-nav button {
  flex: 1; border: 0; background: transparent; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; color: var(--muted);
  font: inherit; font-size: 10.5px; font-weight: 650; cursor: pointer; padding: 0;
}
.mobile-nav button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.mobile-nav button.active { color: var(--brand); }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--grad); color: #fff;
  font-size: 27px; line-height: 1; cursor: pointer; box-shadow: 0 8px 26px rgba(109, 58, 224, .42);
  z-index: 41; display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(.94); }

/* Phones get exactly one way to record money — the floating button. The top-bar
   button is for desktop, where there is no floating button. */
@media (max-width: 899px) {
  #recordBtn { display: none; }
  .who b { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .who span { display: none; }
}

@media (min-width: 900px) {
  .tabs { display: flex; }
  .mobile-nav { display: none; }
  .fab { display: none; }
  :root { --nav-h: 0px; }
}

/* -------------------------------------------------------------------- Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 84px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; padding: 11px 19px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; z-index: 90; box-shadow: var(--shadow-lg);
  max-width: min(92vw, 460px); text-align: center;
}
.toast.bad { background: var(--out); }
@media (min-width: 900px) { .toast { bottom: 26px; } }

/* --------------------------------------------------------------- Login card */
.auth-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px clamp(20px, 5vw, 32px);
}
.auth-card h1 { font-size: 22px; margin-bottom: 5px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.auth-err { background: var(--out-tint); color: #93262a; padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; }
/* A tickbox label is a sentence, not a field name — it must escape the
   uppercase treatment that `.field > label` gives every other label. Written as
   `label.check` so it matches that rule's specificity and, coming later, wins. */
label.check, .check {
  display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px;
  color: var(--ink-soft); text-transform: none; letter-spacing: normal; font-weight: 500;
}
.check input { width: auto; margin: 3px 0 0; flex: none; }
.check .hint { text-transform: none; letter-spacing: normal; }

/* ----------------------------------------------------------------- Printing */
@media print {
  .topbar, .mobile-nav, .fab, .head-actions, .filters, .drawer, .toast { display: none !important; }
  body { background: #fff; }
  .view { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
}
