:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #607080;
  --line: #d8e0e8;
  --panel: #ffffff;
  --surface: #f3f6f8;
  --surface-2: #edf2f5;
  --control: #ffffff;
  --soft: #e4f3f1;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --brand-cream: #f3efe5;
  --brand-dark: #020809;
  --map-bg: #e8eef2;
  --shadow: 0 14px 38px rgba(21, 34, 44, 0.14);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4efe4;
  --muted: #9fb4b8;
  --line: rgba(126, 206, 211, 0.22);
  --panel: rgba(7, 17, 19, 0.94);
  --surface: #03090a;
  --surface-2: rgba(9, 24, 26, 0.88);
  --control: rgba(2, 8, 9, 0.92);
  --soft: rgba(111, 201, 207, 0.16);
  --accent: #6fc9cf;
  --accent-strong: #9fe5e8;
  --warn: #f6b15d;
  --brand-cream: #f4efe4;
  --brand-dark: #020809;
  --map-bg: #10191b;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--surface);
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 750;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.ghost {
  color: var(--accent-strong);
  background: var(--soft);
}

button.ghost:hover {
  background: color-mix(in srgb, var(--soft) 72%, var(--accent) 28%);
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(210px, 0.85fr) minmax(360px, 1.6fr);
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand-block {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: grid;
  gap: 5px;
  justify-items: center;
  flex: 0 0 auto;
}

.brand-logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

.plan-badge {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 18px;
  border: 1px solid rgba(245, 197, 66, 0.55);
  border-radius: 999px;
  padding: 0 7px;
  color: var(--brand-dark);
  background: #f5c542;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.plan-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--brand-dark);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.32rem;
  line-height: 1.1;
}

.brand-block p,
.location-card p,
.safety-note {
  color: var(--muted);
}

.header-callsign {
  margin-top: 2px;
  color: var(--accent-strong) !important;
  font-size: 0.76rem;
  font-weight: 850;
}

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

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
}

.loadout-config span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input,
select,
textarea {
  min-height: 42px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
  color: var(--ink);
  min-width: 0;
}

input {
  width: 100%;
  padding: 0 13px;
}

textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  padding: 10px 13px;
  line-height: 1.35;
}

select {
  padding: 0 10px;
}

.workspace {
  position: relative;
  min-height: 0;
  height: calc(100vh - 73px);
  height: calc(100dvh - 73px);
  flex: 1;
  overflow: hidden;
}

.map-region {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 360px;
  background: var(--map-bg);
}

.leaflet-container {
  width: 100%;
  height: 100%;
  background: var(--map-bg);
  overflow: hidden;
  outline-offset: 1px;
}

/* Critical Leaflet layout rules kept local so file:// previews still work if CDN CSS is blocked. */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-container {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-tile {
  width: 256px;
  height: 256px;
  filter: inherit;
  visibility: inherit;
  border: 0;
}

.leaflet-tile-container {
  pointer-events: none;
}

.leaflet-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 800;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-control-zoom {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.leaflet-control-zoom a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink);
  background: var(--control);
  text-decoration: none;
  font-weight: 850;
}

.leaflet-control-zoom a + a {
  border-top: 1px solid var(--line);
}

.leaflet-control-attribution {
  padding: 3px 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
}

.leaflet-control-attribution a {
  color: var(--accent-strong);
}

.leaflet-popup {
  position: absolute;
  text-align: center;
  margin-bottom: 20px;
}

.leaflet-popup-content-wrapper {
  padding: 1px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  margin: 12px 14px;
  line-height: 1.35;
}

.leaflet-interactive {
  cursor: pointer;
}

.leaflet-overlay-pane svg {
  z-index: 450;
}

.map-status {
  position: absolute;
  left: 16px;
  bottom: 16px;
  max-width: min(520px, calc(100% - 32px));
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 650;
  z-index: 500;
}

.sidebar {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 650;
  width: min(420px, calc(100% - 28px));
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(216, 224, 232, 0.88);
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  transition:
    transform 180ms ease,
    opacity 180ms ease;
  container-type: inline-size;
}

.sidebar.collapsed {
  pointer-events: none;
  opacity: 0;
  transform: translateX(calc(100% + 26px));
}

.panel-toggle {
  position: absolute;
  top: 14px;
  right: 448px;
  z-index: 700;
  min-width: 112px;
  min-height: 40px;
  color: var(--brand-dark);
  background: var(--accent);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.workspace.panel-collapsed .panel-toggle {
  right: 14px;
}

.drop-mode {
  color: #fff;
  background: #1f2937;
}

.panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 18px rgba(21, 34, 44, 0.06);
}

.panel + .panel {
  margin-top: 12px;
}

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

.location-card > *,
.loadout-head > *,
.card-top > *,
.card-actions > * {
  min-width: 0;
}

.planning-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
}

.custom-radius-control span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.custom-radius-control b {
  border-radius: 999px;
  padding: 2px 5px;
  color: var(--brand-dark);
  background: #f5c542;
  font-size: 0.62rem;
  line-height: 1;
}

.operator-panel {
  display: grid;
  gap: 10px;
}

.is-hidden {
  display: none !important;
}

.agreement {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.agreement input {
  min-height: auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h2 {
  font-size: 1rem;
  line-height: 1.25;
}

.radius-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  min-width: 0;
}

.radius-control select,
.radius-control input {
  width: 100%;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: var(--soft);
}

.tab {
  min-height: 36px;
  color: var(--muted);
  background: transparent;
  min-width: 0;
  padding: 0 8px;
  overflow-wrap: anywhere;
}

.pro-tab {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
}

.pro-tab span {
  border-radius: 999px;
  padding: 2px 5px;
  color: var(--brand-dark);
  background: #f5c542;
  font-size: 0.62rem;
  font-weight: 900;
}

.tab.active {
  color: var(--brand-dark);
  background: var(--accent);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.ham {
  background: #2563eb;
}

.gmrs {
  background: #16a34a;
}

.noaa {
  background: #0891b2;
}

.hospital {
  background: #dc2626;
}

.fire {
  background: #ea580c;
}

.police {
  background: #4f46e5;
}

.ranger {
  background: #65a30d;
}

.meshtastic {
  background: #14b8a6;
}

.meshcore {
  background: #f5c542;
}

.reference {
  background: #a78bfa;
}

.resource-list,
.loadout-list {
  display: grid;
  gap: 10px;
}

.resource-card,
.loadout-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--control);
}

.resource-card {
  display: grid;
  gap: 8px;
}

.resource-card.selected {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.resource-card.coverage-active {
  border-color: #0f766e;
  background: var(--soft);
}

.card-top,
.card-actions {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.card-top h2,
.card-top p,
.details span,
.notes {
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.details span {
  min-width: 0;
}

.details strong {
  color: var(--ink);
}

.notes {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.rx-only {
  color: var(--warn);
  font-weight: 850;
}

.tx-enabled {
  color: var(--accent-strong);
  font-weight: 850;
}

.card-actions button {
  min-height: 34px;
}

.loadout-panel {
  margin-bottom: 16px;
}

.loadout-config {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.loadout-config label {
  display: grid;
  gap: 4px;
}

.loadout-list.empty {
  min-height: 72px;
  align-content: center;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

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

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.pro-feature-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.pro-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--control);
  text-align: left;
  cursor: pointer;
}

.pro-feature strong,
.pro-feature span {
  grid-column: 1;
  min-width: 0;
}

.pro-feature span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.pro-feature b {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  white-space: nowrap;
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--brand-dark);
  background: #f5c542;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.loadout-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: var(--surface-2);
}

.route-workspace .route-sidebar {
  width: min(460px, calc(100% - 28px));
}

.route-control-panel,
.route-summary-panel {
  display: grid;
  gap: 10px;
}

.route-control-panel label {
  display: grid;
  gap: 4px;
}

.route-control-panel label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

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

.checkpoint-builder,
.checkpoint-fields {
  display: grid;
  gap: 8px;
}

.checkpoint-fields {
  max-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.checkpoint-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.route-summary {
  grid-template-columns: repeat(3, 1fr);
}

.loadout-review {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.review-head {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 18px rgba(21, 34, 44, 0.06);
}

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

.review-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.review-summary strong,
.review-summary span {
  display: block;
}

.review-summary strong {
  font-size: 1.05rem;
}

.review-summary span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.review-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.review-table.empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.review-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.review-table th,
.review-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.84rem;
}

.review-table th {
  color: var(--muted);
  background: var(--soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.review-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.menu-wrap {
  position: relative;
}

.hamburger-button {
  width: 46px;
  min-width: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  gap: 0;
  background: var(--soft);
}

.hamburger-button span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent-strong);
}

.main-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1000;
  width: 220px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.main-menu button {
  justify-content: flex-start;
  width: 100%;
}

.info-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: var(--surface-2);
}

.info-page {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.info-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 4px 18px rgba(21, 34, 44, 0.06);
}

.section-head {
  display: grid;
  gap: 2px;
}

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

.info-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
}

.info-card p {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.35;
}

.info-card span,
.info-list {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.license-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.license-table > div {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr 1.4fr;
  gap: 12px;
  padding: 11px 12px;
  background: var(--control);
}

.license-table > div:first-child {
  color: var(--accent-strong);
  background: var(--soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.license-table > div + div {
  border-top: 1px solid var(--line);
}

.license-table span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.license-table span:first-child {
  color: var(--ink);
  font-weight: 800;
}

.info-list {
  margin: 0;
  padding-left: 18px;
}

.info-list li + li {
  margin-top: 7px;
}

.source-section a {
  color: var(--accent-strong);
}

@container (max-width: 390px) {
  .panel {
    padding: 12px;
  }

  .location-card,
  .loadout-head,
  .route-head,
  .review-head {
    display: grid;
  }

  .planning-controls,
  .route-form-grid,
  .loadout-config,
  .checkpoint-actions,
  .route-actions,
  .export-actions {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-top,
  .card-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .card-actions {
    align-items: stretch;
  }

  .card-actions button {
    width: 100%;
  }

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

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

@container (max-width: 320px) {
  .tabs,
  .card-top,
  .card-actions {
    grid-template-columns: 1fr;
  }

  .badge {
    justify-self: start;
  }
}

.upgrade-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}

.upgrade-card {
  width: min(720px, 100%);
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.route-preview {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 12px;
  margin-top: 6px;
}

.route-map-preview {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(111, 201, 207, 0.18) 49% 51%, transparent 52%),
    linear-gradient(0deg, transparent 0 48%, rgba(111, 201, 207, 0.14) 49% 51%, transparent 52%),
    radial-gradient(circle at 30% 35%, rgba(111, 201, 207, 0.2), transparent 28%),
    #081113;
  background-size: 84px 84px, 84px 84px, auto, auto;
}

.route-map-preview.route-generated {
  background:
    radial-gradient(circle at 72% 24%, rgba(245, 197, 66, 0.22), transparent 20%),
    radial-gradient(circle at 44% 54%, rgba(111, 201, 207, 0.28), transparent 22%),
    linear-gradient(90deg, transparent 0 48%, rgba(111, 201, 207, 0.2) 49% 51%, transparent 52%),
    linear-gradient(0deg, transparent 0 48%, rgba(111, 201, 207, 0.16) 49% 51%, transparent 52%),
    #081113;
  background-size: auto, auto, 84px 84px, 84px 84px, auto;
}

.route-line {
  position: absolute;
  inset: 32px 44px;
  border: 5px solid transparent;
  border-left-color: var(--accent);
  border-bottom-color: var(--accent);
  border-radius: 38% 0 0 46%;
  transform: rotate(-12deg);
  filter: drop-shadow(0 0 12px rgba(111, 201, 207, 0.45));
}

.route-pin {
  position: absolute;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--brand-dark);
  background: var(--accent);
  font-weight: 900;
}

.route-pin.start {
  left: 35px;
  bottom: 36px;
}

.route-pin.mid {
  left: 48%;
  top: 46%;
}

.route-pin.end {
  right: 40px;
  top: 34px;
}

.route-preview-panel,
.offline-preview {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
}

.route-preview-panel label {
  display: grid;
  gap: 4px;
}

.route-preview-panel label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.route-result-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.route-result-row strong {
  color: var(--accent-strong);
  font-size: 1.25rem;
}

.route-result-row span,
.offline-preview p {
  color: var(--muted);
  font-size: 0.84rem;
}

.route-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.offline-preview label {
  display: flex;
  gap: 8px;
  align-items: center;
}

[hidden] {
  display: none !important;
}

.safety-note {
  margin-top: 10px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.marker-pin {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-content {
  min-width: 210px;
}

@media (max-width: 940px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .top-tools {
    grid-template-columns: 1fr;
  }

  .menu-wrap {
    justify-self: end;
  }

  .workspace {
    height: calc(100vh - 229px);
    height: calc(100dvh - 229px);
    min-height: 420px;
  }

  .map-region {
    height: 100%;
  }

  .sidebar {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 62vh;
    padding: 10px;
  }

  .sidebar.collapsed {
    transform: translateY(calc(100% + 22px));
  }

  .panel-toggle,
  .workspace.panel-collapsed .panel-toggle {
    top: 10px;
    right: 10px;
  }
}

@media (max-width: 620px) {
  .sidebar {
    left: auto;
    right: 8px;
    bottom: 8px;
    width: min(78vw, 380px);
    max-height: 50vh;
    padding: 8px;
  }

  .route-workspace .route-sidebar {
    width: min(82vw, 390px);
  }

  .topbar {
    padding: 12px;
  }

  .search-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .search-panel input {
    grid-column: 1 / -1;
  }

  .location-card,
  .loadout-head {
    display: grid;
  }

  .loadout-config {
    grid-template-columns: 1fr;
  }

  .review-head {
    display: grid;
  }

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

  .review-actions {
    display: grid;
  }

  .route-preview {
    grid-template-columns: 1fr;
  }

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

  .license-table > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .route-actions {
    grid-template-columns: 1fr;
  }

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

  .export-actions {
    grid-template-columns: 1fr;
  }
}

/* mobile-shell compact header */
@media (max-width: 620px) {
  .sidebar {
    left: auto;
    right: 8px;
    bottom: 8px;
    width: min(78vw, 380px);
    max-height: 50vh;
    padding: 8px;
  }

  .route-workspace .route-sidebar {
    width: min(82vw, 390px);
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: center;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 10px;
  }

  .brand-block {
    gap: 8px;
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand-mark {
    gap: 2px;
  }

  .plan-badge {
    min-height: 15px;
    padding: 0 6px;
    font-size: 0.54rem;
  }

  h1 {
    font-size: 1.08rem;
  }

  .brand-block > div:last-child > p:not(.header-callsign) {
    display: none;
  }

  .header-callsign {
    font-size: 0.68rem;
  }

  .top-tools {
    display: contents;
  }

  .search-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .search-panel input {
    grid-column: 1 / -1;
    min-height: 40px;
  }

  .search-panel button {
    min-height: 38px;
    padding: 0 8px;
    font-size: 0.86rem;
  }

  .menu-wrap {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
  }

  .hamburger-button {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  .main-menu {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 62px);
    right: 10px;
    width: min(230px, calc(100vw - 20px));
    max-height: 42vh;
    overflow: auto;
  }

  .workspace {
    height: auto;
    min-height: 0;
  }

  .panel-toggle,
  .workspace.panel-collapsed .panel-toggle {
    top: 10px;
    right: 10px;
    min-width: 104px;
    color: var(--brand-dark);
    background: var(--accent);
    font-size: 0.82rem;
    box-shadow: var(--shadow);
  }

  .sidebar {
    max-height: 50vh;
  }
}






/* mobile-panel compact right drawer */
@media (max-width: 620px) {
  .sidebar,
  .route-workspace .route-sidebar {
    left: auto;
    right: 8px;
    bottom: 8px;
    width: min(62vw, 310px);
    max-height: 46vh;
    padding: 7px;
    border-radius: 8px;
  }

  .panel {
    padding: 9px;
  }

  .panel + .panel {
    margin-top: 8px;
  }

  .panel-toggle,
  .workspace.panel-collapsed .panel-toggle {
    top: 8px;
    right: 8px;
    min-width: 76px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--brand-dark);
    background: var(--accent);
    font-size: 0.76rem;
    font-weight: 900;
    box-shadow: var(--shadow);
  }

  .location-card,
  .loadout-head,
  .route-head {
    gap: 8px;
  }

  .eyebrow {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }

  h2 {
    font-size: 0.84rem;
    line-height: 1.18;
  }

  .notes,
  .agreement,
  .legend,
  .details,
  .safety-note {
    font-size: 0.68rem;
    line-height: 1.25;
  }

  input,
  select,
  textarea,
  button {
    min-height: 34px;
  }

  input,
  select {
    padding: 0 9px;
  }

  .planning-controls,
  .route-form-grid,
  .loadout-config,
  .checkpoint-actions,
  .route-actions,
  .export-actions {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .radius-control {
    gap: 3px;
    font-size: 0.68rem;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
  }

  .tab {
    min-height: 31px;
    padding: 0 6px;
    font-size: 0.7rem;
  }

  .legend {
    gap: 6px 8px;
    margin: 8px 0;
  }

  .dot {
    width: 8px;
    height: 8px;
  }

  .resource-list,
  .loadout-list {
    gap: 7px;
  }

  .resource-card,
  .loadout-item {
    padding: 8px;
  }

  .details {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .card-actions {
    gap: 6px;
  }

  .card-actions button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 0.7rem;
  }

  .badge {
    min-height: 20px;
    padding: 0 6px;
    font-size: 0.58rem;
  }

  .map-status {
    max-width: min(52vw, 250px);
    padding: 8px 10px;
    font-size: 0.74rem;
  }
}

/* mobile-shell v3 compact map layout */
@media (max-width: 620px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: calc(env(safe-area-inset-top, 0px) + 7px) 9px 8px;
  }

  .brand-block {
    gap: 7px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-mark {
    gap: 1px;
  }

  .plan-badge {
    min-height: 13px;
    padding: 0 5px;
    font-size: 0.5rem;
  }

  h1 {
    font-size: 0.98rem;
  }

  .brand-block > div:last-child > p:not(.header-callsign) {
    display: none;
  }

  .header-callsign {
    font-size: 0.62rem;
  }

  .top-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
  }

  .search-panel {
    grid-column: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 5px;
  }

  .search-panel input {
    grid-column: 1 / -1;
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.86rem;
  }

  .search-panel button {
    min-height: 32px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .menu-wrap {
    grid-column: 2;
    align-self: start;
    justify-self: end;
  }

  .hamburger-button {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
  }

  .main-menu {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 88px);
    right: 9px;
    width: min(220px, calc(100vw - 18px));
    max-height: 38vh;
    overflow: auto;
  }

  .workspace {
    height: calc(100dvh - 128px);
    min-height: 0;
  }

  .sidebar,
  .route-workspace .route-sidebar {
    top: 8px;
    left: auto;
    right: 8px;
    bottom: auto;
    width: min(62vw, 310px);
    max-height: calc(100% - 16px);
    padding: 7px;
    border-radius: 8px;
  }

  .sidebar.collapsed {
    transform: translateX(calc(100% + 18px));
  }

  .panel-toggle,
  .workspace.panel-collapsed .panel-toggle {
    top: 8px;
    right: 8px;
    min-width: 74px;
    min-height: 32px;
    padding: 0 9px;
    border-radius: 8px;
    color: var(--brand-dark);
    background: var(--accent);
    font-size: 0.72rem;
    font-weight: 900;
    box-shadow: var(--shadow);
  }
}
/* category-filter-controls */
.leaflet-control-attribution {
  position: relative;
  z-index: 120;
}

.leaflet-control-zoom {
  position: relative;
  z-index: 720;
}

.category-filters {
  align-items: center;
}

.category-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 7px;
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  border-radius: 999px;
  color: var(--ink);
  background: color-mix(in srgb, var(--control) 72%, transparent);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.category-filter.active {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  background: color-mix(in srgb, var(--accent) 22%, var(--control));
}

.category-filter:not(.active) {
  opacity: 0.42;
}

.category-filter:not(.active) .dot {
  filter: grayscale(1);
}

@media (max-width: 940px) {
  .category-filter {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    min-width: 0;
    font-size: clamp(0.62rem, 2.6vw, 0.76rem);
  }
}
/* splash-account-flow */
.splash-view {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(2, 8, 9, 0.88), rgba(2, 8, 9, 0.94)),
    radial-gradient(circle at 50% 25%, rgba(111, 201, 207, 0.24), transparent 42%),
    var(--surface);
}

.splash-view[hidden] {
  display: none;
}

.splash-card {
  width: min(480px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.splash-logo {
  width: 112px;
  height: 112px;
  border-radius: 8px;
  object-fit: cover;
}

.splash-card h1 {
  margin: 4px 0 2px;
  font-size: clamp(2rem, 8vw, 3.4rem);
  line-height: 0.96;
}

.splash-card p {
  margin: 0;
  color: var(--muted);
}

.splash-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.account-card {
  display: grid;
  align-content: start;
  gap: 12px;
}

.account-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.account-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.account-card input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--control);
  text-transform: none;
  letter-spacing: 0;
}

.plan-choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 760px) {
  .splash-card {
    padding: 18px;
  }

  .splash-actions,
  .account-grid,
  .plan-choice-row {
    grid-template-columns: 1fr;
  }

  .splash-logo {
    width: 88px;
    height: 88px;
  }
}