/* Call Calibrations - Design System */

/* Indigo & Glass - see docs/design-language.md, which this file implements. Since CP-321 it is
   the only skin: Olive & Cream and the skin selector were removed at the project owner's
   direction. The eight canonical tokens (--color-bg, -bg-subtle, -surface, -text, -text-muted,
   -accent, -accent-hover, -border) are the portable contract; everything else is an extension
   a data tool needs (status feedback, chart categoricals, sidebar, top bar).

   Two palettes and a three-way switch in the sidebar footer (CC95): System, Light, Dark. :root
   is light; the prefers-color-scheme block below follows the operating system unless the
   reader chose Light (data-theme="light" on <html>), and a copy of it under
   :root[data-theme="dark"] applies Dark on a light OS. The dark blocks carry only the tokens
   whose value differs from light. `color-scheme` keeps browser-drawn widgets - scrollbars, select popups, the range
   thumb - in step with the page.

   These values are exactly what the Indigo skin rendered before CP-321, flattened: the old file
   layered Indigo over the Olive base, so a token Indigo did not set fell through to Olive's -
   those fall-through values are kept here as they were. Two values are deliberately NOT the
   Indigo source document's: its --text-muted (#9ca3af) is 2.5:1 on white and its border
   (#e5e7eb) 1.2:1, both darkened for a table read all day. */
:root {
    color-scheme: light;
    --color-bg: #f4f6f9;
    --color-bg-subtle: #edf0f5;
    --color-surface: #ffffff;
    --color-text: #1e1e2e;
    --color-text-muted: #5f6675;
    --color-accent: #4f46e5;
    --color-accent-hover: #4338ca;
    --color-border: #d6dae2;
    --color-accent-text: #4338ca;
    --color-accent-fill: #4f46e5;
    --color-text-secondary: #454b5c;
    /* Unlike Olive & Cream, on-accent text here IS white: indigo is dark enough to carry it
       at 6.29:1, where the olive accent gave 2.85:1 and the rule had to be "never white". */
    --color-on-accent: #ffffff;
    --color-accent-soft: rgba(79, 70, 229, 0.08);
    --color-accent-ring: rgba(79, 70, 229, 0.16);
    --accent-success: #059669;
    --accent-success-bg: rgba(5, 150, 105, 0.12);
    --on-success: #046c50;
    --accent-warning: #d97706;
    --accent-warning-bg: rgba(217, 119, 6, 0.12);
    --on-warning: #8a5308;
    --accent-danger: #e11d48;
    --accent-danger-bg: rgba(225, 29, 72, 0.10);
    --on-danger: #be1739;
    --accent-info: #3b82f6;
    --accent-info-bg: rgba(59, 130, 246, 0.12);
    --on-info: #1858b2;
    --accent-neutral-bg: rgba(107, 114, 128, 0.18);
    --accent-purple: rgba(124, 58, 237, 0.12);
    --on-purple: #6d28d9;
    --accent-magenta: rgba(219, 39, 119, 0.12);
    --on-magenta: #be185d;
    --accent-nonbooking-bg: rgba(194, 65, 12, 0.12);
    --on-nonbooking: #a13a10;
    --color-danger: #be1739;
    --color-danger-hover: #9f1233;
    /* The source document's own brand pair - indigo and cyan - carries the two-way
       booking/non-booking split the single accent cannot express. */
    --chart-surface: #ffffff;
    --chart-booking: #4f46e5;
    --chart-nonbooking: #0891b2;
    --chart-done: #4f46e5;
    --chart-remaining: #cbd2dd;
    --chart-cat-1: #4f46e5;
    --chart-cat-2: #0891b2;
    --chart-cat-3: #7c3aed;
    --chart-cat-4: #d97706;
    --chart-cat-5: #059669;
    --chart-cat-6: #64748b;
    /* CP-239 auditor redesign tokens */
    --accent-cyan: #0891b2;
    --accent-cyan-bg: rgba(8, 145, 178, 0.10);
    --color-backdrop: rgba(18, 18, 27, 0.55);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.18);
    --pulse-success: rgba(5, 150, 105, 0.5);
    --pulse-warning: rgba(217, 119, 6, 0.5);
    --color-on-danger: #ffffff;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-xs: 6px;
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 12px rgba(0, 0, 0, 0.06);
    --font-weight-strong: 700;
    /* The chrome - sidebar and top bar - follows the mode (CC95): white panels with indigo for
       the current page in light, the original dark panel and gradient bar in dark (the dark
       blocks below). Until CP-349 it was dark in both modes, per docs/design-language.md §11. */
    --sidebar-bg: #ffffff;
    --sidebar-border: #d6dae2;
    --sidebar-brand-bg: linear-gradient(180deg, rgba(79, 70, 229, 0.06) 0%, transparent 100%);
    --sidebar-text: #454b5c;
    --sidebar-text-strong: #1e1e2e;
    --sidebar-text-muted: #5f6675;
    --sidebar-hover-bg: rgba(79, 70, 229, 0.06);
    --sidebar-active-bg: rgba(79, 70, 229, 0.10);
    --sidebar-active-text: #4338ca;
    --sidebar-active-border: #4f46e5;
    /* A chip (Beta, Read-only) on the sidebar or the top bar. Its own tokens because the chrome
       and the page are painted separately (CC95). */
    --chrome-chip-bg: rgba(124, 58, 237, 0.10);
    --chrome-chip-border: rgba(109, 40, 217, 0.25);
    --chrome-chip-text: #6d28d9;
    /* Scrollbars (CC95): a thumb a step darker than the border on a transparent track. */
    --scrollbar-thumb: #c4cad6;
    --scrollbar-thumb-hover: #9aa2b4;
    --sidebar-scrollbar-thumb: #c4cad6;
    --sidebar-scrollbar-thumb-hover: #9aa2b4;
    --brand-icon-bg: linear-gradient(135deg, #4f46e5, #0891b2);
    --brand-icon-border: transparent;
    --brand-icon-text: #ffffff;
    --brand-icon-hover-bg: linear-gradient(135deg, #4338ca, #0e7490);
    --brand-icon-hover-text: #ffffff;
    --brand-text-color: #1e1e2e;
    --topbar-bg: rgba(255, 255, 255, 0.88);
    --topbar-border: #d6dae2;
    --topbar-text: #1e1e2e;
    --topbar-btn-bg: #ffffff;
    --topbar-btn-border: #d6dae2;
    --topbar-btn-text: #1e1e2e;
    --topbar-btn-hover-border: #4f46e5;
    --topbar-btn-active-border: #4f46e5;
    --topbar-btn-active-text: #4338ca;
    --sidebar-chip-bg: #f4f6f9;
    --sidebar-chip-border: #d6dae2;
    --sidebar-chip-text: #1e1e2e;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --color-bg: #12121b;
        --color-bg-subtle: #1a1a27;
        --color-surface: #20202e;
        --color-text: #e9eaf2;
        --color-text-muted: #a2a8bd;
        --color-accent: #8b85f0;
        --color-accent-hover: #a5a0f5;
        --color-border: #33334a;
        --color-accent-text: #a5a0f5;
        --color-accent-fill: #8b85f0;
        --color-text-secondary: #c3c7d6;
        --color-on-accent: #12121b;
        --color-accent-soft: rgba(139, 133, 240, 0.12);
        --color-accent-ring: rgba(139, 133, 240, 0.2);
        --accent-success: #34d399;
        --accent-success-bg: rgba(52, 211, 153, 0.16);
        --on-success: #5ec99a;
        --accent-warning: #fbbf24;
        --accent-warning-bg: rgba(251, 191, 36, 0.16);
        --on-warning: #e6b566;
        --accent-danger: #fb7185;
        --accent-danger-bg: rgba(251, 113, 133, 0.16);
        --on-danger: #f0928a;
        --accent-info: #60a5fa;
        --accent-info-bg: rgba(96, 165, 250, 0.16);
        --on-info: #8ab4f8;
        --accent-neutral-bg: rgba(139, 147, 168, 0.2);
        --accent-purple: rgba(167, 139, 250, 0.16);
        --on-purple: #c4a9f0;
        --accent-magenta: rgba(244, 114, 182, 0.16);
        --on-magenta: #f9a8d4;
        --accent-nonbooking-bg: rgba(251, 146, 60, 0.16);
        --on-nonbooking: #f0a279;
        --chart-surface: #20202e;
        --chart-booking: #8b85f0;
        --chart-nonbooking: #38bdf8;
        --chart-done: #8b85f0;
        --chart-remaining: #4a4a63;
        --chart-cat-1: #8b85f0;
        --chart-cat-2: #38bdf8;
        --chart-cat-3: #c4a9f0;
        --chart-cat-4: #fbbf24;
        --chart-cat-5: #34d399;
        --chart-cat-6: #94a3b8;
        /* CP-239 auditor redesign tokens */
        --accent-cyan: #38bdf8;
        --accent-cyan-bg: rgba(56, 189, 248, 0.12);
        --color-backdrop: rgba(0, 0, 0, 0.62);
        --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
        --pulse-success: rgba(52, 211, 153, 0.5);
        --pulse-warning: rgba(251, 191, 36, 0.5);
        /* The dark chrome (CC95): the dark panel and gradient bar the app had in both modes. */
        --sidebar-border: rgba(255, 255, 255, 0.08);
        --sidebar-text: #cbd5e1;
        --sidebar-text-strong: #ffffff;
        --sidebar-text-muted: #9aa3b8;
        --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
        --sidebar-active-bg: rgba(79, 70, 229, 0.32);
        --sidebar-active-text: #ffffff;
        --sidebar-active-border: #8b85f0;
        --chrome-chip-bg: rgba(167, 139, 250, 0.22);
        --chrome-chip-border: rgba(255, 255, 255, 0.28);
        --chrome-chip-text: #ffffff;
        --sidebar-scrollbar-thumb: rgba(255, 255, 255, 0.14);
        --sidebar-scrollbar-thumb-hover: rgba(255, 255, 255, 0.26);
        --brand-text-color: #ffffff;
        --topbar-border: rgba(255, 255, 255, 0.10);
        --topbar-text: #ffffff;
        --topbar-btn-bg: rgba(255, 255, 255, 0.12);
        --topbar-btn-border: rgba(255, 255, 255, 0.30);
        --topbar-btn-text: #ffffff;
        --topbar-btn-hover-border: rgba(255, 255, 255, 0.55);
        --topbar-btn-active-border: rgba(255, 255, 255, 0.70);
        --topbar-btn-active-text: #ffffff;
        --sidebar-chip-bg: rgba(255, 255, 255, 0.08);
        --sidebar-chip-border: rgba(255, 255, 255, 0.18);
        --sidebar-chip-text: #e2e6f0;
        --sidebar-bg: #171725;
        --sidebar-brand-bg: linear-gradient(180deg, rgba(139, 133, 240, 0.14) 0%, transparent 100%);
        --topbar-bg: linear-gradient(135deg, #14141f 0%, #232145 50%, #3b34b8 100%);
        --scrollbar-thumb: #3a3a55;
        --scrollbar-thumb-hover: #55557a;
    }
}

/* The same dark palette for someone who chose Dark in the sidebar on a light OS (CC95). KEEP IN
   STEP WITH THE BLOCK ABOVE: a token added to one and not the other leaves that mode wrong. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --color-bg: #12121b;
    --color-bg-subtle: #1a1a27;
    --color-surface: #20202e;
    --color-text: #e9eaf2;
    --color-text-muted: #a2a8bd;
    --color-accent: #8b85f0;
    --color-accent-hover: #a5a0f5;
    --color-border: #33334a;
    --color-accent-text: #a5a0f5;
    --color-accent-fill: #8b85f0;
    --color-text-secondary: #c3c7d6;
    --color-on-accent: #12121b;
    --color-accent-soft: rgba(139, 133, 240, 0.12);
    --color-accent-ring: rgba(139, 133, 240, 0.2);
    --accent-success: #34d399;
    --accent-success-bg: rgba(52, 211, 153, 0.16);
    --on-success: #5ec99a;
    --accent-warning: #fbbf24;
    --accent-warning-bg: rgba(251, 191, 36, 0.16);
    --on-warning: #e6b566;
    --accent-danger: #fb7185;
    --accent-danger-bg: rgba(251, 113, 133, 0.16);
    --on-danger: #f0928a;
    --accent-info: #60a5fa;
    --accent-info-bg: rgba(96, 165, 250, 0.16);
    --on-info: #8ab4f8;
    --accent-neutral-bg: rgba(139, 147, 168, 0.2);
    --accent-purple: rgba(167, 139, 250, 0.16);
    --on-purple: #c4a9f0;
    --accent-magenta: rgba(244, 114, 182, 0.16);
    --on-magenta: #f9a8d4;
    --accent-nonbooking-bg: rgba(251, 146, 60, 0.16);
    --on-nonbooking: #f0a279;
    --chart-surface: #20202e;
    --chart-booking: #8b85f0;
    --chart-nonbooking: #38bdf8;
    --chart-done: #8b85f0;
    --chart-remaining: #4a4a63;
    --chart-cat-1: #8b85f0;
    --chart-cat-2: #38bdf8;
    --chart-cat-3: #c4a9f0;
    --chart-cat-4: #fbbf24;
    --chart-cat-5: #34d399;
    --chart-cat-6: #94a3b8;
    /* CP-239 auditor redesign tokens */
    --accent-cyan: #38bdf8;
    --accent-cyan-bg: rgba(56, 189, 248, 0.12);
    --color-backdrop: rgba(0, 0, 0, 0.62);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
    --pulse-success: rgba(52, 211, 153, 0.5);
    --pulse-warning: rgba(251, 191, 36, 0.5);
    /* The dark chrome (CC95): the dark panel and gradient bar the app had in both modes. */
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: #cbd5e1;
    --sidebar-text-strong: #ffffff;
    --sidebar-text-muted: #9aa3b8;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(79, 70, 229, 0.32);
    --sidebar-active-text: #ffffff;
    --sidebar-active-border: #8b85f0;
    --chrome-chip-bg: rgba(167, 139, 250, 0.22);
    --chrome-chip-border: rgba(255, 255, 255, 0.28);
    --chrome-chip-text: #ffffff;
    --sidebar-scrollbar-thumb: rgba(255, 255, 255, 0.14);
    --sidebar-scrollbar-thumb-hover: rgba(255, 255, 255, 0.26);
    --brand-text-color: #ffffff;
    --topbar-border: rgba(255, 255, 255, 0.10);
    --topbar-text: #ffffff;
    --topbar-btn-bg: rgba(255, 255, 255, 0.12);
    --topbar-btn-border: rgba(255, 255, 255, 0.30);
    --topbar-btn-text: #ffffff;
    --topbar-btn-hover-border: rgba(255, 255, 255, 0.55);
    --topbar-btn-active-border: rgba(255, 255, 255, 0.70);
    --topbar-btn-active-text: #ffffff;
    --sidebar-chip-bg: rgba(255, 255, 255, 0.08);
    --sidebar-chip-border: rgba(255, 255, 255, 0.18);
    --sidebar-chip-text: #e2e6f0;
    --sidebar-bg: #171725;
    --sidebar-brand-bg: linear-gradient(180deg, rgba(139, 133, 240, 0.14) 0%, transparent 100%);
    --topbar-bg: linear-gradient(135deg, #14141f 0%, #232145 50%, #3b34b8 100%);
    --scrollbar-thumb: #3a3a55;
    --scrollbar-thumb-hover: #55557a;
}

/* Focus is global, never per-component. outline: none on inputs is only acceptable
   because the accent border plus this rule still render a visible focus state. */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
    border-radius: 3px;
}

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

html { font-size: 14px; }

code, pre, kbd, samp { font-family: var(--font-mono); }

/* Every outline icon in the app (about 140 inline SVGs across the templates and app.js) gets
   round caps and joins (CC95). Most were drawn without them, so their strokes ended square and
   their corners came to points - the dated look. CSS outranks the SVG's own presentation
   attributes, so this restyles them all without touching each one. */
svg[stroke="currentColor"] {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Scrollbars follow the palette (CC95) instead of the browser's grey, which ignored the indigo
   theme and showed as a pale stripe on the dark sidebar. Chromium and Safari take the
   ::-webkit-scrollbar rules: a thin rounded thumb on a transparent track. Chromium ignores those
   on any element that also sets the standard scrollbar-color, so the standard properties are
   given to Firefox alone. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    background-clip: padding-box;
    border: 2px solid transparent;
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-thumb-hover); }
.sidebar ::-webkit-scrollbar-thumb { background-color: var(--sidebar-scrollbar-thumb); }
.sidebar ::-webkit-scrollbar-thumb:hover { background-color: var(--sidebar-scrollbar-thumb-hover); }

@supports (-moz-appearance: none) {
    * { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }
    .sidebar, .sidebar * { scrollbar-color: var(--sidebar-scrollbar-thumb) transparent; }
}

/* Nav icons: fixed box so labels align whatever the glyph's width, and a touch of opacity that
   lifts to full on hover and on the current page. */
.nav-icon {
    flex: none;
    opacity: 0.85;
    transition: opacity var(--transition), transform var(--transition);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

/* Exactly the top bar's height (CC95), so the brand's bottom rule and the bar's continue as one
   line across the page. Padding alone made it 77px against the bar's 64px. */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-height);
    flex-shrink: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--sidebar-border);
    background: var(--sidebar-brand-bg);
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--brand-icon-border);
    background: var(--brand-icon-bg);
    color: var(--brand-icon-text);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* The design language's brand mark inverts to an accent fill on hover. */
.sidebar-brand:hover .brand-icon,
.login-brand:hover .brand-icon {
    background: var(--brand-icon-hover-bg);
    color: var(--brand-icon-hover-text);
}

.brand-text {
    font-weight: var(--font-weight-strong);
    font-size: 1.1rem;
    color: var(--brand-text-color);
}

.sidebar-nav {
    padding: 12px 10px;
    flex: 1;
    /* min-height: 0 lets a flex child shrink below its content so the overflow scrolls
       here, leaving the brand and footer pinned; without it the admin's longer list is clipped. */
    min-height: 0;
    overflow-y: auto;
}

.sidebar-nav-list {
    list-style: none;
}

/* One heading per role group (docs/prd.md, CP-175) - a group is only printed when it has at
   least one item the current session's role can reach, so this never sits over an empty list. */
.sidebar-nav-group {
    margin-bottom: 18px;
}

.sidebar-nav-group:last-child {
    margin-bottom: 0;
}

.sidebar-nav-heading {
    padding: 4px 14px 6px;
    font-size: 0.72rem;
    font-weight: var(--font-weight-strong);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sidebar-text-muted);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-strong);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

/* 10px sides, the same gutter as .sidebar-nav, so the footer buttons line up with the nav
   items above them (CC95). */
.sidebar-footer {
    padding: 12px 10px 14px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

/* A button in the footer stack, so it fills the column rather than shrinking to its label
   the way it did inline in the top bar. */
.sidebar-footer .logout-form .btn {
    width: 100%;
    justify-content: flex-start;
}

/* Same argument as .top-bar .btn-secondary: these read against the sidebar, which a skin
   may paint independently of the page. */
.sidebar-footer .btn-secondary,
.sidebar-footer .user-chip {
    background: var(--sidebar-chip-bg);
    border-color: var(--sidebar-chip-border);
    color: var(--sidebar-chip-text);
}

.sidebar-footer .btn-secondary:hover {
    border-color: var(--color-accent);
}

/* Colour theme toggle (CC95): Light and Dark, two halves of one control on the sidebar's own
   tokens. The active half takes the active-nav fill. */
.toggle.theme-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--sidebar-chip-border);
    border-radius: var(--radius-sm);
    background: var(--sidebar-chip-bg);
}

.theme-toggle .toggle-opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-sm) - 2px);
    background: transparent;
    color: var(--sidebar-text);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

.theme-toggle .toggle-opt svg {
    flex: none;
}

.theme-toggle .toggle-opt:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-strong);
}

.theme-toggle .toggle-opt.active {
    background: var(--sidebar-active-bg);
    border-color: var(--sidebar-active-border);
    color: var(--sidebar-active-text);
}

.sidebar-footer .version-tag {
    padding-left: 2px;
}

.version-tag {
    font-size: 0.75rem;
    color: var(--sidebar-text-muted);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    /* A flex item's min-width defaults to auto, so this one refused to shrink below its
       min-content width (1400px, the cap on .content-area) and pushed the whole page
       240px past the viewport - the page-level horizontal scrollbar. Wide content now
       scrolls inside .table-wrap, which is what that overflow-x: auto was always for. */
    min-width: 0;
    min-height: 100vh;
}

/* Manual Calibration's bare layout (templates/layout.php's `bare` flag) drops the
   sidebar entirely, so the content column no longer needs to leave its width
   reserved - the same rule the narrow-viewport breakpoint already applies to
   .sidebar's display:none below, just triggered by the flag instead of a media query. */
.main-content-bare {
    margin-left: 0;
}

.top-bar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 32px;
    border-bottom: 1px solid var(--topbar-border);
    background: var(--topbar-bg);
    color: var(--topbar-text);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.page-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: var(--font-weight-strong);
}

/* The top bar's own buttons read against the bar, not the page - a skin that paints the bar
   dark over a light page (Indigo & Glass) would otherwise leave them light-on-light. */
.top-bar .btn-secondary {
    background: var(--topbar-btn-bg);
    border-color: var(--topbar-btn-border);
    color: var(--topbar-btn-text);
}

.top-bar .btn-secondary:hover {
    background: var(--topbar-btn-bg);
    border-color: var(--topbar-btn-hover-border);
}

/* The design language's single container, every page, no exceptions - but widened from its
   64rem to 100rem in CP-22, at the project owner's direction. 64rem left roughly 760px of a 1900px
   screen unused while the booking verdict's seven-column table scrolled sideways inside a
   798px well. The one-container rule is what matters and is kept; the width is this app's
   documented deviation from it (docs/prd.md CC31), because it is a data tool whose widest
   tables are the point of the page. */
.content-area {
    max-width: 100rem;
    margin: 0 auto;
    padding: 40px 24px 64px;
}

.content-area.content-area-fluid {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 24px 32px 64px !important;
    box-sizing: border-box !important;
}

/* Widening the container must not widen the prose with it - a 1400px line is unreadable.
   Explanatory copy keeps a normal measure while tables and charts take the full width. */
.card-note,
.card-help > summary,
.card-help p {
    max-width: 80ch;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pending-icon { background: var(--accent-warning-bg); color: var(--accent-warning); }
.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: var(--font-weight-strong);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

/* Section Cards */
.section-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.section-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--color-border);
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* "01 / Pull a Sample" - the eyebrow carries the number and the slash, the heading stays a
   plain-weight title beside it. */
.section-number {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.section-number::after { content: ' /'; }

/* The ⓘ beside a heading and the explanation it opens (CP-25). An explanation that is always
   on screen is read once and then becomes something to scroll past, so it is one button per
   section instead - the heading says what the section is, the button says why. Sized to the
   text beside it rather than as a .btn: it is punctuation on a heading, not an action. */
.info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.info-btn:hover { color: var(--color-accent-text); }

/* The ⓘ on a stat tile (CP-51): every statistic ships with how it is obtained, and the button
   sits inside the uppercase label line rather than beside a heading - so it aligns to the text
   baseline instead of flexing, and tightens up to the label's small type. No colour of its own:
   it inherits .info-btn's, so it cannot break a skin. */
.stat-label .info-btn {
    vertical-align: -3px;
    margin-left: 2px;
    padding: 1px;
}

/* The explanation itself is never drawn where it is written. .info-panel is a store: the
   markup sits beside the section it explains so the two cannot drift apart, and is copied
   into the modal on open. The first version expanded it in place, which pushed everything
   below it down the page - reading the explanation cost you your place in the form. */
.info-panel { display: none; }

.info-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--color-bg);
    opacity: 0.55;
}

.info-modal {
    position: fixed;
    z-index: 201;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(36rem, calc(100vw - 32px));
    max-height: min(80vh, 44rem);
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.info-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.info-modal-header h2 { font-size: 1.05rem; font-weight: 600; }
.info-modal-close { padding: 6px 8px; }

.info-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--color-text-muted);
}

.info-modal-body p { margin: 0 0 12px; }
.info-modal-body p:last-child { margin-bottom: 0; }
/* A resolved filesystem path is wider than this dialog, and must break anywhere rather than
   push it sideways - the modal has no horizontal scroll and should not grow one. */
.info-modal-body code { overflow-wrap: anywhere; }
.info-modal-body dl { margin: 0 0 12px; }
.info-modal-body dl:last-child { margin-bottom: 0; }
.info-modal-body dt { font-weight: 600; color: var(--color-text); margin-bottom: 2px; }
.info-modal-body dd { margin: 0 0 12px; }
.info-modal-body dd:last-child { margin-bottom: 0; }

/* The rule scope selector (CP-28). A modal rather than a dropdown because the choice is made
   from a table - a rule's name alone does not say whether it is the one holding the calls you
   want, so the dates and the call count have to be on screen while you choose. Wider than
   .info-modal for the same reason, and it is the only modal here that scrolls a table. */
/* Open state is the border only. --color-accent-text on this label measures 4.49:1 against
   the surface at 11.2px - a hair under AA, and bin/contrast_audit.mjs fails it. The border
   carries the state anyway. */
.scope-toggle[aria-expanded="true"] {
    border-color: var(--topbar-btn-active-border);
}

.scope-toggle-label {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The class filter's own dropdown (CC67). Anchored to its button rather than being a second
   modal: it has three fixed states and no Apply step, so a dialog would be heavier than the
   choice. Colour and depth from tokens only - a 1px border, never a shadow. */
.scope-menu-wrap {
    position: relative;
}

.scope-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 210;
    min-width: 15rem;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.scope-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 9px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--color-text);
    font: inherit;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}

.scope-menu-item:hover { background: var(--color-bg-subtle); }
.scope-menu-item[aria-checked="true"] { font-weight: var(--font-weight-strong); }

.scope-menu-tick {
    width: 1em;
    color: var(--color-accent-text);
}

.scope-menu-note {
    margin: 4px 4px 2px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.scope-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--color-bg);
    opacity: 0.55;
}

.scope-modal {
    position: fixed;
    z-index: 201;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    -webkit-font-smoothing: antialiased;
    backface-visibility: hidden;
    isolation: isolate;
    width: min(76rem, calc(100vw - 32px));
    max-height: min(84vh, 46rem);
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.scope-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.scope-modal-header h2 { font-size: 1.3rem; font-weight: 600; }
.scope-modal-close { padding: 6px 8px; }

/* The collapsible explanation at the top of the scope picker (CC67) reuses .card-help, which
   has no side padding of its own because it normally sits inside a padded .section-card - this
   modal isn't one, so the padding is added here instead. */
.scope-modal .card-help {
    padding: 14px 20px 0;
    max-width: 80ch;
}

/* The kind tabs in the scope picker (Calibrations / Operations / All). LAYOUT ONLY - the
   buttons are the shared .btn classes, active is .btn-primary and the rest .btn-secondary,
   exactly the .bucket-selector pattern, so no colour literal lives here and all four
   skin/theme combinations follow. */
.scope-kind {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 0;
}

.scope-kind-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.scope-kind-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.scope-modal-body {
    padding: 14px 20px;
    overflow: auto;
}

.scope-table { font-size: 0.95rem; }
.scope-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.scope-table .scope-col-check { width: 2.75rem; }
.scope-table tbody tr { cursor: default; }

/* Matches the row-selection checkbox styling used in the Calls page table (.cell-select /
   .cell-select-hit) so ticking a fetch here looks and behaves the same. */
.scope-table .cell-select-hit { min-width: 36px; height: 36px; }

.scope-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.scope-count {
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

.scope-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Buttons inside the modal read small next to the larger body text above, so they get their
   own bump rather than inheriting .btn-sm's 0.8rem. */
.scope-modal .btn-sm {
    font-size: 0.9rem;
    padding: 7px 16px;
}

/* The count beside a list heading - "Your Rules 3" - so the heading carries the number instead
   of a sentence underneath it saying how many there are. */
.section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--accent-neutral-bg);
    color: var(--color-text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
}

/* A heading that carries a count and an ⓘ is a row, and .section-header aligns on the
   baseline, which would leave both sitting low against the cap height of the text. */
.section-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* A whole .section-card that folds (CP-25): /rules leads with the rules themselves, and the
   New Rule form is a card you open rather than a form permanently pushing them down the page.
   The summary keeps the .section-header treatment so a closed card reads as a card heading,
   not as a stray link. list-style has to be cleared on both selectors - Safari uses
   ::-webkit-details-marker and ignores the standard one. */
.section-card-details > summary {
    cursor: pointer;
    list-style: none;
}

.section-card-details > summary::-webkit-details-marker { display: none; }
.section-card-details:not([open]) > summary { border-bottom: none; }
.section-card-details > summary:hover h2 { color: var(--color-accent-text); }

.section-card-details > summary h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* .section-card has no padding of its own - every gutter on the page comes from a child
   (.section-header, .upload-form). A bare child therefore sits flush against the card's
   edge; these two are the shared way to give one the same gutter as the rest of the card,
   rather than an inline style per paragraph. */
.card-body { padding: 20px 24px; }

.card-note {
    padding: 16px 24px 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.card-note:last-child { padding-bottom: 18px; }

/* Inside a container that already supplies the gutter, the note only needs its type styling. */
.upload-form > .card-note,
.card-body > .card-note { padding-left: 0; padding-right: 0; }

/* The "why this step exists" prose that used to sit between a card's heading and its controls
   (CP-22). Folded by default: a returning reviewer came for the buttons, and the explanation
   is what a new one needs once. Same gutter as .card-note so the two line up when both show. */
.card-help {
    padding: 8px 24px 0;
    font-size: 0.85rem;
}

.card-help:last-child { padding-bottom: 18px; }

.card-body > .card-help { padding-left: 0; padding-right: 0; }

/* A stat tile that names a person/thing already confirmed done - "operator assessed" on a
   sitting's completion page, "reviewer" on the queue-based one. Shared rather than
   duplicated per page since both are the same "here's who, and it's settled" statement. */
.tick-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}
.tick-stat-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-success);
    color: var(--color-on-accent);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.card-help > summary {
    cursor: pointer;
    list-style: none;
    color: var(--color-text-muted);
    font-weight: 500;
    padding: 4px 0;
}

.card-help > summary::-webkit-details-marker { display: none; }
.card-help > summary::before { content: '\25B8\00a0'; }
.card-help[open] > summary::before { content: '\25BE\00a0'; }
.card-help > summary:hover { color: var(--color-text); }

.card-help p {
    margin-top: 10px;
    color: var(--color-text-muted);
    line-height: 1.65;
}

.section-header-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-select {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    color: var(--color-text);
    padding: 8px 12px;
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
}

.filter-select:focus { border-color: var(--color-accent); }

/* Sub-navigation within one sidebar section (CP-22: the transcription pipeline's five steps).
   Depth is the shared 1px border, per docs/design-language.md - the active tab is marked by
   an accent underline sitting on that border, not by a shadow or a filled pill. */
.page-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}

.page-tab {
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.page-tab:hover {
    color: var(--color-text);
    background: var(--color-bg-subtle);
}

.page-tab.active {
    color: var(--color-accent-text);
    border-bottom-color: var(--color-accent);
}

/* A sub-strip of tabs INSIDE a card (CP-88, the Import tab's two input methods). Drawn
   lighter than .page-tabs because it is a choice within one page, not a peer of the page tabs
   above it - at the same weight it reads as another pipeline stage. No colour literals: it
   reuses .page-tab entirely and only changes spacing and the rule under it. */
.page-tabs-sub {
    margin-bottom: 16px;
    gap: 2px;
}

.page-tabs-sub .page-tab {
    padding: 7px 12px;
    font-size: 0.85rem;
}

/* Call Calibration Section view tabs (CP-139) */
.calibration-tabs-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.calibration-view-tabs {
    border-bottom: none;
    margin-bottom: 0;
    display: flex;
    gap: 4px;
}

.calibration-tabs-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 4px;
}

.calibration-view-tabs .page-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: color 0.15s ease, border-color 0.15s ease;
}

.calibration-view-tabs .page-tab:hover {
    color: var(--color-text);
}

.calibration-view-tabs .page-tab.active {
    color: var(--color-accent-text);
    border-bottom-color: var(--color-accent);
    font-weight: 600;
}

/* A segmented button group standing in for a <select> (CP-88). Used for the import's pipeline
   depth: three options, all three worth seeing at once, and cumulative - an order a collapsed
   dropdown hides. The radio is the state and the <label> is the whole hit target, so it needs
   no JS at all and keeps keyboard and screen-reader behaviour for free.

   The 2px border is carried in EVERY state, the .appearance-option rule: growing one on
   selection would shift the row by 1px. Depth is a border and a background step, never a
   shadow, per docs/design-language.md. */
.choice {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    cursor: pointer;
    min-width: 140px;
}

.choice:hover {
    background: var(--color-bg-subtle);
}

.choice input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice:has(input:checked) {
    border-color: var(--color-accent);
    background: var(--color-bg-subtle);
}

/* The ring goes on the label, since the radio itself is visually hidden - without this the
   group is keyboard-navigable with no visible focus at all. */
.choice:has(input:focus-visible) {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Visually hidden, still read by screen readers and still labels its control. */
.sr-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Forms */
.upload-form {
    padding: 20px 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-row-inline { align-items: flex-end; }

/* A row of buttons is a row, not a grid: in .form-row each button lands in its own auto-fit
   column, so a group of two or three ends up spread across the width of the card. */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.form-row > .btn, .form-row-inline > .btn { justify-self: start; }
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label, .form-group > .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-text-muted);
    border-radius: var(--radius-xs);
    color: var(--color-text);
    padding: 10px 14px;
    font-family: var(--font);
    font-size: 0.9rem;
    transition: border-color var(--transition), background-position var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-accent);
}

.form-group input[type="file"] {
    padding: 8px;
}

/* Disabled state needs its own rule because appearance: none below strips out whatever native
   greying the browser would otherwise draw - without this a disabled select looks identical
   to an enabled one. Used by the Add Week modal's Run now / Schedule toggle (CC76-adjacent). */
.form-group input:disabled,
.form-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Every <select> under .form-group, site-wide. The browser's own chrome (system font, flat
   square edges, an arrow that doesn't follow the theme) was the one control that didn't
   match everything drawn around it. appearance: none strips it down to a plain box - same
   border/background/radius as a text input above - and the arrow is drawn with two gradient
   triangles rather than an SVG background-image, because an SVG's stroke colour is a literal
   baked into the data URI and can't track --color-text-muted across the four skin/theme
   combinations the way this can. Sizing is bumped a step above the input/textarea baseline -
   a dropdown is read before it's typed into, so it can afford to be the larger control on
   the form. */
.form-group select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 11px 2.5rem 11px 14px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
        linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 1.2rem) center,
        calc(100% - 0.95rem) center;
    background-size: 0.32rem 0.32rem, 0.32rem 0.32rem;
    background-repeat: no-repeat;
}

.form-group select:hover {
    border-color: var(--color-accent);
}

.form-group select:focus,
.form-group select:hover {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-accent) 50%),
        linear-gradient(135deg, var(--color-accent) 50%, transparent 50%);
}

.form-group select option {
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-xs);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--color-accent-fill);
    color: var(--color-on-accent);
}

.btn-primary:hover {
    background: var(--color-accent-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: var(--accent-success-bg);
    color: var(--on-success);
    border: 1px solid var(--accent-success);
    font-weight: 600;
}

.btn-success:hover {
    border-color: var(--on-success);
}

.btn-secondary {
    background: var(--color-bg-subtle);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-accent);
    background: var(--color-bg-subtle);
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: var(--color-danger-hover);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 3px 10px;
    font-size: 0.75rem;
    line-height: 1.3;
    border-radius: var(--radius-sm);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.badge-success { background: var(--accent-success-bg); color: var(--on-success); }
.badge-warning { background: var(--accent-warning-bg); color: var(--on-warning); }
.badge-danger { background: var(--accent-danger-bg); color: var(--on-danger); }

/* A full-width red notice at the top of a page (the Power BI issue banner, CP-205). Palette
   tokens only, like the badge above, so it follows every skin and theme; a 1px border rather
   than a shadow, per the design language. */
.banner-danger {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px 24px;
    background: var(--accent-danger-bg);
    border: 1px solid var(--accent-danger);
    border-radius: var(--radius);
    color: var(--on-danger);
    font-size: 0.9rem;
    font-weight: 600;
}
.badge-info { background: var(--accent-info-bg); color: var(--on-info); }
.badge-neutral { background: var(--accent-neutral-bg); color: var(--color-text-secondary); }
.badge-purple { background: var(--accent-purple); color: var(--on-purple); }
.badge-cyan { background: var(--accent-cyan-bg); color: var(--accent-cyan); }
.badge-unmatched { border: 1px dashed currentColor; }
.badge-magenta { background: var(--accent-magenta); color: var(--on-magenta); }

/* A calibration score (Result %, manual or AI) read at a glance in a table cell - the
   ordinary .badge is sized for a short status word, not a number someone is scanning a
   column of. Bigger text, no letter-spacing (it fights tabular-nums), and tabular-nums so
   the digits themselves line up column to column. Used by the Calls page's Manual/AI score
   cells (renderCallsScoreCell in app.js). */
.badge-score {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: none;
    padding: 4px 12px;
    font-variant-numeric: tabular-nums;
}

/* Beta Badge */
.badge-beta {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.1;
    background: var(--accent-purple);
    color: var(--on-purple);
    border: 1px solid rgba(109, 40, 217, 0.25);
    vertical-align: middle;
}

.nav-link .badge-beta {
    margin-left: auto;
    font-size: 0.58rem;
    padding: 1.5px 5px;
    line-height: 1;
}

.nav-link.active .badge-beta {
    border-color: currentColor;
}

.page-tab .badge-beta {
    margin-left: 6px;
    font-size: 0.58rem;
    padding: 1px 5px;
    line-height: 1;
}

.page-title .badge-beta {
    font-size: 0.65rem;
    padding: 2px 7px;
}

/* The chrome is painted separately from the page, so a chip on it takes the chrome's tokens. */
.sidebar .badge-beta,
.top-bar .badge-beta {
    background: var(--chrome-chip-bg);
    border-color: var(--chrome-chip-border);
    color: var(--chrome-chip-text);
}

#rerunModalTitle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#rerunModalTitle .badge-beta {
    font-size: 0.65rem;
    padding: 2px 7px;
}

/* Data Table */
.table-wrap { overflow-x: auto; }

/* The Calls page's Tags filter (CallBrowserService::tagOptions()) - a dropdown button and its
   checkbox panel, sitting in the header actions row to the left of the Filter calls button, with
   the chosen tags echoed as removable chips beside it. CP-148 briefly moved this inside the
   Filter calls modal as a <details> disclosure, because the modal body scrolls
   (.rerun-modal-dialog .modal-body { overflow-y: auto }) and would have clipped a floating
   panel; CP-149 moved it back to the header at the project owner's direction, where there is no
   scrolling ancestor, so the floating popover is safe again. */
.calls-tag-dropdown { position: relative; }

.calls-tag-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    min-width: 280px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px;
}

/* The AND/OR match-mode row sits above the checkbox list and never scrolls out of view with it
   (the panel scrolls as a whole, but this row is short enough to stay visible in practice; it is
   markup-static, unlike the checkbox list below it, so switching mode never rebuilds it). */
.calls-tag-mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--color-border);
}

.calls-tag-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.calls-tag-option:hover { background: var(--color-bg-subtle); }

/* A filter panel's own "nothing to pick yet" line (Select Week, when there is nothing to
   filter). text-muted reads as near-invisible here - a near-empty panel with one line of the
   quietest colour in the palette and nothing else on screen to anchor it against, unlike every
   other place text-muted is used, which sits beside normal-weight text or a populated table. */
.calls-tag-option-section {
    flex: 1;
    text-align: right;
    white-space: nowrap;
}

.calls-tag-option-count {
    min-width: 2em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.calls-tag-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.calls-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.calls-tag-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.55;
}

/* The whole point of the ⓘ-hover pattern here: an "x" on every chip all the time is clutter, but
   hiding it entirely defeats "quickly on hover" - so it's always present (and always reachable
   by keyboard focus) but only draws attention once a reader is actually pointed at the chip. */
.calls-tag-chip:hover .calls-tag-chip-remove,
.calls-tag-chip-remove:focus-visible {
    opacity: 1;
    background: rgba(0, 0, 0, 0.15);
}

/* Filter row above a table. Sits between the card body and the table, so it carries its own
   padding - .section-card has none of its own. */
.table-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding: 0 24px 16px;
    border-bottom: 1px solid var(--color-border);
}

.table-toolbar .form-group { margin-bottom: 0; }

.table-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

/* Table paging (CP-22). Sits outside .table-wrap so it stays put when a wide table scrolls
   sideways, and matches .table-toolbar's gutter so the two line up above and below the rows. */
.table-pager {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 24px;
    border-top: 1px solid var(--color-border);
}

.pager-status {
    font-size: 0.85rem;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.pager-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.pager-numbers .btn {
    min-width: 2rem;
    padding-left: 8px;
    padding-right: 8px;
    justify-content: center;
}

.pager-ellipsis {
    padding: 0 4px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* A sortable heading is a real <button> inside the <th> rather than a click handler on the
   th itself, so it keeps keyboard focus and the global :focus-visible ring for free. */
.th-sort {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.th-sort:hover { color: var(--color-text); }
.th-sort.is-sorted { color: var(--color-text); }

/* The arrow only exists on the column actually sorted; an idle column shows nothing rather
   than a greyed-out double arrow, which reads as disabled. */
.th-sort.is-sorted::after {
    content: '\2191';
    font-size: 0.9em;
    line-height: 1;
}

.th-sort.is-sorted[data-dir="desc"]::after { content: '\2193'; }

.cell-nowrap { white-space: nowrap; }
/* The model name under a local/remote badge. Smaller and muted because the badge is what the
   column is read for; the exact model matters only once a row has been singled out. No colour
   literal - the palette owns colour (docs/design-language.md). */
.cell-sub { font-size: 0.75rem; }

/* Row selection in the Sampled Calls table. The select column is narrow and the checkbox is
   accent-tinted so a ticked row reads at a glance; the row tint is the same background step
   the design language uses for hover, one level in, rather than a new colour. */
.cell-select {
    width: 1%;
    padding: 0 !important;
    text-align: center;
}

/* The label wraps the checkbox in a much bigger click target than the icon itself -
   padding on the input isn't reliably clickable across browsers, a label around it is. */
.cell-select-hit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 44px;
    height: 44px;
    cursor: pointer;
}

.cell-select input[type="checkbox"] {
    accent-color: var(--color-accent);
    width: 20px;
    height: 20px;
    cursor: pointer;
    vertical-align: middle;
    pointer-events: none;
}

.cell-select-hit:has(input:disabled) { cursor: not-allowed; }

.cell-select input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.4; }

.data-table tbody tr.is-selected { background: var(--color-bg-subtle); }

/* Sits between the filter toolbar and the table, and is hidden entirely with nothing
   selected - an empty action bar reading "0 selected" is just a permanently disabled row. */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 12px 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-bottom: 1px solid var(--color-border);
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: var(--color-bg-subtle);
}

.data-table tbody td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

/* Admin -> Permissions (CC75, CP-183): the role badge sits above its own select rather than
   beside it, so the column reads as "here's the role, here's how to change it" instead of two
   controls fighting for the same line at the data-table's normal row height. */
.permissions-role-select {
    margin-top: 8px;
    min-width: 150px;
}

.agent-name { font-weight: 600; }

/* Call Cards */
.call-card {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--transition);
}

.call-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent);
    transform: scale(1.01);
}

.audio-player {
    padding: 0 18px 12px;
}

.audio-player audio {
    width: 100%;
    height: 36px;
    border-radius: 8px;
}

.transcript-block {
    margin: 0 18px 14px;
    background: var(--color-accent-soft);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-xs);
    padding: 14px 16px;
}

.transcript-block.pending {
    background: var(--accent-warning-bg);
    border-color: var(--accent-warning-bg);
}

.transcript-text {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* Progress */
.progress-bar {
    height: 8px;
    background: var(--color-bg-subtle);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Calibration progress cells (Calibrate Operator, Operator Sets) - a linear bar for a "how many of
   these are done" ratio and a circular ring for a 0-100 score, both banded red/amber/green by
   the same thresholds (calibBand() in app.js, $calibBand in templates/sets.php) so a reader
   learns the one colour meaning once. --neutral is a fourth, uncoloured band for "no data" -
   never scored as if it were a real 0. */
.calib-ring {
    --calib-ring-pct: 0;
    --calib-ring-color: var(--color-border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    vertical-align: middle;
    margin-right: 4px;
    border: 1px solid var(--color-border);
    background: conic-gradient(var(--calib-ring-color) calc(var(--calib-ring-pct) * 1%), var(--color-bg-subtle) 0);
}

.calib-ring::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--color-surface);
}

.calib-ring-value {
    position: relative;
    z-index: 1;
    font-size: 0.74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
    /* The figure's real backdrop is the ring's ::before disc; painting it here too makes that
       explicit, so nothing (the contrast audit included) reads the conic ring behind it (CC95). */
    background: var(--color-surface);
    border-radius: 50%;
    padding: 0 2px;
}

.calib-ring-value--muted { color: var(--color-text-muted); }

.calib-ring--success { --calib-ring-color: var(--accent-success); }
.calib-ring--warning { --calib-ring-color: var(--accent-warning); }
.calib-ring--danger { --calib-ring-color: var(--accent-danger); }
.calib-ring--neutral { --calib-ring-color: var(--color-border); }

/* Under the manual per-call transcribe bar: the wall-clock timer, and what the estimate was
   based on. The timer is tabular so the digits don't jitter as it counts. */
.transcribe-timer-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 0.8rem;
}

.transcribe-timer {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}

/* Upload Result */
.upload-result {
    margin: 0 24px 20px;
    padding: 12px 16px;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    font-weight: 500;
}

.upload-result.success {
    background: var(--accent-success-bg);
    color: var(--on-success);
    border: 1px solid var(--accent-success-bg);
}

.upload-result.error {
    background: var(--accent-danger-bg);
    color: var(--on-danger);
    border: 1px solid var(--accent-danger-bg);
}

/* Utilities */
.hidden { display: none !important; }
/* A component that sets its own `display` outranks the browser's [hidden] rule, so an element
   hidden by the attribute stays on screen anyway - .form-group is a flex column, which is why
   the rule form's From/To dates shipped visible in the rolling window mode too. */
[hidden] { display: none !important; }
.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--on-danger); }

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.empty-state p {
    margin-top: 12px;
    font-size: 0.9rem;
}

/* Error Page */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.error-page h1 {
    font-size: 6rem;
    font-weight: 800;
    background: var(--color-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.error-page p {
    color: var(--color-text-muted);
    margin: 8px 0 24px;
    font-size: 1.1rem;
}

/* Animations */
/* Opacity only, deliberately - `transform: translateY(...)` here used to leave `.section-card`
   (this animation's main user) with a *computed* transform of translateY(0) forever after,
   because `forwards` keeps the final keyframe value rather than reverting to the cascade's
   `none`. A non-`none` transform on ANY ancestor becomes the containing block for a
   `position: fixed` descendant - so a modal opened from inside a .section-card (the Calls
   page's Filter modal) was being sized and clipped against that card's own box instead of the
   viewport, and .section-card's `overflow: hidden` then clipped it there too. Sidebar/top-bar
   staying undimmed and the modal's footer being cut off were both this, not a sizing bug. */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.stat-card, .section-card, .call-card {
    animation: fadeIn 0.4s ease forwards;
}

.stats-grid .stat-card:nth-child(2) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.15s; }

/* Top bar actions (the rule scope selector and the jobs panel toggle) */
.top-bar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Global search (docs/prd.md CC57, CP-71).

   PAINTED FROM THE TOP BAR'S OWN TOKENS, NOT THE PAGE'S, and that is the whole reason this
   rule exists rather than reusing .filter-select. Under Indigo & Glass the top bar is a
   gradient with white text and translucent-white controls, where .filter-select's
   --color-bg-subtle / --color-text are a cream box with dark text. The placeholder is the
   sharper half: it is measured against the gradient in one skin and against cream in the
   other, so a literal there passes three of the four skin/theme combinations and fails the
   fourth. It is the button text at reduced opacity - a token and an opacity, never a colour.

   min-width: 0 is the .main-content trap in miniature: the input is a flex item beside two
   buttons and an h1 in a fixed-height row, so without it a long placeholder refuses to shrink
   and pushes the page title out of the bar. */
.top-bar-search {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.top-bar-search svg {
    position: absolute;
    left: 10px;
    color: var(--topbar-btn-text);
    opacity: 0.7;
    pointer-events: none;
}

.top-bar-search input {
    width: 18rem;
    max-width: 100%;
    min-width: 0;
    padding: 8px 12px 8px 30px;
    background: var(--topbar-btn-bg);
    border: 1px solid var(--topbar-btn-border);
    border-radius: var(--radius-xs);
    color: var(--topbar-btn-text);
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
}

.top-bar-search input::placeholder {
    color: var(--topbar-btn-text);
    opacity: 0.7;
}

.top-bar-search input:focus { border-color: var(--topbar-btn-active-border); }

/* A call's own external id, which is long and never read as prose. */
.cell-id {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.jobs-toggle[aria-expanded="true"] {
    border-color: var(--topbar-btn-active-border);
    color: var(--topbar-btn-active-text);
}

.jobs-toggle-badge {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--color-accent-fill);
    color: var(--color-on-accent);
    font-size: 0.7rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

/* Account chip, in the sidebar footer since CP-18. */
.user-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-xs);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.logout-form { margin: 0; }

/* Switching theme repaints large flat areas at once, which reads as a jolt. Only the
   colour properties transition - anything broader makes the first paint jank. */
body, .sidebar, .top-bar, .section-card, .stat-card, .call-card, .audio-panel, .data-table tbody tr {
    transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

@media (prefers-reduced-motion: reduce) {
    body, .sidebar, .top-bar, .section-card, .stat-card, .call-card, .audio-panel, .data-table tbody tr {
        transition: none;
    }
}

/* Login page */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 24px;
}

.login-shell {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 32px;
    animation: fadeIn 0.4s ease forwards;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.login-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.login-subtitle {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 6px 0 24px;
}

.login-alert {
    background: var(--accent-danger-bg);
    border: 1px solid var(--accent-danger);
    color: var(--on-danger);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.login-alert code {
    background: var(--color-bg-subtle);
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 0.8rem;
}

.login-submit {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

/* --brand-text-color is white under Indigo & Glass because the wordmark's home is the
   sidebar, whose rail is dark in BOTH themes. The login page has no rail - the same wordmark
   sits on --color-surface - so in Indigo/light it was white on a light card, 1:1, an
   invisible heading. Measured, not reasoned about: bin/contrast_audit.mjs cannot reach
   /login (it signs in first), which is why this survived from CP-31. The page's own text
   token is correct here and unchanged for Olive, whose brand token is already dark. */
.login-brand .brand-text {
    color: var(--color-text);
}

/* Microsoft SSO on the login page (docs/prd.md CC58). The mark's own four brand colours are
   inline in templates/login.php, not here - this file holds no colour literal below the
   palette, and a brand mark must not switch with the skin. */
.login-sso {
    gap: 10px;
    text-decoration: none;
}

/* "or", with a rule either side. Borders rather than a shadow, per the design language. */
.login-footnote {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    margin-top: 20px;
}

/* Transcription page - sample charts */
.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-card h3 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    align-self: flex-start;
}

.chart-canvas-box {
    position: relative;
    width: 100%;
    height: 280px;
}

/* .chart-row is auto-fit, so on the widened container the two charts would each take ~700px
   and draw a circle far larger than two numbers deserve. Cap the column, keep them left. */
.chart-row { grid-template-columns: repeat(auto-fit, minmax(280px, 420px)); }

.badge-booking { background: var(--accent-info-bg); color: var(--on-info); }
.badge-nonbooking { background: var(--accent-nonbooking-bg); color: var(--on-nonbooking); }

/* Per-call detail page (/transcription/call/{id}) */
.detail-back { margin-bottom: 16px; }

.detail-call-id {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-left: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.detail-grid dt {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 4px;
}

.detail-grid dd { font-size: 0.95rem; }

/* Audio player. The native <audio> element is hidden and driven from app.js so the
   transport can carry a real scrub bar, skip buttons and a speed control - a listening
   pass over a 4-minute call needs more than play/pause. */
.audio-panel {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 18px;
}

.ap-transport {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition);
}

.ap-btn:hover { border-color: var(--color-accent); color: var(--color-text); }

.ap-btn-play {
    width: 44px;
    height: 44px;
    background: var(--color-accent);
    border-color: transparent;
    color: var(--color-on-accent);
}

.ap-btn.is-muted { color: var(--accent-danger); border-color: var(--accent-danger); }

.ap-time {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    min-width: 46px;
    text-align: center;
}

.ap-seek {
    flex: 1;
    min-width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.ap-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
}

.ap-seek::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
}

.ap-rate-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ap-rate { padding: 6px 8px; }

/* Transcripts run to hundreds of words, so the detail page keeps one folded away until asked. */
.transcript-disclosure > summary {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 24px;
    cursor: pointer;
    font-size: 0.85rem;
    list-style-position: inside;
}

.transcript-disclosure > summary:hover { background: var(--color-bg-subtle); }

/* The label is written by CSS so the open and closed states can't drift out of step. */
.transcript-summary-label { font-weight: 600; }
.transcript-summary-label::after { content: 'Show transcript'; }
.transcript-disclosure[open] .transcript-summary-label::after { content: 'Hide transcript'; }

.transcript-disclosure .transcript-block {
    margin: 0 24px 20px;
    max-height: 420px;
    overflow-y: auto;
}

.transcript-disclosure .transcript-text { white-space: pre-wrap; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .content-area { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .top-bar { padding: 0 16px; }
    .top-bar-search input { width: 9rem; }
    .chart-row { grid-template-columns: 1fr; }
    .section-header-split { align-items: flex-start; flex-direction: column; }
}

/* ---------------------------------------------------------------------------
   Diarized transcript view (CP-13)

   Two versions of the same call live in the transcript card - the flat run and the
   speaker-separated one - and this switches between them. Sides are assigned by order
   of first appearance, not by role: pyannote returns SPEAKER_00/01 and has no idea
   which one is the telephonist, so the view separates the voices without naming them.
   --------------------------------------------------------------------------- */

.transcript-modes {
    display: inline-flex;
    gap: 2px;
    margin: 0 12px 12px;
    padding: 3px;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.transcript-mode-btn {
    padding: 5px 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.transcript-mode-btn:hover { color: var(--color-text); }

.transcript-mode-btn.is-active {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.transcript-thread {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 12px 12px;
    padding: 16px;
    max-height: 460px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

/* Diarized turns in #transcriptBody */
#transcriptBody .diarized-turn-bubble {
    background: var(--color-surface);
    cursor: pointer;
}
#transcriptBody .diarized-turn-bubble:hover {
    border-color: var(--color-accent);
    transform: translateX(2px);
}

/* Taxonomy page (docs/prd.md CC16) */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

/* In a .form-row the label is a grid cell, so it has to be allowed to wrap - the nowrap that
   keeps a short standalone label on one line makes a long one overflow its column and print
   on top of the label beside it. */
.form-row > .checkbox-label { white-space: normal; }

/* Pipeline rule form (docs/prd.md CC34). The two window shapes sit side by side as radio
   rows rather than one being hidden behind a dropdown - CP-18 hid the unchosen one and the
   date range read as missing. The same rule is why CP-25's repeat interval stays on screen
   while "Once" is selected. A window row is flex, not .form-row: in that grid the label,
   the number box and the "days" suffix each get an equal auto-fit column and the sentence
   comes apart. */
.window-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.window-row .form-group { flex: none; }
.form-group-narrow input { width: 6rem; }
.form-group-narrow select { width: 7.5rem; }

/* CP-25: the form is four numbered steps, one fieldset each, so the order of the questions
   is visible rather than implied by where the fields happen to sit. The number is a counter
   on the legend, not a list marker - a <legend> cannot be a list item. */
.rule-form .form-row:last-child { margin-bottom: 0; }
.rule-form .window-row:last-of-type { margin-bottom: 0; }

/* The "start it now" checkbox is a separate decision from the once/repeat radios above it,
   so it needs the gap that a .card-note between them does not supply. */
.rule-form-start { margin-top: 14px; margin-bottom: 0; }

/* The number keeps .form-group-narrow's 6rem box, but the hint under it is a sentence and
   must be allowed the full grid column. */
.form-group-narrow .field-hint { width: auto; }

/* A single control should not stretch the width of a 100rem container, but .form-row-narrow's
   320px is too tight for a sentence-long <option>. */
.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.radio-label input[type="radio"] {
    flex: none;
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* The option NOT currently chosen, in a "pick one of these two" pair where only one side has
   its own fields to disable (Add Week's Run now / Schedule) - the label itself dims to match
   the disabled look its sibling's fields get, even though the radio stays clickable. */
.field-suffix {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* Model rationale inside a table cell (CP-22). Free prose was making rows five lines tall and
   the table unscannable, so the cell shows two lines and offers the rest. The full text is
   always on the call's own page - this is a preview, never the only copy. */
.cell-reason {
    max-width: 28rem;
    min-width: 14rem;
}

.reason-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.cell-reason.is-open .reason-clamp {
    display: block;
    overflow: visible;
}

/* The quoted line is the model's evidence, not its reasoning - it reads as a quotation so the
   two are not mistaken for one another when they sit in the same cell. */
.reason-quote {
    display: block;
    margin-top: 4px;
    color: var(--color-text-muted);
    font-style: italic;
}

.reason-toggle {
    margin-top: 4px;
    padding: 0;
    background: none;
    border: none;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-accent-text);
    cursor: pointer;
}

.reason-toggle:hover { text-decoration: underline; }

/* Sits under an input, so it must not inherit the uppercase treatment .form-group label gets. */
.field-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.checkbox-label input[type="checkbox"] {
    flex: none;
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* A <details> whose summary is styled as a button. list-style has to be cleared on both
   selectors - Safari uses ::-webkit-details-marker and ignores the standard one. */
.taxonomy-editor > summary {
    cursor: pointer;
    list-style: none;
}

.taxonomy-editor > summary::-webkit-details-marker { display: none; }
.taxonomy-editor[open] > summary { margin-bottom: 4px; }
.taxonomy-editor-block { display: block; margin-top: 16px; }

/* The editor forms sit inside .card-body, which already provides the page's padding, so
   they take none of their own - the same reason .section-card has none. */
.taxonomy-editor .upload-form { padding-left: 0; padding-right: 0; }

/* The category tree diagram on /taxonomy (CP-57): a nested outline with connector lines,
   every node a link. Lines are borders on the list items - never shadows - so the shape
   reads in both themes; impact is a coloured left edge on the answer node, keyed in the
   card note above it. */
.taxonomy-tree,
.taxonomy-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.taxonomy-tree ul { padding-left: 28px; }

.taxonomy-tree .tree-branch {
    position: relative;
    padding: 4px 0 0 18px;
}

.taxonomy-tree .tree-branch::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-left: 1px solid var(--color-border);
}

.taxonomy-tree .tree-branch:last-child::before { bottom: auto; height: 20px; }

.taxonomy-tree .tree-branch::after {
    content: '';
    position: absolute;
    left: 0;
    top: 20px;
    width: 14px;
    border-top: 1px solid var(--color-border);
}

.taxonomy-tree > .tree-branch { padding-left: 0; }
.taxonomy-tree > .tree-branch::before,
.taxonomy-tree > .tree-branch::after { display: none; }
.taxonomy-tree > .tree-branch + .tree-branch { margin-top: 20px; }

.tree-node {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 6px);
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.3;
}

.tree-node:hover { border-color: var(--color-accent); color: var(--color-accent-text); }

.tree-node-section {
    font-weight: var(--font-weight-strong, 600);
    background: var(--color-bg-subtle);
}

.tree-node-draft { border-style: dashed; color: var(--color-text-muted); }
.tree-node-note { font-weight: 400; font-size: 0.8rem; }

.tree-node-tag.tree-impact-revenue_loss { border-left: 3px solid var(--accent-danger); }
.tree-node-tag.tree-impact-service_quality { border-left: 3px solid var(--accent-info); }

/* The operator page's "Top issues" list and its "Feedback by category" accordion (2026-09-14) -
   the same category/question/remark shape as the tree above, but with real counts, so each
   remark row is a fact rather than a diagram node and gets its own leaf styling. Depth is a
   border, never a shadow, per docs/design-language.md. */
.taxonomy-orphans { margin: 0; padding-left: 20px; }
.taxonomy-orphans li + li { margin-top: 6px; }

.taxonomy-crumbs { margin-left: 12px; font-size: 0.85rem; }
.taxonomy-crumbs a { color: var(--color-accent-text); }

.taxonomy-meaning {
    max-width: 34rem;
    white-space: normal;
}

.taxonomy-meaning .text-muted {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
}

/* Categorisation runner (docs/prd.md CC16) - the count row standing in for the reserved
   Pie Chart 3 slot until a real model is chosen. */
.tag-breakdown {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
}

.tag-breakdown-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}

.card-note-inline { padding-top: 0; }
.card-note-inline .text-muted { display: block; margin-top: 4px; font-size: 0.8rem; }
/* ==========================================================================
   Job queue (docs/prd.md CC33)
   The nav badge, the slide-over panel, and the row/group shapes shared with
   the /jobs page. No colour literals - every value here is a palette token,
   so both themes follow automatically.
   ========================================================================== */

/* `hidden` sets display:none in the UA stylesheet, but a display declaration in author CSS
   beats it - so every element below that sets its own display must opt back out explicitly.
   Without this the panel and the bulk bar are visible on every page load. */
.jobs-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--color-bg);
    opacity: 0.55;
}

.jobs-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 201;
    width: min(30rem, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
}

.jobs-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.jobs-panel-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.jobs-live-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.jobs-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    display: inline-block;
    flex-shrink: 0;
}

/* A status dot inside a badge ("● Running") needs room before the word. */
.badge .jobs-dot { margin-right: 6px; }

.jobs-dot-pulse {
    animation: jobsPulse 1.6s ease-in-out infinite;
}

@keyframes jobsPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.jobs-panel-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.jobs-stat {
    padding: 10px 8px;
    text-align: center;
    border: none;
    border-right: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
    transition: background var(--transition), border-color var(--transition);
}

.jobs-stat:last-child { border-right: none; }
.jobs-stat:hover { background: var(--color-bg-subtle); }

.jobs-stat[aria-selected="true"] {
    background: var(--color-accent-soft);
    box-shadow: inset 0 -2px 0 var(--color-accent);
}

.jobs-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.jobs-stat-label {
    display: block;
    margin-top: 2px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    color: var(--color-text-muted);
}

.jobs-stat-sub {
    display: block;
    margin-top: 1px;
    font-size: 0.65rem;
    color: var(--color-text-muted);
}

.jobs-panel-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.jobs-controls-spacer { flex: 1; }
.jobs-unfinished-count {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.jobs-paused-note {
    margin: 0;
    padding: 8px 20px;
    font-size: 0.8rem;
    color: var(--color-text);
    background: var(--color-bg-subtle);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.jobs-paused-note svg {
    color: var(--color-warning);
    flex-shrink: 0;
}

.jobs-panel-bulk {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    background: var(--color-bg-subtle);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.jobs-bulk-count { font-size: 0.8rem; color: var(--color-text-muted); }
.jobs-bulk-actions { display: flex; align-items: center; gap: 8px; }

.jobs-select-all-row {
    padding: 8px 20px;
    background: var(--color-bg-subtle);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.jobs-select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.jobs-select-all-box {
    margin: 0;
}

/* The scrolling region. */
.jobs-panel-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 0;
}

.jobs-empty {
    padding: 28px 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.jobs-batch { border-bottom: 1px solid var(--color-border); }
.jobs-batch:last-child { border-bottom: none; }

.jobs-batch-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 20px 8px;
}

.jobs-batch-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jobs-batch-progress {
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.jobs-batch-bar {
    height: 4px;
    margin: 0 20px 6px;
    background: var(--color-bg-subtle);
    border-radius: 2px;
    overflow: hidden;
}

.jobs-batch-bar-fill {
    height: 100%;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

.job-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 10px;
    padding: 8px 20px;
}

.job-row + .job-row { border-top: 1px solid var(--color-bg-subtle); }
/* Running is yellow everywhere (CP-213): the row tint follows the status badge. */
.job-row.is-running { background: var(--accent-warning-bg); }
.job-row.is-running .jobs-dot { background: currentColor; }

.job-select { margin-top: 3px; }
.job-id { font-variant-numeric: tabular-nums; color: var(--color-text-muted); font-weight: 600; }

/* What a job does, as tags (CP-213). Each stage borrows an existing badge colour pair, so the
   text-on-fill contrast is the one the badges already measure in every skin and theme. None of
   them is a status colour: grey/yellow/green/red belong to queued/running/done/failed. */
.job-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.task-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--accent-neutral-bg);
    color: var(--color-text-secondary);
}
.task-tag-audio { background: var(--accent-info-bg); color: var(--on-info); }
.task-tag-transcribe { background: var(--accent-purple); color: var(--on-purple); }
.task-tag-categorise { background: var(--accent-magenta); color: var(--on-magenta); }
.task-tag-calibrate { background: var(--accent-nonbooking-bg); color: var(--on-nonbooking); }

/* One worker's set of calls on the Running and Queued tabs (CP-213). */
.jobs-workers-head {
    padding: 10px 20px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.jobs-section-title {
    margin: 0;
    padding: 12px 20px 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--color-text-muted);
}
/* Each worker's set is its own bordered block with space around it, so five parallel workers
   read as five things rather than one long list. */
.job-set {
    margin: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    overflow: hidden;
}
.job-set + .job-set { margin-top: 16px; }
.job-set .job-row { border-top: 1px solid var(--color-bg-subtle); }
.job-set.is-paused { opacity: 0.8; }
.job-set-header { padding: 12px 16px 10px; display: grid; gap: 6px; background: var(--color-bg-subtle); }
.job-set-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.job-set-id {
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
}
.job-set-header .jobs-batch-bar { margin: 0; }
.job-set-actions { display: flex; gap: 8px; }
.job-set-header .job-inline-confirm { margin: 4px 0 0; }
.job-set-between { margin: 0; padding: 6px 20px 10px; font-size: 0.78rem; color: var(--color-text-muted); }
.job-timer { font-variant-numeric: tabular-nums; color: var(--color-text); }
.job-main { min-width: 0; }

.job-label {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-meta {
    margin-top: 2px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.job-error {
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    font-size: 0.74rem;
    color: var(--on-danger); /* text, not the button fill: 2.8:1 in dark mode (CC95) */
    overflow-wrap: anywhere;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.job-error svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.job-bar {
    height: 4px;
    margin-top: 6px;
    background: var(--color-bg-subtle);
    border-radius: 2px;
    overflow: hidden;
}

.job-bar-fill {
    height: 100%;
    background: var(--color-accent);
    transition: width 0.3s linear;
}

.job-inline-confirm {
    margin: 8px 20px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-warning);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.78rem;
}

.job-inline-confirm-text {
    flex: 1;
    min-width: 160px;
    color: var(--color-text);
}

.job-actions { display: flex; align-items: center; gap: 4px; }

.job-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    background: none;
    color: var(--color-text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all var(--transition);
}

.job-action:hover {
    border-color: var(--color-accent);
    color: var(--color-accent-text);
}

.jobs-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    flex-shrink: 0;
    font-size: 0.78rem;
}

.jobs-footer-hint {
    color: var(--color-text-muted);
}

.jobs-footer-link {
    color: var(--color-accent);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.jobs-footer-link:hover {
    text-decoration: underline;
}

/* --- What's new (CP-77, docs/prd.md CC62) -----------------------------

   The same slide-over geometry as the jobs panel, deliberately: a reader who has opened one
   knows how to close the other. It carries no colour of its own - the category chips reuse the
   .badge palette, so the four skin/theme combinations need nothing extra here. */

.whatsnew-toggle[aria-expanded="true"] {
    border-color: var(--topbar-btn-active-border);
    color: var(--topbar-btn-active-text);
}

.whatsnew-toggle-badge {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--color-accent-fill);
    color: var(--color-on-accent);
    font-size: 0.7rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.whatsnew-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--color-bg);
    opacity: 0.55;
}

.whatsnew-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 201;
    width: min(32rem, 100vw);
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
}

.whatsnew-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.whatsnew-panel-header h2 { font-size: 1.05rem; font-weight: 600; }
.whatsnew-panel-close { padding: 6px 8px; }

.whatsnew-panel-note {
    padding: 12px 20px;
    margin: 0;
    max-width: 80ch;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    background: var(--color-bg-subtle);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.whatsnew-panel-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.whatsnew-empty {
    padding: 28px 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.whatsnew-release { border-bottom: 1px solid var(--color-border); }
.whatsnew-release:last-child { border-bottom: none; }

.whatsnew-release-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px 6px;
}

.whatsnew-release-header h3 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--color-text-muted);
}

.whatsnew-items {
    list-style: none;
    margin: 0;
    padding: 0 20px 14px;
}

.whatsnew-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 10px;
    padding: 10px 0;
}

.whatsnew-item + .whatsnew-item { border-top: 1px solid var(--color-bg-subtle); }

.whatsnew-item-text { min-width: 0; }

.whatsnew-item-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
}

.whatsnew-item-body {
    margin: 4px 0 0;
    max-width: 80ch;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.whatsnew-item-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-accent-text);
}

/* --- /jobs page ------------------------------------------------------- */

.jobs-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--color-border);
}

.jobs-filter-spacer { margin-left: auto; }

/* The jobs table carries a long call label, a badge, two timestamps and two buttons. Left to
   size itself it squeezes the label into three lines and stacks the buttons; a min-width plus
   .table-wrap's scroll is the pattern the rest of the app already uses for wide tables. */
#jobsPageTable { min-width: 58rem; }
#jobsPageTable th:first-child,
#jobsPageTable td:first-child { width: 2.5rem; }
#jobsPageTable td:nth-child(2) { min-width: 20rem; }
#jobsPageTable td:nth-child(3),
#jobsPageTable td:nth-child(4),
#jobsPageTable td:nth-child(5),
#jobsPageTable td:nth-child(6) { white-space: nowrap; }
#jobsPageTable .job-actions { flex-wrap: nowrap; justify-content: flex-end; }

/* The live batch list inside the transcription cards. Same vocabulary as the jobs panel, but
   it sits inside a .section-card, so it takes the card's own gutter. */
.jobs-inline { padding: 12px 24px 18px; }

.jobs-inline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
}

.jobs-inline .jobs-batch-bar { margin: 0 0 8px; }

.jobs-inline-list {
    list-style: none;
    max-height: 20rem;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.jobs-inline-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.jobs-inline-row + .jobs-inline-row { border-top: 1px solid var(--color-bg-subtle); }
.jobs-inline-row.is-running { background: var(--color-accent-soft); }

.jobs-inline-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jobs-inline-detail {
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* The by-day ratio and the volume chart are time series, not two-number pies, so they get
   the full container width rather than the 420px cap .chart-row puts on a circle. */
.chart-card .card-help { align-self: flex-start; margin-top: 12px; }

/* A stat card's third line: what the number actually counts. The consensus states are not
   self-explanatory from their labels alone, and a legend somewhere else would be read once
   and then forgotten. */
.stat-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--color-text-muted);
    max-width: 40ch;
}

/* Drawn instead of a chart when a section has no verdicts yet. An empty axis reads as "zero
   calls", which is a different claim from "this has not been run". */
/* A sub-heading inside a card body, above one of several tables in the same card - the
   categorisation detail card draws one table per taxonomy question. Spacing only: no colour of
   its own, so it inherits and cannot break a skin. */
.detail-table-heading {
    margin: 24px 0 4px;
    font-size: 1.15rem;
    font-weight: var(--font-weight-strong);
}

.detail-table-heading:first-child { margin-top: 0; }

/* Already inside .card-body here, which carries the 24px gutter, so the shared .card-help
   padding would indent these twice. */
#categorisationDetail .card-help { padding-left: 0; padding-right: 0; }

/* A scope stated in the heading itself - "of non-booking calls" - carried at the surrounding
   weight but muted, so the card's name still reads as the name. Colour from the palette, never
   a literal. */
.heading-qualifier {
    font-weight: 400;
    color: var(--color-text-muted);
}

/* Sale opportunities is a second question sitting inside card 01 rather than a card of its own
   (CC43 fixes the card order), so it needs a separator the card frame would otherwise have given
   it - the 1px rule, never a shadow. */
#opportunityBlock {
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid var(--color-border);
}

/* Same reason as above: the block is nested inside .card-body rather than being a direct child,
   so the `.card-body > .card-note` rule does not reach it and the gutter would be applied twice.
   It also deliberately opts out of the shared 80ch cap and the muted colour, at the project
   owner's direction: this one paragraph is the section's own introduction rather than a footnote
   under a control, so it runs the full width and reads at body strength. */
#opportunityBlock > .card-note {
    max-width: none;
    padding: 2px 0 20px;
    color: var(--color-text);
}

.chart-empty {
    margin: 0;
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* The frequency charts' bucket selector (docs/prd.md CC44). The buttons are the shared .btn
   classes - active is .btn-primary, the rest .btn-secondary - so no colour lives here. */
.bucket-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 16px;
}

/* A time-series card whose canvas may be wider than the card: the wrapper scrolls, the inner
   div is sized by JS to max(card width, buckets x a per-bucket minimum), and Chart.js sizes
   itself to that inner div. The scroll stays inside the card - the page must never scroll
   sideways (the .main-content min-width rule). */
.chart-scroll {
    overflow-x: auto;
    max-width: 100%;
    /* .chart-card centres its children on the cross axis, which shrinks this wrapper to its
       content and left a nine-bucket day chart 252px wide in a full-width card. Stretch is
       the .card-help precedent one rule up. */
    align-self: stretch;
}

.chart-scroll-inner {
    position: relative;
    height: 300px;
    min-width: 100%;
}

/* The live pipeline tracker (docs/prd.md CC42). Borders and background steps only - no colour
   literals, and no box-shadow, per docs/design-language.md. */
.pipeline-rule {
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
}

.pipeline-rule:last-child { border-bottom: none; }
.pipeline-rule:first-child { padding-top: 0; }

.pipeline-rule-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

/* Two stages side by side where there is room, stacked on a narrow screen. Matches the
   .chart-row minimum so the tracker breaks at the same width as everything else on the page. */
.pipeline-stage { margin-bottom: 12px; }
.pipeline-stage:last-child { margin-bottom: 0; }

.pipeline-stage-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.pipeline-stage-label { font-weight: 600; }

/* Tabular so the digits do not jitter as the percentage climbs during a poll. */
.pipeline-stage-pct {
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
}

.pipeline-stage-detail {
    margin: 6px 0 0;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

/* Admin -> Progress (CC65, CP-81): the per-day walk folded under each fetch. Borders and a
   background step for depth, never a shadow - the structural rule from the design language. */
.progress-detail {
    margin-top: 12px;
    border-top: 1px solid var(--color-border);
    padding-top: 10px;
}

.progress-detail > summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.progress-detail > summary:hover { color: var(--color-text); }

.progress-detail .table-wrap { margin-top: 10px; }

/* --- Admin -> Progress Redesign (CP-211) ------------------------------ */

.progress-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.progress-page-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.progress-page-subtitle {
    margin: 4px 0 0;
    font-size: 0.88rem;
}

.progress-page-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.progress-paused-banner,
.progress-connection-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.progress-paused-text,
.progress-connection-text {
    flex: 1;
    font-size: 0.85rem;
}

.progress-scope-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 10px 16px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 0.8rem;
    background: var(--color-bg-subtle);
}

.progress-scope-strip-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.progress-scope-strip-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.progress-scope-strip-spacer { flex: 1; }
.progress-scope-strip-note { font-size: 0.78rem; }

/* Card 01 flight counts vs money split */
.progress-flight-grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 16px;
    align-items: stretch;
}

@media (max-width: 900px) {
    .progress-flight-grid { grid-template-columns: 1fr; }
}

.progress-flight-money {
    padding: 12px 14px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--color-bg-subtle);
}

.progress-flight-money-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.progress-flight-money-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.progress-unattributed-note {
    margin-top: 14px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    font-size: 0.78rem;
    color: var(--color-text-secondary);
}

.progress-section-divider {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 28px 0 12px;
    flex-wrap: wrap;
}

.progress-section-title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.progress-section-subtitle {
    font-size: 0.78rem;
}

/* Card 02 Chunk Grid */
.progress-chunk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

/* The worker roles (CP-332): a pool's heading and its folded idle workers span the whole grid. */
.progress-pool-head {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    font-size: 0.85rem;
}
.progress-pool-head + .progress-pool-head,
.progress-pool-idle + .progress-pool-head { margin-top: 8px; }
.progress-pool-idle { grid-column: 1 / -1; font-size: 0.8rem; }
.progress-pool-idle > summary { cursor: pointer; color: var(--color-text-muted); }
.progress-pool-idle > .progress-chunk-grid { margin-top: 10px; }

.progress-chunk-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-subtle);
    min-width: 0;
}

.progress-chunk-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-chunk-label {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-chunk-detail {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.progress-chunk-current {
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.progress-chunk-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}

.progress-chunk-calls-btn {
    font-size: 0.75rem;
    padding: 2px 8px;
    border: none;
    background: none;
    color: var(--color-accent);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.progress-chunk-calls-btn:hover {
    color: var(--color-accent-text);
}

/* Card 03 Throughput */
.progress-view-switcher {
    display: inline-flex;
}

.progress-throughput-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.progress-legend-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.78rem;
    cursor: pointer;
    font: inherit;
    transition: all var(--transition);
}

.progress-legend-btn:hover {
    background: var(--color-bg-subtle);
}

.progress-legend-btn[aria-pressed="false"] {
    opacity: 0.45;
}

.progress-legend-swatch {
    width: 14px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.progress-legend-rate {
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.72rem;
}

/* Card 04 Job History stats & chips */
.progress-jobs-stat-grid {
    margin-bottom: 16px;
}

.jobs-page-stat-card {
    cursor: pointer;
    text-align: left;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font: inherit;
    color: inherit;
    transition: all var(--transition);
}

.jobs-page-stat-card:hover {
    background: var(--color-bg-subtle);
}

.jobs-page-stat-card[aria-pressed="true"] {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

.jobs-page-filter-chips {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.jobs-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-accent-soft);
    border: 1px solid var(--color-accent);
    font-size: 0.75rem;
    color: var(--color-accent-text);
    font-weight: 500;
}

.jobs-filter-chip-clear {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    line-height: 1;
}

/* Key problems (CC49, CP-55): an ordered list of sentences under the category charts. Plain
   list styling with the palette's border as the separator - no colour literal, no shadow. */
.problem-list {
    margin: 0 0 8px 0;
    padding-left: 1.5rem;
    max-width: 80ch;
}
.problem-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
    line-height: 1.5;
}
.problem-list li:last-child { border-bottom: none; }
.problem-list li a { color: var(--color-text); text-decoration: none; }
.problem-list li a:hover { text-decoration: underline; }
.problem-list .badge { margin-left: 6px; vertical-align: middle; }

/* Editable dashboard widgets (CP-61, docs/prd.md CC53). A keyed tile carries a remove button
   that is only drawn in edit mode - body.stat-editing - so the tiles need no re-render to enter
   or leave it. Dashed borders mark what is editable; no colour of its own anywhere here, every
   value is a token, so the four skin/theme combinations need nothing extra. */
.stat-card { position: relative; }

.stat-remove {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
}
.stat-remove:hover { color: var(--accent-danger); border-color: var(--accent-danger); }
.stat-editing .stat-card[data-stat-key] { border-style: dashed; }
.stat-editing .stat-card[data-stat-key] .stat-remove { display: inline-flex; }

/* A grid with everything shelved keeps its place and says so; spanning every column so it
   does not sit as one small box in a row of nothing. */
.stat-grid-empty {
    grid-column: 1 / -1;
    padding: 16px 20px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.dashboard-edit-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 150;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
/* Shifted left of the shelf while it is open, so the Done it doubles as is never under it. */
.stat-editing .dashboard-edit-fab { right: calc(min(22rem, 100vw - 32px) + 24px); }

/* The shelf: a side overlay rather than a modal, because the reader is comparing what is on
   the page with what is off it - a modal in the middle would cover the very tiles they are
   deciding about. Sits under the info modal (z 200) so a ⓘ pressed in edit mode still reads. */
.stat-shelf {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 190;
    width: min(22rem, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
}
.stat-shelf-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.stat-shelf-header h2 { font-size: 1.05rem; font-weight: 600; }
.stat-shelf-note {
    padding: 12px 20px 0;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--color-text-muted);
}
.stat-shelf-body { flex: 1; overflow-y: auto; padding: 12px 20px 20px; }
.stat-shelf-group { margin-top: 16px; }
.stat-shelf-group h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}
.stat-shelf-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg-subtle);
}
/* CP-64: every tile is a row - handle, checkbox, label, last value. A row that is off the page
   is dimmed rather than hidden, so the list is the whole catalogue in the page's order. */
.stat-shelf-item { justify-content: flex-start; }
.stat-shelf-item:not(.is-on) .stat-shelf-item-label,
.stat-shelf-item:not(.is-on) .stat-shelf-item-value { color: var(--color-text-muted); }
.stat-shelf-item.dragging { opacity: 0.45; border-style: dashed; }
.stat-shelf-handle {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--color-text-muted);
    cursor: grab;
}
.stat-shelf-item-text {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    align-items: center;
    min-width: 0;
    flex: 1;
    cursor: pointer;
}
.stat-shelf-item-text input { grid-row: 1 / span 2; margin: 0; }
.stat-shelf-item-label { font-size: 0.8rem; font-weight: 600; }
.stat-shelf-item-value { font-size: 0.75rem; color: var(--color-text-muted); }
.stat-shelf-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}
.stat-shelf-footer:has(> [hidden]) { display: none; }

/* ============================================================================
   OPERATORS LEADERBOARD (CC55, CP-66)
   ============================================================================ */

/* The two pinned rows. Neither is ranked: one is the fleet's own figure, so a row's percentage
   is read against something, and the other is the calls that carry no operator at all. */
.data-table tfoot .row-total td { border-top: 2px solid var(--color-border); font-weight: 600; }
.data-table tfoot .row-muted td { color: var(--color-text-muted); }

/* The admin hub's cards (docs/prd.md CC64). Each is a whole link, so the hit target is the
   card rather than its title - the .appearance-option precedent, where the option is the card.
   The 2px border is present in every state for the same reason it is there: growing one on
   hover would shift the grid by a pixel. Colours are tokens only; a literal here would fail to
   switch in three of the four skin/theme combinations. */
.admin-area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.admin-area-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-subtle);
    text-decoration: none;
    transition: border-color var(--transition);
}

.admin-area-card:hover {
    border-color: var(--color-accent);
}

.admin-area-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.admin-area-note {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--color-text-muted);
}

/* Filter Pill Group */
.filter-pill {
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-text-secondary);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    height: 30px;
    transition: all var(--transition);
}

.filter-pill:hover {
    color: var(--color-text);
    background: rgba(139, 133, 240, 0.08);
}

.filter-pill.active {
    background: var(--color-accent);
    /* Was white, 3.1:1 on the lifted dark-mode accent (CC95). */
    color: var(--color-on-accent);
    font-weight: 600;
}

/* View Mode Switcher */
.reviewer-view-toggle {
    display: flex;
    background: var(--color-bg-subtle);
    padding: 0.2rem;
    border-radius: var(--radius-xs);
    border: 1.5px solid var(--color-border);
    gap: 0.2rem;
}

.view-mode-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-text-secondary);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all var(--transition);
}

.view-mode-btn:hover {
    color: var(--color-text);
}

.view-mode-btn.active {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* The call page's diarized transcript turns (templates/transcription-call.php). They began in the
   Transcript Reviewer's split reader, which was removed at CP-320. */
.turns-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.diarized-turn-bubble {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.15rem;
    cursor: pointer;
    transition: all var(--transition);
}

.diarized-turn-bubble:hover {
    border-color: var(--color-accent);
    transform: translateX(2px);
}

.diarized-turn-bubble.speaker-a {
    border-left: 4.5px solid var(--accent-info, #3f6f9f);
}

.diarized-turn-bubble.speaker-b {
    border-left: 4.5px solid var(--accent-success, #2e7d5b);
}

.diarized-turn-bubble.active-playing-turn {
    border-color: var(--color-accent);
    background: var(--color-surface);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25), var(--shadow-sm);
    transform: translateX(4px);
}

.diarized-turn-bubble.active-playing-turn .turn-play-tag {
    color: var(--color-accent);
    font-weight: 700;
}

.turn-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.spk-a-color { color: var(--on-info, #2c5680); font-weight: 700; }
.spk-b-color { color: var(--on-success, #1f6349); font-weight: 700; }
.turn-time { font-family: var(--font-mono); color: var(--color-text-secondary); font-weight: normal; }
.turn-play-tag { font-size: 0.72rem; color: var(--color-accent); font-weight: 600; opacity: 0.9; }
.turn-body-text { font-size: 0.92rem; line-height: 1.6; color: var(--color-text); white-space: pre-wrap; overflow-wrap: anywhere; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-dialog {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    background: var(--color-bg-subtle);
}

.reviewer-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1.15rem;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 300;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition);
    pointer-events: none;
}

.reviewer-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Calls Browser (/calls, /calls/calibrated) - CP-141
   - Viewport fit, the page-transcripts-review pattern: filters, the count/percent
     selector and the rerun stages all moved into the Process modal, so the one
     card left on the page is the table - it fills whatever room the viewport
     gives it and scrolls internally, rather than the page growing under it.
   ========================================================================== */

body.page-calls {
    overflow: hidden;
}

body.page-calls .content-area.content-area-fluid {
    height: calc(100vh - var(--topbar-height));
    display: flex;
    flex-direction: column;
    padding: 20px 24px !important;
    box-sizing: border-box;
}

body.page-calls .content-area.content-area-fluid > .section-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

body.page-calls .content-area.content-area-fluid > .section-card > .card-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* The table itself is the scroll region, not the card or the page - the pager stays
   pinned below it rather than scrolling out of view with the rows. */
body.page-calls .table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

body.page-calls .table-pager {
    flex: 0 0 auto;
}

@media (max-height: 700px), (max-width: 900px) {
    body.page-calls {
        overflow: auto;
    }
    body.page-calls .content-area.content-area-fluid {
        height: auto;
    }
    body.page-calls .content-area.content-area-fluid > .section-card {
        flex: none;
    }
    body.page-calls .table-wrap {
        flex: none;
        max-height: 620px;
    }
}

/* ==========================================================================
   Manual Calibration Dedicated Page (/manual-calibration)
   - Viewport fit: eliminates outer-page scroll ("scroll inside of scroll")
   - Expands vertical space so calls queue and main section fill the viewport
   ========================================================================== */

body.page-manual-calibration {
    overflow: hidden;
}

/* The redesign (CP-225) supplies its own header and ground, and this page renders `bare` (no
   top bar), so the content fills the whole viewport edge to edge. */
body.page-manual-calibration .content-area.content-area-fluid {
    padding: 0 !important;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: 0;
}

@media (max-height: 700px), (max-width: 900px) {
    body.page-manual-calibration {
        overflow: auto;
    }
    body.page-manual-calibration .content-area.content-area-fluid {
        height: auto;
    }
}

/* Approach 1 Badges & Sentiment Pills */
.sentiment-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.12rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 9999px;
    letter-spacing: 0.01em;
    line-height: 1.3;
}
.sentiment-pill.sent-positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--on-success, #10b981);
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.sentiment-pill.sent-neutral {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}
.sentiment-pill.sent-negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--on-danger, #ef4444);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.approach1-status-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 0.85rem;
    box-shadow: var(--shadow-sm);
}
.approach1-features-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* =========================================================================
   Call Details Analysis Rerun Pipeline & Trackers (CP-104)
   ========================================================================= */

/* Main page overall progress tracker banner */
.call-pipeline-tracker {
    margin-bottom: 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.call-pipeline-tracker::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent), #38bdf8, var(--color-accent));
    background-size: 200% 100%;
    animation: cptGlowMove 2.5s linear infinite;
}

@keyframes cptGlowMove {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

.cpt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    gap: 12px;
}

.cpt-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cpt-pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: cptPulse 1.8s infinite;
    display: inline-block;
}

.cpt-pulse-dot.is-completed {
    background: #10b981;
    animation: none;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.cpt-pulse-dot.is-failed {
    background: #ef4444;
    animation: none;
}

@keyframes cptPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.cpt-stage-text {
    font-size: 0.92rem;
    color: var(--color-text);
    font-weight: 600;
}

.cpt-metrics {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.cpt-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--color-text);
    background: var(--color-bg-subtle);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

.cpt-percent {
    font-weight: 700;
    color: var(--color-accent);
    min-width: 38px;
    text-align: right;
}

.cpt-progress-bar {
    height: 8px;
    background: var(--color-bg-subtle);
    border-radius: 4px;
    margin-bottom: 0.6rem;
    overflow: hidden;
}

.cpt-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent), #38bdf8);
    transition: width 0.4s ease;
    border-radius: 4px;
}

.cpt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
}

.cpt-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Modal Specifics */
.rerun-modal-dialog {
    max-width: 660px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.rerun-modal-dialog .modal-body {
    overflow-y: auto;
    max-height: calc(90vh - 120px);
    padding: 1.35rem;
}

/* Calls page's Filter calls modal (CP-141) - fills the main content region (the same footprint
   as the section card behind it), not the sidebar or top bar, which stay visible and usable.
   #callsRerunModalBackdrop is moved to a direct child of <body> by initCallsRerunModal() before
   it is ever shown, so this `position: fixed` inset is genuinely relative to the viewport - it
   was previously left nested inside .section-card, and any ancestor that ever picks up a
   transform/filter/perspective (an entrance animation with `forwards`, e.g.) becomes the
   containing block instead, silently resizing and clipping it to that ancestor's box, which is
   what made it read as stuck behind the sidebar and top bar with its footer cut off. */
#callsRerunModalBackdrop {
    top: var(--topbar-height);
    left: var(--sidebar-width);
    padding: 24px;
}

@media (max-width: 768px) {
    #callsRerunModalBackdrop { left: 0; }
}

/* A definite `height` (not max-height) is what makes the flex column below actually enforce it -
   an auto-height flex container doesn't run the shrink algorithm against its children, so the
   header/footer float wherever the content pushes them and the footer (Start button) can end up
   clipped past the bottom. flex: 1 1 auto + min-height: 0 on the body is what lets IT absorb all
   the growth instead. */
.rerun-modal-dialog-lg {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
}

.rerun-modal-dialog-lg .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

.rerun-modal-dialog-lg .modal-header,
.rerun-modal-dialog-lg .modal-footer {
    flex-shrink: 0;
}

/* Everything below is one notch up from the call detail page's rerun modal - this one has
   three times the content on screen at once (filters, selection, stage checkboxes), so the
   compact sizing that works for a single-purpose modal reads as too small here. */
.rerun-modal-dialog-lg .rerun-options-heading { font-size: 0.92rem; }
.rerun-modal-dialog-lg .card-note { font-size: 1rem; }
.rerun-modal-dialog-lg .rerun-checkbox-label { font-size: 1rem; }
.rerun-modal-dialog-lg .rerun-checkbox-label strong { font-size: 1.05rem; }
.rerun-modal-dialog-lg .cell-sub { font-size: 0.88rem; }
.rerun-modal-dialog-lg .form-group label { font-size: 0.85rem; }
.rerun-modal-dialog-lg .filter-select,
.rerun-modal-dialog-lg input[type="text"],
.rerun-modal-dialog-lg input[type="date"],
.rerun-modal-dialog-lg input[type="number"] { font-size: 1rem; }
.rerun-modal-dialog-lg #callsRerunModalTitle { font-size: 1.2rem; }

.modal-lead {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin: 0 0 1rem;
}

/* Pipeline Selection Cards */
.pipeline-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
    .pipeline-picker-grid {
        grid-template-columns: 1fr;
    }
}

.pipeline-card {
    display: flex;
    border: 1.5px solid var(--color-border);
    background: var(--color-bg-subtle);
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.pipeline-card:hover {
    border-color: var(--color-accent);
    background: var(--color-surface);
}

.pipeline-card.is-selected {
    border-color: var(--color-accent);
    background: var(--color-surface);
    box-shadow: 0 0 0 1px var(--color-accent);
}

.pipeline-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pipeline-card-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.pipeline-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pipeline-card-desc {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    line-height: 1.38;
    margin: 0;
}

/* Stage Option Checkboxes */
.rerun-options-group {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 1rem;
}

.rerun-options-heading {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin: 0 0 10px;
}

/* Filters/Select/AI Process are <details>/<summary> now (CP-141), the .card-help marker
   convention reused rather than invented again - list-style cleared on both properties since
   Safari uses ::-webkit-details-marker and ignores the standard one. Collapsed, the heading
   carries no bottom margin, or an empty group would still show the 10px gap above nothing. */
summary.rerun-options-heading {
    cursor: pointer;
    list-style: none;
}

summary.rerun-options-heading::-webkit-details-marker { display: none; }
summary.rerun-options-heading::before { content: '\25B8\00a0'; }
details[open] > summary.rerun-options-heading::before { content: '\25BE\00a0'; }
summary.rerun-options-heading:hover { color: var(--color-text); }

details.rerun-options-group:not([open]) > summary.rerun-options-heading { margin-bottom: 0; }

.rerun-stage-option {
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

.rerun-stage-option:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.rerun-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.86rem;
    color: var(--color-text);
}

.rerun-checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
}

.rerun-stage-subopt {
    margin: 8px 0 2px 26px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rerun-force-option {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border);
}

/* The Calls page's rerun modal progress view (bulk equivalent of .stages-tracker-list above) -
   one block per checked stage, appended as its batch is queued, each holding its own
   watchJobBatch() render rather than a fixed tracker item, since a bulk stage is many jobs. */
.rerun-stage-progress {
    margin-bottom: 14px;
}

.rerun-stage-progress h4 {
    margin: 0 0 6px;
    font-size: 0.86rem;
}

/* Progress Tracker View in Modal */
.rerun-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.rph-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-progress-bar {
    height: 10px;
    background: var(--color-bg-subtle);
    border-radius: 5px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.stages-tracker-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 1rem;
}

.stage-tracker-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    transition: all 0.25s ease;
}

.stage-tracker-item.is-running {
    border-color: var(--color-accent);
    background: var(--color-bg-subtle);
}

.stage-tracker-item.is-completed {
    border-color: rgba(16, 185, 129, 0.4);
}

.stage-tracker-item.is-failed {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.04);
}

.sti-icon-wrap {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    flex-shrink: 0;
    margin-top: 1px;
}

.sti-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-muted);
}

.stage-tracker-item.is-running .sti-icon-wrap {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--color-accent);
}

.stage-tracker-item.is-running .sti-dot {
    background: var(--color-accent);
    animation: stiSpin 1.2s linear infinite;
    box-shadow: 0 0 6px var(--color-accent);
}

.stage-tracker-item.is-completed .sti-icon-wrap {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
}

.stage-tracker-item.is-completed .sti-dot {
    background: #10b981;
}

.stage-tracker-item.is-failed .sti-icon-wrap {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

.stage-tracker-item.is-failed .sti-dot {
    background: #ef4444;
}

.sti-body {
    flex: 1;
    min-width: 0;
}

.sti-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.sti-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text);
}

.sti-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sti-timer {
    font-size: 0.78rem;
    font-weight: 600;
}

.sti-detail {
    font-size: 0.8rem;
    line-height: 1.35;
}

.sti-sub-bar {
    height: 4px;
    margin-top: 6px;
    margin-bottom: 0;
}

.rerun-completion-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-sm);
    margin-top: 1rem;
}

.empty-state-notice {
    padding: 20px;
    text-align: center;
    background: var(--color-bg-subtle);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
}

/* =========================================================================
   Call Calibration Visual Enhancement & Key Explainer (CP-103)
   ========================================================================= */

/* Top Header & Detail Grid Calibration Score */
.badge-qa-score {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    box-shadow: 0 0 10px rgba(111, 191, 149, 0.2);
    letter-spacing: 0.05em;
}

.detail-grid-score-item {
    background: rgba(143, 160, 94, 0.06);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    padding: 6px 10px;
}

.detail-grid-score-item.has-score {
    border-color: rgba(111, 191, 149, 0.4);
    background: rgba(111, 191, 149, 0.06);
}

.top-qa-score-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.top-score-value {
    font-size: 1.15rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* Section 06: Hero Score Banner */
.calibration-hero-banner {
    display: flex;
    align-items: stretch;
    gap: 20px;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.calibration-hero-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent), var(--accent-success));
}

.chb-score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    padding: 16px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-align: center;
}

.chb-score-box.is-success { border-color: rgba(111, 191, 149, 0.4); }
.chb-score-box.is-warning { border-color: rgba(245, 158, 11, 0.4); }
.chb-score-box.is-danger { border-color: rgba(239, 68, 68, 0.4); }

.chb-score-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.chb-score-number {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.chb-score-box.is-success .chb-score-number { color: var(--accent-success); }
.chb-score-box.is-warning .chb-score-number { color: var(--accent-warning); }
.chb-score-box.is-danger .chb-score-number { color: var(--accent-danger); }

.chb-score-number small {
    font-size: 1.25rem;
    font-weight: 700;
    margin-left: 2px;
}

.chb-score-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin-top: 4px;
    font-weight: 600;
}

.chb-status-badge {
    margin-top: 4px;
}

.chb-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    flex: 1;
}

.chb-metric-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.chb-metric-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.chb-metric-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.chb-metric-sub {
    font-size: 0.75rem;
    margin-top: 2px;
}

/* Standardized Score Column in Calibration Table */
.score-cell-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.score-points-tag {
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Calibration Key & Formula Explainer */
.calibration-key-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.calibration-key-card {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
}

.ck-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--color-text);
}

.ck-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ck-header svg {
    color: var(--color-accent);
}

.ck-levels-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.ck-level-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.8rem;
    line-height: 1.35;
}

.ck-level-item .badge {
    flex-shrink: 0;
    min-width: 44px;
    justify-content: center;
    margin-top: 1px;
}

.ck-level-desc strong {
    display: block;
    color: var(--color-text);
    margin-bottom: 2px;
    font-size: 0.82rem;
}

.ck-level-desc span {
    color: var(--color-text-muted);
}

/* Formula Card */
.ck-formula-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    padding: 12px 14px;
    margin: 14px 0 16px;
}

.ck-formula-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.ck-formula-math {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88rem;
    color: var(--color-accent-text);
    font-weight: 600;
    padding: 4px 0;
    word-break: break-word;
}

.ck-breakdown-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ck-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

.ck-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent-ring);
    color: var(--color-accent-text);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.ck-step strong {
    color: var(--color-text);
}

@media (max-width: 960px) {
    .calibration-hero-banner {
        flex-direction: column;
    }
    .chb-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .calibration-key-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------------------------------------------------------------------------
   Collapsible Section Cards & User Notes (Call Details Page)
   --------------------------------------------------------------------------- */

.collapsible-section .section-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.collapsible-section .section-header:hover {
    background: rgba(255, 255, 255, 0.025);
}

.section-header-title {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.section-header-title h2 {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.section-collapse-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-xs);
    background: var(--color-surface-raised, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.section-collapse-toggle:hover {
    color: var(--color-text);
    background: var(--color-surface-hover, rgba(255, 255, 255, 0.1));
    border-color: var(--color-border-subtle);
}

.collapsible-section.is-collapsed .section-collapse-toggle svg {
    transform: rotate(-90deg);
}

.collapsible-section:not(.is-collapsed) .section-collapse-toggle svg {
    transform: rotate(0deg);
}

.collapsible-section.is-collapsed .section-collapsible-content {
    display: none !important;
}

/* ==========================================================================
   Calibration Feedback Section (CP-114) - Call Details Page Section 06
   ========================================================================== */
.calib-feedback-eval-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .calib-feedback-eval-grid {
        grid-template-columns: 1fr;
    }
}

.calib-feedback-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.calib-ai-feedback-card {
    border-top: 3px solid #6366f1;
}

.calib-human-feedback-card {
    border-top: 3px solid #0ea5e9;
}

.calib-feedback-card-header {
    padding: 14px 18px;
    background: var(--color-surface-subtle, rgba(0, 0, 0, 0.02));
    border-bottom: 1px solid var(--color-border-subtle, var(--color-border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cf-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cf-header-title h3 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--color-text);
}

.cf-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cf-icon-ai {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
}

.cf-icon-human {
    background: rgba(14, 165, 233, 0.12);
    color: #0ea5e9;
}

.cf-header-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.calib-feedback-card-body {
    padding: 16px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cf-narrative-quote {
    margin: 0 0 10px 0;
    padding: 12px 14px;
    background: var(--color-surface-subtle, rgba(0, 0, 0, 0.02));
    border-left: 3px solid #6366f1;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--color-text);
}

.cf-narrative-quote p {
    margin: 0;
}

.cf-human-quote {
    border-left-color: #0ea5e9;
}

.cf-narrative-summary {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--color-text);
}

.cf-narrative-summary p {
    margin: 0 0 6px 0;
}

.cf-auditor-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

@keyframes calibFormPulse {
    0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.6); }
    40% { box-shadow: 0 0 0 8px rgba(14, 165, 233, 0.25); }
    100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

/* Coaching highlights */
.coaching-highlights-container {
    margin: 24px 0 20px 0;
    padding: 18px 20px;
    background: var(--color-surface-subtle, rgba(0, 0, 0, 0.015));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.ch-section-heading {
    margin-bottom: 16px;
}

.ch-section-heading h3 {
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text);
}

.coaching-columns-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 860px) {
    .coaching-columns-grid {
        grid-template-columns: 1fr;
    }
}

.coaching-column {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.coaching-col-header {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border-subtle, var(--color-border));
}

.coaching-col-header h4 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
}

.coaching-col-header.is-strength {
    background: rgba(34, 197, 94, 0.08);
    color: #15803d;
}

.coaching-col-header.is-improvement {
    background: rgba(234, 179, 8, 0.08);
    color: #a16207;
}

.coaching-items-list {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.coaching-item-card {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-subtle, var(--color-border));
    background: var(--color-surface);
    font-size: 0.84rem;
}

.coaching-item-card.is-strength {
    border-left: 3px solid #22c55e;
}

.coaching-item-card.is-improvement {
    border-left: 3px solid #eab308;
}

.ci-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.ci-title {
    font-size: 0.84rem;
    color: var(--color-text);
}

.ci-remark {
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.ci-evidence {
    font-style: italic;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    padding-left: 6px;
    border-left: 2px solid var(--color-border-subtle, var(--color-border));
}

.coaching-upsell-strip {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.cus-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    color: var(--color-text);
}

.cus-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.84rem;
    flex-wrap: wrap;
}

.cus-remark {
    color: var(--color-text-secondary);
}

.cus-evidence {
    font-style: italic;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

/* ==========================================================================
   Pipeline > Prompts (CP-107) - the split-view system prompt editor.
   ========================================================================== */
.prompt-split {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.prompt-list {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-list-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
}

.prompt-list-item:hover { background: var(--color-bg-subtle); }

.prompt-list-item.active {
    border-color: var(--color-accent);
    background: var(--color-bg-subtle);
}

.prompt-list-title { font-weight: 600; }

.prompt-list-summary {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.prompt-editor {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prompt-meta h3 {
    margin: 0 0 10px;
    font-size: 1.05rem;
}

.prompt-meta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.prompt-meta-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.prompt-summary-view {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 6px 0 10px;
    padding: 10px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.prompt-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.prompt-meta-row .checkbox-label.is-fixed {
    color: var(--color-text-muted);
}

.prompt-body-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
}

.prompt-mode-btn {
    padding: 6px 14px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    background: none;
    color: var(--color-text-muted);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: -1px;
}

.prompt-mode-btn.active {
    color: var(--color-text);
    border-color: var(--color-border);
    background: var(--color-surface);
}

.prompt-body-textarea {
    width: 100%;
    min-height: 26rem;
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    resize: vertical;
    box-sizing: border-box;
}

.prompt-body-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.prompt-body-preview {
    min-height: 26rem;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    overflow-y: auto;
}

.prompt-body-preview :is(h3, h4, h5) { margin: 0.8em 0 0.3em; }
.prompt-body-preview p { margin: 0 0 0.6em; line-height: 1.6; }
.prompt-body-preview ul { margin: 0 0 0.6em; padding-left: 1.4em; }
.prompt-body-preview li { line-height: 1.6; }

@media (max-width: 800px) {
    .prompt-split { flex-direction: column; }
    .prompt-list { flex: 1 1 auto; width: 100%; }
}

/* --- Calibration Method Comparison Section (CP-145) --- */
.calib-comparison-delta-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.cc-banner-headline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cc-banner-scores {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.cc-banner-score-item {
    display: flex;
    flex-direction: column;
}

.cc-banner-score-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.cc-banner-score-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}

.calib-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.calib-method-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.calib-method-card.is-ai {
    border-top: 3px solid var(--color-accent);
}

.calib-method-card.is-human {
    border-top: 3px solid var(--accent-info);
}

.calib-method-card-header {
    padding: 12px 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.calib-method-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.calib-method-card-footer {
    padding: 10px 16px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
}

/* New Calibration modal: the matching-call count, banded like the calibration rings */
.new-calibration-count {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
    font-weight: var(--font-weight-strong);
    margin: 0.75rem 0;
}
.new-calibration-count--success { background: var(--accent-success-bg); color: var(--on-success); }
.new-calibration-count--danger { background: var(--accent-danger-bg); color: var(--on-danger); }
.new-calibration-title { display: flex; align-items: center; gap: 0.5rem; }
.new-calibration-quote {
    margin: 0.75rem 0;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    background: var(--color-bg-subtle);
    font-size: 0.93rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.new-calibration-quote .quote-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 0.75rem; }
.new-calibration-quote .quote-title { margin: 0; font-size: 1rem; font-weight: 600; }
.new-calibration-quote .quote-range { color: var(--color-text-muted); }
.new-calibration-quote .quote-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.75rem; }
.new-calibration-quote .quote-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
}
.new-calibration-quote .quote-tile-value { font-size: 1.4rem; font-weight: 600; line-height: 1.15; }
.new-calibration-quote .quote-tile-label { font-weight: var(--font-weight-strong); }
.new-calibration-quote .quote-tile-sub { color: var(--color-text-muted); font-size: 0.82rem; }
.new-calibration-quote .quote-section-title { margin: 0 0 0.5rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text-muted); }
.new-calibration-quote .quote-steps { display: flex; flex-direction: column; gap: 0.5rem; }
.new-calibration-quote .quote-step { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr 3rem; align-items: center; gap: 0.75rem; }
.new-calibration-quote .quote-step-count { text-align: right; font-weight: var(--font-weight-strong); }
.new-calibration-quote .quote-step-bar { height: 0.5rem; border-radius: 999px; background: var(--color-border); overflow: hidden; }
.new-calibration-quote .quote-step-bar span { display: block; height: 100%; width: calc(var(--pct, 0) * 1%); background: var(--color-accent-fill); border-radius: 999px; }
#newCalibrationModalBackdrop .modal-body .form-group + .form-group { margin-top: 1rem; }
.busy-row { display: flex; align-items: center; gap: 0.75rem; font-weight: var(--font-weight-strong); }
.busy-elapsed { margin-left: auto; color: var(--color-text-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.busy-spinner {
    flex: none;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-text);
    animation: busy-spin 0.8s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .busy-spinner { animation-duration: 2.4s; } }
#newCalibrationCreateBtn:disabled { background: var(--color-border); color: var(--color-text-muted); opacity: 1; }
#newCalibrationModalBackdrop .field-hint { display: block; margin-top: 0.25rem; }
@media (max-width: 560px) {
    .new-calibration-quote .quote-step { grid-template-columns: 1fr 3rem; }
    .new-calibration-quote .quote-step-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* Date-range calendar (New Calibration): two months, one click for each end of the range. */
.range-cal { border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); padding: 0.75rem; }
.range-cal-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.75rem; }
.range-cal-field { position: relative; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.5rem 3rem 0.5rem 0.75rem; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg); cursor: pointer; }
.range-cal-field.is-active { border-color: var(--color-accent-fill); outline: 2px solid var(--color-accent-soft); }
.range-cal-field-label { font-size: 0.8rem; color: var(--color-text-muted); }
.range-cal-field-value { font-weight: 600; color: var(--color-text); }
.range-cal-field-value.is-empty { font-weight: 400; color: var(--color-text-muted); }
.range-cal-field-clear { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); width: 2.1rem; height: 2.1rem; border: 0; border-radius: 999px; background: none; color: var(--color-text); cursor: pointer; line-height: 1; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.range-cal-field-clear { font-size: 0; }
.range-cal-field-clear::before, .range-cal-field-clear::after { content: ''; position: absolute; top: 50%; left: 50%; width: 1rem; height: 2.5px; border-radius: 1px; background: currentColor; }
.range-cal-field-clear::before { transform: translate(-50%, -50%) rotate(45deg); }
.range-cal-field-clear::after { transform: translate(-50%, -50%) rotate(-45deg); }
.range-cal-field-clear:hover { background: none; opacity: 0.7; }
.range-cal-months { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.range-cal-month-head { display: grid; grid-template-columns: 2rem 1fr 2rem; align-items: center; margin-bottom: 0.4rem; text-align: center; font-weight: 600; }
.range-cal-nav { background: none; border: 0; color: var(--color-text); cursor: pointer; border-radius: 6px; height: 2rem; font-size: 1.1rem; }
.range-cal-nav:hover:not(:disabled) { background: var(--color-bg-subtle); }
.range-cal-nav:disabled { color: var(--color-text-muted); opacity: 0.4; cursor: default; }
.range-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.range-cal-dow { text-align: center; font-size: 0.8rem; color: var(--color-text-muted); padding: 0.25rem 0; }
.range-cal-day { position: relative; border: 0; background: none; color: var(--color-text); font: inherit; font-weight: 600; height: 2.2rem; padding: 0; cursor: pointer; }
.range-cal-day:disabled { color: var(--color-text-muted); opacity: 0.45; font-weight: 400; cursor: default; }
.range-cal-day.is-in-range { background: var(--color-accent-soft); }
.range-cal-day.is-start { border-radius: 999px 0 0 999px; }
.range-cal-day.is-end { border-radius: 0 999px 999px 0; }
.range-cal-day.is-start.is-end { border-radius: 999px; }
.range-cal-day.is-start, .range-cal-day.is-end { background: var(--color-accent-fill); color: var(--color-on-accent); }
.range-cal-day:not(:disabled):not(.is-start):not(.is-end):hover { background: var(--color-bg-subtle); border-radius: 999px; }
.range-cal-day.is-week-hover:not(.is-start):not(.is-end) { background: var(--color-accent-soft); }
.range-cal-day.is-week-hover:not(.is-start):not(.is-end):not(:disabled):hover { background: var(--color-accent-soft); border-radius: 0; }
.range-cal-mode { display: inline-flex; gap: 2px; padding: 2px; margin-bottom: 0.75rem; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg); }
.range-cal-mode-btn { border: 0; border-radius: 6px; background: none; color: var(--color-text-muted); font: inherit; font-weight: 600; padding: 0.3rem 0.8rem; cursor: pointer; }
.range-cal-mode-btn:hover:not(.is-active) { background: var(--color-bg-subtle); color: var(--color-text); }
.range-cal-mode-btn.is-active { background: var(--color-accent-fill); color: var(--color-on-accent); }
.range-cal-field--week, .range-cal-field--day { border-color: var(--chart-cat-3); background: var(--accent-purple); }
.range-cal-field--week.is-filled { border-color: var(--accent-warning); background: var(--accent-warning-bg); }
.range-cal-field--day.is-filled { border-color: var(--accent-success); background: var(--accent-success-bg); }
.range-cal-field--week.is-active, .range-cal-field--day.is-active { --sched-pulse: var(--chart-cat-3); background: color-mix(in srgb, var(--sched-pulse) 30%, transparent); border-color: var(--sched-pulse); outline: 2px solid var(--sched-pulse); animation: sched-field-pulse 1.4s ease-in-out infinite; }
.range-cal-field--week.is-filled.is-active { --sched-pulse: var(--accent-warning); }
.range-cal-field--week:not(.is-filled), .range-cal-field--day:not(.is-filled), .range-cal-field--week:not(.is-filled).is-active, .range-cal-field--day:not(.is-filled).is-active { background: color-mix(in srgb, var(--chart-cat-3) 25%, black); }
.range-cal-field--week:not(.is-filled) .range-cal-field-label, .range-cal-field--day:not(.is-filled) .range-cal-field-label, .range-cal-field--week:not(.is-filled) .range-cal-field-value, .range-cal-field--day:not(.is-filled) .range-cal-field-value { color: white; }
.range-cal-field--day.is-filled.is-active { --sched-pulse: var(--accent-success); }
@keyframes sched-field-pulse { 0%, 100% { outline-offset: 0; outline-color: var(--sched-pulse); } 50% { outline-offset: 4px; outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .range-cal-field--week.is-active, .range-cal-field--day.is-active { animation: none; } }
.range-cal-day.is-sched-week { background: var(--accent-warning-bg); }
.range-cal-day.is-sched-week-hover:not(.is-sched-day), .range-cal-day.is-sched-week-hover:not(.is-sched-day):not(:disabled):hover { background: color-mix(in srgb, var(--accent-warning-bg) 75%, transparent); border-radius: 0; }
.range-cal-day.is-sched-week-hover.is-sched-hover-first:not(.is-sched-day):not(:disabled):hover, .range-cal-day.is-sched-week-hover.is-sched-hover-first:not(.is-sched-day) { border-radius: 999px 0 0 999px; }
.range-cal-day.is-sched-week-hover.is-sched-hover-last:not(.is-sched-day):not(:disabled):hover, .range-cal-day.is-sched-week-hover.is-sched-hover-last:not(.is-sched-day) { border-radius: 0 999px 999px 0; }
.range-cal-day.is-sched-week-start { background: var(--accent-warning); color: var(--color-bg); border-radius: 999px 0 0 999px; }
.range-cal-day.is-sched-week-end:not(.is-sched-day):not(.is-sched-week-hover), .range-cal-day.is-sched-week-end:not(.is-sched-day):not(.is-sched-week-hover):not(:disabled):hover { border-radius: 0 999px 999px 0; }
.range-cal-day.is-sched-day, .range-cal-day.is-sched-day:hover { background: var(--accent-success); color: var(--color-bg); border-radius: 999px; }
.range-cal-day.is-sched-day:not(:disabled):not(.is-start):not(.is-end):hover { background: color-mix(in srgb, var(--accent-success) 88%, transparent); color: var(--color-bg); border-radius: 999px; }
.range-cal-day.is-this-week::after { content: ''; position: absolute; inset: 0; border: solid var(--color-text); border-width: 2px 0; pointer-events: none; }
.range-cal-day.is-this-week-first::after { border-left-width: 2px; border-radius: 999px 0 0 999px; }
.range-cal-day.is-this-week-last::after { border-right-width: 2px; border-radius: 0 999px 999px 0; }
.sched-swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 3px; vertical-align: -1px; }
.sched-swatch--week { background: var(--accent-warning); }
.sched-swatch--day { background: var(--accent-success); margin-left: 0.75rem; }
@media (max-width: 560px) { .range-cal-months { grid-template-columns: 1fr; } }

/* --- Fetches page (CP-208) ---------------------------------------------------------------
   Layout and organisation from docs/design/fetch page/, rendered in this application's own
   tokens: every colour is a palette variable, so all four skin/theme combinations hold, and
   depth is a border plus a background step - nothing here casts a shadow of its own. */
.fetch-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    overflow: visible;
}
.fetch-header-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fetch-header-title { display: flex; align-items: center; gap: 10px; }
.fetch-header-title h1 { margin: 0; font-size: 1.6rem; line-height: 1.15; font-weight: 600; }
.fetch-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.fetch-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.fetch-pills .badge, .fetch-card-badges .badge, .fetch-badge-lg { gap: 6px; }
.fetch-badge-lg { padding: 6px 10px; }

.badge-run { background: var(--color-accent-soft); color: var(--color-accent-text); }
.badge-outline { background: transparent; color: var(--color-text-secondary); border: 1px solid var(--color-border); padding: 2px 7px; }

.fetch-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.fetch-dot-pulse { animation: fetch-pulse 1.4s ease-in-out infinite; }
@keyframes fetch-pulse { 50% { opacity: 0.3; } }

.fetch-label {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.fetch-mono { font-family: var(--font-mono); font-size: 0.92em; }
.fetch-hint { margin: 0; font-size: 0.8rem; color: var(--color-text-muted); }

.fetch-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 32px 24px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg-subtle);
    color: var(--color-text-muted);
    text-align: center;
}
.fetch-empty p { margin: 0; color: var(--color-text); }

.fetch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
    gap: 20px;
    align-items: start;
    margin-bottom: 24px;
}
.fetch-grid .fetch-card { margin-bottom: 0; }
.fetch-card-body { display: flex; flex-direction: column; gap: 18px; padding: 22px 24px; }
.fetch-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fetch-card-title { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.fetch-card-title h2 { margin: 0; font-size: 1.15rem; line-height: 1.3; font-weight: 600; }
.fetch-card-title p { margin: 0; color: var(--color-text-muted); max-width: 64ch; }
.fetch-card-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.fetch-walk { display: flex; flex-direction: column; gap: 8px; }
.fetch-walk-bar { display: flex; gap: 3px; }
.fetch-walk-seg {
    flex: 1 1 0;
    min-width: 0;
    height: 10px;
    border-radius: var(--radius-xs);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
}
.fetch-walk-seg.is-done { background: var(--color-accent-fill); border-color: var(--color-accent-fill); }
.fetch-walk-seg.is-fin { background: var(--color-text-muted); border-color: var(--color-text-muted); opacity: 0.55; }
.fetch-walk-seg.is-err { background: var(--accent-danger-bg); border-color: var(--accent-danger); }
.fetch-walk-seg.is-now {
    border-color: var(--color-accent-fill);
    background-image: repeating-linear-gradient(110deg, var(--color-accent-fill) 0 5px, var(--color-accent-ring) 5px 10px);
    background-size: 20px 100%;
    animation: fetch-slide 0.8s linear infinite;
}
@keyframes fetch-slide { to { background-position: 20px 0; } }
.fetch-walk-bar.is-continuous {
    height: 10px;
    border-radius: var(--radius-xs);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    overflow: hidden;
}
.fetch-walk-fill { display: block; height: 100%; background: var(--color-accent-fill); }
.fetch-walk-fill.is-fin { background: var(--color-text-muted); opacity: 0.55; }
.fetch-walk-caption {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2px 16px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.fetch-details {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 20px;
    padding: 16px 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}
.fetch-details dd { margin: 4px 0 0; color: var(--color-text); }

.fetch-note {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}
.fetch-note-danger { background: var(--accent-danger-bg); border-color: var(--accent-danger); color: var(--on-danger); }
.fetch-note-danger .fetch-label { color: var(--on-danger); }
.fetch-note ul { margin: 4px 0 0; padding-left: 20px; }

.fetch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fetch-actions .btn { min-height: 40px; }
.btn-ghost { background: transparent; color: var(--color-text-secondary); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--color-bg-subtle); color: var(--color-text); }
.btn-secondary:disabled, .btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.fetch-card .upload-result, .fetch-archived-row .upload-result { margin: 0; }

.fetch-change { border-top: 1px solid var(--color-border); }
.fetch-change > summary,
.fetch-fold > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    list-style: none;
    cursor: pointer;
    font-weight: 600;
}
.fetch-change > summary::-webkit-details-marker,
.fetch-fold > summary::-webkit-details-marker { display: none; }
.fetch-change > summary { justify-content: space-between; min-height: 48px; padding: 0 24px; color: var(--color-text-muted); }
.fetch-change > summary:hover, .fetch-fold > summary:hover { color: var(--color-accent-text); }
.fetch-change-body { padding: 0 24px 24px; }
.fetch-change-body .upload-form { padding: 0; }
.fetch-chevron { margin-left: auto; transition: transform var(--transition); }
details[open] > summary > .fetch-chevron { transform: rotate(180deg); }

.fetch-fold > summary { min-height: 60px; padding: 0 24px; font-size: 1rem; }
.fetch-fold-body { padding: 0 24px 24px; }
.fetch-fold-body > .upload-form { padding: 0; }
.fetch-archived-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 14px 0;
    border-top: 1px solid var(--color-border);
}
.fetch-archived-row > div:first-child { flex: 1 1 320px; min-width: 0; }
.fetch-archived-row p { margin: 2px 0 0; font-size: 0.85rem; color: var(--color-text-muted); }
.fetch-archived-row .upload-result { flex-basis: 100%; }

/* The fetch form (CP-208): fields left, estimate right, submit last. */
.fetch-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    grid-template-areas: "main aside" "submit .";
    gap: 24px 32px;
    align-items: start;
}
.fetch-form-main { grid-area: main; display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.fetch-estimate { grid-area: aside; position: sticky; top: calc(var(--topbar-height) + 16px); }
.fetch-form-submit { grid-area: submit; display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 1px solid var(--color-border); }
.fetch-form-submit .form-actions { margin: 0; }
.fetch-form-submit .upload-result ul, .fetch-card .upload-result ul { margin: 4px 0 0; padding-left: 20px; }
.fetch-form-section { display: flex; flex-direction: column; gap: 16px; }
.fetch-form-heading { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--color-text); }
.fetch-form-section > .form-group { gap: 6px; }
.choice-card-input.form-group { flex-direction: row; }
.fetch-form-field { display: flex; flex-direction: column; gap: 8px; }
.fetch-form-field > .form-group { max-width: 24rem; }
.fetch-form-label { font-size: 0.875rem; font-weight: 600; color: var(--color-text); }

/* The range calendar inside the form: the two date boxes above, the months in their own inset. */
.fetch-range-cal { border: 0; padding: 0; background: none; }
.fetch-range-cal .range-cal-fields { max-width: 32rem; }
.range-cal-panel { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); padding: 16px; }
.range-cal-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.range-cal-legend { display: inline-flex; align-items: center; gap: 8px; }
.range-cal-swatch, .range-cal-day.is-recent {
    background-image: repeating-linear-gradient(135deg, var(--color-border) 0 1px, transparent 1px 6px);
}
.range-cal-swatch { width: 18px; height: 18px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); }
.range-cal-day.is-recent:not(.is-start):not(.is-end) { color: var(--color-text-secondary); } /* muted was 4.1:1 on the hatching (CC95) */

/* "How many": each option is a card; the chosen one takes the accent wash. */
.choice-cards { display: flex; flex-direction: column; gap: 10px; max-width: 40rem; }
.choice-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    cursor: pointer;
}
.choice-card:hover { border-color: var(--color-accent); }
.choice-card:has(input[type="radio"]:checked) { background: var(--color-accent-soft); border-color: var(--color-accent-fill); }
.choice-card-row { display: flex; align-items: center; gap: 12px; }
.choice-card-row input[type="radio"] { flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--color-accent-fill); }
.choice-card-title { flex: 1 1 auto; font-weight: 600; color: var(--color-text); }
.choice-card-input { display: inline-flex; align-items: center; gap: 8px; color: var(--color-text-muted); }
.choice-card-input input { width: 6.5rem; }
.choice-card-hint { padding-left: 30px; font-size: 0.8rem; color: var(--color-text-muted); }

.fetch-form-checks { gap: 12px; }
.fetch-check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.fetch-check input { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--color-accent-fill); }
.fetch-check > span { display: flex; flex-direction: column; gap: 2px; color: var(--color-text); }
.fetch-delete { color: var(--on-danger); }
.fetch-delete:hover { background: var(--accent-danger-bg); color: var(--on-danger); }

/* The estimate panel. */
.fetch-estimate {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}
.fetch-estimate [data-estimate-output] { display: flex; flex-direction: column; gap: 12px; transition: opacity var(--transition); }
.fetch-estimate [data-estimate-output].is-loading { opacity: 0.6; }
.fetch-estimate-empty {
    padding: 18px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-subtle);
    color: var(--color-text-muted);
    text-align: center;
}
.fetch-estimate-empty.is-danger { background: var(--accent-danger-bg); border-color: var(--accent-danger); color: var(--on-danger); }
.fetch-estimate-headline { margin: 0; display: flex; align-items: baseline; gap: 8px; font-weight: 600; color: var(--color-text); }
.fetch-estimate-headline > span { font-size: 2.4rem; line-height: 1; letter-spacing: -0.02em; }
.fetch-estimate-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fetch-estimate-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-subtle);
}
.fetch-estimate-tile strong { font-size: 1.1rem; font-weight: 600; color: var(--color-text); overflow-wrap: anywhere; }
.fetch-estimate-tile > span:last-child:not(.fetch-label) { font-size: 0.75rem; color: var(--color-text-muted); }
.fetch-estimate-line { margin: 0; font-size: 0.85rem; color: var(--color-text-muted); }
.fetch-estimate-processing { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--color-border); }

@media (max-width: 1000px) {
    .fetch-form-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "aside" "submit"; }
    .fetch-estimate { position: static; }
}
@media (max-width: 560px) {
    .fetch-form-submit .btn-primary { width: 100%; justify-content: center; }
    .choice-card-row { flex-wrap: wrap; }
    .choice-card-hint { padding-left: 0; }
}

/* "How fetches work" - the wide variant of the shared info modal (data-wide on the panel). */
.info-modal.info-modal-wide { width: min(60rem, calc(100vw - 32px)); max-height: min(88vh, 52rem); }
.how-lede { font-size: 1rem; color: var(--color-text); }
.how-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 24px 36px; margin: 18px 0; }
.how-columns .fetch-label { margin-bottom: 14px; }
.how-steps, .how-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.how-steps { counter-reset: how-step; }
.how-steps li { position: relative; display: flex; flex-direction: column; gap: 2px; padding-left: 46px; counter-increment: how-step; }
.how-steps li::before {
    content: counter(how-step);
    position: absolute;
    left: 0;
    top: -2px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--color-accent-soft);
    color: var(--color-accent-text);
    font-weight: 600;
}
.how-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 14px;
    top: 32px;
    bottom: -16px;
    width: 2px;
    background: var(--color-border);
}
.how-steps strong, .how-facts strong { color: var(--color-text); }
.how-facts li { display: flex; gap: 14px; }
.how-facts li > div { display: flex; flex-direction: column; gap: 2px; }
.how-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--color-bg-subtle);
    color: var(--color-text);
}
.how-more { font-size: 0.85rem; }
.how-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
    .fetch-dot-pulse, .fetch-walk-seg.is-now { animation: none; }
}
@media (max-width: 560px) {
    .fetch-header-actions, .fetch-header-actions .btn { width: 100%; justify-content: center; }
    .fetch-card-body { padding: 18px; }
    .fetch-card-badges { justify-content: flex-start; }
    .fetch-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fetch-actions .btn-primary { flex-basis: 100%; justify-content: center; }
    .fetch-actions .btn-secondary, .fetch-actions .btn-ghost { flex: 1 1 0; justify-content: center; }
    .fetch-change > summary, .fetch-fold > summary { padding: 0 18px; }
    .fetch-change-body, .fetch-fold-body { padding: 0 18px 18px; }
}

/* --- Logs (docs/prd.md CC81, CP-202) ---------------------------------------------------
   Structural classes only; every colour is a palette token so all four skin/theme
   combinations hold, and nothing here casts a shadow. The split view reuses .prompt-split. */
.logs-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin: 12px 0;
}

.logs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.logs-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.logs-filter-wide { grid-column: span 2; }
.logs-filters .filter-select, .logs-trace-search .filter-select { width: 100%; }

.logs-trace-search { display: flex; gap: 12px; align-items: flex-end; }
.logs-trace-search .logs-filter-wide { flex: 1 1 auto; }

.logs-split { margin-bottom: 24px; }
.logs-list-card { flex: 1 1 52%; min-width: 0; }
.logs-detail-card { flex: 1 1 48%; min-width: 0; }

.log-row { cursor: pointer; }
.log-row:focus-visible { outline-offset: -2px; }
.log-row.is-selected td { background: var(--color-bg-subtle); }
.log-group-row th {
    text-align: left;
    background: var(--color-bg-subtle);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}
.log-sub { font-size: 0.8rem; color: var(--color-text-muted); }
.log-mono { font-family: var(--font-mono); font-size: 0.85em; overflow-wrap: anywhere; }

.log-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    width: 96px;
    height: 24px;
}
.log-bar { flex: 1 1 0; background: var(--accent-danger); border-radius: 1px; }
.log-bar-zero { background: var(--color-border); }

.log-attention {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--color-border);
}
.log-attention:first-child { border-top: 0; padding-top: 0; }
.log-attention-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.log-attention-text span { font-size: 0.85rem; color: var(--color-text-secondary); }

.log-detail h3 { margin: 4px 0 2px; font-size: 1.15rem; }
.log-detail h4 { margin: 18px 0 6px; font-size: 0.85rem; color: var(--color-text-secondary); }
.log-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.log-advice {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--accent-info-bg);
}
.log-advice h4 { margin-top: 0; color: var(--on-info); }
.log-advice ol, .log-advice-card ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.log-advice-card .section-header h2 { color: var(--on-info); }
.log-advice-card { background: var(--accent-info-bg); }

.log-kv-grid, .log-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px 16px;
}
.log-summary { margin-bottom: 14px; }
.log-kv { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.log-kv-label { font-size: 0.78rem; color: var(--color-text-muted); }
.log-kv-value { font-size: 0.9rem; }

.log-ref { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.log-pre {
    margin: 0;
    padding: 10px 12px;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.log-attempt {
    padding: 6px 10px;
    margin-bottom: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.log-attempt.is-current { border-color: var(--color-accent); }
.log-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--color-border); }
.log-actions-top { margin: 0 0 12px; padding-top: 0; border-top: 0; }
.log-check-col { width: 32px; padding-right: 0; }
.log-check-col input { cursor: pointer; }
.logs-selbar { display: inline-flex; align-items: center; gap: 8px; }
.logs-export-fields { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.logs-export-count { font-weight: var(--font-weight-strong); margin: 14px 0 8px; }
.logs-export-count.is-error { border-left: 3px solid var(--color-danger); padding-left: 10px; }
.btn.disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--color-accent-text); text-decoration: underline; cursor: pointer; }

.log-steps { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.log-step {
    flex: 1 1 240px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.log-step.is-open { border-style: dashed; }
.log-step h3 { margin: 0; font-size: 1.05rem; }
.log-step-head { display: flex; justify-content: space-between; align-items: center; }
.log-step-arrow { align-self: center; color: var(--color-text-muted); font-size: 1.3rem; }
.log-retries { margin-top: 4px; }

.log-timebar {
    display: flex;
    height: 18px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    overflow: hidden;
    background: var(--color-bg-subtle);
}
.log-seg { display: block; height: 100%; }
.log-seg-1 { background: var(--chart-cat-1); }
.log-seg-2 { background: var(--chart-cat-2); }
.log-seg-3 { background: var(--chart-cat-3); }
.log-seg-4 { background: var(--chart-cat-4); }
.log-legend { display: flex; flex-wrap: wrap; gap: 14px 28px; margin-top: 12px; }
.log-legend-item { display: flex; gap: 8px; align-items: flex-start; font-size: 0.9rem; }
.log-swatch { flex: 0 0 12px; height: 12px; margin-top: 4px; border-radius: 3px; }
.log-retry-row td { color: var(--color-text-secondary); }

@media (max-width: 900px) {
    .logs-split { flex-direction: column; }
    .logs-list-card, .logs-detail-card { flex-basis: auto; width: 100%; }
    .logs-filter-wide { grid-column: auto; }
}

/* Remove from Progress (CP-213): the inline confirm sits in the fetch card's header. */
.progress-remove-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-right: 12px; }
.progress-remove-text { font-size: 0.78rem; color: var(--color-text-secondary); max-width: 46ch; }

/* Time remaining on a processing operator calibration set (Operator Calibration Sets, Export cell).
   Colour comes from palette tokens only; the stripe reuses the fetch walk's sliding-stripe idea. */
.eta-timer { display: flex; flex-direction: column; gap: 4px; min-width: 150px; margin-bottom: 8px; }
.eta-timer-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.eta-timer-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-accent-fill); animation: fetch-pulse 1.4s ease-in-out infinite; }
.eta-timer-value {
    font-size: 1.45rem;
    line-height: 1.1;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}
.eta-timer-finish { font-size: 0.95rem; color: var(--color-text); }
.eta-timer-finish strong { font-weight: var(--font-weight-strong); font-variant-numeric: tabular-nums; }
.eta-timer-queue { font-size: 0.75rem; color: var(--color-text-muted); max-width: 26ch; }
.eta-timer-bar {
    display: block;
    height: 6px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-subtle);
    background-image: repeating-linear-gradient(110deg, var(--color-accent-fill) 0 5px, var(--color-accent-ring) 5px 10px);
    background-size: 20px 100%;
    animation: fetch-slide 0.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
    .eta-timer-dot, .eta-timer-bar { animation: none; }
}

/* Full-page waiting state while a calibration set is created: the spinner is 15% of the screen's
   shorter side and sits dead centre. Above every modal (200-300). No backdrop blur: it softened the
   whole screen, and the ring is a vector stroke so it stays sharp. */
.working-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background: color-mix(in srgb, var(--color-bg) 85%, transparent);
}
.working-overlay[hidden] { display: none; }
.working-spinner {
    width: 15vmin;
    height: 15vmin;
    min-width: 72px;
    min-height: 72px;
    shape-rendering: geometricPrecision;
    animation: busy-spin 1s linear infinite;
}
.working-track, .working-arc { stroke-width: 8; }
.working-track { stroke: var(--color-border); }
.working-arc { stroke: var(--color-accent-fill); stroke-linecap: round; stroke-dasharray: 28 72; }
.working-label { max-width: 40ch; text-align: center; font-size: 1.1rem; font-weight: var(--font-weight-strong); color: var(--color-text); }
@media (prefers-reduced-motion: reduce) { .working-spinner { animation-duration: 3s; } }

/* ============================================================================
   Auditor dashboard redesign (CP-239) - PIN gate. Tokens only, so it follows
   both skins and both modes; the mockup's own values are the Indigo & Glass
   tokens already defined above.
   ============================================================================ */
.pulse-dot {
    display: inline-block;
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-success);
    animation: ccPulse 1.8s infinite;
}
.pulse-dot.warn {
    background: var(--accent-warning);
    animation-name: ccPulseWarn;
}
@keyframes ccPulse {
    0% { box-shadow: 0 0 0 0 var(--pulse-success); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes ccPulseWarn {
    0% { box-shadow: 0 0 0 0 var(--pulse-warning); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.auditor-gate-portal {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0 8px;
}
.gate-wrap {
    width: 100%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
}
.gate-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid var(--color-accent-ring);
    background: var(--color-accent-soft);
    color: var(--color-accent-text);
    font-size: 0.8rem;
    font-weight: var(--font-weight-strong);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.gate-title {
    font-size: 2.3rem;
    line-height: 1.2;
    font-weight: var(--font-weight-strong);
    letter-spacing: -0.01em;
}
.gate-lede {
    max-width: 460px;
    color: var(--color-text-muted);
}
.gate-card {
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 28px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
.gate-hint {
    font-size: 0.86rem;
    color: var(--color-text-muted);
}
.gate-unlocked {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}
.gate-pin-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.gate-pin {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 12px;
}
.gate-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 68px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg-subtle);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 1.9rem;
    transition: var(--transition);
}
.gate-box.is-on {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px var(--color-accent-ring);
}
.gate-box.is-ok {
    border-color: var(--accent-success);
    background: var(--accent-success-bg);
    color: var(--on-success);
}
.gate-box.is-bad {
    border-color: var(--accent-danger);
    background: var(--accent-danger-bg);
    color: var(--on-danger);
}
/* The one real field sits invisibly over the boxes, so paste, autofill and a phone keyboard act
   on a single input. It is still the thing that takes focus, so the global ring is drawn on the
   box group instead (see :focus-within below). */
.gate-real {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
    opacity: 0;
    cursor: text;
}
.gate-pin:focus-within .gate-box.is-on { border-color: var(--color-accent); }
.gate-pin.is-shaking { animation: gateShake 0.4s; }
@keyframes gateShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}
.gate-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    font-size: 0.9rem;
    font-weight: 600;
}
.gate-msg-ok { background: var(--accent-success-bg); color: var(--on-success); }
.gate-msg-bad { background: var(--accent-danger-bg); color: var(--on-danger); }
.gate-foot {
    margin-top: 28px;
    text-align: center;
    font-size: 0.86rem;
    color: var(--color-text-muted);
}
@media (max-width: 520px) {
    .gate-box { width: 50px; height: 60px; }
    .gate-card { padding: 20px; }
    .gate-title { font-size: 1.85rem; }
}
@media (prefers-reduced-motion: reduce) {
    .gate-pin.is-shaking, .pulse-dot { animation: none; }
}

.select-wrap { position: relative; width: 100%; }
.select-wrap select { width: 100%; }

/* ============================================================================
   Auditor dashboard redesign (CP-239) - hero, stat tiles, Continue working.
   ============================================================================ */
.hero { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 24px; }
.hero .section-card { margin-bottom: 0; }
.hero-id { flex: 0 1 340px; min-width: 280px; }
.hero-start { flex: 1 1 560px; min-width: 0; }

.auditor-avatar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--color-accent-fill);
    color: var(--color-on-accent);
    font-weight: var(--font-weight-strong);
}
.id-top { display: flex; align-items: center; gap: 14px; }
.id-name { font-size: 1.07rem; font-weight: var(--font-weight-strong); line-height: 1.3; }
.id-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--on-success);
}
.id-role { font-size: 0.9rem; color: var(--color-text-muted); }
.id-facts {
    margin: 16px 0 0;
    padding: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--color-border);
}
.id-facts div { display: flex; justify-content: space-between; gap: 12px; }
.id-facts dt {
    padding-top: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.id-facts dd { min-width: 0; text-align: right; font-size: 0.9rem; overflow-wrap: anywhere; }
.id-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }

.start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.start-tile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg-subtle);
}
.start-tile .btn { align-self: flex-start; }
.tile-head { display: flex; align-items: center; gap: 12px; }
.tile-head h3 { font-size: 1rem; font-weight: 600; }
.tile-desc { flex: 1; font-size: 0.93rem; color: var(--color-text-secondary); }
.tile-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.icon-tile {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
}
.icon-tile.sm { width: 36px; height: 36px; border-radius: 10px; }
.tone-info { background: var(--accent-info-bg); color: var(--on-info); }
.tone-success { background: var(--accent-success-bg); color: var(--on-success); }
.tone-warning { background: var(--accent-warning-bg); color: var(--on-warning); }
.tone-purple { background: var(--accent-purple); color: var(--on-purple); }
.tone-cyan { background: var(--accent-cyan-bg); color: var(--accent-cyan); }
.tone-accent { background: var(--color-accent-soft); color: var(--color-accent-text); }

.stat-card { position: relative; }
.stat-card > .info-btn { position: absolute; top: 8px; right: 8px; }

.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.work-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    transition: var(--transition);
}
.work-card:hover { border-color: var(--color-accent); }
.work-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.work-op { font-size: 1rem; font-weight: 600; }
.work-meta { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.meta-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.meta-val { font-size: 0.93rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}
.bar { height: 6px; border-radius: 999px; background: var(--color-border); overflow: hidden; }
.bar > div { height: 100%; border-radius: 999px; background: var(--color-accent-fill); transition: width 0.5s; }
.work-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty { padding: 12px 0; text-align: center; color: var(--color-text-muted); }
.num { font-variant-numeric: tabular-nums; }

/* ============================================================================
   Auditor dashboard redesign (CP-239) - operator calibration sets table and
   the New Calibration modal. The status, ring, ETA and quote markup is the
   existing markup (initEtaTimers and renderQuote write into it); only its
   surroundings change.
   ============================================================================ */
.section-header .header-actions { margin-left: auto; }
.dt-strong { font-weight: 600; }
.live-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent-warning-bg);
    color: var(--on-warning);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.mini-progress {
    height: 4px;
    margin: 6px 0 4px;
    border-radius: 999px;
    background: var(--color-border);
    overflow: hidden;
}
.mini-progress > div {
    height: 100%;
    border-radius: 999px;
    background: var(--accent-warning);
    transition: width 0.5s;
}
.set-actions-cell .btn { margin: 0 6px 6px 0; }
.set-actions-cell .eta-timer { margin-bottom: 8px; }

.nc-dialog { max-width: 900px; }
.nc-dialog .modal-body { padding: 20px; }
.nc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.nc-left, .nc-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.nc-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
}
.nc-footer-hint { flex: 1; font-size: 0.86rem; color: var(--color-text-muted); }
.new-calibration-count {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
}
.new-calibration-count--success { border-color: var(--accent-success); }
.new-calibration-count--danger { border-color: var(--accent-danger); }
@media (max-width: 900px) {
    .nc-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Auditor dashboard redesign (CP-239) - audit history ---- */
.section-header-flush { border-bottom: 0; }
#calibrationSetsCard .page-tabs-sub { display: flex; flex-wrap: wrap; margin-bottom: 0; padding: 0 24px; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
#calibrationSetsCard .page-tab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; background: transparent; border-left: 0; border-right: 0; border-top: 0; cursor: pointer; font-family: inherit; }
.tab-count {
    padding: 0 7px;
    border-radius: 999px;
    background: var(--color-bg-subtle);
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 24px; }
.toolbar-note { font-size: 0.86rem; }
.seg { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-xs); overflow: hidden; }
.seg button {
    padding: 6px 14px;
    border: 0;
    background: var(--color-bg-subtle);
    color: var(--color-text-secondary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.seg button + button { border-left: 1px solid var(--color-border); }
.seg button:hover { color: var(--color-text); }
.seg button[aria-pressed="true"] { background: var(--color-accent-fill); color: var(--color-on-accent); }
.dt-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}
.dt-sort:hover { color: var(--color-accent-text); }
th[aria-sort="ascending"] .dt-sort::after { content: "\2191"; }
th[aria-sort="descending"] .dt-sort::after { content: "\2193"; }
.auditor-score { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.auditor-score-bar { display: inline-block; width: 44px; height: 6px; border-radius: 999px; background: var(--color-border); overflow: hidden; }
.auditor-score-bar > span { display: block; height: 100%; border-radius: 999px; }
.band-success { background: var(--accent-success); }
.band-warning { background: var(--accent-warning); }
.band-danger { background: var(--accent-danger); }
#calibrationSetsPager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-top: 1px solid var(--color-border);
}
#calibrationSetsPager[hidden] { display: none; }
#calibrationSetsPager .pager-status { margin-right: auto; font-size: 0.86rem; color: var(--color-text-muted); }
#calibrationSetsPager .pager-numbers { display: inline-flex; gap: 4px; }

/* Shared components for the rubric redesign (CP-250, docs/design/rubric page/). Sizes are the
   mockup's own px values: at this project's 14px root they are what the design measured. Palette
   tokens only, so every one follows both skins and both themes; anything heavier than 600 goes
   through --font-weight-strong, which is what keeps Olive & Cream at 600. */
.tone-danger { background: var(--accent-danger-bg); color: var(--on-danger); }
.tone-neutral { background: var(--accent-neutral-bg); color: var(--color-text-secondary); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; margin-bottom: 24px; }
.page-head h2 { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: var(--font-weight-strong); letter-spacing: -0.01em; line-height: 1.3; }
.page-head p { max-width: 720px; margin-top: 4px; color: var(--color-text-secondary); font-size: 13.5px; }
/* A real toggle: the checkbox is invisible but still the control, laid over the track, so
   keyboard, focus and screen readers behave as for any checkbox. */
.switch { position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px; min-width: 68px; cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--color-text-secondary); }
.switch input { position: absolute; left: 0; top: 50%; margin: -10px 0 0; width: 36px; height: 20px; opacity: 0; cursor: pointer; }
.switch .trk { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: var(--color-text-muted); transition: all var(--transition); }
.switch .trk::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--color-surface); transition: all var(--transition); }
.switch input:checked + .trk { background: var(--accent-success); }
.switch input:checked + .trk::after { left: 18px; }
.switch input:focus-visible + .trk { outline: 2px solid var(--color-accent); outline-offset: 3px; }

.cell-input { width: 100%; font-family: inherit; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); background: var(--color-surface); color: var(--color-text); font-size: 13px; outline: none; transition: all var(--transition); }
.cell-input:hover { border-color: var(--color-text-muted); }
.cell-input:focus { border-color: var(--color-accent); outline: 3px solid var(--color-accent-ring); outline-offset: 0; }
.field-error { font-size: 11.5px; font-weight: 500; color: var(--on-danger); }

/* A score as a small label (a count of answers per score, a score beside a remark). */
.chip { min-width: 22px; padding: 0 6px; border-radius: 6px; font-size: 10.5px; font-weight: 600; text-align: center; line-height: 18px; }
.chip.t3 { background: var(--accent-success-bg); color: var(--on-success); }
.chip.t2 { background: var(--accent-info-bg); color: var(--on-info); }
.chip.t1 { background: var(--accent-warning-bg); color: var(--on-warning); }
.chip.t0 { background: var(--accent-danger-bg); color: var(--on-danger); }
.chip.tNA { background: var(--accent-neutral-bg); color: var(--color-text-secondary); }
.chip.off { opacity: 0.45; text-decoration: line-through; }

/* An inline notice with a dismiss control; .banner-danger above is the full-width page one. */
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); font-size: 12.5px; font-weight: 500; }
.banner-err { background: var(--accent-danger-bg); border-color: var(--accent-danger); color: var(--on-danger); }
.banner .banner-x { margin-left: auto; }

.wt-bar { height: 8px; border-radius: 999px; background: var(--color-bg-subtle); overflow: hidden; }
.wt-bar > div { height: 100%; border-radius: 999px; background: var(--color-accent-fill); }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--color-border); font-size: 12px; color: var(--color-text-muted); }
.pager .spacer { flex: 1; }
.pager-btn { min-width: 30px; padding: 4px 8px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); background: var(--color-bg-subtle); color: var(--color-text); font-size: 11.5px; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.pager-btn:hover:not(:disabled) { border-color: var(--color-accent); }
.pager-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pager-btn[aria-current="page"] { background: var(--color-accent-fill); border-color: var(--color-accent-fill); color: var(--color-on-accent); }

/* A grid-aligned table whose column widths the row declares (--cols), for rows that carry
   controls and wrapped text and so would fight a <table>'s auto layout. */
.dt-grid { min-width: var(--min, 700px); }
.dt-grid-head, .dt-grid-row { display: grid; grid-template-columns: var(--cols); align-items: center; }
.dt-grid-head { background: var(--color-bg-subtle); }
.dt-grid-th { padding: 11px 20px; font-size: 10.5px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: 0.12em; color: var(--color-text-muted); white-space: nowrap; }
.dt-grid-row { border-top: 1px solid var(--color-border); transition: all var(--transition); }
.dt-grid-row:hover { background: var(--color-bg-subtle); }
.dt-grid-cell { padding: 12px 20px; min-width: 0; }

/* Manager rubric editor, /rubric (CC84, CP-247; redesigned CP-250). Every rule hangs off
   .rubric-page because the class names are short and generic (rail, saved, grip, share); the
   components they sit on are the shared block above. Palette tokens only. */
.rubric-page .stat-value small { font-size: 13px; font-weight: 500; color: var(--color-text-muted); }
.rubric-page .rubric-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.rubric-page .rail { position: sticky; top: 88px; display: flex; flex-direction: column; }
.rubric-page .rail .section-card { margin-bottom: 16px; }

.rubric-page .save-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-xs); font-size: 12.5px; font-weight: 600; }
.rubric-page .save-row.s-saved { background: var(--accent-success-bg); color: var(--on-success); }
.rubric-page .save-row.s-saving { background: var(--accent-info-bg); color: var(--on-info); }
.rubric-page .save-row.s-dirty { background: var(--accent-warning-bg); color: var(--on-warning); }
.rubric-page .save-row.s-error { background: var(--accent-danger-bg); color: var(--on-danger); }
.rubric-page .rail-note { margin-top: 10px; font-size: 12px; color: var(--color-text-muted); }
.rubric-page .wt-total { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.rubric-page .wt-total b { font-size: 28px; font-weight: var(--font-weight-strong); line-height: 1.1; font-variant-numeric: tabular-nums; }
.rubric-page .wt-warn { margin: 8px 0 0; font-size: 12px; color: var(--on-warning); }
.rubric-page .wt-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rubric-page .wt-row { display: grid; grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 38px; align-items: center; gap: 10px; padding: 5px 8px; margin: 0 -8px; border-radius: var(--radius-sm); color: var(--color-text); text-decoration: none; font-size: 12.5px; transition: all var(--transition); }
.rubric-page .wt-row:hover { background: var(--color-accent-soft); }
.rubric-page .wt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rubric-page .wt-pct { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.rubric-page .formula { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-xs); background: var(--color-bg-subtle); border: 1px solid var(--color-border); }
.rubric-page .formula code { display: block; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; color: var(--color-accent-text); }
.rubric-page .formula p { margin-top: 8px; font-size: 12px; color: var(--color-text-secondary); }
.rubric-page .key-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.rubric-page .q-list { padding: 16px 20px 4px; display: flex; flex-direction: column; gap: 12px; }
.rubric-page .qcard { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); scroll-margin-top: 88px; transition: all var(--transition); }
.rubric-page .qcard:hover { border-color: var(--color-text-muted); }
.rubric-page .qcard.is-off { border-style: dashed; background: var(--color-bg-subtle); }
.rubric-page .qcard.has-err { border-color: var(--accent-danger); outline: 3px solid var(--accent-danger-bg); }
.rubric-page .qcard.dragging, .rubric-page .a-row.dragging { opacity: 0.5; }
.rubric-page .q-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px 6px; }
.rubric-page .grip { flex: none; display: inline-flex; color: var(--color-text-muted); cursor: grab; }
.rubric-page .q-num { flex: none; width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--color-accent-soft); color: var(--color-accent-text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rubric-page .a-num { width: auto; min-width: 26px; padding: 0 6px; background: var(--accent-success-bg); color: var(--on-success); }
.rubric-page .qcard.is-off .q-num { background: var(--accent-neutral-bg); color: var(--color-text-secondary); }
.rubric-page .q-wording { flex: 1 1 280px; min-width: 0; }
.rubric-page .q-wording .cell-input { font-weight: 600; }
.rubric-page .qcard.is-off .q-wording .cell-input, .rubric-page .a-row.is-off .cell-input { color: var(--color-text-muted); }
.rubric-page .a-row.is-off .a-text .cell-input { text-decoration: line-through; }
.rubric-page .w-block { flex: none; display: flex; align-items: center; gap: 8px; }
.rubric-page .w-block label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-text-muted); }
.rubric-page .w-block .cell-input { width: 68px; text-align: right; font-variant-numeric: tabular-nums; }
.rubric-page .share { min-width: 36px; font-size: 12px; font-weight: 600; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.rubric-page .mv { flex: none; display: inline-flex; gap: 2px; }
.rubric-page .icon-btn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-bg-subtle); color: var(--color-text); cursor: pointer; transition: all var(--transition); }
.rubric-page .icon-btn:hover:not(:disabled) { border-color: var(--color-accent); color: var(--color-accent-text); }
.rubric-page .icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rubric-page .chev { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: var(--color-text-muted); cursor: pointer; }
.rubric-page .chev svg { transition: transform 0.2s; }
.rubric-page .chev.is-open svg { transform: rotate(180deg); }
.rubric-page .q-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 0 14px 12px 52px; font-size: 12px; color: var(--color-text-muted); }
.rubric-page .chips { display: inline-flex; gap: 4px; }
.rubric-page .saved { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--on-success); opacity: 0; transition: opacity 0.25s; }
.rubric-page .saved.on { opacity: 1; }
.rubric-page .q-err { padding: 0 14px 10px 52px; }
.rubric-page .a-panel { margin: 0 14px 14px; padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); background: var(--color-bg-subtle); display: flex; flex-direction: column; gap: 8px; }
.rubric-page .a-rows { display: flex; flex-direction: column; gap: 8px; }
.rubric-page .a-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--color-surface); border: 1px solid var(--color-border); }
.rubric-page .a-row.is-off { border-style: dashed; background: transparent; }
.rubric-page .a-row.has-err { border-color: var(--accent-danger); }
.rubric-page .a-text { flex: 1 1 260px; min-width: 0; }
.rubric-page .a-err { flex: 1 1 100%; padding: 0 4px 2px 130px; }
.rubric-page .a-empty { padding: 10px 4px; font-size: 12.5px; color: var(--color-text-muted); }
.rubric-page .add-a { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px; border: 1px dashed var(--color-text-muted); border-radius: var(--radius-sm); }
.rubric-page .add-a .a-text { flex: 1 1 240px; }
.rubric-page .add-q { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 18px 20px; border-top: 1px solid var(--color-border); background: var(--color-bg-subtle); }
.rubric-page .add-q .fld { display: flex; flex-direction: column; gap: 6px; }
.rubric-page .add-q .fld label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-secondary); }
.rubric-page .add-q .grow { flex: 1 1 320px; }
.rubric-page .add-q .wt { width: 110px; }
.rubric-page .add-hint { flex: 1 1 100%; font-size: 12px; color: var(--color-text-muted); }
.rubric-page .kind { margin-right: 8px; }
@media (max-width: 1100px) {
    .rubric-page .rubric-layout { grid-template-columns: minmax(0, 1fr); }
    .rubric-page .rail { position: static; order: -1; }
}
.rubric-page #rubricError { margin-bottom: 16px; }
.rubric-page .rail-note a { color: var(--color-accent-text); font-weight: 600; }
.rubric-page .section-header .text-muted { font-size: 12px; }
.rubric-page .rail .section-header h2 { font-size: 14px; }
.rubric-page .add-a .a-err { padding-left: 4px; }
.spinner { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--color-border); border-top-color: var(--color-accent); animation: busy-spin 0.8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* Admin rubric editor, /pipeline/rubric (CC50; redesigned CP-250). The three generic additions
   first, then everything page-specific under .rubric-admin. */
.badge-accent { background: var(--color-accent-soft); color: var(--color-accent-text); }
.banner-accent { background: var(--color-accent-soft); border-color: var(--color-accent-ring); color: var(--color-text); font-weight: 400; }
.banner-accent svg { flex: none; margin-top: 2px; color: var(--color-accent-text); }
.banner-warn { background: var(--accent-warning-bg); border-color: transparent; color: var(--on-warning); }
.info-p { font-size: 13.5px; color: var(--color-text-secondary); }

.rubric-admin .banner { margin-bottom: 24px; }
.rubric-admin .section-header .text-muted { font-size: 12px; }
.rubric-admin .cell-sub { display: block; font-size: 11.5px; line-height: 1.4; color: var(--color-text-muted); }
.rubric-admin .tpl-name { font-size: 14px; font-weight: 600; color: var(--color-text); text-decoration: none; }
.rubric-admin .tpl-name:hover { color: var(--color-accent-text); text-decoration: underline; }
.rubric-admin .tpl-name.is-sel { color: var(--color-accent-text); }
.rubric-admin .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rubric-admin .dt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rubric-admin .ok-tick { color: var(--on-success); font-weight: 600; }
.rubric-admin .mono { font-family: var(--font-mono); font-size: 11.5px; color: var(--color-accent-text); overflow-wrap: anywhere; }
.rubric-admin .rename-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 16px 16px; background: var(--color-bg-subtle); border-top: 1px dashed var(--color-border); }
.rubric-admin .rename-row .form-group, .rubric-admin .add-tpl-form .form-group { flex: 1 1 280px; max-width: 420px; }
.rubric-admin .rename-row .form-help, .rubric-admin .add-tpl-form .form-help { flex: 1 1 100%; }
.rubric-admin .dirty { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--on-warning); }
.rubric-admin .pulse-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-warning); }
.rubric-admin .add-tpl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--color-border); background: var(--color-bg-subtle); }
.rubric-admin .add-tpl-form { display: flex; flex-wrap: wrap; align-items: flex-end; flex: 1 1 auto; gap: 12px; }
#calConfirm .modal-body { display: flex; flex-direction: column; gap: 14px; }
#calConfirm .modal-footer { gap: 8px; }
#calConfirm .confirm-facts { margin: 0; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); background: var(--color-bg-subtle); display: flex; flex-direction: column; gap: 6px; }
#calConfirm .confirm-facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
#calConfirm .confirm-facts dt { color: var(--color-text-muted); }
#calConfirm .confirm-facts dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.rubric-admin .section-header.flush { border-bottom: 0; padding-bottom: 6px; }
.rubric-admin .tabs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--color-border); }
.rubric-admin .tabs-head .page-tab { display: inline-flex; align-items: center; gap: 8px; padding: 14px; font-size: 13.5px; }
.rubric-admin .tabs-head .page-tab.is-active { color: var(--color-accent-text); border-bottom-color: var(--color-accent); font-weight: 600; }
.rubric-admin .tab-count { padding: 0 7px; border-radius: 999px; background: var(--color-bg-subtle); color: var(--color-text-secondary); font-size: 11px; font-weight: 600; }
.rubric-admin .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 20px; }
.rubric-admin .toolbar .select-wrap { width: 240px; }
.rubric-admin .toolbar .grow { margin-left: auto; display: flex; gap: 8px; }
.rubric-admin .q-text { font-size: 13px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.rubric-admin .q-text.off { color: var(--color-text-muted); }
.rubric-admin .q-modified { margin-top: 4px; }
.rubric-admin .q-block.is-modified > .dt-grid-row { background: var(--color-accent-soft); }
.rubric-admin .trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rubric-admin .dt-actions.tight { gap: 2px; }
.rubric-admin .link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-accent-text); font-size: 11.5px; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.rubric-admin .link-btn:hover { background: var(--color-accent-soft); }
.rubric-admin .link-btn svg { transition: transform 0.2s; }
.rubric-admin .link-btn.is-open svg { transform: rotate(180deg); }
.rubric-admin .rem-panel { margin: 0 16px 14px 100px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); background: var(--color-surface); display: flex; flex-direction: column; gap: 6px; }
.rubric-admin .rem-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 4px 0; }
.rubric-admin .rem-row.off .rem-text { color: var(--color-text-muted); text-decoration: line-through; }
.rubric-admin .rem-text { flex: 1 1 300px; min-width: 0; font-size: 12.5px; }
.rubric-admin .rem-row .btn-sm { padding: 3px 10px; font-size: 10.5px; }
.rubric-admin .pager-buttons { display: inline-flex; gap: 4px; }
.rubric-admin .empty { padding: 28px 20px; }
.rubric-admin .pending { position: sticky; bottom: 16px; z-index: 40; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 24px; border: 1px solid var(--accent-warning); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow-md); }
.rubric-admin .pending .msg { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; }
.rubric-admin .pending .sp { flex: 1; font-size: 12px; color: var(--color-text-muted); }
.rubric-admin .pending .upload-result { margin: 0; }

.rubric-admin .tree { padding: 8px 20px 20px; }
.rubric-admin .t-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); }
.rubric-admin .t-row:hover { background: var(--color-bg-subtle); }
.rubric-admin .t-cat { margin-top: 8px; font-weight: 600; }
.rubric-admin .t-q { margin-left: 28px; }
.rubric-admin .t-r { margin-left: 60px; padding-top: 4px; padding-bottom: 4px; }
.rubric-admin .t-row.off { border: 1px dashed var(--color-border); }
.rubric-admin .t-row.off .t-text { color: var(--color-text-muted); }
.rubric-admin .t-r.off .t-text { text-decoration: line-through; }
.rubric-admin .t-text { flex: 1; min-width: 0; font-size: 13px; }
.rubric-admin .cell-sub-inline { font-size: 11.5px; }
.rubric-admin .t-chev { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: var(--color-text-muted); cursor: pointer; }
.rubric-admin .t-chev:hover { background: var(--color-accent-soft); color: var(--color-accent-text); }
.rubric-admin .t-chev svg { transition: transform 0.2s; }
.rubric-admin .t-chev.is-open svg { transform: rotate(90deg); }
.rubric-admin .t-spacer { flex: none; width: 24px; }

#calEdit .modal-dialog.wide { max-width: 660px; }
#calEdit .modal-header h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
#calEdit .modal-body { display: flex; flex-direction: column; gap: 14px; }
#calEdit .modal-footer { gap: 8px; }
#calEdit .modal-footer .spacer { flex: 1; }
#calEdit .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#calEdit .grid-3 { display: grid; grid-template-columns: 110px 1fr 110px; gap: 14px; }
#calEdit .edit-remarks { border-top: 1px solid var(--color-border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
#calEdit .grid-remark { display: grid; grid-template-columns: 1fr 150px 80px; gap: 10px; align-items: end; }
#calEdit .edit-remarks-actions { display: flex; align-items: center; gap: 10px; }
#calEdit .dirty { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--on-warning); }
#calEdit .pulse-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-warning); }
#calEdit .ok-tick { color: var(--on-success); font-weight: 600; font-size: 12px; }
/* An open question's wording box: a textarea that fits the whole question, three lines at most,
   then it scrolls. The head and summary rows open the card, so they read as clickable. */
.rubric-page .cell-input.is-multi { display: block; resize: none; line-height: 1.5; max-height: calc(3 * 1.5em + 16px); overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.rubric-page .qcard > .q-head, .rubric-page .qcard > .q-sub { cursor: pointer; }
.rubric-page .q-head .cell-input, .rubric-page .q-head .switch, .rubric-page .q-head .icon-btn, .rubric-page .q-head .grip { cursor: auto; }
.rubric-page .q-head .switch, .rubric-page .q-head .icon-btn, .rubric-page .q-head .chev { cursor: pointer; }
.rubric-page .q-head .grip { cursor: grab; }
.rubric-page .q-head { align-items: flex-start; }
.rubric-page .q-head > .q-num, .rubric-page .q-head > .grip, .rubric-page .q-head > .w-block, .rubric-page .q-head > .switch, .rubric-page .q-head > .mv, .rubric-page .q-head > .chev { margin-top: 3px; }

/* Calibration Results' Question scores toggle (CP-331): every chip holds both readings, and one class on the
   grid decides which shows, so switching redraws nothing. */
.calres-weighted { display: none; }
#calResGrid.is-weighted .calres-raw { display: none; }
#calResGrid.is-weighted .calres-weighted { display: inline; }

/* Set owner is an email address; keep it on one line rather than letting it wrap mid-address. */
.set-owner-cell { white-space: nowrap; }

/* The Set owner select carries `form-control`, which no rule defines, so it fell back to the
   browser's own white box - glaring on the dark theme (CC95). It takes .form-group select's
   treatment (drawn chevron, palette colours), sized down for a table row. */
.set-owner-select {
    appearance: none;
    -webkit-appearance: none;
    max-width: 12rem;
    padding: 5px 1.9rem 5px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    background-color: var(--color-bg-subtle);
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
        linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
    background-position: calc(100% - 0.95rem) center, calc(100% - 0.7rem) center;
    background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
    background-repeat: no-repeat;
    color: var(--color-text);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--transition);
}

.set-owner-select:hover,
.set-owner-select:focus {
    border-color: var(--color-accent);
}

/* Calibration Results, /calibration-results (CC86, redesigned CP-264 from docs/design/calibration results page/).
   The table is the shared .dt-grid; everything here hangs off .calres because the rubric page's own
   row/panel rules are scoped to .rubric-admin. Palette tokens only. */
.calres .page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; margin-bottom: 24px; }
.calres .page-head h2 { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: var(--font-weight-strong); letter-spacing: -0.01em; line-height: 1.3; }
.calres .page-head p { max-width: 760px; margin-top: 4px; color: var(--color-text-secondary); font-size: 13.5px; }
.calres .calres-filters { overflow: visible; position: relative; z-index: 20; }
.calres .toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 16px; padding: 16px 20px; }
.calres .fld { display: flex; flex-direction: column; gap: 6px; }
.calres .fld-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-secondary); }
.calres .calres-auditor, .calres .calres-operator { width: 200px; }
.calres .calres-sort { width: 220px; }
.calres .calres-search { flex: 1 1 100%; min-width: 220px; }
.calres .calres-month-btn { min-height: 38px; }
.calres .calres-range { position: relative; }
.calres .calres-range-btn, .calres .calres-select-btn { display: inline-flex; box-sizing: border-box; min-height: 38px; align-items: center; gap: 10px; min-width: 250px; padding: 10px 14px; border: 1px solid var(--color-text-muted); border-radius: var(--radius-xs); background: var(--color-bg-subtle); color: var(--color-text); font: inherit; font-size: 12.6px; font-weight: 500; font-variant-numeric: tabular-nums; cursor: pointer; transition: all var(--transition); }
.calres .calres-range-btn:hover, .calres .calres-range-btn[aria-expanded="true"], .calres .calres-select-btn:hover, .calres .calres-select-btn[aria-expanded="true"] { border-color: var(--color-accent); }
.calres .calres-range-btn .grow, .calres .calres-select-btn .grow { flex: 1; text-align: left; }
/* In-app select (initInAppSelect, CP-299): the trigger is the date window button's own rule above, so the
   three filters read as one set; this is only what the select adds - a full-width trigger and its list. */
.calres .calres-select-btn { width: 100%; min-width: 0; }
.calres .calres-select-btn .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calres .calres-select-panel { position: absolute; z-index: 70; top: calc(100% + 8px); left: 0; min-width: 100%; width: max-content; max-width: min(320px, calc(100vw - 48px)); padding: 6px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow-md); }
.calres .calres-select-list { max-height: 260px; overflow-y: auto; }
.calres .calres-select-opt { padding: 8px 10px; border-radius: var(--radius-xs); color: var(--color-text); font-size: 12.6px; cursor: pointer; }
.calres .calres-select-opt.is-active { background: var(--color-bg-subtle); }
.calres .calres-select-opt.is-selected { background: var(--color-accent-soft); font-weight: 600; }
.calres .calres-select-opt.is-selected.is-active { outline: 1px solid var(--color-accent); outline-offset: -1px; }
.calres .calres-select-empty { margin: 0; padding: 8px 10px; font-size: 12.6px; color: var(--color-text-secondary); }
.calres .calres-select-filter { box-sizing: border-box; width: 100%; margin-bottom: 6px; padding: 8px 10px; border: 1px solid var(--color-text-muted); border-radius: var(--radius-xs); background: var(--color-bg-subtle); color: var(--color-text); font: inherit; font-size: 12.6px; }
.calres .calres-select-filter:hover, .calres .calres-select-filter:focus { border-color: var(--color-accent); }
/* In-app search: the native search field's operating-system chrome (its own clear cross, rounded look) is
   switched off; the icon and clear button are ours. Focus keeps the global :focus-visible ring. */
.calres .calres-search-box { position: relative; display: flex; align-items: center; }
.calres .calres-search-icon { position: absolute; left: 14px; color: var(--color-text-muted); pointer-events: none; }
.calres .calres-search-box input[type="search"] { -webkit-appearance: none; appearance: none; box-sizing: border-box; width: 100%; min-height: 38px; padding: 10px 38px 10px 38px; border: 1px solid var(--color-text-muted); border-radius: var(--radius-xs); background: var(--color-bg-subtle); color: var(--color-text); font: inherit; font-size: 12.6px; transition: border-color var(--transition); }
.calres .calres-search-box input[type="search"]::-webkit-search-cancel-button, .calres .calres-search-box input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.calres .calres-search-box input[type="search"]::placeholder { color: var(--color-text-secondary); opacity: 1; }
.calres .calres-search-box input[type="search"]:hover, .calres .calres-search-box input[type="search"]:focus { border-color: var(--color-accent); }
.calres .calres-search-clear { position: absolute; right: 6px; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--radius-xs); background: none; color: var(--color-text); font-size: 18px; line-height: 1; cursor: pointer; }
.calres .calres-search-clear:hover { background: var(--color-surface); }
.calres .calres-range-panel { position: absolute; z-index: 70; top: calc(100% + 8px); left: 0; width: 560px; max-width: calc(100vw - 48px); padding: 16px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); box-shadow: var(--shadow-md); }
.calres .calres-range-panel .range-cal { border: 0; padding: 0; background: transparent; }
.calres .calres-hint { min-height: 20px; margin: 0 0 8px; font-size: 12px; color: var(--color-text-muted); }
.calres .calres-range-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; }
.calres .range-cal-field-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-secondary); }
.calres .range-cal-day.is-today:not(.is-start):not(.is-end) { box-shadow: inset 0 0 0 1px var(--color-accent); border-radius: var(--radius-xs); }
.calres .section-header .badge { margin-left: auto; }
.calres .calres-spinner { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--color-border); border-top-color: var(--color-accent); animation: calres-spin 0.8s linear infinite; }
.calres .calres-spinner.is-lg { width: 28px; height: 28px; border-width: 3px; }
.calres .calres-loading { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 20px; text-align: center; color: var(--color-text-muted); }
.calres .calres-loading b { font-size: 15px; color: var(--color-text); }
.calres .calres-loading[hidden] { display: none; }
@keyframes calres-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .calres .calres-spinner { animation: none; } }

.calres .cell-sub { display: block; font-size: 11.5px; line-height: 1.4; color: var(--color-text-muted); }
.calres .mono { font-family: var(--font-mono); font-size: 11.5px; overflow-wrap: anywhere; }
.calres .num { font-variant-numeric: tabular-nums; }
.calres .trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calres .dt-grid-th, .calres .dt-grid-cell { padding-left: 16px; padding-right: 16px; }
.calres .q-block { border-top: 1px solid var(--color-border); transition: all var(--transition); }
.calres .q-block:hover { background: var(--color-bg-subtle); }
.calres .q-block.is-open { background: var(--color-accent-soft); }
.calres .q-block > .dt-grid-row { border-top: 0; }
.calres .q-block > .dt-grid-row:hover { background: transparent; }
#calResRows.is-loading .dt-grid-row { opacity: 0.45; }
.calres .calres-op { font-weight: 600; }
.calres .calres-bk { color: var(--color-accent-text); font-weight: 600; text-decoration: none; }
.calres .calres-bk:hover { text-decoration: underline; }
.calres .calres-exp { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text-muted); cursor: pointer; transition: all var(--transition); }
.calres .calres-exp:hover { background: var(--color-accent-soft); color: var(--color-accent-text); }
.calres .calres-exp svg { transition: transform 0.2s; }
.calres .calres-exp.is-open svg { transform: rotate(90deg); }
.calres .calres-score { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.calres .calres-bar { width: 44px; height: 6px; border-radius: 999px; background: var(--color-border); overflow: hidden; }
.calres .calres-bar > span { display: block; height: 100%; border-radius: 999px; }
.calres .calres-bar > .is-ok { background: var(--accent-success); }
.calres .calres-bar > .is-warn { background: var(--accent-warning); }
.calres .calres-bar > .is-bad { background: var(--accent-danger); }
.calres .calres-pct.is-ok { color: var(--on-success); }
.calres .calres-pct.is-warn { color: var(--on-warning); }
.calres .calres-pct.is-bad { color: var(--on-danger); }
.calres .calres-pct.is-none { color: var(--color-text-muted); }
.calres .calres-gap { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--color-text-secondary); }
.calres .calres-empty { padding: 48px 20px; text-align: center; color: var(--color-text-muted); }
.calres .calres-empty b { display: block; margin-bottom: 4px; font-size: 15px; color: var(--color-text); }
.calres .pager .btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.calres .calres-detail { padding: 4px 20px 20px 60px; }
.calres .calres-top { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-start; margin-bottom: 14px; }
.calres .calres-comment { flex: 1 1 420px; min-width: 0; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); background: var(--color-surface); }
.calres .calres-comment p { margin: 0; font-size: 13px; color: var(--color-text-secondary); overflow-wrap: anywhere; }
.calres .calres-lbl { display: block; margin-bottom: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--color-text-muted); }
.calres .calres-sum { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.calres .calres-cmp { border: 1px solid var(--color-border); border-radius: var(--radius-xs); background: var(--color-surface); overflow: hidden; }
.calres .calres-cmp-head, .calres .calres-cmp-row { display: grid; grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.05fr) minmax(0, 1.05fr); }
.calres .calres-cmp-head { background: var(--color-bg-subtle); }
.calres .calres-cmp-th { padding: 9px 14px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--color-text-muted); }
.calres .calres-cmp-row { border-top: 1px solid var(--color-border); }
.calres .calres-cmp-row.differs { background: var(--accent-warning-bg); }
.calres .calres-cmp-cell { padding: 12px 14px; min-width: 0; font-size: 12.5px; overflow-wrap: anywhere; }
.calres .calres-q { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.calres .calres-qn { flex: none; width: 22px; height: 22px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--color-accent-soft); color: var(--color-accent-text); font-size: 11px; font-weight: 600; }
.calres .calres-differs { margin-left: 8px; }
.calres .calres-side { display: flex; gap: 10px; align-items: flex-start; }
.calres .chip { flex: none; min-width: 40px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.calres .calres-remark { color: var(--color-text); line-height: 1.45; }
.calres .calres-note, .calres .calres-evid { margin-top: 8px; }
.calres .calres-note { color: var(--color-text-secondary); }
.calres .calres-evid { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--color-bg-subtle); color: var(--color-text-secondary); }
.calres .calres-evid q { font-style: italic; quotes: none; }
.calres .calres-note b, .calres .calres-evid b { display: block; margin-bottom: 2px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-text-muted); }
.calres .calres-none { color: var(--color-text-muted); font-style: italic; }
/* View as (admin-only role spoof) - sidebar dropdown above the Auditor group. */
.view-as-toggle {
    display: block;
    margin: 0 0 18px;
}

.view-as-toggle .sidebar-nav-heading {
    display: block;
}

/* CC95: the option list used to be drawn in the page's scheme while the options inherited the
   always-dark sidebar's pale text: light on light. Now the sidebar follows the mode, and the
   options are painted explicitly on the sidebar's own colours, because some browsers ignore
   color-scheme on the popup. The native arrow goes with
   `appearance: none`; the wrapper draws a chevron in currentColor, so no colour leaves the palette. */
.view-as-field {
    position: relative;
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
}

.view-as-field > svg {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.view-as-field::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    pointer-events: none;
    transition: transform var(--transition);
}

.view-as-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 9px 36px 9px 38px;
    background: var(--sidebar-chip-bg);
    border: 1px solid var(--sidebar-chip-border);
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-strong);
    font: inherit;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color var(--transition), background-color var(--transition);
}

.view-as-select:hover {
    border-color: var(--sidebar-text-muted);
    background: var(--sidebar-hover-bg);
}

.view-as-select option {
    background: var(--sidebar-bg);
    color: var(--sidebar-text-strong);
}

/* Spoofing is a state the admin must not forget they are in, so it keeps the accent treatment. */
.view-as-toggle.is-spoofing .view-as-field {
    color: var(--sidebar-text-strong);
}

.view-as-toggle.is-spoofing .view-as-select {
    background: var(--sidebar-active-bg);
    border-color: var(--sidebar-active-border);
}

/* ---------------------------------------------------------------------------------------------
   Loading and error states (CC95). One block for everything a page fetches after first paint:
   an icon inside a spinning ring, a line naming what is loading, and an optional second line.
   templates/partials/loading-state.php renders it for the first paint; app.js's loadingState(),
   errorState(), loadingRow() and errorRow() render it afterwards, so the two are the same markup.
   It replaces the bare "Loading..." text, and its error form replaces the "Loading..." that used
   to stay on screen for ever when a request failed.
   --------------------------------------------------------------------------------------------- */
@keyframes cc-spin { to { transform: rotate(360deg); } }
@keyframes cc-fade-in { from { opacity: 0; } to { opacity: 1; } }

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 36px 20px;
    text-align: center;
    color: var(--color-text-muted);
    /* A short delay before it shows, so a fast answer never flashes a loader. */
    opacity: 0;
    animation: cc-fade-in 0.2s ease 0.15s forwards;
}

.loading-state-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 6px;
    border-radius: 50%;
    background: var(--color-accent-soft);
    color: var(--color-accent-text);
}

.loading-state-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--color-accent);
    border-right-color: var(--color-accent);
    animation: cc-spin 0.9s linear infinite;
}

.loading-state-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.loading-state-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.loading-state-sub {
    max-width: 48ch;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Error form: same shape, danger colours, no spin, shown at once. */
.loading-state.is-error {
    opacity: 1;
    animation: none;
}

.loading-state.is-error .loading-state-ring {
    background: var(--accent-danger-bg);
    color: var(--on-danger);
}

.loading-state.is-error .loading-state-ring::before {
    display: none;
}

/* Compact form: a row inside a table, a slide-over or a small card. */
.loading-state.is-compact {
    flex-direction: row;
    gap: 12px;
    padding: 18px 16px;
    text-align: left;
}

.loading-state.is-compact .loading-state-ring {
    width: 30px;
    height: 30px;
    margin-bottom: 0;
    flex: none;
}

.loading-state.is-compact .loading-state-ring svg {
    width: 14px;
    height: 14px;
}

.loading-state.is-compact .loading-state-title {
    font-size: 0.875rem;
}

.loading-state-cell {
    padding: 0 !important;
}

/* Inside a grid (a stats grid, a chart row) the block takes the whole row, not one column. */
.stats-grid > .loading-state,
.chart-row > .loading-state,
.progress-chunk-grid > .loading-state {
    grid-column: 1 / -1;
}

/* The dashboard's chart boxes while its overview loads: a ring where the chart will be drawn. */
.is-dashboard-loading .chart-canvas-box::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    animation: cc-spin 0.9s linear infinite;
}

/* A container reloading content it already shows (a filter change, the next page): the old rows
   stay, dimmed, instead of vanishing, and a thin bar runs along the top. Opacity only - a
   transform here would capture position: fixed descendants (see the fadeIn note above). */
.is-refreshing {
    position: relative;
    opacity: 0.55;
    pointer-events: none;
    transition: opacity var(--transition);
}

/* The call page's running-stage dot referred to stiSpin, which was never defined, so it never
   moved. A dot cannot show a rotation; it pulses instead. */
@keyframes stiSpin {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .loading-state { animation: none; opacity: 1; }
    .loading-state-ring::before { animation-duration: 2.4s; }
    .is-refreshing { transition: none; }
}

/* ---------------------------------------------------------------------------------------------
   Motion (CC95). Short (150-220ms) and only where it says something: an overlay arriving, a menu
   opening, a control answering a press. Every rule here is switched off under
   prefers-reduced-motion. None of these animations is `forwards`: each ends on the element's own
   resting style, so no transform is left behind to capture position: fixed descendants (the
   fadeIn note above). The two modals are centred by a transform, so their keyframes keep it.
   --------------------------------------------------------------------------------------------- */
@keyframes cc-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cc-slide-in-right { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes cc-menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes cc-modal-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.97); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}
@keyframes cc-modal3d-in {
    from { opacity: 0; transform: translate3d(-50%, -50%, 0) scale(0.97); }
    to { opacity: 1; transform: translate3d(-50%, -50%, 0); }
}

/* An element shown by removing `hidden` goes from display: none to displayed, which restarts its
   animation - so each of these plays on every opening with no JS. */
.info-modal-backdrop, .scope-backdrop, .jobs-backdrop, .whatsnew-backdrop {
    animation: cc-backdrop-in 0.18s ease-out;
}
.jobs-panel, .whatsnew-panel { animation: cc-slide-in-right 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.info-modal { animation: cc-modal-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.scope-modal { animation: cc-modal3d-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.scope-menu, .info-panel { animation: cc-menu-in 0.16s ease-out; }

/* Controls answer a press, and nav icons lean towards the page they open. */
.btn { transition: background-color var(--transition), border-color var(--transition), color var(--transition), transform 0.1s ease; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.nav-link:hover .nav-icon { transform: translateX(2px); }

@media (prefers-reduced-motion: reduce) {
    .info-modal-backdrop, .scope-backdrop, .jobs-backdrop, .whatsnew-backdrop,
    .jobs-panel, .whatsnew-panel, .info-modal, .scope-modal, .scope-menu, .info-panel,
    .stat-card, .section-card, .call-card {
        animation: none;
    }
    .btn, .nav-icon { transition: none; }
    .btn:active:not(:disabled), .nav-link:hover .nav-icon { transform: none; }
}

/* ==========================================================================
   AI Chat (CP-322, CC88): saved questions on the left, the exchange on the right, the composer
   along the foot of the exchange card. Tokens only; depth by borders and a background step,
   never a shadow. The small uppercase labels and the Qn chips follow the design mockups of
   2026-11-14.
   ========================================================================== */
.ai-chat {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.ai-chat-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-muted);
}

/* --- Saved questions --- */
.ai-chat-side {
    position: sticky;
    top: 88px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 112px);
}

.ai-chat-side-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
}

.ai-chat-side-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.ai-chat-side-title h2 { margin: 0; font-size: 1rem; font-weight: 600; }

.ai-chat-new { width: 100%; }

.ai-chat-history {
    flex: 1 1 auto;
    min-height: 80px;
    overflow-y: auto;
    padding: 8px;
}

.ai-chat-hi {
    display: flex;
    align-items: stretch;
    gap: 2px;
    margin-bottom: 2px;
    border-left: 3px solid transparent;
    border-radius: var(--radius-sm);
    transition: background var(--transition), border-color var(--transition);
}

.ai-chat-hi:hover { background: var(--color-bg-subtle); }

.ai-chat-hi.is-active {
    background: var(--color-accent-soft);
    border-left-color: var(--color-accent);
}

.ai-chat-hi-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 6px 9px 10px;
    border: 0;
    background: transparent;
    color: var(--color-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ai-chat-hi-main:disabled,
.ai-chat-hi-del:disabled { cursor: not-allowed; opacity: 0.6; }

.ai-chat-hi-q {
    display: block;
    font-size: 0.93rem;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.ai-chat-hi-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.ai-chat-hi-del {
    flex: 0 0 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.ai-chat-hi-del:hover:not(:disabled) { background: var(--accent-danger-bg); color: var(--on-danger); }

.ai-chat-history-empty { margin: 0; padding: 20px 12px; font-size: 0.93rem; color: var(--color-text-muted); }

.ai-chat-history .ai-chat-alert { margin: 4px; }

.ai-chat-side-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    font-size: 0.86rem;
    color: var(--color-text-muted);
}

.ai-chat-side-note svg { flex: none; margin-top: 2px; }

/* The chat's index status, and the admin's Rebuild index button (CP-329, CC89). */
.ai-chat-index {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px 14px;
    font-size: 0.86rem;
    color: var(--color-text-muted);
}

.ai-chat-index-text { min-width: 0; }

/* --- Main card --- */
.ai-chat-main .section-header {
    display: flex;
    align-items: center;
    gap: 8px 12px;
    flex-wrap: wrap;
}

.ai-chat-status { margin-left: auto; }

.ai-chat-pill { gap: 8px; }

.ai-chat-dot {
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.ai-chat-body { padding: 24px 24px 16px; }

/* Empty state: just the example questions */
.ai-chat-examples-label { margin: 0 0 8px; }

.ai-chat-examples { display: flex; flex-direction: column; gap: 8px; }

.ai-chat-example {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: 0.96rem;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.ai-chat-example:hover:not(:disabled) { border-color: var(--color-accent); background: var(--color-accent-soft); }

.ai-chat-example:disabled { opacity: 0.5; cursor: not-allowed; }

.ai-chat-example-text { flex: 1 1 auto; min-width: 0; }

.ai-chat-example svg { flex: none; color: var(--color-accent-text); }

.ai-chat-example-n {
    flex: none;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: var(--color-accent-soft);
    color: var(--color-accent-text);
    font-size: 0.79rem;
    font-weight: 600;
}

/* --- One exchange --- */
.ai-chat-exchange { display: flex; flex-direction: column; gap: 16px; }

.ai-chat-ask {
    padding: 14px 16px;
    border: 1px solid var(--color-accent-ring);
    border-radius: var(--radius-xs);
    background: var(--color-accent-soft);
}

.ai-chat-ask-text {
    margin: 0;
    font-size: 1.07rem;
    font-weight: 500;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-chat-steps-card,
.ai-chat-answer,
.ai-chat-trail {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    background: var(--color-surface);
}

.ai-chat-steps-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }

.ai-chat-steps-head .ai-chat-label { margin: 0; }

.ai-chat-link-btn {
    margin-left: auto;
    padding: 4px 6px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-accent-text);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
}

.ai-chat-link-btn:hover { background: var(--color-accent-soft); }

.ai-chat-steps {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 2px 14px 12px;
    list-style: none;
}

.ai-chat-steps li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 5px 0;
    font-size: 0.93rem;
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}

.ai-chat-si { flex: none; width: 18px; height: 20px; display: flex; align-items: center; justify-content: center; }

.ai-chat-steps li.is-active { color: var(--color-text); font-weight: 500; }

.ai-chat-steps li.is-done .ai-chat-si { color: var(--on-success); }

.ai-chat-steps li.is-failed,
.ai-chat-steps li.is-failed .ai-chat-si { color: var(--on-danger); }

.ai-chat-running { gap: 6px; }

.ai-chat-running .spinner { width: 10px; height: 10px; border-width: 2px; }

/* Notices and errors */
.ai-chat-alerts { display: flex; flex-direction: column; gap: 10px; }

.ai-chat-alerts:empty { display: none; }

.ai-chat-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid currentColor;
    border-radius: var(--radius-xs);
    font-size: 0.93rem;
    line-height: 1.5;
}

.ai-chat-alert[hidden] { display: none; }

.ai-chat-alert svg { flex: none; margin-top: 2px; }

.ai-chat-alert.is-danger { background: var(--accent-danger-bg); color: var(--on-danger); }

.ai-chat-alert.is-warning { background: var(--accent-warning-bg); color: var(--on-warning); }

.ai-chat-alert.is-info { background: var(--accent-info-bg); color: var(--on-info); }

/* The answer */
.ai-chat-answer { padding: 20px 22px 22px; line-height: 1.6; overflow-wrap: anywhere; }

.ai-chat-answer .ai-chat-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-muted);
}

.ai-chat-answer .ai-chat-section::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.ai-chat-answer > .ai-chat-section:first-child { margin-top: 0; }

.ai-chat-answer h4,
.ai-chat-answer h5,
.ai-chat-answer h6 { margin: 16px 0 6px; font-size: 1rem; font-weight: 600; }

.ai-chat-answer p,
.ai-chat-answer ul,
.ai-chat-answer ol { margin: 0 0 10px; color: var(--color-text-secondary); }

.ai-chat-answer .ai-chat-lead {
    color: var(--color-text);
    font-size: 1.14rem;
    font-weight: 500;
    line-height: 1.55;
    letter-spacing: -0.005em;
}

.ai-chat-answer strong { color: var(--color-text); font-weight: 600; }

.ai-chat-answer ul,
.ai-chat-answer ol { display: flex; flex-direction: column; gap: 6px; padding-left: 20px; }

.ai-chat-answer li::marker { color: var(--color-accent); }

.ai-chat-answer a {
    color: var(--color-accent-text);
    font-weight: 600;
    text-decoration: none;
}

.ai-chat-answer a:hover { text-decoration: underline; }

.ai-chat-answer a[href^="/transcription/call/"] { font-family: var(--font-mono); font-size: 0.86rem; }

.ai-chat-answer code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--color-bg-subtle);
    color: var(--color-text);
    font-size: 0.86rem;
}

.ai-chat-answer hr { margin: 16px 0; border: 0; border-top: 1px solid var(--color-border); }

.ai-chat-cite {
    display: inline-flex;
    align-items: center;
    margin: 0 2px;
    padding: 0 6px;
    border: 1px solid var(--color-accent-ring);
    border-radius: 5px;
    background: var(--color-accent-soft);
    color: var(--color-accent-text);
    font-family: var(--font-mono);
    font-size: 0.79rem;
    line-height: 18px;
    vertical-align: baseline;
    cursor: pointer;
    transition: border-color var(--transition);
}

.ai-chat-cite:hover { border-color: var(--color-accent); }

.ai-chat-table,
.ai-chat-result { overflow-x: auto; }

.ai-chat-table {
    margin: 0 0 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
}

.ai-chat-table table,
.ai-chat-result table { width: 100%; border-collapse: collapse; }

.ai-chat-table th,
.ai-chat-result th {
    padding: 9px 14px;
    background: var(--color-bg-subtle);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.ai-chat-table td,
.ai-chat-result td {
    padding: 8px 14px;
    border-top: 1px solid var(--color-border);
    font-size: 0.93rem;
    color: var(--color-text);
    vertical-align: top;
}

.ai-chat-table tbody tr:hover,
.ai-chat-result tbody tr:hover { background: var(--color-bg-subtle); }

.ai-chat-table .align-right,
.ai-chat-result .align-right { text-align: right; font-variant-numeric: tabular-nums; }

.ai-chat-table .align-center { text-align: center; }

.ai-chat-answer .ai-chat-cap { margin-top: 0; font-size: 0.86rem; color: var(--color-text-muted); }

.ai-chat-quote {
    margin: 10px 0 0;
    padding: 12px 14px;
    border-left: 3px solid var(--color-accent);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    background: var(--color-bg-subtle);
}

.ai-chat-quote + :not(.ai-chat-quote) { margin-top: 12px; }

.ai-chat-answer .ai-chat-qhead { margin: 0 0 8px; font-size: 0.86rem; color: var(--color-text-muted); }

.ai-chat-answer .ai-chat-qtext { margin: 4px 0 0; color: var(--color-text); }

.ai-chat-qline { display: flex; gap: 10px; margin-top: 4px; font-size: 0.96rem; color: var(--color-text); }

.ai-chat-who {
    flex: none;
    min-width: 76px;
    padding-top: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.ai-chat-who.is-customer { color: var(--color-accent-text); }

.ai-chat-code {
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    background: var(--color-bg-subtle);
    font-size: 0.86rem;
    overflow-x: auto;
}

/* The queries (the paper trail) */
.ai-chat-trail-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--color-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ai-chat-trail-toggle:hover { background: var(--color-bg-subtle); }

.ai-chat-trail-toggle svg { flex: none; color: var(--color-text-muted); transition: transform var(--transition); }

.ai-chat-trail-toggle.is-open svg { transform: rotate(90deg); }

.ai-chat-trail-title { font-size: 0.96rem; font-weight: 600; white-space: nowrap; }

.ai-chat-trail-sub { font-size: 0.89rem; color: var(--color-text-muted); }

.ai-chat-trail-body { display: flex; flex-direction: column; gap: 14px; padding: 4px 14px 16px; }

.ai-chat-trail-body[hidden] { display: none; }

.ai-chat-query {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    overflow: hidden;
    transition: border-color var(--transition), background var(--transition);
}

.ai-chat-query.is-hl { border-color: var(--color-accent); background: var(--color-accent-soft); }

.ai-chat-q-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
}

.ai-chat-qn {
    padding: 1px 8px;
    border-radius: 5px;
    background: var(--color-accent-fill);
    color: var(--color-on-accent);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 20px;
}

.ai-chat-q-meta { font-size: 0.89rem; color: var(--color-text-secondary); }

.ai-chat-sql {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre;
}

.ai-chat-query.is-failed .ai-chat-sql { border-bottom: 0; }

.ai-chat-result { max-height: 420px; overflow: auto; }

.ai-chat-result th { position: sticky; top: 0; font-family: var(--font-mono); font-size: 0.82rem; text-transform: none; letter-spacing: 0; }

.ai-chat-result td { font-family: var(--font-mono); font-size: 0.86rem; }

.ai-chat-result tbody tr:first-child td { border-top: 0; }

.ai-chat-result td.ai-chat-null { color: var(--color-text-muted); font-style: italic; }

.ai-chat-result td.ai-chat-cell-long { min-width: 320px; max-width: 640px; white-space: pre-wrap; }

.ai-chat-q-empty { margin: 0; padding: 12px 14px; font-size: 0.93rem; color: var(--color-text-muted); }

.ai-chat-q-error {
    margin: 12px 14px;
    padding: 10px 12px;
    border-radius: var(--radius-xs);
    background: var(--accent-danger-bg);
    color: var(--on-danger);
    font-family: var(--font-mono);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.ai-chat-q-more { padding: 10px 14px; border-top: 1px solid var(--color-border); }

.ai-chat-meta { margin: 0; font-size: 0.86rem; color: var(--color-text-muted); }

.ai-chat-meta:empty { display: none; }

/* --- Composer --- */
.ai-chat-composer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-subtle);
}

.ai-chat-composer textarea {
    display: block;
    width: 100%;
    min-height: 76px;
    padding: 12px 14px;
    border: 1px solid var(--color-text-muted);
    border-radius: var(--radius-xs);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    line-height: 1.5;
    resize: vertical;
    transition: border-color var(--transition);
}

.ai-chat-composer textarea:focus { border-color: var(--color-accent); }

.ai-chat-composer textarea:disabled { opacity: 0.6; cursor: not-allowed; }

.ai-chat-composer-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

.ai-chat-hint { flex: 1 1 200px; font-size: 0.86rem; color: var(--color-text-muted); }

.ai-chat-counter { font-size: 0.86rem; font-variant-numeric: tabular-nums; color: var(--on-warning); }

.ai-chat-counter[hidden] { display: none; }

#aiChatAsk .spinner { border-color: var(--color-on-accent); border-top-color: transparent; }

.ai-chat-dialog { max-width: 460px; }

.ai-chat-dialog .modal-header h3 { margin: 0; font-size: 1.14rem; font-weight: 600; }

.ai-chat-dialog .modal-body { color: var(--color-text-secondary); }

.ai-chat-dialog .modal-footer { gap: 10px; }

@media (max-width: 900px) {
    .ai-chat { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .ai-chat-side { position: static; max-height: none; }
    .ai-chat-history { max-height: 220px; }
    .ai-chat-body { padding: 16px 16px 8px; }
    .ai-chat-composer { padding: 14px 16px 16px; }
    .ai-chat-answer { padding: 16px; }
    .ai-chat-who { min-width: 0; }
    .ai-chat-qline { flex-direction: column; gap: 0; }
}
