:root {
  color-scheme: light;
  --ink: #18202f;
  --muted: #667085;
  --faint: #8a94a6;
  --line: #dde3ec;
  --line-strong: #c8d1dd;
  --panel: #ffffff;
  --soft: #f6f8fb;
  --wash: #eef4f8;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b4233c;
  --warn: #a15c07;
  --ok-bg: #dff7ef;
  --danger-bg: #ffe6ea;
  --warn-bg: #fff3d6;
  --shadow: 0 12px 34px rgba(24, 32, 47, 0.08);
}

.home-shell {
  min-height: 100vh;
  overflow: hidden;
  background: #07140f;
  color: #f5fff8;
}

.home-stage {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 46%, rgba(20, 184, 166, 0.2), transparent 34%),
    linear-gradient(130deg, #07140f 0%, #0d211d 42%, #04100e 100%);
}

body[data-sky-mode="morning"] .home-stage {
  background:
    radial-gradient(circle at 34% 22%, rgba(255, 215, 150, 0.22), transparent 22%),
    radial-gradient(circle at 50% 46%, rgba(20, 184, 166, 0.2), transparent 34%),
    linear-gradient(130deg, #081714 0%, #102821 50%, #06110f 100%);
}

body[data-sky-mode="evening"] .home-stage {
  background:
    radial-gradient(circle at 28% 35%, rgba(255, 139, 83, 0.24), transparent 28%),
    radial-gradient(circle at 50% 46%, rgba(20, 184, 166, 0.16), transparent 36%),
    linear-gradient(140deg, #160f16 0%, #1a211d 46%, #06100f 100%);
}

body[data-sky-mode="night"] .home-stage {
  background:
    radial-gradient(circle at 32% 28%, rgba(129, 170, 255, 0.18), transparent 22%),
    radial-gradient(circle at 50% 46%, rgba(54, 94, 145, 0.2), transparent 36%),
    linear-gradient(130deg, #020713 0%, #06101f 50%, #020710 100%);
}

.globe-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  cursor: pointer;
  outline: 0;
}

.globe-canvas:focus-visible {
  outline: 2px solid rgba(208, 255, 205, 0.7);
  outline-offset: -8px;
}

.home-shade {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, rgba(4, 16, 14, 0) 0%, rgba(4, 16, 14, 0.18) 44%, rgba(4, 16, 14, 0.84) 100%),
    linear-gradient(0deg, rgba(4, 16, 14, 0.5) 0%, rgba(4, 16, 14, 0) 42%);
}

@media (max-width: 760px) {
  .home-stage {
    min-height: 100svh;
  }

  .home-shade {
    background:
      radial-gradient(circle at 50% 34%, rgba(4, 16, 14, 0) 0%, rgba(4, 16, 14, 0.16) 42%, rgba(4, 16, 14, 0.88) 100%);
  }

}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}
button, input { font: inherit; }
button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  min-height: 38px;
  padding: 9px 13px;
  font-weight: 750;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary { background: #fff; border-color: var(--line-strong); color: var(--ink); }
button.secondary:hover { background: var(--wash); }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}
input:focus { outline: 2px solid rgba(15, 118, 110, 0.18); border-color: var(--accent); }
label span { display: block; color: var(--muted); font-size: 12px; font-weight: 750; margin-bottom: 6px; }
.hidden { display: none !important; }
.error { color: var(--danger); min-height: 20px; margin: 0; }
.eyebrow { color: var(--faint); font-size: 11px; font-weight: 850; letter-spacing: 0; text-transform: uppercase; margin: 0 0 4px; }

.portal-shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.side h1 { margin: 0; font-size: 22px; line-height: 1.05; }
.side p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  flex: 0 0 auto;
}
.workspace { padding: 18px; }
.login-panel { min-height: calc(100vh - 36px); display: grid; place-items: center; }
.auth-box {
  width: min(390px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 14px;
}
.auth-box h2 { margin: 0; font-size: 22px; }
.portal-grid {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  gap: 14px;
}
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: transparent;
  padding: 2px 0 4px;
}
.topbar h2 { margin: 0; font-size: 27px; line-height: 1.1; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.summary-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.metric span { display: block; color: var(--muted); font-size: 12px; font-weight: 750; }
.metric strong { display: block; margin-top: 2px; font-size: 22px; line-height: 1.15; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(24, 32, 47, 0.05);
}
.compact-form { padding: 14px; display: grid; gap: 11px; }
.compact-form h3, .map-panel h3, .history-panel h3 { margin: 0; }
.device-column { display: grid; align-content: start; gap: 12px; }
.install-box {
  border: 1px solid #8fd4c7;
  background: #ebfbf7;
  border-radius: 8px;
  padding: 12px;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.install-box a { color: var(--accent-dark); font-weight: 800; }
.install-box p { margin: 8px 0 0; color: var(--muted); }
.device-list { display: grid; gap: 8px; }
.device-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  display: grid;
  gap: 8px;
}
.device-card:hover { background: #fbfcfe; border-color: var(--line-strong); }
.device-card.active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.device-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.device-card strong { font-size: 15px; line-height: 1.25; }
.device-card span { color: var(--muted); font-size: 12px; }
.device-meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}
.fresh { color: var(--accent-dark); background: var(--ok-bg); }
.stale { color: var(--warn); background: var(--warn-bg); }
.offline { color: var(--danger); background: var(--danger-bg); }
.map-column { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr); gap: 14px; align-content: start; }
.map-panel { padding: 14px; min-width: 0; }
.map-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.map-header h3 { font-size: 20px; line-height: 1.2; }
.map-canvas {
  min-height: 470px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #dfe8ef;
  position: relative;
}
.map-canvas iframe { width: 100%; height: 470px; border: 0; display: block; }
.empty-map { height: 470px; display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
.stats div { background: var(--soft); border: 1px solid #edf1f6; border-radius: 8px; padding: 9px; min-width: 0; }
.stats dt { color: var(--muted); font-size: 11px; font-weight: 850; }
.stats dd { margin: 3px 0 0; font-size: 13px; font-weight: 850; overflow-wrap: anywhere; }
.history-panel { padding: 14px; align-self: start; }
.history-list { display: grid; gap: 0; max-height: 548px; overflow: auto; margin-top: 8px; }
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 13px;
  color: inherit;
  text-decoration: none;
}
.history-row:hover { color: var(--accent-dark); }
.history-row strong {
  color: var(--accent-dark);
  font-weight: 850;
  overflow-wrap: anywhere;
  text-align: left;
}

.mobile-shell { min-height: 100vh; background: #111827; color: var(--ink); overflow: hidden; }
.live-map-screen { min-height: 100vh; position: relative; background: #dfe8ef; }
.app-map { position: fixed; inset: 0; background: #dfe8ef; overflow: hidden; }
.app-map iframe { width: 100%; height: 100%; border: 0; display: block; filter: saturate(0.95) contrast(1.02); }
.phone-shell { min-height: 100vh; background: #111827; color: var(--ink); overflow: hidden; }
.phone-map-screen { min-height: 100vh; position: relative; background: #dfe8ef; }
.phone-map { position: fixed; inset: 0; background: #dfe8ef; overflow: hidden; }
.phone-map iframe { width: 100%; height: 100%; border: 0; display: block; filter: saturate(0.95) contrast(1.02); }
.phone-map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #dfe8ef 0%, #f6f8fb 100%);
  color: var(--ink);
  text-align: center;
  padding: 24px;
}
.phone-map-empty strong { font-size: 24px; }
.phone-map-empty span { color: var(--muted); max-width: 260px; line-height: 1.4; }
.map-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #dfe8ef 0%, #f6f8fb 100%);
  color: var(--ink);
  text-align: center;
  padding: 24px;
}
.map-placeholder strong { font-size: 24px; }
.map-placeholder span { color: var(--muted); max-width: 260px; line-height: 1.4; }
.pin-large,
.map-pin {
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 0;
  background: var(--danger);
  transform: rotate(-45deg);
  box-shadow: 0 8px 20px rgba(180, 35, 60, 0.3);
}
.pin-large::after,
.map-pin::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 999px;
  background: #fff;
}
.map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -17px;
  margin-top: -34px;
  z-index: 4;
  pointer-events: none;
}
.map-topbar {
  position: absolute;
  left: 14px;
  right: 14px;
  top: max(14px, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  gap: 10px;
  z-index: 5;
}
.brand-chip,
.map-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(221, 227, 236, 0.9);
  box-shadow: 0 10px 26px rgba(24, 32, 47, 0.14);
  font-size: 13px;
  font-weight: 850;
}
.brand-chip span {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
}
.map-status.live { color: var(--accent-dark); }
.map-status.error { color: var(--danger); }
.map-sheet {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 6;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(221, 227, 236, 0.95);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(24, 32, 47, 0.22);
  padding: 14px;
}
.map-sheet p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.map-sheet h1 { margin: 5px 0 5px; font-size: 25px; line-height: 1.1; }
.map-actions { display: flex; gap: 8px; margin: 12px 0; }
.map-actions button { flex: 1; }
.map-readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.map-readout div { background: var(--soft); border: 1px solid #edf1f6; border-radius: 7px; padding: 8px; min-width: 0; }
.map-readout span { display: block; color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.map-readout strong { display: block; margin-top: 3px; font-size: 12px; overflow-wrap: anywhere; }

@media (max-width: 1180px) {
  .portal-grid { grid-template-columns: 330px minmax(0, 1fr); }
  .map-column { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .portal-shell { grid-template-columns: 1fr; }
  .side { padding: 16px 18px; }
  .portal-grid { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: 1fr 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .workspace { padding: 12px; }
  .topbar, .map-header { align-items: stretch; flex-direction: column; }
  .summary-strip, .stats { grid-template-columns: 1fr; }
  .map-canvas, .empty-map, .map-canvas iframe { height: 340px; min-height: 340px; }
  .map-readout { grid-template-columns: 1fr 1fr; }
}

.admin-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 18%, rgba(20, 184, 166, 0.13), transparent 28%),
    #eef2f6;
  color: var(--ink);
}

body[data-sky-mode="morning"].admin-shell {
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 215, 150, 0.24), transparent 24%),
    linear-gradient(135deg, #edf8f3 0%, #e8f0f6 100%);
}

body[data-sky-mode="evening"].admin-shell {
  background:
    radial-gradient(circle at 24% 28%, rgba(255, 139, 83, 0.22), transparent 28%),
    linear-gradient(135deg, #f2ece8 0%, #e5edf2 100%);
}

body[data-sky-mode="night"].admin-shell {
  background:
    radial-gradient(circle at 75% 18%, rgba(129, 170, 255, 0.18), transparent 24%),
    linear-gradient(135deg, #050c18 0%, #0d1724 100%);
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 48%, rgba(20, 184, 166, 0.2), transparent 34%),
    radial-gradient(circle at 18% 22%, rgba(201, 255, 243, 0.32) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 18%, rgba(201, 255, 243, 0.26) 0 1px, transparent 2px),
    radial-gradient(circle at 68% 72%, rgba(201, 255, 243, 0.22) 0 1px, transparent 2px),
    linear-gradient(130deg, #07140f 0%, #0d211d 42%, #04100e 100%);
}

body[data-sky-mode="morning"] .admin-login {
  background:
    radial-gradient(circle at 34% 22%, rgba(255, 215, 150, 0.22), transparent 22%),
    radial-gradient(circle at 50% 46%, rgba(20, 184, 166, 0.2), transparent 34%),
    radial-gradient(circle at 18% 22%, rgba(201, 255, 243, 0.26) 0 1px, transparent 2px),
    linear-gradient(130deg, #081714 0%, #102821 50%, #06110f 100%);
}

body[data-sky-mode="evening"] .admin-login {
  background:
    radial-gradient(circle at 28% 35%, rgba(255, 139, 83, 0.24), transparent 28%),
    radial-gradient(circle at 50% 46%, rgba(20, 184, 166, 0.16), transparent 36%),
    radial-gradient(circle at 82% 18%, rgba(255, 214, 190, 0.24) 0 1px, transparent 2px),
    linear-gradient(140deg, #160f16 0%, #1a211d 46%, #06100f 100%);
}

body[data-sky-mode="night"] .admin-login {
  background:
    radial-gradient(circle at 32% 28%, rgba(129, 170, 255, 0.18), transparent 22%),
    radial-gradient(circle at 50% 46%, rgba(54, 94, 145, 0.2), transparent 36%),
    radial-gradient(circle at 18% 22%, rgba(201, 255, 243, 0.42) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 18%, rgba(201, 255, 243, 0.34) 0 1px, transparent 2px),
    radial-gradient(circle at 68% 72%, rgba(201, 255, 243, 0.28) 0 1px, transparent 2px),
    linear-gradient(130deg, #020713 0%, #06101f 50%, #020710 100%);
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  background: rgba(245, 255, 248, 0.94);
  border: 1px solid rgba(213, 248, 215, 0.4);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
}

.login-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
}

.login-card h1,
.login-card p { margin: 0; }
.login-card h1 { font-size: 34px; line-height: 1.05; }
.login-card p { color: var(--muted); line-height: 1.45; }

.admin-console {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 348px minmax(0, 1fr);
  background: transparent;
}

.admin-rail {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(180deg, #101923 0%, #08111e 100%);
  color: #f8fafc;
}

body[data-sky-mode="morning"] .admin-rail {
  background: linear-gradient(180deg, #10251f 0%, #0b1b19 100%);
}

body[data-sky-mode="evening"] .admin-rail {
  background: linear-gradient(180deg, #201821 0%, #101720 100%);
}

body[data-sky-mode="night"] .admin-rail {
  background: linear-gradient(180deg, #07101f 0%, #030813 100%);
}

.admin-brand,
.rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-square,
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 26px rgba(0, 164, 133, 0.32);
}

.admin-brand h1,
.admin-brand p,
.rail-brand h1,
.rail-brand p,
.rail-section h2,
.rail-section h3 { margin: 0; }

.admin-brand h1,
.rail-brand h1 { font-size: 23px; line-height: 1; }
.admin-brand p,
.rail-brand p { color: #a9b7c7; font-size: 12px; margin-top: 3px; }

.rail-section {
  display: grid;
  gap: 10px;
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rail-heading h2,
.rail-section h3 {
  color: #f8fafc;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.rail-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rail-metric,
.rail-metrics > div {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px;
}

.rail-metric span,
.rail-metrics > div span {
  display: block;
  color: #9fb0c3;
  font-size: 11px;
  font-weight: 800;
}

.rail-metric strong,
.rail-metrics > div strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 23px;
  line-height: 1;
}

.admin-rail .device-list {
  max-height: 33vh;
  overflow: auto;
  padding-right: 2px;
}

.admin-rail .device-card {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(148, 163, 184, 0.22);
  color: #f8fafc;
}

.admin-rail .device-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(148, 163, 184, 0.42);
}

.admin-rail .device-card.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.admin-rail .device-card span { color: #a9b7c7; }

.enroll-panel,
.enroll-card {
  display: grid;
  gap: 9px;
  margin-top: auto;
  padding-top: 4px;
}

.auto-enroll-note {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 13px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.auto-enroll-note h2,
.auto-enroll-note p {
  margin: 0;
}

.auto-enroll-note h2 {
  color: #f8fafc;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auto-enroll-note p {
  color: #a9b7c7;
  font-size: 13px;
  line-height: 1.35;
}

.install-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 4px;
  border-radius: 7px;
  background: #d0ffcd;
  color: #07140f;
  font-weight: 900;
  text-decoration: none;
}

.install-action:hover {
  background: #baf4b6;
}

.enroll-card h2 {
  margin: 0;
  color: #f8fafc;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.enroll-panel label,
.enroll-card label {
  display: grid;
  gap: 6px;
  color: #c7d2de;
  font-size: 12px;
  font-weight: 850;
}

.enroll-panel input,
.enroll-card input {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.28);
}

.admin-map-stage {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 18%, rgba(15, 118, 110, 0.12), transparent 30%),
    #dce7ef;
}

body[data-sky-mode="morning"] .admin-map-stage {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 217, 156, 0.28), transparent 24%),
    #dfeaf0;
}

body[data-sky-mode="evening"] .admin-map-stage {
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 139, 83, 0.22), transparent 26%),
    #dfe8ef;
}

body[data-sky-mode="night"] .admin-map-stage {
  background:
    radial-gradient(circle at 78% 18%, rgba(129, 170, 255, 0.18), transparent 24%),
    #0b1320;
}

.admin-map {
  position: absolute;
  inset: 0;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.admin-map iframe,
.admin-map .empty-map {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  border: 0;
}

.admin-map .empty-map {
  display: grid;
  align-content: center;
  place-items: center;
  gap: 14px;
  color: #506070;
  font-size: 18px;
  font-weight: 850;
  text-align: center;
}

.dashboard-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 46px;
  height: 46px;
  border: 4px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--danger);
  box-shadow: 0 16px 38px rgba(180, 35, 60, 0.34), 0 0 0 8px rgba(180, 35, 60, 0.12);
  transform: translate(-50%, -92%) rotate(-45deg);
  pointer-events: none;
}

.dashboard-pin::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 999px;
  background: #fff;
}

.dashboard-pin::before {
  content: none;
}

.dashboard-pin.empty {
  position: relative;
  left: auto;
  top: auto;
  width: 50px;
  height: 50px;
  opacity: 0.55;
  transform: rotate(-45deg);
}

.map-command-bar {
  position: absolute;
  left: 20px;
  right: auto;
  top: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  width: min(520px, calc(100% - 40px));
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(12px);
}

.map-command-title {
  display: grid;
  gap: 2px;
}

.map-command-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.map-command-title strong,
.map-command-bar h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.map-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-stats {
  position: absolute;
  left: 20px;
  right: 390px;
  bottom: 72px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
}

.map-stats div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.map-stats dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.map-stats dd {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

#streetAddress {
  font-size: 13px;
  line-height: 1.25;
}

.map-links {
  position: absolute;
  left: 20px;
  right: 390px;
  bottom: 20px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-links a,
.map-links button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  backdrop-filter: blur(12px);
  font-family: inherit;
}

.map-links a:hover,
.map-links button:hover {
  background: #fff;
}

.map-links button {
  background: var(--accent);
  border-color: rgba(13, 148, 136, 0.84);
  color: #fff;
}

.history-drawer {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 3;
  width: 346px;
  max-height: min(54vh, 520px);
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(12px);
}

.history-drawer h3 {
  margin: 0;
  font-size: 15px;
}

.history-drawer .history-list {
  max-height: 42vh;
  margin: 0;
}

@media (max-width: 1180px) {
  .admin-console { grid-template-columns: 320px minmax(0, 1fr); }
  .map-stats { right: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); bottom: 296px; }
  .map-links { right: 20px; bottom: 250px; }
  .history-drawer { left: 20px; width: auto; max-height: 210px; }
}

@media (max-width: 860px) {
  .admin-console { display: block; }
  .admin-rail { min-height: auto; }
  .admin-rail .device-list { max-height: 260px; }
  .admin-map-stage { min-height: 78vh; }
  .admin-map,
  .admin-map iframe,
  .admin-map .empty-map { min-height: 78vh; height: 78vh; }
  .map-command-bar {
    left: 12px;
    right: 12px;
    top: 12px;
    width: auto;
    align-items: stretch;
    flex-direction: column;
  }
  .map-tools { display: grid; grid-template-columns: 1fr 1fr; }
  .map-stats {
    left: 12px;
    right: 12px;
    bottom: 268px;
  }
  .map-links { left: 12px; right: 12px; bottom: 224px; }
  .history-drawer {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-height: 190px;
  }
}

@media (max-width: 560px) {
  .admin-login { padding: 14px; }
  .login-card h1 { font-size: 29px; }
  .admin-rail { padding: 14px; }
  .rail-metrics { grid-template-columns: 1fr 1fr 1fr; }
  .map-command-title strong,
  .map-command-bar h2 { font-size: 18px; }
  .map-stats { grid-template-columns: 1fr 1fr; }
  .map-tools { grid-template-columns: 1fr; }
}
