@import url('/ui-controls.css');
@import url('/health-ui.css');
@import url('/whats-new.css');

@property --pad-hue {
    syntax: "<number>";
    inherits: true;
    initial-value: 240;
}

.external-main { width: min(1180px, calc(100% - 32px)); margin: 28px auto 80px; display: grid; gap: 18px; }
.external-hero,
.external-card { border: 1px solid var(--line, #334155); border-radius: 16px; background: var(--panel, #111827); padding: 20px; }
.external-hero { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.external-hero h2,
.external-card h3 { margin: 0; }
.external-hero p { max-width: 720px; }
.external-master { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.external-master span { display: grid; gap: 3px; }
.external-master small { color: var(--muted, #94a3b8); }
.external-warning { border-left: 4px solid #f59e0b; padding: 12px 16px; background: color-mix(in srgb, #f59e0b 12%, transparent); }
.external-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.external-card > header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 16px; }
.external-card form,
.external-limits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.external-card label { display: grid; gap: 6px; }
.external-table-wrap { overflow-x: auto; }
.external-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.external-table th,
.external-table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line, #334155); }
.switch-cell { display: inline-flex !important; grid-auto-flow: column; align-items: center; justify-content: start; }
.external-events { max-height: 360px; overflow: auto; display: grid; gap: 8px; }
.external-events p { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line, #334155); overflow-wrap: anywhere; }
.external-endpoints { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.external-endpoints dt { color: var(--muted, #94a3b8); }
.external-endpoints dd { margin: 0; text-align: right; }
:root {
    color-scheme: dark;
    --bg: #0b0d10;
    --panel: #12151a;
    --line: #232833;
    --text: #e8edf4;
    --muted: #8b95a5;
    --live: #3dd68c;
    --wait: #e0b34a;
    --err: #ef6b6b;
    --accent: #7aa2ff;
    --codex-blue: #10a7ff;
    --codex-blue-soft: #6bd5ff;
    --focus: #7ce5ff;
    --surface-raised: #18202b;
    --surface-soft: #0f141b;
    --accent-wash: rgba(122, 162, 255, 0.12);
    --accent-border: rgba(122, 162, 255, 0.42);
    --control-min-height: 36px;
    --control-inline-padding: 14px;
    --control-radius: 6px;
}

/* The website's color system keeps hex fallbacks above, then moves supported
   browsers to perceptually even dark surfaces and signals. */
@supports (color: oklch(0.5 0.1 240)) {

    :root {
        --bg: oklch(0.16 0.018 255);
        --panel: oklch(0.205 0.022 255);
        --surface-raised: oklch(0.245 0.03 255);
        --surface-soft: oklch(0.18 0.02 255);
        --line: oklch(0.32 0.028 255);
        --text: oklch(0.94 0.018 250);
        --muted: oklch(0.69 0.035 250);
        --live: oklch(0.8 0.15 155);
        --wait: oklch(0.82 0.14 85);
        --err: oklch(0.73 0.17 28);
        --accent: oklch(0.74 0.14 255);
        --codex-blue: oklch(0.73 0.16 235);
        --codex-blue-soft: oklch(0.84 0.1 220);
        --focus: oklch(0.88 0.12 215);
        --accent-wash: color-mix(in oklch, var(--accent) 14%, transparent);
        --accent-border: color-mix(in oklch, var(--accent) 48%, transparent);
    }

}

.hover-tip {
    position: fixed;
    z-index: 10060;
    max-width: min(360px, calc(100vw - 16px));
    padding: 7px 9px;
    color: #f4f6f8;
    background: rgba(12, 15, 19, 0.97);
    border: 1px solid rgba(185, 193, 204, 0.55);
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
}

* { box-sizing: border-box; }

::selection {
    color: var(--bg);
    background: var(--accent);
}

:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

[hidden] { display: none !important; }

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.4 "IBM Plex Sans", "Segoe UI", sans-serif;
}

html { min-width: 320px; }

/* iOS page boundaries should stay still under a held finger. Keep normal
   document/inner scrolling and browser zoom; stop elastic overscroll and
   horizontal document overflow without changing page height or positioning.
   Platform scope also covers iPhone landscape above the phone breakpoint. */
html.ui-ios {
    overscroll-behavior: none;
    overflow-x: clip;
}
html.ui-ios body {
    overscroll-behavior: none;
    overflow-x: clip;
}
html.ui-ios body > main {
    overscroll-behavior: none;
}

body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100%;
    min-height: 100dvh;
    min-width: 0;
}

.top {
    --chrome-inline-pad: 14px;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 9px 14px 8px;
    border-bottom: 1px solid var(--line);
}

.toolbar-pin { display: none; }

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

.top-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: end;
    column-gap: 8px;
    row-gap: 4px;
    flex: 1 1 auto;

}

.top-actions {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.top-actions .tool-btn {
    min-height: 30px;
    padding: 0 10px;
    box-shadow: none;
    font-size: 11px;
}

.nav-alert-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.nav-alert-count,
.toolbar-alert-summary {
    font-variant-numeric: tabular-nums;
}

.nav-alert-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    min-height: 17px;
    padding: 0 4px;
    color: var(--muted);
    background: rgba(139, 149, 165, 0.12);
    border: 1px solid rgba(139, 149, 165, 0.3);
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
}

.nav-alert-link.has-alerts {
    color: #fff;
}

.nav-alert-link.has-alerts .nav-alert-count {
    color: #fff;
    background: #b84550;
    border-color: #ef6b6b;
}

.top-brand {
    flex: 0 0 auto;
    min-width: max-content;
}

#status {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.status-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.status-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 2px 4px 2px 6px;
    background: rgba(255, 255, 255, 0.018);
    border-left: 1px solid #3a4352;
}

.status-group-label {
    flex: 0 0 auto;
    color: #aab3c1;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.status-group-items {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 3px;
    min-width: 0;
}

.status-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    min-height: 21px;
    padding: 2px 5px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--line);
    white-space: nowrap;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.account-menu {
    position: relative;
    z-index: 40;
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
}

.account-summary {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-height: 30px;
    padding: 0 4px 0 8px;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    font-size: 12px;
}

.account-summary::-webkit-details-marker { display: none; }
.account-summary:hover,
.account-summary:focus-visible { color: var(--text); }

.account-username {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-color,
.collaboration-person > i,
.collaboration-event > i {
    display: block;
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    background: var(--actor-color, var(--accent));
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 8px color-mix(in srgb, var(--actor-color, var(--accent)) 48%, transparent);
}

.collaboration-shell {
    position: relative;
    z-index: 130;
    flex: 0 0 auto;
    align-self: center;
}

.collaboration-count {

    gap: 6px;
    min-height: 30px;
    padding: 0 9px;
    color: var(--live);
    background: rgba(14, 18, 23, 0.72);
    border: 1px solid rgba(61, 214, 140, 0.48);
    border-radius: 999px;
    cursor: pointer;
    list-style: none;

    font-weight: 800;
    letter-spacing: 0.1em;
}

.collaboration-count strong {
    display: inline-grid;
    min-width: 18px;
    min-height: 18px;

    place-items: center;
    color: #07110c;
    background: var(--live);

    font-size: 10px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.collaboration-arrival-badge,
.toolbar-presence-arrival {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 18px;
    padding: 0 4px;
    color: #06111b;
    background: #9be8ff;
    border: 1px solid #e8fbff;
    border-radius: 999px;
    box-shadow: 0 0 0 3px rgba(74, 203, 255, .18), 0 0 16px rgba(74, 203, 255, .56);
    font-size: 9px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    line-height: 1;
    animation: presence-arrival-ping 900ms ease-out 2;
}

.toolbar-presence-arrival { margin: 0 1px 0 2px; }

@keyframes presence-arrival-ping {
    0% { box-shadow: 0 0 0 0 rgba(74, 203, 255, .58), 0 0 8px rgba(74, 203, 255, .42); }
    65% { box-shadow: 0 0 0 7px rgba(74, 203, 255, 0), 0 0 18px rgba(74, 203, 255, .64); }
    100% { box-shadow: 0 0 0 0 rgba(74, 203, 255, 0), 0 0 8px rgba(74, 203, 255, .35); }
}

@media (prefers-reduced-motion: reduce) {

    .collaboration-arrival-badge,
.toolbar-presence-arrival { animation: none; }

}

.collaboration-count::-webkit-details-marker { display: none; }
.collaboration-count:focus-visible { outline: 2px solid #a8c2ff; outline-offset: 2px; }

.collaboration-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);

    width: min(390px, calc(100vw - 28px));
    height: min(520px, calc(100dvh - 86px));

    background: rgba(15, 18, 23, 0.985);
    border: 1px solid #3b4453;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.66);
}

.collaboration-panel > header {
    display: grid;
    gap: 2px;
    padding: 13px 14px 10px;
}

.collaboration-panel > header strong { font-size: 14px; }
.collaboration-panel > header span { color: var(--muted); font-size: 10px; }
.collaboration-panel > hr { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--line); }

.collaboration-presence {
    display: grid;
    max-height: 150px;
    padding: 0 14px 11px;
    overflow-y: auto;
}

.collaboration-person {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-height: 35px;
}

.collaboration-person p {
    display: grid;
    min-width: 0;
    margin: 0;
}

.collaboration-person strong,
.collaboration-person span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collaboration-person strong { font-size: 12px; }
.collaboration-person strong,
.collaboration-event strong,
.account-username { color: var(--actor-color, #5ec8ff); }
.collaboration-person span { color: var(--muted); font-size: 10px; white-space: normal; overflow-wrap: anywhere; }

.collaboration-feed {
    min-height: 0;
    padding: 7px 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.collaboration-event {
    display: grid;
    grid-template-columns: 42px 12px minmax(0, 1fr);
    align-items: start;
    gap: 6px;
    padding: 6px 3px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.collaboration-event time {
    color: #697384;
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.collaboration-event > i { margin-top: 2px; }
.collaboration-event p { display: flex; flex-wrap: wrap; gap: 0 5px; min-width: 0; margin: 0; font-size: 11px; }
.collaboration-event strong { color: var(--actor-color, #5ec8ff); }
.collaboration-event span { min-width: 0; overflow-wrap: anywhere; color: #d7dce4; }
.collaboration-event small { flex-basis: 100%; color: var(--accent); font-size: 9px; }
.collaboration-event.is-activity span { color: var(--muted); }

.collaboration-chat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding: 9px 10px 7px;
    border-top: 1px solid var(--line);
}

.collaboration-chat input {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 9px;
    color: var(--text);
    background: #090b0e;
    border: 1px solid #343c49;
    border-radius: 5px;
    font: inherit;
}

.collaboration-chat button {
    min-height: 38px;
    padding: 0 11px;
    color: var(--text);
    background: #242b36;
    border: 1px solid #465163;
    border-radius: 5px;
    font: inherit;
    cursor: pointer;
}

.collaboration-message {
    min-height: 17px;
    margin: 0;
    padding: 0 11px 8px;
    color: var(--wait);
    font-size: 10px;
}

.account-chevron {
    width: 7px;
    height: 7px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 140ms ease-out;
}

.account-menu[open] .account-chevron {
    transform: translateY(2px) rotate(225deg);
}

.account-popover {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    min-width: 150px;
    padding: 5px;
    background: #171b22;
    border: 1px solid #394150;
    border-radius: 6px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}
.account-popover[popover] {position:fixed;inset:auto;margin:0;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);overflow:auto;box-sizing:border-box;z-index:700;}

.account-action {
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    justify-content: flex-start;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 4px;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.account-action:hover,
.account-action:focus-visible {
    background: #252c37;
}

.profile-summary {
    display: grid;
    gap: 3px;
    padding: 9px 10px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.02);
    border-left: 2px solid #465061;
    font-size: 12px;
}

.profile-summary strong {
    color: var(--text);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.status-chip strong {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.08em;
}

.status-chip[data-tone="good"] { border-color: rgba(61, 214, 140, 0.35); }
.status-chip[data-tone="good"] > span { color: var(--live); }
.status-chip[data-tone="warn"] { border-color: rgba(224, 179, 74, 0.42); }
.status-chip[data-tone="warn"] > span { color: var(--wait); }
.status-chip[data-tone="bad"] { border-color: rgba(239, 107, 107, 0.48); }
.status-chip[data-tone="bad"] > span { color: var(--err); }

.tool-btn {
    position: relative;
    background: linear-gradient(180deg, #242a34 0%, #171b22 100%);
    color: var(--text);
    border: 1px solid #3a4352;
    border-radius: var(--control-radius);
    min-height: var(--control-min-height);
    padding: 0 var(--control-inline-padding);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.075),
        0 2px 0 rgba(0, 0, 0, 0.75),
        0 5px 12px rgba(0, 0, 0, 0.18);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1.2;
    text-align: center;
    touch-action: manipulation;
    user-select: none;
    transition:
        transform 110ms ease-out,
        border-color 140ms ease-out,
        background 140ms ease-out,
        box-shadow 140ms ease-out,
        color 140ms ease-out;
}

.tool-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #303744 0%, #1d222b 100%);
    border-color: #536074;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.11),
        0 3px 0 rgba(0, 0, 0, 0.78),
        0 7px 16px rgba(0, 0, 0, 0.24);
    transform: translateY(-1px);
}

.tool-btn:active:not(:disabled) {
    background: linear-gradient(180deg, #171b22 0%, #252b36 100%);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(0, 0, 0, 0.8);
    transform: translateY(1px);
}

.tool-btn:focus-visible {
    outline: 2px solid #a8c2ff;
    outline-offset: 2px;
}

.tool-btn.primary {
    background: linear-gradient(180deg, #648df0 0%, #3c61bb 100%);
    border-color: #88aaff;
    color: #fff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.23),
        0 2px 0 #1f3260,
        0 6px 15px rgba(49, 82, 161, 0.28);
}

.tool-btn.primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #769cff 0%, #486dcc 100%);
    border-color: #aec3ff;
}

.tool-btn.danger,
.tool-btn[data-recording="on"] {
    background: linear-gradient(180deg, #4a292d 0%, #2b1b1e 100%);
    border-color: #a94f58;
    color: #ffb6bc;
}

.tool-btn:disabled {
    cursor: not-allowed;
    opacity: 0.46;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
    transform: none;
}

/* Shared control primitive. Compact icon and segmented variants below opt out
   deliberately, while every normal action keeps the same readable target and
   centering on desktop and touch screens. */
:where(button, a.tool-btn, [role="button"]) {
    min-height: var(--control-min-height);
    padding: 0 var(--control-inline-padding);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    vertical-align: middle;
    touch-action: manipulation;
    text-decoration: none;
}

:where(button, a.tool-btn, [role="button"]):focus-visible {
    outline: 2px solid #a8c2ff;
    outline-offset: 2px;
}

:where(button, a.tool-btn, [role="button"]):disabled,
:where(button, a.tool-btn, [role="button"])[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.46;
}

summary {
    min-height: var(--control-min-height);
    line-height: 1.2;
}

.context-menu {
    position: fixed;
    z-index: 10000;
    display: grid;
    min-width: 210px;
    max-width: min(320px, calc(100vw - 16px));
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 5px;
    color: var(--text);
    background: #171b22;
    border: 1px solid #394150;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}

.context-menu button {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    color: var(--text);
    background: transparent;
    border: 0;
    font: inherit;
    text-align: left;
    justify-content: flex-start;
    cursor: pointer;
}

.context-menu button:hover,
.context-menu button:focus-visible {
    outline: none;
    background: #252c37;
}

.context-menu button:disabled { color: var(--muted); cursor: default; opacity: 0.55; }
.context-menu button.danger { color: var(--err); }
.context-menu button.has-submenu { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.context-menu button.has-submenu > :last-child { color: var(--muted); font-size: 18px; line-height: 1; }
.context-submenu { z-index: 10001; min-width: 245px; }
.context-menu-separator { height: 1px; margin: 5px 4px; background: var(--line); }
.context-menu-heading { padding:8px 10px 3px; color:var(--muted); font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.07em; }
.context-menu-back { color:var(--muted); border-bottom:1px solid var(--line); }
.context-menu-back[hidden] { display:none; }

.top h1 {
    display: inline-block;

    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-version {
    display: inline-block;
    margin-left: 7px;
    color: var(--muted);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 10px;
    font-variant-numeric: tabular-nums;

    vertical-align: 1px;
    text-decoration: none;
}

.brand-version:hover,
.brand-version:focus-visible,
.brand-version[aria-current="page"] { color: var(--codex-blue-soft); }



.about-intro,
.about-components {
    min-width: 0;
}

.about-eyebrow {
    margin: 0 0 7px;
    color: var(--codex-blue-soft);
    font: 700 10px/1.2 ui-monospace, "SFMono-Regular", Consolas, monospace;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.about-main h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(24px, 4vw, 46px);
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.about-intro blockquote {
    margin: 24px 0 30px;
    padding: 0 0 0 18px;
    color: #c8d0dc;
    border-left: 2px solid var(--codex-blue);
    font-size: clamp(15px, 1.8vw, 19px);
    line-height: 1.65;
}

.about-facts,
.about-components dl {
    margin: 0;
}

.about-facts > div,
.about-components dl > div {
    display: grid;
    grid-template-columns: minmax(110px, 0.6fr) minmax(0, 1.4fr);
    gap: 16px;
    padding: 13px 0;
    border-top: 1px solid var(--line);
}

.about-facts dt,
.about-components dt {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.about-facts dd,
.about-components dd {
    min-width: 0;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.about-facts a { color: var(--codex-blue-soft); }

.about-components > header {
    margin-bottom: 20px;
}

.about-components h2 {
    font-size: clamp(22px, 3vw, 34px);
}

.about-components dd {
    display: grid;
    justify-items: end;
    text-align: right;
}

.about-components dd strong {
    color: var(--text);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 14px;
}

.about-components dd span {
    color: var(--muted);
    font-size: 11px;
}

.about-error {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--err);
}

.global-action-progress {
    display: inline-flex;
    width: min(440px, 46vw);
    min-height: 24px;
    max-height: 26px;
    margin: 0 0 0 9px;
    padding-inline: 9px;
    vertical-align: middle;
}


.top p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

#grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns, 2), minmax(0, 1fr));
    grid-template-rows: repeat(var(--grid-rows, 1), minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

body.has-expanded #grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.tile {
    position: relative;
    background: #000;
    border: 1px solid var(--line);
    min-height: 0;
    height: 100%;
    overflow: hidden;
    cursor: zoom-in;
}

body.has-expanded .tile:not(.expanded) {
    display: none;
}

.tile.expanded {
    cursor: zoom-out;
}

.audio-toggle {
    display: none;
    position: absolute;
    z-index: 12;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    padding: 5px;
    color: var(--muted);
    background: rgba(0, 0, 0, .54);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.tile.expanded.has-audio .audio-toggle { display: block; }
.audio-toggle svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.audio-toggle.is-on { color: var(--live); }
.audio-toggle.is-on .audio-slash { display: none; }
.talkback-toggle {
    display: inline-grid;
    min-width: 48px;
    min-height: 38px;
    place-items: center;
    padding: 0 8px;
    color: var(--text);
    background: rgba(0, 0, 0, .54);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 19px;
    font: 700 10px/1 system-ui, sans-serif;
    letter-spacing: .08em;
    cursor: pointer;
}
.talkback-toggle.is-on {
    color: #fff;
    background: #b9233c;
    border-color: #ff8194;
    box-shadow: 0 0 0 3px rgba(255, 84, 112, .18);
}
.live-ptz {
    display: none;
    position: absolute;
    z-index: 12;
    top: 54px;
    left: 10px;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}
.tile.expanded .live-ptz.is-ready { display: flex; }
.tile:is(:fullscreen, :-webkit-full-screen) .live-ptz.is-ready { display: flex; }
.live-ptz button { min-width: 38px; min-height: 38px; color: var(--text); background: #121820; border: 1px solid #465061; }
.live-ptz-panel {
    display: grid;
    width: min(238px, calc(100vw - 20px));
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--line);
    background: rgba(7, 9, 12, .9);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .44);
    backdrop-filter: blur(16px);
}
.live-ptz-panel[hidden] { display: none; }
.ptz-direction-pad {
    display: grid;
    grid-template-columns: repeat(3, 42px);
    justify-content: center;
    gap: 5px;
}
.ptz-direction-pad button { font-size: 17px; }
.ptz-stop { color: #ff9bac !important; }
.ptz-optical-row { display: flex; align-items: center; gap: 5px; }
.ptz-optical { padding: 0 8px; font: 800 9px/1.1 system-ui, sans-serif; letter-spacing: .03em; white-space: nowrap; }
.ptz-home,
.ptz-journey { padding: 0 8px; font: 800 10px/1.1 system-ui, sans-serif; letter-spacing: .04em; }
.ptz-journey { min-height: 44px !important; color: #cbefff !important; border-color: rgba(64, 190, 255, .56) !important; }
.ptz-journey.is-running { color: #fff !important; border-color: #ff8194 !important; background: #9e2037 !important; }
.ptz-journey-status { min-height: 13px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.3; text-align: center; }
.live-light {
    display: none;
    position: absolute;
    z-index: 12;
    right: 10px;
    bottom: 64px;
    gap: 5px;
    padding: 7px;
    background: rgba(7, 9, 12, .82);
    border: 1px solid var(--line);
}
.tile.expanded .live-light.is-ready { display: flex; }
.tile:is(:fullscreen, :-webkit-full-screen) .live-light.is-ready { display: flex; }
.tile.expanded.has-live-ptz .live-light.is-ready { bottom: 64px; }
.live-light button { min-height: 38px; color: var(--text); background: #121820; border: 1px solid #465061; }

live-tile {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Media presentation has one owner: every video starts as a complete contained
   source and MediaZoomController supplies crop-to-fill, FIT, zoom, and pan with
   one transform. CSS owns only the fixed, clipped viewport. */
live-tile video,
.rewind-stage video {
    object-fit: contain;
    object-position: 50% 50%;
}
live-tile video,
.ai-overlay { transition: transform 120ms ease-out; }
.tile.is-panning video,
.tile.is-panning .ai-overlay,
.tile.is-gesturing video,
.tile.is-gesturing .ai-overlay { transition: none; }

.tile.media-framed video,
.tile.media-zoomed video { will-change: transform; }

.tile live-tile,
.tile .rewind-stage {
    touch-action: none;
    overscroll-behavior: contain;
}

.stale-frame {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.62) saturate(0.8);
    pointer-events: none;
}

.tile.media-fitted .stale-frame { object-fit: contain; }

.ai-overlay {
    position: absolute;
    z-index: 2;
    top: var(--media-source-top, 0px);
    left: var(--media-source-left, 0px);
    width: var(--media-source-width, 100%);
    height: var(--media-source-height, 100%);
    pointer-events: none;
    transform: var(--media-overlay-transform, none);
    transform-origin: center;
}

.ai-box {
    position: absolute;
    min-width: 2px;
    min-height: 2px;
    border: 2px solid #55ee8a;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .55), inset 0 0 12px rgba(85, 238, 138, .1);
}

.ai-box span {
    position: absolute;
    left: -2px;
    bottom: 100%;
    padding: 2px 4px;
    color: #06120a;
    background: #55ee8a;
    font: 700 9px/1.2 ui-monospace, "SFMono-Regular", Consolas, monospace;
    white-space: nowrap;
}

.stream-notice {
    position: absolute;
    z-index: 7;
    top: 42px;
    right: 10px;
    width: 44px;
    height: 44px;
    pointer-events: auto;
}
.stream-notice[hidden] { display: none; }
.live-retry {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 10px;
    border: 1px solid #b7cbd275;
    border-radius: 50%;
    background: #10202cd9;
    color: #d3e6ea;
    box-shadow: 0 2px 8px #0005;
    cursor: pointer;
}
.live-retry svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.live-retry:hover { background: #253b49; border-color: #a6e6dc; }
.live-retry:focus-visible { outline: 2px solid #a6e6dc; outline-offset: 3px; }
.live-retry:disabled { opacity: .55; cursor: default; }
.tile.camera-off .stream-notice { display: none; }

.frame-clock {
    position: absolute;
    z-index: 6;
    top: 7px;
    left: 50%;
    max-width: calc(100% - 150px);
    padding: 2px 5px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.58);
    border-radius: 3px;
    transform: translateX(-50%);
    overflow: hidden;
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px #000;
    white-space: nowrap;
    pointer-events: none;
    transition: color 180ms ease-out, border-color 180ms ease-out;
}

.frame-clock[data-age="waiting"] { color: var(--muted); }
.frame-clock[data-age="fresh"] { color: var(--text); }
.frame-clock[data-age="delayed"] { color: #f2d15c; }
.frame-clock[data-age="stale"] { color: #ff9f43; }
.frame-clock[data-age="stopped"] { color: var(--err); }

body.dense-grid #grid {
    gap: 2px;
    padding: 0;
}

body.live-page:is(.dense-grid, .has-expanded) {
    grid-template-rows: 1fr;
}

body.live-page:is(.dense-grid, .has-expanded) > .top {
    position: fixed;
    z-index: 100;
    top: var(--system-space-warning-height, 0px);
    left: 0;
    right: 0;
    display: flex;
    background: rgba(11, 13, 16, 0.96);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
    transform: translateY(calc(-100% + 6px));
    transition: transform 420ms cubic-bezier(0.65, 0, 0.35, 1);
}

body.live-page:is(.dense-grid, .has-expanded).toolbar-pinned > .top {
    transform: translateY(0);
}

/* One drawer-tab component. Shell files set dimensions only; neither redraws
   the contour. The body hangs over content, attached to the drawer's edge. */
.top .toolbar-handle {
    position: absolute;
    z-index: 8;
    right: max(8px, env(safe-area-inset-right));
    bottom: calc(-1 * var(--command-handle-height) - 1px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: var(--command-handle-width);
    height: var(--command-handle-height);
    min-height: var(--command-handle-height);
    padding: 0 36px 2px 43px;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    cursor: ns-resize;
    font: inherit;
    font-size: var(--command-handle-font-size);
    letter-spacing: 0.025em;
    text-transform: none;
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
}
.top .toolbar-handle::before {
    content: '';
    position: absolute;
    /* Extend the grip into the drawer edge, keeping the painted tab petite. */
    inset: -8px 0 0;
}
.drawer-tab-contour {
    position: absolute;
    z-index: -1;
    inset: -1px 0 0;
    width: 100%;
    height: calc(100% + 1px);
    overflow: visible;
    pointer-events: none;
}
.drawer-tab-contour path {
    fill: var(--command-drawer-surface);
    stroke: var(--command-drawer-edge);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
}
.top .toolbar-handle:focus-visible {
    outline: none;
}
.top .toolbar-handle:focus-visible path,
.top .toolbar-handle:hover path {
    stroke: var(--accent);
}

.toolbar-alert-summary {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    min-height: 18px;
    padding: 1px 5px;
    color: var(--muted);
    background: rgba(139, 149, 165, 0.12);
    border: 1px solid #465061;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
}

.toolbar-alert-link {
    position: absolute;
    z-index: 9;
    right: max(24px, calc(env(safe-area-inset-right) + 16px));
    bottom: calc(-1 * var(--command-handle-height) + (var(--command-handle-height) - var(--command-alert-size)) / 2 - 1px);
    min-width: var(--command-alert-size);
    min-height: var(--command-alert-size);
    padding: 0 3px;
    font-size: var(--command-handle-font-size);
    color: #e8a7ae;
    background: rgba(184, 69, 80, 0.1);
    border-color: rgba(239, 107, 107, 0.38);
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}
.toolbar-alert-link:hover,
.toolbar-alert-link:focus-visible {
    color: #fff;
    box-shadow: 0 0 0 3px rgba(239, 107, 107, .2), 0 5px 16px rgba(0, 0, 0, .36);
    transform: translateY(-1px);
}

.toolbar-handle-chevron {
    display: inline-block;
    font-size: 10px;
    line-height: 1;
    transition: transform 260ms cubic-bezier(.22, .72, .16, 1), color 150ms ease-out;
}
.toolbar-handle[aria-expanded="true"] .toolbar-handle-chevron { transform: rotate(180deg); }
body.command-drawer-dragging .toolbar-handle {
    color: #fff;
    cursor: grabbing !important;
}
body.command-drawer-dragging .drawer-tab-contour path { stroke: var(--accent); }
body.drawer-will-open .toolbar-handle-chevron { color: var(--live); }
body.drawer-will-close .toolbar-handle-chevron { color: var(--wait); }

body.dense-grid .tile {
    border: 0;
}

body.dense-grid .tile:not(.expanded) .hud {
    padding: 22px 8px 6px;
}

body.dense-grid .tile:not(.expanded) .hud-meta,
body.dense-grid .tile:not(.expanded) .cam-dot,
body.dense-grid .tile:not(.expanded) .rec-dot,
body.dense-grid .tile:not(.expanded):not(:hover):not(:focus-within) .zoom-tools,
body.dense-grid .tile:not(.expanded):not(:hover):not(:focus-within) .rewind-button,
body.dense-grid .tile:not(.expanded):not(:hover):not(:focus-within) .snap {
    display: none;
}

body.dense-grid .tile:not(.expanded) .hud-row {
    gap: 6px;
}

body.dense-grid .tile:not(.expanded) .hud-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hud {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 14px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
    pointer-events: none;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.hud-state-cluster {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin-left: auto;
    white-space: nowrap;
}

.hud-meta {
    margin-top: 4px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.hud-meta-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.stream-choice {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.08em;
    pointer-events: auto;
}

.stream-choice select {
    padding: 3px 6px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.72);
    border: 1px solid var(--line);
    font: inherit;
    font-size: 11px;
    letter-spacing: normal;
}

.tile:not(.expanded) .stream-choice { display: none; }

.live-dot {
    font-size: 11px;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.live-dot[data-state="live"] { color: var(--live); }
.live-dot[data-state="wait"] { color: var(--wait); }
.live-dot[data-state="unstable"] { color: var(--wait); }
.live-dot[data-state="stalled"] { color: var(--err); }
.live-dot[data-state="err"] { color: var(--err); }
.live-dot[data-state="off"] { color: var(--muted); }

.tile-detection-indicators {
    display: inline-flex;
    gap: 3px;
}

.tile-detection-indicators span {
    min-width: 20px;
    padding: 1px 4px;
    color: #667080;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid #414958;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-align: center;
}

.tile-detection-indicators span[data-selected="true"] { color: var(--wait); }
.tile-detection-indicators span[data-active="true"] {
    color: #bfffe0;
    border-color: rgba(61, 214, 140, 0.7);
    box-shadow: 0 0 7px rgba(61, 214, 140, 0.28);
}

.cam-dot,
.rec-dot {
    font-size: 11px;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--muted);
}
.rec-dot { margin-left: auto; }
.rec-dot[data-rec="recording"] { color: var(--err); }
.rec-dot[data-rec="reconnecting"] { color: var(--wait); }
.rec-dot[data-rec="paused"] { color: var(--err); }
.cam-dot[data-cam="on"] { color: var(--live); }
.cam-dot[data-cam="idle"] { color: var(--muted); }
.cam-dot[data-cam="ready"] { color: var(--accent); }
.cam-dot[data-cam="disabled"] { color: var(--muted); }
.cam-dot[data-cam="unstable"] { color: var(--wait); }
.cam-dot[data-cam="off"] { color: var(--err); }

.camera-mode {
    padding: 1px 4px;
    color: var(--live);
    background: rgba(0, 0, 0, 0.45);
    border: 0;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    pointer-events: none;
}

.rewind-button,
.snap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-min-height);
    line-height: 1.2;
    text-align: center;
    touch-action: manipulation;
}

.camera-mode[data-camera-mode-state="off"] { color: var(--muted); }
.camera-mode[data-camera-mode-state="on"] { color: var(--live); }
.camera-mode[data-camera-mode-state="rec"] { color: var(--err); }
.camera-mode[data-camera-mode-state="rec"][data-delivery-state="stopped"] {
    color: var(--wait);
    border-style: dashed;
}
.camera-mode[aria-busy="true"] { opacity: 0.75; }

.snap {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    padding: 4px 8px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--line);
    text-decoration: none;
    font-size: 11px;
    letter-spacing: 0.08em;
    pointer-events: auto;
}

.rewind-button {
    display: none;
    position: absolute;
    z-index: 3;
    top: 10px;
    right: 68px;
    padding: 4px 8px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.62);
    border: 1px solid var(--line);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.tile.expanded .snap,
.tile.expanded .rewind-button { display: inline-flex; }

.rewind-stage {
    position: absolute;
    inset: 0;
    z-index: 5;
    overflow: hidden;
    background: #000;
}

.rewind-stage video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 120ms ease-out;
}

.rewind-return { position: absolute; z-index: 8; bottom: 14px; right: 14px; }
.rewind-status { position: absolute; z-index: 8; left: 14px; bottom: 14px; padding: 4px 7px; background: rgba(0, 0, 0, 0.68); color: var(--text); }
.rewind-stage.is-buffered { background: transparent; pointer-events: none; }
.rewind-stage.is-buffered .rewind-return { pointer-events: auto; }
.rewind-status { max-width: calc(100% - 150px); }

.zoom-tools {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 7;
    display: flex;
    background: rgba(0, 0, 0, 0.62);
    border: 1px solid var(--line);
}

.tile:not(.expanded) .zoom-tools { display: none; }

.zoom-tools button {
    min-width: 32px;
    padding: 5px 7px;
    color: var(--text);
    background: transparent;
    border: 0;
    border-right: 1px solid var(--line);
    cursor: pointer;
}
.zoom-tools button:last-child { border-right: 0; }

.playback-debug-setting { grid-column: 1 / -1; align-items: start; }
.playback-debug-setting span { display: grid; gap: 3px; }
.playback-debug-setting small { color: var(--muted); font-weight: 400; line-height: 1.35; }

.text-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
}

.camera-pad-bank {
    --pad-surface: #111722;
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 12px;
    overflow: visible;
    border: 1px solid #2a3443;
    background:
        radial-gradient(circle at 12% -20%, rgba(83, 146, 255, .13), transparent 38%),
        linear-gradient(145deg, #0d1118, #101620 72%, #0b0f15);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 12px 32px rgba(0, 0, 0, .16);
}

.camera-pad-bank > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.camera-pad-bank > header > div { display: grid; gap: 2px; }
.camera-pad-bank > header strong { color: var(--text); font-size: 13px; letter-spacing: .02em; }
.camera-pad-bank > header small,
.camera-pad-bank > header > span,
.camera-pad-bank > p { color: var(--muted); font-size: 11px; }
.camera-pad-bank > header > span {
    padding: 4px 7px;
    border: 1px solid #303a49;
    background: rgba(4, 7, 11, .48);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.camera-pad-bank > p { margin: 0; }

.camera-pad-grid {
    display: grid;
    grid-template-columns: repeat(var(--camera-pad-columns, 4), minmax(112px, 1fr));
    gap: 9px;
    width: min(100%, calc(var(--camera-pad-columns, 4) * 150px + (var(--camera-pad-columns, 4) - 1) * 9px));
    margin-inline: auto;
}

.camera-pad {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    align-items: center;
    column-gap: 9px;
    min-height: 76px;
    padding: 12px;
    overflow: hidden;
    color: #b7c0ce;
    text-align: left;
    border: 1px solid #303a48;
    border-radius: 12px;
    background: linear-gradient(155deg, #171e29, var(--pad-surface) 62%, #0d1219);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .06),
        inset 0 -7px 16px rgba(0, 0, 0, .22),
        0 3px 8px rgba(0, 0, 0, .28);
    cursor: pointer;
    transition: transform 100ms ease, border-color 140ms ease, color 140ms ease, box-shadow 180ms ease, filter 140ms ease;
}

.camera-pad::before {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(7, 11, 17, .78), rgba(7, 11, 17, .42) 70%, rgba(7, 11, 17, .58)),
        linear-gradient(120deg, rgba(255, 255, 255, .075), transparent 34%, rgba(255, 255, 255, .018) 72%, transparent);
    pointer-events: none;
}

.camera-pad[aria-pressed="true"] {
    color: #f8fcff;
    border-color: hsl(var(--pad-hue) 96% 72% / .92);
    box-shadow:
        inset 0 1px 0 hsl(var(--pad-hue) 100% 92% / .35),
        inset 0 -8px 18px rgba(0, 0, 0, .2),
        0 0 0 1px hsl(var(--pad-hue) 95% 65% / .2),
        0 0 22px hsl(var(--pad-hue) 100% 64% / .34),
        0 8px 22px rgba(0, 0, 0, .35);
}

.camera-pad[aria-pressed="true"]::before {
    background:
        radial-gradient(circle at 20% 10%, hsl(var(--pad-hue) 100% 74% / .28), transparent 54%),
        linear-gradient(90deg, hsl(var(--pad-hue) 65% 10% / .68), rgba(7, 11, 17, .34) 68%, rgba(7, 11, 17, .5)),
        linear-gradient(120deg, rgba(255, 255, 255, .1), transparent 38%, rgba(255, 255, 255, .025) 72%, transparent);
}

.camera-pad-still {
    position: absolute;
    z-index: 0;
    inset: 0;
    overflow: hidden;
    background: linear-gradient(155deg, #171e29, var(--pad-surface) 62%, #0d1219);
    pointer-events: none;
}

.camera-pad-still img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(.36) saturate(.62) contrast(.9) brightness(.68);
    opacity: .72;
}

.camera-pad-still.is-unavailable img { display: none; }

.camera-pad-mosaic {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}
.camera-pad-mosaic > span { min-width: 0; min-height: 0; overflow: hidden; }
.camera-pad-mosaic > span img { display: block; }

.camera-pad-led,
.camera-pad-name,
.camera-pad-state {
    position: relative;
    z-index: 2;
}

.camera-pad:hover:not(.is-limit-blocked) { transform: translateY(-1px); border-color: hsl(var(--pad-hue) 78% 64% / .72); }
.camera-pad:active:not(.is-limit-blocked) { transform: translateY(1px) scale(.985); }
.camera-pad:focus-visible { outline: 2px solid hsl(var(--pad-hue) 100% 76%); outline-offset: 3px; }
.camera-pad.is-limit-blocked { cursor: not-allowed; filter: saturate(.35); opacity: .5; }

.camera-pad-led {
    grid-row: 1 / span 2;
    width: 10px;
    height: 10px;
    border: 1px solid #435062;
    border-radius: 50%;
    background: #252d38;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .8);
}

.camera-pad[aria-pressed="true"] .camera-pad-led {
    border-color: hsl(var(--pad-hue) 100% 88% / .95);
    background: hsl(var(--pad-hue) 100% 72%);
    box-shadow:
        0 0 5px hsl(var(--pad-hue) 100% 78%),
        0 0 15px hsl(var(--pad-hue) 100% 62% / .9),
        0 0 28px hsl(var(--pad-hue) 100% 55% / .42);
}

.camera-pad-name {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.camera-pad-state {
    color: #737f90;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.camera-pad[aria-pressed="true"] .camera-pad-state { color: hsl(var(--pad-hue) 100% 84%); }

@supports (color: oklch(0.5 0.1 240)) {

    .camera-pad[aria-pressed="true"] {
        border-color: oklch(.78 .16 var(--pad-hue) / .92);
        box-shadow:
            inset 0 1px 0 oklch(.94 .07 var(--pad-hue) / .35),
            inset 0 -8px 18px rgba(0, 0, 0, .2),
            0 0 0 1px oklch(.72 .16 var(--pad-hue) / .2),
            0 0 22px oklch(.72 .18 var(--pad-hue) / .34),
            0 8px 22px rgba(0, 0, 0, .35);
    }

    .camera-pad[aria-pressed="true"]::before {
        background:
            radial-gradient(circle at 20% 10%, oklch(.8 .15 var(--pad-hue) / .28), transparent 54%),
            linear-gradient(90deg, oklch(.22 .05 var(--pad-hue) / .68), rgba(7, 11, 17, .34) 68%, rgba(7, 11, 17, .5)),
            linear-gradient(120deg, rgba(255, 255, 255, .1), transparent 38%, rgba(255, 255, 255, .025) 72%, transparent);
    }

    .camera-pad:hover:not(.is-limit-blocked) { border-color: oklch(.72 .13 var(--pad-hue) / .72); }
    .camera-pad:focus-visible { outline-color: oklch(.84 .14 var(--pad-hue)); }
    .camera-pad[aria-pressed="true"] .camera-pad-led {
        border-color: oklch(.9 .09 var(--pad-hue) / .95);
        background: oklch(.78 .16 var(--pad-hue));
        box-shadow:
            0 0 5px oklch(.84 .12 var(--pad-hue)),
            0 0 15px oklch(.72 .18 var(--pad-hue) / .9),
            0 0 28px oklch(.65 .2 var(--pad-hue) / .42);
    }
    .camera-pad[aria-pressed="true"] .camera-pad-state { color: oklch(.88 .09 var(--pad-hue)); }

}

#page-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    align-self: center;
}

.sheet {
    width: min(720px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    padding: 0;
}

.sheet[open] {
    display: flex;
    flex-direction: column;
}

.sheet::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
    margin: 0;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sheet-body {
    min-height: 0;
    padding: 16px;
    overflow: auto;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin: 0 0 16px;
}

.status-grid dt {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.status-grid dd {
    margin: 2px 0 0;
}

.status-cam {
    border-top: 1px solid var(--line);
    padding: 10px 0;
}

.status-cam header {
    display: flex;
    gap: 10px;
    align-items: center;
}

.camera-mode-control {
    margin-left: auto;
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.camera-mode-control [data-camera-mode] {
    min-width: 42px;
    min-height: 32px;
    padding: 4px 7px;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.28);
    border: 0;
    border-left: 1px solid var(--line);
    font: inherit;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.07em;
    cursor: pointer;
}

.camera-mode-control [data-camera-mode]:first-child { border-left: 0; }
.camera-mode-control [aria-pressed="true"][data-camera-mode="off"] { color: var(--text); background: rgba(185, 193, 204, 0.18); }
.camera-mode-control [aria-pressed="true"][data-camera-mode="on"] { color: var(--live); background: rgba(61, 214, 140, 0.14); }
.camera-mode-control [aria-pressed="true"][data-camera-mode="rec"] { color: #ff8f8f; background: rgba(255, 91, 91, 0.15); }
.camera-mode-control [data-camera-mode]:disabled { cursor: progress; opacity: 0.72; }

.status-cam p,
.status-empty,
.hint {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.status-main {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 22px 20px 40px;
    overflow: visible;
}

.status-page {
    height: auto;
    min-height: 100dvh;
    grid-template-rows: auto auto;
}

.status-page-heading { margin-bottom: 16px; }
.status-page-heading h2 { margin: 2px 0; }
.status-page-body {
    padding: 16px;
    background: linear-gradient(145deg, rgba(24, 29, 37, 0.82), rgba(12, 15, 20, 0.94));
    border: 1px solid rgba(122, 162, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(18px) saturate(115%);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.status-page-body:hover,
.status-page-body:focus-within {
    border-color: rgba(122, 162, 255, 0.38);
    box-shadow: 0 20px 62px rgba(0, 0, 0, 0.4), 0 0 26px rgba(122, 162, 255, 0.06);
}

.status-cam[aria-busy="true"] {
    background: linear-gradient(90deg, rgba(122, 162, 255, 0.07), transparent 55%);
}

.status-cam-summary,
.status-detection-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.status-cam-summary span {
    padding: 3px 7px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--line);
    font-size: 11px;
}

.detection-state-toggle {
    min-height: 32px;
    padding: 4px 9px;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line);
    border-radius: 999px;
    font: inherit;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.detection-state-toggle[aria-pressed="true"] { color: var(--wait); }
.detection-state-toggle[data-active="true"] { color: var(--live); border-color: rgba(61, 214, 140, 0.48); }
.status-diagnostics { margin-top: 8px; color: var(--muted); }
.status-diagnostics summary { cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }

.status-error {
    color: var(--wait);
}

.loss-board {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--line);
}

.loss-board h3 {
    margin: 0 0 7px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.loss-leaders {
    display: grid;
    gap: 4px;
    margin: 0;
    padding-left: 24px;
}

.loss-leaders li {
    display: list-item;
    padding-left: 2px;
}

.loss-leaders li span {
    margin-left: 8px;
    color: var(--wait);
    font-variant-numeric: tabular-nums;
}

.delivery-series {
    display: flex;
    align-items: end;
    gap: 2px;
    height: 32px;
    margin-top: 6px;
    padding: 3px 4px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--line);
}

.delivery-series span {
    flex: 1 1 0;
    min-width: 2px;
    background: var(--muted);
}

.delivery-series span[data-state="good"] { background: var(--live); }
.delivery-series span[data-state="warn"] { background: var(--wait); }
.delivery-series span[data-state="bad"] { background: var(--err); }

.status-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 7px;
}

.stream-probe-result {
    color: var(--muted);
    font-size: 12px;
}

.add-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

.add-form .hint,
.add-form .sheet-actions,
.add-form h2,
.add-form .credential-fields {
    grid-column: 1 / -1;
}

.add-form h2 { margin: 0; }

.add-form label {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
}

.add-form input,
.add-form select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    padding: 6px 8px;
    font: inherit;
}

.credential-fields {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
}

.credential-fields legend { color: var(--muted); padding: 0 5px; }
.credential-fields .hint { grid-column: 1 / -1; margin: 0; }

.check-label { display: flex !important; align-items: center; gap: 8px !important; }
.check-label input { width: auto; }

.sheet-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

#now-playing {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.add-main {
    padding: 24px 20px 40px;
    overflow: auto;
}

.action-progress {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 28px;
    max-height: 34px;
    margin: 0 0 16px;
    padding: 0 14px 4px;
    overflow: hidden;
    color: var(--muted);
    background: transparent;
    border: 0;
    transition: color 260ms ease;
}

.action-progress::before {
    display: none;
    content: none;
}

.action-progress::after {
    position: absolute;
    z-index: 0;
    top: auto;
    bottom: 1px;
    left: 0;
    width: 14%;
    height: 3px;
    content: "";
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(16, 167, 255, 0.08) 36%,
        var(--codex-blue) 70%,
        #fff 91%,
        transparent 100%);
    filter: drop-shadow(0 0 3px rgba(214, 245, 255, 0.98)) drop-shadow(0 0 8px rgba(16, 167, 255, 0.9));
    opacity: 0;
    transform: translateX(-120%);
}

.action-progress-text {
    position: relative;
    z-index: 1;
    overflow: hidden;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.035em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-progress[data-state="working"] {
    color: var(--text);
    box-shadow: none;
}

.action-progress[data-state="working"]::after {
    animation: action-flight 1.25s linear infinite;
}

.action-progress[data-state="working"] .action-progress-text {
    text-shadow: 0 1px 3px #061019, 0 0 8px rgba(16, 167, 255, 0.42);
}

.action-progress[data-state="success"] { color: var(--live); }
.action-progress[data-state="warning"] { color: var(--wait); }
.action-progress[data-state="error"] { color: var(--err); }

@keyframes action-flight {
    0%, 3% { opacity: 0; transform: translateX(-120%); }
    4% { opacity: 1; transform: translateX(-100%); }
    26% { opacity: 1; transform: translateX(815%); }
    28%, 100% { opacity: 0; transform: translateX(830%); }
}

.choice-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 920px;
}

.choice {
    text-align: left;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    padding: 28px 24px;
    cursor: pointer;
    min-height: 160px;
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
}

.choice strong {
    display: block;
    font-size: 18px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.choice span {
    color: var(--muted);
    font-size: 14px;
}

.panel {
    width: 100%;
    max-width: 920px;
}

.source-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.source-form h2,
.source-form > .hint,
.source-form > .sheet-actions,
.source-form > .credential-fields {
    grid-column: 1 / -1;
}

.source-form h2 { margin: 0; }

.source-form label {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
}

.source-form input,
.source-form select {
    width: 100%;
    padding: 7px 8px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    font: inherit;
}

.scan-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: start;
    margin-bottom: 12px;
}

.scan-bar .hint {
    flex: 1 1 100%;
}

.scan-methods {
    flex: 1 1 100%;
    border-left: 2px solid var(--line);
    padding-left: 10px;
}

.scan-methods summary {
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.scan-methods label {
    display: grid;
    gap: 6px;
    margin-top: 10px;
    max-width: 620px;
}

.scan-methods input {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
}

.found {
    border: 1px solid var(--line);
    background: var(--panel);
    padding: 12px 14px;
    margin-bottom: 10px;
}

.found header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.found ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--muted);
}

.found .evidence {
    color: var(--text);
    font-size: 13px;
}

.services {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.service {
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    padding: 3px 6px;
}

.found .sheet-actions {
    margin-top: 10px;
    justify-content: flex-start;
}

.found input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    padding: 6px 8px;
    font: inherit;
}

.inline-credentials {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 8px;
    flex: 1 1 420px;
}

.inline-credentials label {
    display: grid;
    gap: 4px;
    color: var(--muted);
}

.inventory-page {
    display: grid;
    gap: 14px;
    align-content: start;
    width: 100%;
    max-width: none;
    min-height: 0;
    padding: 20px;
    overflow: auto;
}

.inventory-heading {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
}

.inventory-heading .sheet-actions {
    flex-wrap: wrap;
}

.inventory-heading h2,
.inventory-page h3 { margin: 0 0 6px; }

#configured-inventory,
#discovered-inventory {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
    gap: 8px;
}

.inventory-card-compact {
    min-width: 0;
    margin: 0;
    padding: 8px 10px;
}

.inventory-card-compact header {
    align-items: center;
}

.inventory-card-compact header > span,
.inventory-state {
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.inventory-state[data-state="online"] { color: var(--live); }
.inventory-state[data-state="reconnecting"] { color: var(--wait); }
.inventory-state[data-state="disabled"] { color: var(--err); }

.inventory-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 12px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.inventory-endpoint,
.inventory-auth {
    margin: 4px 0 0;
    overflow: hidden;
    color: var(--text);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inventory-auth {
    color: var(--muted);
}

.inventory-card-compact .sheet-actions {
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}

.inventory-card-compact .tool-btn {
    min-height: var(--control-min-height);
    padding: 5px 9px;
    font-size: 10px;
}

.inventory-self {
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.inventory-disclosure,
.inventory-activity {
    border-top: 1px solid var(--line);
    padding-top: 9px;
}

.inventory-disclosure summary,
.inventory-activity summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.inventory-disclosure summary::-webkit-details-marker,
.inventory-activity summary::-webkit-details-marker { display: none; }

.inventory-disclosure summary::before,
.inventory-activity summary::before {
    content: "›";
    color: var(--accent);
    font-size: 20px;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 180ms ease, color 180ms ease, filter 180ms ease;
}

.inventory-disclosure[open] > summary::before,
.inventory-activity[open] > summary::before { transform: rotate(90deg); }

.disclosure-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.inventory-disclosure-body { padding-top: 4px; }

.disclosure-attention > summary::before {
    animation: disclosure-hint 760ms ease-out 2;
}

@keyframes disclosure-hint {
    0%, 100% { color: var(--accent); filter: none; }
    42% { color: #fff; filter: drop-shadow(0 0 5px rgba(205, 96, 255, 0.9)); }
}

.activity-row {
    border-left: 3px solid var(--line);
    padding: 8px 12px;
    margin: 8px 0;
    background: var(--bg);
}

.activity-row header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.activity-row header span { color: var(--muted); font-size: 12px; }
.activity-row p { margin: 5px 0 0; }

.credential-grid {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 4px 12px;
    margin: 10px 0;
}

.credential-grid dt { color: var(--muted); }
.credential-grid dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.credential-password { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.error-text { color: var(--err); }

.credential-editor {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(190px, 1fr) auto;
    gap: 8px;
    align-items: end;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.credential-editor[hidden] { display: none !important; }

.inventory-card-compact.credentials-open {
    grid-column: 1 / -1;
    border-color: #394150;
}

.credential-editor label { display: grid; gap: 4px; color: var(--muted); }
.credential-editor input {
    width: 100%;
    color: var(--text);
    background: #0d1015;
    border: 1px solid var(--line);
    padding: 7px 8px;
}

.credential-editor .credential-message { grid-column: 1 / -1; }

.recorder-import {
    display: grid;
    grid-template-columns: minmax(100px, 0.35fr) minmax(140px, 0.5fr) minmax(190px, 0.7fr);
    gap: 8px;
    align-items: end;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.recorder-import label { display: grid; gap: 4px; color: var(--muted); }
.recorder-import > .hint,
.recorder-import > .sheet-actions { grid-column: 1 / -1; }

.camera-preview {
    margin-top: 10px;
    max-width: 640px;
    background: #000;
    border: 1px solid var(--line);
}

.camera-preview img { display: block; max-width: 100%; max-height: 360px; margin: auto; }

.settings-main { padding: 20px; overflow: auto; }

#settings-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    max-width: 980px;
    margin-inline: auto;
}

.settings-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-content: start;
    gap: 12px 16px;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .13);
}

.settings-card > header,
.settings-card > .hint,
.settings-card > .check-label,
.zone-editor,
.hardware-card > div,
.hardware-card > button {
    grid-column: 1 / -1;
}

.settings-card > header { display: flex; justify-content: space-between; gap: 12px; }
.settings-card h2 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; }
.settings-card header span { color: var(--muted); }
.settings-card label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.settings-card input,
.settings-card select,
.zone-row input {
    background: var(--bg); color: var(--text); border: 1px solid var(--line); padding: 7px 8px; font: inherit;
}
.settings-card small { color: var(--muted); }

.detection-master-controls,
.detection-tuning { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; grid-column: 1 / -1; }
.detection-master-controls { padding: 10px 12px; background: rgba(255, 255, 255, .025); border: 1px solid var(--line); border-radius: 9px; }
.detection-camera-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    grid-column: 1 / -1;
}
.detection-camera-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 10px;
    align-items: center;
    padding: 9px;
    background: rgba(0, 0, 0, .24);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.detection-camera-card[data-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(122, 162, 255, .2); }
.detection-camera-choice {
    display: grid !important;
    grid-template-columns: auto 112px minmax(0, 1fr);
    gap: 9px !important;
    align-items: center;
    min-width: 0;
    color: var(--text) !important;
    cursor: pointer;
}
.detection-camera-choice > input { width: auto; }
.detection-camera-still {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #05070a;
    border: 1px solid #303846;
    border-radius: 7px;
}
.detection-camera-still img { width: 100%; height: 100%; object-fit: cover; }
.detection-camera-still.is-unavailable::after { content: "No still"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.detection-camera-still.is-unavailable img { display: none; }
.detection-camera-copy { display: grid; gap: 3px; min-width: 0; }
.detection-camera-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detection-camera-copy small { color: var(--muted); }
.detection-camera-badges { display: flex; gap: 4px; margin-top: 2px; }
.detection-camera-badges i {
    min-width: 22px;
    padding: 1px 5px;
    color: #667080;
    border: 1px solid #3d4655;
    border-radius: 999px;
    font-size: 8px;
    font-style: normal;
    font-weight: 800;
    text-align: center;
}
.detection-camera-badges i[data-enabled="true"] { color: var(--live); border-color: rgba(61, 214, 140, .55); }
.detection-confidence { min-width: 0; }
.detection-selection-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
    grid-column: 1 / -1;
}
.detection-selection-actions > span { margin-right: auto; color: var(--muted); font-size: 11px; }
.settings-disclosure { grid-column: 1 / -1; padding: 10px 0; border-top: 1px solid var(--line); }
.settings-disclosure summary { cursor: pointer; color: var(--text); font-weight: 650; }
.detection-tuning { margin-top: 12px; }
.detection-settings > .profile-summary { grid-column: 1 / -1; }

.backup-settings > * { grid-column: 1 / -1; }
.backup-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.backup-toolbar > span { color: var(--muted); font-size: 11px; text-decoration: underline dotted; text-underline-offset: 3px; }
.backup-list { display: grid; gap: 7px; }
.backup-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 9px 10px;
    background: rgba(0, 0, 0, .22);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.backup-row > div:first-child { display: grid; gap: 2px; }
.backup-row span { color: var(--muted); font-size: 10px; }
.backup-actions { display: flex; gap: 6px; }


.auth-page {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    place-items: center;
}

.auth-card {
    width: min(430px, 100%);
    padding: clamp(22px, 6vw, 38px);
    background: var(--panel);
    border: 1px solid var(--line);
}

.auth-card h1 { margin: 0; font-size: clamp(21px, 6vw, 28px); }
.auth-card header p,
.auth-hint { color: var(--muted); line-height: 1.45; }
.auth-card form,
.auth-card label { display: grid; gap: 8px; }
.auth-card form { gap: 16px; margin-top: 24px; }
.auth-card label { color: var(--muted); font-size: 13px; }
.auth-card input {
    width: 100%;
    min-height: 46px;
    padding: 9px 11px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    font: inherit;
    font-size: 16px;
}
.auth-card .auth-remember {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text);
}
.auth-card .auth-remember input {
    width: auto;
    min-height: 0;
    margin-top: 3px;
}
.auth-card .auth-remember span { display: grid; gap: 3px; }
.auth-card .auth-remember small { color: var(--muted); line-height: 1.4; }
.auth-message { min-height: 1.4em; margin: 0; color: var(--wait); }
.form-field-error {
    display: block;
    color: var(--wait);
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.auth-hint { margin: 0; font-size: 12px; }
.auth-card .tool-btn { min-height: var(--control-min-height); }

@media (prefers-reduced-motion: reduce) {

    *,
*::before,
*::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
    body.live-page > .top,
.account-chevron {
        transition-duration: 1ms;
    }
    .action-progress[data-state="working"]::before,
.action-progress[data-state="working"]::after {
        animation: none;
    }
    .action-progress[data-state="working"]::before {
        opacity: 0.16;
        -webkit-mask: none;
        mask: none;
    }
    .action-progress[data-state="working"]::after {
        display: none;
    }
    .camera-pad { transition-duration: 1ms; }

}

.alerts-main {
    overflow: auto;
    padding: clamp(16px, 3vw, 36px);
}

.camera-editor-main {
    overflow: auto;
    padding: clamp(16px, 2.5vw, 34px);
    padding-top: clamp(16px, 2.5vw, 20px);
}

.camera-editor-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    max-width: 1580px;
    margin: 0 auto 20px;
}
.camera-editor-heading h2 { margin: 3px 0; font-size: clamp(28px, 4vw, 46px); }
.camera-editor-heading .text-link { display: inline-block; margin-bottom: 12px; }

.camera-editor-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    align-items: start;
    gap: clamp(18px, 2.5vw, 34px);
    max-width: 1580px;
    margin: auto;
}

.camera-preview-panel {
    position: sticky;
    top: 18px;
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    background: linear-gradient(160deg, #171b21, #0d1014);
}
.camera-preview-stage {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid #3a4352;
    background: #030405;
    cursor: grab;
    touch-action: none;
}
.camera-preview-stage.is-dragging { cursor: grabbing; }
.camera-preview-stage camera-live-preview,
.camera-preview-stage camera-live-preview video,
.camera-preview-stage img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    transition: transform 100ms ease-out;
    will-change: transform;
}
.camera-preview-stage camera-live-preview { position: absolute; inset: 0; }
.camera-preview-stage [hidden] { display: none; }
.camera-preview-stage.is-dragging camera-live-preview video,
.camera-preview-stage.is-dragging img { transition: none; }
.camera-preview-empty { position: absolute; inset: 0; display: grid; place-content: center; padding: 28px; color: var(--muted); text-align: center; }
.camera-preview-crosshair { position: absolute; inset: 50% auto auto 50%; z-index: 2; width: 22px; height: 22px; border: 1px solid rgba(255,255,255,.48); border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.camera-preview-crosshair::before,
.camera-preview-crosshair::after { content: ""; position: absolute; background: rgba(255,255,255,.48); }
.camera-preview-crosshair::before { left: 50%; top: -7px; width: 1px; height: 34px; }
.camera-preview-crosshair::after { top: 50%; left: -7px; width: 34px; height: 1px; }
.camera-preview-drag-hint { position: absolute; z-index: 2; left: 8px; bottom: 8px; padding: 5px 7px; background: rgba(0,0,0,.72); color: #dfe7f1; font-size: 10px; letter-spacing: .04em; pointer-events: none; }
.camera-preview-readout { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.camera-preview-readout strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.camera-preview-readout span { color: var(--muted); text-align: right; }

.camera-editor-form { display: grid; gap: 12px; min-width: 0; }
.editor-block { overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.editor-block > summary { font-size:16px; font-weight:750; display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 15px 17px; cursor: pointer; list-style-position: inside; }
.editor-block > summary span { font-size:inherit; font-weight:inherit; }
.editor-block > summary small { color: var(--muted); text-align: right; }
.editor-block[open] > summary { border-bottom: 1px solid var(--line); background: rgba(122,162,255,.045); }
.editor-block-body { padding: 17px; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.editor-grid label,
.stream-block label,
.orientation-controls > label { display: grid; align-content: start; gap: 6px; color: var(--muted); }
.editor-span-2 { grid-column: 1 / -1; }
.editor-block .credential-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.editor-block .credential-fields .hint { grid-column: 1 / -1; margin: 0; }

.stream-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.stream-block { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 12px; margin: 0; padding: 15px; border: 1px solid #303744; background: #0e1115; }
.stream-block input,
.stream-block select { width: 100%; min-width: 0; }
.stream-block legend { display: flex; align-items: baseline; gap: 8px; padding: 0 7px; color: var(--text); }
.stream-block legend span { font-weight: 750; }
.stream-block legend small { color: var(--muted); }
.stream-path,
.stream-wide { grid-column: 1 / -1; }
.primary-stream { border-top: 3px solid var(--accent); }
.secondary-stream { border-top: 3px solid #56c9b1; }

.orientation-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.orientation-presets .is-selected { color: #fff; border-color: var(--accent); box-shadow: 0 0 0 1px rgba(122,162,255,.22); }
.orientation-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 14px; }
.orientation-controls input[type="range"] { width: 100%; accent-color: var(--accent); }
.orientation-controls output { color: var(--text); font-variant-numeric: tabular-nums; }
.orientation-toggle { display: flex !important; grid-template-columns: auto 1fr; align-items: center; min-height: 42px; padding: 8px 10px; border: 1px solid #303744; background: #0e1115; color: var(--text) !important; }
.input-with-unit { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; border:1px solid #3a4352; border-radius:8px; background:#0d1014; overflow:hidden; }
.input-with-unit:focus-within { outline:2px solid var(--accent); outline-offset:2px; }
.input-with-unit > input { border:0; background:transparent; border-radius:0; min-width:0; }
.input-with-unit > input:focus-visible { outline:none; box-shadow:none; }
.input-with-unit > span { align-self: stretch; display: grid; place-items: center; padding: 0 10px; border:0; color:var(--muted); background:transparent; }
.orientation-note { display: grid; gap: 4px; margin: 15px 0; padding: 12px; border-left: 3px solid var(--wait); background: rgba(224,179,74,.06); color: var(--muted); }
.orientation-note strong { color: var(--text); }
.recording-pipeline-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0 15px; padding: 14px; border: 1px solid #303744; background: #0e1115; }
.recording-pipeline-picker legend { padding: 0 7px; color: var(--text); font-weight: 750; }
.recording-pipeline-choice { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; padding: 12px; border: 1px solid #303744; background: rgba(255,255,255,.018); cursor: pointer; }
.recording-pipeline-choice:has(input:checked) { border-color: var(--accent); background: rgba(122,162,255,.075); box-shadow: 0 0 18px rgba(122,162,255,.08); }
.recording-pipeline-choice:has(input:disabled) { opacity: .48; cursor: not-allowed; }
.recording-pipeline-choice span { display: grid; gap: 4px; }
.recording-pipeline-choice small { color: var(--muted); line-height: 1.35; }
.recording-clock-option,
.recording-pipeline-picker > .hint { grid-column: 1 / -1; margin: 0; }

.camera-zone-editor { display: grid; gap: 12px; }
.detection-area-explainer { margin: 0; color: var(--muted); line-height: 1.45; }
.detection-area-explainer strong { color: var(--text); }
.camera-zone-preview {
    position: relative;
    width: min(720px, 100%);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #05070a;
    border: 1px solid #303744;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
}
.camera-zone-preview > img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; user-select: none; }
.camera-zone-preview > span { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.camera-zone-preview > span[hidden],
.camera-zone-preview > img[hidden] { display: none; }
#camera-zone-overlays { position: absolute; inset: 0; pointer-events: none; }
.camera-zone-overlay { position: absolute; box-sizing: border-box; min-width: 12px; min-height: 12px; overflow: visible; border: 2px solid var(--accent); background: rgba(122, 162, 255, .2); color: #fff; cursor: move; pointer-events: auto; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.camera-zone-overlay-label { position: absolute; top: 2px; left: 3px; max-width: calc(100% - 8px); overflow: hidden; color: #fff; font-size: 11px; font-weight: 750; line-height: 1.2; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; white-space: nowrap; pointer-events: none; }
.camera-zone-resize-handle { position: absolute; right: -7px; bottom: -7px; width: 18px; height: 18px; border: 2px solid #06101d; border-radius: 3px; background: var(--accent); cursor: nwse-resize; pointer-events: auto; }
.camera-zone-preview[data-zone-mode="move"] { cursor: move; }
.camera-zone-preview[data-zone-mode="resize"] { cursor: nwse-resize; }
.camera-zone-list { display: grid; gap: 8px; }
.zone-row { display: grid; grid-template-columns: minmax(130px, 1.5fr) repeat(4, minmax(65px, .7fr)) auto; gap: 8px; align-items: end; }
.zone-row label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.zone-row input { width: 100%; min-width: 0; }
.camera-zone-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.camera-zone-actions .compact-btn.is-active { border-color: var(--accent); background: rgba(122,162,255,.16); color: #fff; }
.camera-zone-coordinates { border-top: 1px solid #303744; padding-top: 10px; }
.camera-zone-coordinates > summary { color: var(--muted); cursor: pointer; font-size: 12px; }
.camera-zone-coordinates[open] > summary { margin-bottom: 10px; }
.camera-zone-editor > .hint { margin: 0; }

.capability-editor { display: grid; grid-template-columns: minmax(260px, 1fr) auto; align-items: start; gap: 14px; }
.capability-audio { display: grid; gap: 5px; }
.experimental-control-picker { display: grid; grid-column: 1 / -1; gap: 9px; margin: 0; padding: 12px; border: 1px solid #303744; background: #0e1115; }
.experimental-control-picker legend { padding: 0 7px; color: var(--text); font-weight: 750; }
.experimental-control-picker .check-label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 7px 9px; }
.experimental-control-picker .check-label small { grid-column: 2; color: var(--muted); line-height: 1.35; }
.capability-editor > .hint,
.capability-editor > .ptz-controls { grid-column: 1 / -1; }
.ptz-controls { display: grid; grid-template-columns: repeat(5, minmax(54px, auto)); align-items: end; gap: 8px; }
.ptz-controls[hidden] { display: none; }
.ptz-preset { display: grid; gap: 4px; min-width: 150px; color: var(--muted); font-size: 12px; }

.camera-editor-actions { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 15px; border: 1px solid #343b48; background: rgba(13,16,20,.96); backdrop-filter: blur(12px); }
.camera-editor-actions .hint { margin: 0; }

.alerts-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto 20px;
}

.alerts-heading h2 { margin: 2px 0 4px; font-size: clamp(28px, 4vw, 48px); }
.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: 0.14em; text-transform: uppercase; }

.alert-counts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.alert-counts span {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--muted);
    white-space: nowrap;
}
.alert-counts strong { color: var(--text); font-size: 18px; }
.alert-counts [data-state="new"] { border-color: rgba(224, 179, 74, 0.45); }

.alert-filters {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 1400px;
    margin: 0 auto 18px;
    padding: 12px;
    border: 1px solid var(--line);
    background: rgba(18, 21, 26, 0.82);
}
.alert-filters label { display: grid; gap: 5px; min-width: 180px; color: var(--muted); }
.alert-filters .hint { margin: 0 0 8px auto; }

.alert-list { display: grid; gap: 14px; max-width: 1400px; margin: auto; }
.alert-card {
    display: grid;
    grid-template-columns: minmax(260px, 38%) minmax(0, 1fr);
    min-height: 230px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-left: 4px solid var(--wait);
    background: linear-gradient(135deg, #15191f, #0f1216);
}
.alert-card[data-alert-state="acknowledged"] { border-left-color: var(--live); }
.alert-card[data-alert-state="dismissed"] { border-left-color: #606978; opacity: 0.8; }
.alert-snapshot { min-height: 230px; overflow: hidden; background: #050607; }
.alert-snapshot img { display: block; width: 100%; height: 100%; min-height: 230px; object-fit: cover; }
.alert-no-snapshot { display: grid; place-content: center; gap: 5px; height: 100%; padding: 24px; color: var(--muted); text-align: center; }
.alert-no-snapshot span { color: var(--text); font-weight: 700; }
.alert-copy { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.alert-copy header { display: flex; justify-content: space-between; gap: 16px; }
.alert-copy h3 { margin: 3px 0 0; font-size: 24px; }
.alert-copy time { color: var(--muted); font-variant-numeric: tabular-nums; }
.alert-state { align-self: start; padding: 5px 8px; border: 1px solid currentColor; color: var(--wait); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.alert-state[data-state="acknowledged"] { color: var(--live); }
.alert-state[data-state="dismissed"] { color: var(--muted); }
.alert-note { flex: 1; margin: 0; font-size: 16px; }
.alert-note.muted { color: var(--muted); }
.alert-actions {  flex-wrap: wrap; }
.alerts-empty { display: grid; gap: 6px; place-items: center; min-height: 260px; padding: 36px; border: 1px dashed #3a4352; color: var(--muted); text-align: center; }
.alerts-empty strong { color: var(--text); font-size: 22px; }

/* Unified application chrome: one compact brand/session line, navigation,
   full-width action beam, then the optional recorder detail strip. */
.top {
    position: relative;
    z-index: 100;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 4px 12px;
    width: 100%;
    padding: 8px var(--chrome-inline-pad) 7px;
    background: rgba(11, 13, 16, 0.96);
    border-bottom: 1px solid rgba(87, 105, 128, 0.24);
}

body.header-pinned:not(.live-page) > .top {
    position: sticky;
    top: var(--system-space-warning-height, 0px);
    backdrop-filter: blur(22px) saturate(1.2);
    -webkit-backdrop-filter: blur(22px) saturate(1.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
}

/* Non-live controls begin pinned. Unpinning preserves the bottom action beam
   as a compact, sticky status dock instead of throwing work feedback away. */
body.header-collapsed:not(.live-page) > .top {
    position: fixed;
    top: var(--system-space-warning-height, 0px);
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
    padding: 8px var(--chrome-inline-pad) 7px;
    overflow: visible;
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    transform: translateY(calc(-100% + var(--command-beam-height, 26px)));
    transition: transform 240ms cubic-bezier(.18, .82, .24, 1.02);
}

.top-brand,
.top > div:first-child {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.top h1 {
    grid-column: 1;
    grid-row: 1;
    display: inline-flex;
    align-items: baseline;
    margin: 0;
    color: #f2f7fc;
    font-size: 18px;
    font-weight: 720;
    letter-spacing: -0.035em;
    line-height: 1;
    text-transform: none;
}

.brand-name {
    position: relative;
    display: inline-flex;
    white-space: nowrap;
}
.brand-cams { color: var(--codex-blue-soft); }

.brand-name.is-classy-shimmer {
    animation: classy-brand-glow 1050ms ease-out both;
}

.brand-name.is-classy-shimmer::after {
    position: absolute;
    inset: -4px -8px;
    content: "";
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.07) 43%, rgba(150, 225, 255, 0.62) 50%, rgba(255, 255, 255, 0.08) 57%, transparent 70%);
    border-radius: 8px;
    mix-blend-mode: screen;
    pointer-events: none;
    transform: translateX(-115%);
    animation: classy-brand-sweep 1050ms cubic-bezier(.2, .72, .2, 1) both;
}

@keyframes classy-brand-sweep {
    0% { opacity: 0; transform: translateX(-115%); }
    18% { opacity: 0.75; }
    72% { opacity: 0.55; }
    100% { opacity: 0; transform: translateX(115%); }
}

@keyframes classy-brand-glow {
    0%, 100% { filter: none; }
    48% { filter: drop-shadow(0 0 5px rgba(107, 213, 255, 0.28)); }
}

@media (prefers-reduced-motion: reduce) {

    .brand-name.is-classy-shimmer,
.brand-name.is-classy-shimmer::after { animation: none; }
    .brand-name.is-classy-shimmer::after { display: none; }

}

.brand-version {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    margin-left: 8px;
    color: #738093;
    font-size: 9px;
    letter-spacing: 0.04em;
}

.top nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    gap: clamp(10px, 2vw, 18px);
    width: 100%;
    min-width: 0;
    margin: 7px 0 0;
    padding: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.top nav::-webkit-scrollbar { display: none; }

.top nav a {
    position: relative;
    isolation: isolate;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 0;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color 120ms ease-out, transform 90ms ease-out;
}

.top nav a::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 50%;
    right: -6px;
    left: -6px;
    height: 25px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    transform: translateY(-50%) scale(.94);
    opacity: 0;
    transition: opacity 90ms ease-out, transform 90ms ease-out;
}

.top nav a:hover {
    color: var(--text);
}

.top nav a:active {
    color: #fff;
    transform: translateY(1px);
}

.top nav a:active::before {
    background: color-mix(in oklch, var(--codex-blue) 18%, var(--surface-raised));
    border-color: color-mix(in oklch, var(--codex-blue) 42%, var(--line));
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .42);
    transform: translateY(-50%) scale(1);
    opacity: 1;
}

.top nav a[aria-current="page"] {
    color: var(--text);
}

.header-session-actions {
    grid-column: 2;
    grid-row: 1;
    /* Session menus must clear the attached Controls handle (layer 8). */
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
    height: 28px;
}

.top-right {
    grid-column: 1 / -1;
    grid-row: 3;
    display: block;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

/* This Live action is shared at every width and reconnects browser views only. */
.top-right:has(.live-refresh) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
}
.top-right:has(.live-refresh) .health-drawer { grid-column: 1 / -1; grid-row: 1; }
.top-right:has(.live-refresh) .health-drawer > summary { min-height: 34px; margin-right: 110px; }
.top-right > .live-refresh { grid-column: 2; grid-row: 1; }
.live-refresh { min-height: 30px; font-size: 11px; white-space: nowrap; }

.header-session-actions .account-menu,
.header-session-actions .collaboration-shell,
.header-session-actions .toolbar-pin {
    flex: 0 0 auto;
    align-self: center;
    margin: 0;
}

.account-summary {
    min-height: 28px;
    max-width: min(190px, 32vw);
    padding: 0 1px 0 5px;
    color: #aab6c6;
    font-size: 11px;
}

.account-username { max-width: min(150px, 24vw); }
.account-color { width: 8px; height: 8px; }

/* A pin through the drawer lip. The 44px hit area has no painted button. */
.ui-glyph { width:20px; height:20px; flex:none; pointer-events:none; }
.top nav a.nav-settings { display:inline-flex; align-items:center; justify-content:center; min-width:28px; padding-inline:6px; }
.top nav a.nav-settings .ui-glyph { width:18px; height:18px; }
.drawer-pin { display:inline-grid; place-items:center; width:36px; height:44px; min-height:44px; padding:0;
    border:0; border-radius:0; background:none; color:var(--muted); box-shadow:none; cursor:pointer; touch-action:manipulation; }
.drawer-pin .ui-glyph { width:19px; height:24px; fill:none; transform:rotate(-32deg) translateY(-2px); transition:transform 150ms ease,color 150ms ease; }
.drawer-pin[aria-pressed="true"] { color:var(--accent); }
.drawer-pin[aria-pressed="true"] .ui-glyph { transform:rotate(0) translateY(2px); }
.drawer-pin:hover { color:var(--text); }
.drawer-pin:focus-visible { outline:2px solid var(--focus,var(--accent)); outline-offset:-5px; border-radius:6px; }
.top > .toolbar-pin.drawer-pin { position:absolute; z-index:10;
    right:calc(max(8px, env(safe-area-inset-right)) + var(--command-handle-width) - 47px);
    bottom:calc(-1 * var(--command-handle-height) - 1px); display:inline-grid;
    width:44px; height:44px; min-height:44px; padding:0; border:0; background:none; box-shadow:none; }
.top > .toolbar-pin.drawer-pin svg { width:19px; height:24px; fill:none; }
@media (prefers-reduced-motion:reduce) { .drawer-pin .ui-glyph { transition:none; } }

/* Room stays in one place. Its panel is viewport-fixed so opening it cannot
   reflow the header or consume camera-grid height. */
.collaboration-shell,
.collaboration-shell:not([open]),
.collaboration-shell[open] {
    position: relative;
    z-index: 510;
    order: initial;
    width: auto;
    margin: 0;
}

.collaboration-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 28px;
    padding: 0 7px;
    color: #f7fcff;
    background: linear-gradient(135deg, #087fda, var(--codex-blue));
    border: 0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(16, 167, 255, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.01em;
    text-transform: none;
}

.collaboration-count:hover,
.collaboration-count:focus-visible {
    color: #fff;
    background: linear-gradient(135deg, #1297ee, #33baff);
    outline: 2px solid rgba(107, 213, 255, 0.5);
    outline-offset: 2px;
}

.collaboration-icon { display: inline-grid; place-items: center; }
.collaboration-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.collaboration-count strong {
    min-width: 17px;
    min-height: 17px;
    padding: 0 4px;
    color: #eaf8ff;
    background: rgba(0, 24, 44, 0.4);
    border-radius: 999px;
    font-size: 9px;
}

.collaboration-panel {
    position: fixed;
    z-index: 500;
    top: var(--room-panel-top, 54px);
    right: var(--room-panel-right, 14px);
    display: grid;
    grid-template-rows: auto auto auto minmax(120px, 1fr) auto auto;
    width: min(410px, calc(100vw - 24px));
    height: min(520px, calc(100dvh - var(--room-panel-top, 54px) - 12px));
    min-height: 300px;
    margin: 0;
    overflow: hidden;
    color: var(--text);
    background:
        linear-gradient(145deg, rgba(41, 63, 84, 0.72), rgba(9, 18, 29, 0.82) 42%, rgba(14, 20, 31, 0.88)),
        rgba(12, 19, 28, 0.74);
    border: 1px solid rgba(151, 213, 255, 0.28);
    border-radius: 16px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.64), inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 0 30px rgba(16, 167, 255, 0.1);
    backdrop-filter: blur(28px) saturate(1.45);
    -webkit-backdrop-filter: blur(28px) saturate(1.45);
}

.collaboration-panel > header { background: linear-gradient(90deg, rgba(16, 167, 255, 0.16), transparent); }
.collaboration-panel > hr,
.collaboration-chat { border-color: rgba(151, 213, 255, 0.16); }
.collaboration-chat input { background: rgba(2, 9, 16, 0.54); border-color: rgba(151, 213, 255, 0.24); }
.collaboration-chat button { background: var(--codex-blue); border: 0; color: #fff; }

/* One stable, viewport-wide beam directly below the navigation. */
.global-action-progress {
    grid-column: 1 / -1;
    grid-row: 2;
    position: relative;
    left: 0;
    display: flex;
    width: calc(100% + (2 * var(--chrome-inline-pad)));
    min-height: 20px;
    max-height: 22px;
    margin: 0 0 0 calc(0px - var(--chrome-inline-pad));
    padding: 0 max(14px, env(safe-area-inset-left)) 3px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.global-action-progress .action-progress-text {
    color: #9daabd;
    font-size: 9px;
    font-weight: 600;
}

.global-action-progress[data-state="working"] .action-progress-text { color: #eef9ff; }

body.live-page:is(.dense-grid, .has-expanded) > .top,
body.live-page > .top {
    display: grid;
}

/* Explicit drawer state owns visibility for every Live grid shape. */
body.live-page.toolbar-pinned > .top,
body.live-page:is(.dense-grid, .has-expanded).toolbar-pinned > .top,
body.live-page.action-in-progress > .top,
body.live-page:is(.dense-grid, .has-expanded).action-in-progress > .top {
    transform: translateY(0);
}

/* Operational UI: one compact control language, camera work in Status. */
.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;
}

.compact-toggle,
.icon-btn {
    min-height: 34px;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
}

.compact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 5px 10px;
    color: var(--text);
    background: rgba(0, 0, 0, .28);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    text-decoration: none;
    cursor: pointer;
}
.compact-btn.primary,
.icon-btn.primary { color: #fff; background: var(--accent); border-color: transparent; }
.compact-btn:disabled,
.icon-btn:disabled { opacity: .5; cursor: not-allowed; }
.compact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.compact-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 720;
}

.compact-toggle small { color: var(--muted); font-size: 9px; letter-spacing: .06em; }
.compact-toggle[aria-pressed="true"] { color: var(--live); border-color: rgba(61, 214, 140, .45); }
.icon-btn { display: inline-grid; width: 34px; padding: 0; place-items: center; font-size: 20px; line-height: 1; }

.status-page-body { padding: 12px; }
.status-operations-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 2px 0 12px;
}
.status-operations-head > div { display: grid; gap: 2px; }
.status-operations-head > div span { color: var(--muted); font-size: 11px; }
.status-select-all { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.status-select-all input,
.status-camera-select input,
.alert-state-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }

.status-bulk-toolbar {
    position: sticky;
    z-index: 5;
    top: 8px;
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    color: var(--text);
    background: rgba(18, 27, 40, .94);
    border: 1px solid rgba(122, 162, 255, .35);
    border-radius: 10px;
    backdrop-filter: blur(18px);
}
.status-bulk-toolbar[hidden] { display: none; }
.status-bulk-toolbar select { min-width: 0; min-height: 36px; color: var(--text); background: var(--bg); border: 1px solid var(--line); }

.status-system-details { margin-bottom: 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.status-system-details > summary,
.status-diagnostics > summary {
    min-height: 34px;
    padding: 9px 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    cursor: pointer;
}
.status-system-details[open] > summary { color: var(--text); }
.status-system-details .status-grid { padding-top: 4px; }
.system-health-groups { display: grid; gap: 12px; padding: 4px 0 12px; }
.system-health-group { min-width: 0; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.system-health-group h3 { margin: 0 0 10px; font-size: 13px; }
.system-health-group dl { display: grid; gap: 10px; margin: 0; }
.system-health-group dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 12px; }
.system-health-group dt { color: var(--muted); font-size: 12px; }
.system-health-group dd { margin: 0; font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.system-health-group dd[data-thermal-state="overheating"] { color: var(--err); font-weight: 600; }
.system-health-group dd[data-thermal-state="hot"] { color: var(--wait); font-weight: 600; }
.system-health-issue { padding: 10px 12px; color: #ffc7aa; background: #372117; border-left: 3px solid var(--wait); }
.system-health-issue[hidden] { display: none; }
.status-technical > summary { padding: 8px 0; color: var(--muted); font-size: 12px; cursor: pointer; }

.status-camera-list { display: grid; gap: 8px; }
.status-cam {
    display: grid;
    grid-template-columns: auto 128px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 9px;
    background: rgba(0, 0, 0, .18);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.status-cam.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-wash); }
.status-camera-select { display: grid; min-height: 72px; place-items: center; cursor: pointer; }
.status-camera-still {
    position: relative;
    aspect-ratio: 16 / 9;
    width: 128px;
    margin: 0;
    overflow: hidden;
    background: #05070a;
    border: 1px solid #303846;
    border-radius: 8px;
}
.status-camera-still img { display: block; width: 100%; height: 100%; object-fit: cover; }
.status-camera-still.is-unavailable::after { content: "Still unavailable"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 9px; }
.status-camera-still.is-unavailable img { display: none; }
.status-camera-content { min-width: 0; }
.status-camera-content > header { min-height: 34px; }
.status-camera-content > header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status-detection-controls { align-items: stretch; }
.status-detector-control {
    display: inline-grid;
    grid-template-columns: minmax(92px, auto) auto;
    gap: 5px;
}
.detection-state-toggle.compact-toggle { border-radius: 8px; }
.alert-state-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 34px;
    padding: 5px 8px;
    color: var(--text);
    background: rgba(0, 0, 0, .2);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 10px;
    cursor: pointer;
}
.alert-state-toggle.is-disabled { color: var(--muted); opacity: .52; cursor: default; }
.status-cam-summary [data-tone="warn"] { color: var(--wait); border-color: rgba(224, 179, 74, .35); }
.status-diagnostics { margin-top: 4px; }
.status-diagnostics p { font-size: 11px; }

.settings-page,
.settings-main,
#settings-form { min-width: 0; max-width: 100%; }
.settings-main { overflow-x: clip; overflow-y: visible; }
#settings-form { gap: 10px; max-width: 900px; }
.settings-card-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    padding: 0 14px 14px;
    border-top: 1px solid var(--line);
}
.settings-card-body > * { min-width: 0; }
.settings-card-body > .profile-summary,
.settings-card-body > .hint,
.settings-card-body > .check-label,
.settings-card-body > .storage-path-label,
.settings-card-body > .detection-tuning,
.settings-card-body > .hardware-card,
.settings-card-body > .backup-toolbar,
.settings-card-body > .backup-list { grid-column: 1 / -1; }
.settings-card-body > .recording-delete-tool { grid-column: 1 / -1; }
.settings-card-body > .secondary-storage-tool { grid-column: 1 / -1; }
.settings-card-body-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-card-body label { padding-top: 12px; }
.storage-path-label output {
    display: block;
    min-width: 0;
    padding: 9px 10px;
    overflow-wrap: anywhere;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 7px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.storage-path-label small { line-height: 1.4; }
.secondary-storage-tool { display: grid; gap: 9px; margin-top: 4px; padding: 11px 0 2px; border-top: 1px solid var(--line); }
.secondary-storage-tool > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.secondary-storage-tool > header span,
.secondary-storage-tool > small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.secondary-storage-tool > .check-label { padding-top: 3px; }
.secondary-storage-tool > p { margin: 0; }
.secondary-path-label { display: grid; gap: 5px; padding-top: 0 !important; }
.secondary-path-label input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.secondary-storage-limits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.secondary-storage-limits label { padding-top: 0; }
.hardware-card { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 10px 12px; align-items: end; padding-top: 12px; border-top: 1px solid var(--line); }
.settings-card-body .hardware-card > #hardware-summary {
    display: grid;
    grid-column: 1 / -1;
    gap: 3px;
    overflow-wrap: anywhere;
}
.settings-card-body .hardware-card > #hardware-summary span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.settings-card-body .hardware-card > label { grid-column: 1; min-width: 0; padding-top: 0; }
.settings-card-body .hardware-card > label select { width: 100%; min-width: 0; max-width: 100%; }
.settings-card-body .hardware-card > button { grid-column: 2; align-self: end; min-height: 38px; white-space: nowrap; }
.settings-card-body .hardware-card > p { grid-column: 1 / -1; }
.backup-settings .settings-card-body > * { grid-column: 1 / -1; }
.backup-toolbar { justify-content: flex-start; padding-top: 14px; }
.backup-toolbar #backup-create { min-height: 38px; padding-inline: 14px; }
.backup-help {
    min-height: 34px;
    padding: 4px 5px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
    cursor: help;
}
.backup-help:hover,
.backup-help:focus-visible { color: var(--text); background: rgba(122, 162, 255, .10); }
.recording-delete-tool { display: grid; gap: 9px; margin-top: 4px; padding-top: 11px; border-top: 1px solid var(--line); }
.recording-delete-tool > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.recording-delete-tool > header span { color: var(--muted); font-size: 10px; }
.recording-delete-scope { display: grid; grid-template-columns: minmax(140px, 1fr) repeat(2, minmax(135px, .8fr)) auto; gap: 8px; align-items: end; }
.recording-delete-scope label { display: grid; gap: 4px; padding-top: 0; color: var(--muted); font-size: 11px; }
.recording-delete-scope select,
.recording-delete-scope input { min-height: 36px; color: var(--text); background: var(--bg); border: 1px solid var(--line); padding: 6px 8px; font: inherit; }
.recording-delete-tool > p { margin: 0; }

/* Camera editing: keep high-value per-camera processing controls compact. */
.camera-editor-heading { gap: 12px; }
.camera-editor-heading h2 { font-size: clamp(24px, 3vw, 34px); }
.camera-editor-heading .text-link { margin-bottom: 5px; }
.camera-preview-panel { gap: 8px; }
.camera-preview-panel > .icon-btn { justify-self: start; }
.editor-block > summary { min-height: 42px; padding: 10px 13px; }
.editor-block > summary small { display: none; }
.editor-block-body { padding: 13px; }
.orientation-note { display: none; }
.orientation-presets { gap: 5px; }
.orientation-presets .tool-btn { min-height: 34px; padding: 5px 9px; font-size: 11px; }
.recording-pipeline-picker.recording-pipeline-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 12px 0 9px;
    padding: 10px;
}
.recording-pipeline-compact .recording-pipeline-choice { padding: 8px; }
.recording-pipeline-compact .recording-pipeline-choice small { font-size: 10px; }
.camera-editor-actions { padding: 8px 10px; }
.camera-editor-actions .hint { font-size: 11px; }

/* Inventory actions are short controls; selection stays visible because batch
   removal is an explicit inventory task and never deletes recorded media. */
.inventory-page { gap: 9px; padding: 12px; }
.inventory-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
.inventory-heading h2 { font-size: clamp(24px, 3vw, 34px); }
.inventory-heading .hint { margin: 0; font-size: 10px; }
.inventory-heading .compact-actions { justify-content: flex-start; }
.inventory-bulk-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; padding: 7px 9px; background: rgba(0, 0, 0, .18); border: 1px solid var(--line); border-radius: 8px; }
.inventory-select-all { margin-right: 2px; color: var(--text); font-size: 11px; cursor: pointer; }
.inventory-select-all input { width: 17px; height: 17px; accent-color: var(--accent); }
.inventory-bulk-tools > .hint { margin-right: 0; }
.inventory-card-compact .compact-btn { min-height: 32px; padding: 4px 8px; font-size: 10px; }
.inventory-disclosure-body > .hint:empty { display: none; }

/* Playback transport: player-adjacent icons and one stepped speed control. */
.camera-pad-bank { padding: 9px; }
.camera-pad-bank > header { margin-bottom: 7px; }
.camera-pad-bank > header strong { font-size: 12px; }
.compact-message:empty { display: none; }

/* Alert Inbox: multi-state chips, opt-in selection, contextual bulk work. */
.alerts-main { padding-top: 12px; }
.alerts-heading { margin-bottom: 8px; }
.alerts-heading h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); }
.alert-filters {

    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 7px;
    margin-bottom: 9px;
    padding: 8px;
}
.alert-state-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.filter-chip {
    min-height: 32px;
    padding: 4px 8px;
    color: var(--muted);
    background: rgba(0, 0, 0, .24);
    border: 1px solid var(--line);
    border-radius: 999px;
    font: inherit;
    font-size: 10px;
    cursor: pointer;
}
.filter-chip span { margin-left: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.filter-chip[aria-pressed="true"] { color: var(--text); border-color: var(--accent); background: var(--accent-wash); }
.alert-camera-filter {  min-width: 0 !important; padding: 7px; }
.alert-camera-filter .camera-pad { min-height: 62px; padding: 8px 10px; border-radius: 9px; }
.alert-camera-filter .camera-pad-name { font-size: 11px; }
.alert-filters .hint { grid-column: 1 / -1; margin: 0; font-size: 10px; }
.alert-bulk-toolbar {
    position: sticky;
    z-index: 8;
    top: 28px;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 1400px;
    margin: 0 auto 9px;
    padding: 7px 8px;
    background: rgba(18, 27, 40, .96);
    border: 1px solid var(--accent-border);
    border-radius: 9px;
    backdrop-filter: blur(16px);
}
.alert-bulk-toolbar[hidden] { display: none; }
.alert-bulk-toolbar strong { margin-right: auto; font-size: 11px; }
.alert-list { gap: 8px; }
.alert-card {
    position: relative;
    grid-template-columns: minmax(180px, 28%) minmax(0, 1fr);
    min-height: 155px;
    border-left-width: 3px;
}
.alert-snapshot { min-height: 155px; }
.alert-snapshot img { min-height: 155px; }
.alert-copy { gap: 7px; padding: 12px; }
.alert-copy h3 { margin: 0; font-size: 18px; }
.alert-state { padding: 3px 6px; font-size: 9px; }
.alert-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 10px; }
.alert-meta span + span::before,
.alert-meta time::before { content: "·"; margin-right: 12px; color: #596475; }
.alert-note { flex: 0 1 auto; color: #d4dbe5; font-size: 12px; }
.alert-actions { display: flex; align-items: center; gap: 5px; margin-top: auto; }
.alert-actions .icon-btn { width: 32px; min-height: 32px; font-size: 16px; }
.alert-select-control { display: none; }
.alert-list.is-selection-mode .alert-select-control {
    position: absolute;
    z-index: 4;
    top: 8px;
    left: 8px;
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    background: rgba(0, 0, 0, .72);
    border-radius: 7px;
}
.alert-select-control input { width: 17px; height: 17px; accent-color: var(--accent); }

.slide-confirm-dialog {
    width: min(520px, calc(100vw - 24px));
    padding: 0;
    color: var(--text);
    background: transparent;
    border: 0;
}
.slide-confirm-dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(5px); }
.slide-confirm-card { display: grid; gap: 14px; padding: 16px; background: var(--panel); border: 1px solid var(--accent-border); border-radius: 12px; box-shadow: 0 24px 70px rgba(0, 0, 0, .7); }
.slide-confirm-card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.slide-confirm-card > p { margin: 0; color: var(--muted); line-height: 1.5; }
.slide-confirm-control { display: grid; gap: 9px; color: var(--text); font-size: 11px; }
.slide-confirm-control input {
    --slide-progress: 0%;
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: ew-resize;
    touch-action: pan-x;
}
.slide-confirm-control input::-webkit-slider-runnable-track {
    height: 16px;
    background:
        linear-gradient(90deg, var(--err), color-mix(in oklch, var(--err) 76%, #ffba63))
        0 / var(--slide-progress) 100% no-repeat,
        color-mix(in oklch, var(--surface-soft) 84%, black);
    border: 1px solid color-mix(in oklch, var(--err) 38%, var(--line));
    border-radius: 999px;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, .56), 0 0 0 1px rgba(255, 255, 255, .025);
}
.slide-confirm-control input::-webkit-slider-thumb {
    width: 34px;
    height: 34px;
    margin-top: -10px;
    appearance: none;
    -webkit-appearance: none;
    background: linear-gradient(145deg, #fff, color-mix(in oklch, var(--err) 32%, #fff));
    border: 3px solid var(--err);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .5), 0 0 0 5px color-mix(in oklch, var(--err) 16%, transparent);
}
.slide-confirm-control input::-moz-range-track {
    height: 16px;
    background: color-mix(in oklch, var(--surface-soft) 84%, black);
    border: 1px solid color-mix(in oklch, var(--err) 38%, var(--line));
    border-radius: 999px;
    box-shadow: inset 0 2px 7px rgba(0, 0, 0, .56);
}
.slide-confirm-control input::-moz-range-progress {
    height: 16px;
    background: linear-gradient(90deg, var(--err), color-mix(in oklch, var(--err) 76%, #ffba63));
    border-radius: 999px;
}
.slide-confirm-control input::-moz-range-thumb {
    width: 30px;
    height: 30px;
    background: linear-gradient(145deg, #fff, color-mix(in oklch, var(--err) 32%, #fff));
    border: 3px solid var(--err);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .5), 0 0 0 5px color-mix(in oklch, var(--err) 16%, transparent);
}
.slide-confirm-control input:focus-visible { outline: none; }
.slide-confirm-control input:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .5), 0 0 0 6px color-mix(in oklch, var(--focus) 34%, transparent);
}
.slide-confirm-dialog.is-complete .slide-confirm-control { color: var(--err); }
.slide-confirm-dialog.is-complete .slide-confirm-card {
    border-color: var(--err);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .7), 0 0 34px color-mix(in oklch, var(--err) 22%, transparent);
}
.slide-confirm-actions { display: flex; justify-content: flex-end; gap: 7px; }

/* Desktop is not a stretched phone. Give the shared control drawer enough
   visual weight to make operational metrics scannable on every page, and
   reflow once for laptop widths. The pull-down handle stays compact. */

/* The action beam is the drawer's bottom edge on every expanded page. */
.global-action-progress { grid-row: 4; }

/* The drawer and its contour meet on one opaque edge color. A live image
   behind a separately blurred tab must not change its apparent attachment. */
body:not(.auth-page) > .top,
body.live-page > .top,
body.live-page:is(.dense-grid, .has-expanded) > .top,
body.header-pinned:not(.live-page) > .top {
    background: linear-gradient(145deg, #192b39, var(--command-drawer-surface) 65%);
    border-bottom-color: var(--command-drawer-edge);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Expanded media actions share one protected rail below the drawer handle. */
.expanded-media-actions {
    position: absolute;
    z-index: 13;
    top: max(48px, calc(env(safe-area-inset-top) + 48px));
    right: max(10px, env(safe-area-inset-right));
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    pointer-events: none;
}

.tile.expanded .expanded-media-actions { display: flex; }
.expanded-media-actions > * { pointer-events: auto; }
.expanded-media-actions .audio-toggle,
.expanded-media-actions .talkback-toggle,
.expanded-media-actions .rewind-button,
.expanded-media-actions .snap {
    position: static;
    top: auto;
    right: auto;
    min-width: 48px;
    min-height: 38px;
    margin: 0;
}
.expanded-media-actions .audio-toggle { width: 38px; height: 38px; min-width: 38px; }
.desktop-audio-volume { display: none; }

/* The command bar stays quiet until its independently controlled health
   subdrawer is requested. Metrics are one readable instrument panel, not a
   stack of nested cards. */
.health-drawer {
    width: 100%;
    min-width: 0;
}

.health-drawer > summary {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    padding: 3px 1px;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.health-drawer > summary::-webkit-details-marker { display: none; }
.health-drawer > summary strong {
    color: var(--text);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.health-drawer-arrow {
    display: inline-grid;
    width: 18px;
    height: 18px;
    place-items: center;
    color: var(--codex-blue-soft);
    font-size: 18px;
    line-height: 1;
    transform: rotate(-90deg);
    transition: transform 150ms ease-out;
}
.health-drawer[open] .health-drawer-arrow { transform: rotate(0); }
.health-drawer-summary {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.health-drawer-panel {
    padding: 4px 0 2px;
    border-top: 1px solid color-mix(in oklch, var(--line) 65%, transparent);
}

/* Alerts starts with the camera selector and lets media own the phone width.
   State and batch work sit in a thin rail below it. */
.alerts-main {
    padding: clamp(7px, 1.5vw, 16px);
}
.alert-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin-bottom: 7px;
    padding: 0;
    background: transparent;
    border: 0;
}
.alert-camera-filter {
    grid-column: 1 / -1;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}
.alert-camera-filter .camera-pad-grid {
    width: 100%;
    gap: 5px;
}
.alert-camera-filter .camera-pad {
    min-height: 64px;
    padding: 6px 7px;
    border-width: 1px;
    border-radius: 7px;
}
.alert-filter-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 2px 0 0;
}
.alert-filter-controls .alert-state-chips {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}
.alert-filter-controls .filter-chip {
    min-height: 30px;
    padding: 3px 7px;
}
.alert-filter-controls .hint:empty { display: none; }
.alert-filter-controls .hint {
    flex: 1 0 100%;
    margin: 0;
}
.alert-list { gap: 6px; }
.alert-card {
    border: 0;
    border-left: 2px solid var(--wait);
    box-shadow: none;
}
.alerts-empty {
    min-height: 150px;
    padding: 22px;
    border: 0;
}
.alerts-empty strong { font-size: 17px; }

/* Expanded media chrome has one compact dock. Camera pixels stay unobstructed
   until the operator opens the grouped panel. */
.expanded-control-dock {
    position: absolute;
    z-index: 14;
    top: max(48px, calc(env(safe-area-inset-top) + 48px));
    right: max(10px, env(safe-area-inset-right));
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 7px;
    max-height: calc(100% - 64px - env(safe-area-inset-bottom));
    pointer-events: none;
}
/* Forgiving selector lists keep Firefox from discarding the whole rule when
   it encounters the WebKit-only fullscreen pseudo-class. */
.tile:is(.expanded, :fullscreen, :-webkit-full-screen) .expanded-control-dock { display: flex; }
.expanded-control-dock > * { pointer-events: auto; }
.expanded-control-launchers { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.expanded-control-launchers button {
    min-height: 38px;
    color: var(--text);
    background: rgba(7, 9, 12, .86);
    border: 1px solid rgba(255, 255, 255, .2);
    box-shadow: 0 7px 24px rgba(0, 0, 0, .32);
    cursor: pointer;
}
.expanded-control-launchers .fullscreen-toggle {
    display: inline-grid;
    min-width: 38px;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    font: 20px/1 system-ui, sans-serif;
}
.expanded-controls-toggle {
    min-width: 92px;
    padding: 0 12px;
    border-radius: 20px;
    font: 800 10px/1 system-ui, sans-serif;
    letter-spacing: .08em;
}
.expanded-controls-toggle.is-open { color: #fff; border-color: var(--accent); background: #18263a; }
.expanded-control-panel {
    box-sizing: border-box;
    display: grid;
    width: min(304px, calc(100vw - 20px));
    max-height: calc(100dvh - 112px - env(safe-area-inset-bottom));
    gap: 10px;
    padding: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--text);
    background: rgba(7, 9, 12, .92);
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
    backdrop-filter: blur(18px);
    overscroll-behavior: contain;
}
.expanded-control-panel[hidden] { display: none; }
.expanded-control-section { display: grid; gap: 7px; min-width: 0; }
.expanded-control-section h3 {
    margin: 0;
    color: var(--muted);
    font: 800 9px/1 system-ui, sans-serif;
    letter-spacing: .12em;
}
.expanded-control-panel .expanded-media-actions,
.expanded-control-panel .zoom-tools,
.expanded-control-panel .live-ptz,
.expanded-control-panel .live-light {
    position: static;
    inset: auto;
    width: auto;
    margin: 0;
}
.expanded-control-panel .expanded-media-actions {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}
.expanded-control-panel .zoom-tools { justify-self: start; }
.expanded-control-panel .live-ptz.is-ready,
.expanded-control-panel .live-light.is-ready { display: grid; }
.expanded-control-panel .live-ptz:not(.is-ready),
.expanded-control-panel .live-light:not(.is-ready) { display: none; }
.expanded-control-panel .live-ptz { align-items: stretch; gap: 7px; }
.expanded-control-panel .live-ptz-panel {
    width: 100%;
    padding: 8px 0 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
}
.expanded-control-panel .live-light-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.expanded-control-panel .live-light button { flex: 1 1 82px; }
.tile.expanded,
.tile:fullscreen { border: 0; }
.tile:fullscreen {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #000;
}
.tile.expanded .zoom-tools,
.tile:fullscreen .zoom-tools {
    overflow: hidden;
    background: rgba(0, 0, 0, .44);
    border: 0;
    border-radius: 8px;
}
.tile.expanded .zoom-tools button,
.tile:fullscreen .zoom-tools button {
    border-right-color: rgba(255, 255, 255, .14);
}

/* Command-drawer interaction: shared behavior stays common; phone and desktop
   own only layout. The title/status beam always remains visible. */
:root {
    --command-beam-height: 26px;
    --command-drawer-surface: #101922;
    --command-drawer-edge: #354958;
}

.global-action-progress,
body.header-collapsed:not(.live-page) > .top .global-action-progress {
    box-sizing: border-box;
    align-items: flex-end;
    min-height: var(--command-beam-height);
    max-height: var(--command-beam-height);
    padding-top: 0;
    padding-bottom: 3px;
    cursor: ns-resize;
    touch-action: pan-x;
    user-select: none;
}
.global-action-progress .action-progress-text {
    font-size: 10px;
    line-height: 1.1;
    letter-spacing: .055em;
}
body.header-collapsed:not(.live-page) > main {
    margin-top: var(--command-beam-height);
}
body.command-drawer-dragging > .top,
body.command-drawer-settling > .top {
    will-change: transform;
}
body.command-drawer-dragging > .top { transition: none !important; }

/* Live and non-Live share the same collapsed endpoint: the beam, never zero. */
body.live-page:not(.toolbar-pinned) > .top,
body.live-page:is(.dense-grid, .has-expanded):not(.toolbar-pinned) > .top,
body.header-collapsed:not(.live-page) > .top {
    transform: translateY(calc(-100% + var(--command-beam-height)));
}

/* An open Live drawer owns only its panel height. The rounded Controls handle
   attaches to that boundary with its body over the page, reserving no gutter. */
body.live-page.toolbar-pinned #grid {
    height: calc(100dvh - var(--live-toolbar-open-height, 0px));
    transform: translateY(var(--live-toolbar-open-height, 0px));
}

/* Desktop drawer padding used to sit below the beam, so the collapsed
   transform revealed the padding and clipped the label above it. Keep the
   phone endpoint unchanged and make the beam the true desktop bottom edge. */

/* The separate narrow handle remains a small secondary desktop target. */

/* Health is its own damped, draggable compartment inside the command drawer. */
.health-drawer > summary { touch-action: pan-x; }
.health-drawer-panel {
    box-sizing: border-box;
    transform-origin: top center;
}
.health-drawer.is-dragging .health-drawer-panel,
.health-drawer.is-settling .health-drawer-panel { overflow: hidden; }
.health-drawer.is-dragging .health-drawer-panel { transition: none; }
.health-drawer.is-settling .health-drawer-panel {
    transition:
        height 190ms cubic-bezier(.18, .82, .24, 1.08),
        opacity 130ms ease-out,
        transform 190ms cubic-bezier(.18, .82, .24, 1.08);
}

/* Desktop command chrome: real navigation controls and a readable health
   instrument panel. Phone density and touch geometry remain unchanged. */

/* Page identity belongs in the persistent beam, not above useful content. */
.inventory-heading h2,
.status-operations-head > div > strong { display: none; }
.inventory-heading > div:first-child,
.camera-editor-heading > div:first-child { min-width: 0; }
.inventory-heading .hint,
.camera-editor-heading .hint { margin-top: 0; }

/* Shared button templates: contained illumination, tactile travel, and a
   persistent selected state. This also removes Android's broad tap flare. */
:where(
    button,
    a.tool-btn,
    a.compact-btn,
    [role="button"]
) {
    -webkit-tap-highlight-color: transparent;
}
:where(
    .tool-btn,
    .compact-btn,
    .icon-btn,
    .compact-toggle,
    .filter-chip,
    .camera-mode-control [data-camera-mode],
    .alert-state-toggle,
    .zoom-tools button,
    .expanded-media-actions button,
    .live-ptz button,
    .live-light button
) {
    border-color: color-mix(in oklch, var(--line) 82%, var(--codex-blue) 18%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .07),
        0 2px 5px rgba(0, 0, 0, .24);
    transition:
        transform 85ms cubic-bezier(.2, .8, .2, 1),
        color 130ms ease-out,
        border-color 130ms ease-out,
        background-color 130ms ease-out,
        box-shadow 130ms ease-out,
        filter 130ms ease-out;
}
:where(
    .tool-btn,
    .compact-btn,
    .icon-btn,
    .compact-toggle,
    .filter-chip,
    .camera-mode-control [data-camera-mode],
    .alert-state-toggle,
    .zoom-tools button,
    .expanded-media-actions button,
    .live-ptz button,
    .live-light button
):hover:not(:disabled) {
    border-color: color-mix(in oklch, var(--codex-blue-soft) 52%, var(--line));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .11),
        0 0 0 1px rgba(16, 167, 255, .07),
        0 3px 8px rgba(0, 0, 0, .28);
}
:where(
    .tool-btn,
    .compact-btn,
    .icon-btn,
    .compact-toggle,
    .filter-chip,
    .camera-mode-control [data-camera-mode],
    .alert-state-toggle,
    .zoom-tools button,
    .expanded-media-actions button,
    .live-ptz button,
    .live-light button
):active:not(:disabled) {
    transform: translateY(1px) scale(.985);
    filter: brightness(1.08);
    box-shadow:
        inset 0 2px 5px rgba(0, 0, 0, .42),
        0 1px 2px rgba(0, 0, 0, .3);
}
:where(
    .compact-toggle,
    .filter-chip,
    .camera-mode-control [data-camera-mode],
    .detection-state-toggle
)[aria-pressed="true"] {
    box-shadow:
        inset 0 0 0 1px color-mix(in oklch, currentColor 34%, transparent),
        0 0 10px color-mix(in oklch, currentColor 18%, transparent);
}

/* Anchor the ClassyCams clock immediately above the measured picture rather
   than covering its first row. A small minimum keeps it reachable when a
   cropped view has no usable upper letterbox. */
.tile.expanded .frame-clock,
.tile:fullscreen .frame-clock {
    top: max(28px, calc(var(--media-content-top, 0px) - 6px));
    right: auto;
    bottom: auto;
    left: 50%;
    max-width: min(
        calc(var(--media-content-width, 100%) - 12px),
        46%
    );
    transform: translate(-50%, -100%);
}

/* Desktop Camera Operations: a substantial preview beside compact controls. */

/* Phone Camera Operations: media gets the first full-width row; controls
   reflow below it rather than squeezing the preview smaller than buttons. */

/* Mobile camera-wall navigation and iOS-safe drawer ownership. Camera tiles
   keep their media gestures; the edge cue supplies an unambiguous page-scroll
   target without overloading pinch or one-finger camera pan. */
.grid-scroll-cue { display: none; }

/* A Talk failure survives routine frame/status updates until retry or dismissal. */
.talkback-notice {
    position: absolute;
    z-index: 65;
    top: max(var(--expanded-controls-safe-top, 48px), env(safe-area-inset-top));
    inset-inline: 12px;
    width: auto;
    max-width: 440px;
    margin-inline: auto;
    padding: 14px;
    color: #f4f6fa;
    background: rgba(18, 25, 34, .98);
    border: 1px solid #cba366;
    border-radius: 10px;
    box-shadow: 0 4px 20px #0008;
    font: 14px/1.45 system-ui, sans-serif;
    text-align: left;
}
.talkback-notice[hidden], .tile:not(.expanded) .talkback-notice { display: none; }
.talkback-notice p { margin: 7px 0 12px; overflow-wrap: anywhere; }
.talkback-notice button { min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px; color: inherit; background: #263342; }

.context-menu-status {display:block;color:var(--muted);font-size:14px;margin-top:4px;}
.context-menu-status[hidden] {display:none;}
/* A current write-space problem stays visible through page/skin controls. */
.system-space-warning {position:sticky;top:0;z-index:150;display:block;padding:10px 14px;
    background:#493411;color:#fff0c2;border-bottom:2px solid #e4b35e;font-size:14px;line-height:1.4;text-align:center;text-decoration:none;}
.system-space-warning[data-level="critical"] {background:#651f27;color:#fff0f0;border-color:#ff6c79;}
.system-space-warning[hidden] {display:none;}
