:root {
    color-scheme: light;

    --sxi-red:         #EA1C2D;
    --sxi-red-hover:   #C8121F;
    --sxi-grey:        #4A4F55;

    /* Brand red as a FILL, behind white text. It stays the print value in both
       themes: --sxi-red is lifted in dark so it still reads AS text, which is
       too bright to sit under a white label. */
    --sxi-red-solid:   #EA1C2D;

    --surface:         #FFFFFF;
    --surface-alt:     #F9FAFB;
    --surface-muted:   #F3F4F6;
    --page-bg:         #F3F4F6;

    --ink:             #0F1419;
    --ink-2:           #2B3036;
    --ink-3:           #4A4F55;
    --text-body:       #374151;
    --text-muted:      #6B7280;
    --text-subtle:     #9CA3AF;

    --border:          #E5E7EB;
    --border-strong:   #D1D5DB;
    --divider:         #F3F4F6;

    --ok:              #059669;
    --ok-bg:           #D1E7DD;
    --warn:            #D97706;
    --warn-bg:         #FCF4E6;
    --warn-border:     #E3C48F;
    --danger:          #B91C1C;
    --danger-bg:       #FEF2F2;
    --info:            #2563EB;

    /* Categorical series colours, in fixed order: slot 1 is always the first series,
       whatever it happens to be, so a filter that changes how many series there are
       never repaints the survivors. Validated for colour-vision deficiency against
       this surface; the pairs that sit close carry a label beside them rather than
       relying on the hue alone. */
    --series-1:        #2a78d6;
    --series-2:        #eb6834;
    --series-3:        #1baf7a;
    --series-4:        #eda100;
    --series-5:        #e87ba4;
    --series-6:        #008300;
    --series-7:        #6a5ad4;
    --series-8:        #e34948;

    /* The XLayer purple already used by the transaction tracker and the workflow
       editor, hoisted here so screens outside those panes can reach it. */
    --purple:          #6D5BA6;
    --purple-hover:    #5B4A8F;

    --radius:          4px;
    --radius-lg:       6px;

    /* Backdrop behind a modal or an overlay pane. */
    --overlay:         rgba(15, 20, 25, 0.45);

    /* Ink for text that sits ON a saturated fill: a status band, the selected
       day in a date picker, a fieldset legend. */
    --on-status:       #FFFFFF;
    --on-status-soft:  rgba(255, 255, 255, 0.55);

    /* Status colours as a FILL, behind white text. Like --sxi-red-solid these
       keep their print value in both themes: a filled brand bar reads as the
       same bar whatever the theme, and only the status colours used AS TEXT
       are lifted for dark. --on-solid is their ink, white in both themes. */
    --ok-solid:        #059669;
    --warn-solid:      #D97706;
    --danger-solid:    #B91C1C;
    --purple-solid:    #6D5BA6;
    --on-solid:        #FFFFFF;
    --on-solid-soft:   rgba(255, 255, 255, 0.55);

    /* Swap these two lines to change fonts across every screen. */
    --font-sans:       'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono:       'JetBrains Mono', 'IBM Plex Mono', Consolas, monospace;
    --font-size-base:  0.875rem;
}

[data-theme="dark"] {
    color-scheme: dark;

    /* The logo red is lifted a little: the print value goes muddy against a
       dark ground and drops below a readable contrast when it lands on text. */
    --sxi-red:         #FF4453;
    --sxi-red-hover:   #FF6874;
    --sxi-red-solid:   #EA1C2D;
    --sxi-grey:        #A9AFB7;

    --surface:         #23282E;
    --surface-alt:     #2A3037;
    --surface-muted:   #323941;
    --page-bg:         #1B1F24;

    --ink:             #F2F4F7;
    --ink-2:           #DCE0E6;
    --ink-3:           #B3BAC3;
    --text-body:       #C4CAD2;
    --text-muted:      #939AA4;
    --text-subtle:     #6D747D;

    --border:          #3A424B;
    --border-strong:   #4B545F;
    --divider:         #2A3037;

    --ok:              #34D399;
    --ok-bg:           #184334;
    --warn:            #FBBF24;
    --warn-bg:         #3A2F16;
    --warn-border:     #5C4A20;
    --danger:          #F87171;
    --danger-bg:       #452828;
    --info:            #60A5FA;

    /* The dark steps are chosen against the dark surface, not lightened copies of the
       light ones. */
    --series-1:        #3987e5;
    --series-2:        #d95926;
    --series-3:        #199e70;
    --series-4:        #c98500;
    --series-5:        #d55181;
    --series-6:        #3aa83a;
    --series-7:        #9085e9;
    --series-8:        #e66767;

    --purple:          #A594D8;
    --purple-hover:    #B9AAE6;

    --overlay:         rgba(0, 0, 0, 0.66);

    --on-status:       #0B1114;
    --on-status-soft:  rgba(11, 17, 20, 0.55);
}

/* The refresh control, one shape wherever a screen offers to reload what it is showing.
   It started on the Transactions module and is here so the next screen does not invent
   its own: an icon, the word, and the surface-and-border treatment the rest of the
   furniture uses. */
.sxi-refresh {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font: inherit;
    font-size: 14px;
    line-height: 1;
    padding: .5rem .9rem;
    color: var(--text-body);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}
.sxi-refresh:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
}
.sxi-refresh:focus-visible {
    outline: 2px solid var(--purple);
    outline-offset: 1px;
}
.sxi-refresh svg { width: 15px; height: 15px; }
.sxi-refresh[hidden] { display: none; }
