/* وطن — صفحة الخريطة.
   خريطة حقيقية كبيرة، مخطط NUCA فوقها، وأرقام القطع داخل الحدود. */

.map-body { background: var(--bg); }
.map-main { padding-bottom: 26px; }
.map-page { display: grid; gap: 12px; }

/* ---------- head ---------- */
.map-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 4px 4px;
}
.map-head-copy { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; max-width: 100%; }
.map-head-copy h1 {
  margin-top: 6px;
  font-family: var(--display);
  font-size: clamp(34px, 3.6vw, 54px);
  font-weight: 600; line-height: 1.02; letter-spacing: -.045em;
  color: var(--ink);
}
.map-head-copy h1 em { font-style: normal; color: var(--brand); }
.map-lede {
  max-width: 64ch; margin-top: 9px;
  font-size: 13px; line-height: 1.75; color: var(--ink-2);
}
.map-facts { display: flex; flex-wrap: wrap; gap: 7px; }
.map-fact {
  display: inline-flex; align-items: baseline; gap: 6px;
  min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-3);
  font-size: 13px; white-space: nowrap;
}
.map-fact b {
  font-family: var(--display); font-size: 14px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */
.atlas-shell {
  display: block;
  width: 100%;
}
.atlas-mapbox {
  position: relative; min-width: 0; min-height: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
  isolation: isolate;
  height: calc(100dvh - 150px);
  min-height: 520px;
}

/* ---------- rail ---------- */
.atlas-rail {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.atlas-rail-head { padding: 13px 13px 8px; flex: none; }
.atlas-rail-head h3 {
  font-family: var(--display); font-size: 15px; font-weight: 600;
  letter-spacing: -.02em; color: var(--ink);
}
.atlas-rail-head p { margin-top: 2px; font-size: 13px; color: var(--ink-4); }
.atlas-search {
  display: flex; align-items: center; gap: 7px;
  margin-top: 9px; height: 35px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--ink-3);
}
.atlas-search svg { width: 14px; height: 14px; flex: none; }
.atlas-search input {
  width: 100%; min-width: 0; border: 0; outline: 0;
  background: transparent; color: var(--ink);
  font-family: var(--font); font-size: 13px;
}
.atlas-search input::placeholder { color: var(--ink-4); }
.atlas-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 7px; }
.atlas-pick select {
  min-width: 0; height: 30px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2); color: var(--ink);
  font-family: var(--font); font-size: 13px;
  text-overflow: ellipsis;
}
.atlas-pick select:disabled { opacity: .55; }
.atlas-filters { display: flex; gap: 5px; margin-top: 7px; }
.atlas-filters button {
  flex: 1; min-height: 28px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--ink-3);
  font-family: var(--font); font-size: 13px;
  transition: background-color .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.atlas-filters button:hover { color: var(--ink); }
.atlas-filters button[aria-pressed="true"] {
  background: var(--grad-brand); border-color: transparent; box-shadow: var(--glow-brand); color: var(--on-brand);
}
.atlas-list {
  flex: 1 1 auto; overflow: auto; padding: 2px 6px 8px;
  scrollbar-width: thin;
}
.atlas-list::-webkit-scrollbar { width: 7px; }
.atlas-list::-webkit-scrollbar-thumb { border-radius: 9px; background: var(--surface-3); }

.zone-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px;
  width: 100%; padding: 7px 8px 6px;
  border: 0; border-radius: 9px;
  background: transparent; text-align: right;
  transition: background-color .16s var(--ease);
}
.zone-row:hover { background: var(--surface-2); }
.zone-row.is-on { background: var(--brand-tint); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 18%, transparent); }
.zone-row-name {
  font-size: 13px; font-weight: 500; line-height: 1.35; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.zone-row-city {
  grid-column: 1; font-size: 13px; color: var(--ink-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.zone-row-city i {
  font-style: normal; display: inline-block;
  margin-inline-start: 3px; padding: 0 4px; border-radius: 4px;
  background: var(--surface-3); color: var(--ink-3); font-size: 13px;
}
.zone-row-free {
  grid-column: 2; grid-row: 1 / span 2; align-self: center;
  font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.zone-row.is-muted { opacity: .45; }
.zone-row-bar {
  grid-column: 1 / -1; display: block; height: 2px; margin-top: 4px;
  border-radius: 99px; background: var(--surface-3); overflow: hidden;
}
.zone-row-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-mid), var(--brand)); }
.zone-row-nogeo { color: var(--ink-2); }
.atlas-list-empty { padding: 18px 10px; text-align: center; color: var(--ink-4); font-size: 13px; line-height: 1.6; }

/* ---------- map ---------- */
#atlasMap { position: absolute; inset: 0; z-index: 1; background: #dfe6ef; }
.ol-attribution { font-size: 13px; }
  font-family: var(--font); background: #dfe6ef;
}
  direction: ltr; font-size: 13px; color: var(--ink-4);
  background: rgba(255,255,255,.78); border-radius: 5px 0 0 0;
}
  color: var(--ink); border: 0; background: rgba(255,255,255,.94);
  width: 30px; height: 30px; line-height: 30px; font-size: 16px;
}

.atlas-overlay { mix-blend-mode: multiply; filter: brightness(1.05) contrast(1.1); }

/* satellite stays natural; only the street layer is calmed */


/* Controls column: left edge, vertically centred. */
.atlas-controls {
  position: absolute; z-index: 780; inset-inline-end: 10px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: auto;
}
.atlas-ctl-group {
  display: flex; flex-direction: column; gap: 0; padding: 4px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%);
}
.atlas-controls button {
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2);
  font-family: var(--font); font-size: 16px; font-weight: 600;
  transition: background-color .14s var(--ease), color .14s var(--ease);
}
.atlas-controls button:hover { background: var(--surface-2); color: var(--ink); }
.atlas-controls button svg { width: 18px; height: 18px; }
/* The locate/fullscreen buttons have no .atlas-ctl-group wrapper, so give them
   the same glass surface and dark ink; keeps the icons legible on satellite. */
.atlas-controls button[data-map-act="recenter"],
.atlas-controls button[data-map-act="full"] {
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%);
}
.atlas-controls button[data-map-act="recenter"]:hover,
.atlas-controls button[data-map-act="full"]:hover { background: var(--surface); color: var(--ink); }
.atlas-controls [hidden] { display: none; }
.atlas-ctl-divider { width: 24px; height: 1px; background: var(--line); margin: 0 auto; }
.atlas-compass {
  width: 52px; height: 52px; border-radius: 50%;
  background: #fff; border: 0; padding: 0;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .atlas-compass { background: var(--surface); }
.atlas-controls .atlas-compass { width: 52px; height: 52px; }
.atlas-controls .atlas-base-thumb { width: 56px; height: 56px; border: 2px solid #fff; border-radius: 10px; }
.atlas-controls .atlas-compass svg { width: 52px; height: 52px; display: block; transition: transform .12s linear; }
.atlas-base-thumb {
  width: 56px; height: 56px; padding: 0; border: 2px solid #fff; border-radius: 10px;
  overflow: hidden; position: relative; box-shadow: var(--shadow-sm); background: var(--surface-2);
}
.atlas-base-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.atlas-base-thumb .atlas-base-thumb-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 0;
  font-size: 13px; color: #fff; background: rgba(15,23,41,.65); text-align: center;
}
.atlas-compass { position: relative; background: var(--surface-2); }
.atlas-controls .atlas-compass { background: var(--surface); box-shadow: var(--shadow-sm); }
.atlas-controls .atlas-compass:hover { background: var(--surface-2); }
.compass-ring {
  position: absolute; inset: 4px; border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  border-radius: 50%;
}
.compass-needle {
  position: absolute; left: 50%; top: 50%; width: 2px; height: 15px;
  margin: -7.5px 0 0 -1px; border-radius: 2px;
  background: linear-gradient(180deg, #d24b3e 0 50%, #59637a 50% 100%);
  transform-origin: center; transition: transform .12s linear;
}
.compass-n {
  position: absolute; top: 1px; left: 50%; transform: translateX(-50%);
  font-size: 13px; font-weight: 700; color: #c04135; line-height: 1;
}
/* Imagery credit sits centred on the map's bottom edge, no chip. */
.atlas-credit {
  position: absolute; z-index: 650; bottom: 4px; left: 50%; transform: translateX(-50%);
  font-size: 13px; line-height: 1.2; color: var(--ink-3); direction: ltr; white-space: nowrap;
  text-shadow: 0 0 3px var(--glass);
  pointer-events: none;
}

/* full screen */
.atlas-mapbox:fullscreen { border-radius: 0; border: 0; background: #0b1120; }
.atlas-mapbox:fullscreen .atlas-map-stack { border-radius: 0; }

.atlas-topbar {
  position: absolute; z-index: 700; top: 10px; right: 10px; left: 10px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  pointer-events: none;
}
.atlas-topbar-center {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; pointer-events: auto;
}
.atlas-map-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-family: var(--font); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-sm); pointer-events: auto;
}
.atlas-map-btn svg { width: 14px; height: 14px; }
.atlas-seg, .atlas-tools {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: 11px;
  border: 1px solid rgba(255,255,255,.42);
  background: rgba(255,255,255,.9);
  box-shadow: 0 10px 26px -18px rgba(15,23,41,.45);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  pointer-events: auto;
}
.atlas-seg button, .atlas-tools button {
  min-height: 28px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-3);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.atlas-seg button.is-on { background: var(--ink); color: #fff; }
.atlas-seg button[disabled] { opacity: .35; cursor: not-allowed; }
.atlas-tools { gap: 4px; padding: 4px; }
.atlas-tools > #atlasLabels {
  height: 28px; padding: 0 11px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-2);
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.atlas-tools > #atlasLabels svg { width: 16px; height: 16px; flex: none; }
.atlas-tools > #atlasLabels:hover { background: var(--surface-2); color: var(--ink); }
.atlas-tools > #atlasLabels.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.atlas-bases {
  display: inline-flex; align-items: center; gap: 2px;
  padding-inline-end: 4px; margin-inline-end: 2px;
  border-inline-end: 1px solid var(--line);
}
.atlas-bases button {
  min-height: 26px; padding: 0 8px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-3);
  font-family: var(--font); font-size: 13px; font-weight: 500;
}
.atlas-bases button.is-on { background: var(--brand); color: #fff; }

.atlas-overlaybar {
  position: absolute; z-index: 690; top: 52px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.42);
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 26px -18px rgba(15,23,41,.45);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  font-size: 13px; color: var(--ink-3);
}
/* `hidden` must win over the flex display above: the switch only exists for
   zones that really have a georeferenced overlay. */
.atlas-overlaybar[hidden] { display: none; }
.atlas-overlaybar input[type="range"] { width: 96px; accent-color: var(--brand); }
.atlas-overlaybar span { min-width: 28px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.atlas-overlaybar button {
  min-height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--ink-2); font-family: var(--font); font-size: 13px;
}
.atlas-overlaybar button[aria-pressed="false"] { opacity: .55; }


/* Honest coverage: what this zone's geometry actually contains. */
/* Bottom-left (inline-end in RTL): one column of glass chips. */
.atlas-float {
  position: absolute; z-index: 700; inset-inline-end: 10px; bottom: 10px;
  width: min(46%, 320px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  pointer-events: none;
}
.atlas-strip, .atlas-hint, .atlas-count, .atlas-legend {
  max-width: 100%; padding: 6px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--glass);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%);
  color: var(--ink-2); font-size: 13px; line-height: 1.35; white-space: normal;
}
/* Honest coverage note: amber tint of the gold token. */
.atlas-strip {
  background: color-mix(in srgb, var(--gold) 16%, var(--glass));
  border-color: color-mix(in srgb, var(--gold) 40%, transparent);
  color: var(--ink);
}
.atlas-legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.atlas-legend span { display: inline-flex; align-items: center; gap: 5px; }
.atlas-legend i { width: 8px; height: 8px; border-radius: 2px; }
.atlas-legend .k-free { background: var(--brand); }
.atlas-legend .k-booked { background: color-mix(in srgb, var(--ink) 30%, transparent); }
.atlas-legend .k-label { background: #fff; border: 1px solid var(--brand); }
.atlas-count { font-variant-numeric: tabular-nums; color: var(--ink); }
.atlas-empty {
  position: absolute; z-index: 680; left: 12px; right: 12px; bottom: 48px;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,.96);
  color: var(--ink-2); font-size: 13px; line-height: 1.6;
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.atlas-empty b { display: block; margin-bottom: 2px; color: var(--ink); font-size: 13px; }

/* ---------- side ---------- */
.atlas-side {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background:
    radial-gradient(110% 70% at 100% 0%, color-mix(in srgb, var(--brand) 6%, transparent), transparent 52%),
    var(--surface);
  overflow: hidden;
}
.atlas-side-head { padding: 15px 15px 0; flex: none; }
.atlas-side-head .eyebrow { margin-bottom: 4px; }
.atlas-zone-name {
  font-family: var(--display); font-size: 17px; font-weight: 600;
  line-height: 1.25; letter-spacing: -.025em; color: var(--ink);
}
.atlas-zone-city { margin-top: 3px; font-size: 13px; color: var(--ink-3); }
.atlas-badge {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 7px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-3);
  font-size: 13px; font-weight: 500;
}
.atlas-badge.is-live { background: color-mix(in srgb, var(--live) 10%, transparent); color: var(--live); }
.atlas-badge.is-out { background: var(--copper-soft); color: var(--copper); }
.atlas-badge.is-partial { background: var(--brand-soft); color: var(--brand); }

.atlas-stats {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; margin: 11px 15px 0; flex: none;
  border: 1px solid var(--line-2); border-radius: 11px;
  background: var(--line-2); overflow: hidden;
}
.atlas-stat { padding: 8px 9px; background: var(--surface); }
.atlas-stat span { display: block; font-size: 13px; color: var(--ink-4); }
.atlas-stat b {
  display: block; margin-top: 2px;
  font-family: var(--display); font-size: 15px; font-weight: 600;
  letter-spacing: -.02em; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.atlas-stat b i { font-style: normal; font-size: 13px; font-weight: 400; color: var(--ink-4); }
.atlas-coverage {
  margin: 8px 15px 0; padding: 7px 9px; flex: none;
  border-radius: 8px; background: var(--surface-2);
  color: var(--ink-3); font-size: 13px; line-height: 1.55;
}
.atlas-coverage b { color: var(--ink-2); font-weight: 600; }
.atlas-actions { display: flex; gap: 6px; margin: 9px 15px 0; flex: none; }
.atlas-actions .btn-small { flex: 1 1 auto; min-height: 32px; }
.atlas-actions a.btn-small { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.atlas-plots {
  flex: 1 1 auto; min-height: 0; overflow: auto; padding: 10px 9px 12px;
  display: flex; flex-direction: column; gap: 1px;
}
.atlas-plots::-webkit-scrollbar { width: 7px; }
.atlas-plots::-webkit-scrollbar-thumb { border-radius: 9px; background: var(--surface-3); }
.atlas-plots-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 6px 5px; font-size: 13px; color: var(--ink-4);
}
.atlas-plots-head b { color: var(--ink-2); font-weight: 600; font-size: 13px; }
.atlas-plot-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 7px; align-items: center;
  width: 100%; padding: 6px 7px; border: 0; border-radius: 8px;
  background: transparent; text-align: right;
}
.atlas-plot-row:hover { background: var(--surface-2); }
.atlas-plot-row.is-on { background: var(--brand-tint); }
.atlas-plot-no {
  display: inline-grid; place-items: center;
  min-height: 24px; padding: 0 3px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand);
  font-family: var(--display); font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.atlas-plot-meta { min-width: 0; }
.atlas-plot-meta .zone-row-name { font-size: 13px; }
.atlas-plot-area { display: block; font-size: 13px; color: var(--ink-4); }
.atlas-plot-price {
  font-family: var(--display); font-size: 13px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.atlas-plot-more { margin-top: 2px; }

.atlas-detail { padding: 2px 10px 4px; }
.atlas-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 2px 7px; }
.atlas-detail-no { font-family: var(--display); font-size: 23px; font-weight: 600; letter-spacing: -.03em; color: var(--ink); }
.atlas-detail-no small { font-family: var(--font); font-size: 13px; font-weight: 400; color: var(--ink-4); letter-spacing: 0; }
.atlas-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--line-2); overflow: hidden;
}
.atlas-detail-grid div { padding: 7px 9px; background: var(--surface); }
.atlas-detail-grid span { display: block; font-size: 13px; color: var(--ink-4); }
.atlas-detail-grid b { display: block; margin-top: 1px; font-family: var(--display); font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.atlas-detail-note { margin-top: 7px; font-size: 13px; line-height: 1.55; color: var(--ink-3); }
.atlas-detail-back {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 0 0 6px; padding: 0; border: 0; background: transparent;
  color: var(--brand); font-family: var(--font); font-size: 13px; font-weight: 500;
}
.atlas-detail-back svg { width: 12px; height: 12px; }

.atlas-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 0 4px; font-size: 13px; color: var(--ink-4);
}

  padding: 5px 8px; border: 0; border-radius: 7px;
  background: rgba(15,23,41,.92); color: #fff;
  font-family: var(--font); font-size: 13px; box-shadow: none;
}


/* ---------- plan empty state ---------- */
.atlas-plan-empty {
  margin: auto; max-width: 320px; padding: 15px; text-align: center;
  color: var(--ink-3); font-size: 13px; line-height: 1.6;
}
.atlas-plan-empty b { display: block; margin-bottom: 3px; color: var(--ink); font-size: 13px; }

/* ---------- dark bits ---------- */
html[data-theme="dark"] .atlas-seg,
html[data-theme="dark"] .atlas-tools,
html[data-theme="dark"] .atlas-overlaybar { background: rgba(16,19,31,.9); border-color: rgba(255,255,255,.1); }
html[data-theme="dark"] .atlas-seg button.is-on, html[data-theme="dark"] .atlas-tools > #atlasLabels.is-on { background: var(--grad-brand); border-color: transparent; color: #06101f; }
html[data-theme="dark"] .atlas-empty { background: rgba(16,19,31,.96); }
html[data-theme="dark"] .atlas-bases button.is-on { background: var(--brand); color: #06101f; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .atlas-head-copy h1 { font-size: clamp(32px, 3.4vw, 46px); }
}
@media (max-width: 1040px) {
  .map-head { align-items: flex-start; }
  .atlas-mapbox { height: 560px; }
}
@media (max-width: 780px) {
  .map-head { padding-top: 10px; }
  .map-lede { font-size: 13px; }
  .atlas-mapbox { height: clamp(400px, 64vh, 560px); }
  .atlas-plots { max-height: 310px; }
  .atlas-search { margin-top: 6px; height: 33px; }
  .atlas-filters { margin-top: 6px; }
  .atlas-topbar { top: 8px; right: 8px; left: 8px; }
  .atlas-overlaybar { top: 48px; right: 8px; left: 8px; justify-content: space-between; }
  .atlas-legend { display: none; }
  .atlas-float { inset-inline-end: 8px; bottom: 8px; }
  .atlas-empty { left: 8px; right: 8px; bottom: 42px; }
  .atlas-credit { display: none; }
  .atlas-seg button, .atlas-tools button { min-height: 27px; }
}
/* Phones: the info stack keeps clear of the control group in the other corner. */
@media (max-width: 640px) {
  .atlas-hint, .atlas-legend { display: none; }
  .atlas-float { width: min(58%, calc(100% - 220px)); }
}
@media (max-width: 460px) {
  .map-head-copy h1 { font-size: 32px; }
  .map-facts { gap: 5px; }
  .map-fact { min-height: 28px; padding: 0 9px; font-size: 13px; }
  .map-fact b { font-size: 13px; }
  .atlas-bases button { padding: 0 6px; font-size: 13px; }
  .atlas-overlaybar input[type="range"] { width: 70px; }
  .atlas-mapbox { height: clamp(380px, 60vh, 500px); }
}

/* keep the page from ever scrolling sideways */
.map-body, .map-shell { max-width: 100%; overflow-x: clip; }

/* ---------- bits shared with the header and detail card ---------- */
.atlas-base-seg {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface);
}
.atlas-base-seg button {
  min-height: 28px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-3);
  font-family: var(--font); font-size: 13px; font-weight: 500;
}
.atlas-base-seg button.is-on { background: var(--ink); color: #fff; }
.map-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.map-head-actions .btn-quiet { min-height: 35px; }

.atlas-crumb {
  padding: 0; border: 0; background: transparent; color: var(--ink-3);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.atlas-crumb:hover { color: var(--brand); }

.atlas-plot-more { margin-top: 3px; min-height: 32px; }
.atlas-detail-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.atlas-detail-actions a {
  flex: 1 1 120px; display: inline-flex; align-items: center; justify-content: center;
  min-height: 31px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--brand);
  font-size: 13px; font-weight: 500; text-align: center;
}
.atlas-detail-actions a:hover { background: var(--brand-tint); border-color: var(--brand); }

@media (max-width: 780px) {
  .map-head-actions { width: 100%; justify-content: space-between; }
  .atlas-base-seg { display: inline-flex; }
}

.rail-filter { display: flex; gap: 4px; margin-top: 7px; }
.rail-filter button {
  flex: 1; min-height: 27px; padding: 0 5px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface-2); color: var(--ink-3);
  font-family: var(--font); font-size: 13px;
}
.rail-filter button.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }

.map-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 2px 4px 0; font-size: 13px; line-height: 1.6; color: var(--ink-4);
}

@media (max-width: 780px) {
  .map-head { flex-direction: column; align-items: stretch; }
  .map-head-copy { max-width: 100%; }
  .map-head-actions { width: 100%; }
}

/* aliases used by the map page markup */
.atlas-facts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.atlas-fact {
  display: inline-flex; align-items: baseline; gap: 6px;
  min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-3);
  font-size: 13px; white-space: nowrap;
}
.atlas-fact b {
  font-family: var(--display); font-size: 14px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.atlas-legend .k-plan { background: transparent; border: 1px dashed var(--ink-4); }

.map-head-actions .btn-quiet.is-on {
  background: var(--grad-brand); border-color: transparent; box-shadow: var(--glow-brand); color: var(--on-brand);
}

/* ---------- drawers ---------- */
.atlas-drawer {
  position: absolute; z-index: 760; top: 54px; bottom: 64px;
  width: min(360px, 88vw);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  transition: transform 200ms var(--ease);
  will-change: transform;
}
.atlas-rail.atlas-drawer { inset-inline-start: 10px; transform: translateX(100%); }
.atlas-side.atlas-drawer { inset-inline-end: 10px; transform: translateX(-100%); }
.atlas-drawer.is-open { transform: translateX(0); }
/* controls sit on the same edge as the plots drawer: step aside while it is open */
.atlas-side.is-open ~ .atlas-controls { inset-inline-end: calc(min(360px, 88vw) + 20px); }
@media (prefers-reduced-motion: reduce) {
  .atlas-drawer { transition: none; }
}
.atlas-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none;
  position: sticky; top: 0; z-index: 1; background: var(--surface);
}
.atlas-drawer-head h2 {
  font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--ink);
}
.atlas-drawer-close {
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: var(--surface-2); color: var(--ink-2); font-size: 18px; line-height: 1;
  display: grid; place-items: center;
}
.atlas-rail-foot { padding: 10px 12px; border-top: 1px solid var(--line); flex: none; }
/* one scrollbar for the whole drawer body: lists grow to their content.
   Higher specificity than `.atlas-rail`/`.atlas-side` so their overflow: hidden never wins. */
.atlas-rail.atlas-drawer, .atlas-side.atlas-drawer {
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
}
.atlas-drawer .atlas-list,
.atlas-drawer .atlas-plots { flex: none; overflow: visible; min-height: auto; max-height: none; }

/* RTL: OL's transform is relative to the origin, so pin the wrapper to it */
.ol-overlay-container { left: 0; top: 0; }
/* popup: OL positions the wrapper; the card itself stays in normal flow */
.atlas-popup {
  display: none; width: 200px; max-width: 200px; background: #fff; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,41,.22); padding: 10px 12px; color: var(--ink);
}
.atlas-popup:not([hidden]) { display: block; }
.atlas-popup::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px; background: #fff;
}
.atlas-pop-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.atlas-pop-no { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: -.03em; }
.atlas-pop-row { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.atlas-pop-row span { color: var(--ink-3); }
.atlas-pop-row b { font-weight: 700; }
.atlas-pop-actions { display: flex; gap: 14px; }
.atlas-pop-more { margin-top: 6px; padding: 0; border: 0; background: none; color: var(--brand); font-size: 13px; font-weight: 600; cursor: pointer; }
html[data-theme="dark"] .atlas-popup { background: var(--surface); }
html[data-theme="dark"] .atlas-popup::after { background: var(--surface); }

/* mobile bottom sheets: sit under the top bar, cover the dock and controls */
@media (max-width: 700px) {
  .atlas-drawer {
    top: auto; bottom: 0; left: 0; right: 0; width: 100%;
    max-height: calc(100% - 54px); border-radius: 16px 16px 0 0;
  }
  .atlas-rail.atlas-drawer, .atlas-side.atlas-drawer { inset-inline-start: 0; inset-inline-end: 0; transform: translateY(100%); }
  .atlas-drawer.is-open { transform: translateY(0); }
  .atlas-side.is-open ~ .atlas-controls { inset-inline-end: 10px; }
  .atlas-controls { top: 54px; transform: none; }
  .atlas-mapbox:has(.atlas-drawer.is-open) :is(.atlas-controls, .atlas-dock, .atlas-filter-chips) { visibility: hidden; }
}

/* ---------- bottom dock ---------- */
/* The dock is only a positioning frame: the map shows through between its
   two floating cards, so the container itself stays transparent and inert. */
.atlas-dock {
  position: absolute; z-index: 790; left: 10px; right: 10px; bottom: 10px;
  display: flex; flex-direction: column; gap: 6px; pointer-events: none;
  background: none; border: 0; box-shadow: none;
}
.atlas-dock-panel {
  position: absolute; bottom: 100%; margin-bottom: 6px;
  inset-inline-end: 10px; inset-inline-start: auto;
  max-width: min(320px, calc(100% - 20px)); box-sizing: border-box;
  padding: 10px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow);
  pointer-events: auto;
}
.atlas-dock-panel[hidden] { display: none; }
.atlas-dock-panel-head { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.atlas-color-seg, .atlas-dock-panel .atlas-seg { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.atlas-color-seg button, .atlas-dock-panel .atlas-seg button {
  min-height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--ink-3); font-family: var(--font); font-size: 13px;
}
.atlas-color-seg button.is-on, .atlas-dock-panel .atlas-seg button.is-on {
  background: var(--grad-brand); border-color: transparent; box-shadow: var(--glow-brand); color: var(--on-brand);
}
.atlas-color-legend, .atlas-legend-rows { display: flex; flex-direction: column; gap: 4px; }
.atlas-legend-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.atlas-legend-row i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.atlas-legend-row span { flex: 1 1 auto; }
.atlas-legend-row b { font-variant-numeric: tabular-nums; color: var(--ink); }
.atlas-legend-empty { font-size: 13px; color: var(--ink-4); }
/* Start-side card: breadcrumb + available/booked chips, pinned to inline-start. */
.atlas-dock-bar {
  display: flex; align-items: center; gap: 8px;
  align-self: flex-start; width: auto;
  min-height: 44px; padding: 6px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  pointer-events: auto;
  max-width: calc(100% - 20px); flex-wrap: wrap;
}
/* End-side card: zoom label + tabs, pinned to the opposite (inline-end) edge. */
.atlas-dock-end {
  position: absolute; inset-inline-end: 0; bottom: 0;
  display: flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 6px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  pointer-events: auto;
  max-width: calc(50% - 8px);
}
.atlas-dock-start { flex: 0 1 auto; min-width: 0; max-width: none; flex-wrap: wrap; white-space: normal; overflow: visible; row-gap: 2px; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.atlas-dock-start > .atlas-crumb:last-child { font-weight: 700; color: var(--ink); }
.atlas-dock-mid { flex: 1 1 auto; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.atlas-dock-mid::-webkit-scrollbar { display: none; }
.atlas-dock-tab { min-height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font-family: var(--font); font-size: 13px; font-weight: 600; }
.atlas-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.atlas-chip .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.atlas-chip .dot.blue { background: #003399; }
.atlas-chip .dot.coral { background: #C13B2E; }
.atlas-chip-btn { border: 1px solid var(--line); font-family: var(--font); cursor: pointer; color: var(--ink); }
.atlas-ramp { width: 28px; height: 8px; border-radius: 4px; background: linear-gradient(to right, #FFF3C4, #C13B2E); }
.atlas-crumb-sep { color: var(--ink-4); }
.atlas-filter-chips {
  position: absolute; z-index: 720; top: 56px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; pointer-events: auto;
}
.atlas-filter-chips[hidden] { display: none; }
.atlas-filter-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.atlas-filter-chip button { border: 0; background: transparent; color: var(--ink-4); cursor: pointer; padding: 0; }
.atlas-filter-badge { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #C13B2E; color: #fff; font-size: 13px; font-weight: 700; margin-inline-start: 4px; }
.atlas-filter-badge[hidden] { display: none; }
.atlas-filter-panel { padding: 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.atlas-filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.atlas-filter-range { flex-wrap: nowrap; align-items: flex-end; }
.atlas-filter-range .atlas-filter-field { min-width: 0; }
.atlas-filter-field { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink-3); flex: 1 1 0; }
.atlas-filter-field input { width: 100%; min-width: 0; box-sizing: border-box; height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; background: var(--surface-2); color: var(--ink); font-family: var(--font); font-size: 13px; }
.atlas-filter-flags { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.atlas-filter-flags input { margin-inline-end: 3px; }
.atlas-layer-row { margin-bottom: 6px; }
.atlas-labels-btn { }
.atlas-overlay-switch, .atlas-opacity { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); margin-bottom: 6px; flex-wrap: wrap; }
.atlas-opacity input[type="range"] { width: 100%; accent-color: var(--brand); }

/* On narrow screens the two cards stack instead of overflowing the map. */
@media (max-width: 640px) {
  .atlas-dock-bar { align-self: stretch; width: 100%; max-width: 100%; }
  .atlas-dock-end { position: static; inset-inline-end: auto; bottom: auto; width: 100%; max-width: 100%; }
  .atlas-dock-start { max-width: 100%; }
}

/* ---------- tap targets: 32px desktop, 44px on phones ---------- */
.atlas-pop-close {
  flex: none; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  font-family: var(--font); font-size: 13px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
}
.atlas-pop-close:hover { color: var(--ink); background: var(--surface-3); }
.atlas-crumb { display: inline-flex; align-items: center; min-height: 32px; }
.atlas-chip, .atlas-filter-chip, .atlas-dock-tab, .rail-filter button,
.atlas-seg button, .atlas-tools button, .atlas-color-seg button,
.atlas-dock-panel .atlas-seg button, .atlas-bases button,
.atlas-drawer-close, .atlas-overlaybar button, .atlas-map-btn,
.atlas-filter-flags label, .atlas-pick select, .atlas-filter-field input,
.atlas-search, .atlas-tools > #atlasLabels { min-height: 32px; }
.atlas-filter-chip button { min-width: 32px; min-height: 32px; }
.atlas-tools > #atlasLabels { height: auto; }
.atlas-filter-flags label { display: inline-flex; align-items: center; }
.atlas-filter-badge { min-width: 18px; height: 18px; }
@media (max-width: 640px) {
  .atlas-crumb, .atlas-chip, .atlas-filter-chip, .atlas-dock-tab, .rail-filter button,
  .atlas-seg button, .atlas-tools button, .atlas-color-seg button,
  .atlas-dock-panel .atlas-seg button, .atlas-bases button,
  .atlas-drawer-close, .atlas-overlaybar button, .atlas-map-btn,
  .atlas-filter-flags label, .atlas-pick select, .atlas-filter-field input,
  .atlas-search, .atlas-tools > #atlasLabels, .atlas-filter-chip button { min-height: 44px; }
  .atlas-filter-chip button { min-width: 44px; }
}

/* phones: the map takes the screen; the header facts are country-wide totals, so they go */
@media (max-width: 700px) {
  .map-head { display: none; }
  .atlas-mapbox { height: calc(100dvh - 146px); min-height: 420px; }
  .atlas-dock-bar { gap: 4px 8px; }
  .atlas-dock-mid { flex: 1 1 100%; }
  .atlas-dock-end { justify-content: flex-end; }
  .atlas-dock-start { flex-wrap: nowrap; overflow: hidden; }
  .atlas-dock-start > :nth-last-child(n+4) { display: none; }
  .atlas-dock-start > .atlas-crumb:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 32px; }
}

#filterReset { display: inline-flex; align-self: flex-start; width: auto; padding-inline: 14px; align-items: center; gap: 6px; color: var(--red); border-color: var(--red); font-weight: 600; }
#filterReset:hover:not([disabled]) { background: var(--red-soft); }
#filterReset[disabled] { opacity: .4; cursor: default; }
