/* لوين؟ collector — brand tokens from lowein-brand/code/brand.css. No build step. */

@font-face {
  font-family: "Noto Sans Arabic";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/noto-sans-arabic-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F, U+2010-2011, U+FD3E-FD3F, U+FDF2, U+FDFC, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "Noto Sans Arabic";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/noto-sans-arabic-latin.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0, U+00A9, U+00AB, U+00B7, U+00BB, U+00D7, U+2013-2014, U+2018-201D, U+2022, U+2026, U+2190-2193, U+2212;
}

/* The display face of the brand (wordmark, landing titles, live trip figures). Defined once
   here, for the landing page and the shell; a page that never uses it never downloads it. */
@font-face {
  font-family: "Baloo Bhaijaan 2";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("../fonts/baloo-bhaijaan-2-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "Baloo Bhaijaan 2";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("../fonts/baloo-bhaijaan-2-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215;
}

:root {
  --navy: #142D4E;
  --navy-700: #0B1C33;
  --teal: #16B8A6;
  --teal-50: #E3F6F4;
  /* Calm controls: a light edge for buttons (their words name them), a quiet fill for minor actions.
     Fields and radio marks keep a 3:1 edge (--border-strong, WCAG 1.4.11). */
  --control-edge: #C9D5E1;
  --quiet: #EEF2F6;
  --quiet-hover: #E3E9F0;
  --yellow: #FFC857;
  --yellow-50: #FFF4D6;
  /* Return direction (العودة): far from teal in lightness, rare on OSM tiles. White text on it is 6.9:1. */
  --purple: #7B2CBF;
  --white: #FFFFFF;
  --surface: #F5F8FA;
  --muted: #526579;
  --border: #DCE5ED;
  /* 3.4:1 on white, for field and chip outlines (WCAG 1.4.11) */
  --border-strong: #7A8CA0;
  --danger: #B42318;
  --danger-50: #FEF3F2;
  --font: "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  --radius-input: 12px;
  --radius-card: 20px;
  --shadow: 0 2px 10px rgba(20, 45, 78, 0.12);
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

/* The wordmark (partials/logo, 303x120): height sets the size. */
.logo { display: block; flex: none; }
.logo__img { display: block; width: auto; height: 100%; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--navy);
  background: var(--surface);
}

a { color: var(--navy); text-underline-offset: 0.2em; }
a:hover { color: var(--navy-700); }

h1, h2, h3 { line-height: 1.4; margin: 0 0 0.5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0 0 0.75rem; }

:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 3px;
}

/* A heading a script moves focus to (tabindex="-1": a new step, a line's detail, a trip's steps)
   is not a control: no ring, after a tap or the keyboard alike, on every page. Screen readers
   still announce it, and the next Tab goes on from there. */
h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus,
h3[tabindex="-1"]:focus { outline: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: 8px;
  top: -200px;
  z-index: 3000;
  padding: 12px 16px;
  border-radius: var(--radius-input);
  background: var(--white);
  font-weight: 700;
}
.skip-link:focus { top: 8px; }

/* The logo mark (shell header, offline page). */
.icon-logo { flex-shrink: 0; border-radius: 9px; }

/* ── Cards and notices ───────────────────────────────────────── */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 16px;
  margin-bottom: 16px;
}

.notice {
  padding: 12px 14px;
  border-radius: var(--radius-input);
  border-inline-start: 4px solid var(--border-strong);
  background: var(--surface);
  font-weight: 600;
}
.notice--warn { background: var(--yellow-50); border-inline-start-color: var(--yellow); }
.notice--ok { background: var(--teal-50); border-inline-start-color: var(--teal); }


.draft-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-bottom: 16px;
  padding: 6px 6px 6px 14px;
  padding-inline-start: 14px;
  border-radius: var(--radius-input);
  background: var(--teal-50);
}
.draft-bar__text { margin: 0; font-weight: 600; }

/* ── Steps (shared: /add and the /map feedback forms) ─────────── */

.step__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.step__nav .btn { flex: 1 1 8rem; }
.step__nav [data-back] { flex: 0 1 auto; }

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn .icon { flex-shrink: 0; }
.btn--primary { background: var(--navy); color: var(--white); }
.btn--primary:hover { background: var(--navy-700); color: var(--white); }
.btn--secondary { background: var(--white); color: var(--navy); border-color: var(--control-edge); }
.btn--secondary:hover { background: var(--surface); border-color: var(--border-strong); }
.btn--ghost { background: var(--quiet); color: var(--navy); }
.btn--ghost:hover { background: var(--quiet-hover); }
.btn--text {
  min-height: 44px;
  padding: 8px 12px;
  background: none;
  color: var(--navy);
  text-decoration: underline;
}
.btn--small { min-height: 40px; padding: 8px 14px; font-size: 0.9375rem; }
.btn--block { width: 100%; }
.btn--icon { min-width: 46px; padding: 8px; font-size: 1.5rem; line-height: 1; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Fields ──────────────────────────────────────────────────── */

.field {
  min-width: 0;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}
.field__label {
  display: block;
  margin: 0 0 4px;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
}
.field__optional { font-weight: 400; font-size: 0.875rem; color: var(--muted); }
.field__hint { margin: 0 0 8px; font-size: 0.875rem; color: var(--muted); }
.field__error { margin: 6px 0 0; font-size: 0.9375rem; font-weight: 600; color: var(--danger); }
.field__error:empty { display: none; }

.input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-input);
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-size: 1rem;
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover { border-color: #5E7088; }
.input:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; border-color: var(--navy); }
.input[aria-invalid="true"] { border: 2px solid var(--danger); }
.input--area { min-height: 6rem; resize: vertical; }
select.input { appearance: auto; }

/* Honeypot. Clipped rather than pushed off-screen: in RTL a large negative
   offset becomes horizontally scrollable overflow on phones. */
.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Radio chips: the real radio covers the chip, so the whole chip is the target. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips--stack { flex-direction: column; }
.chip { position: relative; display: flex; }
.chips--stack .chip { width: 100%; }
.chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.chip span {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--control-edge);
  border-radius: var(--radius-input);
  background: var(--white);
  font-weight: 600;
  transition: background-color 0.15s, border-color 0.15s;
}
.chip:hover span { border-color: var(--border-strong); }
.chip span::before {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: var(--white);
}
.chip input:checked + span { border-color: var(--teal); background: var(--teal-50); box-shadow: inset 0 0 0 1px var(--teal); }
.chip input:checked + span::before { background: radial-gradient(circle, var(--navy) 0 5px, var(--white) 6px); }
.chip input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }
.chip input[aria-invalid="true"] + span { border-color: var(--danger); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  padding: 8px 0;
  cursor: pointer;
  font-weight: 600;
}
.check input {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin: 2px 0 0;
  accent-color: var(--navy);
}

/* Toggle switch («الصق عالطريق»): the knob moves, so state is not colour-only. */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  cursor: pointer;
  font-weight: 700;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch__track {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.15s;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 4px;
  inset-inline-start: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--white);
  transition: inset-inline-start 0.15s;
}
.switch input:checked + .switch__track { background: var(--teal); }
.switch input:checked + .switch__track::after { inset-inline-start: 24px; box-shadow: inset 0 0 0 7px var(--white), inset 0 0 0 12px var(--navy); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--navy); outline-offset: 3px; }

/* Segmented control («شو عم ترسم هلأ؟») */
.segmented { min-width: 0; margin: 16px 0 0; padding: 0; border: 0; }
.segmented__options {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
}
.segmented__option { position: relative; flex: 1 1 0; min-width: 0; }
.segmented__option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.segmented__option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}
.segmented__option input:checked + span { background: var(--navy); color: var(--white); }
.segmented__option input:focus-visible + span { outline: 3px solid var(--navy); outline-offset: 2px; }

/* ── Search ──────────────────────────────────────────────────── */

.place-search__row { display: flex; gap: 8px; }
.place-search__row .input { flex: 1 1 auto; min-width: 0; }
.place-search__row .btn { flex: 0 0 auto; }
.status { margin: 6px 0 0; font-size: 0.9375rem; }
.status:empty { display: none; }
.search-results {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-input);
  overflow: hidden;
}
.search-result {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  color: var(--navy);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.search-results li:last-child .search-result { border-bottom: 0; }
.search-result:hover { background: var(--teal-50); }
.search-result__name { display: block; font-weight: 700; }
.search-result__label { display: block; font-size: 0.875rem; color: var(--muted); }

/* ── Map ─────────────────────────────────────────────────────── */

.map-wrap { position: relative; }
.map {
  height: 70vh;
  height: 70svh; /* the visible viewport on phones, without the browser bars */
  min-height: 380px;
  max-height: 720px;
  background: #E9EEF2;
  font-family: var(--font);
}
.map:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; }

.map-crosshair {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 900;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  pointer-events: none;
}
.map-crosshair::before,
.map-crosshair::after {
  content: "";
  position: absolute;
  background: var(--navy);
  box-shadow: 0 0 0 2px var(--white);
}
.map-crosshair::before { top: 17px; left: 0; width: 36px; height: 3px; }
.map-crosshair::after { left: 17px; top: 0; width: 3px; height: 36px; }
.map:focus-visible ~ .map-crosshair { display: block; }

.map-fab {
  position: absolute;
  left: 12px;
  bottom: 28px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Undo sits opposite «موقعي», under the drawing thumb. */
.map-fab--undo {
  left: auto;
  right: 12px;
}

.map-fab:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Fullscreen toggle sits next to Leaflet's zoom control. */
.map-fab--fullscreen {
  top: 10px;
  bottom: auto;
  left: 54px;
  min-height: 44px;
  padding: 0 14px;
}
/* «اعكس الاتجاه» on the map, only in fullscreen (the tools row is hidden there). */
.map-fab--reverse {
  display: none;
  top: 10px;
  bottom: auto;
  left: auto;
  right: 12px;
  min-height: 44px;
  padding: 0 14px;
}
.layer-switch ~ .map-fab--reverse { top: 72px; }
.map-wrap.is-fullscreen .map-fab--reverse { display: inline-flex; }

.fs-icon { display: inline-flex; }
.fs-icon--exit { display: none; }

.map-hud { display: none; }

/* A CSS overlay rather than the Fullscreen API: it also works on iOS Safari. */
.map-wrap.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--white);
}
.map-wrap.is-fullscreen .map {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: none;
  border-radius: 0;
}
.map-wrap.is-fullscreen .fs-icon--enter { display: none; }
.map-wrap.is-fullscreen .fs-icon--exit { display: inline-flex; }
.map-wrap.is-fullscreen .map-fab--fullscreen { background: var(--navy); color: var(--white); }
.map-wrap.is-fullscreen .map-fab:not(.map-fab--fullscreen):not(.map-fab--reverse):not(.map-fab--here) { bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.map-wrap.is-fullscreen .map-hud {
  position: absolute;
  left: 50%;
  bottom: calc(156px + env(safe-area-inset-bottom, 0px)); /* above «ضع نقطة في موقعي» */
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  pointer-events: none;
}
.map-hud p {
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}
.map-hud p:empty { display: none; }
.map-hud__notice.is-warn { background: #FFF4DB; color: #6B4700; }
/* The keyboard help, for sighted keyboard users: while the map has keyboard focus and no notice shows. */
.map-hud__keys { display: none; }
.map:focus-visible ~ .map-hud .map-hud__notice:empty ~ .map-hud__keys {
  display: block;
  max-width: 30rem;
  border: 2px solid var(--navy);
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* «ضع نقطة في موقعي»: a point per tap at the phone's position. */
.here-tools { margin: 0 0 12px; }
.here-btn { min-height: 52px; }
.here-btn[aria-busy="true"] { opacity: 0.8; cursor: progress; }
.here-hint { margin: 6px 0 0; }
.here-prompt {
  margin-top: 8px;
  padding: 12px;
  border: 2px solid var(--navy);
  border-radius: var(--radius-input);
  background: var(--white);
  color: var(--navy);
}
.here-prompt.is-floating {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(156px + env(safe-area-inset-bottom, 0px));
  z-index: 1002;
  margin: 0;
  box-shadow: var(--shadow);
}
.here-prompt__text { margin: 0 0 8px; font-weight: 700; }
.here-prompt__label { display: block; margin-bottom: 4px; font-size: 0.875rem; font-weight: 700; }
.here-prompt__row { display: flex; flex-wrap: wrap; gap: 6px; }
.here-prompt__row .btn { flex: 1 1 auto; }
.here-prompt__row .input { flex: 1 1 8rem; min-width: 0; min-height: 44px; }
.map-fab--here { display: none; }
.map-wrap.is-fullscreen .map-fab--here {
  display: inline-flex;
  left: 50%;
  right: auto;
  top: auto;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  min-height: 56px;
  padding: 0 22px;
  background: var(--navy);
  color: var(--white);
  font-size: 1.0625rem;
  white-space: nowrap;
  transform: translateX(-50%);
}
.map-wrap.is-fullscreen .map-fab--here:disabled { opacity: 0.75; cursor: progress; }

/* GPS recording: the controls sit on the map (so they work in fullscreen);
   the drawing FABs step aside while recording. */
.gps-open { margin-bottom: 8px; }
.gps-intro {
  margin: 0 0 12px;
  padding: 14px;
  border: 2px solid var(--navy);
  border-radius: var(--radius-input);
  background: var(--teal-50);
}
.gps-intro__title { margin: 0 0 6px; font-size: 1.0625rem; }
.gps-intro__steps { margin: 0 0 8px; padding-inline-start: 1.25rem; }
.gps-intro__steps li { margin-bottom: 4px; }
.gps-intro__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gps-intro__actions .btn { flex: 1 1 8rem; }

.gps-bar {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 1001;
  padding: 10px 12px;
  border: 2px solid var(--navy);
  border-radius: 16px;
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow);
}
.gps-bar__status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 8px; font-size: 0.9375rem; }
.gps-bar__stats { font-weight: 700; }
.gps-bar__acc { font-size: 0.875rem; color: var(--muted); }
.gps-bar__row { display: flex; flex-wrap: wrap; gap: 6px; }
.gps-bar__row .btn { flex: 1 1 auto; }
.gps-bar__row .input { flex: 1 1 8rem; min-width: 0; min-height: 44px; }
.gps-bar__stop { margin-top: 8px; }
.gps-bar__label { display: block; margin-bottom: 4px; font-size: 0.875rem; font-weight: 700; }
.gps-bar__panel .gps-bar__status { margin-bottom: 8px; font-weight: 600; }
.map-wrap.is-recording .map-fab:not(.map-fab--fullscreen) { display: none; }
.map-wrap.is-recording .map-hud { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }

/* Recording light: colour plus a written state next to it. */
.gps-dot { flex-shrink: 0; width: 14px; height: 14px; border: 2px solid var(--navy); border-radius: 999px; background: var(--border-strong); }
.gps-dot--good { background: var(--teal); }
.gps-dot--fair { background: var(--yellow); }
.gps-dot--poor { background: var(--danger); }
.gps-dot--paused { background: var(--white); }
.gps-dot--good,
.gps-dot--fair { animation: gps-pulse 1.6s ease-in-out infinite; }
@keyframes gps-pulse { 50% { box-shadow: 0 0 0 5px rgba(22, 184, 166, 0.25); } }
.gps-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 999px;
  animation: gps-spin 0.9s linear infinite;
}
@keyframes gps-spin { to { transform: rotate(360deg); } }

body.map-fullscreen { overflow: hidden; }

.layer-switch {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.layer-switch__btn {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.layer-switch__btn[aria-pressed="true"] { background: var(--navy); color: var(--white); }

/* Leaflet: bigger zoom buttons (44px targets), brand font. */
.leaflet-container { font-family: var(--font); }
.leaflet-touch .leaflet-bar a,
.leaflet-bar a {
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-size: 22px;
  color: var(--navy);
}
.leaflet-control-attribution { font-size: 0.75rem; }
.leaflet-control-attribution a { color: var(--navy); }

.stop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white);
  border-radius: 7px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.8125rem;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(20, 45, 78, 0.4);
}
.stop-icon:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.me-icon {
  border: 3px solid var(--white);
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 3px var(--navy), 0 0 0 9px rgba(22, 184, 166, 0.3);
}

/* Drawn route points (route-draw.js). The route sits above other lines
   (overlay pane, 400) and below markers (600). */
.leaflet-lowein-route-pane { z-index: 450; }

/* A 44px transparent hit area around a smaller visible handle. */
.wp-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}
.wp-icon:focus { outline: none; }
.wp-icon.leaflet-drag-target { cursor: grabbing; }
.wp-dot {
  position: relative;
  display: block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 3px solid var(--navy);
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 1px 4px rgba(20, 45, 78, 0.35);
}
.wp-icon--start .wp-dot,
.wp-icon--end .wp-dot { width: 28px; height: 28px; }
.wp-icon--main.wp-icon--start .wp-dot { background: var(--yellow); }
/* The end is a square, so start and end differ by shape, not only colour. */
.wp-icon--main.wp-icon--end .wp-dot { border-radius: 7px; background: var(--teal); }
.wp-icon--alt.wp-icon--start .wp-dot,
.wp-icon--alt.wp-icon--end .wp-dot {
  border-color: var(--white);
  background: var(--purple);
  box-shadow: 0 0 0 2px var(--purple), 0 1px 4px rgba(20, 45, 78, 0.35);
}
.wp-icon:focus-visible .wp-dot { box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--navy); }
.wp-icon.leaflet-drag-target .wp-dot { transform: scale(1.2); }
/* The point waiting for its new place («حرّك النقطة إلى منتصف الخريطة»). */
.wp-icon.is-selected .wp-dot { outline: 3px dashed var(--navy); outline-offset: 4px; }

/* Points of the route that is not being drawn: smaller, not tappable. */
.wp-icon.is-static { cursor: default; }
.wp-icon.is-static .wp-dot { width: 12px; height: 12px; border-width: 2px; box-shadow: none; }
.wp-icon.is-static.wp-icon--start .wp-dot,
.wp-icon.is-static.wp-icon--end .wp-dot { width: 18px; height: 18px; border-width: 3px; }

/* «البداية» / «النهاية» tags: navy text, never white on yellow or teal. */
.wp-tag {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0 8px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  pointer-events: none;
}
.wp-icon--main.wp-icon--end .wp-tag { background: var(--teal); }
.wp-icon--alt.wp-icon--end .wp-dot { border-radius: 7px; }
.wp-icon--alt .wp-tag { border-color: var(--white); background: var(--purple); color: var(--white); }

/* Point menu (Leaflet popup) */
.wp-popup .leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow); }
.wp-popup .leaflet-popup-content { margin: 6px 8px 8px; font-family: var(--font); font-size: 0.9375rem; line-height: 1.4; }
.wp-menu { display: flex; flex-direction: column; gap: 6px; }
.wp-menu__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-inline-start: 6px; }
.wp-menu__title { margin: 0; font-weight: 700; color: var(--navy); }
.wp-menu__close {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.wp-menu__btn {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}
.wp-menu__btn:hover,
.wp-menu__close:hover { background: var(--teal-50); }
.wp-menu__btn:focus-visible,
.wp-menu__close:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.wp-menu__btn--start { border-inline-start: 6px solid var(--yellow); }
.wp-menu__btn--end { border-inline-start: 6px solid var(--teal); }
.wp-menu__btn--danger { border-color: var(--danger); color: var(--danger); }
.wp-menu__btn--danger:hover { background: var(--danger-50); }

/* While a point waits for its new place, show the centre crosshair. */
.map.is-moving-point ~ .map-crosshair { display: block; }
.map.is-moving-point.leaflet-grab { cursor: crosshair; }

.map-notice { margin: 0 0 8px; font-weight: 600; }
.map-notice:empty { display: none; }
.map-notice.is-warn {
  padding: 10px 12px;
  border-radius: var(--radius-input);
  border-inline-start: 4px solid var(--yellow);
  background: var(--yellow-50);
}
.route-stats { margin: 0 0 4px; font-weight: 600; }
.route-stats:empty { display: none; }

.tools { margin: 12px 0 16px; }
.tools__hint { margin-top: -4px; }
.tools__row { display: flex; flex-wrap: wrap; gap: 8px; }
.tools__row .btn { flex: 1 1 10rem; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 16px 0;
  padding: 12px;
  list-style: none;
  border-radius: var(--radius-input);
  background: var(--surface);
  font-size: 0.875rem;
}
.legend li { display: flex; align-items: center; gap: 8px; }

/* Stops */
.stops-panel { margin: 0 0 16px; padding: 12px; border: 1.5px solid var(--border); border-radius: var(--radius-input); }
.stops-panel.is-active { border-color: var(--navy); }

/* The return question: a purple-tinted card right under the drawing tools. */
.return-card {
  min-width: 0;
  margin: 0 0 16px;
  padding: 14px 14px 12px;
  border: 2px solid var(--purple);
  border-inline-start-width: 6px;
  border-radius: var(--radius-input);
  background: #F5EFFB; /* purple at ~8%; navy text on it is 13:1 */
  transition: box-shadow 0.2s;
}
.return-card:focus { outline: none; }
.return-card.is-attention { box-shadow: 0 0 0 5px rgba(123, 44, 191, 0.35); }
/* Floated so the legend sits inside the tinted card, not on its border. */
.return-card__title {
  float: inline-start;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 4px;
  padding: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.4;
}
.return-card__title .icon { flex-shrink: 0; color: var(--purple); }
.return-card__hint { clear: both; margin: 0 0 10px; font-size: 0.9375rem; }
.return-card .chip input:checked + span { border-color: var(--purple); background: #EADCF7; }
.return-card .chip input:checked + span::before { background: radial-gradient(circle, var(--purple) 0 5px, var(--white) 6px); border-color: var(--purple); }
.return-card__wait { margin: 10px 0 0; }
.return-confirm {
  margin-top: 12px;
  padding: 12px;
  border: 1.5px dashed var(--purple);
  border-radius: 10px;
  background: var(--white);
}
.return-confirm__text { margin: 0 0 8px; font-weight: 700; }
.return-confirm__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.return-confirm__actions .btn { flex: 1 1 8rem; }
/* Confirmed: teal with navy text (never white on teal), and a written status. */
#return-confirm-yes[aria-pressed="true"] { border-color: var(--navy); background: var(--teal); color: var(--navy); }
.return-confirm__done { margin: 8px 0 0; font-weight: 700; color: #0B5E55; }
.return-confirm__done:empty { display: none; }
.return-card.is-confirmed .return-confirm { border-style: solid; border-color: var(--teal); }
.stops-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; }
.stops-list:empty { display: none; }
.stop-item { display: flex; align-items: flex-end; gap: 8px; }
.stop-item__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin-bottom: 8px;
  border-radius: 7px;
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: 0.875rem;
}
.stop-item__field { flex: 1 1 auto; min-width: 0; }
.stop-item__field label { display: block; font-size: 0.875rem; font-weight: 600; }

/* ── Content pages ───────────────────────────────────────────── */

.prose h2 { margin-top: 24px; font-size: 1.25rem; }
.prose ul { padding-inline-start: 1.25rem; }
.prose li { margin-bottom: 6px; }

/* ── Larger screens / zoom ───────────────────────────────────── */

@media (min-width: 48em) {
  .card { padding: 28px 32px; }
  .map { height: 520px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .chip input:checked + span,
  .segmented__option input:checked + span,
  .layer-switch__btn[aria-pressed="true"] { outline: 3px solid CanvasText; }
}

/* ── PWA ─────────────────────────────────────────────────────── */

/* «ثبّت لوين؟ على جهازك»: small, at the bottom, under the map sheet and fullscreen maps. */
.pwa-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 28rem;
  margin: 0 auto;
  padding: 12px 12px 12px 8px;
  border: 1.5px solid var(--border-strong);
  border-radius: 16px;
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 6px 24px rgba(20, 45, 78, 0.18);
}
.pwa-banner__icon { flex-shrink: 0; border-radius: 10px; }
.pwa-banner__body { flex: 1 1 auto; min-width: 0; }
.pwa-banner__title { margin: 0 0 2px; font-weight: 700; }
.pwa-banner__text { margin: 0 0 8px; font-size: 0.9375rem; color: var(--muted); }
.pwa-banner__share { vertical-align: -3px; color: var(--navy); }
.pwa-banner__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pwa-banner__actions .btn { flex: 0 1 auto; }
.pwa-banner__close {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  margin: -8px -4px 0 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.pwa-banner__close:hover { background: var(--surface); }
.pwa-banner__close:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* Offline page */
.offline { text-align: center; }
.offline__badge { display: flex; justify-content: center; margin: 4px 0 12px; }
.offline__badge .icon-logo { width: 64px; height: 64px; border-radius: 16px; }
.offline__title { font-size: 1.375rem; }

/* ── Verified seal (/map, /trip) and the pills in /map comments (team reply, report reason) ── */
.verified { display: inline-flex; flex: none; align-items: center; margin-inline-start: 4px; vertical-align: -3px; }
.verified svg { display: block; }
.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill--useful { background: var(--teal-50); border-color: var(--teal); }
