/*
 * PalawanSU Toll theme (2026-11, second revision).
 *
 * Loaded by templates/base.html straight after its own <style> block, so it
 * wins over the base rules of the same specificity. Most of it retokenises
 * the custom properties that block defines; the rest restyles the shared
 * components so every page changes together. Light and dark mode are two
 * sets of the same tokens: dark applies when the person chose it (the header
 * toggle sets <html data-theme="dark">) or, with no choice saved, when the
 * device asks for it.
 *
 * Served from static/ (CSP style-src 'self'). Nothing loads from another
 * origin: the gate photograph is static/img/psu-main-gate.*, the geometry
 * and linework are inline SVG in base.html, the icons in messages are the
 * sprite in base.html or data: URIs (CSP img-src 'self' data:).
 *
 * Colours follow the PalawanSU Toll design spec. Where its colour would put
 * text below WCAG 2.1 AA (4.5:1), the text sits on a darker shade of the same
 * orange instead (decided with the project owner, 2026-11-09):
 *   white on the sidebar, #C25220 .. #B4481A         4.64 .. 5.3:1
 *   white on the primary button, #C94F18 .. #A94416  4.55 .. 5.96:1
 *   white over the header fragment's text zone        4.55:1 or more
 *   white on the sign-in panel, #C94F18 .. #B4481A   4.55 .. 5.3:1
 *   warning numbers #9A5B00 / success #3A7656 on white  5.43 / 5.38:1
 *   orange text #A94416 on white / on #F6F2EA         5.96 / 5.33:1
 *   secondary text #6B645D on white / on #F6F2EA      5.82 / 5.22:1
 *     (the spec's #8C847C, 3.3:1, is used for icons only)
 *   input borders #A8744F on white (3:1 needed)       3.98:1
 *   over the photograph, overlay 84 % (90 % behind the form), worst case a
 *   black pixel: #262429 9.6:1, #5E5249 4.7:1, #8F3714 4.8:1
 *   dark mode: #F8F5F0 / #B8B3AC / #FF9B5C on #22242A  14.9 / 7.5 / 7.5:1
 * No text is smaller than 12px.
 */

/* ═══════════════════════════════════════════════════════════════════════
   TOKENS: LIGHT
   ═══════════════════════════════════════════════════════════════════════ */
:root {
    color-scheme: light;

    /* Brand */
    --psu-orange:       #E77239;
    --psu-orange-2:     #EA7A3F;
    --psu-orange-light: #EE844C;
    --psu-action:       #F39A19;
    --psu-burnt:        #C94F18;
    --psu-burnt-dark:   #A94416;
    --psu-peach:        #F9D9C8;
    --psu-peach-soft:   #FDF1EA;

    /* Old names the base stylesheet still reads */
    --psu-50:  var(--psu-peach-soft);
    --psu-100: var(--psu-peach);
    --psu-200: #F4B181;
    --psu-300: #F2A26F;
    --psu-400: var(--psu-orange-light);
    --psu-500: var(--psu-orange);
    --psu-600: var(--psu-burnt);
    --psu-700: var(--psu-burnt-dark);
    --psu-800: #8F3714;
    --accent-50:  var(--psu-peach-soft);
    --accent-100: var(--psu-peach);
    --accent-200: #F4B181;
    --accent-500: var(--psu-orange);
    --accent-600: var(--psu-burnt);
    --accent-700: var(--psu-burnt-dark);
    --accent-800: #8F3714;

    /* Surfaces and text */
    --header-bg:     #FFFFFF;
    --bg:            #F6F2EA;
    --surface:       #FFFFFF;
    --surface-warm:  #FFFEFC;
    --surface-sunk:  #FBF6EF;
    --surface-hover: #FDF5EE;
    --input-bg:      #FFFFFF;

    --text-strong: #262429;
    --text-main:   #262429;
    --text-muted:  #6B645D;
    --text-faint:  #8C847C;
    --text-absent: #6B645D;
    --text-invert: #FFFFFF;
    --text-on-photo-muted: #5E5249;
    --eyebrow:     var(--psu-burnt-dark);
    --link:        var(--psu-burnt-dark);
    --link-hover:  #8F3714;

    --border:         #E6D3C4;
    --border-subtle:  #EFE3D8;
    --border-strong:  #D69A79;
    --border-control: #A8744F;
    --divider:        #D69A79;

    /* Cards: outline, shadow tint and the chamfers */
    --card-line:   #D69A79;
    --card-shadow: 112, 63, 35;
    --chamfer:     20px;
    --chamfer-sm:  14px;

    /* Semantic: base (fill), line (outline), bg (tint), ink (text on tint) */
    --success:      #4F9671;
    --success-line: #78B493;
    --success-bg:   #EAF5EE;
    --success-ink:  #2F6B4C;
    --success-strong: #3A7656;
    --warning:      #F39A19;
    --warning-line: #DDA93F;
    --warning-bg:   #FEF5E1;
    --warning-ink:  #8A5600;
    --danger:       #D92D27;
    --danger-line:  #DF817C;
    --danger-bg:    #FDECEA;
    --danger-ink:   #B42318;
    --info:         var(--psu-orange);
    --info-line:    #E29064;
    --info-bg:      var(--psu-peach-soft);
    --info-ink:     var(--psu-burnt-dark);
    --neutral-line: #B9A99F;
    --neutral-bg:   #F3EEE8;
    --neutral-ink:  #5E5249;
    --issued-line:  #B9A99F;
    --issued-bg:    #F3EEE8;
    --issued-ink:   #262429;

    /* Big numbers in their meaning colour */
    --kpi-amber:  #9A5B00;
    --kpi-red:    #D92D27;
    --kpi-orange: var(--psu-burnt);
    --kpi-green:  #3A7656;
    --kpi-ink:    #262429;

    /* Warm neutral ramp the base stylesheet reads directly */
    --gray-0:   #FFFFFF;
    --gray-25:  #F6F2EA;
    --gray-50:  #FBF6EF;
    --gray-100: #F3EEE8;
    --gray-150: #EFE3D8;
    --gray-200: #E6D3C4;
    --gray-300: #D6C2B2;
    --gray-400: #8C847C;
    --gray-500: #6B645D;
    --gray-600: #5E5249;
    --gray-700: #463C35;
    --gray-800: #2E2A2B;
    --gray-900: #262429;

    --primary-from: var(--psu-burnt);
    --primary-to:   var(--psu-burnt-dark);
    --primary-text: #FFFFFF;

    --focus: var(--psu-burnt);
    /* 84 % everywhere is already enough for every text colour used on the
       photograph (worst case a black pixel, figures at the top); the
       stronger patch only sits behind the form card. */
    --photo-overlay: rgba(247, 243, 239, .84);
    --photo-overlay-strong: rgba(247, 243, 239, .90);
    --header-shadow: 0 1px 0 rgba(112, 63, 35, .08), 0 6px 18px rgba(112, 63, 35, .10);
    --select-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23262429' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");

    --r1: 6px; --r2: 8px; --r3: 10px; --r4: 16px;
    --sh-1: 0 1px 2px rgba(112, 63, 35, .06);
    --sh-2: 0 4px 10px rgba(112, 63, 35, .10), 0 18px 38px rgba(112, 63, 35, .17);
    --sh-3: 0 4px 10px rgba(112, 63, 35, .10), 0 18px 38px rgba(112, 63, 35, .17);
    --sh-pop: 0 6px 14px rgba(32, 27, 25, .12), 0 22px 46px rgba(32, 27, 25, .20);

    --fs-display: clamp(1.75rem, 1.15rem + 1.9vw, 2.75rem);
    --font-ui: 'IBM Plex Sans', Arial, sans-serif;
    --font-id: 'IBM Plex Mono', Consolas, monospace;

    --topbar-h:  64px;
    --sidebar-w: 252px;
}

/* ═══════════════════════════════════════════════════════════════════════
   TOKENS: DARK (the same block twice: chosen, or asked for by the device)
   ═══════════════════════════════════════════════════════════════════════ */
:root[data-theme="dark"] {
    color-scheme: dark;
    --header-bg: #111115; --bg: #141519; --surface: #22242A; --surface-warm: #22242A;
    --surface-sunk: #1C1E23; --surface-hover: #2A2D34; --input-bg: #1A1C21;
    --text-strong: #F8F5F0; --text-main: #E0DCD6; --text-muted: #B8B3AC; --text-faint: #8F8A84;
    --text-absent: #B8B3AC; --text-on-photo-muted: #B8B3AC; --eyebrow: #FF9B5C;
    --link: #FF9B5C; --link-hover: #FFB98C;
    --border: #3C4048; --border-subtle: #31343B; --border-strong: #505660;
    --border-control: #6A707B; --divider: #505660;
    --card-line: #505660; --card-shadow: 0, 0, 0;
    --success-line: #4F9671; --success-bg: #1F3329; --success-ink: #9FD9B8; --success-strong: #3A7656;
    --warning-line: #B88A2E; --warning-bg: #37301F; --warning-ink: #FFD58A;
    --danger-line: #B9504B; --danger-bg: #3A2223; --danger-ink: #FFB4A9;
    --info-line: #C77446; --info-bg: #3A2A20; --info-ink: #FFB98C;
    --neutral-line: #6A6058; --neutral-bg: #2C2E34; --neutral-ink: #E0DCD6;
    --issued-line: #6A6058; --issued-bg: #2C2E34; --issued-ink: #F8F5F0;
    --kpi-amber: #FFC66B; --kpi-red: #FF8A80; --kpi-orange: #FF9B5C; --kpi-green: #8FD3AE; --kpi-ink: #F8F5F0;
    --gray-0: #22242A; --gray-25: #141519; --gray-50: #1C1E23; --gray-100: #2A2D34; --gray-150: #31343B;
    --gray-200: #3C4048; --gray-300: #505660; --gray-400: #8F8A84; --gray-500: #B8B3AC;
    --gray-600: #CFCAC3; --gray-700: #E0DCD6; --gray-800: #F0ECE6; --gray-900: #F8F5F0;
    --psu-peach-soft: #2E2420; --psu-50: #2E2420; --accent-50: #2E2420;
    --primary-from: #FF9B5C; --primary-to: #E77239; --primary-text: #141519;
    --focus: #FF9B5C;
    --photo-overlay: rgba(20, 21, 25, .90); --photo-overlay-strong: rgba(20, 21, 25, .93);
    --header-shadow: 0 1px 0 rgba(0, 0, 0, .5), 0 6px 18px rgba(0, 0, 0, .35);
    --select-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23E0DCD6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    --sh-1: 0 1px 2px rgba(0, 0, 0, .3);
    --sh-pop: 0 6px 14px rgba(0, 0, 0, .35), 0 22px 46px rgba(0, 0, 0, .45);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --header-bg: #111115; --bg: #141519; --surface: #22242A; --surface-warm: #22242A;
        --surface-sunk: #1C1E23; --surface-hover: #2A2D34; --input-bg: #1A1C21;
        --text-strong: #F8F5F0; --text-main: #E0DCD6; --text-muted: #B8B3AC; --text-faint: #8F8A84;
        --text-absent: #B8B3AC; --text-on-photo-muted: #B8B3AC; --eyebrow: #FF9B5C;
        --link: #FF9B5C; --link-hover: #FFB98C;
        --border: #3C4048; --border-subtle: #31343B; --border-strong: #505660;
        --border-control: #6A707B; --divider: #505660;
        --card-line: #505660; --card-shadow: 0, 0, 0;
        --success-line: #4F9671; --success-bg: #1F3329; --success-ink: #9FD9B8; --success-strong: #3A7656;
        --warning-line: #B88A2E; --warning-bg: #37301F; --warning-ink: #FFD58A;
        --danger-line: #B9504B; --danger-bg: #3A2223; --danger-ink: #FFB4A9;
        --info-line: #C77446; --info-bg: #3A2A20; --info-ink: #FFB98C;
        --neutral-line: #6A6058; --neutral-bg: #2C2E34; --neutral-ink: #E0DCD6;
        --issued-line: #6A6058; --issued-bg: #2C2E34; --issued-ink: #F8F5F0;
        --kpi-amber: #FFC66B; --kpi-red: #FF8A80; --kpi-orange: #FF9B5C; --kpi-green: #8FD3AE; --kpi-ink: #F8F5F0;
        --gray-0: #22242A; --gray-25: #141519; --gray-50: #1C1E23; --gray-100: #2A2D34; --gray-150: #31343B;
        --gray-200: #3C4048; --gray-300: #505660; --gray-400: #8F8A84; --gray-500: #B8B3AC;
        --gray-600: #CFCAC3; --gray-700: #E0DCD6; --gray-800: #F0ECE6; --gray-900: #F8F5F0;
        --psu-peach-soft: #2E2420; --psu-50: #2E2420; --accent-50: #2E2420;
        --primary-from: #FF9B5C; --primary-to: #E77239; --primary-text: #141519;
        --focus: #FF9B5C;
        --photo-overlay: rgba(20, 21, 25, .90); --photo-overlay-strong: rgba(20, 21, 25, .93);
        --header-shadow: 0 1px 0 rgba(0, 0, 0, .5), 0 6px 18px rgba(0, 0, 0, .35);
        --select-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23E0DCD6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
        --sh-1: 0 1px 2px rgba(0, 0, 0, .3);
        --sh-pop: 0 6px 14px rgba(0, 0, 0, .35), 0 22px 46px rgba(0, 0, 0, .45);
    }
}

/* Bootstrap reads these at component level. */
:root {
    --bs-body-bg:          var(--bg);
    --bs-body-color:       var(--text-main);
    --bs-body-font-family: var(--font-ui);
    --bs-border-color:     var(--border);
    --bs-border-radius:    var(--r2);
    --bs-border-radius-sm: var(--r1);
    --bs-border-radius-lg: var(--r3);
    --bs-primary:          var(--psu-burnt);
    --bs-primary-rgb:      201, 79, 24;
    --bs-link-color:       var(--link);
    --bs-link-hover-color: var(--link-hover);
    --bs-emphasis-color:   var(--text-strong);
    --bs-secondary-color:  var(--text-muted);
    --bs-heading-color:    var(--text-strong);
    --bs-focus-ring-color: rgba(201, 79, 24, .3);
    --bs-form-select-bg-img: var(--select-arrow);
}

/* ═══════════════════════════════════════════════════════════════════════
   BASE
   ═══════════════════════════════════════════════════════════════════════ */
/* flow-root: the main area's top margin (the header's height) stays inside
   the body instead of pushing the whole page down past 100vh. */
body {
    display: flow-root;
    background: var(--bg);
    color: var(--text-main);
    font-family: var(--font-ui);
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }
h1, h2, h3, h4, h5, h6 { color: var(--text-strong); font-family: var(--font-ui); }
h1 { font-weight: 700; letter-spacing: -0.03em; }
h2 { font-weight: 700; letter-spacing: -0.02em; }
h3, h4 { font-weight: 600; }
code, .id-chip, .plate, .tnum, time { font-family: var(--font-id); }

/* Small, upper-case, letter-spaced, orange: above a big heading. */
.eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 var(--s2);
    font-size: var(--fs-micro);
    font-weight: 600;
    letter-spacing: .16em;
    line-height: 1.3;
    text-transform: uppercase;
    color: var(--eyebrow);
}
.eyebrow-dash::before {
    content: "";
    width: 22px;
    height: 2px;
    flex: none;
    background: currentColor;
}

/* ═══════════════════════════════════════════════════════════════════════
   HEADER: white, fixed, three exploded orange fragments (inline SVG)
   ═══════════════════════════════════════════════════════════════════════ */
.topbar,
.public-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--s6);
    background: var(--header-bg);
    border: 0;
    box-shadow: var(--header-shadow);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: hidden;
}
.topbar > .brand,
.public-header > .brand,
.topbar > .topbar-user,
.public-header > .header-tools { position: relative; z-index: 1; }

.header-geo {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
}
.header-geo-wide { width: 1000px; }
.header-geo-narrow { width: 190px; display: none; }
/* Directional depth, one hard offset shadow per fragment. */
.header-geo .frag { filter: drop-shadow(-9px 7px 0 rgba(32, 27, 25, .18)); }

.brand { gap: var(--s3); min-width: 0; }
.brand-seal {
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: 50%;
    object-fit: contain;
}
.brand-text { gap: 1px; min-width: 0; }
.brand-kicker,
.brand-sub {
    font-size: var(--fs-micro);
    font-weight: 600;
    letter-spacing: .12em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-kicker { color: var(--text-muted); }
.brand-name {
    font-size: var(--fs-md);
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.15;
    text-transform: uppercase;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-sub { color: var(--eyebrow); }

/* The controls sit over the right fragment's darker faces: white. */
.topbar-user, .header-tools { display: flex; align-items: center; gap: var(--s3); }
.header-ctl,
.notif-bell,
.topbar .sidebar-toggle {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    padding: 0;
    border-radius: 12px;
    /* A solid burnt-orange backing, so the white icon reads (5.3:1 or more)
       whether it lands on a fragment or on a white channel. */
    background: rgba(143, 55, 20, .86);
    border: 1px solid rgba(255, 255, 255, .55);
    color: #FFFFFF;
    cursor: pointer;
    transition: background var(--t-fast) var(--ease-soft);
}
.header-ctl:hover,
.notif-bell:hover { background: #8F3714; color: #FFFFFF; }
.header-ctl .ic, .notif-bell .ic { width: 20px; height: 20px; stroke-width: 2; }
/* The menu control is on the white, left side, and only on a phone. */
.topbar .sidebar-toggle { display: none; }
@media (max-width: 768px) { .topbar .sidebar-toggle { display: grid; } }
.topbar .sidebar-toggle {
    background: var(--surface);
    border-color: var(--border-control);
    color: var(--text-strong);
}
.topbar .sidebar-toggle:hover { background: var(--surface-hover); }
.notif-bell-badge {
    background: #D92D27;
    color: #FFFFFF;
    box-shadow: 0 0 0 2px var(--psu-burnt);
}
.theme-toggle .ic-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: inline; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .ic-sun { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .ic-moon { display: inline; }
}

.topbar-user .user-info { max-width: 190px; text-align: right; line-height: 1.2; }
.topbar-user .user-name {
    color: #FFFFFF;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-user .user-role {
    color: #FFFFFF;
    font-size: var(--fs-micro);
    font-weight: 500;
    letter-spacing: .1em;
    white-space: nowrap;
}
.topbar-user .avatar {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 50%;
    color: #FFFFFF;
}
.btn-logout {
    min-height: 44px;
    padding: 0 var(--s4);
    background: rgba(143, 55, 20, .86);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 999px;
    color: #FFFFFF;
    font-weight: 600;
}
.btn-logout:hover { background: #8F3714; border-color: #FFFFFF; color: #FFFFFF; }

/* Focus on the header: light on the orange, the usual ring on white. */
.header-ctl:focus-visible,
.notif-bell:focus-visible,
.btn-logout:focus-visible {
    outline: 3px solid #FFFFFF;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--psu-burnt-dark);
}

/* ═══════════════════════════════════════════════════════════════════════
   SIDEBAR: orange gradient, geometric planes, pale linework
   ═══════════════════════════════════════════════════════════════════════ */
.sidebar {
    top: var(--topbar-h);
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    padding: 28px var(--s4) 20px;
    /* The spec's gradient, deepened where the menu text sits. */
    background: linear-gradient(180deg, #C25220 0%, #BE4E1C 52%, #B4481A 100%);
    border: 0;
    color: #FFFFFF;
    isolation: isolate;
    overflow-x: hidden;
}
.sidebar-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}
.sidebar-art .plane-light { fill: #F0A044; opacity: .16; }
.sidebar-art .plane-mid   { fill: #EB833A; opacity: .20; }
.sidebar-art .plane-dark  { fill: #8F3714; opacity: .16; }
.sidebar-art .line-a { fill: none; stroke: rgba(255, 231, 183, .34); stroke-width: 1.4; }
.sidebar-art .line-b { fill: none; stroke: rgba(255, 226, 164, .22); stroke-width: 1.2; }
.sidebar-art .line-c { fill: none; stroke: rgba(255, 255, 255, .10); stroke-width: 1; }

.sidebar-section { padding: 0; }
.sidebar-section + .sidebar-section {
    margin-top: var(--s5);
    padding-top: var(--s4);
    border-top: 1px solid rgba(255, 255, 255, .24);
}
.sidebar-label {
    padding: 0 var(--s3) var(--s2);
    color: #FFFFFF;
    font-size: var(--fs-micro);
    font-weight: 600;
    letter-spacing: .16em;
}
.sidebar-link {
    min-height: 44px;
    margin: 2px 0;
    padding: 0 var(--s3);
    gap: var(--s3);
    border-radius: 12px;
    color: #FFFFFF;
    font-size: var(--fs-xs);
    font-weight: 500;
    transition: background var(--t-fast) var(--ease-soft);
}
.sidebar-link .ic { width: 18px; height: 18px; color: #FFFFFF; }
/* Darker, not lighter: the white text keeps its contrast (5.9:1). */
.sidebar-link:hover { background: rgba(32, 27, 25, .14); color: #FFFFFF; }
.sidebar-link:hover .ic { color: #FFFFFF; }
.sidebar-link.active {
    position: relative;
    background: #FFFFFF;
    color: var(--psu-burnt-dark);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(112, 40, 10, .22);
}
.sidebar-link.active .ic { color: var(--psu-orange); }
.sidebar-link.active::before {
    content: "";
    display: block;
    position: absolute;
    left: calc(-1 * var(--s4));
    top: 10px;
    bottom: 10px;
    width: 5px;
    height: auto;
    border-radius: 0 3px 3px 0;
    background: var(--psu-peach);
    transform: none;
    animation: none;
}
.sidebar .sidebar-link:focus-visible {
    outline: 3px solid #FFFFFF;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px #8F3714;
}

.sidebar-backdrop {
    inset: var(--topbar-h) 0 0 0;
    background: rgba(20, 21, 25, .5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Light / dark in the menu: phones only; the header keeps it on a computer
   (and on signed-out pages, which have no menu). */
.sidebar-theme { display: none; }
.sidebar .theme-toggle {
    width: 100%;
    background: transparent;
    border: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}
@media (max-width: 768px) {
    .sidebar-theme { display: block; }
    .topbar .theme-toggle { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   WORKSPACE AND PAGE HEADINGS (no card: eyebrow, title, line, divider)
   ═══════════════════════════════════════════════════════════════════════ */
.main-content {
    margin-top: var(--topbar-h);
    margin-left: var(--sidebar-w);
    padding: var(--s8) clamp(var(--s8), 3vw, 54px) var(--s10);
}
.shell { max-width: 1240px; }

.page-header,
.toolbar:has(> .page-header),
.live-scope-row,
.record-head {
    background: none;
    border: 0;
    border-bottom: 1px solid var(--divider);
    box-shadow: none;
    padding: 0 0 20px;
    margin-bottom: var(--s7);
}
.toolbar > .page-header { border: 0; padding: 0; margin: 0; }
.page-header h1,
.page-header h2,
.live-scope-row h1 {
    font-size: var(--fs-display);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.08;
    color: var(--text-strong);
    margin: 0 0 var(--s2);
}
.record-title h1 { font-size: var(--fs-2xl); font-weight: 700; }
.page-header .page-sub,
.live-scope-row .page-sub {
    font-size: var(--fs-md);
    line-height: var(--lh-body);
    color: var(--text-muted);
    max-width: 68ch;
}
.page-header.text-center .eyebrow { justify-content: center; }

/* ═══════════════════════════════════════════════════════════════════════
   CARDS: chamfered top-right and bottom-left, coloured outline,
   multi-layer shadow
   The outline and the surface are two chamfered layers behind the content
   (::before, ::after); the shadow is a drop-shadow on the card itself, so
   it follows the chamfers. The card is not clipped, so focus rings inside
   it are never cut.
   ═══════════════════════════════════════════════════════════════════════ */
.card,
.stat-card,
.status-panel {
    --cut: var(--chamfer);
    --cut-sm: var(--chamfer-sm);
    position: relative;
    isolation: isolate;
    padding: 2px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    --bs-card-bg: transparent;
    --bs-card-border-width: 0;
    filter:
        drop-shadow(0 4px 5px rgba(var(--card-shadow), .10))
        drop-shadow(0 18px 19px rgba(var(--card-shadow), .17));
    transition: transform var(--t-mid) var(--ease), filter var(--t-mid) var(--ease-soft);
}
.card::before,
.stat-card::before,
.status-panel::before,
.card::after,
.stat-card::after,
.status-panel::after {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
}
.card::before,
.stat-card::before,
.status-panel::before {
    inset: 0;
    width: auto;
    height: auto;
    background: var(--card-line);
    clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%,
                       var(--cut-sm) 100%, 0 calc(100% - var(--cut-sm)));
}
.card::after,
.stat-card::after,
.status-panel::after {
    inset: 2px;
    top: 2px;
    right: 2px;
    width: auto;
    height: auto;
    background: var(--surface);
    clip-path: polygon(0 0, calc(100% - var(--cut) + 1px) 0, 100% calc(var(--cut) - 1px),
                       100% 100%, calc(var(--cut-sm) - 1px) 100%,
                       0 calc(100% - var(--cut-sm) + 1px));
}
/* Content backgrounds keep inside the two cut corners. */
.card > :first-child { clip-path: polygon(0 0, calc(100% - var(--cut) + 2px) 0, 100% calc(var(--cut) - 2px), 100% 100%, 0 100%); }
.card > :last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, calc(var(--cut-sm) - 2px) 100%, 0 calc(100% - var(--cut-sm) + 2px)); }
.card > :only-child { clip-path: polygon(0 0, calc(100% - var(--cut) + 2px) 0, 100% calc(var(--cut) - 2px), 100% 100%, calc(var(--cut-sm) - 2px) 100%, 0 calc(100% - var(--cut-sm) + 2px)); }

/* Semantic outlines, with a matching low-opacity shadow. */
.stat-card.warning, .status-panel.is-closed { --card-line: var(--warning-line); }
.stat-card.danger { --card-line: var(--danger-line); }
.stat-card.success, .status-panel.is-open { --card-line: var(--success-line); }
.stat-card.accent, .stat-card.info { --card-line: var(--info-line); }
.stat-card:not(.warning):not(.danger):not(.success):not(.accent):not(.info) { --card-line: var(--neutral-line); }
:root:not([data-theme="dark"]) .stat-card.warning { --card-shadow: 160, 110, 20; }
:root:not([data-theme="dark"]) .stat-card.danger { --card-shadow: 160, 40, 35; }
:root:not([data-theme="dark"]) .stat-card.success { --card-shadow: 40, 110, 70; }
/* Dark mode: restrained neutral shadows, never coloured glows. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .stat-card.warning,
    :root:not([data-theme="light"]) .stat-card.danger,
    :root:not([data-theme="light"]) .stat-card.success { --card-shadow: 0, 0, 0; }
}

/* Only what leads somewhere lifts. */
.card-link:hover,
a.card:hover,
.pick:hover {
    transform: translateY(-2px);
    filter:
        drop-shadow(0 5px 6px rgba(var(--card-shadow), .14))
        drop-shadow(0 22px 23px rgba(var(--card-shadow), .22));
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 0;
    padding: var(--s4) var(--s5);
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text-strong);
}
.card-header .ic { color: var(--psu-orange); }
.card-title { font-weight: 600; }
.card-footer { background: transparent; border-top: 1px solid var(--border-subtle); border-radius: 0; }

/* ── Metrics ───────────────────────────────────────────────────────────── */
.stat-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: calc(var(--s5) + 2px);
}
.stat-label {
    font-size: var(--fs-micro);
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.stat-value {
    font-size: clamp(2.375rem, 1.9rem + 1.3vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--kpi-ink);
}
.stat-card.warning .stat-value { color: var(--kpi-amber); }
.stat-card.danger  .stat-value { color: var(--kpi-red); }
.stat-card.accent  .stat-value,
.stat-card.info    .stat-value { color: var(--kpi-orange); }
.stat-card.success .stat-value { color: var(--kpi-green); }
.stat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); }
.stat-foot { margin-top: auto; padding-top: var(--s3); color: var(--text-muted); }
.stat-link {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: var(--s4);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--link);
}
.stat-link:hover { color: var(--link-hover); }

/* Geometric icon chip: tinted, both chamfers. */
.stat-icon,
.stat-icon-box {
    width: 42px;
    height: 42px;
    padding: 11px;
    flex: none;
    font-size: 1rem;
    stroke-width: 1.9;
    color: var(--neutral-ink);
    background: var(--neutral-bg);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning-ink); }
.stat-card.danger  .stat-icon { background: var(--danger-bg);  color: var(--danger-ink); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success-ink); }
.stat-card.accent  .stat-icon,
.stat-card.info    .stat-icon { background: var(--info-bg);    color: var(--info-ink); }
.stat-card.stat-card-compact { padding: var(--s3) var(--s4); }
.stat-card .stat-value.stat-value-compact { font-size: var(--fs-xl); }

/* ═══════════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════════ */
.table {
    --bs-table-color: var(--text-main);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border);
    color: var(--text-main);
}
.table thead th {
    background: var(--surface-sunk);
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-strong);
    font-size: var(--fs-micro);
    font-weight: 600;
    letter-spacing: .1em;
}
.table tbody td { padding: 12px var(--s4); border-color: var(--border); color: var(--text-main); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.is-flagged { background: var(--danger-bg); }
.table tbody tr.is-flagged:hover { background: var(--danger-bg); }
.table tbody tr.is-inactive { background: var(--surface-sunk); }
.table-responsive { border-radius: 0; }
.kv th { background: var(--surface-sunk); color: var(--text-muted); border-color: var(--border); }
.kv td { color: var(--text-strong); border-color: var(--border); }
.list-group-item { background: var(--surface); color: var(--text-main); border-color: var(--border); }

/* ═══════════════════════════════════════════════════════════════════════
   STATUS PILLS (text, tint, border, icon or dot: never colour alone)
   ═══════════════════════════════════════════════════════════════════════ */
.status-badge {
    padding: 2px 10px;
    border-radius: 999px;
    border-width: 1px;
    font-weight: 600;
}
.badge-scheduled, .badge-draft { background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }
.badge-approved, .badge-entry  { background: var(--success-bg); color: var(--success-ink); border-color: var(--success-line); }
.badge-rejected, .badge-denied { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.badge-issued                  { background: var(--neutral-bg); color: var(--issued-ink); border-color: var(--neutral-line); }
.badge-expired                 { background: var(--danger-bg); color: #8F1F1A; border-color: #B9504B; }
:root[data-theme="dark"] .badge-expired { color: var(--danger-ink); }
.badge-exit                    { background: var(--warning-bg); color: var(--warning-ink); border-color: var(--warning-line); }
.tag { border-radius: var(--r1); background: var(--surface-sunk); border-color: var(--border); color: var(--text-muted); }
.tag-required { background: var(--surface); border-color: var(--border-strong); color: var(--text-main); }
.tag-conditional { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }
.plate, code, .id-chip {
    background: var(--surface);
    color: var(--text-strong);
    border-color: var(--border-strong);
    border-radius: var(--r1);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════ */
.form-label { font-size: var(--fs-xs); font-weight: 500; color: var(--text-strong); margin-bottom: 7px; }
.form-control,
.form-select {
    min-height: 44px;
    background-color: var(--input-bg);
    color: var(--text-strong);
    border: 2px solid var(--border-control);
    border-radius: var(--r3);
    box-shadow: none;
    padding: 8px 12px;
}
.form-select { padding-right: 36px; }
.form-control::placeholder { color: var(--text-muted); opacity: 1; }
.form-control:hover:not(:focus),
.form-select:hover:not(:focus) { border-color: var(--psu-burnt); }
.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-strong);
    border-color: var(--psu-burnt);
    box-shadow: 0 0 0 4px rgba(231, 114, 57, .28);
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] {
    background-color: var(--surface-sunk);
    color: var(--text-muted);
    border-color: var(--border);
}
.form-control-sm, .form-select-sm { min-height: 36px; }
.form-text { color: var(--text-muted); }
.form-check-input { background-color: var(--input-bg); border: 2px solid var(--border-control); }
.form-check-input:checked { background-color: var(--psu-burnt); border-color: var(--psu-burnt); }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(231, 114, 57, .28); border-color: var(--psu-burnt); }
.required-mark { color: var(--danger-ink); }
.form-control.is-invalid, .form-select.is-invalid,
.form-control[aria-invalid="true"], .form-select[aria-invalid="true"] {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(217, 45, 39, .15);
}
.pwd-toggle-btn { color: var(--text-muted); width: 38px; height: 38px; }
.pwd-toggle-btn:hover { color: var(--text-strong); background: var(--surface-hover); }

/* Field errors: an icon and the words. */
.errorlist { color: var(--danger-ink); font-weight: 600; }
.errorlist li { position: relative; padding-left: 20px; }
.errorlist li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .1em;
    width: 15px;
    height: 15px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D92D27' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.4 2.75h7.2l5.65 5.65v7.2l-5.65 5.65H8.4L2.75 15.6V8.4z'/%3E%3Cpath d='M12 7.5v5.5M12 16.5h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.field-error { color: var(--danger-ink); }

/* ═══════════════════════════════════════════════════════════════════════
   BUTTONS: pills; primary orange to burnt orange (deepened for white text)
   ═══════════════════════════════════════════════════════════════════════ */
.btn {
    min-height: 44px;
    padding: 0 var(--s5);
    border-radius: 999px;
    border-width: 2px;
    font-weight: 600;
    gap: 8px;
}
.btn-sm { min-height: 34px; padding: 0 var(--s3); border-width: 1px; }
.btn-icon { min-height: 0; width: 34px; height: 34px; padding: 0; border-radius: var(--r2); }
@media (pointer: coarse) { .btn-sm { min-height: 44px; } }
.btn-lg { min-height: 48px; font-size: var(--fs-md); }
.btn-primary {
    background: linear-gradient(90deg, var(--primary-from), var(--primary-to));
    border-color: transparent;
    color: var(--primary-text);
    box-shadow: 0 4px 12px rgba(169, 68, 22, .22);
}
.btn-primary:hover {
    background: linear-gradient(90deg, var(--primary-to), var(--primary-to));
    border-color: transparent;
    color: var(--primary-text);
}
.btn-primary:active { filter: brightness(.94); }
.btn-secondary,
.btn-outline-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text-strong);
    box-shadow: none;
}
.btn-secondary:hover,
.btn-outline-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--psu-burnt);
    color: var(--text-strong);
}
.btn-outline-primary { background: transparent; border-color: var(--psu-burnt); color: var(--link); }
.btn-outline-primary:hover { background: var(--psu-peach-soft); color: var(--link-hover); }
.btn-success { background: var(--success-strong); border-color: var(--success-strong); color: #FFFFFF; }
.btn-success:hover { background: #2F6B4C; border-color: #2F6B4C; color: #FFFFFF; }
.btn-danger { background: #C62A24; border-color: #C62A24; color: #FFFFFF; }
.btn-danger:hover { background: #A8231E; border-color: #A8231E; color: #FFFFFF; }
.btn-outline-danger { background: var(--surface); border-color: var(--danger-line); color: var(--danger-ink); }
.btn-outline-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-ink); }
/* A button that reads as a link inside a sentence ("send a new code"): plain
   inline text, not a pill. While its countdown runs it is muted text with
   the seconds left; once ready it is an underlined link. */
.btn.btn-link {
    display: inline;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--link);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    vertical-align: baseline;
}
.btn.btn-link:hover { background: none; color: var(--link-hover); }
.btn.btn-link:disabled,
.btn.btn-link.disabled {
    background: none;
    border: 0;
    color: var(--text-muted);
    font-weight: 400;
    text-decoration: none;
    cursor: default;
}
.btn:disabled, .btn.disabled {
    background: var(--surface-sunk);
    border-color: var(--border);
    color: var(--text-muted);
    box-shadow: none;
}
/* The clipped variant, inside geometric and sign-in compositions. */
.btn-clip {
    border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.btn-close { opacity: .6; }
:root[data-theme="dark"] .btn-close { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-close { filter: invert(1); } }

.page-link { background: var(--surface); color: var(--text-main); border-color: var(--border); border-radius: 999px; min-width: 36px; text-align: center; }
.page-link:hover { background: var(--surface-hover); color: var(--text-strong); }
.page-item.active .page-link { background: var(--psu-burnt); border-color: var(--psu-burnt); color: #FFFFFF; }

.wizard-step .step-num { background: var(--surface); border-color: var(--border-control); color: var(--text-muted); }
.wizard-step.active .step-num { background: var(--psu-burnt); border-color: var(--psu-burnt); color: #FFFFFF; box-shadow: 0 0 0 4px rgba(231, 114, 57, .22); }
.wizard-step.done .step-num { background: var(--success-bg); border-color: var(--success-line); color: var(--success-ink); }
.wizard-connector { background: var(--border-strong); }

.pick { background: var(--surface); border: 2px solid var(--border); border-radius: var(--r3); color: var(--text-main); }
.pick:hover { border-color: var(--psu-burnt); background: var(--surface-hover); }
.pick.is-full, .pick:disabled { background: var(--surface-sunk); }
.pick.is-busy:disabled, .pick.is-busy:disabled:hover { background: var(--psu-peach-soft); border-color: var(--psu-burnt); }

.skip-link { background: var(--psu-burnt-dark); color: #FFFFFF; }

/* Focus: one strong orange ring everywhere. */
a:focus-visible, button:focus-visible, .btn:focus-visible, .page-link:focus-visible,
.form-check-input:focus-visible, .pick:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--bg);
}
.form-control:focus-visible, .form-select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

/* ═══════════════════════════════════════════════════════════════════════
   MESSAGES
   One component for every message: toasts, inline alerts, Step 2's
   document results, the Step 3/4 lists, the camera screen, dialogs and the
   Sticker Office's document checks. Four levels, each with its own icon,
   colour and a word label, so colour is never the only signal:
     .alert-danger / -error   "Action required"  red     role="alert"
     .alert-warning           "Please check"     amber   role="status"
     .alert-info              "Note"             peach   role="status"
     .alert-success           "Accepted"         green   role="status"
   ═══════════════════════════════════════════════════════════════════════ */
.alert {
    --msg-bar:  var(--neutral-line);
    --msg-ink:  var(--neutral-ink);
    --msg-bg:   var(--surface);
    --msg-line: var(--border);
    display: flex;
    align-items: flex-start;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: var(--msg-bg);
    border: 1px solid var(--msg-line);
    border-left: 5px solid var(--msg-bar);
    border-radius: var(--r2);
    color: var(--text-main);
    font-size: var(--fs-xs);
    line-height: var(--lh-snug);
}
.alert > .ic { width: 20px; height: 20px; margin-top: 1px; color: var(--msg-ink); stroke-width: 2; }
.alert strong { color: var(--text-strong); font-weight: 600; }
.alert a { color: var(--msg-ink); font-weight: 600; }
.alert-danger, .alert-error { --msg-bar: var(--danger); --msg-ink: var(--danger-ink); --msg-bg: var(--danger-bg); --msg-line: var(--danger-line); }
.alert-warning { --msg-bar: var(--warning); --msg-ink: var(--warning-ink); --msg-bg: var(--warning-bg); --msg-line: var(--warning-line); }
.alert-info    { --msg-bar: var(--psu-orange); --msg-ink: var(--info-ink); --msg-bg: var(--info-bg); --msg-line: var(--info-line); }
.alert-success { --msg-bar: var(--success); --msg-ink: var(--success-ink); --msg-bg: var(--success-bg); --msg-line: var(--success-line); }
.alert-danger, .alert-error, .alert-warning, .alert-info, .alert-success,
.alert-primary, .alert-secondary { color: var(--text-main); }

.alert-content { flex: 1 1 auto; min-width: 0; }
.alert-label {
    display: block;
    margin: 0 0 2px;
    font-size: var(--fs-micro);
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1.3;
    text-transform: uppercase;
    color: var(--msg-ink);
}
.alert-title {
    display: block;
    margin: 0;
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: var(--lh-snug);
    color: var(--text-strong);
}
.alert-details { margin: var(--s1) 0 0; padding: 0; list-style: none; }
.alert-details li { position: relative; padding-left: 14px; margin-top: 2px; white-space: pre-line; }
.alert-details li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: .6em;
    width: 5px;
    height: 5px;
    background: var(--msg-ink);
}
.alert-text { margin: var(--s1) 0 0; white-space: pre-line; }
.alert-next { display: flex; align-items: center; gap: 6px; margin: var(--s2) 0 0; font-weight: 600; color: var(--msg-ink); }
.alert-next::before { content: "\2192"; }
.alert-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }

.messages-wrap { top: calc(var(--topbar-h) + var(--s3)); width: min(400px, calc(100vw - 2 * var(--s4))); }
.messages-wrap .alert { box-shadow: var(--sh-pop); }
.messages-wrap .alert .flex-1 { white-space: normal; }

.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.check-list .alert { margin: 0; padding: var(--s2) var(--s3); }
.check-list .alert > .ic { width: 18px; height: 18px; }
.check-list .alert-title { font-size: var(--fs-xs); }
.check-list .alert-text { margin-top: 0; }

/* Sticker Office "Document checks": counts in the header, what needs a look
   in full, the passed checks as one grouped checklist that opens on demand. */
.check-counts { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.check-counts .status-badge .ic { width: 12px; height: 12px; }
.checks-passed {
    border: 1px solid var(--success-line);
    border-left: 4px solid var(--success);
    border-radius: var(--r2);
    background: var(--success-bg);
}
.checks-passed > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 var(--s3);
    color: var(--text-strong);
    font-size: var(--fs-xs);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.checks-passed > summary::-webkit-details-marker { display: none; }
.checks-passed > summary > .ic { width: 18px; height: 18px; color: var(--success-ink); flex: none; }
.checks-passed > summary .alert-label { display: inline; margin-right: 6px; color: var(--success-ink); }
.checks-passed > summary::after {
    content: "Show";
    margin-left: auto;
    color: var(--link);
    font-size: var(--fs-2xs);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.checks-passed[open] > summary::after { content: "Hide"; }
.passed-list {
    margin: 0;
    padding: var(--s1) var(--s3) var(--s3);
    border-top: 1px solid var(--success-line);
    background: var(--surface);
}
.passed-list dt {
    margin: var(--s3) 0 4px;
    font-size: var(--fs-micro);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.passed-list dd {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0 0 3px;
    font-size: var(--fs-xs);
    color: var(--text-main);
    line-height: 1.4;
}
.passed-list dd .ic { width: 14px; height: 14px; margin-top: .15em; color: var(--success-ink); stroke-width: 2.3; flex: none; }

/* A flat row, one per line, so a note that wraps still reads as one tidy
   block (a rounded pill turned into a lumpy blob on a phone). */
.check-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 6px;
    padding: 4px 10px 4px 8px;
    border: 0;
    border-left: 3px solid var(--success);
    border-radius: 0 4px 4px 0;
    background: var(--success-bg);
    color: var(--success-ink);
    font-size: var(--fs-2xs);
    font-weight: 600;
    line-height: 1.4;
}
.check-note:last-child { margin-bottom: 0; }
.check-note .ic { width: 13px; height: 13px; margin-top: .15em; stroke-width: 2.3; flex: none; }
.check-note.is-attention { border-left-color: var(--warning); background: var(--warning-bg); color: var(--warning-ink); }
.check-note.is-neutral { border-left-color: var(--psu-orange); background: var(--info-bg); color: var(--info-ink); }

.doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border: 1px solid var(--neutral-line);
    border-radius: 999px;
    background: var(--neutral-bg);
    color: var(--neutral-ink);
    font-size: var(--fs-micro);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}
.doc-chip .ic { width: 13px; height: 13px; stroke-width: 2.3; }
.doc-chip.is-accepted { background: var(--success-bg); color: var(--success-ink); border-color: var(--success-line); }
.doc-chip.is-action   { background: var(--danger-bg);  color: var(--danger-ink);  border-color: var(--danger-line); }
.doc-chip.is-checking { background: var(--info-bg);    color: var(--info-ink);    border-color: var(--info-line); }
.doc-chip.is-na       { background: transparent; }

/* A quiet guidance panel (page content, not a message). */
.note {
    background: var(--surface-warm);
    border: 1px solid var(--border);
    border-left: 3px solid var(--psu-orange);
    border-radius: var(--r2);
    color: var(--text-muted);
}
.note .ic { color: var(--psu-orange); }
.note strong { color: var(--text-strong); }

/* ── Dialogs ───────────────────────────────────────────────────────────── */
.confirm-dialog {
    background: var(--surface);
    color: var(--text-main);
    border: 2px solid var(--card-line);
    border-top: 4px solid var(--psu-orange);
    border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.confirm-dialog::backdrop { background: rgba(20, 21, 25, .55); }
.confirm-title { font-weight: 700; color: var(--text-strong); }
.confirm-body p { color: var(--text-muted); }
.confirm-record { background: var(--surface-sunk); border-color: var(--border); border-radius: var(--r2); }
.confirm-mark { border-radius: var(--r2); }

/* ── Smaller pieces ────────────────────────────────────────────────────── */
.icon-plate { border-radius: var(--r2); background: var(--surface-sunk); border-color: var(--border); color: var(--text-main); }
.icon-plate.accent { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }
.status-panel { padding: calc(var(--s5) + 2px); }
.status-panel h2 { font-weight: 700; }
.window-dates, .confirm-record { background: var(--surface-sunk); border-color: var(--border); color: var(--text-strong); }
.otp-cell.is-filled { border-color: var(--psu-burnt); background: var(--psu-peach-soft); }
.steps-inline li::before { background: var(--psu-peach-soft); border-color: var(--info-line); color: var(--info-ink); }
.doc-item { background: var(--success-bg); border-color: var(--success-line); }
.doc-item .doc-name { color: var(--text-main); }
.section-divider { border-color: var(--border); }
.text-muted { color: var(--text-muted) !important; }
.capacity-track { background: var(--border); }
.empty-state h3 { color: var(--text-strong); }

/* ═══════════════════════════════════════════════════════════════════════
   SIGNED-OUT PAGES: full-height split
   Left about 40 %: solid orange institutional panel. Right: warm cream
   workspace with the main gate photograph beneath a translucent overlay,
   and the page's own heading and form card on top.
   ═══════════════════════════════════════════════════════════════════════ */
.main-content.no-sidebar { margin-left: 0; margin-top: var(--topbar-h); padding: 0; min-height: 0; }
.main-content.no-sidebar > .shell-narrow,
.main-content.no-sidebar > .shell { padding: var(--s7) var(--s4); }
/* The error pages have no header. */
body:not(:has(.public-header)):not(:has(.topbar)) .main-content.no-sidebar { margin-top: 0; }

.auth-shell {
    display: grid;
    grid-template-columns: minmax(340px, 41%) minmax(0, 1fr);
    min-height: calc(100vh - var(--topbar-h));
    min-height: calc(100dvh - var(--topbar-h));
}
.auth-brand {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    padding: clamp(40px, 7vh, 84px) clamp(28px, 4.5vw, 64px);
    /* Solid orange, deepened where the white text sits (4.55 .. 5.3:1). */
    background: #C94F18;
    color: #FFFFFF;
}
.auth-brand-shapes { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.auth-brand-shapes .sh-light  { fill: #F0A044; fill-opacity: .10; }
.auth-brand-shapes .sh-orange { fill: #E77239; fill-opacity: .22; }
.auth-brand-shapes .sh-dark   { fill: #8F3714; fill-opacity: .30; }
.auth-brand-mark { display: flex; align-items: center; gap: var(--s4); }
.auth-brand-seal { width: 64px; height: 64px; flex: none; border-radius: 50%; background: #FFFFFF; padding: 2px; }
.auth-brand-kicker,
.auth-brand-product { margin: 0; font-size: var(--fs-micro); font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.auth-brand-name { margin: 2px 0; font-size: clamp(1.25rem, 1rem + .8vw, 1.625rem); font-weight: 700; line-height: 1.15; }
.auth-brand-rule { height: 1px; margin: var(--s7) 0; border: 0; background: rgba(255, 238, 222, .55); opacity: 1; }
.auth-brand .eyebrow { color: #FFFFFF; }
.auth-brand-headline {
    margin: 0 0 var(--s5);
    max-width: 13ch;
    font-size: clamp(2.25rem, 1.2rem + 3.2vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.02;
    color: #FFFFFF;
}
.auth-brand-lede { margin: 0; max-width: 44ch; font-size: var(--fs-md); line-height: var(--lh-body); }

.auth-stage {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    background: var(--bg);
}
/* The gate photograph: decorative, a CSS background, so it has no alt text.
   Cover keeps its own proportions; the arch and its name stay in view. */
.auth-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image: url("../img/psu-main-gate.ffcd2420e35e.jpg");
    background-image: image-set(url("../img/psu-main-gate.48b7166e60cf.webp") type("image/webp"),
                                url("../img/psu-main-gate.ffcd2420e35e.jpg") type("image/jpeg"));
    background-size: cover;
    background-position: 50% 22%;
}
.auth-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 34% 32% at 50% 64%, var(--photo-overlay-strong) 0 55%, transparent 100%),
        linear-gradient(var(--photo-overlay), var(--photo-overlay));
}
.auth-photo { display: none; }
.auth-stage .auth-wrap { min-height: 0; display: block; width: 100%; max-width: 520px; margin: 0 auto; padding: var(--s12) var(--s6); }
.auth-stage .auth-col, .auth-stage .auth-col-wide { max-width: none; }
.auth-stage .auth-col-wide { width: 100%; }
.auth-stage .auth-wrap:has(.auth-col-wide) { max-width: 680px; }
.auth-stage .eyebrow { color: var(--eyebrow); }
:root:not([data-theme="dark"]) .auth-stage .eyebrow { color: #8F3714; }
.auth-head { text-align: left; margin-bottom: var(--s6); }
.auth-head h1 { font-size: var(--fs-display); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; }
.auth-head p { font-size: var(--fs-md); color: var(--text-on-photo-muted); margin-top: var(--s3); }
.auth-mark { margin: 0 0 var(--s4); border-radius: var(--r2); }

/* The form card: thin edge, solid orange top rule, clipped corner. */
.auth-card {
    --cut-sm: 0px;
    --card-line: var(--border-strong);
    padding: 1px;
    filter: drop-shadow(0 10px 14px rgba(var(--card-shadow), .14));
}
.auth-card::after { inset: 1px; border-top: 4px solid var(--psu-orange); }
.auth-card .card-body { padding: calc(var(--s7) + 4px) var(--s7) var(--s7); }
.auth-card h2 { font-size: var(--fs-lg); font-weight: 600; margin-bottom: var(--s5); }
.auth-card .field-link { color: var(--link); font-weight: 600; }
.auth-card .btn-primary {
    border-radius: 0;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.auth-alt { color: var(--text-on-photo-muted); }
.auth-alt a { color: var(--link); }
:root:not([data-theme="dark"]) .auth-alt a { color: #8F3714; }
.auth-stage .note { background: var(--surface); }

/* ── GUIDE: long guidance on the application steps ─────────────────────────
   A <details> section: closed on a phone (one line to tap), open and shown as
   the usual note on a computer, where the summary line is not needed. */
.guide > summary {
    display: flex;
    align-items: center;
    gap: var(--s2);
    min-height: 44px;
    padding: 0 var(--s3);
    border: 1px solid var(--border);
    border-left: 3px solid var(--psu-orange);
    border-radius: var(--r2);
    background: var(--surface-warm);
    color: var(--link);
    font-size: var(--fs-xs);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary::after { content: "+"; margin-left: auto; font-size: 1.1rem; }
.guide[open] > summary::after { content: "\2212"; }
.guide[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.guide[open] > .note { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.guide > .note > .ic { display: none; }
@media (min-width: 769px) {
    .guide > summary { display: none; }
    .guide[open] > .note { border-top: 1px solid var(--border); border-radius: var(--r2); }
    .guide > .note > .ic { display: inline; }
}

/* ── The application steps on a phone: only what needs attention ───────── */
@media (max-width: 768px) {
    /* The step indicator says where you are: no eyebrow or subtitle. */
    .page-header:has(+ nav.wizard-wrap) .eyebrow,
    .page-header:has(+ nav.wizard-wrap) .page-sub { display: none; }
    .page-header:has(+ nav.wizard-wrap) { padding-bottom: var(--s3); margin-bottom: var(--s4); }
    .page-header:has(+ nav.wizard-wrap) h1 { font-size: var(--fs-2xl); margin: 0; }
    /* An accepted document's chip already says "Accepted". */
    .upload-status.alert-success { display: none; }
    .capture-field { padding-bottom: var(--s3); }
    .capture-field .form-text:not(.field-check):not(.upload-status) { font-size: var(--fs-2xs); }
    /* "Filled in from your OR": one compact line. */
    form .field-check.is-saved { padding: 4px 8px 4px 28px; background-position: 8px 50%; background-size: 14px 14px; }
    form .field-check.is-saved::before { display: inline; margin-right: 6px; }
}

/* On a computer the signed-out screens fill the window exactly and the page
   itself never scrolls: spacing and type follow the window's height so the
   sign-in form fits on a laptop screen, and a form too long to fit (create
   account) scrolls inside its own column. Phones scroll as usual (below). */
@media (min-width: 769px) {
    .auth-shell {
        height: calc(100vh - var(--topbar-h));
        height: calc(100dvh - var(--topbar-h));
        min-height: 0;
    }
    body:not(:has(.public-header)) .auth-shell { height: 100vh; height: 100dvh; }
    .auth-brand, .auth-stage { overflow-y: auto; overscroll-behavior: contain; }
    .auth-brand { padding: clamp(20px, 5vh, 84px) clamp(28px, 4.5vw, 64px); }
    .auth-brand-rule { margin: clamp(12px, 3vh, 28px) 0; }
    .auth-brand-headline {
        font-size: clamp(1.75rem, min(3.6vw, 7vh), 4rem);
        margin-bottom: clamp(10px, 2.2vh, 20px);
    }
    .auth-stage { justify-content: flex-start; }
    .auth-stage .auth-wrap { margin: auto; padding: clamp(16px, 4vh, 48px) var(--s6); }
    .auth-head { margin-bottom: clamp(12px, 2.6vh, 24px); }
    .auth-head h1 { font-size: clamp(1.75rem, 5.4vh, 2.75rem); }
    .auth-head p { margin-top: clamp(4px, 1vh, 12px); }
    .auth-card .card-body { padding: clamp(18px, 3.4vh, 32px) var(--s7) clamp(16px, 3vh, 28px); }
    .auth-card h2 { margin-bottom: clamp(10px, 2vh, 20px); }
    .auth-card .mb-3 { margin-bottom: clamp(8px, 1.8vh, 16px) !important; }
    .auth-card .mb-4 { margin-bottom: clamp(10px, 2.2vh, 24px) !important; }
    .auth-alt { margin-top: clamp(8px, 1.6vh, 16px); }
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════ */
/* The left fragment only where the university's name has room. */
@media (max-width: 1239px) { .header-geo .frag-a { display: none; } }
@media (max-width: 1039px) { .header-geo .frag-b { display: none; } }

@media (max-width: 991px) {
    .main-content { padding: var(--s6) var(--s6) var(--s8); }
    .auth-shell { grid-template-columns: minmax(300px, 40%) minmax(0, 1fr); }
    .auth-brand-headline { font-size: clamp(2rem, 1rem + 3vw, 2.75rem); }
}

@media (max-width: 768px) {
    :root { --topbar-h: 60px; }
    .topbar, .public-header { padding: 0 var(--s3); gap: var(--s2); }
    .brand { gap: var(--s2); flex: 1 1 auto; }
    .brand-seal { width: 36px; height: 36px; }
    .brand-name { font-size: var(--fs-xs); letter-spacing: .01em; }
    .brand-kicker { display: none; }
    .header-geo-wide { display: none; }
    .header-geo-narrow { display: block; }
    /* The name stays on the white, clear of the two fragments. */
    .public-header .header-geo-narrow { width: 116px; }
    .public-header .brand { max-width: calc(100% - 116px); }
    .topbar-user, .header-tools { gap: var(--s2); flex: none; }
    .topbar-user .avatar, .topbar-user .user-info { display: none; }
    .btn-logout { width: 44px; padding: 0; justify-content: center; }

    /* The sidebar becomes a drawer: 84vw, at most 320px. */
    .sidebar { width: min(84vw, 320px); transform: translateX(-105%); box-shadow: var(--sh-pop); }
    .sidebar.open { transform: translateX(0); }
    body:has(.sidebar.open) { overflow: hidden; }
    .main-content { margin-left: 0; padding: var(--s5) var(--s4) var(--s8); }

    .messages-wrap { top: auto; width: auto; }
    .stat-value { font-size: 2.375rem; }

    /* Signed out on a phone: the orange panel is a short band above the
       form; the photograph stays beneath the form workspace. */
    .auth-shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
    .auth-brand { padding: var(--s5) var(--s4); }
    /* The header above already names the University: the band keeps only
       its headline. */
    .auth-brand-mark,
    .auth-brand-rule,
    .auth-brand .eyebrow, .auth-brand-lede { display: none; }
    .auth-brand-headline { margin: 0; max-width: none; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.2; }
    .auth-stage { justify-content: flex-start; }
    .auth-stage::before {
        background-image: url("../img/psu-main-gate-800.ac6021aa1c38.jpg");
        background-image: image-set(url("../img/psu-main-gate-800.d5fc65a62ca7.webp") type("image/webp"),
                                    url("../img/psu-main-gate-800.ac6021aa1c38.jpg") type("image/jpeg"));
        background-position: 50% 0;
    }
    .auth-stage::after { background: linear-gradient(var(--photo-overlay-strong), var(--photo-overlay-strong)); }
    .auth-stage .auth-wrap { padding: var(--s7) var(--s4) var(--s10); max-width: none; }
    .auth-card .card-body { padding: var(--s6) var(--s5) var(--s5); }
    .auth-card .btn-primary, .status-panel-action .btn { width: 100%; }
}

@media (max-width: 420px) {
    .brand-sub { display: block; font-size: var(--fs-micro); }
    .main-content { padding: var(--s4) var(--s4) var(--s8); }
}
@media (max-width: 359px) { .topbar .brand-seal, .public-header .brand-seal { display: none; } }

@media (prefers-reduced-motion: reduce) {
    .card, .stat-card, .status-panel, .sidebar { transition: none; }
}


/* ═══════════════════════════════════════════════════════════════════════
   POLISH (2026-11-12): hierarchy, tables, empty states, phone header
   From rendering every page at 1440 and 390 px and checking each for cut-off
   text, wrapping, alignment and contrast.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Hierarchy ─────────────────────────────────────────────────────────── */
/* A record page (application review, issue sticker) names the record: its
   title carries the same weight as any other page title. */
.record-title h1 { font-size: clamp(1.625rem, 1.2rem + 1.2vw, 2.25rem); letter-spacing: -0.03em; line-height: 1.1; }
.record-sub { align-items: center; margin-top: var(--s3); font-size: var(--fs-xs); }
.page-header .page-sub { margin-top: var(--s1); }
/* Card titles: one clear step below the page title, above body text. */
.card-header { min-height: 56px; }
.card-title { font-size: var(--fs-md); letter-spacing: -0.01em; }
.card-header .meta { font-size: var(--fs-2xs); }
/* Label / value tables: quiet labels, strong values. */
.kv th { font-size: var(--fs-2xs); font-weight: 500; }
.kv td { font-size: var(--fs-sm); font-weight: 500; }
/* "Change" on the review step is an action, not a caption. */
.card-header .field-link { color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.card-header .field-link:hover { color: var(--link-hover); }
.micro-label { color: var(--text-muted); letter-spacing: .12em; }

/* ── The application steps ─────────────────────────────────────────────── */
/* Room between the step indicator and the card under it. */
nav.wizard-wrap { margin-bottom: var(--s5); }
.wizard-step { font-size: var(--fs-xs); }
.wizard-step.active { color: var(--text-strong); }
.wizard-step .step-num { width: 28px; height: 28px; }

/* ── Tables ────────────────────────────────────────────────────────────── */
/* A cell never breaks a name, a date or an identifier across lines; a table
   too wide for its card scrolls inside it (.table-responsive). */
.table thead th,
.table tbody td { white-space: nowrap; }
.table tbody td.wrap,
.table tbody td .empty-state,
.table tbody td .empty-state * { white-space: normal; }
.table tbody td { font-size: var(--fs-xs); }
.table .btn-sm { min-width: 72px; }
/* Nine columns fit a 1440 px screen without scrolling. */
.table thead th,
.table tbody td { padding-inline: var(--s3); }
.table thead th:first-child,
.table tbody td:first-child { padding-left: var(--s4); }
.table thead th:last-child,
.table tbody td:last-child { padding-right: var(--s4); }
/* An empty table shows its message, not a row of headings to scroll past. */
.table:has(.empty-state) thead { display: none; }
.table:has(.empty-state) tbody tr:hover { background: transparent; }
.table-responsive { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ── Empty states ──────────────────────────────────────────────────────── */
.empty-state { padding: var(--s10) var(--s5); }
.empty-state > .ic {
    width: 52px;
    height: 52px;
    padding: 14px;
    color: var(--info-ink);
    background: var(--info-bg);
    stroke-width: 1.7;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.empty-state h3 { margin: var(--s4) 0 var(--s1); font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; }
.empty-state p { max-width: 46ch; font-size: var(--fs-xs); line-height: var(--lh-body); color: var(--text-muted); }
.empty-state .btn { margin-top: var(--s4); }

/* ── Components ────────────────────────────────────────────────────────── */
/* Buttons: a calm lift on hover, a press on click; never on a disabled one. */
.btn-primary:not(:disabled):hover { box-shadow: 0 6px 16px rgba(169, 68, 22, .30); transform: translateY(-1px); }
.btn:not(:disabled):active { transform: translateY(0); }
/* Filter bars: labels and controls on one baseline. */
.filter-bar .form-label { margin-bottom: 6px; letter-spacing: .1em; }
.filter-bar .form-control,
.filter-bar .form-select { min-height: 44px; font-size: var(--fs-sm); padding: 8px 12px; }
.filter-summary { border-top-color: var(--border); }
/* Status panel: icon, words and action on one centre line on a computer. */
.status-panel { align-items: center; gap: var(--s5); }
.status-panel h2 { font-size: var(--fs-xl); letter-spacing: -0.02em; }
.status-panel p { font-size: var(--fs-sm); }
.icon-plate {
    width: 44px;
    height: 44px;
    border: 0;
    font-size: var(--fs-lg);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.icon-plate.success { background: var(--success-bg); color: var(--success-ink); }
.icon-plate.warning { background: var(--warning-bg); color: var(--warning-ink); }
.icon-plate.danger { background: var(--danger-bg); color: var(--danger-ink); }
.window-dates { padding: 4px 10px; font-size: var(--fs-2xs); }
/* Long values never push a card wider than the screen. */
.kv td, .alert-text, .alert-title, .record-sub span, .doc-row-name { overflow-wrap: anywhere; }
.record-title { row-gap: var(--s2); }
/* A reading or a date breaks between words, never inside one. */
.doc-item .doc-name { word-break: normal; overflow-wrap: anywhere; }
.reader-status-row .reader-chip strong { white-space: nowrap; }
.card-header .status-badge { font-size: var(--fs-micro); }

/* ── Phone ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* The header names the University in full with the area under it; the
       product name stays on the wider screens, where there is room. */
    .topbar .brand-product { display: none; }
    .topbar .brand-name { font-size: 0.75rem; letter-spacing: .01em; line-height: 1.12; white-space: normal; overflow: visible; }
    .topbar .brand-sub { margin-top: 1px; }
    .topbar .brand-sub { letter-spacing: .1em; }
    .topbar .header-geo-narrow { width: 150px; }
    .topbar .brand-text { flex: 1 1 auto; }

    .page-header,
    .toolbar:has(> .page-header),
    .live-scope-row,
    .record-head { padding-bottom: var(--s4); margin-bottom: var(--s5); }
    .page-header h1, .page-header h2, .live-scope-row h1 { font-size: 1.75rem; }
    .page-header .page-sub, .live-scope-row .page-sub { font-size: var(--fs-sm); }
    .record-head > .btn { width: 100%; justify-content: center; }
    .record-sub { gap: var(--s1) var(--s3); }
    .reader-status-row .reader-chip { border-radius: 10px; align-items: flex-start; }
    .reader-status-row .reader-chip .ic { margin-top: .5em; }
    .card-header { padding: var(--s3) var(--s4); }
    .card-body { padding: var(--s4); }
    .kv th { width: 40%; padding: 10px var(--s4); }
    .kv td { padding: 10px var(--s4); }
    .stat-card { padding: var(--s4); }
    .stat-icon, .stat-icon-box { width: 36px; height: 36px; padding: 9px; }
    .stat-label { letter-spacing: .1em; }
    .status-panel { align-items: stretch; gap: var(--s3); }
    .empty-state { padding: var(--s8) var(--s4); }
    .table tbody td { padding: 12px var(--s3); }
    .table thead th { padding: 8px var(--s3); }
}
@media (max-width: 359px) {
    .topbar .brand-sub { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   DASHBOARD: what needs doing first
   Two task cards (review, hand out) lead; reference counts follow in one
   quiet row. A card is red only when something is overdue, and says so in
   words; with nothing waiting it shows a green "All caught up", not a 0.
   ═══════════════════════════════════════════════════════════════════════ */
.dash-section { margin-bottom: var(--s6); }
.dash-section-title {
    margin: 0 0 var(--s3);
    font-size: var(--fs-micro);
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.action-card { padding: var(--s6); gap: var(--s4); }
.action-head { display: flex; align-items: flex-start; gap: var(--s3); }
.action-title { margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; color: var(--text-strong); }
.action-desc { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--text-muted); }
.action-count { display: flex; align-items: baseline; gap: var(--s2); margin: 0; }
.action-unit { font-size: var(--fs-md); font-weight: 600; color: var(--text-main); }
.action-note,
.action-flag {
    display: flex;
    align-items: flex-start;
    gap: var(--s2);
    margin: 0;
    font-size: var(--fs-xs);
    line-height: 1.4;
}
.action-note { color: var(--text-muted); }
.action-note .ic,
.action-flag .ic { flex: none; width: 1em; height: 1em; margin-top: .2em; }
/* The overdue line is the loudest thing on the page, and a link to just
   those applications. */
.action-flag {
    padding: 10px var(--s3);
    border-left: 3px solid var(--danger-line);
    background: var(--danger-bg);
    color: var(--danger-ink);
    font-weight: 500;
    text-decoration: none;
}
.action-flag strong { font-weight: 700; }
.action-flag:hover { color: var(--danger-ink); text-decoration: underline; text-underline-offset: 3px; }
.action-btn { align-self: flex-start; margin-top: auto; gap: var(--s2); }
.action-card .stat-value { font-size: clamp(2.5rem, 2rem + 1.4vw, 3.5rem); }
.action-card.accent .stat-value { color: var(--kpi-orange); }
/* Overdue: a heavier outline, so it reads first among the cards. */
.action-card.is-overdue::before { inset: -1px; }
.action-clear { margin: auto 0 0; font-size: var(--fs-sm); color: var(--text-muted); }
.action-clear strong { display: block; margin-bottom: 2px; font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; color: var(--success-ink); }

/* At a glance: three counts in one card, no colour, no links. */
.glance {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    padding: var(--s4) 0;
}
.glance-item { padding: var(--s1) var(--s5); }
.glance-item + .glance-item { border-left: 1px solid var(--border); }
.glance dt {
    font-size: var(--fs-micro);
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.glance dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2); margin: var(--s1) 0 0; }
.glance-value { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; color: var(--text-strong); }
.glance-note { font-size: var(--fs-2xs); color: var(--text-muted); }

@media (max-width: 768px) {
    .action-card { padding: var(--s5) var(--s4); }
    .action-btn { align-self: stretch; justify-content: center; }
    .glance { padding: var(--s3) 0; }
    .glance-item { padding: var(--s1) var(--s3); }
    .glance dt { letter-spacing: .08em; }
    .glance-value { font-size: var(--fs-xl); }
}
.filter-sort { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2xs); color: var(--text-muted); }
.filter-sort .ic { width: 1em; height: 1em; }
/* The three counts sit on one line even when a label wraps. */
.glance-item { display: flex; flex-direction: column; }
.glance dd { margin-top: auto; padding-top: var(--s1); }
@media (max-width: 768px) {
    .glance-note { flex-basis: 100%; }
}
