  :root, [data-theme="light"] {
    /* Design system surface tokens */
    --bg: #f7f5f1;
    --surface: #fffdf8;
    --surface-2: #f0ede6;
    --surface-3: #e7e3d8;
    /* Border / rule */
    --rule: rgba(0,0,0,0.09);
    --rule-strong: rgba(0,0,0,0.16);
    /* Ink (text) */
    --ink: #1a1a18;
    --ink-2: #5a5850;
    --ink-3: #8a887d;
    /* Accent (green = fixed/good) */
    --accent: #2a5f4e;
    --accent-dark: #1e483b;
    --accent-tint: #d4e5db;
    --accent-soft: #e4efe9;
    --accent-text: #1a3d30;
    /* Account brand colors (§02-C) */
    --brand-chase: #117aca;
    --brand-apple: #1a1a18;
    --brand-sc: #0473ea;
    --brand-cathay: #00685e;
    /* Flag (amber = flexible/attention) */
    --flag: #b5640b;
    --flag-soft: #fcf0dc;
    /* Warn (rust = bad/danger/destructive) */
    --warn: #a83d2b;
    --warn-soft: #fae3dd;
    /* Good / bad spend semantics */
    --bad: #a83d2b;
    --good: #2f7a5a;
    --good-soft: #d9ecdf;
    /* Highlight / mark */
    --highlight: #fef4c4;
    --mark: #fef4c4;
    --mark-ink: #6b4a0e;
    /* Info (kept for any existing references) */
    --info: #1e5fa8;
    --info-light: #eaf1fb;
    /* Radii & shadow */
    --on-accent: #f0f5f2;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-pop: 0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  }

  [data-theme="dark"] {
    --bg: #14150f;
    --surface: #1c1d17;
    --surface-2: #25261f;
    --surface-3: #2f3028;
    --rule: rgba(255,253,245,0.08);
    --rule-strong: rgba(255,253,245,0.16);
    --ink: #ece8df;
    --ink-2: #b3b0a4;
    --ink-3: #797668;
    --accent: #6fb89a;
    --accent-dark: #8fcfb2;
    --accent-tint: #2c443a;
    --accent-soft: #1f2e27;
    --accent-text: #8fcfb2;
    --flag: #e3a44d;
    --flag-soft: #2e2415;
    --warn: #e07a64;
    --warn-soft: #2d1c17;
    --bad: #e07a64;
    --good: #6fb89a;
    --good-soft: #1f2e27;
    --highlight: #3b3520;
    --mark: #4a3e1a;
    --mark-ink: #f3d480;
    --info: #5090e0;
    --info-light: #182030;
    --shadow: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-pop: 0 8px 24px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
  }

  @media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
      --bg: #14150f;
      --surface: #1c1d17;
      --surface-2: #25261f;
      --surface-3: #2f3028;
      --rule: rgba(255,253,245,0.08);
      --rule-strong: rgba(255,253,245,0.16);
      --ink: #ece8df;
      --ink-2: #b3b0a4;
      --ink-3: #797668;
      --accent: #6fb89a;
      --accent-dark: #8fcfb2;
      --accent-tint: #2c443a;
      --accent-soft: #1f2e27;
      --accent-text: #8fcfb2;
      --flag: #e3a44d;
      --flag-soft: #2e2415;
      --warn: #e07a64;
      --warn-soft: #2d1c17;
      --bad: #e07a64;
      --good: #6fb89a;
      --good-soft: #1f2e27;
      --highlight: #3b3520;
      --mark: #4a3e1a;
      --mark-ink: #f3d480;
      --info: #5090e0;
      --info-light: #182030;
      --shadow: 0 1px 2px rgba(0,0,0,0.4);
      --shadow-pop: 0 8px 24px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
    }
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { transition: background 0.25s, color 0.25s; }
  body { font-family: -apple-system, 'SF Pro Text', 'Helvetica Neue', sans-serif; background: var(--bg); color: var(--ink); font-size: 13.5px; line-height: 1.5; min-height: 100vh; -webkit-font-smoothing: antialiased; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
  button:focus-visible, .btn:focus-visible { outline-offset: 2px; }
  input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }

  /* Layout */
  .app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; transition: grid-template-columns 180ms cubic-bezier(.2,.8,.2,1); }
  .sidebar { background: var(--surface); border-right: 0.5px solid var(--rule); position: sticky; top: 0; height: 100vh; overflow: visible; display: flex; flex-direction: column; }
  .sidebar-inner { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 28px 16px; overflow-y: auto; overflow-x: visible; min-height: 0; }
  .main { padding: 28px 32px; overflow-x: hidden; }
  
  /* Sidebar */
  .logo { font-family: 'Iowan Old Style', 'Charter', Georgia, serif; font-size: 19px; font-weight: 500; color: var(--ink); padding: 4px 12px 6px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 6px; }
  .logo .dot { color: var(--accent); }
  .logo-img { width: 24px; height: 24px; border-radius: 5px; flex-shrink: 0; display: block; }
  .nav-item { display: flex; align-items: center; gap: 9px; padding: 6px 12px; border-radius: 5px; cursor: pointer; color: var(--ink-2); font-size: 13px; transition: background 0.12s, color 0.12s; user-select: none; }
  .nav-item:hover { background: var(--surface-2); color: var(--ink); }
  .nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
  .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
  .nav-section { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.12em; text-transform: uppercase; padding: 18px 12px 6px; }
  .sidebar-footer { margin-top: auto; padding-top: 8px; border-top: 0.5px solid var(--rule); }
  .sidebar-theme { display: flex; gap: 2px; padding: 6px 12px 8px; }
  .sidebar-theme button { flex: 1; height: 26px; border-radius: 5px; color: var(--ink-3); display: grid; place-items: center; transition: background 0.12s, color 0.12s; }
  .sidebar-theme button:hover { background: var(--surface-2); color: var(--ink); }
  .sidebar-theme button.active { background: var(--surface-2); color: var(--ink); box-shadow: var(--shadow); }

  /* Sidebar collapse — desktop only */
  .sidebar-toggle {
    position: absolute; top: 10px; right: -9px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--surface); border: 0.5px solid var(--rule-strong);
    display: grid; place-items: center;
    font-size: 10px; color: var(--ink-2); cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    z-index: 2; line-height: 1; padding: 0;
  }
  .sidebar-toggle:hover { color: var(--ink); background: var(--surface-2); }

  @media (min-width: 901px) {
    html.sidebar-collapsed .app { grid-template-columns: 44px 1fr; }
    html.sidebar-collapsed .sidebar-inner { overflow: visible; padding: 28px 0; }
    html.sidebar-collapsed .sidebar .nav-item { justify-content: center; padding: 7px 0; }
    html.sidebar-collapsed .sidebar .nav-item > span:not(.badge),
    html.sidebar-collapsed .sidebar .nav-section,
    html.sidebar-collapsed .sidebar .logo .logo-pend,
    html.sidebar-collapsed .sidebar .logo .dot,
    html.sidebar-collapsed .sidebar .rate-line,
    html.sidebar-collapsed .sidebar .cur-toggle,
    html.sidebar-collapsed .sidebar #sync-status,
    html.sidebar-collapsed .sidebar .sidebar-sha,
    html.sidebar-collapsed .sidebar .sidebar-theme { display: none; }
    html.sidebar-collapsed .sidebar .logo { padding: 4px 0 6px; justify-content: center; }
    html.sidebar-collapsed .sidebar .sidebar-footer { padding-top: 16px; }
  }

  /* Nav tooltip (shown in collapsed state) */
  .nav-tooltip {
    position: fixed; left: 52px;
    background: var(--ink); color: var(--bg);
    font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 9.5px;
    padding: 4px 8px; border-radius: 4px;
    pointer-events: none; opacity: 0; transition: opacity 100ms;
    z-index: 200; white-space: nowrap;
  }
  .nav-tooltip.visible { opacity: 1; }

  /* Page header */
  .page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
  .page-title { font-family: 'Iowan Old Style', 'Charter', Georgia, serif; font-size: 28px; font-weight: 500; letter-spacing: -0.01em; }
  .page-subtitle { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
  .eyebrow { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; letter-spacing: 0.16em; color: var(--ink-3); text-transform: uppercase; margin-bottom: 4px; }
  #page-transactions .page-header { margin-bottom: 0; }
  
  /* Buttons — global reset so UA stylesheet gray never bleeds through */
  button { background: transparent; border: none; }
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 6px; border: 0.5px solid var(--rule-strong); background: var(--surface); color: var(--ink); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background 0.12s, border-color 0.12s; font-family: inherit; white-space: nowrap; }
  .btn:hover { background: var(--surface-2); }
  .btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
  [data-theme="dark"] .btn-primary,
  [data-theme="auto"] .btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
  [data-theme="dark"] .btn-primary:hover,
  [data-theme="auto"] .btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
  .btn-sm { padding: 4px 10px; font-size: 12px; }
  .btn-danger { color: var(--warn); border-color: rgba(168,61,43,0.25); }
  .btn-danger:hover { background: var(--warn-soft); }
  .btn-warn { color: var(--flag); border-color: rgba(181,100,11,0.3); }
  .btn-warn:hover { background: var(--flag-soft); }
  .btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

  /* ─── DS component utilities ─────────────────── */
  .pane-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }

  /* Cards */
  .card { background: var(--surface); border: 0.5px solid var(--rule); border-radius: var(--radius); padding: 18px 22px; }
  .card.card-dense, .triage-card { padding: 12px 14px; }
  .metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
  .metric { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; }
  .metric-label { font-size: 11.5px; color: var(--ink-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
  .metric-value { font-size: 22px; font-weight: 600; letter-spacing: -0.5px; color: var(--ink); }
  .metric-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
  
  /* Chart area */
  .charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
  #top-merchants div:hover { background: var(--surface-2); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 4px; }
  
  /* Table */
  .table-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
  .filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
  select, input[type="text"], input[type="month"] { background: var(--surface); border: 0.5px solid var(--rule-strong); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px; color: var(--ink); font-family: inherit; outline: none; }
  select:focus, input:focus { border-color: var(--accent); }
  .txn-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .txn-table thead th { text-align: left; padding: 8px 10px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 0.5px solid var(--rule); }
  .txn-table tbody tr { border-bottom: 0.5px solid var(--rule); transition: background 0.1s; }
  .txn-table tbody tr:hover { background: var(--surface-2); }
  .txn-table td { padding: 9px 10px; vertical-align: middle; }
  .txn-table tbody tr:hover .del-btn { opacity: 1; }
  .del-btn { opacity: 0; background: none; border: none; cursor: pointer; color: var(--ink-3); font-size: 15px; padding: 2px 4px; line-height: 1; transition: color 0.1s, opacity 0.1s; }
  .del-btn:hover { color: var(--warn); }
  .txn-table td.amount { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; }
  .txn-table td.amount.debit { color: var(--ink); }
  .txn-table td.amount.credit { color: var(--accent); }
  .merchant { font-weight: 500; color: var(--ink); }

  /* Status badge — mono, uppercase, rectangular (design system §07) */
  .badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 3px; font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; cursor: pointer; border: none; }
  .badge:hover { opacity: 0.85; }
  
  /* Import zone */
  .drop-zone { border: 1.5px dashed var(--rule-strong); border-radius: var(--radius); padding: 36px 24px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
  .drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
  .drop-zone-icon { font-size: 28px; margin-bottom: 10px; }
  .drop-zone-title { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
  .drop-zone-sub { font-size: 13px; color: var(--ink-2); }
  
  /* Toast */
  .toast { position: fixed; bottom: 20px; right: 20px; padding: 10px 16px; background: var(--surface); border: 0.5px solid var(--rule-strong); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); font-size: 13px; color: var(--ink); opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; z-index: 1000; max-width: 320px; }
  .toast.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .toast.toast-good { border-left: 3px solid var(--accent); }
  .toast.toast-warn  { border-left: 3px solid var(--flag); }
  .toast.toast-err   { border-left: 3px solid var(--warn); }
  
  /* Category editor overlay */
  #cat-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 500; align-items: center; justify-content: center; }
  #cat-modal.open { display: flex; }
  .modal-box { background: var(--surface); border-radius: var(--radius); padding: 20px 24px; width: 340px; box-shadow: 0 8px 32px rgba(0,0,0,0.18); }
  .modal-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
  .modal-sub { font-size: 12.5px; color: var(--ink-2); margin-bottom: 16px; }
  .cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 16px; }
  .cat-opt { padding: 7px 6px; border-radius: var(--radius-sm); text-align: center; font-size: 12px; cursor: pointer; transition: filter 0.1s, box-shadow 0.1s; }
  .cat-opt:hover { filter: brightness(0.93); }
  .cat-opt.selected { box-shadow: 0 0 0 2px currentColor; }
  
  /* AI indicator */
  .ai-tag { font-size: 10px; color: var(--ink-3); margin-left: 3px; }
  .btn-rule { background:none; border:0.5px solid var(--accent); border-radius:4px; color:var(--accent); font-size:11px; padding:2px 7px; cursor:pointer; font-family:inherit; white-space:nowrap; }
  .btn-rule:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }

  /* Empty state */
  .empty { text-align: center; padding: 60px 20px; color: var(--ink-2); }
  .empty-state { text-align: center; padding: 56px 32px; color: var(--ink-2); max-width: 420px; margin: 40px auto; }
  .empty-state-glyph { font-size: 40px; opacity: 0.5; margin-bottom: 14px; display: block; }
  .empty-state-title { font-family: 'Iowan Old Style', 'Charter', Georgia, serif; font-size: 18px; font-weight: 500; color: var(--ink); margin-bottom: 8px; letter-spacing: -0.005em; }
  .empty-state-hint { font-size: 14px; color: var(--ink-2); line-height: 1.55; margin-bottom: 20px; }

  /* Tabs */
  .tabs { display: flex; gap: 0; margin-top: 24px; border-bottom: 0.5px solid var(--rule); }
  .tab { padding: 10px 18px 12px; font-size: 13px; cursor: pointer; color: var(--ink-3); background: none; border: none; border-bottom: 2px solid transparent; transition: color 0.12s, border-color 0.12s; margin-bottom: -0.5px; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
  .tab:hover { color: var(--ink-2); }
  .tab.active { color: var(--ink); border-bottom-color: var(--ink); }
  .tab .count { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; padding: 1px 6px; background: var(--surface-2); color: var(--ink-3); border-radius: 99px; font-weight: 500; }
  .tab .count:empty { display: none; }
  .tab.active .count { background: var(--accent-soft); color: var(--accent); }
  .tab.warn .count { background: var(--flag-soft); color: var(--flag); }
  .tab-pane { display: none; padding-top: 28px; }
  .tab-pane.active { display: block; }
  
  /* Loading spinner */
  .spinner { width: 14px; height: 14px; border: 2px solid var(--rule); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
  @keyframes spin { to { transform: rotate(360deg); } }
  
  /* Currency toggle */
  .cur-toggle { display: flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; margin: 0 4px 4px; }
  .cur-btn { flex: 1; padding: 5px 8px; border-radius: 4px; border: none; background: transparent; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; font-family: inherit; transition: background 0.12s, color 0.12s; }
  .cur-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
  .rate-line { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-3); text-align: center; padding-bottom: 8px; }

  /* Bulk action bar */
  .bulk-bar { display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--accent); color: var(--on-accent); border-radius: 8px 8px 0 0; margin-bottom: -1px; flex-wrap: wrap; }
  .bulk-bar.visible { display: flex; }
  .bulk-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
  .bulk-label { font-size: 12.5px; font-weight: 500; color: var(--on-accent); white-space: nowrap; }
  .bulk-bar button, .bulk-bar select, .bulk-bar input[type="text"] { padding: 4px 10px; font-size: 12px; font-family: inherit; background: color-mix(in srgb, var(--on-accent) 15%, transparent); color: var(--on-accent); border: none; border-radius: 4px; cursor: pointer; }
  .bulk-bar input[type="text"] { cursor: text; min-width: 120px; padding: 4px 8px; }
  .bulk-bar button:hover { background: color-mix(in srgb, var(--on-accent) 25%, transparent); }
  .bulk-bar button.danger { background: color-mix(in srgb, #ff6450 30%, transparent); }
  .bulk-bar .bar-divider { width: 0.5px; height: 16px; background: color-mix(in srgb, var(--on-accent) 20%, transparent); flex-shrink: 0; align-self: center; }
  .txn-row input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
  .txn-row.row-selected { background: rgba(42,95,78,0.08); }

  /* ── Transactions redesign ─────────────────────────────────────── */

  /* Triage (Needs Review pane) */
  .triage-intro { font-family: 'Iowan Old Style', 'Charter', Georgia, serif; font-size: 17px; color: var(--ink-2); font-style: italic; max-width: 68ch; text-wrap: pretty; margin-bottom: 4px; }
  .triage-intro .hi { color: var(--ink); font-style: normal; font-weight: 500; }
  .triage-progress { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-top: 14px; display: flex; align-items: center; gap: 10px; }
  .triage-bar { flex: 1; max-width: 260px; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
  .triage-bar-fill { height: 100%; background: var(--accent); transition: width 0.3s ease; border-radius: 2px; }
  .triage-actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }

  /* Triage cards (group review redesign) */
  .triage-group { margin-top: 32px; }
  .triage-group-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 0.5px solid var(--rule); }
  .triage-group-title { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; display: flex; align-items: center; gap: 10px; }
  .priority-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
  .priority-dot.high { background: var(--flag); }
  .priority-dot.med { background: var(--flag); }
  .priority-dot.low { background: var(--ink-3); }
  .triage-group-sub { font-size: 12px; color: var(--ink-3); }
  .triage-card { background: var(--surface); border: 0.5px solid var(--rule); border-radius: 7px; padding: 12px 14px; margin-bottom: 6px; display: grid; grid-template-columns: 1fr auto; gap: 12px 18px; align-items: center; transition: border-color 0.12s; }
  .triage-card:hover { border-color: var(--rule-strong); }
  .triage-card.gp-focused { outline: 2px solid var(--accent) !important; outline-offset: -2px; border-color: var(--accent); }
  .triage-card.resolved { opacity: 0.4; pointer-events: none; }
  .tc-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .tc-headline { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .tc-name-block { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; }
  .tc-desc { font-size: 13.5px; font-weight: 500; letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tc-badge { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 9px; letter-spacing: 0.08em; padding: 1px 5px; border-radius: 3px; text-transform: uppercase; font-weight: 600; flex-shrink: 0; }
  .tc-badge.new { background: var(--accent-soft); color: var(--accent); }
  .tc-badge.warn { background: var(--flag-soft); color: var(--flag); }
  .tc-amount { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
  .tc-meta { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; letter-spacing: 0.02em; color: var(--ink-3); }
  .tc-meta .sep { margin: 0 5px; opacity: 0.5; }
  .tc-meta .yr, .c-date .yr { color: var(--ink-3); opacity: 0.7; margin-left: 2px; letter-spacing: 0.02em; }
  .c-date .yr { font-size: 0.92em; }
  .tc-context { margin-top: 3px; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; display: flex; align-items: center; gap: 6px; min-height: 16px; }
  .tc-context strong { color: var(--ink-2); font-weight: 500; }
  .kagi-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: 0.7; flex-shrink: 0; }
  .kagi-dot.loading { animation: kagi-pulse 1.2s ease-in-out infinite; }
  @keyframes kagi-pulse { 0%,100% { opacity: 0.25; } 50% { opacity: 0.8; } }
  .tc-actions { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
  .tc-action { padding: 5px 10px; font-size: 11.5px; border-radius: 5px; background: var(--surface-2); color: var(--ink); border: 0.5px solid transparent; transition: background 0.12s, border-color 0.12s; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-weight: 500; cursor: pointer; font-family: inherit; }
  .tc-action:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
  .tc-action.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
  .tc-action.primary:hover { background: var(--accent-dark, var(--accent)); border-color: var(--accent-dark, var(--accent)); }
  .tc-action.primary:disabled { opacity: 0.4; cursor: not-allowed; }
  .tc-action.primary:disabled:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
  .tc-action.icon { padding: 5px 7px; background: transparent; color: var(--ink-3); }
  .tc-action.icon:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; }
  .tc-action .kbd { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 9.5px; padding: 0 4px; background: rgba(0,0,0,0.08); border-radius: 2px; color: var(--ink-3); }
  .tc-action.primary .kbd { background: rgba(255,255,255,0.2); color: rgba(255,255,255,0.8); }
  .tc-menu { position: relative; }
  .tc-menu-pop { position: absolute; top: 100%; right: 0; margin-top: 4px; background: var(--surface); border: 0.5px solid var(--rule-strong); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,0.12); padding: 4px; min-width: 160px; z-index: 50; display: none; }
  .tc-menu.open .tc-menu-pop { display: block; }
  .tc-menu-item { padding: 6px 10px; font-size: 12px; border-radius: 4px; cursor: pointer; color: var(--ink); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
  .tc-menu-item:hover { background: var(--surface-2); }
  @media (max-width: 640px) { .triage-card { grid-template-columns: 1fr; } }

  /* Duplicate pairs in triage */
  .dup-section { margin-top: 32px; }
  .dup-section-head { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 0.5px solid var(--rule); }
  .dup-pair { background: var(--surface); border: 0.5px solid var(--rule); border-radius: 7px; margin-bottom: 8px; overflow: hidden; }
  .dup-row { display: flex; align-items: center; gap: 14px; padding: 9px 14px; border-bottom: 0.5px solid var(--rule); font-size: 12.5px; }
  .dup-row:last-of-type { border-bottom: none; }
  .dup-row .d-date { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-3); width: 72px; flex-shrink: 0; }
  .dup-row .d-desc { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; gap: 1px; }
  .dup-row .d-desc .d-raw { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; font-weight: 400; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dup-row .d-src { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; color: var(--ink-2); flex-shrink: 0; }
  .dup-row .d-amt { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 12.5px; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
  .dup-actions { display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--surface-2); border-top: 0.5px solid var(--rule); flex-wrap: wrap; }
  .dup-actions .d-hint { font-size: 11px; flex: 1; min-width: 100%; order: -1; margin-bottom: 2px; }

  /* Inline category picker (floating) */
  #inline-cat-picker { position: fixed; background: var(--surface); border: 0.5px solid var(--rule-strong); border-radius: 8px; padding: 6px; box-shadow: 0 6px 20px rgba(0,0,0,0.14); z-index: 300; display: none; width: 220px; max-height: 340px; overflow-y: auto; }
  #inline-cat-picker.show { display: block; }
  .icp-item { padding: 6px 10px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 13px; }
  .icp-item:hover { background: var(--accent-soft); color: var(--accent); }
  .icp-item.current { font-weight: 600; color: var(--accent); }
  .icp-emoji { width: 18px; text-align: center; font-size: 13px; }

  /* Excluded transactions */
  .txn-row.excluded-row { opacity: 0.45; }
  .txn-row.excluded-row .c-desc { text-decoration: line-through; }

  /* Toolbar (All transactions pane) */
  .toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 0.5px solid var(--rule); border-radius: 8px 8px 0 0; border-bottom: none; flex-wrap: wrap; }
  .txn-search { flex: 1; min-width: 180px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface-2); border-radius: 6px; border: 0.5px solid transparent; transition: border-color 0.12s; }
  .txn-search:focus-within { border-color: var(--accent); background: var(--surface); }
  .txn-search svg { opacity: 0.5; flex-shrink: 0; }
  .txn-search input { flex: 1; border: none; outline: none; background: transparent; font-family: inherit; font-size: 13px; color: var(--ink); }
  .txn-search .slashkey { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; padding: 2px 5px; background: var(--surface); border: 0.5px solid var(--rule); border-radius: 3px; color: var(--ink-3); }
  .filter-pill { padding: 6px 10px; font-size: 12px; background: var(--surface-2); color: var(--ink-2); border-radius: 6px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; border: 0.5px solid transparent; }
  .filter-pill:hover { background: var(--accent-soft); color: var(--accent); }
  .filter-pill select { border: none; outline: none; background: transparent; font-family: inherit; font-size: 12px; color: inherit; cursor: pointer; padding: 0; appearance: none; }
  .dr-pill { position: relative; cursor: pointer; user-select: none; }
  .dr-pill.active { background: var(--accent-soft); color: var(--accent); }
  .dr-dropdown { display: none; position: absolute; top: calc(100% + 6px); left: 0; background: var(--surface); border: 0.5px solid var(--rule); border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.10); padding: 6px; min-width: 200px; z-index: 200; }
  .dr-dropdown.open { display: block; }
  .dr-preset { padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
  .dr-preset:hover { background: var(--accent-soft); color: var(--accent); }
  .dr-preset.selected { color: var(--accent); }
  .dr-divider { margin: 4px 6px; border: none; border-top: 0.5px solid var(--rule); }
  .dr-custom { padding: 4px 4px 2px; display: flex; align-items: center; gap: 6px; }
  .dr-custom select { flex: 1; min-width: 0; border: 0.5px solid var(--rule); border-radius: 5px; padding: 4px 6px; font-family: inherit; font-size: 11.5px; color: var(--ink); background: var(--surface-2); outline: none; cursor: pointer; }
  .dr-custom-label { font-size: 10px; color: var(--ink-3); width: 36px; flex-shrink: 0; }
  .toolbar-cur { display: flex; background: var(--surface-2); border-radius: 6px; padding: 2px; }
  .toolbar-cur-pill { padding: 4px 10px; font-size: 11.5px; font-weight: 500; border-radius: 4px; color: var(--ink-3); cursor: pointer; transition: background 0.12s, color 0.12s; border: none; background: transparent; font-family: inherit; }
  .toolbar-cur-pill.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
  .toolbar-excl { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); cursor: pointer; }
  .toolbar-excl input { cursor: pointer; accent-color: var(--accent); }

  /* Transactions CSS-grid table */
  .txn-grid { background: var(--surface); border: 0.5px solid var(--rule); border-radius: 0 0 8px 8px; border-top: none; overflow: hidden; font-variant-numeric: tabular-nums; }
  .txn-head, .txn-row { display: grid; grid-template-columns: 28px 86px 1fr 130px 140px 62px 120px 110px; gap: 14px; padding: 0 18px; align-items: center; }
  .txn-head { padding-top: 10px; padding-bottom: 10px; border-bottom: 0.5px solid var(--rule); background: var(--surface-2); font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--ink-3); text-transform: uppercase; cursor: default; }
  .txn-head .c-amt { text-align: right; }
  .txn-row { padding-top: 9px; padding-bottom: 9px; border-bottom: 0.5px solid var(--rule); font-size: 12.5px; transition: background 0.08s; cursor: pointer; }
  .txn-row:hover { background: var(--surface-2); }
  .txn-row:hover .del-btn { opacity: 1; }
  .txn-row.focused { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
  .txn-row:last-child { border-bottom: none; }
  .txn-row .c-date { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-3); letter-spacing: 0.02em; }
  .txn-row .c-desc { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .txn-row .c-source { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .txn-row .c-cat { display: flex; align-items: center; gap: 6px; }
  .txn-row .c-cur { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; color: var(--ink-3); }
  .txn-row .c-amt { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 12.5px; text-align: right; font-weight: 500; letter-spacing: -0.01em; }
  .txn-row .c-amt.credit { color: var(--accent); }
  .txn-row .c-alt { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-3); text-align: right; }
  .txn-row.row-review { background: color-mix(in srgb, var(--flag) 5%, transparent); }
  .txn-row.row-review:hover { background: color-mix(in srgb, var(--flag) 9%, transparent); }
  .txn-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; background: var(--surface-2); font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-3); border-top: 0.5px solid var(--rule); border-radius: 0 0 8px 8px; letter-spacing: 0.04em; }
  .txn-footer strong { color: var(--ink); font-weight: 500; }
  .txn-footer .totals { display: flex; gap: 20px; }
  /* Category chip (inline, tinted) */
  .cat-chip { font-size: 11.5px; padding: 2px 7px; border-radius: 4px; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; transition: filter 0.12s; border: 1.5px solid; font-weight: 500; white-space: nowrap; }
  .cat-chip:hover { filter: brightness(0.93); }
  .cat-chip .emoji { font-size: 11px; }

  /* Keyboard hint footer — shown on All tab */
  .kbd-footer { position: fixed; bottom: 16px; right: 20px; font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; color: var(--ink-3); background: var(--surface); border: 0.5px solid var(--rule); padding: 5px 9px; border-radius: 6px; display: none; gap: 12px; letter-spacing: 0.04em; box-shadow: 0 1px 3px rgba(0,0,0,0.04); opacity: 0.85; }
  .kbd-footer .key { background: var(--surface-2); padding: 1px 5px; border-radius: 3px; color: var(--ink-2); font-weight: 600; margin-right: 4px; }
  body.txn-tab-all .kbd-footer { display: flex; }

  /* Import log */
  .import-log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .import-log-table th { text-align: left; padding: 7px 12px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 0.5px solid var(--rule); }
  .import-log-table td { padding: 10px 12px; border-bottom: 0.5px solid var(--rule); vertical-align: middle; }
  .import-log-table tr:last-child td { border-bottom: none; }
  .import-log-table .il-file { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11.5px; color: var(--ink-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .import-log-table .il-count { font-weight: 600; color: var(--accent); }
  .import-log-table .il-date { color: var(--ink-2); white-space: nowrap; font-size: 12px; }
  .import-log-table .il-source { font-weight: 500; }

  /* Scrollbar */
  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 3px; }

  .hidden { display: none !important; }
  .flex { display: flex; }
  
  /* Category chips — tinted + outlined per design system §02-B
     treatment: pale tint bg, 1.5px solid color border, chip shape  */
  .badge[class*=" cat-"], .badge[class*="cat-"] { border-radius: 4px; font-family: inherit; font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; padding: 2px 7px; }
  .cat-dining        { background: #f1dfd2; border: 1.5px solid #c2734a; color: #c2734a; }
  .cat-grocery       { background: #e5e9d0; border: 1.5px solid #7a8b3d; color: #7a8b3d; }
  .cat-airfare       { background: #d9e0ea; border: 1.5px solid #4a6b88; color: #4a6b88; }
  .cat-travel        { background: #dfe6ec; border: 1.5px solid #6b8a9e; color: #6b8a9e; }
  .cat-transport     { background: #dae0e5; border: 1.5px solid #526b7a; color: #526b7a; }
  .cat-shopping      { background: #ece1d4; border: 1.5px solid #8b6a4e; color: #8b6a4e; }
  .cat-sports        { background: #e4ecdb; border: 1.5px solid #6d8a5a; color: #6d8a5a; }
  .cat-health        { background: #eeccc5; border: 1.5px solid #a04b3a; color: #a04b3a; }
  .cat-subscription  { background: #e9dbec; border: 1.5px solid #8a6090; color: #8a6090; }
  .cat-utilities     { background: #f3e4bf; border: 1.5px solid #b88a2e; color: #b88a2e; }
  .cat-rent          { background: #d3dcd6; border: 1.5px solid #2f4a3e; color: #2f4a3e; }
  .cat-taxes         { background: #e0d5cd; border: 1.5px solid #6b4a3e; color: #6b4a3e; }
  .cat-professional  { background: #dedfe8; border: 1.5px solid #5a5e7d; color: #5a5e7d; }
  .cat-education     { background: #ecdfc1; border: 1.5px solid #8a6e2e; color: #8a6e2e; }
  .cat-people        { background: #e8e5cd; border: 1.5px solid #7e7a3d; color: #7e7a3d; }
  .cat-cash          { background: #dfdfd5; border: 1.5px solid #6a6d5a; color: #6a6d5a; }
  .cat-transfer      { background: #ecebe4; border: 1.5px solid #9e9a8a; color: #9e9a8a; }
  .cat-income        { background: #d3e0d9; border: 1.5px solid #2a5f4e; color: #2a5f4e; }
  .cat-other         { background: #e8e4dd; border: 1.5px solid #8a7f70; color: #8a7f70; }
  /* legacy orphan */
  .cat-entertainment { background: #e9dbec; border: 1.5px solid #8a6090; color: #8a6090; }

  [data-theme="dark"] .cat-dining,
  [data-theme="dark"] .cat-grocery,
  [data-theme="dark"] .cat-airfare,
  [data-theme="dark"] .cat-travel,
  [data-theme="dark"] .cat-transport,
  [data-theme="dark"] .cat-shopping,
  [data-theme="dark"] .cat-sports,
  [data-theme="dark"] .cat-health,
  [data-theme="dark"] .cat-subscription,
  [data-theme="dark"] .cat-utilities,
  [data-theme="dark"] .cat-rent,
  [data-theme="dark"] .cat-taxes,
  [data-theme="dark"] .cat-professional,
  [data-theme="dark"] .cat-education,
  [data-theme="dark"] .cat-people,
  [data-theme="dark"] .cat-cash,
  [data-theme="dark"] .cat-transfer,
  [data-theme="dark"] .cat-income,
  [data-theme="dark"] .cat-other,
  [data-theme="dark"] .cat-entertainment { filter: brightness(0.75) saturate(0.85); }

  @media (prefers-color-scheme: dark) {
    [data-theme="auto"] .cat-dining,
    [data-theme="auto"] .cat-grocery,
    [data-theme="auto"] .cat-airfare,
    [data-theme="auto"] .cat-travel,
    [data-theme="auto"] .cat-transport,
    [data-theme="auto"] .cat-shopping,
    [data-theme="auto"] .cat-sports,
    [data-theme="auto"] .cat-health,
    [data-theme="auto"] .cat-subscription,
    [data-theme="auto"] .cat-utilities,
    [data-theme="auto"] .cat-rent,
    [data-theme="auto"] .cat-taxes,
    [data-theme="auto"] .cat-professional,
    [data-theme="auto"] .cat-education,
    [data-theme="auto"] .cat-people,
    [data-theme="auto"] .cat-cash,
    [data-theme="auto"] .cat-transfer,
    [data-theme="auto"] .cat-income,
    [data-theme="auto"] .cat-other,
    [data-theme="auto"] .cat-entertainment { filter: brightness(0.75) saturate(0.85); }
  }
  
  /* ── Keyboard review mode ────────────────────────────────────────────────── */
  tr.kb-focused > td { background: var(--flag-soft) !important; }
  .txn-card.kb-focused { border-color: var(--flag) !important; border-width: 1.5px !important; background: var(--flag-soft); }
  .gp-focused { outline: 2px solid var(--accent) !important; outline-offset: -2px; }

  /* ── Full-screen swipe review overlay (mobile) ───────────────────────────── */
  #fs-review-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: var(--bg);
    display: flex; flex-direction: column;
  }
  .fs-review-card {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 20px;
    padding: 36px 28px;
    text-align: center;
    cursor: grab;
    user-select: none;
    touch-action: pan-y;
    will-change: transform;
    /* default: animated transitions for snap-back and exit */
    transition: transform 0.25s cubic-bezier(.22,.61,.36,1), opacity 0.25s, background 0.1s;
  }
  .fs-review-card.dragging { transition: none; }

  @media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
  }
  @media (max-width: 640px) {
    .charts-row { grid-template-columns: 1fr; }
    /* Remove overflow-x:hidden so child scroll containers can work */
    .main { padding: 16px; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); overflow-x: visible; }
    #toast { bottom: calc(72px + env(safe-area-inset-bottom, 16px)); right: 16px; }

    /* ── Dashboard polish ──────────────────────────────────────────────────── */
    /* Page header: stack title above filter control on narrow screens */
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
    .page-title { font-size: 18px; }
    /* Metric cards: tighter font so large amounts (HK$123,456) fit in 2-col grid */
    .metric-grid { margin-bottom: 16px; gap: 10px; }
    .metric-value { font-size: 18px; }
    .metric { padding: 12px 14px; }
    /* Cards: reduce side padding so content breathes on narrow screens */
    .card { padding: 14px 14px; }
    /* charts-row: tighter vertical gap between the two single-col cards */
    .charts-row { gap: 10px; margin-bottom: 16px; }
    /* Prevent iOS Safari auto-zoom on input focus (triggers when font-size < 16px) */
    select, input[type="text"], input[type="month"], input[type="number"] { font-size: 16px; }

    /* ── M3: filter bar — search full-width, selects in scrollable strip ──── */
    .table-header { flex-direction: column; align-items: stretch; }
    .filter-row { flex-direction: column; gap: 8px; }
    .filter-row > div:first-child { width: 100%; }
    .filter-row > div:first-child input[type="text"] { width: 100% !important; box-sizing: border-box; }
    .filter-selects {
      display: flex; gap: 8px;
      overflow-x: auto; -webkit-overflow-scrolling: touch;
      padding-bottom: 2px; /* prevent clipping of focus ring */
    }
    .filter-selects select,
    .filter-selects input[type="month"] { flex-shrink: 0; }

    /* ── Transaction cards (replaces table on mobile) ──────────────────────── */
    .txn-cards { display: flex; flex-direction: column; gap: 8px; }
    .txn-card {
      background: var(--surface);
      border: 0.5px solid var(--rule);
      border-radius: 10px;
      padding: 12px 14px;
    }
    .txn-card-review { border-left: 3px solid var(--warning); }
    .txn-card-main {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 8px;
      margin-bottom: 8px;
    }
    .txn-card-merchant {
      font-size: 14px;
      font-weight: 500;
      color: var(--ink);
      word-break: break-word;
    }
    .txn-card-meta {
      font-size: 12px;
      color: var(--ink-2);
      margin-top: 2px;
    }
    .txn-card-right { text-align: right; flex-shrink: 0; }
    .txn-card-amount {
      font-size: 15px;
      font-weight: 600;
      white-space: nowrap;
    }
    .txn-card-amount.credit { color: var(--success); }
    .txn-card-native { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
    .txn-card-footer {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
    }
    .txn-card-actions {
      margin-left: auto;
      display: flex;
      gap: 4px;
      align-items: center;
      flex-shrink: 0;
    }

    /* ── Transactions: hide table header, remove table border in card mode ── */
    .txn-head { display: none; }
    .txn-grid { border: none; border-radius: 0; background: transparent; overflow: visible; }
    .kbd-footer { display: none !important; }

    /* ── Filter trigger button (mobile only) ──────────────────────────────── */
    .mobile-filter-trigger {
      display: flex; align-items: center; gap: 8px;
      padding: 0 0 12px;
    }
    .mobile-filter-btn {
      display: flex; align-items: center; gap: 6px;
      padding: 7px 12px; border-radius: 20px;
      background: var(--surface); border: 0.5px solid var(--rule);
      font-size: 13px; color: var(--ink-2); cursor: pointer;
    }
    .mobile-filter-btn .filter-count {
      display: inline-flex; align-items: center; justify-content: center;
      min-width: 18px; height: 18px; border-radius: 9px;
      background: var(--accent); color: var(--on-accent);
      font-size: 10px; font-weight: 600; padding: 0 4px;
    }
    .mobile-txn-count {
      font-size: 12px; color: var(--ink-3); margin-left: auto;
    }

    /* ── Filter bottom sheet ──────────────────────────────────────────────── */
    .filter-backdrop {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.35); z-index: 200;
    }
    .filter-backdrop.open { display: block; }
    .toolbar {
      position: fixed; bottom: calc(60px + env(safe-area-inset-bottom, 0px));
      left: 0; right: 0; z-index: 201;
      background: var(--surface); border-top: 0.5px solid var(--rule);
      border-radius: 14px 14px 0 0;
      padding: 8px 16px 16px;
      flex-direction: column; gap: 10px;
      display: none;
      box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    }
    .toolbar.sheet-open { display: flex; }
    .filter-sheet-handle {
      display: block; width: 36px; height: 4px;
      background: var(--rule-strong); border-radius: 2px;
      margin: 4px auto 8px; flex-shrink: 0;
    }
    /* All filter controls full-width inside sheet */
    .toolbar .txn-search { width: 100%; }
    .toolbar .filter-pill { width: 100%; }
    .toolbar .filter-pill select { width: 100%; appearance: auto; }
    .toolbar .dr-pill { width: 100%; }
    .toolbar .toolbar-cur { margin: 0; }
    .toolbar .toolbar-excl { font-size: 14px; }

    /* ── Bulk bar: pin above bottom nav on mobile ─────────────────────────── */
    .bulk-bar.visible {
      position: fixed; bottom: calc(60px + env(safe-area-inset-bottom, 0px));
      left: 0; right: 0; z-index: 150;
      border-radius: 0; margin-bottom: 0;
      flex-direction: column; align-items: flex-start; gap: 6px;
    }
    .bulk-bar.visible .bulk-bar-actions { flex-wrap: wrap; gap: 6px; }

    /* ── Uncategorised card: flag-soft background ─────────────────────────── */
    .txn-card-review { background: var(--flag-soft) !important; border-left: 3px solid var(--flag); }
  }

  /* ── Bottom tab navigation (mobile only) ───────────────────────────────── */
  .bottom-nav {
    display: none;
  }
  @media (max-width: 640px) {
    .bottom-nav {
      display: flex;
      position: fixed;
      bottom: 0; left: 0; right: 0;
      background: var(--surface);
      border-top: 0.5px solid var(--rule);
      /* Push content above iPhone home indicator */
      padding-bottom: env(safe-area-inset-bottom, 0px);
      z-index: 200;
      /* Subtle blur — matches iOS native feel */
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      background: color-mix(in srgb, var(--surface) 92%, transparent);
    }
    .bnav-item {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      padding: 9px 4px 7px;
      cursor: pointer;
      color: var(--ink-3);
      font-size: 10px;
      font-weight: 500;
      letter-spacing: 0.02em;
      transition: color 0.12s;
      -webkit-tap-highlight-color: transparent;
      user-select: none;
      min-width: 44px; /* Apple HIG minimum tap target */
    }
    .bnav-item:active { opacity: 0.6; }
    .bnav-item.active { color: var(--accent); }
    .bnav-icon {
      width: 22px;
      height: 22px;
      flex-shrink: 0;
    }
  }

  #page-dashboard {
    background: var(--bg);
    min-height: calc(100vh - 56px);
  }

  /* ── Overview v4 ──────────────────────────────────────────────────────────── */
  #page-dashboard { padding: 0; }
  .ov4-wrap { max-width: 900px; padding: 28px 0 64px; }

  /* Page top */
  .ov4-page-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; gap: 16px; flex-wrap: wrap; }
  .ov4-eyebrow { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-3); }
  .ov4-period-chips { display: flex; gap: 4px; }
  .ov4-chip { font-size: 12.5px; font-weight: 500; padding: 5px 12px; border: 0.5px solid var(--rule); border-radius: 99px; background: var(--surface); color: var(--ink-2); cursor: pointer; font-family: inherit; transition: background 0.1s, color 0.1s; white-space: nowrap; }
  .ov4-chip:hover:not(.disabled) { background: var(--surface-2); color: var(--ink); }
  .ov4-chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
  .ov4-chip.disabled { opacity: 0.4; cursor: default; }

  /* Headline + three answers */
  .ov4-headline-wrap { margin-bottom: 32px; }
  .ov4-headline { font-family: 'Iowan Old Style', Charter, Georgia, serif; font-size: 30px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; color: var(--ink); margin-bottom: 18px; text-wrap: balance; }
  .ov4-answer-stack { display: flex; flex-direction: column; gap: 14px; }
  .ov4-answer-row { display: flex; gap: 14px; align-items: flex-start; }
  .ov4-glyph { font-size: 18px; line-height: 1.5; flex-shrink: 0; width: 24px; text-align: center; }
  .ov4-q { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin-bottom: 3px; }
  .ov4-a { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
  .ov4-hi { font-weight: 600; color: var(--ink); }
  .ov4-num { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-variant-numeric: tabular-nums; }
  .ov4-cat { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }

  /* Metric strip */
  .ov4-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 0.5px solid var(--rule-strong); border-bottom: 0.5px solid var(--rule-strong); margin-bottom: 36px; }
  @media (max-width: 640px) { .ov4-strip { grid-template-columns: repeat(2, 1fr); } }
  .ov4-strip-cell { padding: 18px 20px 16px; border-right: 0.5px solid var(--rule); }
  .ov4-strip-cell:last-child { border-right: none; }
  .ov4-strip-label { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin-bottom: 8px; }
  .ov4-strip-val { font-family: 'Iowan Old Style', Charter, Georgia, serif; font-size: 24px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.1; margin-bottom: 5px; }
  .ov4-strip-sub { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; color: var(--ink-3); }
  .ov4-strip-lumps { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; color: var(--ink-3); margin-top: 5px; line-height: 1.4; }
  .ov4-delta-pos { color: var(--bad); }
  .ov4-delta-neg { color: var(--good); }
  .ov4-delta-up  { color: var(--bad); }
  .ov4-delta-dn  { color: var(--good); }

  /* Sections */
  .ov4-section { margin-bottom: 40px; }
  .ov4-sect-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
  .ov4-sect-title { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); margin-bottom: 3px; }
  .ov4-sect-sub { font-size: 12.5px; color: var(--ink-3); }
  .ov4-clear-focus { color: var(--accent); cursor: pointer; text-decoration: none; }
  .ov4-clear-focus:hover { text-decoration: underline; }

  /* Card base */
  .ov4-card { background: var(--surface); border: 0.5px solid var(--rule); border-radius: 8px; }

  /* Mini segmented (merchant mode toggle) */
  .ov4-mini-seg { display: inline-flex; background: var(--surface-2); border-radius: 6px; padding: 3px; gap: 2px; flex-shrink: 0; }
  .ov4-mini-seg button { font-size: 11.5px; font-weight: 500; padding: 4px 10px; border: none; border-radius: 4px; background: transparent; color: var(--ink-2); cursor: pointer; font-family: inherit; white-space: nowrap; transition: background 0.1s, color 0.1s; }
  .ov4-mini-seg button:hover { color: var(--ink); }
  .ov4-mini-seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

  /* Merchant leaderboard */
  .ov4-merch-card { overflow: hidden; }
  .ov4-merch-row { display: grid; grid-template-columns: 28px 1fr 120px 72px 80px; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 0.5px solid var(--rule); cursor: default; transition: background 0.1s; }
  .ov4-merch-row:last-child { border-bottom: none; }
  .ov4-merch-row:hover { background: var(--surface-2); }
  .ov4-merch-rank { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-3); }
  .ov4-merch-name { font-size: 13px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ov4-merch-meta { display: block; font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; color: var(--ink-3); font-weight: 400; margin-top: 1px; }
  .ov4-merch-bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
  .ov4-merch-bar-fill { height: 100%; border-radius: 2px; opacity: 0.78; }
  .ov4-merch-pill { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 3px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ov4-merch-amt { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; }
  @media (max-width: 640px) { .ov4-merch-row { grid-template-columns: 24px 1fr 80px; } .ov4-merch-bar, .ov4-merch-pill { display: none; } }

  /* Takeaway cards */
  .ov4-takeaway-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
  @media (max-width: 600px) { .ov4-takeaway-grid { grid-template-columns: 1fr; } }
  .ov4-takeaway-card { border: 0.5px solid var(--rule); border-radius: 6px; padding: 18px 20px 14px; cursor: pointer; transition: border-color 0.1s, background 0.1s; }
  .ov4-takeaway-card:hover { border-color: var(--rule-strong); }
  .ov4-takeaway-card.focused { border-color: var(--ink-2); background: color-mix(in srgb, var(--ink) 2%, var(--surface)); }
  .ov4-tc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
  .ov4-tc-cat { font-size: 13px; font-weight: 500; color: var(--ink-2); }
  .ov4-tc-pct { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-3); }
  .ov4-tc-pct.up { color: var(--bad); }
  .ov4-tc-pct.dn { color: var(--good); }
  .ov4-tc-line { font-family: 'Iowan Old Style', Charter, Georgia, serif; font-size: 15.5px; line-height: 1.4; color: var(--ink); margin: 8px 0 10px; }
  .ov4-tc-foot { display: flex; justify-content: space-between; font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); margin-top: 8px; }
  .ov4-spark { width: 100%; height: 36px; overflow: visible; }

  /* Show-more toggle + small multiples */
  .ov4-more-cats { margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--rule); }
  .ov4-more-toggle { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); background: none; border: none; cursor: pointer; padding: 4px 0; transition: color 0.1s; }
  .ov4-more-toggle:hover { color: var(--ink); }
  .ov4-sm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
  @media (max-width: 600px) { .ov4-sm-grid { grid-template-columns: repeat(2, 1fr); } }
  .ov4-sm-cell { border: 0.5px solid var(--rule); border-radius: 5px; padding: 12px 14px 10px; cursor: pointer; transition: border-color 0.1s; }
  .ov4-sm-cell:hover { border-color: var(--rule-strong); }
  .ov4-sm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
  .ov4-sm-name { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
  .ov4-sm-val { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink); }
  .ov4-mo { font-size: 10px; color: var(--ink-3); margin-left: 2px; }
  .ov4-sm-foot { display: flex; justify-content: space-between; font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; color: var(--ink-3); margin-top: 6px; }

  /* Discretionary ribbon */
  .ov4-ribbon-card { padding: 16px 20px 14px; }
  .ov4-ribbon-axis { display: grid; grid-template-columns: 80px 1fr 88px; margin-bottom: 4px; }
  .ov4-ribbon-axis > div { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
  .ov4-ribbon-axis > :nth-child(2) { display: grid; grid-template-columns: repeat(12, 1fr); }
  .ov4-ax-end { text-align: right; }
  .ov4-ribbon-row { display: grid; grid-template-columns: 80px 1fr 88px; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 0.5px dashed var(--rule); transition: opacity 0.15s; }
  .ov4-ribbon-row:last-child { border-bottom: none; }
  .ov4-ribbon-lbl { font-size: 12.5px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 0.15s; }
  .ov4-ribbon-svg { width: 100%; height: 28px; overflow: visible; display: block; }
  .ov4-ribbon-total { font-family: 'Iowan Old Style', Charter, Georgia, serif; font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); }
  .ov4-ribbon-pct { display: block; font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; color: var(--ink-3); text-align: right; }

  /* Mosaic */
  .ov4-mosaic-card { padding: 16px 20px; overflow-x: auto; }
  .ov4-mosaic-grid { display: grid; min-width: 600px; }
  .ov4-corner { }
  .ov4-col-head { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); text-align: center; padding-bottom: 6px; }
  .ov4-row-head { font-size: 12px; font-weight: 500; color: var(--ink-2); padding: 4px 6px 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background 0.1s, color 0.1s; border-radius: 3px; }
  .ov4-mosaic-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; transition: opacity 0.15s; }
  .ov4-cell-lbl { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 9.5px; font-variant-numeric: tabular-nums; text-align: center; }

  /* Trend chart */
  .ov4-trend-svg { width: 100%; height: 160px; overflow: visible; }

  /* Tooltip */
  .ov4-tt { position: fixed; z-index: 9999; background: var(--ink); color: var(--surface); font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; padding: 5px 9px; border-radius: 4px; pointer-events: none; white-space: nowrap; transform: translateY(-100%); }

  /* ── Settings redesign ─────────────────────────────────────────────────── */
  .settings-shell { display: flex; flex-direction: column; min-height: 100%; margin: -28px -32px; }
  .settings-sub { padding: 0 32px; border-bottom: 0.5px solid var(--rule); background: var(--surface); position: sticky; top: 0; z-index: 10; }
  .settings-sub-title-row { display: flex; align-items: flex-end; gap: 10px; padding: 24px 0 0; }
  .settings-sub-title-row h2 { font-family: 'Iowan Old Style', Charter, Georgia, serif; font-size: 28px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); margin: 0; flex: 1; }
  .settings-sub-title-row .btn-new-rule { margin-bottom: 3px; display: none; }
  .settings-sub-title-row .btn-new-rule.visible { display: inline-flex; }
  .settings-sub-list { display: flex; gap: 0; overflow-x: auto; margin-top: 14px; }
  .settings-sub-list::-webkit-scrollbar { display: none; }
  .settings-sub-item { display: flex; align-items: center; gap: 7px; padding: 10px 14px 12px; font-size: 13px; font-weight: 500; color: var(--ink-3); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; transition: color 0.12s, border-color 0.12s; }
  .settings-sub-item:hover { color: var(--ink); }
  .settings-sub-item.active { color: var(--ink); border-bottom-color: var(--accent); }
  .settings-sub-item .sub-count { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; color: var(--ink-3); background: var(--surface-2); padding: 1px 6px; border-radius: 3px; font-weight: 600; letter-spacing: 0.02em; }
  .settings-sub-item.active .sub-count { background: var(--accent-soft); color: var(--accent); }
  .settings-panes { flex: 1; }
  .settings-pane { padding: 32px 44px 80px; display: none; }
  .settings-pane.active { display: block; }
  .st-pane-title { font-family: 'Iowan Old Style', Charter, Georgia, serif; font-size: 28px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 4px; }
  .st-pane-desc { color: var(--ink-3); font-size: 13.5px; max-width: 60ch; line-height: 1.5; margin-bottom: 28px; }
  .setting-group { background: var(--surface); border: 0.5px solid var(--rule); border-radius: 8px; margin-bottom: 18px; overflow: hidden; }
  .setting-row { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 16px 22px; border-bottom: 0.5px solid var(--rule); }
  .setting-row:last-child { border-bottom: none; }
  .setting-label { font-weight: 500; font-size: 13.5px; color: var(--ink); }
  .setting-desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; max-width: 44ch; line-height: 1.4; }
  .s-input { padding: 6px 10px; font-size: 13px; border-radius: 5px; background: var(--surface-2); border: 0.5px solid transparent; outline: none; transition: border-color 0.12s, background 0.12s; font-family: 'SF Mono', Menlo, ui-monospace, monospace; color: var(--ink); }
  .s-input:focus { background: var(--surface); border-color: var(--accent); }
  .form-input { background: var(--surface-2); border: 0.5px solid transparent; border-radius: 5px; padding: 6px 10px; font-size: 13px; outline: none; transition: border-color 0.12s, background 0.12s; font-family: inherit; color: var(--ink); }
  .form-input:focus { background: var(--surface); border-color: var(--accent); }
  .segmented { display: inline-flex; background: var(--surface-2); border-radius: 6px; padding: 2px; }
  .segmented button { padding: 5px 12px; font-size: 12px; font-weight: 500; border-radius: 4px; color: var(--ink-3); background: transparent; transition: background 0.12s, color 0.12s; border: none; cursor: pointer; font-family: inherit; }
  .segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
  .st-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .st-cat-chip { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 7px; font-size: 13px; background: var(--surface); border: 0.5px solid var(--rule); }
  .danger-zone { border: 0.5px solid rgba(168,61,43,0.3); border-radius: 8px; padding: 20px 22px; background: var(--surface); margin-top: 24px; }
  .danger-zone-title { font-weight: 600; font-size: 13px; color: var(--warn); margin-bottom: 4px; }
  .danger-zone-desc { font-size: 12px; color: var(--ink-3); margin-bottom: 16px; line-height: 1.4; max-width: 48ch; }
  @media (max-width: 640px) {
    .settings-shell { margin: -16px -16px; }
    .settings-sub { padding: 0 16px; }
    .settings-sub h2 { font-size: 20px; padding: 16px 0 0; }
    .settings-pane { padding: 20px 16px 80px; }
    .setting-row { grid-template-columns: 1fr; gap: 10px; }
  }

  /* ── ⌘K Command palette ────────────────────────────────────────────────── */
  #cmdk-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.36); z-index: 700; align-items: flex-start; justify-content: center; padding: 80px 16px 40px; }
  #cmdk-overlay.open { display: flex; }
  .cmdk-modal { background: var(--surface); border: 0.5px solid var(--rule-strong); border-radius: 10px; box-shadow: var(--shadow-pop); width: 100%; max-width: 560px; overflow: hidden; display: flex; flex-direction: column; max-height: 60vh; }
  .cmdk-input-row { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 0.5px solid var(--rule); }
  .cmdk-icon { color: var(--ink-3); font-size: 15px; flex-shrink: 0; }
  #cmdk-input { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; color: var(--ink); caret-color: var(--accent); }
  #cmdk-input::placeholder { color: var(--ink-3); }
  .cmdk-esc { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; color: var(--ink-3); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; border: 0.5px solid var(--rule); flex-shrink: 0; }
  .cmdk-results { overflow-y: auto; }
  .cmdk-section { padding: 6px 0 2px; }
  .cmdk-section-label { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; letter-spacing: 0.1em; color: var(--ink-3); text-transform: uppercase; padding: 4px 16px 2px; }
  .cmdk-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
  .cmdk-item:hover, .cmdk-item.active { background: var(--accent-soft); color: var(--ink); }
  .cmdk-item-icon { width: 20px; text-align: center; font-size: 14px; flex-shrink: 0; }
  .cmdk-item-label { flex: 1; }
  .cmdk-item-scope { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; color: var(--ink-3); background: var(--surface-2); padding: 1px 5px; border-radius: 3px; }
  .cmdk-item.active .cmdk-item-scope { background: var(--accent-tint); color: var(--accent-dark); }
  .cmdk-empty { padding: 32px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }

  /* ── Design system tab ──────────────────────────────────────────────────── */
  .ds-token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 16px; }
  .ds-swatch { border-radius: 8px; overflow: hidden; border: 0.5px solid var(--rule); }
  .ds-swatch-halves { display: flex; height: 44px; }
  .ds-swatch-half { flex: 1; }
  .ds-swatch-meta { padding: 6px 10px; background: var(--surface-2); }
  .ds-swatch-name { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink); font-weight: 600; }
  .ds-swatch-vals { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; color: var(--ink-3); margin-top: 1px; }
  .ds-components { margin-top: 12px; padding: 16px; background: var(--surface-2); border-radius: 8px; border: 0.5px solid var(--rule); }
  .ds-comp-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .ds-rules-list { margin-top: 10px; padding-left: 20px; }
  .ds-rules-list li { font-size: 13px; color: var(--ink-2); line-height: 1.7; }
  .ds-rules-list code { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; background: var(--surface-2); padding: 1px 4px; border-radius: 3px; color: var(--ink); }

  /* ── Rule tester modal ──────────────────────────────────────────────────── */
  #rule-tester-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.42); z-index: 550; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
  #rule-tester-overlay.open { display: flex; }
  .rt-modal { background: var(--surface); border: 0.5px solid var(--rule-strong); border-radius: var(--radius); box-shadow: 0 8px 40px rgba(0,0,0,0.18); width: 100%; max-width: 680px; display: flex; flex-direction: column; max-height: 82vh; }
  .rt-header { padding: 22px 24px 16px; border-bottom: 0.5px solid var(--rule); }
  .rt-title { font-family: 'Iowan Old Style', Charter, Georgia, serif; font-size: 20px; font-weight: 500; color: var(--ink); margin-bottom: 14px; }
  .rt-fields { display: grid; grid-template-columns: 1fr 1fr 120px; gap: 10px; }
  .rt-field { display: flex; flex-direction: column; gap: 4px; }
  .rt-field label { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 9.5px; letter-spacing: 0.1em; color: var(--ink-3); text-transform: uppercase; font-weight: 600; }
  .rt-field.kw input { font-family: 'SF Mono', Menlo, ui-monospace, monospace; }
  .rt-preview { flex: 1; overflow-y: auto; padding: 16px 24px; min-height: 80px; }
  .rt-summary { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; line-height: 1.5; }
  .rt-summary strong { color: var(--accent); font-weight: 600; }
  .rt-summary .warn-inline { color: var(--warn); font-weight: 600; display: block; margin-top: 2px; }
  .rt-txn-list { border: 0.5px solid var(--rule); border-radius: var(--radius-sm); overflow: hidden; font-size: 12.5px; margin-top: 10px; }
  .rt-txn-row { display: grid; grid-template-columns: 68px 1fr 90px; gap: 10px; padding: 6px 12px; border-bottom: 0.5px solid var(--rule); align-items: center; }
  .rt-txn-row:last-child { border-bottom: none; }
  .rt-txn-row.rt-conflict-row { background: var(--warn-soft); }
  .rt-txn-date { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; color: var(--ink-3); }
  .rt-txn-desc { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rt-txn-desc mark { background: var(--highlight); color: var(--ink); padding: 0 3px; border-radius: 2px; font-style: normal; }
  .rt-conflict-ann { font-size: 10px; color: var(--warn); font-weight: 600; font-style: italic; font-family: -apple-system, sans-serif; margin-left: 6px; }
  .rt-txn-amt { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10.5px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .rt-more { text-align: center; padding: 8px 12px; font-size: 12px; color: var(--ink-3); background: var(--surface-2); }
  .rt-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 24px; border-top: 0.5px solid var(--rule); flex-wrap: wrap; }

  /* ── Rules triage dashboard ────────────────────────────────────────────── */
  .rule-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 20px; }
  .rule-stat-card { background: var(--surface); border: 0.5px solid var(--rule); border-radius: var(--radius); padding: 16px 20px; }
  .rule-stat-n { font-size: 26px; font-weight: 600; color: var(--ink); line-height: 1; }
  .rule-stat-label { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
  .rule-mobile-note { display: none; }
  @media (max-width: 640px) {
    .rule-stats { grid-template-columns: repeat(2,1fr); }
    .rule-mobile-note { display: block; padding: 10px 14px; background: var(--surface); border: 0.5px solid var(--rule); border-radius: var(--radius-sm); font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
  }

  .triage { background: var(--surface); border: 0.5px solid var(--rule); border-radius: 10px; overflow: hidden; }
  .triage-tabs { display: flex; border-bottom: 0.5px solid var(--rule); background: var(--surface-2); overflow-x: auto; }
  .triage-tab { padding: 10px 18px; font-size: 12px; font-weight: 500; color: var(--ink-2); border-bottom: 2px solid transparent; cursor: pointer; display: flex; align-items: center; gap: 8px; white-space: nowrap; user-select: none; flex-shrink: 0; }
  .triage-tab:hover { color: var(--ink); }
  .triage-tab.active { color: var(--ink); background: var(--surface); border-bottom-color: var(--accent); }
  .triage-tab .count { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; padding: 1px 6px; border-radius: 99px; background: var(--surface-2); color: var(--ink-3); font-weight: 600; }
  .triage-tab.active .count { background: var(--accent-soft); color: var(--accent); }
  .triage-tab.warn .count { background: var(--warn-soft); color: var(--warn); }
  .triage-tab.flag .count { background: var(--flag-soft); color: var(--flag); }
  .triage-bulk { padding: 10px 22px; background: var(--accent); color: var(--bg); display: none; gap: 10px; align-items: center; font-size: 12px; flex-wrap: wrap; }
  .triage-bulk.visible { display: flex; }
  .triage-bulk .btn { background: rgba(0,0,0,0.12); border: 0.5px solid rgba(0,0,0,0.15); color: var(--bg); padding: 4px 10px; font-size: 11.5px; }
  .triage-bulk .btn:hover { background: rgba(0,0,0,0.22); }
  .triage-bulk .btn.danger { background: var(--warn); border-color: var(--warn); color: #fff; }
  .triage-head-row { display: grid; grid-template-columns: 20px 1fr 160px 110px 160px 80px; gap: 14px; padding: 7px 22px; background: var(--surface-2); border-bottom: 0.5px solid var(--rule); align-items: center; }
  .triage-row { display: grid; grid-template-columns: 20px 1fr 160px 110px 160px 80px; gap: 14px; padding: 10px 22px; border-bottom: 0.5px solid var(--rule); align-items: center; cursor: pointer; }
  .triage-row:last-child { border-bottom: none; }
  .triage-row:hover { background: var(--surface-2); }
  .triage-row.selected { background: var(--accent-soft); }
  .triage-row.selected:hover { background: var(--accent-soft); }
  .triage-row .kw { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .triage-row .tag-count { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-2); text-align: right; }
  .triage-row .tag-lastfire { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--flag); }
  .triage-row .tag-lastfire.never { color: var(--warn); font-style: italic; }
  .triage-row .triage-actions { display: flex; gap: 4px; justify-self: end; }
  .triage-footer { padding: 12px 22px; background: var(--surface-2); border-top: 0.5px solid var(--rule); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-2); }
  .triage-footer strong { color: var(--ink); font-weight: 600; }
  .triage-empty { text-align: center; padding: 40px 22px; color: var(--ink-2); font-size: 13px; }

  /* ── Rules view toggle ──────────────────────────────────────────────────── */
  .rule-view-toggle { display: flex; gap: 0; margin-bottom: 14px; background: var(--surface-2); border: 0.5px solid var(--rule); border-radius: 8px; padding: 3px; width: fit-content; }
  .rvt-btn { padding: 5px 14px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); border: none; background: none; cursor: pointer; transition: background 0.12s, color 0.12s; white-space: nowrap; }
  .rvt-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
  .rvt-btn:hover:not(.active) { color: var(--ink); }

  /* ── Cluster mode — hide list-only chrome ───────────────────────────────── */
  .triage.cluster-mode .triage-tabs,
  .triage.cluster-mode .triage-head-row,
  .triage.cluster-mode .triage-bulk { display: none !important; }

  /* ── Category cluster groups ────────────────────────────────────────────── */
  .rc-group { border-bottom: 0.5px solid var(--rule); }
  .rc-group:last-child { border-bottom: none; }
  .rc-head { display: flex; align-items: center; gap: 10px; padding: 11px 22px; cursor: pointer; user-select: none; background: var(--surface-2); transition: filter 0.1s; }
  .rc-head:hover { filter: brightness(0.97); }
  .rc-head-count { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-3); background: var(--surface); border: 0.5px solid var(--rule); border-radius: 99px; padding: 1px 8px; }
  .rc-chevron { font-size: 11px; color: var(--ink-3); transition: transform 0.15s; margin-left: auto; }
  .rc-group.collapsed .rc-chevron { transform: rotate(-90deg); }
  .rc-group.collapsed .rc-body { display: none; }
  .rc-row { display: grid; grid-template-columns: 1fr 100px 140px 80px; gap: 14px; padding: 9px 22px 9px 44px; border-top: 0.5px solid var(--rule); align-items: center; }
  .rc-row:hover { background: var(--surface-2); }
  .rc-row .kw { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rc-row .rc-count { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-2); text-align: right; }
  .rc-row .rc-last { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11px; color: var(--ink-3); }
  .rc-row .rc-last.never { color: var(--warn); font-style: italic; }
  .rc-row .rc-last.stale { color: var(--flag); }
  .rc-row .triage-actions { display: flex; gap: 4px; justify-self: end; }

  /* ── Merchant renames pane ──────────────────────────────────────────────── */
  .rename-search-wrap { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border: 0.5px solid var(--rule); border-radius: 6px; margin-bottom: 14px; transition: border-color 0.12s; }
  .rename-search-wrap:focus-within { border-color: var(--accent); }
  .rename-search-wrap svg { opacity: 0.45; flex-shrink: 0; }
  .rename-search-wrap input { flex: 1; border: none; outline: none; background: transparent; font-size: 13px; font-family: inherit; color: var(--ink); }
  .rename-head-row { display: grid; grid-template-columns: 1fr 20px 1fr 90px; gap: 12px; padding: 8px 20px; background: var(--surface-2); border-bottom: 0.5px solid var(--rule); font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: var(--ink-3); text-transform: uppercase; }
  .rename-row { display: grid; grid-template-columns: 1fr 20px 1fr 90px; gap: 12px; padding: 9px 20px; border-bottom: 0.5px solid var(--rule); align-items: center; font-size: 12.5px; }
  .rename-row:last-child { border-bottom: none; }
  .rename-row:hover { background: var(--surface-2); }
  .rename-row .rename-pat { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rename-row .rename-arrow { color: var(--ink-3); text-align: center; font-size: 12px; }
  .rename-row .rename-to { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rename-add-row { display: grid; grid-template-columns: 1fr 20px 1fr 90px; gap: 12px; padding: 10px 20px; border-bottom: 0.5px solid var(--rule); align-items: center; background: var(--accent-soft); }

  /* ── Rules v3 ─────────────────────────────────────────────────────────────── */
  .rv3-strip { display: grid; grid-template-columns: repeat(5,1fr); gap: 1px; background: var(--rule); border: 0.5px solid var(--rule); border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
  .rv3-cell { background: var(--surface); padding: 13px 16px; cursor: pointer; transition: background 0.12s; border-bottom: 2px solid transparent; }
  .rv3-cell:hover { background: var(--surface-2); }
  .rv3-cell.active { background: var(--surface-2); border-bottom-color: var(--accent); }
  .rv3-n { font-family: 'Iowan Old Style', Charter, Georgia, serif; font-size: 22px; font-weight: 500; line-height: 1; margin-bottom: 5px; }
  .rv3-l { font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); }
  .rv3-h { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
  .rv3-cell.warn .rv3-n { color: var(--warn); }
  .rv3-cell.flag .rv3-n { color: var(--flag); }
  .rv3-cell.good .rv3-n { color: var(--good); }

  .rv3-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
  .rv3-search { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--surface); border: 0.5px solid var(--rule); border-radius: 6px; transition: border-color 0.12s; }
  .rv3-search:focus-within { border-color: var(--accent); }
  .rv3-search svg { opacity: 0.5; flex-shrink: 0; }
  .rv3-search input { flex: 1; border: none; outline: none; background: transparent; font-size: 13px; color: var(--ink); }

  .rv3-split { display: grid; grid-template-columns: minmax(0,1fr) 440px; gap: 14px; align-items: start; }
  @media (max-width: 1100px) { .rv3-split { grid-template-columns: 1fr; } .rv3-detail-col { position: static !important; } }
  .rv3-detail-col { position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow-y: auto; }

  .rv3-table { background: var(--surface); border: 0.5px solid var(--rule); border-radius: 8px; overflow: hidden; }
  .rv3-bulk-bar { padding: 9px 14px; background: var(--accent-soft); border-bottom: 0.5px solid var(--accent-tint); display: none; align-items: center; gap: 10px; font-size: 12.5px; color: var(--accent); }
  .rv3-bulk-bar.visible { display: flex; }

  .rv3-head, .rv3-row { display: grid; grid-template-columns: 20px 18px 1fr 120px 64px 80px 24px; gap: 10px; align-items: center; padding: 0 12px; }
  .rv3-head { padding: 7px 12px; font-family: 'SF Mono', Menlo, ui-monospace, monospace; font-size: 9.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); border-bottom: 0.5px solid var(--rule); }
  .rv3-row { padding: 7px 12px; border-bottom: 0.5px solid var(--rule); font-size: 12.5px; cursor: pointer; transition: background 0.08s; }
  .rv3-row:last-child { border-bottom: none; }
  .rv3-row:hover { background: var(--surface-2); }
  .rv3-row.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
  .rv3-row.checked .rv3-chk { background: var(--accent); border-color: var(--accent); }
  .rv3-row.checked .rv3-chk::after { content:''; width:7px; height:4px; border-left:1.5px solid #fff; border-bottom:1.5px solid #fff; transform:rotate(-45deg) translate(1px,-1px); display:block; }
  .rv3-chk { width:14px; height:14px; border:1px solid var(--rule-strong); border-radius:3px; background:var(--surface); display:grid; place-items:center; flex-shrink:0; }
  .rv3-badge { width:16px; height:16px; border-radius:4px; display:grid; place-items:center; font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:9px; font-weight:700; background:var(--surface-2); border:0.5px solid var(--rule); color:var(--ink-3); }
  .rv3-badge.both { background:var(--accent-soft); color:var(--accent); border-color:var(--accent-tint); }
  .rv3-badge.rename { background:var(--flag-soft); color:var(--flag); }
  .rv3-kw { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:11.5px; color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:flex; align-items:center; gap:7px; }
  .rv3-kw .arr { color:var(--ink-3); font-size:10px; }
  .rv3-kw .disp { color:var(--ink-2); }
  .rv3-kw .pill { font-size:9.5px; padding:1px 5px; border-radius:3px; background:var(--warn-soft); color:var(--warn); font-family:'SF Mono',Menlo,ui-monospace,monospace; flex-shrink:0; }
  .rv3-kw .pill.flag { background:var(--flag-soft); color:var(--flag); }
  .rv3-cat .cat-chip { font-size:11px; padding:2px 7px; border-radius:4px; background:var(--surface-2); color:var(--ink); border:0.5px solid var(--rule); display:inline-flex; align-items:center; gap:4px; font-weight:500; white-space:nowrap; max-width:100%; overflow:hidden; text-overflow:ellipsis; }
  .rv3-count { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:11.5px; color:var(--ink-2); text-align:right; font-variant-numeric:tabular-nums; }
  .rv3-count.zero { color:var(--warn); font-style:italic; }
  .rv3-last { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:10.5px; color:var(--ink-3); }
  .rv3-last.stale { color:var(--flag); }
  .rv3-last.never { color:var(--warn); font-style:italic; }
  .rv3-menu { color:var(--ink-3); opacity:0; text-align:center; }
  .rv3-row:hover .rv3-menu, .rv3-row.selected .rv3-menu { opacity:1; }
  .rv3-empty { padding:40px 16px; text-align:center; color:var(--ink-3); font-size:12.5px; font-style:italic; }

  .rv3-detail { background:var(--surface); border:0.5px solid var(--rule); border-radius:10px; overflow:hidden; }
  .rv3-detail-empty { padding:56px 24px; text-align:center; color:var(--ink-3); }
  .rv3-detail-empty .glyph { font-family:'Iowan Old Style',Charter,Georgia,serif; font-size:32px; opacity:0.4; margin-bottom:6px; }
  .rv3-detail-empty .t { font-family:'Iowan Old Style',Charter,Georgia,serif; font-size:16px; color:var(--ink-2); margin-bottom:4px; }
  .rv3-detail-empty .h { font-size:12.5px; max-width:26ch; margin:0 auto; line-height:1.5; }
  .rv3-detail-head { padding:16px 18px 12px; border-bottom:0.5px solid var(--rule); }
  .rv3-detail-eyebrow { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:10px; letter-spacing:0.12em; color:var(--ink-3); text-transform:uppercase; margin-bottom:5px; display:flex; gap:8px; align-items:center; }
  .rv3-detail-eyebrow .age.stale { color:var(--flag); }
  .rv3-detail-eyebrow .age.never { color:var(--warn); }
  .rv3-detail-kw { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:15px; font-weight:500; color:var(--ink); word-break:break-all; margin-bottom:7px; }
  .rv3-detail-recipe { font-size:12px; color:var(--ink-2); line-height:1.55; }
  .rv3-detail-recipe .pill { display:inline-block; background:var(--surface-2); padding:1px 5px; border-radius:3px; font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:11px; color:var(--ink); margin:0 2px; }
  .rv3-detail-recipe .pill.cat { background:var(--accent-soft); color:var(--accent); }
  .rv3-detail-recipe .pill.ren { background:var(--flag-soft); color:var(--flag); }
  .rv3-dstrip { display:grid; grid-template-columns:repeat(3,1fr); border-bottom:0.5px solid var(--rule); }
  .rv3-dstrip .cell { padding:10px 14px; border-right:0.5px solid var(--rule); }
  .rv3-dstrip .cell:last-child { border-right:none; }
  .rv3-dstrip .v { font-family:'Iowan Old Style',Charter,Georgia,serif; font-size:17px; font-weight:500; line-height:1.1; }
  .rv3-dstrip .v.warn { color:var(--warn); }
  .rv3-dstrip .v.flag { color:var(--flag); }
  .rv3-dstrip .l { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:9.5px; font-weight:600; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-3); margin-top:3px; }
  .rv3-dtabs { display:flex; border-bottom:0.5px solid var(--rule); padding:0 6px; background:var(--surface-2); }
  .rv3-dt { padding:7px 10px; font-size:11.5px; color:var(--ink-3); font-weight:500; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-0.5px; display:flex; align-items:center; gap:5px; transition:color 0.12s,border-color 0.12s; }
  .rv3-dt:hover { color:var(--ink); }
  .rv3-dt.active { color:var(--ink); border-bottom-color:var(--accent); background:var(--surface); }
  .rv3-dt .n { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:10px; padding:0 4px; background:var(--surface-2); border-radius:3px; color:var(--ink-3); }
  .rv3-dt.active .n { background:var(--accent-soft); color:var(--accent); }
  .rv3-dt.warn .n { background:var(--warn-soft); color:var(--warn); }
  .rv3-dt.flag .n { background:var(--flag-soft); color:var(--flag); }
  .rv3-txn-list { max-height:340px; overflow-y:auto; }
  .rv3-txn-row { display:grid; grid-template-columns:60px 1fr 74px; gap:8px; align-items:baseline; padding:6px 14px; font-size:12px; border-bottom:0.5px solid var(--rule); }
  .rv3-txn-row:last-child { border-bottom:none; }
  .rv3-txn-row.conflict-row { background:linear-gradient(90deg,var(--warn-soft) 0%,transparent 70%); }
  .rv3-txn-row.overfit-row { background:linear-gradient(90deg,var(--flag-soft) 0%,transparent 70%); }
  .rv3-txn-d { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:10.5px; color:var(--ink-3); }
  .rv3-txn-m { font-size:11.5px; color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .rv3-txn-m mark { background:var(--mark,var(--highlight)); color:var(--mark-ink,var(--ink)); padding:0 2px; border-radius:2px; }
  .rv3-txn-m .sub { display:block; font-size:10.5px; color:var(--warn); font-family:'SF Mono',Menlo,ui-monospace,monospace; margin-top:1px; white-space:normal; }
  .rv3-txn-m .sub.flag { color:var(--flag); }
  .rv3-txn-a { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:11px; text-align:right; color:var(--ink-2); font-variant-numeric:tabular-nums; white-space:nowrap; }
  .rv3-txn-empty { padding:28px 14px; text-align:center; color:var(--ink-3); font-size:12.5px; font-style:italic; }
  .rv3-txn-empty.good { color:var(--good); }
  .rv3-overfit-banner { padding:12px 14px; background:var(--flag-soft); border-bottom:0.5px solid var(--rule); font-size:12px; color:var(--ink-2); line-height:1.5; }
  .rv3-overfit-banner strong { color:var(--flag); }
  .rv3-overfit-banner .suggest { margin-top:6px; display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
  .rv3-overfit-banner .from { text-decoration:line-through; color:var(--ink-3); font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:11px; }
  .rv3-overfit-banner .to { font-family:'SF Mono',Menlo,ui-monospace,monospace; background:var(--accent-soft); color:var(--accent); padding:1px 6px; border-radius:3px; font-size:11px; font-weight:600; }
  .rv3-conflict-banner { padding:12px 14px; background:var(--warn-soft); border-bottom:0.5px solid var(--rule); font-size:12px; color:var(--ink-2); line-height:1.5; }
  .rv3-conflict-banner strong { color:var(--warn); }
  .rv3-conf-list { padding:4px 0; }
  .rv3-conf-row { display:grid; grid-template-columns:1fr 1fr auto; gap:8px; padding:8px 14px; border-bottom:0.5px solid var(--rule); align-items:center; font-size:12px; }
  .rv3-conf-row:last-child { border-bottom:none; }
  .rv3-conf-kw .mono { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:11px; color:var(--ink); }
  .rv3-conf-cat { color:var(--ink-2); }
  .conf-tag { font-family:'SF Mono',Menlo,ui-monospace,monospace; font-size:10px; padding:1px 5px; border-radius:3px; white-space:nowrap; }
  .conf-tag.win { background:var(--accent-soft); color:var(--accent); }
  .conf-tag.lose { background:var(--warn-soft); color:var(--warn); }
  .conf-tag .mono { font-family:'SF Mono',Menlo,ui-monospace,monospace; }
  .rv3-detail-foot { padding:10px 14px; border-top:0.5px solid var(--rule); background:var(--surface-2); display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
  .rv3-detail-foot .spacer { flex:1; }
  @media (max-width: 760px) { .rv3-strip { grid-template-columns:repeat(2,1fr); } .rv3-head .rv3-last, .rv3-row .rv3-last, .rv3-head .rv3-cat, .rv3-row .rv3-cat { display:none; } .rv3-head, .rv3-row { grid-template-columns:20px 18px 1fr 64px 24px; } }
