/* ==========================================================================
   Total Control — design system
   Built from the QC Webworks site language: Manrope, calm near-white
   surfaces, one confident purple, pill controls, mono eyebrows.

   Themes (set on <html data-theme="…">):
     light   light chrome, light workspace
     hybrid  dark chrome (sidebar/topbar), light workspace   ← default
     dark    dark chrome, dark workspace

   Layers: tokens → base → shell → layout → components → utilities → print.
   Page-specific styles live in /public/css/pages/<page>.css and may only
   use the tokens defined here.
   ========================================================================== */

@font-face {
    font-family: "Manrope";
    src: url("/public/fonts/manrope-latin-variable.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("/public/fonts/jetbrains-mono-latin-variable.woff2") format("woff2");
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

/* ------------------------------------------------------------------ tokens */
:root {
    --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

    --fs-xs: .75rem;
    --fs-sm: .8125rem;
    --fs-md: .875rem;
    --fs-base: .9375rem;
    --fs-lg: 1.0625rem;
    --fs-xl: 1.375rem;
    --fs-2xl: clamp(1.6rem, 1.3rem + 1vw, 2.1rem);
    --fs-3xl: clamp(2rem, 1.5rem + 1.8vw, 2.75rem);
    --tracking-tight: -.035em;
    --tracking-display: -.055em;

    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;

    --r-xs: 3px;
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --r-pill: 999px;

    --ease: cubic-bezier(.16, 1, .3, 1);
    --dur: 180ms;
    --dur-slow: 420ms;

    --sidebar-w: 256px;
    --sidebar-w-collapsed: 68px;
    --topbar-h: 60px;
    --content-max: 1360px;

    /* Brand (fixed across themes) */
    --brand: #7625d5;
    --brand-strong: #5f1bb0;
    --brand-lime: #c6fb2f;
    --logo-bg: #ffffff; /* logos are drawn for light backgrounds, so their tile stays light in every theme */

    /* Workspace — light */
    --bg: #fafafa;
    --bg-alt: #f3f3f5;
    --surface: #ffffff;
    --surface-2: #f6f6f8;
    --surface-3: #eeeef2;
    --border: #e4e4e9;
    --border-strong: #d2d2da;
    --text: #1d1d21;
    --text-2: #4a4a55;
    --text-3: #6f6f7c;
    --accent: #7625d5;
    --accent-hover: #6419bb;
    --accent-soft: #f2eafd;
    --accent-text: #6a1fc4;
    --on-accent: #ffffff;
    --focus: #7625d5;

    --success: #11815a;
    --success-soft: #e6f5ee;
    --warning: #a65f00;
    --warning-soft: #fdf2df;
    --danger: #c42b3c;
    --danger-soft: #fce9eb;
    --info: #1f63c7;
    --info-soft: #e7effb;

    --shadow-sm: 0 1px 2px rgba(17, 19, 23, .05);
    --shadow-md: 0 8px 28px rgba(17, 19, 23, .08);
    --shadow-lg: 0 24px 64px rgba(17, 19, 23, .16);
    --overlay: rgba(17, 19, 23, .42);

    /* Chart palette (validated for light surfaces) */
    --chart-1: #7625d5;
    --chart-2: #1f8fbf;
    --chart-3: #d9791a;
    --chart-4: #11815a;
    --chart-5: #c4417a;
    --chart-grid: #ececf0;

    /* Chrome — light */
    --chrome-bg: #ffffff;
    --chrome-border: #e7e7ec;
    --chrome-text: #2a2a31;
    --chrome-text-2: #6f6f7c;
    --chrome-hover: #f3f3f5;
    --chrome-active-bg: #f2eafd;
    --chrome-active-text: #5f1bb0;
    --chrome-input: #f3f3f5;

    color-scheme: light;
}

:root[data-theme="hybrid"] {
    --chrome-bg: #111317;
    --chrome-border: #22252b;
    --chrome-text: #eceaf2;
    --chrome-text-2: #9a98a6;
    --chrome-hover: #1b1d23;
    --chrome-active-bg: #2a1a45;
    --chrome-active-text: #d7bdfb;
    --chrome-input: #1b1d23;
}

:root[data-theme="dark"] {
    --bg: #0e0f12;
    --bg-alt: #121318;
    --surface: #16171c;
    --surface-2: #1c1d23;
    --surface-3: #24252c;
    --border: #2a2b33;
    --border-strong: #383a44;
    --text: #ececf1;
    --text-2: #b8b8c4;
    --text-3: #8b8b99;
    --accent: #9b5cf0;
    --accent-hover: #ac76f3;
    --accent-soft: #261a3a;
    --accent-text: #c29cf8;
    --on-accent: #ffffff;
    --focus: #b88af6;

    --success: #3ec48f;
    --success-soft: #11291f;
    --warning: #e6a23c;
    --warning-soft: #2c2210;
    --danger: #f06a78;
    --danger-soft: #2f1519;
    --info: #6aa6f5;
    --info-soft: #14223a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, .45);
    --shadow-lg: 0 28px 70px rgba(0, 0, 0, .6);
    --overlay: rgba(0, 0, 0, .6);

    --chart-1: #a36bf5;
    --chart-2: #4bb4e0;
    --chart-3: #efa04b;
    --chart-4: #3ec48f;
    --chart-5: #ec6fa5;
    --chart-grid: #26272e;

    --chrome-bg: #0b0c0f;
    --chrome-border: #1f2027;
    --chrome-text: #e6e5ee;
    --chrome-text-2: #8d8b99;
    --chrome-hover: #17181d;
    --chrome-active-bg: #241838;
    --chrome-active-text: #d7bdfb;
    --chrome-input: #17181d;

    color-scheme: dark;
}

/* -------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--fs-base);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "ss01", "cv11";
}
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    color: var(--text);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: var(--tracking-tight);
}
h1 { font-size: var(--fs-2xl); letter-spacing: var(--tracking-display); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4, h5, h6 { font-size: var(--fs-base); }
p { margin: 0; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
img, svg, video, canvas { max-width: 100%; }
img { height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }
code, kbd, pre, samp { font-family: var(--font-mono); font-size: .86em; }
code {
    background: var(--surface-3);
    border-radius: var(--r-xs);
    padding: .1em .35em;
    word-break: break-word;
}
kbd {
    display: inline-block;
    min-width: 1.6em;
    padding: .1em .45em;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: var(--r-xs);
    background: var(--surface);
    color: var(--text-2);
    font-size: .72rem;
    text-align: center;
    line-height: 1.5;
}
pre {
    margin: 0;
    padding: var(--sp-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: auto;
    font-size: var(--fs-sm);
    line-height: 1.6;
}
pre code { background: none; padding: 0; }
table { border-collapse: collapse; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------- shell */
.shell { min-height: 100vh; }
.shell--admin {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    transition: grid-template-columns var(--dur-slow) var(--ease);
}
.shell--admin.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.skip-link {
    position: absolute;
    left: var(--sp-4);
    top: -60px;
    z-index: 1000;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-pill);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { top: var(--sp-3); color: var(--on-accent); }

/* Sidebar */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--chrome-bg);
    border-right: 1px solid var(--chrome-border);
    color: var(--chrome-text);
    z-index: 40;
}
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    height: var(--topbar-h);
    padding: 0 var(--sp-5);
    color: var(--chrome-text);
    text-decoration: none;
    flex-shrink: 0;
}
.sidebar__brand:hover { color: var(--chrome-text); }
.sidebar__logo { width: 30px; height: 30px; border-radius: var(--r-sm); flex-shrink: 0; }
.sidebar__name { font-weight: 700; font-size: var(--fs-md); letter-spacing: -.02em; line-height: 1.1; }
.sidebar__name span { display: block; font-family: var(--font-mono); font-size: .62rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--chrome-text-2); margin-top: 3px; }
.sidebar__search {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin: 0 var(--sp-3) var(--sp-3);
    padding: 9px var(--sp-3);
    background: var(--chrome-input);
    border: 1px solid var(--chrome-border);
    border-radius: var(--r-pill);
    color: var(--chrome-text-2);
    font-size: var(--fs-sm);
    cursor: pointer;
    text-align: left;
}
.sidebar__search:hover { color: var(--chrome-text); }
.sidebar__search span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__search kbd { background: transparent; border-color: var(--chrome-border); color: var(--chrome-text-2); }
/* position: relative keeps visually-hidden (.sr-only) text inside the scroll area; without it that text escapes to the page and adds blank scroll height. */
.sidebar__nav { position: relative; flex: 1; overflow-y: auto; padding: 0 var(--sp-3) var(--sp-4); scrollbar-width: thin; scrollbar-color: var(--chrome-border) transparent; }
.sidebar__group { margin-top: var(--sp-4); }
.sidebar__group-label {
    padding: 0 var(--sp-3) var(--sp-1);
    font-family: var(--font-mono);
    font-size: .64rem;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--chrome-text-2);
}
.sidebar__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
/* Group labels fold their group (tc.js remembers closed groups in qctc_nav_closed). */
button.sidebar__group-label { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: none; text-align: left; cursor: pointer; border-radius: var(--r-sm); }
button.sidebar__group-label:hover, button.sidebar__group-label:focus-visible { color: var(--chrome-text); }
.sidebar__group-label svg { flex: none; transition: transform var(--dur) var(--ease); }
.sidebar__group.is-closed .sidebar__group-label svg { transform: rotate(-90deg); }
.sidebar__group.is-closed .sidebar__list { display: none; }
.shell--admin.is-collapsed .sidebar__group.is-closed .sidebar__list { display: grid; }
.sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 7px var(--sp-3);
    border-radius: var(--r-sm);
    color: var(--chrome-text);
    font-size: var(--fs-md);
    font-weight: 500;
    text-decoration: none;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.sidebar__link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .72; }
.sidebar__link:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.sidebar__link[aria-current="page"] { background: var(--chrome-active-bg); color: var(--chrome-active-text); font-weight: 600; }
.sidebar__link[aria-current="page"] svg { opacity: 1; }
.sidebar__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__count { font-size: var(--fs-xs); color: var(--chrome-text-2); font-variant-numeric: tabular-nums; }
.sidebar__badge {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: var(--r-pill);
    background: var(--accent);
    color: var(--on-accent);
    font-size: .68rem;
    font-weight: 700;
    text-align: center;
}
.sidebar__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-lime); box-shadow: 0 0 0 3px rgba(198, 251, 47, .18); }
.sidebar__foot { border-top: 1px solid var(--chrome-border); padding: var(--sp-3); display: grid; gap: var(--sp-2); flex-shrink: 0; }
.sidebar__user {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2);
    border-radius: var(--r-md);
    color: var(--chrome-text);
    text-decoration: none;
}
.sidebar__user:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.sidebar__user-meta { min-width: 0; flex: 1; }
.sidebar__user-name { display: block; font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { display: block; font-size: var(--fs-xs); color: var(--chrome-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 6px var(--sp-3);
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--chrome-text-2);
    font-size: var(--fs-xs);
    cursor: pointer;
}
.sidebar__collapse:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.sidebar__collapse svg { width: 14px; height: 14px; transition: transform var(--dur) var(--ease); }

.shell--admin.is-collapsed .sidebar__name,
.shell--admin.is-collapsed .sidebar__search span,
.shell--admin.is-collapsed .sidebar__search kbd,
.shell--admin.is-collapsed .sidebar__group-label,
.shell--admin.is-collapsed .sidebar__label,
.shell--admin.is-collapsed .sidebar__count,
.shell--admin.is-collapsed .sidebar__user-meta,
.shell--admin.is-collapsed .sidebar__collapse-label { display: none; }
.shell--admin.is-collapsed .sidebar__brand,
.shell--admin.is-collapsed .sidebar__link,
.shell--admin.is-collapsed .sidebar__user { justify-content: center; padding-left: 0; padding-right: 0; }
.shell--admin.is-collapsed .sidebar__search { justify-content: center; padding: 9px 0; }
.shell--admin.is-collapsed .sidebar__badge { position: absolute; margin: -18px 0 0 22px; min-width: 16px; padding: 0 4px; font-size: .6rem; }
.shell--admin.is-collapsed .sidebar__link { position: relative; }
.shell--admin.is-collapsed .sidebar__collapse svg { transform: rotate(180deg); }

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    height: var(--topbar-h);
    padding: 0 var(--sp-6);
    background: color-mix(in srgb, var(--chrome-bg) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--chrome-border);
    color: var(--chrome-text);
}
.topbar__menu { display: none; }
.topbar__crumbs {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--chrome-text-2);
    white-space: nowrap;
    overflow: hidden;
}
.topbar__crumbs strong { color: var(--chrome-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: var(--sp-2); }
.topbar__tool {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    height: 36px;
    min-width: 36px;
    padding: 0 var(--sp-3);
    border: 1px solid var(--chrome-border);
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--chrome-text);
    font-size: var(--fs-sm);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--dur) var(--ease);
}
.topbar__tool:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.topbar__tool svg { width: 16px; height: 16px; }
.topbar__tool kbd { background: transparent; border-color: var(--chrome-border); color: var(--chrome-text-2); }
.topbar__tool--icon { padding: 0; width: 36px; }
.topbar__count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--r-pill);
    background: var(--danger);
    color: #fff;
    font-size: .64rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

/* Theme switcher — segmented pill (mirrors the site's Desktop/Mobile toggle) */
.theme-switch {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--chrome-border);
    border-radius: var(--r-pill);
    background: var(--chrome-input);
}
.theme-switch__opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border: 0;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--chrome-text-2);
    cursor: pointer;
}
.theme-switch__opt svg { width: 15px; height: 15px; }
.theme-switch__opt:hover { color: var(--chrome-text); }
.theme-switch__opt[aria-pressed="true"] { background: var(--chrome-bg); color: var(--chrome-text); box-shadow: var(--shadow-sm); }
:root[data-theme="hybrid"] .theme-switch__opt[aria-pressed="true"],
:root[data-theme="dark"] .theme-switch__opt[aria-pressed="true"] { background: var(--chrome-active-bg); color: var(--chrome-active-text); }

/* Main column */
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.page { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--sp-8) var(--sp-8) var(--sp-12); flex: 1; }
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4) var(--sp-6);
    flex-wrap: wrap;
    margin-bottom: var(--sp-6);
}
.page-head__copy { min-width: 0; max-width: 72ch; }
.page-head__title { font-size: var(--fs-3xl); font-weight: 600; letter-spacing: var(--tracking-display); line-height: 1.05; }
.page-head__desc { margin-top: var(--sp-2); color: var(--text-2); font-size: var(--fs-lg); }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.page-foot { padding: var(--sp-6) var(--sp-8); color: var(--text-3); font-size: var(--fs-xs); border-top: 1px solid var(--border); }

/* Client shell — top navigation */
.shell--client { display: flex; flex-direction: column; }
.client-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--chrome-bg) 94%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--chrome-border);
    color: var(--chrome-text);
}
.client-bar__row {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    max-width: var(--content-max);
    height: var(--topbar-h);
    margin: 0 auto;
    padding: 0 var(--sp-8);
}
.client-bar__brand { display: flex; align-items: center; gap: var(--sp-3); color: var(--chrome-text); text-decoration: none; font-weight: 700; letter-spacing: -.02em; min-width: 0; }
.client-bar__brand:hover { color: var(--chrome-text); }
.client-bar__brand > img { height: 30px; width: auto; max-width: 140px; border-radius: var(--r-xs); }
.client-bar__brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-bar__nav { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; }
/* Only the links scroll; the More menu must stay outside any overflow box or it gets clipped. */
.client-bar__links { min-width: 0; display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.client-bar__links::-webkit-scrollbar { display: none; }
.client-bar__link {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 7px var(--sp-3);
    border: 0;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--chrome-text-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.client-bar__link svg { width: 15px; height: 15px; }
.client-bar__link:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.client-bar__link:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.client-bar__link[aria-expanded="true"] { background: var(--chrome-hover); color: var(--chrome-text); }
.client-bar__link[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
.client-bar__link > svg:last-child { transition: transform var(--dur) var(--ease); }
.client-bar__link[aria-current="page"] { background: var(--chrome-active-bg); color: var(--chrome-active-text); font-weight: 600; }
.client-bar__more { position: relative; flex-shrink: 0; }
.client-bar__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    padding: var(--sp-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    display: grid;
    gap: 2px;
    z-index: 50;
}
.client-bar__menu a { display: flex; align-items: center; gap: var(--sp-2); padding: 8px var(--sp-3); border-radius: var(--r-sm); color: var(--text); text-decoration: none; font-size: var(--fs-sm); }
.client-bar__menu a:hover { background: var(--surface-2); }
.client-bar__menu a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.client-bar__menu svg { width: 15px; height: 15px; }
.client-bar__actions { display: flex; align-items: center; gap: var(--sp-2); }
.admin-preview-bar {
    background: var(--brand-lime);
    color: #12200a;
    font-size: var(--fs-sm);
    font-weight: 600;
}
.admin-preview-bar__row { max-width: var(--content-max); margin: 0 auto; padding: 6px var(--sp-8); display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.admin-preview-bar a { color: #12200a; }

/* Mobile */
.scrim { position: fixed; inset: 0; background: var(--overlay); border: 0; z-index: 35; }
@media (max-width: 960px) {
    .shell--admin, .shell--admin.is-collapsed { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        transform: translateX(-102%);
        transition: transform var(--dur-slow) var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .shell--admin.is-nav-open .sidebar { transform: none; }
    .shell--admin.is-collapsed .sidebar__name,
    .shell--admin.is-collapsed .sidebar__label,
    .shell--admin.is-collapsed .sidebar__group-label,
    .shell--admin.is-collapsed .sidebar__user-meta,
    .shell--admin.is-collapsed .sidebar__search span { display: revert; }
    .shell--admin.is-collapsed .sidebar__group.is-closed .sidebar__list { display: none; }
    .sidebar__collapse { display: none; }
    .topbar { padding: 0 var(--sp-4); }
    .topbar__menu { display: inline-flex; }
    .topbar__tool-label { display: none; }
    .page { padding: var(--sp-6) var(--sp-4) var(--sp-10); }
    .client-bar__row { padding: 0 var(--sp-4); }
    .admin-preview-bar__row { padding: 6px var(--sp-4); }
}
/* The client nav needs ~1150px on one line; below that it gets its own row. */
@media (max-width: 1180px) {
    .client-bar__row { flex-wrap: wrap; height: auto; padding-top: var(--sp-2); padding-bottom: var(--sp-2); row-gap: var(--sp-1); }
    .client-bar__brand { flex: 1; }
    .client-bar__nav { order: 3; flex-basis: 100%; }
}
@media (max-width: 640px) {
    .page-head__title { font-size: var(--fs-2xl); }
    .topbar__crumbs span { display: none; }
    /* Phones: the page title is right below, so the bar keeps only the client picker and tools. */
    .topbar { gap: var(--sp-2); padding: 0 var(--sp-3); }
    .topbar__crumbs { display: none; }
    .topbar__actions { flex: 1 1 auto; min-width: 0; justify-content: flex-end; gap: 6px; }
    .topbar__actions > .inline-form { flex: 1 1 auto; min-width: 0; }
    .topbar__actions > .inline-form .logo-mark { display: none; }
    .topbar__actions .select--inline { width: 100%; min-width: 0; }
    .topbar__actions > .theme-switch { display: none; }
    .page { padding: var(--sp-5) var(--sp-3) var(--sp-10); }
}
.sidebar__theme { display: none; }
@media (max-width: 640px) {
    .sidebar__theme { display: flex; justify-content: center; padding: var(--sp-2) 0 0; }
}

/* ------------------------------------------------------------------ layout */
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack--xs { gap: var(--sp-1); }
.stack--sm { gap: var(--sp-2); }
.stack--lg { gap: var(--sp-6); }
.stack--xl { gap: var(--sp-8); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.cluster--lg { gap: var(--sp-4); }
.cluster--between { justify-content: space-between; }
/* Left side empty (the admin client picker lives in the topbar): keep the tools on the right. */
.cluster--between > .btn-row:only-child { margin-left: auto; }
.cluster--end { justify-content: flex-end; }
.cluster--start { align-items: flex-start; }
.cluster--nowrap { flex-wrap: nowrap; }
.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.grid--auto-sm { grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); }
.grid--lg { gap: var(--sp-6); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: var(--sp-6); align-items: start; }
.split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }
.section { margin-top: var(--sp-8); }
.section:first-child { margin-top: 0; }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.section__title { font-size: var(--fs-xl); font-weight: 600; letter-spacing: var(--tracking-tight); }
.section__desc { color: var(--text-2); font-size: var(--fs-md); margin-top: 2px; }
@media (max-width: 1100px) {
    .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .grid--2, .grid--3, .grid--4, .split--even { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
}

/* -------------------------------------------------------------- typography */
.eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent-text);
}
.lead { font-size: var(--fs-lg); color: var(--text-2); }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.strong { font-weight: 650; }
.mono { font-family: var(--font-mono); font-size: .86em; }
.num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.break { overflow-wrap: anywhere; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent-text); }
.prose { max-width: 70ch; color: var(--text-2); }
.prose > * + * { margin-top: var(--sp-3); }
.prose h2, .prose h3 { color: var(--text); margin-top: var(--sp-6); }
.prose ul, .prose ol { padding-left: 1.3em; }

/* ----------------------------------------------------------------- buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 38px;
    padding: 0 var(--sp-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--text);
    font-size: var(--fs-md);
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn--soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.btn--soft:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.btn--danger { background: var(--surface); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn--danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger-solid:hover { filter: brightness(1.08); color: #fff; }
.btn--sm { min-height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn--xs { min-height: 24px; padding: 0 var(--sp-2); font-size: var(--fs-xs); gap: var(--sp-1); }
.btn--lg { min-height: 46px; padding: 0 var(--sp-6); font-size: var(--fs-base); }
.btn--icon { padding: 0; width: 38px; }
.btn--icon.btn--sm { width: 30px; }
.btn--block { width: 100%; }
/* Fingers need bigger targets than mouse pointers. */
@media (pointer: coarse) {
    .btn--sm { min-height: 40px; }
    .btn--xs { min-height: 34px; padding: 0 var(--sp-3); }
    .btn--icon.btn--sm, .btn--icon.btn--xs { width: 40px; }
    .topbar__tool { height: 40px; min-width: 40px; }
    .topbar__tool--icon { width: 40px; }
    .chip { min-height: 36px; }
    .check input[type="checkbox"], .check input[type="radio"] { width: 20px; height: 20px; }
    .input, .select, .textarea { font-size: max(16px, 1em); }
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-color: var(--text-3) transparent var(--text-3) transparent;
    border-radius: 50%;
    animation: tc-spin .8s linear infinite;
}
.btn--primary.is-loading::after { border-color: #fff transparent #fff transparent; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-text); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.btn-row--end { justify-content: flex-end; }

/* ------------------------------------------------------------------- cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    min-width: 0;
}
.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
    padding: var(--sp-5) var(--sp-5) 0;
}
.card__head--bordered { padding-bottom: var(--sp-4); border-bottom: 1px solid var(--border); }
.card__title { font-size: var(--fs-base); font-weight: 650; letter-spacing: -.015em; }
.card__sub { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
.card__body { padding: var(--sp-5); }
.card__body--flush { padding: 0; }
.card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card--pad { padding: var(--sp-5); }
.card--muted { background: var(--surface-2); }
.card--accent { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.card--link { display: block; color: inherit; text-decoration: none; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.card--link:hover { color: inherit; border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }

/* Dark band — the site's feature strip. Always dark regardless of theme. */
.band {
    --bg: #111317; --surface: #17191e; --surface-2: #1d1f25; --surface-3: #25272e; --border: #2a2c33; --border-strong: #3a3c45;
    --text: #f1eff6; --text-2: #bdbac8; --text-3: #8e8b9b; --accent-text: #d0acfa; --accent-soft: #2a1a45;
    background: #111317;
    color: var(--text);
    border-radius: var(--r-lg);
    padding: var(--sp-8);
}
.band h1, .band h2, .band h3 { color: var(--text); }
.band__highlight { color: var(--brand-lime); }
.band__headline { max-width: 26ch; font-size: clamp(1.7rem, 1.1rem + 2.1vw, 2.75rem); font-weight: 600; letter-spacing: var(--tracking-display); line-height: 1.08; color: var(--text); }

/* --------------------------------------------------------------- metrics */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: var(--sp-3); }
.kpi {
    position: relative;
    padding: var(--sp-4) var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    min-width: 0;
}
.kpi__label { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-3); font-size: var(--fs-sm); font-weight: 500; }
.kpi__value { margin-top: var(--sp-2); font-size: 1.85rem; font-weight: 650; letter-spacing: -.045em; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.kpi__value small { font-size: .55em; font-weight: 600; letter-spacing: -.01em; color: var(--text-3); margin-left: 2px; }
.kpi__meta { margin-top: var(--sp-2); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); }
.kpi--accent { background: var(--accent); border-color: var(--accent); }
.kpi--accent .kpi__label, .kpi--accent .kpi__meta { color: rgba(255, 255, 255, .78); }
.kpi--accent .kpi__value { color: #fff; }
.kpi--link { color: inherit; text-decoration: none; transition: border-color var(--dur) var(--ease); }
.kpi--link:hover { color: inherit; border-color: var(--border-strong); }
.delta { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 650; font-variant-numeric: tabular-nums; background: var(--surface-3); color: var(--text-2); }
.delta--up { background: var(--success-soft); color: var(--success); }
.delta--down { background: var(--danger-soft); color: var(--danger); }
.kpi--accent .delta { background: rgba(255, 255, 255, .18); color: #fff; }

@media (max-width: 640px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
    .kpi { padding: var(--sp-3) var(--sp-4); }
    .kpi__value { font-size: 1.45rem; }
}

.stat-inline { display: inline-flex; align-items: baseline; gap: var(--sp-2); }
.stat-inline strong { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    color: var(--text-2);
    font-size: .72rem;
    font-weight: 650;
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: middle;
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--accent { background: var(--accent-soft); color: var(--accent-text); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); }
.badge--mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: .02em; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.dot--success { background: var(--success); }
.dot--warning { background: var(--warning); }
.dot--danger { background: var(--danger); }
.dot--info { background: var(--info); }
.dot--accent { background: var(--accent); }
.dot--live { background: var(--success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent); animation: tc-pulse 2s var(--ease) infinite; }
.grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    font-weight: 750;
    font-size: var(--fs-md);
    background: var(--surface-3);
    color: var(--text);
}
.grade--a, .grade--b { background: var(--success-soft); color: var(--success); }
.grade--c { background: var(--warning-soft); color: var(--warning); }
.grade--d, .grade--f { background: var(--danger-soft); color: var(--danger); }

/* ------------------------------------------------------------ alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid var(--border);
    border-left: 3px solid var(--info);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    font-size: var(--fs-md);
}
.alert + .alert { margin-top: var(--sp-2); }
.alert__body { flex: 1; min-width: 0; }
.alert__title { font-weight: 650; }
.alert--success { border-left-color: var(--success); background: var(--success-soft); }
.alert--warning { border-left-color: var(--warning); background: var(--warning-soft); }
.alert--danger { border-left-color: var(--danger); background: var(--danger-soft); }
.alert--info { border-left-color: var(--info); background: var(--info-soft); }
.alert--accent { border-left-color: var(--accent); background: var(--accent-soft); }
.flash-stack { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-5); }

/* ------------------------------------------------------------ empty state */
.empty { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-10) var(--sp-6); text-align: center; }
.empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: var(--sp-2);
    border-radius: var(--r-md);
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 1.35rem;
}
.empty__icon svg { width: 22px; height: 22px; }
.empty__title { font-weight: 650; font-size: var(--fs-lg); letter-spacing: -.02em; }
.empty__text { max-width: 52ch; color: var(--text-2); font-size: var(--fs-md); }
.empty__actions { margin-top: var(--sp-3); display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; }
.empty--compact { padding: var(--sp-6) var(--sp-4); }

/* -------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.field__label .subtle { font-weight: 400; }
.field__hint { font-size: var(--fs-xs); color: var(--text-3); }
.field__error { font-size: var(--fs-xs); color: var(--danger); font-weight: 600; }
.input, .select, .textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px var(--sp-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font-size: var(--fs-md);
    line-height: 1.4;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"], .is-invalid { border-color: var(--danger); }
.input--sm, .select--sm { min-height: 32px; padding: 4px var(--sp-2); font-size: var(--fs-sm); }
.input--mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.select {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8b99' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}
.select--inline { width: auto; min-width: 160px; }
.textarea { min-height: 110px; resize: vertical; }
.textarea--code { font-family: var(--font-mono); font-size: var(--fs-sm); min-height: 180px; }
input[type="color"].input { padding: 3px; width: 56px; cursor: pointer; }
input[type="file"].input { padding: 6px; }
.check { display: inline-flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-md); cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.check__text { display: grid; gap: 1px; }
.check__text small { color: var(--text-3); font-size: var(--fs-xs); }
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; font-size: var(--fs-md); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--border-strong); transition: background var(--dur) var(--ease); flex-shrink: 0; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--focus); outline-offset: 2px; }
.form-grid { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); }
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; padding-top: var(--sp-2); }
.form-actions--end { justify-content: flex-end; }
.fieldset { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); margin: 0; min-width: 0; }
.fieldset legend { padding: 0 var(--sp-2); font-weight: 650; font-size: var(--fs-sm); }
.input-group { display: flex; align-items: stretch; }
.input-group > .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group > .btn { border-radius: 0 var(--r-sm) var(--r-sm) 0; min-height: 40px; margin-left: -1px; }
.inline-form { display: inline-flex; gap: var(--sp-2); align-items: center; margin: 0; }
@media (max-width: 640px) {
    .inline-form { flex-wrap: wrap; max-width: 100%; }
    .inline-form > .input, .inline-form > .select { flex: 1 1 130px; min-width: 0; }
    .table-tools .input { max-width: none; flex: 1 1 160px; }
}
/* Filter bars: controls sit side by side at their natural width; search takes what's left. */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: flex-end; margin-bottom: var(--sp-4); }
.filter-bar > .input, .filter-bar > .select { width: auto; flex: 0 1 auto; min-width: 0; max-width: 220px; }
.filter-bar > .input[type="search"], .filter-bar > .input[type="text"] { flex: 1 1 220px; max-width: none; }
.filter-bar .field { flex: 0 1 auto; gap: 4px; min-width: 140px; max-width: 240px; }
.filter-bar .field.u-grow, .filter-bar .field:has(> .input[type="search"]) { flex: 1 1 220px; max-width: none; }
.filter-bar .field__label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); }
.filter-bar > .btn, .filter-bar > .btn-row { flex: 0 0 auto; }
.filter-bar > .check, .filter-bar > .link-btn { display: inline-flex; align-items: center; min-height: 32px; }
.filter-bar > .check input { margin-top: 0; }
@media (max-width: 640px) {
    .filter-bar > .input, .filter-bar > .select, .filter-bar .field { flex: 1 1 140px; min-width: 0; max-width: none; }
    .filter-bar > .input[type="search"], .filter-bar .field:has(> .input[type="search"]) { flex-basis: 100%; }
}
@media (max-width: 760px) {
    .form-grid--2, .form-grid--3 { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------- tables */
.table-wrap { position: relative; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card > .table-wrap:last-child .table tr:last-child td { border-bottom: 0; }
.table { width: 100%; font-size: var(--fs-md); }
.table th {
    position: sticky;
    top: 0;
    padding: 10px var(--sp-4);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    color: var(--text-3);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}
.table td { padding: 11px var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .is-actions { text-align: right; white-space: nowrap; width: 1%; }
.table .is-actions .btn-row, .table .is-actions .cluster { flex-wrap: nowrap; justify-content: flex-end; }
.table .is-tight { width: 1%; white-space: nowrap; }
.table .is-date { white-space: nowrap; color: var(--text-2); font-size: var(--fs-sm); }
.table .is-truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table--compact th { padding: 7px var(--sp-3); }
.table--compact td { padding: 7px var(--sp-3); font-size: var(--fs-sm); }
/* Month grid: seven equal columns, top-aligned day cells, entries truncate. */
.table--calendar { table-layout: fixed; min-width: 640px; }
.table--calendar td { vertical-align: top; height: 104px; border-left: 1px solid var(--border); }
.table--calendar td:first-child { border-left: 0; }
.table--calendar .badge { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--text); }
.table th[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent-text); }
.table th[aria-sort="descending"]::after { content: " ↓"; color: var(--accent-text); }
.table tr.is-highlight td { background: var(--accent-soft); }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { display: block; margin-top: 1px; font-size: var(--fs-xs); color: var(--text-3); }
.cell-user { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.table-tools { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.table-tools .input { max-width: 280px; min-height: 34px; }
.table-tools__count { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); }
/*
 * Phones: a .table--stack table becomes one card per row, each cell labelled with
 * its column (data-label, filled from the header by tc.js). tc.js adds the class to
 * every data table with 3+ columns and no form fields; opt out with data-nostack.
 */
@media (max-width: 640px) {
    .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
    .table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .table--stack tbody tr { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
    .table--stack tbody tr:hover { background: none; }
    .card > .table-wrap:last-child .table--stack tr:last-child { border-bottom: 0; }
    .table--stack td { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); padding: 3px 0; border: 0; text-align: right; white-space: normal; }
    .table--stack td::before { content: attr(data-label); flex: 0 0 auto; max-width: 45%; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; text-align: left; }
    .table--stack td:not([data-label])::before, .table--stack td[data-label=""]::before { content: none; }
    .table--stack td.cell-title, .table--stack td.is-stack-head { display: block; text-align: left; padding-bottom: var(--sp-1); font-size: var(--fs-md); }
    .table--stack td.cell-title::before, .table--stack td.is-stack-head::before { content: none; }
    .table--stack td.is-actions { display: block; width: 100%; padding-top: var(--sp-2); text-align: left; }
    .table--stack td.is-actions::before { content: none; }
    .table--stack .is-actions .btn-row, .table--stack .is-actions .cluster { flex-wrap: wrap; justify-content: flex-start; }
    .table--stack td:empty { display: none; }
    .table--stack td.is-check { display: inline-flex; width: auto; float: right; padding: 2px 0 0 var(--sp-3); }
    .table--stack td.is-check::before { content: none; }
    .table--stack .is-truncate { max-width: none; }
    /* Beat the desktop column helpers (.is-tight width 1%, .is-truncate nowrap). */
    .table.table--stack td { width: 100%; max-width: none; overflow: visible; white-space: normal; text-overflow: clip; }
    .table.table--stack td.is-check { width: auto; }
}

/* -------------------------------------------------- lists, key/values */
.list { list-style: none; margin: 0; padding: 0; }
.list__item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--border); min-width: 0; }
.list__item:last-child { border-bottom: 0; }
.list--inset .list__item { padding-left: 0; padding-right: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { display: block; font-weight: 600; color: var(--text); }
.list__meta { display: block; font-size: var(--fs-xs); color: var(--text-3); margin-top: 1px; }
.list__aside { flex-shrink: 0; display: flex; align-items: center; gap: var(--sp-2); }
a.list__item { color: inherit; text-decoration: none; }
a.list__item:hover { background: var(--surface-2); color: inherit; }
.kv { display: grid; grid-template-columns: fit-content(40%) minmax(0, 1fr); gap: var(--sp-2) var(--sp-5); margin: 0; font-size: var(--fs-md); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline__item { position: relative; padding: 0 0 var(--sp-4) var(--sp-6); }
.timeline__item::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: -4px; width: 1px; background: var(--border); }
.timeline__item:last-child::before { display: none; }
.timeline__item .dot { position: absolute; left: 0; top: 6px; }
.timeline__title { font-weight: 600; font-size: var(--fs-md); }
.timeline__meta { font-size: var(--fs-xs); color: var(--text-3); }

/* -------------------------------------------------- bars and meters */
.meter { width: 100%; height: 8px; appearance: none; -webkit-appearance: none; border: 0; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; vertical-align: middle; }
.meter::-webkit-progress-bar, .meter::-webkit-meter-bar { background: var(--surface-3); border-radius: var(--r-pill); border: 0; height: 8px; }
.meter::-webkit-progress-value { background: var(--accent); border-radius: var(--r-pill); }
.meter::-moz-progress-bar { background: var(--accent); border-radius: var(--r-pill); }
.meter::-webkit-meter-optimum-value { background: var(--success); border-radius: var(--r-pill); }
.meter::-webkit-meter-suboptimum-value { background: var(--warning); border-radius: var(--r-pill); }
.meter::-webkit-meter-even-less-good-value { background: var(--danger); border-radius: var(--r-pill); }
.meter:-moz-meter-optimum::-moz-meter-bar { background: var(--success); }
.meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warning); }
.meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--danger); }
.meter--thin { height: 4px; }
.meter--thin::-webkit-progress-bar { height: 4px; }
.bar-list { display: grid; gap: var(--sp-3); }
.bar-list__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--sp-3); align-items: center; font-size: var(--fs-md); }
.bar-list__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list__value { font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-list__row .meter { grid-column: 1 / -1; }

/* Sparkline / chart containers */
.chart { position: relative; width: 100%; height: 260px; }
.chart--sm { height: 160px; }
.chart--lg { height: 340px; }
.chart canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.spark { display: block; width: 100%; height: 36px; color: var(--accent); }
.spark path { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark .spark__area { fill: currentColor; stroke: none; opacity: .1; }
.legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); color: var(--text-2); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend__swatch--1 { background: var(--chart-1); }
.legend__swatch--2 { background: var(--chart-2); }
.legend__swatch--3 { background: var(--chart-3); }
.legend__swatch--4 { background: var(--chart-4); }
.legend__swatch--5 { background: var(--chart-5); }

/* ------------------------------------------------------ tabs, chips */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: var(--r-pill); max-width: 100%; }
.tabs__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px var(--sp-4);
    border: 0;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.tabs__item:hover { color: var(--text); }
.tabs__item[aria-current="page"], .tabs__item[aria-selected="true"], .tabs__item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs__count { font-size: .68rem; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-3); }
/* The rule under line tabs is an inset shadow so the active underline covers it without overflowing the row. */
.tabs--line { display: flex; background: none; padding: 0; gap: 2px var(--sp-4); box-shadow: inset 0 -1px 0 var(--border); border-radius: 0; margin-bottom: var(--sp-5); }
.tabs--line .tabs__item { border-radius: 0; padding: var(--sp-3) 0; border-bottom: 2px solid transparent; }
.tabs--line .tabs__item[aria-current="page"], .tabs--line .tabs__item[aria-selected="true"], .tabs--line .tabs__item.is-active { background: none; box-shadow: none; border-bottom-color: var(--accent); color: var(--text); }
/* Phones: tab rows scroll sideways in one line instead of wrapping into a stack. */
@media (max-width: 640px) {
    .tabs--line { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
    .tabs--line::-webkit-scrollbar { display: none; }
    .tabs--line .tabs__item { flex: 0 0 auto; white-space: nowrap; }
    .tabs:not(.tabs--line) { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
    .tabs:not(.tabs--line)::-webkit-scrollbar { display: none; }
    .tabs:not(.tabs--line) .tabs__item { flex: 0 0 auto; white-space: nowrap; }
}
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--text-2);
    font-size: var(--fs-xs);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
a.chip:hover, button.chip:hover { border-color: var(--border-strong); color: var(--text); }
button.chip { cursor: pointer; }
.chip.is-active, .chip[aria-pressed="true"], .chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
/* A chip can wrap a radio or checkbox (booking times): the input hides, the chip shows the choice. */
.chip > input[type="radio"], .chip > input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(> input) { position: relative; cursor: pointer; }
.chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.chip strong { color: var(--text); font-weight: 650; }

/* ------------------------------------------------------ board (kanban) */
/* <div class="board" data-board data-board-url="…" data-csrf="…"> > .board__col[data-board-col="stage"]
   > .board__head + .board__list[data-board-list] > .board__card[data-board-card][data-id][data-value] */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(248px, 1fr); gap: var(--sp-3); overflow-x: auto; padding-bottom: var(--sp-2); align-items: start; }
.board__col { display: flex; flex-direction: column; min-width: 0; max-height: 78vh; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.board__col.is-drag-over { border-color: var(--accent); background: var(--accent-soft); }
.board__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.board__meta { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.board__list { position: relative; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); min-height: 96px; overflow-y: auto; }
.board__empty { padding: var(--sp-4) 0; text-align: center; font-size: var(--fs-xs); color: var(--text-3); }
.board__list:has(.board__card) .board__empty { display: none; }
.board__card { display: block; padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.board__card[draggable="true"] { cursor: grab; }
.board__card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.board__card.is-dragging { opacity: .45; }
.board__card.is-saving { opacity: .7; pointer-events: none; }
.board__title { display: block; font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.board__title:hover { color: var(--accent-text); }
.board__sub { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); overflow-wrap: anywhere; }
.board__foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-2); }
.board__more { padding: 0 var(--sp-3) var(--sp-3); font-size: var(--fs-xs); }

/* ------------------------------------------------------ steps / checklist */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); counter-reset: tc-step; }
.steps__item { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); counter-increment: tc-step; }
.steps__item::before {
    content: counter(tc-step);
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--surface-3); color: var(--text-2);
    font-size: var(--fs-xs); font-weight: 700; flex-shrink: 0;
}
.steps__item.is-done::before { content: "✓"; background: var(--success-soft); color: var(--success); }
.steps__item.is-current { border-color: var(--accent); }
.steps__item.is-current::before { background: var(--accent); color: var(--on-accent); }
.steps__body { flex: 1; min-width: 0; }
.steps__title { font-weight: 600; font-size: var(--fs-md); }
.steps__text { font-size: var(--fs-sm); color: var(--text-2); }

/* ----------------------------------------------------- avatar, media */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent-text);
    font-weight: 700; font-size: var(--fs-sm);
    overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 26px; height: 26px; font-size: var(--fs-xs); }
.avatar--lg { width: 56px; height: 56px; font-size: var(--fs-lg); }
.media { display: flex; gap: var(--sp-3); align-items: flex-start; min-width: 0; }
.media__body { flex: 1; min-width: 0; }
.icon-tile {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--r-md);
    background: var(--surface-3); color: var(--text-2);
    font-weight: 700; font-size: var(--fs-sm); flex-shrink: 0;
}
.icon-tile svg { width: 18px; height: 18px; }
.icon-tile--accent { background: var(--accent-soft); color: var(--accent-text); }
.icon-tile--success { background: var(--success-soft); color: var(--success); }
.icon-tile--warning { background: var(--warning-soft); color: var(--warning); }
.icon-tile--danger { background: var(--danger-soft); color: var(--danger); }
.thumb { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.thumb img { display: block; width: 100%; }

/* ------------------------------------------------------ copy / code */
.copy { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; min-width: 0; }
.copy__value { flex: 1; min-width: 0; padding: 8px var(--sp-3); font-family: var(--font-mono); font-size: var(--fs-sm); overflow-x: auto; white-space: nowrap; }
.copy__btn { border: 0; border-left: 1px solid var(--border); background: var(--surface); padding: 0 var(--sp-3); font-size: var(--fs-xs); font-weight: 650; color: var(--text-2); cursor: pointer; }
.copy__btn:hover { color: var(--text); }
.copy.is-copied .copy__btn { color: var(--success); }
[data-copy] { cursor: copy; }

/* ------------------------------------------------------ disclosure */
.details { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.details > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); cursor: pointer; font-weight: 600; list-style: none; }
.details > summary::-webkit-details-marker { display: none; }
.details > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform var(--dur) var(--ease); flex-shrink: 0; }
.details[open] > summary::after { transform: rotate(225deg); }
.details__body { padding: 0 var(--sp-4) var(--sp-4); }

/* ------------------------------------------------------ overlays */
.dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}
.dialog--wide { width: min(880px, calc(100vw - 32px)); }
@media (max-width: 640px) {
    .dialog, .dialog--wide { width: 100vw; max-width: 100vw; max-height: calc(100dvh - 24px); margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; }
    .dialog[open] { display: flex; flex-direction: column; }
    .dialog > form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
    .dialog__body { padding: var(--sp-4); flex: 1 1 auto; }
    .dialog__head, .dialog__foot { padding: var(--sp-3) var(--sp-4); }
    .dialog__foot { padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom)); flex-wrap: wrap; }
    .dialog__foot > .btn { flex: 1 1 auto; }
}
.dialog::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.dialog__title { font-size: var(--fs-lg); font-weight: 650; }
.dialog__body { padding: var(--sp-5); overflow-y: auto; }
.dialog__foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); }

.popover {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(360px, calc(100vw - 24px));
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    z-index: 60;
    overflow: hidden;
}
.popover__head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); font-weight: 650; font-size: var(--fs-md); }
.popover__body { max-height: 380px; overflow-y: auto; }
.notice { display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.notice:last-child { border-bottom: 0; }
.notice:hover { background: var(--surface-2); color: var(--text); }
.notice .dot { margin-top: 6px; }
.notice__title { font-weight: 600; font-size: var(--fs-sm); }
.notice__text { font-size: var(--fs-xs); color: var(--text-2); }

/* Command palette */
.cmdk { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 12vh var(--sp-4) var(--sp-4); background: var(--overlay); backdrop-filter: blur(4px); }
.cmdk__box { width: min(620px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.cmdk__input { width: 100%; padding: var(--sp-4) var(--sp-5); border: 0; border-bottom: 1px solid var(--border); background: transparent; font-size: var(--fs-lg); color: var(--text); }
.cmdk__input:focus { outline: none; }
.cmdk__results { max-height: 52vh; overflow-y: auto; padding: var(--sp-2); }
.cmdk__group { padding: var(--sp-3) var(--sp-3) var(--sp-1); font-family: var(--font-mono); font-size: .64rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.cmdk__item { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 9px var(--sp-3); border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-md); }
.cmdk__item[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }
.cmdk__hint { font-size: var(--fs-xs); color: var(--text-3); }
.cmdk__empty { padding: var(--sp-6); text-align: center; color: var(--text-3); font-size: var(--fs-md); }
.cmdk__foot { display: flex; gap: var(--sp-4); padding: var(--sp-2) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-xs); color: var(--text-3); }

/* Toasts */
.toasts { position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 300; display: grid; gap: var(--sp-2); max-width: min(380px, calc(100vw - 32px)); }
.toast {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    background: #17181d;
    color: #f1eff6;
    font-size: var(--fs-md);
    box-shadow: var(--shadow-lg);
    border-left: 3px solid var(--brand-lime);
    animation: tc-rise var(--dur-slow) var(--ease);
}
.toast--success { border-left-color: #3ec48f; }
.toast--error { border-left-color: #f06a78; }
.toast--warning { border-left-color: #e6a23c; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all var(--dur) var(--ease); }

/* Side drawer (refresh panel etc.) */
.drawer { position: fixed; right: var(--sp-5); bottom: var(--sp-5); width: min(340px, calc(100vw - 32px)); z-index: 90; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-4) var(--sp-3); }
.drawer__body { padding: 0 var(--sp-4) var(--sp-4); display: grid; gap: var(--sp-2); }
.fab {
    position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 80;
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 10px var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-pill);
    background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--fs-sm);
    box-shadow: var(--shadow-md); cursor: pointer;
}
.fab:hover { border-color: var(--border-strong); }
.fab svg { width: 16px; height: 16px; }

/* Skeleton / spinner */
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: tc-shimmer 1.4s linear infinite; border-radius: var(--r-sm); min-height: 1em; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: tc-spin .8s linear infinite; vertical-align: middle; }

/* ------------------------------------------------------ auth + public */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--bg); }
.auth__aside { background: #111317; color: #f1eff6; padding: var(--sp-12); display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-8); }
.auth__aside h2 { color: #f1eff6; font-size: var(--fs-3xl); letter-spacing: var(--tracking-display); line-height: 1.02; }
.auth__aside h2 em { font-style: normal; color: #b983ff; }
.auth__aside p { color: #bdbac8; max-width: 44ch; }
.auth__brand { display: flex; align-items: center; gap: var(--sp-3); font-weight: 700; color: #f1eff6; text-decoration: none; }
.auth__brand img { width: 32px; height: 32px; }
.auth__main { display: flex; align-items: center; justify-content: center; padding: var(--sp-10) var(--sp-6); }
.auth__panel { width: min(400px, 100%); display: grid; gap: var(--sp-5); }
.auth__title { font-size: var(--fs-2xl); letter-spacing: var(--tracking-display); }
.auth__sub { color: var(--text-2); margin-top: var(--sp-1); }
.auth__links { display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--fs-sm); }
.auth__divider { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-3); font-size: var(--fs-xs); }
.auth__divider::before, .auth__divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth__theme { position: absolute; top: var(--sp-4); right: var(--sp-4); }
.auth--single { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) {
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth__aside { display: none; }
}

.public { min-height: 100vh; display: flex; flex-direction: column; }
.public__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); max-width: 1200px; width: 100%; margin: 0 auto; padding: var(--sp-4) var(--sp-6); }
.public__brand { display: inline-flex; align-items: center; gap: var(--sp-3); color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -.02em; }
.public__brand img { width: 30px; height: 30px; }
.public__main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: var(--sp-8) var(--sp-6) var(--sp-12); }
.public__main--narrow { max-width: 780px; }
.public__foot { border-top: 1px solid var(--border); padding: var(--sp-6); text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
.hero { padding: var(--sp-12) 0 var(--sp-10); text-align: center; }
.hero__title { font-size: clamp(2.6rem, 1.6rem + 4vw, 4.4rem); letter-spacing: -.065em; line-height: .98; font-weight: 580; }
.hero__title em { font-style: normal; color: var(--accent); }
.hero__lead { margin: var(--sp-5) auto 0; max-width: 56ch; color: var(--text-2); font-size: var(--fs-lg); }
.hero__actions { margin-top: var(--sp-6); display: flex; gap: var(--sp-2); justify-content: center; flex-wrap: wrap; }

/* ------------------------------------------------------ report document */
.report { max-width: 980px; margin: 0 auto; padding: var(--sp-10) var(--sp-8); }
/* Cover sits on a card like the rest of the portal; sections are spaced by their .stack parent. */
.report__head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-5); flex-wrap: wrap; }
.report__section { break-inside: avoid; }

/* ------------------------------------- logo marks (Brand::mark, core/brand.php) */
/* A client logo or site icon over coloured initials; tc.js drops a broken image so the initials show. */
.logo-mark {
    --mark-bg: var(--chart-1);
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--r-md);
    background: var(--mark-bg); color: #fff;
    font-weight: 700; font-size: var(--fs-sm); letter-spacing: -.02em; line-height: 1;
    overflow: hidden; flex-shrink: 0; vertical-align: middle;
    box-shadow: inset 0 0 0 1px rgba(17, 19, 23, .08);
}
.logo-mark__text { user-select: none; }
:root[data-theme="dark"] .logo-mark { color: #111317; } /* dark-theme chart colours are light, so initials go dark */
.logo-mark__img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 10%; object-fit: contain; background: var(--logo-bg); }
.logo-mark--xs { width: 20px; height: 20px; border-radius: var(--r-xs); font-size: 9px; }
.logo-mark--xs .logo-mark__img { padding: 6%; }
.logo-mark--sm { width: 28px; height: 28px; border-radius: var(--r-sm); font-size: var(--fs-xs); }
.logo-mark--lg { width: 56px; height: 56px; border-radius: var(--r-md); font-size: var(--fs-lg); }
.logo-mark--xl { width: 80px; height: 80px; border-radius: var(--r-lg); font-size: var(--fs-xl); }
/* Wordmark logos keep their shape: fixed height, natural width. */
.logo-mark--wide { width: auto; min-width: 0; padding: 0 6px; background: var(--logo-bg); }
.logo-mark--wide .logo-mark__text { display: none; }
.logo-mark--wide .logo-mark__img { position: static; width: auto; max-width: 180px; padding: 3px 0; }
.logo-mark--hue-0 { --mark-bg: var(--chart-1); }
.logo-mark--hue-1 { --mark-bg: var(--chart-2); }
.logo-mark--hue-2 { --mark-bg: var(--chart-3); }
.logo-mark--hue-3 { --mark-bg: var(--chart-4); }
.logo-mark--hue-4 { --mark-bg: var(--chart-5); }
.logo-mark--hue-5 { --mark-bg: var(--brand-strong); }
:root[data-theme="dark"] .logo-mark--hue-5 { --mark-bg: var(--accent-text); }
.client-bar__brand .logo-mark { box-shadow: 0 0 0 1px var(--chrome-border); }
.band .logo-mark { box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
/* Overlapping people (team card) */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

/* ------------------------------------------------ client portal: menus, tab bar */
.client-bar__menu--grouped { grid-template-columns: repeat(2, minmax(200px, 1fr)); gap: var(--sp-2) var(--sp-3); min-width: 460px; }
.client-bar__group { display: grid; gap: 2px; align-content: start; }
/* More menu: three groups with a filter, glass surface, quick open. */
.client-bar__menu--mega {
    width: min(780px, calc(100vw - 24px));
    padding: var(--sp-3);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-2) var(--sp-3);
    border-radius: var(--r-lg);
    /* Solid: the sticky bar already blurs, and a nested backdrop blur would not, so a translucent menu lets the page show through. */
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 55%, var(--surface)), var(--surface) 72px);
    box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
    transform-origin: top right;
    animation: tc-menu-in var(--dur) var(--ease);
}
@keyframes tc-menu-in { from { opacity: 0; translate: 0 -6px; scale: .98; } to { opacity: 1; translate: 0 0; scale: 1; } }
@media (prefers-reduced-motion: reduce) { .client-bar__menu--mega { animation: none; } }
.client-bar__menu-head { grid-column: 1 / -1; padding: 0 0 var(--sp-2); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-1); }
.client-bar__menu-search { display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-3); border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-3); }
.client-bar__menu-search:focus-within { box-shadow: 0 0 0 2px var(--focus); color: var(--text-2); }
.client-bar__menu-search input { flex: 1; min-width: 0; height: 36px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-sm); outline: none; }
.client-bar__menu .client-bar__item { align-items: center; gap: var(--sp-3); padding: 7px var(--sp-2); border-radius: var(--r-md); transition: background var(--dur) var(--ease); }
.client-bar__menu .client-bar__item:hover, .client-bar__menu .client-bar__item:focus-visible, .client-bar__menu .client-bar__item.is-active { background: var(--surface-2); outline: none; }
.client-bar__menu .client-bar__item[aria-current="page"] { background: var(--accent-soft); }
.client-bar__item .icon-tile { width: 32px; height: 32px; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.client-bar__item .icon-tile svg { width: 16px; height: 16px; }
.client-bar__item:hover .icon-tile, .client-bar__item.is-active .icon-tile { background: var(--accent-soft); color: var(--accent-text); transform: translateY(-1px); }
.client-bar__item-text { display: grid; min-width: 0; line-height: 1.3; }
.client-bar__item-title { font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.client-bar__item[aria-current="page"] .client-bar__item-title { color: var(--accent-text); }
.client-bar__item-desc { font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-bar__menu-empty { grid-column: 1 / -1; margin: 0; padding: var(--sp-4); text-align: center; color: var(--text-3); font-size: var(--fs-sm); }
@media (max-width: 960px) {
    .client-bar__menu--mega { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.client-bar__group-label { padding: var(--sp-2) var(--sp-3) var(--sp-1); font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.nav-sheet__group + .nav-sheet__group { margin-top: var(--sp-4); }
.client-tabbar { display: none; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 200; }
@media (max-width: 760px) {
    .shell--client .client-bar__nav { display: none; }
    .shell--client .client-bar__row { flex-wrap: nowrap; }
    .shell--client .client-bar__actions .btn--ghost span { display: none; }
    .client-bar__menu--grouped { grid-template-columns: minmax(0, 1fr); min-width: 240px; }
    .client-tabbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px;
        padding: 6px var(--sp-2) calc(6px + env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--chrome-bg) 96%, transparent);
        backdrop-filter: saturate(1.4) blur(12px);
        border-top: 1px solid var(--chrome-border);
    }
    .client-tabbar__item {
        position: relative;
        display: flex; flex-direction: column; align-items: center; gap: 3px;
        padding: 6px 2px; border: 0; border-radius: var(--r-md);
        background: none; color: var(--chrome-text-2);
        font: inherit; font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer;
    }
    .client-tabbar__item svg { width: 20px; height: 20px; }
    .client-tabbar__item:hover { color: var(--chrome-text); }
    .client-tabbar__item[aria-current="page"] { background: var(--chrome-active-bg); color: var(--chrome-active-text); }
    .client-tabbar__badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill); background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
    .shell--client .page-foot { padding-bottom: calc(var(--sp-6) + 76px); }
    /* Admin phones get the same bottom bar (Today, CRM, Billing, Sites, Menu). */
    .shell--admin .page { padding-bottom: calc(var(--sp-10) + 70px); }
    .shell--admin.is-nav-open .admin-tabbar { display: none; }
    body:has(.admin-tabbar) .toasts, body:has(.admin-tabbar) .drawer, body:has(.client-tabbar) .fab { bottom: calc(var(--sp-5) + 70px); }
}

/* ---------------------------------------------------------- utilities */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.u-mt-0 { margin-top: 0; }
.u-mt-1 { margin-top: var(--sp-1); }
.u-mt-2 { margin-top: var(--sp-2); }
.u-mt-3 { margin-top: var(--sp-3); }
.u-mt-4 { margin-top: var(--sp-4); }
.u-mt-6 { margin-top: var(--sp-6); }
.u-mt-8 { margin-top: var(--sp-8); }
.u-mb-0 { margin-bottom: 0; }
.u-mb-2 { margin-bottom: var(--sp-2); }
.u-mb-3 { margin-bottom: var(--sp-3); }
.u-mb-4 { margin-bottom: var(--sp-4); }
.u-mb-6 { margin-bottom: var(--sp-6); }
.u-ml-auto { margin-left: auto; }
.u-w-full { width: 100%; }
.u-grow { flex: 1; min-width: 0; }
.u-shrink-0 { flex-shrink: 0; }
.u-hide-mobile { }
.u-show-mobile { display: none; }
@media (max-width: 760px) {
    .u-hide-mobile { display: none !important; }
    .u-show-mobile { display: revert; }
}

/* ---------------------------------------------------------- motion */
@keyframes tc-spin { to { transform: rotate(360deg); } }
@keyframes tc-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tc-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes tc-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes tc-wobble { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
.page > * { animation: tc-rise var(--dur-slow) var(--ease) both; }
.is-wobbling { animation: tc-wobble .5s var(--ease); }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------ print */
/* Every page prints as a document: branded header (Layout::printHead), light
   ink-friendly colours in every theme, no app chrome or buttons, rows and cards
   kept whole, table headers repeated, page numbers in the margin. Monthly
   reports print from the server-built PDF instead (core/report_pdf.php). */
.print-head { display: none; }
@page { size: letter; margin: 14mm 12mm 16mm; }
@page { @bottom-right { content: "Page " counter(page) " of " counter(pages); font-size: 8pt; color: #6f6f7c; } }
/* ------------------------------------------------------ files (drive) */
.drive-drop { position: relative; min-height: 220px; }
.drive-drop.is-drag-over::after {
    content: "Drop files to upload them here";
    position: absolute; inset: 0; z-index: 20;
    display: flex; align-items: center; justify-content: center;
    border: 2px dashed var(--accent); border-radius: var(--r-lg);
    background: var(--accent-soft); color: var(--accent-text);
    font-weight: 650; font-size: var(--fs-lg);
    pointer-events: none;
}
.drive-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); min-width: 0; font-size: var(--fs-md); }
.drive-crumbs a { color: var(--text-2); text-decoration: none; padding: 2px var(--sp-1); border-radius: var(--r-xs); }
.drive-crumbs a:hover { color: var(--text); background: var(--surface-2); }
.drive-crumbs [aria-current="page"] { color: var(--text); font-weight: 650; }
.drive-crumbs svg { width: 14px; height: 14px; color: var(--text-3); }
.drive-name { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.drive-name a { color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.drive-name a:hover { color: var(--accent-text); }
.drive-name__thumb { width: 36px; height: 36px; border-radius: var(--r-md); object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0; }
.drive-tile { display: grid; gap: var(--sp-2); padding: var(--sp-3); color: var(--text); text-decoration: none; min-width: 0; }
.drive-tile__media { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border-radius: var(--r-md); background: var(--surface-2); color: var(--text-3); overflow: hidden; }
.drive-tile__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drive-tile__media svg { width: 30px; height: 30px; }
.drive-tile__name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-preview { display: flex; align-items: center; justify-content: center; min-height: 240px; border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; }
.drive-preview img, .drive-preview video { display: block; max-width: 100%; max-height: 70vh; }
.drive-preview iframe { display: block; width: 100%; height: 70vh; border: 0; background: var(--surface); }
.drive-preview audio { width: 100%; margin: var(--sp-6); }
.drive-preview pre { width: 100%; max-height: 70vh; margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); }
.drive-uploads { position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: 70; width: min(380px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.drive-uploads__body { max-height: 320px; overflow-y: auto; padding: var(--sp-2) var(--sp-4) var(--sp-4); display: grid; gap: var(--sp-3); }
.drive-uploads__row { display: grid; gap: var(--sp-1); font-size: var(--fs-sm); min-width: 0; }
.drive-bulk { position: sticky; bottom: var(--sp-4); z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-pill); box-shadow: var(--shadow-md); }
@media (max-width: 640px) {
    .drive-bulk { border-radius: var(--r-lg); }
}

@media print {
    :root, :root[data-theme] {
        --bg: #fff; --bg-alt: #fff; --surface: #fff; --surface-2: #f6f6f8; --surface-3: #eeeef2;
        --border: #dcdce2; --border-strong: #c9c9d2; --text: #111317; --text-2: #3a3a44; --text-3: #5f5f6b;
        --accent: #7625d5; --accent-text: #5f1bb0; --accent-soft: #f2eafd; --on-accent: #fff;
        --success: #11815a; --success-soft: #e6f5ee; --warning: #a65f00; --warning-soft: #fdf2df;
        --danger: #c42b3c; --danger-soft: #fce9eb; --info: #1f63c7; --info-soft: #e7effb;
        --chart-grid: #ececf0; --shadow-sm: none; --shadow-md: none; --shadow-lg: none;
        color-scheme: light;
    }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    html, body { background: #fff !important; font-size: 10.5pt; }
    .sidebar, .topbar, .client-bar, .client-tabbar, .admin-preview-bar, .page-head__actions, .page-foot, .fab, .drawer, .toasts,
    .no-print, .skip-link, .popover, dialog, .scrim, .btn, .btn-row, .filter-bar, input[type="search"], .link-btn { display: none !important; }
    .shell--admin, .shell--client { display: block; }
    .main { display: block; }
    .page { padding: 0; max-width: none; margin: 0; }
    .page > * { animation: none !important; }

    .print-head { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid #111317; }
    .print-head__main { flex: 1; min-width: 0; }
    .print-head__name { font-size: 14pt; font-weight: 700; letter-spacing: -.02em; color: #111317; }
    .print-head__meta { font-size: 8.5pt; color: #5f5f6b; }
    .print-head__by { font-size: 8.5pt; color: #5f5f6b; text-align: right; }
    .page-head { margin-bottom: 14px; }
    .page-head .eyebrow { display: none; }
    .page-head__title { font-size: 20pt; }
    .page-head__desc { font-size: 10pt; }

    /* The dark feature band prints as a light, bordered panel. */
    .band { --text: #111317; --text-2: #3a3a44; --text-3: #5f5f6b; --accent-text: #5f1bb0; --accent-soft: #f2eafd; --surface: #fff; --surface-2: #f6f6f8; --border: #dcdce2;
        background: #fff; color: #111317; border: 1px solid #dcdce2; padding: 16px; }
    .band__headline { font-size: 17pt; max-width: none; }
    .band__highlight { color: var(--accent-text); }

    .card, .kpi, .band, .alert, .list__item, .board__card, .steps__item, .bar-list__row, .chart, tr { break-inside: avoid; page-break-inside: avoid; }
    .card { box-shadow: none; border-color: #dcdce2; }
    h1, h2, h3, .card__head, .section__head { break-after: avoid; page-break-after: avoid; }
    .grid--2, .split { grid-template-columns: 1fr 1fr; }
    .grid--3, .grid--4 { grid-template-columns: repeat(3, 1fr); }
    .kpis { grid-template-columns: repeat(4, 1fr); }
    .chart canvas { max-width: 100% !important; height: auto !important; }

    .table-wrap { overflow: visible !important; border: 0; }
    .table { font-size: 9pt; }
    .table thead { display: table-header-group; }
    .table th { position: static; background: #f6f6f8 !important; }
    .table th[aria-sort]::after { content: none; }

    a { color: inherit; text-decoration: none; }
    details:not([open]) > :not(summary) { display: none; }
    .logo-mark { box-shadow: inset 0 0 0 1px #dcdce2; }
}

