/* ==========================================================================
   Onix Glass — the "subtle glass" surface language of the Figma file
   "OnixBI — Home v0.1" (frame "Desktop · 1440 — subtle glass").

   The recipe, as measured on the design's nodes:
     standard card   fill #FFF 66% · border 1px #FFF 90% · background blur 28
                     drop shadow 0 8 24 #101B41 6% · inner highlight 0 1 0 #FFF 90%
                     radius 20 (KPI, trend, recent documents, add documents, upcoming)
     chrome          the same with fill 60% / border 95% (side rail r28, top bar r32)
     alert           fill 70%, radius 18
     tiles in cards  fill #FFF 60–75%, border #FFF 90–95%, radius 12–16
     page            #F6F7FA + three blurred ellipses: teal/200 45% top-left,
                     navy/100 50% top-right, teal/100 50% lower middle (blur 160)

   Two layers: (1) the glass tokens and the page background; (2) the building
   blocks pages compose (card, overline, icon tile, chip, segmented control,
   pill button, row, progress) plus the app.css surfaces — cards, forms,
   toolbars, grids — moved onto the same glass so every module page belongs
   to the design without touching its markup.

   Colours come from onix-theme.css (the DNT ramps); nothing here is a new hue.
   ========================================================================== */

:root {
    /* App Store Connect: the surfaces are white sheets on the #F5F5F7 page, edged with a grey
       hairline (a white rim is invisible there) and lifted by a soft, colourless shadow. */
    --glass-fill:          rgba(255, 255, 255, 0.82);
    --glass-fill-chrome:   rgba(255, 255, 255, 0.78);
    --glass-fill-strong:   rgba(255, 255, 255, 0.88);
    --glass-fill-inset:    rgba(255, 255, 255, 0.70);
    --glass-fill-tile:     rgba(255, 255, 255, 0.92);
    --glass-fill-control:  rgba(0, 0, 0, 0.04);
    --glass-border:        rgba(0, 0, 0, 0.07);
    --glass-border-chrome: rgba(0, 0, 0, 0.07);
    --glass-blur:          28px;
    --glass-shadow:        0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
    --glass-highlight:     inset 0 1px 0 rgba(255, 255, 255, 0.80);
    /* Floating panels are opaque: a backdrop-filter nested inside the blurred
       chrome cannot see the page behind it, and a menu over the navy hero has
       to stay perfectly legible. */
    --glass-pop:           #FFFFFF;

    --blob-1: rgba(180, 214, 220, 0.45);
    --blob-2: rgba(222, 223, 228, 0.50);
    --blob-3: rgba(220, 236, 238, 0.50);
}

:root[data-theme="dark"] {
    --glass-fill:          rgba(255, 255, 255, 0.055);
    --glass-fill-chrome:   rgba(28, 28, 30, 0.80);
    --glass-fill-strong:   rgba(255, 255, 255, 0.075);
    --glass-fill-inset:    rgba(255, 255, 255, 0.05);
    --glass-fill-tile:     rgba(255, 255, 255, 0.08);
    --glass-fill-control:  rgba(255, 255, 255, 0.06);
    --glass-border:        rgba(255, 255, 255, 0.10);
    --glass-border-chrome: rgba(255, 255, 255, 0.12);
    --glass-shadow:        0 8px 24px rgba(0, 0, 0, 0.35);
    --glass-highlight:     inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --glass-pop:           #1C1C1E;
    --blob-1: rgba(4, 118, 137, 0.30);
    --blob-2: rgba(83, 91, 118, 0.22);
    --blob-3: rgba(3, 83, 96, 0.30);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --glass-fill:          rgba(255, 255, 255, 0.055);
        --glass-fill-chrome:   rgba(28, 28, 30, 0.80);
        --glass-fill-strong:   rgba(255, 255, 255, 0.075);
        --glass-fill-inset:    rgba(255, 255, 255, 0.05);
        --glass-fill-tile:     rgba(255, 255, 255, 0.08);
        --glass-fill-control:  rgba(255, 255, 255, 0.06);
        --glass-border:        rgba(255, 255, 255, 0.10);
        --glass-border-chrome: rgba(255, 255, 255, 0.12);
        --glass-shadow:        0 8px 24px rgba(0, 0, 0, 0.35);
        --glass-highlight:     inset 0 1px 0 rgba(255, 255, 255, 0.08);
        --glass-pop:           #1C1C1E;
        --blob-1: rgba(4, 118, 137, 0.30);
        --blob-2: rgba(83, 91, 118, 0.22);
        --blob-3: rgba(3, 83, 96, 0.30);
    }
}

/* No blur available (old WebViews) or the person asked for less transparency:
   the glass goes near-solid so text keeps its contrast. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root { --glass-fill: rgba(255, 255, 255, 0.94); --glass-fill-chrome: rgba(255, 255, 255, 0.94); --glass-fill-strong: rgba(255, 255, 255, 0.96); }
}
@media (prefers-reduced-transparency: reduce) {
    :root { --glass-fill: rgba(255, 255, 255, 0.96); --glass-fill-chrome: rgba(255, 255, 255, 0.96); --glass-fill-strong: #FFFFFF; }
}

/* ─── The page: flat grey-blue with three soft blobs ───────────────────── */

html { background: var(--bg); }
body { background: transparent; }

/* A fixed layer rather than a body background: the blobs stay put while long
   module pages scroll, and the glass always has something to refract. Radial
   gradients stand in for the design's blurred ellipses (no filter cost). */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 620px 470px at 240px 100px, var(--blob-1), transparent 72%),
        radial-gradient(ellipse 540px 420px at calc(100% - 150px) 110px, var(--blob-2), transparent 72%),
        radial-gradient(ellipse 480px 400px at 44% calc(100% - 140px), var(--blob-3), transparent 72%),
        var(--bg);
}

/* ─── Card ─────────────────────────────────────────────────────────────── */

.onix-card {
    position: relative;
    padding: 24px;
    background: var(--glass-fill);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow), var(--glass-highlight);
}

.onix-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.onix-card-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0;
    color: var(--ink);
}

.onix-card-sub {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--muted);
}

/* Link ("View all", "Table view"): Inter Medium 12, teal, trailing chevron. */
.onix-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--brand);
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}
.onix-link:hover { color: var(--brand-strong); text-decoration: none; }
.onix-link svg { width: 12px; height: 12px; flex: none; }

/* ─── Overline: coral wedge + spaced caps ──────────────────────────────── */

.onix-overline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-strong);
}

/* The brand's wedge — the same corner the logo mark carries. */
.onix-wedge {
    width: 10px;
    height: 10px;
    flex: none;
    background: var(--accent);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* ─── Icon tile: the white glass square behind an icon ─────────────────── */

.onix-icontile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--glass-fill-strong);
    border: 1px solid var(--glass-border);
    color: var(--brand-strong);
}
.onix-icontile img { width: 26px; height: 26px; display: block; }
.onix-icontile svg { width: 18px; height: 18px; display: block; }

.onix-icontile--kpi { width: 46px; height: 46px; border-radius: 14px; background: var(--glass-fill-tile); border-color: var(--glass-border-chrome); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.onix-icontile--kpi img { width: 32px; height: 32px; }
.onix-icontile--sm { width: 36px; height: 36px; border-radius: 10px; }
.onix-icontile--warn { background: color-mix(in srgb, var(--warn-soft) 90%, transparent); border-color: transparent; color: var(--warn); }
.onix-icontile--warn svg { width: 20px; height: 20px; }

/* Dark: the icons are full-colour drawings with navy in them, and navy on a
   navy surface disappears — so their tiles stay light, like app icons on a
   dark wallpaper. Bare icons (rail, tab bar, add-documents) get a light
   backing the same way; the spread shadow pads it without moving the layout. */
:root[data-theme="dark"] .onix-icontile:not(.onix-icontile--warn) { background: rgba(255, 255, 255, 0.90); border-color: transparent; color: var(--dnt-teal-700); }
:root[data-theme="dark"] .shell-nav img,
:root[data-theme="dark"] .shell-tab img,
:root[data-theme="dark"] .home-add-tile img { background: rgba(255, 255, 255, 0.88); border-radius: 8px; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.88); }
:root[data-theme="dark"] .shell-mark img { border-radius: 12px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .onix-icontile:not(.onix-icontile--warn) { background: rgba(255, 255, 255, 0.90); border-color: transparent; color: var(--dnt-teal-700); }
    :root:not([data-theme="light"]) .shell-nav img,
    :root:not([data-theme="light"]) .shell-tab img,
    :root:not([data-theme="light"]) .home-add-tile img { background: rgba(255, 255, 255, 0.88); border-radius: 8px; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.88); }
    :root:not([data-theme="light"]) .shell-mark img { border-radius: 12px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22); }
}

/* ─── Chips ────────────────────────────────────────────────────────────── */

.onix-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.45;
    white-space: nowrap;
    background: var(--panel-hover);
    color: var(--ink-soft);
}

/* Delta chips on the KPI tiles: Inter SemiBold 12, padding 3/8. */
.onix-chip--delta { padding: 3px 8px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.onix-chip--up      { background: color-mix(in srgb, var(--brand-soft) 90%, transparent); color: var(--brand-strong); }
.onix-chip--neutral { background: color-mix(in srgb, var(--panel-hover) 90%, transparent); color: var(--dnt-grey-600); }
.onix-chip--down    { background: var(--warn-soft); color: var(--warn); }

/* Document states. */
.onix-chip--review   { background: var(--warn-soft);  color: var(--warn); }
.onix-chip--posted,
.onix-chip--paid     { background: var(--good-soft);  color: var(--good); }
/* REV-039: a reconciled bank transaction — a round green tick (distinct from Bank Transactions' Reviewed ✓). */
.onix-chip--reconciled { background: var(--good); color: #fff; width: 22px; height: 22px; padding: 0; border-radius: 50%; justify-content: center; }
.onix-chip--reconciled svg { width: 14px; height: 14px; }
.onix-chip--captured { background: var(--brand-soft); color: var(--brand-strong); }
.onix-chip--overdue  { background: var(--danger-soft); color: var(--danger-strong); }

:root[data-theme="dark"] .onix-chip--neutral { color: var(--ink-soft); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .onix-chip--neutral { color: var(--ink-soft); } }

/* ─── Segmented control (the period selector) ──────────────────────────── */

.onix-segmented {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: var(--glass-fill-control);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 2px rgba(16, 27, 65, 0.06);
}

.onix-segmented button {
    appearance: none;
    border: 0;
    padding: 8px 16px;
    border-radius: 999px;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}
.onix-segmented button:hover { color: var(--ink); }
.onix-segmented button.is-active { background: var(--solid); color: var(--solid-ink); font-weight: 600; }

/* Pill button (the date-range control and its cousins). */
.onix-pillbtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 10px 12px;
    border-radius: 999px;
    background: var(--glass-fill-control);
    border: 1px solid var(--glass-border);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
    white-space: nowrap;
}
.onix-pillbtn svg { width: 16px; height: 16px; flex: none; color: var(--ink); }

/* ─── Rows (documents, obligations) ────────────────────────────────────── */

.onix-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--hairline);
    color: inherit;
    text-decoration: none;
    min-width: 0;
}
.onix-row:last-child { border-bottom: 0; }
.onix-row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.onix-row-title { font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onix-row-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onix-row-end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.onix-row-amount { font-size: 14px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ─── Progress ─────────────────────────────────────────────────────────── */

.onix-progress { height: 6px; border-radius: 3px; background: var(--hairline); overflow: hidden; }
.onix-progress > span { display: block; height: 100%; border-radius: 3px; background: var(--brand); transition: width 0.4s ease; }
.onix-progress.is-short > span { background: var(--warn); }

/* ─── Small helpers ────────────────────────────────────────────────────── */

.onix-num   { font-variant-numeric: tabular-nums; }
.onix-muted { color: var(--muted); }
.onix-good  { color: var(--good); }
.onix-warn  { color: var(--warn); }

/* ─── app.css surfaces, on the same glass ──────────────────────────────────
   Module pages are built from these classes; moving the classes moves every
   page. Translucent fill + white hairline + the navy-tinted shadow. No
   backdrop-filter on the big scrolling surfaces (tables, kanban): over a
   nearly flat page it is invisible, and it is the expensive half of glass. */

.card,
.form,
.form-card,
.toolbar,
.stat-card,
.empty-state,
.apps-admin-card,
table.grid {
    background: var(--glass-fill);
    border-color: var(--glass-border);
    box-shadow: var(--glass-shadow), var(--glass-highlight);
}

.card, .stat-card, .empty-state, .apps-admin-card { border-radius: 20px; }
/* The forms and the lists are worked in, not looked at: tighter corners than the Home's cards. */
.form, .form-card { border-radius: 14px; }
.toolbar { border-radius: 10px; }
table.grid { border-radius: 12px; }
table.grid thead th:first-child { border-top-left-radius: 12px; }
table.grid thead th:last-child { border-top-right-radius: 12px; }
table.grid tbody:last-child tr:last-child td:first-child { border-bottom-left-radius: 12px; }
table.grid tbody:last-child tr:last-child td:last-child { border-bottom-right-radius: 12px; }

.card, .form, .form-card, .toolbar, .stat-card {
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}

table.grid th, table.grid td { border-bottom-color: var(--hairline); }
.empty-state { border-style: dashed; border-color: var(--line-strong); box-shadow: none; }
/* The accent bar becomes a floating pill: a full-height bar would poke out of the 20px corners. */
.form-card::before { background: var(--brand); top: 18px; bottom: 18px; left: -1px; border-radius: 0 3px 3px 0; }
.stat-card .stat-value { font-family: var(--font-display); font-weight: 700; }
.stat-card::after { display: none; }

.kanban-col { background: var(--glass-fill-inset); border-color: var(--glass-border); border-radius: 16px; }
.kanban-card { border-color: var(--hairline); border-radius: 12px; }

/* Apps grid: white glass tiles, navy glyphs — the rainbow is gone. */
.app-tile {
    background: var(--glass-fill);
    border-color: var(--glass-border);
    box-shadow: var(--glass-shadow), var(--glass-highlight);
    border-radius: 20px;
}
.app-tile::after { display: none; }
.app-tile:hover { border-color: var(--brand-soft-2); }
.app-tile-icon {
    color: var(--ink);
    background: var(--glass-fill-tile);
    border: 1px solid var(--glass-border-chrome);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.app-tile:hover .app-tile-icon { color: var(--brand); }
.apps-admin-icon {
    color: var(--ink);
    background: var(--glass-fill-tile);
    border: 1px solid var(--glass-border-chrome);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Floating panels and the palette. */
.palette,
.toast {
    background: var(--glass-pop);
    border-color: var(--glass-border);
    border-radius: 20px;
}
.toast { border-radius: 14px; }
.setup-balloon { background: var(--glass-pop); border-color: var(--glass-border); border-left-color: var(--brand); border-radius: 14px; }
.palette-backdrop, .drawer-backdrop { background: rgba(16, 27, 65, 0.32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.palette-chip { border-radius: 3px; width: 10px; height: 10px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--chip) 20%, transparent); }

/* Print: no glass, no blobs. */
@media print {
    body::before { display: none; }
    .onix-card, .card, .form, .form-card, .toolbar, table.grid {
        background: #FFFFFF; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; border-color: #CCCED7;
    }
}

/* Bank matching (Pages/Accounting/BankMatchingView): statement columns of transaction
   cards on the left, the open transaction's entry, buttons and dialogs on the right. */
.bankmatch-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.bankmatch-journal { min-width: 240px; }
.bankmatch-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 12px 0; }
.bankmatch-figure { font-family: var(--font-display); font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.bankmatch-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bankmatch-search { min-width: 240px; }
.bankmatch-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
/* REV-039: the detail opens under its row (the grid's detail row), full width. */
.bankmatch-row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.bankmatch-iban { font-size: 0.8rem; font-family: var(--font-mono, ui-monospace, monospace); }
.bankmatch-reconciled-with { margin-left: 6px; font-size: 0.85rem; color: var(--ink-soft); }
.bankmatch-attachments { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.bankmatch-card { cursor: pointer; }
.bankmatch-card.is-selected { outline: 2px solid var(--brand); outline-offset: 6px; border-radius: 8px; }
.kanban-card-amount.is-out { color: var(--danger-strong); }
.kanban-card-amount.is-in { color: var(--good); }
.bankmatch-detail { position: static; display: flex; flex-direction: column; gap: 10px; }
.bankmatch-title { font-family: var(--font-display); margin: 0; display: flex; justify-content: space-between; gap: 12px; }
.bankmatch-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bankmatch-state { display: flex; gap: 6px; flex-wrap: wrap; }
.bankmatch-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.bankmatch-pill {
    display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 999px;
    background: var(--brand-soft); color: var(--brand-strong); font-size: 11px; font-weight: 650; text-align: center;
}
.bankmatch-lines .is-liquidity td { color: var(--muted); }
.bankmatch-lines .is-suspense td { color: var(--warn); font-style: italic; }
.bankmatch-switch td { padding-top: 0; }
.bankmatch-switch .linklike { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; font-size: 12px; text-decoration: underline; }
.bankmatch-remaining .is-zero { color: var(--good); }
.bankmatch-dialog tr.is-preferred td { background: color-mix(in srgb, var(--brand-soft) 60%, transparent); }


/* Digitized invoice review: the original document on the left, the invoice form on
   the right (Invoices.razor + Components/Shared/SourceDocumentPane.razor); stacked,
   document first, on narrow screens. */
.invoice-review.has-source { display: grid; grid-template-columns: minmax(360px, 44%) minmax(0, 1fr); gap: 16px; align-items: start; }
.invoice-review.has-source > .form-card { max-width: none; }
.invoice-source { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; height: calc(100vh - 110px); min-height: 460px; }
.invoice-source__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.invoice-source__head .button { margin-left: auto; }
.invoice-source__pages, .invoice-source__notes { margin: 0; }
.invoice-source__notes ul { margin: 4px 0 0; padding-left: 18px; }
.invoice-source__view { flex: 1; width: 100%; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg-soft); }
.invoice-source__image { overflow: auto; display: flex; justify-content: center; align-items: flex-start; }
.invoice-source__image img { max-width: 100%; height: auto; }
.invoice-source__pages-view { overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px; }
.invoice-source__pages-view img { width: 100%; height: auto; box-shadow: var(--shadow-xs); }

/* The AI validation panel beside the original (ACC-096, InvoiceExtractionPanel.razor): the
   extracted fields with their confidence bars, the review reasons, and the pages with the boxes
   the AI read each value in — a click on a box fills the field. */
.extraction-panel { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.extraction-panel__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.extraction-panel__head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
/* REV-028: "Digitize again" asks first — the question and its two buttons in the panel's head. */
.extraction-panel__confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.86rem; }
/* The title folds the panel; folded, the head keeps the state, the score and the reasons' count. */
.extraction-panel__toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 6px 2px 0; border: 0; border-radius: var(--radius-xs);
    background: none; color: inherit; font: inherit; cursor: pointer;
}
.extraction-panel__toggle:hover .onix-card-title { color: var(--brand-strong); }
.extraction-panel__toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.extraction-panel__chevron { display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--muted); }
.extraction-panel__chevron svg { width: 16px; height: 16px; transform: rotate(90deg); transition: transform var(--dur) var(--ease); }
.extraction-panel.is-collapsed .extraction-panel__chevron svg { transform: rotate(0deg); }
.extraction-panel.is-collapsed { gap: 0; }
.extraction-panel__brief { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.86rem; }
.extraction-panel__brief .onix-num { color: var(--ink); font-weight: 600; }
.extraction-panel__score { display: flex; align-items: center; gap: 8px; }
.extraction-panel__score .onix-progress { flex: 1; min-width: 80px; }
.extraction-panel__fields { display: grid; grid-template-columns: minmax(90px, auto) minmax(0, 1fr) minmax(0, 1fr) 70px; gap: 4px 10px; align-items: center; font-size: 0.9em; }
.extraction-panel__fields .is-changed { color: var(--warn); }
.extraction-panel__fields .onix-progress.is-low > span { background: var(--danger); }
.extraction-panel__reasons { margin: 0; padding-left: 18px; }
.extraction-page { position: relative; }
.extraction-page img { width: 100%; height: auto; display: block; box-shadow: var(--shadow-xs); }
.extraction-box { position: absolute; border: 2px solid var(--brand); border-radius: 2px; background: color-mix(in srgb, var(--brand) 12%, transparent); cursor: pointer; padding: 0; }
.extraction-box:hover, .extraction-box:focus-visible { background: color-mix(in srgb, var(--brand) 28%, transparent); }
.extraction-box.is-low { border-color: var(--warn); }
@media (max-width: 1100px) {
    .invoice-review.has-source { grid-template-columns: minmax(0, 1fr); }
    .invoice-source { position: static; height: 70vh; min-height: 360px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Colour on the glass — the page, the tiles, the app's colour on its surfaces.
   Tokens: onix-theme.css (--hue-*, --app-color / --app-ink, --state-*).
   ═══════════════════════════════════════════════════════════════════════════ */

/* The page's three ellipses in three hues: teal top-left, lavender top-right,
   peach lower middle — the glass chrome blurs them into a soft aurora. */
:root {
    --blob-1: rgba(74, 156, 170, 0.42);
    --blob-2: rgba(167, 139, 250, 0.30);
    --blob-3: rgba(249, 172, 176, 0.32);
}
:root[data-theme="dark"] {
    --blob-1: rgba(4, 118, 137, 0.36);
    --blob-2: rgba(109, 40, 217, 0.26);
    --blob-3: rgba(242, 82, 90, 0.16);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --blob-1: rgba(4, 118, 137, 0.36);
        --blob-2: rgba(109, 40, 217, 0.26);
        --blob-3: rgba(242, 82, 90, 0.16);
    }
}

/* ─── App tiles: each app in its colour again ──────────────────────────── */
.app-tile {
    background: linear-gradient(165deg, color-mix(in srgb, var(--app-color) 14%, #FFFFFF) 0%, var(--glass-fill) 58%);
    border-color: color-mix(in srgb, var(--app-color) 24%, var(--glass-border));
}
.app-tile:hover {
    border-color: color-mix(in srgb, var(--app-color) 55%, transparent);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--app-color) 22%, transparent), var(--glass-highlight);
}
.app-tile-icon,
.apps-admin-icon {
    color: #FFFFFF;
    border-color: transparent;
    background: linear-gradient(140deg, color-mix(in srgb, var(--app-color) 76%, #FFFFFF), var(--app-color));
    box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--app-color) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.app-tile:hover .app-tile-icon { color: #FFFFFF; }
.app-tile:hover .app-tile-title { color: var(--app-ink); }
.shell-apps-panel .app-tile { background: linear-gradient(165deg, color-mix(in srgb, var(--app-color) 12%, #FFFFFF) 0%, var(--glass-fill-inset) 60%); border-color: color-mix(in srgb, var(--app-color) 20%, var(--hairline)); }
:root[data-theme="dark"] .app-tile,
:root[data-theme="dark"] .shell-apps-panel .app-tile { background: linear-gradient(165deg, color-mix(in srgb, var(--app-color) 24%, transparent) 0%, var(--glass-fill) 60%); border-color: color-mix(in srgb, var(--app-color) 30%, var(--glass-border)); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .app-tile,
    :root:not([data-theme="light"]) .shell-apps-panel .app-tile { background: linear-gradient(165deg, color-mix(in srgb, var(--app-color) 24%, transparent) 0%, var(--glass-fill) 60%); border-color: color-mix(in srgb, var(--app-color) 30%, var(--glass-border)); }
}

/* ─── Module pages carry their app's colour ────────────────────────────── */
.shell { --app-color: var(--brand); }

/* The form card's accent pill and its title. */
.form-card::before { background: linear-gradient(180deg, var(--app-color, var(--brand)), color-mix(in srgb, var(--app-color, var(--brand)) 55%, #FFFFFF)); width: 4px; }
.form-card > h3:first-child { color: var(--app-ink, var(--ink)); }

/* Stat cards: a coloured top edge, the label in the colour, a glow behind the figure. */
.stat-card { border-top: 3px solid var(--app-color, var(--brand)); }
.stat-card .stat-label { color: var(--app-ink, var(--brand-strong)); }
.stat-card::after { display: block; background: radial-gradient(circle, color-mix(in srgb, var(--app-color, var(--brand)) 22%, transparent), transparent 70%); opacity: 1; }

/* Table heads as App Store Connect draws them: small grey capitals on the white sheet, a hairline under
   them; the sorted column and a hovered head in the blue. The group rows a whisper of the ink. */
.shell .dxg .dxg-table thead th,
.shell table.grid thead th {
    background: var(--panel);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.shell .dxg .dxg-table thead th.sortable:hover { background: var(--panel-hover); color: var(--ink); }
.shell .dxg .dxg-table thead th.sorted-asc,
.shell .dxg .dxg-table thead th.sorted-desc { color: var(--brand); }
.shell .dxg .dxg-table tbody tr.dxg-group-row > td { background: color-mix(in srgb, var(--ink) 3%, var(--panel)); }
.shell .dxg .dxg-table tbody tr.dxg-group-row .dxg-group-title { color: var(--ink-soft); }

/* Kanban columns: the head tinted with the column's colour (the app's unless the board names one). */
.kanban-col-head { background: color-mix(in srgb, var(--col-color) 9%, transparent); border-radius: 16px 16px 0 0; }
.kanban-col-title { color: var(--col-color); }
:root[data-theme="dark"] .kanban-col-title { color: color-mix(in srgb, var(--col-color) 58%, #FFFFFF); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kanban-col-title { color: color-mix(in srgb, var(--col-color) 58%, #FFFFFF); } }

/* The sidebar of Settings: the current section in the solid teal already; the
   section headings in the brand. */
.settings-nav h3 { color: var(--brand-strong); }

/* ─── Home chips: paid emerald, review amber, captured violet, overdue orange ─ */
.onix-chip--paid     { background: var(--state-paid-soft); color: var(--state-paid); }
.onix-chip--posted   { background: var(--state-posted-soft); color: var(--state-posted); }
.onix-chip--review   { background: var(--state-warn-soft); color: var(--state-warn); }
.onix-chip--captured { background: var(--hue-violet-soft); color: var(--hue-violet); }
.onix-chip--overdue  { background: var(--state-overdue-soft); color: var(--state-overdue); }
.onix-chip--up       { background: var(--state-posted-soft); color: var(--state-posted); }
.onix-chip--down     { background: var(--state-overdue-soft); color: var(--state-overdue); }
.onix-progress > span { background: linear-gradient(90deg, var(--dnt-teal-400), var(--dnt-teal-600)); }
.onix-progress.is-short > span { background: linear-gradient(90deg, #E0A93B, var(--hue-amber)); }

/* ═══ Onix identity: the page as App Store Connect draws it ═══════════════
   Flat #F5F5F7 with the faintest cool wash at the top (onix-theme.css
   --obi-page); dark is the same wash on the near-black page. */
body::before { background: var(--obi-page); }
:root[data-theme="dark"] body::before { background: radial-gradient(1100px 520px at 50% -200px, rgba(41, 151, 255, 0.07), transparent 70%), var(--bg); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) body::before { background: radial-gradient(1100px 520px at 50% -200px, rgba(41, 151, 255, 0.07), transparent 70%), var(--bg); }
}
/* A captured document reads cyan-blue (the fleet has no violet). */
.onix-chip--captured { background: #E1F5FE; color: #0277BD; }
:root[data-theme="dark"] .onix-chip--captured { background: rgba(2, 136, 209, 0.26); color: #4FC3F7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .onix-chip--captured { background: rgba(2, 136, 209, 0.26); color: #4FC3F7; } }
.onix-progress > span { background: linear-gradient(90deg, var(--obi-blue-400), var(--obi-blue-600)); }
.onix-progress.is-short > span { background: linear-gradient(90deg, var(--obi-amber-300), var(--obi-amber-500)); }

/* ═══ Flat ═══════════════════════════════════════════════════════════════════
   App Store Connect has no glass: the surfaces are solid white (dark: #1C1C1E)
   sheets with a grey hairline, the page a flat grey, the chrome opaque. No
   blur, no highlight, no washes, no glows, no tinted or gradient tiles; the
   app's colour survives only on its icon. */
:root {
    --glass-fill:          var(--panel);
    --glass-fill-chrome:   var(--panel);
    --glass-fill-strong:   var(--panel);
    --glass-fill-inset:    var(--panel-2);
    --glass-fill-tile:     var(--panel-hover);
    --glass-fill-control:  var(--panel-hover);
    --glass-border:        var(--line);
    --glass-border-chrome: var(--line);
    --glass-blur:          0px;
    --glass-shadow:        0 1px 2px rgba(0, 0, 0, 0.04);
    --glass-highlight:     0 0 0 0 transparent;
    --glass-pop:           var(--panel);
}
:root[data-theme="dark"] { --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.30); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.30); } }
body::before,
:root[data-theme="dark"] body::before { background: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { background: var(--bg); } }
.onix-card, .card, .form, .form-card, .toolbar, .stat-card, .shell-rail, .shell-topbar, .shell-tabbar, .onix-segmented {
    -webkit-backdrop-filter: none; backdrop-filter: none;
}
.onix-icontile, .onix-icontile--kpi, .app-tile-icon, .apps-admin-icon { box-shadow: none; }
.form-card::before { display: none; }
.app-tile,
.shell-apps-panel .app-tile,
:root[data-theme="dark"] .app-tile,
:root[data-theme="dark"] .shell-apps-panel .app-tile { background: var(--panel); border-color: var(--line); box-shadow: var(--glass-shadow); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .app-tile,
    :root:not([data-theme="light"]) .shell-apps-panel .app-tile { background: var(--panel); border-color: var(--line); box-shadow: var(--glass-shadow); }
}
.app-tile:hover { border-color: var(--brand); box-shadow: var(--glass-shadow); }
.app-tile-icon, .apps-admin-icon { background: var(--app-color); color: #FFFFFF; border-color: transparent; }
.app-tile:hover .app-tile-title { color: var(--brand); }
.kanban-col-head { background: transparent; border-bottom: 1px solid var(--line); border-radius: 0; }
.kanban-col { border-radius: 12px; }
.onix-progress > span, .onix-progress.is-short > span { background: var(--brand); }
.onix-progress.is-short > span { background: var(--warn); }
.palette-backdrop, .drawer-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(0, 0, 0, 0.30); }

/* ─── IDE-021: the digitization's stage (DigitizationStageBadge, BankLineIntakeChip) ─────────────────────────────
   A chip in the row: the brand blue with a small spinner while Onix AI works, amber to review, green done, red failed —
   the reason cut with an ellipsis (all of it in the tooltip). The theme's tokens only: both themes follow. */
.digitization-stage { max-width: 100%; min-width: 0; overflow: hidden; vertical-align: middle; }
.digitization-stage .digitization-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.digitization-stage[data-stage="Failed"] { max-width: 32ch; }
.digitization-stage.is-none { font-size: 12px; }
.digitization-spin { flex: none; width: 11px; height: 11px; border-width: 2px; vertical-align: 0; border-color: color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; }
.bankmatch-intake[data-stage="failed"] { display: inline-block; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
@media (prefers-reduced-motion: reduce) { .digitization-spin { animation: none; } }
