:root{
  --bg:#f3f5f7; --card:#ffffff; --text:#17202a; --muted:#68727f;
  --border:#e2e7ec; --accent:#177a52; --accent-soft:#e6f4ec; --accent-faint:#ebf5f0;
  --blue:#2563eb; --blue-soft:#e8effd;
  --danger:#cf3f3f; --danger-soft:#fbecec;
  --warn:#9a6b1a; --warn-soft:#fdf3e0;
  --track:#edf0f3; --th-bg:#f0f3f6; --input-bg:#ffffff; --seg-bg:#edf0f3;
  --tabbar-bg:rgba(255,255,255,.96);
  --radius:14px; --tabbar-h:64px; --tabbar-pad-b:0px;
  --fcard:#f8fbfd; /* cards + sticky filter panels: a whisper lighter than --card */
  --side-margin:100px; /* desktop content side margins, adjustable in Settings → Layout & card surfaces */
  /* Card fill opacity (100% = solid). Settings → Theme & page background. */
  --card-opacity-pct:100%;
  /* Backdrop blur behind transparent cards (0 = off). */
  --card-backdrop-blur:0px;
}
[data-theme="dark"]{
  --bg:#0f141a; --card:#243040; --text:#edf1f5; --muted:#9aa7b4;
  --border:#3a4a5c; --accent:#35a06c; --accent-soft:#123528; --accent-faint:#152c22;
  --blue:#6b9bf3; --blue-soft:#1b2a4a;
  --danger:#e87a7a; --danger-soft:#3d1f1f;
  --warn:#d9a441; --warn-soft:#3a2c12;
  --track:#232c35; --th-bg:#1f2730; --input-bg:#141b22; --seg-bg:#232c35;
  --tabbar-bg:rgba(24,32,40,.96);
  --fcard:#242f3c; /* cards + sticky filter panels: a touch lighter than --card */
}
/* Dark palettes (Settings → Theme → Color palette). Tint accent/blue + surfaces. */
[data-theme="dark"][data-dark-palette="graphite"]{
  --bg:#0a0a0b; --card:#1c1c1e; --fcard:#2c2c2e;
  --border:#48484a; --track:#3a3a3c; --th-bg:#2c2c2e; --input-bg:#3a3a3c; --seg-bg:#3a3a3c;
  --tabbar-bg:rgba(28,28,30,.96);
  --accent:#a8aeb8; --accent-soft:#2a2c30; --accent-faint:#232428;
  --blue:#8e98a8; --blue-soft:#252830;
}
[data-theme="dark"][data-dark-palette="violet"]{
  --bg:#120f18; --card:#2a2438; --fcard:#322c42;
  --border:#4a4260; --track:#2e2840; --th-bg:#241e32; --input-bg:#1a1624; --seg-bg:#2e2840;
  --tabbar-bg:rgba(28,24,40,.96);
  --accent:#c084fc; --accent-soft:#2a1840; --accent-faint:#221530;
  --blue:#a78bfa; --blue-soft:#2a1f48;
}
[data-theme="dark"][data-dark-palette="ember"]{
  --bg:#14100c; --card:#2c241c; --fcard:#342c22;
  --border:#5a4a38; --track:#32281e; --th-bg:#261e16; --input-bg:#1a1410; --seg-bg:#32281e;
  --tabbar-bg:rgba(36,28,20,.96);
  --accent:#f0a060; --accent-soft:#3a2410; --accent-faint:#2a1c10;
  --blue:#fb923c; --blue-soft:#3a2210;
}
[data-theme="dark"][data-dark-palette="ocean"]{
  --bg:#0c1218; --card:#1e2a38; --fcard:#243244;
  --border:#3a5068; --track:#1e2c3c; --th-bg:#1a2430; --input-bg:#121a24; --seg-bg:#1e2c3c;
  --tabbar-bg:rgba(18,28,40,.96);
  --accent:#38bdf8; --accent-soft:#0e2a3a; --accent-faint:#122830;
  --blue:#60a5fa; --blue-soft:#152a48;
}
[data-theme="dark"][data-dark-palette="rose"]{
  --bg:#141014; --card:#2c2228; --fcard:#342830;
  --border:#5a4450; --track:#32242c; --th-bg:#261c22; --input-bg:#1a1216; --seg-bg:#32242c;
  --tabbar-bg:rgba(36,24,30,.96);
  --accent:#f472b6; --accent-soft:#3a1828; --accent-faint:#2a1420;
  --blue:#fb7185; --blue-soft:#3a1a28;
}
/* Apple — iOS/macOS system dark (true black + system blue) */
[data-theme="dark"][data-dark-palette="apple"]{
  --bg:#000000; --card:#1c1c1e; --fcard:#2c2c2e;
  --border:#38383a; --track:#1c1c1e; --th-bg:#2c2c2e; --input-bg:#1c1c1e; --seg-bg:#2c2c2e;
  --tabbar-bg:rgba(28,28,30,.94);
  --accent:#0a84ff; --accent-soft:#0a2548; --accent-faint:#0c1e38;
  --blue:#64d2ff; --blue-soft:#0a2848;
  --text:#f5f5f7; --muted:#98989d;
}
/* Midnight — deep indigo night */
[data-theme="dark"][data-dark-palette="midnight"]{
  --bg:#08081a; --card:#16162e; --fcard:#1e1e3a;
  --border:#3a3a62; --track:#1c1c36; --th-bg:#14142a; --input-bg:#101024; --seg-bg:#1c1c36;
  --tabbar-bg:rgba(16,16,36,.96);
  --accent:#818cf8; --accent-soft:#1e1a48; --accent-faint:#181434;
  --blue:#6366f1; --blue-soft:#1a1840;
}
/* Sand — warm taupe / desert night */
[data-theme="dark"][data-dark-palette="sand"]{
  --bg:#14110e; --card:#2a241c; --fcard:#322c22;
  --border:#5c5040; --track:#2e2820; --th-bg:#221c16; --input-bg:#1a1612; --seg-bg:#2e2820;
  --tabbar-bg:rgba(36,30,22,.96);
  --accent:#d4a574; --accent-soft:#3a2c18; --accent-faint:#2a2014;
  --blue:#e8c49a; --blue-soft:#3a2a18;
}
[data-theme="dark"] .notice{ border-color:#6b5a26; color:#ecd9a0; }
[data-theme="dark"] .notice.blue{ border-color:#31497a; color:#a9c3f5; }
[data-theme="dark"] .privacy{ border-color:#6b5a26; color:#ecd9a0; }
[data-theme="dark"] .confbadge.high{ background:#123528; color:#5fd598; }
[data-theme="dark"] .confbadge.medium{ background:#3a2c12; color:#e8b64c; }
[data-theme="dark"] .confbadge.low{ background:#232c35; color:#9aa7b4; }
[data-theme="dark"] .dupbadge{ background:#3d1f1f; color:#f0938c; }
/* chart element colors that follow the theme */
.cx-text{ fill:var(--text); }
.cx-mut{ fill:var(--muted); }
.cx-faint{ fill:var(--muted); opacity:.75; }
.cx-neg{ fill:var(--danger); }
.cx-track{ fill:var(--track); }
.cx-grid{ stroke:var(--border); }
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html{-webkit-text-size-adjust:100%; overflow-x:clip;}
body{
  margin:0; background-color:var(--page-bg, var(--bg)); background-image:var(--bg-extra, none);
  background-size:var(--bg-size, auto); background-repeat:var(--bg-repeat, repeat);
  background-position:var(--bg-pos, 0 0); background-attachment:fixed;
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:18px; line-height:1.5; overflow-x:clip;
  isolation:isolate; /* keep #bg-dynamic (z:-1) above body bg, behind UI */
}
[hidden]{display:none !important;}

/* CPA report: typography + tables (used for both PDF generation and print fallback) */
#cpa-report{ color:#000; background:#fff; font-family:Georgia,'Times New Roman',serif; max-width:7.5in; margin:0 auto; padding:24px; }
#cpa-report h1{ font-size:22px; margin:0 0 4px; }
#cpa-report .cpa-sub{ font-size:12px; color:#444; margin:0 0 20px; }
#cpa-report h2{ font-size:15px; margin:22px 0 6px; border-bottom:2px solid #000; padding-bottom:4px; }
#cpa-report table.cpa-table{ width:100%; border-collapse:collapse; font-size:13px; margin:0 0 6px; }
#cpa-report table.cpa-table td{ padding:4px 6px; border-bottom:1px solid #ddd; vertical-align:top; }
#cpa-report table.cpa-table td.cpa-amt{ text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
#cpa-report table.cpa-table tfoot td{ font-weight:bold; border-bottom:none; border-top:2px solid #000; }
#cpa-report .cpa-n{ color:#666; font-size:11.5px; }
#cpa-report .cpa-note{ font-size:11.5px; color:#333; margin:14px 0 0; }
#cpa-report .cpa-summary{ margin-top:18px; border:2px solid #000; padding:10px 14px; }
#cpa-report .cpa-summary .rowline{ display:flex; justify-content:space-between; font-size:14px; padding:3px 0; }
#cpa-report .cpa-summary .rowline.grand{ font-weight:bold; font-size:16px; border-top:1px solid #000; margin-top:6px; padding-top:8px; }
@media print{
  .app-header, .tabbar, .toast-wrap, .no-print{ display:none !important; }
  body{ background:#fff; }
  .card{ box-shadow:none; break-inside:avoid; }
  /* CPA report print fallback: print only the report, nothing else */
  body.cpa-print > *:not(#cpa-report){ display:none !important; }
  body.cpa-print #cpa-report{ display:block !important; position:static; }
}

/* ---------- report charts (style inspired by capital_one_dashboard) ---------- */
.rep-svg{ width:100%; height:auto; display:block; }
.rep-click{ cursor:pointer; }
.rep-click:hover{ opacity:.7; }
.dl-row.rep-click:hover{ background:rgba(140,140,140,.12); opacity:1; }
#txn-drill:empty{ display:none; }
.drillchip{ display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:var(--blue-soft); border:1px solid #c3d4f5; color:#1e3f8f;
  border-radius:12px; padding:9px 12px; font-size:15.5px; margin-bottom:10px; }
/* Dark: stronger blue fill so the drill context reads clearly on navy cards. */
[data-theme="dark"] .drillchip{
  background:color-mix(in srgb, var(--blue) 38%, #152238);
  border-color:color-mix(in srgb, var(--blue) 70%, #1a2740);
  color:#e4eeff;
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--blue) 35%, transparent);
}
/* Same 32px circle ✕ as .card-x (chart dismiss / banner close). */
.drillx{
  flex:none; width:32px; height:32px; border-radius:50%; border:none; cursor:pointer; padding:0;
  background:rgba(127,127,127,.22); color:inherit;
  font-size:18px; line-height:1; display:inline-flex; align-items:center; justify-content:center;
}
[data-theme="dark"] .drillx{ background:rgba(255,255,255,.16); }
.drillx:active{ transform:scale(1.3); opacity:1; }
/* ---- drag-to-reorder chart cards (Home + Reports) ----
   Only the grip handle starts a drag (Pointer Events, so touch works);
   chart bodies stay tappable for drill-through. */
.card-grip{ display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px; margin:-8px 4px -8px -6px; cursor:grab;
  touch-action:none; -webkit-user-select:none; user-select:none;
  color:var(--muted); font-size:20px; line-height:1; flex:0 0 auto; }
.card-grip:active{ cursor:grabbing; color:var(--text); }
.card-drop-ph{ border:2px dashed var(--accent); border-radius:var(--radius);
  margin:0 0 12px; background:rgba(127,127,127,.08); }
/* Settings card collapse header: clear bar + chevron; grip stays separate. */
#screen-settings .set-chead{
  display:flex; align-items:center; gap:10px; flex:1; min-width:0;
  box-sizing:border-box;
  padding:8px 12px 8px 4px;
  margin:0 0 10px;
  min-height:44px;
  border-radius:10px;
  border:1px solid rgba(127,127,127,.22);
  /* Same opacity as card fills (Theme → Card transparency). Collapsed cards
     only show this header, so it must respect --card-opacity-pct. */
  background-color:color-mix(in srgb, var(--card-bg-custom, var(--fcard)) var(--card-opacity-pct, 100%), transparent);
  background-image:var(--card-bg-pattern, none);
  background-size:var(--card-bg-size, auto);
  box-shadow:inset 0 0 0 100vmax rgba(127,127,127,.11);
  -webkit-backdrop-filter:blur(var(--card-backdrop-blur, 0px));
  backdrop-filter:blur(var(--card-backdrop-blur, 0px));
  cursor:pointer;
  -webkit-user-select:none; user-select:none;
  transition:box-shadow .15s ease, border-color .15s ease;
}
#screen-settings .set-chead:hover{
  border-color:rgba(127,127,127,.38);
  box-shadow:inset 0 0 0 100vmax rgba(127,127,127,.18);
}
#screen-settings .set-chead:focus-within{
  border-color:rgba(127,127,127,.45);
}
.card[data-setcard].set-collapsed > .set-chead,
.card[data-setcard].set-collapsed > .set-card-head > .set-chead{
  box-shadow:inset 0 0 0 100vmax rgba(127,127,127,.15);
}
/* Grip: separate reorder hit target — not part of the collapse affordance. */
#screen-settings .set-chead .card-grip{
  width:36px; height:36px; margin:0 2px 0 0; padding:0;
  border-radius:8px; border-right:1px solid rgba(127,127,127,.28);
  border-top-right-radius:0; border-bottom-right-radius:0;
  padding-right:6px; margin-right:4px;
  cursor:grab; color:var(--muted);
}
#screen-settings .set-chead .card-grip:hover{
  color:var(--text); background:rgba(127,127,127,.14);
}
#screen-settings .set-chead .card-grip:active{ cursor:grabbing; }
#screen-settings .set-chead h2{
  margin:0; min-width:0; cursor:pointer; pointer-events:none;
  font-size:inherit; font-weight:700; line-height:1.25;
}
/* Brief summary under the card title — shown expanded and collapsed. */
#screen-settings .set-chead-titles{
  flex:1; min-width:0; display:flex; flex-direction:column; gap:2px;
  pointer-events:none;
}
#screen-settings .set-chead-summary{
  display:-webkit-box;
  font-size:13px; font-weight:500; line-height:1.35;
  color:var(--muted);
  overflow:hidden;
  -webkit-box-orient:vertical; -webkit-line-clamp:2;
}
/* Settings card collapse toggle: clearer button next to the title. */
.set-collapse{ flex:none; width:30px; height:30px; min-width:30px; min-height:30px; border-radius:9px;
  border:1px solid rgba(127,127,127,.28); cursor:pointer; padding:0;
  background:rgba(127,127,127,.28); color:var(--text);
  font-size:12px; font-weight:700; line-height:1; display:inline-flex; align-items:center; justify-content:center;
  flex-shrink:0; box-sizing:border-box;
  transition:background .15s ease, border-color .15s ease; }
.set-collapse:hover{ background:rgba(127,127,127,.48); border-color:rgba(127,127,127,.42); }
.set-collapse:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.set-collapse-icon{
  display:flex; align-items:center; justify-content:center;
  width:12px; height:12px; flex:none;
  line-height:1; font-size:inherit;
  transform-origin:center center;
  transition:transform .2s ease;
  transform:rotate(0deg);
}
.card[data-setcard].set-collapsed .set-collapse .set-collapse-icon{
  transform:rotate(-90deg);
}
@media (prefers-reduced-motion: reduce){
  .set-collapse-icon{ transition:none; }
  #screen-settings .set-chead{ transition:none; }
}
/* Collapsed card body: grid 0fr/1fr height + inner opacity (see .set-collapse-panel). */
.set-collapse-panel{
  display:grid; grid-template-rows:1fr; min-height:0;
}
.set-collapse-panel-inner{ overflow:hidden; min-height:0; opacity:1; }
.card[data-setcard].set-collapsed > .set-collapse-panel{ grid-template-rows:0fr; pointer-events:none; }
.card[data-setcard].set-collapsed > .set-collapse-panel > .set-collapse-panel-inner{ opacity:0; }
/* Extra controls in .set-card-head (e.g. Scan / + Add) collapse with the body.
   Collapse must zero width too — opacity alone left a blank flex gap on the right.
   Include #screen-settings so this beats `#screen-settings .set-card-head .btn`. */
#screen-settings .card[data-setcard] > .set-card-head > :not(.set-chead){
  overflow:hidden; max-height:160px; opacity:1;
}
#screen-settings .card[data-setcard].set-collapsed > .set-card-head > :not(.set-chead){
  max-height:0; max-width:0; opacity:0; margin:0 !important; padding:0 !important;
  overflow:hidden; pointer-events:none; border:none !important;
  flex:0 0 0 !important; width:0 !important; min-width:0 !important;
}
#screen-settings .card[data-setcard].set-collapsed > .set-card-head{ gap:0; }
#screen-settings.set-collapse-anim .set-collapse-panel{
  transition:grid-template-rows .28s ease;
}
#screen-settings.set-collapse-anim .set-collapse-panel-inner{
  transition:opacity .22s ease .04s;
}
#screen-settings.set-collapse-anim .card[data-setcard].set-collapsed > .set-collapse-panel > .set-collapse-panel-inner{
  transition:opacity .16s ease;
}
#screen-settings.set-collapse-anim .card[data-setcard] > .set-card-head > :not(.set-chead){
  transition:max-height .28s ease, max-width .28s ease, opacity .22s ease .04s, margin .28s ease, flex-basis .28s ease;
}
#screen-settings.set-collapse-anim .card[data-setcard].set-collapsed > .set-card-head > :not(.set-chead){
  transition:opacity .16s ease, max-height .28s ease, max-width .28s ease, margin .28s ease, flex-basis .28s ease;
}
@media (prefers-reduced-motion: reduce){
  .set-collapse-panel, .set-collapse-panel-inner,
  #screen-settings .card[data-setcard] > .set-card-head > :not(.set-chead){ transition:none !important; }
}
/* Sticky card headers: when a Settings card scrolls up, its header sticks
   below the app header until the next card pushes it away. Bar tint stays
   (not flat card fill) so collapse affordance remains obvious while stuck. */
.card[data-setcard] > .set-chead{
  position:sticky; top:calc(var(--headH, 64px) + 6px); z-index:10;
}
.card-dragging{ position:fixed !important; z-index:70; pointer-events:none;
  opacity:.95; box-shadow:0 14px 34px rgba(0,0,0,.35); margin:0 !important; }
.rep-svg text{ font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,Helvetica,Arial,sans-serif; }
.donut-legend{ margin-top:4px; display:flex; flex-wrap:wrap; justify-content:center; gap:4px 14px; }
.dl-row{ display:flex; align-items:center; gap:9px; padding:6px 2px; border-top:1px solid var(--border); font-size:15.5px; }
.donut-legend .dl-row{ border-top:0; padding:4px 6px; flex:0 1 auto; max-width:100%; }
.donut-legend .dl-name{ flex:0 1 auto; }
.dl-swatch{ width:11px; height:11px; border-radius:3px; flex:none; }
.dl-name{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dl-pct{ flex:none; min-width:46px; text-align:right; color:var(--muted); font-variant-numeric:tabular-nums; }
.chart-sub{ color:var(--muted); font-size:15px; margin:-6px 0 8px; }
#dash-chart-sub{ margin-top:6px; }
.chart-pick-row{display:flex;align-items:center;justify-content:center;gap:10px;margin-bottom:2px}
.chart-pick-row select{max-width:80%;font-size:17px;font-weight:700;padding:6px 8px}
.donut-trio{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;justify-items:center}
.donut-trio>div{width:100%;max-width:560px;min-width:0}
.donut-trio-title{text-align:center;font-size:17px;margin:6px 0 0;color:var(--muted);font-weight:600}

/* ---------- header ---------- */
.app-header{
  position:sticky; top:0; z-index:20;
  background:var(--card); border-bottom:1px solid var(--border);
  padding:calc(7px + env(safe-area-inset-top)) 16px 7px;
  /* 3-zone: logo | message | actions. Explicit columns so a hidden center
     slot (display:none) does not auto-place actions into the middle track. */
  display:grid; grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center; gap:8px 12px;
}
.app-header h1{font-size:21px; margin:0; font-weight:700; letter-spacing:-.2px;}
.brand{display:flex; align-items:center; gap:10px; min-width:0; grid-column:1; grid-row:1; justify-self:start;}
.brand-icon{width:30px; height:30px; border-radius:8px; display:block; flex:none;}
/* Center slot (Dave, Nov 6): the nudge and the past-due banner form ONE
   stack in the middle column, vertically centered as a unit. They used to
   be separate grid items, with the banner as a full-width second row —
   that pushed the actions into a third row and left the header tall with
   dead space under the stack. One row, one stack: the header is only as
   tall as its tallest zone.
   Alignment (Dave, Nov 7): the two lines also share their left and right
   edges. The stack shrink-wraps to its widest line (width:fit-content)
   and the lines stretch to that width, so the pair reads as one block,
   centered in the column — not two separately centered lines whose
   edges wander by a few px depending on their text lengths. */
.header-center{
  grid-column:2; grid-row:1; min-width:0; justify-self:center;
  width:fit-content; max-width:100%;
  display:flex; flex-direction:column; align-items:stretch; gap:4px;
}
/* Upcoming-bill nudge (empty when none due in the next 7 days). */
.header-bill-nudge{
  min-width:0; max-width:100%; text-align:center;
  font-size:13px; color:var(--muted); line-height:1.3;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.header-bill-nudge .hdr-bill-link{
  background:none; border:none; padding:0; margin:0;
  color:var(--blue); font:inherit; font-weight:600; cursor:pointer;
  text-decoration:underline; text-underline-offset:2px;
}
/* Past-due banner (Dave, Nov 6): the lower line of the header's center
   stack, shown only while at least one bill is past due. Red on the soft
   danger plate so it reads as an alert, not a nudge. */
.header-pastdue{
  max-width:100%;
  background:var(--danger-soft); border:1px solid var(--danger);
  border-radius:8px; padding:4px 12px;
  font-size:13.5px; font-weight:700; color:var(--danger);
  text-align:center; line-height:1.3;
}
.header-pastdue .hdr-pastdue-link{
  background:none; border:none; padding:0; margin:0;
  color:inherit; font:inherit; cursor:pointer; text-decoration:none;
}
.header-pastdue .hdr-pastdue-link:hover,
.header-pastdue .hdr-pastdue-link:focus-visible{ text-decoration:underline; text-underline-offset:2px; }
@media (max-width:560px){
  .header-pastdue{font-size:12.5px;}
}
.header-bill-nudge .hdr-bill-link:hover,
.header-bill-nudge .hdr-bill-link:focus-visible{ color:var(--text); }
@media (max-width:560px){
  .app-header h1{font-size:17px;}
  .header-bill-nudge{font-size:12px;}
}
.header-actions{
  grid-column:3; grid-row:1; justify-self:end;
  display:flex; align-items:center; gap:8px; flex:none; min-width:0;
}
.hdr-news{
  flex:none; font-size:13px; font-weight:600; color:var(--blue);
  background:transparent; border:1px solid var(--border);
  border-radius:999px; padding:5px 11px; cursor:pointer; white-space:nowrap;
}
.hdr-news:hover, .hdr-news:focus-visible{background:var(--blue-soft); border-color:color-mix(in srgb, var(--blue) 35%, var(--border));}
/* Slow pulse while an update is available — cleared when the user opens
   What's new from the header, dismisses the banner, or loads the new build. */
@keyframes hdrNewsPulse{
  0%, 100%{ opacity:1; transform:scale(1); box-shadow:0 0 0 0 rgba(53,160,108,.0); }
  50%{ opacity:.75; transform:scale(1.12); box-shadow:0 0 0 6px rgba(53,160,108,.25); }
}
.hdr-news.pulse{ animation:hdrNewsPulse 2.6s ease-in-out infinite; }
/* Tip jar in the sticky header — mega party animation (Dave 2026-10-16):
   slide → wiggle → double-spin → spring zoom → full color cycle →
   pulse ring → shake → rest, with a constant shimmer sweep. */
.hdr-tip{
  flex:none; font-size:13px; font-weight:600; color:var(--text);
  background:transparent; border:1px solid var(--border);
  border-radius:999px; padding:5px 11px; cursor:pointer; white-space:nowrap;
  text-decoration:none; display:inline-block; transform-origin:center;
  position:relative; overflow:hidden;
  animation:tipjar-party 12s ease-in-out infinite;
}
.hdr-tip::after{
  content:""; position:absolute; inset:-2px; pointer-events:none;
  background:linear-gradient(105deg, transparent 42%, rgba(255,255,255,.65) 50%, transparent 58%);
  transform:translateX(-130%) skewX(-8deg);
  animation:tipjar-shimmer 3.6s ease-in-out infinite;
}
.hdr-tip:hover, .hdr-tip:focus-visible{
  background:var(--accent-soft);
  border-color:color-mix(in srgb, var(--accent) 35%, var(--border));
  animation:tipjar-party 12s ease-in-out infinite, tipjar-glow 1.2s ease-in-out infinite;
}
@keyframes tipjar-party{
  0%{transform:translateX(-46px) rotate(0deg) scale(1);opacity:0;filter:hue-rotate(0deg);box-shadow:0 0 0 0 rgba(255,180,0,0)}
  4%{transform:translateX(0) rotate(0deg) scale(1);opacity:1;filter:hue-rotate(0deg);box-shadow:0 0 0 0 rgba(255,180,0,0)}
  6%{transform:rotate(-7deg) scale(1.1)}
  9%{transform:rotate(6deg) scale(1.1)}
  12%{transform:rotate(-4deg) scale(1.05)}
  15%{transform:rotate(0deg) scale(1)}
  19%{transform:rotate(0deg) scale(1)}
  29%{transform:rotate(720deg) scale(1)}
  33%{transform:rotate(720deg) scale(1)}
  37%{transform:rotate(720deg) scale(1.5)}
  41%{transform:rotate(720deg) scale(.88)}
  45%{transform:rotate(720deg) scale(1.08)}
  49%{transform:rotate(720deg) scale(1);filter:hue-rotate(0deg)}
  61%{transform:rotate(720deg) scale(1.06);filter:hue-rotate(360deg)}
  65%{transform:rotate(720deg) scale(1);box-shadow:0 0 0 0 rgba(255,180,0,.55);filter:hue-rotate(360deg)}
  70%{transform:rotate(720deg) scale(1.14);box-shadow:0 0 0 12px rgba(255,180,0,0);filter:hue-rotate(360deg)}
  75%{transform:rotate(720deg) scale(1);box-shadow:0 0 0 0 rgba(255,180,0,0);filter:hue-rotate(360deg)}
  79%{transform:translateX(0) rotate(720deg)}
  82%{transform:translateX(-5px) rotate(720deg)}
  85%{transform:translateX(5px) rotate(720deg)}
  88%{transform:translateX(-3px) rotate(720deg)}
  91%{transform:translateX(0) rotate(720deg)}
  100%{transform:translateX(0) rotate(720deg) scale(1);opacity:1;filter:hue-rotate(360deg);box-shadow:0 0 0 0 rgba(255,180,0,0)}
}
@keyframes tipjar-shimmer{
  0%{transform:translateX(-130%) skewX(-8deg)}
  55%,100%{transform:translateX(130%) skewX(-8deg)}
}
@keyframes tipjar-glow{0%,100%{text-shadow:0 0 0 rgba(0,0,0,0)}50%{text-shadow:0 0 12px var(--accent)}}
@media (prefers-reduced-motion: reduce){
  .hdr-tip, .hdr-tip::after{ animation:none; }
}
/* Phone header layout (Dave's calls, 2026-10-29 + 2026-10-31): on phones
   the header is the app icon on the left and the Tip Jar pill in the
   upper right — "What's new" and the user chip are hidden, and since
   Oct 31 the "Money Buddy" wordmark is hidden too (the icon tile
   stays). (Context: the three zones need ~460px on one row; below that
   the 3-zone grid let the actions column slide left until the Tip Jar
   pill's box overlapped the title and painted through it — Dave's
   Oct 31 screenshot showed it still crowding even after the first
   fix, so the wordmark itself goes at phone widths.) The bill nudge
   keeps its center slot and truncates. The tip pill keeps its shimmer
   sweep on phones (clipped inside the pill — it cannot escape) but
   drops the party transforms, whose painted extent would still sweep
   across the nudge mid-loop. Desktop is unchanged: all four elements,
   wordmark included, full party animation. Declared here, after the
   base header rules, so every declaration in this block is the last
   word at phone widths. */
@media (max-width:560px){
  .brand h1{ display:none; }
  .hdr-news{ display:none; }
  .user-chip{ display:none; }
  .hdr-tip{ animation:none; }
}
@media (prefers-reduced-motion: reduce){
  .hdr-news.pulse{
    animation:none; opacity:1; transform:none;
    background:var(--blue-soft);
    border-color:color-mix(in srgb, var(--blue) 40%, var(--border));
  }
}
/* Ken Burns: slow pan & zoom for AI-generated backgrounds. */
html.bg-kb body{
  animation:kb-pan-zoom 45s ease-in-out infinite alternate;
}
@keyframes kb-pan-zoom{
  0%{ background-position:0% 20%; background-size:105%; }
  100%{ background-position:100% 80%; background-size:115%; }
}
@media (prefers-reduced-motion: reduce){
  html.bg-kb body{ animation:none; }
}
.user-chip{
  font-size:15px; color:var(--muted); background:var(--track);
  border:1px solid var(--border); border-radius:999px; padding:4px 12px;
  font-family:inherit; cursor:pointer; line-height:1.3;
}
.user-chip:hover{ border-color:var(--accent); color:var(--text); }
.user-chip:active{ opacity:.85; }
.user-chip:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

/* ---------- layout ---------- */
main{padding:14px 14px calc(var(--tabbar-h) + var(--tabbar-pad-b) + 26px); width:calc(max(320px, 100% - var(--side-margin) * 2)); max-width:min(760px, 100%); margin:0 auto; min-width:0;}
.screen{animation:fade .18s ease;}
@keyframes fade{from{opacity:.4}to{opacity:1}}
.card{
  background-color:color-mix(in srgb, var(--fcard) var(--card-opacity-pct, 100%), transparent);
  border:1px solid var(--border);
  border-radius:var(--radius); padding:14px; margin-bottom:12px;
  box-shadow:0 1px 2px rgba(20,30,40,.04);
  -webkit-backdrop-filter:blur(var(--card-backdrop-blur, 0px));
  backdrop-filter:blur(var(--card-backdrop-blur, 0px));
}
/* Settings → Layout & card surfaces: optional card shadow (see applyCardShadow). */
html.card-shadow-custom .card,
html.card-shadow-custom .txn,
html.card-shadow-custom .stat,
html.card-shadow-custom .bill-tile,
html.card-shadow-custom .searchstick.repfilterstick{
  box-shadow:var(--card-surface-shadow);
}
/* Custom card background (Settings → Layout & card surfaces): Solid mode overrides --card/--fcard
   on :root; patterned mode leaves theme card fill and layers --card-bg-pattern only. */
.card{
  background-image:var(--card-bg-pattern, none);
  background-size:var(--card-bg-size, auto);
}
.txn{
  background-image:var(--card-bg-pattern, none);
  background-size:var(--card-bg-size, auto);
}
.card h2{font-size:17px; margin:0 0 10px; font-weight:700;}
.card h3{font-size:16px; margin:14px 0 8px; font-weight:700;}
/* Settings cards: same opacity-aware fill as .card, plus a light wash overlay.
   (Do not set background-color:transparent — that hid Theme card transparency.) */
#screen-settings .card[data-setcard]{
  background-color:color-mix(in srgb, var(--fcard) var(--card-opacity-pct, 100%), transparent);
  background-image:
    var(--card-bg-pattern, none),
    linear-gradient(165deg,
      color-mix(in srgb, var(--text) 14%, transparent) 0%,
      color-mix(in srgb, var(--text) 5%, transparent) 48%,
      color-mix(in srgb, #fff 12%, transparent) 100%);
  background-size:var(--card-bg-size, auto), auto;
}
.muted{color:var(--muted); font-size:15px;}
/* Animated loading dots: each dot jumps with a staggered bounce. */
.load-dots{ display:inline-block; margin-left:2px; }
.load-dots span{
  display:inline-block; font-weight:700;
  animation:dot-jump 1.2s infinite;
}
.load-dots span:nth-child(2){ animation-delay:.15s; }
.load-dots span:nth-child(3){ animation-delay:.3s; }
@keyframes dot-jump{
  0%, 100%{ transform:translateY(0) scale(1); opacity:.4; }
  30%{ transform:translateY(-8px) scale(1.3); opacity:1; }
  50%{ transform:translateY(0) scale(.9); opacity:.7; }
  70%{ transform:translateY(-4px) scale(1.1); opacity:1; }
}
.rowline{display:flex; justify-content:space-between; align-items:center; gap:8px; padding:7px 0; border-bottom:1px solid var(--border);}
.rowline:last-child{border-bottom:none;}

/* ---------- stats ---------- */
.stat-grid{display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; margin-bottom:12px;}
.duo-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px;}
.duo-grid .card{margin-bottom:0; display:flex; flex-direction:column;}
/* Expense Budget planner: a light red wash so it reads apart from Income
   (Dave, Nov 16). Soft mix — not the old danger-soft maroon on each row. */
#screen-budgets .card.bot-expense-card{
  background-color:color-mix(in srgb, var(--danger) 7%, color-mix(in srgb, var(--fcard) var(--card-opacity-pct, 100%), transparent));
  border-color:color-mix(in srgb, var(--danger) 22%, var(--border));
}
[data-theme="dark"] #screen-budgets .card.bot-expense-card{
  background-color:color-mix(in srgb, var(--danger) 10%, color-mix(in srgb, var(--fcard) var(--card-opacity-pct, 100%), transparent));
  border-color:color-mix(in srgb, var(--danger) 28%, var(--border));
}
/* Pin the Propose buttons to the bottom so both bot cards line up */
.bot-actions{margin-top:auto; padding-top:12px;}
@media (max-width:560px){ .duo-grid{grid-template-columns:1fr;} }
/* Side-by-side planners scroll independently: each column's row list gets its
   own scroll region capped below the sticky month bar and above the tab bar,
   so a long expense list never pushes the income planner off screen. */
@media (min-width:561px){
  #screen-budgets .duo-grid{ align-items:start; }
  #screen-budgets .duo-grid > .card{ max-height:calc(100vh - 250px); max-height:calc(100dvh - 250px); }
  #bot-table, #ibot-table{ flex:1 1 auto; min-height:0; overflow-y:auto; }
}
.stat{
  background-color:color-mix(in srgb, var(--card) var(--card-opacity-pct, 100%), transparent);
  border:1px solid var(--border); border-radius:var(--radius); padding:12px 10px; text-align:center;
  -webkit-backdrop-filter:blur(var(--card-backdrop-blur, 0px));
  backdrop-filter:blur(var(--card-backdrop-blur, 0px));
}
.stat .label{font-size:12px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:.4px;}
.stat .value{font-size:21px; font-weight:800; margin:4px 0 2px; letter-spacing:-.3px;}
.stat .split{font-size:13.5px; color:var(--muted); line-height:1.5;}
/* bills calendar */
.bill-cal{display:grid; grid-template-columns:repeat(7,1fr); gap:4px;}
.bill-cal .dow{font-size:11px; color:var(--muted); text-align:center; font-weight:700; padding:4px 0; letter-spacing:.3px;}
.bill-cal .day{position:relative; min-height:44px; border:1px solid var(--border); border-radius:10px; padding:4px 2px; font-size:12px; text-align:center; cursor:pointer; background:var(--card);}
.bill-cal .day.other{opacity:0.35;}
.bill-cal .day.today > div:first-child{display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; background:var(--accent); color:#fff; font-weight:700;}
.bill-cal .day.has-bills{background:var(--accent-soft);}
.bill-cal .day.sel{background:var(--accent-faint); border-color:var(--accent);}
.bill-cal .day .dots{display:flex; gap:4px; justify-content:center; margin-top:4px; flex-wrap:wrap; min-height:9px;}
.bill-cal .day .dot{width:9px; height:9px; border-radius:99px; background:var(--accent);}
.bill-cal .day .dot.over{background:var(--danger);}
.bill-cal .day .n{font-size:10px; color:var(--muted); line-height:1.3;}
/* bills list */
.bill-row{display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border);}
.bill-row:last-child{border-bottom:none;}
.bill-row .bi{flex:1; min-width:0;}
.bill-row .bn{font-weight:700;}
.bill-row .bm{font-size:14px; color:var(--muted);}
.bill-row .amt{font-weight:800; white-space:nowrap; font-variant-numeric:tabular-nums;}
/* Home Bills card: compact upcoming list (next 14 days + overdue). */
#dash-bills-list{margin-top:4px;}
#dash-bills-list .bill-row{padding:8px 0;}
#dash-bills-list .bill-row:first-child{border-top:1px solid var(--border); margin-top:6px; padding-top:10px;}
#dash-bills-list .bn{font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
#dash-bills-list .bm{font-size:13px;}
#dash-bills-list .amt{flex:none;}
#dash-bills-list .btn.small{flex:none; padding:7px 12px; font-size:14px; border-radius:10px;}
#dash-bills-more{display:block; margin-top:6px; font-size:13px;}
.bill-badge{font-size:11px; font-weight:700; padding:2px 8px; border-radius:99px; background:var(--accent-faint); color:var(--accent);}
.bill-badge.over{background:color-mix(in srgb, var(--danger) 15%, transparent); color:var(--danger);}
.bill-badge.soon{background:color-mix(in srgb, #f6c85f 20%, transparent); color:#b8860b;}
.bill-tile{
  position:relative; overflow:hidden;
  background-color:color-mix(in srgb, var(--card) var(--card-opacity-pct, 100%), transparent);
  border:1px solid var(--border); border-radius:var(--radius); padding:12px 16px; margin-bottom:10px;
  box-shadow:0 1px 2px rgba(20,30,40,.04);
  -webkit-backdrop-filter:blur(var(--card-backdrop-blur, 0px));
  backdrop-filter:blur(var(--card-backdrop-blur, 0px));
}
/* Flash highlight when jumping to a bill from a transaction's bell badge. */
@keyframes bill-flash-kf{0%,100%{box-shadow:0 0 0 0 rgba(36,86,200,0);}35%{box-shadow:0 0 0 3px rgba(36,86,200,.55);}}
.bill-tile.bill-flash, .bill-row.bill-flash{animation:bill-flash-kf 1.1s ease 2;}
.bill-tile:last-child{margin-bottom:2px;}
.bill-fill{position:absolute; left:0; top:0; bottom:0; width:0; pointer-events:none;}
.bill-tile-main{position:relative;}
.bill-line1{display:flex; align-items:flex-start; gap:10px;}
.bill-line1 .bn{flex:1; min-width:0; font-weight:700; font-size:16px;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;}
.bill-line1 .amt{flex:none; font-weight:800; font-size:17px; white-space:nowrap; font-variant-numeric:tabular-nums; letter-spacing:-.2px;}
.bill-line2{display:flex; align-items:center; gap:8px; margin-top:6px;}
.bill-line2 .bm{flex:1; min-width:0; font-size:13px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.bill-line2 .bill-badge{flex:none;}
.bill-line2 .btn.small{padding:7px 12px; font-size:15px; border-radius:10px;}
@media (max-width:560px){
  .bill-tile{padding:11px 14px;}
}
/* Bills page: month group headers above the bill tiles, with the month's total. */
.bill-month{display:flex; justify-content:space-between; align-items:baseline; gap:10px;
  font-weight:700; font-size:13px; letter-spacing:.05em; text-transform:uppercase;
  color:var(--muted); margin:16px 0 8px; padding-top:12px; border-top:1px solid var(--border);}
#bill-list .bill-month:first-child, #bill-paid-list .bill-month:first-child{margin-top:0; padding-top:0; border-top:none;}
.bill-month-total{font-variant-numeric:tabular-nums;}
/* Bills calendar header: monthly total at the right, balancing the month title. */
#bill-cal-total{margin-left:auto; font-variant-numeric:tabular-nums; font-weight:700; font-size:17px; white-space:nowrap;}
/* Bills page: sticky month header that appears over the upcoming list while
   scrolling — current month, its total, and an Add bill button. Fixed (out of
   flow) so showing/hiding never shifts the list; JS pins it over the card. */
.bill-stickybar{
  position:fixed; top:calc(var(--headH, 64px) + 6px); z-index:15;
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:0 10px 24px rgba(10,20,15,.14);
  padding:8px 12px 8px 14px;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.bill-stickybar[hidden]{display:none;}
.bill-sticky-month{display:flex; align-items:baseline; gap:10px; min-width:0;
  font-weight:700; font-size:13px; letter-spacing:.05em; text-transform:uppercase; color:var(--muted);}
#bill-sticky-label{white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
#bill-sticky-total{font-variant-numeric:tabular-nums; white-space:nowrap;}
/* Mark-paid confirmation sheet */
.paid-card{background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; margin:12px 0;}
.paid-card-top{display:flex; align-items:center; justify-content:space-between; gap:10px;}
.paid-card-name{font-size:17px; font-weight:700;}
.paid-card-amt{font-size:30px; font-weight:800; letter-spacing:-.5px; margin-top:4px;}
.paid-card-due{font-size:13.5px; margin-top:4px;}
.paid-txn{display:flex; gap:12px; align-items:flex-start; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); padding:13px 14px; margin:0 0 18px; cursor:pointer;}
.paid-txn input{width:22px; height:22px; margin:1px 0 0; flex:none; accent-color:var(--blue);}
.paid-txn-t{font-size:16px; font-weight:700;}
.paid-txn-s{font-size:13.5px; margin-top:2px;}
.paid-cancel{display:block; margin:10px auto 0;}
.pos{color:var(--accent);} .neg{color:var(--danger);}

/* ---------- bars ---------- */
.bar{height:9px; background:var(--track); border-radius:99px; overflow:hidden; margin:6px 0 2px;}
.bar > div{height:100%; background:var(--accent); border-radius:99px; transition:width .3s;}
.bar.over > div{background:var(--danger);}
.barrow{margin:10px 0;}
.barrow + .barrow{border-top:1px solid var(--border); padding-top:12px; margin-top:12px;}
/* Setup → Categories */
.catrow{display:flex; align-items:center; gap:8px; padding:9px 2px; border-top:1px solid var(--border);}
.catrow:first-child{border-top:0;}
.catrow-info{flex:1; min-width:0;}
.catrow-name{font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.catrow-meta{font-size:12.5px;}
.pm-spentby{display:flex; align-items:center; gap:6px; margin-top:6px; flex-wrap:wrap;}
.pm-spentby label{font-size:12px; color:var(--muted); font-weight:500; margin:0; white-space:nowrap;}
.pm-spentby input,
.pm-spentby select{flex:1; min-width:100px; max-width:180px; font-size:13px; padding:5px 8px;}
/* Custom name suggestions (replaces native <datalist> — Electron/Chrome often
   park the OS popup far from the input when the page is centered / transformed). */
.name-suggest{
  position:fixed; z-index:120; margin:0; padding:4px;
  background:var(--card); color:var(--text);
  border:1px solid var(--border); border-radius:10px;
  box-shadow:0 10px 28px rgba(0,0,0,.28);
  max-height:220px; overflow:auto; box-sizing:border-box;
}
.name-suggest button{
  display:block; width:100%; text-align:left; margin:0;
  background:transparent; border:0; border-radius:8px;
  color:var(--text); font:inherit; font-size:15px; font-weight:650;
  padding:8px 12px; cursor:pointer; line-height:1.3;
}
.name-suggest button:hover,
.name-suggest button[aria-selected="true"]{ background:var(--accent-faint, rgba(53,160,108,.16)); }
.name-suggest button:focus-visible{ outline:2px solid var(--accent); outline-offset:-2px; }
.btn.small{padding:6px 11px; font-size:13px; width:auto;}
.danger-text{color:var(--danger);}
.catdel-opt{display:flex; align-items:center; gap:8px; padding:9px 2px; font-size:15px;}
.catdel-opt select{flex:1; min-width:0;}
.barrow .top{display:flex; justify-content:space-between; font-size:15.5px;}
.barrow .top b{font-weight:700;}
.sharebar{height:6px; background:var(--track); border-radius:99px; overflow:hidden; margin:8px 0 2px;}
.sharebar > div{height:100%; background:var(--blue); border-radius:99px;}
/* Budget / income-target rows: slider + compact amount */
.bud-ctl{display:flex; align-items:center; gap:8px; margin-top:8px;}
.bud-ctl .blab{font-size:12px; color:var(--muted); flex:none;}
.bud-ctl input[type=range]{flex:1; min-width:0; accent-color:var(--accent); height:28px;}
.bud-ctl input.amt{width:96px; flex:none; text-align:right; font-variant-numeric:tabular-nums;}
.barrow input[type=number]::-webkit-outer-spin-button,
.barrow input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none; margin:0;}
.barrow input[type=number]{-moz-appearance:textfield; appearance:textfield;}
.barlab{font-size:11px; color:var(--muted); margin:8px 0 3px;}
/* auto-save status note inside budget/target controls */
.save-state{font-size:11px; color:var(--muted); min-width:54px; text-align:right;}
.save-state.ok{color:var(--accent);}
.save-state.err{color:var(--danger);}
/* Budget/income category rows: distinct panels so categories are easy to
   tell apart (replaces the thin divider line inside these two lists). */
/* ---------- lists ---------- */
.txn{position:relative; display:flex; flex-wrap:wrap; align-items:flex-start; gap:10px; width:100%; text-align:left;
  background-color:color-mix(in srgb, var(--card) var(--card-opacity-pct, 100%), transparent);
  border:1px solid var(--border); border-radius:12px;
  padding:10px 12px; margin-bottom:8px; cursor:pointer; font-size:17px; color:var(--text);
  -webkit-backdrop-filter:blur(var(--card-backdrop-blur, 0px));
  backdrop-filter:blur(var(--card-backdrop-blur, 0px));}
.txn:active{background-color:color-mix(in srgb, var(--th-bg) var(--card-opacity-pct, 100%), transparent);}
.txn .dot{width:10px; height:10px; border-radius:50%; flex:none; margin-top:7px;}
.txn .dot.in{background:var(--accent);} .txn .dot.ex{background:var(--danger);} .txn .dot.tr{background:var(--muted);}
.txn .mid{flex:1; min-width:0;}
.txn .amt{flex:none; padding-top:1px;}
.txn .t1{font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.txn .t1.wrap{white-space:normal; overflow:visible;}
/* Tile footer: inline fields live in .mid (title column); full-width fields sit
   on a sibling row under the amount. Shared field styling for both. */
.txn .mid .t2{margin-top:4px; font-size:14.5px; color:var(--muted); min-width:0;
  display:flex; flex-wrap:wrap; align-items:baseline; gap:0 4px;}
.txn > .t2{flex:1 0 100%; width:100%; padding-left:20px; font-size:14.5px; color:var(--muted);
  display:flex; flex-wrap:wrap; align-items:baseline; gap:0 4px;}
.txn.selrow > .t2{padding-left:50px;} /* selbox(20)+gap(10)+dot(10)+gap(10) */
.txn .t2 .tf{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; min-width:0;}
.txn .t2 .tf.wrap{white-space:normal; overflow:visible;}
.txn > .t2 .tf.full{flex:0 0 100%; max-width:100%;}
.txn .t2 .tf-sep{flex:none;}
.txn .amt{font-weight:700; font-variant-numeric:tabular-nums; flex:none;}
.txn .who{font-size:11px; color:var(--muted); background:var(--bg); border-radius:99px; padding:2px 8px; flex:none;}
.datehead{font-size:14.5px; font-weight:700; color:var(--bg-contrast, var(--muted)); text-transform:uppercase; letter-spacing:.5px; margin:14px 2px 8px;
  display:flex; justify-content:space-between; align-items:baseline; gap:10px;}
/* Settings → Interface: per-day expense/income totals on the Transactions page.
   Amount colors come from the shared .pos / .neg rules (var(--accent) /
   var(--danger)) — same tokens as .txn .amt. */
.datehead .dtot{white-space:nowrap; font-weight:700;
  font-size:16px; text-transform:none; letter-spacing:0;
  background:var(--card); border:1px solid var(--border);
  border-radius:999px; padding:2px 10px;}
/* Daily totals "Plain" style (Settings → Interface): no pill; same size as
   the day label. Colors stay on .pos / .neg. */
body.ui-dtot-plain .datehead .dtot{
  background:none; border:none; padding:0; border-radius:0;
  font-size:14.5px;
}
/* Daily totals "Subtle" style: translucent rectangle behind both values —
   less prominent than the pill, more defined than plain. Colors stay on
   .pos / .neg. */
body.ui-dtot-subtle .datehead .dtot{
  background:rgba(0,0,0,.30);
  border-radius:6px; padding:2px 8px;
  font-size:14.5px; text-transform:none; letter-spacing:0; font-weight:700;
  white-space:nowrap;
}
[data-theme="light"] body.ui-dtot-subtle .datehead .dtot{
  background:rgba(255,255,255,.65);
}
/* bulk selection: editing-mode toolbar between the filter card and the list */
.selbar{background:var(--card); border:2px solid var(--blue); border-radius:var(--radius);
  box-shadow:0 2px 10px rgba(10,20,15,.08); padding:8px 10px; margin:0 0 12px;
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.selbar .btn{margin:0;}
.selbar .btn:disabled{opacity:.45;}
/* Intrinsic side clusters; Update fills leftover space and can shrink/ellipsis. */
.selbar .selbar-left{display:flex; align-items:center; gap:6px; flex:0 0 auto;}
.selbar .selbar-left .btn{flex:none;}
.selbar .selbar-mid{flex:1 1 8em; min-width:0; display:flex; align-items:center; justify-content:center;}
.selbar .selbar-right{display:flex; align-items:center; justify-content:flex-end; flex:0 0 auto;}
.selbar #selbar-update{flex:1 1 auto; width:100%; min-width:0; max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.selbar #selbar-delete{flex:none;}
.selbar #selbar-delete:disabled{opacity:.45; cursor:default;}
@media (max-width:560px){
  .selbar .selbar-mid{flex:1 1 100%; order:3;}
  .selbar .selbar-right{margin-left:auto;}
}
/* docked: while the floating sticky card is visible, the bulk-update bar
   becomes an attached section inside it */
.selbar.stuck{
  margin:10px -14px -10px;
  padding:10px 14px;
  border:none;
  border-top:1px solid var(--border);
  border-radius:0 0 var(--radius) var(--radius);
  box-shadow:none;
  background:var(--card);
}
/* docked: while the floating sticky filter card is visible and a drill
   context is active, the temporary drill pill parks itself as an attached
   section at the bottom of the sticky card (same treatment as .selbar.stuck) */
.drillchip.docked{
  margin:10px -14px -10px;
  padding:9px 14px;
  border:none;
  border-top:1px solid var(--border);
  border-radius:0;
  box-shadow:none;
}
[data-theme="dark"] .drillchip.docked{
  background:color-mix(in srgb, var(--blue) 34%, var(--card));
  border-top-color:color-mix(in srgb, var(--blue) 55%, var(--border));
  box-shadow:none;
}
/* rounded bottom corners only when the pill is the last section in the
   sticky card — it parks below the bulk-update bar when select mode is on */
#searchstick > #txn-drill:last-child .drillchip.docked{border-radius:0 0 var(--radius) var(--radius);}
/* drill parked below the bulk bar in the sticky card: the bar's bottom
   corners go square and the pill takes the rounding */
#searchstick > #selbar.stuck:has(+ #txn-drill){border-radius:0;}
.drillchip.soft-in{animation:selbar-soft-in .22s ease;}
/* in-flight bulk jobs: one slim progress bar each, stacked above the selection bar */
#jobbars{display:flex; flex-direction:column; gap:8px; margin:0 0 12px;}
#jobbars:empty{display:none;}
.jobbar{background:var(--card); border:1px solid var(--border); border-radius:14px;
  box-shadow:0 10px 24px rgba(10,20,15,.18); padding:8px 12px;
  display:flex; align-items:center; gap:10px;}
.jobbar .jlabel{flex:1; min-width:0; font-size:13.5px; font-weight:700;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.jobbar .jlabel .jsub{font-weight:400; color:var(--muted);}
.jobbar .jstop{flex:none;}
.txn.selrow.checked{background:var(--th-bg); border-color:var(--blue);}
/* bulk-update result highlight: green once a row's update has landed */
.txn.bulk-done{background:rgba(52,199,89,.16);}
.txn.bulk-fail{background:rgba(255,59,48,.13);}
/* bulk result tint must beat the selected-row tint (higher specificity) */
.txn.selrow.checked.bulk-done{background:rgba(52,199,89,.16);}
.txn.selrow.checked.bulk-fail{background:rgba(255,59,48,.13);}
.txn .selbox{width:20px; height:20px; flex:none; accent-color:var(--blue); pointer-events:none;}
/* bulk-update per-row progress thermometer */
.bulkbar{position:absolute; left:4px; top:8px; bottom:8px; width:4px;
  border-radius:99px; background:var(--th-bg);}
.bulkbar.pending{background:repeating-linear-gradient(45deg, var(--blue) 0 5px, rgba(0,122,255,.22) 5px 10px);
  animation:barber 1s linear infinite;}
@keyframes barber{to{background-position:20px 0;}}
.bulkbar.done{background:#34c759;}
.bulkbar.fail{background:var(--danger);}
/* bulk-update progress sweep: light-green fill that sweeps left to right
   across the row while its save is in flight */
.bulkfill{position:absolute; left:0; top:0; bottom:0; width:0; max-width:100%;
  background:rgba(52,199,89,.20); border-radius:inherit; pointer-events:none;
  transition:width 1.1s ease;}
/* busy feedback */
.spinner{display:inline-block; width:15px; height:15px; border:2px solid rgba(255,255,255,.35);
  border-top-color:#fff; border-radius:50%; animation:spin .8s linear infinite;
  vertical-align:-2px; margin-right:8px;}
@keyframes spin{to{transform:rotate(360deg);}}
.pbar{height:6px; background:var(--th-bg); border-radius:99px; overflow:hidden;
  margin-top:10px; display:none;}
.pbar > div{height:100%; width:0; background:var(--blue); border-radius:99px; transition:width .2s;}
.empty{text-align:center; color:var(--muted); padding:34px 16px; font-size:16.5px;}
.empty .big{font-size:30px; display:block; margin-bottom:8px;}

/* ---------- forms ---------- */
label.f{display:block; font-size:15px; font-weight:600; color:var(--muted); margin:12px 0 5px;}
input[type=text],input[type=email],input[type=password],input[type=number],input[type=date],input[type=month],input[type=url],select,textarea{
  width:100%; font-size:18px; padding:10px 12px; border:1px solid var(--border);
  border-radius:10px; background:var(--input-bg); color:var(--text); font-family:inherit;
}
/* Custom chevron inset from the right edge (native arrows sit flush). */
select{
  appearance:none; -webkit-appearance:none; -moz-appearance:none;
  background-color:var(--input-bg);
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2368727f' d='M1.5 2.2h9L6 6.8z'/></svg>");
  background-repeat:no-repeat;
  background-position:right 14px center;
  background-size:12px 7px;
  padding-right:36px;
}
[data-theme="dark"] select{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%239aa7b4' d='M1.5 2.2h9L6 6.8z'/></svg>");
}
/* month pickers have a wide intrinsic minimum; let them shrink inside flex/grid columns */
input[type=month]{min-width:0;}
/* Month field + calendar button (opens native picker via showPicker when available) */
.month-field{display:flex; align-items:stretch; gap:8px;}
.month-field input[type=month]{flex:1; min-width:0;}
.month-cal-btn{
  flex:none; width:48px; border:1px solid var(--border); border-radius:10px;
  background:var(--input-bg); color:var(--text); cursor:pointer;
  display:flex; align-items:center; justify-content:center; padding:0;
}
.month-cal-btn:focus{outline:2px solid var(--blue-soft); border-color:var(--blue);}
.month-cal-btn svg{width:22px; height:22px; display:block;}
/* date pickers too — keeps them inside their grid column on the edit form */
.fgrid input[type=date]{min-width:0;}
/* edit/add transaction form: fields size to their contents instead of full width */
.sheet.fitfields input[type=text],.sheet.fitfields input[type=number],.sheet.fitfields input[type=date],
.sheet.fitfields select,.sheet.fitfields textarea{width:auto; max-width:100%;}
/* ...except fields marked fullw, which always span the form width */
.sheet.fitfields input.fullw,.sheet.fitfields select.fullw,.sheet.fitfields textarea.fullw{width:100%;}
/* edit/add transaction form: single column on phones, 2 columns on iPad and wider */
.fgrid{display:grid; grid-template-columns:1fr; gap:0 14px;}
@media (min-width:700px){
  .fgrid{grid-template-columns:1fr 1fr;}
  .fgrid .span2{grid-column:1 / -1;}
}
/* auto-growing textareas start at their row count and expand with content */
textarea.autogrow{min-height:0; resize:none; overflow:hidden;}
/* clear (×) button inside search boxes */
.clearbtn{position:absolute; right:6px; top:50%; transform:translateY(-50%);
  width:33px; height:33px; border:none; border-radius:50%; padding:0;
  background:var(--seg-bg); color:var(--muted); font-size:22px; line-height:1;
  cursor:pointer; display:flex; align-items:center; justify-content:center;}
.clearbtn[hidden]{display:none;}
input:focus,select:focus,textarea:focus{outline:2px solid var(--blue-soft); border-color:var(--blue);}
/* Card alerts inbox rows (Import screen). */
.alertrow{ display:flex; align-items:center; gap:10px; padding:10px 4px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.alertrow-main{ flex:1; min-width:180px; }
.alertrow-title{ font-weight:600; font-size:15px; }
.alertrow-sub{ font-size:12.5px; }
.alertrow-amt{ font-weight:700; font-size:15px; }
.alertrow-acts{ display:flex; gap:6px; }
/* Pending badge on transaction rows (unconfirmed card alerts). */
.pendbadge{ font-size:11px; font-weight:700; color:var(--blue); border:1.5px solid var(--blue); border-radius:999px; padding:1px 7px; white-space:nowrap; }
.pendbadge.stale{ color:#b26a00; border-color:#b26a00; }
/* Import preview badges for alert matches. */
.alertbadge{ display:inline-block; margin-left:8px; font-size:11px; font-weight:700; color:#fff; background:var(--green,#2e7d4f); border-radius:999px; padding:1px 8px; white-space:nowrap; }
.alertbadge.maybe{ background:#b26a00; }
/* Who's-entering strip: one-time name ask inside the entry forms. */
.namestrip{ border:2px solid var(--blue); background:var(--input-bg); border-radius:12px; padding:12px 14px; margin:10px 0 14px; }
.namestrip h3{ margin:0 0 4px; font-size:16px; }
.namestrip p{ margin:0 0 8px; font-size:13.5px; }
.namestrip input{ font-size:18px; }
/* Wish list redesign (Jonny's direction, 2026-10-18). Replaces .wish-field sizing. */
.wish-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.wish-total{font-size:15px;font-weight:600;color:#fbbf24;font-variant-numeric:tabular-nums;white-space:nowrap;padding-top:4px}
.wish-cards{display:flex;flex-direction:column;gap:12px;margin:8px 0}
.wish-card{position:relative;background:rgba(255,255,255,.055);border:1px solid rgba(255,255,255,.07);
  border-radius:18px;padding:18px 20px}
.wish-card.wish-enter{animation:wish-in .45s cubic-bezier(.22,1,.36,1)}
.wish-card.wish-leaving{opacity:0;transform:translateX(24px);transition:opacity .22s ease,transform .22s ease}
@keyframes wish-in{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.wish-row1{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;padding-right:76px}
.wish-name{font-size:17px;font-weight:600;color:var(--text)}
.wish-pricewrap{margin-left:auto}
.wish-price{font-size:17px;font-weight:700;color:#fbbf24;font-variant-numeric:tabular-nums}
.wish-unit{font-size:13px;color:var(--muted)}
.wish-x{position:absolute;top:10px;right:10px;width:36px;height:36px;border:0;background:none;
  color:#5b7290;font-size:22px;line-height:1;cursor:pointer;border-radius:10px}
.wish-x:hover{color:#e87a7a;background:rgba(232,122,122,.12)}
.wish-editbtn{position:absolute;top:10px;right:48px;height:36px;border:0;background:none;
  color:#5b7290;font-size:13px;font-weight:600;cursor:pointer;border-radius:10px;padding:0 10px}
.wish-editbtn:hover{color:var(--text);background:rgba(255,255,255,.06)}
.wish-note{font-size:14px;line-height:1.55;color:#8fa9c4;margin-top:8px}
.wish-note.clamped{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.wish-more{background:none;border:0;color:var(--blue);font-size:13px;font-weight:600;cursor:pointer;padding:2px 0}
.wish-linkrow{margin-top:8px}
.wish-link{font-size:13px;color:var(--blue);text-decoration:none}
.wish-link:hover{text-decoration:underline}
/* wish → budget bridge (Dave 2026-10-30) */
.wish-moverow{margin-top:10px}
.wish-movebtn{border:1px solid rgba(52,211,153,.45);background:rgba(52,211,153,.1);color:#34d399;
  font-size:13.5px;font-weight:700;cursor:pointer;border-radius:999px;padding:7px 14px}
.wish-movebtn:hover{background:rgba(52,211,153,.18)}
.wish-planned{margin-top:8px;font-size:13.5px;font-weight:600;color:#34d399}
[data-theme="light"] .wish-movebtn,.light .wish-movebtn{color:#047857;border-color:rgba(4,120,87,.4);background:rgba(4,120,87,.08)}
[data-theme="light"] .wish-planned,.light .wish-planned{color:#047857}
.wish-empty{text-align:center;padding:36px 16px;color:var(--muted)}
.wish-empty-icon{font-size:34px;margin-bottom:10px}
.wish-empty-title{font-size:16px;font-weight:600;color:var(--text);margin-bottom:6px}
.wish-empty-sub{font-size:14px}
/* form */
.wish-form-title{font-size:13px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;
  color:var(--muted);margin:22px 0 12px}
.wish-form-row{display:flex;gap:10px;flex-wrap:wrap}
.wish-fld{margin-bottom:12px}
.wish-fld label{display:block;font-size:12.5px;font-weight:600;color:var(--muted);margin-bottom:6px}
.wish-fld input,.wish-fld textarea{width:100%;box-sizing:border-box;background:#0a1728;
  border:1px solid rgba(255,255,255,.1);border-radius:12px;padding:13px 14px;font-size:15px;color:var(--text)}
.wish-fld textarea{resize:vertical;min-height:58px}
.wish-fld input:focus,.wish-fld textarea:focus{outline:none;border-color:#34d399}
.wish-fld input::placeholder,.wish-fld textarea::placeholder{color:var(--muted);opacity:.75}
.wish-addbtn{width:100%;height:52px;border:0;border-radius:14px;background:#34d399;color:#06281c;
  font-size:16px;font-weight:700;cursor:pointer;margin-top:4px}
.wish-addbtn:hover{filter:brightness(1.06)}
.wish-addbtn:active{transform:scale(.99)}
.wish-hint{font-size:12.5px;color:var(--muted);text-align:center;margin:10px 0 0}
.wish-editing .wish-edit-actions{display:flex;gap:8px;margin-top:12px}
.wish-savebtn{flex:1;height:46px;border:0;border-radius:12px;background:#34d399;color:#06281c;
  font-size:15px;font-weight:700;cursor:pointer}
.wish-cancelbtn{height:46px;padding:0 20px;border:1px solid rgba(255,255,255,.14);border-radius:12px;
  background:none;color:var(--muted);font-size:15px;font-weight:600;cursor:pointer}
/* undo toast */
.wish-undo{position:fixed;left:50%;bottom:88px;transform:translate(-50%,16px);z-index:300;
  display:flex;align-items:center;gap:14px;background:#1c2530;color:#edf1f5;
  border:1px solid rgba(255,255,255,.12);border-radius:14px;padding:12px 16px;font-size:14px;
  box-shadow:0 8px 28px rgba(0,0,0,.4);opacity:0;transition:opacity .25s ease,transform .25s ease;
  pointer-events:none}
.wish-undo.show{opacity:1;transform:translate(-50%,0);pointer-events:auto}
.wish-undo button{border:0;background:none;color:#34d399;font-size:14px;font-weight:700;cursor:pointer;padding:4px 6px}
/* light theme: cards sit on the white container, so elevation goes the other way */
[data-theme="light"] .wish-card,.light .wish-card{background:#f1f4f7;border-color:var(--border)}
[data-theme="light"] .wish-note,.light .wish-note{color:var(--muted)}
[data-theme="light"] .wish-fld input,[data-theme="light"] .wish-fld textarea,
.light .wish-fld input,.light .wish-fld textarea{background:var(--input-bg);border-color:var(--border);color:var(--text)}
[data-theme="light"] .wish-x,[data-theme="light"] .wish-editbtn,
.light .wish-x,.light .wish-editbtn{color:var(--muted)}
[data-theme="light"] .wish-editbtn:hover,.light .wish-editbtn:hover{background:rgba(0,0,0,.05);color:var(--text)}
[data-theme="light"] .wish-cancelbtn,.light .wish-cancelbtn{border-color:var(--border)}
[data-theme="light"] .wish-total,.light .wish-total{color:#b45309}
textarea{resize:vertical; min-height:64px;}
/* sign-in status card (Settings -> Firebase) */
.set-firebase-auth{
  margin:10px 0 4px;
}
.set-firebase-auth .authcard{
  display:flex; gap:10px; align-items:flex-start;
  flex:1; min-width:0; margin:0;
}
.set-firebase-auth-text{flex:1; min-width:0;}
/* Sign out lives inside the subcard, right-aligned next to the status text. */
.authcard #set-auth-signout{
  flex:none; align-self:center; margin:0;
}
.authcard{display:flex; gap:10px; align-items:flex-start; background:var(--card);
  border:1px solid var(--border); border-radius:12px; padding:12px 14px; margin:10px 0;}
.authdot{width:10px; height:10px; border-radius:50%; margin-top:5px; flex:none; background:var(--muted);}
.authcard.signed .authdot{background:var(--accent);}
.authcard.anon .authdot{background:var(--warn);}
.authtitle{font-weight:700; font-size:17px;}
#set-auth-desc{font-size:13px; margin-top:3px;}
/* Firebase use modes: brand icons (Google/Apple/GitHub) above two tiles
   (No password | username/password). Benefits/risks sit under the selection. */
#screen-settings .set-auth-modes{margin:8px 0 4px;}
/* Brand icons: full-width row above both sign-in tiles, centered. */
#screen-settings .set-auth-oauth-icons{
  grid-column:1 / -1;
  display:flex; justify-content:center; align-items:center; gap:14px;
  width:100%; margin:0 0 2px; padding:0;
  box-sizing:border-box;
}
#screen-settings .set-auth-brand{
  width:44px; height:44px; padding:0; margin:0; border-radius:50%;
  border:1.5px solid var(--border); background:var(--bg); color:var(--text);
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer; flex:none; box-sizing:border-box;
}
#screen-settings .set-auth-brand:hover{border-color:var(--blue); background:var(--blue-soft);}
#screen-settings .set-auth-brand.on{
  border-color:var(--blue); background:var(--blue-soft);
  box-shadow:0 0 0 2px var(--blue-soft);
}
#screen-settings .set-auth-brand svg{width:22px; height:22px; display:block;}
#screen-settings .set-auth-mode{
  display:block; width:100%; text-align:center; cursor:pointer;
  border:1px solid var(--border); background:var(--bg); color:var(--text);
  border-radius:12px; padding:10px 12px; margin:0;
  box-sizing:border-box; min-width:0;
}
#screen-settings .set-auth-mode:hover{border-color:var(--blue);}
#screen-settings .set-auth-mode.on{
  border-color:var(--blue); background:var(--blue-soft);
}
#screen-settings .set-auth-mode-title{
  display:block; font-size:15.5px; font-weight:700; line-height:1.25; text-align:center;
}
#screen-settings .set-auth-mode-desc{
  display:block; font-size:13px; color:var(--muted); margin-top:3px; line-height:1.35; font-weight:500; text-align:center;
}
#screen-settings .set-auth-mode.on .set-auth-mode-desc{color:var(--text); opacity:.82;}
/* Grid: brand icons span both columns; then No password | username/password.
   Tiles share one top edge; panels/features hang under each tile. */
#screen-settings .set-auth-detail{
  display:grid; grid-template-columns:1fr 1fr; gap:12px 24px;
  align-items:start;
  margin:8px 0 4px; box-sizing:border-box;
}
#screen-settings .set-auth-detail[data-under="private"]{
  gap:8px 10px;
}
#screen-settings .set-auth-col{
  display:flex; flex-direction:column; gap:12px; min-width:0;
}
#screen-settings .set-auth-col-left .set-auth-features{
  align-self:center;
}
@media (max-width:560px){
  #screen-settings .set-auth-detail{
    grid-template-columns:1fr; gap:12px;
  }
  #screen-settings .set-auth-oauth-icons{order:1;}
  #screen-settings .set-auth-col-left,
  #screen-settings .set-auth-col-right{display:contents;}
  #screen-settings .set-auth-detail [data-auth-mode="private"]{order:2;}
  #screen-settings .set-auth-detail [data-auth-mode="email"]{order:3;}
  #screen-settings .set-auth-detail #set-auth-email-panel,
  #screen-settings .set-auth-detail #set-auth-oauth-panel{order:4;}
  #screen-settings .set-auth-detail .set-auth-features{
    order:5; align-self:stretch; width:100%; max-width:100%;
  }
}
/* Email / OAuth panels — no card chrome. */
#screen-settings #set-auth-private-note{margin:8px 0 2px; font-size:13px;}
#screen-settings #set-auth-email-panel,
#screen-settings #set-auth-oauth-panel{
  margin:0; width:100%; max-width:none;
  padding:4px 0; text-align:center;
  background:transparent; border:none; border-radius:0;
  box-sizing:border-box;
}
#screen-settings .set-auth-email-sub{
  font-size:13px; color:var(--muted); margin:0 0 14px; line-height:1.35; font-weight:500;
}
#screen-settings .set-auth-fields{
  display:flex; flex-direction:column; gap:10px; text-align:left;
}
#screen-settings .set-auth-fields .f{margin:0 0 4px; font-size:13px;}
#screen-settings .set-auth-fields input{
  width:100%; margin:0; border-radius:999px; padding:11px 16px; font-size:16px;
}
#screen-settings .set-auth-forgot{
  margin:8px 0 0; text-align:left;
}
#screen-settings .set-auth-forgot .linkbtn{
  font-size:13.5px; padding:2px 0; font-weight:600;
}
#screen-settings .set-auth-email-actions{
  display:flex; flex-direction:column; gap:10px; margin-top:16px;
}
#screen-settings .set-auth-email-actions .btn{
  width:100%; margin:0; border-radius:999px; padding:12px 18px; font-size:16.5px;
}
#screen-settings .set-auth-email-actions .btn.ghost{
  background:transparent; color:var(--blue); border:1.5px solid var(--blue);
}
#screen-settings .set-auth-email-actions .btn.ghost:hover{
  background:var(--blue-soft);
}
#screen-settings #set-auth-oauth-panel .set-auth-email-sub{margin-bottom:14px;}
#screen-settings #set-auth-oauth{
  width:100%; border-radius:999px; padding:12px 18px; font-size:16.5px;
}
/* Per-mode benefits (green ✓) and risks (red ✕):
   one left-aligned column (placement handled by .set-auth-detail). */
#screen-settings .set-auth-features{
  list-style:none; margin:0; padding:0 6px 2px;
  display:flex; flex-direction:column; align-items:stretch; gap:8px;
  width:max-content; max-width:100%;
  box-sizing:border-box;
}
#screen-settings .set-auth-features li{
  display:flex; align-items:flex-start; gap:10px;
  font-size:13.5px; line-height:1.35; font-weight:500; text-align:left;
  color:var(--text); width:auto; max-width:100%;
  box-sizing:border-box;
}
#screen-settings .set-auth-feat-ico{
  flex:0 0 20px; width:20px; height:20px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:800; line-height:1; margin-top:1px;
  box-sizing:border-box;
}
#screen-settings .set-auth-feat-ok .set-auth-feat-ico{
  color:#22c55e; border:1.5px solid #22c55e; background:rgba(34,197,94,.14);
}
#screen-settings .set-auth-feat-bad .set-auth-feat-ico{
  color:#ef4444; border:1.5px solid #ef4444; background:rgba(239,68,68,.12);
}
#screen-settings .set-auth-features .sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
.seg{display:flex; background:var(--seg-bg); border:1px solid var(--border); border-radius:12px; padding:3px; gap:3px;}
.seg button{flex:1; border:none; background:transparent; padding:9px 4px; border-radius:9px;
  font-size:16.5px; font-weight:600; color:var(--muted); cursor:pointer;}
.seg button.on{background:var(--card); color:var(--text); box-shadow:0 1px 3px rgba(0,0,0,.12);}
/* Storage picker (setup + settings): unmistakable selected state — accent
   ring + tint + bold accent text, readable on every theme. */
#setup-store-seg button.on, #set-store-seg button.on{
  background:var(--accent-faint); color:var(--accent); font-weight:700;
  box-shadow:inset 0 0 0 2px var(--accent), 0 1px 3px rgba(0,0,0,.12);
}
.seg.seg-wrap{flex-wrap:wrap;}
.seg.seg-wrap button{flex:1 1 calc(33.333% - 3px); min-width:5.5em;}
/* Chart onboarding (empty data file): pick-your-charts question card. */
.co-opts{display:flex;flex-direction:column;gap:8px;margin:4px 0 14px;}
.co-opt{display:flex;align-items:center;gap:12px;width:100%;text-align:left;
  background:var(--card);border:1px solid var(--border);border-radius:12px;
  padding:12px;cursor:pointer;color:var(--text);font-size:15px;}
.co-opt .co-check{flex:none;width:22px;height:22px;border-radius:7px;
  border:2px solid var(--muted);box-sizing:border-box;position:relative;}
.co-opt.on{border-color:var(--accent);background:var(--accent-faint);}
.co-opt.on .co-check{background:var(--accent);border-color:var(--accent);}
.co-opt.on .co-check::after{content:'';position:absolute;left:6px;top:2px;width:5px;height:10px;
  border:solid var(--card);border-width:0 2.5px 2.5px 0;transform:rotate(45deg);}
.co-tx{display:flex;flex-direction:column;gap:2px;}
.co-title{font-weight:700;}
.co-sub{color:var(--muted);font-size:13px;}
.co-actions{display:flex;flex-direction:column;gap:8px;align-items:stretch;}
.filters{display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:10px;}
.filters .full{grid-column:1 / -1;}
/* "All" quick-reset chip grouped with a filter menu: blue = no filter (All),
   dimmed = a specific item is chosen; tapping it resets the menu to All. */
.allchip{flex:none; border:1px solid var(--border); background:var(--bg); color:var(--muted);
  border-radius:14px; padding:8px 11px; font-size:15px; font-weight:700; cursor:pointer; white-space:nowrap;}
.allchip.on{background:var(--blue); border-color:var(--blue); color:#fff;}
/* reports category filter chips: multi-select, Capital One tracker pattern */
.catchip{border:1px solid var(--border); background:var(--bg); color:var(--text);
  border-radius:14px; padding:8px 12px; font-size:15px; font-weight:600; cursor:pointer; white-space:nowrap;}
.catchip.on{background:var(--blue); border-color:var(--blue); color:#fff;}
/* Copy budget/income sheet: year-month source pills with totals + plan/actual bars.
   Wide: 2 rows × 6 cols; narrow (phone): 6 rows × 2 cols. */
.copymonth-pills{
  display:grid; grid-template-columns:repeat(6, 1fr); gap:8px; margin:10px 0 2px;
}
.copymonth-pill{
  border:1px solid var(--border); background:var(--bg); color:var(--text);
  border-radius:14px; padding:8px 10px 9px; font-size:14px; font-weight:600; cursor:pointer;
  display:flex; flex-direction:column; align-items:stretch; gap:2px;
  width:100%; min-width:0; box-sizing:border-box;
}
@media (max-width:560px){
  .copymonth-pills{grid-template-columns:repeat(2, 1fr);}
}
.copymonth-pill .cm-mo{font-size:13px; font-weight:700; line-height:1.1;}
.copymonth-pill .cm-amt{font-size:13px; font-weight:600; color:var(--muted); line-height:1.1;}
.copymonth-pill .cm-bars{
  display:flex; flex-direction:column; gap:2px; width:100%; margin-top:4px;
}
.copymonth-pill .cm-bar{
  height:3px; border-radius:99px; background:var(--track); overflow:hidden; width:100%;
}
.copymonth-pill .cm-bar > i{display:block; height:100%; border-radius:99px; max-width:100%;}
.copymonth-pill .cm-bar.plan > i{background:var(--blue); opacity:.65;}
.copymonth-pill .cm-bar.act > i{background:var(--accent);}
.copymonth-pill .cm-bar.act.over > i{background:var(--danger);}
.copymonth-pill .cm-bar.act.under > i{background:var(--warn);}
.copymonth-pill.on{background:var(--blue); border-color:var(--blue); color:#fff;}
.copymonth-pill.on .cm-amt{color:rgba(255,255,255,.88);}
.copymonth-pill.on .cm-bar{background:rgba(255,255,255,.28);}
.copymonth-pill.on .cm-bar.plan > i,
.copymonth-pill.on .cm-bar.act > i{background:#fff; opacity:.95;}
.copymonth-pill.on .cm-bar.act.over > i{background:#fecaca; opacity:1;}
.copymonth-pill.on .cm-bar.act.under > i{background:#fde68a; opacity:1;}
.copymonth-pill.is-target{opacity:.55; cursor:default;}
.copymonth-pill.is-empty .cm-amt{font-weight:500;}
.copymonth-legend{
  display:flex; flex-wrap:wrap; gap:10px 14px; align-items:center;
  font-size:12px; color:var(--muted); margin:0 0 8px; line-height:1.2;
}
.copymonth-legend .cm-key{
  display:inline-flex; align-items:center; gap:6px;
}
.copymonth-legend .cm-swatch{
  display:inline-block; width:14px; height:3px; border-radius:99px; vertical-align:middle;
}
.copymonth-legend .cm-swatch.plan{background:var(--blue); opacity:.65;}
.copymonth-legend .cm-swatch.act{background:var(--accent);}
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border:none; border-radius:12px; padding:12px 18px; font-size:17.5px; font-weight:700;
  cursor:pointer; background:var(--blue); color:#fff; width:100%;
}
.btn:active{opacity:.85;}
.btn:disabled{opacity:.75; cursor:default;}
.btn.ghost{
  background:var(--track); color:var(--text); border:1px solid var(--border);
}
.btn.danger{background:var(--danger);}
.btn.go{background:var(--accent);}
.btn.small{width:auto; padding:8px 14px; font-size:16px;}
.btnrow{display:flex; gap:10px; margin-top:14px;}
.btnrow .btn{margin:0;}
/* Settings → Dialogs: dialog button-bar layout prefs (device-local).
   Scoped to modal sheets so page-level button rows are untouched.
   Dialog bars are built as [Cancel(.btn.ghost), Save(.btn), delete(.iconbtn)]. */
body.ui-swap-btns #modal-root .sheet .btnrow > .btn.ghost{ order:2; }
body.ui-swap-btns #modal-root .sheet .btnrow > .btn:not(.ghost){ order:1; }
body.ui-swap-btns #modal-root .sheet .btnrow > .iconbtn{ order:3; }
/* Delete icon pinned to the left end of the dialog bar. */
body.ui-del-left #modal-root .sheet .btnrow > .iconbtn{ order:-1; margin-right:auto; }
body.ui-swap-btns.ui-del-left #modal-root .sheet .btnrow > .iconbtn{ order:-1; }
/* Delete icon centered between Cancel and Save. */
body.ui-del-center #modal-root .sheet .btnrow > .btn.ghost{ order:1; }
body.ui-del-center #modal-root .sheet .btnrow > .btn:not(.ghost){ order:3; }
body.ui-del-center #modal-root .sheet .btnrow > .iconbtn{ order:2; margin-left:auto; margin-right:auto; }
body.ui-swap-btns.ui-del-center #modal-root .sheet .btnrow > .btn.ghost{ order:3; }
body.ui-swap-btns.ui-del-center #modal-root .sheet .btnrow > .btn:not(.ghost){ order:1; }
/* Settings cards: compact action rows (not full-bleed primary blocks) */
#screen-settings .set-actions{
  display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:10px;
}
#screen-settings .set-actions .btn{width:auto; flex:none; margin:0;}
#screen-settings .set-actions .linkbtn{font-size:14px; padding:6px 4px;}
#screen-settings .set-util{margin-top:12px;}
#screen-settings .set-util .linkbtn{font-size:14px;}
#screen-settings .set-auto-backup{
  margin-top:14px; padding-top:12px; border-top:1px solid var(--border);
}
#screen-settings .set-auto-backup .chk{display:flex; align-items:flex-start; gap:8px; font-size:14px; font-weight:600; cursor:pointer;}
#screen-settings .set-auto-backup .chk input{margin-top:3px; width:18px; height:18px; flex:none;}
#screen-settings .set-auto-backup-opts{margin-top:10px;}
#screen-settings .set-auto-backup-controls{
  display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end;
}
#screen-settings .set-auto-backup-interval-field{
  flex:1 1 160px; min-width:0; max-width:100%;
}
#screen-settings .set-auto-backup-interval-field .f{margin:0 0 4px;}
/* Match select + action button heights in the How often row */
#screen-settings .set-auto-backup-interval-field select,
#screen-settings .set-auto-backup-controls > .btn{
  box-sizing:border-box;
  min-height:42px;
  padding:8px 14px;
  font-size:16px;
  line-height:1.25;
  margin:0;
}
#screen-settings .set-auto-backup-interval-field select{width:100%; max-width:100%;}
#screen-settings .set-auto-backup-controls > .btn{flex:none; width:auto;}
#screen-settings .set-auto-backup-folder{margin:8px 0 0; font-size:13px;}
#screen-settings .set-auto-backup-err{
  margin:6px 0 0; font-size:13px; line-height:1.4; color:var(--danger);
}
#screen-settings .set-auto-backup-help{font-size:13px; margin:8px 0 0; line-height:1.45;}
#screen-settings .set-storage-stats{
  margin-top:14px; padding-top:12px; border-top:1px solid var(--border);
}
#screen-settings .set-storage-stats .f{margin-top:0;}
#screen-settings .set-storage-stats .rowline{font-size:14px; padding:5px 0;}
#screen-settings .set-storage-stats .rowline > span:first-child{color:var(--muted); font-weight:600; flex:1; min-width:0; padding-right:10px;}
#screen-settings .set-storage-stats .rowline > span:last-child{text-align:right; flex:none; max-width:58%; word-break:break-word;}
#screen-settings .set-storage-stats-kicker{font-size:13px; margin:0 0 8px;}
#screen-settings .set-storage-stats .set-stat-val,
#screen-settings .set-firebase-link-val{
  display:flex; flex-wrap:nowrap; align-items:flex-start; justify-content:flex-end; gap:6px;
  flex:none; max-width:58%; min-width:0;
}
#screen-settings .set-storage-stats .set-stat-val a,
#screen-settings .set-firebase-link-val a,
#screen-settings .set-firebase-link-val > span:first-child{
  min-width:0; flex:1 1 auto; word-break:break-all; text-align:right;
}
#screen-settings .set-storage-stats .set-stat-val a,
#screen-settings .set-firebase-link-val a{
  font-size:13px;
  color:var(--blue); font-weight:600; text-decoration:underline;
  text-decoration-color:color-mix(in srgb, var(--blue) 40%, transparent);
  text-underline-offset:2px;
}
#screen-settings .set-storage-stats .set-stat-val a:hover,
#screen-settings .set-storage-stats .set-stat-val a:focus-visible,
#screen-settings .set-firebase-link-val a:hover,
#screen-settings .set-firebase-link-val a:focus-visible{
  text-decoration-color:var(--blue);
}
#screen-settings .set-storage-stats .set-stat-val .btn,
#screen-settings .set-firebase-link-val .btn{padding:2px 8px; font-size:12px; margin:0; width:auto; flex:none; flex-shrink:0;}
#screen-settings .set-storage-stats .set-stat-val .btn.btn-copy-icon,
#screen-settings .set-firebase-link-val .btn.btn-copy-icon{padding:2px 5px; line-height:0;}
#screen-settings .btn-copy-icon svg{width:14px; height:14px; display:block;}
#screen-settings .set-firebase-links{margin-top:10px;}
#screen-settings .set-firebase-links .rowline{font-size:14px; padding:5px 0; border-bottom:none; align-items:flex-start;}
#screen-settings .set-firebase-links .rowline > span:first-child{color:var(--muted); font-weight:600; flex:1; min-width:0; padding-right:10px;}
#screen-settings .set-subsection{
  margin-top:16px; padding-top:14px; border-top:1px solid var(--border);
}
#screen-settings .set-subsection.set-subsection-first{
  margin-top:0; padding-top:0; border-top:none;
}
#screen-settings .set-subhead{
  margin:0; font-size:15px; font-weight:700; letter-spacing:-0.01em;
}
#screen-settings .set-subsection > .set-subhead{ margin:0 0 8px; }
#screen-settings .set-subsection .bg-head{ margin:0 0 8px; }
#screen-settings .set-subsection .bg-head .set-subhead{ margin:0; }
#screen-settings .set-fieldrow{
  display:flex; gap:8px; align-items:center; margin-top:4px;
}
#screen-settings .set-fieldrow input,
#screen-settings .set-fieldrow select{flex:1; min-width:0; margin:0; width:auto;}
#screen-settings .set-fieldrow .btn{flex:none; width:auto; margin:0;}
#screen-settings .set-card-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
  margin-bottom:10px; width:100%; box-sizing:border-box;
}
#screen-settings .set-card-head .set-chead{ margin-bottom:0; min-width:0; }
/* Header bar fills the card when it is a direct child (no action-button row). */
#screen-settings .card[data-setcard] > .set-chead{ width:100%; box-sizing:border-box; }
#screen-settings .set-card-head h2{margin:0; flex:1; min-width:0;}
#screen-settings .set-card-head .btn{flex:none; width:auto; margin:0;}
@media (max-width:420px){
  #screen-settings .set-fieldrow{flex-wrap:wrap;}
  #screen-settings .set-fieldrow .btn{width:100%;}
}
/* sticky action bar: floats at the bottom of a sheet while scrolling,
   settles as the last element when scrolled to the end */
.stickybar{
  position:sticky; bottom:0; z-index:5;
  background:var(--card);
  border-top:1px solid var(--border);
  box-shadow:0 -8px 18px rgba(10,20,15,.08);
  margin:16px -18px -22px;
  padding:12px 18px 14px;
}
/* iPhone: a floating sheet action bar can cover the focused field when the
   keyboard is open, so it becomes a static end-of-content row instead. */
html.iphone .stickybar{
  position:static;
  margin:16px 0 0;
  padding:12px 0 10px;
  border-top:1px solid var(--border);
  box-shadow:none;
  background:none;
  z-index:auto;
}
/* Same for the page-style bar docked at a sheet's bottom (bill form, scanner
   review, budget copy, delete-bill confirm). */
html.iphone .sheet .stickybar-page{
  position:static;
  margin:16px 0 0;
  padding:12px 0 10px;
  border-top:1px solid var(--border);
  border-radius:0;
  box-shadow:none;
  background:none;
}
/* sticky action bar for full-page screens (e.g. the import preview): pins
   just above the tab bar while its card scrolls, settles as the card's last
   element when scrolled to the end */
.stickybar-page{
  position:sticky; bottom:calc(var(--tabbar-h) + var(--tabbar-pad-b)); z-index:5;
  background:var(--card);
  border-top:1px solid var(--border);
  border-radius:0 0 var(--radius) var(--radius);
  box-shadow:0 -8px 18px rgba(10,20,15,.08);
  margin:16px -14px -14px;
  padding:12px 14px;
}
/* Inside a bottom sheet the tab bar sits below the overlay, so dock the
   page-style action bar flush at the sheet's own bottom edge. */
.sheet .stickybar-page{
  bottom:0;
  margin:16px -18px -22px;
  padding:12px 18px 14px;
}
.linkbtn{background:none; border:none; color:var(--blue); font-size:16px; font-weight:600; cursor:pointer; padding:6px 4px;}
.linkbtn:active{opacity:.7;}
/* bulk-update mode is on: the Done toggle gets an active pill background
   with white text for contrast */
.linkbtn.on{background:var(--blue); color:#fff; border-radius:999px; padding:8px 14px;}
[data-theme="dark"] .linkbtn.on{background:#2e4f82; color:#fff;}
/* transactions filter card sits tight above the bulk-update toolbar */
#txn-filtercard{margin-bottom:6px; padding-bottom:8px;}
/* Flagged under Search, level with Reset Sort Order (Dave, Nov 17). */
#f-flagrow{
  display:flex; align-items:center; margin-top:6px; min-height:0;
}
#f-flagrow .flagctl{margin:0;}
/* Filters footer: Bulk update left, Reset right; Tidy and Export CSV
   sit evenly in the space between (Dave, Nov 17). */
#f-btnrow{
  display:flex; align-items:center; justify-content:space-between;
  margin-top:14px; width:100%;
}
#f-btnrow .linkbtn{flex:none; margin:0;}
/* Budget sticky month bar: stays pinned under the app header while the page scrolls.
   Two compact rows (month stepper, then the live totals pill) so the pill
   never wraps mid-phrase over the card buttons below. */
#bud-stickybar{
  position:sticky; top:calc(var(--headH, 64px) + 6px); z-index:15;
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:0 10px 24px rgba(10,20,15,.14);
  padding:10px 14px; margin-bottom:12px;
  display:flex; flex-direction:column; align-items:stretch; gap:4px;
}
#bud-stickybar input{margin:0;}
/* Month stepper: prev/next chevrons around the native month picker,
   centered in the sticky bar with big tap targets. */
.bud-monthnav{display:flex; align-items:center; justify-content:center; gap:8px; flex:none;}
.bud-monthnav .btn{padding:10px 18px; font-size:20px; line-height:1;}
#bud-month{border:1px solid transparent; background:transparent; font-size:18px;
  font-weight:600; color:var(--text); padding:5px 4px; border-radius:8px; width:auto; text-align:center;}
#bud-month:hover{border-color:var(--border);}
/* Live budget-vs-income totals pill: second row of the sticky bar. The
   figures sit on the first line; the colored verdict (percent +
   over/remaining) always gets its own second line (Dave, 2026-10-31). */
.bud-totals{margin:0; text-align:center; font-size:14px; color:var(--muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.bud-totals b{color:var(--text); font-variant-numeric:tabular-nums; font-size:16px;}
@media (max-width:640px){
  .bud-totals{white-space:normal; overflow:visible; line-height:1.5;}
}
.bud-totals b.neg{color:var(--danger);}
/* Dave 2026-10-31: the percent + over/remaining verdict renders on its
   own line (see paintBudgetTotals) so it can never wrap mid-phrase. */
.bud-totals-line2{display:block;}
.bud-totals b.pos{color:var(--accent);}
/* Budget group collapse: chevron on the group header toggles member rows. */
.bot-group-chev{
  flex:none; width:28px; height:28px; min-width:28px; padding:0; margin:0;
  border:none; border-radius:8px; background:transparent; color:var(--text);
  font-size:12px; line-height:1; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center;
  transition:transform .15s ease, background .12s ease;
}
.bot-group-chev:hover{ background:rgba(127,127,127,.22); }
.bot-group-chev:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.bot-group-head.is-collapsed .bot-group-chev{ transform:rotate(-90deg); }
@media (prefers-reduced-motion: reduce){
  .bot-group-chev{ transition:none; }
}
/* Planner rows: let every grid child shrink (name cell, amount input, range
   slider) so nothing can push the row past the card's right edge. */
.bot-row>*{min-width:0;}
.bot-row{position:relative;}
/* Bills inside a budget category row (Dave, Nov 6): one line per bill due
   in the viewed month, checkbox = will pay this month. Skipped bills dim
   and strike through; the row's amount already excludes them. */
.bot-bills{margin:0 0 6px;padding:2px 10px 4px 82px;}
.bot-bill{display:flex;align-items:center;gap:8px;padding:4px 0;font-size:13px;cursor:pointer;border-top:1px dashed var(--border);}
.bot-bill input{width:17px;height:17px;flex:none;accent-color:var(--accent);cursor:pointer;}
.bot-bill-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.bot-bill-due{color:var(--muted);font-size:12px;white-space:nowrap;}
.bot-bill-amt{font-weight:700;white-space:nowrap;}
.bot-bill.skip .bot-bill-name,.bot-bill.skip .bot-bill-due,.bot-bill.skip .bot-bill-amt{opacity:.45;text-decoration:line-through;}
/* Live amount bubble above a planner slider's thumb while dragging
   (Dave 2026-10-29 — the number field alone isn't reliably visible). */
.slider-bubble{position:absolute; transform:translate(-50%,-100%); background:var(--blue); color:#fff;
  font-size:15px; font-weight:700; padding:4px 11px; border-radius:999px; white-space:nowrap;
  pointer-events:none; opacity:0; transition:opacity .15s ease; z-index:6; box-shadow:0 2px 10px rgba(0,0,0,.35);}
.slider-bubble.on{opacity:1;}
.bot-row input[type=range]{max-width:100%;}
/* Planner rows: two-line layout at every width so category names are always
   fully readable and the padlock can never overlap the stats — left rail:
   drag grip over the ✓ check; line 1: category name; line 2: labeled
   YTD avg + Prev month, amount; actions column (padlock above trash)
   spans both lines on the right; then the MTD vs budget chart and the
   adjust slider, each full-width.
   (grid template is inline in JS, so !important overrides it here.)
   Placement is keyed to each cell's class / element type, never nth-child:
   the row's child order has shifted twice (the drag grip was added as the
   first child, and grouped rows insert an ungroup × before the check) and
   nth-child placements silently moved every cell one slot over — that is
   what crushed the amount input into the 40px actions column, showing only
   its first digits (Dave 2026-10-21). Div cells are counted with
   nth-of-type, which the grip (span) and the buttons cannot shift. */
#bot-rows .bot-row, #bot-rows .bot-head{grid-template-columns:22px 44px minmax(0,1fr) var(--bot-amt-w) 36px !important; gap:5px 8px !important;}
#bot-rows .bot-row, #ibot-table .bot-row{row-gap:3px !important;}
/* Face height (Dave, Nov 9 pm): the card sizes to its content. The old
   vertical icon stack (4 x 36px) set a 148px floor and the grid's
   default stretch pumped the slack into the name row as a dead band.
   The cluster is now one horizontal row overlaid on the name row's
   right end (adds no height, takes no column), and rows pack at the
   top instead of stretching. */
#bot-rows .bot-row{align-content:start;}
/* Face slider (Dave, Nov 9 pm): readout + slider are full-width rows
   at the foot of the face, below the MTD bar, like the income cards. */
#bot-rows .bot-row > .bot-sldamt{grid-column:1/-1;}
#bot-rows .bot-row > input[type=range]{grid-column:1/-1;}
/* Vertical tightening (Dave, Nov 9 pm): the face amount input carries
   8px of vertical padding instead of the global 10px — about 40px
   tall — which trims the stats row it governs. Width stays the shared
   --bot-amt-w and values stay unclipped. Both planners. */
.bot-statsrow .bot-amt input{padding-top:8px; padding-bottom:8px;}
.bot-row > .bot-grip{grid-column:1; grid-row:1;}
.bot-row > .lockbtn{grid-column:1; grid-row:2;}
.bot-row > button:not(.lockbtn){grid-column:1; grid-row:3;}
.bot-row > div:nth-of-type(1){grid-column:2/4; grid-row:1;}
.bot-row > div:nth-of-type(2){grid-column:2; grid-row:2;}
.bot-row > div:nth-of-type(3){grid-column:3; grid-row:2;}
.bot-row > div:nth-of-type(4){grid-column:4; grid-row:1/3;}
/* Budget cards package (Nov 9): face cells place by identity class. The
   nth-of-type rules above predate the bills-summary div, which would shift
   every later div one slot — these rules carry :is() specificity (0,3,1)
   to beat nth-of-type (0,2,1) regardless of div order. */
.bot-row > :is(div.bot-nm){grid-column:2; grid-row:1;}
.bot-row > :is(div.bot-thisline){grid-column:2; grid-row:2;}
.bot-row > :is(div.bot-statsrow){grid-column:2/-1; grid-row:3;}
.bot-row > :is(div.bot-acts2){grid-column:2/-1; grid-row:1; justify-self:end; align-self:start !important;}
/* Income planner rows (Dave, Nov 9 pm): the card mirrors the expense
   face — the category name owns the top row at full content width and
   NEVER ellipsizes (it wraps if it must); YTD avg, Prev month and the
   target input share ONE horizontal stats row underneath, the expense
   pattern. Before, the stats stacked vertically in a right-hand block
   beside the name and the name starved to 'W\u2026', 'Re\u2026' at phone
   widths. The stats row extends under the actions column; the input
   keeps the shared --bot-amt-w width. */
#ibot-table .bot-row{grid-template-columns:22px 44px minmax(0,1fr) var(--bot-amt-w) 36px !important;}
#ibot-table .bot-row > .bot-grip{grid-column:1; grid-row:1/-1; align-self:stretch !important;}
#ibot-table .bot-row > .lockbtn{grid-column:1; grid-row:2; align-self:center;}
#ibot-table .bot-row > :is(div.bot-nm){grid-column:2; grid-row:1;}
#ibot-table .bot-row > :is(div.bot-statsrow){grid-column:2/-1; grid-row:2;}
#ibot-table .bot-row > :is(div.bot-acts){grid-column:3; grid-row:1; align-self:start;}
#ibot-table .bot-row > :is(div.bot-mtdchart){grid-column:1/-1;}
#ibot-table .bot-row > input[type=range]{grid-column:1/-1;}
#ibot-table .bot-head{display:grid; margin-bottom:2px; grid-template-columns:22px 44px minmax(0,1fr) var(--bot-amt-w) 36px !important;}
.bot-head > span:nth-of-type(3){grid-column:2/4; grid-row:1;}
.bot-head > span:nth-of-type(4){grid-column:2; grid-row:2;}
.bot-head > span:nth-of-type(5){grid-column:3; grid-row:2;}
/* Planner row stats: stack YTD avg / Prev month vertically inside the narrow
   stats column so the full amounts are always visible — never clipped, never
   ellipsized (Dave 2026-10-15). Each stat gets the full column width. */
.bot-row .bot-stats{flex-direction:column; gap:2px !important; align-items:stretch;}
/* Per-row MTD vs budget bar: track = budget scale, fill = month-to-date. */
.bot-mtd{grid-column:1/-1; margin:1px 0 0; min-width:0;}
.bot-mtd-track{height:10px; border-radius:999px; background:var(--border);
  overflow:hidden; position:relative;}
.bot-mtd-fill{display:block; height:100%; width:0; border-radius:inherit;
  background:var(--danger); transition:width .12s ease-out;}
.bot-mtd.is-inc .bot-mtd-fill{background:var(--accent);}
.bot-mtd.is-over .bot-mtd-fill{background:var(--danger);}
.bot-mtd.is-inc.is-met .bot-mtd-fill{background:var(--accent);}
.bot-mtd.is-empty .bot-mtd-track{opacity:.55;}
/* Lock + trash share one vertical axis; lock top, trash bottom of the row. */
.bot-acts{
  display:flex; flex-direction:column; align-items:center; justify-content:space-between;
  gap:2px; align-self:stretch; min-width:0;
}
.bot-acts .lockbtn{
  width:36px; min-width:36px; padding:0; flex:none;
  display:inline-flex; align-items:center; justify-content:center;
}
.bot-acts .row-del{width:36px; min-width:36px; flex:none;}
/* Drag-reorder grip handle on each planner row (touch-action:none so a touch
   drag doesn't scroll the page) and the row's appearance while dragging. */
.bot-grip{flex:none; cursor:grab; touch-action:none; user-select:none; -webkit-user-select:none;
  color:var(--muted); opacity:.55; font-size:14px; letter-spacing:2px; line-height:1;
  padding:12px 2px; text-align:center; justify-self:center;}
.bot-grip:active{cursor:grabbing;}
/* Dave's layout notes (Nov 9): the whole left edge of a budget card is
   the drag grip — a full-height strip (grid-row 1/-1 via the placement
   rules), dots pinned at the top, a faint rail so the grab zone reads. */
.bot-row > .bot-gripstrip{grid-column:1; grid-row:1/-1; align-self:stretch !important;
  display:flex; align-items:flex-start; justify-content:center;
  padding:10px 0 0; border-radius:8px 0 0 8px;
  background:rgba(127,127,127,.10);}
/* The one stats row: YTD avg, Prev month, amount input. The two figures
   keep natural width and their values never clip (label over value,
   left-aligned). The amount input HUGS its value (Dave, Nov 9 follow-up:
   at flex:1 it spanned most of the card — amounts are short numbers, so
   the field hugs the value at the shared planner width (--bot-amt-w,
   defined below with the income rule). */
.bot-statsrow{display:flex; align-items:flex-end; gap:14px; min-width:0; justify-content:flex-end;}
/* Stats row anchoring (Dave, Nov 9 pm): the YTD / Prev / amount trio
   rides at the row's RIGHT end — the amount field pins to the card's
   bottom-right corner with the two static values immediately in
   front of it, instead of the group floating mid-row with dead
   space to its right. One shared rule: both planners use this row. */
.bot-statsrow > div{text-align:center !important;}
.bot-statsrow .bot-amt{width:var(--bot-amt-w); flex:none; box-sizing:border-box;}
/* ONE amount-field width for both planners (Dave, Nov 9): income's
   grid gave its target field ~86px of content box and five-digit
   targets clipped ('2800' showed as '28'); the expense field was
   wider. Both planners now use this single width — wide enough that
   a 5-digit amount never clips, narrow enough to hug the value. */
:root{--bot-amt-w:104px;}
#ibot-table .bot-amt{width:var(--bot-amt-w); flex:none; box-sizing:border-box; min-width:0;}
/* Live amount readout beside the expanded card's slider: the thumb's
   current value as plain text, always on screen (not just in the drag
   bubble), so moving the slider visibly changes a number somewhere. */
.bot-sldamt{font-size:15px; font-weight:700; color:var(--text); text-align:right; margin:2px 0 0;}
/* Right icon cluster: include-check, lock, trash, chevron — a vertical
   stack centered against the card (placement sets align-self:center on
   the cluster). Every seat is 36px, matching the income rows' cluster. */
.bot-acts2 .lockbtn{width:36px; min-width:36px; min-height:36px;
  display:inline-flex; align-items:center; justify-content:center;}
.bot-acts2 .row-del{width:36px; min-width:36px; min-height:36px; flex:none;}
/* While dragging, the row becomes a fixed ghost that follows the pointer
   exactly; a dashed .bot-drop-ph placeholder holds its spot in the list
   and marks the drop position as it moves. */
.bot-row.bot-dragging{position:fixed; z-index:70; pointer-events:none; opacity:.96;
  box-shadow:0 12px 28px rgba(0,0,0,.35); margin:0 !important;}
.bot-row.bot-dragging .bot-grip{cursor:grabbing; opacity:1;}
.bot-drop-ph{pointer-events:none; border:2px dashed var(--accent); border-radius:10px; margin-bottom:4px;
  background:rgba(127,127,127,.08);}
/* Budget cards package (Nov 9): compact face + expanded state. The face is
   the month at a glance (name, This-month line, MTD bar, amount, chevron,
   one-line bills summary); editing apparatus lives in .bot-detail. */
.bot-thismo{font-size:16px;}
.bot-thismo.over{color:var(--danger); font-weight:700;}
.bot-row > .bot-billsum{grid-column:2/-1; grid-row:4; font-size:16px; font-weight:600;
  color:var(--text); cursor:pointer; padding:3px 0 1px; white-space:nowrap; overflow:hidden;}
.bot-billsum .bot-skipbit{white-space:nowrap;}
.bot-head-face > span:nth-of-type(2){grid-column:3; grid-row:1;}
.bot-head-face > span:nth-of-type(3){grid-column:4; grid-row:1; justify-self:end;}
.bot-head-face > span:nth-of-type(4){grid-column:5; grid-row:1;}
#bot-rows .bot-head{display:grid; margin-bottom:2px;}
.bot-acts2{display:flex; flex-direction:row; align-items:center; justify-content:flex-end; gap:2px;}
.bot-chev{flex:none; width:36px; height:32px; padding:0; border:none; border-radius:8px;
  background:transparent; color:var(--muted); font-size:14px; line-height:1; cursor:pointer;}
.bot-chev:hover{background:rgba(127,127,127,.18); color:var(--text);}
.bot-detail{padding:2px 10px 8px 28px; margin:0;}
/* Expanded card = ONE surface (Dave, Nov 9 pm): when a card is open, its
   face and detail sit inside a .bot-card wrapper that carries the
   card's radius and (for included rows) its state surface, so the
   bills list reads as the card opened up — not a separate panel on
   the page background. The face sheds its own radius/margins inside
   the wrapper; the detail is flush beneath it. Collapsed cards keep
   the bare face, untouched. Grouped open cards keep the accent edge. */
/* Card distinction (Dave, Nov 9 pm): every budget card — collapsed
   (the bare face) and expanded (the .bot-card wrapper) — carries the
   app's standard card outline (1px var(--border), the same stroke
   .card uses) plus a whisper of separation shadow, so adjacent cards
   read as separate units instead of one continuous tinted stack.
   Expanded grouped cards keep their accent left edge via the inline
   style, which overrides this border's left side. */
/* Card lift (Dave, Nov 16): --fcard fill + a real shadow so each
   budget card separates from the page background (the old 1px whisper
   shadow + transparent fill fused into the dark bg). */
.bot-card{
  border-radius:10px; margin-bottom:8px; border:1px solid var(--border);
  background-color:color-mix(in srgb, var(--fcard) var(--card-opacity-pct, 100%), transparent);
  box-shadow:0 2px 10px rgba(0,0,0,.14), 0 1px 3px rgba(0,0,0,.08);
}
#bot-rows .bot-row, #ibot-table .bot-row{
  border:1px solid var(--border);
  background-color:color-mix(in srgb, var(--fcard) var(--card-opacity-pct, 100%), transparent);
  box-shadow:0 2px 10px rgba(0,0,0,.14), 0 1px 3px rgba(0,0,0,.08);
}
[data-theme="dark"] .bot-card,
[data-theme="dark"] #bot-rows .bot-row,
[data-theme="dark"] #ibot-table .bot-row{
  box-shadow:0 4px 16px rgba(0,0,0,.45), 0 1px 4px rgba(0,0,0,.3);
}
/* The face inside an expanded wrapper sheds the outline again — the
   wrapper IS the card edge. The bare-row rule above outranks this one
   on specificity (two ids beat class+class), so it needs !important. */
.bot-card > .bot-row{border:none !important; box-shadow:none !important; background:transparent !important;}
.bot-card > .bot-row{border-radius:0; margin:0;}
.bot-card > .bot-row.is-open .bot-gripstrip{border-radius:0;}
.bot-detail .bot-bills{margin:4px 0 2px; padding:2px 0 4px;}
/* No divider between the card face and its bills list (Dave, Nov 9 pm):
   the first bill row drops the dashed top border every bill row
   carries — the list flows straight out of the face. The dashed
   rules BETWEEN bills stay, so rows still scan. */
.bot-card .bot-bill:first-child{border-top:none;}
.bot-dacts{display:flex; flex-wrap:wrap; gap:8px; margin-top:8px;}
/* Bills total row: the receipt at the foot of the expanded list — a firm
   solid rule over the bills' dashed ones, plain label, bold amount. */
.bot-bill-total{display:flex; align-items:center; gap:8px; padding:6px 0 2px;
  font-size:13.5px; border-top:2px solid var(--border); margin-top:2px;}
.bot-bill-total-label{flex:1; font-weight:600;}
.bot-bill-total-amt{font-weight:800; white-space:nowrap;}
.bot-bill-total-amt.is-tap{cursor:pointer;}
.bot-bill-total-amt.is-tap:hover{color:var(--accent);}
.bot-bill-skipline{font-size:12px; color:var(--muted); padding:2px 0 0;}
/* Pattern face + merged control (Dave, Nov 10 — the mock he approved):
   tiles column, centered stat band, one slider/progress control.
   Placement rules are host-scoped so they outrank the legacy
   nth-of-type placements they replace. */
#bot-rows .bot-row > :is(div.bot-tiles), #ibot-table .bot-row > :is(div.bot-tiles){grid-column:2; grid-row:1/3; align-self:start; align-content:start;}
.bot-tiles{display:flex; flex-direction:column; gap:6px;}
.bot-tiles .lockbtn{width:44px; min-width:44px; height:44px; min-height:44px; padding:0; flex:none;
  display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--border); border-radius:12px; background:rgba(127,127,127,.08); font-size:17px;}
.bot-tiles .bot-tilelock{font-size:19px;}
#bot-rows .bot-row > :is(div.bot-nm), #ibot-table .bot-row > :is(div.bot-nm){grid-column:3; grid-row:1;}
#bot-rows .bot-row > :is(button.bot-facedel), #ibot-table .bot-row > :is(button.bot-facedel){grid-column:5; grid-row:1; align-self:start;}
#bot-rows .bot-row > :is(div.bot-statsrow), #ibot-table .bot-row > :is(div.bot-statsrow){grid-column:3/5; grid-row:2;}
.bot-statsrow{display:grid; grid-template-columns:1fr 1fr var(--bot-amt-w); align-items:end; column-gap:10px;}
.bot-statsrow > div > div:last-child{font-size:15px !important;}
/* Recentering the band (above) must not move the amount field: the
   .bot-amt cell keeps its content left-aligned, like the field it
   replaces — only the two stat chips center. (Dave's corner pin,
   Nov 9 pm: the field belongs at the row's right edge, not centered
   in its column.) */
.bot-statsrow .bot-amt{width:auto; text-align:left !important;}
#bot-rows .bot-row > :is(div.bot-billsum){grid-column:3/-1; grid-row:4;}
#bot-rows .bot-row > :is(div.bot-mrow), #ibot-table .bot-row > :is(div.bot-mrow){grid-column:3/-1;}
.bot-mrow{display:flex; align-items:center; gap:10px; margin-top:2px;}
.bot-mslider{position:relative; flex:1; height:30px; min-width:0;}
.bot-mtrack{position:absolute; left:0; right:0; top:50%; transform:translateY(-50%); height:12px; border-radius:999px; background:var(--border); overflow:hidden;}
.bot-mfill{display:block; height:100%; width:0; background:var(--blue); border-radius:999px; transition:width .12s ease-out;}
.bot-mslider.is-inc .bot-mfill{background:var(--accent);}
.bot-mslider.is-over .bot-mfill{background:var(--danger);}
.bot-mtick{position:absolute; top:1px; bottom:1px; width:3px; margin-left:-1.5px; background:#fff; border-radius:2px; box-shadow:0 0 0 1.5px rgba(0,0,0,.45); z-index:4; pointer-events:none;}
.bot-mslider input[type=range]{-webkit-appearance:none; appearance:none; position:absolute; inset:0; width:100%; height:30px; background:transparent; margin:0; padding:0; cursor:pointer; z-index:3;}
.bot-mslider input[type=range]::-webkit-slider-runnable-track{background:transparent;}
.bot-mslider input[type=range]::-webkit-slider-thumb{-webkit-appearance:none; width:26px; height:26px; border-radius:50%; background:#fff; border:2px solid rgba(0,0,0,.35); box-shadow:0 1px 4px rgba(0,0,0,.5);}
.bot-mslider input[type=range]::-moz-range-track{background:transparent;}
.bot-mslider input[type=range]::-moz-range-thumb{width:24px; height:24px; border-radius:50%; background:#fff; border:2px solid rgba(0,0,0,.35);}
.bot-mslider.locked input[type=range]{display:none;}
.bot-mrow .bot-sldamt{margin:0; min-width:64px;}
.bot-sldamt.is-over{color:var(--danger);}
/* Disclosure chevron 2× the prior 20×30 / 14px face (Dave, Nov 16). */
.bot-mrow .bot-chev{width:40px; height:44px; font-size:28px;}
/* Two-mode drag affordances (JS shows exactly one at a time): group target
   outline/block, the outcome chip riding with the ghost, the OUT strip,
   and the post-drop pulse on the group block. */
.bot-group-target{outline:2px solid var(--accent) !important; outline-offset:-2px;
  background:var(--accent-soft) !important;}
.bot-drag-chip{position:fixed; z-index:90; transform:translate(-50%,-190%);
  background:var(--accent); color:#fff; font-size:12.5px; font-weight:700;
  padding:5px 12px; border-radius:999px; white-space:nowrap; pointer-events:none;
  box-shadow:0 4px 14px rgba(0,0,0,.3);}
.bot-out-strip{border:2px dashed var(--danger); border-radius:10px; padding:10px;
  margin:4px 0 8px; text-align:center; font-weight:700; font-size:13px;
  color:var(--danger); background:rgba(127,127,127,.06);}
.bot-out-strip.bot-out-hot{background:var(--danger); color:#fff;}
@keyframes botPulse{0%{box-shadow:0 0 0 0 rgba(127,127,127,0);}30%{box-shadow:0 0 0 3px var(--accent);}100%{box-shadow:0 0 0 0 rgba(127,127,127,0);}}
.bot-pulse{animation:botPulse .9s ease;}
@media (prefers-reduced-motion: reduce){ .bot-pulse{animation:none;} }
/* floating search clone: appears fixed below the app header only after the
   in-card search box scrolls off the top of the page */
#searchstick label.f{display:none;}
/* Transactions stick: solid-ish card plate so Search / Flagged / Bulk update
   / Scroll to Top read clearly over the scrolling Filters card + txn list
   (frosted translucency was too close to the content behind). Home/Reports
   sticks use the same fcard fill via .searchstick.repfilterstick. */
#searchstick{
  background-color:color-mix(in srgb, var(--fcard) var(--card-opacity-pct, 100%), transparent);
  border-color:var(--border);
  box-shadow:0 10px 28px rgba(0,0,0,.28);
  -webkit-backdrop-filter:blur(var(--card-backdrop-blur, 0px));
  backdrop-filter:blur(var(--card-backdrop-blur, 0px));
}
#searchstick:has(#selbar.stuck){
  background-color:color-mix(in srgb, var(--card) var(--card-opacity-pct, 100%), transparent);
  border-color:var(--border);
  box-shadow:0 10px 28px rgba(0,0,0,.28);
}
/* Sticky footer: Bulk update | Flagged (true center) | Scroll to Top */
.stick-actions{
  display:grid; grid-template-columns:1fr auto 1fr;
  align-items:center; gap:8px; margin-top:14px;
}
.stick-actions .linkbtn{flex:none;}
.stick-actions #f-select-stick{justify-self:start;}
.stick-actions .flagctl{justify-self:center;}
.stick-actions #f-reset-stick{justify-self:end;}
/* Record flagging (2026-10-21): toggle switch in the sticky filter bars,
   flag toggle on transaction rows, step-through bar in the edit sheet.
   Amber is the app's attention color — red would read as an error. */
.flagctl{display:inline-flex; align-items:center; gap:7px; font-weight:600; cursor:pointer; user-select:none; -webkit-user-select:none; flex:none;}
.flagctl .flaglyph{color:var(--muted); font-size:15px; line-height:1;}
.flagctl.on .flaglyph{color:#f59e0b;}
.flagctl .flagcount{color:var(--muted); font-weight:600; font-variant-numeric:tabular-nums;}
input.flagsw{appearance:none; -webkit-appearance:none; width:40px; height:22px; border-radius:999px; background:#8a97a5; position:relative; cursor:pointer; flex:none; margin:0; padding:0; transition:background .15s ease;}
input.flagsw::after{content:''; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.35); transition:left .15s ease;}
input.flagsw:checked{background:#f59e0b;}
input.flagsw:checked::after{left:20px;}
input.flagsw:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}
.flagbadge{flex:none; font-size:16px; line-height:1; padding:4px 2px; color:var(--muted); opacity:.45; cursor:pointer;}
.flagbadge.on{color:#f59e0b; opacity:1;}
.walkbar{display:flex; align-items:center; justify-content:space-between; gap:8px; margin:0 0 12px; padding:8px 10px; background:var(--warn-soft); border-radius:10px;}
.walkbar .walkpos{font-weight:700; color:var(--warn); font-variant-numeric:tabular-nums;}
.flagformrow{display:flex; align-items:center; margin:10px 0 2px;}
/* Width tracks main's content column (min 760 with 14px pad → 732), then
   insets 20px per side so the float sits inside the card column
   (Dave, Nov 17). */
.searchstick{
  position:fixed; z-index:15;
  top:calc(var(--headH, 64px) + 6px);
  left:50%; transform:translateX(-50%);
  width:min(692px, calc(max(320px, 100vw - var(--side-margin, 100px) * 2) - 68px));
  max-width:calc(100vw - 68px);
  background:var(--card);
  border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:0 10px 24px rgba(10,20,15,.14);
  padding:10px 14px;
}
.searchstick[hidden]{display:none;}
.searchstick input{margin:0;}
/* animated handoff between the filter card and the floating sticky card:
   the stick fades + slides on a soft ramp instead of popping */
#searchstick, #dashfilterstick, #repfilterstick{transition:opacity .38s ease-out, transform .38s cubic-bezier(0.22,1,0.36,1), visibility .38s;}
#searchstick.gone, #dashfilterstick.gone, #repfilterstick.gone{opacity:0; visibility:hidden; pointer-events:none; transform:translateX(-50%) translateY(-12px) scale(.985);}
/* soft appear for the bulk-update bar: first shown, docking, undocking */
@keyframes selbar-soft-in{from{opacity:0; transform:translateY(-6px);} to{opacity:1; transform:translateY(0);}}
.selbar.soft-in{animation:selbar-soft-in .22s ease;}
/* Custom tooltip pill: native `title` timing isn't controllable, so buttons use
   data-tip (or automatic sheet-button tips) with a 1000ms hover delay instead.
   Positioned by JS above the hovered button. */
#tabtip{
  position:fixed; z-index:90;
  transform:translateX(-50%) translateY(4px);
  background:#20262d; color:#fff; padding:7px 12px; border-radius:9px; font-size:13.5px;
  max-width:92vw; text-align:center; opacity:0; pointer-events:none;
  transition:opacity .15s, transform .15s;
}
#tabtip.show{opacity:1; transform:translateX(-50%) translateY(0);}
@media (prefers-reduced-motion: reduce){
  #searchstick, #dashfilterstick, #repfilterstick{transition:none;}
  .selbar.soft-in{animation:none;}
  .drillchip.soft-in{animation:none;}
  #tabtip{transition:none;}
}
/* Reports sticky filter + stats summary: same floating placement as the
   Transactions/Home sticks; appears once the filter + summary header scroll
   off-screen. Scroll to Top returns to the filters. */
.repfilterstick{padding:8px 14px; text-align:left;}
.repfilterstick .rf-cap{font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted);}
.repfilterstick .rf-sum{font-size:13.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.repfilterstick .rf-top{display:flex; align-items:flex-start; gap:10px;}
.repfilterstick .rf-top-main{flex:1; min-width:0; cursor:pointer;}
.repfilterstick .rf-top .linkbtn{flex:none; margin-top:2px; white-space:nowrap;}
.repfilterstick .rf-stats{
  display:flex; flex-wrap:wrap; gap:6px 12px; align-items:baseline;
  margin-top:6px; font-size:12.5px; font-variant-numeric:tabular-nums;
  color:var(--muted); line-height:1.35;
}
.repfilterstick .rf-stats b{font-weight:700;}
.repfilterstick .rf-stats b:not(.pos):not(.neg){color:var(--text);}
#rep-filtercard, #rep-summarycard{scroll-margin-top:calc(var(--headH, 64px) + 12px);}
#dash-filtercard{scroll-margin-top:calc(var(--headH, 64px) + 12px);}
/* Sticky filter panels share the card background so they read as part of the
   card family while floating. */
.searchstick.repfilterstick{
  background-color:color-mix(in srgb, var(--fcard) var(--card-opacity-pct, 100%), transparent);
  -webkit-backdrop-filter:blur(var(--card-backdrop-blur, 0px));
  backdrop-filter:blur(var(--card-backdrop-blur, 0px));
}
/* Largest expenses: fixed layout so Category/Amount stay visible; merchant and
   category wrap instead of clipping. */
table.ptable.top-table{min-width:0; table-layout:fixed; width:100%;}
table.ptable.top-table th:nth-child(1){width:18%;}
table.ptable.top-table th:nth-child(3){width:27%;}
table.ptable.top-table th:nth-child(4){width:22%;}
table.ptable.top-table td.top-cat{overflow-wrap:anywhere;}
/* Category Mix table: fixed layout with a truncating Category column so
   numeric columns stay compact. Widths use data-scol (not nth-child) so
   hidden phone columns (Txns / Avg) do not leave empty reserved space. */
table.ptable.mix{table-layout:fixed; min-width:0; width:100%;}
/* Budget vs Actual table (desktop defaults; phone overrides tighten further). */
table.ptable.budget-tbl{table-layout:fixed; min-width:0; width:100%;}
table.ptable.budget-tbl [data-scol="name"]{width:32%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
table.ptable.budget-tbl [data-scol="budget"],
table.ptable.budget-tbl [data-scol="actual"],
table.ptable.budget-tbl [data-scol="var"]{width:17%; white-space:nowrap;}
table.ptable.budget-tbl [data-scol="pct"]{width:14%; white-space:nowrap;}
table.ptable.mix [data-scol="txns"]{width:56px;}
table.ptable.mix [data-scol="share"]{width:56px;}
table.ptable.mix [data-scol="amount"]{width:104px;}
table.ptable.mix [data-scol="avg"]{width:104px;}
table.ptable.mix th:nth-child(n+2), table.ptable.mix td:nth-child(n+2){white-space:nowrap;}
table.ptable.mix td[data-scol="name"]{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.top-cell{min-width:0;}
.top-merch{font-weight:600; overflow-wrap:anywhere;}
.top-desc{font-size:12px; color:var(--muted); overflow-wrap:anywhere;}
.iconbtn{
  flex:none; width:46px; border-radius:12px; border:1px solid var(--border);
  background:var(--card); color:var(--danger); cursor:pointer; margin:0;
  display:inline-flex; align-items:center; justify-content:center;
}
.iconbtn:active{opacity:.7;}
.iconbtn svg{width:20px; height:20px;}
/* Row delete (Home Upcoming Bills, Bills tiles / paid list): soft-danger + trash SVG */
.row-del{
  flex:none; width:36px; height:36px; padding:0; margin:0; border:none;
  border-radius:10px; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--danger-soft); color:var(--danger);
}
.row-del:active{opacity:.75;}
.row-del svg{width:18px; height:18px; display:block;}
.reclist{max-height:38vh; overflow-y:auto; margin:10px 0; border:1px solid var(--border); border-radius:12px;}
.recrow{display:flex; align-items:center; gap:10px; padding:9px 12px; border-top:1px solid var(--border); font-size:15.5px; cursor:pointer;}
.recrow:first-child{border-top:0;}
.recrow input{width:auto; flex:none; margin:0;}
.recrow .recmain{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.recrow .recamt{flex:none; font-weight:600;}
.fab{
  position:fixed; right:18px; bottom:calc(var(--tabbar-h) + var(--tabbar-pad-b) + 20px);
  width:58px; height:58px; border-radius:50%; border:none; z-index:30;
  background:color-mix(in srgb, var(--accent) 85%, transparent); color:#fff; font-size:30px; line-height:1; cursor:pointer;
  box-shadow:0 4px 14px rgba(0,0,0,.25);
}
/* Settings → Interface: add (+) button style variants.
   Each variant's look is shared between the real .fab (via body class) and
   the Settings preview chips (via .asp-*), so the preview is WYSIWYG. */
body.ui-addbtn-glossy .fab,
.addstyle-prev.asp-glossy{
  color:#fff;
  background:
    radial-gradient(circle at 28% 22%, rgba(255,255,255,.55) 0%, rgba(255,255,255,.06) 30%, rgba(255,255,255,0) 46%),
    radial-gradient(circle at 74% 84%, rgba(140,200,255,.16) 0%, rgba(140,200,255,0) 52%),
    linear-gradient(150deg, #46565f 0%, #232e36 55%, #0f151b 100%);
  border:1px solid rgba(255,255,255,.16);
  box-shadow:0 6px 16px rgba(0,0,0,.35), inset 0 1px 1px rgba(255,255,255,.45), inset 0 -3px 6px rgba(0,0,0,.45);
}
body.ui-addbtn-outline .fab,
.addstyle-prev.asp-outline{
  background:var(--card);
  border:2px solid var(--accent);
  color:var(--accent);
  box-shadow:0 2px 8px rgba(0,0,0,.12);
}
body.ui-addbtn-square .fab{ border-radius:20px; }
body.ui-addbtn-transparent .fab,
.addstyle-prev.asp-transparent{
  background:transparent; border:none; box-shadow:none;
  color:var(--accent);
}
body.ui-addbtn-ring .fab,
.addstyle-prev.asp-ring{
  background:transparent;
  border:2px solid var(--muted);
  color:var(--accent);
  box-shadow:none;
}
body.ui-addbtn-hidden .fab{ display:none; }
.fab .fab-lbl{ display:none; }
body.ui-addbtn-labeled:not(.ui-addbtn-hidden) .fab{
  width:auto; min-width:58px; height:58px; padding:0 20px 0 16px;
  border-radius:29px;
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  font-size:16px; font-weight:600;
}
body.ui-addbtn-labeled:not(.ui-addbtn-hidden) .fab .fab-glyph{ font-size:26px; line-height:1; flex:none; }
body.ui-addbtn-labeled:not(.ui-addbtn-hidden) .fab .fab-lbl{ display:block; white-space:nowrap; }
#ui-addlabel-seg.is-irrelevant{ opacity:.45; pointer-events:none; }
/* Settings → Interface: add-button style picker previews. */
.addstyle-prev.asp-classic{
  background:color-mix(in srgb, var(--accent) 85%, transparent);
  color:#fff; border-radius:50%;
  box-shadow:0 4px 14px rgba(0,0,0,.25);
}
.addstyle-prev.asp-square{
  background:color-mix(in srgb, var(--accent) 85%, transparent);
  color:#fff; border-radius:20px;
  box-shadow:0 4px 14px rgba(0,0,0,.25);
}
.addstyle-prev.asp-hidden{
  border:2px dashed var(--muted); border-radius:50%;
  background:transparent; opacity:.55;
}
/* Settings → Interface: add-button visual style picker.
   Fills the phone width (wrapping to two rows), content-sized on larger layouts. */
.addstyle-row{ display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; padding:3px 2px; }
/* Settings → Interface: transaction type order & visibility widget. */
.typesort-list{ display:flex; flex-direction:column; gap:8px; margin-top:6px; min-width:0; max-width:100%; }
.typesort-row{
  display:flex; align-items:center; gap:10px;
  background:var(--card); border:1px solid var(--border); border-radius:12px;
  padding:10px 12px;
}
.typesort-row .card-grip{ cursor:grab; flex:none; }
/* Rows opt out of touch scrolling so drags don't fight the page;
   edge auto-scroll (in JS) takes over near the viewport top/bottom. */
/* Row allows vertical page scroll; only the grip blocks it (touch-action:none
   on .card-grip) so drags start cleanly. */
.typesort-row.typesort-dragging{
  position:relative; z-index:5; opacity:.96;
  box-shadow:0 10px 24px rgba(0,0,0,.28);
  /* Like .card-dragging: the row must not hit-test while it follows the
     finger, or iOS Safari retargets the touch and kills the drag. */
  pointer-events:none;
}
/* Placeholder in drag lists: no extra margin (the list gap handles spacing). */
.typesort-list .card-drop-ph{margin:0;}
/* Transaction tile footer field toggles. */
.tilefooter-list{display:flex; flex-direction:column; gap:8px; min-width:0; max-width:100%;}
.tilefooter-row{display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
  align-items:center; column-gap:10px; row-gap:8px; padding:10px 12px;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--bg);
  min-width:0; max-width:100%; box-sizing:border-box;}
.tilefooter-row .tilefooter-lead{
  grid-column:1; display:flex; align-items:center; gap:10px; min-width:0; justify-self:start;
}
.tilefooter-row .tilefooter-label{min-width:0; font-size:15px; font-weight:600;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.tilefooter-row .tiletitle-select{ grid-column:1; justify-self:start; }
.tilefooter-row .tilefooter-ctrls{
  grid-column:2; display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:10px;
}
.tilefooter-row .typesort-toggle,
.tilefooter-row .tilefooter-end{ grid-column:3; justify-self:end; margin-left:0; }
.tilefooter-row .tilefooter-end{ width:44px; }
.tilefooter-row .tiletitle-select{flex:1 1 160px; min-width:0; font-size:15px; font-weight:600;
  background:var(--bg); color:var(--text); border:1px solid var(--border);
  border-radius:8px; padding:8px 10px;}
.tilefooter-row .switch{flex:none;}
.typesort-row .dot{ flex:none; }
.typesort-label{ flex:1; min-width:0; font-weight:600; }
/* Tab bar order: name + muted summary filling space before the visibility toggle. */
#ui-taborder-list .typesort-titles,
#ui-init-pages .typesort-titles{
  flex:1; min-width:0;
  display:flex; align-items:baseline; gap:10px;
}
#ui-taborder-list .typesort-label,
#ui-init-pages .typesort-label{ flex:none; }
#ui-taborder-list .typesort-summary,
#ui-init-pages .typesort-summary{
  flex:1; min-width:0;
  font-size:13px; font-weight:500; line-height:1.35;
  color:var(--muted);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.typesort-toggle{
  flex:none; border:1px solid var(--border); background:var(--bg); border-radius:10px;
  font-size:17px; line-height:1; padding:7px 11px; cursor:pointer; color:var(--text);
}
.typesort-toggle:not(.on){ opacity:.45; }
.typesort-toggle.on{
  background:var(--accent-faint); color:var(--accent); border-color:color-mix(in srgb, var(--accent) 45%, var(--border));
  font-weight:600;
}
/* Segmented tab control for wrap/truncate / inline/full — hug labels. */
.seg-tab{ display:inline-flex; border:1px solid var(--border); border-radius:10px; overflow:hidden; flex:none; width:auto; }
.seg-tab .seg-opt{
  border:none; background:var(--bg); padding:7px 12px; font-size:13px; cursor:pointer;
  color:var(--muted); white-space:nowrap; flex:0 0 auto; width:auto;
}
.seg-tab .seg-opt.on{ background:var(--accent-faint); color:var(--accent); font-weight:600; }
.seg-tab .seg-opt + .seg-opt{ border-left:1px solid var(--border); }
/* Tile footer rows: tabs stay content-sized; row wraps if needed. */
.tilefooter-row .seg-tab{ flex:0 0 auto; width:auto; max-width:100%; }
@media (max-width:520px){
  .tilefooter-row .seg-tab .seg-opt{ padding:7px 8px; font-size:12px; }
}
#screen-settings .card{ min-width:0; overflow-x:clip; }
.addstyle-row{ display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; padding:3px 2px; }
.addstyle-row button{
  flex:1 1 21%; min-width:78px;
  display:flex; flex-direction:column; align-items:center; gap:7px;
  background:none; border:none; padding:10px 4px 8px; border-radius:14px; cursor:pointer;
}
@media (min-width:700px){
  .addstyle-row{ justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto; padding:4px 2px; }
  .addstyle-row button{ flex:none; min-width:0; padding-left:16px; padding-right:16px; }
}
.addstyle-row button[aria-selected="true"]{ background:var(--accent-faint); box-shadow:0 0 0 2.5px var(--accent); }
.addstyle-prev{
  width:54px; height:54px; flex:none;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:28px; line-height:1;
  box-sizing:border-box;
}
.addstyle-prev .asp-lbl{ display:none; }
.addstyle-row.addstyle-previews-labeled .addstyle-prev:not(.asp-hidden){
  width:auto; min-width:54px; height:54px; padding:0 14px 0 11px;
  border-radius:27px; gap:4px;
  font-size:13px; font-weight:600;
}
.addstyle-row.addstyle-previews-labeled .addstyle-prev.asp-square:not(.asp-hidden){ border-radius:27px; }
.addstyle-row.addstyle-previews-labeled .addstyle-prev:not(.asp-hidden) .asp-glyph{
  font-size:22px; line-height:1; flex:none;
}
.addstyle-row.addstyle-previews-labeled .addstyle-prev:not(.asp-hidden) .asp-lbl{
  display:block; white-space:nowrap; font-size:12px; font-weight:600; line-height:1;
}
.addstyle-lbl{ font-size:12.5px; color:var(--muted); white-space:nowrap; }
.addstyle-row button[aria-selected="true"] .addstyle-lbl{ color:var(--text); font-weight:700; }
/* Settings → Interface: card background pattern picker (mirrors add-button style row). */
.cardbgpat-row{ display:flex; flex-wrap:wrap; gap:6px; margin:8px 0 10px; padding:3px 2px; }
.cardbgpat-row button{
  flex:1 1 21%; min-width:72px;
  display:flex; flex-direction:column; align-items:center; gap:7px;
  background:none; border:none; padding:8px 4px 6px; border-radius:14px; cursor:pointer;
}
@media (min-width:700px){
  .cardbgpat-row{ justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto; padding:4px 2px; }
  .cardbgpat-row button{ flex:none; min-width:0; padding-left:12px; padding-right:12px; }
}
.cardbgpat-row button[aria-selected="true"]{ background:var(--accent-faint); box-shadow:0 0 0 2.5px var(--accent); }
.cardbgpat-prev{
  width:54px; height:54px; flex:none; border-radius:10px; box-sizing:border-box;
  border:1px solid var(--border); background-color:transparent;
  background-repeat:repeat;
}
.cardbgpat-prev.cbpat-none{ background-image:none; background-color:var(--card); }
.cardbgpat-prev.cbpat-dots{
  background-image:radial-gradient(circle, rgba(128,128,128,.35) 1.2px, transparent 1.3px);
  background-size:14px 14px;
}
.cardbgpat-prev.cbpat-lines{
  background-image:repeating-linear-gradient(45deg, rgba(128,128,128,.22) 0 2px, transparent 2px 8px);
}
.cardbgpat-prev.cbpat-grid{
  background-image:linear-gradient(rgba(128,128,128,.22) 1px, transparent 1px), linear-gradient(90deg, rgba(128,128,128,.22) 1px, transparent 1px);
  background-size:18px 18px;
}
.cardbgpat-prev.cbpat-stripes{
  background-image:repeating-linear-gradient(0deg, rgba(128,128,128,.22) 0 2px, transparent 2px 10px);
}
.cardbgpat-prev.cbpat-checks{
  background-image:repeating-conic-gradient(rgba(128,128,128,.24) 0 90deg, transparent 90deg 180deg);
  background-size:14px 14px;
}
.cardbgpat-prev.cbpat-crosshatch{
  background-image:repeating-linear-gradient(45deg, rgba(128,128,128,.22) 0 1px, transparent 1px 7px), repeating-linear-gradient(-45deg, rgba(128,128,128,.22) 0 1px, transparent 1px 7px);
}
.cardbgpat-lbl{ font-size:12.5px; color:var(--muted); white-space:nowrap; }
.cardbgpat-row button[aria-selected="true"] .cardbgpat-lbl{ color:var(--text); font-weight:700; }

/* ---------- universal button hover ---------- */
/* Every button gets visible hover feedback. Wrapped in (hover:hover) so touch
   devices (which would leave the hover stuck after a tap) keep :active only. */
@media (hover:hover){
  button:not(:disabled):hover{ filter:brightness(.92); }
  /* Text-style buttons read better underlined than dimmed. */
  button.linkbtn:hover{ filter:none; text-decoration:underline; }
  /* Transparent-background controls get a soft tint so the hover reads. */
  .tabbar button:not(.on):hover,
  .seg button:not(.on):hover{ filter:none; background:rgba(127,127,127,.14); }
  .allchip:not(.on):hover,
  .catchip:not(.on):hover{ filter:none; border-color:var(--text); }
}

/* ---------- tab bar ---------- */
.tabbar{
  position:fixed; left:0; right:0; bottom:var(--kb-h, 0px); z-index:70;
  transform:translateZ(0); /* own compositing layer: stays glued to the viewport on iOS */
  transition:bottom .22s ease-out; /* glide above the iOS keyboard while typing */
  height:calc(var(--tabbar-h) + var(--tabbar-pad-b));
  padding-bottom:var(--tabbar-pad-b);
  background:var(--tabbar-bg); backdrop-filter:blur(8px);
  border-top:1px solid var(--border); display:flex;
}
/* Sheet foot sits on the tab bar — drop the hairline so they read as one edge. */
body.sheet-open .tabbar{ border-top-color:transparent; }
.tabbar button{
  flex:1; border:none; background:none; cursor:pointer; color:var(--muted);
  font-size:10.5px; font-weight:600; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:3px; padding:6px 0;
  margin:4px 3px; border-radius:14px;
}
.tabbar button svg{width:22px; height:22px;}
/* Tab bar appearance: labels only / icons only / both (default). */
.tabbar.no-icons button svg{display:none;}
.tabbar.no-icons button{font-size:12px; gap:0;}
.tabbar.icons-only .tab-lbl{display:none;}
.tabbar.icons-only button{gap:0;}
.tabbar button.on{color:var(--accent); background:var(--accent-faint); box-shadow:0 0 0 2.5px var(--accent);}
.tabbar button#tab-back:disabled{opacity:.35; cursor:default;}
/* Back is an action, not a destination tab (Dave, 2026-11-15): it wears
   a filled accent pill -- the one solid shape in the bar -- while the
   destination tabs stay flat. Paint only: same box, same tap target.
   Disabled (nowhere to go back to) it keeps the pill shape in inert
   gray, so the bar's left edge never changes identity. */
.tabbar button#tab-back{
  background:var(--accent); color:var(--on-accent); border-radius:999px;
}
.tabbar button#tab-back:disabled{
  background:var(--border); color:var(--muted); opacity:1; cursor:default;
}
/* Back button style preference (Settings -> Tab bar): Plain restores
   the flat tab look (with the old fade when disabled); Hidden removes
   the button from the bar -- applyBackBtn keeps it, as the pill, when
   every destination tab is hidden, so the bar never has zero exits. */
.tabbar.back-plain button#tab-back{ background:none; color:var(--muted); border-radius:14px; }
.tabbar.back-plain button#tab-back:disabled{ background:none; color:var(--muted); opacity:.35; }
.tabbar.back-hidden button#tab-back{ display:none; }
/* pan-x so a finger on a tile can still scroll the bar; none once a drag starts. */
.tabbar button{ touch-action:pan-x; user-select:none; -webkit-user-select:none; }
.tabbar.is-reordering, .tabbar.is-reordering button{ touch-action:none; }
/* Source stays put — only dim slightly; do not change size/border (avoids reflow). */
.tabbar button.tab-drag-source{ opacity:.35; }
/* Drop target: dashed outline = dragged tile will insert before this one. */
.tabbar button.tab-drop-target{
  outline:2px dashed var(--accent); outline-offset:-2px;
  background:var(--accent-faint);
  box-shadow:none;
}
/* Full tile preview on <body> — outside the tab bar's transform/overflow clip. */
.tab-drag-ghost{
  position:fixed; z-index:90; margin:0; box-sizing:border-box;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; padding:6px 0; border:none; border-radius:14px; cursor:grabbing;
  pointer-events:none; touch-action:none;
  color:var(--accent); background:var(--accent-faint);
  box-shadow:0 0 0 2.5px var(--accent), 0 12px 28px rgba(0,0,0,.4);
  transform:scale(1.06);
}
.tab-drag-ghost svg{width:22px; height:22px;}
@media (max-width:560px){
  .tab-drag-ghost{ gap:4px; padding:4px 0 6px; font-size:16px; }
  .tab-drag-ghost svg{width:33px; height:33px;}
}
/* iPhone: while the keyboard is open the tab bar stays behind it instead of
   gliding up over the page content, where it would cover e.g. search results. */
html.iphone .tabbar{ bottom:0; transition:none; }
.tabbar .tab-short{display:none;}
@media (max-width:560px){
  .tabbar .tab-full{display:none;}
  .tabbar .tab-short{display:inline;}
}

/* iPhone only: hide the parenthetical hints on filter labels */
.iphone .fhint{display:none;}
/* ---------- iPhone layout refinements (≤560px) ---------- */
@media (max-width:560px){
  /* tab bar: 50% bigger icons/text; scroll sideways to reach every tab */
  :root{--tabbar-h:74px; --tabbar-pad-b:max(12px, calc(env(safe-area-inset-bottom) / 2));}
  .tabbar{overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch;}
  .tabbar::-webkit-scrollbar{display:none;}
  .tabbar button{flex:none; min-width:72px; font-size:16px; gap:4px; padding:4px 0 6px;}
  .tabbar button svg{width:33px; height:33px;}
  /* home stat tiles: stay 3-across, compact */
  .stat{padding:8px 6px;}
  .stat .label{font-size:10.5px;}
  .stat .value{font-size:18px;}
  .stat .split{font-size:12.5px; line-height:1.4;}
  /* tables: hide Txns / Avg-mo / %-of-budget columns on phones
     (th carry data-scol; td cells get matching data-scol in JS).
     Category Mix omits those columns from the DOM on phone (see catMixTable).
     Budget vs Actual table keeps % of budget — see .budget-tbl below. */
  .ptable [data-scol="txns"], .ptable [data-scol="avg"], .ptable [data-scol="pct"]{display:none;}
  /* Category Mix on phone: only Category / Share / Amount — keep Category
     compact so Share/Amount aren't pushed to the far edge by empty name space. */
  .ptable.mix, .ptable.mix.mix-phone{min-width:0; width:100%;}
  table.ptable.mix.mix-phone [data-scol="name"]{
    width:42%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  }
  table.ptable.mix.mix-phone [data-scol="share"]{width:24%;}
  table.ptable.mix.mix-phone [data-scol="amount"]{width:28%;}
  /* Budget vs Actual table: all 5 columns on phone; Category stays compact. */
  .ptable.budget-tbl{min-width:0; width:100%; table-layout:fixed;}
  .ptable.budget-tbl [data-scol="pct"]{display:table-cell;}
  table.ptable.budget-tbl [data-scol="name"]{
    width:26%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  }
  table.ptable.budget-tbl [data-scol="budget"],
  table.ptable.budget-tbl [data-scol="actual"],
  table.ptable.budget-tbl [data-scol="var"]{width:18%; white-space:nowrap;}
  table.ptable.budget-tbl [data-scol="pct"]{width:14%; white-space:nowrap;}
  table.ptable.budget-tbl th, table.ptable.budget-tbl td{padding-left:4px; padding-right:4px; font-size:13px;}
  /* category mix donuts: stack the three vertically, one per row */
  .donut-trio{grid-template-columns:1fr;}
  /* charts: text 2x on phones (CSS beats the font-size attributes) */
  .rep-svg text[font-size="11"]{font-size:22px;}
  .rep-svg text[font-size="12"]{font-size:24px;}
  .rep-svg text[font-size="13"]{font-size:26px;}
  .rep-svg text[font-size="18"]{font-size:18px;}
  .rep-svg text[font-size="33"]{font-size:33px;}
  .rep-svg g[font-size="12"]{font-size:24px;}
  /* transactions filters: keep 2 columns on phones too (Dave's call) */
  /* edit form: Date and Amount share one row on phones */
  .fgrid{grid-template-columns:1fr 1fr;}
  .fgrid>div{grid-column:1 / -1;}
  .fgrid>div.half{grid-column:auto;}
  /* hide the All quick-reset chips on phones (each menu still offers All first) */
  .filters .allchip{display:none;}
  /* transaction cards: slightly tighter */
  .txn{padding:8px 10px; gap:8px;}
  /* budget planner rows: taller check / action tap targets on phones.
     Direct-child .lockbtn is the ✓; padlock lives in .bot-acts (kept 36px
     wide so it stays centered with the trash icon). */
  .bot-row > .lockbtn{min-height:44px; min-width:40px;}
  .bot-row .bot-acts .lockbtn{min-height:44px;}
  /* bills calendar: taller day cells so dots don't crowd the date */
  .bill-cal .day{min-height:52px;}
}

/* Desktop/tablet charts: CSS font-size on SVG <text> still lives in viewBox
   user space and scales with the CTM (~2× on wide cards). Use ~half of the
   desired screen size so labels land ~16–18px. Phone keeps the larger 2×
   overrides in the max-width:560px block above. */
@media (min-width:561px){
  .rep-svg text[font-size="11"]{font-size:8px;}
  .rep-svg text[font-size="12"]{font-size:9px;}
  .rep-svg text[font-size="13"]{font-size:9px;}
  .rep-svg text[font-size="18"]{font-size:9px;}
  .rep-svg text[font-size="33"]{font-size:10px;}
  .rep-svg g[font-size="12"]{font-size:9px;}
}

/* ---------- tablet (iPad): "medium" layout. Widen the content column so the
   app uses the tablet's width instead of the narrow phone-width column, at
   full-size type. ---------- */
@media (min-width:761px){
  main{width:calc(max(320px, 100% - var(--side-margin) * 2)); max-width:1000px;}
  .sheet{max-width:880px;}
}

/* ---------- desktop: full-size type, wide content column. Comes after tablet
   so it wins the cascade at ≥1200px. ---------- */
@media (min-width:1200px){
  main{max-width:calc(max(320px, min(1600px, 100%) - var(--side-margin) * 2));}
  .sheet{max-width:1100px;}
}

/* ---------- modal ---------- */
/* Overlay covers the full viewport; bottom padding reserves the tab bar so
   every sheet's bottom edge sits flush on the footer (no page/FAB gap). The
   tab bar paints above the overlay (z-index) so tabs stay tappable. Keyboard
   lift adjusts padding in applyKbOffset(). */
.overlay{
  position:fixed; inset:0;
  padding-bottom:var(--tabbar-dock-h, calc(var(--tabbar-h) + var(--tabbar-pad-b)));
  box-sizing:border-box;
  z-index:60; background:rgba(15,20,25,.5);
  display:flex; align-items:flex-end; justify-content:center; animation:fade .15s;
  transition:padding-bottom .22s ease-out; /* sheets glide above the iOS keyboard */
}
.sheet{
  background:var(--card); width:100%; max-width:760px; position:relative;
  /* Height is capped by the overlay content box (above the tab bar / keyboard). */
  max-height:100%;
  border-radius:20px 20px 0 0;
  display:flex; flex-direction:column; overflow:hidden;
  padding:0;
  /* Kill subpixel hairlines between sheet foot and tab bar. */
  margin-bottom:-1px;
}
/* Non-scrolling chrome: grab + title + close stay above sheet-body. */
.sheet-head{
  flex:none; position:relative; z-index:8;
  min-height:56px;
  padding:8px 56px 10px 18px; /* right pad clears absolute ✕ */
  background:var(--card);
  border-bottom:1px solid var(--border);
  box-shadow:0 1px 0 rgba(20,30,40,.04);
}
.sheet-head-title{
  margin:2px 0 0; padding:0;
  font-size:17px; font-weight:700; line-height:1.25; color:var(--text);
}
.sheet-body{
  flex:1 1 auto; min-height:0; overflow-y:auto;
  /* No home-indicator pad — the sheet docks on the tab bar, which owns safe-area. */
  padding:10px 18px 22px;
  -webkit-overflow-scrolling:touch;
  touch-action:pan-y; /* lock to vertical scroll; no horizontal dragging */
}
/* Pinned action footer: sits flush at the sheet's bottom edge, outside the
   scroll area, so content scrolls fully and never shows through behind it. */
.sheet-foot{
  flex:none;
  background:var(--card);
  border-top:1px solid var(--border);
  padding:12px 18px 14px;
}
.sheet-foot .btnrow{ margin-top:0; }
/* ✕ pinned in the non-scrolling head — never over live preview. */
.sheet-x{
  position:absolute; top:8px; right:12px; z-index:9;
  width:45px; height:45px; border-radius:50%; border:none; cursor:pointer; padding:0;
  background:rgba(127,127,127,.22); color:var(--text);
  font-size:22px; line-height:1; display:flex; align-items:center; justify-content:center;
}
/* Round-button press: grow to 1.5× and fade to invisible in sync (150ms).
   Buttons that stay on screen (FAB, search clear) ease back on release;
   sheet ✕ / card ✕ use .press-out + a matching delay so the fade finishes as
   the sheet dismisses or the card is removed. */
.sheet-x, .card-x, .fab, .clearbtn, .set-collapse{
  transition:transform .15s ease-out, opacity .15s ease-out;
}
.sheet-x:active, .card-x:active, .fab:active, .set-collapse:active,
.sheet-x.press-out, .card-x.press-out{
  transform:scale(1.5); opacity:0;
}
.clearbtn:active, .clearbtn.press-out{
  transform:translateY(-50%) scale(1.5); opacity:0;
}
/* Chart-card × press feedback: inflate visibly FIRST (staying opaque), then
   fade — the old in-sync grow+fade was too fast to perceive. */
.card-x:active{ transform:scale(1.3); opacity:1; }
.card-x.press-out{
  transform:scale(1.65); opacity:0;
  transition:transform .16s ease-out, opacity .24s ease-in .14s;
}
/* Small circle ✕ to hide/remove a chart card (Home / Reports) — not a data delete. */
.card-x{
  flex:none; width:32px; height:32px; border-radius:50%; border:none; cursor:pointer; padding:0;
  background:rgba(127,127,127,.18); color:var(--muted);
  font-size:18px; line-height:1; display:inline-flex; align-items:center; justify-content:center;
}
.sheet h2{margin:0 0 4px; font-size:18px;}
/* Drag handle at the top of every bottom sheet: a full-width hit area with
   the iOS-style thumb centered. Dragging it resizes the sheet; the sticky
   footer stays pinned at the bottom while content slides behind it. */
.grab{width:100%; padding:14px 0 8px; margin:0 auto; cursor:grab; touch-action:none;
  user-select:none; -webkit-user-select:none;}
.sheet-head .grab{margin:0 auto 4px;}
.grab::after{content:''; display:block; width:42px; height:5px; border-radius:99px;
  background:var(--border); margin:0 auto;}
.grab.resizing{cursor:grabbing;}

/* ---------- toast / spinner ---------- */
#toast{
  position:fixed; left:50%; transform:translateX(-50%) translateY(20px); z-index:80;
  bottom:calc(var(--tabbar-h) + var(--tabbar-pad-b) + 18px + var(--kb-h, 0px));
  background:#20262d; color:#fff; padding:11px 18px; border-radius:12px; font-size:15.5px;
  opacity:0; pointer-events:none; transition:all .25s; max-width:92vw; text-align:center;
}
#toast.show{opacity:1; transform:translateX(-50%) translateY(0);}
#toast.err{background:#8f2424;}
#toast.hold{pointer-events:auto; cursor:pointer;}
#toast.hold::after{content:' · Tap to dismiss'; opacity:.9; font-size:13px;}
/* When a bottom sheet is open, show the toast at the top so it never covers the sheet's buttons. */
#toast.top{bottom:auto; top:calc(var(--headH, 60px) + 10px + env(safe-area-inset-top)); transform:translateX(-50%) translateY(-20px);}
#toast.top.show{transform:translateX(-50%) translateY(0);}
.spin{display:inline-block; width:18px; height:18px; border:2.5px solid var(--border);
  border-top-color:var(--blue); border-radius:50%; animation:sp 0.8s linear infinite; vertical-align:-4px;}
@keyframes sp{to{transform:rotate(360deg)}}
/* Small "Updating…" pill shown below the header while data reloads. */
#refresh-pill{
  position:fixed; left:50%; transform:translateX(-50%) translateY(-8px); z-index:70;
  top:calc(var(--headH, 60px) + 8px + env(safe-area-inset-top));
  background:var(--card); color:var(--text); border:1px solid var(--border);
  padding:7px 14px; border-radius:20px; font-size:13.5px; font-weight:600;
  box-shadow:0 2px 8px rgba(20,30,40,.12);
  opacity:0; pointer-events:none; transition:opacity .2s, transform .2s;
  display:flex; align-items:center; gap:8px;
}
#refresh-pill.show{opacity:1; transform:translateX(-50%) translateY(0);}
#refresh-pill .spin{width:14px; height:14px; border-width:2px; vertical-align:0;}
.loading{text-align:center; padding:40px 0; color:var(--muted);}

/* ---------- import ---------- */
.drop{border:2px dashed var(--border); border-radius:var(--radius); padding:22px 14px; text-align:center;
  background:var(--card); margin-bottom:12px;
  transition:border-color .15s ease, background .15s ease, box-shadow .15s ease;}
.drop input{display:none;}
.drop.is-dragover,
#pdf-import-card.is-dragover .drop{
  border-color:var(--accent);
  background:color-mix(in srgb, var(--accent-soft) 70%, transparent);
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
#pdf-import-card.is-dragover{
  border-color:color-mix(in srgb, var(--accent) 40%, var(--border));
}
.mapgrid{display:grid; grid-template-columns:1fr 1fr; gap:8px;}
.ptablewrap{overflow-x:auto; border:1px solid var(--border); border-radius:12px; margin:10px 0;}
/* Import preview: the table's floor is the sum of its fields' full-value
   widths, so the wrap scrolls sideways instead of squeezing the Type /
   Account / Category selects into clipped stubs (Dave, 2026-11-15). */
#preview-card table.ptable{min-width:1160px;}
table.ptable{border-collapse:collapse; width:100%; font-size:14.5px; min-width:640px;}
/* Narrow tables (e.g. Income by category): drop the min-width so columns
   size dynamically to the viewport instead of scrolling sideways. Numeric
   columns stay compact; the first column takes the remaining space. */
table.ptable.fit{min-width:0;}
table.ptable.fit th:nth-child(n+2), table.ptable.fit td:nth-child(n+2){white-space:nowrap;}
table.ptable.fit th, table.ptable.fit td{padding-left:4px; padding-right:4px;}
/* In-app update banner: shown when version.json reports a newer build. */
#updBar{position:fixed;top:0;left:0;right:0;z-index:10000;display:none;align-items:center;justify-content:space-between;gap:12px;background:#2456c8;color:#fff;padding:10px 14px;font-size:14px;box-shadow:0 2px 10px rgba(0,0,0,.3);flex-wrap:wrap;}
#updBar.show{display:flex;}
#updBar .umsg{flex:1; min-width:min(100%,220px); line-height:1.35;}
#updBar .utitle{font-weight:700; font-size:15px;}
#updBar .usub{font-size:13px; opacity:.92; margin-top:2px;}
#updBar .uacts{display:flex;align-items:center;gap:8px;flex:none;flex-wrap:wrap;}
/* Banner action chips on the blue bar (What’s new / Refresh). */
#updBar .ubtn-bar{
  flex:none; font-size:13px; font-weight:700; color:#fff;
  background:rgba(255,255,255,.18); border:1px solid rgba(255,255,255,.42);
  border-radius:999px; padding:6px 12px; cursor:pointer; white-space:nowrap;
}
#updBar .ubtn-bar:hover, #updBar .ubtn-bar:focus-visible{
  background:rgba(255,255,255,.3); border-color:rgba(255,255,255,.6);
}
#updBar .ubtn-bar[hidden]{display:none !important;}
/* Banner dismiss: circle ✕ on the blue bar (same grow+fade as .card-x). */
#updBar .card-x{background:rgba(255,255,255,.22); color:#fff;}
#updBar .card-x:hover{background:rgba(255,255,255,.34);}
/* Lightweight "What's new" panel under the update banner — z below the banner
   so banner dismiss stays usable. Scrim + Esc + circle ✕ close only the panel. */
#updNews{position:fixed;inset:0;z-index:9999;display:none;}
#updNews.show{display:block;}
#updNews .updNews-scrim{position:absolute;inset:0;background:rgba(0,0,0,.35);}
#updNews .updNews-card{
  position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  width:max(280px, calc(100% - 400px));
  height:max(200px, calc(100dvh - 400px));
  max-width:calc(100% - 24px);
  max-height:calc(100dvh - 24px);
  display:flex;flex-direction:column;background:var(--card);color:var(--text);
  border:1px solid var(--border);border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.28);
  /* clip keeps the rounded corners. hidden would be a scroll container and
     position:sticky on the type tiles fails inside it. */
  overflow:clip; overscroll-behavior:contain;
}
#updNews .updNews-card.dragging,
#updNews .updNews-card.resizing{ box-shadow:0 18px 48px rgba(0,0,0,.38); }
#updNews .updNews-card.dragging{ cursor:grabbing; }
/* SE corner grip — drag to resize width and height. */
#updNews .updNews-resize{
  position:absolute; right:0; bottom:0; width:28px; height:28px;
  cursor:nwse-resize; touch-action:none; z-index:2;
  background:
    linear-gradient(135deg, transparent 0 54%, var(--muted) 54% 58%, transparent 58% 68%, var(--muted) 68% 72%, transparent 72% 82%, var(--muted) 82% 86%, transparent 86%);
  opacity:.55;
}
#updNews .updNews-resize:hover,
#updNews .updNews-card.resizing .updNews-resize{ opacity:.9; }
#updNews .updNews-head{
  display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px 4px;flex:none;
  cursor:grab; touch-action:none; user-select:none; -webkit-user-select:none;
}
#updNews .updNews-card.dragging .updNews-head{ cursor:grabbing; }
#updNews .updNews-head h2{margin:0;font-size:19px; pointer-events:none;}
#updNews .updNews-sub{
  margin:0;padding:0 14px 8px;font-size:15px;flex:none;
  cursor:grab; touch-action:none; user-select:none; -webkit-user-select:none;
}
/* One scrollport for the whole changelog. Load-new-version sticks under the
   head while Earlier (and long New) content scrolls beneath it. */
#updNews .updNews-body{
  flex:1 1 auto; min-height:0; max-height:100%;
  padding:0 14px 12px; overflow-x:clip; overflow-y:auto;
  -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
  font-size:16px;
}
#updNews .updNews-new{ overflow:visible; }
#updNews .updNews-body h2{font-size:18px;margin:4px 0 8px;}
/* iPhone: What's-new type matches the normal app text size for readability */
html.iphone #updNews .updNews-head h2{font-size:22px;}
html.iphone #updNews .updNews-sub{font-size:17px;}
html.iphone #updNews .updNews-body{font-size:21px;line-height:1.45;}
html.iphone #updNews .updNews-body h2{font-size:20px;}
#updNews .updNews-body h3{font-size:17px;margin:14px 0 6px;}
#updNews .updNews-body h4{font-size:15px;font-weight:700;color:var(--muted);margin:12px 0 4px;}
#updNews .updNews-body h4 a.cl-ver-link{
  color:inherit; text-decoration:none; text-underline-offset:2px; font-weight:700;
}
#updNews .updNews-body h4 a.cl-ver-link:hover{
  color:var(--accent); text-decoration:underline;
}
#updNews .updNews-body ul.info-list{
  margin:0 0 4px; padding-left:0; list-style:none;
}
#updNews .updNews-body li{font-size:16px;line-height:1.45;margin:6px 0;}
html.iphone #updNews .updNews-body li{font-size:18px;}
#updNews .updNews-refresh{
  position:sticky; top:0; z-index:2;
  display:flex; justify-content:center; align-items:center;
  margin:0 -14px; padding:12px 14px;
  background:var(--card); border-top:1px solid var(--border); border-bottom:1px solid var(--border);
}
#updNews .updNews-refresh .ubtn{
  width:auto; min-width:168px; max-width:100%;
  background:var(--blue); color:#fff; border:0; border-radius:10px;
  padding:12px 22px; font-weight:700; font-size:15px; cursor:pointer;
}
#updNews .updNews-earlier{
  margin:0; border-top:none; padding-top:10px; overflow:visible;
}
#updNews .updNews-earlier>summary{cursor:pointer;font-weight:600;font-size:14px;color:var(--muted);list-style:none;}
#updNews .updNews-earlier>summary::-webkit-details-marker{display:none;}
#updNews .updNews-earlier>summary::before{content:'▸ '; color:var(--muted);}
#updNews .updNews-earlier[open]>summary::before{content:'▾ ';}
#updNews .updNews-earlier .updNews-earlier-body{margin-top:8px;opacity:.92;}
/* Full-history type tiles sit at the top of the earlier body (hidden when collapsed). */
#updNews .updNews-earlier .updNews-earlier-body .cl-type-stats{margin:0 0 10px;}
/* Hard page lock while the panel is open — body is position:fixed via JS so
   wheel/touch cannot move Home underneath. */
html.upd-news-open, html.upd-news-open body{
  overflow:hidden !important; overscroll-behavior:none; touch-action:none;
}
html.upd-news-open #updNews, html.upd-news-open #updNews *{ touch-action:auto; }
html.upd-news-open #updNews .updNews-body{ touch-action:pan-y; }
/* Info page version markers under date headings */
#info-body h4{font-size:13px;font-weight:700;color:var(--muted);margin:12px 0 4px;}
#info-body h4 a.cl-ver-link{
  color:inherit; text-decoration:none; text-underline-offset:2px; font-weight:700;
}
#info-body h4 a.cl-ver-link:hover{
  color:var(--accent); text-decoration:underline;
}
/* Pull-to-check-for-updates indicator: slides down from the top while the
   user drags down from the very top of a screen. */
#ptrHint{position:fixed;top:0;left:50%;transform:translate(-50%,-110%);z-index:9000;
  background:var(--card);border:1px solid var(--border);border-top:0;border-radius:0 0 12px 12px;
  padding:8px 18px 10px;font-size:14px;color:var(--muted);white-space:nowrap;pointer-events:none;
  transition:transform .18s ease;box-shadow:0 4px 14px rgba(0,0,0,.18);}
#ptrHint.show{transform:translate(-50%,0);}
#ptrHint.armed{color:var(--text);font-weight:600;}
/* Info page: change log rendered from CHANGELOG.md. */
#info-version{margin:0 0 12px;}
#screen-info h3{margin:20px 0 6px; font-size:16px;}
ul.info-list{margin:0 0 8px; padding-left:20px;}
ul.info-list li{margin:7px 0; font-size:15px; line-height:1.45;}
/* Structured changelog items:
   Row 1: type pill + 👍/👎. Row 2: full-width title. Then detail. */
ul.info-list li .cl-top{
  display:flex; flex-direction:column; align-items:stretch; gap:5px;
}
ul.info-list li .cl-meta{
  display:flex; align-items:center; gap:10px; min-height:28px;
}
ul.info-list li .cl-meta .vote-btns{ margin-left:auto; }
ul.info-list li .cl-head{
  font-weight:600; line-height:1.35; width:100%; min-width:0;
}
/* Type pill: capsule like vote buttons; border matches text color. */
ul.info-list li .cl-type{
  display:inline-flex; align-items:center; vertical-align:middle;
  font-size:11px; font-weight:700; letter-spacing:.02em;
  line-height:1.2; padding:3px 9px; border-radius:999px;
  border:1px solid; white-space:nowrap; flex:none;
}
ul.info-list li .cl-type-feature{
  color:var(--accent); border-color:var(--accent);
  background:var(--accent-soft);
}
ul.info-list li .cl-type-bugfix,
ul.info-list li .cl-type-fix{
  color:var(--danger); border-color:var(--danger);
  background:var(--danger-soft);
}
ul.info-list li .cl-type-polish{
  color:#0e7490; border-color:#0e7490;
  background:#e0f7fa;
}
ul.info-list li .cl-type-improvement{
  color:#6d28d9; border-color:#6d28d9;
  background:#f3e8ff;
}
[data-theme="dark"] ul.info-list li .cl-type-polish{
  color:#67e8f9; border-color:#67e8f9;
  background:#0c2f38;
}
[data-theme="dark"] ul.info-list li .cl-type-improvement{
  color:#c4b5fd; border-color:#c4b5fd;
  background:#2a1f45;
}
/* What’s new: type-count tiles (match pill colors). Click to filter the section list. */
.cl-type-stats{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(72px,1fr)); gap:8px;
  margin:0 0 12px;
}
.cl-type-stat{
  display:block; width:100%; box-sizing:border-box;
  font:inherit; appearance:none; -webkit-appearance:none;
  text-align:center; border:1px solid; border-radius:var(--radius);
  padding:8px 6px; min-width:0; cursor:pointer;
  transition: box-shadow .12s ease, transform .12s ease;
}
.cl-type-stat .value{font-size:20px; font-weight:800; letter-spacing:-.3px; line-height:1.1;}
.cl-type-stat .label{
  font-size:11px; font-weight:700; margin-top:3px; line-height:1.2;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.cl-type-stat.cl-type-feature{
  color:var(--accent); border-color:var(--accent); background:var(--accent-soft);
}
.cl-type-stat.cl-type-bugfix{
  color:var(--danger); border-color:var(--danger); background:var(--danger-soft);
}
.cl-type-stat.cl-type-polish{
  color:#0e7490; border-color:#0e7490; background:#e0f7fa;
}
.cl-type-stat.cl-type-improvement{
  color:#6d28d9; border-color:#6d28d9; background:#f3e8ff;
}
.cl-type-stat.cl-type-other{
  color:var(--muted); border-color:var(--border); background:var(--bg);
}
.cl-type-stat.is-selected,
.cl-type-stat[aria-pressed="true"]{
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px currentColor;
  transform: translateY(-1px);
}
.cl-type-stat:focus-visible{ outline:2px solid currentColor; outline-offset:2px; }
[data-theme="dark"] .cl-type-stat.cl-type-polish{
  color:#67e8f9; border-color:#67e8f9; background:#0c2f38;
}
[data-theme="dark"] .cl-type-stat.cl-type-improvement{
  color:#c4b5fd; border-color:#c4b5fd; background:#2a1f45;
}
[data-theme="dark"] .cl-type-stat.cl-type-other{
  color:#a8b0bd; border-color:#3a4250; background:#1a1f28;
}
@media (max-width:420px){
  .cl-type-stats{grid-template-columns:repeat(auto-fit,minmax(64px,1fr));}
}
/* Type-count tiles stick to the top of the sheet while their section scrolls.
   Padding keeps the selected ring inside the bar so the list can't cover it. */
#updNews .cl-type-stats{
  position:sticky; top:0; z-index:5;
  margin:0 -14px 0; padding:8px 14px 14px;
  background:var(--card);
  box-shadow:0 1px 0 var(--border);
}
#updNews .cl-typed-list{ position:relative; z-index:1; }
/* Load new version already occupies the top; later tiles sit just under it. */
#updNews .updNews-refresh{ z-index:3; }
#updNews .updNews-refresh ~ .updNews-earlier .cl-type-stats{
  top:var(--upd-refresh-h, 0px);
}
html.iphone #updNews .cl-type-stat .value{font-size:22px;}
html.iphone #updNews .cl-type-stat .label{font-size:12px;}
ul.info-list li .cl-head a.cl-link{
  display:inline; color:var(--text); font-weight:600; text-decoration:none;
  text-underline-offset:2px;
}
ul.info-list li .cl-head a.cl-link:hover{
  opacity:.88; text-decoration:underline;
}
ul.info-list li .cl-detail{margin-top:3px; font-weight:400; color:var(--muted); font-size:0.94em; line-height:1.4;}
#updNews .updNews-body li .cl-detail{font-size:0.9em;}
html.iphone #updNews .updNews-body li .cl-detail{font-size:0.92em;}
/* Votes sit on the type-pill row; title is full width underneath. */
ul.info-list li.has-votes{display:block;}
ul.info-list li.has-votes .cl-meta .vote-btns{flex:none; padding-top:0;}
ul.info-list li.has-votes .vote-text{width:100%; min-width:0;}
.vote-btns{display:inline-flex; gap:6px; flex-direction:row; flex:none; padding-top:0; align-items:center;}
.vote-btns button{
  border:1px solid var(--border); background:var(--bg); border-radius:999px;
  font-size:16px; padding:6px 12px; cursor:pointer; line-height:1.4;
  color:var(--muted); white-space:nowrap;
}
.vote-btns button .cnt{font-weight:700; margin-left:3px;}
.vote-btns button.voted-up{border-color:var(--accent); color:var(--accent);}
.vote-btns button.voted-down{border-color:var(--danger); color:var(--danger);}
/* iPhone: stack 👍/👎 so changelog text keeps more horizontal room */
html.iphone .vote-btns{flex-direction:column; align-items:stretch; gap:4px; padding-top:0;}
html.iphone .vote-btns button{padding:5px 10px; text-align:center;}
.vote-report{
  background:var(--card); border:1px solid var(--border); border-radius:14px;
  padding:14px 16px; margin:0 0 16px;
}
.vote-report h4{margin:0; display:flex; align-items:center; gap:8px; cursor:pointer; user-select:none; -webkit-user-select:none;}
.vote-report h4 .vr-chev{margin-left:auto; color:var(--muted); font-size:14px; transition:transform .15s;}
.vote-report.collapsed h4 .vr-chev{transform:rotate(-90deg);}
.vote-report.collapsed .vr-body{display:none;}
.vote-report .vr-body{margin-top:8px;}
.vote-report .vr-row{display:flex; gap:8px; align-items:center; margin:8px 0; font-size:14px;}
.vote-report .vr-row.vr-stacked{flex-direction:column; align-items:stretch; gap:4px; margin:12px 0;}
.vote-report .vr-row.vr-stacked .vr-text{font-size:14px;}
.vote-report .vr-rank{font-weight:700; color:var(--muted); margin-right:4px;}
.vote-report .vr-text{flex:1; min-width:0;}
.vote-report .vr-counts{flex:none; color:var(--muted); font-size:13px;}
.ptable th{background:var(--th-bg); text-align:left; padding:8px; font-size:13px; position:sticky; top:0;}
.ptable td{padding:6px; border-top:1px solid var(--border); vertical-align:middle;}
.ptable input,.ptable select{font-size:14.5px; padding:6px 8px;}
.ptable tr.skip td{opacity:.45;}
.notice{background:var(--warn-soft); border:1px solid #ecd9ac; color:#6d4f14;
  border-radius:12px; padding:10px 14px; font-size:14px; margin-bottom:12px;}
.notice.blue{background:var(--blue-soft); border-color:#c3d4f5; color:#1e3f8f;}
.confbadge{display:inline-block;font-size:11px;font-weight:600;margin-left:6px;padding:1px 7px;border-radius:9px;white-space:nowrap;vertical-align:middle}
.confbadge.high{background:#e6f4ea;color:#1e7e34}
.confbadge.medium{background:#fef7e0;color:#b06000}
.confbadge.low{background:#f1f3f4;color:#5f6368}
.dupbadge{display:inline-block;font-size:11px;font-weight:700;margin-left:6px;padding:1px 7px;border-radius:9px;white-space:nowrap;vertical-align:middle;background:#fdecea;color:#b3261e}
.applyall{display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin:10px 0;}
.applyall label{font-size:12px; color:var(--muted); font-weight:600;}
/* Settings → Appearance: calm, professional background picker */
.bg-section{margin-top:16px; padding-top:14px; border-top:1px solid var(--border);}
.bg-head{display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin:0 0 10px;}
.bg-head .f{margin:0;}
.bg-head .linkbtn{font-size:13px; padding:2px 0; font-weight:600;}
.bg-panel{margin:0;}
.bg-intensity{margin:0 0 12px;}
.bg-intensity .seg{width:100%;}
.bg-intensity .seg button{flex:1; font-size:14px;}
.bg-type-row{display:grid; grid-template-columns:64px minmax(0,1fr); gap:8px 10px; align-items:start; margin:0 0 10px;}
.bg-type-row:last-child{margin-bottom:0;}
.bg-type-lbl{
  font-size:12px; font-weight:600; color:var(--muted); line-height:36px;
  letter-spacing:.01em;
}
.bg-presets{
  display:flex; gap:8px; flex-wrap:wrap; align-items:center; min-height:36px;
  min-width:0; max-width:100%;
}
.bg-motion-body, .bg-motion-group{ min-width:0; }
/* Narrow: keep swatches on one row and scroll sideways (iPhone / small screens). */
@media (max-width:560px){
  .bg-presets{
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
    scrollbar-width:none;
    padding:2px 1px 6px;
    touch-action:pan-x;
  }
  .bg-presets::-webkit-scrollbar{ display:none; }
  .bg-presets button, .bg-presets .bg-motion-cell{ flex:none; }
}
.bg-presets button{
  width:44px; height:44px; border-radius:12px; border:1px solid rgba(127,127,127,.45);
  padding:0; cursor:pointer; background-color:var(--track); background-size:cover;
  background-position:center; flex:none; position:relative;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.25), 0 1px 3px rgba(0,0,0,.18);
  transition: box-shadow .15s ease, border-color .15s ease, transform .12s ease;
}
.bg-presets button:hover{transform:translateY(-1px);}
.bg-presets button:active{transform:none;}
.bg-presets button.on{
  border-color:var(--accent);
  box-shadow:0 0 0 2px var(--card), 0 0 0 4px var(--accent);
}
.bg-presets button.on::after{
  content:""; position:absolute; right:3px; bottom:3px; width:8px; height:8px;
  border-radius:50%; background:var(--accent); border:1.5px solid #fff;
  box-shadow:0 0 0 1px rgba(0,0,0,.12);
}
.bg-customize{margin-top:16px;}
.bg-customize-label{
  font-size:12px; font-weight:700; color:var(--muted); margin:0 0 8px;
  letter-spacing:.02em; text-transform:uppercase;
}
.bg-cust-list{display:flex; flex-direction:column; gap:0; border:1px solid var(--border); border-radius:12px; overflow:hidden; background:var(--card);}
.bg-cust-row{
  display:grid; grid-template-columns:88px 1fr; gap:10px 12px; align-items:center;
  padding:12px; border-bottom:1px solid var(--border);
}
.bg-cust-row:last-child{border-bottom:0;}
.bg-cust-kicker{font-size:13px; font-weight:700; color:var(--text); line-height:1.2;}
.bg-cust-actions{display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-width:0;}
.bg-cust-actions .btn.small{padding:7px 12px; font-size:14px;}
.bg-cust-actions .linkbtn{font-size:13px; padding:4px 2px;}
.bg-cust-row input[type=color]{
  width:40px; height:32px; padding:0; border:1px solid var(--border); border-radius:8px;
  background:transparent; cursor:pointer; flex:none;
}
.bg-cust-row input[type=color].on{
  box-shadow:0 0 0 2px var(--card), 0 0 0 4px var(--accent); border-color:var(--accent);
}
.bg-cust-hex{
  appearance:none; -webkit-appearance:none; border:0; background:none; padding:4px 2px; margin:0;
  font:inherit; font-size:12.5px; font-weight:600; color:var(--muted); font-variant-numeric:tabular-nums;
  cursor:pointer; border-radius:6px;
}
.bg-cust-hex:hover{ color:var(--text); text-decoration:underline; }
.bg-cust-hex:focus-visible{ outline:2px solid var(--blue-soft); outline-offset:2px; }
.bg-pic-thumb{
  width:44px; height:32px; border-radius:8px; border:1px solid var(--border);
  background:#edf0f3 center/cover no-repeat; flex:none; overflow:hidden;
}
.bg-pic-thumb.on{
  border-color:var(--accent);
  box-shadow:0 0 0 2px var(--card), 0 0 0 4px var(--accent);
}
.bg-pic-thumb.empty{background:
  linear-gradient(45deg,#e2e7ec 25%,transparent 25%),
  linear-gradient(-45deg,#e2e7ec 25%,transparent 25%),
  linear-gradient(45deg,transparent 75%,#e2e7ec 75%),
  linear-gradient(-45deg,transparent 75%,#e2e7ec 75%);
  background-size:12px 12px; background-position:0 0,0 6px,6px -6px,-6px 0; background-color:#f3f5f7;
}
.bg-pic-modes{display:flex; align-items:center; gap:8px; flex-wrap:wrap; width:100%; margin-top:2px;}
.bg-pic-modes .seg{flex:none;}
.bg-pic-modes .seg button{font-size:13px; padding:6px 10px;}
.bg-lib{margin-top:10px; padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--track);}
[data-theme="dark"] .bg-lib{background:var(--seg-bg);}
.bg-lib-head{display:flex; align-items:center; justify-content:space-between; gap:8px; margin:0 0 8px; flex-wrap:wrap;}
.bg-lib-head strong{font-size:13px; font-weight:700;}
.bg-lib-actions{display:flex; gap:6px; flex-wrap:wrap; align-items:center;}
.bg-lib-actions .btn.small{padding:6px 11px; font-size:13px;}
.bg-lib-empty{font-size:12.5px; color:var(--muted); margin:0;}
.bg-lib-list{display:flex; flex-direction:column; gap:6px;}
.bg-lib-item{
  display:flex; align-items:center; gap:8px; padding:8px 10px;
  border:1px solid var(--border); border-radius:10px; background:var(--card);
}
.bg-lib-item.on{border-color:var(--accent); box-shadow:0 0 0 1px var(--accent);}
.bg-lib-swatch{
  width:36px; height:28px; border-radius:8px; border:1px solid var(--border);
  flex:none; overflow:hidden; background:var(--track); position:relative;
}
.bg-lib-meta{flex:1; min-width:0;}
.bg-lib-name{font-size:13.5px; font-weight:700; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.bg-lib-kind{font-size:11.5px; color:var(--muted); font-weight:600;}
.bg-lib-btns{display:flex; gap:4px; flex-wrap:wrap; flex:none;}
.bg-lib-btns .btn.small{padding:5px 9px; font-size:12.5px;}
.bg-lib-btns .linkbtn{font-size:12.5px; padding:4px 2px;}
.bg-customs-empty{font-size:12.5px; color:var(--muted); margin:0;}
.bg-custom-swatch{
  width:36px; height:36px; border-radius:10px; border:1px solid var(--border);
  padding:0; cursor:pointer; position:relative; overflow:hidden; flex:none;
  background-size:cover; background-position:center;
}
.bg-custom-swatch.on{border-color:var(--accent); box-shadow:0 0 0 2px var(--card), 0 0 0 4px var(--accent);}
.bg-custom-swatch .bg-custom-x{
  position:absolute; top:2px; right:2px; width:16px; height:16px; border:0; border-radius:50%;
  background:rgba(23,32,42,.55); color:#fff; font-size:11px; line-height:16px; padding:0; cursor:pointer;
}
/* MH editor sheet */
.mh-ed-card{
  border:1px solid var(--border); border-radius:12px; margin:0 0 10px;
  background:var(--card); padding:12px;
}
.mh-ed-card-title{
  margin:0 0 10px; font-size:13.5px; font-weight:700; color:var(--text);
}
.mh-ed-card-body{display:grid; grid-template-columns:1fr 1fr; gap:8px 12px;}
@media (max-width:420px){ .mh-ed-card-body{grid-template-columns:1fr;} }
.mh-ed-field label{display:flex; justify-content:space-between; gap:8px; font-size:12px; font-weight:600; color:var(--muted); margin:0 0 3px;}
.mh-ed-field label .v{color:var(--text); font-variant-numeric:tabular-nums;}
.mh-ed-field input[type=range]{width:100%;}
.mh-ed-field input[type=color]{width:100%; height:34px; padding:0; border:1px solid var(--border); border-radius:8px; background:transparent;}
.mh-ed-toggle{display:flex; align-items:center; gap:8px; font-size:13.5px; grid-column:1 / -1;}
.mh-ed-toggle input{width:18px; height:18px;}
.mh-ed-pills{
  display:flex; flex-wrap:wrap; gap:8px; margin:0 0 12px;
}
.mh-ed-pills .catchip{font-size:14px; padding:7px 11px;}
.mh-ed-layer-cards{display:flex; flex-direction:column; gap:0;}
.mh-ed-actions{flex-wrap:wrap; gap:8px; margin-top:12px; z-index:2;}
.mh-ed-actions .btn{flex:1 1 calc(50% - 8px); min-width:120px;}
.mh-ed-hint{font-size:12.5px; color:var(--muted); margin:0 0 10px;}
.mh-ed-lbl{font-size:12px; font-weight:700; color:var(--muted); margin:0 0 6px; text-transform:uppercase; letter-spacing:.03em;}
/* Sticky preview pins under fixed .sheet-head (z below head so ✕ stays clear). */
.mh-ed-preview-wrap{
  position:sticky; top:0; z-index:3;
  margin:0 0 14px; padding:0 0 10px;
  background:var(--card);
  border-bottom:1px solid var(--border);
  box-shadow:0 6px 10px -8px rgba(20,30,40,.18);
}
.mh-ed-preview-cap{
  margin:0 0 6px; font-size:11px; font-weight:700; letter-spacing:.04em;
  text-transform:uppercase; color:var(--muted);
}
.mh-ed-preview{
  position:relative; height:168px; border-radius:12px; border:1px solid var(--border);
  overflow:hidden; background:#05070c;
  box-shadow:0 1px 2px rgba(20,30,40,.06);
}
@media (min-width:520px){ .mh-ed-preview{height:190px;} }
.mh-ed-preview .mh-custom{ position:absolute; inset:0; display:block; }
/* Height is locked in JS after open so layer pills don't move the top edge.
   Flex + margin-top:auto keeps the action bar docked when content shrinks. */
.sheet.mh-ed-sheet .sheet-body{
  padding-top:8px;
  display:flex; flex-direction:column;
}
.sheet.mh-ed-sheet .sheet-body > *{ flex:0 0 auto; }
.sheet.mh-ed-sheet .mh-ed-actions{ margin-top:auto; }

.bg-motion{margin-top:14px; border:1px solid var(--border); border-radius:12px; background:transparent;}
.bg-motion > summary{
  list-style:none; cursor:pointer; user-select:none;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:11px 12px; font-size:13.5px; font-weight:700; color:var(--text);
}
.bg-motion > summary::-webkit-details-marker{display:none;}
.bg-motion > summary::after{
  content:"▸"; color:var(--muted); font-size:12px; font-weight:700;
  transition:transform .15s ease;
}
.bg-motion[open] > summary::after{transform:rotate(90deg);}
.bg-motion-body{padding:0 12px 12px; display:flex; flex-direction:column; gap:12px;}
.bg-motion-group{margin:0;}
.bg-motion-label{
  font-size:12px; font-weight:700; color:var(--muted); margin:0 0 6px;
  letter-spacing:.02em; text-transform:uppercase;
}
.bg-motion-cell{
  display:flex; flex-direction:column; align-items:center; flex:none;
  width:48px; gap:4px; position:relative; z-index:0;
}
.bg-motion-cell:hover, .bg-motion-cell:focus-within{ z-index:2; }
.bg-motion-cell-name{
  display:block; font-size:11px; font-weight:600; line-height:1.25;
  color:var(--text); text-align:center; white-space:nowrap;
  visibility:hidden; pointer-events:none;
  max-width:none; width:max-content;
}
.bg-motion-cell:hover .bg-motion-cell-name,
.bg-motion-cell:focus-within .bg-motion-cell-name{
  visibility:visible;
}
.bg-presets-scene button,
.bg-presets-dgrad button,
.bg-presets-dynamic button,
.bg-presets-journey button,
.bg-presets-game button{
  width:48px; height:34px; border-radius:10px; position:relative; overflow:hidden;
}
.bg-presets-scene button.on::after,
.bg-presets-dgrad button.on::after,
.bg-presets-dynamic button.on::after,
.bg-presets-journey button.on::after,
.bg-presets-game button.on::after{
  right:2px; bottom:2px; width:7px; height:7px;
}
.bg-presets-dynamic button,
.bg-presets-game button{
  background-color:#05070c; border-color:#2a3544;
  box-shadow:inset 0 0 10px rgba(0,255,255,.18);
}
.bg-presets-dynamic button.on,
.bg-presets-game button.on{
  box-shadow:0 0 0 2px var(--card), 0 0 0 4px var(--accent), inset 0 0 10px rgba(0,255,255,.18);
}
.bg-presets-dynamic button .mh-thumb,
.bg-presets-journey button .mh-thumb,
.bg-presets-dgrad button .mh-thumb,
.bg-presets-game button .mh-thumb{position:absolute; inset:0; pointer-events:none;}
.mh-live{overflow:hidden; border-radius:inherit;}
/* Scenes size themselves in cq* units, so a 480×340 container at 1/10 scale
   is a faithful mini page that fills the 48×34 swatch. */
.mh-live-stage{
  position:absolute; left:0; top:0; width:480px; height:340px;
  container-type:size; transform:scale(.1); transform-origin:0 0;
}
.mh-live-stage .mh-scene{position:absolute; inset:0; display:block;}
.bg-hint{font-size:12.5px; line-height:1.45; margin:12px 0 0; color:var(--muted);}
.bg-hint b{font-weight:650; color:var(--text);}
/* Settings → Interface: daily totals on/off + style as one nested unit. */
.ui-daytotals-group{margin-top:2px;}
.ui-daytotals-group > .bg-customize-label{margin:14px 0 8px;}
.ui-daytotals-nest{
  border:1px solid var(--border); border-radius:12px;
  background:var(--card); padding:2px 14px 12px;
}
.ui-daytotals-nest .muted{margin:8px 0 10px;}
.ui-daytotals-nest .muted:last-child{margin-bottom:0;}
/* Page-background presets work in any theme. */
.bg-ed-preview{
  width:100%; height:110px; border-radius:12px; border:1px solid var(--border);
  background-color:#f3f5f7; background-size:auto; background-repeat:repeat;
  margin:8px 0 12px;
}
.bg-ed-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px 12px;}
@media (max-width:420px){
  .bg-ed-grid{grid-template-columns:1fr;}
  .bg-type-row{grid-template-columns:56px 1fr;}
}
.bg-ed-field label{display:block; font-size:12px; font-weight:600; color:var(--muted); margin:0 0 4px;}
.bg-ed-field input[type=color]{width:100%; height:36px; padding:0; border:1px solid var(--border); border-radius:8px; background:transparent; cursor:pointer;}
.bg-ed-field input[type=range]{width:100%;}
.bg-ed-field select, .bg-ed-field input[type=text]{
  width:100%; font-size:15px; padding:8px 10px; border:1px solid var(--border);
  border-radius:10px; background:var(--input-bg); color:var(--text); font-family:inherit;
}
.bg-ed-check{display:flex; align-items:center; gap:8px; margin-top:10px; font-size:14.5px;}
.bg-ed-check input{width:18px; height:18px;}
.bg-ed-hint{font-size:12.5px; color:var(--muted); margin:6px 0 0;}
.bg-editor-actions{display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:4px;}

/* ---------- Dynamic Max Headroom page backgrounds (CRT-dark layer only) ----------
   Stage lives on #bg-dynamic. Theme tokens (--bg, --text, …) stay with the user's
   Light/Dark choice so card chrome (.btn.ghost, chips, inputs) stays readable. */
#bg-dynamic{
  position:fixed; inset:0; z-index:-1; pointer-events:none; overflow:hidden;
  display:none; background:#05070c; container-type:size;
}
html[data-bg-dynamic] #bg-dynamic{display:block;}
/* Hide body page fill/image while a dynamic stage is up (tokens still light/dark). */
html[data-bg-dynamic] body{
  background-color:transparent !important;
  background-image:none !important;
}
/* iPhone Safari: background-attachment:fixed is ignored, and position:fixed with
   z-index < 0 scrolls with the page. Paint static bgs on a fixed z-index:0 plate
   and raise app chrome above it (same viewport-locked feel as desktop). */
html.iphone body{
  background-color:transparent;
  background-image:none;
}
html.iphone body::before{
  content:"";
  position:fixed; inset:0; z-index:0; pointer-events:none;
  background-color:var(--page-bg, var(--bg));
  background-image:var(--bg-extra, none);
  background-size:var(--bg-size, auto);
  background-repeat:var(--bg-repeat, repeat);
  background-position:var(--bg-pos, 0 0);
  transform:translateZ(0);
}
html.iphone[data-bg-dynamic] body::before{ display:none; }
html.iphone[data-bg-anim="1"] body{
  animation:none !important;
}
html.iphone[data-bg-anim="1"] body::before{
  background-size:200% 200%;
  background-repeat:no-repeat;
  animation:dg-shift 14s ease-in-out infinite;
}
html.iphone.bg-paused[data-bg-anim="1"] body::before{ animation:none; }
html.iphone #bg-dynamic{
  display:none !important;
}
/* Motion gradients (dg-*) are CSS-only and safe on iPhone; Max Headroom / Games stay off. */
html.iphone[data-bg-dynamic^="dg-"] #bg-dynamic{
  display:block !important;
}
html.iphone #app,
html.iphone #setup-screen{
  position:relative;
  z-index:1;
}
#bg-dynamic .mh-scene{position:absolute; inset:0; display:none;}
/* Dark mode: dim custom page backgrounds so bright presets aren't blinding
   at night. A translucent black layer paints over the background image /
   gradient (and the solid --page-bg beneath it). Scoped to data-bg-custom so
   the default dark background is untouched. Dynamic stages dim via filter. */
html[data-theme="dark"][data-bg-custom]:not(.iphone) body{
  background-image:linear-gradient(rgba(4,7,11,.45), rgba(4,7,11,.45)), var(--bg-extra, none);
}
html[data-theme="dark"][data-bg-custom].iphone body::before{
  background-image:linear-gradient(rgba(4,7,11,.45), rgba(4,7,11,.45)), var(--bg-extra, none);
}
/* Dynamics (MH / journeys / games) are authored for dark CRT stages — do not
   further dim #bg-dynamic or black arcade scenes read as an empty void. */
html[data-bg-dynamic="mh-wireframe"] #bg-dynamic .mh-scene[data-mh="mh-wireframe"],
html[data-bg-dynamic="mh-grid"] #bg-dynamic .mh-scene[data-mh="mh-grid"],
html[data-bg-dynamic="mh-scanlines"] #bg-dynamic .mh-scene[data-mh="mh-scanlines"],
html[data-bg-dynamic="mh-stripes"] #bg-dynamic .mh-scene[data-mh="mh-stripes"],
html[data-bg-dynamic="mh-glitch"] #bg-dynamic .mh-scene[data-mh="mh-glitch"],
html[data-bg-dynamic="mh-geometry"] #bg-dynamic .mh-scene[data-mh="mh-geometry"],
html[data-bg-dynamic="mh-tunnel"] #bg-dynamic .mh-scene[data-mh="mh-tunnel"],
html[data-bg-dynamic="mh-head"] #bg-dynamic .mh-scene[data-mh="mh-head"],
html[data-bg-dynamic="mh-news"] #bg-dynamic .mh-scene[data-mh="mh-news"],
html[data-bg-dynamic="mh-blip"] #bg-dynamic .mh-scene[data-mh="mh-blip"],
html[data-bg-dynamic="mh-chrome"] #bg-dynamic .mh-scene[data-mh="mh-chrome"],
html[data-bg-dynamic="j-space"] #bg-dynamic .mh-scene[data-mh="j-space"],
html[data-bg-dynamic="j-mountains"] #bg-dynamic .mh-scene[data-mh="j-mountains"],
html[data-bg-dynamic="j-ocean"] #bg-dynamic .mh-scene[data-mh="j-ocean"],
html[data-bg-dynamic="j-road"] #bg-dynamic .mh-scene[data-mh="j-road"],
html[data-bg-dynamic="j-forest"] #bg-dynamic .mh-scene[data-mh="j-forest"],
html[data-bg-dynamic="j-city"] #bg-dynamic .mh-scene[data-mh="j-city"],
html[data-bg-dynamic="j-desert"] #bg-dynamic .mh-scene[data-mh="j-desert"],
html[data-bg-dynamic="j-rain"] #bg-dynamic .mh-scene[data-mh="j-rain"],
html[data-bg-dynamic="dg-aurora"] #bg-dynamic .mh-scene[data-mh="dg-aurora"],
html[data-bg-dynamic="dg-mesh"] #bg-dynamic .mh-scene[data-mh="dg-mesh"],
html[data-bg-dynamic="dg-sunset"] #bg-dynamic .mh-scene[data-mh="dg-sunset"],
html[data-bg-dynamic="dg-conic"] #bg-dynamic .mh-scene[data-mh="dg-conic"],
html[data-bg-dynamic="dg-wave"] #bg-dynamic .mh-scene[data-mh="dg-wave"],
html[data-bg-dynamic="dg-candy"] #bg-dynamic .mh-scene[data-mh="dg-candy"],
html[data-bg-dynamic="dg-ember"] #bg-dynamic .mh-scene[data-mh="dg-ember"],
html[data-bg-dynamic="dg-ocean"] #bg-dynamic .mh-scene[data-mh="dg-ocean"],
html[data-bg-dynamic="dg-prism"] #bg-dynamic .mh-scene[data-mh="dg-prism"],
html[data-bg-dynamic="dg-noir"] #bg-dynamic .mh-scene[data-mh="dg-noir"],
html[data-bg-dynamic="dg-plasma"] #bg-dynamic .mh-scene[data-mh="dg-plasma"],
html[data-bg-dynamic="dg-dawn"] #bg-dynamic .mh-scene[data-mh="dg-dawn"],
html[data-bg-dynamic="g-nightdriver"] #bg-dynamic .mh-scene[data-mh="g-nightdriver"],
html[data-bg-dynamic="g-pacman"] #bg-dynamic .mh-scene[data-mh="g-pacman"],
html[data-bg-dynamic="g-digdug"] #bg-dynamic .mh-scene[data-mh="g-digdug"],
html[data-bg-dynamic="g-centipede"] #bg-dynamic .mh-scene[data-mh="g-centipede"],
html[data-bg-dynamic="g-invaders"] #bg-dynamic .mh-scene[data-mh="g-invaders"],
html[data-bg-dynamic="g-asteroids"] #bg-dynamic .mh-scene[data-mh="g-asteroids"],
html[data-bg-dynamic="g-tempest"] #bg-dynamic .mh-scene[data-mh="g-tempest"],
html[data-bg-dynamic="g-battlezone"] #bg-dynamic .mh-scene[data-mh="g-battlezone"],
html[data-bg-dynamic="g-zaxxon"] #bg-dynamic .mh-scene[data-mh="g-zaxxon"],
html[data-bg-dynamic="g-qbert"] #bg-dynamic .mh-scene[data-mh="g-qbert"],
html[data-bg-dynamic="g-frogger"] #bg-dynamic .mh-scene[data-mh="g-frogger"],
html[data-bg-dynamic="g-missile"] #bg-dynamic .mh-scene[data-mh="g-missile"],
html[data-bg-dynamic="mh-custom"] #bg-dynamic .mh-scene[data-mh="mh-custom"]{display:block;}
/* Custom animated gradient (editor) — body keeps tokens; layer paints shift */
html[data-bg-anim="1"] body{
  background-size:200% 200% !important;
  background-repeat:no-repeat !important;
  animation:dg-shift 14s ease-in-out infinite;
}
@keyframes dg-shift{
  0%,100%{ background-position:0% 40%; }
  50%{ background-position:100% 60%; }
}

/* ---------- Custom Max Headroom engine (CSS-variable driven) ---------- */
#bg-dynamic.mh-engine,
html[data-bg-dynamic="mh-custom"] #bg-dynamic{
  --mh-black:#05070c; --mh-neon1:#00ffff; --mh-neon2:#ff00c8; --mh-accent:#ffe600;
  --mh-intensity:1; --mh-speed:1; --mh-vignette:.5; --mh-chroma:0;
  --mh-grid-on:1; --mh-grid-size:36; --mh-grid-thick:2; --mh-grid-opacity:.72;
  --mh-grid-persp:480; --mh-grid-depth:64; --mh-grid-dur:3.2;
  --mh-grid-rot:0; --mh-grid-rot-deg:0deg; --mh-grid-rot-min-deg:-18deg; --mh-grid-rot-max-deg:18deg; --mh-grid-rot-dur:8s;
  --mh-vp-x:50%; --mh-vp-y:47%; --mh-vp-amp:8%; --mh-vp-dur:6s; --mh-grid-rand:0;
  --mh-wash-on:1; --mh-horizon-on:1; --mh-vignette-on:1; --mh-chroma-on:0;
  --mh-scan-on:1; --mh-scan-gap:3; --mh-scan-opacity:.55; --mh-scan-dur:1.4;
  --mh-beam:0.55; --mh-flicker:0.35;
  --mh-stripe-on:1; --mh-stripe-thick:28; --mh-stripe-angle:-32; --mh-stripe-angle-deg:-32deg;
  --mh-stripe-angle-min-deg:-48deg; --mh-stripe-angle-max-deg:-16deg; --mh-stripe-angle-dur:8s;
  --mh-stripe-opacity:.55; --mh-stripe-dur:4;
  --mh-glitch-on:1; --mh-tear:1; --mh-glitch-dur:2.2; --mh-rgb:6; --mh-noise:.2; --mh-stutter:1;
  --mh-city-on:1; --mh-city-opacity:.85; --mh-city-pulse:2.2; --mh-shape-size:1; --mh-shape-count:1;
}

.mh-custom{ --_spd: var(--mh-speed, 1); }
.mh-custom .mhc-stage{ position:absolute; inset:0; background:var(--mh-black,#05070c); }
/* Ambient neon wash — gated; off = solid base only */
.mh-custom .mhc-wash{
  position:absolute; inset:0; opacity:0; pointer-events:none;
  background:
    radial-gradient(ellipse 70% 55% at 18% 28%, color-mix(in srgb, var(--mh-neon1) 40%, transparent), transparent 58%),
    radial-gradient(ellipse 60% 50% at 82% 72%, color-mix(in srgb, var(--mh-neon2) 38%, transparent), transparent 55%),
    radial-gradient(ellipse 50% 40% at 55% 48%, color-mix(in srgb, var(--mh-accent) 22%, transparent), transparent 50%);
}
.mh-custom[data-mh-wash="1"] .mhc-wash{
  opacity:calc(var(--mh-wash-on,1) * var(--mh-intensity,1) * .9);
}
.mh-custom .mhc-layer{ position:absolute; inset:0; pointer-events:none; }
.mh-custom .mhc-grid{
  opacity:calc(var(--mh-grid-on,1) * var(--mh-grid-opacity,.72) * var(--mh-intensity,1));
  perspective:var(--mh-grid-persp-px,480px);
  perspective-origin:var(--mh-vp-x,50%) var(--mh-vp-y,47%);
  transform:rotateZ(var(--mh-grid-rot-deg,0deg));
  transform-style:preserve-3d;
}
.mh-custom[data-mh-grid="1"][data-vp-move="1"] .mhc-grid{
  animation:mhc-vp-drift calc(var(--mh-vp-dur,6s) / var(--_spd)) ease-in-out infinite;
}
.mh-custom[data-mh-grid="1"][data-grid-rot="1"] .mhc-grid{
  animation:mhc-grid-rot calc(var(--mh-grid-rot-dur,8s) / var(--_spd)) ease-in-out infinite;
}
.mh-custom[data-mh-grid="1"][data-vp-move="1"][data-grid-rot="1"] .mhc-grid{
  animation:
    mhc-vp-drift calc(var(--mh-vp-dur,6s) / var(--_spd)) ease-in-out infinite,
    mhc-grid-rot calc(var(--mh-grid-rot-dur,8s) / var(--_spd)) ease-in-out infinite;
}
.mh-custom .mhc-plane{
  position:absolute; left:-50%; width:200%; height:58%;
  background-image:
    linear-gradient(var(--mh-neon1) var(--mh-grid-thick-px,2px), transparent var(--mh-grid-thick-px,2px)),
    linear-gradient(90deg, var(--mh-neon1) var(--mh-grid-thick-px,2px), transparent var(--mh-grid-thick-px,2px)),
    linear-gradient(color-mix(in srgb, var(--mh-neon2) 55%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--mh-accent) 40%, transparent) 1px, transparent 1px);
  background-size: var(--mh-grid-size-px,36px) var(--mh-grid-size-px,36px), var(--mh-grid-size-px,36px) var(--mh-grid-size-px,36px),
    calc(var(--mh-grid-size-px,36px)*2) calc(var(--mh-grid-size-px,36px)*2), calc(var(--mh-grid-size-px,36px)*2) calc(var(--mh-grid-size-px,36px)*2);
  transform-origin:center top; will-change:auto;
  filter:drop-shadow(0 0 6px color-mix(in srgb, var(--mh-neon1) 55%, transparent));
  animation:none;
}
.mh-custom[data-mh-grid="1"] .mhc-plane{
  will-change:background-position, transform;
  animation:mhc-grid-scroll calc(var(--mh-grid-dur,3.2s) / var(--_spd)) linear infinite;
}
.mh-custom[data-mh-grid="1"][data-grid-rand="1"] .mhc-plane{
  animation:
    mhc-grid-scroll calc(var(--mh-grid-dur,3.2s) / var(--_spd)) linear infinite,
    mhc-grid-jitter calc(0.55s / var(--_spd)) steps(2,end) infinite;
}
.mh-custom .mhc-floor{
  bottom:-12%; top:auto;
  transform:rotateX(var(--mh-grid-depth-deg,64deg));
  mask-image:linear-gradient(to top, rgba(0,0,0,.95), transparent 88%);
  -webkit-mask-image:linear-gradient(to top, rgba(0,0,0,.95), transparent 88%);
}
.mh-custom .mhc-ceil{
  top:-12%;
  transform:rotateX(calc(var(--mh-grid-depth-deg,64deg) * -1));
  animation-direction:reverse;
  mask-image:linear-gradient(to bottom, rgba(0,0,0,.85), transparent 88%);
  -webkit-mask-image:linear-gradient(to bottom, rgba(0,0,0,.85), transparent 88%);
}
.mh-custom .mhc-horizon{
  position:absolute; left:0; right:0; height:3px;
  top:var(--mh-vp-y,47%);
  background:linear-gradient(90deg, transparent, var(--mh-neon2), var(--mh-neon1), var(--mh-accent), var(--mh-neon2), transparent);
  box-shadow:0 0 28px var(--mh-neon1), 0 0 48px var(--mh-neon2);
  opacity:0;
  transform:translateX(calc((var(--mh-vp-x,50%) - 50%) * 0.35));
  animation:none;
}
.mh-custom[data-mh-horizon="1"] .mhc-horizon{
  opacity:calc(var(--mh-horizon-on,1) * var(--mh-intensity,1));
  animation:mhc-horizon-pulse calc(1.6s / var(--_spd)) ease-in-out infinite;
}
.mh-custom[data-mh-horizon="1"][data-vp-move="1"] .mhc-horizon{
  animation:
    mhc-horizon-pulse calc(1.6s / var(--_spd)) ease-in-out infinite,
    mhc-horizon-wander calc(var(--mh-vp-dur,6s) / var(--_spd)) ease-in-out infinite;
}
@keyframes mhc-grid-scroll{ to{ background-position:0 var(--mh-grid-size-px,36px), var(--mh-grid-size-px,36px) 0, 0 calc(var(--mh-grid-size-px,36px)*2), calc(var(--mh-grid-size-px,36px)*2) 0; } }
/* brightness only — never override opacity (that broke layer gates) */
@keyframes mhc-horizon-pulse{ 0%,100%{ filter:brightness(.85); } 50%{ filter:brightness(1.4); } }
@keyframes mhc-vp-drift{
  0%,100%{ perspective-origin:var(--mh-vp-x,50%) var(--mh-vp-y,47%); }
  25%{ perspective-origin:calc(var(--mh-vp-x,50%) + var(--mh-vp-amp,8%)) calc(var(--mh-vp-y,47%) - var(--mh-vp-amp,8%) * .55); }
  50%{ perspective-origin:calc(var(--mh-vp-x,50%) - var(--mh-vp-amp,8%) * .35) calc(var(--mh-vp-y,47%) + var(--mh-vp-amp,8%) * .4); }
  75%{ perspective-origin:calc(var(--mh-vp-x,50%) + var(--mh-vp-amp,8%) * .5) calc(var(--mh-vp-y,47%) + var(--mh-vp-amp,8%) * .25); }
}
@keyframes mhc-grid-rot{
  0%,100%{ transform:rotateZ(var(--mh-grid-rot-min-deg,-18deg)); }
  50%{ transform:rotateZ(var(--mh-grid-rot-max-deg,18deg)); }
}
@keyframes mhc-horizon-wander{
  0%,100%{ transform:translateX(calc((var(--mh-vp-x,50%) - 50%) * 0.35)); }
  25%{ transform:translateX(calc((var(--mh-vp-x,50%) - 50%) * 0.35 + var(--mh-vp-amp,8%) * .8)); }
  50%{ transform:translateX(calc((var(--mh-vp-x,50%) - 50%) * 0.35 - var(--mh-vp-amp,8%) * .55)); }
  75%{ transform:translateX(calc((var(--mh-vp-x,50%) - 50%) * 0.35 + var(--mh-vp-amp,8%) * .35)); }
}
@keyframes mhc-grid-jitter{
  0%,100%{ translate:0 0; }
  50%{ translate:calc(var(--mh-grid-rand,0) * 2px) calc(var(--mh-grid-rand,0) * -1.5px); }
}

.mh-custom .mhc-scan{ opacity:calc(var(--mh-scan-on,1) * var(--mh-intensity,1)); }
.mh-custom .mhc-scanlines{
  position:absolute; inset:0;
  background:repeating-linear-gradient(0deg,
    rgba(0,0,0,var(--mh-scan-opacity,.55)) 0 1px,
    transparent 1px var(--mh-scan-gap-px,3px),
    color-mix(in srgb, var(--mh-neon1) 18%, transparent) var(--mh-scan-gap-px,3px) calc(var(--mh-scan-gap-px,3px) + 1px));
  animation:none;
}
.mh-custom[data-mh-scan="1"] .mhc-scanlines{
  animation:mhc-scan-drift calc(var(--mh-scan-dur,1.4s) / var(--_spd)) linear infinite;
}
.mh-custom .mhc-beam{
  position:absolute; left:0; right:0; height:18%;
  background:linear-gradient(180deg, transparent, color-mix(in srgb, var(--mh-neon1) 35%, transparent), transparent);
  opacity:calc(var(--mh-beam,.55) * var(--mh-scan-on,1));
  animation:none;
}
.mh-custom[data-mh-scan="1"] .mhc-beam{
  animation:mhc-beam calc(1.8s / var(--_spd)) linear infinite;
}
.mh-custom .mhc-flicker{
  position:absolute; inset:0; background:rgba(255,255,255,.04);
  opacity:0;
  animation:none;
}
.mh-custom[data-mh-scan="1"] .mhc-flicker{
  opacity:calc(var(--mh-flicker,.35) * var(--mh-scan-on,1));
  animation:mhc-flicker calc(0.9s / var(--_spd)) steps(3,end) infinite;
}
@keyframes mhc-scan-drift{ to{ background-position:0 5px; } }
@keyframes mhc-beam{ 0%{ top:-20%; } 100%{ top:110%; } }
@keyframes mhc-flicker{ 0%,100%{ opacity:0; } 30%{ opacity:calc(var(--mh-flicker,.35)*.8); } 60%{ opacity:0; } 85%{ opacity:calc(var(--mh-flicker,.35)); } }

/* Angle is a registered custom property so it can animate between min/max. */
@property --mh-stripe-angle-deg{
  syntax:"<angle>"; inherits:true; initial-value:-32deg;
}
.mh-custom .mhc-stripes{ opacity:calc(var(--mh-stripe-on,1) * var(--mh-stripe-opacity,.55) * var(--mh-intensity,1)); }
.mh-custom .mhc-band{
  position:absolute; inset:-40%;
  background:repeating-linear-gradient(var(--mh-stripe-angle-deg,-32deg),
    var(--mh-neon2) 0 var(--mh-stripe-thick-px,28px),
    var(--mh-accent) var(--mh-stripe-thick-px,28px) calc(var(--mh-stripe-thick-px,28px)*2),
    var(--mh-neon1) calc(var(--mh-stripe-thick-px,28px)*2) calc(var(--mh-stripe-thick-px,28px)*3));
  mix-blend-mode:screen;
  animation:none;
}
.mh-custom[data-mh-stripe="1"] .mhc-band{
  animation:mhc-stripe-march calc(var(--mh-stripe-dur,4s) / var(--_spd)) linear infinite;
}
.mh-custom[data-mh-stripe="1"][data-stripe-angle="1"] .mhc-stripes{
  animation:mhc-stripe-angle calc(var(--mh-stripe-angle-dur,8s) / var(--_spd)) ease-in-out infinite;
}
.mh-custom[data-mh-stripe="1"] .mhc-b2{ opacity:.65; animation-direction:reverse; animation-duration:calc(var(--mh-stripe-dur,4s) * .7 / var(--_spd)); filter:hue-rotate(40deg); }
@keyframes mhc-stripe-march{ to{ transform:translate3d(120px, 80px, 0); } }
@keyframes mhc-stripe-angle{
  0%,100%{ --mh-stripe-angle-deg:var(--mh-stripe-angle-min-deg,-48deg); }
  50%{ --mh-stripe-angle-deg:var(--mh-stripe-angle-max-deg,-16deg); }
}

.mh-custom .mhc-glitch{ opacity:calc(var(--mh-glitch-on,1) * var(--mh-intensity,1)); }
.mh-custom .mhc-slice{
  position:absolute; left:-5%; right:-5%; height:8%;
  background:linear-gradient(90deg, transparent, color-mix(in srgb, var(--mh-neon1) 55%, transparent), color-mix(in srgb, var(--mh-neon2) 55%, transparent), transparent);
  mix-blend-mode:screen; opacity:calc(var(--mh-tear,1) * .85);
  animation:none;
}
.mh-custom[data-mh-glitch="1"] .mhc-slice{
  animation:mhc-tear calc(var(--mh-glitch-dur,2.2s) / var(--_spd) / max(var(--mh-stutter,1),.2)) steps(1) infinite;
}
.mh-custom .mhc-s1{ top:12%; }
.mh-custom .mhc-s2{ top:34%; height:7%; animation-delay:.4s; }
.mh-custom .mhc-s3{ top:55%; height:10%; animation-delay:.9s; opacity:calc(var(--mh-tear,1) * var(--mh-shape-count,1) * .7); }
.mh-custom .mhc-s4{ top:78%; height:8%; animation-delay:1.3s; opacity:calc(var(--mh-tear,1) * var(--mh-shape-count,1) * .6); }
.mh-custom .mhc-noise{
  position:absolute; inset:0; opacity:0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.06) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 1px, transparent 1px 2px);
  animation:none;
}
.mh-custom[data-mh-glitch="1"] .mhc-noise{
  opacity:var(--mh-noise,.2);
  animation:mhc-noise calc(.45s / var(--_spd)) steps(4) infinite;
}
.mh-custom .mhc-rgb{
  position:absolute; inset:0;
  box-shadow: inset calc(var(--mh-rgb-px,6px) * -1) 0 0 color-mix(in srgb, var(--mh-neon2) 35%, transparent),
              inset var(--mh-rgb-px,6px) 0 0 color-mix(in srgb, var(--mh-neon1) 35%, transparent);
  opacity:0;
  animation:none;
}
.mh-custom[data-mh-glitch="1"] .mhc-rgb{
  opacity:calc(var(--mh-glitch-on,1) * .85);
  animation:mhc-rgb calc(1.1s / var(--_spd)) steps(3) infinite;
}
@keyframes mhc-tear{
  0%,40%,100%{ transform:translateX(0); opacity:0; }
  42%{ transform:translateX(calc(var(--mh-rgb-px,6px) * 2)); opacity:.9; }
  48%{ transform:translateX(calc(var(--mh-rgb-px,6px) * -1.5)); opacity:.7; }
  55%{ transform:translateX(0); opacity:0; }
}
@keyframes mhc-noise{ to{ background-position:12px 0, 0 8px; } }
@keyframes mhc-rgb{
  0%,100%{ transform:translateX(0); }
  33%{ transform:translateX(calc(var(--mh-rgb-px,6px) * .4)); }
  66%{ transform:translateX(calc(var(--mh-rgb-px,6px) * -.4)); }
}

.mh-custom .mhc-city{ opacity:calc(var(--mh-city-on,1) * var(--mh-city-opacity,.85) * var(--mh-intensity,1)); }
.mh-custom .mhc-skyline{
  position:absolute; left:0; right:0; bottom:0; height:42%;
  background-image:
    linear-gradient(var(--mh-neon1) 1px, transparent 1px),
    linear-gradient(90deg, var(--mh-neon1) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--mh-neon2) 50%, transparent) 1px, transparent 1px);
  background-size:22px 22px, 22px 22px, 44px 44px;
  mask-image:linear-gradient(to top, #000 20%, transparent);
  -webkit-mask-image:linear-gradient(to top, #000 20%, transparent);
  animation:none;
}
.mh-custom[data-mh-city="1"] .mhc-skyline{
  animation:mhc-city-pulse calc(var(--mh-city-pulse,2.2s) / var(--_spd)) ease-in-out infinite;
}
.mh-custom .mhc-poly{
  position:absolute; border:2px solid var(--mh-neon1);
  box-shadow:0 0 14px var(--mh-neon1); background:color-mix(in srgb, var(--mh-neon1) 10%, transparent);
  width:calc(48px * var(--mh-shape-size,1)); height:calc(48px * var(--mh-shape-size,1));
  animation:none;
  opacity:0;
}
.mh-custom[data-mh-city="1"] .mhc-poly{
  animation:mhc-float calc(4.5s / var(--_spd)) ease-in-out infinite;
  opacity:calc(var(--mh-city-on,1) * var(--mh-shape-count,1));
}
.mh-custom .mhc-p1{ top:12%; left:10%; border-color:var(--mh-neon1); }
.mh-custom .mhc-p2{ top:18%; right:14%; border-color:var(--mh-neon2); border-radius:50%; animation-delay:-1s; }
.mh-custom[data-mh-city="1"] .mhc-p3{ bottom:48%; left:40%; border-color:var(--mh-accent); border-radius:4px; animation-delay:-.5s; opacity:calc(var(--mh-city-on,1) * min(1, var(--mh-shape-count,1))); }
.mh-custom[data-mh-city="1"] .mhc-p4{ top:40%; left:22%; border-color:var(--mh-neon2); animation-delay:-1.8s; opacity:calc(var(--mh-city-on,1) * max(0, var(--mh-shape-count,1) - .35)); }
@keyframes mhc-city-pulse{ 0%,100%{ filter:brightness(1); } 50%{ filter:brightness(1.35); } }
@keyframes mhc-float{ 0%,100%{ transform:translateY(0) rotate(12deg) scale(1);} 50%{ transform:translateY(-24px) rotate(28deg) scale(1.08);} }

.mh-custom .mhc-vignette{
  position:absolute; inset:0; pointer-events:none; opacity:0;
  background:radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,var(--mh-vignette,.5)) 100%);
}
.mh-custom[data-mh-vignette="1"] .mhc-vignette{
  opacity:calc(var(--mh-vignette-on,1));
}
.mh-custom .mhc-chroma{
  position:absolute; inset:0; pointer-events:none; opacity:0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--mh-neon2) 25%, transparent), transparent 40%, transparent 60%, color-mix(in srgb, var(--mh-neon1) 25%, transparent));
  mix-blend-mode:screen;
}
.mh-custom[data-mh-chroma="1"] .mhc-chroma{
  opacity:calc(var(--mh-chroma-on,1) * var(--mh-chroma,0));
}
html[data-mh-freeze="1"] .mh-custom *,
html.bg-paused .mh-custom *{ animation-play-state:paused !important; }
.mh-custom[data-mh-all-off="1"] *{ animation:none !important; }

/* ---------- Dynamic gradients ---------- */
.dg-aurora .dg-blob,
.dg-ember .dg-blob,
.dg-ocean .dg-blob,
.dg-noir .dg-blob,
.dg-plasma .dg-blob{
  position:absolute; width:70%; height:70%; border-radius:50%; filter:blur(48px);
  opacity:.7; mix-blend-mode:screen;
}
.dg-aurora .dg-a1{ top:-15%; left:-10%; background:#a78bfa; animation:dg-blob-drift 11s ease-in-out infinite; }
.dg-aurora .dg-a2{ top:20%; right:-20%; background:#38bdf8; animation:dg-blob-drift 14s ease-in-out infinite reverse; }
.dg-aurora .dg-a3{ bottom:-20%; left:20%; background:#f472b6; animation:dg-blob-drift 12s ease-in-out -3s infinite; }
.dg-aurora .dg-base{ position:absolute; inset:0; background:linear-gradient(160deg,#0f172a,#1e1b4b 50%,#312e81); }
@keyframes dg-blob-drift{
  0%,100%{ transform:translate(0,0) scale(1); }
  33%{ transform:translate(12%,8%) scale(1.12); }
  66%{ transform:translate(-8%,-6%) scale(.92); }
}

.dg-mesh .dg-m{
  position:absolute; inset:-20%;
  background:
    radial-gradient(at 20% 30%, #fb7185 0, transparent 45%),
    radial-gradient(at 80% 20%, #38bdf8 0, transparent 40%),
    radial-gradient(at 50% 80%, #a3e635 0, transparent 42%),
    radial-gradient(at 10% 80%, #c084fc 0, transparent 38%),
    #fef3c7;
  background-size:140% 140%;
  animation:dg-mesh-move 16s ease-in-out infinite;
}
@keyframes dg-mesh-move{
  0%,100%{ background-position:0% 0%, 100% 0%, 50% 100%, 0% 100%, 0 0; }
  50%{ background-position:40% 20%, 60% 40%, 30% 60%, 20% 50%, 0 0; }
}

.dg-sunset .dg-s{
  position:absolute; inset:0;
  background:linear-gradient(120deg,#ffe600,#ff6b35,#ff2d95,#7c3aed,#00e5ff,#ffe600);
  background-size:300% 300%;
  animation:dg-flow 10s linear infinite;
}
@keyframes dg-flow{ to{ background-position:100% 50%; } }

.dg-conic .dg-c{
  position:absolute; left:50%; top:50%; width:160cqmax; height:160cqmax;
  margin:-80cqmax 0 0 -80cqmax;
  background:conic-gradient(from 0deg,#ff2d95,#ffe600,#00e5ff,#a3e635,#c026ff,#ff2d95);
  animation:dg-spin 18s linear infinite;
}
.dg-conic .dg-cveil{
  position:absolute; inset:0;
  background:radial-gradient(circle at center, transparent 30%, rgba(255,255,255,.35) 100%);
}
@keyframes dg-spin{ to{ transform:rotate(360deg); } }

.dg-wave .dg-w{
  position:absolute; inset:-30% -10%;
  background:
    linear-gradient(190deg, rgba(56,189,248,.55), transparent 50%),
    linear-gradient(10deg, rgba(167,139,250,.5), transparent 55%),
    linear-gradient(180deg,#e0f2fe,#ddd6fe 50%,#fce7f3);
  background-size:100% 200%, 100% 200%, auto;
  animation:dg-wave-flow 9s ease-in-out infinite;
}
@keyframes dg-wave-flow{
  0%,100%{ background-position:0 0, 0 100%, 0 0; transform:translateY(0); }
  50%{ background-position:0 40%, 0 40%, 0 0; transform:translateY(-3%); }
}

.dg-candy .dg-band{
  position:absolute; inset:-40%;
  background:repeating-linear-gradient(
    -32deg,
    #ff2d95 0 28px,
    #ffe600 28px 56px,
    #00e5ff 56px 84px,
    #a3e635 84px 112px,
    #c026ff 112px 140px
  );
  animation:dg-candy-march 8s linear infinite;
  opacity:.85;
}
.dg-candy .dg-wash{
  position:absolute; inset:0;
  background:radial-gradient(ellipse at 50% 30%, rgba(255,255,255,.35), transparent 60%);
}
@keyframes dg-candy-march{ to{ transform:translate3d(70px, 50px, 0); } }

.dg-ember .dg-e-base{ position:absolute; inset:0; background:linear-gradient(160deg,#1c0a00,#7c2d12 45%,#451a03); }
.dg-ember .dg-e1{ top:-10%; left:10%; width:75%; height:75%; background:#f97316; animation:dg-blob-drift 9s ease-in-out infinite; }
.dg-ember .dg-e2{ top:30%; right:-15%; width:65%; height:65%; background:#ef4444; animation:dg-blob-drift 12s ease-in-out infinite reverse; }
.dg-ember .dg-e3{ bottom:-15%; left:30%; width:80%; height:60%; background:#fbbf24; animation:dg-blob-drift 10s ease-in-out -2s infinite; opacity:.55; mix-blend-mode:color-dodge; }

.dg-ocean .dg-oc-base{ position:absolute; inset:0; background:linear-gradient(180deg,#0c4a6e,#082f49 50%,#020617); }
.dg-ocean .dg-oc1{ top:10%; left:-15%; width:80%; height:70%; background:#22d3ee; animation:dg-blob-drift 13s ease-in-out infinite; }
.dg-ocean .dg-oc2{ bottom:-10%; right:-10%; width:70%; height:75%; background:#0369a1; animation:dg-blob-drift 11s ease-in-out infinite reverse; }

.dg-prism .dg-pr{
  position:absolute; inset:-20%;
  background:conic-gradient(from 120deg, #f472b6, #a78bfa, #38bdf8, #34d399, #fbbf24, #f472b6);
  animation:dg-spin 22s linear infinite;
  filter:blur(28px); opacity:.85;
}
.dg-prism .dg-pr-veil{
  position:absolute; inset:0;
  background:radial-gradient(circle at 40% 40%, rgba(255,255,255,.45), transparent 55%);
}

.dg-noir .dg-n-base{ position:absolute; inset:0; background:radial-gradient(ellipse at 50% 40%, #1f2937, #0a0a0b 70%); }
.dg-noir .dg-n1{ top:5%; left:20%; background:#9ca3af; filter:blur(56px); opacity:.35; animation:dg-blob-drift 14s ease-in-out infinite; }
.dg-noir .dg-n2{ bottom:0; right:10%; background:#6b7280; filter:blur(64px); opacity:.3; animation:dg-blob-drift 16s ease-in-out infinite reverse; }

.dg-plasma .dg-pl-base{ position:absolute; inset:0; background:linear-gradient(145deg,#1e1b4b,#4c1d95 50%,#0f172a); }
.dg-plasma .dg-pl1{ top:-20%; left:0; background:#e879f9; animation:dg-blob-drift 8s ease-in-out infinite; }
.dg-plasma .dg-pl2{ top:20%; right:-20%; background:#38bdf8; animation:dg-blob-drift 10s ease-in-out infinite reverse; }
.dg-plasma .dg-pl3{ bottom:-25%; left:25%; background:#c026ff; animation:dg-blob-drift 9s ease-in-out -1s infinite; }

.dg-dawn .dg-dn{
  position:absolute; inset:0;
  background:linear-gradient(180deg,#fda4af 0%,#fdba74 28%,#fef3c7 55%,#e0f2fe 100%);
  background-size:100% 200%;
  animation:dg-wave-flow 14s ease-in-out infinite;
}

/* Pause CSS animations when tab hidden or reduced-motion */
html.bg-paused #bg-dynamic *,
html.bg-paused .bg-presets-dynamic .mh-thumb *,
html.bg-paused .bg-presets-journey .mh-thumb *,
html.bg-paused .bg-presets-dgrad .mh-thumb *,
html.bg-paused .bg-presets-game .mh-thumb *,
html.bg-paused body,
html.bg-paused body::before{
  animation-play-state:paused !important;
}
@media (prefers-reduced-motion: reduce){
  #bg-dynamic *,
  .bg-presets-dynamic .mh-thumb *,
  .bg-presets-journey .mh-thumb *,
  .bg-presets-dgrad .mh-thumb *,
  .bg-presets-game .mh-thumb *,
  html[data-bg-anim="1"] body,
  html.iphone[data-bg-anim="1"] body::before{
    animation:none !important;
  }
  .mh-glitch .mh-slice{ opacity:.45; }
  .mh-crt .mh-flicker{ opacity:.2; }
  .mh-crt .mh-static{ opacity:.4; }
  .dg-conic .dg-c{ transform:rotate(40deg); }
}

/* ---------- setup ---------- */
.setupwrap{max-width:560px; margin:0 auto; padding:26px 18px 40px;}
#local-lock-err{color:var(--danger);}
.setupwrap h1{font-size:24px; margin:6px 0 4px;}
.steps{background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:6px 16px; margin:14px 0;}
.steps li{margin:10px 0; font-size:15.5px;}
.privacy{background:var(--warn-soft); border:1px solid #ecd9ac; border-radius:12px; padding:10px 14px; font-size:13.5px; color:#6d4f14; margin-top:12px;}
.quickpick{display:flex; gap:8px; margin:8px 0;}
.quickpick button{flex:1;}
.taxgroup{margin-bottom:6px;}
.taxgroup .gtotal{font-weight:800; font-size:16px; padding-top:10px;}
.badge{display:inline-block; font-size:11px; font-weight:700; border-radius:99px; padding:2px 9px; margin-left:6px; vertical-align:1px;}
.badge.in{background:var(--accent-soft); color:var(--accent);}
.badge.ex{background:var(--danger-soft); color:var(--danger);}
/* ---------- document scanner (bill + receipt OCR) ---------- */
.filepick{display:none;}
.scannote{font-size:12px; color:var(--accent); font-weight:600; margin:3px 0 0;}
.scannote.dim{color:var(--muted); font-weight:400;}
.scanprog{display:flex; align-items:center; gap:10px; padding:18px 4px; font-size:15.5px; font-weight:600;}
.scanthumb-img{width:100%; border-radius:12px; border:1px solid var(--border); margin:6px 0 4px; cursor:pointer;}
.scanattach{display:flex; align-items:center; gap:10px; margin:2px 0 8px;}
.scanattach img{width:52px; height:52px; object-fit:cover; border-radius:8px; border:1px solid var(--border); cursor:pointer; flex:none;}
.scanbadge{font-size:13px; flex:none;}
.billbadge{font-size:13px; flex:none; cursor:pointer;}
.splitbadge{font-size:10.5px; font-weight:700; color:var(--blue); background:var(--blue-soft);
  border-radius:8px; padding:2px 7px; flex:none; letter-spacing:.02em;}
/* Split-parts breakdown shown on a split transaction's detail sheet. */
.splitparts{margin:2px 0 12px; padding:10px 12px; background:var(--blue-soft);
  border:1px solid var(--border); border-radius:10px; font-size:13.5px;}
.splitparts-h{font-weight:700; margin-bottom:6px;}
.splitparts-r{display:flex; justify-content:space-between; gap:8px; padding:2px 0;}
.splitparts-r.rep-click{border-radius:6px; margin:0 -6px; padding:2px 6px;}
.splitparts-r.rep-click:hover{ background:rgba(140,140,140,.12); }
.splitparts-r.rep-click:active{ background:rgba(140,140,140,.22); }
.splitparts-a{font-variant-numeric:tabular-nums; font-weight:600; flex:none;}
.splitparts-r.thisone .splitparts-a{color:var(--blue);}

/* ---- coach marks (one-time hint bubbles) ---- */
#coach-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:9000}
.coach-bubble{position:fixed;z-index:9001;max-width:300px;background:var(--card,#fff);color:var(--text,#111);border-radius:12px;padding:14px 14px 12px;box-shadow:0 8px 30px rgba(0,0,0,.35);border:1px solid var(--border,#ddd)}
.coach-title{font-weight:700;font-size:15px;margin-bottom:6px}
.coach-text{font-size:13.5px;line-height:1.45;margin-bottom:10px}
.coach-actions{display:flex;gap:10px;align-items:center;justify-content:flex-end;padding-top:2px}
#coach-dot{position:fixed;z-index:9001;width:18px;height:18px;border-radius:50%;background:var(--accent,#007aff);box-shadow:0 0 0 6px rgba(0,122,255,.25);animation:coach-pulse 1.2s ease-in-out infinite;pointer-events:none}
@keyframes coach-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.25)}}

/* ---- Collapsed home chart cards ---- */
.dashchart-head{display:flex;align-items:center;gap:12px;cursor:pointer;border-radius:10px}
.dashchart-head:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.dashchart-thumb{flex:none;width:56px;height:40px;border-radius:8px;background:var(--bg);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;overflow:hidden}
.dashchart-titles{flex:1;min-width:0}
.dashchart-title{display:block;font-size:16px;font-weight:700}
.dashchart-blurb{display:block;font-size:13px;color:var(--muted);line-height:1.45;margin-top:3px}
.dashchart-chev{flex:none;font-size:18px;color:var(--muted);padding:4px}

/* ---- welcome cards (Apple What’s New sheet) ----
   Mac: centered card, title leading, Continue trailing.
   iPad: same sheet, larger.
   iPhone: bottom sheet, grabber, full-width Continue. */
#welcome-scrim{
  position:fixed; inset:0; z-index:10020;
  display:flex; align-items:center; justify-content:center;
  padding:28px 20px;
  background:rgba(0,0,0,.38);
}
.welcome-card{
  width:440px;
  height:600px;
  max-width:100%;
  max-height:min(600px, calc(100vh - 48px));
  display:flex; flex-direction:column;
  box-sizing:border-box;
  background:#fff; color:#1d1d1f;
  border-radius:20px;
  padding:40px 36px 28px;
  border:1px solid rgba(0,0,0,.08);
  box-shadow:0 24px 70px rgba(0,0,0,.28);
  text-align:left;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display",system-ui,sans-serif;
}
[data-theme="dark"] .welcome-card{
  background:#1e1e1e; color:#fff;
  border-color:rgba(255,255,255,.1);
  box-shadow:0 28px 80px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.06);
}
.welcome-card h2{
  margin:0 0 32px;
  font-size:22px; font-weight:700; letter-spacing:-.022em; line-height:1.15;
  text-align:left;
}
.welcome-points{
  list-style:none; margin:0; padding:0;
  display:flex; flex-direction:column; gap:22px;
  overflow:auto;
}
.welcome-points li{
  display:grid; grid-template-columns:28px 1fr; column-gap:16px; align-items:start;
}
.welcome-mark{
  width:28px; height:28px; margin-top:1px;
  display:flex; align-items:center; justify-content:center;
  color:var(--accent);
}
.welcome-mark svg{width:26px; height:26px; display:block;}
.welcome-points strong{
  display:block; font-size:15px; font-weight:650; letter-spacing:-.01em; line-height:1.25;
}
.welcome-points p{
  margin:2px 0 0; color:#6e6e73; font-size:13px; line-height:1.35; font-weight:400;
}
[data-theme="dark"] .welcome-points p{color:#98989d;}
.welcome-actions{
  margin-top:auto; padding-top:20px;
  display:flex; justify-content:flex-end;
}
.welcome-go{
  appearance:none; -webkit-appearance:none;
  width:auto; min-width:108px; height:36px;
  padding:0 20px; border:none; border-radius:999px;
  background:var(--accent); color:var(--on-accent, #fff);
  font:600 15px/1 -apple-system,BlinkMacSystemFont,"SF Pro Text",system-ui,sans-serif;
  cursor:pointer;
}
.welcome-go:active{opacity:.88;}
.welcome-go:focus{outline:none;}
.welcome-go:focus-visible{box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent);}
.welcome-grabber{display:none;}
/* iPad: same Mac sheet, more room and a larger Continue. */
.welcome-card.is-pad{
  width:620px; height:720px;
  max-height:min(720px, calc(100vh - 64px));
  border-radius:26px;
  padding:48px 44px 36px;
}
.welcome-card.is-pad h2{font-size:28px; margin-bottom:40px;}
.welcome-card.is-pad .welcome-points{gap:28px;}
.welcome-card.is-pad .welcome-points li{grid-template-columns:34px 1fr; column-gap:18px;}
.welcome-card.is-pad .welcome-mark{width:34px; height:34px;}
.welcome-card.is-pad .welcome-mark svg{width:30px; height:30px;}
.welcome-card.is-pad .welcome-points strong{font-size:17px;}
.welcome-card.is-pad .welcome-points p{font-size:15px;}
.welcome-card.is-pad .welcome-go{min-width:132px; height:44px; padding:0 26px; font-size:17px;}
/* iPhone: page sheet from the bottom, Continue across the width. */
#welcome-scrim.is-phone{
  align-items:flex-end; justify-content:center;
  padding:0 12px 12px;
}
.welcome-card.is-phone{
  width:100%; height:min(88dvh, 760px);
  max-height:88dvh;
  border-radius:28px;
  padding:10px 22px calc(16px + env(safe-area-inset-bottom));
}
.welcome-card.is-phone .welcome-grabber{
  display:block; width:36px; height:5px; border-radius:99px;
  margin:6px auto 22px; flex:none;
  background:rgba(60,60,67,.3);
}
[data-theme="dark"] .welcome-card.is-phone .welcome-grabber{background:rgba(255,255,255,.28);}
.welcome-card.is-phone h2{font-size:28px; margin-bottom:28px;}
.welcome-card.is-phone .welcome-points{gap:26px;}
.welcome-card.is-phone .welcome-points li{grid-template-columns:32px 1fr; column-gap:14px;}
.welcome-card.is-phone .welcome-mark{width:32px; height:32px;}
.welcome-card.is-phone .welcome-mark svg{width:28px; height:28px;}
.welcome-card.is-phone .welcome-points strong{font-size:17px;}
.welcome-card.is-phone .welcome-points p{font-size:15px; line-height:1.35;}
.welcome-card.is-phone .welcome-actions{justify-content:stretch;}
.welcome-card.is-phone .welcome-go{width:100%; height:50px; font-size:17px;}
/* A squeezed desktop window uses the phone sheet so it still fits. */
@media (max-width:560px){
  #welcome-scrim.is-mac{align-items:flex-end; padding:0 12px 12px;}
  .welcome-card.is-mac{
    width:100%; height:min(88dvh, 760px); max-height:88dvh;
    border-radius:28px;
    padding:10px 22px calc(16px + env(safe-area-inset-bottom));
  }
  .welcome-card.is-mac .welcome-grabber{
    display:block; width:36px; height:5px; border-radius:99px;
    margin:6px auto 22px; flex:none;
    background:rgba(60,60,67,.3);
  }
  [data-theme="dark"] .welcome-card.is-mac .welcome-grabber{background:rgba(255,255,255,.28);}
  .welcome-card.is-mac h2{font-size:28px; margin-bottom:28px;}
  .welcome-card.is-mac .welcome-points strong{font-size:17px;}
  .welcome-card.is-mac .welcome-points p{font-size:15px;}
  .welcome-card.is-mac .welcome-actions{justify-content:stretch;}
  .welcome-card.is-mac .welcome-go{width:100%; height:50px; font-size:17px;}
}

/* Budget cards — Jonny's layout crit (2026-11-16; Dave follow-up: stats
   open downward under the slider). The face is a grip strip + a content
   column (.bot-main): Row 1 name + state cluster (check · lock · trash,
   40-44px targets), Row 2 one control row (chevron · merged slider ·
   amount input at 88px — the input IS the readout), Row 3 (open) stats
   on an equal 1fr 1fr 1fr grid (label over value, dividers, whole cell
   taps), Row 4 the bills line. Expense stats + bills show on open cards
   only. Included cards use --fcard (no danger-soft wash); red lives in
   the over-budget This-month value. The old grid placement rules keyed
   to .bot-row children no longer match: the rows' children now live
   inside .bot-main. */
.bot-gripstrip{flex:none; width:22px;}
.bot-main{flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; padding:6px 8px 6px 0;}
.bot-r1{display:flex; align-items:center; gap:8px; min-height:42px;}
.bot-nm{flex:1; min-width:0;}
.bot-nm b{font-size:17px; line-height:1.15;}
.bot-cluster{display:flex; align-items:center; gap:6px; flex:none;}
.bot-cluster > button.btn{width:42px; height:42px; min-width:42px; min-height:42px; padding:0; flex:none; display:flex; align-items:center; justify-content:center;}
.bot-cluster .row-del{width:40px; height:40px; min-width:40px; min-height:40px;}
#bot-rows .bot-row > button.btn{align-self:center;}
#bot-rows .bot-statsrow, #ibot-table .bot-statsrow{display:grid; grid-template-columns:1fr 1fr 1fr; justify-content:stretch; align-items:stretch; gap:0;}
#bot-rows .bot-statsrow > div, #ibot-table .bot-statsrow > div{text-align:left !important;}
.bot-stat{padding:4px 10px; min-height:44px; display:flex; flex-direction:column; justify-content:center;}
.bot-stat:first-child{padding-left:0;}
.bot-stat + .bot-stat{border-left:1px solid var(--border);}
#bot-rows .bot-mrow .bot-amt, #ibot-table .bot-mrow .bot-amt{width:88px; flex:none;}
.bot-mrow .bot-amt input{width:100%; text-align:right; font-size:16px; font-variant-numeric:tabular-nums; padding-top:8px; padding-bottom:8px;}
.bot-bills{padding-left:2px;}
/* Planner card disclosure (Dave, Nov 16): same 0fr↔1fr height trick as
   Settings card collapse, so YTD/Prev/This (and expense bills) animate
   open downward under the slider without a full re-render. */
.bot-disclose{
  display:grid; grid-template-rows:0fr; min-height:0;
  transition:grid-template-rows .28s ease, margin-top .28s ease;
  /* Cancel .bot-main's column gap while collapsed so closed cards
     don't keep a phantom 6px strip under the slider. */
  margin-top:-6px;
}
.bot-disclose-inner{
  overflow:hidden; min-height:0; opacity:0;
  transition:opacity .16s ease;
  pointer-events:none;
}
.bot-row.is-open > .bot-main > .bot-disclose{grid-template-rows:1fr; margin-top:0;}
.bot-row.is-open > .bot-main > .bot-disclose > .bot-disclose-inner{
  opacity:1; pointer-events:auto;
  transition:opacity .22s ease .04s;
}
.bot-row.is-open > .bot-main > .bot-disclose > .bot-disclose-inner > .bot-detail{
  padding:2px 2px 6px 0; margin:0;
}
@media (prefers-reduced-motion: reduce){
  .bot-disclose, .bot-disclose-inner{transition:none !important;}
}
/* Professional polish (Dave, Nov 16): quiet ledger finish. Neutral
   ink for names (color reserved for state), one segmented action
   cluster instead of three floating boxes, a slimmer slider, hairline
   dividers, tabular figures throughout. */
#bot-rows .bot-row, #ibot-table .bot-row, .bot-card{
  border-radius:14px;
  box-shadow:0 1px 2px rgba(16,24,40,.05), 0 10px 28px -14px rgba(16,24,40,.22),
    inset 0 1px 0 rgba(255,255,255,.05);
}
[data-theme="dark"] #bot-rows .bot-row,
[data-theme="dark"] #ibot-table .bot-row,
[data-theme="dark"] .bot-card{
  box-shadow:0 1px 2px rgba(0,0,0,.35), 0 14px 32px -14px rgba(0,0,0,.55),
    inset 0 1px 0 rgba(255,255,255,.05);
}
#bot-rows .bot-row, #ibot-table .bot-row{margin-bottom:10px;}
.bot-main{gap:8px; padding:10px 12px 10px 2px;}
.bot-gripstrip{width:18px; background:transparent; opacity:.5;}
.bot-row:hover .bot-gripstrip{opacity:.85;}
.bot-r1{min-height:40px;}
.bot-nm b{font-size:16.5px; font-weight:650; letter-spacing:-.01em;}
.bot-nm b:hover{color:var(--accent) !important; opacity:1;}
/* Segmented action cluster */
.bot-cluster{
  gap:2px; padding:3px; border-radius:12px;
  background:rgba(127,127,127,.07);
  border:1px solid color-mix(in srgb, var(--border) 75%, transparent);
}
.bot-cluster > button.btn,
.bot-cluster .row-del{
  width:36px; height:36px; min-width:36px; min-height:36px;
  border:none; border-radius:9px; background:transparent;
  transition:background .15s ease, color .15s ease;
}
.bot-cluster .row-del{color:var(--muted);}
.bot-cluster > button.btn:hover,
.bot-cluster .row-del:hover{background:rgba(127,127,127,.13);}
.bot-cluster .row-del:hover{background:var(--danger-soft); color:var(--danger);}
.bot-cluster button:focus-visible,
.bot-mrow .bot-chev:focus-visible{outline:2px solid var(--accent); outline-offset:1px;}
/* Control row */
.bot-mrow{gap:8px;}
.bot-mrow .bot-chev{
  width:40px; height:44px; font-size:22px; border-radius:10px;
  transition:background .15s ease, color .15s ease;
}
.bot-mrow .bot-chev:hover{background:rgba(127,127,127,.12);}
.bot-mtrack{height:8px; background:color-mix(in srgb, var(--border) 80%, transparent);}
.bot-mtick{width:2px; margin-left:-1px;}
.bot-mslider input[type=range]::-webkit-slider-thumb{
  width:22px; height:22px; border:1.5px solid rgba(0,0,0,.25);
  box-shadow:0 1px 3px rgba(0,0,0,.35), 0 0 0 3px rgba(255,255,255,.06);
}
.bot-mslider input[type=range]::-moz-range-thumb{
  width:20px; height:20px; border:1.5px solid rgba(0,0,0,.25);
  box-shadow:0 1px 3px rgba(0,0,0,.35);
}
.bot-mrow .bot-amt input{
  border-radius:10px; font-size:15.5px; font-weight:650;
  letter-spacing:.01em; padding:9px 10px;
  transition:border-color .15s ease;
}
.bot-mrow .bot-amt input:focus{border-color:var(--accent); outline:none;}
/* Disclosed stats */
.bot-disclose-inner > .bot-statsrow{
  border-top:1px solid color-mix(in srgb, var(--border) 70%, transparent);
  padding-top:6px;
}
.bot-stat{border-radius:9px; padding:5px 10px; transition:background .15s ease;}
.bot-stat:hover{background:rgba(127,127,127,.07);}
.bot-stat > div:first-child{letter-spacing:.09em !important;}
.bot-stat > div:last-child{
  font-size:15px !important; font-weight:650 !important;
  font-variant-numeric:tabular-nums;
}
.bot-stat + .bot-stat{border-left-color:color-mix(in srgb, var(--border) 60%, transparent);}
/* Bills */
.bot-billsum{
  font-size:13px !important; font-weight:550; color:var(--muted);
  letter-spacing:.01em; padding-top:8px !important;
}
.bot-bill{
  padding:7px 2px; font-size:13.5px; gap:10px;
  border-top:1px solid color-mix(in srgb, var(--border) 55%, transparent);
}
.bot-bill-name{font-weight:550;}
.bot-bill-due, .bot-bill-amt{font-variant-numeric:tabular-nums;}
.bot-bill-amt{font-weight:650;}
.bot-bill-total{
  border-top:1px solid var(--border); margin-top:4px; padding-top:9px;
}
.bot-bill-total-label{
  font-size:11.5px; font-weight:650; letter-spacing:.08em;
  text-transform:uppercase; color:var(--muted);
}
.bot-bill-total-amt{font-size:15px; font-weight:750; font-variant-numeric:tabular-nums;}
/* Column headers match the quieter face */
.bot-head-face{
  font-size:11px !important; font-weight:650; letter-spacing:.07em;
  text-transform:uppercase;
}
/* Missing bill→budget categories (Dave, Nov 16): callout under the
   planner rows when upcoming bills have no budget row yet. */
.bot-missing-bills{
  margin:12px 0 4px; padding:12px; border-radius:12px;
  border:1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  background:color-mix(in srgb, var(--accent-soft) 70%, transparent);
}
.bot-missing-bills-hd{font-weight:700; font-size:14px; margin-bottom:2px;}
.bot-missing-bills-sub{font-size:12.5px; margin-bottom:8px;}
.bot-missing-bills-row{
  display:flex; align-items:center; gap:10px; padding:6px 0;
  border-top:1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.bot-missing-bills-row:first-of-type{border-top:none;}
.bot-missing-bills-cat{flex:1; min-width:0; font-weight:600;}
.bot-missing-bills-amt{font-variant-numeric:tabular-nums; font-weight:650; color:var(--muted);}
.bot-missing-bills-row .btn{flex:none; width:auto; min-width:64px;}
.bot-missing-bills-all{width:100%; margin-top:6px;}
.bot-bill-addbud{width:auto !important; padding:4px 10px !important; font-size:12.5px !important;}
/* Sticky November bar: a real seam, so cards sliding under it read as
   passing under a header (the old single soft shadow let a sliced
   card fuse with the bar and read as a stray slider row). */
#bud-stickybar{box-shadow:0 10px 24px rgba(10,20,15,.14), 0 16px 20px -10px rgba(10,20,15,.35);}

/* Import log: per-account statement-coverage strip — 12 month cells for the
   current year next to the account name (filled = statement imported). */
.cov-strip{display:inline-flex;align-items:center;gap:3px;margin-left:8px}
.cov-year{font-size:11px;color:var(--muted);margin-right:1px}
.cov-cell{width:20px;height:20px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;font-size:10.5px;font-weight:600;color:var(--muted);background:var(--accent-faint);border:1px solid var(--border);box-sizing:border-box;flex:none}
.cov-cell.got{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.cov-cell.now{box-shadow:0 0 0 2px var(--accent)}
.cov-cell.future{opacity:.38}

/* Bills: autopay pill on the bill tile's meta line. */
.autopaybadge{font-size:11px;font-weight:600;padding:1px 7px;border-radius:999px;background:var(--accent-soft);color:var(--accent);white-space:nowrap}
