  :root{
    --bg:#F1F4F9;
    --card:#FFFFFF;
    --ink:#0F172A;
    --ink-soft:#64748B;
    --line:#E2E8F0;
    --credit:#16A34A;
    --debit:#DC2626;
    --gold:#F59E0B;
    --link:#2563EB;
    --goal:#9333EA;
    --binder:#1B2A4D;
    --binder-light:#27406B;
    --shadow:0 1px 2px rgba(15,23,42,.05), 0 8px 20px rgba(15,23,42,.08);
    --shadow-sm:0 1px 2px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.08);
    --shadow-glass:0 1px 2px rgba(15,23,42,.05), 0 12px 28px rgba(15,23,42,.10);
    --shadow-fab:0 8px 20px rgba(15,23,42,.32);
    --shadow-nav:0 -4px 20px rgba(15,23,42,.06);
    /* App-wide transition standard: one duration, one easing curve, used for every screen/
       overlay/modal/banner transition instead of ad hoc per-element timing. Values match the
       search-overlay fade that was already in place and felt right - not a new invention, just
       generalized. transform/opacity only (never width/height/top/left), so this stays cheap
       on lower-end devices. */
    --anim-duration:260ms;
    --anim-ease:cubic-bezier(.16,1,.3,1);
    /* Round "category ordering + colour": every theme now draws category avatars/swatches from the
       same 36-swatch OKLCH palette (js/app.js's CAT_SWATCHES), which sits at lightness >=0.65 -
       too light for legible white text (previously every non-Black theme's .cat-badge default).
       Promoted from body[data-theme="black"]'s own block (still there, harmless duplicate of the
       same value) to a global token so catBadgeStyle() can apply it unconditionally. */
    --avatar-letter:#0B0B0B;
  }
  *{box-sizing:border-box; -webkit-tap-highlight-color:transparent; tap-highlight-color:transparent; letter-spacing:normal; word-spacing:normal; text-justify:none; text-align-last:auto;}
  /* overflow-x was hidden here, not auto - deliberately changed. Every previously-fixed
     stray-horizontal-scrollbar bug in this app's history was fixed by adding overflow-x:hidden
     to the SPECIFIC container that was overflowing (see .views, #home-activity-list/
     #home-breakdown-list, .table-scroll, .search-overlay-body - each already scoped there, each
     confirmed still present), not by relying on this root-level rule - so none of those are
     re-exposed by this change; this only ever engages for overflow that escapes every one of
     those local containers, which is exactly the failure mode being guarded against here.
     A real production report (a hardware alert-slider toggle triggering a display-cutout/inset
     recompute on a specific Android device) showed genuine CONTENT CLIPPING at the right edge -
     a toolbar icon, button text, and a link cut off mid-glyph, not just an empty strip. hidden
     discards whatever overflows past the edge outright; auto instead leaves it reachable by
     scrolling. A scrollbar appearing at all is still a real bug worth fixing at its source (see
     the env(safe-area-inset-*)/100vw fix elsewhere in this file for this specific report's
     actual root cause) - but between "recoverable via a scrollbar" and "silently unreachable,"
     unreachable is worse, and this is the backstop for whatever this class of bug turns out to
     be next time, not just this one instance of it.
     overflow-y:hidden is added explicitly alongside it, not left unset. Per the CSS Overflow
     spec, an axis left at its initial 'visible' value computes to 'auto' the moment the OTHER
     axis is anything but visible/clip - true for overflow-x:hidden before this file's history
     and still true for overflow-x:auto now, so html/body have had an IMPLICIT overflow-y:auto
     (a real, independently-scrollable second scroll container on the vertical axis, not just a
     clipping rule) for as long as overflow-x has been non-visible here, regardless of which
     round set it. That's one confirmed half of a real two-nested-scroll-container bug reported
     on iOS Safari (the other half is body's min-height:100vh below): whenever body's box is
     taller than the actually-visible viewport, that slack was independently touch-scrollable
     right here at the root, dragging the whole app shell - .topbar included - within the real
     screen instead of just being inert overflow. Only .views (see below) should ever be a real
     scroll container; this makes that explicit and load-bearing instead of an accidental side
     effect of the x-axis rule. */
  html,body{margin:0;padding:0;height:100%; overflow-x:auto; overflow-y:hidden; -webkit-text-size-adjust:100%; text-size-adjust:100%; touch-action:pan-x pan-y;}
  /* html's own background, mirroring body's --bg per theme (see applyTheme() in js/app.js,
     which now sets data-theme on <html> too, not just <body>) - a CSS variable redefined on
     body[data-theme=X] cascades to body's descendants only, never to html, since html is body's
     ANCESTOR. Without this, any element anywhere in the app that ever renders wider than the
     viewport - a native control on a specific mobile browser ignoring its flex/grid container,
     the exact class of bug this project has hit multiple times - exposes html's default
     background (transparent/white) in the gap next to position:fixed chrome (header, bottom
     nav), which is sized to the visual viewport and can't reveal what's actually overflowing.
     This can't prevent that overflow, only ensure it reads as a same-colour non-event instead of
     a stark white strip, on whichever theme happens to be active when it happens. */
  html{ background:var(--bg); }
  html[data-theme="dark"]{ background:#0B1220; }
  html[data-theme="crimson"]{ background:#1E1E27; }
  html[data-theme="black"]{ background:#000000; }
  button, a, .node, [onclick]{ touch-action:manipulation; }
  body{
    font-family:'Inter',system-ui,sans-serif;
    color:var(--ink);
    background:var(--bg);
    /* Issue 2 (round 6): tells the browser which palette its OWN native controls should render
       in - the number input's up/down spinner, a date input's calendar icon/text, a <select>'s
       dropdown panel, and scrollbars are all drawn by the browser/OS, not by this app's CSS, and
       default to assuming a light page unless told otherwise. Light IS light, so this is the
       explicit default; Dark/Crimson/Black each override it to `dark` in their own theme block
       below (light-on-dark instead of light-on-light for those same native widgets). Deliberately
       the ONLY property this round's Issue 2 touches - no positioning/overflow/safe-area rule
       anywhere is affected by it. */
    color-scheme:light;
    display:flex;
    /* 100vh is a well-documented iOS Safari trap: it resolves to the LARGEST possible viewport -
       chrome (address bar/toolbar) fully collapsed - not the currently-visible one. Since the
       toolbar is showing more often than not, body's box ends up genuinely taller than what's on
       screen, and that slack was independently scrollable (see overflow-y:hidden above) - the
       confirmed other half of the real two-nested-scroll-container bug reported on iOS. 100dvh
       (dynamic viewport height) tracks the ACTUAL current visible area live as the toolbar
       shows/hides, so it's declared second and wins in any browser that supports it; the 100vh
       line above it is the fallback for anything that doesn't (an unsupported value in a
       declaration is ignored outright, so the earlier one stands - no @supports needed). */
    min-height:100vh;
    min-height:100dvh;
    -webkit-font-smoothing:antialiased;
  }
  button{font-family:inherit; cursor:pointer;}
  input,select{font-family:inherit;}
  *:focus-visible{ outline:2px solid var(--gold); outline-offset:1px; }
  svg{display:block;}
  .mono-num{ font-family:'Inter',sans-serif; font-variant-numeric:tabular-nums; font-feature-settings:"tnum"; letter-spacing:.2px; }
  .masked-amount{ letter-spacing:4px; opacity:.82; }

  .card{ background:var(--card); border-radius:22px; box-shadow:var(--shadow); padding:22px; border:1px solid rgba(15,23,42,.04); }
  .card-glass{
    background: rgba(255,255,255,.52);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    border: 1px solid rgba(255,255,255,.65);
    box-shadow: var(--shadow-glass);
    /* Forces its own compositing layer, isolated from the rest of the page's paint order. Without
       this, some GPU/browser combinations have been seen re-using a stale backdrop-filter capture
       after a nearby layout shift (e.g. a row's height changing), which can visibly "print" unrelated
       page content that's actually elsewhere in the DOM through the blur - not a z-index/stacking
       bug in this app's own CSS, but exactly the class of rendering artifact this class of fix exists
       for on backdrop-filter elements. */
    isolation: isolate;
    transform: translateZ(0);
  }
  .grid-2x2, .card-header-row, .balance-card, .ring-card{ position:relative; z-index:1; }
  .card-label{ font-size:12px; font-weight:700; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.5px; }
  .card-header-row{ display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; gap:10px; flex-wrap:wrap; }
  .link-btn{ background:none; border:none; color:var(--link); font-size:12.5px; font-weight:700; padding:0; }
  .empty-note{ color:var(--ink-soft); font-size:13px; }
  /* Escalates the "Forgotten your PIN?" link into a bordered pill during lockout - the moment
     someone is most likely to actually need it, so it shouldn't read as just another quiet
     text link at that point. */
  #pinlock-forgot-link.prominent{
    color:var(--gold); border:1.5px solid var(--gold); border-radius:999px;
    padding:8px 16px; font-size:13px;
  }

  /* Integrity Check duplicate-entry cards: separates the flagged details from the dismiss
     action with a divider and a full-width, standard-sized button (inheriting .btn-pill's
     normal padding/font instead of a shrunk-down override), rather than a small button sitting
     flush under the text with no breathing room - previously read as cramped/unorganized. */
  .integrity-dup-card{ padding:18px 20px; }
  .integrity-dup-card + .integrity-dup-card{ margin-top:12px; }
  .integrity-dup-title{ font-weight:700; font-size:14.5px; margin-bottom:6px; }
  .integrity-dup-sub{ line-height:1.5; }
  /* Two real actions now (Keep both / Delete selected copy) instead of the one dismiss-only
     button this used to lay out full-width - each gets equal width side by side on a normal
     screen, wrapping to stack full-width on anything too narrow to fit both comfortably. */
  .integrity-dup-actions{ margin-top:16px; padding-top:14px; border-top:1px solid var(--line); }
  .integrity-dup-actions .dup-keep-btn, .integrity-dup-actions .dup-delete-btn{ flex:1 1 160px; justify-content:center; }
  .integrity-dup-copy-row:first-child{ border-top:none; padding-top:0; }

  .btn-pill{ display:inline-flex; align-items:center; gap:7px; padding:11px 18px; border-radius:999px; font-weight:600; font-size:13.5px; border:none; transition:transform .12s, box-shadow .12s, filter .12s; box-shadow:var(--shadow-sm); }
  .btn-pill:hover{ transform:translateY(-1px); filter:brightness(1.04); }
  .btn-pill:active{ transform:translateY(0) scale(.97); }
  .btn-black{ background:var(--binder); color:#FFFFFF; }
  .btn-outline{ background:#fff; color:var(--ink); border:1.5px solid var(--line); box-shadow:none; }
  .btn-outline:hover{ background:var(--bg); }
  .btn-danger{ background:var(--debit); color:#fff; }
  /* Add Debit needs a solid fill like Add Credit, using the same --debit color already shown
     on debit amounts everywhere else - not a separate class from .btn-danger though, since
     "record an expense" isn't a destructive action semantically, just happens to share the
     same color token. White text passes contrast on light theme's --debit, but NOT on Dark/
     Crimson's lighter coral tones (checked: ~2.6:1) - those two themes override the text
     color to the theme's own --bg (a guaranteed-dark color) further below, which does pass. */
  .btn-debit{ background:var(--debit); color:#fff; }
  /* Reset Everything gets its own visually distinct card (a tinted border/background, not just
     another button stacked under Backup/Restore) so its irreversibility reads clearly before
     anyone taps it, rather than looking like one more routine settings action. */
  .danger-zone{ background:rgba(220,38,38,.05); border:1.5px solid rgba(220,38,38,.22); }
  .danger-zone-label{ display:flex; align-items:center; gap:6px; font-size:12px; font-weight:700; color:var(--debit); text-transform:uppercase; letter-spacing:.5px; }
  .icon-btn-sm{ background:var(--bg); border:none; border-radius:8px; color:var(--ink-soft); padding:6px; display:flex; align-items:center; transition:background .12s, color .12s; }
  .icon-btn-sm:hover{ background:var(--line); color:var(--ink); }

  .spine{ width:232px; background:rgba(255,255,255,.78); backdrop-filter:blur(18px) saturate(160%); -webkit-backdrop-filter:blur(18px) saturate(160%); border-right:1px solid var(--line); display:flex; flex-direction:column; padding:22px 14px; flex-shrink:0; }
  .brand-row{ display:flex; align-items:center; gap:10px; padding:6px 8px 26px; }
  .brand-mark{ width:38px; height:38px; border-radius:50%; background:#fff; display:flex; align-items:center; justify-content:center; flex-shrink:0; box-shadow:var(--shadow-sm); overflow:hidden; padding:3px; }
  .brand-mark img{ width:100%; height:100%; object-fit:contain; }
  .brand-name{ font-weight:800; font-size:17px; letter-spacing:-.2px; }
  .brand-sub{ font-size:10.5px; color:var(--ink-soft); margin-top:2px; }
  .spine .tab-btn{ display:flex; align-items:center; gap:11px; padding:11px 14px; border-radius:13px; color:var(--ink-soft); font-weight:600; font-size:14px; margin-bottom:3px; background:none; border:none; text-align:left; width:100%; transition:background .12s, color .12s; }
  .spine .tab-btn:hover{ background:var(--bg); color:var(--ink); }
  .spine .tab-btn.active{ background:var(--binder); color:#FFFFFF; box-shadow:var(--shadow-sm); }
  .spine .tab-label{ flex:1; }

  /* NOT position:fixed - real-device evidence (iOS 16 Pro Max standalone) showed a fixed nav
     floating ~90pt above the true screen bottom, while .views' own bottom-reaching behavior
     (ordinary scroll, no position:fixed involved) was independently confirmed CORRECT on the same
     device - isolating the problem to position:fixed's viewport anchoring specifically, not a
     general "document shorter than the screen" bug (which would have broken .views too). No
     JS measure-and-nudge workaround could fix this either: it compares the nav's rendered rect
     against window.visualViewport, but if visualViewport itself is the (possibly-WebKit-
     miscomputed) height nav is ALREADY being positioned against, the two agree and no gap is ever
     measured, even though a real gap exists against the physical screen - confirmed directly, the
     workaround applied zero correction on the real device. Making bottom-nav an ordinary in-flow
     flex child instead (last child of body, which is flex-direction:column at this breakpoint,
     with every other body child between it and main being position:fixed and so out of flow -
     see below) sidesteps position:fixed's viewport-anchoring rules entirely: its position is now
     ordinary block/flex layout math, the same mechanism already proven correct for .views. */
  .bottom-nav{ display:none; background:rgba(255,255,255,.72); backdrop-filter:blur(20px) saturate(180%); -webkit-backdrop-filter:blur(20px) saturate(180%); border-top:1px solid rgba(15,23,42,.08); justify-content:space-around; align-items:center; padding:8px 6px calc(6px + env(safe-area-inset-bottom)); flex-shrink:0; z-index:50; box-shadow:var(--shadow-nav); }
  .bottom-nav .tab-btn{ background:none; border:none; display:flex; flex-direction:column; align-items:center; gap:3px; color:var(--ink-soft); font-size:10.5px; font-weight:600; padding:4px 6px; flex:1; }
  .bottom-nav .tab-btn.active{ color:var(--binder); }
  .bottom-nav .tab-btn.fab{ background:var(--binder); color:#FFFFFF; width:54px; height:54px; border-radius:50%; margin-top:-30px; justify-content:center; box-shadow:var(--shadow-fab); flex:0 0 auto; border:4px solid var(--bg); }
  .bottom-nav .tab-btn.fab .tab-label{ display:none; }

  main{ flex:1; display:flex; flex-direction:column; overflow:hidden; }
  /* padding-top (not the sticky `top` offset) carries the inset, matching the pattern already
     used correctly on #pinlock-overlay: this element's own box still starts at true y:0 of
     .views' scrollport, so its blurred background still extends full-bleed under the status bar/
     Dynamic Island in standalone - only the CONTENT inside is pushed down to clear it. env()
     resolves to 0 in a plain Safari tab (Safari's own chrome, not the page, occupies that space
     there) and on Android, so this is a no-op everywhere except an iOS standalone install. */
  .topbar{ position:sticky; top:0; z-index:30; margin:0 -30px; padding:calc(18px + env(safe-area-inset-top)) 30px 18px; display:flex; justify-content:space-between; align-items:center; background:rgba(241,244,249,.7); backdrop-filter:blur(18px) saturate(160%); -webkit-backdrop-filter:blur(18px) saturate(160%); border-bottom:1px solid rgba(15,23,42,.06); }
  .topbar-left{ display:flex; align-items:center; gap:10px; }
  .topbar h1{ font-size:19px; margin:0; font-weight:800; letter-spacing:-.2px; }
  .topbar-right{ display:flex; align-items:center; gap:10px; }
  .icon-circle{ width:38px; height:38px; border-radius:50%; background:rgba(255,255,255,.75); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); box-shadow:var(--shadow-sm); display:flex; align-items:center; justify-content:center; color:var(--ink); position:relative; border:1px solid rgba(255,255,255,.6); transition:transform .12s, box-shadow .12s; }
  .icon-circle:hover{ transform:translateY(-1px); box-shadow:var(--shadow); }
  .badge-dot{ position:absolute; top:-3px; right:-3px; min-width:16px; height:16px; padding:0 3px; border-radius:999px; background:var(--debit); color:#fff; font-size:9.5px; font-weight:800; display:none; align-items:center; justify-content:center; box-shadow:0 0 0 2px #fff; }

  /* --views-base-pb lets JS (setBottomSpaceReservation() in js/app.js) temporarily add extra
     bottom padding - reserving room for a bottom-docked toast/banner - without needing to know or
     hardcode this responsive base value itself; it just reads the variable and adds to it, then
     clears back to '' (falling back to this rule) once nothing needs the room any more. */
  /* -webkit-overflow-scrolling:touch gives this, the one true scroll container, native momentum
     scrolling on iOS. overscroll-behavior-y:contain stops a scroll gesture that reaches .views'
     own top/bottom from "chaining" into whatever's behind it - defense in depth alongside the
     html,body overflow-y:hidden fix above, so even if some future bug makes an ancestor tall
     enough to want to scroll again, a gesture inside .views can't drag it. */
  .views{ flex:1; overflow-y:auto; overflow-x:hidden; -webkit-overflow-scrolling:touch; overscroll-behavior-y:contain; padding:0 30px 50px; position:relative; --views-base-pb:50px; transition:padding-bottom var(--anim-duration) var(--anim-ease); }
  .view{ display:none; max-width:1100px; position:relative; padding-top:18px; }
  .view.active{ display:block; animation: viewFadeIn var(--anim-duration) var(--anim-ease); }
  @keyframes viewFadeIn{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:translateY(0); } }
  @media (prefers-reduced-motion: reduce){ .view.active{ animation:none; } }

  .grid-2x2{ display:flex; flex-direction:column; gap:16px; margin-bottom:16px; }
  /* Desktop-only: pairs Net Balance with Top Categories, and Recent Activity with Spending -
     the same two-column model Add Entry already uses, applied here instead of leaving Home as
     the mobile single-column stack simply stretched wider with a lot of unused side space. Each
     card keeps its own normal internal vertical content; only their card-level arrangement
     changes. Mobile is untouched - .grid-2x2 stays the plain stacked column it already was.
     Pairing is by comparable natural height rather than DOM order: Net Balance and Top
     Categories are both compact "snapshot" cards, while Recent Activity and Spending are both
     deeper "browse more" cards with their own path to a fuller view - the DOM order (Net
     Balance, Spending, Recent Activity, Top Categories, for mobile's stacked reading order)
     doesn't match that pairing, so the visual grid position is reassigned per-card via `order`
     rather than reordering the DOM (which would also reshuffle mobile's stack).
     align-items is left at Grid's default (stretch, i.e. not overridden here) so each row's two
     cards end up the SAME height - the taller card's natural height sets the row, the shorter
     card stretches to match. This is safe now that pairing is by comparable card type (unlike an
     earlier round, where mismatched pairs made stretching read as broken dead space): Net
     Balance/Top Categories are both fixed-size snapshots, and Recent Activity/Spending's
     breakdown list both have a capped max-height with their own internal scroll below (see
     #home-activity-list/#home-breakdown-list) so neither can grow the row unbounded as data
     accumulates over time - the row's height is always exactly one of the two cards' rendered
     height, never an arbitrary fixed number. */
  @media (min-width:781px){
    .grid-2x2{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
    .grid-2x2 .balance-card{ order:1; }
    .grid-2x2 .home-topcat-card{ order:2; }
    .grid-2x2 .home-recent-card{ order:3; }
    .grid-2x2 .ring-card{ order:4; }
    /* Recent Activity is already capped to 8 rows in JS (renderHomeActivity), but Spending's
       breakdown list (renderBreakdownList) lists every distinct category with any spending this
       period with no cap at all - genuinely unbounded as a user's category list grows over
       months. Without a ceiling here, that card (and so its whole row, once stretched to match)
       would silently start growing again exactly like the dead-space bug this pairing was
       meant to fix, just from the opposite direction. 760px sits comfortably above Recent
       Activity's current full 8-row height (~710px), so today's normal content on either card
       never trips this cap - it only engages once real growth actually exceeds it, at which
       point that card's own "View All" link is the intended way to see everything, same as
       elsewhere in the app. */
    /* overflow-x explicitly set here too (same reasoning as .search-overlay-body further down):
       leaving overflow-y:auto with no explicit overflow-x makes the browser compute the other
       axis as auto as well, so a few sub-pixels of horizontal overflow from a row's flex content
       was enough to show a permanent horizontal scrollbar track under both lists with nothing
       actually meant to scroll sideways. */
    #home-activity-list, #home-breakdown-list{
      max-height: 760px;
      overflow-y: auto;
      overflow-x: hidden;
      scrollbar-width: thin;
      scrollbar-color: var(--line) transparent;
    }
    #home-activity-list::-webkit-scrollbar, #home-breakdown-list::-webkit-scrollbar{ width:8px; }
    #home-activity-list::-webkit-scrollbar-track, #home-breakdown-list::-webkit-scrollbar-track{ background:transparent; }
    #home-activity-list::-webkit-scrollbar-thumb, #home-breakdown-list::-webkit-scrollbar-thumb{ background:var(--line); border-radius:999px; }
    #home-activity-list::-webkit-scrollbar-thumb:hover, #home-breakdown-list::-webkit-scrollbar-thumb:hover{ background:var(--ink-soft); }
  }
  /* Desktop-only (this whole section already never renders on mobile - see applyDesktopLayout()
     in js/app.js): pairs the Debts & EMIs Overview and Receivables Overview stat cards side by
     side, the same natural fit as the Insights stat-tile row above. The actual Active Debts/
     Active Receivables lists stay full-width vertical lists below, unchanged in shape. */
  .home-desktop-row{ display:flex; gap:18px; margin-top:18px; }
  .home-desktop-row > .card{ flex:1; min-width:0; }
  .balance-amount{ font-size:30px; font-weight:700; margin:6px 0 18px; }
  .balance-amount.negative{ color:var(--debit); }
  /* Shown instead of the real figure whenever it isn't confirmed-ready yet (default state on
     first paint, and re-applied for the brief window around logout) - defense in depth alongside
     the render-ordering fixes: even if some future change or device-specific timing race lets
     this repaint before the actual reveal is ready, it reads as "loading", never as a real ₹0.00
     someone could mistake for their actual balance being gone. */
  .balance-amount.skeleton{
    color:transparent; background:linear-gradient(90deg, var(--line) 25%, var(--card) 50%, var(--line) 75%);
    background-size:200% 100%; border-radius:8px; animation:skeletonShimmer 1.4s ease-in-out infinite;
  }
  @keyframes skeletonShimmer{ 0%{ background-position:200% 0; } 100%{ background-position:-200% 0; } }
  @media (prefers-reduced-motion: reduce){ .balance-amount.skeleton{ animation:none; background-position:0 0; } }
  .mono-num.negative{ color:var(--debit); }
  .progress-block{ margin-bottom:18px; }
  .progress-row{ display:flex; justify-content:space-between; font-size:12.5px; color:var(--ink-soft); font-weight:600; margin-bottom:8px; text-align:left; }
  .progress-row span{ white-space:nowrap; }
  .progress-track{ height:8px; border-radius:999px; background:var(--bg); overflow:hidden; box-shadow:inset 0 1px 2px rgba(15,23,42,.08); }
  .progress-fill{ height:100%; border-radius:999px; background:var(--binder); transition:width .3s ease; width:0%; }
  .progress-spent{ font-size:12px; color:var(--ink-soft); margin-top:8px; font-weight:600; }
  .quick-actions{ display:flex; gap:10px; }
  .quick-actions .btn-pill{ flex:1; justify-content:center; }

  .ring-period-toggle{ display:inline-flex; background:var(--bg); border-radius:999px; padding:3px; gap:2px; }
  .ring-period-btn{ background:none; border:none; padding:6px 13px; border-radius:999px; font-size:11.5px; font-weight:700; color:var(--ink-soft); }
  .ring-period-btn.active{ background:#fff; color:var(--ink); box-shadow:var(--shadow-sm); }
  .ring-card{ display:flex; flex-direction:column; align-items:center; }
  .ring-card .ring-period-toggle{ margin-top:14px; }
  .ring-wrap{ position:relative; width:fit-content; margin:6px auto; }
  .ring-center{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; pointer-events:none; }
  .ring-center-label{ font-size:11px; color:var(--ink-soft); font-weight:600; margin-bottom:4px; }
  .ring-center-amount{ font-size:19px; font-weight:700; color:var(--ink); }
  .ring-tap-hint{ text-align:center; font-size:11px; color:var(--ink-soft); margin-top:8px; }
  /* Desktop-only: Home's Spending card used to be just the donut with a lot of empty space
     beside it - Insights' own Spending Breakdown card already solves this (ring + category
     legend side by side), so this reuses that same layout here instead of inventing a new one.
     display:contents on mobile makes the wrapper invisible to layout - .ring-wrap participates
     directly in .ring-card's centered flex column exactly as if this wrapper didn't exist, so
     mobile stays pixel-identical (the breakdown list itself also stays display:none there). */
  .ring-with-breakdown{ display:contents; }
  #home-breakdown-list{ display:none; }
  @media (min-width:781px){
    .ring-with-breakdown{ display:flex; align-items:center; gap:26px; flex-wrap:wrap; width:100%; }
    #home-breakdown-list{ display:block; flex:1; min-width:230px; }
  }

  .activity-group-label{ font-size:11.5px; font-weight:700; color:var(--ink-soft); margin:14px 0 8px; text-transform:uppercase; letter-spacing:.4px; }
  .activity-group-label:first-child{ margin-top:0; }
  .activity-row{ display:flex; justify-content:space-between; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--bg); }
  .activity-row.clickable-row{ cursor:pointer; border-radius:10px; transition:background .12s; margin:0 -6px; padding:9px 6px; }
  .activity-row.clickable-row:active{ background:var(--bg); }
  .activity-row:last-child{ border-bottom:none; }
  .activity-left{ display:flex; align-items:center; gap:11px; min-width:0; flex:1 1 auto; overflow:hidden; }
  .activity-left > div{ min-width:0; flex:1 1 auto; overflow:hidden; }
  .cat-badge{ width:36px; height:36px; border-radius:50%; color:var(--avatar-letter); font-weight:700; font-size:14px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
  .activity-name{ font-size:13.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  /* Note and date are separate flex children, not one truncating string (see buildActivityRow
     in js/app.js) - the date has flex-shrink:0 and white-space:nowrap so it can never be the
     part a long note truncates into.
     CORRECTION to the original version of this fix: .activity-sub-note had no flex-basis of its
     own (defaulting to auto = its full, unwrapped text width), so on a real device narrower than
     this was tested at (360px, not the 390px this was verified against), the note's available
     space could shrink to a few stray pixels - not a readable ellipsis, an actually-broken
     render (a lone "·" separator clipped mid-glyph into what looked like a stray "["). Giving the
     note an explicit flex-basis is still not enough on its own - flex-shrink alone has no floor,
     it will crush a box to zero-and-below-readable given a narrow enough container. flex-wrap on
     the container is what actually fixes it: once the note's basis + the date's own width can no
     longer both fit, the date wraps to its own second line instead of both continuing to
     compress past readability - so at 360px the note gets a full line to ellipsis a long string
     within (materially wider than being squeezed alongside a full-width date), and the date
     ALWAYS renders in full, on whichever line it ends up on. */
  .activity-sub{ display:flex; flex-wrap:wrap; align-items:baseline; column-gap:5px; font-size:11.5px; color:var(--ink-soft); margin-top:1px; max-width:100%; min-width:0; }
  /* flex-grow was 1 here until this round - it let the note's box stretch to fill all remaining
     space in its flex container whenever the note's own text was short (most visibly the "Debit"/
     "Credit" type-label fallback for a note-less entry), dragging the "·" separator and the date
     span after it far to the right without ever triggering flex-wrap (the row's total content
     still nominally fit one line, so nothing wrapped - it just left a large invisible gap). Fixed
     at the source (flex:0 1 auto) rather than per-view: this exact defect, exact cause, and exact
     fix value were already found and proven correct once before, but scoped narrowly to Black
     theme's History rows only (see the removed body[data-theme="black"] .history-row override
     this replaces) "consistent with every round's convention of never touching Light/Dark/Crimson
     even where the bug is arguably universal" - which is exactly how the same defect went
     unnoticed in Light/Dark/Crimson's History, and separately in the category-detail popup and
     global search, for another two rounds. flex-shrink:1 is unchanged, and .activity-sub's own
     flex-wrap:wrap (unchanged) is still what actually prevents an unreadably-crushed note on a
     narrow container - auto basis only changes how much space the note claims when there IS
     enough room, never removes the wrap safety net for when there isn't. */
  .activity-sub-note{ flex:0 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .activity-sub-date{ flex-shrink:0; white-space:nowrap; }
  /* Two dates are rendered per row (see buildActivityRow in app.js), only one ever visible -
     mobile shows day+short-month, omitting the year when it's the current year (freeing ~5
     characters for the note next to it, since a real 360px device is short on room); desktop
     always shows the full day+month+year regardless of year, since space isn't the constraint
     there. -full stays last in source order so the :not(:last-child) separator rule above still
     fires correctly regardless of which sibling is the display:none one. */
  .activity-sub-date-full{ display:none; }
  @media (min-width:781px){
    .activity-sub-date-short{ display:none; }
    .activity-sub-date-full{ display:inline; }
  }
  /* Category-detail popup and global search: short/full date picked by the OVERLAY's own width,
     not the viewport's. Both sit inside a .search-overlay-inner capped at max-width:560px - on a
     genuinely narrow (mobile) viewport that cap never engages and the popup tracks the viewport
     like everything else, but on any desktop-class window it reaches its fixed ~524px content
     width regardless of how much wider the window itself is, which is exactly the "viewport says
     wide, container isn't actually" mismatch the min-width:781px rule above can't see. container-
     type:inline-size here is otherwise inert - it only takes visible effect where a @container
     rule below actually queries it. Threshold (400px) sits with real margin on both sides of what
     was measured directly: ~524px on any real desktop window (comfortably over), ~286px at a
     354px mobile viewport (comfortably under) - see the PR for both measurements. Unconditional
     reset first (not inside any query) is what makes this WIN over the plain min-width:781px rule
     above regardless of which one the browser would otherwise apply last; the @container rule
     then reinstates full/short exactly like the viewport version did, just keyed to the right
     signal. */
  #catdetail-list, #global-search-results{ container-type:inline-size; }
  #catdetail-list .activity-sub-date-short,
  #global-search-results .activity-sub-date-short{ display:inline; }
  #catdetail-list .activity-sub-date-full,
  #global-search-results .activity-sub-date-full{ display:none; }
  @container (min-width:400px){
    #catdetail-list .activity-sub-date-short,
    #global-search-results .activity-sub-date-short{ display:none; }
    #catdetail-list .activity-sub-date-full,
    #global-search-results .activity-sub-date-full{ display:inline; }
  }
  .activity-sub-note:not(:last-child)::after{ content:'·'; margin-left:5px; }
  /* History-only mobile row rebuild (see buildActivityRow's historyMode param in js/app.js).
     Real device evidence: History's per-row edit/delete icons crushed the category name into
     truncating where Home's equivalent row (no icons) didn't, same device, same data - tapping a
     row already opens the detail overlay with its own Edit/Delete, and the chevron already
     signals the row is tappable, so the icons were redundant weight exactly where room is
     scarcest. .history-sub-mobile is rendered ALONGSIDE .activity-sub, not instead of it - only
     one is ever visible per breakpoint (below), so desktop's History row - not reported as having
     any problem - keeps the exact markup/behavior every other activity row already uses, and
     every other view using buildActivityRow (Home, Add Entry's Today list, category detail,
     global search) never gets a .history-row class at all and is untouched by any of this. */
  .history-sub-mobile{ display:none; }
  @media (max-width:780px){
    .history-row .activity-sub{ display:none; }
    .history-row .history-sub-mobile{ display:block; margin-top:1px; }
    .history-row .history-sub-note{ font-size:11.5px; color:var(--ink-soft); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .history-row .history-sub-date{ font-size:11.5px; color:var(--ink-soft); margin-top:1px; white-space:nowrap; }
    .history-row .activity-actions{ display:none; }
    /* Even with the icons gone, this app's own longest real category names ("Loan Repayment
       Received", "Investment Returns") still don't fit the available width in one line at 360px -
       confirmed directly: Home's OWN row (identical badge/amount proportions, the reference this
       redesign matches) truncates the exact same string today. Rather than truncate (losing
       characters) or shrink the badge/amount column (touching shared, non-History-scoped sizing),
       let the category wrap to a second line instead - guarantees every real category renders in
       full with no partial glyph, at the cost of a taller row only for the names actually long
       enough to need it. */
    .history-row .activity-name{ white-space:normal; overflow:visible; text-overflow:clip; line-height:1.25; }
  }
  .activity-right{ display:flex; align-items:center; gap:8px; flex-shrink:0; }
  .activity-amt{ font-weight:700; font-size:13.5px; }
  .activity-amt.income{ color:var(--credit); }
  .activity-amt.expense{ color:var(--debit); }
  .activity-actions{ display:flex; gap:4px; }
  /* Persistent, always-visible cue that the row itself opens something - not just a hover/active
     background flash that only shows up mid-tap, after the user has already committed to it. */
  .activity-chevron{ display:flex; align-items:center; color:var(--ink-soft); opacity:.55; flex-shrink:0; }
  .activity-chevron svg{ width:15px; height:15px; }

  .cat-grid-2x2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
  /* min-width:0 overrides the grid default (min-width:auto), which otherwise sizes each
     column to fit its content's min-content width - on a narrow phone that's wider than the
     1fr share actually available, pushing both cells past the card's right edge. */
  .cat-grid-cell{ background:var(--bg); border-radius:16px; padding:14px; position:relative; min-width:0; }
  .cat-grid-cell.clickable-row{ cursor:pointer; transition:transform .1s; }
  .cat-grid-cell.clickable-row:active{ transform:scale(.97); }
  .cat-grid-top{ display:flex; align-items:center; gap:8px; margin-bottom:10px; }
  .cat-amt{ font-size:15px; font-weight:700; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  /* A tinted pill, not bare text jammed into the corner - gap-based layout (not
     space-between) keeps it anchored right next to the amount at any card width,
     instead of drifting off to the far edge on wide desktop cards. */
  .cat-pct{
    font-size:11px; font-weight:700; flex-shrink:0;
    padding:3px 9px; border-radius:999px; line-height:1.4;
  }
  /* Mobile card width can't fit an amount, a pill, and an icon without truncating the amount
     illegibly - dropping the pill on narrow screens (desktop keeps it) restores the amount's
     full width, back to how this looked before the pill existed. */
  @media (max-width:780px){
    .cat-pct{ display:none; }
  }
  .cat-grid-name{ font-size:12px; color:var(--ink-soft); font-weight:600; margin-bottom:10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .cat-badge.sm{ width:26px; height:26px; font-size:11px; }

  .insight-note{ background:#fff; border-radius:16px; padding:14px 18px; font-size:13.5px; margin:0 0 16px; box-shadow:var(--shadow-sm); display:none; border-left:4px solid var(--gold); }

  .breakdown-row{ display:flex; align-items:center; gap:10px; margin-bottom:11px; font-size:13px; }
  .breakdown-row .dot{ width:9px; height:9px; border-radius:50%; flex-shrink:0; }
  .breakdown-name{ width:130px; flex-shrink:0; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .breakdown-track{ flex:1; height:7px; background:var(--bg); border-radius:999px; overflow:hidden; box-shadow:inset 0 1px 2px rgba(15,23,42,.06); }
  .breakdown-fill{ height:100%; border-radius:999px; }
  .breakdown-amt{ width:95px; text-align:right; font-weight:700; flex-shrink:0; }

  .budget-grid{ display:flex; flex-direction:column; gap:12px; }
  .budget-row{ background:var(--bg); border-radius:16px; padding:14px 16px; margin-bottom:12px; }
  .budget-row:last-child{ margin-bottom:0; }
  .budget-row.clickable-row{ cursor:pointer; transition:background .12s; }
  .budget-row.clickable-row:active{ background:var(--line); }
  .budget-row-top{ display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:9px; }
  .budget-cat-left{ display:flex; align-items:center; gap:10px; }
  /* Budget Watch (Insights) specifically: force every row to the same two-line shape regardless
     of category-name length, instead of the previous behavior where only names too long to fit
     alongside the amount wrapped - a mix of one-line and two-line rows in the same list. Scoped to
     #budget-watch-list only; the Budget Set list and Wallets reuse .budget-row-top/.budget-cat-left
     for narrower single-line rows (a limit input, a delete button) that must stay untouched. */
  #budget-watch-list .budget-cat-left{ flex-basis:100%; }
  .budget-cat-name{ font-weight:700; font-size:13.5px; }
  .budget-limit-input{ display:flex; align-items:center; gap:6px; }
  .budget-limit-input input{ width:90px; padding:6px 9px; border:1.5px solid var(--line); border-radius:8px; background:#fff; font-size:16px; }
  .budget-bar-track{ height:8px; background:#fff; border-radius:999px; overflow:hidden; margin-bottom:7px; box-shadow:inset 0 1px 2px rgba(15,23,42,.06); }
  .budget-bar-fill{ height:100%; border-radius:999px; transition:width .3s ease; }
  .budget-row-meta{ font-size:11.5px; color:var(--ink-soft); font-weight:600; }
  .budget-row-meta.over{ color:var(--debit); }

  .debt-card{ background:var(--bg); border-radius:16px; padding:14px 16px; margin-bottom:12px; border-left:4px solid transparent; }
  .debt-card.clickable-row{ cursor:pointer; transition:background .12s; }
  .debt-card.clickable-row:active{ background:var(--line); }
  .debt-card.type-emi{ border-left-color:var(--link); }
  .debt-card.type-lump{ border-left-color:var(--gold); }
  .debt-card.paid-off{ opacity:.65; border-left-color:var(--credit); }
  .debt-card-top{ display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:10px; gap:8px; }
  .debt-name{ font-weight:700; font-size:14px; }
  .debt-type-badge{ font-size:11.5px; color:var(--ink-soft); font-weight:600; margin-top:2px; }
  .debt-bar-track{ height:8px; background:#fff; border-radius:999px; overflow:hidden; margin-bottom:8px; box-shadow:inset 0 1px 2px rgba(15,23,42,.06); }
  .debt-bar-fill{ height:100%; border-radius:999px; transition:width .3s ease; }
  .debt-row-meta{ font-size:11.5px; color:var(--ink-soft); font-weight:600; margin-bottom:4px; }
  .overdue-tag{ color:var(--debit); font-weight:700; }
  .paidoff-tag{ color:var(--credit); font-weight:700; }
  .log-payment-form{ margin-top:10px; background:#fff; border-radius:12px; padding:12px; }
  .log-payment-form label{ display:block; font-size:11.5px; color:var(--ink-soft); font-weight:700; margin-bottom:8px; }
  .log-payment-form input, .log-payment-form select{ width:100%; max-width:100%; min-width:0; margin-top:5px; padding:9px 10px; border:1.5px solid var(--line); border-radius:9px; font-size:16px; background:var(--bg); }

  /* Desktop-only: Insights' Outstanding Debt / Owed to You / Savings Goals cards used to stack
     full-width, one under another, for what's really just a number and a caption each - reuses
     the same 3-across tile-row idea already working for Home's Debts & EMIs Overview /
     Receivables Overview stat trios (.debt-overview-grid below), just applied to whole cards
     instead of stats within one card. display:contents on mobile keeps these as ordinary stacked
     cards exactly as before - each keeps its own inline margin-bottom for that spacing, so the
     !important below only ever fires once the grid (and its own gap) takes over on desktop. */
  .insight-stat-row{ display:contents; }
  @media (min-width:781px){
    .insight-stat-row{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; align-items:start; margin-bottom:16px; }
    .insight-stat-row .card{ margin-bottom:0 !important; }
  }

  .debt-overview-grid{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; margin-bottom:14px; }
  .debt-overview-stat{ background:var(--bg); border-radius:14px; padding:12px 8px; text-align:center; }
  .debt-overview-label{ display:block; font-size:10px; color:var(--ink-soft); font-weight:700; text-transform:uppercase; letter-spacing:.3px; margin-bottom:6px; }
  .debt-overview-amt{ font-size:14.5px; font-weight:800; }
  .debt-overview-track{ height:8px; background:var(--bg); border-radius:999px; overflow:hidden; margin-bottom:14px; box-shadow:inset 0 1px 2px rgba(15,23,42,.06); }
  .debt-overview-fill{ height:100%; background:var(--credit); border-radius:999px; transition:width .3s ease; }
  .debt-overview-subsection{ margin-bottom:10px; border-left:3px solid transparent; padding-left:10px; }
  .debt-overview-subsection[id$="-emi-section"]{ border-left-color:var(--link); }
  .debt-overview-subsection[id$="-lump-section"]{ border-left-color:var(--gold); }
  .debt-overview-subsection[id$="-emi-section"] .debt-overview-subtitle{ color:var(--link); }
  .debt-overview-subsection[id$="-lump-section"] .debt-overview-subtitle{ color:var(--gold); }
  .debt-overview-subtitle{ font-size:12px; font-weight:700; color:var(--ink-soft); margin-bottom:6px; }
  .debt-overview-row{ display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px 14px; font-size:12.5px; font-weight:600; background:var(--bg); border-radius:10px; padding:9px 12px; }

  .goal-card{ background:var(--bg); border-radius:16px; padding:14px 16px; margin-bottom:12px; border-left:4px solid var(--goal); }
  .goal-card.complete{ opacity:.65; border-left-color:var(--credit); }
  .goal-card.clickable-row{ cursor:pointer; transition:background .12s; }
  .goal-card.clickable-row:active{ background:var(--line); }
  .goal-card-top{ display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
  .goal-name{ font-weight:700; font-size:14px; }
  .goal-meta{ font-size:11.5px; color:var(--ink-soft); font-weight:600; margin-top:2px; }
  .goal-bar-track{ height:8px; background:#fff; border-radius:999px; overflow:hidden; margin:10px 0 8px; box-shadow:inset 0 1px 2px rgba(15,23,42,.06); }
  .goal-bar-fill{ height:100%; border-radius:999px; background:var(--goal); transition:width .3s ease; }
  .goal-row-meta{ font-size:11.5px; color:var(--ink-soft); font-weight:600; margin-bottom:4px; }
  .goal-reached-tag{ color:var(--credit); font-weight:700; }
  .contribution-form{ margin-top:10px; background:#fff; border-radius:12px; padding:12px; }
  .contribution-form label{ display:block; font-size:11.5px; color:var(--ink-soft); font-weight:700; margin-bottom:8px; }
  .contribution-form input{ width:100%; max-width:100%; min-width:0; margin-top:5px; padding:9px 10px; border:1.5px solid var(--line); border-radius:9px; font-size:16px; background:var(--bg); }

  .ledger-form{ max-width:440px; }
  .type-toggle{ display:flex; gap:10px; margin-bottom:20px; background:var(--bg); border-radius:14px; padding:5px; }
  .type-btn{ flex:1; padding:11px 8px; border:none; border-radius:10px; background:none; font-size:13.5px; font-weight:700; color:var(--ink-soft); display:flex; align-items:center; justify-content:center; gap:6px; transition:background .12s, color .12s, box-shadow .12s; }
  .type-btn.active{ background:#fff; color:var(--ink); box-shadow:var(--shadow-sm); }
  .type-btn.credit.active{ color:var(--credit); }
  .type-btn.debit.active{ color:var(--debit); }
  .ledger-form label{ display:block; font-size:12.5px; color:var(--ink-soft); margin-bottom:16px; font-weight:700; }
  .ledger-form input, .ledger-form select{ display:block; width:100%; max-width:100%; min-width:0; margin-top:7px; padding:11px 12px; border:1.5px solid var(--line); border-radius:12px; font-size:16px; background:#fff; color:var(--ink); }
  .stamp-btn{ width:100%; padding:13px; justify-content:center; font-size:14.5px; }
  #cancel-edit-link{ display:none; margin-top:12px; background:none; border:none; color:var(--ink-soft); font-size:13px; font-weight:600; width:100%; text-align:center; align-items:center; justify-content:center; gap:5px; }
  .today-entries{ margin-top:30px; max-width:440px; }
  .today-entries h3{ font-size:15px; font-weight:800; margin-bottom:6px; }

  .stamp-overlay{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none; opacity:0; transition:opacity .15s; z-index:999; }
  .stamp-overlay.show{ opacity:1; }
  .stamp-overlay .stamp{ font-weight:800; font-size:32px; border:5px solid var(--credit); letter-spacing:.5px; color:var(--credit); padding:16px 32px; border-radius:14px; background:rgba(255,255,255,.72); backdrop-filter:blur(14px) saturate(160%); -webkit-backdrop-filter:blur(14px) saturate(160%); transform:scale(2) rotate(-10deg); opacity:0; transition:transform .35s cubic-bezier(.2,1.6,.4,1), opacity .25s; box-shadow:var(--shadow); }
  .stamp-overlay.show .stamp{ transform:scale(1) rotate(-6deg); opacity:1; }
  @media (prefers-reduced-motion: reduce){ .stamp-overlay, .stamp-overlay .stamp{ transition:none !important; } }

  .report-controls{ margin-bottom:16px; }
  .segmented{ display:grid; grid-template-columns:1fr 1fr; gap:8px; background:var(--bg); border-radius:16px; padding:6px; margin-bottom:16px; }
  .segmented button{ padding:11px 12px; background:none; border:none; border-radius:11px; font-size:13px; color:var(--ink-soft); font-weight:700; transition:background .12s, color .12s; }
  .segmented button.active{ background:#fff; color:var(--ink); box-shadow:var(--shadow-sm); }
  .period-inputs{ margin-bottom:16px; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
  .period-inputs input{ padding:9px 12px; border:1.5px solid var(--line); border-radius:10px; background:#fff; font-family:'Roboto Mono',monospace; }
  .period-hint{ font-size:12px; color:var(--ink-soft); font-weight:500; }
  .filter-row{ display:flex; gap:10px; flex-wrap:wrap; }
  .filter-row select{ padding:9px 12px; border:1.5px solid var(--line); border-radius:10px; min-width:160px; background:#fff; }
  .search-input{ flex:2; min-width:200px; padding:9px 12px; border:1.5px solid var(--line); border-radius:10px; background:#fff; }
  .search-input-wrap{ position:relative; flex:2; min-width:200px; }
  .search-input-wrap .search-input{ width:100%; padding-left:36px; }
  .search-input-wrap .search-icon{ position:absolute; left:11px; top:50%; transform:translateY(-50%); color:var(--ink-soft); }

  /* History's extended filter panel (date range, amount range, wallet, sort) - collapsible so it
     doesn't dominate a mobile screen; toggled by JS adding/removing .collapsed, defaulted per
     breakpoint at render time (see wireHistoryFilters in js/app.js). Desktop has enough width
     that it stays open by default, same as the filter row always did before this. */
  .history-filters-panel{ display:flex; flex-direction:column; gap:10px; margin-top:12px; }
  .history-filters-panel.collapsed{ display:none; }
  .history-filters-toggle{ position:relative; }
  .filter-count-badge{ display:inline-flex; align-items:center; justify-content:center; min-width:17px; height:17px; padding:0 4px; border-radius:999px; background:var(--link); color:#fff; font-size:10.5px; font-weight:700; line-height:1; }
  .filter-inline-label{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--ink-soft); font-weight:600; flex:1 1 140px; min-width:0; max-width:100%; }
  .filter-inline-label input{ flex:1; min-width:0; max-width:100%; padding:9px 12px; border:1.5px solid var(--line); border-radius:10px; background:#fff; font-family:'Roboto Mono',monospace; color:var(--ink); }
  /* Below the panel's own mobile/desktop split (see wireHistoryFilters in js/app.js) - each
     inline label (Min/Max amount, From/To date) becomes the sole occupant of its row instead of
     sharing one with a sibling. flex:1 1 140px + min-width:0 on the label and min-width:0 on its
     input are already textbook-correct for letting a number input shrink below its native
     content width, but a number input's spin-button control is real estate some mobile browser
     engines add on top of the flex-computed box rather than inside it - two labels still fighting
     for one narrow row is exactly the layout that turns "slightly wider than expected" into
     "wider than the viewport." One per row removes the fight entirely, independent of whichever
     engine-specific rendering quirk is actually adding the extra width on a given device. */
  @media (max-width:780px){
    .filter-inline-label{ flex:1 1 100%; }
  }
  .active-filter-chips{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:12px; }
  .filter-chip{ display:inline-flex; align-items:center; gap:5px; padding:5px 6px 5px 12px; border-radius:999px; background:var(--bg); border:1px solid var(--line); font-size:12px; font-weight:600; color:var(--ink-soft); }
  /* A 44x44 tap target (WCAG's minimum) on an icon this small would visually bloat the whole
     chip if built from real padding - the ::before pseudo-element instead expands only the
     CLICKABLE area (inset:-14px around a 16px box = 44x44) while the chip itself stays compact.
     position:relative on the button anchors that pseudo-element to the button, not the chip. */
  .filter-chip-remove{ position:relative; display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; padding:0; border:none; border-radius:50%; background:none; color:var(--ink-soft); flex-shrink:0; }
  .filter-chip-remove::before{ content:''; position:absolute; inset:-14px; }
  .filter-chip-remove:hover{ background:rgba(0,0,0,.08); color:var(--ink); }
  .filter-chip-remove svg{ width:10px; height:10px; }
  .filter-chip-clear{ font-size:12px; font-weight:700; color:var(--link); background:none; border:none; padding:5px 4px; text-decoration:underline; }

  .report-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; flex-wrap:wrap; gap:10px; }
  .report-header h2{ font-size:16.5px; margin:0; font-weight:800; letter-spacing:-.2px; }
  .report-header .btn-group{ display:flex; gap:8px; flex-wrap:wrap; }
  .report-summary{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; margin-bottom:22px; }
  .summary-box{ background:var(--bg); border-radius:16px; padding:14px 16px; font-size:11.5px; color:var(--ink-soft); font-weight:700; text-align:center; }
  .summary-box .mono-num{ display:block; font-size:18px; color:var(--ink); margin-top:6px; font-weight:700; }
  .summary-box.credit .mono-num{ color:var(--credit); }
  .summary-box.debit .mono-num{ color:var(--debit); }
  .summary-box .mono-num.negative{ color:var(--debit); }

  /* overflow-y:hidden added deliberately (not left to default): this wrapper's overflow-x:auto is
     the one genuinely-intended case of horizontal scrolling in the app (wide report tables on
     narrow viewports), but per the same overflow spec quirk noted elsewhere in this file, leaving
     the other axis at its default 'visible' would make the browser compute it as 'auto' too,
     risking an unwanted vertical scrollbar here as well. Closing it from this direction keeps the
     intentional horizontal scroll while ruling out any accidental vertical one. */
  .table-scroll{ overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch; }
  .data-table{ width:100%; min-width:560px; border-collapse:collapse; font-size:13.5px; }
  .data-table th{ text-align:left; padding:9px 8px; color:var(--ink-soft); font-size:10.5px; text-transform:uppercase; letter-spacing:.5px; font-weight:700; border-bottom:1.5px solid var(--line); }
  .data-table td{ padding:11px 8px; border-bottom:1px solid var(--bg); }
  .data-table td.num{ font-family:'Roboto Mono',monospace; font-variant-numeric:tabular-nums; font-weight:700; text-align:right; }
  .data-table tr:hover{ background:var(--bg); }

  .more-row{ display:flex; justify-content:space-between; align-items:center; width:100%; background:#fff; border:none; border-radius:18px; padding:16px 18px; margin-bottom:10px; box-shadow:var(--shadow-sm); color:var(--ink); font-size:14.5px; font-weight:700; transition:transform .12s, box-shadow .12s; }
  .more-row:hover{ transform:translateY(-1px); box-shadow:var(--shadow); }
  .more-row-left{ display:flex; align-items:center; gap:13px; }
  .more-icon-badge{ width:36px; height:36px; border-radius:11px; background:var(--bg); color:var(--ink); display:flex; align-items:center; justify-content:center; }
  .back-btn{ display:flex; align-items:center; gap:6px; background:none; border:none; color:var(--ink-soft); font-weight:700; font-size:13.5px; margin-bottom:16px; padding:0; }
  .back-btn:hover{ color:var(--ink); }
  .more-sub{ display:none; }
  .more-sub.active{ display:block; animation: viewFadeIn var(--anim-duration) var(--anim-ease); }
  #more-menu{ display:none; }
  #more-menu.active{ display:block; animation: viewFadeIn var(--anim-duration) var(--anim-ease); }
  @media (prefers-reduced-motion: reduce){ .more-sub.active, #more-menu.active{ animation:none; } }
  .more-sub h2{ font-size:18px; margin:0 0 16px; font-weight:800; letter-spacing:-.2px; }

  .cat-columns{ display:flex; gap:16px; flex-wrap:wrap; margin-bottom:16px; }
  .cat-col{ flex:1; min-width:260px; }
  .cat-col h3{ font-size:14.5px; margin-top:0; margin-bottom:14px; font-weight:800; }
  /* Round "category ordering + colour": a third child (.cat-drag-handle) joins .cat-row-left and
     the delete button - space-between with a middle child that doesn't grow would leave uneven
     gaps either side of it, so .cat-row-left instead takes flex:1 to fill the remaining width,
     keeping the handle pinned left and the delete button pinned right without needing
     justify-content at all. */
  .cat-row{ display:flex; align-items:center; gap:6px; padding:9px 0; border-bottom:1px solid var(--bg); font-size:13.5px; position:relative; }
  .cat-row.cat-row-dragging{ position:relative; z-index:5; background:var(--card); box-shadow:var(--shadow-sm); border-radius:10px; }
  .cat-row-left{ display:flex; align-items:center; gap:10px; flex:1; min-width:0; cursor:pointer; }
  /* touch-action:none is what actually solves the brief's "long-press competes with page
     scrolling" complaint: the browser only ever hands a touch gesture to its own scroll handling
     OR to this element's pointer events, decided the instant the gesture starts on this element -
     dragging can only ever begin here, never from a long-press anywhere else on the row. */
  .cat-drag-handle{ display:flex; align-items:center; justify-content:center; width:32px; height:32px; flex-shrink:0; color:var(--ink-soft); cursor:grab; touch-action:none; -webkit-user-select:none; user-select:none; }
  .cat-drag-handle:active{ cursor:grabbing; }
  .cat-col form{ display:flex; gap:8px; margin-top:14px; }
  .cat-col form input{ flex:1; padding:9px 12px; border:1.5px solid var(--line); border-radius:10px; background:var(--bg); }
  .cat-col form button{ background:var(--binder); color:#FFFFFF; border:none; padding:9px 16px; border-radius:10px; font-weight:700; font-size:13px; }

  /* Colour picker grid (round "category ordering + colour") - 30 swatches from js/app.js's
     CAT_SWATCHES, rendered inside #color-picker-overlay's .search-overlay-body. 6 columns keeps
     each swatch a comfortable touch target down to a 320px screen without the grid needing its
     own horizontal scroll. */
  .swatch-grid{ display:grid; grid-template-columns:repeat(6, 1fr); gap:10px; padding:2px 0 8px; }
  .swatch-btn{ position:relative; aspect-ratio:1; border-radius:50%; border:2.5px solid transparent; padding:0; display:flex; align-items:center; justify-content:center; color:var(--avatar-letter); }
  .swatch-btn.swatch-current{ border-color:var(--ink); }
  .swatch-btn.swatch-taken{ opacity:.32; cursor:not-allowed; }
  .swatch-btn:disabled{ cursor:not-allowed; }

  /* Desktop-only scrollbar treatment for the colour picker, same breakpoint and pattern
     #schedule-overlay's own desktop block already uses further down this file. Mobile's overlay
     scroll (touch, ephemeral, non-reserving-width) never showed either problem this fixes, so
     both rules are scoped inside this same min-width:781px block and nothing changes below it.
     a) padding-right on the scroll container - not on .swatch-grid itself - opens a gap between
        the swatches and the track/thumb without needing to also compensate the grid's own width
        (padding on the SCROLLING element shifts its content box, .swatch-grid included, without
        the grid needing any size math of its own).
     b) color-scheme:dark (set globally per theme in an earlier round, and staying) makes Dark/
        Black/Crimson's browser-default scrollbar draw a visible track - Light's color-scheme:light
        default track already renders invisible, which is the look this matches everywhere.
        scrollbar-color's track keyword and ::-webkit-scrollbar-track are both set to transparent
        for the same reason #schedule-overlay's desktop block already sets both: which one
        actually paints depends on the engine, and setting only one leaves the other browser
        family showing the unwanted track. */
  @media (min-width:781px){
    #color-picker-overlay .search-overlay-body{
      padding-right:10px;
      scrollbar-width:thin; scrollbar-color:var(--line) transparent;
    }
    #color-picker-overlay .search-overlay-body::-webkit-scrollbar{ width:8px; }
    #color-picker-overlay .search-overlay-body::-webkit-scrollbar-track{ background:transparent; }
    #color-picker-overlay .search-overlay-body::-webkit-scrollbar-thumb{ background:var(--line); border-radius:999px; }
    #color-picker-overlay .search-overlay-body::-webkit-scrollbar-thumb:hover{ background:var(--ink-soft); }
    /* Desktop has room to lay the 30 swatches out wider and shorter instead of mobile's tall
       6-column strip - 10 columns x 3 rows fits well within .search-overlay-inner's 78vh cap on
       any normal desktop window (verified down to 1024x700), so the scrollbar styling just above
       is a fallback for an unusually short window rather than the common case. Widening the modal
       itself alongside the column count keeps each swatch a comfortable size rather than shrinking
       them to fit more columns into the mobile-sized 560px width. */
    #color-picker-overlay .search-overlay-inner{ max-width:640px; }
    #color-picker-overlay .swatch-grid{ grid-template-columns:repeat(10, 1fr); }
  }

  /* Floating calculator button (round "calculator") - a NEW, separate fixed element, deliberately
     never touching html/body/main/.views/.bottom-nav/.topbar's own geometry (see the round's own
     overlap-survey report). Its "bottom" is set entirely at runtime by positionCalcFab() in
     js/app.js (the same positionAboveBottomNav() the toast/update-banner already use), so this
     rule intentionally has no bottom value of its own - only right/size/appearance, which are
     genuinely this NEW element's own concern.
     Round 8: circular chrome is back, matching the bottom-nav's own Add Entry FAB
     (.bottom-nav .tab-btn.fab) - same background:var(--binder) fill and box-shadow:var(--shadow-fab)
     elevation, so the two floating round buttons in this app read as the same visual language
     rather than two different patterns. Unlike that button, this one isn't embedded in the nav bar
     (it floats freely over arbitrary page content), so it skips that button's border:4px solid
     var(--bg) "cutout" ring - that border exists to separate the Add Entry FAB from the bar it
     sits inside, a context this element doesn't share.
     The circle IS the hit-area (width/height/border-radius together, no separate padding-only
     wrapper) - round 5's rationale for extra invisible hit-padding beyond the drawn icon doesn't
     apply once a regular circular shape wraps everything, since the circle itself is already a
     clean, fully-hittable target with no irregular silhouette to compensate for.
     Round 9: resized from 68px to 54px to match the Add Entry FAB's own computed size exactly
     (getBoundingClientRect confirmed both at 68x68/54x54 respectively before this change - a
     clean 1.259 ratio, not the ~1.44 independently measured against a screenshot; the likely cause
     of that mismatch was found and fixed below, not in this size number itself).
     positionCalcFab()/setBottomSpaceReservation() (which read this element's live
     getBoundingClientRect(), untouched here) reserve however much space this box actually turns
     out to be - re-verified against the round's own overlap-survey report regardless, since a
     smaller circle changes the hit-area. */
  #calc-fab{
    position:fixed; right:16px; width:54px; height:54px; border-radius:50%;
    background:var(--binder); color:#FFFFFF; box-shadow:var(--shadow-fab);
    /* Round 9 fix: #calc-fab never explicitly reset the browser's own default <button> border/
       padding (round 5's version had border:none - lost when round 8's rewrite swapped that line
       for a real background/box-shadow and didn't carry border:none forward). The result was a
       genuinely visible artifact: a default 2px outset button border (a light/dark bevel, not a
       flat colour) riding the circle's own edge, confirmed both via getComputedStyle (border:"2px
       outset rgb(0,0,0)") and by screenshot at 6x zoom - lighter on the top-left, darker toward
       black on the bottom-right. That non-uniform edge is the most likely explanation for the
       independently-measured ~1.44x ratio: a bevelled edge doesn't have one clean boundary to
       measure pixels against, unlike a flat-filled circle. */
    border:none; padding:0;
    display:flex; align-items:center; justify-content:center;
    z-index:250; cursor:pointer;
  }
  #calc-fab:active{ transform:scale(.94); }
  /* 35px keeps the same ~17.6% padding-per-side ratio the 44px-in-68px icon had (12/68), just
     scaled to the new 54px circle (54 * 44/68 = 34.9, rounded to 35) rather than carrying the old
     12px absolute padding forward unscaled. */
  #calc-fab svg{ width:35px; height:35px; display:block; }

  .calc-display{ font-size:28px; font-weight:800; color:var(--ink); text-align:right; padding:4px 4px 2px; word-break:break-all; font-variant-numeric:tabular-nums; }
  .calc-op-row{ font-size:14px; font-weight:700; color:var(--ink-soft); text-align:right; min-height:12px; padding:0 4px 2px; }
  .calc-keypad{ display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:5px; }
  /* Fixed height (not aspect-ratio) so key height stays constant regardless of the sheet's own
     width - aspect-ratio here previously meant a wider sheet (e.g. the 420px desktop cap) made
     every key taller too, which is exactly backwards for fitting the whole sheet on screen
     without scrolling (Issue 1, round 2): the widest layouts need the SHORTEST keys, not the
     tallest. 44px is the floor Issue 2 asked to stay at or above for a comfortable touch target. */
  .calc-key{ height:44px; border:none; border-radius:12px; background:var(--bg); color:var(--ink); font-size:18px; font-weight:700; display:flex; align-items:center; justify-content:center; transition:background .1s; }
  .calc-key:active{ background:var(--line); }
  .calc-key-fn{ color:var(--ink-soft); font-size:15px; }
  .calc-key-op{ background:var(--binder); color:#FFFFFF; }
  .calc-key-eq{ background:var(--credit); color:#FFFFFF; }

  #calc-tab-emi label{ display:block; font-size:12.5px; font-weight:700; color:var(--ink-soft); margin-bottom:12px; }
  #calc-tab-emi input, #calc-tab-emi select{ display:block; width:100%; margin-top:4px; padding:9px 12px; border:1.5px solid var(--line); border-radius:10px; background:var(--bg); color:var(--ink); font-size:14px; }
  /* Issue 6, round 3 - the result panel's markup reuses the shared .card component (built in
     app.js's calcEmiCalculate), but .card's own box-shadow is tuned for a top-level page card
     sitting on the plain page background (--bg), not for a small panel nested one level inside a
     sheet that is ALREADY a --card-coloured, already-shadowed surface. Stacking that shadow here
     read as a separate, slightly-offset ghost rectangle behind the real panel (worst on desktop,
     where the panel sits more isolated against the wider sheet) rather than a shadow that gives
     it presence a panel this deep in the nesting doesn't need. Dropping the shadow and swapping to
     a --bg fill against the sheet's --card background gives the same "this is a distinct panel"
     read via a plain tone/border difference instead, with no phantom edge. */
  #calc-emi-result .card{ box-shadow:none; background:var(--bg); border-color:var(--line); }

  /* touch-action:manipulation (Issue 4, round 3) - every OTHER tappable calculator control is a
     real <button>, already covered by the global `button, a, .node, [onclick]{
     touch-action:manipulation }` rule near the top of this file. This row is a plain <div> with a
     delegated click listener, so it slipped through that rule - meaning it was the one calculator
     element still exposed to the mobile-browser default double-tap-zoom delay, where the FIRST
     tap on a fresh target is held back (sometimes ~300ms, sometimes dropped) while the browser
     waits to see if a second tap follows. That's what "sometimes requires two taps" looks like
     from the user's side: no state actually gets lost between taps (traced the full handler and
     couldn't find any code path that populates fields and then clears them), the first tap
     sometimes just never reaches the click listener at all. */
  .calc-history-row{ display:flex; align-items:center; gap:8px; padding:3px 0; border-bottom:1px solid var(--bg); font-size:12.5px; cursor:pointer; touch-action:manipulation; }
  /* Raised from ~2.3 rows to ~6 rows (Issue 1, round 3 - the 2-ish row region from round 2 read
     as too cramped once real-device testing had actual history to scroll through). The outer
     sheet must still never scroll regardless of how many calculations pile up, so this remains
     the one intentional scroll region left, just taller: contained to the history list itself. */
  #calc-history-list{ max-height:140px; overflow-y:auto; }
  /* Same scrollbar-track fix as #color-picker-overlay .search-overlay-body (Issue 3, round 3) -
     color-scheme:dark (set per dark theme) makes the browser's default scrollbar draw a visible
     track, which Light's color-scheme:light default track already renders invisible; this list is
     the same shape of bug the colour picker had, just never carried the same treatment because it
     didn't exist as a scroll container yet. Applied unconditionally (not behind the colour
     picker's desktop-only breakpoint) because this list scrolls on mobile too, unlike the colour
     picker's swatch grid which only needed it on an unusually short desktop window. Both
     scrollbar-color's track keyword and ::-webkit-scrollbar-track are set to transparent for the
     same reason the colour picker's fix sets both: which one actually paints depends on the
     engine, and setting only one leaves the other browser family showing the unwanted track. */
  #calc-history-list{ scrollbar-width:thin; scrollbar-color:var(--line) transparent; }
  #calc-history-list::-webkit-scrollbar{ width:6px; }
  #calc-history-list::-webkit-scrollbar-track{ background:transparent; }
  #calc-history-list::-webkit-scrollbar-thumb{ background:var(--line); border-radius:999px; }
  #calc-history-list::-webkit-scrollbar-thumb:hover{ background:var(--ink-soft); }
  /* Scoped padding trim (not the shared .btn-pill rule) - Issue 1, round 2: the Quick tab's
     display+keypad+history needed to fit one mobile screen with no internal scrollbar, and this
     button only exists on the Add Entry-opened sheet, so it's pure overhead everywhere else. */
  #calc-use-amount-btn{ padding-top:5px; padding-bottom:5px; }
  .calc-history-kind{ flex-shrink:0; font-size:10px; font-weight:800; letter-spacing:.03em; text-transform:uppercase; color:var(--ink-soft); background:var(--bg); padding:2px 6px; border-radius:6px; }
  .calc-history-summary{ flex:1; min-width:0; color:var(--ink-soft); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .calc-history-result{ flex-shrink:0; font-weight:700; color:var(--ink); }

  @media (min-width:781px){
    #calculator-overlay .search-overlay-inner{ max-width:420px; }
    /* Issue 5, round 3: right:16px (the mobile value, unchanged below this breakpoint) read as
       clipped into the corner on desktop's much larger, otherwise-empty canvas. Pulled in to 32px
       to match the matching bottom-offset bump in positionCalcFab() (js/app.js), which is the
       only other half of this fix - that function's own overlap-avoidance logic is untouched,
       only the desktop margin NUMBER it's called with. */
    #calc-fab{ right:32px; }
  }
  /* Scoped header-margin trim (not the shared .search-overlay-header rule, same pattern as the
     max-width override above) - part of Issue 1 (round 2)'s vertical-space budget to fit the
     whole sheet without an internal scrollbar. */
  #calculator-overlay .search-overlay-header{ margin-bottom:8px; }

  .settings-row{ display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:14px; }
  .settings-row label{ font-size:13px; color:var(--ink-soft); font-weight:700; }
  .settings-row input{ margin-left:8px; padding:7px 9px; border:1.5px solid var(--line); border-radius:8px; width:3.5em; background:var(--bg); }
  .settings-actions{ display:flex; gap:10px; flex-wrap:wrap; }

  #loading-overlay{ position:fixed; inset:0; background:var(--bg); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px; z-index:2000; }
  #loading-overlay img{ width:64px; height:64px; animation: loadPulse 1.4s ease-in-out infinite; }
  #loading-overlay .loading-text{ font-size:13.5px; font-weight:700; color:var(--ink-soft); letter-spacing:.3px; }
  @keyframes loadPulse{ 0%,100%{ transform:scale(1); opacity:1; } 50%{ transform:scale(1.08); opacity:.7; } }

  /* ---------- Dark mode ---------- */
  body[data-theme="dark"]{
    color-scheme:dark;
    --bg:#0B1220;
    --card:#141B2D;
    --ink:#E8ECF6;
    --ink-soft:#8B95AC;
    --line:#232C42;
    --credit:#22C55E;
    --debit:#F87171;
    --gold:#FBBF24;
    --link:#60A5FA;
    --goal:#C084FC;
    --binder:#2563EB;
    --binder-light:#3B82F6;
    --shadow:0 1px 2px rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.35);
    --shadow-sm:0 1px 2px rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.45);
    --shadow-glass:0 1px 2px rgba(0,0,0,.35), 0 12px 28px rgba(0,0,0,.40);
    --shadow-fab:0 8px 22px rgba(0,0,0,.55);
    --shadow-nav:0 -4px 20px rgba(0,0,0,.35);
  }
  body[data-theme="dark"] .spine{ background:rgba(20,27,45,.82); border-right-color:var(--line); }
  body[data-theme="dark"] .bottom-nav{ background:rgba(20,27,45,.82); border-top-color:var(--line); }
  body[data-theme="dark"] .topbar{ background:rgba(11,18,32,.74); border-bottom-color:var(--line); }
  body[data-theme="dark"] .icon-circle{ background:rgba(32,41,64,.78); border-color:rgba(255,255,255,.07); }
  body[data-theme="dark"] .card-glass{ background:rgba(32,41,64,.55); border-color:rgba(255,255,255,.07); }
  body[data-theme="dark"] .stamp-overlay .stamp{ background:rgba(20,27,45,.8); }
  body[data-theme="dark"] .data-table tr:hover{ background:rgba(255,255,255,.04); }
  body[data-theme="dark"] .ledger-form input, body[data-theme="dark"] .ledger-form select,
  body[data-theme="dark"] .filter-row select, body[data-theme="dark"] .search-input,
  body[data-theme="dark"] .period-inputs input, body[data-theme="dark"] .budget-limit-input input,
  body[data-theme="dark"] .log-payment-form input, body[data-theme="dark"] .log-payment-form select, body[data-theme="dark"] .cat-col form input,
  body[data-theme="dark"] .settings-row input, body[data-theme="dark"] .btn-outline,
  body[data-theme="dark"] .filter-inline-label input,
  body[data-theme="dark"] .contribution-form input{
    background:#1A2336; border-color:var(--line); color:var(--ink);
  }
  body[data-theme="dark"] .more-row, body[data-theme="dark"] .summary-box, body[data-theme="dark"] .insight-note,
  body[data-theme="dark"] .log-payment-form, body[data-theme="dark"] .contribution-form{
    background:var(--card);
  }
  body[data-theme="dark"] .progress-track, body[data-theme="dark"] .breakdown-track,
  body[data-theme="dark"] .budget-bar-track, body[data-theme="dark"] .debt-bar-track,
  body[data-theme="dark"] .goal-bar-track{ background:#0E1626; }
  body[data-theme="dark"] .ring-period-btn.active,
  body[data-theme="dark"] .type-btn.active,
  body[data-theme="dark"] .segmented button.active{
    background:#28344E; color:#FFFFFF; box-shadow:var(--shadow-sm);
  }
  body[data-theme="dark"] .type-btn.credit.active{ color:#4ADE80; }
  body[data-theme="dark"] .type-btn.debit.active{ color:#F87171; }
  body[data-theme="dark"] .btn-debit{ color:var(--bg); }

  /* ---------- Crimson theme ----------
     Token system built from the 4 specified colors (deep navy-black bg, charcoal card, crimson
     accent, off-white ink), then everything else derived deliberately rather than defaulted:
     - --debit is a warm coral-orange (#FF7A59), NOT the crimson accent. The brief specifically
       flagged that #df0139 sits close to a typical expense-red, and money-leaving-your-account
       must never look like "just a themed button" - shifting debit ~330° away in hue (magenta-
       red accent vs orange-coral debit) keeps them visually unambiguous at a glance, verified via
       WCAG contrast (6.4:1 against --bg) so it also reads clearly as text, not just as a swatch.
     - --binder (primary CTA/FAB/active-nav-tab color) IS the exact crimson - that's where the
       brief's "CTAs, active states, key highlights" language actually belongs. It is NOT used as
       the background for segmented/type-btn "active" pills, though: white text on crimson passes
       AA (5:1), but credit/debit-tinted text on crimson does not (checked: ~2:1) - those pills
       keep the same neutral-charcoal-fill pattern Dark/Mounty already use, with credit/debit text
       colors layered on top, so financial figures stay legible everywhere they appear.
     - --ink-soft, --line, and every surface tone below were picked and checked against both --bg
       and --card (4.5:1+ for text roles) rather than eyeballed, since this is a financial app
       where every number has to stay readable, not just look right in a screenshot.
     - No background photo/decoration (unlike Mounty) - matte and flat by design, so glass/blur
       stays confined to the same signature surfaces already used for every theme (nav chrome via
       .spine/.bottom-nav/.topbar, .icon-circle, and the handful of .card-glass hero cards) rather
       than spreading blur across scrollable list content. */
  body[data-theme="crimson"]{
    color-scheme:dark;
    --bg:#1E1E27;
    --card:#28242A;
    --ink:#E2E2E2;
    --ink-soft:#9A97A0;
    --line:#3A363E;
    --credit:#3DDC84;
    --debit:#FF7A59;
    --gold:#F5B942;
    --link:#FF5C8A;
    --goal:#B98BFF;
    --binder:#DF0139;
    --binder-light:#FF2D63;
    --shadow:0 1px 2px rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.35);
    --shadow-sm:0 1px 2px rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.45);
    --shadow-glass:0 1px 2px rgba(0,0,0,.35), 0 12px 28px rgba(0,0,0,.40);
    --shadow-fab:0 8px 22px rgba(0,0,0,.55);
    --shadow-nav:0 -4px 20px rgba(0,0,0,.35);
  }
  body[data-theme="crimson"] .spine{ background:rgba(38,34,42,.82); border-right-color:var(--line); }
  body[data-theme="crimson"] .bottom-nav{ background:rgba(38,34,42,.82); border-top-color:var(--line); }
  body[data-theme="crimson"] .topbar{ background:rgba(30,28,35,.74); border-bottom-color:var(--line); }
  body[data-theme="crimson"] .icon-circle{ background:rgba(48,43,50,.78); border-color:rgba(255,255,255,.07); }
  body[data-theme="crimson"] .card-glass{ background:rgba(40,36,42,.58); border-color:rgba(255,255,255,.08); }
  body[data-theme="crimson"] .stamp-overlay .stamp{ background:rgba(30,27,34,.82); }
  body[data-theme="crimson"] .data-table tr:hover{ background:rgba(255,255,255,.04); }
  body[data-theme="crimson"] .ledger-form input, body[data-theme="crimson"] .ledger-form select,
  body[data-theme="crimson"] .filter-row select, body[data-theme="crimson"] .search-input,
  body[data-theme="crimson"] .period-inputs input, body[data-theme="crimson"] .budget-limit-input input,
  body[data-theme="crimson"] .log-payment-form input, body[data-theme="crimson"] .log-payment-form select, body[data-theme="crimson"] .cat-col form input,
  body[data-theme="crimson"] .settings-row input, body[data-theme="crimson"] .btn-outline,
  body[data-theme="crimson"] .filter-inline-label input,
  body[data-theme="crimson"] .contribution-form input{
    background:#2A252D; border-color:var(--line); color:var(--ink);
  }
  body[data-theme="crimson"] .more-row, body[data-theme="crimson"] .summary-box, body[data-theme="crimson"] .insight-note,
  body[data-theme="crimson"] .log-payment-form, body[data-theme="crimson"] .contribution-form{
    background:var(--card);
  }
  body[data-theme="crimson"] .progress-track, body[data-theme="crimson"] .breakdown-track,
  body[data-theme="crimson"] .budget-bar-track, body[data-theme="crimson"] .debt-bar-track,
  body[data-theme="crimson"] .goal-bar-track{ background:#17151B; }
  body[data-theme="crimson"] .ring-period-btn.active,
  body[data-theme="crimson"] .type-btn.active,
  body[data-theme="crimson"] .segmented button.active{
    background:#3A2E33; color:#FFFFFF; box-shadow:var(--shadow-sm);
  }
  body[data-theme="crimson"] .type-btn.credit.active{ color:var(--credit); }
  body[data-theme="crimson"] .type-btn.debit.active{ color:var(--debit); }
  body[data-theme="crimson"] .btn-debit{ color:var(--bg); }
  body[data-theme="crimson"] .bottom-nav .tab-btn.active{ color:var(--binder); }

  /* ---------- Type-scale calibration findings (Webline, v48-v50, retired) ----------
     Webline (the pixel-console theme) measured how VT323/Press Start 2P actually render
     compared to Inter, at real sizes, on a real device. The theme itself is gone, but these
     numbers were expensive to derive (two separate Playwright measurement passes across two
     rounds) and may be useful again if any future theme ever mixes display faces with Inter:
       - Cap-height ratio, measured by rendering 'M' in each face across an 8-34px sweep and
         reading back actualBoundingBoxAscent/Descent from canvas text metrics, then a
         least-squares fit: Inter ~0.695, Press Start 2P (pixel face) ~0.887, VT323 (mono face)
         ~0.572. To make a face's rendered cap-height match Inter's own for a given nominal
         size N: pixel_px = N * (0.695/0.887) = N * 0.784; mono_px = N * (0.695/0.572) = N * 1.215.
       - The pixel-face ratio (0.784) held up on a real device. The mono-face ratio (1.215) did
         NOT - cap-height alone missed VT323's much heavier stroke weight and wider per-
         character advance width, both of which dominate how "big" a full string of real
         (mostly lowercase, numeral-heavy) text actually reads at a glance. Re-measured by
         rendering 5 real strings in Inter (at real app-context sizes) and in VT323 across a
         candidate sweep, side by side, and finding the size at which VT323 stopped reading as
         visually larger - not a formula applied blind, an actual side-by-side comparison. All 5
         strings converged independently on the same ratio: mono_px = N * 0.84 (not 1.215). */

  /* ---------- Black theme ----------
     Strict monochrome dark theme - pure black and grey chrome, no hues in nav/topbar/cards/body
     text/Save Entry/chevrons/dividers/backgrounds. NOT a recolour of Dark (which is navy-tinted
     with a blue accent) - every chrome token below is a true grey or pure white/black so it
     reads as a genuinely different theme sitting next to Dark in the picker, not a variant of it.
     Structurally identical to every other theme here (same selectors, same component list).
     Round 1 shipped --credit/--debit as pure white/grey (no colour at all). Real-device testing
     found pure monochrome fails on scannability - round 2 reintroduces colour, but ONLY where it
     carries meaning: category identity (categoryColorBlack() in js/app.js) and credit/debit
     polarity (these two lines). Both still live as ordinary custom properties, so a future
     decision to change them again is still a one-line edit here, nothing else.
     --warning is new this round - the 80-99.99%-of-budget amber state (see .budget-bar-fill.warn
     below); --debit doubles as the 100%+ state deliberately, the same red as an overspent
     category IS an over-budget category.
     --binder (primary CTA/FAB/active-nav-tab colour) stays pure white, inverted from every other
     theme - the reference design's defining move, and explicitly NOT the same token as --credit
     even though both are bright: --binder drives ordinary chrome (Save Entry, the FAB, active nav
     tab) which stays monochrome per the brief, while --credit is reserved for the credit/debit
     pair specifically. Every existing rule that pairs background:var(--binder) with a hardcoded
     color:#FFFFFF (.btn-black, .spine .tab-btn.active, .bottom-nav .tab-btn.fab, .cat-col form
     button) would otherwise render white text on a white button, so each gets a Black-specific
     override below flipping the text to black - the same "override the hardcoded text colour
     when the token's lightness flips" pattern Dark/Crimson already use for .btn-debit (see line
     ~695/767 above), just applied to the primary-button token instead of the debit one. */
  body[data-theme="black"]{
    color-scheme:dark;
    --bg:#000000;
    --card:#121212;
    --ink:#FFFFFF;
    --ink-soft:#A0A0A0;
    --line:#2A2A2A;
    --credit:#3FB950;
    --debit:#F85149;
    --warning:#D29922;
    --avatar-letter:#0B0B0B;
    --gold:#C8C8C8;
    --link:#B0B0B0;
    --goal:#E0E0E0;
    --binder:#FFFFFF;
    --binder-light:#E8E8E8;
    --shadow:0 1px 2px rgba(0,0,0,.5), 0 8px 20px rgba(0,0,0,.5);
    --shadow-sm:0 1px 2px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.55);
    --shadow-glass:0 1px 2px rgba(0,0,0,.5), 0 12px 28px rgba(0,0,0,.5);
    --shadow-fab:0 8px 22px rgba(0,0,0,.6);
    --shadow-nav:0 -4px 20px rgba(0,0,0,.5);
  }
  /* Add Credit / Add Debit (Home quick actions) - the ONE place .btn-black/.btn-debit's usual
     binder-white/debit-red styling gets overridden to the CREDIT colour specifically, so the two
     buttons read as a green/red pair rather than "primary" vs "disabled". Targeted by id, not by
     class, because .btn-black/.btn-debit are shared with unrelated buttons (Save Entry, Save
     Debt, the debt-kind toggle...) that must stay on the ordinary --binder/--debit chrome tokens. */
  body[data-theme="black"] #qa-money-in{ background:var(--credit); }
  /* Round 3 briefly capped these to 180px on desktop so the solid green/red pair wouldn't occupy
     as much area as the wide desktop card gave them - round 4 reverses that: the cap left dead
     space and unbalanced the Net Balance card, so both buttons fill the card width as an equal
     pair on every breakpoint again, exactly as they did before round 3 (colours unchanged). */
  body[data-theme="black"] .spine{ background:rgba(18,18,18,.9); border-right-color:var(--line); }
  body[data-theme="black"] .bottom-nav{ background:rgba(18,18,18,.9); border-top-color:var(--line); }
  body[data-theme="black"] .topbar{ background:rgba(0,0,0,.82); border-bottom-color:var(--line); }
  body[data-theme="black"] .icon-circle{ background:rgba(28,28,28,.85); border-color:rgba(255,255,255,.08); }
  body[data-theme="black"] .card-glass{ background:rgba(28,28,28,.6); border-color:rgba(255,255,255,.08); }
  body[data-theme="black"] .stamp-overlay .stamp{ background:rgba(0,0,0,.82); }
  body[data-theme="black"] .data-table tr:hover{ background:rgba(255,255,255,.04); }
  /* #backup-nag-banner's border is a hardcoded rgba(245,158,11,...) amber INLINE style in
     index.html itself (shared markup, not a per-theme CSS rule - every other theme shows this
     same amber too), the one hardcoded hue found anywhere in the app chrome that Black's
     screenshots actually surface. Every other theme keeps it (out of scope - not a Black-specific
     rule to touch there), but under Black's "no hues anywhere" requirement this needed a theme
     override - and needs !important specifically, because an inline style="border:..." always
     beats an external stylesheet selector regardless of specificity (confirmed the hard way on
     this exact element type before - see the retired Webline "Reduce Animations" row's own
     history for the same lesson). */
  body[data-theme="black"] #backup-nag-banner{ border-color:rgba(255,255,255,.25) !important; }
  /* Same class of hardcoded-hue leak as the banner above, but in CSS this time rather than an
     inline style: these badges pair a THEME-REACTIVE text colour (var(--credit)/--debit/--gold)
     with a HARDCODED translucent rgba(22,163,74/220,38,38/245,158,11,...) background tint that
     never changes per theme. Round 1 (pure monochrome) neutralized these to plain white/grey
     tints; round 2 tints them to actually match the now-real credit/debit/warning colours the
     text itself uses, instead of leaving a mismatched grey tint under coloured text. */
  body[data-theme="black"] .txdetail-badge.credit,
  body[data-theme="black"] .schedule-status.paid{ background:rgba(63,185,80,.16); }
  body[data-theme="black"] .txdetail-badge.debit,
  body[data-theme="black"] .schedule-status.overdue,
  body[data-theme="black"] .reminder-status.overdue{ background:rgba(248,81,73,.16); }
  body[data-theme="black"] .reminder-status.upcoming{ background:rgba(210,153,34,.18); }
  body[data-theme="black"] .danger-zone{ background:rgba(248,81,73,.06); border-color:rgba(248,81,73,.3); }
  /* 2.2c (round 1): over-budget/overdue/alert states shared var(--debit) with ordinary debit
     text under pure monochrome, so white+underline gave them their own signal. Round 2: colour
     is back and --debit IS red now, so these states get the same red as any other debit/overdue
     figure - the underline workaround is no longer needed and is dropped, matching how a real
     "something needs attention" state reads once red actually means something again. */
  body[data-theme="black"] .budget-row-meta.over,
  body[data-theme="black"] .overdue-tag,
  body[data-theme="black"] .reminder-key-figure.alert{
    color:var(--debit);
  }
  /* Issue 3 (round 3): one settled/pending/neutral rule applied everywhere these figures appear.
     GREEN = settled (Total Paid/Total Received, already var(--credit) inline - unchanged).
     RED = not yet settled (Total Pending, already var(--debit) inline - unchanged; Outstanding
     Debt and Owed to You were previously white and green respectively - the exact "same concept,
     two treatments" inconsistency this fixes).
     WHITE = totals/neutral facts (Total Committed was already unstyled - unchanged; Savings
     Goals was previously var(--goal), a distinct lavender-ish accent, not white).
     #receivable-summary-amount and #goals-summary-amount need !important - both carry an inline
     style="color:..." in index.html (shared markup, read by every theme), which always beats an
     external stylesheet selector regardless of specificity. #debt-summary-amount has no inline
     colour to begin with, so plain specificity is enough for it. */
  body[data-theme="black"] #debt-summary-amount,
  body[data-theme="black"] #receivable-summary-amount{
    color:var(--debit) !important;
  }
  /* Issue 4 (round 4) CORRECTION: round 3 placed Savings Goals in the white/neutral group - wrong,
     this tile shows the amount already saved, which is exactly as "settled" as Total Paid/Total
     Received elsewhere, so it takes the same credit green treatment instead. */
  body[data-theme="black"] #goals-summary-amount{
    color:var(--credit) !important;
  }
  /* Issue 4 (round 4): the Savings Goals page's own overview card had the same saved/remaining
     figures and progress fill all riding on --goal (a neutral lavender/grey accent with no
     settled/pending meaning), rather than the green/red pair used everywhere else. #goalsov-
     total-saved and #goalsov-overall-fill carry inline style="color/background:var(--goal)" in
     index.html (shared markup), hence !important; #goalsov-total-remaining has no inline colour to
     begin with, so plain specificity is enough for it. */
  body[data-theme="black"] #goalsov-total-saved{
    color:var(--credit) !important;
  }
  body[data-theme="black"] #goalsov-total-remaining{
    color:var(--debit);
  }
  body[data-theme="black"] #goalsov-overall-fill{
    background:var(--credit) !important;
  }
  /* Net Balance/Net Worth/Net (Reports) already have a pre-existing, cross-theme .negative rule
     (.balance-amount.negative / .mono-num.negative / .summary-box .mono-num.negative all resolve
     to var(--debit)) that every OTHER theme keeps relying on unchanged. Under Black specifically,
     these three are "totals" per the rule above, not pending/debit figures, and must stay white
     even when the underlying number is negative - overridden by ID, which already outranks the
     class-only base rules on specificity, no !important needed. */
  body[data-theme="black"] #home-balance.negative,
  body[data-theme="black"] #networth-amount.negative,
  body[data-theme="black"] #report-net.negative{
    color:var(--ink);
  }
  /* Issue 1 (round 4) used to override .activity-sub-note's flex-grow here, scoped to Black theme's
     History rows only. That scoping is what let the identical defect keep recurring elsewhere
     (Light/Dark/Crimson's own History, the category-detail popup, global search) for another two
     rounds - the base .activity-sub-note rule itself now carries this fix unconditionally (see its
     own comment), so this override is redundant and removed rather than left as dead, misleading
     weight. */
  body[data-theme="black"] .ledger-form input, body[data-theme="black"] .ledger-form select,
  body[data-theme="black"] .filter-row select, body[data-theme="black"] .search-input,
  body[data-theme="black"] .period-inputs input, body[data-theme="black"] .budget-limit-input input,
  body[data-theme="black"] .log-payment-form input, body[data-theme="black"] .log-payment-form select, body[data-theme="black"] .cat-col form input,
  body[data-theme="black"] .settings-row input, body[data-theme="black"] .btn-outline,
  body[data-theme="black"] .filter-inline-label input,
  body[data-theme="black"] .contribution-form input{
    background:#1C1C1C; border-color:var(--line); color:var(--ink);
  }
  body[data-theme="black"] .more-row, body[data-theme="black"] .summary-box, body[data-theme="black"] .insight-note,
  body[data-theme="black"] .log-payment-form, body[data-theme="black"] .contribution-form{
    background:var(--card);
  }
  body[data-theme="black"] .progress-track, body[data-theme="black"] .breakdown-track,
  body[data-theme="black"] .budget-bar-track, body[data-theme="black"] .debt-bar-track,
  body[data-theme="black"] .goal-bar-track{ background:#1C1C1C; }
  body[data-theme="black"] .ring-period-btn.active,
  body[data-theme="black"] .type-btn.active,
  body[data-theme="black"] .segmented button.active{
    background:#2A2A2A; color:#FFFFFF; box-shadow:var(--shadow-sm);
  }
  body[data-theme="black"] .type-btn.credit.active{ color:var(--credit); }
  body[data-theme="black"] .type-btn.debit.active{ color:var(--debit); }
  body[data-theme="black"] .btn-debit{ color:var(--bg); }
  body[data-theme="black"] .btn-danger{ color:var(--bg); }
  body[data-theme="black"] .bottom-nav .tab-btn.active{ color:var(--binder); }
  /* Inverted-button text flip - see the comment above body[data-theme="black"] for why these
     exist: every one of these hardcodes color:#FFFFFF against background:var(--binder), which is
     now white too. */
  body[data-theme="black"] .btn-black,
  body[data-theme="black"] .spine .tab-btn.active,
  body[data-theme="black"] .bottom-nav .tab-btn.fab,
  body[data-theme="black"] .cat-col form button,
  body[data-theme="black"] .calc-key-op,
  body[data-theme="black"] #calc-fab{
    color:#000000;
  }
  /* Issue 2 (round 5): a fifth instance of the exact same background:var(--binder) + hardcoded
     color:#fff pairing above, missed from the original audit - the "Update available" banner's
     icon circle (#sw-update-banner .update-banner-icon in index.html). Its download glyph is an
     inline SVG (see icon() in js/app.js) drawn with stroke="currentColor", so it inherits
     whatever `color` the circle around it resolves to - under every other theme that's a dark
     --binder circle with a legible white glyph, but under Black, --binder is white too, so the
     glyph was rendering white-on-white: a blank circle, invisible until the banner actually
     appears (which only happens mid-update, easy to miss in screenshot-only verification - this
     is what real-device testing caught). Needs !important: color:#fff is an INLINE style on this
     element in index.html (shared markup, read by every theme), which always beats an external
     stylesheet selector regardless of specificity - the same lesson every other inline-style fix
     in this file has needed. */
  body[data-theme="black"] .update-banner-icon{
    color:#000000 !important;
  }
  /* 2.2a: the +/- sign and a weight difference are the only distinction between credit and
     debit under Black (no colour difference beyond white-vs-grey) - .activity-amt already
     carries the +/- via its own markup and a flat font-weight:700 for both; this drops expense
     rows specifically to 600 so credit reads very slightly heavier, matching the brief exactly. */
  body[data-theme="black"] .activity-amt.expense{ font-weight:600; }
  body[data-theme="black"] .summary-box.debit .mono-num{ font-weight:600; }
  body[data-theme="black"] .mono-num.negative{ font-weight:600; }

  .theme-toggle{ width:46px; height:26px; border-radius:999px; background:var(--line); border:none; position:relative; padding:0; flex-shrink:0; transition:background .15s; }
  .theme-toggle .theme-toggle-thumb{ position:absolute; top:3px; left:3px; width:20px; height:20px; border-radius:50%; background:#fff; box-shadow:var(--shadow-sm); transition:transform .18s; }
  .theme-toggle.on{ background:var(--binder); }
  .theme-toggle.on .theme-toggle-thumb{ transform:translateX(20px); }

  /* ---------- Search overlay ---------- */
  /* Shared by every modal dialog on this class (search, schedule, category/tx/debt/goal detail,
     diagnostics, notifications) - all fixed inset:0, so all touch the physical top edge. The 64px
     clearance was a flat guess that happened to just clear a Dynamic Island's ~59px inset on one
     specific device; env() makes it correct on any device instead of coincidentally close on one. */
  .search-overlay{ position:fixed; inset:0; background:rgba(15,23,42,.45); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px); z-index:300; display:none; align-items:flex-start; justify-content:center; padding:calc(64px + env(safe-area-inset-top)) 16px 20px; opacity:0; transition:opacity var(--anim-duration) var(--anim-ease); }
  /* Lets View Log (normally z-index 300, same as every other .search-overlay) render above the
     login/signup gate (z-index 4000) when opened via the long-press-the-logo shortcut on that
     screen - the one path a signed-out user has to their own diagnostic log, since the rest of
     Install Diagnostics lives behind More -> Profile & Backup, which the auth gate blocks. */
  .search-overlay.above-auth-gate{ z-index:4500; }
  .search-overlay.open{ opacity:1; }
  .search-overlay-inner{ background:var(--card); border-radius:20px; max-width:560px; width:100%; max-height:78vh; box-shadow:var(--shadow); padding:18px; display:flex; flex-direction:column; opacity:0; transform:translateY(18px) scale(.96); transition:opacity var(--anim-duration) var(--anim-ease), transform var(--anim-duration) var(--anim-ease); }
  .search-overlay.open .search-overlay-inner{ opacity:1; transform:translateY(0) scale(1); }
  @media (prefers-reduced-motion: reduce){ .search-overlay, .search-overlay-inner{ transition:none; } }

  /* ---------- App-wide screen/overlay transition standard ----------
     One duration+easing (--anim-duration/--anim-ease, defined in :root above), applied via the
     same .open toggle class the search-overlay above already used (see animateIn()/animateOut()
     and showOverlay()/hideOverlay() in js/app.js) - auth (login/signup/forgot/PIN-reset flows),
     the PIN lock screen, and the update/backup banners were previously raw style.display
     toggles with no transition at all. transform/opacity only, never width/height/top/left. */
  #auth-overlay, #pinlock-overlay{ opacity:0; transition:opacity var(--anim-duration) var(--anim-ease); }
  #auth-overlay.open, #pinlock-overlay.open{ opacity:1; }
  /* Horizontal centering lives here now, not as a separate inline transform on the element - only
     one `transform` declaration can ever win for a given element, so splitting the centering
     (inline) from the show/hide slide (here) silently dropped the slide entirely: the inline
     transform always took precedence, leaving this rule's translateY component with no effect
     regardless of the .open class (confirmed directly - computed transform was identical with
     and without .open). Combining both axes in one place is what actually makes both work. */
  #sw-update-banner{ opacity:0; transform:translateX(-50%) translateY(8px); transition:opacity var(--anim-duration) var(--anim-ease), transform var(--anim-duration) var(--anim-ease); }
  #sw-update-banner.open{ opacity:1; transform:translateX(-50%) translateY(0); }
  /* backup-nag-banner is a normal in-flow block (not fixed-position like the banner above), so
     only opacity is animated - transitioning height/margin to smooth its insertion into the
     layout would mean animating a layout-triggering property, which is exactly what this
     standard avoids for performance. */
  #backup-nag-banner{ opacity:0; transition:opacity var(--anim-duration) var(--anim-ease); }
  #backup-nag-banner.open{ opacity:1; }
  #loading-overlay{ transition:opacity var(--anim-duration) ease; }
  /* Applied programmatically (reTriggerFade() in js/app.js) to replay this fade whenever a
     view's CONTENT changes without the element's own display toggling doing it automatically -
     confirmed by direct testing that a plain display:none -> flex swap does NOT restart an
     animation already sitting on an element via a class that's never added/removed, so this
     needs an actual class toggle (remove + forced reflow + re-add) each time, not just a static
     rule. Used for the auth overlay's login/forgot/code/done steps and the PIN-lock screen's
     title/subtitle across mode changes. */
  .view-fade-retrigger{ animation: viewFadeIn var(--anim-duration) var(--anim-ease); }
  @media (prefers-reduced-motion: reduce){
    #auth-overlay, #pinlock-overlay, #sw-update-banner, #backup-nag-banner, #loading-overlay, .views{ transition:none; }
    .view-fade-retrigger{ animation:none; }
  }
  .search-overlay-header{ display:flex; align-items:center; gap:10px; margin-bottom:14px; flex-shrink:0; }
  /* overflow-x explicitly set (not left to default) on purpose: per the CSS overflow spec, when
     one axis is a non-'visible' value (overflow-y:auto here) and the other is left at its default
     'visible', the browser is required to instead compute the other axis as 'auto' too - it can't
     leave one axis clipping-capable and the other genuinely unclipped. That silently turned this
     into overflow-x:auto, and every one of this class's several popups (category detail, schedule,
     notifications, search, transaction/debt/goal detail) has some row content that overflows its
     container by a few sub-pixels (nowrap text, badge+amount rows at the container's exact width),
     which was enough to trigger a permanent horizontal scrollbar with nothing genuinely meant to
     scroll sideways. None of these popups have any content that's actually supposed to scroll
     horizontally, so this is hidden outright rather than auto. */
  .search-overlay-body{ overflow-y:auto; overflow-x:hidden; -webkit-overflow-scrolling:touch; }
  .schedule-row{ padding:11px 4px; border-bottom:1px solid var(--bg); }

  .txdetail-hero{ text-align:center; padding:18px 0 20px; border-bottom:1px solid var(--line); margin-bottom:6px; }
  .txdetail-badge{ display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; padding:5px 12px; border-radius:999px; margin-bottom:12px; }
  .txdetail-badge.credit{ background:rgba(22,163,74,.12); color:var(--credit); }
  .txdetail-badge.debit{ background:rgba(220,38,38,.12); color:var(--debit); }
  .txdetail-amount{ font-size:32px; font-weight:800; color:var(--ink); margin-bottom:6px; }
  .txdetail-category{ font-size:13.5px; color:var(--ink-soft); font-weight:600; }
  .txdetail-fields{ padding-top:8px; }
  .txdetail-field{ display:flex; justify-content:space-between; align-items:flex-start; gap:14px; padding:12px 4px; border-bottom:1px solid var(--bg); }
  .txdetail-field:last-child{ border-bottom:none; }
  .txdetail-field-label{ font-size:12px; color:var(--ink-soft); font-weight:600; flex-shrink:0; }
  .txdetail-field-value{ font-size:13.5px; font-weight:600; color:var(--ink); text-align:right; }
  .schedule-row:last-child{ border-bottom:none; }
  .schedule-row-top{ display:flex; justify-content:space-between; align-items:center; gap:8px; }
  .schedule-row-left{ display:flex; align-items:center; gap:10px; min-width:0; }
  .schedule-no{ width:26px; height:26px; border-radius:50%; background:var(--bg); color:var(--ink-soft); font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
  .schedule-due{ font-size:12.5px; font-weight:600; }
  .schedule-amt{ font-size:12px; font-weight:700; color:var(--ink-soft); margin-top:1px; }
  .schedule-status{ font-size:10.5px; font-weight:700; padding:3px 9px; border-radius:999px; flex-shrink:0; white-space:nowrap; }
  .schedule-status.paid{ background:rgba(22,163,74,.12); color:var(--credit); }
  .schedule-status.overdue{ background:rgba(220,38,38,.12); color:var(--debit); }
  .schedule-status.upcoming{ background:var(--bg); color:var(--ink-soft); }
  .schedule-meta{ font-size:11px; color:var(--ink-soft); font-weight:600; margin-top:6px; padding-left:36px; }
  /* Empty on upcoming/overdue rows (always rendered now so the desktop grid below can reserve
     its space) - collapses to nothing here on mobile, same as when the div wasn't rendered at
     all, since mobile's single-column list has no side-by-side row to look mismatched against. */
  .schedule-meta:empty{ display:none; }

  /* Mobile: the native scrollbar here was showing at rest and only hiding once scrolled to an
     edge - backwards from the usual "invisible until actively scrolling" expectation. The thumb
     color is driven entirely by the --schedule-thumb-color custom property, which
     bindScheduleScrollFade() in js/app.js writes directly (var(--line) while scrolling, then a
     manual rAF-driven fade through partial-alpha values back to transparent once scrolling
     stops) - NOT a CSS transition/opacity change on the pseudo-element itself. Real-device
     testing found neither reliably animates there: a background-color transition just snaps
     instantly, and opacity was outright ignored, permanently showing the thumb regardless of
     state (Android renders this thumb as its own compositor overlay layer that doesn't run
     through the usual transition/opacity pipeline). A plain background-color VALUE change does
     correctly repaint it, which is what the JS fade relies on. webkit-only deliberately: mobile
     here means Chrome/Android, which renders scrollbars via these pseudo-elements, not the
     standard scrollbar-width/scrollbar-color properties - setting both at once (an earlier
     version of this fix did) left a stray gutter/line artifact on real devices even outside the
     schedule overlay, since the two styling systems don't always coexist cleanly. Overridden
     below for desktop, which keeps its own always-visible slim scrollbar (and does use
     scrollbar-color, for Firefox). */
  #schedule-overlay .search-overlay-body::-webkit-scrollbar{ width:6px; }
  #schedule-overlay .search-overlay-body::-webkit-scrollbar-track{ background:transparent; }
  #schedule-overlay .search-overlay-body::-webkit-scrollbar-thumb{ background:var(--schedule-thumb-color, transparent); border-radius:999px; }

  /* Desktop-only: the mobile single-column list gets a narrow, heavily-visible native
     scrollbar once there are more than a handful of installments. On wide screens there's
     room to lay rows out two-up (fewer inner scrolls needed) and to give any scrolling
     that remains a slim, custom-styled scrollbar instead of the stock OS one. Mobile is
     untouched — everything here lives behind the same 781px breakpoint as the rest of
     the desktop layout work. */
  @media (min-width:781px){
    #schedule-overlay .search-overlay-inner{ max-width:760px; }
    #schedule-list{ display:grid; grid-template-columns:1fr 1fr; gap:2px 24px; align-content:start; }
    #schedule-overlay .schedule-row{ border-bottom:none; background:var(--bg); border-radius:12px; padding:11px 14px; margin-bottom:8px; }
    /* Paid rows show a 3rd line (paid-on date/time) that upcoming/overdue rows don't, which
       otherwise left 2-line and 3-line cards visibly mismatched side-by-side in this 2-column
       grid. Reserving the same space here whether or not there's text to show keeps every card
       in the grid the same shape regardless of status. */
    #schedule-overlay .schedule-meta:empty{ display:block; min-height:1em; }
    #schedule-overlay .search-overlay-body{ scrollbar-width:thin; scrollbar-color:var(--line) transparent; }
    #schedule-overlay .search-overlay-body::-webkit-scrollbar{ width:8px; }
    #schedule-overlay .search-overlay-body::-webkit-scrollbar-track{ background:transparent; }
    #schedule-overlay .search-overlay-body::-webkit-scrollbar-thumb{ background:var(--line); border-radius:999px; }
    #schedule-overlay .search-overlay-body::-webkit-scrollbar-thumb:hover{ background:var(--ink-soft); }
  }

  /* ---------- Recurring quick-add ---------- */
  .recurring-chips{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:18px; }
  .recurring-chip{ display:flex; align-items:center; gap:7px; background:var(--bg); border:1.5px solid var(--line); border-radius:999px; padding:8px 10px 8px 6px; font-size:12.5px; font-weight:600; color:var(--ink); }
  .recurring-chip .chip-badge{ width:22px; height:22px; border-radius:50%; color:var(--avatar-letter); font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
  .recurring-chip .chip-del{ color:var(--ink-soft); font-weight:800; padding:0 2px; border-radius:50%; }
  .recurring-chip .chip-del:hover{ color:var(--debit); }
  .save-recurring-row{ display:flex; align-items:center; gap:8px; margin:-6px 0 16px; font-size:12.5px; color:var(--ink-soft); font-weight:600; }
  .save-recurring-row input[type="checkbox"]{ width:16px; height:16px; accent-color:var(--binder); }

  /* ---------- Net worth ---------- */
  .networth-row{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; padding-top:12px; margin-top:4px; border-top:1px solid var(--line); }
  .networth-row .card-label{ font-size:11px; line-height:1.4; padding-top:2px; }
  .networth-row .mono-num{ line-height:1.4; flex-shrink:0; }

  /* ---------- Reminders ---------- */
  .reminder-card{ background:var(--bg); border-radius:16px; padding:14px 16px; margin-bottom:12px; }
  .reminder-card-top{ display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
  .reminder-name{ font-weight:600; font-size:12.5px; color:var(--ink-soft); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  /* The key figure (the number that actually matters - how far over budget, how many overdue,
     when something's due) used to be buried mid-sentence in .reminder-meta ("Rs1,200.00 of
     Rs100.00 — over by Rs1,100.00"), the same "everything on one run-on line" problem already
     fixed elsewhere in this app (see History's row redesign). Mirrors the size/weight
     relationship .txdetail-amount/.txdetail-category already use in the transaction detail
     overlay - one big, unmissable primary figure, with the category/title now demoted to a small
     label above it instead of competing for attention as the biggest text in the card. */
  .reminder-key-figure{ font-size:18px; font-weight:800; margin-top:2px; }
  .reminder-key-figure.alert{ color:var(--debit); }
  .reminder-meta{ font-size:11.5px; color:var(--ink-soft); font-weight:600; margin-top:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  /* Explicit 44x44 tap target (WCAG's minimum), not left to the glyph's own small rendered box -
     the previous version was maybe 22x19px in practice (18px font + 2px/4px padding). */
  .alert-dismiss-btn{ background:none; border:none; color:var(--ink-soft); font-size:18px; line-height:1; width:44px; height:44px; display:flex; align-items:center; justify-content:center; flex-shrink:0; cursor:pointer; margin:-10px -10px 0 0; }
  .alert-dismiss-btn:hover{ color:var(--ink); }
  .reminder-status{ font-size:11px; font-weight:700; padding:3px 9px; border-radius:999px; flex-shrink:0; }
  .reminder-status.overdue{ background:rgba(220,38,38,.12); color:var(--debit); }
  .reminder-status.upcoming{ background:rgba(245,158,11,.14); color:var(--gold); }
  .reminder-actions{ display:flex; gap:8px; margin-top:10px; }

  /* ---------- Add Entry desktop side panel ---------- */
  .add-entry-main{ min-width:0; }
  @media (min-width:781px){
    .add-entry-layout{ display:flex; align-items:flex-start; gap:26px; }
    .add-entry-main{ flex:1 1 480px; max-width:480px; }
    .add-entry-side{ flex:1 1 380px; min-width:0; }
  }

  @media (max-width:780px){
    body{ flex-direction:column; }
    .spine{ display:none; }
    .bottom-nav{ display:flex; }
    main{ padding-bottom:0; }
    /* CORRECTION: the previous round reduced this from 90px to 50px (matching desktop's own
       base value) reasoning that the old fixed-nav clearance was no longer needed - true, but
       desktop's 50px was never nav-related in the first place (desktop has no bottom-nav at all,
       display:none there - it was always just that card's own breathing room). Copying it to
       mobile left a real, measured 50px of dead air between the last row and the nav on a real
       device (confirmed via the Layout Diagnostics tool: GAP A = .views bottom minus last-child
       bottom = ~50px on both iOS and Android). Reduced to match the same 16px already used for
       this breakpoint's left/right padding - real, deliberate breathing room, not a nav-clearance
       leftover with nothing left to clear. */
    .views{ padding:0 16px 16px; --views-base-pb:16px; }
    /* Must keep the env(safe-area-inset-top) term from the base .topbar rule above - this media
       query used to overwrite it outright with a flat 16px 16px, silently discarding the inset
       on every phone-width screen (<=780px is every phone, not just some), which is exactly where
       the standalone-iOS status-bar collision this fixes actually happens. */
    .topbar{ margin:0 -16px; padding:calc(16px + env(safe-area-inset-top)) 16px 16px; }
    .grid-2x2{ grid-template-columns:1fr; }
    .cat-columns{ flex-direction:column; }
    .report-summary{ grid-template-columns:1fr; }
    .debt-overview-grid{ grid-template-columns:1fr; }
  }

  #app-toast{
    /* bottom is set dynamically in JS (positionAboveBottomNav() in js/app.js), measuring the
       bottom-nav's ACTUAL rendered top edge (mobile) so this always docks just above it, or a
       flat margin from the viewport bottom on desktop where there's no bottom-nav. Anchored to
       the BOTTOM of the viewport rather than pushed down from the topbar - a top-anchored toast
       can only avoid overlapping content by reserving space in the scrollable area right where it
       first appears, and that reservation only ever affects whatever's at the very TOP of that
       area. If the page is scrolled anywhere else, the toast still sits directly over whatever
       content is currently there regardless of the reservation - confirmed directly: it
       overlapped the Restore Backup/Reset Everything buttons on a scrolled More page. The zone
       just above the bottom-nav never has scrollable page content rendered there no matter the
       scroll position, so there's nothing left for it to overlap. This value is only a fallback
       for the brief instant before that JS runs. */
    position:fixed; left:50%; bottom:calc(80px + env(safe-area-inset-bottom)); z-index:5000;
    /* A flat pixel offset, not a percentage of the toast's own height - same reasoning as the
       previous top-anchored version, just mirrored: once "bottom" itself became a JS-measured
       value rather than a constant, a percentage-based hidden position no longer reliably
       cleared the viewport for every message length. */
    transform:translateX(-50%) translateY(160px);
    display:flex; align-items:center; gap:12px; background:var(--debit); color:#fff;
    padding:12px 16px; border-radius:14px; box-shadow:var(--shadow); font-size:13.5px; font-weight:600;
    /* Hugs its own content instead of a fixed near-full-width box - a short message (e.g. "PIN
       reset — you're back in.") was leaving visibly empty space, since every toast used to claim
       the same width regardless of how little text it actually had. width:max-content sizes it to
       its content, up to max-width as a cap so a genuinely long message still wraps sensibly
       instead of stretching edge-to-edge or overflowing the viewport.
       max-width previously read calc(100vw - 32px) - plain 100vw, with no inset awareness at all,
       on an element whose OWN vertical position one line up is already inset-aware
       (env(safe-area-inset-bottom)). With viewport-fit=cover, 100vw is defined to stay pinned to
       the full physical width regardless of any cutout/inset - it will not itself desync under a
       transient inset change. But this element's bottom offset DOES move with insets, and if a
       cutout-driven reflow ever changes how much of that 100vw is actually usable on either side
       (a curved-edge display, a landscape safe area, or the OS briefly resizing the WebView's own
       content area for a heads-up system overlay - unconfirmed without a real device or display
       cutout, which nothing in this repo's test tooling can emulate), a width computed with no
       inset offset at all is left with no way to account for it, while this element's own
       position already does. Subtracting BOTH left/right insets from the width calculation ties
       it to the exact same inset values the position already depends on, so the two can only ever
       move together - not a guess at what the real desync mechanism is, just removing the one
       asymmetry that's visible in the CSS regardless of what turns out to be causing it. */
    transition:transform var(--anim-duration) var(--anim-ease); width:max-content; max-width:min(420px, calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 32px));
  }
  @media (prefers-reduced-motion: reduce){ #app-toast{ transition:none; } }
  #app-toast.show{ transform:translateX(-50%) translateY(0); }
  #app-toast.info{ background:var(--binder); }
  #app-toast-close{ background:none; border:none; color:#fff; opacity:.8; font-size:18px; line-height:1; padding:0; flex-shrink:0; }
  #app-toast-close:hover{ opacity:1; }
