/* EFICOR DMS — shared UI foundation. Geist-based tokens (see DESIGN.md),
   EFICOR teal as the accent. Pages keep only page-specific rules. */

:root {
  /* Geist gray, light */
  --gray-100: #f2f2f2; --gray-200: #ebebeb; --gray-300: #e6e6e6;
  --gray-500: #c9c9c9; --gray-600: #a8a8a8; --gray-700: #8f8f8f; --gray-800: #7d7d7d;
  --gray-900: #4d4d4d; --gray-1000: #171717;
  --alpha-200: #00000015; --alpha-400: #00000014;
  --bg-100: #ffffff; --bg-200: #fafafa;

  /* brand accent — EFICOR teal. teal-700 is the site's own button teal
     (#05A896, eficor.org) — decorative use only: 2.98:1 on white fails AA,
     so text/solid fills use teal-900. */
  --teal-100: #defffb;
  --teal-700: #05a896; --teal-800: #00927f; --teal-900: #007f70; --teal-1000: #003f34;

  /* status (Geist scales) */
  --red-100: #ffeeef; --red-900: #d8001b; --red-1000: #47000c;
  --green-100: #ecfdec; --green-900: #107d32;

  /* semantic aliases (admin pages still use these names) */
  --ink: var(--gray-1000);
  --muted: var(--gray-900);
  --line: var(--gray-300);
  --line-soft: var(--gray-200);
  --bg: var(--bg-200);
  --accent: var(--teal-900);
  --accent-strong: #00695d;
  --err: var(--red-900);
  --err-soft: var(--red-100);

  --radius-sm: 6px;
  --radius-md: 12px;
  --shadow-card: 0 2px 2px rgba(0, 0, 0, .04);
  --ring: 0 0 0 2px var(--bg-100), 0 0 0 4px var(--teal-800);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* --- surfaces --- */
.card {
  background: var(--bg-100);
  border: 1px solid var(--alpha-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* --- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  text-decoration: none; /* anchors styled as buttons (export links) */
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled {
  background: var(--gray-100); border-color: var(--gray-100);
  color: var(--gray-700); cursor: not-allowed;
}
.btn-lg { height: 48px; padding: 0 20px; font-size: 16px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-ghost { color: var(--ink); background: var(--bg-100); border-color: var(--alpha-400); }
.btn-ghost:hover { background: var(--gray-100); border-color: var(--alpha-400); }
.btn-quiet { color: var(--gray-900); background: none; border-color: transparent; }
.btn-quiet:hover { color: var(--ink); background: var(--gray-100); border-color: transparent; }
.btn-block { width: 100%; }

/* --- form fields --- */
.field { margin-top: 16px; }
.field > label {
  display: block;
  font-size: 13px;
  line-height: 16px;
  font-weight: 500;
  margin-bottom: 6px;
}

.control {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-100);
  border: 1px solid var(--gray-500); /* darker than stock Geist — see DESIGN.md */
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s, background-color .6s;
}
/* programmatic-fill feedback: add .flash, remove after ~600ms — teal pulse,
   then the .control transition fades it back */
.control.flash { background-color: var(--teal-100); transition: background-color 0s; }
.control::placeholder { color: var(--gray-700); }
.control:hover { border-color: var(--gray-600); }
.control:focus { outline: none; border-color: var(--teal-800); box-shadow: var(--ring); }
/* :has() covers a .control that WRAPS the invalid input (e.g. the login
   password field's show/hide toggle) rather than being it — same technique
   already used below for the unset-select placeholder look. */
.control[aria-invalid="true"], .control:has(> [aria-invalid="true"]) { border-color: var(--red-900); }
textarea.control { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
select.control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d7d7d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
select.control:required:invalid { color: var(--gray-700); } /* placeholder option */
/* ponytail: the dropdown popup stays OS-native (as Stripe does) — restyling it
   via appearance:base-select broke on partial Chromium support. */
.control::-webkit-outer-spin-button, .control::-webkit-inner-spin-button { -webkit-appearance: none; }
/* iOS Safari auto-zooms focused inputs under 16px — bump on touch devices only */
@media (hover: none) and (pointer: coarse) {
  .control { font-size: 16px; }
}
input[type="number"].control { -moz-appearance: textfield; appearance: textfield; }

.err {
  color: var(--red-900);
  font-size: 12px;
  line-height: 16px;
  margin: 6px 0 0;
}
.err:empty { display: none; } /* no reserved space — fields sit tight until an error shows */

/* --- banners --- */
.banner { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; line-height: 18px; display: none; }
.banner.ok { background: var(--teal-100); color: var(--teal-1000); display: block; }
.banner.bad { background: var(--red-100); color: var(--red-1000); display: block; }

/* --- status pills --- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 16px;
  padding: 2px 9px;
  border-radius: 9999px;
  font-weight: 500;
}
/* status dot — glanceable anchor; currentColor keeps it on the pill's scale */
.pill.paid::before, .pill.failed::before, .pill.refunded::before {
  content: ''; width: 6px; height: 6px; border-radius: 9999px; background: currentColor;
}
.pill.paid { background: var(--green-100); color: var(--green-900); }
/* 'created' (unpaid) renders as plain muted text, not a pill — it's the
   majority state; a pill on every row is noise, color marks the exceptions */
.pill.failed, .pill.refunded { background: var(--red-100); color: var(--red-900); }

/* --- tables --- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--gray-200); }
.table th {
  font-size: 11px;
  line-height: 16px;
  text-transform: uppercase;
  letter-spacing: .06em; /* locked spec: 11/500 caps +0.06em */
  font-weight: 500;
  color: var(--gray-700);
  background: var(--bg-200);
}
.table td { padding-top: 12px; padding-bottom: 12px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 500; }
.table tr:last-child td { border-bottom: none; } /* no double line against a card edge */

/* --- utilities --- */
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
/* visually hidden but announced — aria-live status text, skip links, etc. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
/* majority row-state as quiet text (pills mark the exceptions) */
.quiet { color: var(--gray-700); font-size: 13px; }
.pill.role { background: var(--gray-200); color: var(--gray-900); }
/* admin = elevated privilege, worth a glance before an edit/export/resend —
   informational teal (badge, not a competing action), same pairing as the
   80G banner and the copy-chip's "copied" state */
.pill.role.admin { background: var(--teal-100); color: var(--teal-1000); }
.spacer { flex: 1; }
.empty { padding: 40px 16px; text-align: center; color: var(--gray-900); font-size: 14px; }
.empty h4 { margin: 0 0 4px; font-size: 16px; font-weight: 600; letter-spacing: -0.2px; color: var(--ink); }
.empty p { margin: 0; }
.empty .desc { color: var(--gray-900); font-size: 13px; }
.empty .idchip, .empty .btn { margin-top: 16px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 48px; font-size: 13px; font-weight: 500; color: var(--gray-900); cursor: pointer; }
.back:hover { color: var(--ink); }
.mono-b { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; font-weight: 500; color: var(--ink); }
/* unset selects ("All …" / "Any time") read as placeholders, like empty inputs */
select.control:has(option[value=""]:checked) { color: var(--gray-700); }

/* --- card anatomy: panel, head/body/foot, stacking --- */
.card + .card { margin-top: 24px; }
/* FY switch on Reports: the annual card dims in place while it refetches —
   no full-page blank for a change that's scoped to one card */
.card[aria-busy="true"] { opacity: .5; pointer-events: none; transition: opacity .1s; }
.panel { overflow-x: auto; }
/* mixed cards (head + tiles + tables) scroll per-table instead — a whole-
   card .panel swipe drags the header off into whitespace on phones, since
   block siblings size to the visible width, not the table's canvas */
.tscroll { overflow-x: auto; }
/* tinted bands (thead, .foot, .card-foot) meet the card's rounded corners
   cleanly instead of bleeding square past them */
.card > :first-child { border-top-left-radius: calc(var(--radius-md) - 1px); border-top-right-radius: calc(var(--radius-md) - 1px); }
.card > :last-child { border-bottom-left-radius: calc(var(--radius-md) - 1px); border-bottom-right-radius: calc(var(--radius-md) - 1px); }
/* border-collapse ignores radii — round the corner cells themselves */
.card > .table:first-child thead th:first-child { border-top-left-radius: calc(var(--radius-md) - 1px); }
.card > .table:first-child thead th:last-child { border-top-right-radius: calc(var(--radius-md) - 1px); }
/* report card head: title + one-line description; a toolbar after it gets
   its own separating hairline */
.card-head { padding: 20px 16px 12px; }
.card-head h4 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.2px; }
.card-head .desc { margin: 2px 0 0; font-size: 13px; color: var(--gray-900); }
.card-head + .toolbar { border-top: 1px solid var(--gray-200); }
/* section title for a table inside a larger card (Reports: purpose/donor splits) */
.subhead { font-size: 14px; font-weight: 600; letter-spacing: -0.2px; padding: 18px 16px 8px; }
/* share meter: quiet track, teal data-ink fill — proportions at a glance */
.meter { display: inline-block; width: 64px; height: 4px; border-radius: 9999px; background: var(--gray-200); vertical-align: 1px; margin-left: 10px; }
.meter i { display: block; height: 100%; min-width: 2px; border-radius: 9999px; background: var(--teal-800); }
/* two-zone edit card: white body = title + description + fields; tinted
   footer = constraint left, the single action right */
.card-body { padding: 20px 24px; }
.card-body h4 { margin: 0 0 6px; font-size: 16px; font-weight: 600; letter-spacing: -0.2px; }
.card-body .desc { margin: 0 0 16px; font-size: 13px; line-height: 18px; color: var(--gray-900); }
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px 12px 24px; background: var(--bg-200);
  border-top: 1px solid var(--gray-200); font-size: 13px; color: var(--gray-900);
}
.card-foot .actions { display: flex; gap: 8px; flex: none; }
/* save/error line under a form: neutral for progress, red only on error;
   collapsed when empty so the card carries no reserved hole */
.form-msg { font-size: 13px; color: var(--gray-900); margin: 12px 0 0; }
.form-msg:empty { display: none; }
.form-msg.is-err { color: var(--red-900); }

/* --- table extensions (list views) --- */
.table .chev { width: 24px; padding-left: 0; text-align: right; color: var(--gray-500); font-size: 15px; transition: color .15s; }
/* the chevron wakes with its row — affirms "this opens" without adding motion */
tbody tr.clickable:hover .chev, tbody tr.clickable:focus-visible .chev { color: var(--gray-900); }
/* secondary line inside a cell (e.g. PAN under the donor name) */
.table .sub { font-size: 12px; line-height: 16px; color: var(--gray-700); margin-top: 2px; }
.table .c-date { color: var(--gray-700); font-size: 13px; white-space: nowrap; }
.table .none { color: var(--gray-500); } /* empty "—" cells */
@media (min-width: 900px) {
  .panel { overflow-x: visible; } /* an overflow ancestor defeats sticky */
  .tscroll { overflow-x: visible; } /* same trap for the per-table wrapper */
  .table thead th { position: sticky; top: 0; z-index: 1; }
}
.table th.sortable { cursor: pointer; user-select: none; }
/* sort must be discoverable at a glance: inactive sortable headers carry a
   faint arrow showing what the first click does; the active column reads ink */
.table th.sortable[aria-sort="none"]::after { content: " ▼"; color: var(--gray-500); }
.table th.sortable[aria-sort="none"][data-nat="asc"]::after { content: " ▲"; color: var(--gray-500); }
.table th.sortable[aria-sort="ascending"], .table th.sortable[aria-sort="descending"] { color: var(--ink); }
.table th.sortable:hover { color: var(--ink); }
.table th.sortable:focus-visible { outline: 2px solid var(--teal-800); outline-offset: -2px; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--bg-200); }
tbody tr.clickable:focus-visible { outline: 2px solid var(--teal-800); outline-offset: -2px; }
/* per-row receipt actions (Download / Resend) as small ghost buttons — the
   cell is fixed-width so resend status text never reflows the row */
.rowact { white-space: nowrap; width: 320px; }
.rowact .byhand { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-right: 8px; }
/* 8px vertical padding + 28px button = the 44px of a plain text row — button
   rows must not run taller than their neighbors */
td.rowact { padding-top: 8px; padding-bottom: 8px; }
.rowact .btn { height: 28px; padding: 0 10px; font-size: 13px; }
.rowact .btn + .btn { margin-left: 8px; }
/* resend lifecycle: busy locks out double-sends; ok/fail are transient tones */
.rowact .busy { color: var(--gray-600); pointer-events: none; }
.rowact .ok { color: var(--green-900); pointer-events: none; }
.rowact .fail { color: var(--red-900); }
/* footer band: range text left, pager right */
.foot {
  display: flex; align-items: center; padding: 10px 16px; font-size: 13px;
  color: var(--gray-700); background: var(--bg-200); border-top: 1px solid var(--gray-200);
}
.foot a { color: var(--gray-900); font-weight: 500; text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }
.foot .btn, .pfoot .btn { height: 28px; padding: 0 10px; font-size: 13px; }
.foot .btn:disabled { background: none; border-color: transparent; color: var(--gray-500); cursor: default; }

/* --- toolbar + search --- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--gray-200); }
.toolbar .control { width: auto; }
/* buttons that travel as one unit when the toolbar wraps; wraps itself
   only when even the pair alone can't fit (ultra-narrow), never pans */
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 559px) {
  /* phones (same break as .tiles): the pair takes its own full row and
     splits it evenly — one line by construction; the tighter padding is
     what lets both labels clear the toolbar's 16px insets at 390px */
  .btns { flex: 1 1 100%; }
  .btns .btn { flex: 1; padding: 0 10px; }
}
.search { flex: 1; min-width: 200px; max-width: 340px; display: flex; align-items: center; gap: 8px; padding: 0 12px; cursor: text; }
.search svg { flex: none; color: var(--gray-700); }
.search input { border: 0; outline: 0; background: none; font: inherit; width: 100%; color: var(--ink); }
.search input::placeholder { color: var(--gray-700); }
.search:focus-within { border-color: var(--teal-800); box-shadow: var(--ring); }
.search kbd {
  margin-left: auto; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px; line-height: 16px; color: var(--gray-700);
  border: 1px solid var(--gray-200); border-radius: 4px; padding: 0 5px; background: var(--bg-200);
}
/* joined range control (min–max / from–to) */
.rng {
  display: inline-flex; align-items: center; height: 36px;
  background: var(--bg-100); border: 1px solid var(--gray-500); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.rng:hover { border-color: var(--gray-600); }
.rng:focus-within { border-color: var(--teal-800); box-shadow: var(--ring); }
.rng .sep { color: var(--gray-600); font-size: 13px; user-select: none; }
.rng input {
  border: 0; outline: 0; background: none; font: inherit; font-size: 14px;
  color: var(--ink); height: 34px; padding: 0 8px; min-width: 0;
}
.rng input::placeholder { color: var(--gray-700); }
.rng input[type=date] { width: 130px; }
.rng input[type=number] { width: 72px; appearance: textfield; -moz-appearance: textfield; }
.rng input::-webkit-outer-spin-button, .rng input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* --- filter chips + popovers (Stripe model — see the map's locked spec) --- */
.chip { color: var(--gray-900); font-weight: 400; }
.chip b { font-weight: 500; color: var(--ink); }
.chip[aria-expanded="true"] svg { transform: rotate(180deg); }
.pop { position: relative; }
.popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  width: max-content; min-width: 200px; max-width: calc(100vw - 24px); padding: 14px 16px;
  background: var(--bg-100); border: 1px solid var(--alpha-200);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.10);
  display: none; flex-direction: column; gap: 12px;
}
.popover.open { display: flex; }
/* right-anchored when left-anchoring would spill past the viewport (JS measures) */
.popover.flip { left: auto; right: 0; }
.popover .grp { display: flex; flex-direction: column; gap: 8px; }
.popover .opt { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.popover input[type="radio"] { accent-color: var(--teal-900); margin: 0; }
.popover .grp .control { width: 100%; }
/* the custom range belongs to the Custom option: indented to its label.
   No dimming — the fields are always live (focusing one selects Custom),
   and half-faded-but-interactive reads as disabled. */
.popover .rng.dates { margin-left: 24px; }
.popover input[type="date"]::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }
.popover input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.popover .pfoot {
  margin: 2px -16px -14px; padding: 8px 12px;
  background: var(--bg-200); border-top: 1px solid var(--gray-200);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  display: flex; justify-content: space-between; gap: 8px;
}

/* --- donor identity + copyable id chip (detail views) --- */
/* labeled fact grid (v1 mock, signed off 2026-07-05): 11-caps labels — the
   table-header ramp — over 14px ink values; absent facts read a quiet "—".
   Gift stats moved to the shared .tiles row inside the summary card —
   the old 17px stat band left with them. */
.facts { display: flex; flex-wrap: wrap; gap: 20px 48px; }
.fact .f-label { font-size: 11px; line-height: 16px; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-700); margin-bottom: 5px; }
.fact .f-value { font-size: 14px; line-height: 20px; color: var(--ink); }
.fact .f-value.none { color: var(--gray-500); }
/* inline edit (donor card): the read layout IS the form —
   values swap to controls in place under the same labels. 240px keeps
   all four facts on one 1440px row like read mode; max-width caps the
   phone case. view-head wraps so the name input and the Cancel/Save
   .btns pair can't pan the card at 390px. */
.card .view-head { flex-wrap: wrap; }
.card .view-head .control { flex: 1 1 220px; max-width: 420px; }
.facts .control { width: 240px; max-width: 100%; }
.facts + .desc { margin: 16px 0 0; }
.idchip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px;
  padding: 4px 8px 4px 10px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  background: var(--bg-200); color: var(--gray-900); cursor: pointer;
  transition: border-color .15s, background-color .15s, color .15s;
}
.idchip:hover { color: var(--ink); border-color: var(--gray-500); }
.idchip:focus-visible { outline: none; box-shadow: var(--ring); }
.idchip:active { background: var(--gray-200); }
/* icon zone reads as the action, set off from the identifier by a hairline */
.idchip .icon { display: flex; padding-left: 7px; border-left: 1px solid var(--gray-300); color: var(--gray-600); transition: border-color .15s; }
.idchip:hover .icon { color: var(--gray-900); }
.idchip .icon-check { display: none; }
/* copied: icon swaps to a check, chip tints teal for a moment — no layout
   shift, no fighting-for-space text swap; aria-live carries the confirmation
   for screen readers. */
.idchip.copied { border-color: var(--teal-800); background: var(--teal-100); }
.idchip.copied .icon { border-left-color: transparent; color: var(--teal-900); }
.idchip.copied .icon-copy { display: none; }
.idchip.copied .icon-check { display: flex; }
/* inside the fact grid the chip drops its box — the label already frames it;
   bare mono value + copy icon, sized up to sit with 14px neighbors */
.fact .idchip { border: none; background: none; padding: 0; font-size: 13px; }
.fact .idchip .icon { border-left: none; padding-left: 0; }
.fact .idchip.copied { background: none; }

/* --- stat tiles --- */
/* overflow clips square hover fills to the card's rounded corners */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--gray-200); overflow: hidden; }
.card-body + .tiles { border-top: 1px solid var(--gray-200); } /* body above tiles (donor summary) */
.tile { padding: 16px; }
.tile + .tile { border-left: 1px solid var(--gray-200); }
.tiles:last-child { border-bottom: none; } /* nothing below to separate from (Overview) */
/* tiles that link to their detail view — quiet hover, row-style focus */
a.tile { display: block; color: inherit; text-decoration: none; transition: background .15s; }
a.tile:hover { background: var(--bg-200); }
a.tile:focus-visible { outline: 2px solid var(--teal-800); outline-offset: -2px; }
.tile .t-label { font-size: 13px; color: var(--gray-900); }
.tile .t-value { margin-top: 4px; font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr; }
  .tile + .tile { border-left: none; border-top: 1px solid var(--gray-200); }
}

/* --- column chart — single series (teal-800, validated); pair it with a
   table carrying the exact values. Inner classes scoped under .chart. --- */
/* shape (chart) and exact values (table) share one glance on wide screens */
@media (min-width: 900px) {
  /* head + chart stack left; the table owns the card's full right edge */
  .mrow { display: grid; grid-template-columns: 1fr 360px; }
  /* stretch (not start): pass the row height through .mcol to .chart so
     the plot can grow to the table's height — no dead corner under it */
  .mrow .mcol { display: flex; flex-direction: column; }
  .mrow .mcol .chart { flex: 1; }
  .mrow .tscroll { border-left: 1px solid var(--gray-200); }
  /* tinted thead meets the card's rounded corner — same trick as the
     .card > .table:first-child rules above */
  .mrow .table thead th:last-child { border-top-right-radius: calc(var(--radius-md) - 1px); }
}
/* Base: a fixed, always-definite plot height. .col/.bar below size themselves
   by percentage — that only resolves correctly against a height CSS itself
   considers "specified", which flex-grow/min-height do NOT provide unless an
   ancestor forces one (a trap: it silently breaks below the 900px stretch
   override, collapsing every bar to its min-height — verified live, not
   theory). Keep this fixed value as the width-independent floor. */
.chart { padding: 4px 16px 8px; }
.chart .plot {
  position: relative; height: 170px; margin: 28px 0 30px;
  display: flex; align-items: flex-end; gap: 12px;
  /* right tail: tick labels sit at right:0 of the .grid lines, and those are
     absolute — they span the padding box — so this padding insets only the
     flex columns. Last bar stops short; gridline runs on under the label.
     72px clears "₹1,00,000" (~58px at 11px) with breathing room. */
  padding-right: 72px;
}
@media (min-width: 900px) {
  /* Only here is .mrow a grid that stretches .chart to the table's height —
     so only here can .plot's height be flex-grown into a still-definite
     size. Below this breakpoint the fixed 170px above stands untouched. */
  .chart { display: flex; flex-direction: column; }
  .chart .plot { height: auto; flex: 1; min-height: 170px; }
}
.chart .grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--gray-200); }
.chart .grid span { position: absolute; right: 0; bottom: 2px; font-size: 11px; color: var(--gray-700); }
.chart .col {
  position: relative; flex: 1; min-width: 0; height: 100%;
  display: flex; align-items: flex-end; justify-content: center;
}
/* relative: the tooltip anchors to the BAR's own height, not the column's —
   the column stretches to fill the card, so anchoring to it floated every
   tooltip near the plot's top regardless of which bar was hovered */
.chart .bar { position: relative; width: 100%; max-width: 48px; min-height: 2px; background: var(--teal-800); border-radius: 4px 4px 0 0; }
/* 12 month labels (some "Mon YYYY"-wide at year boundaries) don't fit under
   12 narrow columns below ~900px — they'd overlap into their neighbors. The
   table alongside already lists every month by name; hide the axis and let
   it carry that job until there's room for both. */
.chart .col .x { display: none; }
/* tips too: hover-only affordance, and even at opacity 0 the last column's
   nowrap span still takes layout space past the card's right edge — a 1px
   sideways pan on phones with nothing visible to explain it */
.chart .col .tip { display: none; }
@media (min-width: 900px) {
  .chart .col .x {
    display: block;
    position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    font-size: 11px; color: var(--gray-900); white-space: nowrap;
  }
  .chart .col .tip { display: block; }
}
.chart .col .tip {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: var(--gray-1000); color: #fff; font-size: 11px; line-height: 16px;
  padding: 4px 8px; border-radius: var(--radius-sm); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .1s; z-index: 2;
}
.chart .col:hover .tip { opacity: 1; }

/* --- needs-attention band (Overview) --- */
/* Stripe-Home-style quiet row: white card, red dot, one sentence — never a
   red fill (red-100 is form-error voice). Rendered only when count > 0. */
.unsent { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; font-size: 13px; line-height: 20px; }
.unsent .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--red-900); margin-top: 6px; }
.unsent .strong { font-weight: 500; }
.unsent .split { color: var(--muted); }
.unsent a { color: var(--teal-900); text-decoration: none; }
.unsent a:hover { text-decoration: underline; }
