/*
 * theme.css — Bearing Mark shared stylesheet
 * Refresh v2 — Session 16 PR-A
 *
 * Preserves every selector name the PHP pages depend on.
 * Brand fonts emitted separately by brand_css.php from BRAND_FONT_*
 * constants in config.php. Brand and semantic palette tokens are owned
 * by this file (per Coherence v3 §3.5: product owns the palette).
 *
 * New primitives in this revision (used by PR-B dashboard rebuild):
 *   .dashboard-grid + .span-2
 *   .card--edge + .card--edge-{primary,info,success,warning,danger}
 *   .card-head + .ch-meta + .ch-link
 *   .card-foot + .card-foot-meta + .card-foot-action
 *   .status-pill + .status-pill--{draft,issued,alert,active,completed,cancelled,muted,info}
 *   .verdict-pill + .verdict-pill--{green,yellow,red,info,muted}  (S73 PR-1)
 *   .pill + .pill--{green,yellow,red,info,muted}  (S74 PR-1 — lifted from _workspace_styles.php)
 *   .module-prose + .kv-strip
 *   .mini-list + .audit-feed + .drone-snap
 *   .report-pill (replaces .bug-fab — still on every page via shell_end.php)
 *   .nav-hamburger + .nav-drawer + .nav-drawer-* (mobile nav)
 *   .nav-drawer-built-by + .page-footer (Deadfall attribution)
 */

/* ── Design tokens — canonical catalogue (Coherence Arc Phase 1, S88 PR-1) ─
 *
 * Canonical token catalogue. The legacy alias shim (theme-legacy.css) was
 * retired at S103 PR-47 — Phase 3 exit. Every consumer now reads canonical
 * names directly.
 *
 * Net-new tokens land with defensible defaults; the visual pinboard is the
 * sign-off mechanism for final values, marked with @pinboard-tbd below.
 */
:root,
[data-theme="dark"] {
    /* Surface palette */
    --surface-page:        #0a0c11;
    --surface-card:        #13161f;
    --surface-sunken:      #1c2030;
    --surface-elevated:    #20243a;

    /* Text palette */
    --text-strong:         #e7e9ed;
    --text:                #8b91a3;
    --text-muted:          #6b7280;
    --text-faint:          #4f5562;

    /* Border palette */
    --border-subtle:       #1c2030;
    --border:              #242838;
    --border-strong:       #343a4d;

    /* Chrome layout — topnav height, referenced by the fullscreen map offset
     * so map controls clear the sticky nav. Single source of truth. */
    --nav-h:               52px;

    /* Brand palette — navy / blue / orange from the Bearing Mark logo.
     * Values inherited from the splash --bm-* set landed in Phase 0 PR-0b. */
    --brand-primary:       #1f3a66;
    --brand-primary-rgb:   31, 58, 102;
    --brand-primary-soft:  #2d5489;
    --brand-accent:        #4fa3ff;
    --brand-accent-rgb:    79, 163, 255;
    --brand-warm:          #ff8a3d;
    --brand-warm-rgb:      255, 138, 61;

    /* Semantic palette — base + rgb + on-surface soft variant.
     * --semantic-*-soft are AA-lifted variants for coloured text on
     * --surface-card. @pinboard-tbd — final values signed off at pinboard. */
    --semantic-info:         #5a9fd4;
    --semantic-info-rgb:     90, 159, 212;
    --semantic-info-soft:    #8fc3e8;
    --semantic-success:      #5aa85e;
    --semantic-success-rgb:  90, 168, 94;
    --semantic-success-soft: #8fcb92;
    --semantic-warning:      #c58b3a;
    --semantic-warning-rgb:  197, 139, 58;
    --semantic-warning-soft: #e0b370;
    --semantic-danger:       #a03535;
    --semantic-danger-rgb:   160, 53, 53;
    --semantic-danger-soft:  #c46060;

    /* Geometry */
    --radius:           8px;
    --radius-sm:        6px;
    --radius-lg:        10px;
    --shadow-sm:        none;
    --shadow:           none;
    --shadow-strong:    none;

    /* Spacing scale — 4px base, 8 steps. Declared but not yet consumed;
     * Phase 3 page rewrites convert literal `px` values to these tokens. */
    --space-1:          4px;
    --space-2:          8px;
    --space-3:          12px;
    --space-4:          16px;
    --space-5:          20px;
    --space-6:          24px;
    --space-7:          32px;
    --space-8:          40px;

    /* ── Design system primitives — Direction C rollout (Session 35 PR-A) ──
     *
     * These tokens back the shared workspace primitives (step ticks,
     * context strips, two-pane workspace, mobile tabs, review rows, pills)
     * defined in `_workspace_styles.php` and exercised by pages converting
     * to the Direction C pattern starting Session 35 PR-B.
     *
     * Per the design-system plan (docs/session-34-pr-b-design-system-plan.md),
     * almost every workspace token references the existing palette tokens
     * above, so light-theme equivalents resolve naturally without
     * duplication. The exceptions (absolute sizes, gaps, transitions) are
     * theme-agnostic by definition.
     *
     * Pill RGB values reference --color-{success,warning,danger}-rgb which
     * ARE theme-specific — pills automatically pick up the right palette
     * when [data-theme="light"] is active.
     */

    /* Step ticks primitive RETIRED in S94 PR-31 — tokens removed.
     * The .step-ticks / .step-tick block in _workspace_styles.php deleted
     * in the same PR. All five page consumers (survey, flights, postflight,
     * sdr, rpoc) migrated to the canonical .section-rail primitive between
     * S88 PR-5 and S94 PR-31. */

    /* Context strip (top-of-page light context) */
    --cs-label-size:           0.66rem;
    --cs-label-weight:         500;
    --cs-label-color:          var(--text-muted);
    --cs-label-spacing:        0.05em;
    --cs-value-size:           0.82rem;
    --cs-value-weight:         500;
    --cs-value-color:          var(--text-strong);
    --cs-gap-row:              0.6rem;
    --cs-gap-col:              1.1rem;
    --cs-padding:              0.7rem 1.1rem;
    --cs-bg:                   var(--surface-card);
    --cs-border:               1px solid var(--border);

    /* Two-pane workspace (Survey only) */
    --workspace-grid-cols:           1.05fr 1fr;
    --workspace-grid-cols-focus:     64px 1fr;
    --workspace-collapse-threshold:  620px;
    --workspace-min-height:          620px;
    --workspace-transition:          grid-template-columns 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --context-pane-padding:          1rem;
    --context-pane-padding-focus:    0.65rem 0.4rem;
    --context-pane-bg:               var(--surface-card);
    --context-pane-border-r:         1px solid var(--border);
    --form-pane-padding:             1rem 1.1rem;
    --form-pane-padding-focus:       1rem 1.5rem;

    /* Card-mini (collapsed-pane card strip) */
    --card-mini-bg:            var(--surface-sunken);
    --card-mini-border:        1px solid var(--border);
    --card-mini-radius:        var(--radius-sm);
    --card-mini-padding:       0.5rem 0.65rem;
    --card-mini-padding-focus: 0.5rem;
    --card-mini-gap:           0.55rem;
    --card-mini-name-size:     0.78rem;
    --card-mini-status-size:   0.68rem;
    --card-mini-border-l:      1px;

    /* Mobile tabs */
    --mobile-tab-padding:       0.45rem 0.75rem;
    --mobile-tab-size:          0.74rem;
    --mobile-tab-color:         var(--text);
    --mobile-tab-color-active:  var(--text-strong);
    --mobile-tab-border:        2px solid transparent;
    --mobile-tab-border-active: 2px solid var(--brand-primary);
    --mobile-tab-bg:            var(--surface-card);

    /* Pills (state pills used everywhere) */
    --pill-radius:             999px;
    --pill-padding:            0.15rem 0.55rem;
    --pill-size:               0.72rem;
    --pill-weight:             600;
    --pill-border-width:       1px;
    --pill-green-bg:           rgba(var(--semantic-success-rgb), 0.15);
    --pill-green-fg:           var(--semantic-success);
    --pill-green-border:       rgba(var(--semantic-success-rgb), 0.4);
    --pill-yellow-bg:          rgba(var(--semantic-warning-rgb), 0.15);
    --pill-yellow-fg:          var(--semantic-warning);
    --pill-yellow-border:      rgba(var(--semantic-warning-rgb), 0.45);
    --pill-red-bg:             rgba(var(--semantic-danger-rgb), 0.15);
    --pill-red-fg:             var(--semantic-danger);
    --pill-red-border:         rgba(var(--semantic-danger-rgb), 0.45);
    --pill-info-bg:            rgba(var(--semantic-info-rgb), 0.15);
    --pill-info-fg:            var(--semantic-info);
    --pill-info-border:        rgba(var(--semantic-info-rgb), 0.4);
    --pill-muted-bg:           var(--surface-sunken);
    --pill-muted-fg:           var(--text-muted);
    --pill-muted-border:       var(--border);
}
[data-theme="light"] {
    /* Surface palette */
    --surface-page:        #f6f4ef;
    --surface-card:        #ffffff;
    --surface-sunken:      #efece3;
    --surface-elevated:    #ffffff;

    /* Text palette */
    --text-strong:         #14161c;
    --text:                #56595f;
    --text-muted:          #8a8d94;
    --text-faint:          #a8aaae;

    /* Border palette */
    --border-subtle:       #ece8dc;
    --border:              #e0dcd0;
    --border-strong:       #c8c3b4;

    /* Brand palette — same hues as dark; tuned during pinboard pass.
     * Navy on cream reads fine; pinboard validates AA across both themes. */
    --brand-primary:       #1f3a66;
    --brand-primary-rgb:   31, 58, 102;
    --brand-primary-soft:  #2d5489;
    --brand-accent:        #4fa3ff;
    --brand-accent-rgb:    79, 163, 255;
    --brand-warm:          #ff8a3d;
    --brand-warm-rgb:      255, 138, 61;

    /* Semantic palette. On cream surfaces the saturated semantics have
     * plenty of contrast, so soft = base. @pinboard-tbd — pinboard
     * confirms or tunes the soft = base call on light theme. */
    --semantic-info:         #2963a8;
    --semantic-info-rgb:     41, 99, 168;
    --semantic-info-soft:    var(--semantic-info);
    --semantic-success:      #2e7d3a;
    --semantic-success-rgb:  46, 125, 58;
    --semantic-success-soft: var(--semantic-success);
    --semantic-warning:      #8a5a15;
    --semantic-warning-rgb:  138, 90, 21;
    --semantic-warning-soft: var(--semantic-warning);
    --semantic-danger:       #a03535;
    --semantic-danger-rgb:   160, 53, 53;
    --semantic-danger-soft:  var(--semantic-danger);

    /* Geometry */
    --shadow-sm:        none;
    --shadow:           0 4px 20px rgba(30, 24, 15, .08);
    --shadow-strong:    0 8px 32px rgba(30, 24, 15, .14);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
    font-family: var(--brand-font-body), ui-sans-serif, system-ui, -apple-system, sans-serif;
    background: var(--surface-page);
    color: var(--text-strong);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.003em;
    transition: background .2s, color .2s;
    overflow-x: clip;
    max-width: 100vw;
}
button, input, textarea, select { font-family: inherit; }
button { cursor: pointer; }
input, progress { accent-color: var(--brand-primary); }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
img { max-width: 100%; }

.page-wrap {
    padding: 28px 20px 80px;
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    min-width: 0;
    overflow-x: clip;
}
@media (max-width: 640px) {
    .page-wrap { padding: 20px 14px 80px; }
}

/* ── Topnav ─────────────────────────────────────────────────────────────── */
.topnav {
    background: #0b0d13;
    color: #e7e9ed;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 12px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 2px solid var(--brand-primary);
    box-shadow: none;
}
[data-theme="light"] .topnav { background: #111319; }

.topnav-brand-link {
    display: flex; align-items: center; gap: 10px;
    color: #e7e9ed; flex-shrink: 0;
}
.topnav-brand {
    font-family: var(--brand-font-display), 'Georgia', sans-serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #e7e9ed;
}
.topnav-div {
    width: 1px; height: 20px;
    background: rgba(255,255,255,.12);
    flex-shrink: 0;
}
.topnav-links {
    display: flex;
    align-items: center;
    overflow-x: auto;
    flex-shrink: 1;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    height: 100%;
}
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-tab {
    font-size: 13px;
    color: rgba(255,255,255,.55);
    padding: 0 13px;
    white-space: nowrap;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 100%;
    text-decoration: none;
    transition: color .15s, border-color .15s;
    font-weight: 500;
    letter-spacing: .005em;
    position: relative;
    top: 1px;
}
.topnav-tab:hover { color: rgba(255,255,255,.85); }
.topnav-tab.active {
    color: #fff;
    border-bottom-color: var(--brand-warm);
    font-weight: 600;
}
.topnav-tab .tab-icon {
    width: 14px; height: 14px; flex-shrink: 0; opacity: .7;
    filter: brightness(0) invert(1);
}
.topnav-tab:hover .tab-icon, .topnav-tab.active .tab-icon { opacity: 1; }
.topnav-tab-label { display: inline; }

/* ── Section tabs — in-page sub-navigation (e.g. Fleet → Drones / Batteries) ── */
.section-tabs {
    display: flex;
    gap: 2px;
    margin: -4px 0 22px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.section-tab {
    flex: 0 0 auto;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
}
.section-tab:hover { color: var(--text-strong); }
.section-tab.active {
    color: var(--text-strong);
    font-weight: 700;
    border-bottom-color: var(--brand-accent);
}

/* ── Hamburger button (mobile only) ─────────────────────────────────────── */
.nav-hamburger {
    display: none;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.85);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: border-color .15s, color .15s;
}
.nav-hamburger:hover { border-color: rgba(255,255,255,.4); color: #fff; }
.nav-hamburger svg { width: 18px; height: 18px; }

@media (max-width: 960px) {
    .topnav-links { display: none; }
    .nav-hamburger { display: inline-flex; }
    /* The drawer carries the team switcher on mobile (parity copy lives in
       .nav-drawer-teamswitch); hide the topnav pill so it isn't duplicated
       and doesn't crowd the bar at narrow widths. */
    .team-switch-wrap { display: none; }
}
/* Content-driven collapse: shell_end.php measures whether the full tab row
 * fits and toggles .nav-collapsed when it doesn't (13 modules need a wide bar,
 * so a fixed breakpoint mis-fits mid-size laptops). Folds into the same
 * hamburger drawer at any width. The <=960px block above is the no-JS fallback. */
.topnav.nav-collapsed .topnav-links    { display: none; }
.topnav.nav-collapsed .nav-hamburger   { display: inline-flex; }
.topnav.nav-collapsed .team-switch-wrap { display: none; }
.topnav.nav-collapsed .topnav-div      { display: none; }
@media (max-width: 520px) {
    .topnav-div { display: none; }
}

.topnav-spacer { flex: 1; min-width: 8px; }

/* Theme toggle */
.theme-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: rgba(255,255,255,.85);
    flex-shrink: 0;
    transition: border-color .15s, color .15s;
    min-height: 32px;
}
.theme-toggle:hover { border-color: rgba(255,255,255,.4); color: #fff; }
.theme-toggle svg { width: 14px; height: 14px; }
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none; }

/* Avatar button (existing markup uses .nav-avatar-wrap > .topnav-avatar) */
.topnav-avatar {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--brand-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0; cursor: pointer;
    border: none;
    min-height: 32px;
    letter-spacing: .04em;
}

/* ── Avatar dropdown menu ───────────────────────────────────────────────── */
.nav-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}
.nav-avatar-drop {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
    z-index: 60;
    overflow: hidden;
    padding: 4px;
    transform-origin: top right;
    animation: dropIn .14s ease;
}
[data-theme="light"] .nav-avatar-drop {
    box-shadow: 0 8px 32px rgba(20,15,10,.14);
}
.nav-avatar-drop[hidden] { display: none; }
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-4px) scale(.98); }
    to   { opacity: 1; transform: none; }
}
.nav-avatar-drop-head {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.nav-avatar-drop-head .name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-strong);
    letter-spacing: -0.005em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-avatar-drop-head .email {
    font-size: 12px;
    color: var(--text);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-avatar-drop-head .role {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--brand-primary);
    background: rgba(var(--brand-primary-rgb), .1);
    border: 1px solid rgba(var(--brand-primary-rgb), .25);
    padding: 2px 7px;
    border-radius: 4px;
    margin-top: 6px;
}
.nav-drop-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-strong);
    cursor: pointer;
    text-align: left;
    transition: background .12s, color .12s;
    text-decoration: none;
    font-family: inherit;
    min-height: 36px;
}
.nav-drop-item:hover {
    background: var(--surface-sunken);
}
.nav-drop-item svg {
    width: 14px; height: 14px;
    flex-shrink: 0;
    opacity: .65;
    stroke: currentColor;
}
.nav-drop-item:hover svg { opacity: 1; }
.nav-drop-item--danger {
    color: var(--text-strong);
}
.nav-drop-item--danger svg {
    stroke: var(--semantic-danger);
}
.nav-drop-item--danger:hover {
    background: rgba(var(--semantic-danger-rgb), .1);
    color: var(--text-strong);
}
.nav-drop-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ── Team switcher (topnav, multi-team users) ───────────────────────────────
   Sits in the topnav-right cluster (before the theme toggle). The button is a
   compact pill on the dark bar; the menu reuses the avatar-dropdown surface
   language so the two read as one family. Hidden entirely for single-team
   users (the markup isn't rendered). */
.team-switch-wrap {
    position: relative;
    flex-shrink: 0;
}
.team-switch-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    min-height: 32px;
    max-width: 180px;
    padding: 0 9px;
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.85);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .01em;
    transition: border-color .15s, color .15s;
}
.team-switch-btn:hover { border-color: rgba(255,255,255,.4); color: #fff; }
.team-switch-icon { width: 14px; height: 14px; flex-shrink: 0; }
.team-switch-label {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.team-switch-caret { width: 12px; height: 12px; flex-shrink: 0; opacity: .7; }

.team-switch-drop {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    max-width: 280px;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
    z-index: 60;
    overflow: hidden;
    padding: 4px;
    transform-origin: top right;
    animation: dropIn .14s ease;
}
[data-theme="light"] .team-switch-drop {
    box-shadow: 0 8px 32px rgba(20,15,10,.14);
}
.team-switch-drop[hidden] { display: none; }
.team-switch-drop-head {
    padding: 8px 12px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.team-switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-strong);
    cursor: pointer;
    text-align: left;
    transition: background .12s, color .12s;
    min-height: 36px;
}
.team-switch-item:hover { background: var(--surface-sunken); }
.team-switch-item.is-active { font-weight: 600; }
.team-switch-item.is-switching { opacity: .6; pointer-events: none; }
.team-switch-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.team-switch-check {
    width: 15px; height: 15px;
    flex-shrink: 0;
    stroke: var(--brand-primary);
}

/* Team switcher (mobile drawer) — full-width rows at the top of the drawer,
   above the module links. Same scope choice, drawer-native styling. */
.nav-drawer-teamswitch {
    padding: 10px 0 8px;
    border-bottom: 1px solid var(--border);
}
.nav-drawer-teamswitch-head {
    padding: 0 20px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text);
}
.nav-drawer-teamswitch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 11px 20px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
    min-height: 44px;
}
.nav-drawer-teamswitch-item:hover {
    background: var(--surface-sunken);
    color: var(--text-strong);
}
.nav-drawer-teamswitch-item.is-active {
    color: var(--text-strong);
    background: var(--surface-sunken);
    border-left-color: var(--brand-primary);
    font-weight: 600;
}
.nav-drawer-teamswitch-item.is-switching { opacity: .6; pointer-events: none; }
.nav-drawer-teamswitch-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-drawer-teamswitch-item svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
    stroke: var(--brand-primary);
}

/* ── Mobile nav drawer ──────────────────────────────────────────────────── */
.nav-drawer-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.nav-drawer-scrim.open {
    opacity: 1;
    pointer-events: auto;
}
.nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 85vw);
    background: var(--surface-card);
    border-right: 1px solid var(--border);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,.35);
}
[data-theme="light"] .nav-drawer {
    box-shadow: 0 8px 40px rgba(20,15,10,.18);
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    min-height: 52px;
    flex-shrink: 0;
}
.nav-drawer-head .brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-drawer-head .brand .wordmark {
    font-family: var(--brand-font-display), sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-strong);
}
.nav-drawer-close {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
}
.nav-drawer-close:hover { color: var(--text-strong); border-color: var(--border-strong); }
.nav-drawer-close svg { width: 14px; height: 14px; }

.nav-drawer-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    overflow-y: auto;
    flex: 1;
}
.nav-drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
    min-height: 44px;
}
.nav-drawer-link:hover {
    background: var(--surface-sunken);
    color: var(--text-strong);
}
.nav-drawer-link.active {
    color: var(--text-strong);
    background: var(--surface-sunken);
    border-left-color: var(--brand-warm);
    font-weight: 600;
}
.nav-drawer-link svg {
    width: 16px; height: 16px;
    opacity: .65;
    flex-shrink: 0;
    stroke: currentColor;
}
.nav-drawer-link:hover svg,
.nav-drawer-link.active svg { opacity: 1; }

.nav-drawer-foot {
    border-top: 1px solid var(--border);
    padding: 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.nav-drawer-foot .user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    min-width: 0;
}
.nav-drawer-foot .user .avatar {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--brand-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    flex-shrink: 0;
}
.nav-drawer-foot .user .meta {
    min-width: 0;
    overflow: hidden;
    flex: 1;
}
.nav-drawer-foot .user .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-drawer-foot .user .role {
    font-size: 11px;
    color: var(--text);
    text-transform: capitalize;
}
.nav-drawer-foot-actions {
    border-top: 1px solid var(--border);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-drawer-foot-actions .nav-drop-item {
    min-height: 40px;
    padding: 10px 12px;
}

/* Deadfall attribution inside drawer foot */
/* ── Drawer "built by" attribution ──────────────────────────────────────────
   Same 3-line stack treatment as .page-footer. Centered (vs. left-aligned in
   the page footer) because the drawer is a narrow rail and centering reads
   as a self-contained signature block; left-alignment would pull awkwardly
   against the centered drawer-foot user card immediately above it. */
.nav-drawer-built-by {
    padding: 12px 18px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: .02em;
    line-height: 1.55;
}
.nav-drawer-built-by .df-tag {
    font-style: italic;
    color: var(--text-muted);
    letter-spacing: 0;
}
.nav-drawer-built-by .df-brand {
    /* Forest-green accent, same rationale as .page-footer .df-brand. */
    color: var(--semantic-success);
    font-weight: 500;
    text-decoration: none;
    margin-top: 3px;
    opacity: .8;
    transition: opacity .12s;
}
.nav-drawer-built-by .df-brand:hover {
    opacity: 1;
}

/* ── Page footer (Deadfall attribution) ─────────────────────────────────── */
/* ── Page footer (Deadfall attribution) ────────────────────────────────────
   Three-line left-aligned stack. Replaces a previous inline single-line
   layout that suffered two bugs:
     (a) on mobile the centered .report-pill (position:fixed bottom:16px)
         vertically overlapped the centered footer text — fixed here by
         extra bottom padding at <640px to clear the pill height + breathing.
     (b) italic .df-tag and roman <a> on the same flex line with
         align-items:center had visibly mismatched baselines because Manrope's
         italic and roman variants have different vertical metrics.
   Stacking dissolves both — each line owns its own line-box. */
.page-footer {
    padding: 18px 20px 28px;
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: .02em;
    line-height: 1.55;
}
.page-footer .df-tag {
    font-style: italic;
    color: var(--text-muted);
    letter-spacing: 0;
}
.page-footer .df-brand {
    /* Forest-green accent. The hue is borrowed visually from
       --semantic-success (which is #2e7d3a in light theme, #5aa85e in
       dark) — chosen here as a complementary accent to the GBSAR brand
       red, NOT as a semantic "success" indicator. If a dedicated
       brand-attribution token is ever wanted, extract --color-deadfall
       and emit from brand_css.php. */
    color: var(--semantic-success);
    font-weight: 500;
    text-decoration: none;
    margin-top: 3px;
    opacity: .8;
    transition: opacity .12s;
}
.page-footer .df-brand:hover {
    opacity: 1;
}
/* Legal links cluster (Session 45 PR-A). A small horizontal row sitting
   below the Deadfall attribution stack. Subtle — secondary text color,
   small dot separator, slight top margin to break from the column flow.
   Tokens only — see theme.css canonical set. */
.page-footer-legal {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.4;
    letter-spacing: .02em;
}
.page-footer-legal a {
    color: var(--text);
    text-decoration: none;
    transition: color .12s;
}
.page-footer-legal a:hover {
    color: var(--text-strong);
}
.page-footer-legal .sep {
    color: var(--text-muted);
    opacity: .5;
}
@media (max-width: 640px) {
    .page-footer {
        /* 72px bottom-padding clears the .report-pill (which sits at
           bottom:16px and stands ~30px tall, so the bottom 46px of any
           viewport is reserved). 72 = 46 + ~26 for breathing. */
        padding: 14px 14px 72px;
    }
}

/* ── Report pill (replaces .bug-fab — bottom-center, super subtle) ──────── */
.report-pill {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px 6px 11px;
    background: rgba(var(--semantic-warning-rgb), 0);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-family: var(--brand-font-body), sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s, transform .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    text-decoration: none;
    white-space: nowrap;
    z-index: 80;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background-color: var(--surface-card);
}
[data-theme="light"] .report-pill {
    box-shadow: 0 2px 10px rgba(20,15,10,.06), 0 1px 2px rgba(20,15,10,.04);
}
.report-pill:hover, .report-pill:focus-visible {
    color: var(--semantic-warning);
    border-color: rgba(var(--semantic-warning-rgb), .5);
    transform: translateX(-50%) translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,0,0,.22);
    outline: none;
}
[data-theme="light"] .report-pill:hover {
    box-shadow: 0 4px 14px rgba(20,15,10,.1);
}
.report-pill .dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--semantic-warning);
    flex-shrink: 0;
    transition: box-shadow .15s;
}
.report-pill:hover .dot {
    box-shadow: 0 0 0 3px rgba(var(--semantic-warning-rgb), .2);
}

/* ── Section headers ────────────────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--brand-warm);
}
.section-back {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 12.5px;
    text-decoration: none;
}
.section-back:hover { color: var(--brand-primary); text-decoration: underline; }
.section-title {
    font-family: var(--brand-font-display), sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .01em;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.15;
    color: var(--text-strong);
}
.section-title .hd-icon {
    width: 20px; height: 20px;
    color: var(--brand-primary);
    opacity: 1;
    filter: none;
    flex-shrink: 0;
    stroke: var(--brand-primary);
}
[data-theme="dark"] .section-title .hd-icon { filter: none; opacity: 1; }
.section-subtitle {
    font-size: 13.5px;
    color: var(--text);
    margin-top: 4px;
    line-height: 1.5;
}
.section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text);
    margin-bottom: 14px;
}
@media (max-width: 640px) {
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .section-header > :last-child { align-self: flex-start; }
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
    transition: border-color .15s;
    min-width: 0;
    max-width: 100%;
    position: relative;
}
.card-body { padding: 20px 22px; min-width: 0; }
.card-head + .card-body { padding-top: 14px; }
@media (max-width: 480px) {
    .card-body { padding: 16px; }
    .card-head + .card-body { padding-top: 12px; }
}

/* Card head — compact alternative to section-header for module cards */
.card-head {
    padding: 14px 22px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.card-head h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-strong);
    margin: 0 0 2px;
    line-height: 1.3;
}
.card-head .ch-meta {
    font-size: 12px;
    color: var(--text);
    margin: 0;
}
.card-head .ch-link {
    font-size: 12.5px;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
    flex-shrink: 0;
    transition: color .12s, border-color .12s;
}
.card-head .ch-link:hover {
    color: var(--text-strong);
    border-bottom-color: var(--border-strong);
}
@media (max-width: 480px) {
    .card-head { padding: 12px 16px 0; }
}

/* Card edge accent — 1px hairline, semantic color */
.card--edge::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--edge-color, var(--brand-primary));
}
.card--edge-primary { --edge-color: var(--brand-primary); }
.card--edge-info    { --edge-color: var(--semantic-info); }
.card--edge-success { --edge-color: var(--semantic-success); }
.card--edge-warning { --edge-color: var(--semantic-warning); }
.card--edge-danger  { --edge-color: var(--semantic-danger); }

/* Card foot — paginated list footer */
.card-foot {
    border-top: 1px solid var(--border);
    padding: 12px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface-page);
    flex-wrap: wrap;
}
.card-foot-meta {
    font-size: 12.5px;
    color: var(--text);
}
.card-foot-meta b { color: var(--text-strong); font-weight: 600; }
.card-foot-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
    background: var(--surface-card);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: border-color .12s, color .12s;
    min-height: 36px;
}
.card-foot-action:hover {
    background: var(--surface-elevated);
    border-color: var(--border-strong);
}
.card-foot-action:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.40);
}
@media (max-width: 640px) {
    .card-foot {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .card-foot-meta { text-align: center; }
    .card-foot-action { justify-content: center; }
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    min-height: 40px;
    white-space: normal;
    text-align: center;
    text-decoration: none;
    letter-spacing: .005em;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
.btn--primary:hover:not(:disabled) {
    background: var(--brand-primary-soft);
    border-color: var(--brand-primary-soft);
}
.btn--ghost {
    /* Background: --surface-elevated (S106 PR-68 bump from
       --surface-sunken). The previous --surface-sunken background
       collided with attachments-widget rows, batteries readouts,
       and other surfaces that also sit on --surface-sunken — in
       dark mode the buttons read as nearly invisible, since the
       sunken/border token pair (#1c2030 / #242838) has insufficient
       brightness delta against the matching row background. Raising
       to --surface-elevated (#20243a in dark, #ffffff in light)
       gives the ghost button a clear "lifted" surface in both
       themes and against every container the portal puts it on.
       The hover state (border-strong + surface-elevated) is now a
       border-only delta. */
    background: var(--surface-elevated);
    color: var(--text-strong);
    border-color: var(--border);
}
.btn--ghost:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--surface-elevated);
}
.btn--danger {
    background: var(--semantic-danger);
    color: #fff;
    border-color: var(--semantic-danger);
}
.btn--sm { padding: 5px 11px; min-height: 30px; font-size: 12.5px; }

/* Touch-target compliance: WCAG 2.1 AA requires 44×44 on touch devices.
   Applied at the mobile breakpoint where touch is the dominant input.
   Base .btn bumped from 40px to 44px min-height with padding raised
   9px→11px to keep visual rhythm (S104 PR-50); .btn--sm bumped from
   30px to 44×44 in both dimensions (the original bump). */
@media (max-width: 640px) {
    .btn     { min-height: 44px; padding: 11px 16px; }
    .btn--sm { min-width: 44px; min-height: 44px; }
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text);
    margin-bottom: 6px;
}
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
/* --row-4 promoted from .flights-row--4 in S101 PR-44. Used by the flights
 * wizard conditions section (wind / dir / vis / ceiling) — a genuine
 * four-column compact strip. Other pages may pick it up. Mobile collapses
 * to single column with the other variants. */
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; } }

/* .form-hint — small helper text under form inputs / labels.
 * Use on <span> or <p>; display:block lets either work.
 *
 * Color is intentionally body-text (var(--text)), not muted. The pattern
 * was set by fleet/batteries (S90 PR-20 / PR-22) which pair body-color
 * hints with --text-strong links for emphasis when the hint contains a
 * link. Muting the hint would shift that balance and require re-tuning
 * the link colour too — out of scope for the promotion. Promoted from
 * the .maint-help / .sdr-help / .rpoc-help / .fleet-hint / .batteries-hint
 * / .documents-hint / .reports-hint / .admin-form-hint page-private
 * aliases in S97 PR-39. Modifier variants --tight and --warn promoted
 * from .admin-form-hint--tight / --warn in the same PR.
 *
 * Two page-private hint variants NOT migrated: .license-hint and
 * .ops-form-hint both use var(--text-muted) instead of var(--text), a
 * genuinely different visual treatment that deserves its own design
 * pass (muted-hint pattern). Documented for a future muted-vs-body
 * reconciliation PR.
 */
.form-hint {
    display: block;
    margin: var(--space-1) 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text);
}
.form-hint a {
    color: var(--text-strong);
    text-decoration: underline;
    text-decoration-color: var(--text);
    text-underline-offset: 3px;
}
/* --tight: pulls the hint up against the input above and adds extra
 * bottom margin so the next field sits with normal rhythm. Useful for
 * inline validators ("0 = no filter", role-description hints) where the
 * hint should read as part of the field unit, not a separate line.
 * Promoted from .admin-form-hint--tight in S97 PR-39. */
.form-hint--tight {
    margin-top: calc(-1 * var(--space-1));
    margin-bottom: var(--space-3);
}
/* --warn: warning-toned variant (cert-level training validator and other
 * conditional warnings). Composes the tight margins; standalone use
 * preserves admin.php precedent where --warn appeared without --tight.
 * Promoted from .admin-form-hint--warn in S97 PR-39. */
.form-hint--warn {
    color: var(--semantic-warning);
    margin-top: calc(-1 * var(--space-1));
    margin-bottom: var(--space-3);
}
/* --success and --danger: success / failure toned variants, joining --warn.
 * Used by the flights wizard for inline NOTAM-verified confirmations
 * and required-but-missing field validators. Color tokens only — they
 * do NOT compose the tight margins of --warn, so spacing matches the
 * base .form-hint. Promoted from .flights-help--success / --error in
 * S101 PR-44. */
.form-hint--success { color: var(--semantic-success); }
.form-hint--danger  { color: var(--semantic-danger);  }

input[type=text], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=datetime-local], input[type=number],
input[type=search], input[type=url], input[type=tel],
select, textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-strong);
    background: var(--surface-sunken);
    transition: border .12s, background .12s;
    appearance: none;
    -webkit-appearance: none;
}
[data-theme="light"] input[type=text],
[data-theme="light"] input[type=email],
[data-theme="light"] input[type=password],
[data-theme="light"] input[type=date],
[data-theme="light"] input[type=time],
[data-theme="light"] input[type=datetime-local],
[data-theme="light"] input[type=number],
[data-theme="light"] input[type=search],
[data-theme="light"] input[type=url],
[data-theme="light"] input[type=tel],
[data-theme="light"] select,
[data-theme="light"] textarea { background: #fff; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.40);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
    background: var(--surface-card);
}
input::placeholder, textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b91a3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
/* Explicit option styling — some browsers don't inherit through <select> */
select option {
    background: var(--surface-card);
    color: var(--text-strong);
}
/* Selected option: brand-navy highlight instead of the browser's native
   (grey-blue) selection colour, so multi-select listboxes read on-theme.
   Native option-highlight styling is browser-dependent — Firefox honours the
   background; the inset box-shadow forces the fill in WebKit/Blink where the
   system highlight paints over background-color. White text holds contrast on
   the navy in both light and dark themes. */
select option:checked {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 0 10px 100px var(--brand-primary) inset;
}

/* ── iOS Safari auto-zoom prevention (S104 PR-49) ───────────────────────────
   iOS Safari auto-zooms the viewport when a text input receives focus and
   its computed font-size is < 16px. The base input rule above uses 14px,
   which triggered a layout-shifting zoom on every form focus on every
   iPhone in the portal. This block bumps font-size to 16px at the mobile
   breakpoint only; desktop visual rhythm is preserved. Selector list
   mirrors the base rule above. */
@media (max-width: 640px) {
    input[type=text], input[type=email], input[type=password],
    input[type=date], input[type=time], input[type=datetime-local], input[type=number],
    input[type=search], input[type=url], input[type=tel],
    select, textarea {
        font-size: 16px;
    }
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    line-height: 1.55;
    margin-bottom: 14px;
    border-left: 3px solid;
}
.alert--error   { background: rgba(var(--semantic-danger-rgb), .08);  border-color: var(--semantic-danger);  color: var(--semantic-danger); }
.alert--success { background: rgba(var(--semantic-success-rgb), .08); border-color: var(--semantic-success); color: var(--semantic-success); }
.alert--info    { background: rgba(var(--semantic-info-rgb), .08);    border-color: var(--semantic-info);    color: var(--semantic-info); }
.alert--warning { background: rgba(var(--semantic-warning-rgb), .08); border-color: var(--semantic-warning); color: var(--semantic-warning); }

/* ── Data tables ────────────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    min-width: 0;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.data-table th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text);
    padding: 12px 16px 10px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    background: transparent;
}
.data-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-strong);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr {
    transition: background .12s, box-shadow .12s;
    position: relative;
}
.data-table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--brand-primary);
}
.data-table tbody tr:hover { background: var(--surface-sunken); }

/* Clickable rows (S139): a row carrying data-row-href navigates as a whole
   (delegated handler in shell_end.php). The hover affordance above already
   applies; this only signals the row is clickable. The row keeps a real <a>
   in its primary cell (.row-open-link) as the keyboard / assistive-tech
   target — whole-row click is mouse convenience layered on top, never a
   replacement for the link. */
.data-table tbody tr[data-row-href],
[data-row-href],
.js-row-open { cursor: pointer; }
.row-open-link { color: inherit; text-decoration: none; font-weight: 600; }
.row-open-link:hover,
.row-open-link:focus-visible { text-decoration: underline; }

/* #3: keep date (and stacked time) cells on their own lines so they don't
   wrap into a squished block in narrow columns. */
.data-table td.cell-date { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* #6: status/flag pills in a cell sit in a gapped, wrapping row so adjacent
   pills (e.g. version + Mandatory) have consistent breathing room instead of
   a single collapsing text space. */
.pill-row {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Mobile: data-table becomes a stacked card list at <640px.
   HARD RULE (v27): every <td> in a .data-table MUST carry a data-label="…"
   attribute at authoring time — PHP-rendered or JS-rendered alike. Without it
   the header hides on mobile and the cell renders as bare unlabelled text. */
@media (max-width: 640px) {
    .table-wrap { overflow-x: visible; }
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td {
        display: block;
        width: 100%;
    }
    .data-table tbody tr {
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
        position: relative;
    }
    .data-table tbody tr:last-child { border-bottom: 0; }
    .data-table tbody tr:hover {
        background: transparent;
    }
    .data-table tbody tr:hover td:first-child {
        box-shadow: none;
    }
    .data-table td {
        padding: 4px 0;
        border-bottom: 0;
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 12px;
        min-width: 0;
    }
    .data-table td[data-label]::before {
        content: attr(data-label);
        font-size: 10.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .1em;
        color: var(--text);
        flex-shrink: 0;
        padding-right: 8px;
    }
    .data-table td > * {
        text-align: right;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .data-table td:first-child {
        font-weight: 700;
        font-size: 15px;
        color: var(--text-strong);
        padding-bottom: 6px;
        margin-bottom: 6px;
        border-bottom: 1px dashed var(--border);
        display: block;
        text-align: left;
    }
    .data-table td:first-child::before { display: none; }
}

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: modalIn .18s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; letter-spacing: -0.005em; }
.modal-close {
    background: none; border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    min-height: 44px; min-width: 44px;
}
.modal-close:hover { background: var(--surface-sunken); color: var(--text-strong); }
.modal-body   { padding: 18px 20px; }
.modal-footer {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

/* Branded confirm / alert / prompt dialog (droneConfirm / droneAlert /
   dronePrompt — shell_end.php), built on the .modal primitives above. */
.dp-dialog { max-width: 420px; }
.dp-dialog .dp-dialog-desc {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text);
    margin: 0;
    white-space: pre-line;
}
.dp-dialog .dp-dialog-input {
    width: 100%;
    margin-top: 14px;
}
.dp-dialog .modal-footer .btn {
    flex: 1;
    min-height: 44px;
}

/* ── Dialog primitive (Coherence Arc Phase 1, S88 PR-7) ──────────────────── *
 *
 * Modal dialog built on the native <dialog> element. The browser handles
 * focus management (focus moves into the dialog on showModal(), inert-treats
 * the rest of the page), Esc-to-close, and the modal stacking context. We
 * style the chrome and add click-on-backdrop-to-close via JS (shell_end.php).
 *
 * Markup contract:
 *   <dialog class="dialog" id="my-dialog" aria-labelledby="my-dialog-title">
 *     <form method="dialog" class="dialog-form">  <!-- method="dialog" closes on submit -->
 *       <header class="dialog-head">
 *         <h2 class="dialog-title" id="my-dialog-title">…</h2>
 *         <button class="dialog-close" type="button"
 *                 data-dialog-cancel aria-label="Close">…×…</button>
 *       </header>
 *       <div class="dialog-body">
 *         …controls…
 *       </div>
 *       <footer class="dialog-foot">
 *         <button class="btn btn--ghost" type="button" data-dialog-cancel>Cancel</button>
 *         <button class="btn btn--primary" type="submit">Confirm</button>
 *       </footer>
 *     </form>
 *   </dialog>
 *
 * Open from JS:
 *   document.getElementById('my-dialog').showModal();
 * Close:
 *   • Native: Esc, or a submit with method="dialog"
 *   • Declarative: any element with [data-dialog-cancel] inside the dialog
 *   • Click on backdrop (outside the .dialog box) — wired in shell_end.php
 *
 * Legacy .modal-overlay/.modal still in place above for older consumers;
 * gradually migrated as pages get rewritten in Phase 3.
 */
.dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    color: var(--text);
    padding: 0;
    max-width: min(540px, calc(100vw - 24px));
    width: 100%;
    box-shadow: var(--shadow-strong);
}
.dialog::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
}
.dialog[open] {
    animation: dialogIn .18s ease;
}
@keyframes dialogIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.dialog-form {
    display: flex;
    flex-direction: column;
    margin: 0;
    max-height: calc(100vh - 48px);
}
.dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
}
.dialog-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-strong);
    margin: 0;
    line-height: 1.3;
}
.dialog-close {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
}
.dialog-close:hover {
    background: var(--surface-sunken);
    color: var(--text);
}
.dialog-close:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 1px;
}
.dialog-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1 1 auto;
}
.dialog-body > p:first-child { margin-top: 0; }
.dialog-body > :last-child   { margin-bottom: 0; }
.dialog-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}
.dialog-foot--space-between {
    justify-content: space-between;
}

/* Mobile: full-width, less padding. */
@media (max-width: 480px) {
    .dialog {
        max-width: calc(100vw - 12px);
        margin: 6px;
    }
    .dialog-body { padding: 14px; }
    .dialog-head { padding: 12px 14px; }
    .dialog-foot { padding: 10px 14px; }
}

/* ── Read row primitive (Coherence Arc Phase 1, S88 PR-9) ────────────────── *
 *
 * Display-only label/value pair, optionally paired with a right-aligned
 * action (button or muted text). Promoted to canonical from the pattern
 * profile.php invented in PR-7 (.profile-readonly-row), because the same
 * shape recurs across every settings-style page: cert info, account info,
 * sign-in info, RPOC details, drone profile, document metadata, etc.
 *
 * Markup contract:
 *   <div class="read-row">
 *     <div>
 *       <div class="read-row-label">Email</div>
 *       <div class="read-row-value">user@example.com</div>
 *     </div>
 *     <button class="btn btn--ghost">Change</button>   <!-- optional -->
 *   </div>
 *
 * Two equal-width grid columns by default; the optional action goes in the
 * second column and aligns to the right. Two label/value pairs side-by-side
 * also use the same markup (just two label/value blocks, no action).
 *
 * Mobile (<540px): collapses to single column; action goes full-width
 * underneath.
 *
 * Variants:
 *   .read-row--compact — tighter vertical padding for dense lists.
 */
.read-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-subtle);
}
.read-row:last-child { border-bottom: none; }
.read-row > :last-child {
    justify-self: end;
}
.read-row > :only-child {
    grid-column: 1 / -1;
    justify-self: stretch;
}
.read-row-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}
.read-row-value {
    color: var(--text-strong);
    font-size: 0.95rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.read-row--compact {
    padding: 6px 0;
}
@media (max-width: 540px) {
    .read-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .read-row > :last-child {
        justify-self: stretch;
    }
}

/* ── Action row primitive (S104 PR-53) ────────────────────────────────── *
 *
 * Horizontal cluster of action buttons rendered below a submitted-view
 * card stack. Wrap behaviour on narrow widths — buttons retain their
 * native sizing and flow to a second row when there isn't horizontal
 * room for all of them.
 *
 * Origin: lifted from _postflight_styles.php's .pf-view-actions, which
 * was duplicated identically in the survey submitted-view renderer's
 * page-private chrome. Promoted to canonical here so both submitted-view
 * pages (and any future ones) consume the same primitive. The page-
 * private duplicates removed in the same PR.
 *
 * Markup contract:
 *   <div class="action-row">
 *     <a class="btn btn--primary" href="...">Primary action</a>
 *     <a class="btn btn--ghost"   href="...">Back link</a>
 *     <button class="btn btn--ghost">Secondary action</button>
 *   </div>
 * ─────────────────────────────────────────────────────────────────────── */
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

/* ── Banner primitive (Coherence Arc Phase 1, S88 PR-9) ──────────────────── *
 *
 * Inline alert strip pinned within a page (distinct from toasts, which float
 * over the page corner). Used for page-level state — pending changes,
 * required actions, regulatory warnings, success confirmations.
 *
 * Promoted to canonical from profile.php's .profile-banner. Variants follow
 * the semantic palette: info (default), success, warning, danger.
 *
 * Markup contract:
 *   <div class="banner banner--warning" role="status">
 *     <div class="banner-icon" aria-hidden="true">⚠</div>
 *     <div class="banner-body">
 *       <strong>Heading.</strong> Detail text spanning a sentence or two.
 *       <button class="banner-action">Optional inline action</button>
 *     </div>
 *   </div>
 *
 * The icon column is fixed-width; the body flexes. Multi-line bodies wrap
 * naturally; the icon stays top-aligned via align-items: flex-start.
 *
 * Variants signal severity via a 3px left border and a tinted icon:
 *   .banner            — info (default), accent border
 *   .banner--success   — green
 *   .banner--warning   — amber
 *   .banner--danger    — red
 */
.banner {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    border-left: 1px solid var(--brand-accent);
    background: var(--surface-card);
    margin-bottom: 16px;
    align-items: flex-start;
}
.banner--success { border-left-color: var(--semantic-success); }
.banner--warning { border-left-color: var(--semantic-warning); }
.banner--danger  { border-left-color: var(--semantic-danger);  }
.banner-icon {
    font-size: 18px;
    line-height: 1.1;
    flex-shrink: 0;
    color: var(--brand-accent);
}
.banner--success .banner-icon { color: var(--semantic-success); }
.banner--warning .banner-icon { color: var(--semantic-warning); }
.banner--danger  .banner-icon { color: var(--semantic-danger);  }
.banner-body {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.5;
    color: var(--text);
}
.banner-body code {
    background: var(--surface-sunken);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85em;
}
.banner-action {
    background: none;
    border: none;
    color: var(--brand-accent);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: underline;
}
.banner-action:hover { color: var(--text-strong); }

/* ── Metric tile primitive (Coherence Arc Phase 1, S88 PR-9) ─────────────── *
 *
 * Single-stat tile for KPI strips, hero numbers, dashboard summary rows.
 * Big number + small label + optional trend delta indicator. Designed to
 * sit inside a CSS grid container at any column count.
 *
 * Markup contract:
 *   <div class="metric-tile">
 *     <div class="metric-tile-value">42</div>
 *     <div class="metric-tile-label">Active flights</div>
 *     <div class="metric-tile-delta metric-tile-delta--up">+3 this week</div>
 *   </div>
 *
 * The delta line is optional; omit when no trend is being shown. Variants:
 *   .metric-tile-delta--up   — green
 *   .metric-tile-delta--down — red
 *   .metric-tile-delta--flat — muted (default)
 *
 * Sits inside a .card to inherit border/surface, or freestanding with the
 * border on by default.
 */
.metric-tile {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-right: 1px solid var(--brand-warm);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.metric-tile-value {
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--text-strong);
    line-height: 1.1;
    letter-spacing: -0.01em;
}
.metric-tile-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}
.metric-tile-delta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.metric-tile-delta--up   { color: var(--semantic-success); }
.metric-tile-delta--down { color: var(--semantic-danger);  }
.metric-tile-delta--flat { color: var(--text-muted);       }

/* ── Timeline row primitive (Coherence Arc Phase 1, S88 PR-9) ────────────── *
 *
 * Single chronological event row for audit logs, history feeds, activity
 * timelines. Marker dot on the left, timestamp + body on the right.
 * Designed to stack in a vertical list with a connector line linking
 * consecutive markers.
 *
 * Markup contract:
 *   <div class="timeline-list">
 *     <div class="timeline-row">
 *       <div class="timeline-row-marker" aria-hidden="true"></div>
 *       <div class="timeline-row-content">
 *         <div class="timeline-row-time">2026-05-21 14:23</div>
 *         <div class="timeline-row-body">
 *           <strong>Flight submitted</strong> — Bayfield West, 12 min
 *         </div>
 *       </div>
 *     </div>
 *     …more rows…
 *   </div>
 *
 * The .timeline-list wrapper draws the vertical connector line behind the
 * markers via a single pseudo-element. The last row's connector tails off
 * naturally because the .timeline-row markers cap the line.
 *
 * Variants on the marker:
 *   .timeline-row-marker--success — green
 *   .timeline-row-marker--warning — amber
 *   .timeline-row-marker--danger  — red
 *   .timeline-row-marker--muted   — neutral grey (routine / background events)
 *   default                       — brand-accent
 */
.timeline-list {
    position: relative;
    padding: 0;
    margin: 0;
    list-style: none;
}
.timeline-list::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border);
    z-index: 0;
}
.timeline-row {
    position: relative;
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 12px;
    padding: 8px 0;
    align-items: start;
}
.timeline-row-marker {
    position: relative;
    z-index: 1;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--brand-accent);
    border: 2px solid var(--surface-page);
    margin-top: 3px;
}
.timeline-row-marker--success { background: var(--semantic-success); }
.timeline-row-marker--warning { background: var(--semantic-warning); }
.timeline-row-marker--danger  { background: var(--semantic-danger);  }
.timeline-row-marker--muted   { background: var(--text-muted);       }
.timeline-row-actor {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 6px;
}
.timeline-row-content {
    min-width: 0;
}
.timeline-row-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    margin-bottom: 2px;
}
.timeline-row-body {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ── Empty state primitive (Coherence Arc Phase 1, S88 PR-9) ─────────────── *
 *
 * Centered placeholder for "no records yet" scenarios — empty inboxes,
 * never-logged flights, fresh user dashboards. Icon + title + body + CTA,
 * stacked vertically and centered. Sits inside any container; no opinion
 * about its outer chrome.
 *
 * Markup contract:
 *   <div class="empty-state">
 *     <div class="empty-state-icon" aria-hidden="true">📭</div>
 *     <h3 class="empty-state-title">No flights yet</h3>
 *     <p class="empty-state-body">Log your first flight to get started.</p>
 *     <a href="/flights.php" class="btn btn--primary">Log a flight</a>
 *   </div>
 *
 * Icon can be an emoji, an inline SVG, or omitted entirely. CTA is
 * optional — pure-informational empty states drop the trailing button.
 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    text-align: center;
    gap: 8px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 2.2rem;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--text-muted);
    opacity: 0.7;
}
.empty-state-icon svg {
    width: 40px;
    height: 40px;
}
.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-strong);
    margin: 0;
}
.empty-state-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0 0 6px;
    max-width: 380px;
}
.empty-state .btn {
    margin-top: 4px;
}

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 999;
    display: flex; flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--semantic-info);
    border-radius: var(--radius-sm);
    padding: 11px 16px;
    font-size: 13px;
    box-shadow: var(--shadow);
    pointer-events: all;
    max-width: 320px;
}
.toast--success { border-left-color: var(--semantic-success); }
.toast--error   { border-left-color: var(--semantic-danger); }
.toast--info    { border-left-color: var(--semantic-info); }

/* ── Status pill (used by RPOC card and similar) ────────────────────────── */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 11px 4px 9px;
    border-radius: 999px;
    font-family: var(--brand-font-body), ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .08em;
    border: 1px solid;
    margin-bottom: 12px;
    vertical-align: middle;
}

/* When a status pill sits inline within a section title (beside the heading
   text and other pills), drop the stacked-badge bottom margin so it aligns to
   the text instead of riding ~6px high under vertical-align: middle. The
   .pill / .verdict-pill primitives carry no such margin, which is why they
   already sit correctly next to it. */
.section-title .status-pill {
    margin-bottom: 0;
}
.status-pill .pulse {
    width: 7px; height: 7px;
    border-radius: 50%;
}
.status-pill--draft {
    color: var(--semantic-warning);
    background: rgba(var(--semantic-warning-rgb), .1);
    border-color: rgba(var(--semantic-warning-rgb), .35);
}
.status-pill--draft .pulse {
    background: var(--semantic-warning);
    box-shadow: 0 0 0 3px rgba(var(--semantic-warning-rgb), .2);
}
.status-pill--issued {
    color: var(--semantic-success);
    background: rgba(var(--semantic-success-rgb), .1);
    border-color: rgba(var(--semantic-success-rgb), .35);
}
.status-pill--issued .pulse {
    background: var(--semantic-success);
    box-shadow: 0 0 0 3px rgba(var(--semantic-success-rgb), .2);
}
.status-pill--alert {
    color: var(--semantic-danger);
    background: rgba(var(--semantic-danger-rgb), .1);
    border-color: rgba(var(--semantic-danger-rgb), .35);
}
.status-pill--alert .pulse {
    background: var(--semantic-danger);
    box-shadow: 0 0 0 3px rgba(var(--semantic-danger-rgb), .2);
}

/* Additional lifecycle variants — operations dashboard, future modules. */
.status-pill--active {
    color: var(--semantic-success);
    background: rgba(var(--semantic-success-rgb), .1);
    border-color: rgba(var(--semantic-success-rgb), .35);
}
.status-pill--active .pulse {
    background: var(--semantic-success);
    box-shadow: 0 0 0 3px rgba(var(--semantic-success-rgb), .2);
}
.status-pill--completed {
    color: var(--semantic-info);
    background: rgba(var(--semantic-info-rgb), .1);
    border-color: rgba(var(--semantic-info-rgb), .35);
}
.status-pill--completed .pulse {
    background: var(--semantic-info);
    box-shadow: 0 0 0 3px rgba(var(--semantic-info-rgb), .2);
}
.status-pill--cancelled {
    color: var(--text);
    background: var(--surface-sunken);
    border-color: var(--border);
}
.status-pill--cancelled .pulse {
    background: var(--text-muted);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .15);
}
.status-pill--muted {
    color: var(--text);
    background: var(--surface-sunken);
    border-color: var(--border);
}
/* --info shares its hue with --completed (both --semantic-info). They're kept
 * separate because the intent differs: --completed marks lifecycle terminal
 * state, --info marks a category / notification badge (e.g. maintenance row
 * has an associated SDR). If a distinct accent colour is later introduced,
 * --info can be re-pointed without churning call sites. */
.status-pill--info {
    color: var(--semantic-info);
    background: rgba(var(--semantic-info-rgb), .1);
    border-color: rgba(var(--semantic-info-rgb), .35);
}
.status-pill--info .pulse {
    background: var(--semantic-info);
    box-shadow: 0 0 0 3px rgba(var(--semantic-info-rgb), .2);
}

/* ── Verdict pill (severity / traffic-light family) ─────────────────────────
 * Sibling family to .status-pill. Semantically distinct: lifecycle vs outcome.
 * Use .status-pill for record state (draft / issued / active / completed /
 * cancelled / muted / info). Use .verdict-pill for severity or compliance
 * outcomes (green / yellow / red) and analysis runtime states (info / muted).
 *
 * Visually mirrors .status-pill so the two families read as related, but
 * intentionally lacks:
 *   - margin-bottom: verdict pills sit inline in cards and table cells
 *   - .pulse rule:   verdict pills are outcome indicators, not live state
 * ───────────────────────────────────────────────────────────────────────── */
.verdict-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px 4px 9px;
    border-radius: 999px;
    font-family: var(--brand-font-body), ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .08em;
    border: 1px solid;
    vertical-align: middle;
}
.verdict-pill--green {
    color: var(--semantic-success);
    background: rgba(var(--semantic-success-rgb), .1);
    border-color: rgba(var(--semantic-success-rgb), .35);
}
.verdict-pill--yellow {
    color: var(--semantic-warning);
    background: rgba(var(--semantic-warning-rgb), .1);
    border-color: rgba(var(--semantic-warning-rgb), .35);
}
.verdict-pill--red {
    color: var(--semantic-danger);
    background: rgba(var(--semantic-danger-rgb), .1);
    border-color: rgba(var(--semantic-danger-rgb), .35);
}
.verdict-pill--info {
    color: var(--semantic-info);
    background: rgba(var(--semantic-info-rgb), .1);
    border-color: rgba(var(--semantic-info-rgb), .35);
}
.verdict-pill--muted {
    color: var(--text-muted);
    background: var(--surface-sunken);
    border-color: var(--border);
}

/* ── Pill (inline-compact severity primitive — Session 74 PR-1) ─────────────
 * Third pill family. Inline-compact counterpart to .verdict-pill — same
 * semantics (severity / verdict / categorical accent), smaller scale for use
 * in context-strip values, review-row trailing badges, and dense table cells.
 *
 * Family relationship:
 *   .status-pill  — prominent, lifecycle state (record state machine)
 *   .verdict-pill — prominent, severity / compliance outcome
 *   .pill         — inline-compact, severity / categorical accent
 *
 * Sized via the --pill-* tokens (defined in :root above) so type and padding
 * stay consistent with the surrounding cs-value / review-row text.
 *
 * Origin: previously defined in _workspace_styles.php (Session 35 PR-A
 * "canonical primitives" block). Lifted here in Session 74 PR-1 to colocate
 * all three pill families. The workspace-styles copy remains in place
 * temporarily as a no-op shim and is removed in the final cleanup PR of
 * the pill-standardization arc.
 * ───────────────────────────────────────────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: var(--pill-padding);
    border: var(--pill-border-width) solid transparent;
    border-radius: var(--pill-radius);
    font-size: var(--pill-size);
    font-weight: var(--pill-weight);
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    vertical-align: middle;
}
.pill--green {
    background: var(--pill-green-bg);
    color:      var(--pill-green-fg);
    border-color: var(--pill-green-border);
}
.pill--yellow {
    background: var(--pill-yellow-bg);
    color:      var(--pill-yellow-fg);
    border-color: var(--pill-yellow-border);
}
.pill--red {
    background: var(--pill-red-bg);
    color:      var(--pill-red-fg);
    border-color: var(--pill-red-border);
}
.pill--info {
    background: var(--pill-info-bg);
    color:      var(--pill-info-fg);
    border-color: var(--pill-info-border);
}
.pill--muted {
    background: var(--pill-muted-bg);
    color:      var(--pill-muted-fg);
    border-color: var(--pill-muted-border);
}

/* ── Module: prose card body ────────────────────────────────────────────── */
.module-prose {
    color: var(--text-strong);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 14px;
}
.module-prose b { color: var(--text-strong); font-weight: 600; }
.module-prose .accent { color: var(--semantic-info); font-weight: 600; }

/* ── Module: key-value strip ────────────────────────────────────────────── */
.kv-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.kv-strip .kv .k {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text);
    margin-bottom: 3px;
}
.kv-strip .kv .v {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
}
.kv-strip .kv .v--mono {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 12.5px;
}
@media (max-width: 480px) {
    .kv-strip { grid-template-columns: 1fr; gap: 8px; }
}

/* ── Module: mini list (upcoming, etc.) ─────────────────────────────────── */
.mini-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.mini-list > li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 4px 12px;
    align-items: baseline;
    padding: 11px 0;
    border-bottom: 1px dashed var(--border);
}
.mini-list > li:last-child { border-bottom: none; padding-bottom: 0; }
.mini-list > li:first-child { padding-top: 4px; }
.mini-list .ml-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}
.mini-list .ml-tag--alert {
    color: var(--semantic-warning);
    background: rgba(var(--semantic-warning-rgb), .1);
    border-color: rgba(var(--semantic-warning-rgb), .3);
}
.mini-list .ml-title {
    font-size: 13.5px;
    color: var(--text-strong);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mini-list .ml-meta {
    font-size: 12px;
    color: var(--text);
    grid-column: 2;
    margin-top: -2px;
}
.mini-list .ml-when {
    font-size: 12px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.mini-list .ml-when--soon { color: var(--semantic-warning); font-weight: 600; }

/* ── Module: audit feed ─────────────────────────────────────────────────── */
.audit-feed {
    list-style: none;
    margin: 0;
    padding: 0;
}
.audit-feed > li {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 12.5px;
    align-items: baseline;
}
.audit-feed > li:last-child { border-bottom: none; padding-bottom: 0; }
.audit-feed > li:first-child { padding-top: 4px; }
.audit-feed .af-time {
    font-family: ui-monospace, Menlo, monospace;
    color: var(--text-muted);
    font-size: 11.5px;
}
.audit-feed .af-action {
    font-family: ui-monospace, Menlo, monospace;
    color: var(--text-strong);
    font-size: 12px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.audit-feed .af-who {
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
}

/* ── Module: drone snapshot ─────────────────────────────────────────────── */
.drone-snap {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px dashed var(--border);
    align-items: center;
}
.drone-snap:last-child { border-bottom: none; padding-bottom: 0; }
.drone-snap:first-child { padding-top: 4px; }
.drone-snap .ds-icon {
    width: 36px; height: 36px;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}
.drone-snap .ds-icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.drone-snap .ds-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong);
}
.drone-snap .ds-model {
    font-size: 12px;
    color: var(--text);
    margin-top: 1px;
}
.drone-snap .ds-stats {
    text-align: right;
    font-size: 12.5px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.drone-snap .ds-stats b { color: var(--text-strong); font-weight: 600; }

/* ── Dashboard module grid (used by index.php in PR-B) ──────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.dashboard-grid > .span-2 { grid-column: 1 / -1; }
@media (max-width: 960px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── Utility ────────────────────────────────────────────────────────────── */
.text-secondary { color: var(--text); }
.text-tertiary  { color: var(--text-muted); }
.text-danger    { color: var(--semantic-danger); }
.text-success   { color: var(--semantic-success); }
.text-warning   { color: var(--semantic-warning); }
.text-mono      { font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace; font-variant-numeric: tabular-nums; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
