:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #fff;
  --text: #142033;
  --muted: #748096;
  --line: #e4e9f2;
  --blue: #3767ee;
  --cyan: #19a6c9;
  --green: #18a56b;
  --amber: #f0a21c;
  --red: #e53855;
  --shadow: 0 12px 36px rgba(31, 48, 82, .08);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
svg { width: 1.4em; height: 1.4em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, p { margin: 0; }
.topbar, main, footer { width: min(1500px, calc(100% - 36px)); margin-inline: auto; }
.topbar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand, .header-status, .panel-title, .camera-toolbar, .camera-footer, .signal-card, footer { display: flex; align-items: center; }
.brand { gap: 13px; }
.brand-icon, .title-icon { display: grid; place-items: center; flex: 0 0 auto; }
.brand-icon { width: 48px; height: 48px; color: #fff; background: linear-gradient(145deg, #586ef3, #764ddd); border-radius: 15px; box-shadow: 0 10px 22px rgba(86, 91, 225, .24); }
.brand-icon svg { width: 28px; height: 28px; }
.eyebrow { display: block; margin-bottom: 3px; color: var(--blue); font-size: .66rem; font-weight: 850; letter-spacing: .15em; }
h1 { font-size: 1.45rem; letter-spacing: -.035em; }
h2 { font-size: 1.1rem; letter-spacing: -.025em; }
.header-status { gap: 10px; }
.network-chip, .device-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; color: #536075; background: #fff; font-size: .76rem; font-weight: 750; }
.network-chip svg { width: 17px; }
.dot, .status-light, .indicator, .secure-dot { display: inline-block; border-radius: 50%; background: #aab3c2; }
.dot { width: 9px; height: 9px; }
.dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(24,165,107,.12); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.command-layout { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(520px, 1.8fr) minmax(225px, .65fr); gap: 18px; align-items: stretch; }
.gps-panel, .camera-panel { padding: 20px; }
.panel-title { gap: 11px; }
.panel-title.compact { gap: 10px; }
.title-icon { width: 41px; height: 41px; border-radius: 12px; }
.gps-icon { color: #216cdb; background: #e8f2ff; }
.camera-icon { color: #714edc; background: #f0ebff; }
.evidence-icon { color: #168875; background: #e6f8f2; }
.panel-title .status-light { margin-left: auto; width: 10px; height: 10px; }
.panel-title .status-light.online { background: var(--green); box-shadow: 0 0 0 5px rgba(24,165,107,.12); }
.gps-map { position: relative; height: 205px; margin-top: 18px; overflow: hidden; border: 1px solid #dce7f5; border-radius: 15px; background: linear-gradient(145deg, #f1f7ff, #eaf3f4); }
.map-grid { position: absolute; inset: 0; opacity: .55; background-image: linear-gradient(#cbdbea 1px, transparent 1px), linear-gradient(90deg, #cbdbea 1px, transparent 1px), linear-gradient(35deg, transparent 44%, #d3e2e8 45%, #d3e2e8 47%, transparent 48%); background-size: 36px 36px, 36px 36px, 85px 85px; transform: scale(1.2) rotate(-5deg); }
.location-pin { position: absolute; left: 50%; top: 44%; width: 42px; height: 42px; transform: translate(-50%, -50%) rotate(45deg); border-radius: 50% 50% 50% 6px; background: var(--blue); box-shadow: 0 8px 18px rgba(55,103,238,.3); }
.location-pin span { position: absolute; inset: 12px; border-radius: 50%; background: #fff; }
.gps-state { position: absolute; left: 50%; bottom: 15px; transform: translateX(-50%); width: max-content; max-width: 88%; padding: 6px 10px; border-radius: 8px; color: #445067; background: rgba(255,255,255,.9); font-size: .69rem; font-weight: 800; box-shadow: 0 3px 12px rgba(31,48,82,.1); }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 11px; }
.coordinate-box { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #fafcff; }
.coordinate-box span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .58rem; font-weight: 850; letter-spacing: .09em; }
.coordinate-box strong { display: block; overflow: hidden; font-size: clamp(.72rem, .85vw, .88rem); text-overflow: ellipsis; }
.icon-button { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 11px; min-height: 42px; border-radius: 12px; color: #fff; background: var(--blue); font-size: .76rem; font-weight: 800; text-decoration: none; }
.icon-button svg { width: 18px; }
.icon-button.disabled { pointer-events: none; color: #8994a6; background: #e8ecf2; }
.camera-panel { min-width: 0; display: flex; flex-direction: column; }
.camera-toolbar { justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 11px; border-radius: 10px; color: #7b8798; background: #f0f2f6; font-size: .67rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.live-badge span { width: 8px; height: 8px; border-radius: 50%; background: #a8b0bc; }
.live-badge.live { color: #fff; background: var(--red); }
.live-badge.live span { background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.stream-shell { position: relative; flex: 1; min-height: 350px; overflow: hidden; border-radius: 16px; background: #111927; }
.stream-shell > img { width: 100%; height: 100%; min-height: 350px; display: block; object-fit: cover; }
.viewfinder { position: absolute; inset: 18px; pointer-events: none; }
.viewfinder i { position: absolute; width: 28px; height: 28px; border-color: rgba(255,255,255,.75); border-style: solid; }
.viewfinder i:nth-child(1) { left: 0; top: 0; border-width: 2px 0 0 2px; }
.viewfinder i:nth-child(2) { right: 0; top: 0; border-width: 2px 2px 0 0; }
.viewfinder i:nth-child(3) { right: 0; bottom: 0; border-width: 0 2px 2px 0; }
.viewfinder i:nth-child(4) { left: 0; bottom: 0; border-width: 0 0 2px 2px; }
.stream-overlay { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; width: max-content; max-width: calc(100% - 34px); padding: 9px 13px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; color: #fff; background: rgba(13,22,38,.73); backdrop-filter: blur(8px); font-size: .72rem; font-weight: 700; }
.stream-overlay.active { background: rgba(193,34,63,.88); }
.overlay-icon { display: grid; place-items: center; }
.overlay-icon svg { width: 17px; }
.camera-footer { justify-content: space-between; gap: 14px; padding-top: 13px; color: var(--muted); font-size: .68rem; font-weight: 700; }
.camera-footer span { display: inline-flex; align-items: center; gap: 6px; }
.camera-footer svg { width: 15px; }
.signal-stack { display: grid; grid-template-rows: repeat(3, 1fr); gap: 13px; }
.signal-card { position: relative; min-height: 120px; gap: 14px; padding: 17px; overflow: hidden; transition: transform .2s, border-color .2s, box-shadow .2s; }
.signal-card::after { content: ""; position: absolute; right: -24px; bottom: -34px; width: 90px; height: 90px; border-radius: 50%; background: #f3f6fb; }
.signal-card.active { transform: translateY(-2px); border-color: currentColor; box-shadow: 0 13px 30px rgba(31,48,82,.13); }
.signal-icon { position: relative; z-index: 1; display: grid; place-items: center; flex: 0 0 58px; height: 58px; border-radius: 17px; }
.signal-icon svg { width: 29px; height: 29px; }
.signal-icon.gsm { color: #216cdb; background: #e7f0ff; }
.signal-icon.alert { color: #c47b00; background: #fff3d7; }
.signal-icon.danger { color: #d62e4c; background: #ffe8ed; }
.indicator { position: absolute; right: -2px; top: -2px; width: 12px; height: 12px; border: 3px solid #fff; }
.indicator.good { background: var(--green); }
.indicator.warning { background: var(--amber); }
.indicator.danger { background: var(--red); }
.signal-copy { position: relative; z-index: 1; min-width: 0; display: grid; gap: 3px; }
.signal-copy > span { color: var(--muted); font-size: .59rem; font-weight: 850; letter-spacing: .08em; }
.signal-copy strong { font-size: .9rem; letter-spacing: .02em; }
.signal-copy small { overflow-wrap: anywhere; color: var(--muted); font-size: .63rem; line-height: 1.35; }
.alert-card.active { color: #b87300; }
.danger-card.active { color: var(--red); }
.evidence-section { margin-top: 18px; padding: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.count-badge { padding: 8px 11px; border-radius: 10px; color: #526076; background: #f0f3f8; font-size: .69rem; font-weight: 800; }
.evidence-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.evidence-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.evidence-media { position: relative; aspect-ratio: 16/10; background: #e9eef5; }
.evidence-media img, .evidence-media video { width: 100%; height: 100%; display: block; object-fit: cover; }
.media-placeholder { height: 100%; display: grid; place-items: center; color: #98a3b3; }
.media-placeholder svg { width: 34px; height: 34px; }
.evidence-body { padding: 12px; }
.evidence-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.event-type { display: inline-flex; padding: 5px 8px; border-radius: 7px; font-size: .62rem; font-weight: 900; }
.event-type.ALERT { color: #986200; background: #fff1ce; }
.event-type.DANGER { color: #c82945; background: #ffe5ea; }
.event-state { color: var(--muted); font-size: .63rem; font-weight: 700; }
.meta { display: grid; gap: 4px; color: var(--muted); font-size: .67rem; }
.evidence-actions { display: flex; gap: 7px; margin-top: 10px; }
.evidence-action { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 31px; padding: 0 9px; border-radius: 8px; color: #435168; background: #eef2f7; font-size: .63rem; font-weight: 800; text-decoration: none; }
.evidence-action.primary { color: #fff; background: var(--blue); }
.evidence-action svg { width: 14px; }
.empty-state { grid-column: 1/-1; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px dashed #cbd4e1; border-radius: 14px; color: var(--muted); text-align: center; }
.empty-state .empty-icon { color: #9aa7ba; font-size: 2rem; }
.empty-state strong { color: #566276; font-size: .82rem; }
.empty-state small { font-size: .7rem; }
footer { justify-content: space-between; gap: 16px; padding: 18px 2px 28px; color: var(--muted); font-size: .68rem; }
footer span { display: inline-flex; align-items: center; gap: 6px; }
.secure-dot { width: 7px; height: 7px; background: var(--green); }

@media (max-width: 1120px) {
  .command-layout { grid-template-columns: minmax(250px, .8fr) minmax(460px, 1.5fr); }
  .signal-stack { grid-column: 1/-1; grid-template-columns: repeat(3, 1fr); grid-template-rows: none; }
  .evidence-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 780px) {
  .topbar { align-items: flex-start; padding: 18px 0; }
  .network-chip { display: none; }
  .command-layout { grid-template-columns: 1fr; }
  .gps-panel, .camera-panel { padding: 16px; }
  .camera-panel { grid-row: 1; }
  .gps-panel { grid-row: 2; }
  .signal-stack { grid-column: auto; grid-template-columns: 1fr; }
  .stream-shell, .stream-shell > img { min-height: 300px; }
  .evidence-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .topbar, main, footer { width: min(100% - 22px, 1500px); }
  .brand-icon { width: 42px; height: 42px; }
  h1 { font-size: 1.25rem; }
  .device-pill { padding: 0 10px; }
  .stream-shell, .stream-shell > img { min-height: 235px; }
  .stream-overlay { bottom: 12px; }
  .camera-footer { align-items: flex-start; flex-direction: column; gap: 6px; }
  .evidence-grid { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; }
}
