:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #eef2ee;
  --surface-raised: #fafcf9;
  --ink: #17221d;
  --ink-soft: #35443d;
  --muted: #65726c;
  --line: #d8dfda;
  --line-strong: #788a81;
  --accent: #08786c;
  --accent-strong: #075f56;
  --accent-soft: #e4f2ef;
  --ok: #157044;
  --ok-soft: #e6f3eb;
  --warn: #8a5500;
  --warn-soft: #fff0cd;
  --crit: #aa312c;
  --crit-strong: #87241f;
  --crit-soft: #fbe8e6;
  --unknown: #5e6964;
  --unknown-soft: #ecefed;
  --header: #17241f;
  --header-soft: #22332b;
  --shadow-sm: 0 1px 2px rgba(21, 36, 29, .08);
  --shadow-md: 0 8px 24px rgba(21, 36, 29, .1);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --focus: 0 0 0 3px rgba(8, 120, 108, .28);
  --focus-on-dark: #5eead4;
  --focus-on-dark-shadow: 0 0 0 3px rgba(94, 234, 212, .28);
  --topbar-content-height: 68px;
  --topbar-height: calc(var(--topbar-content-height) + env(safe-area-inset-top));
  --mobile-nav-height: 0px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% -20%, rgba(8, 120, 108, .08), transparent 34rem),
    var(--bg);
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: inherit; }

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.ui-icon {
  width: 1.25em;
  height: 1.25em;
  display: inline-block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -.2em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: var(--focus);
}
[data-input-modality="pointer"] h1[tabindex="-1"]:focus { outline: 0; box-shadow: none; }

.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 100;
  max-width: calc(100vw - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right)));
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--accent-strong);
  white-space: normal;
  overflow-wrap: anywhere;
}
.skip-link:not(:focus) { transform: translateY(calc(-100% - max(8px, env(safe-area-inset-top)))); }
.skip-link:focus { transform: translateY(0); }

.topbar :focus-visible,
.connection-banner :focus-visible,
.live-stage :focus-visible,
.archive-stage :focus-visible,
.skip-link:focus-visible {
  outline-color: var(--focus-on-dark);
  box-shadow: var(--focus-on-dark-shadow);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar-height);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
  align-items: center;
  gap: 20px;
  padding: env(safe-area-inset-top) max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
  color: #fff;
  background: rgba(23, 36, 31, .97);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(14px);
}

.brand-block, .brand, .topbar-actions, .primary-nav, .title-with-status,
.viewer-toolbar, .viewer-controls, .panel-heading, .camera-facts,
.incident-meta, .incident-actions, .section-summary, .camera-heading,
.page-heading-buttons, .camera-heading-actions {
  display: flex;
  align-items: center;
}

.brand-block { min-width: 0; gap: 12px; }
.brand { min-width: 44px; min-height: 44px; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark {
  width: 42px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 7px;
  color: #dff8f2;
  background: rgba(8, 120, 108, .25);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  flex: 0 0 auto;
}
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 15px; letter-spacing: -.01em; }
.brand-copy small { margin-top: 4px; color: #aebbb5; font-size: 11px; font-weight: 600; }

.primary-nav {
  height: 100%;
  justify-content: center;
  gap: 4px;
}
.nav-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  color: #c9d3ce;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.nav-link[aria-current="page"] { color: #fff; background: rgba(8, 120, 108, .45); }
.nav-count, .mobile-count {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  color: #fff;
  background: var(--crit);
  font-size: 11px;
  font-weight: 800;
}

.topbar-actions { flex: 0 0 auto; justify-content: flex-end; gap: 12px; }
.update-meta { min-width: 0; display: grid; justify-items: end; line-height: 1.2; }
.clock { color: #e1e8e4; font-size: 13px; font-variant-numeric: tabular-nums; }
.last-updated { margin-top: 3px; color: #99aaa2; font-size: 11px; white-space: nowrap; }
.icon-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid #4a5a52;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--header-soft);
  cursor: pointer;
}
.icon-button:hover { background: #2d4238; border-color: #65756d; }
.refresh-icon { font-size: 20px; line-height: 1; }
.icon-button.is-loading .refresh-icon { animation: spin .75s linear infinite; }

.status-badge {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.15;
  white-space: nowrap;
}
.status-symbol {
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}
.status-ok { color: #0a5632; background: var(--ok-soft); border-color: #b5dbc5; }
.status-ok .status-symbol { color: #fff; background: var(--ok); }
.status-warn { color: #704400; background: var(--warn-soft); border-color: #ebce8b; }
.status-warn .status-symbol { color: #fff; background: var(--warn); }
.status-crit { color: #84231f; background: var(--crit-soft); border-color: #efb9b4; }
.status-crit .status-symbol { color: #fff; background: var(--crit); }
.status-unknown { color: #4d5853; background: var(--unknown-soft); border-color: #cdd4d0; }
.status-unknown .status-symbol { color: #fff; background: var(--unknown); }
.topbar .status-badge { flex: 0 0 auto; max-width: none; overflow: visible; border-color: rgba(255, 255, 255, .2); }
.topbar .status-badge span:last-child { overflow: visible; text-overflow: clip; }
.operator-mode-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 221, 142, .4);
  border-radius: 999px;
  color: #ffe7ad;
  background: rgba(138, 85, 0, .3);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  flex: 0 0 auto;
}
.operator-mode-short { display: none; }

.connection-banner {
  position: sticky;
  top: var(--topbar-height);
  z-index: 25;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px max(20px, env(safe-area-inset-right)) 8px max(20px, env(safe-area-inset-left));
  color: #fff;
  background: var(--crit-strong);
  box-shadow: var(--shadow-md);
  font-size: 13px;
}
.connection-banner span { color: #f8d8d5; }
.button-inverse { color: #fff !important; background: transparent !important; border-color: rgba(255,255,255,.5) !important; }

main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 30px max(24px, env(safe-area-inset-right)) 48px max(24px, env(safe-area-inset-left));
}

.app-view { min-width: 0; }
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.page-heading > div:first-child { min-width: 0; }
.page-heading-actions { align-items: center; }
.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { min-width: 0; max-width: 100%; margin-bottom: 7px; font-size: clamp(26px, 3vw, 35px); line-height: 1.08; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { margin-bottom: 8px; font-size: 19px; line-height: 1.2; letter-spacing: -.015em; }
h3 { margin-bottom: 5px; font-size: 16px; }
.page-lead { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

.theme-picker {
  width: min(100%, 320px);
  min-width: 0;
  flex: 0 0 320px;
  margin: 0;
  padding: 0;
  border: 0;
}
.theme-picker legend { margin-bottom: 7px; padding: 0; color: var(--muted); font-size: 11px; font-weight: 800; }
.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.theme-option { position: relative; min-width: 0; cursor: pointer; }
.theme-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.theme-option span {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 6px;
  border-right: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
}
.theme-option:last-child span { border-right: 0; }
.theme-option:hover span { background: var(--surface-raised); }
.theme-radio:checked + span { color: #fff; background: var(--accent-strong); }
.theme-radio:focus-visible + span { position: relative; z-index: 1; outline: 2px solid var(--accent); outline-offset: -3px; box-shadow: var(--focus); }
.theme-radio:checked:focus-visible + span {
  outline-color: var(--focus-on-dark);
  box-shadow: var(--focus-on-dark-shadow);
}
.theme-picker > p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.button:not(:disabled):hover { border-color: #8fa097; background: var(--surface-raised); }
.button-primary { color: #fff; border-color: var(--accent); background: var(--accent); }
.button-primary:not(:disabled):hover { color: #fff; border-color: var(--accent-strong); background: var(--accent-strong); }
.button-secondary { color: var(--accent-strong); border-color: #9fc5bd; background: var(--accent-soft); }
.button-warning { color: #5f3900; border-color: #d9ad55; background: #fff7e4; }
.button-quiet { color: var(--ink-soft); background: transparent; }
.button.is-disabled { pointer-events: none; opacity: .45; }

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric-card {
  min-width: 0;
  min-height: 124px;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
button.metric-card { width: 100%; font: inherit; cursor: pointer; }
.metric-action:hover { border-color: #91bbb2; background: #f6fbf9; box-shadow: var(--shadow-md); }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-value { margin-top: 5px; font-size: 28px; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-hint { align-self: end; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.35; }

.attention-strip {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 12px 14px 12px 18px;
  border: 1px solid #e8c675;
  border-left: 5px solid var(--warn);
  border-radius: var(--radius);
  color: #523400;
  background: var(--warn-soft);
}
.attention-strip div { display: grid; gap: 3px; }
.attention-strip strong { font-size: 14px; }
.attention-strip span { color: #73521b; font-size: 12px; line-height: 1.35; }
.attention-strip.is-error { border-color: #e0aaa6; border-left-color: var(--crit); color: #6d211d; background: var(--crit-soft); }
.attention-strip.is-error span { color: #7a3733; }

.camera-toolbar, .incident-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.78);
}
.search-field {
  min-width: 230px;
  flex: 1 1 300px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: #fff;
}
.search-field:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.select-field { min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
input, select {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
}
.select-field select { min-width: 150px; max-width: 100%; }
.filter-chips { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.filter-chip {
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.filter-chip:hover { border-color: var(--line-strong); }
.filter-chip.active { color: #fff; background: var(--accent-strong); }
.button:not(:disabled):active, .icon-button:not(:disabled):active, .filter-chip:not(:disabled):active,
.nav-link:active, .tab:not(:disabled):active, .camera-card-link:active {
  transform: translateY(1px);
  filter: brightness(.96);
}

.camera-groups { display: grid; gap: 26px; }
.camera-group-header { min-width: 0; display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.camera-group-header h2 { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.camera-group-header span { color: var(--muted); font-size: 12px; }
.camera-grid { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); align-items: start; gap: 12px; }
.camera-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.camera-card::before { content: ""; position: absolute; inset: 0 auto 0 0; z-index: 2; width: 4px; background: var(--unknown); }
.camera-card[data-status="ok"]::before { background: var(--ok); }
.camera-card[data-status="warn"]::before { background: var(--warn); }
.camera-card[data-status="crit"]::before { background: var(--crit); }
.camera-card-link { display: block; color: inherit; text-decoration: none; }
.camera-card-link:hover .camera-card-title strong { color: var(--accent-strong); }
.camera-card-link:focus-visible { outline-offset: -4px; }
.camera-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #aeb8b2;
  background: #101713;
}
.camera-image img { width: 100%; height: 100%; display: block; object-fit: contain; }
.camera-image img.is-empty { visibility: hidden; }
.snapshot-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  font-size: 11px;
}
.snapshot-placeholder .ui-icon { width: 24px; height: 24px; opacity: .72; }
.snapshot-state {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  padding: 4px 7px;
  border-radius: 5px;
  color: #f1f6f3;
  background: rgba(10, 17, 13, .74);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.camera-card-body { padding: 12px 13px 13px 16px; }
.camera-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.camera-card-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; white-space: nowrap; }
.camera-card-title .status-badge { flex: 0 0 auto; }
.camera-meta { min-width: 0; margin-top: 9px; display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.camera-meta-row { display: flex; justify-content: space-between; gap: 8px; }
.camera-meta-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-meta > [data-camera-infrastructure] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camera-note { color: var(--ink-soft); font-size: 12px; line-height: 1.35; }
.history-badge {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px 10px 16px;
  border: 0;
  border-top: 1px solid #e2bd67;
  border-radius: 0;
  color: #714500;
  background: var(--warn-soft);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}
.history-badge:hover { color: #543300; border-color: #c99b3d; background: #fff3d5; }
.history-badge:active { background: #ffe8ad; }
.history-badge:focus-visible { outline-offset: -3px; }
.history-badge strong { min-width: 0; overflow-wrap: anywhere; }
.history-badge small { color: #826124; font-size: 11px; font-weight: 700; white-space: nowrap; }

.info-callout {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #b9d5ce;
  border-radius: var(--radius);
  color: #29453d;
  background: var(--accent-soft);
}
.info-callout p { margin: 0; font-size: 13px; line-height: 1.5; }
.callout-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); font-weight: 800; }
.operator-mode-notice {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #e2bd67;
  border-radius: var(--radius);
  color: #634000;
  background: #fff8e7;
}
.operator-mode-notice > .ui-icon { width: 24px; height: 24px; }
.operator-mode-notice div { min-width: 0; display: grid; gap: 2px; }
.operator-mode-notice strong { font-size: 13px; }
.operator-mode-notice span { color: #75551b; font-size: 12px; line-height: 1.35; }
.operator-mode-notice.is-protected { border-color: #b9d5ce; color: #29453d; background: var(--accent-soft); }
.operator-mode-notice.is-protected span { color: #49655d; }
.incident-toolbar { justify-content: space-between; }
.incident-toolbar .search-field { flex: 0 1 360px; }
.section-summary { justify-content: space-between; gap: 12px; min-height: 32px; margin: 2px 0 10px; color: var(--muted); font-size: 12px; }
.page-heading-buttons, .camera-heading-actions { gap: 8px; flex-wrap: wrap; }
.incident-summary-error { color: var(--crit-strong); font-weight: 700; }
.incident-summary-note { color: var(--muted); font-size: 11px; }
.incident-scope-note { flex-basis: 100%; color: #75551b; font-size: 11px; line-height: 1.4; }
.incident-list { display: grid; gap: 12px; }
.incident-group {
  overflow: visible;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}
.incident-group > summary {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255,255,255,.82);
  cursor: pointer;
  list-style-position: inside;
}
.incident-group > summary:hover { background: var(--surface-raised); }
.incident-group[open] > summary { margin-bottom: 9px; border-color: var(--line-strong); }
.incident-group-copy { min-width: 0; display: inline-grid; gap: 3px; margin-right: auto; }
.incident-group-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.incident-group-copy span { min-width: 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.incident-group-count { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; color: var(--ink-soft); background: var(--surface-soft); font-size: 11px; font-weight: 800; }
.incident-group-items { display: grid; gap: 9px; padding: 0 0 5px 10px; }
.incident-group-items .incident-card { box-shadow: none; }
.incident-load-more { justify-self: center; min-width: min(320px, 100%); }
.incident-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 22px;
  padding: 17px 18px 17px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.incident-card::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 5px; border-radius: var(--radius) 0 0 var(--radius); background: var(--warn); }
.incident-card.severity-crit::before { background: var(--crit); }
.incident-card.is-acknowledged { border-color: #cfd8d1; background: #f7faf7; }
.incident-main { min-width: 0; }
.incident-heading { display: flex; align-items: flex-start; gap: 9px; flex-wrap: wrap; }
.incident-heading h2 { margin: 1px 0 0; }
.incident-state {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  color: #7a2722;
  background: var(--crit-soft);
  font-size: 11px;
  font-weight: 800;
}
.incident-state.is-resolved { color: #1e6443; background: var(--ok-soft); }
.incident-message { margin: 8px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.incident-meta { gap: 13px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 11px; }
.incident-meta span { display: inline-flex; align-items: center; gap: 4px; }
.incident-detail {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #4d4030;
  background: #f7f2e9;
  font-size: 12px;
  line-height: 1.45;
}
.incident-actions { align-self: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; max-width: 290px; }
.acknowledged-label { color: var(--ok); font-size: 12px; font-weight: 750; }
.operator-hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.text-link { color: var(--accent-strong); font-weight: 750; text-decoration-thickness: 1px; text-underline-offset: 2px; }

.archive-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-sm);
}
.archive-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, .65fr) minmax(150px, .65fr) auto;
  grid-template-areas: "camera date time latest";
  align-items: end;
  gap: 10px;
}
.archive-camera-field { grid-area: camera; }
.archive-date-field { grid-area: date; }
.archive-time-field { grid-area: time; }
.archive-toolbar #archiveLatest { grid-area: latest; }
.archive-toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.archive-toolbar input, .archive-toolbar select { width: 100%; height: 44px; }
.timeline-wrap { min-width: 0; margin: 14px 0; }
.timeline-toolbar {
  min-width: 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.timeline-window-copy { min-width: 0; display: grid; gap: 2px; }
.timeline-window-copy strong { font-size: 13px; }
.timeline-window-copy span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.timeline-toolbar-controls {
  min-width: 0;
  display: flex;
  flex: 0 1 auto;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}
.timeline-day-navigation {
  width: min(420px, 100%);
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(128px, auto) minmax(112px, 1fr) minmax(128px, auto);
  align-items: stretch;
  gap: 6px;
}
.timeline-day-button,
.timeline-selected-date {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.timeline-day-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  color: var(--ink-soft);
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.timeline-day-button:not(:disabled):hover {
  border-color: var(--accent);
  background: var(--surface-raised);
}
.timeline-selected-date {
  display: grid;
  place-items: center;
  padding: 5px 8px;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.timeline-day-compact { display: none; }
.timeline-scale-control {
  width: 272px;
  min-width: 0;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.timeline-scale-control legend {
  margin: 0 0 4px;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}
.timeline-scale-hint {
  display: block;
  min-width: 0;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.timeline-zoom {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.timeline-zoom-button {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--ink-soft);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.timeline-zoom-button:first-child { border-left: 0; }
.timeline-zoom-button.active,
.timeline-zoom-button[aria-pressed="true"] { color: #fff; background: var(--accent-strong); }
.timeline-hours {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.timeline-shell {
  position: relative;
  width: 100%;
  height: 52px;
}
.timeline-track {
  position: absolute;
  inset: 4px 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(90deg, #e9edea 0, #e9edea calc(4.166% - 1px), #d1d9d3 calc(4.166% - 1px), #d1d9d3 4.166%);
  pointer-events: none;
}
.timeline-segment { position: absolute; top: 8px; bottom: 8px; min-width: 1px; border-radius: 3px; background: var(--ok); }
.timeline-cursor { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--crit); pointer-events: none; transform: translateX(-1px); }
.timeline-cursor::after { content: ""; position: absolute; top: 0; left: -4px; width: 11px; height: 7px; border-radius: 0 0 5px 5px; background: var(--crit); }
.timeline-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 52px;
  min-height: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: ew-resize;
  touch-action: pan-y;
}
.timeline-input::-webkit-slider-runnable-track { height: 44px; background: transparent; }
.timeline-input::-moz-range-track { height: 44px; background: transparent; }
.timeline-input::-webkit-slider-thumb {
  width: 20px;
  height: 44px;
  margin-top: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}
.timeline-input::-moz-range-thumb { width: 20px; height: 44px; border: 0; background: transparent; }
.timeline-input:focus-visible { outline-offset: 2px; }
.timeline-window-boundaries {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}
.timeline-window-boundaries span { min-width: 0; overflow-wrap: anywhere; }
.timeline-window-boundaries span:last-child { text-align: right; }
.timeline-window-boundaries time { color: var(--ink-soft); font-weight: 750; font-variant-numeric: tabular-nums; }
.timeline-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: 11px; }
.timeline-legend span { display: inline-flex; align-items: center; gap: 6px; }
.timeline-legend i { width: 18px; height: 7px; display: inline-block; border-radius: 3px; border: 1px solid var(--line-strong); }
.legend-recorded { background: var(--ok); }
.legend-gap { background: var(--surface-soft); }
.timeline-status { min-height: 20px; margin-top: 5px; color: var(--muted); font-size: 12px; }
.archive-current-time {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 3px 12px;
  margin: 14px 0 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}
.archive-current-time > span { grid-row: 1 / 3; align-self: center; color: var(--muted); font-size: 11px; font-weight: 750; }
.archive-current-time strong { min-width: 0; font-size: clamp(16px, 2vw, 20px); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.archive-current-time small { color: var(--muted); font-size: 12px; }
.live-stage, .archive-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #26342d;
  border-radius: var(--radius);
  background: #080d0a;
}
.live-stage iframe, .archive-stage video { width: 100%; height: 100%; display: block; border: 0; object-fit: contain; background: #080d0a; }
.live-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.live-action-button {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 10px;
  color: #fff;
  background: rgba(8, 13, 10, .78);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  pointer-events: auto;
}
.live-action-button:not(:disabled):hover { background: rgba(23, 36, 31, .94); border-color: #fff; }
.live-action-button[aria-pressed="true"] { color: #8af2df; border-color: #8af2df; background: rgba(7, 95, 86, .92); }
.live-action-button .ui-icon { width: 22px; height: 22px; }
.live-pip { display: none; }
.live-stage:fullscreen,
.live-stage:-webkit-full-screen { position: fixed; inset: 0; width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; border-radius: 0; }
.live-stage:fullscreen .live-actions,
.live-stage:-webkit-full-screen .live-actions {
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
}
.stage-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 7px; padding: 20px; color: #aab5af; text-align: center; pointer-events: none; }
.stage-placeholder strong { color: #e8eeea; font-size: 14px; }
.stage-placeholder span:last-child { max-width: 360px; font-size: 11px; line-height: 1.45; }
.stage-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #47554e; border-radius: 50%; color: #d9e2dd; font-size: 15px; }
.archive-stage video { pointer-events: none; }
.archive-viewer { min-width: 0; }
.archive-viewer:fullscreen,
.archive-viewer:-webkit-full-screen {
  width: 100vw;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  padding:
    max(8px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  color: #fff;
  background: #050806;
}
.archive-viewer:fullscreen .timeline-wrap,
.archive-viewer:-webkit-full-screen .timeline-wrap {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: var(--radius-sm);
  background: #101914;
}
.archive-viewer:fullscreen .timeline-window-copy span,
.archive-viewer:-webkit-full-screen .timeline-window-copy span,
.archive-viewer:fullscreen .timeline-scale-control legend,
.archive-viewer:-webkit-full-screen .timeline-scale-control legend,
.archive-viewer:fullscreen .timeline-scale-hint,
.archive-viewer:-webkit-full-screen .timeline-scale-hint,
.archive-viewer:fullscreen .timeline-hours,
.archive-viewer:-webkit-full-screen .timeline-hours,
.archive-viewer:fullscreen .timeline-window-boundaries,
.archive-viewer:-webkit-full-screen .timeline-window-boundaries,
.archive-viewer:fullscreen .timeline-legend,
.archive-viewer:-webkit-full-screen .timeline-legend,
.archive-viewer:fullscreen .timeline-status,
.archive-viewer:-webkit-full-screen .timeline-status { color: #c4cec8; }
.archive-viewer:fullscreen .timeline-window-boundaries time,
.archive-viewer:-webkit-full-screen .timeline-window-boundaries time { color: #fff; }
.archive-viewer:fullscreen .timeline-toolbar-controls,
.archive-viewer:-webkit-full-screen .timeline-toolbar-controls { align-items: end; }
.archive-viewer:fullscreen .timeline-scale-hint,
.archive-viewer:-webkit-full-screen .timeline-scale-hint { display: none; }
.archive-viewer:fullscreen .timeline-day-button,
.archive-viewer:-webkit-full-screen .timeline-day-button {
  color: #fff;
  border-color: rgba(255,255,255,.45);
  background: #17241f;
}
.archive-viewer:fullscreen .timeline-day-button:not(:disabled):hover,
.archive-viewer:-webkit-full-screen .timeline-day-button:not(:disabled):hover { background: #22352d; }
.archive-viewer:fullscreen .timeline-selected-date,
.archive-viewer:-webkit-full-screen .timeline-selected-date {
  color: #fff;
  border-color: rgba(255,255,255,.32);
  background: #0b120e;
}
.archive-viewer:fullscreen .timeline-zoom,
.archive-viewer:-webkit-full-screen .timeline-zoom { border-color: rgba(255,255,255,.45); background: #17241f; }
.archive-viewer:fullscreen .timeline-zoom-button,
.archive-viewer:-webkit-full-screen .timeline-zoom-button { color: #fff; border-color: rgba(255,255,255,.24); }
.archive-viewer:fullscreen .timeline-zoom-button[aria-pressed="true"],
.archive-viewer:-webkit-full-screen .timeline-zoom-button[aria-pressed="true"] { background: var(--accent); }
.archive-viewer:fullscreen .timeline-day-button:focus-visible,
.archive-viewer:-webkit-full-screen .timeline-day-button:focus-visible,
.archive-viewer:fullscreen .timeline-zoom-button:focus-visible,
.archive-viewer:-webkit-full-screen .timeline-zoom-button:focus-visible {
  outline-color: var(--focus-on-dark);
  box-shadow: var(--focus-on-dark-shadow);
}
.archive-viewer:fullscreen .archive-current-time,
.archive-viewer:-webkit-full-screen .archive-current-time { display: none; }
.archive-viewer:fullscreen .archive-stage,
.archive-viewer:-webkit-full-screen .archive-stage { height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; }
.archive-viewer:fullscreen .archive-player-status,
.archive-viewer:-webkit-full-screen .archive-player-status { min-height: 24px; padding: 2px 4px; color: #c4cec8; }
.archive-viewer:fullscreen .archive-control-button,
.archive-viewer:-webkit-full-screen .archive-control-button { color: #fff; border-color: rgba(255,255,255,.45); background: #17241f; }
.archive-viewer:fullscreen .archive-control-primary,
.archive-viewer:-webkit-full-screen .archive-control-primary { background: var(--accent); }
.archive-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 20px;
  color: #c4cec8;
  background: rgba(8, 13, 10, .82);
  text-align: center;
}
.archive-overlay.is-hidden { display: none; }
.archive-overlay strong { color: #fff; font-size: 16px; }
.archive-overlay > span:not(.stage-icon):not(.archive-overlay-spinner) { max-width: 500px; font-size: 13px; line-height: 1.45; }
.archive-overlay-spinner {
  width: 28px;
  height: 28px;
  display: none;
  border: 3px solid rgba(255,255,255,.24);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.archive-overlay[data-state="loading-index"] .archive-overlay-spinner,
.archive-overlay[data-state="preparing"] .archive-overlay-spinner,
.archive-overlay[data-state="buffering"] .archive-overlay-spinner { display: block; }
.archive-overlay[data-state="loading-index"] .stage-icon,
.archive-overlay[data-state="preparing"] .stage-icon,
.archive-overlay[data-state="buffering"] .stage-icon { display: none; }
.archive-overlay-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; pointer-events: auto; }
.archive-stage-time {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 3;
  max-width: calc(100% - 20px);
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 7px;
  color: #fff;
  background: rgba(8,13,10,.72);
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.archive-player-status { min-height: 29px; padding: 7px 2px 2px; color: var(--muted); font-size: 12px; }
.archive-player-status.status-error { color: var(--crit); font-weight: 750; }
.archive-controls {
  display: grid;
  grid-template-columns: 72px minmax(128px, 1fr) 72px 48px 48px 48px minmax(104px, auto) minmax(124px, auto);
  align-items: stretch;
  gap: 8px;
}
.archive-control-button {
  min-width: 0;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  cursor: pointer;
}
.archive-control-button:not(:disabled):hover { border-color: #8fa097; background: var(--surface-raised); }
.archive-control-primary { color: #fff; border-color: var(--accent); background: var(--accent); }
.archive-control-primary:not(:disabled):hover { color: #fff; border-color: var(--accent-strong); background: var(--accent-strong); }
.archive-control-icon { width: 48px; padding: 0; }
.archive-control-icon .ui-icon { width: 22px; height: 22px; }
.archive-audio-button[aria-pressed="true"] { color: var(--accent-strong); border-color: #8ab9af; background: var(--accent-soft); }
.archive-speed-button { font-variant-numeric: tabular-nums; white-space: nowrap; }
.archive-download-button { color: var(--accent-strong); border-color: #9fc5bd; background: var(--accent-soft); }

.system-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.system-band { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.system-band-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.system-band-header h2 { margin: 0; }
.system-band-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.system-verdict { margin-bottom: 13px; padding: 9px 11px; border-radius: var(--radius-sm); color: #1d5f3f; background: var(--ok-soft); font-size: 12px; font-weight: 700; }
.system-verdict.status-warn { color: #704400; background: var(--warn-soft); }
.system-verdict.status-crit { color: #84231f; background: var(--crit-soft); }
.key-values { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(110px, 1fr); gap: 9px 16px; margin: 0; font-size: 12px; }
.key-values dt { color: var(--muted); }
.key-values dd { min-width: 0; margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.technical-details { margin-top: 13px; border-top: 1px solid var(--line); }
.technical-details summary { min-height: 44px; display: flex; align-items: center; color: var(--accent-strong); font-size: 12px; font-weight: 700; cursor: pointer; }

.back-button {
  min-height: 44px;
  margin: -8px 0 10px;
  padding: 0;
  border: 0;
  color: var(--accent-strong);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.camera-heading { align-items: flex-end; gap: 18px; margin-bottom: 16px; }
.camera-title-block { min-width: 0; }
.title-with-status { min-width: 0; gap: 12px; flex-wrap: wrap; }
.title-with-status h1 { margin: 0; }
.camera-facts { min-width: 0; gap: 7px; flex: 1 1 auto; flex-wrap: wrap; }
.fact-pill { min-width: 0; max-width: 100%; padding: 5px 8px; border-radius: 6px; color: var(--muted); background: var(--surface-soft); font-size: 11px; overflow-wrap: anywhere; }
.camera-heading-actions { margin-left: auto; justify-content: flex-end; }
.camera-issue-banner { margin-bottom: 14px; padding: 12px 14px; border: 1px solid #efb9b4; border-left: 5px solid var(--crit); border-radius: var(--radius); color: #70231f; background: var(--crit-soft); font-size: 13px; line-height: 1.45; }
.camera-tabs { display: flex; gap: 3px; margin-bottom: 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  min-width: 110px;
  min-height: 46px;
  padding: 8px 15px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font-weight: 650;
  cursor: pointer;
}
.tab:hover { color: var(--ink); background: rgba(255,255,255,.55); }
.tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); font-weight: 800; }
.panel { min-width: 0; }
.viewer-toolbar { justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.viewer-controls { gap: 8px; flex-wrap: wrap; }
.segmented { display: inline-grid; grid-template-columns: repeat(2, minmax(92px, auto)); overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.segment { min-height: 44px; padding: 6px 12px; border: 0; border-right: 1px solid var(--line); color: var(--ink-soft); background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.segment:last-child { border-right: 0; }
.segment.active { color: #fff; background: var(--accent); }
.live-audio { min-width: 132px; }
.live-audio.active { color: var(--accent-strong); border-color: #8ab9af; background: var(--accent-soft); }
.live-state { color: var(--muted); font-size: 11px; }
.panel-heading { justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.panel-heading h2 { margin-bottom: 3px; }
.panel-heading p { margin: 0; font-size: 11px; }
.event-list { display: grid; gap: 8px; }
.event-row { display: grid; grid-template-columns: 155px 95px minmax(0, 1fr); gap: 12px; align-items: start; padding: 11px 13px; border: 1px solid var(--line); border-left: 5px solid var(--unknown); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); }
.event-row.status-ok { border-left-color: var(--ok); }
.event-row.status-warn { border-left-color: var(--warn); }
.event-row.status-crit { border-left-color: var(--crit); }
.event-time, .event-source { color: var(--muted); font-size: 11px; }
.event-message { min-width: 0; overflow-wrap: anywhere; font-size: 12px; line-height: 1.4; }
.event-transition { display: block; margin-bottom: 2px; color: var(--ink); font-weight: 750; }

.empty-state {
  min-height: 150px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255,255,255,.58);
  text-align: center;
  font-size: 13px;
}
.empty-state strong { color: var(--ink-soft); }
.loading-lines { display: grid; gap: 8px; }
.loading-line { height: 16px; border-radius: 6px; background: linear-gradient(90deg, #e9edea 25%, #f6f8f6 50%, #e9edea 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

.mobile-nav { display: none; }
.archive-download-dialog {
  width: min(520px, calc(100vw - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right))));
  max-width: 520px;
  max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: max(14px, env(safe-area-inset-top)) auto max(14px, env(safe-area-inset-bottom));
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: transparent;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.archive-download-dialog::backdrop { background: rgba(10, 19, 15, .64); backdrop-filter: blur(3px); }
.archive-download-card {
  max-height: inherit;
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.archive-download-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.archive-download-heading h2 { margin: 0; }
.archive-dialog-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--surface);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.archive-download-help { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.archive-download-summary { display: grid; gap: 8px; margin: 0; }
.archive-download-summary > div { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; }
.archive-download-summary dt { color: var(--muted); font-size: 12px; }
.archive-download-summary dd { min-width: 0; margin: 0; font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.archive-download-duration { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.archive-download-duration select { width: 100%; height: 44px; font-size: 16px; }
.archive-download-status { min-height: 22px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.archive-download-status.status-error { color: var(--crit); font-weight: 750; }
.archive-download-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.archive-download-actions > :only-child,
.archive-download-actions #archiveDownloadReady { grid-column: 1 / -1; }
.action-dialog {
  --dialog-safe-inline: max(14px, env(safe-area-inset-left), env(safe-area-inset-right));
  width: min(520px, calc(100vw - var(--dialog-safe-inline) - var(--dialog-safe-inline)));
  max-width: 520px;
  max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin-top: max(14px, env(safe-area-inset-top));
  margin-right: auto;
  margin-bottom: max(14px, env(safe-area-inset-bottom));
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: transparent;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.action-dialog::backdrop { background: rgba(10, 19, 15, .58); backdrop-filter: blur(3px); }
.action-dialog-card { max-height: inherit; display: grid; gap: 16px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow-y: auto; overscroll-behavior: contain; }
.action-dialog-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; }
.action-dialog-heading .eyebrow { margin-bottom: 5px; }
.action-dialog-heading h2 { margin: 0; font-size: 21px; }
.action-dialog-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #704400; background: var(--warn-soft); }
.action-dialog-icon .ui-icon { width: 22px; height: 22px; }
.action-dialog-text { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }
.action-dialog-note { margin: -4px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); color: #654000; background: var(--warn-soft); font-size: 12px; line-height: 1.45; }
.action-dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.toast {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 60;
  max-width: min(430px, calc(100vw - max(20px, env(safe-area-inset-left)) - max(20px, env(safe-area-inset-right))));
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: #26352e;
  box-shadow: var(--shadow-md);
  font-size: 12px;
  line-height: 1.4;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1210;
  --surface: #151d19;
  --surface-soft: #1c2822;
  --surface-raised: #202c26;
  --ink: #eef4f0;
  --ink-soft: #c3cec7;
  --muted: #9baaa2;
  --line: #34423a;
  --line-strong: #63766b;
  --accent: #08766b;
  --accent-strong: #67e3cf;
  --accent-soft: #17352f;
  --ok: #187749;
  --ok-soft: #173426;
  --warn: #995d00;
  --warn-soft: #382a12;
  --crit: #c54842;
  --crit-strong: #ffb4ae;
  --crit-soft: #3a1f1e;
  --unknown: #5b6b62;
  --unknown-soft: #252e29;
  --header: #0a100d;
  --header-soft: #18251f;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, .58);
  --focus: 0 0 0 3px rgba(103, 227, 207, .36);
  --focus-on-dark: #67e3cf;
  --focus-on-dark-shadow: 0 0 0 3px rgba(103, 227, 207, .36);
  scrollbar-color: #63766b var(--bg);
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 15% -20%, rgba(103, 227, 207, .04), transparent 34rem),
    var(--bg);
}
:root[data-theme="dark"] :focus-visible { outline-color: var(--focus-on-dark); }
:root[data-theme="dark"] ::selection { color: #fff; background: #155f55; }
:root[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #63766b;
  border: 3px solid var(--bg);
  border-radius: 999px;
}

:root[data-theme="dark"] .button-primary,
:root[data-theme="dark"] .filter-chip.active,
:root[data-theme="dark"] .segment.active,
:root[data-theme="dark"] .skip-link,
:root[data-theme="dark"] .theme-radio:checked + span {
  color: #fff;
  border-color: #08766b;
  background: #08766b;
}
:root[data-theme="dark"] .button-primary:not(:disabled):hover {
  color: #fff;
  border-color: #066259;
  background: #066259;
}
:root[data-theme="dark"] .theme-radio:focus-visible + span {
  outline-color: var(--focus-on-dark);
  box-shadow: var(--focus-on-dark-shadow);
}
:root[data-theme="dark"] .button:not(:disabled):hover { border-color: #71837a; }
:root[data-theme="dark"] .button-secondary { color: #67e3cf; border-color: #4d867b; background: #17352f; }
:root[data-theme="dark"] .button-warning { color: #ffd78b; border-color: #ae7d2d; background: #382a12; }
:root[data-theme="dark"] .search-field,
:root[data-theme="dark"] input,
:root[data-theme="dark"] select {
  color-scheme: dark;
  color: var(--ink);
  background: #111814;
  border-color: var(--line-strong);
  caret-color: var(--focus-on-dark);
}
:root[data-theme="dark"] .search-field input { background: transparent; }
:root[data-theme="dark"] input::placeholder { color: #7f9187; }
:root[data-theme="dark"] select option { color: var(--ink); background: var(--surface); }
:root[data-theme="dark"] input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px #111814 inset;
  caret-color: var(--focus-on-dark);
}

:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .archive-card { background: rgba(21, 29, 25, .96); }
:root[data-theme="dark"] .metric-action:hover { border-color: #4d867b; background: #202c26; }
:root[data-theme="dark"] .camera-toolbar,
:root[data-theme="dark"] .incident-toolbar,
:root[data-theme="dark"] .incident-group > summary { background: rgba(21, 29, 25, .9); }
:root[data-theme="dark"] .incident-group > summary:hover { background: var(--surface-raised); }
:root[data-theme="dark"] .empty-state { background: rgba(21, 29, 25, .72); }

:root[data-theme="dark"] .status-ok,
:root[data-theme="dark"] .incident-state.is-resolved {
  color: #9ee8bd;
  background: #173426;
  border-color: #3d986c;
}
:root[data-theme="dark"] .status-warn {
  color: #ffd78b;
  background: #382a12;
  border-color: #ae7d2d;
}
:root[data-theme="dark"] .status-crit,
:root[data-theme="dark"] .incident-state {
  color: #ffb4ae;
  background: #3a1f1e;
  border-color: #bd5a55;
}
:root[data-theme="dark"] .status-unknown {
  color: #c8d2cc;
  background: #252e29;
  border-color: #74837b;
}
:root[data-theme="dark"] .status-ok .status-symbol { background: #187749; }
:root[data-theme="dark"] .status-warn .status-symbol { background: #995d00; }
:root[data-theme="dark"] .status-crit .status-symbol { background: #c54842; }
:root[data-theme="dark"] .status-unknown .status-symbol { background: #5b6b62; }

:root[data-theme="dark"] .attention-strip {
  color: #ffd78b;
  border-color: #ae7d2d;
  border-left-color: #995d00;
  background: #382a12;
}
:root[data-theme="dark"] .attention-strip span,
:root[data-theme="dark"] .history-badge,
:root[data-theme="dark"] .history-badge small,
:root[data-theme="dark"] .incident-scope-note { color: #f0c778; }
:root[data-theme="dark"] .attention-strip.is-error {
  color: #ffb4ae;
  border-color: #bd5a55;
  border-left-color: #c54842;
  background: #3a1f1e;
}
:root[data-theme="dark"] .attention-strip.is-error span { color: #eeb0aa; }
:root[data-theme="dark"] .history-badge {
  border-top-color: #ae7d2d;
  background: #382a12;
}
:root[data-theme="dark"] .history-badge:hover { color: #ffd78b; border-color: #c18e39; background: #443419; }
:root[data-theme="dark"] .history-badge:active { background: #4d3a1b; }

:root[data-theme="dark"] .info-callout,
:root[data-theme="dark"] .operator-mode-notice.is-protected {
  color: #c3ece4;
  border-color: #4d867b;
  background: #17352f;
}
:root[data-theme="dark"] .operator-mode-notice.is-protected span { color: #a9c9c0; }
:root[data-theme="dark"] .operator-mode-notice {
  color: #ffd78b;
  border-color: #ae7d2d;
  background: #382a12;
}
:root[data-theme="dark"] .operator-mode-notice span { color: #f0c778; }

:root[data-theme="dark"] .incident-card.is-acknowledged { border-color: #3b4a42; background: #18221d; }
:root[data-theme="dark"] .incident-detail { color: #d7c7ad; background: #2b251c; }
:root[data-theme="dark"] .acknowledged-label { color: #9ee8bd; }
:root[data-theme="dark"] .incident-summary-error,
:root[data-theme="dark"] .archive-player-status.status-error { color: #ffb4ae; }

:root[data-theme="dark"] .timeline-track {
  background: repeating-linear-gradient(90deg, #1c2822 0, #1c2822 calc(4.166% - 1px), #394840 calc(4.166% - 1px), #394840 4.166%);
}
:root[data-theme="dark"] .timeline-input { background: transparent; }
:root[data-theme="dark"] .timeline-segment { background: #29a868; }
:root[data-theme="dark"] .timeline-zoom { background: #111814; }
:root[data-theme="dark"] .timeline-zoom-button { color: var(--ink-soft); border-color: #394840; }
:root[data-theme="dark"] .timeline-zoom-button[aria-pressed="true"] { color: #fff; background: #08766b; }
:root[data-theme="dark"] .timeline-day-button { color: var(--ink); border-color: #56685f; background: #111814; }
:root[data-theme="dark"] .timeline-day-button:not(:disabled):hover { border-color: #67b7a8; background: #202c26; }
:root[data-theme="dark"] .timeline-selected-date { color: var(--ink); border-color: #46574e; background: #1c2822; }
:root[data-theme="dark"] .timeline-window-boundaries time { color: var(--ink); }
:root[data-theme="dark"] .archive-current-time { background: #1c2822; }
:root[data-theme="dark"] .archive-control-button,
:root[data-theme="dark"] .archive-dialog-close { color: var(--ink); background: #111814; }
:root[data-theme="dark"] .archive-control-button:not(:disabled):hover,
:root[data-theme="dark"] .archive-dialog-close:hover { border-color: #71837a; background: #202c26; }
:root[data-theme="dark"] .archive-control-primary { color: #fff; border-color: #08766b; background: #08766b; }
:root[data-theme="dark"] .archive-audio-button[aria-pressed="true"] { color: #67e3cf; border-color: #4d867b; background: #17352f; }
:root[data-theme="dark"] .archive-download-button { color: #67e3cf; border-color: #4d867b; background: #17352f; }
:root[data-theme="dark"] .archive-download-dialog::backdrop { background: rgba(0, 0, 0, .72); }
:root[data-theme="dark"] .system-verdict { color: #9ee8bd; background: #173426; }
:root[data-theme="dark"] .system-verdict.status-warn { color: #ffd78b; background: #382a12; }
:root[data-theme="dark"] .system-verdict.status-crit { color: #ffb4ae; background: #3a1f1e; }
:root[data-theme="dark"] .camera-issue-banner { color: #ffb4ae; border-color: #bd5a55; border-left-color: #c54842; background: #3a1f1e; }
:root[data-theme="dark"] .tab:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
:root[data-theme="dark"] .live-audio.active { color: #67e3cf; border-color: #4d867b; background: #17352f; }
:root[data-theme="dark"] .loading-line {
  background: linear-gradient(90deg, #1c2822 25%, #2a3831 50%, #1c2822 75%);
  background-size: 200% 100%;
}
:root[data-theme="dark"] .action-dialog::backdrop { background: rgba(0, 0, 0, .72); }
:root[data-theme="dark"] .action-dialog-icon,
:root[data-theme="dark"] .action-dialog-note { color: #ffd78b; background: #382a12; }
:root[data-theme="dark"] .mobile-nav {
  background: rgba(21, 29, 25, .96);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, .42);
}
:root[data-theme="dark"] .camera-image,
:root[data-theme="dark"] .live-stage,
:root[data-theme="dark"] .archive-stage,
:root[data-theme="dark"] .live-stage iframe,
:root[data-theme="dark"] .archive-stage video { background: #050806; }

.camera-note,
.camera-issue-banner,
.incident-heading h2,
.incident-detail,
.section-summary > span,
.live-state,
.event-source,
.system-verdict,
.key-values dt,
.timeline-status,
.archive-player-status,
.empty-state,
.toast {
  min-width: 0;
  overflow-wrap: anywhere;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: minmax(230px, 1fr) auto minmax(180px, 1fr);
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }
  .brand-copy small, .refresh-label { display: none; }
  .camera-grid { grid-template-columns: repeat(3, minmax(210px, 1fr)); }
  .archive-toolbar {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    grid-template-areas:
      "camera camera date time"
      "latest latest latest latest";
  }
  .timeline-toolbar {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .timeline-toolbar-controls {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 272px;
  }
  .timeline-day-navigation,
  .timeline-scale-control { width: 100%; }
  .archive-viewer:fullscreen .timeline-toolbar,
  .archive-viewer:-webkit-full-screen .timeline-toolbar {
    display: flex;
    align-items: end;
  }
  .archive-viewer:fullscreen .timeline-toolbar-controls,
  .archive-viewer:-webkit-full-screen .timeline-toolbar-controls {
    width: auto;
    display: flex;
  }
  .archive-viewer:fullscreen .timeline-day-navigation,
  .archive-viewer:-webkit-full-screen .timeline-day-navigation { width: min(380px, 100%); }
  .archive-viewer:fullscreen .timeline-scale-control,
  .archive-viewer:-webkit-full-screen .timeline-scale-control { width: 252px; }
}

@media (min-width: 901px) and (max-width: 1535px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 10px;
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }
  .brand-block { gap: 6px; }
  .brand { gap: 0; }
  .brand-mark { width: 37px; }
  .brand-copy { display: none; }
  .operator-mode-badge { padding-right: 7px; padding-left: 7px; }
  .operator-mode-badge .ui-icon { display: none; }
  .operator-mode-long { display: none; }
  .operator-mode-short { display: inline; }
  .primary-nav { min-width: 0; gap: 0; }
  .nav-link { padding: 0 8px; font-size: 13px; }
  .topbar-actions { gap: 8px; }
  .refresh-label { display: none; }
}

@media (min-width: 901px) and (max-width: 980px) {
  .archive-controls {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .archive-controls #archiveSkipBack { grid-column: 1 / 2; grid-row: 1; }
  .archive-controls #archivePlayPause { grid-column: 2 / 7; grid-row: 1; }
  .archive-controls #archiveSkipForward { grid-column: 7 / 8; grid-row: 1; }
  .archive-controls #archiveAudio { grid-column: 1 / 2; grid-row: 2; width: auto; }
  .archive-controls #archiveFullscreen { grid-column: 2 / 3; grid-row: 2; width: auto; }
  .archive-controls #archiveFrame { grid-column: 3 / 4; grid-row: 2; width: auto; }
  .archive-controls #archivePlaybackSpeed { grid-column: 4 / 6; grid-row: 2; }
  .archive-controls #openArchiveDownload { grid-column: 6 / 8; grid-row: 2; }
}

@media (max-width: 900px) {
  :root {
    --topbar-content-height: 62px;
    --mobile-nav-height: calc(70px + env(safe-area-inset-bottom));
  }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .primary-nav { display: none; }
  .brand-copy strong { font-size: 14px; }
  .operator-mode-badge .ui-icon { display: none; }
  .operator-mode-long { display: none; }
  .operator-mode-short { display: inline; }
  .update-meta { display: none; }
  main {
    padding: 22px max(16px, env(safe-area-inset-right)) calc(var(--mobile-nav-height) + 28px) max(16px, env(safe-area-inset-left));
    scroll-padding-bottom: calc(var(--mobile-nav-height) + 16px);
  }
  .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .camera-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .camera-toolbar, .incident-toolbar { align-items: stretch; flex-wrap: wrap; }
  .camera-toolbar .search-field, .incident-toolbar .search-field { flex-basis: 100%; }
  .filter-chips { flex: 1 1 auto; }
  .system-details { grid-template-columns: 1fr; }
  .incident-card { grid-template-columns: 1fr; }
  .incident-actions { max-width: none; justify-content: flex-start; }
  .archive-viewer:fullscreen .timeline-window-copy,
  .archive-viewer:-webkit-full-screen .timeline-window-copy { display: none; }
  .timeline-toolbar-controls { grid-template-columns: minmax(0, 1fr); }
  .archive-viewer:fullscreen .timeline-toolbar-controls,
  .archive-viewer:-webkit-full-screen .timeline-toolbar-controls {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 252px;
  }
  .archive-viewer:fullscreen .timeline-day-navigation,
  .archive-viewer:-webkit-full-screen .timeline-day-navigation,
  .archive-viewer:fullscreen .timeline-scale-control,
  .archive-viewer:-webkit-full-screen .timeline-scale-control { width: 100%; }
  .archive-controls {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .archive-controls #archiveSkipBack { grid-column: 1 / 2; grid-row: 1; }
  .archive-controls #archivePlayPause { grid-column: 2 / 7; grid-row: 1; }
  .archive-controls #archiveSkipForward { grid-column: 7 / 8; grid-row: 1; }
  .archive-controls #archiveAudio { grid-column: 1 / 2; grid-row: 2; width: auto; }
  .archive-controls #archiveFullscreen { grid-column: 2 / 3; grid-row: 2; width: auto; }
  .archive-controls #archiveFrame { grid-column: 3 / 4; grid-row: 2; width: auto; }
  .archive-controls #archivePlaybackSpeed { grid-column: 4 / 6; grid-row: 2; }
  .archive-controls #openArchiveDownload { grid-column: 6 / 8; grid-row: 2; }
  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    min-height: var(--mobile-nav-height);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.96);
    box-shadow: 0 -6px 18px rgba(21,36,29,.08);
    backdrop-filter: blur(14px);
  }
  .mobile-nav a { position: relative; min-height: 54px; display: grid; place-content: center; justify-items: center; gap: 4px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 750; }
  .mobile-nav a > .ui-icon { width: 20px; height: 20px; }
  .mobile-nav a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); }
  .mobile-count { position: absolute; top: 3px; left: calc(50% + 8px); }
  .toast { bottom: calc(var(--mobile-nav-height) + 12px); }
}

@media (hover: none) and (pointer: coarse) {
  .live-pip:not([hidden]) { display: inline-flex; }
}

@media (max-width: 620px) {
  .topbar {
    padding-right: max(10px, env(safe-area-inset-right));
    padding-left: max(10px, env(safe-area-inset-left));
    gap: 8px;
  }
  .brand-block { gap: 7px; }
  .brand-mark { width: 37px; }
  .brand-copy { display: none; }
  .operator-mode-badge { flex: 0 0 auto; padding-right: 7px; padding-left: 7px; }
  .operator-mode-long { display: none; }
  .operator-mode-short { display: inline; }
  .connection-banner {
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  }
  .connection-banner span { flex-basis: calc(100% - 100px); }
  main { padding: 18px max(10px, env(safe-area-inset-right)) calc(var(--mobile-nav-height) + 24px) max(10px, env(safe-area-inset-left)); }
  .page-heading { align-items: flex-start; margin-bottom: 17px; }
  .page-heading-actions { flex-wrap: wrap; }
  .theme-picker { width: 100%; flex: 1 0 100%; }
  h1 { font-size: 27px; }
  .page-lead { font-size: 13px; }
  .overview-metrics { gap: 8px; }
  .metric-card { min-height: 104px; padding: 13px; }
  .metric-value { font-size: 24px; }
  .metric-hint { font-size: 11px; }
  .attention-strip { min-height: 66px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 10px 10px 10px 14px; }
  .attention-strip span { font-size: 11px; }
  .attention-strip .button { width: auto; min-height: 44px; padding: 7px 10px; }
  .camera-toolbar, .incident-toolbar { margin-top: 15px; padding: 8px; }
  .select-field { width: 100%; justify-content: space-between; }
  .select-field select { flex: 1 1 auto; }
  .filter-chips { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .filter-chip { min-height: 44px; flex: 0 0 auto; }
  .camera-groups { gap: 21px; }
  .camera-grid { grid-template-columns: 1fr; gap: 9px; }
  .camera-card-link { display: grid; grid-template-columns: clamp(140px, 42%, 156px) minmax(0, 1fr); align-items: start; min-height: 0; }
  .camera-image { height: auto; aspect-ratio: 16 / 9; align-self: start; }
  .camera-card-body { padding: 10px 10px 10px 13px; }
  .camera-card-title { align-items: flex-start; }
  .camera-card-title .status-badge { min-height: 25px; padding: 3px 6px; }
  .camera-card-title .status-symbol { width: 15px; height: 15px; }
  .camera-card-title .status-badge span:last-child { display: none; }
  .camera-card[data-status="ok"] .camera-note { display: none; }
  .camera-meta-row { display: grid; gap: 2px; }
  .camera-meta-row span:last-child { display: none; }
  .camera-meta, .history-badge { font-size: 12px; }
  .history-badge small, .snapshot-state { font-size: 11px; }
  .snapshot-state { right: 6px; bottom: 6px; padding: 3px 6px; }
  .incident-card { padding: 15px 13px 15px 18px; }
  .section-summary { align-items: stretch; flex-direction: column; }
  .section-summary .button { width: 100%; }
  .incident-group > summary { align-items: flex-start; }
  .incident-group-count { margin-top: 2px; }
  .incident-group-copy span, .incident-meta { font-size: 12px; }
  .incident-state, .incident-group-count { font-size: 11px; }
  .incident-actions { display: grid; grid-template-columns: 1fr; }
  .incident-actions .button { width: 100%; }
  .archive-card { padding: 10px; border-radius: var(--radius); }
  .archive-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "camera camera"
      "date time"
      "latest latest";
  }
  .archive-toolbar input, .archive-toolbar select { min-width: 0; font-size: 16px; }
  .timeline-toolbar { align-items: stretch; display: grid; grid-template-columns: minmax(0, 1fr); }
  .timeline-toolbar-controls { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .timeline-day-navigation {
    grid-template-columns: minmax(76px, auto) minmax(0, 1fr) minmax(76px, auto);
  }
  .timeline-day-wide { display: none; }
  .timeline-day-compact { display: inline; }
  .timeline-day-button { padding-right: 8px; padding-left: 8px; }
  .timeline-scale-control { width: 100%; }
  .timeline-zoom { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .timeline-zoom-button { min-width: 0; }
  .timeline-legend { gap: 9px; font-size: 10px; }
  .archive-viewer:fullscreen .timeline-wrap,
  .archive-viewer:-webkit-full-screen .timeline-wrap { padding: 6px 8px; }
  .archive-viewer:fullscreen .timeline-toolbar,
  .archive-viewer:-webkit-full-screen .timeline-toolbar {
    display: flex;
    margin-bottom: 4px;
  }
  .archive-viewer:fullscreen .timeline-toolbar-controls,
  .archive-viewer:-webkit-full-screen .timeline-toolbar-controls {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .archive-viewer:fullscreen .timeline-window-copy,
  .archive-viewer:-webkit-full-screen .timeline-window-copy,
  .archive-viewer:fullscreen .timeline-hours,
  .archive-viewer:-webkit-full-screen .timeline-hours,
  .archive-viewer:fullscreen .timeline-legend,
  .archive-viewer:-webkit-full-screen .timeline-legend,
  .archive-viewer:fullscreen .timeline-status,
  .archive-viewer:-webkit-full-screen .timeline-status { display: none; }
  .archive-current-time { grid-template-columns: 1fr; gap: 3px; }
  .archive-current-time > span { grid-row: auto; }
  .archive-stage-time { right: 6px; top: 6px; max-width: calc(100% - 12px); font-size: 11px; }
  .archive-overlay { padding: 14px; }
  .archive-overlay .stage-icon { display: none; }
  .archive-overlay strong { font-size: 15px; }
  .archive-overlay > span:not(.stage-icon):not(.archive-overlay-spinner) { font-size: 12px; }
  .archive-download-card { padding: 17px 14px; }
  .archive-download-actions { grid-template-columns: 1fr; }
  .archive-download-actions > *,
  .archive-download-actions #archiveDownloadReady { grid-column: auto; }
  .camera-heading { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .camera-title-block { width: 100%; }
  .camera-facts { order: 3; width: 100%; }
  .camera-heading-actions { width: 100%; display: grid; grid-template-columns: 1fr; margin-left: 0; }
  .camera-heading-actions .button { width: 100%; }
  .camera-tabs { margin-right: -10px; margin-left: -10px; padding-left: 10px; }
  .viewer-toolbar { align-items: stretch; }
  .viewer-controls { width: 100%; display: grid; grid-template-columns: 1fr; }
  .segmented { grid-template-columns: repeat(2, 1fr); }
  .live-audio { width: 100%; }
  .live-stage, .archive-stage { border-radius: var(--radius-sm); }
  .event-row { grid-template-columns: 1fr auto; gap: 5px 10px; }
  .event-message { grid-column: 1 / -1; }
  .key-values { grid-template-columns: minmax(0, 1fr) minmax(90px, 1fr); gap: 8px 12px; }
  .operator-mode-notice { grid-template-columns: auto minmax(0, 1fr); }
  .operator-mode-notice .button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 410px) {
  .camera-card-title strong { font-size: 14px; }
  .archive-toolbar {
    grid-template-columns: 1fr;
    grid-template-areas: "camera" "date" "time" "latest";
  }
  .archive-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-controls #archivePlayPause { grid-column: 1 / 3; grid-row: 1; }
  .archive-controls #archiveSkipBack { grid-column: 1 / 2; grid-row: 2; }
  .archive-controls #archiveSkipForward { grid-column: 2 / 3; grid-row: 2; }
  .archive-controls #archiveAudio { grid-column: 1 / 2; grid-row: 3; width: auto; }
  .archive-controls #archiveFullscreen { grid-column: 2 / 3; grid-row: 3; width: auto; }
  .archive-controls #archiveFrame { grid-column: 1 / 2; grid-row: 4; width: auto; }
  .archive-controls #archivePlaybackSpeed { grid-column: 2 / 3; grid-row: 4; }
  .archive-controls #openArchiveDownload { grid-column: 1 / 3; grid-row: 5; }
  .archive-viewer:fullscreen .archive-controls,
  .archive-viewer:-webkit-full-screen .archive-controls { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .archive-viewer:fullscreen .archive-controls #archiveSkipBack,
  .archive-viewer:-webkit-full-screen .archive-controls #archiveSkipBack { grid-column: 1 / 2; grid-row: 1; }
  .archive-viewer:fullscreen .archive-controls #archivePlayPause,
  .archive-viewer:-webkit-full-screen .archive-controls #archivePlayPause { grid-column: 2 / 4; grid-row: 1; }
  .archive-viewer:fullscreen .archive-controls #archiveSkipForward,
  .archive-viewer:-webkit-full-screen .archive-controls #archiveSkipForward { grid-column: 4 / 5; grid-row: 1; }
  .archive-viewer:fullscreen .archive-controls #archiveAudio,
  .archive-viewer:-webkit-full-screen .archive-controls #archiveAudio { grid-column: 1 / 2; grid-row: 2; width: auto; }
  .archive-viewer:fullscreen .archive-controls #archiveFullscreen,
  .archive-viewer:-webkit-full-screen .archive-controls #archiveFullscreen { grid-column: 2 / 3; grid-row: 2; width: auto; }
  .archive-viewer:fullscreen .archive-controls #archiveFrame,
  .archive-viewer:-webkit-full-screen .archive-controls #archiveFrame { grid-column: 3 / 4; grid-row: 2; width: auto; }
  .archive-viewer:fullscreen .archive-controls #archivePlaybackSpeed,
  .archive-viewer:-webkit-full-screen .archive-controls #archivePlaybackSpeed {
    grid-column: 4 / 5;
    grid-row: 2;
    font-size: 0;
  }
  .archive-viewer:fullscreen .archive-controls #archivePlaybackSpeed::after,
  .archive-viewer:-webkit-full-screen .archive-controls #archivePlaybackSpeed::after {
    content: attr(data-rate-label);
    font-size: 13px;
  }
  .archive-viewer:fullscreen .archive-controls #openArchiveDownload,
  .archive-viewer:-webkit-full-screen .archive-controls #openArchiveDownload { grid-column: 1 / 5; grid-row: 3; }
  .archive-download-dialog { width: calc(100vw - 16px); margin-bottom: max(8px, env(safe-area-inset-bottom)); }
  .action-dialog { width: calc(100vw - 16px); margin-bottom: max(8px, env(safe-area-inset-bottom)); }
  .action-dialog-card { padding: 18px 16px; border-radius: var(--radius); }
}

body.archive-immersive-active {
  position: fixed;
  top: var(--archive-immersive-scroll-offset, 0);
  right: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.archive-viewer.archive-immersive {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  overflow: hidden;
  padding:
    max(8px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  color: #fff;
  background: #050806;
}
.archive-viewer.archive-immersive .timeline-wrap {
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: var(--radius-sm);
  background: #101914;
}
.archive-viewer.archive-immersive .timeline-window-copy,
.archive-viewer.archive-immersive .timeline-hours,
.archive-viewer.archive-immersive .timeline-legend,
.archive-viewer.archive-immersive .timeline-status { display: none; }
.archive-viewer.archive-immersive .timeline-toolbar { margin-bottom: 4px; }
.archive-viewer.archive-immersive .timeline-window-boundaries,
.archive-viewer.archive-immersive .timeline-scale-control legend,
.archive-viewer.archive-immersive .timeline-scale-hint { color: #c4cec8; }
.archive-viewer.archive-immersive .timeline-window-boundaries time { color: #fff; }
.archive-viewer.archive-immersive .timeline-day-button,
.archive-viewer.archive-immersive .timeline-zoom,
.archive-viewer.archive-immersive .timeline-zoom-button {
  color: #fff;
  border-color: rgba(255,255,255,.4);
  background: #17241f;
}
.archive-viewer.archive-immersive .timeline-zoom-button[aria-pressed="true"] { background: var(--accent); }
.archive-viewer.archive-immersive .timeline-day-button:focus-visible,
.archive-viewer.archive-immersive .timeline-zoom-button:focus-visible {
  outline-color: var(--focus-on-dark);
  box-shadow: var(--focus-on-dark-shadow);
}
.archive-viewer.archive-immersive .archive-current-time { display: none; }
.archive-viewer.archive-immersive .archive-stage {
  min-width: 0;
  min-height: 0;
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}
.archive-viewer.archive-immersive .archive-player-status {
  min-height: 24px;
  padding: 2px 4px;
  color: #c4cec8;
}
.archive-viewer.archive-immersive .archive-control-button {
  color: #fff;
  border-color: rgba(255,255,255,.45);
  background: #17241f;
}
.archive-viewer.archive-immersive .archive-control-primary { background: var(--accent); }

@media (max-width: 410px) {
  .archive-viewer.archive-immersive .archive-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .archive-viewer.archive-immersive .archive-controls #archiveSkipBack { grid-column: 1 / 2; grid-row: 1; }
  .archive-viewer.archive-immersive .archive-controls #archivePlayPause { grid-column: 2 / 4; grid-row: 1; }
  .archive-viewer.archive-immersive .archive-controls #archiveSkipForward { grid-column: 4 / 5; grid-row: 1; }
  .archive-viewer.archive-immersive .archive-controls #archiveAudio { grid-column: 1 / 2; grid-row: 2; width: auto; }
  .archive-viewer.archive-immersive .archive-controls #archiveFullscreen { grid-column: 2 / 3; grid-row: 2; width: auto; }
  .archive-viewer.archive-immersive .archive-controls #archiveFrame { grid-column: 3 / 4; grid-row: 2; width: auto; }
  .archive-viewer.archive-immersive .archive-controls #archivePlaybackSpeed {
    grid-column: 4 / 5;
    grid-row: 2;
    font-size: 0;
  }
  .archive-viewer.archive-immersive .archive-controls #archivePlaybackSpeed::after {
    content: attr(data-rate-label);
    font-size: 13px;
  }
  .archive-viewer.archive-immersive .archive-controls #openArchiveDownload {
    grid-column: 1 / 5;
    grid-row: 3;
  }
}

@media (max-width: 1024px) and (orientation: landscape) and (max-height: 600px) {
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) {
    position: fixed;
    inset: 0;
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding: 0;
    background: #050806;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-stage-time {
    top: calc(max(8px, env(safe-area-inset-top)) + 52px);
    right: max(8px, env(safe-area-inset-right));
    max-width: calc(100% - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right)));
    transition: top .18s ease;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-wrap {
    position: absolute;
    right: max(6px, env(safe-area-inset-right));
    bottom: calc(max(2px, env(safe-area-inset-bottom)) + 52px);
    left: max(6px, env(safe-area-inset-left));
    z-index: 4;
    min-width: 0;
    margin: 0;
    padding: 2px 6px;
    border: 1px solid rgba(255,255,255,.36);
    border-radius: 10px;
    background: rgba(8,13,10,.82);
    box-shadow: 0 4px 18px rgba(0,0,0,.32);
    transition:
      opacity .18s ease,
      visibility 0s linear;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-toolbar {
    position: fixed;
    top: max(6px, env(safe-area-inset-top));
    right: max(6px, env(safe-area-inset-right));
    left: calc(max(6px, env(safe-area-inset-left)) + 52px);
    z-index: 5;
    display: block;
    margin: 0;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-toolbar-controls {
    width: 100%;
    display: block;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-day-navigation {
    width: 100%;
    grid-template-columns: minmax(76px, auto) minmax(0, 1fr) minmax(76px, auto);
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-day-wide { display: none; }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-day-compact { display: inline; }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-day-button {
    min-height: 44px;
    padding-right: 8px;
    padding-left: 8px;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-selected-date {
    color: #fff;
    border-color: rgba(255,255,255,.32);
    background: #0b120e;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-window-copy,
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-scale-control,
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-hours,
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-window-boundaries,
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-legend,
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-status,
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-current-time,
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) #archiveFrame,
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) #openArchiveDownload {
    display: none;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-player-status {
    position: absolute;
    top: calc(max(8px, env(safe-area-inset-top)) + 52px);
    left: max(8px, env(safe-area-inset-left));
    z-index: 5;
    width: fit-content;
    max-width: min(62%, calc(100% - max(24px, env(safe-area-inset-left)) - max(24px, env(safe-area-inset-right))));
    min-height: 0;
    margin: 0;
    padding: 6px 9px;
    border: 1px solid rgba(255,255,255,.38);
    border-radius: 8px;
    color: #fff;
    background: rgba(8,13,10,.84);
    box-shadow: 0 3px 14px rgba(0,0,0,.3);
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-player-status:empty {
    display: none;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-player-status.status-error {
    color: #fff;
    border-color: rgba(255,180,174,.8);
    background: rgba(105,22,22,.92);
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-shell,
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-input {
    height: 44px;
    min-height: 44px;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .timeline-track { inset: 0; }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls {
    position: absolute;
    right: max(6px, env(safe-area-inset-right));
    bottom: max(2px, env(safe-area-inset-bottom));
    left: max(6px, env(safe-area-inset-left));
    z-index: 4;
    display: grid;
    grid-template-columns: 52px minmax(112px, 1fr) 52px 48px minmax(58px, 74px);
    gap: 4px;
    padding: 2px;
    border: 1px solid rgba(255,255,255,.36);
    border-radius: 10px;
    background: rgba(8,13,10,.82);
    box-shadow: 0 4px 18px rgba(0,0,0,.32);
    transition:
      border-color .18s ease,
      background-color .18s ease,
      box-shadow .18s ease;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls > :not(#archiveFullscreen) {
    transition:
      opacity .18s ease,
      transform .18s ease,
      visibility 0s linear;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-control-button {
    min-height: 44px;
    padding: 5px 7px;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archiveSkipBack {
    grid-column: 1 / 2;
    grid-row: 1;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archivePlayPause {
    grid-column: 2 / 3;
    grid-row: 1;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archiveSkipForward {
    grid-column: 3 / 4;
    grid-row: 1;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archiveAudio {
    width: auto;
    grid-column: 4 / 5;
    grid-row: 1;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archivePlaybackSpeed {
    grid-column: 5 / 6;
    grid-row: 1;
    font-size: 0;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archivePlaybackSpeed::after {
    content: attr(data-rate-label);
    font-size: 13px;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archiveFullscreen {
    position: fixed;
    top: max(6px, env(safe-area-inset-top));
    left: max(6px, env(safe-area-inset-left));
    z-index: 6;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    pointer-events: auto;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen).archive-controls-hidden .timeline-wrap {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity .18s ease,
      visibility 0s linear .18s;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen).archive-controls-hidden .archive-controls {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen).archive-controls-hidden .archive-controls > :not(#archiveFullscreen) {
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    pointer-events: none;
    transition:
      opacity .18s ease,
      transform .18s ease,
      visibility 0s linear .18s;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen).archive-controls-hidden .archive-controls #archiveFullscreen {
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen).archive-controls-hidden .archive-stage-time {
    top: max(8px, env(safe-area-inset-top));
  }
}

@media (max-width: 410px) and (orientation: landscape) and (max-height: 600px) {
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls {
    grid-template-columns: 44px minmax(58px, 1fr) 44px 44px minmax(44px, 60px);
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archivePlayPause {
    font-size: 0;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archivePlayPause::after {
    width: 0;
    height: 0;
    content: "";
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 13px solid currentColor;
  }
  .archive-viewer:is(.archive-immersive, :fullscreen, :-webkit-full-screen) .archive-controls #archivePlayPause[aria-pressed="true"]::after {
    width: 14px;
    height: 18px;
    border: 0;
    background: linear-gradient(to right, currentColor 0 4px, transparent 4px 10px, currentColor 10px 14px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .archive-viewer .timeline-wrap,
  .archive-viewer .archive-controls > :not(#archiveFullscreen) { transition-delay: 0s !important; }
}
