:root {
  --bg: #f8fbff;
  --panel: #ffffff;
  --panel-2: #f1f7ff;
  --glass: rgba(255, 255, 255, 0.86);
  --ink: #172033;
  --muted: #66748a;
  --line: rgba(85, 112, 145, 0.16);
  --teal: #20b7a4;
  --mint: #e9fff7;
  --amber: #f6a723;
  --coral: #f05c70;
  --blue: #3d7dff;
  --shadow: 0 18px 48px rgba(35, 58, 93, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f8fbff 0%, #f7fff9 46%, #fffaf3 100%);
  color: var(--ink);
  font-family: Inter, "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}

button, input, select { font: inherit; }
button {
  cursor: pointer;
  transform: translateY(0) scale(1);
  transition:
    transform 120ms ease,
    filter 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
  will-change: transform;
}

button:active:not(:disabled) {
  transform: translateY(2px) scale(0.965);
  filter: brightness(0.9);
}
.hidden { display: none !important; }

.email-code-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}

.signup-methods {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
}

.signup-method-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.signup-method-title span,
.signup-methods small {
  color: var(--muted);
  font-size: 13px;
}

.signup-method-title strong {
  color: var(--ink);
  font-size: 15px;
}

.social-auth-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.social-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.social-button span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 13px;
}

.social-button.google span {
  background: #eef4ff;
  color: #2559b7;
}

.social-button.kakao {
  background: #ffeb3b;
  border-color: rgba(172, 138, 0, 0.2);
  color: #241f00;
}

.social-button.kakao span {
  background: rgba(36, 31, 0, 0.12);
}

.social-button.naver {
  background: #03c75a;
  border-color: transparent;
  color: #ffffff;
}

.social-button.naver span {
  background: rgba(255, 255, 255, 0.2);
}

.social-button.email-method {
  background: #ffffff;
  color: #2559b7;
}

.social-button.email-method span {
  background: #eef4ff;
  color: #2559b7;
}

.social-button.disabled {
  opacity: 0.48;
  filter: grayscale(0.25);
}

.email-code-row input {
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--ink);
  padding: 0 12px;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 520px);
  gap: 28px;
  min-height: 100vh;
  padding: 28px;
}

.login-visual,
.login-card,
.sidebar,
.map-panel,
.guardian-side > section,
.summary-item,
.person-card,
.phone-screen,
.settings-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-visual {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(61, 125, 255, 0.12), rgba(32, 183, 164, 0.11) 52%, rgba(246, 167, 35, 0.11)),
    var(--panel);
}

.radar-card {
  position: relative;
  display: grid;
  place-items: center;
  width: min(440px, 78vw);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #f7fbff 0%, #edfff7 58%, #fff8e9 100%);
  text-align: center;
}

.radar-ring {
  position: absolute;
  width: 48%;
  aspect-ratio: 1;
  border: 1px solid rgba(61, 125, 255, 0.22);
  border-radius: 50%;
}

.radar-ring.second { width: 76%; opacity: 0.55; }
.radar-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 14px rgba(61, 125, 255, 0.12); }
.radar-card strong { position: absolute; bottom: 40%; font-size: 28px; }
.radar-card p { position: absolute; bottom: 32%; color: var(--muted); }

.login-card {
  align-self: center;
  padding: 34px;
}

.login-card h1,
.cockpit-hero h1 {
  margin: 10px 0 4px;
  font-size: clamp(34px, 5vw, 60px);
  letter-spacing: 0;
}

.login-card p,
.cockpit-hero p { color: var(--muted); margin: 0 0 22px; line-height: 1.6; }

.brand-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(32, 183, 164, 0.24);
  border-radius: 999px;
  background: #e9fff7;
  color: #087267;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.role-toggle,
.mode-tabs,
.nav-tabs {
  display: grid;
  gap: 6px;
}

.role-toggle,
.mode-tabs { grid-template-columns: repeat(2, 1fr); margin: 18px 0; }
.nav-tabs { grid-template-columns: 1fr; }

.role-option,
.mode-tab,
.nav-tab,
.ghost-button {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f9fd;
  color: #20304a;
  font-weight: 800;
}

.role-option.active,
.mode-tab.active,
.nav-tab.active {
  background: var(--blue);
  color: #ffffff;
  border-color: transparent;
}

.field { display: grid; gap: 8px; min-width: 0; margin: 14px 0; color: var(--muted); }
.field input, .field select {
  width: 100%;
  min-width: 0;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--ink);
  padding: 0 14px;
}

.primary-button,
.command-button,
.share-toggle,
.mini-button,
.addon-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 900;
  padding: 0 18px;
}

.mini-button {
  min-height: 38px;
  padding: 0 12px;
  background: #eef5ff;
  color: #2559b7;
  border: 1px solid var(--line);
}

.primary-button.full { width: 100%; }
.login-hint { margin-top: 16px !important; font-size: 13px; }

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  gap: 18px;
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 18px;
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 900;
}

.brand-row span,
.connection-card span,
.event-card span { display: block; color: var(--muted); font-size: 13px; }
.connection-card { margin: 18px 0; padding: 14px; border-radius: 8px; background: #f5f9ff; }

.main { min-width: 0; }
.view-panel { display: none; }
.view-panel.active { display: block; }

.cockpit-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.top-actions { display: flex; gap: 10px; }
.web-hero {
  align-items: center;
}
.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9ff;
  color: var(--blue);
  font-weight: 900;
}

.guardian-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(6, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.person-card,
.summary-item {
  min-height: 92px;
  padding: 14px;
}

.person-card { display: flex; align-items: center; gap: 12px; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 8px; background: linear-gradient(135deg, var(--blue), var(--teal)); color: #ffffff; font-weight: 900; }
.person-card strong, .summary-item strong { display: block; margin-top: 6px; font-size: 22px; }
.person-card span, .person-card small, .summary-item span { color: var(--muted); }

.guardian-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.monitor-grid > * {
  min-width: 0;
}

.map-panel,
.map-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.map-toolbar {
  position: absolute;
  z-index: 500;
  left: 14px;
  right: 14px;
  top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.map-toolbar span { color: var(--muted); font-size: 10px; }
.map-toolbar strong { display: block; margin-top: 1px; font-size: 14px; }
.map-toolbar small {
  display: block;
  max-width: 100%;
  margin-top: 1px;
  color: #087567;
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.follow-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f3f7ff;
  color: #2b5fc7;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}
.follow-button.active {
  border-color: transparent;
  background: var(--blue);
  color: #ffffff;
}

.map-canvas {
  position: relative;
  height: min(58vh, 620px);
  min-height: 420px;
  overflow: hidden;
  background: #edf4ff;
}

.monitor-map-card .map-canvas {
  height: min(70vh, 760px);
  min-height: 560px;
}

.web-person-marker {
  position: relative;
  width: 54px;
  height: 54px;
}

.web-person-marker .marker-halo {
  position: absolute;
  inset: 2px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61, 125, 255, 0.18) 0 42%, rgba(32, 183, 164, 0.08) 43% 100%);
  box-shadow: 0 14px 28px rgba(35, 58, 93, 0.28);
}

.web-person-marker .marker-person {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 31px;
  height: 43px;
  transform: translate(-50%, -50%) rotate(var(--heading));
  transform-origin: 50% 50%;
}

.web-person-marker .marker-head {
  position: absolute;
  left: 50%;
  top: 0;
  width: 15px;
  height: 15px;
  transform: translateX(-50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--blue);
}

.web-person-marker .marker-body {
  position: absolute;
  left: 50%;
  top: 15px;
  width: 26px;
  height: 28px;
  transform: translateX(-50%);
  border: 2px solid #fff;
  border-radius: 13px 13px 10px 10px;
  background: linear-gradient(180deg, #7dd3fc 0%, var(--blue) 100%);
  clip-path: polygon(50% 0, 82% 18%, 100% 76%, 62% 100%, 50% 82%, 38% 100%, 0 76%, 18% 18%);
}

.leaflet-container { font-family: inherit; background: #edf4ff; }
.monitor-map-card .leaflet-bottom.leaflet-right {
  right: 14px;
  bottom: 14px;
}

.monitor-map-card .leaflet-control-zoom {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(35, 58, 93, 0.16);
  overflow: hidden;
}

.monitor-map-card .leaflet-control-zoom a {
  width: 40px;
  height: 40px;
  line-height: 40px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.map-canvas.navigation-mode .leaflet-map-pane {
  transform-origin: 50% 50%;
  will-change: transform;
}
.map-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
  background: #ffffff;
}
.map-metrics button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  color: #2b5fc7;
  background: #f5f8ff;
  font-weight: 800;
}
.map-metrics button:hover { background: #eef5ff; }

.safe-zone,.route,.map-label,.person-marker { display: none; }

.live-direction-marker {
  position: relative;
  filter: drop-shadow(0 12px 18px rgba(35, 58, 93, 0.26));
}
.live-direction-marker .nav-halo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61,125,255,0.18) 0 42%, rgba(32,183,164,0.1) 43% 100%);
}
.live-direction-marker .person-figure {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 31px;
  height: 43px;
  transform: translate(-50%, -50%) rotate(var(--nav-deg));
  transform-origin: 50% 50%;
}
.live-direction-marker .person-head {
  position: absolute;
  left: 50%;
  top: 0;
  width: 15px;
  height: 15px;
  transform: translateX(-50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 5px 10px rgba(8,20,18,0.25);
}
.live-direction-marker .person-body {
  position: absolute;
  left: 50%;
  top: 15px;
  width: 26px;
  height: 28px;
  transform: translateX(-50%);
  border: 2px solid #fff;
  border-radius: 13px 13px 10px 10px;
  background: linear-gradient(180deg, #7dd3fc 0%, var(--blue) 100%);
  clip-path: polygon(50% 0, 82% 18%, 100% 76%, 62% 100%, 50% 82%, 38% 100%, 0 76%, 18% 18%);
  box-shadow: 0 10px 18px rgba(15,118,110,0.32);
}
.live-direction-marker .sensor-needle,
.live-direction-marker .course-needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 25px;
  border-radius: 999px;
  transform-origin: 50% 100%;
  opacity: 0.85;
}
.live-direction-marker .sensor-needle {
  background: #f59e0b;
  transform: translate(-50%, -100%) rotate(var(--device-deg));
}
.live-direction-marker .course-needle {
  background: var(--blue);
  transform: translate(-50%, -100%) rotate(var(--course-deg));
}
.live-direction-marker .muted { opacity: 0.25; }

.guardian-side { display: grid; gap: 14px; align-content: start; }
.mission-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mission-grid article {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f5f9ff;
}
.mission-grid strong { display: block; color: #2b5fc7; font-size: 22px; }
.mission-grid span { color: var(--muted); }

.live-panel, .history-panel { display: grid; gap: 12px; padding: 14px; }
.device-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f5f9ff;
}
.device-panel span,
.device-panel small { color: var(--muted); }
.device-panel strong { display: block; margin-top: 5px; font-size: 20px; }
.device-panel-head {
  padding: 14px;
  border-radius: 8px;
  background: #eef5ff;
  border: 1px solid rgba(61,125,255,0.16);
}
.device-register {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.device-register input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}
.device-register button {
  min-width: 64px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 900;
}
.device-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}
.device-chip {
  width: 100%;
  min-height: 72px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  text-align: left;
}
.device-chip.active {
  border-color: transparent;
  background: linear-gradient(135deg, #dceaff, #3d7dff);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(61,125,255,0.22);
}
.device-chip strong { display: block; font-size: 16px; }
.device-chip small {
  display: block;
  margin-top: 3px;
  color: inherit;
  opacity: 0.78;
}
.device-chip .device-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.device-chip .device-meta span {
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}
.device-item {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
}
.device-item strong,
.device-item span {
  display: block;
}
.device-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}
.pair-request {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
}
.pair-request button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
}
.pair-request button.danger {
  background: var(--coral);
}
.alert-card, .event-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f7faff;
}
.alert-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: rgba(244,176,62,0.16); color: #9a6208; font-weight: 900; }
.alert-card p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }
.media-card,
.billing-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f7faff;
}
.media-card span,
.billing-card span { color: var(--muted); font-size: 12px; }
.media-card strong,
.billing-card strong { display: block; margin-top: 3px; }
.media-card small,
.billing-card small { display: block; color: var(--muted); margin-top: 5px; }
.media-card img,
.media-card video {
  display: none;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef4fb;
}
.media-card.has-media img { display: block; }
.media-card.in-call video { display: block; }
.media-card.in-call img { display: none; }
.billing-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.billing-meter {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #edf3fb;
}
.billing-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--teal), var(--amber));
  transition: width 220ms ease;
}
.billing-stats,
.addon-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.billing-stats span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef5ff;
  color: #2b5fc7;
  font-weight: 800;
}
.addon-button {
  min-height: 64px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 8px;
}
.addon-button span {
  color: rgba(23, 32, 51, 0.72);
  font-weight: 900;
  font-size: 12px;
}
.billing-note {
  line-height: 1.5;
}
.legal-consent-box {
  display: grid;
  gap: 8px;
  margin: 4px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faff;
}
.legal-consent-box.hidden { display: none; }
.legal-consent-box label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.legal-consent-box input { width: 18px; height: 18px; accent-color: var(--teal); }
.legal-consent-box a {
  color: #2b5fc7;
  font-weight: 800;
  text-decoration: none;
}
.command-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.command-button.danger { background: var(--coral); color: #fff; }
.event-card { justify-content: space-between; }

.phone-screen { max-width: 520px; padding: 18px; }
.phone-status { display: flex; justify-content: space-between; color: var(--muted); }
.phone-card { margin: 18px 0; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: #ffffff; }
.phone-card h2 { font-size: 42px; margin: 18px 0 8px; }
.phone-card p, .phone-list span { color: var(--muted); }
.phone-list { display: grid; gap: 10px; }
.phone-list article { display: flex; justify-content: space-between; padding: 14px; border-radius: 8px; background: #f7faff; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-panel { padding: 18px; }
.architecture-list { color: var(--muted); line-height: 1.8; }

.legal-dock {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 5000;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.legal-dock a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 6px;
  color: #2b5fc7;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.legal-dock a:hover {
  background: #eef5ff;
}

.side-panel,
.device-card {
  display: grid;
  gap: 12px;
}

.side-panel {
  position: sticky;
  top: 18px;
  min-width: 0;
}

.web-panel {
  display: none;
}

.web-panel.active {
  display: grid;
}

.status-box,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f9ff;
  color: var(--muted);
  line-height: 1.5;
  padding: 12px;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  color: var(--ink);
  margin-bottom: 4px;
}

.history-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.quick-range {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-range button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8ff;
  color: #2b5fc7;
  font-weight: 900;
}

.stay-list {
  display: grid;
  gap: 8px;
}

.stay-title {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.stay-item,
.stay-empty {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--ink);
  padding: 11px;
  text-align: left;
}

.stay-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.stay-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--amber);
  color: #172033;
  font-weight: 900;
}

.stay-item strong,
.stay-empty strong {
  display: block;
}

.stay-item small,
.stay-empty span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.45;
}

.command-button.active,
.mini-button.active {
  background: var(--amber);
  color: #172033;
}

.web-device-list {
  max-height: 310px;
}

.device-item.active {
  border-color: transparent;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);
}

.device-item.active strong {
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.16);
}

.device-item.active span {
  color: rgba(255, 255, 255, 0.92);
}

.device-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.panel-heading span,
.panel-heading small {
  color: var(--muted);
}

.panel-heading strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.share-toggle {
  width: 100%;
  min-height: 60px;
  font-size: 18px;
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .nav-tabs { grid-template-columns: repeat(3, 1fr); }
  .guardian-summary, .guardian-grid, .settings-grid, .monitor-grid { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}

@media (max-width: 680px) {
  .login-screen { grid-template-columns: 1fr; padding: 14px; }
  .login-visual { display: none; }
  .app-shell { padding: 10px; }
  .cockpit-hero { flex-direction: column; }
  .guardian-summary { grid-template-columns: repeat(2, 1fr); }
  .person-card { grid-column: 1 / -1; }
  .map-canvas { min-height: 360px; height: 52vh; }
  .monitor-map-card .map-canvas { min-height: 420px; height: 58vh; }
  .map-toolbar { left: 10px; right: 10px; top: 10px; padding: 6px 10px; }
  .map-toolbar strong { font-size: 14px; }
  .map-metrics { grid-template-columns: 1fr; }
  .history-fields,
  .quick-range,
  .email-code-row,
  .social-auth-row { grid-template-columns: 1fr; }
  .top-actions { width: 100%; flex-direction: column; }
}
