:root {
  --surface: #fcfcfb; --surface-2: #f2f1ee;
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #898781;
  --border: #e3e1dc;
  --good: #0ca30c; --warning: #a36f00; --serious: #ec835a; --critical: #d03b3b;
  /* Categorical series palette (validated 8-slot order — see dataviz skill's
     references/palette.md; this dashboard's surfaces are an exact match, so
     these steps are used as-is, not re-derived). Assign in fixed order per
     chart, never cycled/reassigned when a filter changes what's visible. */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  /* Chrome-only additions (2026-07-25 visual refresh) — never touch the
     series-*/status tokens above, they're CVD-validated as-is. */
  --accent: var(--series-1);                 /* alias — ties hover/nav accents to the validated blue, no new hue */
  --accent-wash: rgba(42, 120, 214, 0.07);   /* --series-1 as low-alpha rgb, for hover/background washes */
  --wash-2: rgba(11, 11, 11, 0.025);         /* faint neutral counter-wash for background depth */
  --card-shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 6px 16px rgba(11, 11, 11, 0.04);
  --font-display: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", sans-serif;
  /* Row hover gets its own warmer, higher-alpha wash (--series-4/amber) —
     deliberately distinct from the blue --accent-wash used for buttons/nav/
     cards, and noticeably stronger, so hovering a row of text unambiguously
     reads as "you are on this row" rather than blending into the page. */
  --row-hover-wash: rgba(237, 161, 0, 0.18);
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1a1a19; --surface-2: #242422;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #898781;
    --border: #3a3936;
    --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --accent-wash: rgba(57, 135, 229, 0.14);
    --wash-2: rgba(255, 255, 255, 0.02);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
    --row-hover-wash: rgba(201, 133, 0, 0.22);
  }
}
* { box-sizing: border-box; margin: 0; }
:root { --sidebar-width: 216px; --sidebar-collapsed-width: 56px; }
html { scrollbar-gutter: stable; }
body {
  background:
    radial-gradient(1100px 620px at 10% -10%, var(--accent-wash), transparent 55%),
    radial-gradient(900px 520px at 100% 6%, var(--wash-2), transparent 50%),
    var(--surface);
  background-attachment: fixed;
  color: var(--text-primary);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 24px; max-width: 960px;
  margin-left: calc(var(--sidebar-width) + 24px);
  transition: margin-left 0.15s ease;
}
html.sidebar-collapsed body { margin-left: calc(var(--sidebar-collapsed-width) + 24px); }
header { display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.nav-group { display: flex; align-items: center; gap: 10px; }
/* Detail page header: back link stacked above the title, both left-aligned
   — per feedback, "Back to dashboard" reads better as a breadcrumb above
   the heading than floated to the far right of the row. */
header.detail-header { flex-direction: column; align-items: flex-start; gap: 4px; }
h1 { font-family: var(--font-display); font-size: 23px; font-weight: 700; letter-spacing: -0.01em; }
.meta { color: var(--text-muted); font-size: 12px; }
/* Persistent left sidebar (2026-07-25 — replaced the earlier hamburger
   dropdown, since it required a click just to see where else you could go).
   Desktop: always visible, collapsible to an icon-only rail. Mobile (this
   dashboard's primary audience): an off-canvas drawer, toggled by the same
   fixed corner button, since a persistent 216px rail would eat too much of
   a phone's width. Fixed positioning means .sidebar/.sidebar-toggle render
   correctly regardless of where in the DOM _nav_menu() is called from. */
.sidebar-toggle { position: fixed; top: 14px; left: 14px; z-index: 30;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-primary); font-size: 15px; line-height: 1; padding: 6px 10px; cursor: pointer;
  box-shadow: var(--card-shadow); }
.sidebar-toggle:hover { background: var(--accent-wash); border-color: var(--accent); }
.sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-width);
  background: var(--surface-2); border-right: 1px solid var(--border);
  padding: 60px 10px 16px; overflow-y: auto; overflow-x: hidden; z-index: 25;
  transition: width 0.15s ease; }
html.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 6px;
  font-size: 13px; color: var(--text-primary); text-decoration: none; white-space: nowrap; }
.sidebar a:hover, .sidebar a:focus-visible { background: var(--accent-wash); }
.sidebar a.nav-sub { padding-left: 21px; color: var(--text-secondary); font-size: 12px; }
.sidebar a .nav-icon { flex-shrink: 0; font-size: 14px; }
html.sidebar-collapsed .sidebar a .label { display: none; }
html.sidebar-collapsed .sidebar a.nav-sub { padding-left: 9px; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 20; }
@media (max-width: 860px) {
  body, html.sidebar-collapsed body { margin-left: 0; padding-top: 60px; }
  .sidebar, html.sidebar-collapsed .sidebar { width: var(--sidebar-width); transform: translateX(-100%);
    transition: transform 0.2s ease; }
  .sidebar a .label { display: inline !important; }
  .sidebar.open { transform: translateX(0); }
  /* MUST out-specify the collapsed rule above, not just come after it.
     `.sidebar, html.sidebar-collapsed .sidebar` is (0,2,1) while a bare
     `.sidebar.open` is (0,2,0) — so on a phone whose sidebar-collapsed class
     was restored from localStorage (set on a desktop visit; the restoring
     IIFE has no viewport check), the translateX(-100%) won and tapping the
     toggle dimmed the backdrop while the drawer stayed off-screen, with no
     way to navigate at all. Phones are this dashboard's primary audience, so
     this rule is load-bearing, not cosmetic — see the CSS-contract test in
     tests/test_dashboard.py. */
  html.sidebar-collapsed .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  /* Summary card overflow fix: .balance-row's non-shrinking children
     (avatar 30 + name 96 + amount 130, flex-shrink:0 on name/amount) sum to
     a 340px minimum with the .balance-track floor — wider than the ~350px
     content area on many phones once .summary-card's own padding is
     subtracted, and with nothing left to give, the row spilled out of the
     card and forced page-level horizontal scroll, clipping the amount
     column off-screen (reported on a live 390px device: "+INR 20,896..."
     cut mid-number). Narrower fixed widths bring the mobile minimum down to
     ~250px, comfortably inside the smallest phones this dashboard targets.

     These selectors are rescoped with an ancestor class already present in
     the real DOM (.summary-card .balance-row instead of bare .balance-row,
     etc.) rather than left as bare selectors — the unconditional desktop
     rules for these same properties sit LATER in this file at equal
     specificity, and a same-specificity tie goes to whichever rule is later
     in source order, not whichever is inside an active media query. Bare
     selectors here were therefore dead: this "fix" never actually applied,
     on any viewport, until the specificity was made to win outright. Same
     doctrine as the .sidebar mobile-drawer fix above — see tests/css.py's
     specificity() helper and tests/contract/test_security.py's
     test_balance_and_settle_mobile_overrides_outrank_desktop_rules(). */
  .summary-card .balance-row { gap: 8px; }
  .balance-row .avatar { width: 24px; height: 24px; font-size: 10px; }
  .balance-row .balance-name { width: 68px; font-size: 12px; }
  .balance-row .balance-track { min-width: 28px; }
  .balance-row .balance-amount { width: 108px; font-size: 14px; }
  /* Same shrink for the settle-up pills' fixed debtor-name column, plus a
     touch less padding/gap, so the amount pill doesn't rely on the inner
     scroll fallback from .settle-list-wrap's overflow-x:auto. */
  .summary-card .settle-pill .settle-name { width: 72px; }
  /* Regression found on a live phone the same day the two rules above
     shipped: giving the CREDITOR name the same fixed .settle-name width as
     the debtor (needed so both ends of the pill get equal treatment — see
     render_balances_html()) pushed the pill's minimum content width to
     ~365px (avatar+name+arrow+avatar+name+amount, all non-shrinking) against
     a ~300px mobile content area — a genuine ~60px overflow, not a rendering
     fluke. overflow-x:auto on .settle-list-wrap turned that into a
     *scrollable* pill rather than an invisible one, but the browser didn't
     land at scrollLeft 0, so the debtor name's leading characters were
     clipped instead ("hubankar" for "Shubhankar") — a different-looking but
     equally broken result. Shaving fixed pixel widths further is fragile:
     the same overflow returns for a longer name, or for a multi-currency-
     merged amount ("INR 10,408.72 + USD 50.00", a real, already-shipped
     format that can be much wider than a single-currency one). Wrapping the
     amount onto its own line sidesteps the pixel budget entirely — avatars +
     both names + arrow alone need only ~254px, comfortably inside ~300px,
     regardless of name length or how many currencies got merged.

     2026-07-26: that ~254px budget left ~46px of slack unspent, and the
     padding/gap were tightened as far as they'd go rather than as far as
     they needed to go — reported on a live phone as the avatar circles
     visually crowding the pill's own rounded (border-radius:999px) edges.
     A stadium shape's end-caps curve inward fastest right where a
     vertically-centered avatar sits, so an 8px inset reads far tighter here
     than the same 8px would on a square-cornered card. Spent ~18px of that
     slack on padding/gap instead: 14+22+10+72+10+16+10+22+10+72+14 = 272px,
     still comfortably inside ~300px. */
  .summary-card .settle-pill { padding: 10px 14px 10px 14px; gap: 10px; font-size: 12px;
    flex-wrap: wrap; }
  .summary-card .settle-pill .settle-amount { flex-basis: 100%; margin-left: 0;
    padding-left: 0; text-align: right; margin-top: 4px; }
}

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 28px; }
/* Both render_flatmates_page() and render_group_page() always render 5
   tiles — an odd count. auto-fit picks however many 140px+ columns fit the
   container, and on any width where that lands on an even count, the 5th
   tile ends up alone on the final row at a single column's width, reading
   as a clipped/misaligned tile rather than a full-width one (reported on a
   live phone: the "All-time" tile). Spanning the lone last item across
   every column fixes this at any viewport/column count, not just mobile. */
.tiles .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; box-shadow: var(--card-shadow);
  transition: box-shadow .15s ease, transform .15s ease, background .15s ease; }
.tile:hover { transform: translateY(-1px); background: var(--accent-wash); }
.tile .label { color: var(--text-secondary); font-size: 12px; }
.tile .value { font-size: 32px; font-weight: 700; letter-spacing: -0.01em; margin-top: 4px; }
.tile .value .dim { color: var(--text-muted); font-size: 16px; font-weight: 400; }
.tile .note { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.tile .note.good { color: var(--good); }
.tile .note.warning { color: var(--warning); }
.tile .note.serious { color: var(--serious); }
.tile .note.critical { color: var(--critical); }
h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.005em; margin: 28px 0 10px; color: var(--text-secondary); }
h3 { font-size: 11px; font-weight: 700; margin: 18px 0 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-muted); font-weight: 500;
  border-bottom: 1px solid var(--border); padding: 6px 8px; }
td { border-bottom: 1px solid var(--border); padding: 6px 8px; vertical-align: top; }
/* Faint vertical column separators — subtle enough to just barely read as a
   grid rather than a stark ruled table, reusing the same --border token as
   the existing horizontal row rules (no new, stronger color introduced).
   Dropped on the last cell in a row so the table's right edge stays open,
   and excluded from .row-details (a single colspan'd cell — a divider there
   would be meaningless). */
table tr:not(.row-details) > :not(:last-child) { border-right: 1px solid var(--border); }
td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
td.err { color: var(--text-secondary); font-size: 12px; }
/* Consistent, theme-aware row-hover feedback across every plain table (Queued
   photos, Unsynced expenses) — matches the accent-wash hover language used
   everywhere else (nav, buttons, cards). Excludes .row-main/.row-details,
   which already have their own dedicated hover treatment below. */
table tr:not(.row-main):not(.row-details):hover td { background: var(--row-hover-wash); }
.empty { color: var(--text-muted); }
a.view { color: var(--text-secondary); text-decoration: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 8px; font-size: 12px; white-space: nowrap; }
a.view:hover { background: var(--accent-wash); border-color: var(--accent); }
a.back { color: var(--text-secondary); text-decoration: none; font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 16px 0 24px; }
.detail-grid dt { color: var(--text-muted); }
.detail-grid dd { margin: 0; }
.receipt-photo { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin-top: 8px; }
.range-select { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 20px; }
.range-select button { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-secondary); font-size: 12px; padding: 5px 10px; cursor: pointer; }
.range-select button:hover { background: var(--accent-wash); border-color: var(--accent); }
.range-select button.active { background: var(--text-primary); color: var(--surface); border-color: var(--text-primary); }
canvas.chart { width: 100%; height: 220px; display: block; margin-bottom: 8px; }
.chart-wrap { position: relative; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--card-shadow); overflow: hidden; }
.chart-tooltip { position: absolute; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; font-size: 11px; pointer-events: none; white-space: nowrap; z-index: 5; }
.chart-tooltip-title { font-weight: 600; margin-bottom: 2px; }
/* Legend swatch background is a per-series color set by app.js via
   .style.background (CSSOM, not an HTML style="..." attribute) right after
   this markup is inserted -- see handleMove()'s comment in app.js. */
.chart-tooltip-swatch { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 1px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
.hub-card { display: block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; text-decoration: none; color: var(--text-primary); box-shadow: var(--card-shadow);
  transition: border-color .15s ease, transform .15s ease; }
.hub-card:hover { background: var(--accent-wash); border-color: var(--accent); transform: translateY(-2px); }
.hub-card-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.hub-card-desc { font-size: 13px; color: var(--text-secondary); }
/* Balance summary card — always-visible section above the spend chart (not a
   tab; the earlier tab toggle was removed once Summary and Recent expenses
   stopped being paired as two views of the same click). */
.summary-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 20px 8px; box-shadow: var(--card-shadow); margin-bottom: 28px;
  transition: background .15s ease; cursor: pointer; }
.summary-card:hover, .summary-card.expanded { background: var(--accent-wash); }
.summary-card h3:first-child { margin-top: 0; }
.balance-list { display: flex; flex-direction: column; gap: 14px; margin: 10px 0 22px; }
.balance-row { display: flex; align-items: center; gap: 12px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }
/* One class per avatar_series_slot() value (1-8) -- CSS classes, not an
   inline style="background:var(--series-N);" attribute, so the color
   survives CSP's style-src 'self' (Phase 4f, no unsafe-inline). */
.avatar-series-1 { background: var(--series-1); }
.avatar-series-2 { background: var(--series-2); }
.avatar-series-3 { background: var(--series-3); }
.avatar-series-4 { background: var(--series-4); }
.avatar-series-5 { background: var(--series-5); }
.avatar-series-6 { background: var(--series-6); }
.avatar-series-7 { background: var(--series-7); }
.avatar-series-8 { background: var(--series-8); }
.balance-name { width: 96px; flex-shrink: 0; font-size: 13px; }
/* Capped max-width (not flex:1 unbounded) — on a wide desktop card a full-
   stretch bar left a huge empty gap between name and amount for anyone with
   a small balance relative to the max; capping keeps the row visually
   compact regardless of card width, while still shrinking to fit on narrow
   mobile viewports. */
.balance-track { flex: 1; max-width: 220px; min-width: 48px; height: 8px; border-radius: 4px;
  background: var(--surface); position: relative; overflow: hidden; }
/* Width is set by app.js from this element's own data-pct attribute (a
   CSSOM .style.width assignment, not an HTML style="..." attribute -- see
   render_balances_html()'s comment). Color comes from one of the two
   classes below, same CSP reasoning as .avatar-series-N above. */
.balance-fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.balance-fill.balance-good { background: var(--good); }
.balance-fill.balance-critical { background: var(--critical); }
.balance-amount { width: 130px; flex-shrink: 0; text-align: right; font-size: 16px; font-weight: 700;
  font-variant-numeric: tabular-nums; }
.balance-amount.balance-good { color: var(--good); }
.balance-amount.balance-critical { color: var(--critical); }
/* Settle-up pills are hidden until the Summary card as a whole is hovered
   (desktop) or tapped/expanded (touch, JS-bound like the row-details
   pattern below) — the balances themselves are the headline; who-owes-whom
   is a detail one interaction away, not shown by default. */
.settle-list-wrap { max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.2s ease, opacity 0.15s ease; }
/* overflow-y: auto on the EXPANDED state only (the collapsed state must keep
   overflow: hidden for the max-height transition to clip anything at all).
   Without this, the 400px cap silently truncated the list — which became
   reachable once settlements merged into a single list rendered after every
   currency section rather than one short list per currency: past roughly
   eight pills, the remainder was simply invisible with no scrollbar and no
   indication anything had been cut. */
.summary-card:hover .settle-list-wrap, .summary-card.expanded .settle-list-wrap,
.summary-card:focus-within .settle-list-wrap { max-height: 400px; opacity: 1;
  overflow-y: auto; overflow-x: auto; }
.settle-hint { font-size: 11px; color: var(--text-muted); margin: 2px 0 4px; }
.summary-card:hover .settle-hint, .summary-card.expanded .settle-hint { display: none; }
.settle-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 16px; }
.settle-pill { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: 13px; }
/* Fixed-width name column, applied to BOTH the debtor and creditor spans
   (render_balances_html()), so the arrow/creditor avatar start at the same x
   position on every row — without this, a longer debtor name (e.g.
   "Shubhankar" vs "Avadhoot") pushes everything after it further right,
   making the list of pills look ragged/misaligned rather than columnar. The
   creditor name used to be emitted as a bare, unwrapped text node with none
   of this discipline — its unbounded width was one of the things that pushed
   the amount span off the edge of the pill, invisible on mobile. */
.settle-pill .settle-name { width: 92px; flex-shrink: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.settle-pill .arrow { color: var(--text-muted); padding: 0 2px; }
.settle-pill .settle-amount { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums;
  padding-left: 12px; }
/* Recent-expenses row density: basic fields (description, amount, split,
   sync status) stay visible; secondary fields (received time, category,
   payer, receipt) live in a second <tr> that reveals on hover (desktop),
   tap (touch — bound in JS, since :hover doesn't fire reliably there), or
   keyboard focus on its inner link. Reveal animates via max-height on a
   wrapper div (not display:none/block) so it "expands a little" instead of
   snapping open. /expense/<id> (or, for group rows with no detail page, the
   raw photo) remains the escape hatch, reachable from inside the reveal
   regardless of hover state. */
tr.row-main { cursor: pointer; }
/* Hover/expanded highlight covers row-main AND its sibling row-details
   together as one visual block. Each pair is wrapped in its own
   <tbody class="row-group"> (see dashboard.py) specifically so this works:
   a plain `tr.row-main:hover + tr.row-details` sibling-combinator rule looks
   right at first, but CSS has no "previous sibling" selector — once the
   cursor moves off row-main and onto the now-revealed row-details below it,
   `tr.row-main:hover` stops matching (the mouse is no longer literally over
   that row) and nothing keeps row-main's own highlight on, so the highlight
   appears to "jump" to row-details alone instead of covering the whole
   block. `:hover`/`:focus-within` on an ancestor, by contrast, stays true
   for as long as the pointer/focus is anywhere inside it — including either
   child row — so grouping the pair in a <tbody> and keying off *that*
   covers both rows regardless of which specific one the cursor is over. */
tr.row-main.expanded, tr.row-details.expanded,
tbody.row-group:hover tr, tbody.row-group:focus-within tr {
  background: var(--row-hover-wash);
}
tr.row-details td { padding: 0; border-bottom: 1px solid var(--border); }
.row-details-wrap { max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.18s ease, opacity 0.15s ease; }
tbody.row-group:hover .row-details-wrap,
tbody.row-group:focus-within .row-details-wrap,
tr.row-details.expanded .row-details-wrap { max-height: 120px; opacity: 1; }
.row-details-inner { display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px 16px; padding: 8px 8px 10px; font-size: 12px; color: var(--text-secondary); }
.row-details-inner .field b { color: var(--text-muted); font-weight: 500; margin-right: 4px; }
/* Sync-status color — duplicated into row-details (green synced / red
   pending) so the state is still visible without collapsing back to the
   basic row. */
.status-badge { font-weight: 600; }
.status-badge.status-good { color: var(--good); }
.status-badge.status-bad { color: var(--critical); }
/* Expense-detail popover — /group/<name> rows have no per-container detail
   route to link to (see ExpenseRowView's docstring), so their "Full details"
   control opens this in-page modal instead of navigating, populated by
   app.js's _bindPopoverButtons() from the triggering button's data-*
   attributes. [hidden] (a real DOM property JS toggles, not a class) is
   enough to show/hide it — no inline style="..." needed. */
.popover-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.popover-overlay[hidden] { display: none; }
.popover-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--card-shadow); padding: 20px; max-width: 420px; width: 100%;
  max-height: 80vh; overflow-y: auto; position: relative; }
.popover-close { position: absolute; top: 10px; right: 10px; background: none; border: none;
  color: var(--text-secondary); font-size: 16px; cursor: pointer; padding: 4px 8px; }
.popover-close:hover { color: var(--text-primary); }
