/* Spotlight Payments — Nova Design V1.0 (the HyperlocalAI production system).
   White 272px sidebar with a blue-50 active state, 64px white header, #F9FAFD
   page, white cards with a BLUE-tinted shadow, Hanken Grotesk throughout.
   Dimensions here are measured production values — check the nova-design
   skill's references/measured-specs.md before changing any of them. */
@import url("https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,100..900;1,100..900&display=swap");

/* ============================================================================
   Nova Design V1.0 tokens. Measured from the live DOM, not invented.
   ========================================================================= */
:root {
  --brand-blue:   #0070FC;   /* accent: links, icons, active states */
  --brand-indigo: #0E0071;
  --brand-hover:  #0A0054;
  /* Solid button fill. Nova production uses BOTH #0070fc and #2563eb for
     primary buttons (measured-specs: "Detect brand" vs "Add New Post"). Only
     #2563eb clears WCAG AA against white text — 5.17:1 vs 4.45:1 — so solid
     fills use it and #0070FC stays the accent. */
  --btn-solid:    #2563EB;
  --btn-solid-hv: #1D4ED8;

  --bg-page:      #F9FAFD;
  --surface:      #FFFFFF;
  --surface-alt:  #F9FAFB;
  --nav-active-bg:#EFF6FF;
  --nav-active-fg:#2563EB;

  --border-soft:  #E5E7EB;
  --border-card:  #E5E5E5;
  --border-sub:   #F3F4F6;

  --text-heading: #122E44;
  --text:         #111827;
  --text-body:    #53606A;
  --text-2:       #374151;
  --text-muted:   #6B7280;

  --ok-bg:   #F0FDF4; --ok-fg:   #16A34A; --ok-bd:   #86EFAC;
  --warn-bg: #FFFBEB; --warn-fg: #B45309; --warn-bd: #FDE68A;
  --bad-bg:  #FEF2F2; --bad-fg:  #DC2626; --bad-bd:  #FECACA;
  --info-bg: #EFF6FF; --info-fg: #1D4ED8; --info-bd: #BFDBFE;
  --neutral-bg: #F3F4F6; --neutral-fg: #374151;

  --accent-success: #16A34A;
  --danger: #DC2626;
  --star: #F59E0B;

  --pill-pending-bg: var(--warn-bg); --pill-pending-fg: var(--warn-fg);
  --pill-submitted-bg: var(--info-bg); --pill-submitted-fg: var(--info-fg);
  --pill-done-bg: #DCFCE7; --pill-done-fg: #15803D;
  --pill-muted-bg: var(--neutral-bg); --pill-muted-fg: var(--neutral-fg);

  --radius-sm: 4px; --radius-ctrl: 6px; --radius-lg: 8px;
  --radius-card: 12px; --radius-2xl: 16px;
  --radius-pill: 9999px; --radius-badge: 9999px;

  --shadow-card: 0 2px 8px rgba(0, 112, 252, 0.08);
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -4px rgba(0,0,0,.10);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04);

  --sidebar-w: 272px; --header-h: 64px; --content-max: 1320px;

  --font-body:  "Hanken Grotesk", -apple-system, system-ui, "Segoe UI", sans-serif;
  --font-brand: var(--font-body);
  --font-mono:  var(--font-body);
}

/* Every number in this product is tabular. No exceptions. */
.mono, .kpi .n, .dt-n, .amt, table.grid td, table.grid th { font-variant-numeric: tabular-nums; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 14px; line-height: 23.8px;
  color: var(--text);
  background: var(--bg-page);
}
a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--font-body); cursor: pointer; }
input, select, textarea { font-family: var(--font-body); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.muted { color: var(--text-muted); }
code { font-family: var(--font-mono); background: var(--bg-page); padding: 1px 6px; border-radius: var(--radius-badge); font-size: 0.88em; }
pre { background: var(--bg-page); border: 0.5px solid var(--border-soft); border-radius: var(--radius-ctrl); padding: 12px 14px; overflow:auto; }
pre code { background: none; padding: 0; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--border-soft);
  padding: 16px 12px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand-mark { display: block; font-weight: 700; font-size: 20px; letter-spacing: -.2px;
  color: var(--text); text-decoration: none; margin: 4px 12px 20px; }
.brand-mark span { color: var(--brand-blue); }
.brand-mark:hover { text-decoration: none; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 40px;
  color: #4B5563; text-decoration: none; padding: 10px 12px;
  border-radius: var(--radius-lg); font-size: 16px; font-weight: 400;
  transition: background 120ms ease, color 120ms ease; }
.side-nav a:hover { background: var(--neutral-bg); color: var(--text); text-decoration: none; }
.side-nav a.active { background: var(--nav-active-bg); color: var(--nav-active-fg); font-weight: 500; }
.side-nav a.sub { padding-left: 32px; font-size: 14px; color: var(--text-muted); min-height: 36px; }
.side-nav a.sub::before { content: ""; }
.side-nav a.sub.active { color: var(--nav-active-fg); background: var(--nav-active-bg); }
.nav-parent { display: flex; align-items: center; }
.nav-parent > a { flex: 1 1 auto; }
.nav-toggle { background: none; border: 0; color: #9CA3AF; cursor: pointer;
  font-size: 10px; line-height: 1; padding: 8px 10px; border-radius: var(--radius-lg);
  transition: transform 120ms ease; }
.nav-toggle:hover { color: var(--text-2); background: var(--neutral-bg); }
/* No accordion: every nav item is always visible (see base.html). */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); background: var(--surface);
  padding: 0 24px; border-bottom: 1px solid var(--border-soft); gap: 16px; }
.switcher { display: flex; gap: 10px; margin: 0; }
select, .switcher select {
  appearance: none; -webkit-appearance: none;
  background-color: var(--surface); color: var(--text);
  border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl);
  padding: 8px 30px 8px 12px; font-size: 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23657180' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.content { padding: 24px; max-width: var(--content-max); width: 100%; }
.content > h1 { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -.2px;
  color: #333333; margin: 0 0 4px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border-card);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 24px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 18px; font-weight: 600; color: var(--text-heading); margin: 0 0 12px; }
.content > h1 + .card, .toolbar + .card, .kpi-row + .card { margin-top: 0; }
.card h1 { font-size: 16px; font-weight: 600; margin: 0 0 4px; line-height: 1.4; }
.card.center { text-align: center; }
.actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.center .actions { justify-content: center; }

/* ---------- Buttons ----------
   Measured: 40px tall, 6px radius, 8px/16px padding, 14px/500. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; border: 1px solid var(--border-soft); background: var(--surface);
  color: var(--btn-solid); border-radius: var(--radius-ctrl); padding: 8px 16px;
  font-size: 14px; font-weight: 500; text-decoration: none; text-align: center;
  transition: all 200ms cubic-bezier(.4, 0, .2, 1);
}
.btn:hover { border-color: #93C5FD; text-decoration: none; }
.btn-primary { background: var(--btn-solid); border-color: var(--btn-solid); color: #fff; }
.btn-primary:hover { background: var(--btn-solid-hv); border-color: var(--btn-solid-hv);
  transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-body); }
.btn-ghost:hover { background: var(--neutral-bg); color: var(--text); border-color: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; }
.btn-small { min-height: 32px; padding: 6px 12px; font-size: 13px; }
.btn[disabled], .btn-primary[disabled] { filter: grayscale(.35); opacity: .65; cursor: not-allowed; }

/* ---------- Alerts (flash) ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-ctrl); margin-bottom: 16px; font-size: 13px;
  border: 0.5px solid var(--border-soft); }
.alert-success { background: var(--pill-done-bg); color: var(--pill-done-fg); border-color: #A6F0C6; }
.alert-error   { background: #FDECEA; color: var(--danger); border-color: #F4C7C3; }
.alert-warn    { background: var(--pill-pending-bg); color: var(--pill-pending-fg); border-color: #F2DDA8; }

/* ---------- Badges / status pills ----------
   Measured: fully round, 2-4px/8-12px padding, 12px/600, each state a
   bg + fg + BORDER triple. They read as words, never SHOUTED. */
.pill { display: inline-block; padding: 3px 10px; border-radius: var(--radius-badge);
  font-size: 12px; font-weight: 600; line-height: 1.5; letter-spacing: 0;
  text-transform: none; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral-fg); border: 1px solid transparent; }
.pill.success, .pill.paid, .pill.completed, .pill.tone-good
  { background: var(--pill-done-bg); color: var(--pill-done-fg); border-color: #BBF7D0; }
.pill.pending, .pill.partially_paid, .pill.processing, .pill.queued,
.pill.completed_with_errors, .pill.pending_approval, .pill.tone-warn
  { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.pill.sent, .pill.batched, .pill.submitted, .pill.approved, .pill.confirmed, .pill.tone-info
  { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.pill.draft, .pill.open, .pill.tone-neutral
  { background: var(--neutral-bg); color: var(--neutral-fg); border-color: transparent; }
.pill.failed, .pill.cancelled, .pill.expired, .pill.tone-bad
  { background: var(--bad-bg); color: #B91C1C; border-color: var(--bad-bd); }

/* status badge (dealer result / pay pages) */
.status-badge { display: inline-block; padding: 8px 16px; border-radius: var(--radius-pill);
  font-weight: 700; margin-bottom: 18px; }
.status-badge.success { background: var(--pill-done-bg); color: var(--pill-done-fg); }
.status-badge.failed { background: #FDECEA; color: var(--danger); }
.status-badge.pending { background: var(--pill-pending-bg); color: var(--pill-pending-fg); }

/* env badge (dev affordance) */
.env-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-badge);
  text-transform: uppercase; letter-spacing: 0.5px; background: var(--pill-submitted-bg); color: var(--pill-submitted-fg); }
.env-badge.live { background: #FDECEA; color: var(--danger); }

/* ---------- Tables ---------- */
/* ---------- Tables ----------
   Measured (Listing Management): th 16px/12px, 14px/600 #374151;
   td 16px/12px; rows separated by 1px #f3f4f6, hover #f9fafb. */
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
table.grid th { text-align: left; padding: 16px 12px; font-size: 14px; font-weight: 600;
  color: var(--text-2); text-transform: none; letter-spacing: 0;
  border-bottom: 1px solid var(--border-soft); }
table.grid td { text-align: left; padding: 16px 12px; font-size: 14px; font-weight: 400;
  color: #0A0A0A; border-bottom: 1px solid var(--border-sub); vertical-align: middle; }
table.grid tbody tr:hover { background: var(--surface-alt); }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td a { color: var(--nav-active-fg); text-decoration: none; }
table.grid td a:hover { text-decoration: underline; }

table.kv { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.kv th, table.kv td { text-align: left; padding: 12px 4px; font-size: 14px;
  border-bottom: 1px solid var(--border-sub); vertical-align: top; }
table.kv th { color: var(--text-muted); font-weight: 500; width: 42%; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.48px; text-transform: uppercase; color: var(--text-muted); }
.form-grid input, .form-grid select, .form-grid textarea {
  text-transform: none; letter-spacing: normal; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-ctrl); padding: 9px 12px; font-size: 14px; }
.form-grid select { padding-right: 30px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(0,112,252,0.12); }
.pay-form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.pay-form label { font-size: 12px; font-weight: 600; letter-spacing: 0.48px; text-transform: uppercase; color: var(--text-muted); display:flex; flex-direction:column; gap:6px; }
.pay-form input { text-transform: none; letter-spacing: normal; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl); padding: 10px 12px; font-size: 15px; }

/* ---------- KPI tiles ---------- */
.kpi-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 24px; }
.kpi { background: var(--surface); border: 0.5px solid var(--border-soft); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 16px 20px; min-width: 120px; }
.kpi .n { font-family: var(--font-mono); font-size: 22px; font-weight: 600; line-height: 1.1; }
.kpi .l { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* ---------- Status summary tiles (clickable) ---------- */
.stat-tiles { gap: 10px; margin-bottom: 16px; }
.stat-tiles .kpi { flex: 1 1 104px; min-width: 104px; padding: 13px 16px; }
.kpi.stat { color: inherit; cursor: pointer; border-top: 3px solid transparent;
  transition: box-shadow 120ms ease, border-color 120ms ease, transform 120ms ease; }
.kpi.stat:hover { box-shadow: 0 2px 10px rgba(14,0,113,0.12); transform: translateY(-1px); }
.kpi.stat.active { border-color: var(--brand-blue); box-shadow: 0 2px 10px rgba(14,0,113,0.12); }
.kpi.stat.pill-paid { border-top-color: var(--pill-done-fg); }
.kpi.stat.pill-partially_paid { border-top-color: var(--pill-pending-fg); }
.kpi.stat.pill-sent, .kpi.stat.pill-batched, .kpi.stat.pill-confirmed { border-top-color: var(--brand-blue); }
.kpi.stat.pill-draft { border-top-color: var(--pill-muted-fg); }
.kpi.stat.pill-cancelled, .kpi.stat.pill-expired, .kpi.stat.pill-failed { border-top-color: var(--danger); }
.kpi.stat.pill-paid, .kpi.stat.pill-success, .kpi.stat.pill-tax { border-top-color: var(--pill-done-fg); }
.kpi.stat.pill-pending, .kpi.stat.pill-partially_paid, .kpi.stat.pill-queued { border-top-color: var(--pill-pending-fg); }
.kpi.stat.pill-draft, .kpi.stat.pill-open, .kpi.stat.pill-proforma { border-top-color: var(--pill-muted-fg); }
.kpi.stat .l { text-transform: capitalize; }

/* ---------- Central scope bar (brand + date lens) ---------- */
.scope-bar { display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--border-soft);
  padding: 9px 28px; position: sticky; top: 0; z-index: 20; }
.scope-group { display: flex; align-items: center; gap: 8px; }
.scope-lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.scope-static { font-weight: 600; font-size: 14px; }
.scope-bar select, .scope-bar input[type=date] { font: inherit; font-size: 13px; padding: 5px 9px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl); background: var(--surface); color: var(--text); }
.scope-date, .custom-dates { display: inline-flex; align-items: center; gap: 6px; }
.scope-echo { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.scope-echo strong { color: var(--text); }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  background: var(--surface); border: 0.5px solid var(--border-soft);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card);
  padding: 14px 16px; margin-bottom: 16px; }
.filter-bar label { display: flex; flex-direction: column; gap: 5px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.filter-bar input, .filter-bar select { font: inherit; font-size: 13px; text-transform: none;
  letter-spacing: 0; color: var(--text); padding: 7px 10px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl); background: var(--surface); }
.filter-bar .btn { margin-bottom: 1px; }
/* multi-select dropdown with chips (line-items filter) */
.filter-bar .ms-field { display: flex; flex-direction: column; gap: 5px; }
.filter-bar .ms-field .filt-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.ms-dropdown { position: relative; }
.ms-toggle { display: flex; align-items: center; gap: 6px; min-width: 190px; min-height: 34px;
  font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--border-soft);
  border-radius: var(--radius-ctrl); background: var(--surface); color: var(--text); cursor: pointer; }
.ms-chips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; align-items: center; }
.ms-chip { background: var(--pill-submitted-bg); color: var(--pill-submitted-fg); border-radius: var(--radius-badge);
  padding: 2px 8px; font-size: 12px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-ph { color: var(--text-muted); }
.ms-caret { color: var(--text-muted); margin-left: auto; }
.ms-panel { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl);
  box-shadow: var(--shadow-card); padding: 6px; min-width: 240px; max-height: 260px; overflow: auto; }
.ms-dropdown.open .ms-panel { display: block; }
.ms-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 13px;
  border-radius: 6px; cursor: pointer; white-space: nowrap; }
.ms-opt:hover { background: var(--bg-page); }
.ms-paste { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; padding: 6px 8px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl); background: var(--surface); color: var(--text); }
.ms-paste-hint { font-size: 10.5px; color: var(--text-muted); margin: 3px 2px 6px; }

/* ---------- Send-request modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(14,0,113,0.35);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-card { background: var(--surface); border-radius: var(--radius-card);
  box-shadow: 0 12px 40px rgba(0,0,0,0.25); padding: 22px 24px; width: 560px;
  max-width: 100%; max-height: 88vh; overflow: auto; }
.modal-card h2 { margin: 0 0 14px; font-size: 18px; }
.send-preview th { width: 64px; text-align: left; color: var(--text-muted); font-weight: 600; vertical-align: top; }
.send-body-label { margin: 16px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.send-body { border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl);
  padding: 12px 14px; background: var(--bg-page); max-height: 300px; overflow: auto; font-size: 13.5px; }
.send-preview th { width: 96px; text-align: left; color: var(--text-muted); font-weight: 600; vertical-align: top; }
.send-details { margin-top: 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl); padding: 8px 12px; }
.send-details summary { cursor: pointer; font-size: 13px; color: var(--brand-blue); font-weight: 600; }
.send-details .send-subj { font-size: 13px; margin-top: 8px; }
.send-details .send-body { margin-top: 8px; }

/* bulk select + send */
.bulk-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; min-height: 34px; }
.bulk-bar .bulk-all-lbl { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.bulk-bar .bulk-actions { margin-left: auto; display: flex; gap: 8px; }
.grid th.cb-col, .grid td.cb-col { width: 30px; text-align: center; }
/* Reserve the actions column so hiding row buttons in bulk mode doesn't reflow the table. */
.grid th.act-col, .grid td.act-col { width: 1%; min-width: 252px; }
/* Equal-width, aligned row actions (Send request / View / Cancel line up). */
/* Row actions: let them wrap instead of clipping. A row needing three
   (Resend / Copy link / Cancel) wanted 278px in a fixed 220px cell, so the last
   one was cut off at the table edge. Sized to content, right-aligned, wrapping. */
.grid td.act-col { display: flex; gap: 6px; align-items: center; justify-content: flex-end;
                   flex-wrap: wrap; white-space: nowrap; }
.act-col .btn, .act-col .row-cancel .btn { box-sizing: border-box; min-height: 30px;
                                           padding: 5px 10px; font-size: 12.5px; }
.act-col .row-cancel { display: inline-flex; margin: 0; }
.row-cancel { display: inline-block; }
body.bulk-active .row-send, body.bulk-active .row-cancel, body.bulk-active .row-action { display: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.95); background: var(--danger); }

/* ---------- Content preview frames ---------- */
.preview-frame { background: var(--bg-page); border: 0.5px solid var(--border-soft);
  border-radius: var(--radius-card); padding: 24px; margin-top: 8px; }
.preview-email { max-width: 640px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl); overflow: hidden; }
.preview-email-head { background: var(--bg-page); border-bottom: 1px solid var(--border-soft);
  padding: 12px 18px; font-size: 13px; display: grid; gap: 3px; }
.preview-email-body { padding: 18px; }

/* ---------- Misc ---------- */
.toggle-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 0.5px solid var(--border-soft); }
.toggle-row .desc { color: var(--text-muted); font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
code.token { font-size: 12px; word-break: break-all; color: var(--brand-blue); }

/* ---------- Public (dealer) pages ---------- */
.container { max-width: 640px; margin: 0 auto; padding: 24px 20px 64px; }
.container .topbar { justify-content: center; }
.container .brand { font-family: var(--font-brand); font-weight: 700; font-size: 20px; color: var(--brand-indigo); }

/* ---------- Workflow stepper ---------- */
.workflow { display: flex; align-items: flex-start; margin: 6px 0; }
.wf-step { flex: 1; min-width: 64px; display: flex; flex-direction: column; align-items: center;
  gap: 6px; text-align: center; position: relative; }
.wf-step::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px;
  background: var(--border-soft); z-index: 0; }
.wf-step:first-child::before { display: none; }
.wf-step.done::before, .wf-step.current::before { background: var(--accent-success); }
.wf-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; background: var(--surface); border: 2px solid var(--border-soft);
  color: var(--text-muted); position: relative; z-index: 1; }
.wf-step.done .wf-dot { background: var(--accent-success); border-color: var(--accent-success); color: #fff; }
.wf-step.current .wf-dot { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff;
  box-shadow: 0 0 0 4px rgba(0,112,252,0.15); }
.wf-step.skipped .wf-dot { border-style: dashed; }
.wf-label { font-size: 12px; color: var(--text-muted); }
.wf-step.current .wf-label { color: var(--text); font-weight: 600; }
.wf-step.skipped .wf-label { text-decoration: line-through; opacity: 0.6; }

/* dashboard pending queues */
.queue + .queue { margin-top: 18px; }
.queue-head { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 6px; }

/* ---------- Auth + header ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(circle at 20% 30%, rgba(0,112,252,.10), transparent 55%),
    radial-gradient(circle at 80% 70%, rgba(14,0,113,.10), transparent 55%),
    var(--bg-page); }
.auth-card { background: var(--surface); border: 0.5px solid var(--border-soft);
  border-radius: 16px; box-shadow: 0 20px 50px rgba(14,11,26,.10); padding: 32px; width: 100%; max-width: 420px; }
.auth-brand { font-family: var(--font-brand); font-weight: 700; font-size: 22px; margin-bottom: 6px; color: var(--brand-indigo); }
.auth-brand span { color: var(--brand-blue); }
.auth-card h1 { font-size: 20px; margin: 0 0 12px; }

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.imp-banner { background: var(--pill-pending-bg); color: var(--pill-pending-fg);
  border-bottom: 0.5px solid #F2DDA8; padding: 8px 28px; font-size: 13px;
  display: flex; align-items: center; gap: 12px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 18px; border-bottom: 0.5px solid var(--border-soft); }
.tabs a { padding: 8px 14px; font-size: 14px; color: var(--text-muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); font-weight: 600; }

.field-cap { font-size: 12px; font-weight: 600; letter-spacing: 0.48px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.checks label { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; letter-spacing: normal; text-transform: none; color: var(--text); }
.checks input[type="checkbox"] { width: auto; padding: 0; border: 0; box-shadow: none; -webkit-appearance: checkbox; appearance: checkbox; }

/* Send-preview: the rendered email body is a PICTURE of the email, not a live
   page. Its anchors have their href stripped in JS; these rules make that
   visible so a reader doesn't click "Pay Now" expecting it to do something. */
.send-body-note { font-size: 11.5px; color: var(--text-muted);
                  background: #FFF7E6; border: 1px solid #F3E0BC; border-radius: 8px;
                  padding: 8px 10px; margin: 10px 0 8px; line-height: 1.45; }
.send-body a, .send-body a:hover { cursor: default; text-decoration: none; opacity: .55; }
.send-body a.btn, .send-body a.btn-primary { filter: grayscale(1); }

/* Payment link block: the issued /pay/<token> URL, copyable by hand when the
   email did not reach the dealer. */
.paylink-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 8px; }
.paylink-input { flex: 1 1 340px; min-width: 240px; padding: 9px 12px; font-size: 13px;
                 border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl);
                 background: #F5F9FF; color: var(--text); }
.paylink-card .card-title { margin-bottom: 4px; }

/* A resend preview shows a genuinely live link -- undo the inert styling. */
.send-body.is-live a { cursor: pointer; text-decoration: underline; opacity: 1; }
.send-body.is-live a.btn, .send-body.is-live a.btn-primary { filter: none; text-decoration: none; }
.send-body-note.is-live { background: #E7F6EE; border-color: #BFE3CF; color: #14663D; }

/* Email delivery controls on the Settings page. */
.email-delivery { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border-soft); }
.ed-locked { background: #FFF4E0; border: 1px solid #F3E0BC; color: #7A5200; border-radius: 9px;
             padding: 11px 14px; font-size: 12.5px; line-height: 1.55; margin-bottom: 14px; }
.ed-modes { display: flex; flex-direction: column; gap: 8px; }
.ed-mode { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; cursor: pointer;
           border: 1px solid var(--border-soft); border-radius: 10px; background: #fff; }
.ed-mode:hover { border-color: #9DBFEA; }
.ed-mode input { margin-top: 3px; }
.ed-mode span { display: flex; flex-direction: column; gap: 2px; }
.ed-mode strong { font-size: 13.5px; }
.ed-mode small { color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.ed-mode:has(input:checked) { border-color: var(--brand-blue); background: #F5F9FF;
                              box-shadow: 0 0 0 2px rgba(0,112,252,.10); }
.email-delivery textarea { width: 100%; margin-top: 6px; padding: 9px 12px; font: inherit; font-size: 13px;
                           border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl);
                           box-sizing: border-box; resize: vertical; }

/* ---------------------------------------------------------------- merged Payments list
   Requests + payment attempts are one screen now. The chrome was five stacked
   boxes (title, tiles, filter card, toolbar, bulk bar) above the table; this is
   a header line, a chip strip that doubles as the status filter, and one slim
   filter row. The table is the only card left. */
.page-head { display: flex; align-items: center; justify-content: space-between;
             gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head-actions { display: flex; gap: 8px; }

.statline { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.stat-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px;
             border-radius: 999px; border: 1px solid var(--border-soft);
             background: #fff; font-size: 12.5px; color: var(--text-muted);
             text-decoration: none; white-space: nowrap; }
.stat-chip b { font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-chip:hover { border-color: #9DBFEA; }
.stat-chip.active { border-color: var(--brand-blue); background: #F5F9FF;
                    box-shadow: 0 0 0 2px rgba(0,112,252,.10); color: var(--text); }

.filter-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-line .filt-search { padding: 7px 11px; font: inherit; font-size: 13px; min-width: 210px;
                            border: 1px solid var(--border-soft);
                            border-radius: var(--radius-ctrl); background: #fff; }
.filter-line .ms-dropdown { margin: 0; }
.bulk-bar.inline { margin-bottom: 10px; }

/* Status tones. One vocabulary for the derived statuses, used by the chips and
   the row pills, so "waiting on the dealer" and "waiting on us" never look alike. */
.pill.tone-neutral, .stat-chip.tone-draft, .stat-chip.tone-confirmed,
.stat-chip.tone-cancelled, .stat-chip.tone-expired { background: #F1F5F9; color: #475569; }
.pill.tone-info,  .stat-chip.tone-sent              { background: #E0EEFF; color: #0E4FA3; }
.pill.tone-warn,  .stat-chip.tone-in_progress,
.stat-chip.tone-awaiting_approval                   { background: #FFF4E0; color: #7A5200; }
.pill.tone-bad,   .stat-chip.tone-failed            { background: #FDECEA; color: #A32E22; }
.pill.tone-good,  .stat-chip.tone-paid,
.stat-chip.tone-partially_paid                      { background: #E7F6EE; color: #14663D; }
.stat-chip.tone-awaiting_approval, .stat-chip.tone-failed { font-weight: 600; }

/* Attempt history on the detail page — a timeline, not a second table. */
.tl { display: flex; flex-direction: column; }
.tl-row { display: flex; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 10px; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.tl-dot.ok { background: #1E8E5A; } .tl-dot.bad { background: #C0392B; }
.tl-dot.wait { background: #E0A200; } .tl-dot.idle { background: #CBD5E1; }
.tl-line { flex-grow: 1; width: 1px; background: #E5EAF1; margin-top: 4px; }
.tl-body { flex-grow: 1; padding-bottom: 14px; }
.tl-title { font-size: 13px; font-weight: 600; }
.tl-meta { font-family: var(--font-mono, monospace); font-size: 11px; color: #94A3B8; margin-top: 2px; }

/* The derived statuses are written as sentences ("Awaiting approval"), not
   codes, so they should not be shouted — and uppercase made the longest one
   wrap onto two lines in the status column. */
.pill[class*="tone-"] { text-transform: none; letter-spacing: 0; white-space: nowrap; }

/* ---------------------------------------------------------------- dashboard
   Was eight static numbers in two rows above a stack of queue boxes. Now five
   tiles that each link into the list they count, and one flat attention list. */
.dash-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
              gap: 16px; margin-bottom: 24px; }
@media (max-width: 1100px) { .dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Nova KPI card — measured 12px radius, 1px #e5e5e5, white, blue-tinted shadow,
   40x40 tinted icon square. The CARD stays white; semantics live in the icon
   square and the number, never in a coloured card body. */
.dash-tile { display: block; padding: 20px; border-radius: var(--radius-card);
  text-decoration: none; background: var(--surface); border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card); transition: all 200ms cubic-bezier(.4,0,.2,1); }
.dash-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dt-ic { display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-lg);
  background: var(--nav-active-bg); color: var(--brand-blue); margin-bottom: 12px; }
.dt-n { font-size: 30px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; letter-spacing: -.4px; line-height: 1.15; }
.dt-l { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-top: 4px; }
.dt-s { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.dash-tile.tone-warn .dt-ic { background: var(--warn-bg); color: var(--warn-fg); }
.dash-tile.tone-warn .dt-n  { color: var(--warn-fg); }
.dash-tile.tone-bad  .dt-ic { background: var(--bad-bg); color: var(--danger); }
.dash-tile.tone-bad  .dt-n  { color: var(--danger); }
.dash-tile.tone-good .dt-ic { background: var(--pill-done-bg); color: var(--pill-done-fg); }
.dash-tile.tone-good .dt-n  { color: var(--pill-done-fg); }
.dash-attention td { padding: 9px 0; border-bottom: 1px solid #EEF3F9; font-size: 13px; }
.dash-attention tr:last-child td { border-bottom: 0; }

/* Lucide icons: stroke-only, flat, inheriting colour from their container. */
.ic { display: block; flex: 0 0 auto; }

/* Status chips on the Payments list, matching the badge vocabulary. */
.stat-chip.tone-draft, .stat-chip.tone-confirmed,
.stat-chip.tone-cancelled, .stat-chip.tone-expired { background: var(--neutral-bg); color: var(--neutral-fg); }
.stat-chip.tone-sent { background: var(--info-bg); color: var(--info-fg); }
.stat-chip.tone-in_progress, .stat-chip.tone-awaiting_approval { background: var(--warn-bg); color: var(--warn-fg); }
.stat-chip.tone-failed { background: var(--bad-bg); color: #B91C1C; }
.stat-chip.tone-paid, .stat-chip.tone-partially_paid { background: var(--pill-done-bg); color: var(--pill-done-fg); }

/* ---------- Bank-transfer proof review (now part of the payment detail page) ----------
   These were inline in the retired Bank transfers screen. */
.nf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
  @media (max-width: 1000px) { .nf-grid { grid-template-columns: 1fr; } }

  .nf-amt { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 4px; }
  .nf-amt .box .l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; }
  .nf-amt .box .v { font-size: 24px; font-weight: 800; color: var(--brand-indigo); font-variant-numeric: tabular-nums; letter-spacing: -.4px; margin-top: 3px; }

  /* Proof viewer */
  .proof-wrap { position: relative; background: #F5F9FF; border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden; }
  .proof-scroll { max-height: 460px; overflow: auto; display: flex; align-items: flex-start; justify-content: center; }
  .proof-scroll img { display: block; transform-origin: top center; transition: transform .12s ease; max-width: 100%; }
  .proof-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border-soft); background: #fff; flex-wrap: wrap; }
  .proof-bar .zl { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 42px; }
  .proof-bar .spacer { flex: 1; }
  .proof-pdf { width: 100%; height: 460px; border: 0; display: block; background: #fff; }
  .proof-none { padding: 26px; text-align: center; color: var(--text-muted); font-size: 13px; }

  .rev-form label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 12px; }
  .rev-form .hint { display: block; font-weight: 400; color: var(--text-muted); font-size: 11.5px; margin-top: 3px; }
  .rev-form input[type=text], .rev-form textarea { width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; font-size: 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-ctrl, 8px); box-sizing: border-box; }
  .rev-form textarea { min-height: 62px; resize: vertical; }
  .rev-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
  .btn-approve { background: var(--accent-success, #1E8E5A); color: #fff; border: 0; }
  .btn-approve:hover { background: #17754a; }
  .btn-reject { background: #fff; color: #C0392B; border: 1px solid #E8B4AE; }
  .btn-reject:hover { background: #FDECEA; }
  .mismatch { display: none; margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: #FFF4E0; color: #7A5200; font-size: 12.5px; line-height: 1.5; }
  .note-val { white-space: pre-wrap; }
  .reviewed { padding: 14px 16px; border-radius: 10px; font-size: 13px; line-height: 1.55; }
  .reviewed.ok { background: #E7F6EE; color: #14663D; }
  .reviewed.no { background: #FDECEA; color: #A32E22; }

/* Secondary line inside a table cell — lets a row carry a second fact
   (raised-on, dealer code, what it is for, how it was paid) without adding a
   column for each. Quiet enough that the primary value still leads. */
.cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.cell-sub.mono { letter-spacing: .2px; }

/* ---------------------------------------------------------------- payment detail
   Was a column of eight cards ~2150px tall, with the status stated three times
   and five numbers spread over nine table rows. Now: one header card carrying
   identity, stepper and money, then a two-column body. */
.detail-head { padding: 20px 24px; }
.dh-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dh-top h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; color: #333; }
.dh-sub { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.dh-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dh-flow { margin: 16px 0 4px; padding: 14px 0; border-top: 1px solid var(--border-sub);
           border-bottom: 1px solid var(--border-sub); }

.money-strip { display: flex; flex-wrap: wrap; gap: 28px; padding-top: 14px; }
.ms-item { display: flex; flex-direction: column; gap: 2px; }
.ms-l { font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
        color: var(--text-muted); font-weight: 600; }
.ms-v { font-size: 16px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.ms-item.strong .ms-v { font-size: 20px; font-weight: 700; color: var(--brand-indigo); }
.ms-item.ok .ms-v { color: var(--pill-done-fg); }

/* Two-column body: the reviewer's evidence on the left, the decision on the right. */
.detail-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .detail-cols { grid-template-columns: 1fr; } }
.detail-cols > div > .card + .card { margin-top: 16px; }

/* ---------------------------------------------------------------- payment link line
   The link is one fact, not a section, so it is a row inside the header card
   rather than a card of its own. Clicking the URL or the icon copies it. */
.paylink-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
                margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-sub); }
.pl-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
            color: var(--text-muted); font-weight: 600; }
.pl-url { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
          background: none; border: 0; padding: 0; cursor: pointer; font-size: 12.5px;
          color: var(--nav-active-fg); text-decoration: underline; text-underline-offset: 2px; }
.pl-url:hover { color: var(--brand-indigo); }
.pl-icon { display: inline-flex; align-items: center; justify-content: center;
           width: 26px; height: 26px; border-radius: var(--radius-ctrl); border: 1px solid var(--border-soft);
           background: #fff; color: var(--text-muted); cursor: pointer; text-decoration: none; }
.pl-icon:hover { border-color: #93C5FD; color: var(--brand-blue); }
.pl-exp { font-size: 11.5px; color: var(--text-muted); }
.pl-copied { font-size: 11.5px; font-weight: 600; color: var(--pill-done-fg); }

/* Bank transfer: the UTR is what gets matched against the statement. */
.bt-utr { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: .4px; }
.bt-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.6; }
.bt-note { margin-top: 10px; padding: 9px 12px; background: var(--surface-alt);
           border-left: 2px solid var(--border-soft); border-radius: 0 8px 8px 0;
           font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; }

/* Proof: a thumbnail that opens a lightbox, instead of an inline viewer. */
.proof-thumb { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px;
               background: var(--surface-alt); border: 1px solid var(--border-soft);
               border-radius: var(--radius-lg); cursor: pointer; text-align: left; font: inherit; }
.proof-thumb:hover { border-color: #93C5FD; }
.proof-thumb img { width: 92px; height: 64px; object-fit: cover; border-radius: 6px;
                   border: 1px solid var(--border-soft); background: #fff; flex: 0 0 auto; }
.pt-doc { width: 92px; height: 64px; display: flex; align-items: center; justify-content: center;
          border-radius: 6px; background: #fff; border: 1px solid var(--border-soft);
          font-size: 13px; font-weight: 700; color: var(--text-muted); flex: 0 0 auto; }
.pt-cap { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text);
          min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pt-cap small { font-size: 11.5px; color: var(--text-muted); }

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(17, 24, 39, .82);
            display: flex; flex-direction: column; padding: 16px; }
.lightbox[hidden] { display: none !important; }
.lb-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lb-name { color: #fff; font-size: 13px; }
.lb-spacer { flex: 1; }
.lb-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; }
.lb-body img { max-width: 100%; max-height: 100%; object-fit: contain;
               border-radius: 8px; background: #fff; }
.lb-pdf { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }

/* "Paid so far" carries when + how, absorbing what was a one-row Payments card. */
.ms-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* History is an icon in the header that opens a sheet, not a card nobody reads. */
.lb-sheet { align-items: center; justify-content: center; }
.lb-card { background: #fff; border-radius: var(--radius-2xl); padding: 20px 24px;
           max-width: 620px; width: 100%; max-height: 80vh; overflow: auto;
           box-shadow: var(--shadow-xl); }
.lb-card .lb-bar { margin-bottom: 4px; }
.lb-title { font-size: 16px; font-weight: 600; color: var(--text); }

/* A .btn inside a table cell is a BUTTON, not a link: the table's link colour
   was overriding .btn-primary's white, leaving "Review proof" blue-on-blue and
   effectively unreadable. */
table.grid td a.btn { color: var(--btn-solid); text-decoration: none; }
table.grid td a.btn:hover { text-decoration: none; }
table.grid td a.btn-primary, table.grid td a.btn-primary:hover { color: #fff; }
table.grid td a.btn-danger, table.grid td a.btn-danger:hover { color: #fff; }

/* The table may exceed the card on narrow viewports — scroll it, never clip. */
.card > table.grid { display: table; }
.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------- payments tiles
   The Dashboard and the Payments list were one page pretending to be two: the
   dashboard was this list, with a money stat above it and a "needs attention"
   panel repeating rows already below. The tiles moved here and double as the
   status filter, so there is no separate chip strip. Smaller than the old
   dashboard tiles — they sit above a table, not alone on a page. */
.stat-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
              gap: 10px; margin-bottom: 16px; }
@media (max-width: 1180px) { .stat-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px)  { .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-tile { display: block; padding: 11px 13px; border-radius: var(--radius-lg);
             background: var(--surface); border: 1px solid var(--border-card);
             box-shadow: var(--shadow-card); text-decoration: none;
             transition: all 160ms cubic-bezier(.4,0,.2,1); }
.stat-tile:hover { border-color: #93C5FD; text-decoration: none; }
.stat-tile.active { border-color: var(--btn-solid); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.st-n { font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.2;
        font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.st-l { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-top: 3px; }
.st-s { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.stat-tile.tone-warn .st-n { color: var(--warn-fg); }
.stat-tile.tone-bad  .st-n { color: var(--danger); }
.stat-tile.tone-good .st-n { color: var(--pill-done-fg); }
