:root {
  --bg: #f3f5f8;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-alt: rgba(237, 242, 247, 0.92);
  --line: rgba(217, 225, 234, 0.88);
  --text: #17324d;
  --muted: #62758a;
  --primary: #2563eb;
  --primary-strong: #1749af;
  --green: #1f9d58;
  --yellow: #d79a12;
  --red: #d14343;
  --danger: #b73535;
  --shadow: 0 20px 40px rgba(18, 39, 64, 0.14);
  --shadow-strong: 0 22px 54px rgba(10, 29, 54, 0.24);
  --radius: 20px;
  --font-ui: "Segoe UI Variable", "Segoe UI", Tahoma, sans-serif;
  --topbar-height: 60px;
  --workspace-sidebar-width: 312px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font-ui);
  background: linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
}

.admin-app-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 34%),
    linear-gradient(180deg, #f8fafc 0%, #e9eef5 100%);
}

.admin-page-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 74px;
  padding: 14px 28px;
  background: rgba(23, 50, 77, 0.96);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(10, 29, 54, 0.18);
}

.admin-page-topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.admin-page-topbar .eyebrow {
  color: #9ec5ff;
}

.admin-page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: end;
}

.admin-page-link {
  display: inline-flex;
  align-items: center;
}

.admin-page-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.admin-page-stack {
  display: grid;
  gap: 18px;
}

.admin-page-hero {
  margin-bottom: 18px;
}

.admin-page-hero h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.admin-toast {
  position: sticky;
  top: 86px;
  z-index: 10;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(23, 50, 77, 0.94);
  color: #ffffff;
  box-shadow: var(--shadow);
}

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

button {
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(26, 124, 87, 0.14), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, #eaf0f6 100%);
}

.login-shell {
  width: min(100%, 420px);
}

.login-card,
.detail-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card {
  padding: 28px;
}

.login-brand,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
}

.subtle-copy,
.muted-note,
label span,
.detail-label {
  color: var(--muted);
}

.error-text {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.95rem;
}

.login-note {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
}

.checkbox-row input[type="checkbox"] {
  width: auto;
  min-width: 18px;
  height: 18px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  border-color: #98b5f0;
}

.secondary-button,
button[type="submit"] {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
}

.secondary-button {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--text);
  text-decoration: none;
}

button[type="submit"] {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.user-chip,
.status-chip,
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
}

.map-app-page {
  height: 100vh;
  overflow: hidden;
  background: #d6e0ea;
}

.map-shell {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 24%),
    radial-gradient(circle at bottom right, rgba(46, 127, 91, 0.18), transparent 22%),
    linear-gradient(180deg, #d7e7f3 0%, #cfe3ef 46%, #dbe8d5 100%);
}

.map-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: var(--topbar-height);
  padding: 10px 14px;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 23, 38, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 30px rgba(10, 29, 54, 0.2);
  color: #f8fbff;
}

.topbar-leading,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-actions {
  justify-self: end;
  min-width: 0;
}

.menu-toggle-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.menu-toggle-button:hover {
  background: rgba(142, 195, 255, 0.12);
  border-color: rgba(142, 195, 255, 0.24);
}

.menu-toggle-button span {
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.map-topbar .user-chip {
  max-width: min(260px, 36vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 7px 12px;
  font-size: 0.92rem;
}

.nav-pill {
  text-decoration: none;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid rgba(23, 50, 77, 0.08);
  padding: 7px 12px;
  font-size: 0.92rem;
}

button.nav-pill {
  appearance: none;
  font: inherit;
}

.nav-pill.is-active {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-strong);
  border-color: rgba(37, 99, 235, 0.22);
}

.nav-pill-status {
  background: rgba(18, 39, 64, 0.42);
  color: #dff1ff;
  border-color: rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-sidebar-overlay {
  position: absolute;
  inset: 0;
  z-index: 32;
  opacity: 0;
  pointer-events: none;
  background: rgba(7, 21, 36, 0.22);
  transition: opacity 180ms ease;
}

.map-sidebar-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.map-sidebar {
  position: absolute;
  top: calc(var(--topbar-height) + 12px);
  left: 14px;
  bottom: 14px;
  width: min(var(--workspace-sidebar-width), calc(100vw - 28px));
  z-index: 35;
  pointer-events: none;
}

.map-sidebar.is-open {
  pointer-events: auto;
}

.map-sidebar-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(245, 248, 252, 0.96);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-strong);
  transform: translateX(calc(-100% - 24px));
  transition: transform 180ms ease;
}

.map-sidebar.is-open .map-sidebar-shell {
  transform: translateX(0);
}

.map-sidebar-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.map-sidebar-header h2 {
  margin: 4px 0 0;
  font-size: 1.2rem;
}

.map-sidebar-header .subtle-copy {
  margin: 4px 0 0;
  font-size: 0.96rem;
}

.sidebar-close-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(23, 50, 77, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
}

.sidebar-close-button:hover {
  color: var(--text);
  background: #ffffff;
}

.map-sidebar-nav {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  align-content: start;
  grid-auto-rows: max-content;
  padding-right: 2px;
}

.sidebar-nav-link,
.sidebar-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(23, 50, 77, 0.08);
  background: var(--surface-strong);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.sidebar-nav-link.is-active {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.14), rgba(37, 99, 235, 0.08));
  border-color: rgba(37, 99, 235, 0.22);
  color: var(--primary-strong);
}

.sidebar-action-button {
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-strong);
}

.sidebar-section {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border-radius: 16px;
  background: rgba(237, 242, 247, 0.78);
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.sidebar-section-label {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-pill-group {
  display: grid;
  gap: 6px;
}

.nav-pill-group.is-vertical {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.map-sidebar .nav-pill {
  justify-content: center;
  width: 100%;
  padding: 9px 10px;
  border-radius: 999px;
}

.sidebar-mode-status {
  display: grid;
  gap: 6px;
}

.sidebar-mode-pill {
  width: fit-content;
  max-width: 100%;
}

.sidebar-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(23, 50, 77, 0.08);
  background: #ffffff;
  color: var(--text);
}

.map-sidebar-footer {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(23, 50, 77, 0.08);
}

.sidebar-user-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(237, 242, 247, 0.78);
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.sidebar-logout-button {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
}

.map-main {
  position: relative;
  height: 100%;
  overflow: hidden;
}

.map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.map-canvas,
.fallback-map {
  position: absolute;
  inset: 0;
}

.fallback-map {
  background:
    radial-gradient(circle at 22% 18%, rgba(37, 99, 235, 0.16), transparent 16%),
    radial-gradient(circle at 76% 68%, rgba(41, 144, 105, 0.18), transparent 18%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.26), transparent 30%),
    linear-gradient(180deg, #dcecff 0%, #edf5ff 34%, #d6ead8 100%);
}

.fallback-map.is-satellite-mode {
  background:
    radial-gradient(circle at 20% 24%, rgba(108, 150, 95, 0.18), transparent 18%),
    radial-gradient(circle at 78% 70%, rgba(84, 107, 76, 0.22), transparent 22%),
    linear-gradient(160deg, rgba(244, 232, 201, 0.12), transparent 30%),
    linear-gradient(180deg, #49655d 0%, #5f7a5f 34%, #80765b 68%, #50453f 100%);
}

.fallback-map::before,
.fallback-map::after {
  content: "";
  position: absolute;
  inset: 0;
}

.fallback-map::before {
  background:
    linear-gradient(120deg, transparent 0%, transparent 44%, rgba(66, 114, 166, 0.18) 45%, rgba(66, 114, 166, 0.18) 48%, transparent 49%),
    linear-gradient(40deg, transparent 0%, transparent 65%, rgba(66, 114, 166, 0.16) 66%, rgba(66, 114, 166, 0.16) 69%, transparent 70%);
}

.fallback-map.is-satellite-mode::before {
  background:
    linear-gradient(126deg, transparent 0%, transparent 38%, rgba(58, 74, 60, 0.2) 39%, rgba(58, 74, 60, 0.2) 46%, transparent 47%),
    linear-gradient(32deg, transparent 0%, transparent 62%, rgba(112, 124, 82, 0.2) 63%, rgba(112, 124, 82, 0.2) 70%, transparent 71%);
}

.fallback-map::after {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.24) 0, rgba(255, 255, 255, 0.24) 1px, transparent 1px, transparent 64px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.24) 0, rgba(255, 255, 255, 0.24) 1px, transparent 1px, transparent 64px);
  opacity: 0.64;
}

.fallback-map.is-satellite-mode::after {
  background:
    radial-gradient(circle at 24% 40%, rgba(255, 255, 255, 0.06), transparent 14%),
    radial-gradient(circle at 70% 28%, rgba(0, 0, 0, 0.12), transparent 18%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 72px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 72px);
  opacity: 0.45;
}

.map-toast {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 14;
  max-width: min(560px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(10, 23, 38, 0.76);
  color: #f6fbff;
  box-shadow: 0 16px 34px rgba(7, 21, 36, 0.22);
}

.map-marker-button {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  z-index: 8;
}

.tower-pin {
  position: relative;
  display: grid;
  place-items: center;
  width: 50px;
  height: 62px;
  border-radius: 18px 18px 12px 12px;
  background: #1749af;
  box-shadow: 0 16px 28px rgba(14, 34, 58, 0.25);
}

.tower-pin::after {
  content: "";
  position: absolute;
  top: 54px;
  width: 14px;
  height: 14px;
  background: inherit;
  transform: rotate(45deg);
  border-radius: 2px;
}

.map-marker-button.status-green .tower-pin {
  background: var(--green);
}

.map-marker-button.status-yellow .tower-pin {
  background: var(--yellow);
}

.map-marker-button.status-red .tower-pin {
  background: var(--red);
}

.tower-pin-glyph {
  position: relative;
  z-index: 1;
  color: white;
  font-weight: 800;
  font-size: 1rem;
}

.tower-pin-svg {
  display: block;
  width: 20px;
  height: 20px;
}

.tower-nameplate {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 50, 77, 0.08);
  color: var(--text);
  font-size: 0.82rem;
  white-space: nowrap;
  box-shadow: 0 10px 18px rgba(18, 39, 64, 0.1);
}

.is-draft-pin {
  pointer-events: none;
  z-index: 9;
}

.map-marker-button.is-editing {
  z-index: 11;
}

.map-marker-button.is-editing .tower-pin {
  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.18),
    0 16px 28px rgba(14, 34, 58, 0.28);
}

.map-marker-button.is-dragging .tower-pin {
  transform: scale(1.04);
}

.tower-pin-draft {
  background: var(--primary);
}

.map-action-popup {
  position: absolute;
  z-index: 12;
  width: min(240px, calc(100vw - 36px));
  pointer-events: auto;
  transform: translateY(-100%);
}

.pin-action-box {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 210px;
  padding: 14px;
  padding-right: 40px;
  border: 1px solid rgba(23, 50, 77, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 18px 36px rgba(18, 39, 64, 0.18);
}

.pin-action-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
}

.pin-action-close:hover {
  background: rgba(23, 50, 77, 0.08);
  color: var(--text);
}

.pin-action-title {
  font-weight: 700;
  font-size: 0.96rem;
}

.pin-action-coords {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pin-action-coords span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pin-action-coords strong {
  font-size: 0.92rem;
}

.pin-action-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.pin-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pin-action-button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--primary);
  color: #ffffff;
}

.pin-action-button.is-secondary {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--text);
}

.add-site-form {
  gap: 14px;
}

.add-site-form input[readonly] {
  background: #f5f8fc;
  color: var(--muted);
}

.add-site-form textarea {
  min-height: 110px;
  resize: vertical;
}

.editor-map-hint,
.detail-inline-card {
  margin: 0;
}

.editor-map-hint {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: rgba(37, 99, 235, 0.06);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.detail-inline-card {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(23, 50, 77, 0.08);
  background: rgba(237, 242, 247, 0.72);
}

.detail-card-actions {
  margin-top: 14px;
}

.inline-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary-strong);
  text-decoration: none;
  font-weight: 600;
}

.inline-link-button.is-secondary {
  width: auto;
  border-color: rgba(23, 50, 77, 0.08);
  background: var(--surface-strong);
  color: var(--text);
}

.target-assignment-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 4px;
}

.target-assignment-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(23, 50, 77, 0.08);
  background: rgba(255, 255, 255, 0.84);
}

.target-assignment-option.is-stale {
  border-style: dashed;
  background: rgba(255, 244, 214, 0.5);
}

.target-assignment-option input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.target-assignment-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.target-assignment-copy strong,
.target-assignment-copy span {
  overflow-wrap: anywhere;
}

.target-assignment-copy span {
  color: var(--muted);
  font-size: 0.86rem;
}

.targets-page {
  min-height: 100vh;
  padding: 22px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 24%),
    radial-gradient(circle at bottom right, rgba(31, 157, 88, 0.1), transparent 24%),
    linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
}

.targets-page-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.targets-page-header {
  display: grid;
  gap: 8px;
}

.targets-page-header h1,
.targets-page-summary h2 {
  margin: 0;
}

.targets-page-header-row {
  display: flex;
  justify-content: flex-start;
}

.targets-page-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.targets-page-detail {
  display: grid;
}

.targets-summary-card {
  display: grid;
  gap: 14px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.targets-summary-card:hover,
.targets-summary-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 18px 32px rgba(23, 50, 77, 0.12);
}

.targets-summary-card.is-selected {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 18px 32px rgba(37, 99, 235, 0.12);
}

.targets-summary-card .detail-card-header,
.targets-detail-card .detail-card-header {
  align-items: start;
}

.targets-summary-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.targets-summary-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.targets-summary-footer .inline-link-button {
  width: auto;
  flex-shrink: 0;
}

.targets-detail-card {
  display: grid;
  gap: 16px;
}

.device-interface-list {
  display: grid;
  gap: 10px;
}

.targets-detail-card.is-empty {
  min-height: 0;
}

.targets-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.target-graph-frame {
  position: relative;
  display: grid;
  min-height: 180px;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(23, 50, 77, 0.08);
  background:
    linear-gradient(180deg, rgba(241, 245, 249, 0.92), rgba(226, 232, 240, 0.92));
}

.target-graph-frame.is-detail {
  min-height: 260px;
}

.target-graph-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.target-graph-frame.is-detail .target-graph-image {
  object-fit: contain;
  background: rgba(255, 255, 255, 0.72);
}

.target-graph-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

.target-graph-empty strong {
  color: var(--text);
}

.target-graph-frame.is-unavailable .target-graph-empty {
  height: 100%;
}

.targets-card .detail-grid,
.targets-detail-card .detail-grid {
  margin-top: 0;
}

.gm-style .gm-style-iw-c {
  padding: 0;
  border-radius: 16px;
}

.gm-style .gm-style-iw-d {
  overflow: hidden !important;
}

.gm-style .gm-style-iw-chr,
.gm-style .gm-ui-hover-effect {
  display: none !important;
}

.tower-panel {
  position: absolute;
  top: calc(var(--topbar-height) + 14px);
  right: 18px;
  bottom: 18px;
  width: min(380px, calc(100vw - 36px));
  z-index: 20;
  pointer-events: none;
}

.tower-panel.is-admin-mode {
  width: min(460px, calc(100vw - 36px));
}

.tower-panel-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(245, 248, 252, 0.94);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-strong);
  transform: translateX(calc(100% + 24px));
  transition: transform 180ms ease;
}

.tower-panel.is-open {
  pointer-events: auto;
}

.tower-panel.is-open .tower-panel-shell {
  transform: translateX(0);
}

.tower-panel-header {
  display: grid;
  gap: 8px;
}

.tower-panel-header h2 {
  margin: 4px 0 0;
}

.tower-panel-header .subtle-copy {
  margin: 6px 0 0;
}

.tower-panel-body {
  display: grid;
  flex: 1 1 auto;
  gap: 14px;
  overflow: auto;
  min-height: 0;
  padding-right: 2px;
}

.tower-panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid rgba(23, 50, 77, 0.08);
}

.tower-panel-footer:empty {
  display: none;
}

.panel-action-button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--primary);
  color: #ffffff;
}

.panel-action-button.is-secondary {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--text);
}

.panel-action-button.is-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.detail-card {
  padding: 18px;
}

.admin-collapsible-card {
  padding: 0;
  overflow: hidden;
}

.admin-collapsible-summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 18px;
  list-style: none;
  cursor: pointer;
}

.admin-collapsible-summary::-webkit-details-marker {
  display: none;
}

.admin-collapsible-summary h3 {
  margin: 0 0 6px;
}

.admin-collapsible-state::after {
  content: "Open";
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-collapsible-card[open] .admin-collapsible-state::after {
  content: "Collapse";
  background: rgba(98, 117, 138, 0.12);
  color: var(--muted);
}

.admin-collapsible-content {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.detail-card-header.is-stacked {
  display: grid;
  gap: 8px;
  align-items: start;
}

.detail-card-placeholder {
  min-height: 160px;
}

.detail-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.detail-card h3 {
  margin: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-metric {
  padding: 12px;
  border-radius: 14px;
  background: rgba(237, 242, 247, 0.92);
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.summary-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.3rem;
}

.provisioning-callout strong {
  overflow-wrap: anywhere;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-customer-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(237, 242, 247, 0.72);
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.admin-customer-card h4 {
  margin: 0;
}

.admin-user-card .plan-badge {
  align-self: start;
}

.admin-customer-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.admin-token-issue-row {
  grid-template-columns: minmax(0, 1.4fr) 160px auto;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.plan-badge-muted {
  background: rgba(98, 117, 138, 0.12);
  color: var(--muted);
}

.admin-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-customer-section {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(23, 50, 77, 0.08);
}

.admin-customer-section .detail-card-header {
  margin-bottom: 0;
}

.admin-nested-list {
  display: grid;
  gap: 10px;
}

.admin-mini-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.empty-state {
  padding: 16px;
  border-radius: 16px;
  background: rgba(237, 242, 247, 0.72);
  border: 1px dashed rgba(23, 50, 77, 0.16);
  color: var(--muted);
}

.detail-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.84rem;
}

.status-chip {
  font-size: 0.84rem;
  color: white;
}

.status-chip.status-green {
  background: var(--green);
}

.status-chip.status-yellow {
  background: var(--yellow);
}

.status-chip.status-red {
  background: var(--red);
}

@media (max-width: 840px) {
  .map-topbar {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 10px 12px;
  }

  .tower-panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    height: min(62vh, 520px);
  }

  .tower-panel-shell {
    transform: translateY(calc(100% + 24px));
  }

  .tower-panel.is-open .tower-panel-shell {
    transform: translateY(0);
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .admin-inline-form {
    grid-template-columns: 1fr;
  }

  .tower-panel-footer {
    justify-content: stretch;
  }

  .panel-action-button {
    width: 100%;
  }

  .map-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }

  .map-sidebar {
    top: calc(var(--topbar-height) + 10px);
    left: 12px;
    bottom: 12px;
    width: min(var(--workspace-sidebar-width), calc(100vw - 24px));
  }
}

@media (max-width: 640px) {
  .login-page {
    padding: 16px;
  }

  .login-card {
    padding: 22px;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .map-topbar .user-chip {
    max-width: calc(100vw - 24px);
  }

  .nav-pill-group.is-vertical {
    grid-template-columns: 1fr;
  }

  .map-sidebar {
    width: calc(100vw - 24px);
  }

  .targets-page {
    padding: 14px;
  }

  .targets-page-list,
  .targets-summary-stats {
    grid-template-columns: 1fr;
  }

  .targets-summary-footer,
  .targets-detail-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .targets-summary-footer .inline-link-button,
  .targets-detail-actions .inline-link-button {
    width: 100%;
  }
}
