/* =========================================================================
   QA Portal — Design System
   Fonts  : DM Sans (headings) · Source Sans 3 (body) — self-hosted WOFF2
   Theming: [data-theme="light|dark"] on <html>
   ========================================================================= */

/* Self-hosted static-weight WOFF2 fonts. See docs/fonts.md for the 11
   files that must live in /public/assets/fonts/. */

@font-face { font-family:'DM Sans'; font-weight:400; font-style:normal;  font-display:swap; src:url('/assets/fonts/DMSans-400.woff2') format('woff2'); }
@font-face { font-family:'DM Sans'; font-weight:500; font-style:normal;  font-display:swap; src:url('/assets/fonts/DMSans-500.woff2') format('woff2'); }
@font-face { font-family:'DM Sans'; font-weight:600; font-style:normal;  font-display:swap; src:url('/assets/fonts/DMSans-600.woff2') format('woff2'); }
@font-face { font-family:'DM Sans'; font-weight:700; font-style:normal;  font-display:swap; src:url('/assets/fonts/DMSans-700.woff2') format('woff2'); }
@font-face { font-family:'DM Sans'; font-weight:400; font-style:italic;  font-display:swap; src:url('/assets/fonts/DMSans-400italic.woff2') format('woff2'); }

@font-face { font-family:'Source Sans 3'; font-weight:300; font-style:normal;  font-display:swap; src:url('/assets/fonts/SourceSans3-300.woff2') format('woff2'); }
@font-face { font-family:'Source Sans 3'; font-weight:400; font-style:normal;  font-display:swap; src:url('/assets/fonts/SourceSans3-400.woff2') format('woff2'); }
@font-face { font-family:'Source Sans 3'; font-weight:500; font-style:normal;  font-display:swap; src:url('/assets/fonts/SourceSans3-500.woff2') format('woff2'); }
@font-face { font-family:'Source Sans 3'; font-weight:600; font-style:normal;  font-display:swap; src:url('/assets/fonts/SourceSans3-600.woff2') format('woff2'); }
@font-face { font-family:'Source Sans 3'; font-weight:700; font-style:normal;  font-display:swap; src:url('/assets/fonts/SourceSans3-700.woff2') format('woff2'); }
@font-face { font-family:'Source Sans 3'; font-weight:400; font-style:italic;  font-display:swap; src:url('/assets/fonts/SourceSans3-400italic.woff2') format('woff2'); }

/* =========================================================================
   Design tokens — light mode (default)
   ========================================================================= */
:root {
    /* Brand */
    --accent:           #2563EB;
    --accent-hover:     #1D4ED8;
    --accent-light:     #EFF6FF;
    --accent-border:    #BFDBFE;

    /* Semantic colours */
    --success:          #16A34A;
    --success-light:    #F0FDF4;
    --success-border:   #86EFAC;
    --warning:          #D97706;
    --warning-light:    #FFFBEB;
    --warning-border:   #FCD34D;
    --danger:           #DC2626;
    --danger-fg:        #DC2626;
    --danger-light:     #FEF2F2;
    --danger-border:    #FCA5A5;
    --delta-minor-fg:   #854D0E;
    --delta-warn-fg:    #C2410C;

    /* Surface */
    --bg:               #F8FAFC;
    --surface:          #FFFFFF;
    --surface-2:        #F1F5F9;
    --surface-3:        #E2E8F0;
    --border:           #E2E8F0;
    --border-strong:    #CBD5E1;
    --text:             #0F172A;
    --text-muted:       #64748B;
    --text-subtle:      #94A3B8;

    /* Header */
    --header-bg:        #0F172A;
    --header-text:      #F1F5F9;
    --header-muted:     #94A3B8;
    --header-hover:     rgba(255, 255, 255, .08);

    /* Elevation */
    --shadow-xs:        0 1px 2px rgba(0,0,0,.06);
    --shadow-sm:        0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:        0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px -2px rgba(0,0,0,.06);
    --shadow-lg:        0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -4px rgba(0,0,0,.06);

    /* Radii */
    --r-sm:             0.25rem;
    --r:                0.5rem;
    --r-lg:             0.75rem;
    --r-xl:             1rem;
    --r-full:           9999px;

    /* Layout */
    --header-h:         3.5rem;
    --content-max:      1280px;
}

/* =========================================================================
   Dark mode tokens
   ========================================================================= */
[data-theme="dark"] {
    --bg:               #0F172A;
    --surface:          #1E293B;
    --surface-2:        #293548;
    --surface-3:        #334155;
    --border:           #334155;
    --border-strong:    #475569;
    --text:             #F1F5F9;
    --text-muted:       #94A3B8;
    --text-subtle:      #64748B;

    --header-bg:        #080D1A;
    --header-text:      #F1F5F9;
    --header-muted:     #64748B;

    --accent:           #3B82F6;
    --accent-hover:     #2563EB;
    --accent-light:     #1E3A5F;
    --accent-border:    #1D4ED8;

    --success-light:    #052E16;
    --success-border:   #166534;
    --warning-light:    #422006;
    --warning-border:   #92400E;
    --danger-light:     #3B0A0A;
    --danger-border:    #991B1B;
    --danger-fg:        #F87171;
    --delta-minor-fg:   #FBBF24;
    --delta-warn-fg:    #FB923C;

    --shadow-xs:        0 1px 2px rgba(0,0,0,.30);
    --shadow-sm:        0 1px 3px rgba(0,0,0,.40), 0 1px 2px rgba(0,0,0,.30);
    --shadow-md:        0 4px 6px -1px rgba(0,0,0,.50), 0 2px 4px -2px rgba(0,0,0,.40);
    --shadow-lg:        0 10px 15px -3px rgba(0,0,0,.50), 0 4px 6px -4px rgba(0,0,0,.40);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--border-strong, #cbd5e1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong, #cbd5e1) var(--surface); }

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

img, svg {
    display: block;
    max-width: 100%;
}

button, input, select, textarea {
    font: inherit;
}

/* =========================================================================
   Base
   ========================================================================= */
body {
    font-family: 'Source Sans 3', 'Segoe UI', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    transition: background .15s, color .15s;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'DM Sans', 'Segoe UI', Arial, sans-serif;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =========================================================================
   App shell (authenticated layout)
   ========================================================================= */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ----- Header ----- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: var(--header-bg);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 0.75rem;
    box-shadow: 0 1px 0 rgba(255,255,255,.06);
    flex-shrink: 0;
}

.app-header__logo {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--header-text);
    text-decoration: none;
    letter-spacing: .01em;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-header__logo:hover {
    text-decoration: none;
    color: var(--header-text);
}

/* .logo-portal colours the "Portal" part of the logo wordmark */
.logo-portal { color: var(--accent); }

.app-header__spacer {
    flex: 1;
}

.app-header__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ----- Icon button (theme toggle, bell) ----- */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--r);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--header-muted);
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--header-hover);
    color: var(--header-text);
}

.icon-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* ----- Theme toggle slider ----- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--r);
    color: var(--header-muted);
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--header-hover);
    color: var(--header-text);
}

.theme-toggle__icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 1;
}

.theme-toggle__icon svg {
    width: 0.875rem;
    height: 0.875rem;
}

.theme-toggle__track {
    position: relative;
    width: 2.375rem;   /* 38 px */
    height: 1.375rem;  /* 22 px */
    background: rgba(255, 255, 255, .18);
    border-radius: var(--r-full);
    transition: background .25s;
    flex-shrink: 0;
}

[data-theme="dark"] .theme-toggle__track {
    background: var(--accent);
}

.theme-toggle__thumb {
    position: absolute;
    top: 0.1875rem;   /* 3 px — centres 16 px thumb in 22 px track */
    left: 0.1875rem;  /* 3 px */
    width: 1rem;      /* 16 px */
    height: 1rem;     /* 16 px */
    background: #fff;
    border-radius: var(--r-full);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}

/* Dark: slide = track(38) − thumb(16) − 2 × pad(6) = 16 px = 1 rem */
[data-theme="dark"] .theme-toggle__thumb {
    transform: translateX(1rem);
}

/* Auth-page variant — fixed corner button with light-bg colour context */
.auth-theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 50;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    box-shadow: var(--shadow-sm);
    padding: 0.375rem 0.625rem;
    color: var(--text-muted);
}

.auth-theme-toggle:hover {
    background: var(--surface-2);
    color: var(--text);
}

/* Track on light background defaults to a soft gray */
.auth-theme-toggle .theme-toggle__track {
    background: var(--surface-3);
}

[data-theme="dark"] .auth-theme-toggle .theme-toggle__track {
    background: var(--accent);
}

/* Thumb uses accent in light mode, white in dark mode */
.auth-theme-toggle .theme-toggle__thumb {
    background: var(--accent);
    box-shadow: none;
}

[data-theme="dark"] .auth-theme-toggle .theme-toggle__thumb {
    background: #fff;
}

/* ----- Account dropdown ----- */
.account-menu {
    position: relative;
}

.account-menu__btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.3125rem 0.5rem;
    border-radius: var(--r);
    transition: background .15s;
}

.account-menu__btn:hover {
    background: var(--header-hover);
}

.account-menu__avatar {
    width: 2rem;
    height: 2rem;
    border-radius: var(--r-full);
    background: var(--accent);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.6875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: .04em;
}

.account-menu__name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--header-text);
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu__caret {
    color: var(--header-muted);
    transition: transform .15s;
    flex-shrink: 0;
}

.account-menu__caret svg {
    width: 1rem;
    height: 1rem;
}

.account-menu__btn[aria-expanded="true"] .account-menu__caret {
    transform: rotate(180deg);
}

/* Dropdown panel */
.account-menu__panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    min-width: 15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    z-index: 200;
}

.account-menu__panel.is-open {
    display: block;
}

.account-menu__header {
    padding: 0.625rem 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.375rem;
}

.account-menu__full-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-menu__role {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.account-menu__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--r-sm);
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
    transition: background .1s;
}

.account-menu__item:hover,
.account-menu__item:focus {
    background: var(--surface-2);
    text-decoration: none;
    outline: none;
}

.account-menu__item svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--text-muted);
}

.account-menu__item--disabled {
    color: var(--text-subtle);
    cursor: not-allowed;
    pointer-events: none;
}

.account-menu__item--disabled svg {
    color: var(--text-subtle);
}

.account-menu__item--danger {
    color: var(--danger);
}

.account-menu__item--danger svg {
    color: var(--danger);
}

.account-menu__item--danger:hover {
    background: var(--danger-light);
}

.account-menu__divider {
    height: 1px;
    background: var(--border);
    margin: 0.375rem 0;
}

/* Logout form wrapping a menu item */
.account-menu__logout-form {
    margin: 0;
    padding: 0;
}

.account-menu__logout-form .account-menu__item {
    width: 100%;
}

/* =========================================================================
   Notification bell — top-bar icon, unread badge, and dropdown panel.
   Mirrors the account-menu popover; the bell reuses .icon-btn and turns gold
   (.icon-btn--alert) when unread notifications exist. The notification row
   (.notif-item) is shared by this dropdown and the /notifications page.
   ========================================================================= */
.notif-menu {
    position: relative;
}

.notif-menu__btn {
    position: relative; /* anchors the unread badge */
}

.notif-badge {
    position: absolute;
    top: 0.125rem;
    right: 0.125rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1rem;
    text-align: center;
    box-shadow: 0 0 0 2px var(--header-bg, #0F172A);
}

.notif-menu__panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}

.notif-menu__panel.is-open {
    display: block;
}

.notif-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border);
}

.notif-menu__heading {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.notif-menu__list {
    max-height: 24rem;
    overflow-y: auto;
}

.notif-menu__empty {
    padding: 1.75rem 0.875rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin: 0;
}

.notif-menu__footer {
    display: block;
    padding: 0.625rem 0.875rem;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    border-top: 1px solid var(--border);
    text-decoration: none;
}

.notif-menu__footer:hover {
    background: var(--surface-2);
    text-decoration: none;
}

/* History-page list card: flush rows clipped to the card's rounded corners, so
   full-width rows and their hover fill span edge-to-edge (no floating inset
   rectangle, no square hover inside the rounded card). Compound selector
   (.card.notif-card) so it out-specifies .card's own padding regardless of
   source order. */
.card.notif-card {
    padding: 0;
    overflow: hidden;
}

/* ----- Notification row (shared: dropdown + /notifications page) ----- */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background .1s;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover,
.notif-item:focus {
    background: var(--surface-2);
    text-decoration: none;
    outline: none;
}

/* Unread: soft accent-tinted wash (distinct from the grey hover tint) plus a
   bold title — the familiar email-inbox cue, no left bar. */
.notif-item--unread {
    background: var(--accent-light);
}

.notif-item--unread:hover {
    background: var(--accent-light);
    filter: brightness(0.97);
}

.notif-item--unread .notif-item__title {
    font-weight: 700;
}

.notif-item--compact {
    padding: 0.625rem 0.875rem;
}

.notif-item__icon {
    flex-shrink: 0;
    display: flex;
    color: var(--text-muted);
    margin-top: 0.0625rem;
}

.notif-item__icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

.notif-item--warn   .notif-item__icon { color: var(--warning); }
.notif-item--danger .notif-item__icon { color: var(--danger); }
.notif-item--info   .notif-item__icon { color: var(--accent); }

.notif-item__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.notif-item__title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.notif-item__text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.notif-item__time {
    font-size: 0.6875rem;
    color: var(--text-subtle);
    margin-top: 0.125rem;
}

.notif-item__dot {
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 0.375rem;
}

/* =========================================================================
   View Restriction indicator — top-bar icon + popover
   Only rendered when the user has a self-imposed division restriction
   (QA Analyst self-restrict feature). The icon variant uses the warning
   palette so it draws the eye and reminds the user their view is filtered.
   ========================================================================= */
.view-restriction-indicator {
    position: relative;
}

/* Active-restriction state: colour the icon stroke only (no background tint)
   so the indicator behaves like a notification bell turning red — a state
   change on the icon itself, not a button-chrome change. The default
   .icon-btn:hover still tints the background on hover for both states.
   Warm gold (#FBBF24) chosen to pop against the dark #0F172A header without
   the cautionary read of darker amber. */
.icon-btn--alert {
    color: #FBBF24;
}

.icon-btn--alert:hover {
    color: #FBBF24;
}

.view-restriction-panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.625rem;
    z-index: 200;
}

.view-restriction-panel.is-open {
    display: block;
}

/* Match the notification panel's title style (normal-case semibold in full text
   colour) so the two header popovers read as siblings. */
.view-restriction-panel__header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    padding: 0 0.125rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.view-restriction-panel__list {
    list-style: none;
    margin: 0 0 0.625rem;
    padding: 0;
    max-height: 16rem;
    overflow-y: auto;
}

.view-restriction-panel__subhead {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0 0.125rem 0.25rem;
}

.view-restriction-panel__list li {
    font-size: 0.875rem;
    color: var(--text);
    padding: 0.25rem 0.125rem;
}

.view-restriction-panel__body {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 0.625rem;
    padding: 0 0.125rem;
    line-height: 1.4;
}

.view-restriction-panel__actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.625rem;
    border-top: 1px solid var(--border);
}

/* =========================================================================
   Breadcrumb bar — full-width strip below the header
   Doubles as the action bar (export buttons etc.) on report pages
   ========================================================================= */
.breadcrumb-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    min-height: 2.625rem;
    gap: 1rem;
    flex-shrink: 0;
}

.breadcrumb-bar .breadcrumb {
    margin-bottom: 0;
}

.breadcrumb__home-link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
    line-height: 1;
    font-size: 0.8125rem;
}

.breadcrumb__home-link:hover {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb__home-link svg {
    width: 0.9375rem;
    height: 0.9375rem;
}

.breadcrumb-bar__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* =========================================================================
   Main content area
   ========================================================================= */
.site-main {
    flex: 1;
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 3rem;
}

/* ----- Page header (title + breadcrumb + actions) ----- */
.page-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.page-header__title-group {
    flex: 1;
    min-width: 0;
}

.page-header__title-group h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.page-header__subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.page-header__actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

/* ----- Breadcrumb ----- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb__sep {
    color: var(--text-subtle);
}

.breadcrumb__current {
    color: var(--text);
}

/* =========================================================================
   Cards
   ========================================================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* Title above a (possibly long) description instead of side by side. */
.card-header--stacked {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.25rem;
}

.card-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* =========================================================================
   Dashboard nav grid
   ========================================================================= */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.nav-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .1s;
    cursor: pointer;
}

.nav-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--text);
}

.nav-card__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--r);
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-card__icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.nav-card__title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.nav-card__desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* =========================================================================
   Stat cards
   ========================================================================= */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stat-card__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 0.5rem;
}

.stat-card__value {
    font-family: 'DM Sans', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card__trend {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.stat-card__trend--up   { color: var(--success); }
.stat-card__trend--down { color: var(--danger); }

/* =========================================================================
   Alerts / Flash messages
   ========================================================================= */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--r);
    font-size: 0.9375rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}

.alert svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    margin-top: .15rem;
}

.alert ul {
    margin: 0.25rem 0 0 1.25rem;
}

.alert-success {
    background: var(--success-light);
    border-color: var(--success-border);
    color: var(--success);
}

.alert-error,
.alert-danger {
    background: var(--danger-light);
    border-color: var(--danger-border);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    border-color: var(--warning-border);
    color: var(--warning);
}

.alert-info {
    background: var(--accent-light);
    border-color: var(--accent-border);
    color: var(--accent);
}

/* =========================================================================
   Forms
   ========================================================================= */
.form-group {
    margin-bottom: 1.125rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.375rem;
}

/* Input wrapper — positions icons and password toggle relative to the input */
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap .input-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-subtle);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.input-wrap .input-icon svg {
    width: 1rem;
    height: 1rem;
}

/* When the wrapper has an icon, indent the input text */
.input-wrap .form-control {
    padding-left: 2.5rem;
}

/* Password show/hide toggle */
.pw-toggle {
    position: absolute;
    right: 0.625rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.375rem;
    border-radius: var(--r-sm);
    transition: color .1s, background .1s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    line-height: 1;
}

.pw-toggle:hover {
    color: var(--text);
    background: var(--surface-2);
}

.pw-toggle svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* Extra right padding when there's a pw-toggle inside the wrapper */
.input-wrap--pw .form-control {
    padding-right: 4rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
    -webkit-appearance: none;
}

.form-control::placeholder {
    color: var(--text-subtle);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

[data-theme="dark"] .form-control:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .2);
}

.form-control:disabled {
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-control.is-invalid,
.form-control[aria-invalid="true"] {
    border-color: var(--danger-fg);
}
.form-control.is-invalid:focus,
.form-control[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .15);
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

/* Checkbox row */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-check input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.form-check input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: .5;
}

/* Password requirements callout */
.password-rules {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--r);
    padding: 0.75rem 1rem 0.75rem 1.25rem;
    margin: 0 0 1.25rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.85;
}

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.25rem;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--r);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover {
    text-decoration: none;
}

.btn:disabled,
.btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

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

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

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

.btn-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
    color: #fff;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 0.3125rem 0.75rem;
    font-size: 0.875rem;
}

/* =========================================================================
   Badges
   ========================================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--r-full);
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); border-color: var(--success-border); }
.badge-warning { background: var(--warning-light); color: var(--warning); border-color: var(--warning-border); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  border-color: var(--danger-border); }
.badge-neutral { background: var(--surface-2);     color: var(--text-muted); border-color: var(--border); }
.badge-circle  { background: var(--surface-2); color: var(--text); border-color: var(--border); min-width: 1.75rem; justify-content: center; padding: .125rem .375rem; }
.badge-accent  { background: var(--accent-light);  color: var(--accent);  border-color: var(--accent-border); }

/* =========================================================================
   Tables
   ========================================================================= */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.table th {
    padding: 0.75rem 1rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: left;
}

.table td {
    padding: 0.75rem 1rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table:not(.calib-oc) tbody tr:hover td {
    background: var(--surface-2);
}

.table--striped tbody tr:nth-child(even) td {
    background: var(--surface-2);
}

.table tfoot th {
    padding: 0.75rem 1rem;
    font-family: 'DM Sans', sans-serif;
    font-size: .8125rem;
    font-weight: 700;
    border-top: 2px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.table:not(.table--compact) .row--zero td {
    color: var(--text-muted);
    font-style: italic;
}

/* =========================================================================
   Progress bar
   ========================================================================= */
.progress-bar {
    height: 0.5rem;
    background: var(--surface-3);
    border-radius: var(--r-full);
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    border-radius: var(--r-full);
    background: var(--accent);
    transition: width .3s ease;
}

.progress-bar__fill--success { background: var(--success); }
.progress-bar__fill--warning { background: var(--warning); }
.progress-bar__fill--danger  { background: var(--danger); }

/* =========================================================================
   Auth pages (login, reset password) — standalone, no app-shell
   ========================================================================= */
.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg);
}

.auth-brand {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.3125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.5rem;
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 1.625rem;
    height: 1.625rem;
    flex-shrink: 0;
}

/* .logo-portal handles the accent colour in auth pages too */

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem 2.25rem;
    width: 100%;
    max-width: 26rem;
}

.auth-card__title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.1875rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.auth-card__subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.auth-card__footer {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-card__footer a {
    color: var(--accent);
}

/* =========================================================================
   Utilities — spacing, display, text, sizing
   Used to replace inline style="..." attributes so CSP style-src can drop
   'unsafe-inline'. Keep this block small and extend intentionally.
   ========================================================================= */

/* Spacing — utility classes use !important so they always win over
   component-level CSS (same pattern as Tailwind/Bootstrap utilities).
   The original inline style="..." these replaced always beat class
   selectors; without !important these utilities could lose specificity
   battles to later component rules (e.g. .table--compact td padding). */
.section-gap { margin-top: 2rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-5 { margin-bottom: 1.25rem !important; }
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-auto { margin-left: auto !important; }
.p-0  { padding: 0 !important; }
.p-1  { padding: 0.25rem !important; }
.px-1 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.py-1 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.pl-icon { padding-left: 2.5rem !important; }

/* Display / visibility */
.d-inline       { display: inline; }
.d-inline-block { display: inline-block; }
.d-block        { display: block; }
.d-flex         { display: flex; }
.is-hidden      { display: none !important; }

/* Text */
.text-muted    { color: var(--text-muted); }
.text-danger   { color: var(--danger); }
.text-center   { text-align: center !important; }
.text-right    { text-align: right !important; }
.text-nowrap   { white-space: nowrap; }
.font-xs       { font-size: 0.75rem; }
.font-sm       { font-size: 0.8125rem; }
.font-md       { font-size: 0.875rem; }
.font-lg       { font-size: 0.9375rem; }
.font-xl       { font-size: 1rem; }
.font-2xl      { font-size: 1.5rem; }
.font-normal   { font-weight: normal; }
.text-sm       { font-size: 0.875rem; }

/* Fixed widths used in tables and inline layouts */
.w-3rem  { width: 3rem; }
.w-4rem  { width: 4rem; }
.w-4_5rem { width: 4.5rem; }
.w-5rem  { width: 5rem; }
.w-6rem  { width: 6rem; }
.w-6_5rem { width: 6.5rem; }
.w-7rem  { width: 7rem; }
.w-8rem  { width: 8rem; }
.w-9rem  { width: 9rem; }
.w-10rem { width: 10rem; }
.w-11rem { width: 11rem; }
.w-12rem { width: 12rem; }
.w-13rem { width: 13rem; }
.w-14rem { width: 14rem; }
.w-15rem { width: 15rem; }
.w-18rem { width: 18rem; }
.w-7_4rem { width: 7.4rem; }
.w-full  { width: 100%; }
.w-auto  { width: auto; }

/* Min/max widths */
.min-w-10rem { min-width: 10rem; }
.min-w-12rem { min-width: 12rem; }
.min-w-15rem { min-width: 15rem; }
.mw-25rem    { max-width: 25rem; }
.mw-40rem    { max-width: 40rem; }
.mw-44rem    { max-width: 44rem; }
.mw-62rem    { max-width: 62rem; }

/* Flex helpers */
.flex-1        { flex: 1; }
.flex-row      { display: flex; flex-direction: row; }
.flex-wrap     { flex-wrap: wrap; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.shrink-0      { flex-shrink: 0; }
.gap-1         { gap: 0.5rem !important; }
.gap-2         { gap: 0.75rem !important; }
.gap-3         { gap: 1rem !important; }
.gap-4         { gap: 2rem !important; }
.gap-5         { gap: 1.5rem !important; }

/* Overflow */
.overflow-y-auto { overflow-y: auto; }

/* Tiny label/badge sizing (0.6rem – 0.7rem) */
.font-xxs      { font-size: 0.7rem; }
.font-micro    { font-size: 0.6rem; }
.font-medium   { font-weight: 500; }
.font-600      { font-weight: 600; }
.fst-italic    { font-style: italic; }

/* Max-height constraints used for scrollable modal regions */
.maxh-20rem { max-height: 20rem; }
.maxh-24rem { max-height: 24rem; }
.maxh-25rem { max-height: 25rem; }

/* Additional font sizes */
.font-nano     { font-size: 0.65rem; }
.font-85       { font-size: 0.85rem; }

/* Monospace / selection helpers */
.font-mono       { font-family: monospace; }
.user-select-all { user-select: all; }

/* Padding */
.p-2           { padding: 1rem !important; }
.p-3           { padding: 1.25rem !important; }
.p-xs          { padding: 0.75rem !important; }

/* Interactive affordance */
.clickable      { cursor: pointer; user-select: none; }
.cursor-default { cursor: default; }

/* Opacity helpers for disabled-looking elements */
.opacity-40     { opacity: 0.4; }

/* Form-input error state (used by JS validation feedback) */
.input-error    { border-color: var(--danger) !important; }

/* Per-picker "Clear all" link (opt-in via data-clearable on .pill-picker). */
.pill-picker__clear { font-size: 0.8125rem; margin-top: 0.25rem; display: block; }

/* Dashboard widget config — colour-rule preview swatch.
   Each variant corresponds to an entry in the fixed colorOptions list in
   dashboard.js. Dark-mode colours come from the [data-theme="dark"] block.
   JS swaps the modifier class when the user changes the dropdown. */
.color-rule__indicator--green  { background-color: #dcfce7; border-color: #15803d; }
.color-rule__indicator--blue   { background-color: #dbeafe; border-color: #2563eb; }
.color-rule__indicator--amber  { background-color: #fef3c7; border-color: #b45309; }
.color-rule__indicator--orange { background-color: #ffedd5; border-color: #c2410c; }
.color-rule__indicator--red    { background-color: #fee2e2; border-color: #dc2626; }
.color-rule__indicator--purple { background-color: #ede9fe; border-color: #7c3aed; }
.color-rule__indicator--teal   { background-color: #ccfbf1; border-color: #0d9488; }
.color-rule__indicator--grey   { background-color: #f3f4f6; border-color: #6b7280; }

[data-theme="dark"] .color-rule__indicator--green  { background-color: rgba(74, 222, 128, 0.2);  border-color: #4ade80; }
[data-theme="dark"] .color-rule__indicator--blue   { background-color: rgba(96, 165, 250, 0.2);  border-color: #60a5fa; }
[data-theme="dark"] .color-rule__indicator--amber  { background-color: rgba(251, 191, 36, 0.2);  border-color: #fbbf24; }
[data-theme="dark"] .color-rule__indicator--orange { background-color: rgba(251, 146, 60, 0.2);  border-color: #fb923c; }
[data-theme="dark"] .color-rule__indicator--red    { background-color: rgba(248, 113, 113, 0.2); border-color: #f87171; }
[data-theme="dark"] .color-rule__indicator--purple { background-color: rgba(167, 139, 250, 0.2); border-color: #a78bfa; }
[data-theme="dark"] .color-rule__indicator--teal   { background-color: rgba(45, 212, 191, 0.2);  border-color: #2dd4bf; }
[data-theme="dark"] .color-rule__indicator--grey   { background-color: rgba(156, 163, 175, 0.2); border-color: #9ca3af; }

/* Card row border-top divider (counterpart to .card-row-divider) */
.card-section-top {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

/* Standalone thin divider used as <hr> replacement */
.hr-border {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.25rem 0;
}

/* User-edit two-column grid (main form + sidebar) */
.user-edit-grid {
    display: grid;
    grid-template-columns: 1fr 18rem;
    gap: 1.5rem;
    align-items: start;
    max-width: 62rem;
}

/* Scrollable list box for division pickers / similar bordered lists */
.list-scrollbox {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 20rem;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
}

/* Uppercase group heading (division group header, etc.) */
.group-heading {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0.75rem 0 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

/* When a group heading is an interactive select-all/deselect-all toggle
   (view-restriction picker) the resting appearance is unchanged — only the
   hover cursor and keyboard focus ring signal that it is clickable. */
.group-heading[role="button"] { cursor: pointer; }
.group-heading[role="button"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Checkbox row used inside division pickers */
.check-row { margin-bottom: 0.2rem; }

/* Muted note helper (light 0.5rem margin around explanatory text) */
.note-pad { margin: 0.5rem 0; }

/* Stacked column layout (vertical flex with gap) */
.col-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Margins */
.mt-5     { margin-top: 1.25rem !important; }
.mt-6     { margin-top: 1.5rem !important; }

/* Card padding variant used on compact cards (sparkline, small panels) */
.card-pad-sm { padding: 0.75rem 1rem; }

/* Zero margins/padding */
.m-0  { margin: 0 !important; }
.mr-auto { margin-right: auto !important; }

/* Icon sizes for inline SVGs that previously set width/height via style="" */
.icon-xs { width: 0.75rem;  height: 0.75rem; }
.icon-sm { width: 0.875rem; height: 0.875rem; }
.icon-md { width: 1rem;     height: 1rem; }
.icon-lg { width: 1.25rem;  height: 1.25rem; }

/* Icons inline with surrounding text — nudge baseline down slightly */
.icon-inline   { vertical-align: -0.1em; }
.icon-inline-1 { vertical-align: -0.15em; }

/* Modal content typography helpers (help/info modals) */
.modal-para     { margin-bottom: 1rem; }
.modal-list     { padding-left: 1.25rem; line-height: 1.65; margin-bottom: 1rem; }
.wc-swatch-good    { color: hsl(120, 60%, 42%); }
.wc-swatch-bad     { color: hsl(0,   60%, 42%); }
.wc-swatch-mixed   { color: hsl(60,  60%, 42%); }
.wc-swatch-muted   { color: var(--text-muted); }

.text-subtle       { color: var(--text-subtle); }

/* "no data" placeholder in cards/tables */
.no-data--padded    { padding: 0.75rem 1rem; }
.no-data--pad-small { padding: 0.5rem 0; }

/* Card compact section bar (thin top border divider) */
.card-row-divider { padding: 0.5rem 1rem; border-bottom: 1px solid var(--border); }

/* Coaching-summary metric stats row (horizontal-centred metric tiles) */
.summary-stats-row {
    padding: 1rem;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Padding variants — asymmetric layouts that repeat in coaching/profile pages */
.pad-link-row { padding: 0 1rem 0.75rem; }

/* Padding-right variant for scrollable modal content */
.pr-1 { padding-right: 0.75rem !important; }

/* Numeric table cells — right-aligned values.
   Replaces the ~95 inline style="text-align:right" uses across reports. */
.table th.num,
.table td.num,
th.num,
td.num { text-align: right; }

/* =========================================================================
   Status dashboard (Phase 7)
   ========================================================================= */

/* 4-column grid for the top-row health cards; collapses to 2 then 1 */
.status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

@media (max-width: 900px) {
    .status-grid { grid-template-columns: repeat(2, 1fr); }
}

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

/* Key/value pair list inside status cards */
.status-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
    font-size: 0.9375rem;
}

.status-dl dt {
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.status-dl dd {
    margin: 0;
    word-break: break-word;
}

/* Wider label column for the "Last Run" detail card */
.status-dl--wide {
    grid-template-columns: 9rem 1fr;
}

/* =========================================================================
   Print
   ========================================================================= */
@media print {
    .app-header,
    .account-menu,
    .icon-btn,
    .auth-theme-toggle,
    .btn,
    .nav-grid { display: none !important; }

    .site-main { padding: 0; }

    .card,
    .table-wrap { box-shadow: none; border: 1px solid #ccc; }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 640px) {
    .auth-card { padding: 1.5rem 1.25rem; }
    .site-main { padding: 1.25rem 1rem 2rem; }
    .account-menu__name { display: none; }
    .nav-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: stretch; }
}

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

/* =========================================================================
   Report navigation
   ========================================================================= */
.report-nav {
    display: flex;
    gap: .25rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
    padding-bottom: 0;
}

.report-nav__item {
    display: inline-block;
    padding: .5rem .875rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: .25rem .25rem 0 0;
    transition: color .15s, border-color .15s;
}

.report-nav__item:hover {
    color: var(--text);
    border-bottom-color: var(--border);
}

.report-nav__item--active,
.report-nav__item[aria-current="page"] {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Dropdown group inside the report nav — used for "Agents ▾", "Evaluators ▾"
   etc. The trigger looks identical to a .report-nav__item; the panel drops
   below it on click. Behaviour handled in app.js (click-to-open,
   click-outside-close, Esc, keyboard nav). */
.report-nav__group {
    position: relative;
    display: inline-flex;
}

/* Trigger is a <button> — reset button defaults so it matches .report-nav__item
   visually. .report-nav__item already supplies padding, color, typography.
   inline-flex + align-items center aligns the chevron SVG to the middle of the
   label text (default baseline alignment makes the SVG sit visually high). */
.report-nav__trigger {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}

.report-nav__chevron {
    display: inline-flex;
    align-items: center;
    margin-left: .3rem;
    transition: transform .15s ease;
}
.report-nav__chevron svg {
    width: 14px;
    height: 14px;
}

.report-nav__trigger[aria-expanded="true"] .report-nav__chevron {
    transform: rotate(180deg);
}

.report-nav__panel {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    min-width: max-content;
    margin: .375rem 0 0;
    padding: .25rem 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

[data-theme="dark"] .report-nav__panel {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}

.report-nav__panel[hidden] {
    display: none;
}

.report-nav__panel-item {
    display: block;
    padding: .5rem 1rem;
    font-size: .875rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.report-nav__panel-item:hover,
.report-nav__panel-item:focus {
    background: rgba(0, 0, 0, .04);
    color: var(--text);
    outline: none;
}

[data-theme="dark"] .report-nav__panel-item:hover,
[data-theme="dark"] .report-nav__panel-item:focus {
    background: rgba(255, 255, 255, .06);
}

/* "You are here" — bold + tinted background. Stays clickable (refresh-page
   behaviour preserved). */
.report-nav__panel-item--current {
    background: rgba(0, 0, 0, .055);
    font-weight: 600;
}

[data-theme="dark"] .report-nav__panel-item--current {
    background: rgba(255, 255, 255, .085);
}

/* =========================================================================
   Report filters card
   ========================================================================= */
.report-filters {
    margin-bottom: 1rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.filter-row + .filter-row { margin-top: .75rem; }

.filter-group {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.filter-group--submit {
    margin-left: auto;
    flex-direction: row;
    align-items: flex-end;
}

.filter-group--check {
    justify-content: flex-end;
    padding-bottom: .2rem;
}

/* Secondary actions row — checkboxes left, Apply right */
.filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}

.filter-actions .filter-group--check {
    padding-bottom: 0;
}

.filter-actions .filter-group--submit {
    margin-left: auto;
}

/* Full-width pills area below the filter controls (external pill target) */
.filter-pills-row {
    margin-top: .5rem;
}

/* Small form control variant */
.form-control--sm {
    padding: .3rem .6rem;
    font-size: .875rem;
    min-width: 9rem;
}

/* Date preset buttons row */
.date-presets {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}


.date-preset {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: .3rem .7rem;
    font-size: .8125rem;
    font-weight: 500;
    border-radius: .25rem;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}

.date-preset:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--text-muted);
}

.date-preset--active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Custom date range inputs */
.date-range-inputs {
    display: flex;
    align-items: center;
    gap: .4rem;
}

/* =========================================================================
   Report meta bar + sort links
   ========================================================================= */
.report-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: .5rem;
}

/* Question Performance: selected-question results heading (not a card) */
.report-subject {
    margin-bottom: .5rem;
}
.report-subject__q {
    line-height: 1.5;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: .2em;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.sort-link:hover { color: var(--accent); }

.sort-icon {
    font-size: .7em;
    opacity: .7;
}

/* =========================================================================
   Pagination
   ========================================================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .25rem;
    padding: .75rem 0 .25rem;
    flex-wrap: wrap;
}

.pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 .5rem;
    font-size: .875rem;
    font-weight: 500;
    border-radius: .25rem;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}

.pagination__btn:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--border);
}

.pagination__btn--active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    pointer-events: none;
}

.pagination__btn--disabled {
    opacity: .4;
    pointer-events: none;
}

.pagination__ellipsis {
    font-size: .875rem;
    color: var(--text-muted);
    padding: 0 .25rem;
}

/* =========================================================================
   Table helpers
   ========================================================================= */
.no-data {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
}

/* =========================================================================
   Pill picker — multi-value filter control
   ========================================================================= */

/*
 * Use on .filter-row when pill pickers are present so that selects and the
 * Apply button stay top-aligned regardless of how many pills are in each picker.
 * The submit group needs a .form-label-ghost sibling above the buttons so that
 * buttons visually line up with the select inputs.
 */
.filter-row--start { align-items: flex-start; align-content: flex-start; }

.filter-row--start .filter-group--submit {
    flex-direction: column;
    align-items: flex-start;
}

/* Invisible spacer that matches .form-label height so buttons sit at the
   same vertical position as select inputs in adjacent pill-picker groups. */
.form-label-ghost {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
    visibility: hidden;
    user-select: none;
    pointer-events: none;
}

.filter-group__btns {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.filter-group--pill {
    flex: 1;
    min-width: 11rem;
    max-width: 22rem;
}

/* Compact variant: opts out of flex-grow so the dropdown sits at its
   intrinsic width (capped) rather than stretching across the row.
   Used for short fixed-option filters like Score Range and Reviewed. */
.filter-group--narrow {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 15rem;
}

.pill-picker {
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

.pill-picker__select {
    width: 100%;
}

.pill-picker__pills {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    min-height: 0;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    border-radius: var(--r-full);
    padding: .125rem .375rem .125rem .625rem;
    font-size: .8125rem;
    font-weight: 500;
    max-width: 18rem;
    white-space: nowrap;
}

.pill__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pill__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--accent);
    font-size: 1rem;
    line-height: 1;
    border-radius: var(--r-full);
    padding: 0;
    transition: background .1s, color .1s;
}

.pill__remove:hover {
    background: var(--accent);
    color: #fff;
}

/* Two-column grid used by the evaluator profile Before/After mode and the
   evaluator comparison side-by-side layout. Collapses to a single column on
   narrow viewports. */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}
@media (max-width: 900px) {
    .grid-2col { grid-template-columns: 1fr; }
}

/* Optional before/after split control on the profile date bar. Sits below the
   range/custom row and reads as a secondary, opt-in comparison control. */
.split-compare {
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
}
/* Flush variant: no own separator (used when another element, e.g. the filter
   actions row, already provides the single divider). */
.split-compare--flush {
    border-top: none;
    padding-top: 0;
    margin-top: 1rem;
}
/* Before/After question cells carry lost-marks detail as hover text. */
.qa-lost-tip { cursor: help; }
/* Two-tier grouped header on the Before/After score-breakdown tables:
   the "Before" / "On & after" spanning cells centre over their Evals+Avg pair. */
.split-breakdown__group { text-align: center; }

/* Stable widths for the Question Performance picker selects, so the filter row
   doesn't reflow as forms/questions of different name lengths are chosen. The
   width lives on the group (fixed basis, but shrinkable) rather than the select
   itself, so the row wraps and shrinks on narrow screens like the other reports
   instead of overflowing. The closed control clips long text; the open option
   list still shows it in full. */
.qp-form-group     { flex: 0 1 18rem; min-width: 0; }
.qp-question-group { flex: 0 1 36rem; min-width: 0; }
.qp-form-select,
.qp-question-select { width: 100%; }

/* Searchable pill-picker combobox (progressive enhancement of .pill-picker).
   The native <select> is hidden and a text input + results panel take over;
   the panel reuses the .agent-search__* styles. */
.pill-picker--enhanced .pill-picker__select { display: none; }
.pill-search { position: relative; }
.pill-search__add-all .agent-search__name,
.pill-search__add-group .agent-search__name {
    color: var(--accent);
    font-weight: 600;
}
.pill-search__add-all { border-bottom: 1px solid var(--border); }

/* =========================================================================
   Score badges — coloured inline badges for Total Score cells
   Thresholds are defined in src/Views/reports/_helpers.php (SCORE_* consts)
   ========================================================================= */
.score-badge {
    display: inline-block;
    padding: .125rem .5rem;
    border-radius: var(--r-full);
    font-size: .8125rem;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}

/* ≥ 90% — passing (green) */
.score--pass  { color: #15803d; background: #dcfce7; border-color: #bbf7d0; }
/* 80–89% — minor improvement needed (yellow) */
.score--minor { color: #854d0e; background: #fefce8; border-color: #fef08a; }
/* 70–79% — warning (orange) */
.score--warn  { color: #c2410c; background: #ffedd5; border-color: #fb923c; }
/* < 70%  — poor (red) */
.score--poor  { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }

[data-theme="dark"] .score--pass  { color: #4ade80; background: rgba(74,222,128,.12);  border-color: rgba(74,222,128,.25); }
[data-theme="dark"] .score--minor { color: #fde047; background: rgba(253,224,71,.12);   border-color: rgba(253,224,71,.25); }
[data-theme="dark"] .score--warn  { color: #fb923c; background: rgba(251,146,60,.12);   border-color: rgba(251,146,60,.25); }
[data-theme="dark"] .score--poor  { color: #f87171; background: rgba(248,113,113,.12);  border-color: rgba(248,113,113,.25); }

/* ---- Δ severity tiers (evaluator profile + comparison) ----
   Magnitude-coded, not direction-coded: a +12 delta and a -12 delta both
   get .delta--warn. Sign is shown in the text. The base rule covers
   non-table contexts (e.g. the Comparison Overall card deltas); the
   specificity-bumped .table td.delta--X variants are needed inside
   tables where .table td's color rule would otherwise win. */
.delta--minor { color: var(--delta-minor-fg); font-weight: 600; }
.delta--warn  { color: var(--delta-warn-fg);  font-weight: 600; }
.delta--poor  { color: var(--danger-fg);      font-weight: 600; }
.table td.delta--minor { color: var(--delta-minor-fg); font-weight: 600; }
.table td.delta--warn  { color: var(--delta-warn-fg);  font-weight: 600; }
.table td.delta--poor  { color: var(--danger-fg);      font-weight: 600; }

/* ---- Trend indicators (monthly vs-prior columns) ---- */
.trend {
    font-size: .8125rem;
    font-weight: 600;
    white-space: nowrap;
}
.trend--up      { color: #15803d; }
.trend--down    { color: #b91c1c; }
.trend--neutral { color: var(--text-muted); }

[data-theme="dark"] .trend--up      { color: #4ade80; }
[data-theme="dark"] .trend--down    { color: #f87171; }
[data-theme="dark"] .trend--neutral { color: var(--text-muted); }

/* =========================================================================
   Report responsive
   ========================================================================= */
@media (max-width: 640px) {
    .filter-row { flex-direction: column; align-items: stretch; }
    .filter-actions { flex-direction: column; align-items: stretch; }
    .filter-actions .filter-group--submit { margin-left: 0; }
    .filter-group--submit { margin-left: 0; }
    .date-presets { flex-direction: column; }
    .date-range-inputs { flex-wrap: wrap; }
    .report-nav { gap: 0; }
    .report-nav__item { padding: .4rem .6rem; font-size: .8125rem; }
    .date-presets--extended { flex-direction: column; }
}

/* ── Evaluation Search ──────────────────────────────────── */
.filter-group--search { flex: 0 1 36rem; min-width: 0; }
.filter-group--search .input-wrap { max-width: 36rem; }
@media (max-width: 640px) {
    /* Parent flips to flex-direction: column at this breakpoint, which would
       make our 36rem flex-basis apply to height. Reset and let the group fill
       the card width like other filter-groups do. */
    .filter-group--search { flex: 0 0 auto; width: 100%; max-width: none; }
    .filter-group--search .input-wrap { max-width: none; }
    /* Same trap: the Question Performance form/question groups carry an
       18rem/36rem flex-basis that would become HEIGHT once the row stacks. */
    .qp-form-group,
    .qp-question-group { flex: 0 0 auto; width: 100%; }
}

.saved-filter-bar {
    display: flex; align-items: center; gap: .75rem;
    margin-bottom: .75rem; flex-wrap: wrap;
}
.saved-filter-bar .form-label { margin-bottom: 0; white-space: nowrap; }
.saved-filter-bar select { max-width: 20rem; }
.saved-filter-bar__delete { margin-left: auto; }

.save-filter-modal { margin-bottom: .75rem; padding: .75rem 1rem; }
#results { scroll-margin-top: 4rem; }
#evaluations, #notes, #actions, #activity-log { scroll-margin-top: 4rem; }
/* Item-level anchors a save redirects back to (#action-{id}, #note-{id},
   #action-note-{id}, #action-notes-{id}): clear the sticky header so the item
   lands in view instead of hidden underneath it. */
.coaching-action[id], .coaching-note[id], .vf-action-note[id], .vf-action-notes[id],
.vf-completed-section[id] {
    scroll-margin-top: calc(var(--header-h) + 1rem);
}

.pill-row-label {
    font-size: .75rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .03em;
    align-self: center; white-space: nowrap; margin-right: .15rem;
}

.save-filter-modal__error { color: var(--danger-fg); font-size: .8125rem; margin-bottom: .35rem; }
.modal__error { color: var(--danger-fg); font-size: .8125rem; display: block; margin-top: .35rem; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }
.btn-link:hover { color: var(--accent-hover); }
.save-filter-modal__row { display: flex; gap: .5rem; align-items: center; }
.save-filter-modal__row input[type="text"] { flex: 1; max-width: 20rem; }

.row--clickable { cursor: pointer; }
.row--clickable:hover { background: var(--bg-hover, rgba(0,0,0,.04)); }
[data-theme="dark"] .row--clickable:hover { background: rgba(255,255,255,.06); }

.badge--rescore {
    display: inline-block; font-size: .7rem; font-weight: 600;
    padding: .1rem .35rem; border-radius: 3px;
    background: var(--color-warning, #f59e0b); color: #fff;
    vertical-align: middle; margin-left: .25rem;
}

.date-presets--extended { flex-wrap: wrap; }

/* ── Evaluation Detail ──────────────────────────────────── */
.eval-detail__header { margin-bottom: 1rem; }
.eval-detail__header-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: .75rem 1.5rem; padding: 1rem;
}
.eval-detail__label {
    display: block; font-size: .75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); margin-bottom: .15rem;
}
.eval-detail__value { font-size: .95rem; }
.eval-detail__section-title { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }

.eval-detail__comments { margin-bottom: 1rem; padding: 1rem; }
.eval-detail__comment-section { margin-bottom: 1rem; }
.eval-detail__comment-section:last-child { margin-bottom: 0; }
.eval-detail__comment-section h3 { font-size: .9rem; font-weight: 600; margin-bottom: .35rem; }
.eval-detail__comment-text { white-space: pre-wrap; line-height: 1.5; color: var(--text-body); }

.question-group { margin-bottom: .75rem; }
.question-group__header {
    display: flex; align-items: center; gap: 1rem;
    padding: .75rem 1rem; border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.question-group__header h3 { font-size: .95rem; margin: 0; }
.question-group__weight { font-size: .8rem; color: var(--text-muted); }
.question-group__score { font-size: .85rem; margin-left: auto; }

.table--compact th, .table--compact td { padding: .4rem .6rem; font-size: .875rem; }
/* Force column widths from <colgroup> rather than letting per-table content
   resize them — used by the evaluator profile/comparison so multiple stacked
   tables (one per question group) line up identically across the page.
   Cell content still wraps normally (no overflow/ellipsis applied). */
.table--fixed { table-layout: fixed; }

/* "Show only differences" toggle on the evaluator profile + comparison views.
   Server marks any row, group wrapper, or form card whose entire content
   is zero-variation (Δ exactly 0 or null) with data-perfect="1". When the
   wrapping container picks up the .show-issues-only class (via the
   nonce'd inline script), all those nodes vanish. If the server flagged
   data-all-perfect="1" on the same wrapper (nothing to show with filter
   on), the empty-state message appears in their place. */
.show-issues-only [data-perfect="1"] { display: none !important; }
.calibration-empty-state { display: none; }
.show-issues-only[data-all-perfect="1"] .calibration-empty-state { display: block; }

/* Headers in fixed-layout tables: drop the global uppercase + letter-spacing
   (makes proper-noun names like "Hamza Muhammad" render naturally and more
   compactly), and truncate-with-ellipsis when a column is too narrow so the
   header never visually spills into the next column. Full text remains in
   the title attribute for desktop hover. */
.table--fixed th {
    text-transform: none;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}
.table--compact td > div:first-child { font-style: normal; }
.question-row__comment {
    margin-top: .25rem; font-size: .8rem; color: var(--text-muted);
    font-style: italic; white-space: pre-wrap;
}

.row--below-max, .row--below-max td { background: rgba(245, 158, 11, .09); }
.row--below-max:hover td { background: rgba(245, 158, 11, .16) !important; }
[data-theme="dark"] .row--below-max, [data-theme="dark"] .row--below-max td { background: rgba(245, 158, 11, .12); }
[data-theme="dark"] .row--below-max:hover td { background: rgba(245, 158, 11, .18) !important; }

.row--zero, .row--zero td { background: rgba(239, 68, 68, .09); }
.row--zero:hover td { background: rgba(239, 68, 68, .16) !important; }
[data-theme="dark"] .row--zero, [data-theme="dark"] .row--zero td { background: rgba(239, 68, 68, .14); }
[data-theme="dark"] .row--zero:hover td { background: rgba(239, 68, 68, .20) !important; }

/* Positive counterpart to .row--zero — green hue at a lighter opacity so it
   reads as a gentle "all clear" signal rather than a strong colour wash.
   Used when "zero" is a good thing (e.g. zero unreviewed evaluations).
   Non-clickable rows only, so no hover variants. */
.row--complete, .row--complete td { background: rgba(34, 197, 94, .07); }
[data-theme="dark"] .row--complete, [data-theme="dark"] .row--complete td { background: rgba(34, 197, 94, .09); }

.row--kill, .row--kill td { background: rgba(239, 68, 68, .09); }
.row--kill:hover td { background: rgba(239, 68, 68, .16) !important; }
[data-theme="dark"] .row--kill, [data-theme="dark"] .row--kill td { background: rgba(239, 68, 68, .14); }
[data-theme="dark"] .row--kill:hover td { background: rgba(239, 68, 68, .20) !important; }

.badge--kill, .badge--critical {
    display: inline-block; font-size: .65rem; font-weight: 700;
    padding: .1rem .3rem; border-radius: 3px;
    vertical-align: middle; margin: 0 .1rem;
}
.badge--kill { background: #ef4444; color: #fff; }
.badge--critical { background: #8b5cf6; color: #fff; }

/* ── Search match context ────────────────────────────────── */
/* Remove border between a result row and its snippet — they appear as one unit */
tr.row--clickable:has(+ tr.match-context) td { border-bottom: none; padding-bottom: .25rem; }
.match-context td { border-bottom: 1px solid var(--border); padding-top: .3rem !important; padding-bottom: .6rem !important; font-size: .8125rem; }
.match-context:hover td { background: transparent !important; }
.match-context__badge {
    display: inline-block; font-size: .7rem; font-weight: 600;
    padding: .1rem .4rem; border-radius: 3px; vertical-align: middle;
    background: var(--surface-2, #e2e8f0); color: var(--text-body);
    margin-right: .4rem;
}
[data-theme="dark"] .match-context__badge { background: rgba(255,255,255,.12); }
.match-context__snippet { color: var(--text-muted); font-size: .8125rem; }
.match-context__more {
    display: inline-block; margin-left: .5rem; font-size: .75rem;
    color: var(--color-accent); cursor: pointer; text-decoration: none;
}
.match-context__more:hover { text-decoration: underline; }
.match-context__expanded { margin-top: .35rem; }
.match-context__item { margin-top: .25rem; }

mark {
    background: rgba(250, 204, 21, .4); padding: .05rem .15rem;
    border-radius: 2px; color: inherit;
}
[data-theme="dark"] mark { background: rgba(234, 179, 8, .3); }

.badge--reviewed-yes, .badge--reviewed-no {
    display: inline-block; font-size: .75rem; font-weight: 600;
    padding: .15rem .5rem; border-radius: 3px;
}
.badge--reviewed-yes { background: #16a34a; color: #fff; }
.badge--reviewed-no { background: #dc2626; color: #fff; }

/* =========================================================================
   Phase 10 — Dashboard System
   ========================================================================= */

/* Dashboard list — card grid ------------------------------------------------ */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    transition: border-color .15s, box-shadow .15s;
}
.dash-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}
.dash-card__link {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    text-decoration: none;
    color: inherit;
    flex: 1;
}
.dash-card__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--r);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-card__icon svg {
    width: 1.25rem;
    height: 1.25rem;
}
.dash-card__title {
    font-family: 'DM Sans', sans-serif;
    font-size: .9375rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}
.dash-card__desc {
    font-size: .8125rem;
    color: var(--text-muted);
}
.dash-card__actions {
    display: flex;
    gap: .25rem;
    justify-content: flex-end;
}

/* Date override dropdown */
.date-override-dropdown {
    position: relative;
    display: inline-block;
}
.date-override-dropdown__menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 50;
    min-width: 14rem;
    margin-top: .25rem;
    padding: .375rem 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .375rem;
    box-shadow: var(--shadow-md);
}
.date-override-dropdown__item {
    display: block;
    padding: .375rem .75rem;
    font-size: .8125rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}
.date-override-dropdown__item:hover {
    background: var(--surface-2);
}
.date-override-dropdown__item--active {
    font-weight: 600;
    color: var(--accent);
}
.date-override-dropdown__item--reset {
    color: var(--accent);
    font-weight: 500;
}
.date-override-dropdown__sep {
    height: 1px;
    background: var(--border);
    margin: .25rem 0;
}
.date-override-dropdown__custom {
    display: flex;
    align-items: center;
    gap: .375rem;
    padding: .375rem .75rem;
}
.date-override-dropdown__custom input[type="date"] {
    width: 7.5rem;
    font-size: .75rem;
}
.btn-accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Widget grid — 12-column layout -------------------------------------------- */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}
.widget-grid__empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.widget {
    grid-column: span 4; /* default: medium */
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    display: flex;
    flex-direction: column;
    transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.widget[data-grid-size="2"] { grid-column: span 2; }
.widget[data-grid-size="4"] { grid-column: span 4; }
.widget[data-grid-size="6"] { grid-column: span 6; }

.widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .625rem .75rem;
    border-bottom: 1px solid var(--border);
    gap: .5rem;
}
.widget__title {
    font-family: 'DM Sans', sans-serif;
    font-size: .8125rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.widget__actions {
    display: flex;
    gap: .125rem;
    flex-shrink: 0;
}
.widget__action-btn {
    background: none;
    border: none;
    padding: .2rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
}
.widget__action-btn svg {
    width: .875rem;
    height: .875rem;
}
.widget__action-btn:hover {
    color: var(--text);
    background: var(--surface-2);
}
.widget__action-btn--danger:hover {
    color: #dc2626;
}
.widget__body {
    padding: .5rem .75rem;
    flex: 1;
    overflow: auto;
    max-height: 300px;
}
.widget__date-label {
    padding: .25rem .75rem .5rem;
    font-size: .7rem;
    color: var(--text-muted);
    text-align: right;
}
.widget__date-label:empty { display: none; }

/* Widget empty state */
.widget__empty {
    color: var(--text-muted);
    font-size: .8125rem;
    text-align: center;
    padding: 1.5rem .5rem;
}

/* Widget footer note — appears under a table when row set was capped */
.widget__footer-note {
    color: var(--text-muted);
    font-size: .8125rem;
    padding: .5rem .75rem;
    border-top: 1px solid var(--border);
    text-align: center;
}
.widget__footer-note a { color: var(--accent); text-decoration: none; }
.widget__footer-note a:hover { text-decoration: underline; }

/* Widget placeholder (coaching) */
.widget__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem .5rem;
    text-align: center;
}

/* Custom metric tile */
.widget__metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem .5rem;
    text-align: center;
}
.widget__metric-value {
    font-family: 'DM Sans', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
    /* Match the padding applied by .metric-color--* so coloured and
       uncoloured values keep the same box geometry and align on baseline. */
    padding: 0.25rem 0.5rem;
}
.widget__metric-label {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .25rem;
    /* Prevent multi-word labels from wrapping when tiles are sized to
       equal thirds via flex-1. There's always horizontal room in the
       widget; without this the longest label ("Overdue Actions") would
       wrap to two lines because flex min-width: auto resolves to the
       longest-word width, not the full label. */
    white-space: nowrap;
}

/* Metric colour rules — text + subtle background tint */
.metric-color--green  { color: #15803d; background: rgba(22, 163, 74, .1); }
.metric-color--blue   { color: #2563eb; background: rgba(37, 99, 235, .1); }
.metric-color--amber  { color: #b45309; background: rgba(217, 119, 6, .1); }
.metric-color--orange { color: #c2410c; background: rgba(234, 88, 12, .1); }
.metric-color--red    { color: #dc2626; background: rgba(220, 38, 38, .1); }
.metric-color--purple { color: #7c3aed; background: rgba(124, 58, 237, .1); }
.metric-color--teal   { color: #0d9488; background: rgba(20, 184, 166, .1); }
.metric-color--grey   { color: #6b7280; background: rgba(107, 114, 128, .1); }

[data-theme="dark"] .metric-color--green  { color: #4ade80; background: rgba(74, 222, 128, .12); }
[data-theme="dark"] .metric-color--blue   { color: #60a5fa; background: rgba(96, 165, 250, .12); }
[data-theme="dark"] .metric-color--amber  { color: #fbbf24; background: rgba(251, 191, 36, .12); }
[data-theme="dark"] .metric-color--orange { color: #fb923c; background: rgba(251, 146, 60, .12); }
[data-theme="dark"] .metric-color--red    { color: #f87171; background: rgba(248, 113, 113, .12); }
[data-theme="dark"] .metric-color--purple { color: #a78bfa; background: rgba(167, 139, 250, .12); }
[data-theme="dark"] .metric-color--teal   { color: #2dd4bf; background: rgba(45, 212, 191, .12); }
[data-theme="dark"] .metric-color--grey   { color: #9ca3af; background: rgba(156, 163, 175, .12); }

.metric-color--green, .metric-color--blue, .metric-color--amber,
.metric-color--orange, .metric-color--red, .metric-color--purple,
.metric-color--teal, .metric-color--grey {
    border-radius: .375rem;
    padding: .25rem .5rem;
}

/* Colour rule config UI */
.color-rules { margin-top: .5rem; }
.color-rule {
    display: flex;
    gap: .375rem;
    align-items: center;
    margin-bottom: .375rem;
}
.color-rule select, .color-rule input {
    font-size: .8125rem;
    padding: .25rem .375rem;
}
.color-rule__operator { width: 5rem; }
.color-rule__value    { width: 5rem; }
.color-rule__color    { width: 6rem; }
.color-rule__indicator {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 3px;
    border: 2px solid transparent;
    flex-shrink: 0;
}
.color-rule__remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 .25rem;
    line-height: 1;
}
.color-rule__remove:hover { color: #dc2626; }
.color-rules__add {
    font-size: .8125rem;
    margin-top: .25rem;
}

/* Colour swatches in select */
.color-swatch {
    display: inline-block;
    width: .75rem;
    height: .75rem;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: .25rem;
}

/* Widget tables */
.widget-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8125rem;
}
.widget-table th {
    text-align: left;
    font-weight: 600;
    font-size: .75rem;
    color: var(--text-muted);
    padding: .25rem .375rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.widget-table td {
    padding: .3rem .375rem;
    border-bottom: 1px solid var(--border-light, var(--border));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 12rem;
}
.widget-table tr:last-child td { border-bottom: none; }

/* Score colour classes */
.score--good    { color: #16a34a; font-weight: 600; }
.score--warning { color: #d97706; font-weight: 600; }
.score--caution { color: #ea580c; font-weight: 600; }
.score--critical { color: #dc2626; font-weight: 600; }

/* Drag and drop states */
.widget--dragging {
    opacity: .35;
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}
.widget--drop-before,
.widget--drop-after {
    position: relative;
}
.widget--drop-before::before,
.widget--drop-after::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 6px var(--accent);
    z-index: 2;
}
.widget--drop-before::before { left: -6px; }
.widget--drop-after::after   { right: -6px; }
.widget[draggable="true"] {
    cursor: grab;
}
.widget[draggable="true"]:active {
    cursor: grabbing;
}

/* Modal system */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg, .5rem);
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0,0,0,.15));
    width: 90%;
    max-width: 28rem;
    max-height: 85vh;
    overflow-y: auto;
}
.modal--sm  { max-width: 22rem; }
.modal--med { max-width: 34rem; }
.modal--lg  { max-width: 40rem; }
.modal--xl  { max-width: 56rem; }

/* Confirmation modal — used by the global data-confirm handler in app.js.
   Message-only layout; no title. Buttons right-aligned in the footer. */
.modal--confirm .modal__body {
    padding: 1.25rem 1.25rem 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.5;
}
.modal__header {
    padding: 1rem 1.25rem .5rem;
}
.modal__title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}
.modal__body {
    padding: .5rem 1.25rem;
}
.modal__footer {
    padding: .75rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

/* Widget picker grid */
.widget-picker__cat {
    font-family: 'DM Sans', sans-serif;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: .75rem 0 .375rem;
}
.widget-picker__cat:first-child { margin-top: 0; }
.widget-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .5rem;
}
.widget-picker__item {
    background: var(--surface-2);
    color: var(--text);          /* explicit colour so dark mode applies; browser's
                                    user-agent <button> default is otherwise black */
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: .75rem;
    cursor: pointer;
    appearance: none;            /* prevent OS-native button styling overriding theme */
    text-align: left;
    transition: border-color .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
}
.widget-picker__item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.widget-picker__label {
    font-weight: 600;
    font-size: .8125rem;
}
.widget-picker__desc {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .125rem;
}

/* Button extras */
.btn-xs {
    padding: .15rem .35rem;
    font-size: .75rem;
}
.btn-danger-text { color: #dc2626; }
.btn-danger-text:hover { color: #b91c1c; }

/* Dashboard responsive */
@media (max-width: 900px) {
    .widget-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    .widget[data-grid-size="2"] { grid-column: span 3; }
    .widget[data-grid-size="4"] { grid-column: span 6; }
    .widget[data-grid-size="6"] { grid-column: span 6; }
}
@media (max-width: 600px) {
    .widget-grid {
        grid-template-columns: 1fr;
    }
    .widget, .widget[data-grid-size="2"],
    .widget[data-grid-size="4"], .widget[data-grid-size="6"] {
        grid-column: span 1;
    }
    .dash-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   Change Log
   ========================================================================= */
.changelog { max-width: 52rem; }
.changelog__entry {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .5rem;
    border-top: 3px solid var(--border);
}
.changelog__entry--latest {
    border-top: 3px solid var(--accent);
    border-left: none;
}
.changelog__header {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
}
.changelog__date {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: .01em;
}
.changelog__title {
    font-size: .9375rem;
    font-weight: 500;
    margin: 0 0 .875rem;
    color: var(--text-muted);
}
.changelog__items {
    margin: 0;
    padding-left: 0;
    list-style: none;
}
.changelog__items li {
    font-size: .9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: .375rem;
    padding-left: 1.75rem;
    position: relative;
}
.changelog__items li:last-child { margin-bottom: 0; }

/* Icon markers via ::before pseudo-element with inline SVG */
.changelog__items li::before {
    content: '';
    position: absolute;
    left: 0;
    top: .35em;
    width: 1rem;
    height: 1rem;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Add — green plus circle */
.cl-add::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2316a34a'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-11.25a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5Z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

/* Fix — amber wrench */
.cl-fix::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23d97706'%3E%3Cpath fill-rule='evenodd' d='M14.103 2.554a.75.75 0 0 1 .342.834L13.823 5.7a.5.5 0 0 0 .142.47l.98.98a.5.5 0 0 0 .47.141l2.313-.623a.75.75 0 0 1 .834.343c.395.7.613 1.5.613 2.352 0 2.68-2.173 4.854-4.854 4.854a4.83 4.83 0 0 1-1.44-.218l-4.68 4.68a2.5 2.5 0 0 1-3.536-3.536l4.68-4.68a4.83 4.83 0 0 1-.217-1.44c0-2.68 2.173-4.853 4.854-4.853.85 0 1.65.218 2.352.613Z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

/* Remove — red minus circle */
.cl-remove::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23dc2626'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

/* Info — muted dot */
.cl-info::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239ca3af'%3E%3Ccircle cx='10' cy='10' r='3'/%3E%3C/svg%3E");
}

/* Dark mode — brighter icon colours */
[data-theme="dark"] .cl-add::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2322c55e'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-11.25a.75.75 0 0 0-1.5 0v2.5h-2.5a.75.75 0 0 0 0 1.5h2.5v2.5a.75.75 0 0 0 1.5 0v-2.5h2.5a.75.75 0 0 0 0-1.5h-2.5v-2.5Z' clip-rule='evenodd'/%3E%3C/svg%3E");
}
[data-theme="dark"] .cl-fix::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23fbbf24'%3E%3Cpath fill-rule='evenodd' d='M14.103 2.554a.75.75 0 0 1 .342.834L13.823 5.7a.5.5 0 0 0 .142.47l.98.98a.5.5 0 0 0 .47.141l2.313-.623a.75.75 0 0 1 .834.343c.395.7.613 1.5.613 2.352 0 2.68-2.173 4.854-4.854 4.854a4.83 4.83 0 0 1-1.44-.218l-4.68 4.68a2.5 2.5 0 0 1-3.536-3.536l4.68-4.68a4.83 4.83 0 0 1-.217-1.44c0-2.68 2.173-4.853 4.854-4.853.85 0 1.65.218 2.352.613Z' clip-rule='evenodd'/%3E%3C/svg%3E");
}
[data-theme="dark"] .cl-remove::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23ef4444'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z' clip-rule='evenodd'/%3E%3C/svg%3E");
}
[data-theme="dark"] .cl-info::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Ccircle cx='10' cy='10' r='3'/%3E%3C/svg%3E");
}

/* =========================================================================
   Coaching
   ========================================================================= */
.coaching-header { padding: 1.25rem; }
.coaching-header__top { margin-bottom: .75rem; }
.coaching-header__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 .25rem;
}
.coaching-header__meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    color: var(--text-muted);
}
.coaching-header__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: .75rem;
    margin-top: .75rem;
}
.coaching-header__field { font-size: .875rem; }
.coaching-header__label {
    display: block;
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: .125rem;
}
.coaching-header__value { font-weight: 500; }

/* Notes */
.coaching-notes { padding: 0; }
.coaching-note {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.coaching-note:last-child { border-bottom: none; }
.coaching-note__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-bottom: .375rem;
    font-size: .875rem;
}
.coaching-note__body {
    font-size: .9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Inline note editing — shared by coaching + vendor session notes and vendor
   action notes. Text actions (Edit / Delete / Unlink) replace the old red ×. */
.btn-link--danger { color: var(--danger); }
.btn-link--danger:hover { color: #B91C1C; }
[data-theme="dark"] .btn-link--danger { color: #F87171; }
[data-theme="dark"] .btn-link--danger:hover { color: #FCA5A5; }
.note-actions {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
}
.note-edited { cursor: help; }
.note-edit-form { margin-top: .5rem; }

/* Action Items */
.coaching-actions { padding: 0; }
.coaching-action {
    padding: .5rem 1rem;
    border-bottom: 1px solid var(--border);
}
.coaching-action:last-child { border-bottom: none; }
.coaching-action__row {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}
.coaching-action__check {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    color: var(--text);
    flex-shrink: 0;
}
/* Read-only render (a <span>, not a <button>) must not look clickable. */
.coaching-action__check:not(button) { cursor: default; }
/* Read-only list marker: a plain muted bullet, not a checkbox. */
.coaching-action__check--bullet { font-size: 1.1rem; color: var(--text-muted); }
.coaching-action__content {
    flex: 1;
    font-size: .9375rem;
}
.coaching-action__text--done {
    text-decoration: line-through;
    color: var(--text-muted);
}
.coaching-action__due {
    display: block;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .125rem;
}
/* "(edited)" and the "Completed by … / Completed <date>" line on an action item
   always get their own line (like "Due:"), whether or not a due date is shown.
   Note headers keep "(edited)" inline beside the date. */
.coaching-action__content .note-edited,
.coaching-action__meta {
    display: block;
    width: fit-content;
    margin-top: .125rem;
}
.coaching-action__due--overdue { color: #dc2626; font-weight: 600; }
[data-theme="dark"] .coaching-action__due--overdue { color: #f87171; }
.coaching-action--complete { opacity: .7; }
.coaching-action--overdue { background: rgba(220, 38, 38, .05); }
[data-theme="dark"] .coaching-action--overdue { background: rgba(248, 113, 113, .08); }

/* Inline form rows with labels — buttons align to input baseline */
.coaching-inline-form {
    display: flex;
    gap: .5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.coaching-inline-form__btn {
    margin-bottom: 1px; /* fine-tune to match input height */
}

/* Outcome */
.coaching-outcome {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}
.coaching-outcome__body {
    font-size: .9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-top: .25rem;
}

/* Session nav */
.session-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.coaching-edit-details summary { cursor: pointer; }
.coaching-edit-details[open] summary { margin-bottom: .25rem; }

.section-gap { margin-top: 1.25rem !important; }

/* Activity Log */
.activity-log { padding: 0; }
.activity-log__entry {
    display: flex;
    align-items: baseline;
    gap: .375rem;
    padding: .375rem 1rem;
    font-size: .8125rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.activity-log__entry:last-child { border-bottom: none; }
.activity-log__time {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: .75rem;
}
.activity-log__sep { color: var(--border-strong); }
.activity-log__user { font-weight: 500; white-space: nowrap; flex-shrink: 0; }
.activity-log__detail { color: var(--text-secondary); }

/* ---- combo-select — single-select searchable dropdown ----
   Standalone component (not shared with .pill-picker). Used on the coaching
   create page for picking an agent: trigger looks like a form-control, click
   opens a popover with a filter input and a grouped list, selection fills
   the trigger + a hidden input. */
.combo-select {
    position: relative;
}
.combo-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    cursor: pointer;
    user-select: none;
}
.combo-select__trigger:focus,
.combo-select__trigger:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
[data-theme="dark"] .combo-select__trigger:focus,
[data-theme="dark"] .combo-select__trigger:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .2);
}
.combo-select__trigger.input-error {
    border-color: var(--danger-fg);
}
.combo-select__display {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.combo-select__display--placeholder {
    color: var(--text-muted);
}
.combo-select__chevron {
    color: var(--text-muted);
    font-size: .75rem;
    flex-shrink: 0;
}
.combo-select__clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .25rem;
    flex-shrink: 0;
}
.combo-select__clear:hover {
    color: var(--danger-fg);
}
.combo-select__panel {
    position: absolute;
    top: calc(100% + .25rem);
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.combo-select__search {
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: 0 !important;
    width: 100%;
}
.combo-select__search:focus {
    box-shadow: none !important;
    border-bottom-color: var(--accent) !important;
}
.combo-select__list {
    list-style: none;
    margin: 0;
    padding: .25rem 0;
    max-height: 18rem;
    overflow-y: auto;
}
.combo-select__group-label {
    padding: .375rem .75rem .25rem;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}
.combo-select__group-label:first-child {
    border-top: none;
}
.combo-select__option {
    padding: .4rem .75rem;
    cursor: pointer;
    font-size: .875rem;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
}
.combo-select__option:hover,
.combo-select__option--active {
    background: var(--accent-light);
}
.combo-select__option-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.combo-select__state {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.combo-select__empty {
    padding: 1rem .75rem;
    text-align: center;
    font-size: .875rem;
    color: var(--text-muted);
}

/* Agent search dropdown */
.agent-search { position: relative; }
.agent-search__results {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 22rem;
    z-index: 50;
    max-height: 16rem;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 .375rem .375rem;
    box-shadow: var(--shadow-md);
}
.agent-search__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem .75rem;
    cursor: pointer;
    font-size: .875rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.agent-search__item:last-child { border-bottom: none; }
.agent-search__item:hover,
.agent-search__item--active {
    background: var(--surface-2);
}
.agent-search__name { font-weight: 500; }
.agent-search__div {
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.agent-search__state {
    font-size: .7rem;
    color: var(--text-muted);
    font-style: italic;
    margin-left: .25rem;
}
.agent-search__none {
    padding: .5rem .75rem;
    font-size: .8125rem;
    color: var(--text-muted);
}
.agent-search__group-label {
    padding: .375rem .75rem .125rem;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-2);
}

/* =========================================================================
   Agent Profile
   ========================================================================= */
.agent-header { padding: 1.25rem; }
.agent-header__top {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.agent-header__name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}
.agent-header__meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

.agent-date-bar { padding: .75rem 1rem; margin-top: 1rem; }

.agent-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}
/* Variant for pages with 3 metric cards (evaluator profile). Auto-fit keeps
   the row balanced in any container — full-width or split into halves. */
.agent-metrics--3 {
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}
.agent-metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: .5rem;
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.agent-metric-card__value {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    /* Match the padding applied by .metric-color--* so coloured and
       uncoloured values keep the same box geometry and align on baseline. */
    padding: 0.25rem 0.5rem;
}
.agent-metric-card__label {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .25rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* Question analysis */
.question-form-section {
    border-bottom: 1px solid var(--border);
}
.question-form-section:last-child { border-bottom: none; }
.question-form-section__header {
    padding: .75rem 1rem;
    font-weight: 600;
    font-size: .9375rem;
    cursor: pointer;
    user-select: none;
}
.question-form-section__header:hover { background: var(--surface-2); }
.question-group-section {
    padding: 0 1rem .75rem;
}
.question-group-section__header {
    font-weight: 500;
    font-size: .8125rem;
    color: var(--text-muted);
    padding: .5rem 0 .25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .25rem;
}

/* Profile icon button for report rows */
.btn-profile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: .25rem;
    color: var(--text-muted);
    vertical-align: middle;
    margin-left: .375rem;
    opacity: .6;
    transition: opacity .15s;
}
.btn-profile-icon:hover {
    opacity: 1;
    color: var(--accent);
}

/* Peer comparison */
.agent-metric-card__peer {
    font-size: .7rem;
    color: var(--text-muted);
    margin-top: .375rem;
    border-top: 1px solid var(--border);
    padding-top: .375rem;
}
/* Let .score--good / .score--critical override the muted peer-row colour
   when applied directly on .agent-metric-card__peer (delta sub-line). */
.agent-metric-card__peer.score--good     { color: #16a34a; }
.agent-metric-card__peer.score--critical { color: #dc2626; }

/* ---- Two-state pill toggle (Peers / Self on the evaluator profile) ----
   Radio-input-driven so it works without JS and is keyboard-accessible.
   The input is visually hidden; the label receives the pill styling. */
.mode-toggle {
    display: inline-flex;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 2px;
    position: relative;
    align-items: center;
    gap: 0;
}
.mode-toggle__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.mode-toggle__option {
    padding: .25rem .75rem;
    border-radius: var(--r-full);
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
    user-select: none;
    line-height: 1.2;
}
.mode-toggle__input:checked + .mode-toggle__option {
    background: var(--accent);
    color: #fff;
}
.mode-toggle__input:focus-visible + .mode-toggle__option {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Evaluator Comparison: Overall section cards ----
   Same outer chrome as .agent-metric-card (border, padding, surface) but
   left-aligned, stacked rows for A/B values + a delta footer. The Δ row
   uses the .delta--minor / --warn / --poor severity classes. */
.agent-metric-card.compare-overall-card {
    text-align: left;
    justify-content: flex-start;
    gap: .35rem;
}
.compare-overall-card__title {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-weight: 600;
    margin-bottom: .1rem;
}
.compare-overall-card__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    min-width: 0;
}
.compare-overall-card__name {
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .875rem;
    flex: 1;
    min-width: 0;
}
.compare-overall-card__name:hover {
    text-decoration: underline;
}
.compare-overall-card__value {
    font-weight: 600;
    white-space: nowrap;
    font-size: .9375rem;
}
.compare-overall-card__delta {
    margin-top: .25rem;
    padding-top: .375rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: .875rem;
}

/* Sparkline */
.sparkline {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    height: 4rem;
    position: relative;
}
.sparkline__bar {
    flex: 0 1 12px;
    min-width: 3px;
    border-radius: 1px 1px 0 0;
    transition: opacity .15s;
}
/* Dense mode: applied by the view when bar count exceeds 180 so the
   bars fill the card width evenly without overflowing. Bars touch and
   flex-grow shares the full container width. */
.sparkline--dense { gap: 0; }
.sparkline--dense .sparkline__bar {
    flex: 1 1 0;
    max-width: 12px;
    min-width: 0;
    border-radius: 0;
}
.sparkline__bar:hover { opacity: .7; }
.sparkline__bar--good    { background: #16a34a; }
.sparkline__bar--warning { background: #d97706; }
.sparkline__bar--caution { background: #ea580c; }
.sparkline__bar--critical { background: #dc2626; }
[data-theme="dark"] .sparkline__bar--good    { background: #4ade80; }
[data-theme="dark"] .sparkline__bar--warning { background: #fbbf24; }
[data-theme="dark"] .sparkline__bar--caution { background: #fb923c; }
[data-theme="dark"] .sparkline__bar--critical { background: #f87171; }
.sparkline__ref-line {
    position: absolute;
    left: 0;
    right: 0;
    border-bottom: 1.5px dashed var(--text-muted);
    opacity: .5;
    pointer-events: none;
}

/* Before/After split (profile split mode): the "on & after" bars are wrapped in
   this group so its accent left border acts as a clear split marker, with a bit
   of whitespace on either side. align-self:stretch makes the marker span the
   full chart height; the bars still sit flex-end. */
.sparkline__after-group {
    align-self: stretch;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    flex: 0 1 auto;
    margin-left: 4px;
    padding-left: 5px;
    border-left: 3px solid var(--accent);
}
.sparkline--dense .sparkline__after-group { gap: 0; flex-basis: 0; }

/* Time-scaled needle trend for table cells (Question Performance ranking).
   Each needle is positioned by DATE across a fixed-width track (left %) with
   height = that day's score; left/height/opacity are set per row in a nonce'd
   <style>. Needle colours reuse the .sparkline__bar--* band classes. A dashed
   ref-line marks the passing threshold. Fixed track width => every row is the
   same width and time-aligned, so rows are directly comparable. */
.trend-needle {
    position: relative;
    width: 100%;
    min-width: 10rem;
    height: 2rem;
    overflow: hidden;
}
.trend-needle__needle {
    position: absolute;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    min-height: 1px;
    border-radius: 1px 1px 0 0;
}
.trend-needle__needle:hover { opacity: .55; }
.trend-needle__ref {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed var(--text-muted);
    opacity: .35;
    pointer-events: none;
}

/* Expandable breakdown rows */
.breakdown-expand summary { list-style: none; cursor: pointer; }
.breakdown-expand summary::-webkit-details-marker { display: none; }
.breakdown-expand__row {
    display: flex;
    align-items: center;
    padding: .375rem .75rem;
    font-size: .875rem;
}
.breakdown-expand__row:hover { background: var(--surface-2); }
.breakdown-expand__detail {
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}

/* Question notes inline */
.qa-notes-list {
    padding: .25rem .75rem .5rem 2rem;
    background: var(--surface-2);
}
.qa-notes-list__item {
    display: flex;
    gap: .5rem;
    padding: .25rem 0;
    font-size: .8125rem;
    border-bottom: 1px solid var(--border);
}
.qa-notes-list__item:last-child { border-bottom: none; }
.qa-notes-list__date {
    flex-shrink: 0;
    font-size: .75rem;
    white-space: nowrap;
}
.qa-notes-list__text {
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Evaluator comments */
.eval-comments-list { padding: 0; }
.eval-comment {
    padding: .625rem 1rem;
    border-bottom: 1px solid var(--border);
}
.eval-comment:last-child { border-bottom: none; }
.eval-comment__header {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .25rem;
    font-size: .8125rem;
}
.eval-comment__date { font-weight: 500; white-space: nowrap; }
.eval-comment__form { color: var(--text-muted); font-size: .75rem; }
.eval-comment__body {
    font-size: .875rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Sort toggle button group */
.btn-group-toggle {
    display: inline-flex;
    gap: 1px;
}
.btn-group-toggle .btn { border-radius: 0; }
.btn-group-toggle .btn:first-child { border-radius: .25rem 0 0 .25rem; }
.btn-group-toggle .btn:last-child { border-radius: 0 .25rem .25rem 0; }

/* Word cloud */
.word-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    line-height: 1.2;
    min-height: 8rem;
}
.word-cloud__word {
    display: inline-block;
    font-weight: 600;
    cursor: default;
    transition: opacity .15s;
}
.word-cloud__word:hover { opacity: .6; }
.word-cloud__word--clickable { cursor: pointer; }
.word-cloud__word--clickable:hover { text-decoration: underline; }

/* Word cloud modal match rows */
.wc-match {
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}
.wc-match:last-child { border-bottom: none; }
.wc-match__header {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .25rem;
}
.wc-match__date {
    font-size: .8125rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.wc-match__source {
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 32rem;
    flex: 1;
}
.wc-match__score {
    font-size: .8125rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}
.wc-match__body {
    font-size: .875rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
[data-theme="dark"] .word-cloud__word { filter: brightness(1.3); }

.wc-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    margin-left: 0.5rem;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    vertical-align: middle;
    transition: color .15s;
}
.wc-help-btn:hover { color: var(--accent); }
.wc-help-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 768px) {
    .agent-metrics { grid-template-columns: repeat(2, 1fr); }
}


/* =========================================================================
   Audit Log viewer (Phase 15)
   ========================================================================= */
.audit-event-type {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .8125rem;
    background: var(--surface-2);
    padding: .125rem .375rem;
    border-radius: var(--r-sm);
    color: var(--text);
    white-space: nowrap;
}

.audit-detail { font-size: .8125rem; }
.audit-detail__short,
.audit-detail__full { word-break: break-word; }
.audit-detail__full { white-space: pre-wrap; }
.audit-detail__toggle {
    color: var(--accent);
    font-size: .75rem;
    margin-left: .25rem;
    cursor: pointer;
    text-decoration: none;
}
.audit-detail__toggle:hover { text-decoration: underline; }


/* =========================================================================
   Admin Panel (Phase 16)
   ========================================================================= */
.admin-action-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1rem;
}
.admin-quick-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.admin-quick-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.admin-quick-links a:hover { text-decoration: underline; }

.admin-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--border);
}
.admin-summary-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}

/* Scheduled Reports form (Phase 14a Step D) */
.scheduled-report-flex-grow {
    flex: 1 1 240px;
}
.scheduled-report-chip {
    padding: .25rem .5rem;
}
.scheduled-report-chip__close {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    color: inherit;
    margin-left: .25rem;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}
.scheduled-report-chip__close:hover {
    opacity: .7;
}


/* Settings page (Phase 16 Step B) */
.settings-field { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.settings-field:last-of-type { border-bottom: none; }
.settings-field .form-label { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.settings-field__desc { margin: .25rem 0 .75rem; line-height: 1.45; }
.settings-field__input-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.settings-field__meta { margin: .5rem 0 0; }

/* Vendor Feedback section-page filters: compact fixed-option selects, and a
   roomier Title search that absorbs the freed width. */
.vf-filter-compact { min-width: 0; width: 8rem; }
.filter-group--vf-grow { flex: 1 1 16rem; min-width: 12rem; }

/* Toggle switch — a checkbox styled as a slider (e.g. "Visible to vendor"). */
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
    position: relative; width: 2.25rem; height: 1.25rem;
    background: var(--border); border-radius: 1rem;
    transition: background .15s; flex-shrink: 0;
}
.switch__track::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 1rem; height: 1rem; background: #fff; border-radius: 50%;
    transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(1rem); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch__label { font-size: .8125rem; }

/* Vendor Feedback — action-item notes (expander under each action item). */
.vf-action-notes { margin: .25rem 0 .1rem 2.1rem; }
.vf-action-notes > summary { list-style: none; display: inline-block; cursor: pointer; }
.vf-action-notes > summary::-webkit-details-marker { display: none; }
.vf-action-note { padding: .4rem 0; border-top: 1px solid var(--border); }
.vf-action-note:first-of-type { border-top: none; }
.vf-action-note__head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* Aggregate action-items card: labelled Group vs Session buckets. */
.vf-actions-bucket + .vf-actions-bucket { margin-top: 1rem; }
.vf-actions-bucket__label {
    font-size: .75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-muted); margin: 0 0 .35rem;
}

/* =========================================================================
   Interaction Calibration
   ========================================================================= */
.mw-46rem { max-width: 46rem; }
.align-items-start { align-items: flex-start; }

.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.detail-list dt { font-weight: 600; color: var(--text-muted); }
.detail-list dd { margin: 0; }

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: .2rem 0; }

/* Assignees card: labelled Calibrator / Participants sections */
.calib-assignee-block + .calib-assignee-block {
    margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border);
}
.calib-assignee-label {
    font-size: .75rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted); margin-bottom: .35rem;
}
.calib-manage-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.w-auto { width: auto; }

/* "Before opening…" requirements list */
.calib-open-reqs { margin: 0 0 1rem; padding-left: 1.35rem; }
.calib-open-reqs li { padding: .1rem 0; }

/* Modal (form preview) */
.calib-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.calib-modal.is-hidden { display: none; }
.calib-modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.calib-modal__dialog {
    position: relative; display: flex; flex-direction: column;
    width: 100%; max-width: 46rem; max-height: 85vh;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: .5rem; box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.calib-modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .9rem 1.15rem; border-bottom: 1px solid var(--border);
}
.calib-modal__header h2 { margin: 0; font-size: 1.05rem; }
.calib-modal__close {
    background: none; border: none; font-size: 1.5rem; line-height: 1;
    cursor: pointer; color: var(--text-muted); padding: 0 .25rem;
}
.calib-modal__body { padding: 1.15rem; overflow-y: auto; }

/* Form preview */
.calib-preview__group { margin-bottom: 1.25rem; }
.calib-preview__group:last-child { margin-bottom: 0; }
.calib-preview__group-head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
    border-bottom: 1px solid var(--border); padding-bottom: .35rem; margin-bottom: .5rem;
}
.calib-preview__group-name { font-weight: 600; }
.calib-preview__q { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.calib-preview__q:last-child { border-bottom: none; }
.calib-preview__opts { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.calib-preview__opt {
    font-size: .8125rem; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: .35rem; padding: .12rem .5rem;
}
.calib-preview__opt-val { color: var(--text-muted); font-weight: 600; margin-left: .25rem; }

/* Detail title + status badge, vertically centred */
.calib-detail-title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* Audio */
.calib-audio { width: 100%; max-width: 40rem; }
.calib-audio-replace > summary { display: inline-flex; list-style: none; cursor: pointer; }
.calib-audio-replace > summary::-webkit-details-marker { display: none; }

/* Scoring page */
.w-100 { width: 100%; }
.calib-score-layout { display: grid; grid-template-columns: 1fr 20rem; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .calib-score-layout { grid-template-columns: 1fr; } }
.calib-score-side { position: sticky; top: calc(var(--header-h) + 1rem); }
@media (max-width: 900px) { .calib-score-side { position: static; } }
.calib-score-panel .calib-audio { margin-bottom: .75rem; }
.calib-score-readout { text-align: center; padding: .5rem 0 .25rem; }
.calib-score-readout__label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.calib-score-readout__value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.calib-save-status { min-height: 1.1rem; margin: .35rem 0 .5rem; text-align: center; }

.calib-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .5rem; padding-bottom: .35rem; border-bottom: 1px solid var(--border); }
.calib-group-name { margin: 0; font-size: 1rem; }
.calib-q { padding: .75rem 0; border-bottom: 1px solid var(--border); border-radius: .35rem; }
.calib-q--flash { animation: calibFlash 1.5s ease; }
@keyframes calibFlash {
    0%, 100% { background: transparent; }
    20%      { background: var(--accent-light, var(--surface-2)); }
}
.calib-q:last-child { border-bottom: none; padding-bottom: 0; }
.calib-q__text { font-weight: 500; }
.calib-q__help { margin-top: .15rem; }
.calib-q__options { display: flex; flex-direction: column; gap: .3rem; margin: .5rem 0; }
.calib-opt { display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: .15rem .25rem; border-radius: .3rem; }
.calib-opt:hover { background: var(--surface-2); }
.calib-opt input { margin: 0; }
.calib-opt__val { color: var(--text-muted); font-size: .8125rem; }
.calib-opt--na span { color: var(--text-muted); }
.calib-q__comment > summary { display: inline-block; cursor: pointer; list-style: none; }
.calib-q__comment > summary::-webkit-details-marker { display: none; }
.calib-ts-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.calib-ts-row .calib-q-ts { width: 5rem; }
.calib-ts-row .calib-comment-remove { margin-left: auto; color: var(--danger); }
.calib-q__answer-ro { margin-top: .35rem; }
.calib-q__comment-ro { margin-top: .35rem; padding: .4rem .6rem; background: var(--surface-2); border-radius: .35rem; font-size: .9rem; }
.calib-ts-chip { display: inline-block; background: var(--accent-light, var(--surface-2)); color: var(--accent, var(--text)); border-radius: .25rem; padding: 0 .35rem; font-size: .8rem; font-weight: 600; }
button.calib-ts-chip { border: none; cursor: pointer; font-family: inherit; }
button.calib-ts-chip:hover { filter: brightness(0.94); text-decoration: underline; }

/* Outcome / comparison */
.calib-summary { display: grid; grid-template-columns: repeat(2, minmax(9rem, 1fr)) 2fr; gap: 1rem; }
@media (max-width: 800px) { .calib-summary { grid-template-columns: 1fr; } }
.calib-summary__tile { padding: 1rem; }
.calib-summary__label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.calib-summary__value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; margin-top: .25rem; }
.calib-summary__sub { margin-top: .15rem; }
.calib-top-divergent { margin: .35rem 0 0; padding-left: 1.2rem; }
.calib-top-divergent li { padding: .1rem 0; }

.calib-oc { table-layout: fixed; }
.calib-oc th, .calib-oc td { vertical-align: top; }
.calib-oc__qhead, .calib-oc__q { width: 20rem; }
.calib-oc__col { width: 9rem; text-align: center; }
.calib-oc__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calib-oc__role { font-size: .72rem; color: var(--text-muted); font-weight: 400; }
.calib-oc__group { font-size: .72rem; color: var(--text-subtle); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calib-oc__role .badge { font-size: .68rem; padding: 0 .35rem; }
.calib-oc__score { font-weight: 600; }
.calib-oc__col--key { background: var(--accent-light, var(--surface-2)); }
.calib-oc__grouprow th { background: var(--surface-2); font-size: .8125rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.calib-oc__cell { text-align: center; font-size: .875rem; overflow-wrap: anywhere; }
.calib-oc__pts { color: var(--text-muted); font-size: .72rem; }
.calib-oc--key { background: var(--accent-light, var(--surface-2)); font-weight: 600; }
.calib-oc--diverge { background: #FEF3C7; }
[data-theme="dark"] .calib-oc--diverge { background: var(--warning-light); }
.calib-oc tr[data-qrow] { scroll-margin-top: calc(var(--header-h) + 1rem); }

/* Outcome notes (per-question justifications + general session feedback) */
.calib-note-row td { background: var(--surface-2); padding: .5rem .75rem; }
.calib-note-details > summary { cursor: pointer; color: var(--text-muted); }
.calib-note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.calib-note__author { font-weight: 600; font-size: .8125rem; margin-right: .4rem; }
.calib-note__body { font-size: .875rem; }
/* Session feedback: stack author over body, like coaching notes. */
.calib-feedback-list .calib-note__author { display: block; margin-right: 0; margin-bottom: .15rem; }
.calib-feedback-list .calib-note__body { color: var(--text-secondary); line-height: 1.5; }

/* Acknowledge results (participant) + acknowledgement roster (manager) */
.calib-ack__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.calib-ack-list { display: flex; flex-direction: column; gap: .4rem; }
.calib-ack-item { display: flex; align-items: center; gap: .5rem; }
.calib-ack-item__state { margin-left: auto; }

