:root {
  color-scheme: dark;
  --bg: #070b12;
  --panel: rgba(18, 27, 42, 0.72);
  --panel-strong: rgba(17, 25, 39, 0.94);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f7fb;
  --muted: #9eabba;
  --blue: #55c7ff;
  --blue-strong: #159bd8;
  --mint: #4be1ad;
  --amber: #ffc35a;
  --danger: #ff6d7d;
  --radius: 22px;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 10% -10%, rgba(34, 142, 202, 0.18), transparent 36%),
    radial-gradient(circle at 95% 20%, rgba(72, 63, 157, 0.15), transparent 36%),
    linear-gradient(150deg, #08101b 0%, #070b12 52%, #090b11 100%);
  color: var(--text);
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.15;
  border-radius: 999px;
}
.ambient-one { width: 260px; height: 260px; background: #0b9cd7; top: 10%; left: -100px; }
.ambient-two { width: 320px; height: 320px; background: #674bc8; right: -180px; bottom: 8%; }

.shell { width: min(1220px, calc(100% - 32px)); margin-inline: auto; }

.app-header {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: max(18px, env(safe-area-inset-top));
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #c9f2ff;
  background: linear-gradient(145deg, rgba(51, 179, 234, 0.26), rgba(42, 87, 142, 0.14));
  border: 1px solid rgba(121, 214, 255, 0.22);
  box-shadow: inset 0 1px rgba(255,255,255,.16), 0 14px 34px rgba(0, 128, 185, .18);
}
.brand-mark svg { width: 30px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.brand h1 { margin: 1px 0 0; font-size: clamp(24px, 4vw, 32px); letter-spacing: -0.04em; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.system-pill, .count-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 36, .62);
  color: var(--muted);
  font-size: 13px;
}
.system-pill span { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 14px currentColor; }
.system-pill.online span { background: var(--mint); }
.system-pill.offline span { background: var(--danger); }
.system-pill strong { color: var(--text); }

.icon-button, .soft-button, .primary-button, .nav-item {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.icon-button {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 15px;
  background: rgba(255,255,255,.07); border: 1px solid var(--line);
}
.icon-button svg, .soft-button svg, .primary-button svg, .nav-item svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.soft-button, .primary-button {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 0 16px; border-radius: 14px;
}
.soft-button { background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.primary-button { background: linear-gradient(135deg, #2bb6ef, #1a87cc); color: #03131d; font-weight: 800; box-shadow: 0 10px 28px rgba(16, 149, 209, .25); }

.app-main { padding: 20px 0 122px; }
.sharing-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding: 13px 16px;
  border-radius: 18px;
}
.sharing-status-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--mint); background: rgba(75,225,173,.1); }
.sharing-status-icon svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sharing-status > div:last-child { display: grid; gap: 3px; }
.sharing-status strong { font-size: 13px; }
.sharing-status span { color: var(--muted); font-size: 11px; }
.sharing-status.has-viewers { border-color: rgba(85,199,255,.28); }
.view { animation: reveal .28s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 18px; }
.section-heading h2 { margin: 5px 0 0; font-size: clamp(25px, 4vw, 36px); letter-spacing: -.035em; }
.section-actions { display: flex; align-items: center; gap: 8px; }
#data-mode.active { color: #baf8e2; border-color: rgba(75,225,173,.24); background: rgba(75,225,173,.1); }

.camera-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.camera-card, .camera-skeleton {
  position: relative;
  min-height: 310px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #0d1420;
  box-shadow: var(--shadow);
}
.camera-card:nth-child(3) { grid-column: span 1; }
.camera-skeleton { background: linear-gradient(110deg, #111927 25%, #192538 45%, #111927 65%); background-size: 220% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position-x: -220%; } }
.camera-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0d1420; }
.camera-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3,7,12,.05) 34%, rgba(3,7,12,.86) 100%); pointer-events: none; }
.camera-overlay { position: absolute; z-index: 2; inset: auto 0 0; padding: 24px; display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.camera-name { margin: 4px 0 0; font-size: 23px; letter-spacing: -.02em; }
.live-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.live-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 14px var(--danger); }
.camera-card:not(.camera-sleeping) .live-chip::before { background: var(--blue); box-shadow: 0 0 14px rgba(85,199,255,.65); }
.camera-expand { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: rgba(8,15,25,.64); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(10px); }
.camera-expand svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.camera-placeholder { position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 10px; color: var(--muted); }
.camera-placeholder svg { width: 42px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.camera-placeholder span { font-size: 13px; font-weight: 750; }
.camera-sleeping .camera-media { opacity: 0; }
.camera-sleeping .camera-placeholder { display: grid; }
.camera-sleeping .live-chip::before { background: var(--amber); box-shadow: 0 0 14px rgba(255,195,90,.48); }
.camera-note { margin-top: 7px; color: #c2cad5; font-size: 12px; }
.camera-sleeping .camera-expand { cursor: default; opacity: .42; }
.camera-offline .camera-media { opacity: .18; }
.camera-offline .camera-placeholder { display: grid; }
.camera-offline .live-chip::before { background: var(--amber); box-shadow: none; }
.soft-button.is-loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.glass-panel {
  background: linear-gradient(145deg, rgba(26, 38, 57, .74), rgba(12, 19, 30, .72));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px rgba(255,255,255,.055), var(--shadow);
  backdrop-filter: blur(12px);
}
.quick-filters { display: flex; gap: 8px; margin: -2px 0 13px; padding: 2px 1px; overflow-x: auto; scrollbar-width: none; }
.quick-filters::-webkit-scrollbar { display: none; }
.filter-chip { min-height: 38px; padding: 0 14px; white-space: nowrap; color: var(--muted); background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.filter-chip.active { color: #d8f5ff; border-color: rgba(85,199,255,.34); background: rgba(46,166,219,.16); box-shadow: inset 0 1px rgba(255,255,255,.06); }
.filter-panel { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr 1fr auto; align-items: end; gap: 12px; padding: 16px; border-radius: 20px; }
.filter-panel label { display: grid; gap: 7px; }
.filter-panel label > span { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; padding-left: 3px; }
input, select {
  width: 100%; min-height: 46px; color: var(--text); background: rgba(5,10,18,.58); border: 1px solid var(--line); border-radius: 13px; padding: 0 12px; outline: none;
}
input:focus, select:focus { border-color: rgba(79,195,247,.56); box-shadow: 0 0 0 3px rgba(37,170,228,.12); }
.history-status { min-height: 36px; padding: 16px 3px 4px; color: var(--muted); font-size: 13px; }
.events-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.event-card {
  min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: rgba(14,22,34,.72); overflow: hidden; cursor: pointer; box-shadow: 0 15px 36px rgba(0,0,0,.2); transition: transform .2s ease, border-color .2s ease;
}
.event-card:hover { transform: translateY(-2px); border-color: rgba(92,196,242,.34); }
.event-thumb-wrap { aspect-ratio: 16/9; position: relative; overflow: hidden; background: #0c121c; }
.event-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.event-play { position: absolute; right: 12px; bottom: 12px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: rgba(5,10,18,.78); backdrop-filter: blur(10px); }
.event-play svg { width: 17px; fill: currentColor; stroke: none; margin-left: 2px; }
.event-watched { display: none; position: absolute; left: 10px; bottom: 10px; padding: 4px 8px; border-radius: 999px; color: #cde1ec; background: rgba(4,10,17,.72); backdrop-filter: blur(9px); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.event-card.watched { border-color: rgba(75,225,173,.18); }
.event-card.watched .event-watched { display: block; }
.event-info { padding: 14px 15px 16px; }
.event-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.event-label { font-size: 16px; font-weight: 800; text-transform: capitalize; }
.event-camera { color: var(--blue); font-size: 12px; font-weight: 750; }
.event-time { margin-top: 7px; color: var(--muted); font-size: 12px; }
.event-severity { margin-top: 7px; padding: 3px 7px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.06); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.event-severity.alert { color: #ffd894; background: rgba(255,173,48,.12); }
.event-severity.detection { color: #9ee4ff; background: rgba(64,184,235,.13); }
.empty-state { grid-column: 1/-1; min-height: 290px; display: grid; place-items: center; align-content: center; text-align: center; border-radius: var(--radius); padding: 32px; }
.empty-state svg { width: 42px; fill: none; stroke: var(--muted); stroke-width: 1.4; }
.empty-state h3 { margin: 15px 0 5px; }
.empty-state p { margin: 0; color: var(--muted); }
.load-more { grid-column: 1/-1; width: min(280px, 100%); margin: 12px auto 0; }

.timeline-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .85fr);
  gap: 18px;
  align-items: start;
}
.timeline-player, .timeline-browser { min-width: 0; border-radius: var(--radius); padding: 18px; }
.timeline-browser { position: relative; }
.timeline-player-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.timeline-player-heading h3 { margin: 4px 0 0; font-size: 22px; letter-spacing: -.025em; }
.timeline-player-heading select { width: auto; min-width: 138px; }
.timeline-media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: #020407;
  border: 1px solid rgba(255,255,255,.07);
}
.timeline-media video { grid-area: 1 / 1; width: 100%; height: 100%; object-fit: contain; background: #000; }
.timeline-media video[hidden], .timeline-empty[hidden] { display: none; }
.timeline-empty {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}
.timeline-empty svg { width: 43px; fill: none; stroke: var(--blue); stroke-width: 1.45; opacity: .8; }
.timeline-empty strong { color: var(--text); }
.timeline-empty span { max-width: 280px; font-size: 12px; line-height: 1.45; }
.timeline-player-controls { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 13px; }
.timeline-player-controls .soft-button { white-space: nowrap; }
.timeline-playback-status { min-width: 0; color: var(--muted); font-size: 12px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-action-row { display: grid; grid-template-columns: 1fr auto auto 1fr; gap: 9px; margin-top: 10px; }
.timeline-action-row .soft-button { min-width: 0; padding-inline: 12px; }
.compact-control { display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 10px; color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 14px; }
.compact-control span { font-size: 10px; font-weight: 750; text-transform: uppercase; }
.compact-control select { width: 70px; min-height: 32px; padding-inline: 7px; }
.timeline-filters { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 11px; }
.timeline-filters label { display: grid; gap: 7px; min-width: 0; }
.timeline-filters label > span, .timeline-summary span { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.timeline-filters .primary-button { grid-column: 1 / -1; }
.timeline-summary { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-top: 20px; }
.timeline-summary > div:first-child { display: grid; gap: 5px; }
.timeline-summary strong { font-size: 20px; }
.timeline-zoom-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.timeline-zoom-control select { width: 67px; min-height: 36px; padding-inline: 8px; }
.timeline-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 3px 0 10px;
  overscroll-behavior-x: contain;
  scrollbar-color: rgba(85,199,255,.5) rgba(255,255,255,.06);
  scrollbar-width: thin;
  touch-action: pan-x;
}
.timeline-scroll::-webkit-scrollbar { height: 8px; }
.timeline-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,.05); border-radius: 999px; }
.timeline-scroll::-webkit-scrollbar-thumb { background: rgba(85,199,255,.46); border-radius: 999px; }
.timeline-track {
  position: relative;
  width: 1440px;
  height: 154px;
  overflow: hidden;
  cursor: crosshair;
  border: 1px solid var(--line);
  border-radius: 17px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.006)),
    rgba(4,9,16,.56);
}
.timeline-hour { position: absolute; inset-block: 0; width: 1px; background: rgba(255,255,255,.07); pointer-events: none; }
.timeline-hour span { position: absolute; top: 12px; left: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.timeline-shared-range, .timeline-recorded-range, .timeline-activity-range { position: absolute; min-width: 2px; border-radius: 999px; pointer-events: none; }
.timeline-shared-range { top: 42px; height: 82px; background: rgba(75,225,173,.09); border: 1px solid rgba(75,225,173,.13); border-radius: 12px; }
.timeline-recorded-range { top: 67px; height: 31px; background: linear-gradient(90deg, rgba(43,182,239,.72), rgba(85,199,255,.95)); box-shadow: 0 5px 18px rgba(31,159,217,.2); }
.timeline-activity-range { top: 105px; height: 8px; background: var(--amber); box-shadow: 0 0 12px rgba(255,195,90,.35); }
.timeline-marker { position: absolute; z-index: 2; top: 118px; width: 6px; height: 20px; margin-left: -3px; border-radius: 5px; background: var(--amber); box-shadow: 0 0 10px rgba(255,195,90,.42); pointer-events: none; }
.timeline-marker.person { background: var(--mint); box-shadow: 0 0 10px rgba(75,225,173,.48); }
.timeline-marker.vehicle { background: #b98cff; box-shadow: 0 0 10px rgba(185,140,255,.48); }
.timeline-playhead { position: absolute; z-index: 3; top: 30px; bottom: 18px; width: 2px; background: #fff; box-shadow: 0 0 10px rgba(255,255,255,.8); pointer-events: none; }
.timeline-playhead::before { content: ""; position: absolute; top: -3px; left: -5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(85,199,255,.28); }
.timeline-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 9px; color: var(--muted); font-size: 10px; }
.timeline-legend span { display: inline-flex; align-items: center; gap: 6px; }
.timeline-legend span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.timeline-legend span.activity::before { background: var(--amber); }
.timeline-legend span.person::before { background: var(--mint); }
.timeline-legend span.vehicle::before { background: #b98cff; }
.timeline-legend span.selected::before { background: #fff; box-shadow: 0 0 7px rgba(255,255,255,.7); }
.timeline-tooltip { position: absolute; z-index: 8; bottom: 47px; transform: translateX(-50%); width: 168px; overflow: hidden; color: var(--text); background: rgba(5,10,18,.94); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 16px 34px rgba(0,0,0,.48); pointer-events: none; }
.timeline-tooltip[hidden] { display: none; }
.timeline-tooltip img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #05080d; }
.timeline-tooltip > div { display: grid; gap: 2px; padding: 9px 11px 10px; }
.timeline-tooltip strong { font-size: 12px; }
.timeline-tooltip span { color: var(--muted); font-size: 10px; }
.timeline-loading { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, rgba(85,199,255,.1) 45%, transparent 70%); background-size: 220% 100%; animation: shimmer 1.2s infinite linear; }

.bottom-nav {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); gap: 4px; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: 21px; background: rgba(10,16,26,.82); box-shadow: 0 18px 55px rgba(0,0,0,.48); backdrop-filter: blur(22px);
}
.nav-item { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 9px; border-radius: 16px; background: transparent; color: var(--muted); font-weight: 750; }
.nav-item.active { color: var(--text); background: linear-gradient(145deg, rgba(44,172,226,.24), rgba(51,93,157,.18)); box-shadow: inset 0 1px rgba(255,255,255,.09); }

.viewer-dialog { width: min(1180px, calc(100% - 24px)); max-width: none; height: min(860px, calc(100dvh - 24px)); padding: 0; color: var(--text); overflow: hidden; background: #070b12; border: 1px solid var(--line-strong); border-radius: 24px; box-shadow: 0 32px 100px rgba(0,0,0,.72); grid-template-rows: auto auto minmax(0, 1fr); }
.viewer-dialog[open] { display: grid; }
.viewer-dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(7px); }
.dialog-toolbar { min-height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 14px 22px; border-bottom: 1px solid var(--line); }
.dialog-toolbar h3 { margin: 3px 0 0; font-size: 23px; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-mode-bar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 18px; border-bottom: 1px solid var(--line); background: rgba(11,18,29,.94); }
.dialog-mode-bar[hidden] { display: none; }
.dialog-mode-switch { display: flex; gap: 5px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.045); }
.dialog-mode { min-height: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 0 13px; color: var(--muted); border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-size: 12px; font-weight: 760; }
.dialog-mode svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dialog-mode.active { color: #e8f8ff; background: rgba(62,181,235,.18); box-shadow: inset 0 0 0 1px rgba(85,199,255,.18); }
.dialog-mode-status { color: var(--muted); font-size: 11px; }
.dialog-media { min-height: 0; display: grid; place-items: center; overflow: hidden; background: #020407; }
.dialog-media > img, .dialog-media > video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.detection-inspector { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.detection-visual { min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 16px; background: radial-gradient(circle at 50% 50%, rgba(33,65,84,.22), transparent 55%), #020407; }
.detection-stage { position: relative; display: inline-block; width: fit-content; height: fit-content; max-width: 100%; max-height: 100%; line-height: 0; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.detection-stage img { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 250px); object-fit: contain; background: #000; }
.detection-overlay { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.detection-object-box, .detection-region { fill: none; }
.detection-object-box { stroke: var(--mint); stroke-width: 3px; filter: drop-shadow(0 0 5px rgba(75,225,173,.82)); }
.detection-region { stroke: rgba(85,199,255,.9); stroke-width: 2px; stroke-dasharray: 9 6; fill: rgba(85,199,255,.035); }
.detection-footer { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 18px; border-top: 1px solid var(--line); background: rgba(10,16,26,.96); }
.detection-summary { display: flex; align-items: center; gap: 11px; }
.detection-summary-icon { width: 12px; height: 12px; border: 2px solid var(--mint); border-radius: 3px; box-shadow: 0 0 12px rgba(75,225,173,.55); }
.detection-summary > div { display: grid; gap: 3px; }
.detection-summary strong { font-size: 13px; }
.detection-summary span { color: var(--muted); font-size: 10px; }
.detection-legend { display: flex; gap: 14px; color: var(--muted); font-size: 10px; }
.detection-legend span { display: inline-flex; align-items: center; gap: 6px; }
.detection-legend span::before { content: ""; width: 12px; height: 8px; border: 2px solid var(--mint); border-radius: 2px; }
.detection-legend .region::before { border-color: var(--blue); border-style: dashed; }
.detection-navigation { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.detection-navigation button { min-height: 34px; padding: 0 11px; color: var(--text); border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.055); cursor: pointer; font-size: 11px; font-weight: 720; }
.detection-navigation button:disabled { opacity: .35; cursor: default; }
.detection-loading { display: grid; place-items: center; gap: 8px; color: var(--text); text-align: center; }
.detection-loading > span { width: 34px; height: 34px; border: 3px solid rgba(85,199,255,.18); border-top-color: var(--blue); border-radius: 50%; animation: spin .85s linear infinite; }
.detection-loading small { color: var(--muted); }
.detection-empty { max-width: 440px; }

.install-dialog {
  width: min(520px, calc(100% - 28px));
  max-width: none;
  padding: 0;
  color: var(--text);
  overflow: hidden;
  background: linear-gradient(145deg, rgba(25,38,57,.98), rgba(8,14,24,.98));
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: 0 32px 100px rgba(0,0,0,.72);
}
.install-dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(8px); }
.install-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 20px 16px; border-bottom: 1px solid var(--line); }
.install-app-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.install-app-identity img { width: 54px; height: 54px; border-radius: 16px; box-shadow: 0 10px 28px rgba(0,0,0,.3); }
.install-app-identity h3 { margin: 4px 0 0; font-size: 23px; letter-spacing: -.025em; }
.install-dialog-body { display: grid; gap: 16px; padding: 20px; }
.install-security-note { display: grid; gap: 5px; padding: 14px 15px; color: #ffe0a8; background: rgba(255,174,48,.1); border: 1px solid rgba(255,195,90,.24); border-radius: 15px; }
.install-security-note[hidden], .install-native-button[hidden] { display: none; }
.install-security-note span { color: #d5c5a8; font-size: 12px; line-height: 1.5; }
.install-browser-hint { margin: 0; color: #d8e1eb; font-size: 14px; line-height: 1.5; }
.install-steps { display: grid; gap: 10px; margin: 0; padding-left: 24px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.install-steps li { padding-left: 4px; }
.install-steps li::marker { color: var(--blue); font-weight: 800; }
.install-native-button { width: 100%; }

.offline-banner { position: fixed; z-index: 99; top: 0; inset-inline: 0; text-align: center; padding: calc(7px + env(safe-area-inset-top)) 12px 7px; background: #963b49; color: white; font-size: 12px; font-weight: 750; }
.update-toast { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: 96px; width: min(470px, calc(100% - 24px)); display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px 13px 17px; border-radius: 18px; }
.update-toast[hidden] { display: none; }
.update-toast > div { display: grid; gap: 3px; }
.update-toast strong { font-size: 13px; }
.update-toast span { color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
  .camera-grid { grid-template-columns: 1fr; }
  .camera-card, .camera-skeleton { min-height: 290px; }
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .filter-panel .primary-button { grid-column: 1/-1; }
  .events-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 20px, 1220px); }
  .app-header { min-height: 92px; }
  .brand-mark { width: 45px; height: 45px; border-radius: 15px; }
  .brand-mark svg { width: 26px; }
  .brand .eyebrow { display: none; }
  .brand h1 { font-size: 24px; }
  .system-pill { min-width: 42px; width: 42px; padding: 0; justify-content: center; }
  .system-pill strong { display: none; }
  .app-main { padding-top: 12px; }
  .section-heading { align-items: center; }
  .section-heading h2 { font-size: 28px; }
  .section-actions .soft-button { width: 44px; padding: 0; }
  .section-actions .soft-button > span, .section-actions #refresh-live { font-size: 0; }
  .section-actions #refresh-live svg { margin: 0; }
  .sharing-status { margin-bottom: 17px; }
  .camera-card, .camera-skeleton { min-height: 235px; border-radius: 19px; }
  .camera-overlay { padding: 18px; }
  .camera-name { font-size: 20px; }
  .filter-panel { grid-template-columns: 1fr; padding: 13px; }
  .filter-panel .primary-button { grid-column: auto; }
  .events-list { grid-template-columns: 1fr; }
  .timeline-player, .timeline-browser { padding: 13px; border-radius: 19px; }
  .timeline-player-heading { align-items: end; }
  .timeline-player-heading select { min-width: 118px; }
  .timeline-player-controls { grid-template-columns: 1fr 1fr; }
  .timeline-playback-status { grid-column: 1 / -1; grid-row: 1; }
  .timeline-action-row { grid-template-columns: 1fr 1fr; }
  .compact-control { justify-content: center; }
  .timeline-filters { grid-template-columns: 1fr; }
  .timeline-filters .primary-button { grid-column: auto; }
  .timeline-summary { align-items: center; }
  .timeline-swipe-hint { max-width: 120px; }
  .viewer-dialog { width: 100%; height: 100dvh; max-height: none; border-radius: 0; border: 0; }
  .dialog-toolbar { padding-left: 15px; }
  .dialog-toolbar h3 { max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dialog-mode-bar { align-items: stretch; padding: 7px 10px; }
  .dialog-mode-switch { flex: 1; }
  .dialog-mode { flex: 1; justify-content: center; padding-inline: 9px; }
  .dialog-mode-status { display: none; }
  .detection-visual { padding: 8px; }
  .detection-stage img { max-height: calc(100dvh - 250px); }
  .detection-footer { min-height: 82px; flex-wrap: wrap; gap: 8px 14px; padding: 10px 12px; }
  .detection-legend { order: 3; flex-basis: 100%; }
  .detection-navigation { margin-left: auto; }
  .install-dialog { width: calc(100% - 20px); border-radius: 21px; }
  .install-dialog-header, .install-dialog-body { padding-inline: 16px; }
  .bottom-nav { grid-template-columns: repeat(3, minmax(86px, 1fr)); width: min(calc(100% - 20px), 390px); }
  .nav-item { gap: 6px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
