/* ============================================================================
   Onix theme — the brand layer over app.css.

   Source of truth: the Figma file "OnixBI — Home v0.1", page "Foundations —
   Tokens & Icons" ("DNT colour tokens — bound to variables"). app.css defines
   the component system through design tokens; this sheet
     1. declares the DNT ramps (teal · navy · coral · grey) and the handful of
        semantic colours the design uses outside the ramps,
     2. re-values app.css's tokens to them, light and dark, and
     3. gives the shared controls the design's shapes (12px buttons, pill
        chips, navy "solid" for the primary action and the selected segment).
   The glass surfaces live in onix-glass.css, the shell in onix-shell.css.
   Loaded AFTER app.css; remove the <link> and the neutral base look returns.

   Colour roles, as the design uses them:
     navy   ink, the primary button, the selected segment, the cash hero
     teal   links, focus, progress, charts, "positive" chips, the capture FAB
     coral  the brand accent and notification dot — never body text
     green  money that is settled / covered (posted, paid, live, covered)
     amber  needs a look (for review, the missing-documents alert)
   ============================================================================ */

:root {
    /* ── DNT ramps (Figma variables) ─────────────────────────────────────── */
    --dnt-teal-50:  #F0F7F8;  --dnt-teal-100: #DCECEE;  --dnt-teal-200: #B4D6DC;
    --dnt-teal-300: #87BDC6;  --dnt-teal-400: #4A9CAA;  --dnt-teal-500: #047689;
    --dnt-teal-600: #036576;  --dnt-teal-700: #035360;  --dnt-teal-800: #02404A;

    --dnt-navy-50:  #F1F1F4;  --dnt-navy-100: #DEDFE4;  --dnt-navy-200: #B7BBC6;
    --dnt-navy-300: #8C92A4;  --dnt-navy-400: #535B76;  --dnt-navy-500: #101B41;
    --dnt-navy-600: #0E1738;  --dnt-navy-700: #0B132E;  --dnt-navy-800: #090F23;

    --dnt-coral-50:  #FEF5F5; --dnt-coral-100: #FDE7E8; --dnt-coral-300: #F9ACB0;
    --dnt-coral-500: #F2525A; --dnt-coral-600: #D0474D; --dnt-coral-700: #A9393F;

    --dnt-grey-50:  #F9F9FB;  --dnt-grey-100: #F3F4F7;  --dnt-grey-200: #E5E6EB;
    --dnt-grey-300: #CCCED7;  --dnt-grey-400: #9A9EAC;  --dnt-grey-500: #6F7485;
    --dnt-grey-600: #525666;  --dnt-grey-700: #393D4C;

    /* Used by the design but not part of a ramp. */
    --dnt-green:       #0E8158;  --dnt-green-tint: #E4F4EE;
    --dnt-amber-ink:   #9C6811;  --dnt-amber-tint: #FBF0DC;
    --dnt-chart-teal:  #0089A0;

    /* ── Type ────────────────────────────────────────────────────────────── */
    --font-display: "Montserrat", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --font-text: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* ── app.css tokens, re-valued ───────────────────────────────────────── */
    --bg:            #F6F7FA;
    --bg-soft:       var(--dnt-grey-50);
    --panel:         #FFFFFF;
    --panel-2:       var(--dnt-grey-50);
    --panel-hover:   var(--dnt-grey-100);

    --ink:           var(--dnt-navy-500);
    --ink-soft:      var(--dnt-navy-400);
    --muted:         var(--dnt-grey-500);
    --muted-2:       var(--dnt-grey-400);

    --line:          var(--dnt-grey-200);
    --line-strong:   var(--dnt-grey-300);
    --hairline:      rgba(16, 27, 65, 0.08);   /* the design's row divider */

    --brand:         var(--dnt-teal-500);
    --brand-strong:  var(--dnt-teal-700);
    --brand-ink:     #FFFFFF;
    --brand-soft:    var(--dnt-teal-100);
    --brand-soft-2:  var(--dnt-teal-200);
    --ring:          rgba(4, 118, 137, 0.32);

    /* The design's "solid": primary button, selected segment, avatar. */
    --solid:         var(--dnt-navy-500);
    --solid-hover:   var(--dnt-navy-600);
    --solid-ink:     #FFFFFF;
    --solid-shadow:  0 6px 16px rgba(16, 27, 65, 0.22);
    --accent:        var(--dnt-coral-500);

    --good:          var(--dnt-green);
    --good-soft:     var(--dnt-green-tint);
    --danger:        var(--dnt-coral-600);
    --danger-soft:   var(--dnt-coral-100);
    --danger-strong: var(--dnt-coral-700);
    --warn:          var(--dnt-amber-ink);
    --warn-soft:     var(--dnt-amber-tint);
    --info:          var(--dnt-teal-700);
    --info-soft:     var(--dnt-teal-100);

    /* Document states (REV-003), the accountant's colour language on every screen: Draft pink, Posted green,
       Verified blue (Reversed / Cancelled stay muted). --state-on is the text on a filled state step. */
    --state-draft:         #C2185B;  --state-draft-soft:    #FCE4EC;
    --state-posted:        var(--dnt-green);  --state-posted-soft: var(--dnt-green-tint);
    --state-verified:      #1D5FBF;  --state-verified-soft: #E3EDFB;
    --state-on:            #FFFFFF;

    /* Radii — 20px cards, 12–14px controls, 6px chips-in-text. */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --shadow-xs: 0 1px 2px rgba(16, 27, 65, 0.05);
    --shadow-sm: 0 2px 8px rgba(16, 27, 65, 0.06);
    --shadow-md: 0 8px 24px rgba(16, 27, 65, 0.08);
    --shadow-lg: 0 18px 48px rgba(16, 27, 65, 0.18);

    /* Dataviz: revenue in chart teal, expenses in navy/200 (the design's pair). */
    --series-income:  var(--dnt-chart-teal);
    --series-expense: var(--dnt-navy-200);
    --series-result:  var(--dnt-teal-300);

    /* The floating top bar: gap + bar + 8 air — onix-shell.css computes it from the bar's own
       variables; this is the value without the shell. Sticky table headers (app.css /
       onix-datagrid.css) park under it. */
    --topbar-h: 64px;

    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%236F7485' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

/* ─── Dark ───────────────────────────────────────────────────────────────────
   The design ships light only; dark keeps its language on the navy end of the
   ramp: navy/800 page, navy/50 ink, the teal lifted two steps so it still
   reads as the interactive colour, and the "solid" inverted (a navy pill on a
   navy page would vanish). */
:root[data-theme="dark"] {
    --bg:            var(--dnt-navy-800);
    --bg-soft:       var(--dnt-navy-700);
    --panel:         #121C3F;
    --panel-2:       #16214A;
    --panel-hover:   #1B2856;

    --ink:           var(--dnt-navy-50);
    --ink-soft:      var(--dnt-navy-100);
    --muted:         var(--dnt-navy-300);
    --muted-2:       #6B7390;

    --line:          rgba(255, 255, 255, 0.09);
    --line-strong:   rgba(255, 255, 255, 0.17);
    --hairline:      rgba(255, 255, 255, 0.08);

    --brand:         var(--dnt-teal-300);
    --brand-strong:  var(--dnt-teal-200);
    --brand-ink:     var(--dnt-navy-800);
    --brand-soft:    rgba(74, 156, 170, 0.20);
    --brand-soft-2:  rgba(74, 156, 170, 0.34);
    --ring:          rgba(135, 189, 198, 0.42);

    --solid:         var(--dnt-navy-50);
    --solid-hover:   #FFFFFF;
    --solid-ink:     var(--dnt-navy-500);
    --solid-shadow:  0 6px 16px rgba(0, 0, 0, 0.35);

    --good:          #5FCFA4;
    --good-soft:     rgba(14, 129, 88, 0.24);
    --danger:        var(--dnt-coral-300);
    --danger-soft:   rgba(242, 82, 90, 0.18);
    --danger-strong: var(--dnt-coral-300);
    --warn:          #E8BC68;
    --warn-soft:     rgba(156, 104, 17, 0.28);
    --info:          var(--dnt-teal-200);
    --info-soft:     rgba(74, 156, 170, 0.20);
    --state-draft:         #F48FB1;  --state-draft-soft:    rgba(233, 30, 99, 0.22);
    --state-posted:        #5FCFA4;  --state-posted-soft:   rgba(14, 129, 88, 0.24);
    --state-verified:      #8AB4F8;  --state-verified-soft: rgba(66, 133, 244, 0.24);
    --state-on:            var(--dnt-navy-800);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.40);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.55);

    --series-income:  #2FB3C8;
    --series-expense: var(--dnt-navy-400);

    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238C92A4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:            var(--dnt-navy-800);
        --bg-soft:       var(--dnt-navy-700);
        --panel:         #121C3F;
        --panel-2:       #16214A;
        --panel-hover:   #1B2856;
        --ink:           var(--dnt-navy-50);
        --ink-soft:      var(--dnt-navy-100);
        --muted:         var(--dnt-navy-300);
        --muted-2:       #6B7390;
        --line:          rgba(255, 255, 255, 0.09);
        --line-strong:   rgba(255, 255, 255, 0.17);
        --hairline:      rgba(255, 255, 255, 0.08);
        --brand:         var(--dnt-teal-300);
        --brand-strong:  var(--dnt-teal-200);
        --brand-ink:     var(--dnt-navy-800);
        --brand-soft:    rgba(74, 156, 170, 0.20);
        --brand-soft-2:  rgba(74, 156, 170, 0.34);
        --ring:          rgba(135, 189, 198, 0.42);
        --solid:         var(--dnt-navy-50);
        --solid-hover:   #FFFFFF;
        --solid-ink:     var(--dnt-navy-500);
        --solid-shadow:  0 6px 16px rgba(0, 0, 0, 0.35);
        --good:          #5FCFA4;
        --good-soft:     rgba(14, 129, 88, 0.24);
        --danger:        var(--dnt-coral-300);
        --danger-soft:   rgba(242, 82, 90, 0.18);
        --danger-strong: var(--dnt-coral-300);
        --warn:          #E8BC68;
        --warn-soft:     rgba(156, 104, 17, 0.28);
        --info:          var(--dnt-teal-200);
        --info-soft:     rgba(74, 156, 170, 0.20);
        --state-draft:         #F48FB1;  --state-draft-soft:    rgba(233, 30, 99, 0.22);
        --state-posted:        #5FCFA4;  --state-posted-soft:   rgba(14, 129, 88, 0.24);
        --state-verified:      #8AB4F8;  --state-verified-soft: rgba(66, 133, 244, 0.24);
        --state-on:            var(--dnt-navy-800);
        --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.40);
        --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.55);
        --series-income:  #2FB3C8;
        --series-expense: var(--dnt-navy-400);
        --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238C92A4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    }
}

/* ─── Type ─────────────────────────────────────────────────────────────────── */

html, body { font-family: var(--font-text); }

h1, h2, h3,
.apps-grid-title {
    font-family: var(--font-display);
    color: var(--ink);
}
h1 { font-size: 1.7rem;  font-weight: 700; letter-spacing: -0.015em; line-height: 1.1; }
h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.012em; line-height: 1.15; }
h3 { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.005em; }

/* ─── Controls in the design's shapes, drawn tight ─────────────────────────── */

.button {
    border-radius: 8px;
    padding: 5px 11px;
    font-weight: 600;
    border-color: var(--line);
}
.button.small { border-radius: 7px; }

/* Button/Primary: navy, soft navy shadow — not the brand teal. */
.button.primary {
    background: var(--solid);
    color: var(--solid-ink);
    border-color: transparent;
    box-shadow: var(--solid-shadow);
}
.button.primary:hover { background: var(--solid-hover); border-color: transparent; }

/* A filled destructive button is the same coral in both themes: the dark
   theme's --danger is a light tint meant for text, not for a fill. */
.button.danger,
.button.danger:hover { background: var(--dnt-coral-600); border-color: var(--dnt-coral-700); color: #FFFFFF; }
.button.danger:hover { background: var(--dnt-coral-700); }

/* "Selected" reads as the navy pill everywhere the design would. */
.view-switcher-btn.active,
.statusbar-step.current,
.settings-nav-item.active,
.pager .pager-btn.current {
    background: var(--solid);
    border-color: var(--solid);
    color: var(--solid-ink);
}

/* Chips: the design's status chip — pill, tinted, no dot, no outline. */
.badge {
    padding: 2px 9px;
    border: 0;
    font-size: 0.74rem;
    font-weight: 550;
    background: var(--panel-hover);
    color: var(--ink-soft);
}
.badge::before { display: none; }
.badge.is-good, .badge-ok { border: 0; }
.badge.is-active, .badge.is-info { background: var(--brand-soft); color: var(--brand-strong); border: 0; }
.badge.is-bad, .badge-warn, .badge-off { border: 0; }
.badge.is-draft { background: var(--state-draft-soft); color: var(--state-draft); }
.badge.is-posted { background: var(--state-posted-soft); color: var(--state-posted); }
.badge.is-verified { background: var(--state-verified-soft); color: var(--state-verified); }

/* REV-011: a document accounted in another month than its invoice date's — the date and the period in red,
   in the editor (the fields) and in the list (the cells). */
span.is-period-mismatch { color: var(--danger-strong); font-weight: 600; }
label.is-period-mismatch > span:first-child { color: var(--danger-strong); }
label.is-period-mismatch input,
label.is-period-mismatch select { color: var(--danger-strong); border-color: var(--danger); }
.period-confirm { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-left: 3px solid var(--danger); }
.period-confirm p { margin: 0; }
.period-confirm__actions { display: flex; gap: 8px; }
/* IDE-009: the period is typed (MM.yyyy), the allowed months listed under it; what the field refuses — text that is no
   month, a month the date does not allow, a locked period — is said under the row, in the fields' column. */
.invoice-period-field input { flex: 1 1 auto; width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.invoice-period-field input[aria-invalid="true"] { border-color: var(--danger); }
.invoice-header .form-column__side--contents.is-period-mismatch > label input { color: var(--danger-strong); border-color: var(--danger); }
/* The document's condition names the period (IDE-004, onix-form.css .is-condition-error): the typed field is red the same way. */
.is-condition-error .invoice-period-field input { color: var(--danger-strong); border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.period-note { margin: 2px 0 0; color: var(--danger-strong); font-size: 0.78rem; font-weight: 550; line-height: 1.3; }
.form-column .form-column__side--contents > .span-all.period-note { grid-column: 2 / -1; }

/* The state bar's current step in its state's colour (StatusBar Step.Tone); a muted state keeps a quiet pill. */
.statusbar-step.current.is-draft { background: var(--state-draft); border-color: var(--state-draft); color: var(--state-on); }
.statusbar-step.current.is-posted { background: var(--state-posted); border-color: var(--state-posted); color: var(--state-on); }
.statusbar-step.current.is-verified { background: var(--state-verified); border-color: var(--state-verified); color: var(--state-on); }
.statusbar-step.current.is-muted { background: var(--panel-hover); border-color: var(--line-strong); color: var(--ink-soft); }

.avatar { --avatar-color: var(--brand-strong); }
.star.on { color: #E0A93B; }

input[type=checkbox], input[type=radio] { accent-color: var(--brand); }

/* Inputs: a flat field with a line under it (app.css), not a rounded box — the figures and the
   texts of a form read as a table. The toolbar's and the settings' controls keep a light frame. */
.toolbar input[type=text], .toolbar select,
.settings-input input[type=text], .settings-input input[type=number],
.settings-input input[type=password], .settings-input select {
    border-radius: 7px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Colour layer — the hues beyond the ramps.

   The ramps alone (teal · navy · grey, a coral dot) read monochrome once every
   screen is built from them. This layer adds a small family of hues and gives
   them jobs: a colour per rail destination (and its icon, icons/glass), a
   colour per app (ModuleCatalog) that the top bar, tiles, table heads and
   form accents carry, and a colour per document state so a list can be read
   by colour alone. Everything below is a token with a dark twin; the shell,
   glass and home sheets spend them.

   Document states (REV-003 kept: Reversed / Cancelled stay muted):
     Draft rose · Posted green · Verified blue · Paid/Done emerald
     Confirmed/In progress teal · Sent/Pending indigo · Needs action amber
     Overdue/Failed orange · Rejected/Blocked red · Cancelled/Reversed slate
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* ── Hues: an ink (text on a tint, AA on white) and its tint ─────────── */
    --hue-rose:    #C2185B;  --hue-rose-soft:    #FCE4EC;
    --hue-red:     #D0474D;  --hue-red-soft:     #FDE7E8;
    --hue-orange:  #C2410C;  --hue-orange-soft:  #FEE8DC;
    --hue-amber:   #9C6811;  --hue-amber-soft:   #FBF0DC;
    --hue-green:   #0E8158;  --hue-green-soft:   #E4F4EE;
    --hue-emerald: #0F766E;  --hue-emerald-soft: #D7F0EC;
    --hue-teal:    #047689;  --hue-teal-soft:    #DCECEE;
    --hue-blue:    #1D5FBF;  --hue-blue-soft:    #E3EDFB;
    --hue-indigo:  #4F46E5;  --hue-indigo-soft:  #E6E6FB;
    --hue-violet:  #6D28D9;  --hue-violet-soft:  #EDE6FB;
    --hue-slate:   #6F7485;  --hue-slate-soft:   #EEF0F4;

    /* ── The rail's destinations (SideRail / MobileTabBar data-nav) ─────── */
    --nav-home:      #047689;
    --nav-documents: #6D28D9;
    --nav-banking:   #1D4ED8;
    --nav-invoices:  #EA580C;
    --nav-reports:   #D97706;
    --nav-guides:    #059669;
    --nav-apps:      #4F46E5;
    --nav-settings:  #525666;

    /* ── Record states beyond draft / posted / verified ─────────────────── */
    --state-paid:    var(--hue-emerald);  --state-paid-soft:    var(--hue-emerald-soft);
    --state-active:  var(--hue-teal);     --state-active-soft:  var(--hue-teal-soft);
    --state-sent:    var(--hue-indigo);   --state-sent-soft:    var(--hue-indigo-soft);
    --state-warn:    var(--hue-amber);    --state-warn-soft:    var(--hue-amber-soft);
    --state-overdue: var(--hue-orange);   --state-overdue-soft: var(--hue-orange-soft);
    --state-bad:     var(--hue-red);      --state-bad-soft:     var(--hue-red-soft);
    --state-muted:   var(--hue-slate);    --state-muted-soft:   var(--hue-slate-soft);

    /* The "solid" (primary button, selected segment, current pager page) is
       the brand teal, not navy: the one control the eye looks for is in colour. */
    --solid:        var(--dnt-teal-600);
    --solid-hover:  var(--dnt-teal-700);
    --solid-shadow: 0 6px 16px rgba(4, 118, 137, 0.28);

    /* Trend chart: revenue teal, expenses coral — two hues, not teal and grey. */
    --series-income:  #0089A0;
    --series-expense: #F2525A;
}

:root[data-theme="dark"] {
    --hue-rose:    #F48FB1;  --hue-rose-soft:    rgba(233, 30, 99, 0.22);
    --hue-red:     #F9ACB0;  --hue-red-soft:     rgba(242, 82, 90, 0.20);
    --hue-orange:  #FDAE7B;  --hue-orange-soft:  rgba(234, 88, 12, 0.24);
    --hue-amber:   #E8BC68;  --hue-amber-soft:   rgba(156, 104, 17, 0.28);
    --hue-green:   #5FCFA4;  --hue-green-soft:   rgba(14, 129, 88, 0.24);
    --hue-emerald: #5EEAD4;  --hue-emerald-soft: rgba(13, 148, 136, 0.22);
    --hue-teal:    #87BDC6;  --hue-teal-soft:    rgba(74, 156, 170, 0.22);
    --hue-blue:    #8AB4F8;  --hue-blue-soft:    rgba(66, 133, 244, 0.24);
    --hue-indigo:  #A5B4FC;  --hue-indigo-soft:  rgba(99, 102, 241, 0.26);
    --hue-violet:  #C4B5FD;  --hue-violet-soft:  rgba(124, 58, 237, 0.26);
    --hue-slate:   #9AA0B4;  --hue-slate-soft:   rgba(255, 255, 255, 0.08);
    --nav-home:      #87BDC6;
    --nav-documents: #C4B5FD;
    --nav-banking:   #8AB4F8;
    --nav-invoices:  #FDAE7B;
    --nav-reports:   #FBBF24;
    --nav-guides:    #34D399;
    --nav-apps:      #A5B4FC;
    --nav-settings:  #B7BBC6;
    --solid:        var(--dnt-teal-300);
    --solid-hover:  var(--dnt-teal-200);
    --solid-ink:    var(--dnt-navy-800);
    --solid-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    --series-income:  #2FB3C8;
    --series-expense: #F9ACB0;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --hue-rose:    #F48FB1;  --hue-rose-soft:    rgba(233, 30, 99, 0.22);
        --hue-red:     #F9ACB0;  --hue-red-soft:     rgba(242, 82, 90, 0.20);
        --hue-orange:  #FDAE7B;  --hue-orange-soft:  rgba(234, 88, 12, 0.24);
        --hue-amber:   #E8BC68;  --hue-amber-soft:   rgba(156, 104, 17, 0.28);
        --hue-green:   #5FCFA4;  --hue-green-soft:   rgba(14, 129, 88, 0.24);
        --hue-emerald: #5EEAD4;  --hue-emerald-soft: rgba(13, 148, 136, 0.22);
        --hue-teal:    #87BDC6;  --hue-teal-soft:    rgba(74, 156, 170, 0.22);
        --hue-blue:    #8AB4F8;  --hue-blue-soft:    rgba(66, 133, 244, 0.24);
        --hue-indigo:  #A5B4FC;  --hue-indigo-soft:  rgba(99, 102, 241, 0.26);
        --hue-violet:  #C4B5FD;  --hue-violet-soft:  rgba(124, 58, 237, 0.26);
        --hue-slate:   #9AA0B4;  --hue-slate-soft:   rgba(255, 255, 255, 0.08);
        --nav-home:      #87BDC6;
        --nav-documents: #C4B5FD;
        --nav-banking:   #8AB4F8;
        --nav-invoices:  #FDAE7B;
        --nav-reports:   #FBBF24;
        --nav-guides:    #34D399;
        --nav-apps:      #A5B4FC;
        --nav-settings:  #B7BBC6;
        --solid:        var(--dnt-teal-300);
        --solid-hover:  var(--dnt-teal-200);
        --solid-ink:    var(--dnt-navy-800);
        --solid-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
        --series-income:  #2FB3C8;
        --series-expense: #F9ACB0;
    }
}

/* ─── The app's colour, as text ──────────────────────────────────────────────
   --app-color is the module's tile colour (ModuleCatalog), set on the shell
   (MainLayout), the top bar's menu (TopBar) and each tile. As a fill it is
   used as is; as text it is deepened towards the ink in light and lifted
   towards white in dark so a bright module colour stays readable. */
.shell, .shell-subnav, .app-tile, .apps-admin-icon, .kanban-col-head, .form-card, .stat-card, .card {
    --app-ink: color-mix(in srgb, var(--app-color, var(--brand)) 84%, var(--ink));
}
:root[data-theme="dark"] .shell,
:root[data-theme="dark"] .shell-subnav,
:root[data-theme="dark"] .app-tile,
:root[data-theme="dark"] .apps-admin-icon,
:root[data-theme="dark"] .kanban-col-head,
:root[data-theme="dark"] .form-card,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] .card { --app-ink: color-mix(in srgb, var(--app-color, var(--brand)) 58%, #FFFFFF); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .shell,
    :root:not([data-theme="light"]) .shell-subnav,
    :root:not([data-theme="light"]) .app-tile,
    :root:not([data-theme="light"]) .apps-admin-icon,
    :root:not([data-theme="light"]) .kanban-col-head,
    :root:not([data-theme="light"]) .form-card,
    :root:not([data-theme="light"]) .stat-card,
    :root:not([data-theme="light"]) .card { --app-ink: color-mix(in srgb, var(--app-color, var(--brand)) 58%, #FFFFFF); }
}

/* ─── Primary action: a teal gradient ───────────────────────────────────── */
.button.primary {
    background: linear-gradient(135deg, var(--dnt-teal-500), var(--dnt-teal-700));
    border-color: transparent;
    color: #FFFFFF;
}
.button.primary:hover { background: linear-gradient(135deg, var(--dnt-teal-600), var(--dnt-teal-800)); }
:root[data-theme="dark"] .button.primary { background: linear-gradient(135deg, var(--dnt-teal-200), var(--dnt-teal-400)); color: var(--dnt-navy-800); }
:root[data-theme="dark"] .button.primary:hover { background: linear-gradient(135deg, #FFFFFF, var(--dnt-teal-300)); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .button.primary { background: linear-gradient(135deg, var(--dnt-teal-200), var(--dnt-teal-400)); color: var(--dnt-navy-800); }
    :root:not([data-theme="light"]) .button.primary:hover { background: linear-gradient(135deg, #FFFFFF, var(--dnt-teal-300)); }
}

/* ─── Status chips: one colour per state, a dot in it ───────────────────── */
.badge { gap: 6px; padding: 2px 9px 2px 8px; }
.badge::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge,
.badge.is-muted, .badge-off { background: var(--state-muted-soft); color: var(--state-muted); }
.badge.is-good, .badge-ok { background: var(--state-paid-soft); color: var(--state-paid); }
.badge.is-active { background: var(--state-active-soft); color: var(--state-active); }
.badge.is-info { background: var(--hue-blue-soft); color: var(--hue-blue); }
.badge.is-sent { background: var(--state-sent-soft); color: var(--state-sent); }
.badge.is-warn, .badge-warn { background: var(--state-warn-soft); color: var(--state-warn); }
.badge.is-overdue { background: var(--state-overdue-soft); color: var(--state-overdue); }
.badge.is-bad { background: var(--state-bad-soft); color: var(--state-bad); }
.badge.is-draft { background: var(--state-draft-soft); color: var(--state-draft); }
.badge.is-posted { background: var(--state-posted-soft); color: var(--state-posted); }
.badge.is-verified { background: var(--state-verified-soft); color: var(--state-verified); }

/* The state bar: the current step filled with its state's colour, the steps
   behind it tinted "done" green. */
.statusbar-step.done { color: var(--state-posted); background: var(--state-posted-soft); }
.statusbar-step.current.is-good { background: var(--state-paid); border-color: var(--state-paid); color: var(--state-on); }
.statusbar-step.current.is-active { background: var(--state-active); border-color: var(--state-active); color: var(--state-on); }
.statusbar-step.current.is-sent { background: var(--state-sent); border-color: var(--state-sent); color: var(--state-on); }
.statusbar-step.current.is-warn { background: var(--state-warn); border-color: var(--state-warn); color: var(--state-on); }
.statusbar-step.current.is-overdue { background: var(--state-overdue); border-color: var(--state-overdue); color: var(--state-on); }
.statusbar-step.current.is-bad { background: var(--state-bad); border-color: var(--state-bad); color: var(--state-on); }

/* Alerts and the small state helpers follow the same hues. */
.alert.warn { background: var(--hue-amber-soft); color: var(--hue-amber); border-color: color-mix(in srgb, var(--hue-amber) 30%, transparent); }
.alert.info { background: var(--hue-blue-soft); color: var(--hue-blue); border-color: color-mix(in srgb, var(--hue-blue) 30%, transparent); }
.stat-card .stat-delta.up { color: var(--hue-green); }
.stat-card .stat-delta.down { color: var(--hue-red); }

/* ═══════════════════════════════════════════════════════════════════════════
   Onix identity — the App Store Connect palette.

   The look of App Store Connect (and apple.com's developer tools): a flat,
   near-white page (#F5F5F7), white surfaces with a grey hairline instead of a
   white rim, near-black ink (#1D1D1F) with grey secondary text (#6E6E73), and
   one blue — Apple's #0071E3 — for every link, tab, selection and primary
   action. No gradients: the primary button is a flat blue, the status chips a
   coloured dot and a tint, a table a white sheet with hairline rows and small
   grey capitals for its heads (the S/4HANA list look: bold ink in the cells,
   blue chevrons and links, the selection in a light blue). Dark is Apple's:
   #1C1C1E surfaces on a #111114 page, #2997FF links, #0A84FF fills.

   The ramps keep their historical slot names (the "teal" slots hold the
   blues, the "navy" slots the ink greys, the "coral" slots the orange accent)
   so every sheet that spends a token follows without a change; the --obi-*
   tokens below are the ones onix-glass.css reads (the page, the progress bar).
   Destructive actions stay red.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* ── The Apple ramps ────────────────────────────────────────────────── */
    --obi-navy-900:  #0A2A52;
    --obi-blue-700:  #0051A8;
    --obi-blue-600:  #0066CC;
    --obi-blue-500:  #0071E3;
    --obi-blue-400:  #1A85F0;
    --obi-blue-300:  #2997FF;
    --obi-sky-400:   #5AB0FF;
    --obi-sky-300:   #7FC0FF;
    --obi-sky-200:   #CFE2FF;
    --obi-sky-100:   #E9F2FF;
    --obi-sky-50:    #F5F9FF;
    --obi-ink-900:   #1D1D1F;
    --obi-ink-700:   #424245;
    --obi-ink-500:   #6E6E73;
    --obi-ink-300:   #86868B;
    --obi-ink-200:   #D2D2D7;
    --obi-ink-100:   #E5E5EA;
    --obi-amber-700: #B25000;
    --obi-amber-600: #E07C00;
    --obi-amber-500: #FF9500;
    --obi-amber-300: #FFC078;
    --obi-amber-100: #FFF1E0;
    --obi-red-700:   #D70015;
    --obi-red-100:   #FDE8E9;
    --obi-green-700: #248A3D;
    --obi-green-100: #E3F6E8;
    /* The one "gradient" is flat: Apple's buttons are one blue. */
    --obi-gradient:  #0071E3;
    /* The page: flat #F5F5F7, nothing on it. */
    --obi-page:      #F5F5F7;

    /* ── The slots: "teal" = the blues, "navy" = the ink greys, "coral" = orange ─ */
    --dnt-teal-50:  var(--obi-sky-50);   --dnt-teal-100: var(--obi-sky-100);  --dnt-teal-200: var(--obi-sky-200);
    --dnt-teal-300: var(--obi-sky-400);  --dnt-teal-400: var(--obi-blue-400); --dnt-teal-500: var(--obi-blue-500);
    --dnt-teal-600: var(--obi-blue-600); --dnt-teal-700: var(--obi-blue-700); --dnt-teal-800: var(--obi-navy-900);

    --dnt-navy-50:  #F5F5F7;  --dnt-navy-100: #D1D1D6;  --dnt-navy-200: #AEAEB2;
    --dnt-navy-300: var(--obi-ink-300); --dnt-navy-400: var(--obi-ink-700); --dnt-navy-500: var(--obi-ink-900);
    --dnt-navy-600: #2C2C2E;  --dnt-navy-700: #1C1C1E;  --dnt-navy-800: #111114;

    --dnt-coral-50:  #FFF8F0; --dnt-coral-100: var(--obi-amber-100); --dnt-coral-300: var(--obi-amber-300);
    --dnt-coral-500: var(--obi-amber-500); --dnt-coral-600: var(--obi-amber-600); --dnt-coral-700: var(--obi-amber-700);

    --dnt-grey-50:  #FAFAFC;  --dnt-grey-100: #F2F2F7;  --dnt-grey-200: var(--obi-ink-100);
    --dnt-grey-300: var(--obi-ink-200); --dnt-grey-400: #AEAEB2; --dnt-grey-500: var(--obi-ink-500);
    --dnt-grey-600: var(--obi-ink-700); --dnt-grey-700: #2C2C2E;

    --dnt-green:       var(--obi-green-700); --dnt-green-tint: var(--obi-green-100);
    --dnt-amber-ink:   var(--obi-amber-700); --dnt-amber-tint: var(--obi-amber-100);
    --dnt-chart-teal:  var(--obi-blue-500);

    /* ── Type: the system face (SF on Apple, Segoe on Windows), Inter as the stand-in ─ */
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-text:    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* ── Roles ──────────────────────────────────────────────────────────── */
    --bg:            #F5F5F7;
    --bg-soft:       #FAFAFC;
    --panel:         #FFFFFF;
    --panel-2:       #FAFAFC;
    --panel-hover:   #F2F2F7;
    --hairline:      rgba(0, 0, 0, 0.08);
    --line:          var(--obi-ink-100);
    --line-strong:   var(--obi-ink-200);
    --ring:          rgba(0, 113, 227, 0.32);
    --solid:         var(--obi-blue-500);
    --solid-hover:   #0077ED;
    --solid-shadow:  0 0 0 0 transparent;
    --accent:        var(--obi-amber-500);
    --danger:        var(--obi-red-700);
    --danger-soft:   var(--obi-red-100);
    --danger-strong: #B3000F;
    --info:          var(--obi-blue-600);
    --info-soft:     var(--obi-sky-100);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.16);
    --series-income:  var(--obi-blue-500);
    --series-expense: var(--obi-amber-500);
    --series-result:  var(--obi-sky-400);

    /* ── Rail destinations: Apple's system colours, deepened to read as text ─ */
    --nav-home:      var(--obi-blue-500);
    --nav-documents: #5E5CE6;
    --nav-banking:   #1C8EA8;
    --nav-invoices:  #E8710A;
    --nav-reports:   #9B3FD1;
    --nav-guides:    #248A3D;
    --nav-apps:      #4A6CF7;
    --nav-settings:  var(--obi-ink-500);

    /* ── States on the white page ───────────────────────────────────────── */
    --state-posted:        var(--obi-green-700);  --state-posted-soft:   var(--obi-green-100);
    --state-verified:      var(--obi-blue-500);   --state-verified-soft: var(--obi-sky-100);
    --state-active:        #1C8EA8;               --state-active-soft:   #E0F4F8;
    --state-warn:          var(--obi-amber-700);  --state-warn-soft:     var(--obi-amber-100);
    --state-bad:           var(--obi-red-700);    --state-bad-soft:      var(--obi-red-100);
    --state-muted:         var(--obi-ink-500);    --state-muted-soft:    #F2F2F7;
    --hue-green:   var(--obi-green-700); --hue-green-soft: var(--obi-green-100);
    --hue-blue:    var(--obi-blue-500);  --hue-blue-soft:  var(--obi-sky-100);
    --hue-amber:   var(--obi-amber-700); --hue-amber-soft: var(--obi-amber-100);
    --hue-red:     var(--obi-red-700);   --hue-red-soft:   var(--obi-red-100);
    --hue-slate:   var(--obi-ink-500);   --hue-slate-soft: #F2F2F7;
}

:root[data-theme="dark"] {
    --bg:            #111114;
    --bg-soft:       #161618;
    --panel:         #1C1C1E;
    --panel-2:       #232326;
    --panel-hover:   #2C2C2E;
    --ink:           #F5F5F7;
    --ink-soft:      #D1D1D6;
    --muted:         #A1A1A6;
    --muted-2:       #7C7C82;
    --line:          rgba(255, 255, 255, 0.10);
    --line-strong:   rgba(255, 255, 255, 0.18);
    --hairline:      rgba(255, 255, 255, 0.08);
    --brand:         var(--obi-blue-300);
    --brand-strong:  var(--obi-sky-400);
    --brand-ink:     #FFFFFF;
    --brand-soft:    rgba(10, 132, 255, 0.20);
    --brand-soft-2:  rgba(10, 132, 255, 0.34);
    --ring:          rgba(41, 151, 255, 0.42);
    --solid:         #0A84FF;
    --solid-hover:   var(--obi-blue-300);
    --solid-ink:     #FFFFFF;
    --solid-shadow:  0 1px 2px rgba(0, 0, 0, 0.30);
    --accent:        #FF9F0A;
    --good:          #30D158;
    --good-soft:     rgba(48, 209, 88, 0.18);
    --danger:        #FF453A;
    --danger-soft:   rgba(255, 69, 58, 0.18);
    --danger-strong: #FF6961;
    --warn:          #FF9F0A;
    --warn-soft:     rgba(255, 159, 10, 0.18);
    --info:          var(--obi-sky-400);
    --info-soft:     rgba(10, 132, 255, 0.20);
    --series-income:  var(--obi-blue-300);
    --series-expense: #FF9F0A;
    --series-result:  var(--obi-sky-300);
    --nav-home:      var(--obi-blue-300);
    --nav-documents: #7D7AFF;
    --nav-banking:   #40C8E0;
    --nav-invoices:  #FF9F0A;
    --nav-reports:   #BF5AF2;
    --nav-guides:    #30D158;
    --nav-apps:      #6E8CFF;
    --nav-settings:  #A1A1A6;
    --state-posted:   #30D158;  --state-posted-soft:   rgba(48, 209, 88, 0.18);
    --state-verified: var(--obi-sky-400); --state-verified-soft: rgba(10, 132, 255, 0.22);
    --state-active:   #40C8E0;  --state-active-soft:   rgba(64, 200, 224, 0.20);
    --state-warn:     #FF9F0A;  --state-warn-soft:     rgba(255, 159, 10, 0.18);
    --state-bad:      #FF453A;  --state-bad-soft:      rgba(255, 69, 58, 0.18);
    --state-muted:    #A1A1A6;  --state-muted-soft:    rgba(255, 255, 255, 0.08);
    --hue-green: #30D158; --hue-green-soft: rgba(48, 209, 88, 0.18);
    --hue-blue:  var(--obi-sky-400); --hue-blue-soft:  rgba(10, 132, 255, 0.22);
    --hue-amber: #FF9F0A; --hue-amber-soft: rgba(255, 159, 10, 0.18);
    --hue-red:   #FF453A; --hue-red-soft:   rgba(255, 69, 58, 0.18);
    --hue-slate: #A1A1A6; --hue-slate-soft: rgba(255, 255, 255, 0.08);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:            #111114;
        --bg-soft:       #161618;
        --panel:         #1C1C1E;
        --panel-2:       #232326;
        --panel-hover:   #2C2C2E;
        --ink:           #F5F5F7;
        --ink-soft:      #D1D1D6;
        --muted:         #A1A1A6;
        --muted-2:       #7C7C82;
        --line:          rgba(255, 255, 255, 0.10);
        --line-strong:   rgba(255, 255, 255, 0.18);
        --hairline:      rgba(255, 255, 255, 0.08);
        --brand:         var(--obi-blue-300);
        --brand-strong:  var(--obi-sky-400);
        --brand-ink:     #FFFFFF;
        --brand-soft:    rgba(10, 132, 255, 0.20);
        --brand-soft-2:  rgba(10, 132, 255, 0.34);
        --ring:          rgba(41, 151, 255, 0.42);
        --solid:         #0A84FF;
        --solid-hover:   var(--obi-blue-300);
        --solid-ink:     #FFFFFF;
        --solid-shadow:  0 1px 2px rgba(0, 0, 0, 0.30);
        --accent:        #FF9F0A;
        --good:          #30D158;
        --good-soft:     rgba(48, 209, 88, 0.18);
        --danger:        #FF453A;
        --danger-soft:   rgba(255, 69, 58, 0.18);
        --danger-strong: #FF6961;
        --warn:          #FF9F0A;
        --warn-soft:     rgba(255, 159, 10, 0.18);
        --info:          var(--obi-sky-400);
        --info-soft:     rgba(10, 132, 255, 0.20);
        --series-income:  var(--obi-blue-300);
        --series-expense: #FF9F0A;
        --series-result:  var(--obi-sky-300);
        --nav-home:      var(--obi-blue-300);
        --nav-documents: #7D7AFF;
        --nav-banking:   #40C8E0;
        --nav-invoices:  #FF9F0A;
        --nav-reports:   #BF5AF2;
        --nav-guides:    #30D158;
        --nav-apps:      #6E8CFF;
        --nav-settings:  #A1A1A6;
        --state-posted:   #30D158;  --state-posted-soft:   rgba(48, 209, 88, 0.18);
        --state-verified: var(--obi-sky-400); --state-verified-soft: rgba(10, 132, 255, 0.22);
        --state-active:   #40C8E0;  --state-active-soft:   rgba(64, 200, 224, 0.20);
        --state-warn:     #FF9F0A;  --state-warn-soft:     rgba(255, 159, 10, 0.18);
        --state-bad:      #FF453A;  --state-bad-soft:      rgba(255, 69, 58, 0.18);
        --state-muted:    #A1A1A6;  --state-muted-soft:    rgba(255, 255, 255, 0.08);
        --hue-green: #30D158; --hue-green-soft: rgba(48, 209, 88, 0.18);
        --hue-blue:  var(--obi-sky-400); --hue-blue-soft:  rgba(10, 132, 255, 0.22);
        --hue-amber: #FF9F0A; --hue-amber-soft: rgba(255, 159, 10, 0.18);
        --hue-red:   #FF453A; --hue-red-soft:   rgba(255, 69, 58, 0.18);
        --hue-slate: #A1A1A6; --hue-slate-soft: rgba(255, 255, 255, 0.08);
    }
}

/* ─── Type, as App Store Connect sets it: semibold headings, tight tracking ── */
h1 { font-size: 1.6rem;  font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; }
h3 { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; }

/* ─── Controls: the flat blue primary, a white secondary with a grey hairline ─ */
.button { border-color: var(--line-strong); box-shadow: none; }
.button:hover { border-color: #AEAEB2; background: var(--panel-hover); }
.button.primary { background: var(--solid); border-color: transparent; color: var(--solid-ink); box-shadow: var(--solid-shadow); }
.button.primary:hover { background: var(--solid-hover); border-color: transparent; }
.button.danger, .button.danger:hover { background: var(--obi-red-700); border-color: transparent; color: #FFFFFF; }
.button.danger:hover { background: #B3000F; }
:root[data-theme="dark"] .button { border-color: var(--line-strong); }
:root[data-theme="dark"] .button:hover { border-color: rgba(255, 255, 255, 0.28); }
:root[data-theme="dark"] .button.primary { background: var(--solid); color: #FFFFFF; }
:root[data-theme="dark"] .button.primary:hover { background: var(--solid-hover); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .button { border-color: var(--line-strong); }
    :root:not([data-theme="light"]) .button:hover { border-color: rgba(255, 255, 255, 0.28); }
    :root:not([data-theme="light"]) .button.primary { background: var(--solid); color: #FFFFFF; }
    :root:not([data-theme="light"]) .button.primary:hover { background: var(--solid-hover); }
}

/* "Selected" is the blue: the view switcher, the current pager page, the settings section. */
.view-switcher-btn.active,
.settings-nav-item.active,
.pager .pager-btn.current { background: var(--solid); border-color: var(--solid); color: var(--solid-ink); }

/* Status chips: App Store Connect's dot + text — the tint is kept, the dot carries the colour. */
.badge { font-weight: 500; }
.badge::before { opacity: 1; }

.star.on { color: var(--obi-amber-500); }

/* ─── Flat: no inset shadows on the controls, the segmented control a grey track ─ */
.onix-segmented { box-shadow: none; background: var(--panel-hover); border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.onix-pillbtn { background: var(--panel); border-color: var(--line-strong); }
.stat-card { border-top: 0; }
.stat-card .stat-label { color: var(--muted); }
.stat-card::after { display: none; }
