/* Acrelume design tokens: Option A "Precision neutral" (2026-11-18).
   Source of truth for colours, type and sizing on every page (public, auth and logged-in). Load it on every layout
   AFTER Bootstrap and custom.css and BEFORE acrelume-shell.css and any page stylesheet.
   Values are copied from the owner-approved mockup (static/mockups/acrelume/a/styles.css). Do not invent new colours.

   Three families of names:
   1. --ac-*   the Option A tokens. Use these in new and restyled CSS.
   2. --st-*   the older Site Studio token names (premium UI pass, 2026-11-09). Still work; now mapped onto --ac-*.
   3. --color-* the legacy custom.css theme variables. Bridged onto --ac-* so pages that have not been restyled yet
               already sit on the A canvas, hairlines and text colours.

   Light is the default. Dark applies when static/js/theme_toggle.js puts .dark-mode on <html>/<body>, or when
   [data-theme="dark"] is set on an ancestor.
   Rules: 8 px grid, 32 px controls, radius 6 (controls) / 8 (cards), 1 px hairlines, one accent, shadows only on
   menus and popovers, no gradients or glows. */

:root {
    /* ================= A tokens ================= */
    /* surfaces */
    --ac-bg: #F7F7F8;             /* page canvas */
    --ac-surface: #FFFFFF;        /* cards, panels, top bar, left nav, menus */
    --ac-surface-2: #FAFAFB;      /* table headers, search fields, quiet wells */
    --ac-hover: #F2F2F4;          /* hover and "selected" fill */
    --ac-pressed: #EBEBEE;        /* pressed / stronger fill */
    /* lines */
    --ac-border: #E6E6E9;         /* default 1 px hairline */
    --ac-border-strong: #D6D6DB;  /* button and checkbox outlines */
    /* text */
    --ac-text: #16171A;           /* primary */
    --ac-text-2: #6B6F7B;         /* THE secondary colour */
    --ac-text-3: #9A9DA6;         /* placeholders, disabled, decorative only */
    --ac-text-on-accent: #FFFFFF;
    /* accent: logo bolt, primary buttons, site pin and radius. Nothing else. */
    --ac-accent: #E4572E;
    --ac-accent-hover: #CF4A23;
    --ac-accent-tint: #FCEEE9;
    --ac-accent-ink: #B8441F;     /* accent-coloured text on light surfaces (AA) */
    --ac-accent-line: rgba(228, 87, 46, .28);
    --brand-accent: var(--ac-accent);
    /* status: muted, shown as a dot or a tinted pill */
    --ac-good: #3F8F5A;  --ac-good-tint: #EBF4EE;  --ac-good-line: rgba(63, 143, 90, .24);
    --ac-warn: #B7811C;  --ac-warn-tint: #FAF3E3;  --ac-warn-line: rgba(183, 129, 28, .26);
    --ac-bad:  #C2453A;  --ac-bad-tint:  #FAECEA;  --ac-bad-line:  rgba(194, 69, 58, .24);
    --ac-info: #4C6A92;  --ac-info-tint: #EDF1F6;  --ac-info-line: rgba(76, 106, 146, .24);
    /* elevation: menus and popovers only */
    --ac-menu-shadow: 0 4px 16px rgba(20, 20, 30, .08), 0 1px 3px rgba(20, 20, 30, .06);
    --ac-focus-ring: 0 0 0 2px var(--ac-surface), 0 0 0 4px rgba(228, 87, 46, .40);
    --ac-overlay: rgba(14, 15, 17, .40);   /* modal backdrop */
    /* type */
    --ac-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --ac-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --ac-fs-xs: 11px;    /* section labels, counters */
    --ac-fs-sm: 12px;    /* meta, captions, table headers */
    --ac-fs: 13px;       /* app base */
    --ac-fs-site: 14px;  /* marketing base */
    --ac-fs-h3: 14px;    /* card titles */
    --ac-fs-h2: 16px;    /* panel titles */
    --ac-fs-h1: 18px;    /* page titles in the app */
    --ac-fs-kpi: 22px;   /* KPI numbers */
    --ac-lh: 1.45;
    --ac-tracking-tight: -.01em;
    --ac-tracking-caps: .06em;
    /* sizing (8 px grid) */
    --ac-sp-1: 4px; --ac-sp-2: 8px; --ac-sp-3: 12px; --ac-sp-4: 16px; --ac-sp-5: 20px; --ac-sp-6: 24px; --ac-sp-8: 32px; --ac-sp-12: 48px;
    --ac-h-ctl: 32px;    /* buttons, inputs, selects */
    --ac-h-ctl-sm: 28px;
    --ac-r-xs: 4px;      /* pills, tags, kbd */
    --ac-r: 6px;         /* controls */
    --ac-r-lg: 8px;      /* cards, menus, panels */
    --ac-ic: 16px; --ac-ic-sm: 14px; --ac-ic-stroke: 1.75;
    /* app shell */
    --ac-nav-w: 200px;
    --ac-nav-w-collapsed: 56px;
    --ac-top-h: 48px;
    --ac-site-top-h: 56px;  /* public header */
    /* motion */
    --ac-ease: cubic-bezier(.2, .7, .2, 1);
    --ac-dur: 120ms;
    /* one-hue data ramp (low to high), e.g. transmission voltage */
    --ac-data-1: #9DB4DE; --ac-data-2: #6F8FCB; --ac-data-3: #4867AE; --ac-data-4: #2B4384;

    color-scheme: light;
}

:root.dark-mode, body.dark-mode, [data-theme="dark"] {
    --ac-bg: #0E0F11;
    --ac-surface: #16171A;
    --ac-surface-2: #1A1B1F;
    --ac-hover: #1F2024;
    --ac-pressed: #26272C;
    --ac-border: #26272C;
    --ac-border-strong: #33353B;
    --ac-text: #ECEDEF;
    --ac-text-2: #9095A0;
    --ac-text-3: #686C76;
    --ac-accent: #E8643D;
    --ac-accent-hover: #F07450;
    --ac-accent-tint: #2B1A14;
    --ac-accent-ink: #F08A68;
    --ac-accent-line: rgba(232, 100, 61, .32);
    --ac-good: #5DAE78;  --ac-good-tint: #16251B;  --ac-good-line: rgba(93, 174, 120, .26);
    --ac-warn: #D3A04A;  --ac-warn-tint: #2A2214;  --ac-warn-line: rgba(211, 160, 74, .28);
    --ac-bad:  #DE6A5E;  --ac-bad-tint:  #2D1816;  --ac-bad-line:  rgba(222, 106, 94, .28);
    --ac-info: #7C9AC2;  --ac-info-tint: #18202B;  --ac-info-line: rgba(124, 154, 194, .28);
    --ac-menu-shadow: 0 4px 16px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .3);
    --ac-focus-ring: 0 0 0 2px var(--ac-surface), 0 0 0 4px rgba(232, 100, 61, .50);
    --ac-overlay: rgba(0, 0, 0, .55);
    --ac-data-1: #B9CBEC; --ac-data-2: #8FA9DD; --ac-data-3: #6585C8; --ac-data-4: #4A68AC;
    color-scheme: dark;
}

/* ================= --st-* (Site Studio names) mapped onto A =================
   Declared on the same selectors as the A tokens so they re-resolve in dark mode. */
:root, :root.dark-mode, body.dark-mode, [data-theme="dark"] {
    /* type */
    --st-font: var(--ac-font);
    --st-font-mono: var(--ac-mono);
    --st-fs-xs: 11px; --st-fs-sm: 12px; --st-fs-md: 13px; --st-fs-lg: 14px; --st-fs-h: 16px; --st-fs-display: 22px;
    --st-fw-regular: 400; --st-fw-medium: 500; --st-fw-semibold: 600;
    --st-lh-tight: 1.25; --st-lh: 1.45; --st-lh-prose: 1.55;
    --st-tracking-caps: var(--ac-tracking-caps);
    --st-tracking-tight: var(--ac-tracking-tight);
    /* spacing */
    --st-sp-1: 4px; --st-sp-2: 8px; --st-sp-3: 12px; --st-sp-4: 16px; --st-sp-5: 20px; --st-sp-6: 24px; --st-sp-8: 32px;
    /* radii: A uses 6 on controls and 8 on cards */
    --st-r-xs: 4px; --st-r-sm: 4px; --st-r-md: 6px; --st-r-lg: 8px; --st-r-pill: 999px;
    /* control sizes */
    --st-h-ctl: 32px; --st-h-ctl-sm: 28px; --st-ic: 16px; --st-ic-sm: 14px; --st-ic-stroke: 1.75;
    /* surfaces */
    --st-canvas: var(--ac-bg);
    --st-panel: var(--ac-surface);
    --st-surface: var(--ac-surface);
    --st-fill: var(--ac-hover);
    --st-fill-hover: var(--ac-pressed);
    --st-fill-strong: var(--ac-border-strong);
    /* borders */
    --st-border: var(--ac-border);
    --st-border-strong: var(--ac-border-strong);
    /* text */
    --st-text: var(--ac-text);
    --st-text-2: var(--ac-text-2);
    --st-text-3: var(--ac-text-3);
    --st-text-on-accent: var(--ac-text-on-accent);
    /* accent */
    --st-accent: var(--ac-accent);
    --st-accent-hover: var(--ac-accent-hover);
    --st-accent-soft: var(--ac-accent-tint);
    --st-accent-line: var(--ac-accent-line);
    --st-accent-ink: var(--ac-accent-ink);
    /* status */
    --st-good: var(--ac-good); --st-good-soft: var(--ac-good-tint); --st-good-line: var(--ac-good-line); --st-good-ink: var(--ac-good);
    --st-warn: var(--ac-warn); --st-warn-soft: var(--ac-warn-tint); --st-warn-line: var(--ac-warn-line); --st-warn-ink: var(--ac-warn);
    --st-bad:  var(--ac-bad);  --st-bad-soft:  var(--ac-bad-tint);  --st-bad-line:  var(--ac-bad-line);  --st-bad-ink:  var(--ac-bad);
    --st-info: var(--ac-info); --st-info-soft: var(--ac-info-tint); --st-info-line: var(--ac-info-line); --st-info-ink: var(--ac-info);
    --st-neutral-soft: var(--ac-hover);
    /* elevation: A has no card shadows; only menus and popovers get one */
    --st-shadow-1: none;
    --st-shadow-2: none;
    --st-shadow-3: var(--ac-menu-shadow);
    --st-panel-edge: 1px 0 0 var(--ac-border);
    /* focus and motion */
    --st-focus: var(--ac-focus-ring);
    --st-ease: var(--ac-ease);
    --st-dur: var(--ac-dur);
    /* data ramp */
    --st-data-1: var(--ac-data-1); --st-data-2: var(--ac-data-2); --st-data-3: var(--ac-data-3); --st-data-4: var(--ac-data-4);

    /* ================= legacy custom.css variables bridged onto A ================= */
    --font-family: var(--ac-font);
    --color-text: var(--ac-text);
    --color-text-secondary: var(--ac-text-2);
    --color-accent: var(--ac-accent);
    --color-accent-secondary: var(--ac-accent);
    --color-background: var(--ac-bg);
    --color-card: var(--ac-surface);
    --color-border: var(--ac-border);
    --color-input-bg: var(--ac-surface);
    --color-hover-bg: var(--ac-hover);
    --color-shadow: rgba(20, 20, 30, .08);
    --scrollbar-track: transparent;
    --scrollbar-thumb: var(--ac-border-strong);
}

/* =====================================================================================================
   Older opt-in studio components (.st-*), kept for the pages that already use them, now drawn in the A style.
   New work should use the .ac-* components in acrelume-shell.css.
   ===================================================================================================== */

.st-card { background: var(--st-surface); border: 1px solid var(--st-border); border-radius: var(--st-r-lg); box-shadow: none; }
.st-card--float { box-shadow: none; }

.st-lbl { font-size: var(--st-fs-xs); font-weight: 600; letter-spacing: var(--st-tracking-caps); text-transform: uppercase; color: var(--ac-text-3); line-height: 1.3; }

.st-ib {
    width: var(--st-h-ctl); height: var(--st-h-ctl); display: inline-grid; place-items: center; flex: none; padding: 0;
    border: 0; border-radius: var(--st-r-md); background: transparent; color: var(--st-text-2); cursor: pointer;
    transition: background-color var(--st-dur) var(--st-ease), color var(--st-dur) var(--st-ease);
}
.st-ib svg { width: var(--st-ic); height: var(--st-ic); stroke-width: 1.75; }
.st-ib:hover { background: var(--ac-hover); color: var(--st-text); }
.st-ib:active { background: var(--ac-pressed); }
.st-ib.is-on, .st-ib[aria-pressed="true"] { background: var(--ac-hover); color: var(--ac-text); }
.st-ib:focus-visible { outline: none; box-shadow: var(--st-focus); }

.st-pill {
    display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 8px; border-radius: 4px;
    font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap;
    background: var(--ac-hover); color: var(--ac-text-2);
}
.st-pill.is-good { background: var(--ac-good-tint); color: var(--ac-good); }
.st-pill.is-warn { background: var(--ac-warn-tint); color: var(--ac-warn); }
.st-pill.is-bad { background: var(--ac-bad-tint); color: var(--ac-bad); }
.st-pill.is-info { background: var(--ac-info-tint); color: var(--ac-info); }
.st-pill.is-accent { background: var(--ac-accent-tint); color: var(--ac-accent-ink); }

.st-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; display: inline-block; background: var(--ac-text-3); }
.st-dot.is-good { background: var(--ac-good); } .st-dot.is-warn { background: var(--ac-warn); } .st-dot.is-bad { background: var(--ac-bad); }

.st-chips { display: inline-flex; flex-wrap: wrap; gap: var(--st-sp-1); }
.st-chip {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--st-sp-1); height: var(--st-h-ctl-sm); padding: 0 10px;
    border: 1px solid var(--ac-border); border-radius: var(--ac-r); background: var(--ac-surface); color: var(--ac-text-2);
    font: inherit; font-size: var(--st-fs-sm); font-weight: 500; white-space: nowrap; cursor: pointer;
    transition: background-color var(--st-dur) var(--st-ease), color var(--st-dur) var(--st-ease), border-color var(--st-dur) var(--st-ease);
}
.st-chip:hover { color: var(--ac-text); background: var(--ac-hover); }
.st-chip.is-on, .st-chip[aria-pressed="true"] { background: var(--ac-hover); border-color: var(--ac-border-strong); color: var(--ac-text); }
.st-chip:focus-visible { outline: none; box-shadow: var(--st-focus); }

/* Switch: A style (26x16, dark track when on). Markup: <button class="st-switch" role="switch" aria-checked="false"><span></span></button> */
.st-switch {
    position: relative; width: 26px; height: 16px; flex: none; padding: 0; border: 0; border-radius: 8px;
    background: var(--ac-border-strong); cursor: pointer; transition: background-color var(--st-dur) var(--st-ease);
}
.st-switch > span {
    position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff;
    transition: transform var(--st-dur) var(--st-ease);
}
.st-switch[aria-checked="true"] { background: var(--ac-text); }
:root.dark-mode .st-switch[aria-checked="true"], body.dark-mode .st-switch[aria-checked="true"], [data-theme="dark"] .st-switch[aria-checked="true"] { background: var(--ac-text-2); }
.st-switch[aria-checked="true"] > span { transform: translateX(10px); }
.st-switch[disabled], .st-switch[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.st-switch:focus-visible { outline: none; box-shadow: var(--st-focus); }

.st-range { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; margin: 0; background: transparent; cursor: pointer; --st-range-pct: 50%; }
.st-range::-webkit-slider-runnable-track { height: 2px; border-radius: 2px; background: linear-gradient(to right, var(--ac-text-2) var(--st-range-pct), var(--ac-border-strong) var(--st-range-pct)); }
.st-range::-moz-range-track { height: 2px; border-radius: 2px; background: var(--ac-border-strong); }
.st-range::-moz-range-progress { height: 2px; border-radius: 2px; background: var(--ac-text-2); }
.st-range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -5px; border-radius: 50%; background: var(--ac-surface); border: 0; box-shadow: 0 0 0 1px var(--ac-border-strong); }
.st-range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ac-surface); border: 0; box-shadow: 0 0 0 1px var(--ac-border-strong); }
.st-range:focus-visible { outline: none; }
.st-range:focus-visible::-webkit-slider-thumb { box-shadow: var(--st-focus); }
.st-range:focus-visible::-moz-range-thumb { box-shadow: var(--st-focus); }

.st-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--st-h-ctl); padding: 0 12px;
    border: 1px solid var(--ac-border-strong); border-radius: var(--ac-r); background: var(--ac-surface); color: var(--ac-text);
    font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
    transition: background-color var(--st-dur) var(--st-ease), border-color var(--st-dur) var(--st-ease);
}
.st-btn:hover { background: var(--ac-hover); }
.st-btn:focus-visible { outline: none; box-shadow: var(--st-focus); }
.st-btn--primary { background: var(--ac-accent); border-color: var(--ac-accent); color: var(--ac-text-on-accent); }
.st-btn--primary:hover { background: var(--ac-accent-hover); border-color: var(--ac-accent-hover); }
.st-btn svg { width: var(--st-ic-sm); height: var(--st-ic-sm); }

@media (prefers-reduced-motion: reduce) {
    .st-ib, .st-chip, .st-switch, .st-switch > span, .st-btn { transition: none; }
}
