/* Zelarion design tokens (.claude/skills/zelarion-system-design/references/tokens.md).
   Components use var(--z-*) only: no raw colors, shadows or durations anywhere else. */

:root {
    color-scheme: light;

    /* Color: neutral workspace (launcher, sign-in, account). Apps bring their own theme below; the
       Zelarion brand belongs to the Admin app only. Contrast in tokens.md. */
    --z-bg: #F6F7F8;
    --z-surface: #FFFFFF;
    --z-surface-2: #EDEFF2;
    --z-hairline: #E3E6EA;
    --z-hairline-strong: #CDD2D8;
    --z-text: #111418;
    --z-text-muted: #5D6570;
    --z-accent: #4A5361;
    --z-accent-strong: #2F3640;
    --z-accent-soft: #E9ECF0;
    --z-on-accent: #FFFFFF;
    --z-attention: #E5484D;
    --z-on-attention: #FFFFFF;
    --z-success: #1F8A5B;
    --z-warning: #A86A12;
    --z-danger: #C9302C;
    --z-shadow-ink: 17 20 24;

    /* Type: system fonts until the self-hosted files are added (tokens.md). */
    --z-font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
    --z-font-body: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    --z-font-mono: "JetBrains Mono", Consolas, "SFMono-Regular", monospace;

    /* Space (4px base), radius, layers */
    --z-space-1: 4px;
    --z-space-2: 8px;
    --z-space-3: 12px;
    --z-space-4: 16px;
    --z-space-5: 20px;
    --z-space-6: 24px;
    --z-space-7: 32px;
    --z-space-8: 40px;
    --z-space-9: 56px;
    --z-space-10: 72px;
    --z-radius-control: 10px;
    --z-radius-card: 14px;
    --z-radius-pill: 999px;
    --z-shadow-raised: 0 1px 0 rgb(255 255 255 / .6) inset, 0 1px 2px rgb(var(--z-shadow-ink) / .06), 0 8px 24px -12px rgb(var(--z-shadow-ink) / .12);
    --z-shadow-overlay: 0 1px 0 rgb(255 255 255 / .5) inset, 0 2px 4px rgb(var(--z-shadow-ink) / .08), 0 24px 48px -16px rgb(var(--z-shadow-ink) / .24);
    --z-highlight: rgb(255 255 255 / .28);
    /* Things you pick up (deal cards): lit from above like the buttons, three layers (CRM DESIGN.md §3). */
    --z-shadow-card: inset 0 1px 0 var(--z-highlight), 0 1px 2px rgb(var(--z-shadow-ink) / .10), 0 10px 24px -14px rgb(var(--z-shadow-ink) / .30);
    --z-shadow-card-hover: inset 0 1px 0 var(--z-highlight), 0 2px 4px rgb(var(--z-shadow-ink) / .10), 0 16px 32px -14px rgb(var(--z-shadow-ink) / .36);
    --z-shadow-lift: inset 0 1px 0 var(--z-highlight), 0 6px 12px rgb(var(--z-shadow-ink) / .14), 0 28px 56px -16px rgb(var(--z-shadow-ink) / .48);

    /* Motion */
    --z-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --z-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --z-ease-emphasized: cubic-bezier(0.7, 0, 0.25, 1);
    --z-dur-press: 70ms;
    /* A released button comes back up a little past flat and settles: slower than the press, and sprung. */
    --z-dur-release: 260ms;
    /* The visible bottom edge of a button: it rests this high and sinks onto it when pressed. */
    --z-lip: 3px;
    /* Whole-interface scale: 1 on phones, tablets and a full-HD desktop; laptops step down (ladder at the end of
       this file). The viewport in the page's own pixels, for anything that must fill the window under the scale. */
    --z-ui-scale: 1;
    --z-vh: calc(100dvh / var(--z-ui-scale));
    --z-vw: calc(100vw / var(--z-ui-scale));
    --z-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --z-dur-hover: 180ms;
    --z-dur-state: 260ms;
    --z-dur-page: 460ms;
    --z-stagger: 55ms;
    --z-dur-chart: 1100ms;
    --z-dur-count: 900ms;
    --z-dur-theme: 900ms;

    /* Layout */
    --z-rail-width: 248px;
    --z-rail-collapsed: 72px;
    --z-topbar-height: 64px;
    --z-tabbar-height: 64px;
    --z-content-max: 1440px;

    /* Glass shell: off by default (opaque, flush panels); an app turns it on with its own values. */
    --z-backdrop: none;
    --z-glass: var(--z-surface);
    --z-glass-strong: var(--z-surface);
    --z-glass-border: var(--z-hairline);
    --z-glass-blur: 0px;
    --z-surface-opaque: var(--z-surface);
    --z-shell-gap: 0px;
    --z-shell-radius: 0px;
    --z-warm: var(--z-accent);
    --z-warm-strong: var(--z-accent-strong);
    --z-warm-soft: var(--z-accent-soft);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --z-bg: #0B0C0E;
    --z-surface: #141619;
    --z-surface-2: #1B1E22;
    --z-hairline: #24282D;
    --z-hairline-strong: #33383F;
    --z-text: #ECEEF1;
    --z-text-muted: #9AA1AA;
    --z-accent: #AEB5BF;
    --z-accent-strong: #D5DAE0;
    --z-accent-soft: #22262C;
    --z-on-accent: #0B0C0E;
    --z-attention: #FF5C61;
    --z-shadow-ink: 0 0 0;
    --z-highlight: rgb(255 255 255 / .06);
}

/* Partner brand: AscendRev. Only the brand layer changes. */
:root[data-brand="ascendrev"] {
    --z-accent: #326292;
    --z-accent-strong: #1E5E46;
    --z-accent-soft: #E8EEF6;
}

:root[data-brand="ascendrev"][data-theme="dark"] {
    --z-bg: #0F1B33;
    --z-surface: #192B51;
    --z-surface-2: #1D3360;
    --z-hairline: #23406C;
    --z-text-muted: #6E93BC;
    --z-accent-strong: #2E8A66;
    --z-on-accent: #FFFFFF;
}

/* App themes: each app carries its own accent, set on the shell with data-app. Inside an app it wins
   over a partner brand; the launcher keeps the neutral workspace colors. Only Admin wears the Zelarion
   brand (navy, blue #008FE8, cyan #00D5EC), surfaces included.
   Contrast (tokens.md): strong on bg and on soft >= 4.99, on-accent on strong >= 5.7, accent on bg >= 3. */
/* CRM: indigo with a warm coral complement, on glass over a blurred photo.
   Surfaces are translucent and blur what is behind them; hairlines, not shadows, separate them.
   Contrast: text on glass over the lightest backdrop 15.2, muted 6.1, strong on soft 6.4. */
[data-app="crm"] {
    --z-bg: #EEF0FA;
    --z-backdrop: url("../backgrounds/crm-light.webp");
    --z-surface: rgb(255 255 255 / .72);
    --z-surface-2: rgb(232 236 252 / .78);
    --z-hairline: rgb(28 34 84 / .09);
    --z-hairline-strong: rgb(28 34 84 / .18);
    --z-text: #121633;
    --z-text-muted: #525A7E;
    --z-accent: #4C6EF5;
    --z-accent-strong: #3346C8;
    --z-accent-soft: #E4E9FF;
    --z-on-accent: #FFFFFF;
    --z-warm: #D9622F;
    --z-warm-strong: #9E3F17;
    --z-warm-soft: #FCE7DD;
    --z-success: #12805A;
    --z-warning: #9A600E;
    --z-danger: #C02B37;
    --z-shadow-ink: 18 22 60;
    --z-glass: rgb(255 255 255 / .52);
    --z-glass-strong: rgb(255 255 255 / .86);
    --z-glass-border: rgb(255 255 255 / .7);
    --z-glass-blur: 26px;
    --z-surface-opaque: #FFFFFF;
    --z-shell-gap: 12px;
    --z-shell-radius: 16px;
    --z-nav-active: var(--z-accent-strong);
    --z-nav-active-text: #FFFFFF;
    --z-series-1: #4C6EF5;
    --z-series-2: #E07A4F;
    --z-series-3: #14937A;
    --z-series-4: #9A5BD6;
    --z-series-5: #C99A1E;
}
/* Steward, Charter and Ombuds share the CRM's glass shell (one suite, one structure): translucent surfaces over
   a blurred backdrop in the app's own hue. Neutrals are shared; each app sets only its accent and backdrop.
   Contrast: text on glass over the lightest backdrop 16.4, muted 6.6; accent-strong on white >= 5.6 for all three. */
[data-app="people"], [data-app="work"], [data-app="helpdesk"] {
    --z-surface: rgb(255 255 255 / .72);
    --z-surface-2: rgb(236 240 244 / .78);
    --z-hairline: rgb(20 28 40 / .09);
    --z-hairline-strong: rgb(20 28 40 / .18);
    --z-text: #12161F;
    --z-text-muted: #515A68;
    --z-shadow-ink: 18 24 34;
    --z-glass: rgb(255 255 255 / .52);
    --z-glass-strong: rgb(255 255 255 / .86);
    --z-glass-border: rgb(255 255 255 / .7);
    --z-glass-blur: 26px;
    --z-surface-opaque: #FFFFFF;
    --z-shell-gap: 12px;
    --z-shell-radius: 16px;
    --z-nav-active: var(--z-accent-strong);
    --z-nav-active-text: var(--z-on-accent);
}
[data-app="people"] { --z-bg: #EAF2EC; --z-backdrop: url("../backgrounds/people-light.webp"); }
[data-app="work"] { --z-bg: #F6F0EA; --z-backdrop: url("../backgrounds/work-light.webp"); }
[data-app="helpdesk"] { --z-bg: #E8F2F1; --z-backdrop: url("../backgrounds/helpdesk-light.webp"); }
[data-app="people"] { --z-accent: #2F9E5B; --z-accent-strong: #1B7543; --z-accent-soft: #E2F4E8; --z-on-accent: #FFFFFF; }
[data-app="work"] { --z-accent: #CF5B0C; --z-accent-strong: #A8480C; --z-accent-soft: #FDEBDD; --z-on-accent: #FFFFFF; }
[data-app="helpdesk"] { --z-accent: #0E9384; --z-accent-strong: #0B6B60; --z-accent-soft: #DDF3F0; --z-on-accent: #FFFFFF; }
[data-app="learning"] { --z-accent: #7D5BEA; --z-accent-strong: #5634BE; --z-accent-soft: #EEE8FE; --z-on-accent: #FFFFFF; }
[data-app="knowledge"] { --z-accent: #E64980; --z-accent-strong: #AD1F55; --z-accent-soft: #FCE6EF; --z-on-accent: #FFFFFF; }
[data-app="settings"] {
    --z-bg: #F5F8FB;
    --z-surface: #FFFFFF;
    --z-surface-2: #EDF2F7;
    --z-hairline: #E1E8EF;
    --z-hairline-strong: #CAD5E0;
    --z-text: #071522;
    --z-text-muted: #5B7083;
    --z-accent: #008FE8;
    --z-accent-strong: #0066B3;
    --z-accent-soft: #E2F1FC;
    --z-on-accent: #FFFFFF;
    --z-shadow-ink: 7 21 34;
}

/* CRM at night: a deep indigo sky with the coral as its warm counterweight; the backdrop turns dark too.
   Contrast: text on glass 14.8, muted 7.3, accent on glass 6.9, on-accent on accent 8.2. */
:root[data-theme="dark"] [data-app="crm"] {
    --z-bg: #090B1A;
    --z-backdrop: url("../backgrounds/crm-dark.webp");
    --z-surface: rgb(22 26 58 / .62);
    --z-surface-2: rgb(38 44 88 / .58);
    --z-hairline: rgb(170 182 255 / .10);
    --z-hairline-strong: rgb(170 182 255 / .20);
    --z-text: #ECEEFF;
    --z-text-muted: #A3ABD3;
    --z-accent: #8C9EFF;
    --z-accent-strong: #B6C2FF;
    --z-accent-soft: rgb(140 158 255 / .16);
    --z-on-accent: #0B0F2E;
    --z-warm: #FF9C78;
    --z-warm-strong: #FFBFA6;
    --z-warm-soft: rgb(255 156 120 / .15);
    --z-success: #46D8A4;
    --z-warning: #F2B84B;
    --z-danger: #FF7488;
    --z-shadow-ink: 0 0 0;
    --z-glass: rgb(14 17 42 / .52);
    --z-glass-strong: rgb(17 21 50 / .9);
    --z-glass-border: rgb(255 255 255 / .07);
    --z-surface-opaque: #171B3D;
    --z-nav-active: var(--z-accent);
    --z-nav-active-text: #0B0F2E;
    --z-series-1: #8C9EFF;
    --z-series-2: #FF9C78;
    --z-series-3: #46D8A4;
    --z-series-4: #C79BFF;
    --z-series-5: #F2C94C;
}
/* The same three at night: neutral dark glass, the backdrop turns dark, the accent carries the app's colour.
   Contrast: text on glass 15.1, muted 7.6; on-accent on accent >= 8 for all three. */
:root[data-theme="dark"] [data-app="people"], :root[data-theme="dark"] [data-app="work"], :root[data-theme="dark"] [data-app="helpdesk"] {
    --z-surface: rgb(22 27 34 / .62);
    --z-surface-2: rgb(38 45 56 / .58);
    --z-hairline: rgb(200 212 228 / .10);
    --z-hairline-strong: rgb(200 212 228 / .20);
    --z-text: #ECEFF4;
    --z-text-muted: #A4AEBD;
    --z-shadow-ink: 0 0 0;
    --z-glass: rgb(14 18 24 / .52);
    --z-glass-strong: rgb(17 22 29 / .9);
    --z-glass-border: rgb(255 255 255 / .07);
    --z-surface-opaque: #171C24;
    --z-nav-active: var(--z-accent);
}
:root[data-theme="dark"] [data-app="people"] { --z-bg: #0A120E; --z-backdrop: url("../backgrounds/people-dark.webp"); }
:root[data-theme="dark"] [data-app="work"] { --z-bg: #140D09; --z-backdrop: url("../backgrounds/work-dark.webp"); }
:root[data-theme="dark"] [data-app="helpdesk"] { --z-bg: #081110; --z-backdrop: url("../backgrounds/helpdesk-dark.webp"); }
:root[data-theme="dark"] [data-app="people"] { --z-accent: #4ACB7E; --z-accent-strong: #6FDC9B; --z-accent-soft: #10301E; --z-on-accent: #04140A; }
:root[data-theme="dark"] [data-app="work"] { --z-accent: #FF9A4D; --z-accent-strong: #FFB070; --z-accent-soft: #3A2010; --z-on-accent: #1A0A00; }
:root[data-theme="dark"] [data-app="helpdesk"] { --z-accent: #2DD4BF; --z-accent-strong: #5EEAD4; --z-accent-soft: #0B2E2A; --z-on-accent: #04140F; }
:root[data-theme="dark"] [data-app="learning"] { --z-accent: #A48BFF; --z-accent-strong: #BBA8FF; --z-accent-soft: #251A47; --z-on-accent: #0E0826; }
:root[data-theme="dark"] [data-app="knowledge"] { --z-accent: #FF7AA8; --z-accent-strong: #FF9DBE; --z-accent-soft: #3A1424; --z-on-accent: #1A0510; }
:root[data-theme="dark"] [data-app="settings"] {
    --z-bg: #05070A;
    --z-surface: #071522;
    --z-surface-2: #0B1E30;
    --z-hairline: #12283D;
    --z-hairline-strong: #1C3A55;
    --z-text: #E8EDF2;
    --z-text-muted: #91A7B9;
    --z-accent: #00D5EC;
    --z-accent-strong: #4FE3F5;
    --z-accent-soft: #06293A;
    --z-on-accent: #021015;
    --z-shadow-ink: 0 0 0;
}

/* Reduced motion: movement becomes a short fade, data does not animate (motion.md). */
@media (prefers-reduced-motion: reduce) {
    :root {
        --z-dur-press: 1ms;
        --z-dur-hover: 120ms;
        --z-dur-state: 120ms;
        --z-dur-page: 120ms;
        --z-stagger: 0ms;
        --z-dur-chart: 1ms;
        --z-dur-count: 1ms;
        --z-dur-theme: 1ms;
    }
}

/* Operator console: Zelarion's own tools. Warm paper and amber, unlike any customer app, so staff always
   know they are changing what a customer is sold. */
[data-app="operator"] {
    --z-bg: #F7F5F0;
    --z-surface: #FFFFFF;
    --z-surface-2: #F0ECE3;
    --z-hairline: #E6E0D3;
    --z-hairline-strong: #D2C9B6;
    --z-text: #1C1710;
    --z-text-muted: #6E6453;
    --z-accent: #C27A0A;
    --z-accent-strong: #8F5600;
    --z-accent-soft: #FBEFD9;
    --z-on-accent: #FFFFFF;
    --z-shadow-ink: 28 23 16;
}

:root[data-theme="dark"] [data-app="operator"] {
    --z-bg: #0D0B08;
    --z-surface: #17130D;
    --z-surface-2: #201A12;
    --z-hairline: #2B241A;
    --z-hairline-strong: #3F3526;
    --z-text: #F1ECE2;
    --z-text-muted: #B0A48F;
    --z-accent: #F2A93B;
    --z-accent-strong: #FFC56B;
    --z-accent-soft: #2E220F;
    --z-on-accent: #1A1104;
    --z-shadow-ink: 0 0 0;
}

/*
 * Laptop density ladder. Every size in the suite is designed for a 1920px desktop; narrower laptop screens scale the
 * whole interface down together (type, controls, spacing, icons), so proportions hold and more fits, instead of
 * columns squeezing. Phones and tablets keep 1: touch targets must not shrink. base.css applies it as zoom on <body>.
 */
@media (min-width: 1024px) and (max-width: 1365px) { :root { --z-ui-scale: 0.82; } }
@media (min-width: 1366px) and (max-width: 1535px) { :root { --z-ui-scale: 0.86; } }
@media (min-width: 1536px) and (max-width: 1727px) { :root { --z-ui-scale: 0.9; } }
@media (min-width: 1728px) and (max-width: 1919px) { :root { --z-ui-scale: 0.95; } }
