/**
 * RST — Réseau urbain Rabat – Salé – Témara
 *
 * A printed-map interface. The whole visual system is lifted off the STRS
 * platform signage photographed in this repo: cream map stock, a navy title
 * band, black terminus plates, square colour chips and route ribbons.
 *
 * The atomic unit is the PLATE, not the card. Corners are square. Hierarchy
 * comes from ink and weight, never from shadow or gradient.
 * Light-first: the printed map is light. The dark CARTO basemap still works
 * because every panel is opaque paper laid over it.
 */

:root {
  --font-main: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'Noto Sans Arabic', sans-serif;

  /* map stock */
  --paper: #F4EFE3;
  --paper-2: #EDE6D6;
  --paper-3: #E4DBC7;
  --ink: #191E1C;
  --band: #1E2C48;
  --band-deep: #16223A;
  --sea: #B4C8CF;
  --tx: #1B201E;
  --tx-2: #4A5350;
  --tx-3: #7C8580;
  --on-ink: #F4EFE3;
  --on-band: #C7CEDC;

  --hair: rgba(25, 30, 28, 0.16);
  --hair-2: rgba(25, 30, 28, 0.3);

  /* the network's own chip colours, off the printed map legend */
  --c-red: #C0392B;
  --c-amber: #D9541E;
  --c-orange: #E08A2B;
  --c-yellow: #DDB438;
  --c-olive: #6E9B3F;
  --c-green: #3E7A5E;
  --c-teal: #4A8C8C;
  --c-blue: #3B6FA0;
  --c-navy: #2F4A7C;
  --c-plum: #5A4A8C;
  --c-purple: #7B4B94;
  --c-rose: #B0455F;
  --c-brown: #8C6239;
  --c-t1: #3B3160;
  --c-t2: #C85F7E;

  --sidebar-w: 400px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--paper-3);
  color: var(--tx);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

.arabic-text { font-family: var(--font-ar); }
.tnum { font-variant-numeric: tabular-nums; }

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   SIDEBAR — a printed panel pinned beside the map
   ========================================================================== */
.sidebar {
  width: var(--sidebar-w);
  height: 100%;
  background: var(--paper);
  border-right: 1px solid var(--hair-2);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  flex-shrink: 0;
  position: relative;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* ---- the navy title band, straight off the map ---- */
.band {
  background: var(--band);
  color: var(--on-ink);
  padding: 12px 16px;
}

.band .band-fr {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--on-band);
  line-height: 1.3;
}

.band .band-ar {
  font-family: var(--font-ar);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  color: #FFFFFF;
  margin-top: 1px;
}

.band .band-sub {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-band);
  opacity: 0.75;
  margin-top: 4px;
}

/* ---- network figures strip ---- */
.strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--hair);
  background: var(--paper);
}

.strip > div {
  padding: 9px 6px;
  text-align: center;
  position: relative;
}

.strip > div + div { border-left: 1px solid var(--hair); }

.strip .v {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.strip .k {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 1px;
}

/* ---- search well: inset, receives content ---- */
.pad { padding: 12px 16px; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--tx-3);
  pointer-events: none;
  display: flex;
}

.search-box input {
  width: 100%;
  padding: 8px 30px 8px 32px;
  border: 1px solid var(--hair-2);
  background: var(--paper-2);
  color: var(--tx);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.search-box input:focus {
  border-color: var(--ink);
  background: var(--paper);
  box-shadow: inset 0 -2px 0 0 var(--band);
}

.search-box input::placeholder { color: var(--tx-3); }

.clear-btn {
  position: absolute;
  right: 4px;
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  color: var(--tx-3);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-btn:hover { color: var(--tx); background: var(--paper-3); }

/* ---- zone filter plates ---- */
.eyebrow {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--tx-3);
  margin-bottom: 8px;
}

.plates { display: flex; gap: 4px; flex-wrap: wrap; }

.plate {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  background: var(--paper-2);
  border: 1px solid var(--hair);
  color: var(--tx-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.plate:hover { background: var(--paper-3); color: var(--tx); }

.plate.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

.plate:focus-visible,
.btn:focus-visible,
.row:focus-visible,
.step:focus-visible,
.clear-btn:focus-visible {
  outline: 2px solid var(--band);
  outline-offset: 1px;
}

/* ==========================================================================
   LINE ROWS — chip / disc + destination + distance
   ========================================================================== */
.lines-list-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.list-meta-header {
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--tx-3);
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  background: var(--paper-2);
  position: sticky;
  top: 0;
  z-index: 2;
}

.list-meta-header .count { letter-spacing: 0.02em; }

.btn-text {
  background: none;
  border: none;
  color: var(--band);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 3px;
}

.btn-text:hover { text-decoration: underline; }

.lines-list { padding: 0 16px 12px; }

.row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hair);
  cursor: pointer;
  position: relative;
}

.row:hover { background: rgba(25, 30, 28, 0.035); }

.row:active { background: rgba(25, 30, 28, 0.07); }

.row.active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--band);
}

.row .dest { flex: 1; min-width: 0; }

.row .dest .fr {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.row .km {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx-3);
  text-align: right;
  flex-shrink: 0;
  line-height: 1.2;
}

.row .km b {
  display: block;
  color: var(--tx-2);
  font-size: 12.5px;
  font-weight: 700;
}

/* ---- chips & discs: the two markers, square for bus, round for tram ---- */
.chip {
  min-width: 40px;
  height: 28px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  flex-shrink: 0;
  border: none;
  font-family: var(--font-main);
}

.disc {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

/* ==========================================================================
   ACTIVE LINE — band header + route ribbon itinerary
   ========================================================================== */
.active-line-panel {
  flex: 1;
  overflow-y: auto;
  display: none;
  flex-direction: column;
}

.active-band {
  background: var(--band);
  color: var(--on-ink);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
}

.active-band .info { flex: 1; min-width: 0; }

.active-band .info h2 {
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.active-band .info .meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--on-band);
  margin-top: 1px;
}

.active-band .close-panel-btn {
  background: transparent;
  border: 1px solid rgba(199, 206, 220, 0.4);
  color: var(--on-band);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.active-band .close-panel-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

/* ---- direction plates ---- */
.direction-tabs {
  display: flex;
  border-bottom: 1px solid var(--hair);
  background: var(--paper-2);
  padding: 8px 14px;
  gap: 4px;
  flex-wrap: wrap;
}

.dir-plate {
  flex: 1;
  min-width: 130px;
  padding: 6px 8px;
  background: var(--paper);
  border: 1px solid var(--hair);
  color: var(--tx-2);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.1s ease;
}

.dir-plate:hover { background: var(--paper-3); }

.dir-plate.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

/* ---- route ribbon ---- */
.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 6px;
}

.timeline-head .lbl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--tx-3);
}

.btn-xs {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  background: var(--paper-2);
  border: 1px solid var(--hair-2);
  color: var(--tx);
  cursor: pointer;
}

.btn-xs:hover { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

.ribbon {
  list-style: none;
  position: relative;
  padding: 4px 16px 20px 16px;
}

/* the route ribbon itself */
.ribbon::before {
  content: '';
  position: absolute;
  left: 21px;
  top: 14px;
  bottom: 30px;
  width: 4px;
  background: var(--line-color, var(--c-amber));
}

.step {
  position: relative;
  padding: 7px 0 7px 26px;
  cursor: pointer;
  min-height: 34px;
}

.step:hover { background: rgba(25, 30, 28, 0.04); }

/* station dot: white core, ink ring */
.step::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
  transition: transform 0.1s ease;
}

.step:hover::before { transform: scale(1.2); }

/* interchange: ink square */
.step.interchange::before {
  border-radius: 0;
  width: 12px;
  height: 12px;
  left: 1px;
  background: var(--ink);
  border-color: var(--ink);
}

/* termini: solid plates at each end */
.step.first::before,
.step.last::before {
  border-radius: 0;
  width: 14px;
  height: 14px;
  left: 0;
  border-width: 0;
}

.step.first::before { background: var(--ink); }
.step.last::before { background: var(--c-red); }

.step .nm {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  display: block;
}

.step.first .nm,
.step.last .nm { font-weight: 700; }

.step .sub {
  font-size: 10.5px;
  color: var(--tx-3);
  font-weight: 500;
}

.step .term-plate {
  display: inline-block;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  margin-bottom: 2px;
}

.step.last .term-plate { background: var(--c-red); }

/* interchange chips beside the stop */
.step .xchips {
  display: inline-flex;
  gap: 2px;
  margin-left: 6px;
  vertical-align: middle;
}

.step .xchips span {
  width: 20px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: 700;
}

/* ==========================================================================
   THE INTERCHANGE MATRIX — the signature device
   ========================================================================== */
.matrix-section {
  border-top: 1px solid var(--hair);
  background: var(--paper-2);
  padding: 12px 16px;
}

.matrix { display: flex; gap: 8px; flex-wrap: wrap; }

.block { border: 2px solid var(--ink); }

.block .head {
  background: var(--ink);
  color: var(--on-ink);
  padding: 4px 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.block .head .ar {
  font-family: var(--font-ar);
  font-size: 12px;
  font-weight: 600;
  display: block;
  line-height: 1.4;
}

.block .grid {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  background: var(--paper);
}

.block .grid button {
  height: 24px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  border-right: 1px solid rgba(244, 239, 227, 0.4);
  border-bottom: 1px solid rgba(244, 239, 227, 0.4);
}

.block .grid button:hover { filter: brightness(1.15); }

/* ==========================================================================
   THUMB-ZONE ACTIONS
   ========================================================================== */
.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--hair-2);
  background: var(--paper);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 12px;
  border: 1px solid var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  transition: background-color 0.1s ease;
}

.btn.solid { background: var(--ink); color: var(--on-ink); flex: 1; }
.btn.solid:hover { background: var(--band); border-color: var(--band); }
.btn.ghost { background: transparent; color: var(--tx); flex: 1; }
.btn.ghost:hover { background: var(--paper-2); }

.btn:active { transform: scale(0.985); }

/* ==========================================================================
   MAP VIEWPORT & CONTROLS
   ========================================================================== */
.map-viewport {
  flex: 1;
  height: 100%;
  position: relative;
  background: var(--sea);
}

#map { width: 100%; height: 100%; background: var(--sea); }

.map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 196px;
}

.ctrl {
  background: var(--paper);
  border: 1px solid var(--hair-2);
  padding: 9px 11px;
  color: var(--tx);
}

.ctrl-head {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tx-3);
  margin-bottom: 7px;
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.toggle-item input { accent-color: var(--ink); cursor: pointer; }

.dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  flex-shrink: 0;
}

.dot.bus { background: var(--c-amber); }
.dot.tram { background: var(--c-t2); }
.dot.stops { background: var(--ink); }

.ctrl select {
  width: 100%;
  background: var(--paper-2);
  color: var(--tx);
  border: 1px solid var(--hair-2);
  padding: 5px 7px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.ctrl select:focus { border-color: var(--ink); }

/* ---- radar banner: an ink plate ---- */
.radar-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--on-ink);
  border: 1px solid var(--ink);
  padding: 8px 10px 8px 14px;
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  max-width: calc(100% - 460px);
}

.radar-pulse {
  width: 9px;
  height: 9px;
  background: var(--c-amber);
  flex-shrink: 0;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.banner-close {
  background: none;
  border: none;
  color: var(--on-band);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  flex-shrink: 0;
}

.banner-close:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.12); }

.mobile-sidebar-toggle { display: none; }

/* ==========================================================================
   LEAFLET — paper plates over the map
   ========================================================================== */
.leaflet-container { font-family: var(--font-main); }

.leaflet-popup-content-wrapper {
  background: var(--paper);
  color: var(--tx);
  border-radius: 0;
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(25, 30, 28, 0.22);
  padding: 0;
}

.leaflet-popup-tip {
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: none;
}

.leaflet-popup-content { margin: 0; }

.custom-popup { min-width: 232px; }

.popup-band {
  background: var(--ink);
  color: var(--on-ink);
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
}

.popup-ar {
  font-family: var(--font-ar);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--on-band);
  display: block;
  margin-top: 1px;
}

.popup-body { padding: 9px 10px 10px; }

.popup-kind {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--tx-3);
  margin-bottom: 6px;
}

.popup-grid { display: flex; flex-wrap: wrap; gap: 3px; }

.popup-grid button {
  min-width: 26px;
  height: 20px;
  padding: 0 5px;
  border: none;
  color: #FFFFFF;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.popup-grid button:hover { filter: brightness(1.15); }

.popup-coords {
  margin-top: 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--tx-3);
}

.popup-radar-list { list-style: none; padding: 0; }

.popup-radar-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--hair);
  font-size: 11.5px;
}

.popup-radar-list li:last-child { border-bottom: none; }

.popup-radar-list .d {
  font-weight: 700;
  color: var(--c-amber);
  flex-shrink: 0;
}

/* route tooltip */
.route-tooltip {
  background: var(--ink) !important;
  color: var(--on-ink) !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: 2px 2px 0 rgba(25, 30, 28, 0.25) !important;
  font-family: var(--font-main) !important;
  font-size: 11.5px !important;
  padding: 5px 8px !important;
}

.route-tooltip::before { border-top-color: var(--ink) !important; }

/* marker clusters, squared off */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(30, 44, 72, 0.28) !important;
  border-radius: 0 !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: var(--band) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  font-family: var(--font-main) !important;
  border-radius: 0 !important;
}

/* ==========================================================================
   ANALYTICS — figures, the matrix, exports
   ========================================================================== */
.stats-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 30, 28, 0.55);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.analytics-box {
  background: var(--paper);
  border: 1px solid var(--ink);
  max-width: 820px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 6px 6px 0 rgba(25, 30, 28, 0.25);
}

.analytics-band {
  background: var(--band);
  color: var(--on-ink);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analytics-band h2 {
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
}

.analytics-band p {
  font-size: 11px;
  color: var(--on-band);
  margin-top: 1px;
}

.analytics-band .ar {
  font-family: var(--font-ar);
  font-size: 12px;
  color: var(--on-band);
  margin-top: 2px;
}

.close-analytics-btn {
  background: transparent;
  border: 1px solid rgba(199, 206, 220, 0.4);
  color: var(--on-band);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.close-analytics-btn:hover { background: rgba(255, 255, 255, 0.12); color: #FFFFFF; }

.analytics-body { overflow-y: auto; }

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--hair);
}

.metric-strip > div { padding: 14px 10px; text-align: center; }
.metric-strip > div + div { border-left: 1px solid var(--hair); }

.metric-strip .v {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.metric-strip .k {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 3px;
}

.metric-strip .sub { font-size: 10px; color: var(--tx-3); margin-top: 2px; }

.section { padding: 14px 16px; border-bottom: 1px solid var(--hair); }

.section-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--tx-3);
  margin-bottom: 10px;
}

.hub-grid { display: flex; gap: 10px; flex-wrap: wrap; }

.exports { display: flex; flex-wrap: wrap; gap: 6px; }

.export-plate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  background: var(--paper-2);
  border: 1px solid var(--hair-2);
  color: var(--tx);
  text-decoration: none;
}

.export-plate:hover { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

/* ---- Region Upcoming Placeholder in Sidebar ---- */
.region-empty-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  background: var(--paper-2);
  border-top: 1px solid var(--hair-2);
  overflow-y: auto;
}

.region-empty-card {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 4px 4px 0 rgba(25, 30, 28, 0.15);
}

.region-empty-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 3px 7px;
  background: var(--c-amber);
  color: #FFFFFF;
}

.region-empty-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.region-empty-ar {
  font-family: var(--font-ar);
  font-size: 14px;
  font-weight: 700;
  color: var(--tx-2);
}

.region-empty-card p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--tx-2);
  margin-top: 2px;
}

.region-upcoming-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.region-upcoming-tags span {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  background: var(--paper-3);
  border: 1px solid var(--hair-2);
  color: var(--tx);
}

.btn-back-rabat {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--on-ink);
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-back-rabat:hover {
  background: var(--band);
  border-color: var(--band);
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(25, 30, 28, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    transform: translateX(-100%);
    width: 86vw;
    max-width: 380px;
    z-index: 1100;
    transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 4px 0 24px rgba(25, 30, 28, 0.35);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-sidebar-toggle {
    display: flex;
    position: fixed;
    bottom: 20px;
    left: 16px;
    z-index: 1001;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    color: var(--on-ink);
    border: 2px solid var(--paper);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    touch-action: manipulation;
  }

  .mobile-sidebar-toggle:active {
    transform: scale(0.92);
  }

  /* Map controls compact placement for mobile */
  .map-controls {
    width: auto;
    max-width: 155px;
    right: 10px;
    top: 10px;
    gap: 6px;
    z-index: 999;
  }

  .ctrl {
    padding: 6px 8px;
  }

  .toggle-item {
    font-size: 10.5px;
  }

  .ctrl select {
    font-size: 10.5px;
    padding: 4px;
  }

  .radar-banner {
    top: 10px;
    left: 10px;
    right: 10px;
    transform: none;
    max-width: calc(100% - 20px);
    font-size: 11px;
    padding: 6px 10px;
    z-index: 1002;
  }

  .analytics-box {
    max-height: 94vh;
    width: 95vw;
  }

  .stats-backdrop {
    padding: 10px;
  }

  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-strip > div:nth-child(3) { border-left: none; }
  .metric-strip > div:nth-child(n+3) { border-top: 1px solid var(--hair); }
}

/* ==========================================================================
   MOTION — felt, not watched
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
