@charset "UTF-8";
/*
 * Student Device Registration & Network Management System
 * ------------------------------------------------------------------
 * A deliberately plain admin stylesheet: flat surfaces separated by 1px
 * borders, a 4px radius, 14px type, and no gradients. Colour is used to say
 * what kind of thing something is, and for nothing else.
 */

/* ------------------------------------------------------------------ tokens */

:root {
    color-scheme: light;

    --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Mono", Consolas, "Courier New", monospace;

    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-alt: #f8f9fa;
    --surface-inset: #fbfcfd;
    --border: #dee2e6;
    --border-soft: #e9ecef;
    --row-hover: #f1f4f8;

    --text: #212529;
    --text-muted: #6c757d;
    --text-faint: #adb5bd;

    --primary: #1a4f8a;
    --primary-hover: #153f6f;
    --primary-fg: #ffffff;
    --primary-soft-bg: #e7eef7;
    --primary-soft-border: #b8cbe3;
    --primary-soft-fg: #14375f;

    --success: #1e7e34;
    --success-bg: #d4edda;
    --success-border: #a3cfbb;
    --success-fg: #155724;

    --danger: #b02a37;
    --danger-bg: #f8d7da;
    --danger-border: #f1aeb5;
    --danger-fg: #58151c;

    --warning: #8a6d1f;
    --warning-bg: #fff3cd;
    --warning-border: #ffeeba;
    --warning-fg: #664d03;

    --info: #0c5460;
    --info-bg: #d1ecf1;
    --info-border: #a5d8de;
    --info-fg: #0c5460;

    --secondary: #6c757d;
    --secondary-bg: #e9ecef;

    --gold: #b8860b;
    --gold-bg: #fdf6e3;
    --gold-border: #e8d9a6;
    --gold-fg: #6b5310;

    --side-bg: #1f2d3d;
    --side-border: #16212e;
    --side-text: #b9c2cd;
    --side-strong: #ffffff;
    --side-muted: #8593a4;
    --side-heading: #6b7a8d;
    --side-hover: #29394e;
    --side-active: #2b3c52;
    --side-accent: #c9a227;

    /* Landing panel. The sign-in hero sits on the same dark navy as the
       sidebar, and that panel stays dark in both themes, so the colours drawn
       on top of it cannot follow --text/--border: those flip, and navy-on-navy
       would be unreadable. These therefore describe light ink on a dark ground
       and are deliberately NOT restated in [data-theme="dark"] -- the same
       treatment --side-text and --side-accent already get.
       The -rgb triplets exist for the alpha washes; the plain hex cannot be
       faded without color-mix(). */
    --panel-accent: #c9a227;
    --panel-accent-rgb: 201, 162, 39;
    --panel-ok: #6fcf8a;
    --panel-ok-rgb: 111, 207, 138;
    --panel-warn: #e0be6a;
    --panel-warn-rgb: 224, 190, 106;

    --overlay: rgba(0, 0, 0, .5);
    --focus: #1a4f8a;

    /* read by the dashboard charts so the plots follow the theme */
    --brand: #1a4f8a;
    --chart-ink: #495057;
    --chart-grid: rgba(0, 0, 0, .12);
    --blue-dot: #1a4f8a;
    --green-dot: #1e7e34;
    --amber-dot: #b8860b;
    --red-dot: #b02a37;
    --violet-dot: #5b4b8a;
    --cyan-dot: #0c5460;
    --slate-dot: #6c757d;

    /* Status palette. Each state is defined once here and every consumer --
       badge, legend dot and chart slice -- reads the same token, so a status
       can never be one colour in a legend and another in a plot. The dark
       theme only has to restate the same names. */
    --st-approved: #1e7e34;
    --st-pending: #1a4f8a;
    --st-blocked: #c2570a;
    --st-revoked: #9b2c5f;
    --st-rejected: #b02a37;
    --st-inactive: #6c757d;
    --st-allow: #1e7e34;
    --st-deny: #b02a37;
    --st-quarantine: #b8860b;

    /* Categorical ramp, for series with no fixed meaning (device types,
       activity actions, network segments). */
    --series-1: #1a4f8a;
    --series-2: #1e7e34;
    --series-3: #b8860b;
    --series-4: #5b4b8a;
    --series-5: #0c5460;
    --series-6: #b02a37;
    --series-7: #6c757d;
    --series-8: #8a5a2b;

    --radius: 4px;
    --radius-sm: 3px;
    --radius-lg: 6px;

    --sidebar-w: 250px;
    --topbar-h: 56px;
}

[data-theme="dark"] {
    color-scheme: dark;

    --bg: #212529;
    --surface: #2b3035;
    --surface-alt: #343a40;
    --surface-inset: #272c31;
    --border: #495057;
    --border-soft: #3d4348;
    --row-hover: #343a40;

    --text: #dee2e6;
    --text-muted: #adb5bd;
    --text-faint: #868e96;

    --primary: #6ea8e0;
    --primary-hover: #8bb9e7;
    --primary-fg: #14181c;
    --primary-soft-bg: #23344a;
    --primary-soft-border: #35506f;
    --primary-soft-fg: #a8c8ea;

    --success: #6fcf8a;
    --success-bg: #1f3b28;
    --success-border: #2f5b3c;
    --success-fg: #a5e0b6;

    --danger: #e78b95;
    --danger-bg: #43242a;
    --danger-border: #66343d;
    --danger-fg: #f2b8bf;

    --warning: #e0be6a;
    --warning-bg: #41351a;
    --warning-border: #5f4e26;
    --warning-fg: #f0d9a4;

    --info: #79c6d4;
    --info-bg: #1c3840;
    --info-border: #2b5560;
    --info-fg: #a9dbe4;

    --secondary: #adb5bd;
    --secondary-bg: #3d4348;

    --gold: #d9b64a;
    --gold-bg: #3b3319;
    --gold-border: #574a25;
    --gold-fg: #e8d19a;

    --side-bg: #171c21;
    --side-border: #101418;
    --side-hover: #212830;
    --side-active: #26313c;

    --brand: #6ea8e0;
    --chart-ink: #adb5bd;
    --chart-grid: rgba(255, 255, 255, .18);
    --blue-dot: #6ea8e0;
    --green-dot: #6fcf8a;
    --amber-dot: #e0be6a;
    --red-dot: #e78b95;
    --violet-dot: #a48bd4;
    --cyan-dot: #79c6d4;
    --slate-dot: #adb5bd;

    --st-approved: #6fcf8a;
    --st-pending: #6ea8e0;
    --st-blocked: #f0a35e;
    --st-revoked: #ef7fa0;
    --st-rejected: #e78b95;
    --st-inactive: #adb5bd;
    --st-allow: #6fcf8a;
    --st-deny: #e78b95;
    --st-quarantine: #e0be6a;

    --series-1: #6ea8e0;
    --series-2: #6fcf8a;
    --series-3: #e0be6a;
    --series-4: #a48bd4;
    --series-5: #79c6d4;
    --series-6: #e78b95;
    --series-7: #adb5bd;
    --series-8: #d6a17a;

    --overlay: rgba(0, 0, 0, .68);
    --focus: #6ea8e0;
}

/* --------------------------------------------------------------- baseline */

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

code, kbd, pre, .mono, .num { font-family: var(--mono); }
.num { font-size: .92em; }

hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

svg { flex: none; width: 1em; height: 1em; }

/* ----------------------------------------------------------- text helpers */

.muted { color: var(--text-muted); }
.sub { color: var(--text-muted); }
.small { font-size: .85em; }
.tight { margin: 0; padding-left: 1.1rem; }
.tight li { margin: 0; }
.primary { color: var(--primary); }
.danger { color: var(--danger); }
.secure { color: var(--success); display: inline-flex; align-items: center; gap: .3rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.check { color: var(--success); }
.truncation { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22rem; }
.meta { color: var(--text-muted); font-size: .85em; }
.org { color: var(--text-muted); }
.span-2 { grid-column: span 2; }
.hint { color: var(--text-muted); font-size: .85em; display: block; margin-top: .25rem; }
.required::after { content: " *"; color: var(--danger); font-weight: 700; }
.sep { color: var(--text-faint); margin: 0 .4rem; }
.gap { color: var(--text-faint); padding: 0 .35rem; }
.spacer { flex: 1 1 auto; }

/* Two equal columns that line up as a row and collapse as a column. The
   cards stretch to a shared height and wrap instead of being squeezed, so a
   short card beside a tall one no longer floats out of alignment. */
.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}
.split > * { min-width: 0; }

/* ------------------------------------------------------------------ shell */

.shell { display: flex; min-height: 100vh; }

.nav-progress {
    position: fixed; inset: 0 auto auto 0; height: 2px; width: 0;
    background: var(--side-accent); z-index: 60;
}

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--side-bg);
    border-right: 1px solid var(--side-border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex; align-items: center; gap: .65rem;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--side-border);
}
.brand-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { color: var(--side-strong); font-size: 1rem; letter-spacing: .01em; }
.brand-text small {
    color: var(--side-muted); font-size: .7rem;
    text-transform: uppercase; letter-spacing: .07em;
}

.nav { padding: .5rem 0 1rem; flex: 1 1 auto; }

.nav-heading {
    margin: .9rem 0 .25rem;
    padding: 0 1rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--side-heading);
}

.nav-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem 1rem;
    color: var(--side-text);
    font-size: .9rem;
    border-left: 3px solid transparent;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.nav-link:hover { background: var(--side-hover); color: var(--side-strong); text-decoration: none; }
.nav-link.active {
    background: var(--side-active);
    color: var(--side-strong);
    border-left-color: var(--side-accent);
    font-weight: 600;
}
.nav-link svg { width: 1.05rem; height: 1.05rem; }

.sidebar-foot { padding: .75rem 1rem 1rem; border-top: 1px solid var(--side-border); }
.sidebar-foot .btn-ghost { background: transparent; border-color: var(--side-border); color: var(--side-text); }
.sidebar-foot .btn-ghost:hover {
    background: var(--side-hover); border-color: var(--side-muted); color: var(--side-strong);
}

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 40;
    min-height: var(--topbar-h);
    display: flex; align-items: center; gap: 1rem;
    padding: .5rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.page-title { min-width: 0; }
.page-title h1 { margin: 0; font-size: 1.15rem; }

.breadcrumbs {
    display: flex; align-items: center; gap: .15rem;
    font-size: .78rem; margin-bottom: .1rem; flex-wrap: wrap;
}
.crumb { color: var(--text-muted); }
.crumb:hover { color: var(--primary); }
.crumb-current { color: var(--text); font-weight: 600; }
.crumb-sep { display: inline-flex; color: var(--text-faint); }
.crumb-sep svg { width: .8rem; height: .8rem; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.search-trigger {
    display: flex; align-items: center; gap: .45rem;
    height: 32px; padding: 0 .55rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font: inherit; font-size: .85rem;
    cursor: pointer;
}
.search-trigger:hover { background: var(--surface); border-color: var(--text-faint); color: var(--text); }
.search-trigger svg { width: .95rem; height: .95rem; }
.search-label { min-width: 5rem; text-align: left; }

.kbd {
    font-family: var(--mono); font-size: .72rem; line-height: 1;
    padding: .2rem .35rem;
    border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    background: var(--surface-alt); color: var(--text-muted);
}

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); border-color: var(--text-faint); }
.icon-btn svg { width: 1.05rem; height: 1.05rem; }
.icon-glyph { width: 1.15rem; height: 1.15rem; }

.theme-toggle .ico { width: 1.05rem; height: 1.05rem; }
.theme-toggle .ico-moon { display: none; }
[data-theme="dark"] .theme-toggle .ico-sun { display: none; }
[data-theme="dark"] .theme-toggle .ico-moon { display: block; }

.chip {
    display: inline-flex; align-items: center;
    padding: .15rem .5rem;
    font-size: .72rem; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
    border-radius: var(--radius-sm);
    border: 1px solid var(--secondary-bg);
    background: var(--secondary-bg); color: var(--text-muted);
}
.chip-admin { background: var(--primary-soft-bg); border-color: var(--primary-soft-border); color: var(--primary-soft-fg); }
.chip-staff { background: var(--info-bg); border-color: var(--info-border); color: var(--info-fg); }
.chip-student { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }
.topbar .chip { height: 32px; padding: 0 .6rem; }

.content { padding: 1.1rem 1.25rem 1.5rem; flex: 1 1 auto; }
.content > .toolbar, .content > .card { animation: ui-enter .18s ease-out both; }
@keyframes ui-enter {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.footer {
    padding: .85rem 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .8rem;
}

/* ----------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.card:last-child { margin-bottom: 0; }
.filter-card { margin-bottom: 1.1rem; }

.card-head {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1rem;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 600;
}
.card-actions { margin-left: auto; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .4rem; }

/* .kv lays out as a label column plus a body, and its selector reaches any
   nested span. .card-actions is a span, so without this it inherits the fixed
   label width and its buttons spill out of the row. */
.kv .card-actions { flex: 0 0 auto; width: auto; margin-left: auto; }
.card-body { padding: 1rem; }
.panel-body { padding: .85rem 1rem; }

.toolbar {
    display: flex; align-items: center; gap: .5rem;
    flex-wrap: wrap; margin-bottom: .85rem;
}
.screen-bar { display: flex; align-items: center; gap: .5rem; margin-bottom: .85rem; }

/* --------------------------------------------------------------- buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .38rem .8rem;
    font: inherit; font-size: .875rem; font-weight: 500; line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease,
        color .15s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn svg { width: 1rem; height: 1rem; }

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

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.92); color: #fff; }
[data-theme="dark"] .btn-success { color: #14181c; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); color: #fff; }
[data-theme="dark"] .btn-danger { color: #14181c; }

.btn-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-fg); }
.btn-warning:hover { background: var(--warning); border-color: var(--warning-border); color: #fff; }

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

.btn-sm { padding: .2rem .5rem; font-size: .8rem; }
.btn-lg { padding: .55rem 1.1rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }

.link-button {
    background: none; border: 0; padding: 0;
    color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline;
}

.actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.actions form { display: inline; margin: 0; }

/* Table action groups keep a predictable row: equal gaps, equal button
   heights, and no wrapping inside the scrollable table wrapper. */
.table td .actions { flex-wrap: nowrap; gap: .4rem; }
.table td .actions .btn { min-height: 30px; padding: .25rem .6rem; }

/* ------------------------------------------------------------------ forms */

.field { margin-bottom: .9rem; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.field-row .span-2 { grid-column: 1 / -1; }

label { display: block; margin-bottom: .3rem; font-weight: 600; font-size: .85rem; }

input[type="text"], input[type="search"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="tel"], select, textarea {
    display: block;
    width: 100%;
    padding: .38rem .55rem;
    font: inherit; font-size: .875rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
textarea { min-height: 6rem; resize: vertical; }

input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
    border-color: var(--text-faint);
}
input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-soft-bg);
}
input:disabled, select:disabled, textarea:disabled {
    background: var(--surface-alt); color: var(--text-muted); cursor: not-allowed;
}
input[readonly] { background: var(--surface-alt); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }

input[type="checkbox"], input[type="radio"] { width: auto; margin-right: .35rem; }
.checkline { display: flex; align-items: flex-start; gap: .4rem; font-weight: 400; }

input[type="file"] { font-size: .875rem; }
input[type="date"] { min-height: 33px; }

.form-actions {
    display: flex; align-items: center; gap: .5rem;
    flex-wrap: wrap;
    padding-top: .35rem;
    border-top: 1px solid var(--border-soft);
    margin-top: .4rem;
}

.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem .75rem; }
.f-item { display: flex; flex-direction: column; }
.f-item > label { font-weight: 600; font-size: .78rem; color: var(--text-muted); }
.f-search { grid-column: span 2; }
.f-actions { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: .5rem; }

.filter-input { width: 100%; }

/* --------------------------------------------------------------- filtering */

.filter-chips {
    display: flex; align-items: center; gap: .35rem;
    flex-wrap: wrap;
    padding-top: .6rem;
    margin-top: .6rem;
    border-top: 1px dashed var(--border);
}
.filter-chips-label {
    font-size: .75rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: var(--text-muted);
}
.fchip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .15rem .45rem;
    font-size: .8rem;
    background: var(--primary-soft-bg);
    border: 1px solid var(--primary-soft-border);
    border-radius: var(--radius-sm);
    color: var(--primary-soft-fg);
}
.fchip:hover { background: var(--primary-soft-border); text-decoration: none; }
.fchip-key { font-weight: 600; }
.fchip-val { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip-x { font-weight: 700; opacity: .7; }
.fchip-clear { font-size: .8rem; margin-left: .2rem; }

/* ----------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }

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

.table th {
    text-align: left;
    padding: .55rem .75rem;
    background: var(--surface-alt);
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.table th.right { text-align: right; }
.table th[data-sort] { cursor: pointer; user-select: none; }

.table td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--row-hover); }
.table tbody tr[data-href] { cursor: pointer; }

.table td .muted.small { margin-top: .1rem; }

/* Cells that hold a meter need room for the bar and its caption. The widths
   live here rather than in a style attribute so a table can be re-laid out
   from one place. */
.table td.cell-meter { min-width: 140px; }
.table td.cell-share { min-width: 120px; }

/* The device list carries ten columns. Wrapping the long headings and
   trimming horizontal padding keeps the action column reachable on a
   standard laptop without hiding any device information. */
.table-devices th { white-space: normal; }
.table-devices th .sort-arrow { display: inline-block; margin-left: .2rem; }
.table-devices th,
.table-devices td { padding-left: .4rem; padding-right: .4rem; }
.table-devices td:first-child strong { white-space: nowrap; }
.table-devices .brand-cell { min-width: 7rem; }
.table-devices td .actions { gap: .3rem; justify-content: flex-end; }
.table-devices td .actions .btn { padding-left: .35rem; padding-right: .35rem; }

.empty {
    padding: 2rem .75rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.sort-label { color: inherit; }
.sort-arrow { display: inline-block; width: 1rem; text-align: center; color: var(--text-faint); }
a:hover > .sort-arrow { color: var(--primary); }

/* ----------------------------------------------------------------- badges */

.badge {
    display: inline-block;
    padding: .2em .5em;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .04em;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--secondary-bg);
    border-color: var(--secondary-bg);
    color: var(--text-muted);
}

/* device and request status */
.badge-pending, .badge-revoked { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-fg); }
.badge-approved, .badge-allow, .badge-active { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }
.badge-blocked, .badge-rejected, .badge-deny { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.badge-quarantine { background: var(--info-bg); border-color: var(--info-border); color: var(--info-fg); }
.badge-inactive, .badge-neutral, .badge-locked { background: var(--secondary-bg); border-color: var(--border); color: var(--text-muted); }

/* Plain category tones. The status and role badges above carry a meaning, so a
   category label (the kind of report, the kind of metric) needs a neutral set
   that does not borrow one. The colour tokens were already in use elsewhere. */
.badge-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-fg); }
.badge-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-fg); }
.badge-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }
.badge-primary { background: var(--primary-soft-bg); border-color: var(--primary-soft-border); color: var(--primary-soft-fg); }

/* roles */
.badge-admin { background: var(--primary-soft-bg); border-color: var(--primary-soft-border); color: var(--primary-soft-fg); }
.badge-staff { background: var(--info-bg); border-color: var(--info-border); color: var(--info-fg); }
.badge-student { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }

/* logged actions: only the ones that carry a meaning, the rest stay neutral */
.badge-create, .badge-approve, .badge-unlock, .badge-restore { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }
.badge-delete, .badge-reject, .badge-block, .badge-failed_login { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.badge-update, .badge-status_change, .badge-password_change { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-fg); }
.badge-login, .badge-logout, .badge-view, .badge-export, .badge-print, .badge-backup { background: var(--secondary-bg); border-color: var(--border); color: var(--text-muted); }

.dot {
    display: inline-block;
    width: .55rem; height: .55rem;
    border-radius: 50%;
    background: var(--text-faint);
    vertical-align: middle;
}
.dot-pending { background: var(--st-pending); }
.dot-approved, .dot-allow, .dot-active { background: var(--st-approved); }
.dot-blocked, .dot-deny { background: var(--st-blocked); }
.dot-revoked { background: var(--st-revoked); }
.dot-rejected { background: var(--st-rejected); }
.dot-quarantine { background: var(--st-quarantine); }
.dot-inactive { background: var(--st-inactive); }

/* Categorical ramp, for series without a fixed status meaning. */
.dot-series-1 { background: var(--series-1); }
.dot-series-2 { background: var(--series-2); }
.dot-series-3 { background: var(--series-3); }
.dot-series-4 { background: var(--series-4); }
.dot-series-5 { background: var(--series-5); }
.dot-series-6 { background: var(--series-6); }
.dot-series-7 { background: var(--series-7); }
.dot-series-8 { background: var(--series-8); }

/* ----------------------------------------------------------------- pager */

.pager {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .7rem 1rem;
    border-top: 1px solid var(--border);
    font-size: .85rem;
}
.pager-pages {
    margin-left: auto;
    display: flex; align-items: center; gap: .35rem;
    flex-wrap: wrap;
}
.pager-pages a,
.pager-pages .current,
.pager-pages .gap {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.1rem; height: 2rem;
    padding: 0 .6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: .82rem; font-weight: 600; line-height: 1;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease,
                color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.pager-pages a:hover {
    background: var(--surface-alt);
    border-color: var(--text-faint);
    color: var(--text);
}
.pager-pages a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.pager-pages a:active { transform: translateY(1px); }
.pager-pages .current {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-fg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.pager-pages .gap {
    color: var(--text-faint);
    background: var(--surface-alt);
    border-color: var(--border-soft);
    cursor: not-allowed;
}
.pager-pages .pager-ellipsis {
    min-width: 1.5rem;
    padding: 0 .25rem;
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
    cursor: default;
}
@media (max-width: 640px) {
    .pager { align-items: flex-start; }
    .pager-pages { margin-left: 0; width: 100%; justify-content: flex-start; }
}

/* ----------------------------------------------------------------- alerts */

.flash-stack { display: flex; flex-direction: column; gap: .5rem; }
.flash-stack:not(:empty) { margin-bottom: .9rem; }

.alert {
    display: flex; align-items: flex-start; gap: .55rem;
    padding: .6rem .8rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: .875rem;
}
.alert-text { flex: 1 1 auto; min-width: 0; }
.alert-ico, .alert-ico svg { width: 1.1rem; height: 1.1rem; }
.alert-close {
    flex: none;
    background: none; border: 0; padding: 0;
    font-size: 1.15rem; line-height: 1;
    color: inherit; opacity: .55; cursor: pointer;
}
.alert-close:hover { opacity: 1; }
.alert.is-removing { opacity: 0; transform: translateY(-4px); transition: opacity .18s, transform .18s; }

.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }
.alert-danger, .alert-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-fg); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-fg); }

.toast-stack {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 110;
    display: flex; flex-direction: column; gap: .5rem;
    max-width: min(24rem, calc(100vw - 2rem));
}
.toast {
    display: flex; align-items: flex-start; gap: .5rem;
    padding: .55rem .7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: var(--radius);
    font-size: .875rem;
}
.toast-text { flex: 1 1 auto; min-width: 0; }
.toast-close {
    flex: none;
    background: none; border: 0; padding: 0;
    font-size: 1.1rem; line-height: 1;
    color: var(--text-muted); cursor: pointer;
}
.toast-close:hover { color: var(--text); }
.toast-success { border-left-color: var(--success); }
.toast-danger, .toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--info); }
.toast.is-out { opacity: 0; transition: opacity .18s linear; }

/* ------------------------------------------------------------------ stats */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}
.stat-card {
    display: flex; align-items: center; gap: .8rem;
    padding: .75rem .9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
}
a.stat-card:hover {
    background: var(--surface-alt);
    border-color: var(--text-faint);
    color: inherit; text-decoration: none;
}
.stat-ico {
    flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.4rem; height: 2.4rem;
    background: var(--primary-soft-bg);
    border: 1px solid var(--primary-soft-border);
    border-radius: var(--radius);
    color: var(--primary-soft-fg);
}
.stat-ico svg { width: 1.2rem; height: 1.2rem; }
.stat-body { min-width: 0; display: flex; flex-direction: column; }
.stat-label {
    font-size: .72rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: var(--text-muted);
}
.stat-value { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.stat-sub {
    font-size: .78rem; color: var(--text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.tone-green .stat-ico, .stat-ico.tone-green {
    background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg);
}
.tone-red .stat-ico, .stat-ico.tone-red {
    background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-fg);
}
.tone-amber .stat-ico, .stat-ico.tone-amber {
    background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-fg);
}
.tone-cyan .stat-ico, .stat-ico.tone-cyan {
    background: var(--info-bg); border-color: var(--info-border); color: var(--info-fg);
}
.tone-violet .stat-ico, .stat-ico.tone-violet {
    background: var(--primary-soft-bg); border-color: var(--primary-soft-border); color: var(--primary-soft-fg);
}
.tone-blue .stat-ico, .stat-ico.tone-blue {
    background: var(--primary-soft-bg); border-color: var(--primary-soft-border); color: var(--primary-soft-fg);
}

/* --------------------------------------------------------- charts + cards */

.chart-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    /* Stretch, not start: every chart card in a row then shares one height and
       the plots sit on a common baseline instead of floating at their own. */
    align-items: stretch;
    margin-bottom: 1rem;
}
.chart-card { margin-bottom: 0; display: flex; flex-direction: column; }
.chart-card.span-2 { grid-column: span 2; }
/* The plot absorbs whatever height the stretched card has left over. */
.chart-wrap { flex: 1 1 auto; min-height: 230px; height: 230px; position: relative; }
.chart-wrap canvas { max-width: 100%; }
.chart-empty { display: grid; place-items: center; }
.chart-empty canvas { display: none; }
.chart-empty-state { margin: 0; padding: 1rem; color: var(--text-muted); text-align: center; }
/* A card with no plot should not stretch a hair taller than its content. */
.chart-card > .card-head { min-height: 2.85rem; }

.legend {
    list-style: none;
    margin: 0;
    padding: .75rem 1rem;
    border-top: 1px solid var(--border-soft);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
    gap: .35rem .9rem;
}
.legend li { display: flex; align-items: center; gap: .5rem; font-size: .85rem; min-width: 0; }
.legend-label { flex: 1 1 auto; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { font-weight: 700; font-family: var(--mono); }

/* One source of colour for legends, mirroring the .dot-* rules above. */
.legend-dot { flex: none; width: .6rem; height: .6rem; border-radius: 50%; }
.legend-pending { background: var(--st-pending); }
.legend-approved { background: var(--st-approved); }
.legend-blocked { background: var(--st-blocked); }
.legend-revoked { background: var(--st-revoked); }
.legend-rejected { background: var(--st-rejected); }
.legend-inactive { background: var(--st-inactive); }
.legend-quarantine { background: var(--st-quarantine); }

/* ----------------------------------------------------------------- meters */

.meter {
    height: 7px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
}
.meter-fill { height: 100%; background: var(--primary); }
.meter-fill.over { background: var(--danger); }

/* --------------------------------------------------------------- feed/kv */

.feed { list-style: none; margin: 0; padding: 0; }
.feed > li {
    display: flex; align-items: flex-start; gap: .65rem;
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--border-soft);
}
.feed > li:last-child { border-bottom: 0; }
.feed-dot {
    flex: none;
    width: .6rem; height: .6rem; margin-top: .4rem;
    border-radius: 50%;
    background: var(--slate-dot);
}
.feed-login, .feed-logout, .feed-view { background: var(--slate-dot); }
.feed-create, .feed-update, .feed-approve, .feed-unlock, .feed-restore, .feed-backup { background: var(--green-dot); }
.feed-delete, .feed-reject, .feed-failed_login { background: var(--red-dot); }
/* Sign-in failures all land in the feed, so the reason has its own colour:
   a definite credential failure reads red, a challenge or throttle failure
   reads amber because it is only a signal, not a conclusion. */
.feed-bad_password, .feed-unknown_user, .feed-account_locked { background: var(--red-dot); }
.feed-captcha_failed, .feed-ip_throttled { background: var(--amber-dot); }
.feed-status_change, .feed-password_change, .feed-export, .feed-print { background: var(--amber-dot); }
.feed-body { min-width: 0; flex: 1 1 auto; }
.feed-text { font-size: .875rem; }
.feed-meta { font-size: .78rem; color: var(--text-muted); }

.kv {
    display: flex; align-items: baseline; gap: .6rem;
    padding: .35rem 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: .875rem;
}
.kv:last-child { border-bottom: 0; }
/* Fixed label column, so the values start on one vertical line. */
.kv span { flex: 0 0 9rem; color: var(--text-muted); }
.kv strong { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }

.card-head.sub { background: var(--surface); color: var(--text); }
.card-head h2, .card-head h3 { margin: 0; font-size: .95rem; }

/* ------------------------------------------------------- password strength */

.pw-meter { margin-top: .35rem; }
.pw-bar {
    height: 6px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
}
.pw-bar > span { display: block; height: 100%; width: 0; background: var(--danger); }
.pw-bar.is-weak > span { background: var(--danger); }
.pw-bar.is-fair > span { background: var(--warning); }
.pw-bar.is-good > span { background: var(--gold); }
.pw-bar.is-strong > span { background: var(--success); }
.pw-label { display: block; margin-top: .2rem; font-size: .78rem; color: var(--text-muted); }

/* ----------------------------------------------------------------- modals */

.modal-root {
    position: fixed; inset: 0; z-index: 90;
    display: flex;
    align-items: center; justify-content: center;
    padding: 1rem;
    background: var(--overlay);
    visibility: hidden; opacity: 0; pointer-events: none;
    transition: opacity .16s ease, visibility 0s linear .16s;
}
.modal-root.show, .modal-root.open {
    visibility: visible; opacity: 1; pointer-events: auto;
    transition-delay: 0s;
}

.modal-card {
    width: 100%;
    max-width: 30rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    opacity: 0; transform: translateY(4px);
    transition: opacity .16s ease, transform .16s ease;
}
.modal-root.show .modal-card, .modal-root.open .modal-card { opacity: 1; transform: none; }
.modal-card-lg { max-width: 42rem; }
.modal-head {
    display: flex; align-items: center; gap: .6rem;
    padding: .7rem 1rem;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.modal-body { padding: 1rem; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: .5rem;
    padding: .7rem 1rem;
    background: var(--surface-alt);
    border-top: 1px solid var(--border);
}

/* -------------------------------------------------------- privacy notice */
/*
 * A small informational dialog, shown once per tab session. It reuses the
 * .modal-root positioning so it centres like every other dialog, but carries
 * its own compact card: a soft emblem, a short paragraph and three chips.
 * The palette and toasts sit above it (z-index 100/110), so a user can still
 * open the palette while it is on screen.
 */

.modal-root.privacy-root {
    animation: none;
    background: rgba(4, 16, 31, .36);
    transition: opacity .18s ease, visibility 0s linear .18s;
}
.modal-root.privacy-root.show,
.modal-root.privacy-root.open {
    transition: opacity .18s ease, visibility 0s linear 0s;
}

.privacy-card {
    width: 100%;
    max-width: 22rem;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    padding: 1rem 1.1rem 1.05rem;
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--text);
    box-shadow: 0 18px 42px rgba(2, 10, 20, .24), 0 2px 8px rgba(2, 10, 20, .08);
    transform: translateY(8px) scale(.985);
    transition: opacity .18s ease, transform .18s ease;
}
.modal-root.show .privacy-card,
.modal-root.open .privacy-card { transform: none; }

.privacy-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: .6rem;
}
.privacy-emblem {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary-soft-bg);
    color: var(--primary);
}
.privacy-emblem-ico { width: 1.05rem; height: 1.05rem; }

.privacy-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    margin: 0;
    background: none; border: 0;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 1.25rem; line-height: 1;
    cursor: pointer;
}
.privacy-close:hover { background: var(--surface-alt); color: var(--text); }
.privacy-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.privacy-title {
    margin: 0 0 .35rem;
    color: var(--text);
    font-size: 1.02rem;
    line-height: 1.25;
}
.privacy-text {
    margin: 0 0 .8rem;
    color: var(--text-muted);
    font-size: .84rem;
    line-height: 1.6;
}

.privacy-chips {
    list-style: none;
    display: flex; flex-wrap: wrap; gap: .35rem;
    margin: 0 0 .9rem; padding: 0;
}
.privacy-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    min-height: 28px;
    padding: .28rem .55rem;
    border: 1px solid var(--primary-soft-border);
    border-radius: 999px;
    background: var(--primary-soft-bg);
    color: var(--primary-soft-fg);
    font-size: .74rem; font-weight: 600; line-height: 1.1;
    white-space: nowrap;
}
.privacy-chip-ico { flex: none; width: .8rem; height: .8rem; }

.privacy-actions { margin-top: .1rem; }
.privacy-actions .btn { margin: 0; min-height: 36px; }

[data-theme="dark"] .modal-root.privacy-root { background: rgba(0, 0, 0, .55); }

/* ------------------------------------------------------- command palette */

.palette-backdrop {
    position: fixed; inset: 0; z-index: 100;
    display: none;
    align-items: flex-start; justify-content: center;
    padding: 9vh 1rem 1rem;
    background: var(--overlay);
}
.palette-backdrop.show { display: flex; }

.palette {
    width: 100%; max-width: 34rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.palette-head {
    display: flex; align-items: center; gap: .5rem;
    padding: .55rem .8rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}
.palette-head svg { width: 1rem; height: 1rem; }
.palette-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: .25rem;
    font: inherit; font-size: 1rem;
    color: var(--text);
    background: transparent;
    border: 0;
}
.palette-input:focus { outline: 0; }
.palette-list {
    list-style: none;
    max-height: 21rem; overflow-y: auto;
    padding: .3rem;
    margin: 0;
}
.palette-group {
    padding: .45rem .55rem .2rem;
    font-size: .7rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-muted);
}
.palette-item {
    display: flex; align-items: center; gap: .6rem;
    width: 100%;
    padding: .45rem .55rem;
    background: none; border: 0;
    border-radius: var(--radius-sm);
    font: inherit; font-size: .9rem;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.palette-item:hover { background: var(--surface-alt); }
.palette-item.is-active {
    background: var(--primary-soft-bg);
    color: var(--primary-soft-fg);
}
.palette-ico { flex: none; display: inline-flex; color: var(--text-muted); }
.palette-ico svg { width: 1rem; height: 1rem; }
.palette-item.is-active .palette-ico { color: inherit; }
.palette-text { flex: 1 1 auto; min-width: 0; }
.palette-sub { font-size: .78rem; color: var(--text-muted); }
.palette-foot {
    display: flex; align-items: center; gap: .9rem;
    padding: .45rem .8rem;
    background: var(--surface-alt);
    border-top: 1px solid var(--border);
    font-size: .78rem;
    color: var(--text-muted);
}
.palette-empty { padding: 1.2rem .6rem; text-align: center; color: var(--text-muted); font-style: italic; }

/* --------------------------------------------------------------- backtop */

.to-top {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 45;
    width: 34px; height: 34px;
    display: none;
    align-items: center; justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
}
.to-top.show { display: inline-flex; }
.to-top:hover { background: var(--surface-alt); color: var(--text); border-color: var(--text-faint); }
.to-top svg { width: 1.05rem; height: 1.05rem; }

/* ----------------------------------------------------------- nav toggles */

.nav-backdrop {
    position: fixed; inset: 0; z-index: 70;
    display: none;
    background: var(--overlay);
}
.nav-backdrop.show { display: block; }

body.is-locked { overflow: hidden; }

/* ------------------------------------------------------------- nav loader */

.nav-progress {
    position: fixed; top: 0; left: 0; z-index: 60;
    height: 2px; width: 0;
    background: var(--side-accent);
    opacity: 0;
    pointer-events: none;
}
.nav-progress.show { opacity: 1; }
body.is-navigating .content { opacity: .55; }
.content { transition: opacity .12s linear; }

/* ------------------------------------------------------------- utilities */

.only-mobile { display: none; }
.no-print { /* hidden by the print rules below */ }

/* button busy state */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: "";
    position: absolute; top: 50%; left: 50%;
    width: 14px; height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    color: var(--primary-fg);
    animation: spin .6s linear infinite;
}
.btn-ghost.is-loading::after, .btn-warning.is-loading::after { color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- utility */

.hide { display: none !important; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.p-0 { padding: 0; }

.notfound { text-align: center; padding: 3rem 1rem; }
.notfound .code {
    font-family: var(--mono);
    font-size: 2.6rem; font-weight: 700;
    color: var(--text-faint);
}

/* ==================================================================
   AUTH — sign-in landing page, forced password change, installer
   ------------------------------------------------------------------
   The dark stage and the mesh are fixed, so the card reads as a lit
   panel sitting on top of the network rather than as a page background.
   ================================================================== */

.auth-body {
    background: var(--side-bg);
    min-height: 100vh;
    color: var(--side-text);
}

/* Non-landing pages centre one card on the same stage. */
.auth-body:not(.auth-body-landing) {
    background: var(--bg);
    color: var(--text);
}

.auth-stage {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
    align-items: center;
    gap: 3rem;
    padding: 3rem clamp(1.25rem, 5vw, 5rem);
}

.auth-body:not(.auth-body-landing) .auth-stage {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
}

/* ------------------------------------------------------------ mesh bg */

.auth-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 600px at 18% 12%, rgba(var(--panel-accent-rgb), .16), transparent 65%),
        radial-gradient(700px 520px at 82% 88%, rgba(var(--panel-ok-rgb), .10), transparent 60%),
        var(--side-bg);
}
.auth-mesh-svg { width: 100%; height: 100%; }
/* 10% mesh: visible as texture, never as pattern-on-the-nose. */
.mesh-link { stroke: var(--side-text); stroke-opacity: .10; stroke-width: 1; }
.mesh-node { fill: var(--side-text); fill-opacity: .16; }

/* ------------------------------------------------------------- hero */

.hero { min-width: 0; }
.hero-inner { max-width: 30rem; }

/* Logo mark for landing page */
.hero-logo {
    display: block;
    width: 6rem;
    height: 6rem;
    margin: 0 auto 1.25rem;
    filter: drop-shadow(0 4px 12px rgba(26, 79, 138, 0.4));
}

.hero-status {
    display: inline-flex; align-items: center; gap: .5rem;
    margin: 0 0 1.75rem;
    padding: .35rem .75rem;
    font-size: .7rem; font-weight: 600;
    letter-spacing: .09em; text-transform: uppercase;
    color: var(--panel-ok);
    background: rgba(var(--panel-ok-rgb), .14);
    border: 1px solid rgba(var(--panel-ok-rgb), .38);
    border-radius: 999px;
}
.hero-status-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--panel-ok);
    box-shadow: 0 0 0 3px rgba(var(--panel-ok-rgb), .18);
}
/* An honest warning colour when the request is not actually encrypted. */
.hero-status-warn {
    color: var(--panel-warn);
    background: rgba(var(--panel-warn-rgb), .16);
    border-color: rgba(var(--panel-warn-rgb), .45);
}
.hero-status-warn .hero-status-dot {
    background: var(--panel-warn);
    box-shadow: 0 0 0 3px rgba(var(--panel-warn-rgb), .18);
}
.hero-status-sep { opacity: .5; }

.hero-title {
    margin: 0 0 1.1rem;
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -.02em;
    text-transform: uppercase;
    color: var(--side-strong);
}

.hero-copy {
    margin: 0 0 1.75rem;
    max-width: 28rem;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--side-text);
}

.hero-btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .6rem 1.15rem;
    font: inherit; font-size: .8rem; font-weight: 600;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--side-strong);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: var(--radius);
    cursor: pointer;
}
.hero-btn:hover {
    color: var(--side-strong);
    border-color: var(--panel-accent);
    background: rgba(255, 255, 255, .08);
}
.hero-btn::after {
    content: "";
    width: 6px; height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-1px, -1px);
    transition: transform .15s ease;
}
.hero-btn[aria-expanded="true"]::after { transform: rotate(225deg) translate(-1px, -1px); }

.hero-meta {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    margin-top: 2rem;
    font-size: .74rem;
    letter-spacing: .04em;
    color: var(--side-muted);
}
.hero-meta-dot { opacity: .5; }

/* ------------------------------------------------------------- card */

.auth-main { min-width: 0; display: flex; justify-content: flex-end; }
.auth-body:not(.auth-body-landing) .auth-main { justify-content: center; }

.auth-card {
    position: relative;
    width: 100%;
    max-width: 27rem;
    padding: 2rem 1.85rem 1.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    /* Soft, single, low-opacity: a lift, not a halo. */
    box-shadow: 0 18px 44px -22px rgba(2, 6, 23, .55);
    color: var(--text);
}

/* The landing card is the one lit panel on a dark stage, so it carries a thin
   accent edge on top. */
.auth-card-landing { border-top: 2px solid var(--primary); }

.auth-tools {
    position: absolute; top: .75rem; right: .75rem;
    display: flex; gap: .35rem;
}

.auth-head { text-align: center; margin-bottom: 1.25rem; }
.auth-mark {
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto .4rem;
}
.auth-head h1 { margin: 0 0 .2rem; font-size: 1.15rem; }
.auth-head .muted { margin: 0; font-size: .85rem; }
.auth-head-rule { height: 2px; width: 2.5rem; background: var(--primary); margin: .6rem auto 0; }

.auth-foot {
    margin-top: 1.25rem;
    padding-top: .85rem;
    border-top: 1px solid var(--border-soft);
    text-align: center;
    font-size: .75rem;
    color: var(--text-muted);
}
.auth-alt { text-align: center; margin-top: .8rem; font-size: .85rem; }
.auth-form .field { margin-bottom: .85rem; }
.auth-form label { font-size: .82rem; }

/* ------------------------------------------------------- form heading */

.auth-form-head { margin-bottom: 1.35rem; }
.auth-form-title {
    margin: 0 0 .3rem;
    font-size: 1.32rem; font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}
.auth-form-sub { margin: 0; font-size: .85rem; line-height: 1.5; color: var(--text-muted); }

/* ------------------------------------------------- inputs with icons */

.field-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .74rem; font-weight: 600;
    letter-spacing: .07em; text-transform: uppercase;
    color: var(--text-muted);
}

.input-icon { position: relative; display: flex; align-items: center; }
.input-icon input { padding-left: 2.4rem; }
.input-icon input[type="password"] { padding-right: 2.6rem; }

.input-ico {
    position: absolute; left: .7rem;
    width: 1.05rem; height: 1.05rem;
    color: var(--text-faint);
    pointer-events: none;
}
.input-icon input:focus ~ .input-action { color: var(--text); }

.input-action {
    position: absolute; right: .35rem;
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; padding: 0;
    border-radius: var(--radius-sm);
    color: var(--text-faint);
    cursor: pointer;
}
.input-action:hover { color: var(--text); background: var(--row-hover); }
.input-action svg { width: 1.1rem; height: 1.1rem; }

/* The sign-in fields are deliberately NOT restyled here. They used to carry
   their own slate background, border, focus ring and placeholder colour, which
   is why the login page read as a different application from the one you land
   in after signing in. Every module form is drawn by the shared rule near the
   top of this file (--surface on --border, --primary focus ring), so the sign-in
   form now uses that same rule and inherits both themes for free. Only the
   icon padding above is layout, and it stays. */

/* --------------------------------------------------- human verification */

.verify {
    margin: 1.15rem 0 0;
    padding: 0;
    border: 0;
}
.verify-legend {
    padding: 0;
    margin-bottom: .45rem;
    font-size: .72rem; font-weight: 700;
    letter-spacing: .11em; text-transform: uppercase;
    color: var(--text-muted);
}

.verify-box {
    display: flex; align-items: center; gap: .5rem;
    padding: .4rem .5rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.verify-img {
    display: block;
    height: 46px; width: auto;
    border-radius: 3px;
    transition: opacity .15s ease;
}
.verify-img.is-loading { opacity: .45; }
[data-theme="dark"] .verify-img { filter: brightness(.92) contrast(1.05); }

.verify-refresh {
    flex: none;
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
}
.verify-refresh:hover { color: var(--primary); border-color: var(--primary); }
.verify-refresh svg { width: 1rem; height: 1rem; }
.verify-refresh.is-spinning svg { animation: captcha-spin .6s linear infinite; }
@keyframes captcha-spin { to { transform: rotate(360deg); } }

/* The challenge (picture or text question) and its answer share one row
   whenever the screen has room, so the code is never pushed below the box it
   belongs to. The answer keeps a stable, code-sized width; the challenge
   takes what is left. On a narrow screen the row folds to one column. */
.verify-row {
    display: flex;
    align-items: stretch;
    gap: .5rem;
}
.verify-row .verify-box { flex: 1 1 auto; min-width: 0; }
.verify-row .verify-answer { flex: 0 1 140px; margin-top: 0; display: flex; }
.verify-row .verify-answer input { width: 100%; }

.verify-challenge {
    flex: none;
    display: flex; align-items: center; gap: .3rem;
    margin: 0; padding: 0 .7rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.05rem;
    white-space: nowrap;
}

.verify-answer input { text-align: center; letter-spacing: .3em; font-family: var(--mono); }
.verify-note { margin: .4rem 0 0; font-size: .74rem; color: var(--text-muted); }
.verify-q { font-family: var(--mono); font-weight: 700; color: var(--text); }
.verify-switch { margin: .45rem 0 0; font-size: .74rem; }
.verify-switch a { color: var(--primary); }

/* Fold the challenge and the answer into one column once the row is too
   narrow to hold them side by side without clipping. */
@media (max-width: 520px) {
    .verify-row { flex-wrap: wrap; }
    .verify-row .verify-answer { flex: 1 1 100%; }
    .verify-challenge { flex: 1 1 100%; justify-content: center; }
}

/* ------------------------------------------------------------- notice */

.signin-notice {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    margin: 1rem 0 0;
    padding: .5rem .65rem;
    font-size: .74rem;
    color: var(--text-muted);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.signin-notice-sep { opacity: .45; }
.signin-notice strong { color: var(--text); }
.signin-notice-hot { color: var(--danger); font-weight: 600; }
.signin-notice-hot strong { color: var(--danger); }

/* ------------------------------------------------------------- help */
.signin-help { margin: .85rem 0 0; font-size: .76rem; color: var(--text-muted); }
.signin-help strong { color: var(--text); }
.signin-help a { color: var(--primary); }

/* ------------------------------------------------- demo instructions */

.demo-creds {
    margin-top: 1.1rem;
    padding: .85rem .95rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    animation: ui-enter .2s ease-out both;
}

.demo-head {
    display: flex; align-items: center; gap: .45rem;
    margin-bottom: .5rem;
    transition: margin-bottom .2s ease;
}
.demo-creds.collapsed .demo-head { margin-bottom: 0; }
.demo-ico { display: inline-flex; color: var(--primary); }
.demo-ico svg { width: 1rem; height: 1rem; }
.demo-title {
    margin: 0;
    font-size: .72rem; font-weight: 700;
    letter-spacing: .11em; text-transform: uppercase;
    color: var(--text);
}

.demo-intro { margin: 0 0 .6rem; font-size: .8rem; color: var(--text-muted); }

.demo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }

.demo-item {
    display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .7rem;
    padding: .45rem .55rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
}

.demo-role {
    flex: none;
    font-size: .68rem; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase;
    padding: .1rem .45rem;
    color: var(--primary-soft-fg);
    background: var(--primary-soft-bg);
    border: 1px solid var(--primary-soft-border);
    border-radius: 999px;
}

.demo-cred { display: inline-flex; align-items: baseline; gap: .3rem; font-size: .8rem; }
.demo-key { color: var(--text-muted); }
.demo-val {
    font-family: var(--mono); font-weight: 600;
    color: var(--text);
    padding: .05rem .3rem;
    background: var(--surface-inset);
    border: 1px solid var(--border-soft);
    border-radius: 3px;
    user-select: all;
}

.demo-note { margin: .6rem 0 0; font-size: .74rem; color: var(--text-muted); }

/* --- collapsible demo instructions --- */

.demo-toggle {
    display: inline-flex; align-items: center; gap: .45rem;
    width: 100%; padding: 0; background: none; border: none;
    font: inherit; font-size: .72rem; font-weight: 700;
    letter-spacing: .11em; text-transform: uppercase;
    color: var(--text); text-align: left; cursor: pointer;
}
.demo-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.demo-toggle .demo-ico { color: var(--primary); }
.demo-toggle .demo-ico svg { width: 1rem; height: 1rem; }
.demo-title { margin: 0; }

/* Chevron: points down when expanded, right when collapsed. */
.demo-chevron {
    display: inline-block; width: 0; height: 0;
    margin-left: auto;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-muted);
    transition: transform .2s ease;
}
.demo-creds.collapsed .demo-chevron { transform: rotate(-90deg); }

.demo-content {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows .24s ease, opacity .18s ease;
}
.demo-content-inner { overflow: hidden; min-height: 0; }
.demo-creds.collapsed .demo-content { grid-template-rows: 0fr; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    .demo-toggle .demo-chevron,
    .demo-content,
    .demo-creds.collapsed .demo-content,
    .demo-head { transition: none !important; }
}

@media (max-width: 520px) {
    .demo-creds { padding: .7rem .75rem; }
}

/* Native backup disclosures keep their semantic keyboard behavior while
   easing the chevron and the newly revealed content. */
.archive-details > summary, .backup-acc > summary {
    cursor: pointer;
    transition: color .15s ease;
}
.archive-details > summary:focus-visible, .backup-acc > summary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.details-chevron svg { transition: transform .16s ease; }
.archive-details[open] .details-chevron svg,
.backup-acc[open] .details-chevron svg { transform: rotate(90deg); }
.archive-details[open] .backup-list,
.backup-acc[open] .backup-acc-body { animation: disclosure-in .16s ease-out both; }
@keyframes disclosure-in {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------- submit */

.signin-form { margin: 0; }

.signin-submit {
    display: block;
    width: 100%;
    margin-top: 1.15rem;
    padding: .78rem 1rem;
    font: inherit; font-size: .82rem; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    /* Same three tokens as .btn-primary, so the sign-in button is the app's
       button rather than a second one painted a different colour. */
    color: var(--primary-fg);
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.signin-submit:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.signin-submit[disabled] { opacity: .7; cursor: progress; }

.signin-submit-label { display: block; position: relative; }
.signin-submit-busy { display: none; }
.signin-submit.is-loading .signin-submit-text { visibility: hidden; }
.signin-submit.is-loading .signin-submit-busy {
    display: block;
    position: absolute; inset: 0;
    line-height: 1.5rem;
}

/* --------------------------------------------------------- guidelines */

.guidelines {
    margin-top: 1.1rem;
    padding: .9rem 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
}
.guidelines-title {
    margin: 0 0 .5rem;
    font-size: .74rem; font-weight: 700;
    letter-spacing: .11em; text-transform: uppercase;
    color: var(--primary);
}
.guidelines-list { margin: 0; padding-left: 1.05rem; font-size: .8rem; color: var(--text-muted); }
.guidelines-list li { margin-bottom: .4rem; }
.guidelines-list li:last-child { margin-bottom: 0; }
.guidelines-list strong { color: var(--text); }

/* --------------------------------------------------------- security note */

.auth-security {
    display: flex; align-items: flex-start; gap: .5rem;
    margin: 1.1rem 0 0;
    padding: .65rem .75rem;
    font-size: .74rem; line-height: 1.5;
    color: var(--text-muted);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}
.auth-security-ico { flex: none; display: inline-flex; color: var(--success); }
.auth-security-ico svg { width: 1rem; height: 1rem; }
.auth-security strong { color: var(--text); }

/* =========================================================== reports page */
/* Purpose-built for the report picker. The list used to be built out of .kv,
   which is a label/value row: .kv span pins every nested span to a 9rem
   column, so the report text was crushed into 144px while the buttons were
   pushed to the far edge by margin-left:auto. That produced the stretched rows
   and the empty band in the middle. These rules replace that structure with a
   real three-column row: information, metadata, actions. */

.rpt-lead {
    margin: 0 0 1rem;
    max-width: 60ch;
    font-size: .875rem;
    color: var(--text-muted);
}

/* --- the list --- */

.rpt-list { display: flex; flex-direction: column; }

.rpt-row {
    display: grid;
    /* information | metadata | actions. The middle track is capped so the
       buttons cannot drift off the right edge on a wide screen, and the row
       height is driven purely by its content. */
    grid-template-columns: minmax(0, 1fr) 13rem auto;
    align-items: center;
    gap: 1rem;
    padding: .7rem .25rem;
    border-bottom: 1px solid var(--border-soft);
}
.rpt-row:last-child { border-bottom: 0; }

/* Information: title first and dominant, description underneath and quiet. */
.rpt-main { min-width: 0; }
.rpt-title {
    margin: 0;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}
.rpt-desc {
    margin: .15rem 0 0;
    font-size: .78rem;
    line-height: 1.5;
    color: var(--text-muted);
    /* Long names wrap instead of widening the row. */
    overflow-wrap: anywhere;
}

/* Metadata: stacked and right-aligned against the actions. */
.rpt-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .25rem;
    text-align: right;
    font-size: .72rem;
    color: var(--text-muted);
    min-width: 0;
}
.rpt-filters {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    white-space: nowrap;
}
.rpt-filters svg { width: .8rem; height: .8rem; flex: none; }
.rpt-scope { white-space: nowrap; }

/* Actions: compact, right-aligned, never wrapping under the metadata. */
.rpt-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

/* --- filter card --- */

.rpt-filters-head { align-items: baseline; }
.rpt-filters-note {
    margin: .8rem 0 0;
    font-size: .76rem;
    color: var(--text-muted);
}

/* --- device brand mark --- */

/* Manufacturer marks use a compact fixed box and preserve their proportions.
   Scope these to the device cell: .brand-logo is also the sidebar logo class. */
.brand-cell .brand-logo {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 44px;
    width: 44px; height: 24px;
    overflow: hidden;
}
.brand-cell .brand-logo img {
    display: block;
    width: 100%; height: 100%;
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    object-position: center;
}

.brand-cell { display: flex; align-items: center; gap: .55rem; min-width: 8rem; }
.brand-cell .brand-name {
    display: flex; flex-direction: column; gap: .08rem;
    min-width: 0; line-height: 1.25;
}
.brand-cell .brand-title,
.brand-cell .brand-model { overflow-wrap: anywhere; }

/* --- subtle professional animations (respect prefers-reduced-motion) --- */

.btn,
button,
input[type="submit"],
select.filter-input,
input.filter-input,
.nav a,
.sidebar a,
.card,
.modal,
[role="dialog"] {
    transition: background-color .15s ease, border-color .15s ease, color .15s ease,
                box-shadow .15s ease, transform .1s ease, opacity .15s ease;
}

.btn:hover,
button:not(.s-peek):hover { transform: translateY(-1px); }
.btn:active,
button:not(.s-peek):active { transform: translateY(0); }

.nav a:hover,
.sidebar a:hover { transform: translateX(2px); }

.card { transition: box-shadow .2s ease, transform .15s ease; }
.card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }

.modal,
[role="dialog"] { animation: modalFade .18s ease-out; }
@keyframes modalFade {
    from { opacity: 0; transform: translateY(6px) scale(.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .25s ease-out both; }

@media (prefers-reduced-motion: reduce) {
    .btn, button, input[type="submit"], select.filter-input, input.filter-input,
    .nav a, .sidebar a, .card, .modal, [role="dialog"], .privacy-card {
        transition: none !important;
    }
    .modal, [role="dialog"], .fade-in, .privacy-card { animation: none !important; }
}

/* --- documents & screenshots --- */

/* Thumbnails are a fixed square so a slow or failed image never reflows the
   row; non-images fall back to a labelled extension tile. */
.doc-thumb-col { width: 68px; }
.doc-thumb-cell { vertical-align: middle; }
.doc-thumb {
    display: block; width: 52px; height: 52px;
    border-radius: 4px; border: 1px solid var(--border);
    object-fit: cover; background: var(--bg-subtle);
}
.doc-thumb-tile {
    display: flex; align-items: center; justify-content: center;
    font-size: .62rem; font-weight: 700; letter-spacing: .02em;
    color: var(--text-muted); text-transform: uppercase;
    background: var(--bg-subtle);
}
.doc-upload .form-actions { margin-top: .25rem; }

/* --- signature block (shared by the on-screen report and the settings
       preview; the printed report styles its own) --- */

.signoff {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 34px; margin-top: .5rem; break-inside: avoid;
}
.signoff > div { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.signoff-name {
    display: block; min-height: 16px;
    font-size: .8rem; font-weight: 600; color: var(--text);
    text-align: center; overflow-wrap: break-word; max-width: 100%;
}
.sig-line { display: block; width: 100%; max-width: 200px; border-bottom: 1px solid var(--text-faint); height: 0; }
.sig-label {
    display: block; margin-top: 0;
    font-size: .66rem; color: var(--text-muted);
    text-align: center; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
@media (max-width: 640px) {
    .signoff { flex-direction: column; gap: 18px; }
}

/* --- responsive --- */

@media (max-width: 900px) {
    /* Below this width a fixed metadata column squeezes the report name, so
       the row folds: information on top, then metadata, then the actions on
       their own line, still right-aligned. */
    .rpt-row {
        grid-template-columns: minmax(0, 1fr);
        gap: .5rem;
        align-items: start;
    }
    .rpt-meta { align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; }
    .rpt-actions { justify-content: flex-start; }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
    .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-card.span-2 { grid-column: 1 / -1; }
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* Two columns need roughly 22rem each before they get cramped. */
    .split { grid-template-columns: minmax(0, 1fr); }

    /* The hero keeps its identity but hands the card the full width. */
    .auth-stage {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
        align-content: center;
        padding: 2.5rem 1.5rem;
    }
    .auth-main { justify-content: center; }
    .hero-inner { max-width: 34rem; }
    .hero-title { font-size: clamp(2rem, 7vw, 2.8rem); }
    .hero-copy { max-width: 34rem; }
    .hero-meta { margin-top: 1.25rem; }
}

@media (max-width: 900px) {
    .only-mobile { display: inline-flex; }
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        height: 100%;
        z-index: 80;
        transform: translateX(-100%);
        transition: transform .18s ease;
    }
    .sidebar.open { transform: none; }
    .content { padding: 1rem; }
    .topbar { padding: .5rem 1rem; }
    .toast-stack { right: .75rem; left: .75rem; bottom: .75rem; max-width: none; }
}

@media (max-width: 640px) {
    .filters { grid-template-columns: minmax(0, 1fr); }
    .f-search { grid-column: 1 / -1; }
    .field-row { grid-template-columns: minmax(0, 1fr); }
    .search-label, .search-trigger .kbd { display: none; }
    /* The right-hand controls may drop to their own row rather than crowd or
       overlap the title on the narrowest phones. */
    .topbar { flex-wrap: wrap; row-gap: .4rem; }
    .topbar-right { flex: none; }
    .stat-grid { grid-template-columns: minmax(0, 1fr); }
    .chart-grid { grid-template-columns: minmax(0, 1fr); }
    .modal-foot { flex-direction: column-reverse; }
    .modal-foot .btn { width: 100%; }
    .truncation { max-width: 11rem; }
    .kv { flex-direction: column; gap: 0; }
    .kv span { flex: 0 0 auto; width: auto; }
    .kv .card-actions { margin-left: 0; justify-content: flex-start; }
    .footer { font-size: .75rem; }

    .auth-stage { padding: 2rem 1rem; gap: 1.5rem; }
    .hero-status { margin-bottom: 1.1rem; font-size: .64rem; }
    .hero-title { font-size: 2rem; margin-bottom: .75rem; }
    .hero-copy { font-size: .9rem; margin-bottom: 1.1rem; }
    .auth-card { padding: 1.6rem 1.25rem 1.3rem; }
    .auth-form-title { font-size: 1.15rem; }
    .signin-notice { font-size: .7rem; }
    .hero-meta { font-size: .68rem; }
}

@media print {
    .sidebar, .topbar, .no-print, .nav-progress,
    .pager, .form-actions, .actions, .screen-bar, .skip-link,
    .auth-mesh, .hero, .auth-tools { display: none !important; }
    body, .auth-body { background: #fff; color: #000; }
    .content { padding: 0; }
    .card, .stat-card { break-inside: avoid; border-color: #999; }
    .table th, .table td { border-color: #bbb; }
    a { color: #000; text-decoration: underline; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    .sidebar { transition: none; }
}
