/*
 * Kaibo design tokens — "instrument" black and orange.
 * Warm near-black surfaces, one signal orange used sparingly, DIN-style figures
 * and mono micro-labels. Dark is the default; data-theme="light" gives a bone
 * paper variant. Older variable names (--canvas, --surface, --text, …) remain
 * as aliases so every module stylesheet follows the active theme.
 */
:root {
    color-scheme: dark;

    /* Neutrals: warm black, never pure #000 */
    --bg: #0c0b0a;
    --bg-sidebar: #0c0b0a;
    --surface: #141311;
    --surface-2: #1a1816;
    --surface-3: #23211e;
    --surface-input: #100f0d;
    --line-soft: #201e1b;
    --line: #2d2a26;
    --line-strong: #3d3934;
    --ink: #f2eee7;
    --ink-2: #b5aea4;
    --ink-3: #847d73;
    --ink-4: #5c5751;
    --shadow: #000000;
    --scrim: #000000;
    --control-track: #181614;
    --control-thumb: #2a2723;

    /* Signal orange and meaning */
    --accent: #ff6a13;
    --accent-strong: #ff7f36;
    --accent-text: #ff8a45;
    --accent-soft: #2a1709;
    --on-accent: #0c0b0a;
    --pos: #5fcf86;
    --pos-text: #8de0a9;
    --neg: #ff5468;
    --neg-text: #ff8f9c;
    --info: #7ea6c4;
    --info-text: #aec8dc;
    --gold: #ffbf3c;
    --gold-text: #ffd685;
    --violet: #a69ae0;
    --violet-text: #c9c1f0;

    /* Shape and depth: flat panels, hairlines instead of soft shadows */
    --radius-xs: 3px;
    --radius-sm: 5px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-pill: 999px;
    --elev-1: none;
    --elev-2: 0 18px 40px -24px color-mix(in srgb, var(--shadow) 90%, transparent);
    --elev-3: 0 30px 80px -24px color-mix(in srgb, var(--shadow) 95%, transparent), 0 0 0 1px var(--line);
    --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);

    /* Type */
    --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Bahnschrift SemiCondensed", Bahnschrift, "DIN Alternate", "DIN Next", "D-DIN", "Roboto Condensed", sans-serif-condensed, "Arial Narrow", sans-serif;
    --font-mono: "Cascadia Mono", "SF Mono", ui-monospace, "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;

    /* Layout */
    --sidebar-width: 236px;
    --rail-width: 84px;
    --content-max: 1440px;

    /* Aliases for the module stylesheets */
    --canvas: var(--bg);
    --sidebar: var(--bg-sidebar);
    --surface-raised: var(--surface-2);
    --border: var(--line);
    --border-subtle: var(--line-soft);
    --text: var(--ink);
    --text-muted: var(--ink-2);
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #eeebe5;
    --bg-sidebar: #e8e5de;
    --surface: #f8f6f2;
    --surface-2: #f2efe9;
    --surface-3: #e7e3db;
    --surface-input: #fdfcfa;
    --line-soft: #e0dbd2;
    --line: #d2ccc1;
    --line-strong: #b8b0a3;
    --ink: #161411;
    --ink-2: #4d4740;
    --ink-3: #78716a;
    --ink-4: #a39b90;
    --shadow: #2a2118;
    --scrim: #161411;
    --control-track: #e3dfd7;
    --control-thumb: #fdfcfa;

    --accent: #ee5a07;
    --accent-strong: #d84f04;
    --accent-text: #b8460a;
    --accent-soft: #fbe3d2;
    --on-accent: #161411;
    --pos: #1e9a52;
    --pos-text: #15753d;
    --neg: #d93348;
    --neg-text: #b4243a;
    --info: #3f7397;
    --info-text: #2f5a78;
    --gold: #d48e00;
    --gold-text: #8f5f00;
    --violet: #6b5cc4;
    --violet-text: #54479f;

    --elev-2: 0 18px 40px -26px color-mix(in srgb, var(--shadow) 45%, transparent);
    --elev-3: 0 30px 80px -30px color-mix(in srgb, var(--shadow) 55%, transparent), 0 0 0 1px var(--line);
}

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

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

::selection {
    background: color-mix(in srgb, var(--accent) 40%, transparent);
    color: var(--ink);
}

:where(a) {
    color: var(--accent-text);
    text-underline-offset: 3px;
}

:where(h1, h2, h3, h4) {
    color: var(--ink);
    text-wrap: balance;
}

:where(strong, b, .amount, [class*="amount"], [class*="balance"] strong, td, time) {
    font-variant-numeric: tabular-nums;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

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