/* HawkZero admin layout — flat surfaces, one accent, no HUD theatrics. */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--hz-font-ui);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--hz-text);
  background: #08090c;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--hz-c); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--hz-font-display); letter-spacing: 0; text-transform: none; margin: 0; font-weight: 600; }
h1 { font-size: 1.2rem; } h2 { font-size: .95rem; color: var(--hz-text); }
.muted { color: #8494a8; }

/* ---- login ---- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: min(560px, 100%);
  display: grid;
  gap: 22px;
}
.login-card .hz-banner__label { padding-left: 37%; font-size: clamp(14px, 6.2cqw, 34px); }
.login-panel {
  position: relative;
  padding: 26px 26px 22px;
  background: #0e1218;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
}
.login-panel h1 { font-size: 1.05rem; color: var(--hz-text); }
.login-panel .sub { margin: 6px 0 20px; font-size: .9rem; }
.form-row + .form-row { margin-top: 16px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.alert {
  margin: 0 0 16px;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: #f5a3ab;
  background: rgba(241,106,118,.10);
  border: 1px solid rgba(241,106,118,.35);
  border-radius: 6px;
}
.login-footer { text-align: center; font-size: .8rem; color: #8494a8; }

/* ---- admin shell ---- */
.shell { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.sidebar {
  padding: 18px 14px;
  border-right: 1px solid rgba(255,255,255,.07);
  background: #070b11;  /* matches the banner PNG backing */
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { margin-bottom: 8px; }
.sidebar .nav { display: grid; gap: 4px; }
.sidebar .hz-banner--compact .hz-banner__label { font-size: clamp(9px, 5.4cqw, 15px); letter-spacing: .06em; }
.sidebar .foot { margin-top: auto; padding-top: 12px; display: grid; gap: 8px; }

.main { padding: 22px 28px 48px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar .crumbs { font-family: var(--hz-font-ui); font-size: 12px; color: #8494a8; }
.topbar .crumbs b { color: var(--hz-text); font-weight: 550; }

.hero { max-width: 900px; margin-bottom: 22px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.sector-links { display: flex; flex-wrap: wrap; gap: 10px; }

.panel {
  padding: 20px 22px;
  background: #0e1218;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  margin-bottom: 18px;
}
.panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.panel + .panel { margin-top: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat {
  padding: 14px 16px;
  background: #10151d;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
}
.stat b { display: block; font-family: var(--hz-mono, ui-monospace, Menlo, Consolas, monospace); font-size: 1.35rem; font-weight: 650; color: var(--hz-text); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 4px; font-size: 11px; color: #8494a8; }

table.hz { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.hz th { text-align: left; font-family: var(--hz-font-ui); font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #8494a8; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
table.hz td { padding: 10px; border-bottom: 1px solid rgba(255,255,255,.04); color: #b8c2d1; }
table.hz tr:hover td { background: rgba(255,255,255,.03); }

.error-wrap { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.error-wrap .code { font-family: var(--hz-font-display); font-size: 4rem; font-weight: 650; color: var(--hz-c); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar .nav { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .main { padding: 18px 16px 40px; }
}

/* ---- TOTP-only login: prominent authenticator field ---- */
.hz-input--code {
  font-family: var(--hz-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: .55em;
  text-align: center;
  text-indent: .55em;
  padding: 14px 10px;
}

/* ---- iPhone shell: live screen view ---- */
.live-wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.live-frame {
  flex: 0 0 320px;
  background: #000;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 9 / 19.5;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 36px rgba(0,0,0,.45), inset 0 0 0 6px #05070a;
}
.live-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.live-side { flex: 1; min-width: 260px; }

/* ---- device chrome, sizing and zoom ---- */
:root { --hz-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; }
.shell-stage { display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start; justify-content: center; }
.shell-controls { flex: 1; min-width: 280px; display: grid; gap: 14px; align-content: start; }
.phone {
  position: relative;
  width: var(--hz-phone-w, 340px);
  height: calc(var(--hz-phone-w, 340px) * 2.164);
  background: #05070a;
  border-radius: calc(var(--hz-phone-w, 340px) * 0.14);
  padding: calc(var(--hz-phone-w, 340px) * 0.028);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 20px 48px rgba(0,0,0,.5);
}
.phone__screen {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  background: #000;
  border-radius: calc(var(--hz-phone-w, 340px) * 0.115);
  display: flex; align-items: center; justify-content: center;
}
.phone__screen img { width: 100%; height: 100%; object-fit: contain; display: block; }
.phone__island {
  position: absolute; top: calc(var(--hz-phone-w, 340px) * 0.035);
  left: 50%; transform: translateX(-50%);
  width: calc(var(--hz-phone-w, 340px) * 0.30);
  height: calc(var(--hz-phone-w, 340px) * 0.075);
  background: #000; border-radius: 999px; z-index: 3;
  border: 1px solid rgba(255,255,255,.06);
}
.phone__btn { position: absolute; background: #0b0f15; border: 1px solid rgba(255,255,255,.10); border-radius: 4px; }
.phone__btn--volup { left: -3px; top: 16%; width: 4px; height: 9%; }
.phone__btn--voldown { left: -3px; top: 27%; width: 4px; height: 9%; }
.phone__btn--power { right: -3px; top: 21%; width: 4px; height: 12%; }
.phone__empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #4d5a6e; font-family: var(--hz-mono); letter-spacing: .18em;
  font-size: 11px; z-index: 2; pointer-events: none;
}
.phone.is-full { position: fixed; inset: 0; z-index: 200; width: 100vw; height: 100vh; border-radius: 0; padding: 0; }
.phone.is-full .phone__island, .phone.is-full .phone__btn { display: none; }
.phone.is-full .phone__screen { border-radius: 0; }
.shell-status { display: grid; gap: 6px; font-family: var(--hz-mono); font-size: 11px; }
.stat-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px;
  background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 6px; }
.stat-line span { color: var(--dim2); }
.stat-line b { color: #cfe0f5; font-weight: 500; }
.hz-live-pill { font-family: var(--hz-mono); font-size: 10px; letter-spacing: .1em;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim2); }
.hz-live-pill.on { color: #35d399; border-color: rgba(53,211,153,.45); }
.hz-count { margin-left: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(76,194,247,.12);
  color: var(--accent); font-family: var(--hz-mono); font-size: 10px; }
.map { width: 100%; height: 280px; border: 0; border-radius: 10px; background: #070a0e; border: 1px solid var(--line); }
.hz-btn--active { border-color: rgba(76,194,247,.55); background: rgba(76,194,247,.14); }

/* ---- GPS map skin (deliberate cartography theme, not UI chrome) ---- */
:root { --bh-black: #050000; --bh-blood: #ff1033; --bh-blood-dark: #7a0012; --bh-blood-deep: #3a0509; }
.gps-wrap { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; }
#gps-map { flex: 1 1 520px; height: 520px; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(122,0,18,.45); background: #020000; }
.gps-hud { flex: 0 0 300px; background: rgba(5,0,0,.92); border: 1px solid rgba(122,0,18,.5);
  border-radius: 10px; padding: 14px; }
.gps-hud__top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.gps-dot { width: 10px; height: 10px; border-radius: 50%; background: #555; }
.gps-dot.on { background: var(--bh-blood); animation: gpsPulse 1.6s infinite; }
@keyframes gpsPulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.gps-state { color: #ff8a9a; font-size: 11px; font-weight: 600; }
.gps-hud__device { color: #ffd9df; font-weight: 600; font-size: 14px; margin-bottom: 10px; word-break: break-all; }
.gps-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid rgba(122,0,18,.35); font-size: 11px; }
.gps-row:last-child { border-bottom: 0; }
.gps-row span { color: rgba(255,90,110,.7); font-size: 10px; }
.gps-row b { color: #ffd9df; font-family: var(--hz-mono); font-weight: 500; text-align: right; }

/* Reference marker: pulse rings + core dot */
.bh-marker-wrapper { background: transparent !important; border: 0 !important; }
.bh-marker { position: relative; width: 46px; height: 46px; }
.bh-marker__core { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 14px; height: 14px; border-radius: 50%; background: var(--bh-blood);
  box-shadow: 0 0 12px 2px rgba(255,16,51,.85); display: grid; place-items: center; }
.bh-marker__dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.bh-marker__pulse { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; border: 2px solid rgba(255,16,51,.55); animation: bhPulse 2.2s ease-out infinite; }
.bh-marker__pulse--delay { animation-delay: 1.1s; }
@keyframes bhPulse { 0% { transform: scale(.35); opacity: .95; } 100% { transform: scale(1.9); opacity: 0; }

/* Re-tint CARTO dark tiles to the map skin */
.bh-tiles { filter: brightness(0.62) contrast(1.35) saturate(4.5) sepia(0.35) hue-rotate(-56deg) invert(0.02); }
.leaflet-container { background: #020000 !important; font-family: var(--hz-mono); outline: none; }
.leaflet-control-attribution { background: rgba(5,0,0,.75) !important; color: #a33 !important;
  border: 1px solid rgba(122,0,18,.5); border-radius: 6px; }
.leaflet-control-attribution a { color: #ff5a6e !important; }
.leaflet-control-zoom { border: 1px solid rgba(122,0,18,.6) !important; overflow: hidden; }
.leaflet-control-zoom a { background: rgba(5,0,0,.85) !important; color: var(--bh-blood) !important;
  border-bottom: 1px solid rgba(122,0,18,.5) !important; }
.leaflet-control-zoom a:hover { background: rgba(60,0,8,.95) !important; color: #fff !important; }

/* ---- iPhone 18 Pro Max exact hardware (163.4 x 78.0 mm) ---- */
:root { --hz-phone-w: 320px; }
.phone {
  height: calc(var(--hz-phone-w) * 2.0949);
  background: linear-gradient(145deg, #1b1f26 0%, #05070a 62%, #0b0e13 100%);
  border-radius: calc(var(--hz-phone-w) * 0.16);
  padding: calc(var(--hz-phone-w) * 0.030);
}
.phone__screen {
  border-radius: calc(var(--hz-phone-w) * 0.115);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.phone__island {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 calc(var(--hz-phone-w) * 0.018);
}
.phone__cam {
  width: calc(var(--hz-phone-w) * 0.032); height: calc(var(--hz-phone-w) * 0.032);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #3b4a63 0%, #10141c 55%, #000 100%);
  box-shadow: inset 0 0 2px rgba(120,160,255,.55), 0 0 4px rgba(0,0,0,.9);
}
.phone__sensor {
  width: calc(var(--hz-phone-w) * 0.020); height: calc(var(--hz-phone-w) * 0.020);
  border-radius: 50%; background: #161b23; box-shadow: inset 0 0 2px rgba(255,255,255,.12);
}
.phone__led {
  position: absolute; top: calc(var(--hz-phone-w) * 0.047); left: calc(var(--hz-phone-w) * 0.062);
  width: calc(var(--hz-phone-w) * 0.016); height: calc(var(--hz-phone-w) * 0.016);
  border-radius: 50%; background: #57c8ff;
  z-index: 4;
}
/* left rail: Action button, volume up, volume down */
.phone__btn--action { left: -3px; top: 12%; width: 4px; height: 6%; }
.phone__btn--volup { left: -3px; top: 19%; width: 4px; height: 9%; }
.phone__btn--voldown { left: -3px; top: 27%; width: 4px; height: 9%; }
/* right rail: Side button + Camera Control */
.phone__btn--power { right: -3px; top: 21%; width: 4px; height: 12%; }
.phone__btn--camctl { right: -3px; top: 33%; width: 4px; height: 7%; }

/* ---- iPad Pro 13" shell ---- */
:root { --hz-ipad-w: 480px; }
.ipad {
  position: relative;
  width: var(--hz-ipad-w);
  height: calc(var(--hz-ipad-w) * 0.768);
  background: linear-gradient(145deg, #1b1f26 0%, #05070a 62%, #0b0e13 100%);
  border-radius: calc(var(--hz-ipad-w) * 0.036);
  padding: calc(var(--hz-ipad-w) * 0.018);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 20px 48px rgba(0,0,0,.5);
}
.ipad__screen {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  background: #000;
  border-radius: calc(var(--hz-ipad-w) * 0.028);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  display: flex; align-items: center; justify-content: center;
}
.ipad__screen img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ipad__empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #4d5a6e; font-family: var(--hz-mono); letter-spacing: .18em;
  font-size: 12px; z-index: 2; pointer-events: none;
}
.ipad__cam-module {
  position: absolute; top: calc(var(--hz-ipad-w) * 0.025);
  left: 50%; transform: translateX(-50%);
  width: calc(var(--hz-ipad-w) * 0.09);
  height: calc(var(--hz-ipad-w) * 0.025);
  background: #0a0d12; border-radius: 999px; z-index: 3;
  border: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.ipad__cam {
  width: calc(var(--hz-ipad-w) * 0.015); height: calc(var(--hz-ipad-w) * 0.015);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #3b4a63 0%, #10141c 55%, #000 100%);
  box-shadow: inset 0 0 2px rgba(120,160,255,.55), 0 0 4px rgba(0,0,0,.9);
}
.ipad__btn { position: absolute; background: #0b0f15; border: 1px solid rgba(255,255,255,.10); border-radius: 3px; }
.ipad__btn--top { top: -3px; left: 12%; width: 8%; height: 3px; }
.ipad__btn--volup { right: -3px; top: 8%; width: 3px; height: 6%; }
.ipad__btn--voldown { right: -3px; top: 15%; width: 3px; height: 6%; }
.ipad__led {
  position: absolute; top: calc(var(--hz-ipad-w) * 0.028); left: calc(var(--hz-ipad-w) * 0.055);
  width: calc(var(--hz-ipad-w) * 0.008); height: calc(var(--hz-ipad-w) * 0.008);
  border-radius: 50%; background: #57c8ff;
  z-index: 4;
}
.ipad.is-full { position: fixed; inset: 0; z-index: 200; width: 100vw; height: 100vh; border-radius: 0; padding: 0; }
.ipad.is-full .ipad__cam-module, .ipad.is-full .ipad__btn, .ipad.is-full .ipad__led { display: none; }
.ipad.is-full .ipad__screen { border-radius: 0; }
#ipad-zoom-group [data-zoom] { cursor: pointer; }
#ipad-zoom-group [data-zoom].hz-btn--active { border-color: rgba(76,194,247,.55); background: rgba(76,194,247,.14); }

/* ---- Device detection: show correct shell ---- */
.device-shell--iphone .ipad { display: none; }
.device-shell--ipad .phone { display: none; }
.device-shell--unknown .phone, .device-shell--unknown .ipad { display: none; }
.device-shell--unknown .device-unknown-msg { display: block; }
.device-unknown-msg { display: none; padding: 40px; text-align: center; color: var(--dim2); }

/* ---- Retina display streaming optimization ---- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .phone__screen img, .ipad__screen img { image-rendering: -webkit-optimize-contrast; }
}
.phone__screen img, .ipad__screen img {
  image-rendering: optimizeQuality;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* ---- Theme Support ---- */
:root {
  --accent: #4cc2f7;
  --accent2: #8a6bff;
  --accent-glow: rgba(76,194,247,.16);
  --live: #35d399;
  --live-glow: rgba(53,211,153,.25);
  --warn: #f0b35a;
  --bad: #f16a76;
  --line: rgba(255,255,255,.07);
  --line2: rgba(255,255,255,.13);
  --dim: #8494a8;
  --dim2: #5a687c;
}

[data-theme="light"] {
  --hz-text: #10151f;
  --accent: #0b7fc2;
  --accent2: #7c3aed;
  --live: #0f9d6b;
  --warn: #b97b10;
  --bad: #c93444;
  --line: rgba(15,23,42,.08);
  --line2: rgba(15,23,42,.15);
  --dim: #56647a;
  --dim2: #8494ab;
}

/* ---- Toast Container ---- */
.hz-toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
}
.hz-toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: #10151d;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  font-size: 13px;
  transform: translateX(120%);
  transition: transform .2s ease;
}
.hz-toast--enter { transform: translateX(0); }
.hz-toast--exit { transform: translateX(120%); }
.hz-toast__icon { font-size: 14px; }
.hz-toast--info { border-color: rgba(76,194,247,.35); }
.hz-toast--info .hz-toast__icon { color: var(--accent); }
.hz-toast--success { border-color: rgba(53,211,153,.35); }
.hz-toast--success .hz-toast__icon { color: var(--live); }
.hz-toast--warning { border-color: rgba(240,179,90,.35); }
.hz-toast--warning .hz-toast__icon { color: var(--warn); }
.hz-toast--error { border-color: rgba(241,106,118,.4); }
.hz-toast--error .hz-toast__icon { color: var(--bad); }
.hz-toast--beacon { border-color: rgba(53,211,153,.35); }
.hz-toast__message { flex: 1; color: #e7ecf4; }
.hz-toast__action {
  background: var(--accent);
  border: 0; color: #06121a;
  padding: 4px 10px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
}
.hz-toast__close {
  background: none; border: 0;
  color: var(--dim); cursor: pointer;
  font-size: 18px; line-height: 1;
  padding: 0 0 0 8px;
}

/* ---- Keyboard Badge ---- */
.kbd, kbd {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--hz-mono);
  font-size: 10px;
  color: var(--dim);
}

/* ---- Theme Toggle Button ---- */
.hz-theme-toggle {
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 16px;
  display: grid; place-items: center;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.hz-theme-toggle:hover {
  background: rgba(255,255,255,.05);
  color: var(--hz-text);
  border-color: var(--line2);
}

@media (prefers-reduced-motion: reduce) {
  .hz-toast { transition: none; }
  .gps-dot.on, .bh-marker__pulse { animation: none; }
}
