/*
 * Design tokens - the single source of truth for colour, spacing and type.
 *
 * Rules:
 *  - No component, page or scoped stylesheet may contain a raw colour value.
 *    Always reference a token from this file.
 *  - Every token is defined in both the light and the dark block. A token that
 *    exists in only one theme is a bug: the other theme falls back silently.
 *  - Bootstrap is re-tinted here by overriding its own --bs-* variables, so the
 *    existing markup keeps working unchanged.
 */

/* ===== Light (default) ===== */
:root,
[data-bs-theme="light"] {
    /* Surfaces */
    --bg: #fafaf7;
    --bg-panel: #ffffff;
    --bg-hover: #f3f3ee;

    /* Text */
    --text: #1a1a1a;
    --text-muted: #6f6f6a;
    --text-faint: #a8a8a3;

    /* Accent and semantics */
    --accent: #c2410c;
    --accent-soft: #ea580c;
    --positive: #15803d;
    --negative: #b91c1c;
    --warning: #a16207;

    /* Lines */
    --border: #e8e8e2;
    --border-strong: #1a1a1a;

    /* Status pills - background / foreground pairs */
    --status-neutral-bg: #e5e7eb;
    --status-neutral-fg: #374151;
    --status-positive-bg: #dcfce7;
    --status-positive-fg: #15803d;
    --status-negative-bg: #fee2e2;
    --status-negative-fg: #b91c1c;
    --status-warning-bg: #fef3c7;
    --status-warning-fg: #a16207;
    --status-info-bg: #ede9fe;
    --status-info-fg: #6d28d9;
    --status-strong-bg: #1a1a1a;
    --status-strong-fg: #fafaf7;

    /* Row tints for table state (kept subtle - never the only signal) */
    --row-negative: #fdf0f0;
    --row-warning: #fdf8ec;

    /* Type */
    --font-mono: 'JetBrains Mono', 'Cascadia Mono', 'Consolas', monospace;
    --fs-page-title: 22px;
    --fs-body: 12px;
    --fs-small: 11px;
    --fs-micro: 10px;

    /* Layout */
    --sidebar-w: 220px;

    /* ===== Bootstrap re-tint ===== */
    --bs-body-bg: var(--bg);
    --bs-body-bg-rgb: 250, 250, 247;
    --bs-body-color: var(--text);
    --bs-body-color-rgb: 26, 26, 26;
    --bs-emphasis-color: var(--text);
    --bs-heading-color: var(--text);

    --bs-body-font-family: var(--font-mono);
    --bs-body-font-size: var(--fs-body);
    --bs-body-line-height: 1.5;

    /* .text-secondary reads --bs-secondary-rgb, not --bs-secondary-color */
    --bs-secondary: var(--text-muted);
    --bs-secondary-rgb: 111, 111, 106;
    --bs-secondary-color: var(--text-muted);
    --bs-tertiary-color: var(--text-faint);
    --bs-secondary-bg: var(--bg-hover);
    --bs-tertiary-bg: var(--bg);
    --bs-tertiary-bg-rgb: 250, 250, 247;

    --bs-primary: var(--accent);
    --bs-primary-rgb: 194, 65, 12;
    --bs-success: var(--positive);
    --bs-success-rgb: 21, 128, 61;
    --bs-danger: var(--negative);
    --bs-danger-rgb: 185, 28, 28;
    --bs-warning: var(--warning);
    --bs-warning-rgb: 161, 98, 7;

    --bs-link-color: var(--accent);
    --bs-link-color-rgb: 194, 65, 12;
    --bs-link-hover-color: var(--accent-soft);

    --bs-border-color: var(--border);
    --bs-border-color-translucent: var(--border);

    /* Sharp corners everywhere - the look has no rounding */
    --bs-border-radius: 0;
    --bs-border-radius-sm: 0;
    --bs-border-radius-lg: 0;
    --bs-border-radius-xl: 0;
    --bs-border-radius-2xl: 0;
    --bs-border-radius-pill: 0;
}

/* ===== Dark ===== */
[data-bs-theme="dark"] {
    --bg: #0e0e10;
    --bg-panel: #161618;
    --bg-hover: #1f1f22;

    --text: #e8e8e3;
    --text-muted: #9a9a94;
    --text-faint: #66666a;

    --accent: #f97316;
    --accent-soft: #fb923c;
    --positive: #4ade80;
    --negative: #f87171;
    --warning: #fbbf24;

    --border: #26262a;
    --border-strong: #e8e8e3;

    --status-neutral-bg: #26262a;
    --status-neutral-fg: #b8b8b3;
    --status-positive-bg: #14321f;
    --status-positive-fg: #4ade80;
    --status-negative-bg: #3a1414;
    --status-negative-fg: #f87171;
    --status-warning-bg: #3a2c10;
    --status-warning-fg: #fbbf24;
    --status-info-bg: #2d1b5e;
    --status-info-fg: #c4b5fd;
    --status-strong-bg: #e8e8e3;
    --status-strong-fg: #0e0e10;

    --row-negative: #2a1414;
    --row-warning: #2a2210;

    --bs-body-bg: var(--bg);
    --bs-body-bg-rgb: 14, 14, 16;
    --bs-body-color: var(--text);
    --bs-body-color-rgb: 232, 232, 227;
    --bs-emphasis-color: var(--text);
    --bs-heading-color: var(--text);

    --bs-secondary: var(--text-muted);
    --bs-secondary-rgb: 154, 154, 148;
    --bs-secondary-color: var(--text-muted);
    --bs-tertiary-color: var(--text-faint);
    --bs-secondary-bg: var(--bg-hover);
    --bs-tertiary-bg: var(--bg-panel);
    --bs-tertiary-bg-rgb: 22, 22, 24;

    --bs-primary: var(--accent);
    --bs-primary-rgb: 249, 115, 22;
    --bs-success: var(--positive);
    --bs-success-rgb: 74, 222, 128;
    --bs-danger: var(--negative);
    --bs-danger-rgb: 248, 113, 113;
    --bs-warning: var(--warning);
    --bs-warning-rgb: 251, 191, 36;

    --bs-link-color: var(--accent);
    --bs-link-color-rgb: 249, 115, 22;
    --bs-link-hover-color: var(--accent-soft);

    --bs-border-color: var(--border);
    --bs-border-color-translucent: var(--border);
}
