  /* ── Structural System Base ─────────────────────────────── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --navy:       #1B3A6B;
    --navy2:      #2151A0;
    --gold:       #F59E0B;
    --gold-bg:    #FFFBEB;
    /* Text-safe darker variants: --gold and --green fail WCAG AA
       (2.15:1 and 3.77:1 against white) when used as text color rather
       than a background/border/icon fill. Use these instead any time
       the color itself is the only thing carrying meaning in text
       (e.g. a "Short"/"Over" label, a warning line) — both pass
       4.5:1+ against white and var(--light). */
    --gold-ink:   #B45309;
    --green:      #059669;
    --green-bg:   #ECFDF5;
    --green-ink:  #047857;
    --red:        #DC2626;
    --red-bg:     #FEF2F2;
    /* --red vs --red-bg is 4.41:1 — just under AA's 4.5:1 for normal
       text. Same fix as gold-ink/green-ink below: a slightly darker
       shade for any place red is the text color rather than a border,
       icon, or fill against plain white (where --red already passes). */
    --red-ink:    #B91C1C;
    --grey:       #64748B;
    --light:      #F8FAFC;
    --white:      #ffffff;
    --border:     #E2E8F0;
    --text:       #0F172A;
    --radius:     16px;
    --shadow:     0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
    --font-scale: 100%;

    /* Section accent colours */
    --c-random:   #1B3A6B;
    --c-team:     #059669;
    --c-reports:  #6D28D9;
    --c-sync:     #D97706;
  }

  html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--light); color: var(--text); min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
  }

  #app {
    max-width: 540px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding-bottom: 85px;
    font-size: var(--font-scale);
  }

  /* ── Header ─────────────────────────────────────────────── */
  .header {
    background: var(--navy); padding: 12px 16px; position: sticky; top: 0; z-index: 110;
    display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow-md);
  }
  .header-brand-wrap { display: flex; flex-direction: column; }
  .header-sub { color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
  .header-title { color: var(--white); font-size: 16px; font-weight: 800; line-height: 1.2; margin-top: 1px; }
  .header-loc { color: rgba(255,255,255,0.70); font-size: 11px; font-weight: 600; margin-top: 1px; }

  /* ── Bottom Tab Bar ──────────────────────────────────────── */
  .tabbar {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 540px; background: var(--white);
    border-top: 1px solid var(--border); display: flex; z-index: 110;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab-btn {
    flex: 1; border: none; background: transparent; cursor: pointer;
    padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px;
    transition: background 0.15s;
  }
  .tab-btn:active { background: var(--light); }
  .tab-icon { font-size: 19px; line-height: 1; transition: transform 0.15s; }
  .tab-btn.active .tab-icon { transform: scale(1.05); }
  .tab-label { font-size: 10px; font-weight: 700; color: #B0BAC9; letter-spacing: 0.2px; }
  .tab-btn.active .tab-label { color: var(--navy); }
  .tab-dot { width: 20px; height: 3px; border-radius: 2px; background: var(--gold); display: none; margin-top: 1px; }
  .tab-btn.active .tab-dot { display: block; }

  /* ── Home Screen ─────────────────────────────────────────── */
  .home-screen { padding: 16px 14px 8px; }

  .home-welcome {
    text-align: center;
    padding: 10px 0 20px;
  }
  .home-greeting {
    font-size: 20px; font-weight: 800; color: var(--text); line-height: 1.2;
  }
  .home-tagline {
    font-size: 12px; color: var(--grey); margin-top: 3px; font-weight: 500;
  }

  .section-tile {
    display: flex; align-items: center; gap: 16px;
    border-radius: 20px; padding: 18px 16px; margin-bottom: 12px;
    cursor: pointer; border: none; width: 100%; text-align: left;
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.14s ease, box-shadow 0.14s ease;
    font-family: inherit;
  }
  .section-tile:active { transform: scale(0.975); box-shadow: 0 2px 6px rgba(0,0,0,0.10); }

  .section-tile--inventory { background: linear-gradient(135deg, #1B3A6B 0%, #2563EB 100%); }
  .section-tile--team    { background: linear-gradient(135deg, #065F46 0%, #059669 100%); }
  .section-tile--sync    { background: linear-gradient(135deg, #92400E 0%, #D97706 100%); }

  .section-tile-icon {
    width: 52px; height: 52px; border-radius: 14px;
    background: rgba(255,255,255,0.18); display: flex; align-items: center;
    justify-content: center; font-size: 24px; flex-shrink: 0;
  }
  .section-tile-body { flex: 1; min-width: 0; }
  .section-tile-name {
    font-size: 16px; font-weight: 800; color: #ffffff; line-height: 1.2;
  }
  .section-tile-desc {
    font-size: 11px; color: rgba(255,255,255,0.70); margin-top: 3px; font-weight: 500;
  }
  .section-tile-stat {
    font-size: 11px; color: rgba(255,255,255,0.55); margin-top: 6px; font-weight: 600;
  }
  .section-tile-chevron {
    font-size: 22px; color: rgba(255,255,255,0.45); flex-shrink: 0; line-height: 1;
  }

  /* ── Section Navigation Bar (inside section pages) ───────── */
  .section-nav-bar {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
  }
  .section-nav-label {
    font-size: 10px; font-weight: 700; color: var(--grey);
    text-transform: uppercase; letter-spacing: 1.2px;
    padding: 9px 14px 0;
  }
  .section-sub-tabs {
    display: flex; border-top: none;
  }
  .section-sub-tab {
    flex: 1; border: none; background: transparent;
    padding: 9px 0 11px; font-size: 12px; font-weight: 700;
    color: var(--grey); cursor: pointer; position: relative;
    transition: color 0.15s; font-family: inherit;
  }
  .section-sub-tab:hover { color: var(--text); }
  .section-sub-tab.active { color: var(--navy); }
  .section-sub-tab.active::after {
    content: ''; position: absolute; bottom: 0; left: 25%; right: 25%;
    height: 3px; background: var(--gold); border-radius: 2px 2px 0 0;
  }
  .section-sub-tab + .section-sub-tab { border-left: 1px solid var(--border); }

  /* ── Layout & View Management ────────────────────────────── */
  .page { display: none; padding: 14px; }
  .page.active { display: block; }

  /* ── Cards ───────────────────────────────────────────────── */
  .card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px;
  }
  .card-title {
    font-size: 11px; font-weight: 700; color: var(--grey);
    text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 12px; margin-top: 16px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
  }
  .card-title:first-child { margin-top: 0; }

  /* ── Control Mechanics ──────────────────────────────────── */
  .sticky-controls {
    position: sticky; top: 52px; z-index: 105;
    background: var(--white); padding: 12px; border-radius: var(--radius);
    margin-bottom: 12px; box-shadow: var(--shadow);
  }
  .search-sort-row { display: flex; gap: 8px; margin-top: 8px; }
  .search-input {
    flex: 1; padding: 10px 12px; border: 1.5px solid var(--border);
    border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text);
    background: var(--light); transition: border-color 0.15s;
  }
  .search-input:focus { outline: none; border-color: var(--navy); background: var(--white); box-shadow: 0 0 0 3px rgba(27,58,107,0.25); }
  .sort-btn {
    background: var(--light); border: 1.5px solid var(--border); border-radius: 10px;
    padding: 0 12px; font-size: 12px; font-weight: 700; color: var(--navy); cursor: pointer;
  }

  /* ── Buttons ─────────────────────────────────────────────── */
  .btn {
    border: none; cursor: pointer; font-weight: 700; border-radius: 10px;
    display: inline-flex; align-items: center; gap: 6px;
    font-family: inherit; justify-content: center; transition: opacity 0.15s, transform 0.1s;
  }
  .btn:active { opacity: 0.82; transform: scale(0.98); }
  .btn-primary { background: var(--navy); color: var(--white); padding: 10px 18px; font-size: 13px; }
  .btn-gold    { background: var(--gold); color: var(--white); padding: 10px 18px; font-size: 13px; }
  .btn-danger  { background: var(--red);  color: var(--white); padding: 10px 18px; font-size: 13px; }
  .btn-block   { width: 100%; border-radius: var(--radius); padding: 13px; font-size: 14px; }
  .btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .btn-sm { font-size: 12px; padding: 8px 14px; }

  /* ── Dynamic History Tree Accordions ───────────────────── */
  .history-item {
    border: 1.5px solid var(--border); border-radius: 12px; margin-bottom: 8px;
    overflow: hidden; background: var(--white); display: flex; flex-direction: column;
  }
  .history-row-layout { display: flex; align-items: center; padding: 0 12px; }
  .history-header {
    flex: 1; padding: 12px 0; display: flex; justify-content: space-between;
    align-items: center; cursor: pointer; user-select: none;
  }
  .history-header:hover { background: var(--light); }
  .history-content {
    display: none; padding: 12px; background: #F8FAFC;
    border-top: 1px solid var(--border); font-size: 13px;
  }
  .history-item.open .history-content { display: block; }
  .history-item.open .arrow-toggle { transform: rotate(90deg); }
  .arrow-toggle { transition: transform 0.2s ease; display: inline-block; font-size: 14px; color: var(--navy); }

  .bulk-actions-panel {
    display: flex; gap: 8px; margin-bottom: 10px;
    background: var(--white); padding: 10px; border-radius: 12px;
    border: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .custom-checkbox {
    width: 18px; height: 18px; margin-right: 10px;
    border-radius: 4px; border: 2px solid var(--border); cursor: pointer;
    accent-color: var(--navy);
  }

  /* ── Font Control Accessibility Widget ─────────────────── */
  .font-widget {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--white); border-radius: var(--radius);
    margin-bottom: 12px; border: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .font-btn-group { display: flex; gap: 6px; }
  .font-btn {
    padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--light); font-weight: 700; font-size: 12px; cursor: pointer; font-family: inherit;
  }
  .font-btn.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

  /* ── Valuation Badge Variant Styling ─────────────────────── */
  .val-badge { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 12px; white-space: nowrap; }
  .val-grey   { background: var(--light);    color: var(--grey); }
  .val-red    { background: var(--red-bg);   color: var(--red-ink); }
  .val-green  { background: var(--green-bg); color: var(--green-ink); }

  /* ── Tables ─────────────────────────────────────────────── */
  .audit-table { width: 100%; border-collapse: collapse; }
  .audit-table th {
    font-size: 11px; font-weight: 700; color: var(--grey); text-transform: uppercase;
    padding: 10px 6px; border-bottom: 2px solid var(--border); text-align: left;
  }
  .audit-table td { padding: 11px 6px; border-bottom: 1px solid var(--light); vertical-align: middle; }
  .audit-table tbody tr:nth-child(even) td { background: #F8FAFC; }
  .audit-table input[type=number] {
    width: 75px; padding: 8px; border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 14px; font-weight: 700; text-align: right; color: var(--navy);
    background: var(--white); transition: border-color 0.15s, box-shadow 0.15s;
  }
  .audit-table input[type=number]:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(180,83,9,0.28);
  }

  .diff-pos  { color: var(--green-ink); font-weight: 800; font-size: 14px; background: var(--green-bg); padding: 2px 6px; border-radius: 4px; }
  .diff-neg  { color: var(--red-ink);   font-weight: 800; font-size: 14px; background: var(--red-bg);   padding: 2px 6px; border-radius: 4px; }
  .diff-zero { color: var(--grey);  font-weight: 700; font-size: 14px; }

  /* ── Toast ───────────────────────────────────────────────── */
  .toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    padding: 10px 22px; border-radius: 24px; font-size: 13px; font-weight: 700;
    color: var(--white); z-index: 250; box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    white-space: nowrap;
  }
  .toast.success { background: var(--green); }
  .toast.error   { background: var(--red); }

  /* ── Filter Toggle Buttons ───────────────────────────────── */
  .filter-btn {
    border: 1.5px solid var(--border); background: var(--light); border-radius: 20px;
    padding: 5px 11px; font-size: 11px; font-weight: 700; color: var(--grey);
    cursor: pointer; transition: all 0.15s; font-family: inherit;
  }
  .filter-btn-active { background: var(--navy); color: var(--white); border-color: var(--navy); }

  /* ── History sub-entry per date ──────────────────────────── */
  .history-date-entry {
    border-left: 3px solid var(--border); padding: 8px 10px; margin-bottom: 6px;
    border-radius: 0 6px 6px 0; background: var(--white);
  }
  .history-date-entry:last-child { margin-bottom: 0; }

  /* ── PDF Report ──────────────────────────────────────────── */
  #printable-report-canvas {
    display: none; background: #ffffff; padding: 40px;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #111111;
  }
  .pdf-meta-box {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
    margin-bottom: 30px; border-bottom: 2px solid #1B3A6B; padding-bottom: 15px;
  }
  .pdf-brand-title { font-size: 24px; font-weight: 800; color: #1B3A6B; text-transform: uppercase; }
  .pdf-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 25px; }
  .pdf-stat-card {
    background: #F8FAFC; border: 1px solid #E2E8F0; padding: 12px;
    border-radius: 8px; text-align: center;
  }
  .pdf-stat-val { font-size: 18px; font-weight: 700; color: #1B3A6B; }
  .pdf-stat-lbl { font-size: 10px; text-transform: uppercase; color: #64748B; font-weight: 600; margin-top: 2px; }
  .pdf-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
  .pdf-table th {
    background: #1B3A6B; color: #ffffff; text-transform: uppercase;
    font-size: 10px; font-weight: 700; padding: 10px; text-align: left; letter-spacing: 0.5px;
  }
  .pdf-table td { padding: 10px; border-bottom: 1px solid #E2E8F0; font-size: 12px; }
  .pdf-table tr:nth-child(even) td { background: #F8FAFC; }

  @media print {
    body { background: white !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    #app { display: none !important; }
    #printable-report-canvas { display: block !important; }
    @page { margin: 1.5cm; }
  }

  /* ── Cloud Sync Status Bar ───────────────────────────────── */
  #cloud-sync-bar {
    position: fixed; top: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 540px; height: 26px;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.2px; font-family: inherit;
    cursor: pointer; z-index: 200; transition: background 0.3s, color 0.3s;
    border: none; border-bottom: 1px solid rgba(0,0,0,0.07); padding: 0;
    appearance: none; -webkit-appearance: none;
    user-select: none; -webkit-tap-highlight-color: transparent;
  }
  #cloud-sync-bar.state-synced   { background: #ECFDF5; color: #059669; }
  #cloud-sync-bar.state-syncing  { background: #FFFBEB; color: #D97706; }
  #cloud-sync-bar.state-error    { background: var(--red-bg); color: var(--red-ink); }
  #cloud-sync-bar.state-idle     { background: var(--light); color: var(--grey); }
  #cloud-sync-bar.state-unlinked { background: var(--light); color: var(--grey); }
  #cloud-sync-bar .sync-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  }
  #cloud-sync-bar.state-synced   .sync-dot { background: #059669; box-shadow: 0 0 5px #05966988; }
  #cloud-sync-bar.state-syncing  .sync-dot { background: var(--gold); animation: pulse-dot 0.9s infinite; }
  #cloud-sync-bar.state-error    .sync-dot { background: var(--red); }
  #cloud-sync-bar.state-idle     .sync-dot { background: #B0BAC9; }
  #cloud-sync-bar.state-unlinked .sync-dot { background: #B0BAC9; }
  @keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
  }
  /* Push entire app down by bar height */
  #app { padding-top: 26px; }
  .header { top: 26px; }
  /* Sticky controls: 26px bar + 52px header */
  .sticky-controls { top: 78px; }

  /* ── Settings Page ─────────────────────────────────────── */
  .settings-label {
    display: block; font-size: 11px; font-weight: 700; color: var(--grey);
    margin-bottom: 4px; letter-spacing: 0.5px; text-transform: uppercase;
  }
  .settings-input {
    width: 100%; padding: 12px; border: 1.5px solid var(--border); border-radius: 10px;
    font-weight: 600; font-size: 14px; margin-bottom: 14px; color: var(--navy);
    background: var(--light); transition: border-color 0.15s;
  }
  .settings-input:focus { outline: none; border-color: var(--navy); background: var(--white); box-shadow: 0 0 0 3px rgba(27,58,107,0.25); }

  /* ── History date-range & select-all bar ───────────────── */
  .history-filter-bar {
    display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap;
  }
  .history-filter-bar input[type=date] {
    flex: 1; min-width: 120px; padding: 8px; border: 1.5px solid var(--border);
    border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--navy);
  }
  .select-all-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 10px;
  }

  /* ── Combined Multi-Audit Print ──────────────────────────── */
  .pdf-page-section { page-break-after: always; }
  .pdf-page-section:last-child { page-break-after: auto; }

  /* ── Company Card List (Verify Stock) ──────────────────── */
  .company-card {
    background: var(--white); border-radius: 14px; box-shadow: var(--shadow);
    padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
    border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: space-between;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .company-card:active { border-color: var(--gold); box-shadow: 0 2px 12px rgba(245,158,11,0.22); }
  .company-card-name { font-size: 14px; font-weight: 800; color: var(--navy); margin-bottom: 3px; line-height: 1.2; }
  .company-card-meta { font-size: 11px; color: var(--grey); font-weight: 600; }
  .company-card-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; margin-left: 10px; }
  .company-items-badge { font-size: 11px; font-weight: 800; background: var(--light); color: var(--navy); border-radius: 10px; padding: 3px 9px; }
  .company-value-badge { font-size: 10px; font-weight: 700; background: var(--gold-bg); color: var(--gold-ink); border-radius: 10px; padding: 3px 9px; }

  /* ── Audit row cursor highlight ─────────────────────────── */
  .audit-row-focused { border-left: 3px solid var(--gold) !important; }
  .audit-row-focused td { background: #FFFBEB !important; }

  /* ── History search bar ─────────────────────────────────── */
  #history-search-input {
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
    border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 10px;
    background: var(--light); color: var(--text);
  }
  #history-search-input:focus { outline: none; border-color: var(--navy); background: var(--white); box-shadow: 0 0 0 3px rgba(27,58,107,0.25); }

  /* ── PIN Gate overlay ───────────────────────────────────── */
  #pin-gate-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,31,61,0.97); z-index: 500;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  }
  .pin-title { color: var(--white); font-size: 17px; font-weight: 800; letter-spacing: 0.5px; }
  .pin-sub   { color: rgba(255,255,255,0.55); font-size: 12px; font-weight: 600; }
  .pin-dots  { display: flex; gap: 14px; }
  .pin-dot-circle {
    width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4);
    background: transparent; transition: background 0.15s;
  }
  .pin-dot-circle.filled { background: var(--gold); border-color: var(--gold); }
  .pin-keypad { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; width: 220px; }
  .pin-key {
    background: rgba(255,255,255,0.10); border: none; color: var(--white);
    font-size: 20px; font-weight: 700; border-radius: 12px; padding: 16px 0;
    cursor: pointer; font-family: inherit; transition: background 0.1s;
  }
  .pin-key:hover  { background: rgba(255,255,255,0.18); }
  .pin-key:active { background: var(--gold); }
  .pin-key.wide { grid-column: span 2; font-size: 14px; }
  /* --red is only 3.39:1 against this overlay's dark background —
     fails AA. This is the one place in the app with a dark backdrop
     behind body text, so it needs its own lighter shade rather than
     the light-background --red/--red-ink tokens used everywhere else. */
  .pin-error-msg { color: #F87171; font-size: 12px; font-weight: 700; min-height: 18px; }

  /* ── PWA Install Banner ─────────────────────────────────── */
  #pwa-install-banner {
    position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
    width: calc(100% - 32px); max-width: 508px; background: var(--navy); border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.25); padding: 12px 14px; z-index: 150;
    display: none; align-items: center; gap: 12px;
  }
  #pwa-install-banner.visible { display: flex; }
  #pwa-install-banner .pwa-icon {
    width: 40px; height: 40px; border-radius: 10px; background: var(--gold);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 20px;
  }
  #pwa-install-banner .pwa-text { flex: 1; }
  #pwa-install-banner .pwa-title { font-size: 13px; font-weight: 800; color: var(--white); }
  #pwa-install-banner .pwa-sub   { font-size: 11px; color: rgba(255,255,255,0.65); margin-top: 2px; }
  #pwa-install-banner .pwa-btn   {
    background: var(--gold); color: var(--white); border: none; border-radius: 20px;
    padding: 8px 14px; font-size: 12px; font-weight: 800; cursor: pointer; white-space: nowrap;
  }
  #pwa-install-banner .pwa-dismiss {
    background: transparent; border: none; color: rgba(255,255,255,0.4);
    font-size: 18px; cursor: pointer; padding: 4px; line-height: 1;
  }

  /* ── Progress bar ────────────────────────────────────────── */
  .progress-track {
    background: var(--light); border-radius: 8px; height: 8px; overflow: hidden;
  }
  .progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--green), #34D399);
    border-radius: 8px; transition: width 0.35s ease;
  }

  /* ── Metric grid (audit bar) ─────────────────────────────── */
  .metric-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;
    text-align: center; font-size: 11px; font-weight: 700;
    border-top: 1px solid var(--border); padding-top: 10px; gap: 4px;
  }
  .metric-cell-label { font-size: 9px; font-weight: 600; color: var(--grey); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
  .metric-cell-value { font-size: 16px; font-weight: 800; line-height: 1.1; }
  .metric-cell-sub   { font-size: 9px; font-weight: 600; color: var(--grey); margin-top: 1px; }
  .metric-short  { color: var(--red); }
  .metric-over   { color: var(--green-ink); }
  .metric-match  { color: var(--grey); }
  .metric-rem    { color: var(--gold-ink); }

  /* ── Empty state ─────────────────────────────────────────── */
  .empty-state {
    text-align: center; padding: 40px 20px; color: var(--grey);
  }
  .empty-state-icon { font-size: 44px; margin-bottom: 12px; }
  .empty-state-title { font-weight: 700; font-size: 15px; color: var(--text); margin-bottom: 6px; }
  .empty-state-sub { font-size: 12px; color: var(--grey); line-height: 1.5; }

  /* ── Inventory tab ────────────────────────────────────────── */
  .inv-group-header { background: var(--light); cursor: pointer; }
  .inv-group-header:active { background: #EEF2F7; }
  .inv-group-header .arrow-toggle.open { transform: rotate(90deg); }
  .inv-subtotal-row td { background: var(--gold-bg) !important; border-top: 1.5px solid var(--gold); border-bottom: none; }
  .company-card.active { border-color: var(--navy); box-shadow: 0 2px 12px rgba(27,58,107,0.18); background: #F3F6FB; }

  /* ── Accessibility ────────────────────────────────────────
     Applies across the whole app, on top of the component-specific
     focus styles already set above (search/settings inputs etc).
     A keyboard user must always be able to see where focus is —
     removing outline without a visible replacement is never done
     anywhere in this file. ── */

  /* Any element that reaches focus but has no more specific focus
     rule of its own (buttons, links, custom-checkbox, cards acting
     as buttons, the skip link) gets this ring. `:focus-visible`
     keeps it from showing on a plain mouse click, matching how
     browsers already treat native controls. */
  a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
  textarea:focus-visible, [tabindex]:focus-visible, [role="button"]:focus-visible {
    outline: 3px solid var(--navy2);
    outline-offset: 2px;
  }
  /* Fallback for the (now rare) browser without :focus-visible support —
     better a slightly-too-eager ring than an invisible one. */
  .no-focus-visible-support a:focus, .no-focus-visible-support button:focus,
  .no-focus-visible-support [tabindex]:focus { outline: 3px solid var(--navy2); outline-offset: 2px; }

  .skip-link {
    position: absolute; left: 8px; top: -48px; z-index: 1000;
    background: var(--navy); color: var(--white); font-weight: 700; font-size: 13px;
    padding: 10px 16px; border-radius: 8px; transition: top .15s ease;
  }
  .skip-link:focus { top: 8px; }

  /* Visually-hidden but still announced by screen readers — for labels
     that would be redundant/cluttered if shown, but are still needed
     for anyone not reading the screen visually. */
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
  }

  /* Resets so a real <button> can stand in for what used to be a
     clickable <div> (keyboard/AT-reachable by default) without
     inheriting default button chrome. */
  .file-trigger-tile { display: block; appearance: none; -webkit-appearance: none; }
  .link-btn { appearance: none; -webkit-appearance: none; }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  }

  /* ── Scrollbars — a thin, unobtrusive scrollbar reads as a
     considered desktop app rather than a resized mobile page.
     Firefox via scrollbar-width/color, WebKit/Chromium via
     ::-webkit-scrollbar. Purely cosmetic, no effect on touch. */
  * { scrollbar-width: thin; scrollbar-color: #C7D0DC transparent; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: #C7D0DC; border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
  ::-webkit-scrollbar-thumb:hover { background: #A9B6C8; background-clip: padding-box; }
