/* =========================================================================
 * style.css — Arizona Surgical Physician Assistants
 *
 * Three layers, in this order:
 *   1. APP LAYER   the kit's own stylesheet, with its :root re-pointed at
 *                  the ASPA tokens so login/register/dashboard follow the
 *                  active theme.
 *   2. SITE LAYER  the ASPA theme. Structure and components only: it holds
 *                  no literal colours, every one comes from a theme file.
 *   3. BRIDGE      kit component classes restated against ASPA tokens.
 *
 * Only `.btn` and `.sr-only` collide between layers 1 and 2. The site layer
 * is second so it wins on `.btn`; the bridge then restores the kit's button
 * modifiers. The site layer's `.card` is scoped to `.grid--cards .card`,
 * because the kit uses a bare `.card` for account panels.
 *
 * Colours live in /assets/css/themes/aspa-light.css and aspa-dark.css.
 * ====================================================================== */

/* =========================================================================
 * FONTS — served first-party.
 *
 * The kit's CSP is `style-src 'self' 'unsafe-inline'` and `font-src 'self'`,
 * so the Google Fonts stylesheet and its font files were both blocked and
 * every page fell back to Georgia/Arial. These are the same two families,
 * self-hosted, which needs no CSP change at all — widening the policy to let
 * a third-party origin serve fonts would be the wrong trade for cosmetics.
 *
 * Both are variable fonts with the unused axis ranges stripped: Cinzel is
 * clipped to 400-700 (900 was never used) and Instrument Sans is pinned to
 * wdth 100 and clipped to 400-600. 92 KB for both, two requests, no italics
 * because nothing in the design uses them.
 * ====================================================================== */

@font-face {
    font-family: "Cinzel";
    src: url("/assets/fonts/Cinzel-var.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Instrument Sans";
    src: url("/assets/fonts/InstrumentSans-var.woff2") format("woff2");
    font-weight: 400 600;
    font-style: normal;
    font-display: swap;
}

/* ========================= 1. APP LAYER ================================ */

/* =========================================================================
 * style.css — single, dependency-free stylesheet for the whole app.
 * Replaces Bootstrap. Implements the subset of utility/layout classes the
 * existing markup uses. Intentionally simple; tweak freely.
 * ====================================================================== */

:root {
    /* Re-pointed at the ASPA tokens defined in /assets/css/themes/*.css.
       Custom properties resolve at use time, so it does not matter that the
       theme file loads after this one. The app pages therefore follow the
       active theme without any of their own markup changing. */
    --bg: var(--bg-page);
    --fg: var(--text-primary);
    --muted: var(--text-muted);
    --primary: var(--brand-primary);
    --primary-dark: var(--c-oxblood);
    --danger: var(--text-error);
    --success: #2E7D52;          /* semantic, deliberately outside the brand palette */
    --border: var(--line-hairline);
    --card: var(--bg-surface);
    --dark: var(--c-ink);
    /* The kit's own stylesheet uses these two but never defines them.
       --paper-2 carries a literal fallback so it renders; --text does
       not, so `color: var(--text)` is invalid at computed-value time
       and inherits — which turns the OAuth button white-on-white in
       the dark theme. Defining them here fixes both. */
    --text: var(--text-primary);
    --paper-2: var(--bg-inset);
    /* --radius is intentionally not set here: the site layer below defines it. */
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--fg);
    background: var(--bg);
    line-height: 1.5;
    min-height: 100vh;
}

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

h1, h2, h3, h4, h5, h6 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.2; }
.h3 { font-size: 1.5rem; }
.h5 { font-size: 1.1rem; }

img { max-width: 100%; height: auto; }

/* ---------- Layout: container + flex grid ---------- */

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

[class*="col-"] {
    padding: 0 15px;
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
}

/* col-N (12-column) shared across breakpoints; mobile-first = full width,
   widths apply from the small breakpoint up. */
@media (min-width: 768px) {
    .col-sm-1,.col-md-1,.col-lg-1,.col-xl-1 { flex-basis: 8.3333%;  max-width: 8.3333%;  }
    .col-sm-2,.col-md-2,.col-lg-2,.col-xl-2 { flex-basis: 16.6667%; max-width: 16.6667%; }
    .col-sm-3,.col-md-3,.col-lg-3,.col-xl-3 { flex-basis: 25%;      max-width: 25%;      }
    .col-sm-4,.col-md-4,.col-lg-4,.col-xl-4 { flex-basis: 33.3333%; max-width: 33.3333%; }
    .col-sm-5,.col-md-5,.col-lg-5,.col-xl-5 { flex-basis: 41.6667%; max-width: 41.6667%; }
    .col-sm-6,.col-md-6,.col-lg-6,.col-xl-6 { flex-basis: 50%;      max-width: 50%;      }
    .col-sm-7,.col-md-7,.col-lg-7,.col-xl-7 { flex-basis: 58.3333%; max-width: 58.3333%; }
    .col-sm-8,.col-md-8,.col-lg-8,.col-xl-8 { flex-basis: 66.6667%; max-width: 66.6667%; }
    .col-sm-9,.col-md-9,.col-lg-9,.col-xl-9 { flex-basis: 75%;      max-width: 75%;      }
    .col-sm-10,.col-md-10,.col-lg-10,.col-xl-10 { flex-basis: 83.3333%; max-width: 83.3333%; }
    .col-sm-11,.col-md-11,.col-lg-11,.col-xl-11 { flex-basis: 91.6667%; max-width: 91.6667%; }
    .col-sm-12,.col-md-12,.col-lg-12,.col-xl-12 { flex-basis: 100%;  max-width: 100%;     }
}
.col-auto { flex: 0 0 auto; width: auto; max-width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ---------- Text + font utilities ---------- */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-muted   { color: var(--muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.font-weight-normal { font-weight: 400; }
.font-weight-bold   { font-weight: 700; }
.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;
}
small { font-size: 0.85em; }
sub { font-size: 0.8em; }

/* ---------- Spacing utilities (0–5 -> 0,.25,.5,1,1.5,3 rem) ---------- */
.m-0{margin:0}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:1rem}.m-4{margin:1.5rem}.m-5{margin:3rem}
.mt-0{margin-top:0}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:1rem}.mt-4{margin-top:1.5rem}.mt-5{margin-top:3rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:1rem}.mb-4{margin-bottom:1.5rem}.mb-5{margin-bottom:3rem}
.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:1rem}
.ml-auto{margin-left:auto}.mr-auto{margin-right:auto}
.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-3{margin-top:1rem;margin-bottom:1rem}
.p-2{padding:.5rem}.p-3{padding:1rem}
.pr-2{padding-right:.5rem}
.py-5{padding-top:3rem;padding-bottom:3rem}.px-4{padding-left:1.5rem;padding-right:1.5rem}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1rem; }
label { display: inline-block; margin-bottom: .35rem; font-weight: 500; }

.form-control {
    display: block;
    width: 100%;
    padding: .55rem .75rem;
    font-size: 1rem;
    color: var(--fg);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.form-control:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47,111,237,.15);
}

textarea.form-control { min-height: 110px; resize: vertical; }

/* Auth forms get a card-like centered panel */
.form-auth {
    background: var(--card);
    padding: 2rem 1.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    margin: 2.5rem auto;
    max-width: 420px;
}

/* Checkbox / radio (custom-control* shim -> native controls) */
.custom-control { position: relative; display: block; margin: .25rem 0; }
.custom-control-input { margin-right: .4rem; }
.custom-control-label { font-weight: 400; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    user-select: none;
    padding: .55rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: #e9ecef;
    color: var(--fg);
    transition: background-color .15s ease-in-out, border-color .15s ease-in-out;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-lg { padding: .7rem 1.25rem; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn-default { background: #fff; border-color: var(--border); color: var(--fg); }

/* ---------- Navbar ---------- */
.navbar {
    display: flex;
    align-items: center;
    padding: .6rem 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.navbar .container { display: flex; align-items: center; width: 100%; }
.bg-white { background: #fff; }
.bg-dark  { background: var(--dark); }
.navbar-light .nav-link, .navbar-light .navbar-brand { color: var(--fg); }
.navbar-dark  .nav-link, .navbar-dark  .navbar-brand { color: #f1f1f1; }
.shadow-sm { box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.navbar-brand {
    display: inline-flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 600;
    margin-right: 1rem;
}
.navbar-brand img { margin-right: .5rem; }

.navbar-nav {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: .25rem;
}
.navbar-collapse { display: flex; flex: 1; align-items: center; justify-content: flex-end; }
.nav-item { list-style: none; }
.nav-link {
    display: block;
    padding: .4rem .75rem;
    border-radius: 6px;
}
.nav-link:hover { text-decoration: none; opacity: .85; }
.navbar-img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; vertical-align: middle; }

/* Mobile toggle */
.navbar-toggler {
    display: none;
    margin-left: auto;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 6px;
    padding: .35rem .6rem;
    cursor: pointer;
    color: inherit;
}
.navbar-toggler-icon::before { content: "\2630"; font-size: 1.1rem; }

/* ---------- Dropdown (toggled by app.js via .show) ---------- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + .25rem);
    display: none;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    padding: .35rem 0;
    z-index: 1000;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
    display: block;
    padding: .5rem 1rem;
    color: var(--fg);
    white-space: nowrap;
}
.dropdown-item:hover { background: var(--bg); text-decoration: none; }
.dropdown-toggle .caret { margin-left: .3rem; }

@media (max-width: 767px) {
    .navbar-toggler { display: inline-block; }
    .navbar-collapse {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .navbar-collapse.show { display: flex; }
    .navbar-nav { flex-direction: column; align-items: stretch; width: 100%; }
    .dropdown-menu { position: static; box-shadow: none; border: 0; }
    .navbar .container { flex-wrap: wrap; }
}

/* ---------- Jumbotron / misc ---------- */
.jumbotron {
    background: #fff;
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    margin: 2rem 0;
    border: 1px solid var(--border);
}

/* ---------- Footer (light, minimal) ---------- */
.site-footer {
    padding: 1.5rem 0;
    background: #fff;
    border-top: 1px solid #e6e8eb;
}
.footer-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    text-align: left;
}
.footer-logo img { display: block; }
.footer-text {
    margin: 0;
    font-size: .85rem;
    color: #6b7280;
}
.footer-text a { color: #4b5563; text-decoration: none; }
.footer-text a:hover { text-decoration: underline; }

/* ---------- Header navigation select ---------- */
.nav-controls { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.nav-select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%23555' d='M2 4l4 4 4-4z'/></svg>") no-repeat right .7rem center;
    border: 1px solid #d5d9de;
    border-radius: 8px;
    padding: .5rem 2rem .5rem .9rem;
    font-size: .95rem;
    font-weight: 600;
    color: #2b2f36;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.nav-select:hover { border-color: #b7bdc5; }
.nav-select:focus-visible { outline: none; border-color: #2b6cb0; box-shadow: 0 0 0 3px rgba(43,108,176,.2); }

.nav-avatar-btn {
    background: #fff;
    border: 1px solid #d5d9de;
    border-radius: 8px;
    padding: .25rem .5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.nav-avatar-btn:hover { border-color: #b7bdc5; }

/* ---------- Profile card / avatar (profile-edit & profile-card) ---------- */
.picCard { margin-bottom: 1rem; }
.avatar-upload { position: relative; max-width: 200px; margin: 0 auto; }
.avatar-preview {
    width: 160px; height: 160px; margin: 0 auto;
    border-radius: 50%; border: 3px solid var(--border); overflow: hidden;
}
.avatar-preview > div {
    width: 100%; height: 100%;
    background-size: cover; background-position: center; background-repeat: no-repeat;
}
.avatar-edit { text-align: center; margin-top: .5rem; }
.avatar-edit input { display: inline-block; }

/* ---------- CAPTCHA widget ---------- */
.captcha-container {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
    background: #fafbfc;
}
.captcha-label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: .4rem;
}
.captcha-question {
    font-weight: 600;
    margin-bottom: .6rem;
    min-height: 1.4em;
}
.captcha-image-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: .75rem;
    max-width: 100%;
}
.captcha-image {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.refresh-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 34px;
    height: 34px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255,255,255,.9);
    cursor: pointer;
    color: var(--fg);
}
.refresh-btn:hover { background: #fff; }
.refresh-icon { width: 100%; height: 100%; }
.captcha-input { max-width: 320px; }

/* ---------- Admin dashboard ---------- */
.dashboard { max-width: 1100px; margin-top: 1.5rem; }
.dash-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1rem; }
.dash-head h4 { margin: 0; }
.dash-sub { color: var(--muted); font-size: .85rem; }
.dash-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.dash-search { flex: 1; max-width: 480px; }
.dash-count { color: var(--muted); font-size: .85rem; white-space: nowrap; }

.dash-table-wrap { max-height: 45vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.dash-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dash-table thead th {
    position: sticky; top: 0; background: #f6f7f9; text-align: left;
    padding: .55rem .75rem; border-bottom: 1px solid var(--border); font-weight: 600; z-index: 1;
}
.dash-table tbody td { padding: .5rem .75rem; border-bottom: 1px solid #eef0f2; }
.dash-table tbody tr { cursor: pointer; }
.dash-table tbody tr:hover { background: #f9fafb; }
.dash-table tbody tr.selected { background: #e7f1ff; }

.dash-actions { display: flex; align-items: center; gap: .5rem; margin: .9rem 0; flex-wrap: wrap; }
.btn-success { background: #1a7f47; border-color: #1a7f47; color: #fff; }
.btn-danger  { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.dash-status { font-size: .85rem; margin-left: .5rem; }
.dash-status.ok  { color: #1a7f47; }
.dash-status.err { color: #b3261e; }

.dash-detail { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-top: .5rem; }
.dash-detail h5 { margin: 0 0 1rem; }
.dash-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem 1.25rem; }
.dash-fields label { display: flex; flex-direction: column; font-size: .8rem; font-weight: 600; color: var(--muted); gap: .3rem; }
.dash-fields input, .dash-fields select, .dash-fields textarea {
    font-size: .9rem; font-weight: 400; color: var(--fg);
    padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 6px; width: 100%;
}
.dash-fields .dash-wide { grid-column: 1 / -1; }
.field-error { color: #b3261e; font-weight: 400; font-size: .75rem; min-height: .9em; }

.dash-ro-head { margin: 1.25rem 0 .6rem; color: var(--muted); }
.dash-readonly { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem 1rem; font-size: .82rem; color: var(--fg); }
.dash-readonly span { color: var(--muted); word-break: break-word; }

@media (max-width: 720px) {
    .dash-fields, .dash-readonly { grid-template-columns: 1fr; }
}

/* ---------- Developer Console ---------- */
.devc { max-width: 900px; margin-top: 1.5rem; }
.devc-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.devc-head h4 { margin: 0; }
.devc-sub { color: var(--muted); font-size: .85rem; }
.devc-actions { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; position: sticky; top: 0; background: var(--bg, #fff); padding: .5rem 0; z-index: 5; }
.devc-status { font-size: .85rem; }
.devc-status.ok { color: #1a7f47; }
.devc-status.err { color: #b3261e; }

.devc-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.devc-group-title { margin: 0 0 .75rem; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.devc-rows { display: flex; flex-direction: column; }
.devc-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: .7rem 0; border-top: 1px solid #eef0f2; }
.devc-row:first-child { border-top: 0; }
.devc-row-label label { font-weight: 600; font-size: .95rem; display: block; }
.devc-note { display: block; font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.devc-row-control { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; min-width: 220px; }
.devc-row-control input[type="text"], .devc-row-control input[type="number"], .devc-row-control textarea {
    width: 100%; min-width: 220px; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; font-family: inherit;
}
.devc-field-error { color: #b3261e; font-size: .75rem; }

/* toggle switch */
.devc-switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.devc-switch input { opacity: 0; width: 0; height: 0; }
.devc-slider { position: absolute; inset: 0; cursor: pointer; background: #cfd4da; border-radius: 26px; transition: background .15s; }
.devc-slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.devc-switch input:checked + .devc-slider { background: #1a7f47; }
.devc-switch input:checked + .devc-slider::before { transform: translateX(20px); }
.devc-switch input:focus-visible + .devc-slider { outline: 2px solid #1a7f47; outline-offset: 2px; }
.devc-locked { font-size: .8rem; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }

.devc-secret-intro { font-size: .88rem; color: var(--muted); max-width: 70ch; }
.devc-secrets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem; }
.devc-secret { display: flex; justify-content: space-between; align-items: center; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 6px; font-size: .82rem; }
.devc-secret code { font-size: .78rem; }
.devc-secret.is-set span { color: #1a7f47; font-weight: 600; }
.devc-secret.not-set span { color: #b3261e; font-weight: 600; }
@media (max-width: 640px) { .devc-row { grid-template-columns: 1fr; } .devc-row-control { align-items: stretch; } }

/* ---------- Link tracking ---------- */
.lt { max-width: 1080px; margin-top: 1.5rem; }
.lt-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.lt-head h4 { margin: 0; }
.lt-sub { color: var(--muted); font-size: .85rem; }
.lt-create { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.lt-create h5 { margin: 0 0 .8rem; font-size: 1rem; }
.lt-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem 1rem; align-items: end; }
.lt-form label { display: flex; flex-direction: column; font-size: .78rem; font-weight: 600; color: var(--muted); gap: .3rem; }
.lt-form input { padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; }
.lt-opt { font-weight: 400; text-transform: none; }
.lt-err { color: #b3261e; font-size: .72rem; font-weight: 400; }
.lt-status { font-size: .82rem; align-self: center; }
.lt-status.ok { color: #1a7f47; } .lt-status.err { color: #b3261e; }

.lt-table-wrap, .lt-recent-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.lt-table, .lt-recent { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 720px; }
.lt-table th, .lt-recent th { text-align: left; background: #f6f7f9; padding: .55rem .7rem; border-bottom: 1px solid var(--border); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.lt-table td, .lt-recent td { padding: .5rem .7rem; border-bottom: 1px solid #eef0f2; vertical-align: top; }
.lt-table tr.sel { background: #e7f1ff; }
.lt-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }
.lt-copy { border: 1px solid var(--border); background: #fff; border-radius: 4px; cursor: pointer; margin-left: .3rem; padding: 0 .35rem; }
.lt-dest { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; color: var(--muted); }
.lt-muted { color: var(--muted); }
.lt-badge { font-size: .72rem; padding: .1rem .45rem; border-radius: 10px; font-weight: 600; }
.lt-badge.on { background: #e6f4ec; color: #1a7f47; } .lt-badge.off { background: #f3e6e6; color: #b3261e; }
.lt-row-actions button { border: 1px solid var(--border); background: #fff; border-radius: 5px; cursor: pointer; font-size: .74rem; padding: .18rem .45rem; margin-right: .25rem; }
.lt-empty { text-align: center; color: var(--muted); padding: 1.5rem; }

.lt-detail { margin-top: 1.75rem; border-top: 2px solid var(--border); padding-top: 1.25rem; }
.lt-detail-head { display: flex; justify-content: space-between; align-items: center; }
.btn-line { border: 1px solid var(--border); padding: .4rem .8rem; border-radius: 6px; text-decoration: none; color: var(--fg); font-size: .82rem; }
.lt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.lt-kpis div { font-size: .8rem; color: var(--muted); }
.lt-kpi { display: block; font-size: 1.7rem; font-weight: 700; color: var(--fg); }
.lt-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; }
.lt-cols h6 { margin: 0 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lt-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; border-bottom: 1px solid var(--border); }
.lt-bar { flex: 1; display: flex; align-items: flex-end; }
.lt-bar span { width: 100%; background: #1a7f47; border-radius: 2px 2px 0 0; display: block; min-height: 3px; }
.lt-list { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.lt-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px solid #eef0f2; font-size: .84rem; }
.lt-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .lt-cols { grid-template-columns: 1fr; } }

/* ---------- My Account (export / delete) ---------- */
.acct { max-width: 720px; margin-top: 1.5rem; }
.acct-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.acct-head h4 { margin: 0; }
.acct-sub, .acct-muted { color: var(--muted); font-size: .9rem; }
.acct-note { color: var(--muted); background: var(--paper-2, #f1ede3); padding: 1rem; border-radius: var(--radius); }
.acct-ok { color: #1a7f47; } .acct-err { color: #b3261e; }
.acct-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.acct-card h5 { margin: 0 0 .4rem; }
.acct-card .acct-muted { margin: 0 0 1rem; }
.acct-danger { border-color: #e3c6c6; background: #fdf7f7; }
.acct-danger h5 { color: #b3261e; }

/* ---------- API clients ---------- */
.apic-warn { background: #fdf6e3; border: 1px solid #ece0b8; color: #7a5c00; padding: .8rem 1rem; border-radius: var(--radius); }
.apic-create { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.apic-create input { flex: 1; min-width: 220px; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 6px; }
.apic-secret { margin-top: 1rem; padding: 1rem; border: 1px dashed #1a7f47; border-radius: 8px; background: #f3fbf6; }
.apic-secret code { background: #fff; padding: .15rem .4rem; border-radius: 4px; word-break: break-all; }
.apic-ref { background: #12161b; color: #d4d8dc; padding: 1rem 1.2rem; border-radius: 8px; overflow-x: auto; font-size: .82rem; line-height: 1.7; }

/* ---------- Dev-console sub-nav + maintenance ---------- */
.devc-subnav { display: flex; gap: .3rem; flex-wrap: wrap; margin: -0.5rem 0 1.25rem; border-bottom: 1px solid var(--border); }
.devc-subnav a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); font-size: .9rem; font-weight: 600; border-bottom: 2px solid transparent; }
.devc-subnav a:hover { color: var(--fg); }
.mnt-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.mnt-btn { border: 1px solid var(--border); background: #fff; border-radius: 5px; cursor: pointer; font-size: .74rem; padding: .18rem .45rem; margin-right: .25rem; text-decoration: none; color: var(--fg); }
.mnt-restore-db { padding: .25rem; border: 1px solid var(--border); border-radius: 5px; font-size: .8rem; }
.mnt-log { background: #12161b; color: #d4d8dc; padding: 1rem; border-radius: 8px; margin-top: 1rem; font-size: .8rem; white-space: pre-wrap; max-height: 300px; overflow: auto; }
.mnt-alert { padding: .5rem .7rem; border-radius: 6px; font-size: .88rem; margin: .3rem 0; }
.mnt-critical { background: #fdeaea; color: #b3261e; } .mnt-warning { background: #fdf6e3; color: #7a5c00; } .mnt-info { background: #eaf1fd; color: #1a4b8f; }
.mnt-dns-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; font-size: .9rem; }

/* ---------- Public profile page ---------- */
.pf { max-width: 880px; margin: 2rem auto; }
.pf-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(16, 22, 26, .06);
}
.pf-cover {
    height: 120px;
    background: linear-gradient(120deg, var(--primary), var(--primary-dark));
}
.pf-head {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding: 0 1.5rem 1.25rem;
}
.pf-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--card);
    background: #fff;
    margin-top: -72px;
    box-shadow: 0 1px 3px rgba(16, 22, 26, .12);
    flex-shrink: 0;
}
.pf-id { flex: 1 1 auto; min-width: 0; }
.pf-name { font-size: 1.6rem; line-height: 1.2; margin: 0; color: var(--fg); word-break: break-word; }
.pf-fullname { color: var(--muted); margin: .2rem 0 0; }
.pf-fullname .fa { margin-right: .25rem; }
.pf-headline { color: var(--fg); margin: .35rem 0 0; }
.pf-role {
    display: inline-block;
    margin-top: .6rem;
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
}
.pf-role-4 { background: #fef3e6; color: #a15c00; border-color: #f3d9b5; }
.pf-role-5 { background: #eaf1fd; color: var(--primary-dark); border-color: #cbdcfa; }

/* Owner. Without a rule of its own this badge fell back to the plain
   grey, which read as less senior than Director rather than more. */
.pf-role-6 {
  background: var(--bg-inset);
  color: var(--text-brand);
  border-color: var(--brand-primary);
}
.pf-edit { align-self: flex-end; white-space: nowrap; }
.pf-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}
.pf-section-title {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin: 0 0 .6rem;
}
.pf-bio { color: var(--fg); line-height: 1.65; margin: 0; word-break: break-word; }
.pf-empty { color: var(--muted); font-style: italic; margin: 0; }
.pf-dl { margin: 0; }
.pf-dl dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-top: .65rem; }
.pf-dl dt:first-child { margin-top: 0; }
.pf-dl dd { margin: .1rem 0 0; color: var(--fg); word-break: break-word; }

@media (max-width: 640px) {
    .pf-head { flex-direction: column; align-items: flex-start; }
    .pf-avatar { margin-top: -72px; }
    .pf-edit { align-self: stretch; text-align: center; }
    .pf-body { grid-template-columns: 1fr; }
}
.pf-message {
    max-width: 480px;
    margin: 4rem auto;
    text-align: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
}
.pf-message h1 { font-size: 1.4rem; margin: 0 0 .5rem; color: var(--fg); }
.pf-message p { color: var(--muted); margin: 0 0 1.25rem; }

/* Username shown beside the header avatar (email + Discord accounts) */
.nav-username { font-weight: 600; font-size: .9rem; color: var(--fg); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .nav-username { display: none; } }

/* ---------- OAuth sign-in buttons (login page) ---------- */
.oauth-buttons { display: flex; flex-direction: column; gap: .5rem; margin-top: .85rem; }
.oauth-btn {
    display: block; text-align: center; padding: .6rem .9rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: #fff; color: var(--text); text-decoration: none; font-weight: 500;
}
.oauth-btn:hover { background: #f6f7f9; text-decoration: none; }
/* Provider accents — purely cosmetic; unknown providers fall back to the base. */
.oauth-btn-discord   { color: #5662f6; border-color: #5662f6; }
.oauth-btn-google    { color: #1a73e8; border-color: #dadce0; }
.oauth-btn-github    { color: #24292f; border-color: #24292f; }
.oauth-btn-microsoft { color: #0067b8; border-color: #0067b8; }

/* ---------- Connected sign-in methods (profile-edit) ---------- */
.acct-oauth-row {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    padding: .55rem 0; border-top: 1px solid var(--border);
}
.acct-oauth-row:first-of-type { border-top: none; }
.acct-oauth-row form { margin: 0; }
.acct-oauth-name   { font-weight: 600; min-width: 8rem; }
.acct-oauth-linked { color: var(--muted); font-size: .9rem; flex: 1 1 auto; }

/* ---------- Dashboard: account-type badge ---------- */
.dash-kind {
    display: inline-block; padding: .05rem .45rem; border-radius: 999px;
    font-size: .74rem; font-weight: 600; letter-spacing: .01em;
    border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.dash-kind-local { background: #f3f4f6; }
.dash-kind-oauth { background: #eef4ff; border-color: #c7d8f7; color: #1a4fa0; }
.dash-table tr.row-oauth td:first-child { font-style: italic; }


/* ========================= 2. SITE LAYER =============================== */

/* =============================================================
   ASPA — base.css
   Structure, layout, type and behaviour.

   RULE: this file contains no literal colours. Every colour is a
   var() defined by the active theme in css/themes/*.css, so a new
   theme (e.g. dark mode) is a single file with no markup changes.
   ============================================================= */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body, h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
  padding: 0;
}

ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* The `hidden` attribute is only a UA-stylesheet `display: none`, so any
   author rule that sets display beats it — `.btn { display: inline-flex }`
   was keeping hidden buttons on screen. This restores the attribute's
   meaning everywhere, which is why several components below no longer need
   their own `[hidden]` rule. */
[hidden] { display: none !important; }


/* ---------- 2. Structural tokens ---------- */
:root {
  /* Type — Cinzel is the Trajan-style engraved capital in the logo.
     Its lowercase draws as small capitals, which is why headings are
     written in sentence case and still set as capitals. */
  --font-display: "Cinzel", "Trajan Pro", "Optima", Georgia, serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --step--1: clamp(0.72rem, 0.69rem + 0.14vw, 0.8rem);
  --step-0:  clamp(0.95rem, 0.91rem + 0.2vw, 1.06rem);
  --step-1:  clamp(1.1rem, 1.02rem + 0.36vw, 1.32rem);
  --step-2:  clamp(1.3rem, 1.14rem + 0.72vw, 1.8rem);
  --step-3:  clamp(1.6rem, 1.32rem + 1.3vw, 2.5rem);
  --step-4:  clamp(1.75rem, 1.3rem + 2.1vw, 3.1rem);

  /* Space */
  --sp-1: 0.375rem;
  --sp-2: 0.75rem;
  --sp-3: 1.125rem;
  --sp-4: 1.75rem;
  --sp-5: 2.5rem;
  --sp-6: 4rem;

  /* Layout */
  --shell: 76rem;
  --gutter: clamp(1.1rem, 4vw, 3.25rem);
  --hairline: 1px;
  --radius: 3px;

  /* Frame */
  --rail-w: clamp(11px, 1.4vw, 16px);        /* ribbon thickness */
  --rail-inset: clamp(0.4rem, 1.8vw, 1.75rem);
  --fil-size: clamp(2rem, 4.2vw, 3.25rem);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- 3. Base type ---------- */
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.64;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

p + p { margin-top: var(--sp-3); }

/* The logo's grey letterspaced subtitle, reused as the section label. */
.eyebrow {
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.eyebrow--onDark { color: var(--text-on-dark-muted); }

.section__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-3);
  line-height: 1.14;
  letter-spacing: 0.005em;
  color: var(--text-heading);
}
.section__title--onDark { color: var(--text-on-dark); }

.lede {
  font-size: var(--step-1);
  line-height: 1.55;
}

/* The logo's rule-dash-rule device from the "LLC" line. */
.ornament {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: var(--sp-3);
}
.ornament i {
  width: 2.5rem;
  height: 1px;
  background: var(--rule-steel);
}
.ornament b {
  width: 0.42rem;
  height: 0.42rem;
  transform: rotate(45deg);
  background: var(--bevel-lozenge);
  box-shadow: 0 1px 0 var(--bevel-glint);
}
.ornament--centred { justify-content: center; }
.ornament--centred i { width: 3.5rem; }
.ornament--onDark i { background: var(--rule-steel-on-dark); }


.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-surface);
  color: var(--text-heading);
}
.skip-link:focus { left: var(--sp-2); top: var(--sp-2); }

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

/* ---------- 4. Shell & sections ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(3rem, 6.5vw, 5.5rem); }

/* Only content inside the rails needs to clear them. */
.stage .shell {
  padding-inline: max(var(--gutter), calc(var(--rail-inset) + var(--rail-w) + 1.5rem));
}

/* No section paints its own background. The page is one surface from the
   masthead to the footer; only the hero image interrupts it. */

/* Room for the curls, which occupy the first and last 5x --rail-w of the
   stage. Without this they would sit over the opening and closing copy. */
.stage > .section:first-of-type { padding-top: clamp(4.5rem, 9vw, 7rem); }
.section--contact { padding-bottom: clamp(6rem, 13vw, 9.5rem); }

.section__head { margin-bottom: var(--sp-5); }
.section__head--centred { text-align: center; }

.shell--split {
  display: grid;
  gap: var(--sp-5) clamp(2rem, 6vw, 4.5rem);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 62rem) {
  .shell--split { grid-template-columns: 20rem minmax(0, 1fr); }
  .shell--split .split__aside { position: sticky; top: 7rem; align-self: start; }
}

.aside__note {
  margin-top: var(--sp-4);
  color: var(--text-secondary);
  max-width: 28ch;
}

/* ---------- 5. Rails ----------
   The logo's border is an open outline, not a box. Two ribbons run down
   the sides below the hero, curl inward at each end and stop. They sit on
   a single continuous background — there is no inner surface. */
.stage { position: relative; }

.rails {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  margin-top: 40px;
}

.rail {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
}
.rail--left  { left: var(--rail-inset); }
.rail--right { right: var(--rail-inset); transform: scaleX(-1); }

/* The ribbon spans exactly 10 of the curl's 50 viewBox units, so a box of
   5x the rail width renders it at precisely the band's thickness. Both
   dimensions are set explicitly — leaving height to the intrinsic aspect
   ratio is what previously let the curl render narrower than the band. */
.rail__cap {
  flex: none;
  width: calc(var(--rail-w) * 5);
  height: calc(var(--rail-w) * 5);
  /* The reset's `svg { max-width: 100% }` would clamp this to the rail's
     own width and render the curl at a fifth of scale. */
  max-width: none;
  overflow: hidden;
}
.rail__cap--end { transform: scaleY(-1); }

/* The straight run. A plain gradient, its stops matching the curl's five
   passes band for band, so the join is invisible. */
.rail__band {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  background: var(--rail-band);
}

.rail-shade { stroke: var(--rail-shade); }
.rail-deep  { stroke: var(--rail-deep); }
.rail-face  { stroke: var(--rail-face); }
.rail-hi    { stroke: var(--rail-hi); }
.rail-glint { stroke: var(--rail-glint); }

/* ---------- 5b. Filigree frame ----------
   Three-step corners, used on the contact form. No fill and no border:
   the corners alone mark the panel, so the background stays continuous. */
.frame { position: relative; }

.frame__corner {
  position: absolute;
  width: var(--fil-size);
  height: var(--fil-size);
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 1px 0 var(--emboss-lo)) drop-shadow(0 -1px 0 var(--emboss-hi));
}
.frame__corner--tl { top: 0; left: 0; }
.frame__corner--tr { top: 0; right: 0; transform: rotate(90deg); }
.frame__corner--br { bottom: 0; right: 0; transform: rotate(180deg); }
.frame__corner--bl { bottom: 0; left: 0; transform: rotate(270deg); }

.frame > .form { padding: clamp(1.5rem, 3.2vw, 2.5rem); }

.fil-outer { fill: var(--fil-outer); }
.fil-mid   { fill: var(--fil-mid); }
.fil-inner { fill: var(--fil-inner); }

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.78em 1.6em;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.2s var(--ease), transform 0.12s var(--ease),
              background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn--sm { padding: 0.58em 1.1em; letter-spacing: 0.14em; text-indent: 0.14em; }

/* A miniature of the same bevel: light along the top, shade beneath. */
.btn--primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  text-shadow: var(--btn-primary-text-shadow);
  box-shadow: var(--btn-primary-bevel);
}
.btn--primary:hover { filter: brightness(1.1); }
.btn--primary:active { transform: translateY(1px); box-shadow: var(--btn-primary-bevel-active); }

.btn--ghost {
  background: transparent;
  color: var(--text-on-dark);
  border: var(--hairline) solid var(--btn-ghost-border);
}
.btn--ghost:hover { background: var(--btn-ghost-bg-hover); border-color: var(--text-on-dark); }
.btn--ghost:active { transform: translateY(1px); }

/* ---------- 7. Masthead ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-header);
  border-bottom: var(--hairline) solid var(--line-hairline);
  backdrop-filter: saturate(160%) blur(10px);
}

.masthead__inner {
  max-width: var(--shell);
  margin-inline: auto;
  padding: 0.5rem var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  justify-content: space-between;
}

.wordmark { display: flex; align-items: center; gap: 0.7rem; }
.wordmark__logo {
  width: auto;
  height: clamp(2.4rem, 5vw, 3rem);
  flex: none;
}
.wordmark__text { display: grid; gap: 0.15rem; line-height: 1; }
.wordmark__name {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.2vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-brand);
}
.wordmark__sub {
  font-family: var(--font-display);
  font-size: 0.56rem;
  font-weight: 400;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav { display: flex; align-items: center; gap: var(--sp-4); }

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-size: var(--step--1);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav__list a {
  position: relative;
  white-space: nowrap;
  padding-block: 0.35rem;
  color: var(--text-secondary);
  transition: color 0.2s var(--ease);
}
.nav__list a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--bevel-lozenge);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.nav__list a:hover { color: var(--text-brand); }
.nav__list a:hover::after { transform: scaleX(1); }

/* The signed-in destination select. Sits in the nav list, so it inherits
   the masthead's display face and tracking rather than looking like a form
   control that wandered in. */
.nav__jump-select {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 0.35rem 1.7rem 0.35rem 0.6rem;
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text-secondary);
  appearance: none;
  background-image: var(--select-caret);
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.6rem;
  cursor: pointer;
  max-width: 14rem;
}
.nav__jump-select:hover { color: var(--text-brand); border-color: var(--brand-primary); }

/* Options are rendered by the OS, which ignores most of the above; set the
   colours so a dark theme does not produce dark-on-dark. */
.nav__jump-select option { background: var(--bg-surface); color: var(--text-secondary); }

.nav__jump-fallback { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

.nav__tools { display: flex; align-items: center; gap: var(--sp-3); }

.theme-switch { display: flex; align-items: center; gap: 0.5rem; }
.theme-switch__label {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.theme-switch__select {
  font-size: var(--step--1);
  padding: 0.35rem 1.6rem 0.35rem 0.55rem;
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text-secondary);
  appearance: none;
  background-image: var(--select-caret);
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.6rem;
  cursor: pointer;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.7rem;
  background: transparent;
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.nav-toggle__bars { position: relative; width: 1rem; height: 2px; background: var(--text-brand); }
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 1rem;
  height: 2px;
  background: var(--text-brand);
}
.nav-toggle__bars::before { top: -5px; }
.nav-toggle__bars::after { top: 5px; }

/* Between the mobile drawer and a roomy desktop the bar is tight: drop the
   theme caption and close the gaps rather than let the button wrap. */
@media (min-width: 62rem) and (max-width: 80rem) {
  .nav { gap: var(--sp-3); }
  .nav__list { gap: var(--sp-3); }
  .theme-switch__label { display: none; }
  .masthead .btn--sm { letter-spacing: 0.1em; text-indent: 0.1em; }
}

/* ---------- 8. Hero ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: clamp(27rem, 74vh, 40rem);
  padding-top: clamp(2.5rem, 6vh, 4.5rem);
  overflow: hidden;
}

.hero__media {
  position: absolute;
  inset: 0;
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center;
  z-index: 0;
  background-repeat: no-repeat;
}
.hero__veil { position: absolute; inset: 0; z-index: 1; background: var(--hero-veil); }

.hero__body {
  position: relative;
  z-index: 2;
  margin: auto;
  width: 100%;
  max-width: var(--shell);
  padding: clamp(1.5rem, 4vw, 3rem) var(--gutter);
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-4);
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--text-on-dark);
  margin-bottom: var(--sp-3);
  text-shadow: var(--hero-title-shadow);
  max-width: 26ch;
}
.hero__title span { color: var(--text-on-dark-accent); }

.hero__lede {
  max-width: 46ch;
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--text-on-dark-soft);
}

.hero__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }

.hero__strip {
  position: absolute;
  z-index: 2;
  padding: var(--sp-3) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  /*! gap: 0.5rem clamp(1rem, 3vw, 2.25rem); */
  justify-content: center;
  border-top: var(--hairline) solid var(--line-on-dark);
  background: rgba(200,0,0,0.5);
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #FFFFFF;
  /*! font-weight: bold; */
  top: 0px;
}

/* ---------- 9. About ---------- */
.facts {
  margin-top: var(--sp-5);
  display: grid;
  gap: var(--hairline);
  background: var(--line-hairline);
  border: var(--hairline) solid var(--line-hairline);
}
@media (min-width: 40rem) { .facts { grid-template-columns: 1fr 1fr; } }

.facts__item { background: var(--bg-page); padding: var(--sp-3); }
.facts__item dt {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-brand);
  margin-bottom: 0.35rem;
}
.facts__item dd { margin: 0; color: var(--text-secondary); }

/* ---------- 10. Capability cards ---------- */
.grid--cards {
  display: grid;
  gap: var(--hairline);
  background: var(--line-hairline);
  border: var(--hairline) solid var(--line-hairline);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 44rem) { .grid--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 68rem) { .grid--cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Incomplete final row. The grid paints the rule colour behind its cells, so
   a row that is not filled shows as a bare grey block rather than as blank
   space. These quantity queries reshape the layout to whatever divides the
   item count cleanly, so the section works at any length without editing CSS.

   `:has()` takes the specificity of its argument, so each of these outweighs
   the plain track rules above regardless of source order. Browsers without
   `:has()` simply keep the fixed 3-up grid. */
@media (min-width: 44rem) and (max-width: 67.99rem) {
  /* two-up band: one item fills the width, an odd count stretches the orphan */
  .grid--cards:has(> :last-child:nth-child(1)) { grid-template-columns: minmax(0, 1fr); }
  .grid--cards:has(> :last-child:nth-child(n + 3)):has(> :last-child:nth-child(odd)) > :last-child {
    grid-column: span 2;
  }
}

@media (min-width: 68rem) {
  /* Under a full row, split evenly rather than leaving a third empty:
     one item goes full width, two or four go half and half. */
  .grid--cards:has(> :last-child:nth-child(1)) { grid-template-columns: minmax(0, 1fr); }
  .grid--cards:has(> :last-child:nth-child(2)),
  .grid--cards:has(> :last-child:nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Five or more: keep three tracks and let the last row's orphan stretch
     across the remainder. n+5 keeps these off the counts handled above. */
  .grid--cards:has(> :last-child:nth-child(n + 5)):has(> :last-child:nth-child(3n + 1)) > :last-child {
    grid-column: span 3;
  }
  .grid--cards:has(> :last-child:nth-child(n + 5)):has(> :last-child:nth-child(3n + 2)) > :last-child {
    grid-column: span 2;
  }
}

/* The facts list and the key-point banner paint their rules the same way, so
   they fail identically if an item is removed. Same treatment, fewer cases:
   neither is likely to exceed its row. */
@media (min-width: 40rem) {
  .facts:has(> :last-child:nth-child(odd)) > :last-child { grid-column: span 2; }
}
@media (min-width: 46rem) {
  .keypoints:has(> :last-child:nth-child(1)) { grid-template-columns: minmax(0, 1fr); }
  .keypoints:has(> :last-child:nth-child(2)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.grid--cards .card {
  position: relative;
  background: var(--bg-page);
  padding: var(--sp-4) var(--sp-3);
  transition: background-color 0.25s var(--ease);
}
.grid--cards .card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--bevel-lozenge);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s var(--ease);
}
.grid--cards .card:hover { background: var(--bg-inset); }
.grid--cards .card:hover::before { transform: scaleY(1); }

.grid--cards .card__title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--step-1);
  line-height: 1.25;
  color: var(--text-heading);
  margin-bottom: 0.45rem;
}
.grid--cards .card p { color: var(--text-secondary); }

/* ---------- 11. Process ---------- */
.steps {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 52rem) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
  .step + .step { border-left: var(--hairline) solid var(--line-hairline); padding-left: var(--sp-4); }
  .step { padding-right: var(--sp-4); }
}

.step__num {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-brand);
}
.step__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-2);
  line-height: 1.2;
  color: var(--text-heading);
  margin: 0.35rem 0 0.6rem;
}
.step p { color: var(--text-secondary); max-width: 34ch; }

/* ---------- 12. Contact details ---------- */
.contact-details {
  margin-top: var(--sp-4);
  display: grid;
  gap: 0.55rem;
  color: var(--text-secondary);
}
.contact-details span {
  display: inline-block;
  min-width: 4.5rem;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- 13. Form ---------- */
.form__row {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: var(--sp-3);
}
@media (min-width: 34rem) { .form__row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.field { margin-bottom: var(--sp-3); }
.form__row .field { margin-bottom: 0; }

.field > label,
.field__label {
  display: block;
  margin-bottom: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field input[type="time"],
.field input[type="number"],
.field input[type="password"],
.field input[type="search"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  background: var(--input-bg);
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  box-shadow: var(--input-inset);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 6.5rem; }

.field select {
  appearance: none;
  background-image: var(--select-caret);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.65rem;
  padding-right: 2rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--focus-halo);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--text-muted); }

.field--check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  margin-top: var(--sp-3);
}
.field--check input { width: 1.05rem; height: 1.05rem; margin-top: 0.25rem; accent-color: var(--brand-primary); }
.field--check > label {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step--1);
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.5;
  color: var(--text-secondary);
}
.field--check .field__error { grid-column: 1 / -1; }

.field__error { margin-top: 0.3rem; font-size: 0.72rem; color: var(--text-error); }

.field--invalid input,
.field--invalid select,
.field--invalid textarea { border-color: var(--text-error); }

.form__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: var(--hairline) solid var(--line-hairline);
}
.form__note { font-size: var(--step--1); color: var(--text-muted); }
.form__status { margin-top: var(--sp-3); font-size: var(--step--1); color: var(--text-brand); }
.form__status:empty { margin-top: 0; }

/* ---------- 14. Footer ---------- */
.footer {
  background: var(--bg-page);
  padding-block: var(--sp-5) var(--sp-4);
}
.footer__inner {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: var(--sp-3);
}
.footer__logo { width: clamp(8rem, 20vw, 11rem); height: auto; }
.footer__legal { font-size: var(--step--1); color: var(--text-muted); line-height: 1.7; }
.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
  font-family: var(--font-display);
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.footer__links a:hover { color: var(--text-brand); }

/* ---------- 15. Mobile ---------- */
@media (max-width: 61.99rem) {
  .nav-toggle { display: inline-flex; }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: grid;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--gutter);
    background: var(--bg-surface);
    border-bottom: var(--hairline) solid var(--line-hairline);
    box-shadow: var(--nav-shadow);
    clip-path: inset(0 0 100% 0);
    opacity: 0;
    pointer-events: none;
    transition: clip-path 0.3s var(--ease), opacity 0.2s var(--ease);
  }
  .nav.is-open { clip-path: inset(0 0 0 0); opacity: 1; pointer-events: auto; }
  .nav__list { display: grid; gap: var(--sp-2); font-size: var(--step-0); }
  .nav__tools {
    flex-wrap: wrap;
    justify-content: space-between;
    padding-top: var(--sp-3);
    border-top: var(--hairline) solid var(--line-hairline);
  }
  .hero__strip { justify-content: flex-start; }
}

@media (max-width: 26rem) {
  .wordmark__text { display: none; }
}

/* ---------- 16. Motion ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }


@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- 17. Print ----------
   The only literal colours in this file. Paper is always ink on white,
   whatever theme is active on screen. */
@media print {
  .masthead, .hero__strip, .nav-toggle, .btn, .rails { display: none; }
  body { background: #fff; color: #000; }
}

.hero-strip-text {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #FFF;
  /*! font-weight: bold; */
}
.hero-strip-title {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #FFF;
  font-weight: bold;
}
/* ---------- 18. Hero wordmark ----------
   The company name from the logo, rebuilt as live text.

   The bevel is a vertical gradient clipped to the glyphs. The emboss has
   to come from stacked drop-shadow filters rather than text-shadow: with
   background-clip: text the painted background IS the letterform, and a
   text-shadow would render on top of it. A filter applies to the
   composited result, so each shadow lands behind the glyph as intended.

   Proportions are measured from the artwork. In the logo the subtitle has
   0.425 the cap height of the name yet spans exactly the same width, so
   the tracking carries the difference: 0.599em, solved against Cinzel's
   real metrics. Sizing everything in em from this one element keeps that
   relationship true at every viewport. */
.hero-mark {
  width: min(72rem, 90vw);
  margin-inline: auto;
  text-align: center;
  font-size: clamp(1.9rem, 8.1vw, 7.2rem);
}

.hero-mark__name,
.hero-mark__sub,
.hero-mark__llc span {
  font-family: var(--font-display);
  white-space: nowrap;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.hero-mark__name {
  font-size: 1em;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.005em;
  margin: 0;
  background-image: var(--mark-red);
  filter: var(--mark-emboss);
}

.hero-mark__sub {
  font-size: 0.425em;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.599em;
  text-indent: 0.599em;      /* re-centres the trailing letter-space */
  margin: 0.34em 0 0;
  background-image: var(--mark-silver);
  filter: var(--mark-emboss-sm);
}

/* The rule-LLC-rule line, at the 38% of the name's width it occupies in
   the logo. The rules flex, so they stay correct at any size. */
.hero-mark__llc {
  display: flex;
  align-items: center;
  gap: 0.9em;
  width: 38%;
  margin: 0.55em auto 0;
  font-size: 0.375em;
}
.hero-mark__llc span {
  font-size: 1em;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  background-image: var(--mark-silver);
  filter: var(--mark-emboss-sm);
}
.hero-mark__llc i {
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule-steel-on-dark);
}

/* Buttons centred beneath the mark. */
.hero__actions { justify-content: center; }

/* ---------- 19. Meet the owner ----------
   Portrait left, biography right. No red border here: the rails already
   bracket this section, and a second one would nest a frame in a frame. */
.bio {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
@media (min-width: 56rem) {
  .bio { grid-template-columns: minmax(16rem, 24rem) minmax(0, 1fr); }
}

/* Shared image mat. A thin steel keyline inside the border echoes the
   scalpel rather than the ribbon, so a framed photo never reads as a
   second red frame. Used by the portrait and the support image. */
.plate {
  margin: 0;
  position: relative;
  background: var(--bg-inset);
  border: var(--hairline) solid var(--line-hairline);
  padding: clamp(0.5rem, 1vw, 0.75rem);
  box-shadow: var(--nav-shadow);
}
.plate img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}
.plate::after {
  content: "";
  position: absolute;
  inset: clamp(0.5rem, 1vw, 0.75rem);
  border: var(--hairline) solid var(--line-strong);
  opacity: 0.5;
  pointer-events: none;
}

.bio__portrait img { aspect-ratio: 4 / 5; }

/* Declared after the base rule on purpose: `position: relative` above
   would otherwise win on equal specificity, and the leftover `top` would
   push the portrait down the page instead of pinning it. */
@media (min-width: 56rem) {
  .bio__portrait { position: sticky; top: 7rem; }
}

.bio__name { margin-bottom: 0.15em; }
.bio__creds {
  display: block;
  font-size: 0.44em;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-brand);
  margin-top: 0.5em;
}

.bio__role {
  margin-top: 0.6rem;
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.bio .lede { margin-top: var(--sp-4); }

.bio__points {
  margin-top: var(--sp-5);
  display: grid;
  gap: var(--sp-4);
}
.bio__point {
  display: grid;
  gap: 0.3rem 1.5rem;
  padding-top: var(--sp-3);
  border-top: var(--hairline) solid var(--line-hairline);
}
@media (min-width: 44rem) {
  .bio__point { grid-template-columns: 8.5rem minmax(0, 1fr); }
}
.bio__point dt {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-brand);
  padding-top: 0.28rem;
}
.bio__point dd {
  margin: 0;
  color: var(--text-secondary);
}

/* ---------- 20. Hero banner ----------
   The banner was absolutely positioned with fixed 32px type, so on narrow
   screens it grew to five lines and sat on top of the wordmark. Putting it
   back in normal flow keeps it pinned to the top of the hero — it is the
   first child — while letting the mark below it reflow instead of collide.
   Fluid type keeps it to two lines on a phone. */
.hero__strip {
  position: static;
  gap: 0.1rem 1.5rem;
}
/* The banner is the hero's first child, so it should sit flush beneath the
   masthead; the mark still centres in whatever space is left. */
.hero { padding-top: 0; }
.hero-strip-title { font-size: clamp(1.05rem, 2.6vw, 2rem); }
.hero-strip-text  { font-size: clamp(0.85rem, 2.05vw, 1.6rem); }

/* ---------- 21. Logo artwork ----------
   The PNG lockups are drawn for a light ground. A theme can lift them
   with --logo-filter rather than shipping a second set of assets. */
.wordmark__logo,
.footer__logo { filter: var(--logo-filter, none); }


/* ---------- 22. Key points (bio banner) ----------
   A thin three-cell strip closing the bio section. Same hairline-gap grid
   as .facts and .grid--cards: the container paints the rule colour and the
   cells sit on the page colour on top of it. */
.keypoints {
  margin-top: clamp(2rem, 4vw, 3.25rem);
  display: grid;
  gap: var(--hairline);
  grid-template-columns: minmax(0, 1fr);
  background: var(--line-hairline);
  border: var(--hairline) solid var(--line-hairline);
}
@media (min-width: 46rem) {
  .keypoints { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.keypoints__item {
  position: relative;
  overflow: hidden;
  background: var(--bg-inset);
  padding: clamp(0.95rem, 2vw, 1.4rem) var(--sp-3);
  min-height: 5.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  text-align: center;
}

.keypoints__figure {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-2);
  line-height: 1;
  color: var(--text-brand);
}
.keypoints__label,
.keypoints__eyebrow {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* The coverage cell. The image is blurred on a pseudo-element inset past
   the edges — blurring in place would feather the cell's own borders —
   then a scrim carries the type. */
.keypoints__item--coverage::before {
  content: "";
  position: absolute;
  inset: -16px;
  background-image: var(--coverage-image);
  background-size: cover;
  background-position: center;
  filter: blur(2.5px) saturate(1.08);
}
.keypoints__item--coverage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--coverage-scrim);
}
.keypoints__item--coverage > * { position: relative; z-index: 1; }
.keypoints__item--coverage .keypoints__eyebrow { color: var(--text-on-dark-muted); }
.keypoints__lead {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-on-dark);
  text-shadow: var(--hero-title-shadow);
}

/* ---------- 23. Reasons (capabilities footer) ---------- */
.reasons { margin-top: clamp(2.25rem, 5vw, 3.75rem); }
.reasons__head { text-align: center; margin-bottom: var(--sp-4); }
.reasons__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-2);
  line-height: 1.15;
  color: var(--text-heading);
}

.reasons__list {
  display: grid;
  gap: var(--sp-3) clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 46rem) {
  .reasons__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.reasons__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
  padding-top: var(--sp-3);
  border-top: var(--hairline) solid var(--line-hairline);
}
/* The same bevelled lozenge used by the section ornament. */
.reasons__item::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.5rem;
  transform: rotate(45deg);
  background: var(--bevel-lozenge);
  box-shadow: 0 1px 0 var(--bevel-glint);
}
.reasons__item h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-brand);
  margin-bottom: 0.35rem;
}
.reasons__item p { color: var(--text-secondary); }

/* ---------- 24. Trusted surgical support ---------- */
.support {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}
@media (min-width: 56rem) {
  .support { grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem); }
}
.support__figure img { aspect-ratio: 4 / 3; }


/* ---------- 25. Intake sheet ----------
   Everything here is shared with the contact form: same .field, .form__row
   and .frame. Only what a longer clinical form actually needs is new. */

/* Three across, and a name row where the middle initial only needs a box. */
@media (min-width: 34rem) {
  .form__row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form__row--name { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 7rem; }
  .form__row--wide-left { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

/* Fieldsets carry the grouping for screen readers; the legend reuses the
   eyebrow treatment so it matches every other label on the site. */
.form__group {
  border: 0;
  padding: 0;
  margin: 0 0 var(--sp-5);
}
.form__group legend {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: var(--sp-3);
}
/* A legend is inline by default, so its two lines would run together. */
.form__group legend > * { display: block; }
.form__group legend .eyebrow { margin-bottom: 0.35rem; }
.form__group + .form__group {
  padding-top: var(--sp-4);
  border-top: var(--hairline) solid var(--line-hairline);
}
.form__legend {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-heading);
}

/* Status choices. Radios rather than checkboxes: a case is exactly one of
   N/A, pending or authorised, and ticking two would be meaningless. */
.choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem clamp(1rem, 3vw, 1.75rem);
}
.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}
.choice input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--brand-primary);
  flex: none;
}
.choice span { line-height: 1; }

/* Revealed by the "Authorized" choice. */
.choice-input { flex: 1 1 12rem; min-width: 10rem; }
.choice-input[hidden] { display: none; }

/* The attestation. An inset panel with a red edge, so it reads as the
   binding part of the sheet without introducing a second frame. */
.attestation {
  margin-top: var(--sp-4);
  padding: var(--sp-4) var(--sp-3);
  background: var(--bg-inset);
  border: var(--hairline) solid var(--line-hairline);
  border-left: 3px solid var(--brand-primary);
}
.attestation p {
  color: var(--text-secondary);
  font-size: var(--step--1);
  line-height: 1.7;
}
.attestation .form__row { margin-top: var(--sp-4); margin-bottom: 0; }

/* Sub-heading inside a fieldset (Primary / Secondary carrier). */
.form__subhead {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-brand);
  margin: var(--sp-4) 0 var(--sp-2);
}
.form__group > .form__subhead:first-of-type { margin-top: 0; }

/* The intake sheet is long, so it reads better in a narrower column than
   the full shell. */
.intake { max-width: 54rem; margin-inline: auto; }
.intake__note {
  max-width: 56ch;
  margin: var(--sp-3) auto 0;
  color: var(--text-secondary);
  font-size: var(--step--1);
}

.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;
}

/* ---------- 26. Printing the intake sheet ----------
   This one gets printed and filled by hand, so fields need to survive the
   trip: visible rules, nothing split across a page break. */
@media print {
  .form__group, .field, .attestation, .form__row { break-inside: avoid; }
  .field input,
  .field select,
  .field textarea {
    border: 1px solid #000;
    box-shadow: none;
    background: none;
  }
  .attestation { background: none; border-left: 3px solid #000; }
  .choice-input[hidden] { display: block; }
}

/* ---------- 28. Form switcher ----------
   Secure request vs general enquiry. Same hairline-gap construction as the
   card grids: the strip paints the rule colour and the tabs sit on it. */
.formswitch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--hairline);
  margin-bottom: var(--sp-4);
  background: var(--line-hairline);
  border: var(--hairline) solid var(--line-hairline);
}
.formswitch__tab {
  padding: 0.75rem 0.9rem;
  border: 0;
  cursor: pointer;
  background: var(--bg-page);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.formswitch__tab:hover { color: var(--text-brand); }
.formswitch__tab[aria-selected="true"] {
  background: var(--bg-inset);
  color: var(--text-brand);
  box-shadow: inset 0 -3px 0 0 var(--brand-primary);
}
.formpanel[hidden] { display: none; }

/* Caution panel, reused by the unsecured-form disclaimer. */
.notice {
  margin-top: var(--sp-4);
  padding: var(--sp-3);
  background: var(--bg-inset);
  border: var(--hairline) solid var(--line-hairline);
  border-left: 3px solid var(--brand-primary);
  font-size: var(--step--1);
  line-height: 1.65;
  color: var(--text-secondary);
}
.notice strong { color: var(--text-brand); }

.form__status--ok { color: var(--text-brand); }
.form__status--err { color: var(--text-error); }


/* ---------- 29. Encrypted intake ----------
   The assurance panel at the head of the intake sheet, and the queue
   the practice reads it in. */

.intake__seal {
  margin-bottom: var(--sp-4);
  padding: var(--sp-3);
  background: var(--bg-inset);
  border: var(--hairline) solid var(--line-hairline);
  border-left: 3px solid var(--brand-primary);
  font-size: var(--step--1);
  line-height: 1.65;
  color: var(--text-secondary);
}
.intake__seal-lead {
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.3rem;
}
.intake__seal-fp {
  margin-top: var(--sp-3);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}
.intake__seal-fp span {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.intake__seal-fp code,
.queue__key code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--text-brand);
}

/* Off-screen rather than display:none — a bot that only skips hidden
   fields still fills this one. */
.intake__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.intake__seal-action { margin-top: var(--sp-3); }

.intake__done { text-align: left; }
.intake__ref {
  margin-top: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
}
.intake__ref span {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.intake__ref code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--step-2);
  letter-spacing: 0.08em;
  color: var(--text-brand);
}

/* ---------- 30. The request queue ---------- */
.queue__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: var(--hairline) solid var(--line-hairline);
}
.queue__filters { display: flex; gap: var(--hairline); background: var(--line-hairline); }
.queue__filter {
  padding: 0.55rem 1rem;
  border: 0;
  cursor: pointer;
  background: var(--bg-page);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.queue__filter[aria-pressed="true"] {
  background: var(--bg-inset);
  color: var(--text-brand);
  box-shadow: inset 0 -3px 0 0 var(--brand-primary);
}
.queue__key {
  font-size: var(--step--1);
  color: var(--text-muted);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.queue__lock {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-brand);
  text-decoration: underline;
}

.queue__notices { margin: 0 0 var(--sp-3); }
.section--app .queue__notices .queue__warn { margin: 0; padding-block: 0.4rem; }
.queue__notices .queue__warn:first-child { margin-top: 0; }

/* A secondary button for light grounds. .btn--ghost is drawn for the
   hero's dark ground and is near-invisible on the page surface. */
.btn--secondary {
  background: var(--bg-surface);
  color: var(--text-heading);
  border: var(--hairline) solid var(--line-strong);
}
.btn--secondary:hover { border-color: var(--brand-primary); color: var(--text-brand); }
.btn--secondary:active { transform: translateY(1px); }


/* The key-file picker, which the kit never styled. */
.field input[type="file"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--input-bg);
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: var(--step--1);
}

@media print {
  /* Printing a record goes through printRecord(), which builds its own
     window; this only tidies an accidental print of the page itself. */
  .queue__bar, .queue__filters, .rec__actions,
  .workbench__list, .pagelinks { display: none; }
}

/* ---------- 32. Access log ---------- */

.audit__banner {
  margin-bottom: var(--sp-4);
  padding: var(--sp-3);
  background: var(--bg-inset);
  border: var(--hairline) solid var(--line-hairline);
  border-left: 3px solid var(--line-strong);
  font-size: var(--step--1);
  color: var(--text-secondary);
}
.audit__banner--due {
  border-left-color: var(--brand-primary);
  color: var(--text-brand);
  font-weight: 600;
}

.audit__flags {
  margin-bottom: var(--sp-4);
  padding: var(--sp-3);
  background: var(--bg-inset);
  border: var(--hairline) solid var(--line-hairline);
  border-left: 3px solid var(--brand-primary);
}
.audit__flags-head {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-brand);
  margin-bottom: var(--sp-2);
}
.audit__flag { font-size: var(--step--1); color: var(--text-secondary); margin-top: 0.35rem; }
.audit__flag strong { color: var(--text-heading); }
.audit__flag-count { color: var(--text-brand); }
.audit__flag-why { color: var(--text-muted); }

.audit__day {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: var(--sp-4) 0 var(--sp-2);
  padding-bottom: 0.3rem;
  border-bottom: var(--hairline) solid var(--line-hairline);
}

.audit__list {
  display: grid;
  gap: var(--hairline);
  background: var(--line-hairline);
  border: var(--hairline) solid var(--line-hairline);
}
.audit__row {
  background: var(--bg-page);
  padding: 0.55rem var(--sp-3);
  display: grid;
  gap: 0.15rem 1rem;
  grid-template-columns: minmax(0, 1fr);
  font-size: var(--step--1);
}
@media (min-width: 48rem) {
  .audit__row { grid-template-columns: 4.5rem 13rem 9rem minmax(0, 1fr); align-items: baseline; }
}
.audit__row--flag { box-shadow: inset 3px 0 0 0 var(--brand-primary); }
.audit__time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.audit__what { color: var(--text-heading); }
.audit__who  { color: var(--text-secondary); }
.audit__detail {
  color: var(--text-muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

#audit-confirm { margin-top: var(--sp-5); }


/* ---------- 34. Re-sealing ---------- */

.reseal__readers {
  margin: 0 0 var(--sp-4);
  padding-left: 1.2rem;
  font-size: var(--step--1);
  color: var(--text-secondary);
}
.reseal__readers li { margin-bottom: 0.3rem; }
.reseal__readers strong { color: var(--text-heading); }
.reseal__readers code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.reseal__readers em { color: var(--text-brand); font-style: normal; }

.reseal__progress { margin: var(--sp-4) 0; }
.reseal__bar {
  height: 4px;
  background: var(--line-hairline);
  overflow: hidden;
}
.reseal__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand-primary);
  transition: width 0.25s var(--ease);
}
.reseal__count {
  margin: var(--sp-2) 0 0;
  font-size: var(--step--1);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* One line per record: reference, when it came in, what is happening
   to it. Hairlines are painted by the container so an interrupted run
   does not leave a dangling rule. */
.reseal__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--hairline);
  background: var(--line-hairline);
  border: var(--hairline) solid var(--line-hairline);
}
.reseal__row {
  background: var(--bg-page);
  padding: 0.6rem var(--sp-3);
  display: grid;
  gap: 0.15rem 1rem;
  grid-template-columns: minmax(0, 1fr);
  font-size: var(--step--1);
  align-items: baseline;
}
@media (min-width: 42rem) {
  .reseal__row { grid-template-columns: 9rem minmax(0, 1fr) 9rem; }
}
.reseal__ref {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text-heading);
}
.reseal__meta  { color: var(--text-muted); }
.reseal__state {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.reseal__row--busy .reseal__state { color: var(--text-brand); }
.reseal__row--done .reseal__state { color: var(--text-secondary); }
.reseal__row--fail { box-shadow: inset 3px 0 0 0 var(--brand-primary); }
.reseal__row--fail .reseal__state { color: var(--text-brand); font-weight: 700; }
.reseal__row--skip { opacity: 0.6; }

/* ---------- 32a. The reading workbench ---------- */

/* This page is a tool rather than a document, so it gets more width than
   the prose shell allows and less vertical padding above it. */
.section--app { padding-block: clamp(1.25rem, 2.4vw, 2rem); }
.section--app .shell { max-width: 96rem; }

/* A tool's title does not need the full editorial treatment; the room it
   was taking is room the record below it needs. */
.section--app .apphead { margin-bottom: var(--sp-3); }
.section--app .section__title { font-size: var(--step-2); }

/* The ornament is editorial punctuation. On a page where vertical space
   is the scarce resource and the record below is the point, it is the
   first thing that should give way. */
.section--app .section__head .ornament { display: none; }

/* List on the left, one record on the right. Below the breakpoint they
   stack, list first, which is the order you use them in on a phone. */
.workbench { display: grid; gap: var(--sp-4); }

@media (min-width: 64rem) {
  /* The workbench fills whatever is left of the viewport, rather than
     being given a height guessed from the chrome above it. That chrome
     changes — a notice appears, the title wraps — and a guessed height
     would push the record half below the fold exactly when there is most
     to read. Each side then scrolls inside the frame; the page does not.
     The masthead is the only fixed subtraction. */
  .section--app {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 4.1rem);
  }
  .section--app > .shell { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }

  #queue-unlock { flex: 0 0 auto; }
  .queue { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }

  .workbench {
    grid-template-columns: 19rem minmax(0, 1fr);

    /* flex-basis 0, not auto: with auto the workbench is sized from its
       own content first and only then allowed to grow, so a long record
       pushed it past the bottom of the window — the exact thing the
       frame exists to prevent. At 0 it takes the space that is left and
       the panes scroll inside it. */
    flex: 1 1 0;
    min-height: 20rem;
  }
  .workbench__list,
  .workbench__pane { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}

.workbench__list {
  border: var(--hairline) solid var(--line-hairline);
  background: var(--bg-inset);
}
.workbench__listhead {
  margin: 0;
  padding: 0.55rem var(--sp-3);
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-inset);
  border-bottom: var(--hairline) solid var(--line-hairline);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.workbench__listhead:empty { display: none; }

.qlist { list-style: none; margin: 0; padding: 0; }
.qlist__empty {
  padding: var(--sp-4) var(--sp-3);
  font-size: var(--step--1);
  color: var(--text-muted);
}

.qrow { border-bottom: var(--hairline) solid var(--line-hairline); }
.qrow:last-child { border-bottom: 0; }

.qrow__btn {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  padding: 0.6rem var(--sp-3);
  text-align: left;
  background: none;
  border: 0;
  border-left: 3px solid transparent;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.qrow__btn:hover { background: var(--bg-surface); }
.qrow--on > .qrow__btn {
  background: var(--bg-surface);
  border-left-color: var(--brand-primary);
}

.qrow__top { display: flex; align-items: center; gap: 0.5rem; }
.qrow__ref {
  flex: 1 1 auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--text-heading);
}
.qrow--on .qrow__ref { color: var(--text-brand); }

/* Status as a dot, not a word: in a narrow column the word was most of
   the row, and the three states only need to be distinguishable. */
.qrow__dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}
.qrow__dot--new      { background: var(--brand-primary); }
.qrow__dot--read     { background: var(--line-strong); }
.qrow__dot--archived { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }

.qrow__when { font-size: 0.74rem; color: var(--text-muted); }

.qrow__lockmark {
  justify-self: start;
  margin-top: 0.15rem;
  font-family: var(--font-display);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.1rem 0.35rem;
  color: var(--text-muted);
  border: var(--hairline) dashed var(--line-hairline);
}
.qrow--locked .qrow__ref { color: var(--text-muted); }

/* ---- the pane ---- */

.workbench__pane {
  border: var(--hairline) solid var(--line-hairline);
  background: var(--bg-inset);
}

.pane__empty {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--sp-2);
  height: 100%;
  min-height: 16rem;
  padding: var(--sp-5);
  text-align: center;
  font-size: var(--step--1);
  color: var(--text-muted);
}
.pane__empty p { max-width: 28rem; margin: 0; }
.pane__empty-title {
  font-family: var(--font-display);
  font-size: var(--step-0);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.pane__pending {
  margin: 0;
  padding: var(--sp-5);
  font-size: var(--step--1);
  color: var(--text-muted);
}

/* ---- one record ---- */

.rec { padding: var(--sp-3) var(--sp-4) var(--sp-4); }

.rec__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-5);
  padding-bottom: var(--sp-3);
  border-bottom: var(--hairline) solid var(--line-hairline);
}
.rec__who { flex: 1 1 18rem; min-width: 0; }
.rec__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.15;
  color: var(--text-heading);
  overflow-wrap: anywhere;
}
.rec__sub {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* The four facts a scheduler looks for first. */
.rec__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin: 0;
}
.rec__fact dt {
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.rec__fact dd {
  margin: 0.1rem 0 0;
  font-size: var(--step--1);
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.rec__procedure {
  margin: var(--sp-3) 0 0;
  padding: 0.5rem var(--sp-3);
  background: var(--bg-surface);
  border-left: 3px solid var(--brand-primary);
  font-family: var(--font-display);
  font-size: var(--step-0);
  color: var(--text-heading);
}

.rec__grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  margin-top: var(--sp-3);

  /* Let a one-track card slide back into a gap a two-track card left
     earlier in the row. Without this the grid leaves shelves of empty
     space and the record runs taller than it needs to. */
  grid-auto-flow: dense;
}
/* Everything below is scoped to .rec__grid.

   These started life as bare .card / .card__title rules, which collided
   with the home page's cards: the home rule is more specific so it won
   where the two overlapped, but it never declared text-transform,
   letter-spacing or a border-bottom, so those leaked through and its
   headings came out small, uppercase and underlined. A generic class
   name in a shared stylesheet is not a safe place to put component
   styles. */

/* A card with many fields, or one long value, takes two tracks. In a
   single-track grid the browser clamps this, so no media query is needed. */
.rec__grid > .card--wide { grid-column: span 2; }

/* A split card holds two sub-columns, so two tracks leave each of them
   about as wide as a label. It takes the whole row instead, which is
   also what reads best: primary and secondary cover sit side by side at
   equal width, which is how they are compared. */
.rec__grid > .card--split { grid-column: 1 / -1; }

.rec__grid > .card {
  padding: var(--sp-3);
  background: var(--bg-surface);
  border: var(--hairline) solid var(--line-hairline);
  border-radius: 0;

  /* Fields decide their own layout from the width of the card they are
     in, not the width of the window. A one-track card in a wide window
     is still a narrow card. */
  container-type: inline-size;
}
.rec__grid .card__title {
  margin: 0 0 var(--sp-2);
  padding-bottom: 0.35rem;
  border-bottom: var(--hairline) solid var(--line-hairline);
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-brand);
}

.rec__grid .card__fields { margin: 0; display: grid; gap: 0.3rem; }

/* Label beside value, so a card is a short table rather than a column of
   alternating lines. The label column gives up width when the card is
   narrow, and below 17rem there is not enough room for two columns at
   all, so the pair stacks. */
.rec__grid .f {
  display: grid;
  grid-template-columns: minmax(4.5rem, 7rem) minmax(0, 1fr);
  gap: 0 var(--sp-2);
}
.rec__grid .f--block { grid-template-columns: minmax(0, 1fr); }

@container (max-width: 17rem) {
  .rec__grid .f { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rec__grid .f__value { margin-top: 0.05rem; }
}

.rec__grid .f__label {
  font-size: 0.68rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.rec__grid .f__value {
  margin: 0;
  font-size: var(--step--1);
  line-height: 1.45;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.rec__grid .f--block .f__value { white-space: pre-wrap; margin-top: 0.1rem; }

/* Primary and secondary insurance, side by side. */
.rec__grid .card__split { display: grid; gap: var(--sp-3) var(--sp-5); }
@container (min-width: 30rem) {
  .rec__grid .card__split { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }

  /* A rule between the two halves, so it is obvious which carrier a row
     belongs to when the values line up across the gap. */
  .rec__grid .card__col + .card__col {
    padding-left: var(--sp-5);
    margin-left: calc(var(--sp-5) * -0.5);
    border-left: var(--hairline) solid var(--line-hairline);
  }
}
.rec__grid .card__col { min-width: 0; }
.rec__grid .card__sub {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.rec__grid .card__none { margin: 0; font-size: var(--step--1); color: var(--text-muted); }

.rec__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: var(--hairline) solid var(--line-hairline);
}
.rec__stamp { margin: 0; font-size: 0.74rem; color: var(--text-muted); }
.rec__actions { display: flex; gap: var(--sp-2); }

/* ---------- 32b. Links between the secure pages ---------- */

/* These were small underlined links set close together, which read as
   footnotes rather than as the way between the four pages of a tool. Given
   a target size and a line of explanation they stop needing a second
   glance to work out which one you want. */
.pagelinks {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  margin-bottom: var(--sp-5);
}

/* Title on the left, the way out on the right. The title block never
   filled its line, and on the queue page the row the links used to
   occupy is the row the record needs. */
.apphead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-5);
}
.apphead > .section__head { flex: 1 1 18rem; margin-bottom: 0; }
.apphead > .pagelinks {
  flex: 0 1 auto;
  margin-bottom: 0;

  /* An explicit column flow, not auto-fit. As a flex item the grid has no
     resolved width when it decides its track count, so auto-fit settled on
     a single column and stacked the links into a tall tower — taller than
     the row they were moved out of. */
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(9.5rem, 12rem);
}

/* Stacked, the links want the full width again. */
@media (max-width: 59.99rem) {
  .apphead > .pagelinks {
    width: 100%;
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  }
}

.pagelink {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem var(--sp-3);
  background: var(--bg-inset);
  border: var(--hairline) solid var(--line-hairline);
  border-left: 3px solid var(--line-strong);
  text-decoration: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease),
              transform 0.2s var(--ease);
}
.pagelink:hover,
.pagelink:focus-visible {
  background: var(--bg-surface);
  border-left-color: var(--brand-primary);
  transform: translateX(2px);
}

.pagelink__label {
  font-family: var(--font-display);
  white-space: nowrap;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-heading);
}
.pagelink:hover .pagelink__label { color: var(--text-brand); }

.pagelink__note {
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--text-muted);
}

/* The arrow is decoration and belongs in the stylesheet, not in every
   page's markup. */
.pagelink__label::after {
  content: " \2192";
  opacity: 0.55;
}

/* ---------- 33. Keys & staff ---------- */

.keys__notices:not(:empty) { margin-bottom: var(--sp-4); }
.keys__notices .queue__warn:first-child { margin-top: 0; }

.keys__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

/* One key per card. The roster is read down the page rather than
   scanned across a table, because every row carries a sentence or two
   of consequence and a table would crush them. */
.keyrow {
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  background: var(--bg-inset);
  border: var(--hairline) solid var(--line-hairline);
  border-left: 3px solid var(--line-strong);
}
.keyrow--unconfirmed { border-left-color: var(--brand-primary); }
.keyrow--revoked     { border-left-color: var(--line-hairline); opacity: 0.85; }

.keyrow__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-3);
}
.keyrow__label {
  margin: 0;
  flex: 1 1 14rem;
  font-family: var(--font-display);
  font-size: var(--step-1);
  color: var(--text-heading);
}

.keyrow__badge {
  flex: none;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border: var(--hairline) solid var(--line-hairline);
  color: var(--text-muted);
}
.keyrow__badge--ok          { color: var(--text-secondary); border-color: var(--line-strong); }
.keyrow__badge--unconfirmed { color: var(--text-brand); border-color: var(--brand-primary); }
.keyrow__badge--revoked     { border-style: dashed; }

.keyrow__facts {
  margin: 0;
  display: grid;
  gap: 0.2rem var(--sp-3);
  grid-template-columns: minmax(0, 1fr);
  font-size: var(--step--1);
}
@media (min-width: 40rem) {
  .keyrow__facts { grid-template-columns: 11rem minmax(0, 1fr); align-items: baseline; }
}
.keyrow__facts dt {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.keyrow__facts dd { margin: 0 0 0.3rem; color: var(--text-secondary); }
.keyrow__facts dd code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text-heading);
  overflow-wrap: anywhere;
}

.keyrow__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: var(--hairline) solid var(--line-hairline);
}

/* What revoking did not do, in order. */
.keys__checklist {
  margin: 0;
  padding-left: 1.4rem;
  font-size: var(--step--1);
  color: var(--text-secondary);
}
.keys__checklist li { margin-bottom: var(--sp-3); }
.keys__checklist strong { color: var(--text-heading); }
.keys__checklist a { color: var(--text-brand); text-decoration: underline; }


@media print {
  .queue__bar, .pagelinks, #audit-confirm, .masthead, .footer, .rails { display: none !important; }
  .audit__row { break-inside: avoid; }
  .audit__list { border: 0; }
}

/* =========================================================================
   BRIDGE — kit components retuned onto the ASPA tokens.
   The site layer above wins on `.btn`, so the kit's modifier classes are
   restated here against our bevel rather than left half-overridden.
   ====================================================================== */

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    text-shadow: var(--btn-primary-text-shadow);
    box-shadow: var(--btn-primary-bevel);
    border: none;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: translateY(1px); box-shadow: var(--btn-primary-bevel-active); }

.btn-default,
.btn-line {
    background: var(--bg-surface);
    color: var(--text-heading);
    border: var(--hairline) solid var(--line-strong);
}
.btn-default:hover,
.btn-line:hover { border-color: var(--text-brand); color: var(--text-brand); }

.btn-dark { background: var(--c-ink); color: var(--c-white); border: none; }
.btn-danger { background: var(--c-vermilion); color: var(--c-white); border: none; }
.btn-success { background: var(--success); color: var(--c-white); border: none; }

/* Account panels, tables and inputs on the app pages. */
.card {
    background: var(--bg-surface);
    border: var(--hairline) solid var(--line-hairline);
    border-radius: var(--radius);
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.8rem;
    background: var(--input-bg);
    border: var(--hairline) solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--text-primary);
    box-shadow: var(--input-inset);
}
.form-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--focus-halo);
}

/* The avatar in the navbar, which the ASPA masthead has no equivalent for. */
.nav__avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    object-fit: cover;
    border: var(--hairline) solid var(--line-strong);
}
.nav__account { display: inline-flex; align-items: center; gap: 0.5rem; }

/* ---- App-layer bleed corrections ---------------------------------------
   The app layer sets element-level defaults that predate the site layer and
   reach into the pages the site layer owns: h1-h6 line-height, a:hover
   underline, and .btn line-height. These restore the standalone behaviour
   without editing the site layer, which is kept byte-identical to base.css
   so the two can still be diffed.

   The specificity is deliberate. :where() contributes nothing, while :is()
   takes the weight of its most specific argument — one element — so each
   heading rule lands at (0,0,1): heavier than the app layer's bare `h1, h2...`
   only by source order, and lighter than any component class, which therefore
   still wins. Writing the ancestor as a plain class instead would tie with the
   component rules and beat them by order, silently flattening the wordmark and
   the section titles.

   Scoped to the site's own regions: the kit's pages use <main> too, and their
   heading and link defaults are left alone. */
:where(.masthead, .footer, .hero, .section) :is(h1, h2, h3, h4, h5, h6) { line-height: inherit; }

:where(.masthead, .footer, .hero, .section) a:hover { text-decoration: none; }

.btn--primary,
.btn--ghost { line-height: inherit; }

/* The bridge's .card above is for the kit's account panels. The capability
   grid draws its own hairline separators, so it must not also gain a border
   and a radius from it. */
.grid--cards .card { border: 0; border-radius: 0; }
