  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&display=swap');

  :root {
    /* ── Ledger palette ── one teal hue family carries the whole app;
       amber is reserved for "carried forward from a previous shift"
       values; red is reserved for genuine deficits/destructive actions
       only, so it keeps its alarm value instead of being diluted.
       Every color used anywhere in this app should trace back to a
       token below — no one-off hex values in component rules. */
    --teal:        #0D8C78;
    --teal-dark:   #0A5147;
    --teal-light:  #D8F0EA;
    --teal-pale:   #F1FAF8;
    --navy:        #0E241F;
    --navy-light:  #16323F;  /* only for dark hero gradients, never flat text/bg */
    --slate:       #3B4B44;
    --muted:       #63726C;  /* darkened from #7C8B85 — that failed WCAG AA (3.6:1) on white; this hits 5.1:1 */
    --border:      #E1E6E1;
    --border-strong: #C3CCC5;  /* bolder cell/table-line border for ledger grids */
    --surface:     #F5F6F3;
    --paper-dim:   #EBEEEA;
    --white:       #ffffff;
    --red:         #B23A2C;
    --red-dark:    #7A2B20;
    --red-pale:    #F8E2DC;
    --amber:       #B9660F;
    --amber-dark:  #8A5410;  /* for amber-on-pale text; #B9660F alone only hits 3.45:1 */
    --amber-pale:  #F7E6CE;
    --green:       #1D7A46;
    --green-dark:  #15803D;
    --green-pale:  #E3F4E9;
    --blue:        #1F4E93;
    --blue-pale:   #E4EBFA;

    /* ── Dark-surface variants ── the sync card, sidebar, and any other
       panel with a navy/teal-dark background reuse this trio instead of
       inventing new hex values per component. */
    --on-dark-primary:   #E2E8F0;
    --on-dark-secondary: #94A3B8;
    --status-ok:   #4ADE80;
    --status-warn: #FBBF24;
    --status-bad:  #F87171;

    /* ── Shift identity dots ── deliberately outside the semantic
       system: these mark which of the 3 daily shifts a record belongs
       to (Night/Morning/Evening), a category label rather than a
       status, so a categorical (not tonal) distinction is appropriate. */
    --shift-night:   #6366F1;
    --shift-morning: var(--amber);
    --shift-evening: #F97316;

    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
    --shadow-md:   0 4px 12px rgba(0,0,0,.10);
    --shadow-lg:   0 8px 24px rgba(0,0,0,.12);
  }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--surface);
    min-height: 100vh;
    padding: 16px 8px 40px;
    color: var(--navy);
    line-height: 1.5;
  }

  .hidden { display: none !important; }

  /* ── SHELL ── */
  .shell {
    max-width: 680px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }

  /* ── APP HEADER BAR ── */
  .app-bar {
    background: linear-gradient(135deg, var(--navy) 0%, var(--teal-dark) 100%);
    padding: 20px 24px 18px;
    display: flex; align-items: center; gap: 14px;
  }
  .app-bar-icon {
    width: 42px; height: 42px; border-radius: var(--radius-md);
    background: var(--teal); display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0;
  }
  .app-bar-text h1 { font-size: 1.1rem; font-weight: 800; color: var(--white); letter-spacing: -.3px; }
  .app-bar-text p  { font-size: 0.75rem; color: var(--on-dark-secondary); font-weight: 500; margin-top: 2px; }

  /* ── PAGE BODY PADDING ── */
  .page-body { padding: 20px 20px 28px; }

  /* ── SECTION CARD ── */
  .card {
    background: var(--white);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }
  .card-head {
    padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1.5px solid var(--border-strong);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
    transition: background .12s;
  }
  .card-head:hover { background: var(--surface); }
  .card-head h3 {
    font-size: 0.8rem; font-weight: 700; color: var(--slate);
    text-transform: uppercase; letter-spacing: .6px;
    display: flex; align-items: center; gap: 8px;
  }
  .card-head h3 .step {
    background: var(--teal); color: var(--white); font-size: 0.65rem; font-weight: 700;
    padding: 2px 7px; border-radius: 20px; letter-spacing: 0;
    text-transform: none;
  }
  .card-head-right { display: flex; align-items: center; gap: 8px; }
  .card-total-badge {
    font-size: 0.75rem; font-weight: 700; color: var(--teal-dark);
    background: var(--teal-light); padding: 2px 8px; border-radius: 20px;
    font-family: 'JetBrains Mono', monospace;
    display: none;
  }
  .card.collapsed .card-total-badge { display: inline-flex; }
  .collapse-icon { font-size: 0.7rem; color: var(--muted); transition: transform .2s; }
  .card.collapsed .collapse-icon { transform: rotate(-90deg); }
  .card-body { padding: 4px 0; }
  .card.collapsed .card-body,
  .card.collapsed .strips-header,
  .card.collapsed .divider,
  .card.collapsed .add-row-btn-wrap { display: none !important; }

  /* ── ROWS ──
     Each row is a bordered "cell" in the ledger grid. Borders are kept
     slightly darker/bolder than the ambient --border tone so the grid
     of cells reads clearly at a glance, on screen and on print. */
  .row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 16px;
    border: 1px solid var(--border-strong, var(--border)); border-bottom: none;
    font-size: 0.85rem; transition: background .12s, box-shadow .12s;
  }
  .row:last-child { border-bottom: 1px solid var(--border-strong, var(--border)); }
  /* Computed/subtotal rows get a bold double rule above them — the
     classic ledger cue that "this cell is a total, not raw input". */
  .row.computed {
    border-top: 3px double var(--slate);
  }
  .row:hover { background: var(--teal-pale); }
  /* Highlight the row that currently has keyboard/tap focus inside it */
  .row:focus-within {
    background: var(--teal-pale);
    border-color: var(--teal);
    box-shadow: inset 3px 0 0 0 var(--teal-dark);
    position: relative;
    z-index: 1;
  }
  .row label, .row .row-lbl {
    font-weight: 500; color: var(--slate); flex: 1; padding-right: 10px;
    font-size: 0.85rem;
  }
  .row input[type="number"],
  .row input[type="text"],
  .row select {
    padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.85rem; color: var(--navy); background: var(--surface);
    transition: border-color .15s, box-shadow .15s; width: 120px; text-align: right;
    font-family: 'JetBrains Mono', monospace; font-weight: 600;
  }
  .row input[type="text"] { text-align: left; font-family: 'Inter', sans-serif; font-weight: 500; }
  .row input:focus, .row select:focus {
    outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,148,136,.15);
    background: var(--white);
  }
  .row input[readonly] { background: var(--surface) !important; cursor: default; color: var(--slate); }

  /* tap-to-fill highlight */
  .row input[type="number"]:not([readonly]) {
    cursor: text;
  }
  .row input[type="number"]:not([readonly]):hover {
    border-color: var(--teal); background: var(--white);
  }

  /* ── ROW VARIANTS ── */
  .row.computed { background: var(--surface); }
  .row.computed input[readonly] { background: var(--paper-dim, #EBEEEA) !important; font-weight: 700; color: var(--navy); }
  .row.highlight-blue { background: var(--blue-pale); }
  .row.highlight-blue label, .row.highlight-blue .row-lbl { color: var(--blue); font-weight: 700; }
  .row.highlight-blue input { background: var(--blue-pale) !important; color: var(--blue); border-color: var(--blue); }
  .row.highlight-green { background: var(--green-pale); }
  .row.highlight-green label { color: var(--green); font-weight: 700; }
  .row.highlight-green input { background: var(--green-pale) !important; color: var(--green); border-color: var(--green); }
  .row.highlight-red { background: var(--red-pale); }
  .row.highlight-red label { color: var(--red); font-weight: 700; }
  .row.highlight-red input { background: var(--red-pale) !important; color: var(--red); border-color: var(--red); }
  .row.override-on input { background: var(--amber-pale) !important; border-color: var(--amber) !important; color: var(--amber) !important; }

  /* ── Carried forward from a previous shift ──
     These boxes (previous shift's CC, credit, deposits, cash position)
     are the app's most error-prone fields — easy to overlook that
     they're inherited, not fresh input. Giving them a color of their
     own (instead of the same gray as any other computed/readonly box)
     makes that distinction visible at a glance. */
  #box-out-prev-cc, #box-out-curr-cc, #box-out-prev-credit,
  #box-out-prev-dep, #box-out-prev-cash {
    background: var(--amber-pale) !important;
  }
  #box-out-prev-cc label, #box-out-curr-cc label, #box-out-prev-credit label,
  #box-out-prev-dep label, #box-out-prev-cash label {
    color: var(--amber) !important; font-weight: 700;
  }
  #box-out-prev-cc input, #box-out-curr-cc input, #box-out-prev-credit input,
  #box-out-prev-dep input, #box-out-prev-cash input {
    background: var(--amber-pale) !important; border-color: var(--amber) !important;
    color: var(--amber) !important; font-weight: 700 !important;
  }
  /* final-editable rows */
  .row.final-editable input[type="number"] { background: var(--amber-pale) !important; border-color: var(--amber) !important; cursor: pointer; }
  .row.final-editable label { color: var(--amber-dark); }

  /* inline-editable label */
  .row .lbl-input {
    border: none; background: transparent; font-weight: 500; color: var(--slate);
    flex: 1; padding: 4px 0; width: auto; text-align: left; font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
  }
  .row .lbl-input:focus { border-bottom: 1px solid var(--teal); border-radius: 0; box-shadow: none; }

  /* strips 4-col row */
  .strips-header {
    display: flex; padding: 7px 16px; background: var(--surface);
    font-size: 0.72rem; font-weight: 700; color: var(--muted); gap: 6px;
  }
  .strips-header span:first-child { flex: 1; }
  .strips-header span { width: 80px; text-align: right; }
  .row.strip-row { gap: 6px; }

  .strip-group-header {
    padding: 8px 16px 4px; margin-top: 6px;
    font-size: 0.72rem; font-weight: 800; color: var(--teal-dark);
    text-transform: uppercase; letter-spacing: .4px;
    background: var(--teal-pale); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  }
  .strip-group-header:first-child { margin-top: 0; }

  /* Portrait / narrow phones: the item name column was getting crushed
     to the point of being unreadable. Grouped items rely on the group
     header above instead, freeing the row for Price / Qty / Total only. */
  @media (orientation: portrait), (max-width: 480px) {
    .strip-row.grouped .strip-name { display: none; }
    .strip-row.grouped { justify-content: flex-end; }
    .strip-row.grouped .strip-price,
    .strip-row.grouped .strip-qty,
    .strip-row.grouped .strip-line { flex: 1; width: auto; min-width: 0; }
  }
  .row.strip-row .strip-name { flex:1; font-weight:500; color:var(--slate); font-size:.85rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .row.strip-row input { width: 80px; margin: 0; }

  /* three-cell credit row — the two <select>s (Group/Name) need
     flex-basis:0 + min-width:0, not the default "width:auto" content-
     based basis, so they share the row's remaining space and actually
     shrink when needed. Without min-width:0, a <select> refuses to
     shrink below its own content width — the classic flexbox overflow
     trap — which on a narrow phone silently pushed the amount input
     off the row's edge, clipped invisibly by .shell's overflow:hidden
     with no way to scroll to it. The amount input itself (wrapped
     with its ± toggle in an unclassed flex div — see addTierCreditRow
     in components.js) is left fixed-size on purpose: that's the one
     number in this row the user actually needs to read, so it should
     never be the thing that shrinks. */
  .row.three-col { gap: 6px; }
  .row.three-col select { flex: 1 1 0; min-width: 0; text-align: left; font-family: 'Inter', sans-serif; font-weight: 500; }
  .row.three-col > div { flex: 0 0 auto; }

  /* delete row button */
  .del-row-btn {
    background: none; border: none; color: var(--muted); font-size: 1rem;
    cursor: pointer; padding: 0 0 0 6px; line-height: 1; flex-shrink: 0;
  }
  .del-row-btn:hover { color: var(--red); }

  /* ── SOFT-DELETED ROW ──────────────────────────────────────
     A "removed" row (HS / Misc / Aux Credit / Deposit / Aux Strip)
     stays in the DOM instead of vanishing — struck through, dimmed,
     read-only — so it's recoverable via Undo and still visible in
     this shift's own record. It's excluded from totals and from
     carrying forward into the next shift (see calc()/
     buildSheetRecord()/pullPreviousShift() in actions.js). */
  .row.row-deleted {
    background: var(--red-pale);
    border-radius: var(--radius-sm);
  }
  .row.row-deleted input {
    text-decoration: line-through;
    color: var(--red);
    opacity: 0.75;
    background: transparent;
  }
  .row.row-deleted .del-row-btn {
    color: var(--teal-dark);
    font-size: 0.95rem;
  }
  .row.row-deleted .del-row-btn:hover { color: var(--teal); }

  /* add row button strip */
  .add-row-btn-wrap {
    padding: 8px 16px;
    border-top: 1px dashed var(--border);
    background: var(--surface);
  }
  .add-row-btn {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.78rem; font-weight: 600; color: var(--teal-dark);
    background: none; border: 1px dashed var(--teal); border-radius: var(--radius-sm);
    padding: 5px 12px; cursor: pointer; transition: all .15s;
  }
  .add-row-btn:hover { background: var(--teal-pale); }

  /* named account block — per-account multi-entry group (credit section) */
  .named-account-block {
    border-bottom: 1px solid var(--border);
  }
  .named-account-head {
    padding: 8px 16px 2px;
    font-size: 0.82rem; font-weight: 700; color: var(--navy);
  }
  .named-account-rows { display: flex; flex-direction: column; }
  .named-account-add-wrap { padding: 2px 16px 8px; }
  .add-row-btn-sm { font-size: 0.72rem; padding: 3px 10px; }

  /* credit ledger description suffix */
  .cl-lbl-desc { font-weight: 400; color: var(--muted); font-size: 0.85em; }

  /* ── BUTTONS ── */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: var(--radius-md); border: none;
    font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all .15s;
    font-family: 'Inter', sans-serif; letter-spacing: .2px;
  }
  .btn:active { transform: translateY(1px); }
  .btn-teal  { background: var(--teal); color: var(--white); }
  .btn-teal:hover { background: var(--teal-dark); box-shadow: var(--shadow-md); }
  .btn-navy  { background: var(--navy); color: var(--white); }
  .btn-navy:hover { background: var(--navy-light); box-shadow: var(--shadow-md); }
  .btn-ghost { background: var(--surface); color: var(--slate); border: 1px solid var(--border); }
  .btn-ghost:hover { background: var(--paper-dim); } /* was identical to its base color — no tap feedback */
  .btn-green { background: var(--green); color: var(--white); }
  .btn-green:hover { background: var(--green-dark); box-shadow: var(--shadow-md); }
  .btn-red   { background: var(--red); color: var(--white); }
  .btn-red:hover { background: var(--red-dark); }
  .btn-full  { width: 100%; }
  .btn-sm    { padding: 5px 12px; font-size: 0.78rem; border-radius: var(--radius-sm); }
  .btn-nav   { background: var(--border); color: var(--slate); padding: 7px 14px; border-radius: var(--radius-sm); font-size:0.8rem; }
  .btn-nav:hover { background: var(--paper-dim); }

  /* ── BUTTON ROWS ── */
  .btn-row { display: flex; gap: 10px; margin-bottom: 16px; }
  .btn-row .btn { flex: 1; }

  /* ── FORMS ── */
  .form-field { margin-bottom: 14px; }
  .form-field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--slate); margin-bottom: 5px; }
  .form-field input, .form-field select {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 0.9rem; color: var(--navy); background: var(--surface); transition: border-color .15s;
    font-family: 'Inter', sans-serif;
  }
  .form-field input:focus, .form-field select:focus {
    outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,148,136,.15); background: var(--white);
  }
  .form-row { display: flex; gap: 12px; }
  .form-row .form-field { flex: 1; margin-bottom: 0; }

  /* ── CALENDAR ── */
  .cal-nav { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
  .cal-nav h4 { font-size: 1rem; font-weight: 700; color: var(--navy); }
  .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 0 12px 12px; }
  .cal-day-lbl { font-size: 0.7rem; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
  .cal-cell {
    aspect-ratio: 1; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    padding: 5px 4px 4px; cursor: pointer; border: 1.5px solid transparent; transition: all .12s;
    color: var(--slate); background: var(--surface);
  }
  .cal-cell:hover { background: var(--teal-light); border-color: var(--teal); color: var(--teal-dark); }
  .cal-cell.empty { background: transparent; cursor: default; border: none; }
  .cal-cell.empty:hover { background: transparent; border: none; }
  .cal-cell.today { border-color: var(--teal); background: var(--teal-pale); color: var(--teal-dark); }
  .cal-dots { display: flex; gap: 2px; justify-content: center; }
  .dot { width: 5px; height: 5px; border-radius: 50%; }
  .dot-night   { background: var(--shift-night); }
  .dot-morning { background: var(--amber); }
  .dot-evening { background: var(--shift-evening); }

  /* ── DATE PICKER PANEL ── */
  .date-picker-panel {
    margin: 0 16px 16px; padding: 16px; background: var(--teal-pale);
    border: 1.5px solid var(--teal); border-radius: var(--radius-lg);
  }
  .date-picker-panel h4 { font-size: 0.85rem; font-weight: 700; margin-bottom: 12px; color: var(--teal-dark); }

  /* ── BADGE ── */
  .badge {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  }
  .badge-shift   { background: var(--blue-pale); color: var(--blue); }
  .badge-final   { background: var(--red-pale); color: var(--red); }

  /* ── PAGINATION STRIP ── */
  .pager {
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); padding: 10px 16px; border-bottom: 1px solid var(--border);
  }
  .pager-label { font-size: 0.82rem; font-weight: 700; color: var(--slate); font-family: 'JetBrains Mono', monospace; }

  /* ── SETTINGS SUB-TABS ── */
  .settings-tabs {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
  }
  .settings-tab {
    padding: 7px 13px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--surface); color: var(--slate); font-size: 0.78rem; font-weight: 600;
    font-family: 'Inter', sans-serif; cursor: pointer; transition: background .12s, color .12s, border-color .12s;
    white-space: nowrap;
  }
  .settings-tab:hover { background: var(--surface); }
  .settings-tab.active {
    background: var(--teal); color: var(--white); border-color: var(--teal);
  }

  /* ── LEDGER HEADER ── */
  .ledger-header {
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  }
  .ledger-header h2 { font-size: 1.1rem; font-weight: 800; color: var(--navy); }
  .ledger-header p  { font-size: 0.75rem; color: var(--muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

  /* ── SUMMARY BANNER ── */
  .summary-banner {
    background: linear-gradient(135deg, var(--navy) 0%, var(--teal-dark) 100%);
    border-radius: var(--radius-lg); padding: 20px; margin: 4px 16px 12px;
    box-shadow: var(--shadow-md);
  }
  .banner-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.08);
    font-size: 0.85rem; color: var(--on-dark-secondary);
  }
  .banner-row:last-child {
    border: none; border-top: 3px double rgba(255,255,255,.55);
    padding-top: 14px; font-size: 1.2rem; font-weight: 800; color: var(--white);
  }
  .banner-row .val { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
  .banner-row .val.pos { color: var(--status-ok); }
  .banner-row .val.neg { color: var(--status-bad); }
  .summary-banner-title {
    font-size: 0.78rem; font-weight: 800; color: var(--white);
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px;
  }
  .summary-banner-subtitle {
    font-size: 0.71rem; color: rgba(255,255,255,.6); margin-bottom: 10px;
    line-height: 1.35;
  }
  /* Amber variant — reserved for banners that ALWAYS show the
     period-aggregated ("since last Final") figures, so they're visually
     distinct at a glance from banners whose scope changes with the
     active Shift/Final mode (which keep the default navy/teal look). */
  .summary-banner.summary-banner-amber {
    background: linear-gradient(135deg, #6b4a12 0%, #8a5a10 100%);
  }
  .summary-banner-amber .summary-banner-title { color: #ffe9b8; }
  .summary-banner-amber .banner-row:last-child { color: #ffe9b8; }

  /* ── PRE-DATE TOTAL SUBGROUP (Final Closing, Part 2) ──
     Visually contains the POS/Customers/System-Return breakdown inside a
     single bordered box so it reads as "one deduction with its own math
     shown", not three separate deductions from Net Cash Available. */
  .predate-group {
    background: var(--surface); border: 1px dashed var(--border);
    border-radius: var(--radius); margin: 2px 0 8px; padding: 2px 0 0;
  }
  .predate-group-title {
    font-size: 0.7rem; font-weight: 700; color: var(--muted);
    padding: 6px 16px 2px; text-transform: uppercase; letter-spacing: .3px;
  }
  .predate-subrow { padding-left: 28px; }
  .predate-subrow label { font-size: 0.82rem; }
  .predate-subtotal {
    border-top: 1px dashed var(--border); margin-top: 2px;
  }

  /* ── SUMMARY CARDS ── */
  .shift-summary-card { padding: 16px; }
  .shift-summary-card .card-title {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
    padding-bottom: 10px; border-bottom: 1px solid var(--border);
  }
  .shift-summary-card .card-title h4 { font-size: 0.9rem; font-weight: 700; color: var(--teal-dark); }
  .mini-stats { display: flex; gap: 8px; }
  .mini-stat { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 8px; text-align: center; }
  .mini-stat h5 { font-size: 0.7rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }
  .mini-stat p  { font-size: 0.9rem; font-weight: 700; color: var(--navy); font-family: 'JetBrains Mono', monospace; }

  /* ── SETTINGS LIST ── */
  .settings-item { display: flex; gap: 8px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--border); }
  .settings-item input, .settings-item select { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; font-family: 'Inter', sans-serif; }
  .settings-item input:first-child { flex: 2; }
  .settings-item select { flex: 1.2; min-width: 90px; }
  .settings-item input[type="number"] { width: 90px; text-align: right; font-family: 'JetBrains Mono', monospace; }

  /* ── MANIFEST LIST ── */
  .manifest-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 16px; border-bottom: 1px solid var(--border); font-size: 0.83rem;
  }
  .manifest-item:last-child { border: none; }
  .manifest-item span { color: var(--slate); font-weight: 500; }
  .manifest-item .key-label { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--navy); }

  /* ── EMPTY STATE ── */
  .empty-state { text-align: center; padding: 24px 16px; color: var(--muted); font-size: 0.85rem; }
  .empty-state span { display: block; font-size: 2rem; margin-bottom: 8px; }

  /* ── NOTICE BOX ── */
  .notice {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--amber-pale); border: 1px solid var(--amber); border-radius: var(--radius-md);
    padding: 10px 14px; font-size: 0.8rem; color: var(--amber-dark); font-weight: 500; margin: 0;
  }
  .notice::before { content: "⚠️"; flex-shrink: 0; }

  /* ── DIVIDER ── */
  .divider { height: 1px; background: var(--border); margin: 8px 0; }

  /* ── MISC STATUS SELECT ── */
  .misc-row { gap: 6px; }
  .misc-row .lbl-input { flex: 2; }
  .misc-row select { width: 110px; text-align: left; font-family: 'Inter', sans-serif; font-size: 0.78rem; font-weight: 500; }
  .misc-row input[type="number"] { width: 90px; }

  /* ── SUMMARY TOTAL BOX ── */
  .total-grid { padding: 4px 0; }

  /* ── UTILITY ── */
  .text-muted { color: var(--muted); }
  .text-sm    { font-size: 0.78rem; }
  .mt-8       { margin-top: 8px; }
  .flex-between { display: flex; justify-content: space-between; align-items: center; }

  /* ═══════════════════════════════════════
     MODAL PICKER OVERLAY (for selects)
  ═══════════════════════════════════════ */
  #modal-picker-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 9998; padding: 20px;
    animation: fadeIn .15s ease;
  }
  .modal-picker-sheet {
    background: var(--white); border-radius: var(--radius-xl);
    width: 100%; max-width: 380px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: popIn .18s ease;
  }
  @keyframes popIn { from { transform: scale(.93); opacity:0; } to { transform: scale(1); opacity:1; } }
  .modal-picker-title {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    font-size: 0.85rem; font-weight: 700; color: var(--slate);
    text-transform: uppercase; letter-spacing: .5px;
    display: flex; justify-content: space-between; align-items: center;
  }
  .modal-picker-list { max-height: 55vh; overflow-y: auto; }
  .modal-picker-item {
    padding: 13px 20px; border-bottom: 1px solid var(--border);
    font-size: 0.9rem; font-weight: 500; cursor: pointer;
    transition: background .1s; display: flex; align-items: center; justify-content: space-between;
    color: var(--navy);
  }
  .modal-picker-item:last-child { border-bottom: none; }
  .modal-picker-item:hover { background: var(--teal-pale); color: var(--teal-dark); }
  .modal-picker-item.selected { background: var(--teal-pale); color: var(--teal-dark); font-weight: 700; }
  .modal-picker-item.selected::after { content: "✓"; color: var(--teal); font-weight: 700; }

  /* ── EDIT MODAL ── */
  #edit-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; padding: 20px;
    animation: fadeIn .15s ease;
  }
  #edit-modal-overlay.hidden { display: none; }
  .edit-modal-sheet {
    background: var(--white); border-radius: var(--radius-xl);
    width: 100%; max-width: 360px;
    box-shadow: var(--shadow-lg); overflow: hidden;
    animation: popIn .18s ease;
  }
  .edit-modal-head {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
  }
  .edit-modal-head h3 { font-size: 0.9rem; font-weight: 700; color: var(--navy); margin: 0; }
  .edit-modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
  .edit-modal-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
  .edit-modal-pin { width: 100%; box-sizing: border-box; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 1rem; font-family: 'JetBrains Mono', monospace; letter-spacing: 4px; text-align: center; }
  .edit-modal-pin:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,140,120,.15); }
  .edit-mode-toggle { display: flex; gap: 0; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .edit-mode-btn { flex: 1; padding: 10px; border: none; background: var(--surface); font-size: 0.85rem; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
  .edit-mode-btn.active-shift { background: var(--navy); color: var(--white); }
  .edit-mode-btn.active-final { background: var(--teal-dark); color: var(--white); }
  .edit-modal-footer { display: flex; gap: 8px; padding: 0 20px 18px; }
  .edit-modal-err { font-size: 0.78rem; color: var(--red); text-align: center; min-height: 16px; }

  /* ── SAVE ACTION SHEET ── */
  #save-action-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 9999; animation: fadeIn .15s ease;
  }
  #save-action-overlay.hidden { display: none; }
  .save-action-sheet {
    background: var(--white); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%; max-width: 480px; padding: 20px 20px 32px;
    box-shadow: var(--shadow-lg);
    animation: slideUp .2s ease;
  }
  @keyframes slideUp { from { transform: translateY(60px); opacity:0; } to { transform: translateY(0); opacity:1; } }
  .save-action-title { font-size: 1rem; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
  .save-action-sub   { font-size: 0.8rem; color: var(--muted); margin-bottom: 18px; }
  .save-action-btns  { display: flex; flex-direction: column; gap: 10px; }
  .save-action-btns .btn { font-size: 0.9rem; padding: 13px; }

  /* ── APP ALERT ── styled stand-in for window.alert(); same bottom-sheet
     language as Save Action so an interruption still feels like part of
     this app, not an OS-level error. Tone only tints the icon chip —
     amber/red stay reserved for their semantic meaning, not the whole sheet,
     so a routine info message never reads as alarming. */
  #app-alert-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 10000; animation: fadeIn .15s ease;
  }
  #app-alert-overlay.hidden { display: none; }
  .app-alert-sheet {
    background: var(--white); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%; max-width: 480px; padding: 24px 20px 28px;
    box-shadow: var(--shadow-lg); text-align: center;
    animation: slideUp .2s ease;
  }
  .app-alert-icon {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; margin: 0 auto 12px; background: var(--teal-light);
  }
  #app-alert-overlay[data-tone="warn"]   .app-alert-icon { background: var(--amber-pale); }
  #app-alert-overlay[data-tone="danger"] .app-alert-icon { background: var(--red-pale); }
  .app-alert-msg {
    font-size: 0.9rem; color: var(--navy); line-height: 1.5;
    margin-bottom: 20px; white-space: pre-line;
  }
  .app-alert-ok { width: 100%; padding: 13px; font-size: 0.9rem; }

  @media (min-width: 480px) {
    #app-alert-overlay { align-items: center; }
    .app-alert-sheet   { border-radius: var(--radius-xl); }
  }

  /* ── APP CONFIRM ── styled stand-in for window.confirm(), reusing the
     same sheet language as APP ALERT so a delete/restore/logout prompt
     still feels like the app asking a question rather than the OS
     throwing up a warning. Cancel sits first (left) and gets initial
     focus — the safe, non-destructive choice is the path of least
     resistance, so a reflexive Enter/tap can't fire a delete. */
  #app-confirm-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 10000; animation: fadeIn .15s ease;
  }
  #app-confirm-overlay.hidden { display: none; }
  #app-confirm-overlay[data-tone="warn"] .app-alert-icon { background: var(--amber-pale); }
  .app-confirm-btn-row { display: flex; gap: 10px; }
  .app-confirm-btn-row .btn { flex: 1; padding: 13px; font-size: 0.9rem; }

  @media (min-width: 480px) {
    #app-confirm-overlay { align-items: center; }
  }

  /* ── PDF MODAL ── */
  #pdf-modal-overlay { position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:9999;padding:20px;animation:fadeIn .15s ease; }
  #pdf-modal-overlay.hidden { display:none; }
  .pdf-modal-sheet { background:var(--white);border-radius:var(--radius-xl);width:100%;max-width:320px;overflow:hidden;box-shadow:var(--shadow-lg);animation:popIn .18s ease; }
  .pdf-modal-head { padding:16px 20px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center; }
  .pdf-modal-head h3 { font-size:0.9rem;font-weight:700;color:var(--navy);margin:0; }
  .pdf-modal-body { padding:18px 20px;display:flex;flex-direction:column;gap:10px; }
  .pdf-modal-body .btn { font-size:0.9rem;padding:13px;display:flex;align-items:center;justify-content:center;gap:8px; }
  #pdf-modal-status { font-size:0.78rem;color:var(--muted);text-align:center;min-height:18px;padding-bottom:4px; }

  /* ── Final mode notice bar ── */
  .final-mode-bar {
    background: linear-gradient(90deg, var(--teal-dark) 0%, var(--teal) 100%);
    padding: 10px 20px; display: flex; align-items: center; gap: 10px;
    font-size: 0.8rem; font-weight: 700; color: var(--white);
  }

  /* ══════════════════════════════════════════════════════════
     PRINT / PDF EXPORT — COMPACT A4 SINGLE PAGE
  ══════════════════════════════════════════════════════════ */
  #print-sheet { display:none; }
  #print-sheet.show { display:block; position:fixed; left:0; top:0; z-index:-1; background:var(--white); }
  .ps-sheet-scope .ps-page {
    width: 794px; height: 1123px;
    background: var(--surface); color: var(--navy);
    font-family: 'Inter', Arial, sans-serif;
    position: relative; overflow: hidden; page-break-after: always; box-sizing: border-box;
  }
  .ps-sheet-scope .ps-page:last-child { page-break-after: auto; }
  .ps-sheet-scope .ps-spine {
    position: absolute; left: 0; top: 0; bottom: 0; width: 20px; background: var(--navy);
  }
  .ps-sheet-scope .ps-spine-final { background: var(--amber-dark); }
  .ps-sheet-scope .ps-spine-label {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%) rotate(-90deg);
    font-family: 'JetBrains Mono', monospace;
    font-size: 7px; letter-spacing: 3px; color: rgba(255,255,255,.4);
    white-space: nowrap; text-transform: uppercase;
  }
  .ps-sheet-scope .ps-spine-ticks { position:absolute; left:0; top:0; bottom:0; width:20px; }
  .ps-sheet-scope .ps-tick { position:absolute; left:4px; width:12px; height:1px; background:rgba(255,255,255,.12); }
  .ps-sheet-scope .ps-content { margin-left: 20px; padding: 10px 14px 6px; }
  .ps-sheet-scope .ps-letterhead {
    display:flex; align-items:center; justify-content:space-between;
    border-bottom: 1.5px solid var(--navy); padding-bottom: 6px; margin-bottom: 7px;
  }
  .ps-sheet-scope .ps-brand h1 {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 15px; font-weight: 600; color: var(--navy);
  }
  .ps-sheet-scope .ps-brand p {
    font-size: 7px; color: var(--muted); letter-spacing: 1.4px; text-transform: uppercase; margin-top: 1px;
  }
  .ps-sheet-scope .ps-doctype { text-align: right; }
  .ps-sheet-scope .ps-doctype .ps-doctype-tag {
    display:inline-block; font-family:'JetBrains Mono',monospace; font-size:7.5px;
    letter-spacing: 2px; text-transform:uppercase; color:var(--white);
    background:var(--teal); padding: 2px 7px; border-radius: 3px;
  }
  .ps-sheet-scope .ps-page-final .ps-doctype .ps-doctype-tag { background:var(--amber-dark); }
  .ps-sheet-scope .ps-doctype .ps-doctype-date { margin-top: 3px; font-size: 8.5px; color: var(--navy); font-weight: 600; }
  .ps-sheet-scope .ps-box {
    background:var(--white); border:1.25px solid var(--border-strong); border-radius: 4px;
    overflow:hidden; margin-bottom: 5px;
  }
  .ps-sheet-scope .ps-box h4 {
    margin:0; padding: 3px 7px; font-size: 7px; font-weight:700;
    text-transform: uppercase; letter-spacing: 1px;
    background: var(--navy); color: var(--surface);
  }
  .ps-sheet-scope .ps-box.ps-box-accent h4 { background:var(--teal); }
  .ps-sheet-scope .ps-box.ps-box-final h4  { background:var(--amber-dark); }
  .ps-sheet-scope .ps-row {
    display:flex; justify-content:space-between; gap: 6px;
    padding: 2px 7px; font-size: 8px;
    border-bottom: 1px solid var(--paper-dim);
  }
  .ps-sheet-scope .ps-row:last-child { border-bottom:none; }
  .ps-sheet-scope .ps-row span:first-child { color:var(--slate); flex:1; }
  .ps-sheet-scope .ps-row span:last-child {
    font-family:'JetBrains Mono',monospace; font-weight:700; color:var(--navy); white-space:nowrap;
  }
  .ps-sheet-scope .ps-row.ps-total {
    background:var(--paper-dim);
    border-top: 2px double var(--navy);
  }
  .ps-sheet-scope .ps-row.ps-total span { color:var(--navy) !important; font-weight:700; }
  .ps-sheet-scope .ps-row.ps-highlight {
    background:var(--teal-pale);
    border-top: 2px double var(--teal-dark); border-bottom:1px solid var(--teal);
  }
  .ps-sheet-scope .ps-row.ps-highlight span { color:var(--teal) !important; font-weight:800; }
  .ps-sheet-scope .ps-row.ps-red { background:var(--red-pale); }
  .ps-sheet-scope .ps-row.ps-red span { color:var(--red) !important; font-weight:700; }
  .ps-sheet-scope .ps-row.ps-minus span:last-child::before { content:'\2212\00A0'; }
  .ps-sheet-scope .ps-row.ps-plus  span:last-child::before { content:'+\00A0'; }
  .ps-sheet-scope .ps-row.ps-empty span:last-child { color:var(--muted); font-weight:500; }
  .ps-sheet-scope .ps-main3 {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: 5px; align-items: start; margin-bottom: 5px;
  }
  .ps-sheet-scope .ps-col { display: flex; flex-direction: column; gap: 5px; }
  .ps-sheet-scope .ps-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:6px; align-items:start; }
  .ps-sheet-scope .ps-hero {
    border-radius: 4px; padding: 8px 12px; margin-top: 4px;
    display:flex; align-items:center; justify-content:space-between;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    border: 2px double rgba(255,255,255,.4);
  }
  .ps-sheet-scope .ps-hero.ps-hero-short { background: linear-gradient(135deg, var(--red-dark) 0%, var(--red) 100%); }
  .ps-sheet-scope .ps-hero .ps-hero-label { font-size:7.5px; letter-spacing:1.4px; text-transform:uppercase; color:rgba(255,255,255,.6); }
  .ps-sheet-scope .ps-hero .ps-hero-val { font-family:'JetBrains Mono',monospace; font-size:18px; font-weight:800; color:var(--white); margin-top:1px; }
  .ps-sheet-scope .ps-hero .ps-hero-sub { text-align:right; font-size:7.5px; color:rgba(255,255,255,.5); max-width:180px; line-height:1.4; }
  .ps-sheet-scope .ps-chiprow { display:flex; gap:4px; flex-wrap:wrap; margin-bottom:6px; }
  .ps-sheet-scope .ps-chip {
    background:var(--white); border:1px solid var(--border); border-radius:20px;
    padding:2px 7px; font-size:8px; font-family:'JetBrains Mono',monospace; color:var(--navy);
  }
  .ps-sheet-scope .ps-foot {
    position:absolute; bottom:6px; left:20px; right:0;
    padding:4px 14px 0; display:flex; justify-content:space-between;
    font-size:7px; color:var(--muted); border-top:1px solid var(--border);
  }
  .ps-sheet-scope .ps-foot-page { font-family:'JetBrains Mono',monospace; }
  /* ── COMPACT LEDGER TOOLBAR ── */
  .ledger-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    background: var(--white); gap: 10px;
  }
  .ledger-toolbar-left {
    display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1;
  }
  .ltb-back {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    width: 34px; height: 34px; font-size: 1rem; cursor: pointer; color: var(--slate);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: all .12s;
  }
  .ltb-back:hover { background: var(--border); }
  .ltb-title {
    font-size: 0.95rem; font-weight: 800; color: var(--navy);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .ltb-meta {
    font-size: 0.7rem; color: var(--muted); margin-top: 1px;
    font-family: 'JetBrains Mono', monospace; white-space: nowrap;
  }
  .ledger-toolbar-right {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  }
  .ltb-icon-btn {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    width: 36px; height: 36px; font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: all .12s; color: var(--slate);
  }
  .ltb-icon-btn:hover { background: var(--teal-pale); border-color: var(--teal); }
  .ltb-icon-btn:active { transform: scale(.92); }
  /* More menu */
  .ltb-more-wrap { position: relative; }
  .ltb-more-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 500;
    background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); min-width: 170px; overflow: hidden;
    animation: popIn .15s ease;
  }
  .ltb-more-menu button {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 11px 14px; background: none; border: none;
    font-size: 0.85rem; font-weight: 500; color: var(--slate); cursor: pointer;
    font-family: 'Inter', sans-serif; border-bottom: 1px solid var(--border);
    transition: background .1s; text-align: left;
  }
  .ltb-more-menu button:last-child { border-bottom: none; }
  .ltb-more-menu button:hover { background: var(--teal-pale); color: var(--teal-dark); }

  /* ── PRINT MODE ── */
  @media print {
    body { padding: 0; background: var(--white); }
    .shell { box-shadow: none; border-radius: 0; }
    #print-sheet { display: block !important; position: static !important; z-index: auto !important; width: 100% !important; }
    #print-sheet .ps-page { page-break-after: always; }
    .view-pane:not(#print-sheet) { display: none !important; }
    .app-bar, .pager, .ledger-header, .btn-row, #pdf-status { display: none !important; }
  }

  /* ── FINAL CLOSING SUMMARY CARD (swipeable carousel) ── */
  .fcs-empty {
    padding: 20px 16px; text-align: center; color: var(--muted); font-size: 0.85rem;
  }
  #fcs-body.hidden, .fcs-empty.hidden { display: none; }
  .fcs-head {
    padding: 12px 16px 4px;
    font-size: 0.8rem; font-weight: 700; color: var(--slate);
    text-transform: uppercase; letter-spacing: .6px;
  }
  .fcs-date {
    padding: 0 16px 10px; font-size: 0.82rem; font-weight: 600; color: var(--navy); cursor: pointer;
  }
  .fcs-viewport { overflow: hidden; touch-action: pan-y; }
  .fcs-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
    background: var(--border-strong); margin: 0 16px 16px; border-radius: var(--radius-md);
    border: 1.5px solid var(--border-strong);
    overflow: hidden; cursor: pointer;
  }
  .fcs-stat {
    background: var(--white); padding: 12px 14px;
    display: flex; flex-direction: column; gap: 4px;
  }
  .fcs-stat-lbl { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
  .fcs-stat-val { font-size: 1rem; font-weight: 800; color: var(--navy); font-family: 'JetBrains Mono', monospace; }

  /* ── CLOUD SYNC CARD ── */
  .sync-card {
    background: linear-gradient(135deg, var(--navy) 0%, var(--teal-dark) 100%);
    border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden;
    box-shadow: var(--shadow-md);
  }
  .sync-card-head {
    padding: 14px 18px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .sync-card-icon {
    width: 36px; height: 36px; border-radius: var(--radius-md);
    background: rgba(13,148,136,.25); display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
  }
  .sync-card-head h3 { font-size: 0.85rem; font-weight: 700; color: var(--white); letter-spacing: .3px; }
  .sync-card-head p  { font-size: 0.7rem; color: var(--on-dark-secondary); margin-top: 1px; }
  .sync-card-body { padding: 16px 18px; }

  /* State A — unlinked */
  .sync-unlinked-text {
    font-size: 0.8rem; color: var(--on-dark-secondary); line-height: 1.6; margin-bottom: 14px;
  }
  .sync-unlinked-text strong { color: var(--on-dark-primary); }
  .btn-cloud-connect {
    /* Shared primary-action color for cloud connect/setup buttons
       (Supabase and Google Drive) — deliberately a plain blue rather
       than an app token, so these read as "connect an outside
       account" rather than a themed in-app action. */
    display: inline-flex; align-items: center; gap: 8px;
    background: #0061ff; color: var(--white); border: none; border-radius: var(--radius-md);
    padding: 11px 20px; font-size: 0.88rem; font-weight: 700; cursor: pointer;
    font-family: 'Inter', sans-serif; transition: all .15s; width: 100%; justify-content: center;
  }
  .btn-cloud-connect:hover { background: #0052d9; box-shadow: 0 4px 14px rgba(0,97,255,.4); }
  .btn-cloud-connect:active { transform: translateY(1px); }

  /* State B — linked */
  .sync-linked-state { display: flex; flex-direction: column; gap: 12px; }
  .sync-connected-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(22,163,74,.15); border: 1px solid rgba(22,163,74,.3);
    border-radius: 20px; padding: 5px 12px;
    font-size: 0.75rem; font-weight: 700; color: var(--status-ok);
  }
  .sync-connected-badge .sync-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--status-ok);
    box-shadow: 0 0 6px var(--status-ok); animation: syncPulse 2s infinite;
  }
  @keyframes syncPulse {
    0%, 100% { opacity: 1; } 50% { opacity: .4; }
  }
  .sync-status-line {
    font-size: 0.75rem; color: var(--on-dark-secondary); font-family: 'JetBrains Mono', monospace;
    background: rgba(255,255,255,.05); border-radius: var(--radius-sm);
    padding: 7px 10px; border: 1px solid rgba(255,255,255,.07);
    min-height: 32px; display: flex; align-items: center; gap: 6px;
  }
  .sync-status-line.status-ok     { color: var(--status-ok); border-color: rgba(74,222,128,.2); }
  .sync-status-line.status-busy   { color: var(--status-warn); border-color: rgba(251,191,36,.2); }
  .sync-status-line.status-error  { color: var(--status-bad); border-color: rgba(248,113,113,.2); }
  .sync-btn-row { display: flex; gap: 8px; }
  .btn-sync-action {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
    color: var(--on-dark-primary); border-radius: var(--radius-md); padding: 9px 10px;
    font-size: 0.8rem; font-weight: 600; cursor: pointer; font-family: 'Inter', sans-serif;
    transition: all .15s;
  }
  .btn-sync-action:hover { background: rgba(13,148,136,.2); border-color: var(--teal); color: var(--white); }
  .btn-sync-action:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
  .btn-sync-disconnect {
    background: none; border: 1px solid rgba(248,113,113,.3);
    color: var(--status-bad); border-radius: var(--radius-md); padding: 8px 14px;
    font-size: 0.75rem; font-weight: 600; cursor: pointer; font-family: 'Inter', sans-serif;
    width: 100%; transition: all .15s; margin-top: 2px;
  }
  .btn-sync-disconnect:hover { background: rgba(248,113,113,.1); border-color: var(--status-bad); }
  .sync-spinner { display: inline-block; animation: spin .7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── SYNC MINI TOP STATUS BAR ── */
  #sync-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9999;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.2px;
    transition: background 0.25s;
  }
  #sync-topbar.tb-show  { display: flex; }
  #sync-topbar.tb-ok    { background: rgba(5,150,105,0.94); color: var(--white); }
  #sync-topbar.tb-busy  { background: rgba(217,119,6,0.94); color: var(--white); }
  #sync-topbar.tb-error { background: rgba(220,38,38,0.94); color: var(--white); }
  .tb-spin { display: inline-block; animation: spin .7s linear infinite; }
  body.topbar-on { padding-top: 46px; }

  /* ═══════════════════════════════════════════
     CREDIT LEDGER TAB
  ═══════════════════════════════════════════ */
  #page-credit-ledger .page-body { padding: 12px 14px 32px; max-width: 680px; margin: 0 auto; }

  .cl-toolbar {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 14px; flex-wrap: wrap;
  }
  .cl-toolbar-title {
    font-size: 1rem; font-weight: 800; color: var(--navy); flex: 1; min-width: 120px;
  }
  .cl-toolbar select {
    font-size: 0.78rem; padding: 5px 8px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface); color: var(--slate);
    cursor: pointer; max-width: 180px;
  }
  .cl-toolbar-btns { display: flex; gap: 6px; }

  /* Credit / Misc mode tabs */
  .cl-mode-tabs {
    display: flex; gap: 6px; margin-bottom: 12px;
    background: var(--surface); border-radius: var(--radius-md); padding: 4px;
  }
  .cl-mode-tab {
    flex: 1; text-align: center; padding: 8px 10px; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--muted); font-size: 0.82rem; font-weight: 700;
    cursor: pointer; font-family: 'Inter', sans-serif; transition: all .12s;
  }
  .cl-mode-tab.active { background: var(--white); color: var(--teal-dark); box-shadow: var(--shadow-sm); }

  /* Per-snapshot print button (3" thermal receipt) */
  .cl-print-btn {
    font-size: 0.7rem; padding: 3px 8px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border);
    color: var(--slate); cursor: pointer; white-space: nowrap;
  }
  .cl-print-btn:hover { background: var(--teal); color: var(--white); border-color: var(--teal); }

  /* Date group card */
  .cl-date-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: 10px;
    overflow: hidden; box-shadow: var(--shadow-sm);
  }
  .cl-date-head {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; cursor: pointer;
    background: var(--surface); border-bottom: 1px solid transparent;
    transition: background 0.15s;
  }
  .cl-date-card.open .cl-date-head { border-bottom-color: var(--border); background: var(--surface); }
  .cl-date-head:hover { background: var(--surface); }
  .cl-date-icon { font-size: 1rem; flex-shrink: 0; }
  .cl-date-label { font-size: 0.88rem; font-weight: 700; color: var(--navy); flex: 1; }
  .cl-date-sub   { font-size: 0.72rem; color: var(--muted); margin-top: 1px; }
  .cl-date-total {
    font-size: 0.82rem; font-weight: 800; color: var(--teal-dark);
    background: var(--teal-pale); border-radius: 20px; padding: 3px 10px; white-space: nowrap;
  }
  .cl-chevron { font-size: 0.7rem; color: var(--muted); margin-left: 6px; transition: transform 0.2s; }
  .cl-date-card.open .cl-chevron { transform: rotate(90deg); }
  .cl-date-body { display: none; padding: 8px 10px 10px; }
  .cl-date-card.open .cl-date-body { display: block; }

  /* Flat shift-wise list (default Credit Ledger layout) */
  .cl-flat-container { display: flex; flex-direction: column; gap: 6px; }

  .cl-date-divider {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 8px; padding: 14px 4px 4px; margin-top: 4px;
  }
  .cl-flat-container > .cl-date-divider:first-child { padding-top: 2px; margin-top: 0; }
  .cl-date-divider-label { font-size: 0.78rem; font-weight: 700; color: var(--navy); }
  .cl-date-divider-total { font-size: 0.72rem; font-weight: 700; color: var(--teal-dark); }

  .cl-shift-row-flat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); overflow: hidden;
  }
  .cl-shift-row-head {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; cursor: pointer; background: var(--white);
  }
  .cl-shift-row-head:hover { background: var(--teal-pale); }
  .cl-shift-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .cl-shift-row-main { flex: 1; min-width: 0; }
  .cl-shift-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .cl-shift-row-name { font-size: 0.82rem; font-weight: 700; color: var(--navy); }
  .cl-shift-row-date  { font-size: 0.72rem; color: var(--muted); }
  .cl-shift-row-sub   { font-size: 0.72rem; color: var(--muted); margin-top: 1px; }
  .cl-shift-row-total { font-size: 0.82rem; font-weight: 800; color: var(--navy); white-space: nowrap; }
  .cl-shift-row-flat .cl-chevron { transition: transform 0.2s; }
  .cl-shift-row-flat.open .cl-chevron { transform: rotate(90deg); }
  .cl-shift-row-body { display: none; border-top: 1px solid var(--border); }
  .cl-shift-row-flat.open .cl-shift-row-body { display: block; }
  .cl-shift-row-flat.mode-final .cl-shift-row-head,
  .cl-shift-row-flat:has(.cl-badge-final) .cl-shift-row-head { background: var(--amber-pale); }

  /* Shift snapshot block */
  .cl-shift-block {
    border: 1px solid var(--border); border-radius: var(--radius-md);
    margin-bottom: 8px; overflow: hidden;
  }
  .cl-shift-block:last-child { margin-bottom: 0; }
  .cl-shift-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .cl-shift-block.mode-final .cl-shift-header { background: var(--amber-pale); border-bottom-color: var(--amber); }
  .cl-badge-shift { font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 10px; background: var(--blue-pale); color: var(--blue); }
  .cl-badge-final { font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 10px; background: var(--amber-pale); color: var(--amber-dark); }
  .cl-shift-name  { font-size: 0.82rem; font-weight: 700; color: var(--navy); flex: 1; }
  .cl-shift-total { font-size: 0.82rem; font-weight: 800; color: var(--navy); }
  .cl-open-btn {
    font-size: 0.7rem; padding: 3px 8px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border);
    color: var(--slate); cursor: pointer; white-space: nowrap;
  }
  .cl-open-btn:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }

  /* Lines inside snapshot */
  .cl-lines { padding: 6px 12px 10px; }
  .cl-opening-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.75rem; color: var(--muted); padding: 4px 0 6px;
    border-bottom: 1px dashed var(--border); margin-bottom: 4px;
  }
  .cl-opening-row span:last-child { font-weight: 700; color: var(--slate); }
  .cl-line {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.78rem; padding: 3px 0; color: var(--slate);
  }
  .cl-line .cl-lbl { color: var(--navy); font-weight: 700; font-size: 0.73rem; }
  .cl-line .cl-val { font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
  @media print {
    .cl-line .cl-lbl { color: #000 !important; font-weight: 700 !important; }
    .cl-line .cl-val { color: #000 !important; }
  }
  .cl-adj-row .cl-lbl { color: var(--amber-dark); }
  .cl-adj-row .cl-val { color: var(--amber-dark); }
  .cl-total-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.82rem; font-weight: 800; color: var(--navy);
    border-top: 1.5px solid var(--border); margin-top: 6px; padding-top: 6px;
  }
  .cl-cat-label {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .5px; color: var(--muted); padding: 6px 0 2px;
  }

  /* Filter active state */
  .cl-filter-active .cl-date-label { color: var(--teal-dark); }

  /* Show more button */
  .cl-show-more {
    width: 100%; padding: 10px; border-radius: var(--radius-md);
    background: var(--surface); border: 1px dashed var(--border);
    color: var(--muted); font-size: 0.8rem; cursor: pointer; text-align: center;
    margin-top: 4px;
  }
  .cl-show-more:hover { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-pale); }

  /* Export panel */
  .cl-export-panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 14px; margin-bottom: 14px; display: none;
  }
  .cl-export-panel.open { display: block; }
  .cl-export-panel h4 { font-size: 0.82rem; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
  .cl-export-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
  .cl-export-row label { font-size: 0.75rem; color: var(--muted); min-width: 32px; }
  .cl-export-row input[type=date], .cl-export-row select {
    font-size: 0.78rem; padding: 5px 8px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--white); color: var(--slate);
    flex: 1; min-width: 100px;
  }
  .cl-empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 0.85rem; }

  /* ═══════════════════════════════════════════════════════════
     LEDGER PROGRESS + JUMP NAV  (sticky, sits under ledger-toolbar)
  ═══════════════════════════════════════════════════════════ */
  .ledger-progress-bar {
    position: sticky; top: 0; z-index: 30;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .lpb-track-row {
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 6px 16px 4px;
  }
  .lpb-viewall-link {
    flex-shrink: 0; font-size: 0.68rem; font-weight: 700; color: var(--teal-dark);
    background: var(--teal-pale); border: 1px solid var(--teal); border-radius: 20px;
    padding: 3px 9px; cursor: pointer; display: flex; align-items: center; gap: 4px;
    white-space: nowrap;
  }

  .lpb-nav-row {
    display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 16px;
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .lpb-nav-row::-webkit-scrollbar { display: none; }
  .lpb-chip {
    position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 5px;
    padding: 6px 11px; border-radius: 20px; font-size: 0.72rem; font-weight: 600;
    background: var(--surface); color: var(--muted); border: 1px solid transparent;
    cursor: pointer; transition: background .15s, color .15s, transform .15s;
    -webkit-tap-highlight-color: transparent;
  }
  .lpb-chip:active { transform: scale(0.96); }
  .lpb-chip .lpb-chip-icon { font-size: 0.78rem; line-height: 1; }
  .lpb-chip.lpb-current {
    background: var(--teal); color: var(--white); transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(13,148,136,.4); z-index: 1;
  }
  .lpb-chip.lpb-current:active { transform: scale(1.05); }
  .lpb-chip.lpb-current::after {
    content: ''; position: absolute; left: 50%; bottom: -8px;
    transform: translateX(-50%);
    border-left: 5px solid transparent; border-right: 5px solid transparent;
    border-top: 6px solid var(--teal);
  }

  /* ═══════════════════════════════════════════════════════════
     FOCUS MODE  (only one section card visible at a time)
  ═══════════════════════════════════════════════════════════ */
  body.focus-mode .ledger-section.focus-hidden { display: none !important; }
  body.focus-mode .ledger-section { will-change: transform, opacity; }
  .focus-controls {
    display: none; gap: 8px; padding: 12px 16px 0;
  }
  body.focus-mode .focus-controls { display: flex; }
  .focus-btn {
    flex: 1; height: 40px; border-radius: var(--radius-md); font-size: 0.82rem; font-weight: 700;
    border: 1px solid var(--border); background: var(--surface); color: var(--slate);
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  }
  .focus-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .focus-btn.focus-btn-next { background: var(--teal); border-color: var(--teal); color: var(--white); }

  /* ═══════════════════════════════════════════════════════════
     PREVIOUS-SHIFT SNAPSHOT  (read-only, always visible, sits
     below "Save as Draft" in each section's footer)
  ═══════════════════════════════════════════════════════════ */
  .prev-shift-snapshot {
    margin-top: 14px; border: 1px dashed var(--border); border-radius: var(--radius-md);
    background: var(--surface); overflow: hidden;
  }
  .pss-head {
    padding: 8px 12px; font-size: 0.72rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .3px; background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .pss-body { max-height: 260px; overflow-y: auto; }
  .pss-row {
    display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
    padding: 7px 12px; font-size: 0.82rem; color: var(--slate); border-bottom: 1px solid var(--border);
  }
  .pss-row span:first-child { flex-shrink: 0; }
  .pss-row span:last-child { font-weight: 700; color: var(--navy); text-align: right; }
  .pss-empty, .pss-empty-row {
    padding: 12px; font-size: 0.8rem; color: var(--muted); text-align: center;
  }
  .pss-empty-row span:last-child { font-weight: 400; color: var(--muted); }
  .pss-row.pss-row-deleted {
    background: var(--red-pale);
  }
  .pss-row.pss-row-deleted span { text-decoration: line-through; color: var(--red); opacity: 0.8; }
  .pss-row.pss-row-deleted em { font-style: normal; text-decoration: none; font-size: 0.7rem; color: var(--muted); }

  /* ═══════════════════════════════════════════════════════════
     VIEW ALL  (read-only glance overlay — never editable, never
     a second navigation path; closes back to the same focus card)
  ═══════════════════════════════════════════════════════════ */
  .viewall-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 60;
    display: flex; align-items: flex-end; justify-content: center;
  }
  .viewall-overlay.hidden { display: none; }
  .viewall-panel {
    width: 100%; max-width: 480px; max-height: 80vh; overflow-y: auto;
    background: var(--surface); border-radius: 16px 16px 0 0;
    padding: 14px 0 18px; box-shadow: 0 -8px 24px rgba(0,0,0,.18);
  }
  .viewall-head {
    display: flex; align-items: center; justify-content: center; position: relative;
    padding: 0 16px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
  }
  .viewall-close {
    position: absolute; left: 16px; background: none; border: none; cursor: pointer;
    font-size: 0.78rem; font-weight: 700; color: var(--muted);
  }
  .viewall-title { font-size: 0.85rem; font-weight: 700; color: var(--navy); }
  .viewall-list { padding: 4px 0; }
  .viewall-row {
    display: flex; align-items: center; gap: 8px; padding: 10px 16px;
    border-bottom: 1px solid var(--border); font-size: 0.85rem; color: var(--slate);
    cursor: pointer; transition: background .12s;
  }
  .viewall-row:hover, .viewall-row:focus-visible {
    background: var(--surface); outline: none;
  }
  .viewall-row .va-icon { font-size: 0.95rem; }
  .viewall-row .va-label { flex: 1; font-weight: 600; }
  .viewall-row .va-value { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--muted); }
  .viewall-row.va-current { background: var(--teal-pale); }
  .viewall-row.va-current:hover { background: var(--teal-pale); }
  .viewall-row.va-current .va-label { color: var(--teal-dark); }
  .viewall-row .va-here {
    font-size: 0.65rem; font-weight: 700; color: var(--teal-dark); white-space: nowrap;
  }
  .viewall-row .va-go {
    font-size: 1rem; font-weight: 700; color: var(--border); line-height: 1;
  }
  .viewall-row:hover .va-go, .viewall-row:focus-visible .va-go {
    color: var(--teal-dark);
  }
  .viewall-foot {
    text-align: center; padding: 12px 16px 0; font-size: 0.8rem; font-weight: 700; color: var(--navy);
  }

  /* ═══════════════════════════════════════════════════════════
     SUMMARY MODAL  (shown before final save)
  ═══════════════════════════════════════════════════════════ */
  #summary-modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 200; backdrop-filter: blur(2px);
  }
  #summary-modal-overlay.hidden { display: none; }
  .summary-sheet {
    width: 100%; max-width: 480px; background: var(--surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 88vh; overflow-y: auto;
    animation: summarySlideUp .22s ease;
  }
  @keyframes summarySlideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
  .summary-head {
    background: linear-gradient(135deg, var(--navy) 0%, var(--teal-dark) 100%);
    padding: 20px 20px 16px; text-align: center; color: var(--white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  .summary-head-icon { font-size: 1.8rem; line-height: 1; }
  .summary-head h3 { font-size: 0.95rem; font-weight: 700; margin: 6px 0 2px; }
  .summary-head p { font-size: 0.72rem; color: var(--on-dark-secondary); margin: 0; }
  .summary-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
  .summary-stat {
    background: var(--surface); border-radius: var(--radius-md); padding: 12px 14px;
  }
  .summary-stat-label { font-size: 0.72rem; color: var(--muted); margin-bottom: 2px; }
  .summary-stat-value { font-size: 1.15rem; font-weight: 700; color: var(--navy); font-family: 'JetBrains Mono', monospace; }
  .summary-stat.sv-ok    { background: var(--green-pale); }
  .summary-stat.sv-ok .summary-stat-value    { color: var(--green); }
  .summary-stat.sv-warn  { background: var(--amber-pale); border: 1px solid var(--amber); }
  .summary-stat.sv-warn .summary-stat-label, .summary-stat.sv-warn .summary-stat-value { color: var(--amber-dark); }
  .summary-stat.sv-bad   { background: var(--red-pale); border: 1px solid var(--red); }
  .summary-stat.sv-bad .summary-stat-label, .summary-stat.sv-bad .summary-stat-value { color: var(--red); }

  /* Small inline variance chips — Saved Records list + Staff Ledger.
     Deliberately separate from .sv-* above (those are scoped to the
     larger .summary-stat card, not a bare inline span). */
  .var-chip-ok   { color: var(--green); }
  .var-chip-warn { color: var(--amber-dark); }
  .var-chip-bad  { color: var(--red); }
  .summary-warn-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; font-size: 0.7rem; }
  .summary-footer { padding: 12px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
  .summary-footer .btn-full { width: 100%; }
  .summary-back-btn {
    width: 100%; background: none; border: none; color: var(--muted);
    font-size: 0.78rem; padding: 6px; cursor: pointer; text-align: center;
  }
  .summary-incomplete-note {
    display: flex; align-items: flex-start; gap: 8px; background: var(--amber-pale);
    border: 1px solid var(--amber); border-radius: var(--radius-md); padding: 10px 12px;
    font-size: 0.72rem; color: var(--amber-dark); margin: 0 18px 6px;
  }

/* ═══════════════════════════════════════════════════════════
   CLOSING BOOK
═══════════════════════════════════════════════════════════ */
.cb-range-row { display: flex; gap: 10px; margin-bottom: 10px; }
.cb-range-field { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.cb-range-field label { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.cb-range-field input, .cb-range-field select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.85rem; font-family: 'Inter', sans-serif; background: var(--surface); color: var(--slate);
}
.cb-shortcut-row { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.cb-shortcut-row .btn { flex: 1; min-width: 100px; }
.cb-generate-status {
  margin-top: 10px; padding: 10px 12px; background: var(--surface); border-radius: var(--radius-sm);
  font-size: 0.8rem; color: var(--slate); text-align: center; font-weight: 600;
}

.cb-reader { margin-top: 16px; }
.cb-reader:not(.hidden) {
  position: fixed; inset: 0; z-index: 900;
  margin: 0; padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  display: flex; flex-direction: column;
}
.cb-reader:not(.hidden) .cb-viewport {
  flex: 1 1 auto; height: auto; min-height: 0;
}
.cb-reader-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px;
}
.cb-reader-toolbar2 { gap: 10px; }
.cb-page-counter {
  font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; font-weight: 700;
  color: var(--navy); background: var(--surface); padding: 6px 12px; border-radius: var(--radius-sm);
}
.cb-zoom-group { display: flex; gap: 4px; }
.cb-zoom-group .btn { padding: 6px 10px; font-size: 0.75rem; }
#cb-jump-select {
  padding: 7px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.78rem; background: var(--surface); color: var(--slate); font-family: 'Inter', sans-serif;
}

.cb-viewport {
  width: 100%; height: 62vh; min-height: 380px; overflow: auto;
  background: var(--paper-dim); border-radius: var(--radius-md); border: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: center; padding: 14px;
  touch-action: pan-y;
}
.cb-viewport.cb-viewport-zoomed { touch-action: pan-x pan-y; justify-content: flex-start; }
.cb-page-sizer { flex-shrink: 0; position: relative; }
.cb-page-stage {
  width: 794px; height: 1123px; flex-shrink: 0;
  transform-origin: top left;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.cb-page-stage .ps-page { page-break-after: unset !important; }

.cb-cover-page { display: flex; flex-direction: column; }
.cb-cover-title { font-size: 2.4rem; font-weight: 800; color: var(--navy); margin-top: 60px; text-align: center; }
.cb-cover-range { font-size: 1rem; color: var(--slate); text-align: center; margin-top: 20px; line-height: 1.6; font-family: 'JetBrains Mono', monospace; }
.cb-cover-arrow { color: var(--muted); font-size: 1.1rem; }
.cb-cover-stats { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 50px; }
.cb-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 22px; text-align: center; min-width: 120px;
}
.cb-stat-val { font-size: 1.8rem; font-weight: 800; color: var(--navy); font-family: 'JetBrains Mono', monospace; }
.cb-stat-label { font-size: 0.72rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .3px; }
.cb-cover-gen { text-align: center; color: var(--muted); font-size: 0.75rem; margin-top: auto; padding-bottom: 20px; }

@media (max-width: 480px) {
  .cb-range-row { flex-direction: column; }
  .cb-shortcut-row .btn { min-width: 0; }
}

/* ── ACTIVITY LOG ── */
.al-entry {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 14px; margin-bottom: 8px;
}
.al-entry-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.al-entry-main { display: flex; flex-direction: column; gap: 2px; }
.al-entry-title { font-size: 0.85rem; font-weight: 700; color: var(--slate); }
.al-entry-sub   { font-size: 0.72rem; color: var(--muted); }
.al-entry-badge {
  font-size: 0.68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap; text-transform: uppercase; letter-spacing: 0.02em;
}
/* Semantic reuse only — no colors invented for this list that don't
   already mean the same thing elsewhere in the app. "Final" always
   reads as teal-dark (see .edit-mode-btn.active-final below), and
   "delete" is the only entry that gets red, keeping red's alarm value
   intact instead of splitting it across two unrelated meanings. */
.al-badge-create     { background: var(--blue-pale);  color: var(--blue); }
.al-badge-save-draft { background: var(--amber-pale); color: var(--amber-dark); }
.al-badge-save       { background: var(--green-pale); color: var(--green); }
.al-badge-save-final { background: var(--teal-pale);  color: var(--teal-dark); }
.al-badge-edit-open  { background: var(--paper-dim);  color: var(--slate); }
.al-badge-delete     { background: var(--red-pale);   color: var(--red); }
.al-badge-archive    { background: var(--paper-dim);  color: var(--muted); }
.al-entry-changes { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; }
.al-change-row {
  display: flex; justify-content: space-between; gap: 10px; font-size: 0.76rem; padding: 3px 0;
}
.al-change-label { color: var(--muted); flex: 1.3; }
.al-change-vals   { font-family: 'JetBrains Mono', monospace; color: var(--slate); text-align: right; flex: 1; }
.al-entry-empty { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 30px 10px; }
#image-reader.hidden { display: none; }
#image-reader {
  position: fixed; inset: 0; z-index: 950;
  background: var(--navy);
  display: flex; flex-direction: column;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
}
.img-reader-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px;
}
.img-reader-info {
  display: flex; align-items: center; gap: 8px; color: var(--on-dark-primary); font-size: 0.82rem; text-align: right;
}
.img-reader-counter {
  font-family: 'JetBrains Mono', monospace; font-weight: 700; background: rgba(255,255,255,.12);
  padding: 4px 10px; border-radius: var(--radius-sm); color: var(--white);
}
.img-reader-viewport {
  flex: 1 1 auto; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none; border-radius: var(--radius-md);
  background: var(--navy-light);
}
.img-reader-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  box-shadow: 0 6px 24px rgba(0,0,0,.4); background: var(--white);
  transform-origin: center center; will-change: transform;
}
.img-reader-status {
  color: var(--on-dark-secondary); font-size: 0.9rem; font-weight: 600;
}
.img-reader-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(15,23,42,.55); color: var(--white); border: none; border-radius: 999px;
  width: 40px; height: 40px; font-size: 1.4rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.img-reader-nav-prev { left: 8px; }
.img-reader-nav-next { right: 8px; }
.img-reader-nav:disabled { opacity: .3; pointer-events: none; }
.img-reader-footer { margin-top: 10px; }
.img-reader-footer .btn { width: 100%; }

/* ═══════════════════════════════════════════════════════════
   DESKTOP LAYOUT
   Everything above this point is untouched — the app still
   looks/behaves exactly the same on phones. These rules only
   kick in on wider viewports so the app stops looking like a
   phone screen stretched into the middle of a big monitor.
═══════════════════════════════════════════════════════════ */
@media (min-width: 861px) {

  body {
    padding: 40px 24px 60px;
    background: var(--border);
  }
  body.topbar-on { padding-top: 70px; }

  /* Give the whole app room to breathe on real screens instead of
     staying pinned to a 680px phone-width column. */
  .shell {
    max-width: 900px;
    border-radius: 20px;
  }
  #page-credit-ledger .page-body { max-width: 100%; }

  /* Mouse cursors instead of touch affordances */
  .card-head, .cl-date-head, .lpb-chip, .ltb-back, .ltb-icon-btn,
  .focus-btn, .add-row-btn, .del-row-btn, .cl-open-btn, .cl-print-btn,
  .cl-mode-tab, .cl-show-more, .modal-picker-item, .viewall-close,
  .btn, .edit-mode-btn { cursor: pointer; }

  /* Rows get a touch more horizontal room since there's no thumb
     to design around, and hover feedback reads better with a
     visible pointer cursor throughout. */
  .row input[type="number"],
  .row input[type="text"],
  .row select { width: 140px; }
  .row.three-col select { min-width: 90px; }

  /* Stat grids use the freed-up width instead of stacking 2-wide */
  .fcs-grid { grid-template-columns: repeat(4, 1fr); }

  /* ── Bottom sheets → centered dialogs ──
     On mobile these slide up from the bottom edge (a familiar
     phone pattern). On desktop there is no "bottom edge" to
     anchor to, so they become normal centered modal dialogs. */
  #save-action-overlay,
  #summary-modal-overlay,
  .viewall-overlay {
    align-items: center;
    padding: 24px;
  }
  .save-action-sheet,
  .summary-sheet,
  .viewall-panel {
    max-width: 440px;
    border-radius: var(--radius-xl);
    animation: popIn .18s ease;
  }
  .summary-head { border-radius: var(--radius-xl) var(--radius-xl) 0 0; }

  /* Modal pickers / edit / pdf dialogs get a little more width so
     they don't look like a phone dialog floating in a sea of gray */
  .modal-picker-sheet { max-width: 420px; }
  .edit-modal-sheet { max-width: 400px; }
  .pdf-modal-sheet { max-width: 360px; }

  /* Closing book reader: use real vertical space instead of vh
     tuned for a phone viewport, and cap width so pages don't feel
     lost in an oversized viewport. */
  .cb-reader:not(.hidden) { padding: 24px; }
  .cb-viewport { height: 78vh; min-height: 560px; }

  /* Ledger toolbar / progress nav get breathing room */
  .ledger-toolbar { padding: 14px 24px; }
  .lpb-track-row { padding: 8px 24px 4px; }
  .lpb-nav-row { padding: 0 24px 16px; }
  .page-body { padding: 28px 32px 36px; }

  /* Buttons shouldn't stay full-bleed-width like a mobile action
     sheet when there's plenty of room to sit inline */
  .save-action-btns .btn,
  .summary-footer .btn-full { width: auto; align-self: stretch; }
}

/* Extra-wide monitors: stop growing past a comfortable reading
   width so rows of text/inputs don't become uncomfortably wide. */
@media (min-width: 1200px) {
  .shell { max-width: 960px; }
}

/* ═══════════════════════════════════════════════════════════
   DESKTOP APP SHELL — v2
   The block above just widened the phone layout. This is the
   actual structural difference: a persistent sidebar instead of
   full-page swaps, and real multi-column layouts on the pages
   that were still one long stacked column. Phones are completely
   unaffected — .app-sidebar doesn't exist in their layout at all.
═══════════════════════════════════════════════════════════ */
.app-sidebar { display: none; }

@media (min-width: 861px) {

  body { display: flex; justify-content: center; }

  /* ── Shell becomes sidebar + content, side by side ── */
  .shell {
    display: flex;
    align-items: flex-start;
    max-width: 1180px;
    width: 100%;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    gap: 24px;
  }
  .shell-main {
    flex: 1;
    min-width: 0;
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }

  /* Phones use .app-bar as their only header; desktop uses the
     sidebar brand block instead, so hide the duplicate. */
  .shell-main > .app-bar { display: none; }

  /* Redundant now that the destination is one click away in the
     sidebar at all times. */
  .btn-row.back-row, #dashboard-btn-row { display: none; }

  #sync-topbar { display: none; } /* mobile pull-to-sync affordance; Settings/Dashboard already surface sync state on desktop */
  body.topbar-on { padding-top: 40px; }

  .app-sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    background: linear-gradient(180deg, var(--navy) 0%, var(--teal-dark) 100%);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 18px 14px;
    gap: 4px;
  }
  .sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 8px 16px; margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .sidebar-brand-name { font-size: 0.88rem; font-weight: 800; color: var(--white); letter-spacing: -.2px; line-height: 1.25; }
  .sidebar-brand-sub  { font-size: 0.68rem; color: var(--on-dark-secondary); font-weight: 500; margin-top: 2px; }
  .sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
  .sidebar-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 10px;
    background: none; border: none; cursor: pointer;
    color: var(--on-dark-secondary); font-size: 0.84rem; font-weight: 600;
    font-family: 'Inter', sans-serif; text-align: left;
    transition: background .12s, color .12s;
  }
  .sidebar-link-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
  .sidebar-link:hover { background: rgba(255,255,255,.07); color: var(--white); }
  .sidebar-link.active { background: var(--teal); color: var(--white); box-shadow: var(--shadow-sm); }
  .sidebar-link.active:hover { background: var(--teal); }
  .sidebar-link-context { cursor: default; opacity: .55; }
  .sidebar-link-context:hover { background: none; color: var(--on-dark-secondary); }
  .sidebar-link-context.active { opacity: 1; background: rgba(13,148,136,.25); color: var(--status-ok); box-shadow: none; }
  .sidebar-divider { height: 1px; background: rgba(255,255,255,.1); margin: 8px 6px; }

  /* ── DASHBOARD: cloud sync full-width, calendar + saved records
     side by side instead of one under the other ── */
  #page-dashboard .page-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    grid-template-areas:
      "cal    saved"
      "picker picker";
    align-items: start;
  }
  #card-calendar     { grid-area: cal; }
  #card-saved-records{ grid-area: saved; margin-bottom: 0; }
  #shift-picker       { grid-area: picker; }

  /* ── SETTINGS: two-column masonry within whichever tab panel is
     open, instead of the whole page's ~10 cards stacked together ── */
  #page-settings .settings-tab-panel {
    column-count: 2; column-gap: 20px;
  }
  #page-settings .settings-tab-panel > .card {
    break-inside: avoid; -webkit-column-break-inside: avoid;
    display: inline-block; width: 100%; vertical-align: top;
  }

  /* ── SHIFT LEDGER: the section chips become a real sticky side
     rail (still the same DOM/JS — jumpToSection() etc. — just laid
     out vertically alongside the section instead of as a scrolling
     row of pills above it) ── */
  #page-ledger {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-areas:
      "pager    pager"
      "banners  banners"
      "toolbar  toolbar"
      "pdf      pdf"
      "nav      body";
    column-gap: 24px;
  }
  #page-ledger .pager           { grid-area: pager; }
  #page-ledger #final-mode-bar,
  #page-ledger #locked-mode-bar { grid-area: banners; }
  #page-ledger .ledger-toolbar  { grid-area: toolbar; }
  #page-ledger #pdf-status      { grid-area: pdf; }
  #page-ledger > .page-body     { grid-area: body; max-width: 640px; }

  #page-ledger .ledger-progress-bar {
    grid-area: nav;
    position: sticky; top: 0;
    background: transparent; border-bottom: none;
    align-self: start;
  }
  #page-ledger .lpb-track-row { justify-content: flex-start; padding: 16px 8px 10px; }
  #page-ledger .lpb-nav-row {
    display: flex; flex-direction: column; gap: 4px;
    overflow: visible; padding: 0 4px;
  }
  #page-ledger .lpb-chip {
    justify-content: flex-start; width: 100%; border-radius: 10px;
    padding: 9px 12px;
  }
  #page-ledger .lpb-chip.lpb-current { transform: none; }
  #page-ledger .lpb-chip.lpb-current::after { display: none; } /* the little downward arrow made sense under a horizontal row, not a vertical list */
  #page-ledger .lpb-chip.lpb-current:active { transform: none; }

  /* ── CREDIT LEDGER: date snapshots as a multi-column masonry
     instead of one long vertical stack ── */
  #page-credit-ledger #cl-cards-container {
    column-count: 2; column-gap: 16px;
  }
  #page-credit-ledger #cl-cards-container > * {
    break-inside: avoid; -webkit-column-break-inside: avoid;
    margin-bottom: 16px;
  }

  /* ── CLOSING BOOK: summary + range picker side by side; reader
     (once generated) still takes the full width below ── */
  #page-closing-book .page-body {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start;
  }
  #page-closing-book .btn-row.back-row,
  #page-closing-book .cl-toolbar { grid-column: 1 / -1; }
  #page-closing-book #cb-reader:not(.hidden) { grid-column: 1 / -1; }
}

/* ── MOTION ── a cashier reopening this app dozens of times a shift
   shouldn't be resold the same slide/pop/spin flourish every time if
   their OS says to keep still — respect it instead of only ever
   defaulting to "on". This still leaves state changes instant and
   legible; nothing depends on the animation to convey information. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
