/* لوين؟ 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;
}

:root {
  --navy: #142D4E;
  --navy-700: #0B1C33;
  --teal: #16B8A6;
  --teal-50: #E3F6F4;
  --yellow: #FFC857;
  --yellow-50: #FFF4D6;
  --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; }

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;
}

.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; }

/* ── Header / footer ─────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  text-decoration: none;
  color: var(--navy);
}
.brand__name { font-size: 1.25rem; font-weight: 700; }
.brand__tagline { font-size: 0.875rem; color: var(--muted); }
.icon-logo { flex-shrink: 0; border-radius: 9px; }
.header-form { margin: 0; }

.site-main {
  flex: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 16px;
}
.site-main:focus { outline: none; }
.page--review .site-main { max-width: 64rem; }

.site-footer {
  padding: 24px 16px 32px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}
.site-footer p { margin: 0 0 4px; }
.site-footer a { display: inline-block; padding: 10px 6px; color: var(--navy); }

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

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 16px;
  margin-bottom: 16px;
}
.card--flush { padding: 0; overflow: hidden; }
.step__pad { padding: 20px 16px; }
.step__pad + .map-wrap,
.map-wrap + .step__pad { padding-top: 16px; }
.narrow { max-width: 28rem; margin-inline: auto; }

.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); }

.intro { margin: 8px 0 16px; }
.intro__title { margin-bottom: 4px; }
.intro__text { color: var(--muted); }

.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; }

/* ── Progress ────────────────────────────────────────────────── */

.progress { margin-bottom: 16px; }
.progress__text { margin: 0 0 8px; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.progress__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.progress__step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 4px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}
.progress__dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  border: 2px solid var(--border-strong);
  background: var(--white);
  font-weight: 700;
  font-size: 0.8125rem;
}
.progress__step.is-done { border-top-color: var(--teal); color: var(--navy); }
.progress__step.is-done .progress__dot { background: var(--teal); border-color: var(--teal); color: var(--navy); }
.progress__step.is-current { border-top-color: var(--navy); color: var(--navy); font-weight: 700; }
.progress__step.is-current .progress__dot { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* ── Steps ───────────────────────────────────────────────────── */

.step__title { font-size: 1.375rem; }
.step__title:focus { outline: none; }
.step__title:focus-visible { outline: 3px solid var(--navy); }
.step__help { color: var(--muted); }

.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; }

.error-summary,
.step__errors {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 2px solid var(--danger);
  border-radius: var(--radius-input);
  background: var(--danger-50);
}
.error-summary:focus,
.step__errors:focus { outline: 3px solid var(--navy); outline-offset: 2px; }
.error-summary__title { margin: 0 0 4px; font-size: 1rem; font-weight: 700; color: var(--danger); }
.error-summary__list,
.step__errors ul { margin: 0; padding-inline-start: 1.25rem; }
.error-summary a,
.step__errors a { color: var(--danger); font-weight: 600; display: inline-block; padding: 4px 0; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: 14px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.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(--navy); }
.btn--secondary:hover { background: var(--teal-50); }
.btn--ghost { background: var(--surface); color: var(--navy); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--border-strong); }
.btn--text {
  min-height: 44px;
  padding: 8px 12px;
  background: none;
  color: var(--navy);
  text-decoration: underline;
}
.btn--small { min-height: 44px; padding: 8px 14px; font-size: 0.9375rem; }
.btn--block { width: 100%; }
.btn--icon { min-width: 48px; 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: 48px;
  padding: 10px 14px;
  border: 1.5px 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:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; 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: 48px;
  padding: 10px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-input);
  background: var(--white);
  font-weight: 600;
}
.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: 2px solid var(--navy); background: var(--teal-50); }
.chip input:checked + span::before { background: radial-gradient(circle, var(--navy) 0 5px, var(--white) 6px); }
.chip input:focus-visible + span { outline: 3px 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--review { height: 50vh; min-height: 300px; border-radius: var(--radius-input); margin-bottom: 12px; }

.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) { bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.map-wrap.is-fullscreen .map-hud {
  position: absolute;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  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; }

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); }
.wp-icon--main.wp-icon--end .wp-dot { 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(--navy);
  box-shadow: 0 0 0 2px var(--navy), 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-tag { border-color: var(--white); background: var(--navy); 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); }
.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; }

/* ── Thanks / share ──────────────────────────────────────────── */

.thanks { text-align: center; }
.thanks__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 8px auto 12px;
  border-radius: 999px;
  background: var(--teal);
  color: var(--navy);
}
.thanks__badge .icon { width: 36px; height: 36px; }
.thanks__title:focus { outline: none; }
.share { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); text-align: start; }
.share__title { font-size: 1.125rem; }
.share__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.share__actions .btn { flex: 1 1 10rem; }

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

.prose h2 { margin-top: 24px; font-size: 1.25rem; }
.prose ul { padding-inline-start: 1.25rem; }
.prose li { margin-bottom: 6px; }
.error-page { text-align: center; }
.error-page__code { margin: 0; font-size: 3rem; font-weight: 700; color: var(--navy); }

/* ── Review ──────────────────────────────────────────────────── */

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
}
.filter.is-active { background: var(--navy); border-color: var(--navy); color: var(--white); }
.badge { padding: 0 8px; border-radius: 999px; background: var(--surface); color: var(--navy); font-size: 0.8125rem; }
.filter.is-active .badge { background: var(--white); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.table caption { padding-bottom: 8px; text-align: start; font-size: 0.875rem; color: var(--muted); }
.table th,
.table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.table a { display: inline-block; padding: 4px 0; font-weight: 700; }

.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--new { background: var(--yellow-50); border-color: var(--yellow); }
.status-pill--useful { background: var(--teal-50); border-color: var(--teal); }
.status-pill--spam { background: var(--danger-50); border-color: var(--danger); color: var(--danger); }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }

.details { display: grid; grid-template-columns: minmax(7rem, max-content) 1fr; gap: 8px 16px; margin: 0; }
.details dt { font-weight: 700; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.plain-list { margin: 0; padding-inline-start: 1.25rem; }

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

@media (max-width: 30em) {
  .details { grid-template-columns: 1fr; }
  .details dd { margin-bottom: 8px; }
  .brand__tagline { display: none; }
}

@media (min-width: 48em) {
  .card { padding: 28px 32px; }
  .card--flush { padding: 0; }
  .step__pad { 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; }
}

/* ── Public map (/map) ───────────────────────────────────────── */

.intro__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-weight: 700;
}
.card--tight { padding: 14px 16px 6px; }
.field--compact { margin-bottom: 12px; }

/* Checkbox chips (filters): a tick mark, not colour alone */
.chip--check span::before { border-radius: 6px; }
.chip--check input:checked + span::before {
  background: var(--navy);
  box-shadow: inset 0 0 0 3px var(--white);
}

.map-wrap--card { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; margin-bottom: 8px; }
.map--public { height: 55vh; min-height: 300px; }
.map--public:not(.is-drawing):focus-visible ~ .map-crosshair { display: none; }
.map--public.is-drawing { outline: 4px solid var(--yellow); outline-offset: -4px; }

/* Below the map (not over it) so the whole map stays tappable while drawing. */
.draw-bar {
  padding: 10px 12px;
  border-top: 3px solid var(--yellow);
  background: var(--white);
}
.draw-bar__text { margin: 0 0 8px; font-size: 0.875rem; font-weight: 600; }
.draw-bar__hint { margin: -4px 0 8px; font-size: 0.8125rem; color: var(--muted); }
.draw-bar__row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.draw-bar__row .btn { flex: 1 1 auto; }
.switch--small { min-height: 44px; gap: 8px; font-size: 0.9375rem; }

.line-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.line-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-input);
  background: var(--white);
  color: var(--navy);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.line-item:hover { background: var(--teal-50); }
.line-item__name { font-weight: 700; overflow-wrap: anywhere; }
.line-item__route { grid-column: 1 / -1; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }

/* Bottom sheet */
.sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1200;
  max-height: 78vh;
  overflow-y: auto;
  margin: 0 auto;
  max-width: 40rem;
  padding: 8px 16px 24px;
  border-radius: 24px 24px 0 0;
  background: var(--white);
  box-shadow: 0 -6px 24px rgba(20, 45, 78, 0.18);
}
.sheet:focus { outline: none; }
.sheet__handle { width: 40px; height: 4px; margin: 4px auto 10px; border-radius: 999px; background: var(--border); }
.sheet__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sheet__title { margin: 0 0 4px; font-size: 1.25rem; overflow-wrap: anywhere; }
.sheet__title:focus { outline: none; }
.sheet__title:focus-visible { outline: 3px solid var(--navy); }
.sheet__meta { margin: 4px 0; color: var(--muted); overflow-wrap: anywhere; }
.sheet__subtitle { margin: 16px 0 8px; font-size: 1rem; }
.sheet__actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sheet__actions .btn { flex: 1 1 8rem; }
.sheet__actions .btn[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--yellow); }
.sheet__form { margin: 8px 0 12px; padding: 12px; border: 1.5px solid var(--border); border-radius: var(--radius-input); }
/* While drawing a correction only a slim bar of the sheet stays visible. */
.sheet--minimized { max-height: 4.5rem; overflow: hidden; }

.counters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.counter {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  font-weight: 700;
  font-size: 0.9375rem;
}
.counter--ok { background: var(--teal-50); border-color: var(--teal); }
.counter--wrong { background: var(--danger-50); border-color: var(--danger); color: var(--danger); }

.comments { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.comment { padding: 10px 12px; border-radius: var(--radius-input); background: var(--surface); }
.comment--team { border-inline-start: 4px solid var(--teal); background: var(--teal-50); }
.comment__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 0.8125rem; color: var(--muted); }
.comment__body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Review: feedback moderation */
.feedback-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.feedback-item { padding: 12px; border: 1.5px solid var(--border); border-radius: var(--radius-input); }
.feedback-item.is-hidden { border-style: dashed; background: var(--surface); }
.feedback-item__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 8px; }
.feedback-item__actions .input { width: auto; flex: 1 1 10rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 0; }
.correction-toggles { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0; }
