/*
 * لوين؟ — «الخطوط» (/map). Loaded after app.css and shell.css ('page_styles').
 *
 * The map fills the stage; the shell's sheet (a bottom sheet on phones, a side
 * panel from 900px) holds the search, the filter chips and the list, or one
 * line's detail. The one loud element is the card's route rail: the line in
 * its own map colour, from a yellow start circle to a teal end square, solid
 * when the team reviewed it and dashed when not, the same marks as the map.
 */

.page--lines {
  --line: var(--teal);
  --lines-elev: 0 1px 2px rgba(20, 45, 78, 0.08), 0 6px 20px rgba(20, 45, 78, 0.12);
  --lines-teal-text: #0B5E55;
  --lines-red-text: #9B1C1C;
}

/* Line colours: same palette and order as PALETTE in map.js (and /trip). */
.lc-0 { --line: #16B8A6; }
.lc-1 { --line: #1D4ED8; }
.lc-2 { --line: #DB2777; }
.lc-3 { --line: #4D7C0F; }
.lc-4 { --line: #7B2CBF; }
.lc-5 { --line: #B91C1C; }
.lc-6 { --line: #0E7490; }
.lc-7 { --line: #9333EA; }
.lc-8 { --line: #059669; }
.lc-9 { --line: #BE185D; }

/* ── The map ─────────────────────────────────────────────────── */

.map--public:not(.is-drawing):focus-visible ~ .map-crosshair { display: none; }
.map--public.is-drawing { outline: 4px solid var(--yellow); outline-offset: -4px; }

/* Notices from the map and the drawing (role=status), under the map's top controls. */
.map-toast {
  position: absolute;
  top: 68px;
  left: 50%;
  z-index: 1001;
  width: max-content;
  max-width: min(26rem, calc(100% - 132px));
  margin: 0;
  padding: 8px 16px;
  border-radius: 16px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--lines-elev);
  transform: translateX(-50%);
  pointer-events: none;
}
.map-toast:empty { display: none; }
.map-toast.is-warn { background: var(--yellow); color: var(--navy); }

/* The keyboard help (the map's aria-describedby, read from here even while hidden): shown to sighted
   keyboard users while they draw a correction with the map focused, in the toast's place; a toast
   (zoom gate, "point added") takes over while it shows. */
.map-keys { display: none; }
.map--public.is-drawing:focus-visible ~ .map-keys {
  position: absolute;
  top: 68px;
  left: 50%;
  z-index: 1001;
  display: block;
  width: max-content;
  max-width: min(30rem, calc(100% - 132px));
  margin: 0;
  padding: 8px 16px;
  border: 2px solid var(--navy);
  border-radius: 16px;
  background: var(--white);
  color: var(--navy);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  box-shadow: var(--lines-elev);
  transform: translateX(-50%);
  pointer-events: none;
}
.map--public.is-drawing:focus-visible ~ .map-toast:not(:empty) ~ .map-keys { display: none; }
/* Touch screens: a script focus after a tap can count as focus-visible; the keyboard help would cover the map. */
@media (hover: none) and (pointer: coarse) { .map--public.is-drawing:focus-visible ~ .map-keys { display: none; } }

/* «ارسم الطريق الصحيح»: floats over the map, just above the lowered sheet. */
.draw-bar {
  position: absolute;
  inset-inline: 8px;
  bottom: calc(var(--sheet-visible, 0px) + 8px);
  z-index: 1150;
  max-width: 36rem;
  margin-inline: auto;
  padding: 10px 12px;
  border-top: 4px solid var(--yellow);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--lines-elev);
}
.draw-bar__text { margin: 0 0 6px; font-size: 0.875rem; font-weight: 600; line-height: 1.5; }
.draw-bar__hint { margin: 0 0 8px; font-size: 0.8125rem; line-height: 1.5; 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; }

/* The searched place: a yellow pin (a navy teardrop outline) inside a dashed ring. */
.place-pin::before {
  content: "";
  position: absolute;
  top: 0;
  left: 3px;
  width: 20px;
  height: 20px;
  border: 3px solid var(--navy);
  border-radius: 50% 50% 50% 0;
  background: var(--yellow);
  box-shadow: 0 0 0 2px var(--white), 0 3px 6px rgba(20, 45, 78, 0.35);
  transform: rotate(-45deg);
}
.place-pin::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 10px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--navy);
}

/* Line ends: start = yellow circle, end = square; teal for the way there, purple for the way back. */
.line-end {
  border: 2.5px solid var(--navy);
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 0 0 1.5px var(--white);
}
.line-end--end { border-radius: 3px; background: var(--teal); }
.line-end--return { border-color: var(--white); background: var(--purple); box-shadow: 0 0 0 1.5px var(--purple); }
.line-end.is-dimmed { opacity: 0.35; }

/* «البداية: …» tags, shown for the selected line or from zoom 15. */
.line-tag__label {
  position: absolute;
  bottom: 10px;
  left: 0;
  max-width: 13rem;
  overflow: hidden;
  padding: 1px 8px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: var(--teal);
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
}
.line-tag--start.line-tag--outbound .line-tag__label { background: var(--yellow); }
/* The way back starts where the way there ends: its tags go below the point. */
.line-tag--return .line-tag__label { top: 10px; bottom: auto; border-color: var(--white); background: var(--purple); color: var(--white); box-shadow: 0 0 0 1px var(--purple); }

/* Direction arrows along the selected line (rotated in JS through the CSSOM). */
.line-arrow__head {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--white);
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 1px 3px rgba(20, 45, 78, 0.4);
}
.line-arrow__head::before {
  content: "";
  position: absolute;
  top: 3.5px;
  left: 2.5px;
  width: 5px;
  height: 5px;
  border-top: 2px solid var(--navy);
  border-right: 2px solid var(--navy);
  transform: rotate(45deg);
}
.line-arrow--return .line-arrow__head { background: var(--purple); }
.line-arrow--return .line-arrow__head::before { border-color: var(--white); }
/* While a correction is drawn, the line stays underneath for reference, paler (map.js dims its strokes). */
.map--public.is-drawing .line-tag,
.map--public.is-drawing .line-arrow { opacity: 0.45; }

/* ── Sheet head: the title and the search ────────────────────── */

.lines-head__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font: 800 1.5rem/1.2 var(--shell-display, var(--font));
}
.lines-head__count {
  min-width: 2.25rem;
  padding: 3px 10px 1px;
  border-radius: 999px;
  background: var(--teal-50);
  color: var(--lines-teal-text);
  font-size: 1rem;
  text-align: center;
}
.lines-head__count:empty { display: none; }

.lines-search {
  display: flex;
  align-items: center;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
}
.lines-search:focus-within { border-color: var(--navy); background: var(--white); box-shadow: 0 0 0 3px rgba(20, 45, 78, 0.18); }
.lines-search > .icon { flex: none; margin-inline-start: 12px; color: var(--muted); }
.lines-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--navy);
  font: inherit;
  -webkit-user-select: text;
  user-select: text;
}
.lines-search__input:focus { outline: none; }
.lines-search__input::placeholder { color: var(--muted); opacity: 1; }
.lines-search__input::-webkit-search-cancel-button { display: none; }

.lines-search__clear,
.place-filter__clear {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.lines-search__clear:hover,
.place-filter__clear:hover { color: var(--navy); }
.lines-search__clear:focus-visible,
.place-filter__clear:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; }

/* ── The list view ───────────────────────────────────────────── */

/* While typing: «ابحث عن مكان اسمه …» and the places found. */
.place-search { margin: 4px 0 8px; padding: 6px; border: 1px solid var(--border); border-radius: 16px; background: var(--white); box-shadow: 0 1px 2px rgba(20, 45, 78, 0.06); }
.place-search__ask,
.place-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 6px 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--navy);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.place-result { flex-direction: column; align-items: stretch; gap: 0; justify-content: center; }
.place-search__ask:hover,
.place-result:hover { background: var(--surface); }
.place-search__ask:focus-visible,
.place-result:focus-visible { outline: 3px solid var(--navy); outline-offset: -3px; }
.place-search__icon { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: var(--yellow-50); }
.place-search__text { display: flex; flex-direction: column; min-width: 0; }
.place-search__name,
.place-result__name { font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.place-search__sub,
.place-result__sub { font-size: 0.8125rem; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.place-search__status { margin: 4px 8px; font-size: 0.875rem; color: var(--muted); }
.place-search__status:empty { display: none; }
.place-search__results { margin: 0; padding: 0; list-style: none; }
.place-search__results:not(:empty) { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }

/* A place is set: «تمر على بعد 300 م من …», with a way out. */
.place-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
  padding: 2px;
  padding-inline-start: 12px;
  border: 1.5px solid var(--yellow);
  border-radius: 14px;
  background: var(--yellow-50);
  font-weight: 700;
  line-height: 1.4;
}
.place-filter > .icon { flex: none; }
.place-filter__text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.place-filter__clear { color: var(--navy); }
.place-filter:focus { outline: none; }
.place-filter:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* Filter chips: one scrolling row that stays in view above the cards. */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 12px;
  margin: 0 -16px;
  padding: 6px 16px 8px;
  overflow-x: auto;
  background: var(--white);
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
/* More chips past the edge: the row fades out at its end (the left in RTL). */
.filter-bar { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 28px); mask-image: linear-gradient(to left, transparent 0, #000 28px); }
.filter-bar__group { display: flex; flex: none; gap: 6px; }
.filter-bar__group + .filter-bar__group { padding-inline-start: 12px; border-inline-start: 1px solid var(--border); }
.fchip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--control-edge);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.fchip:hover { border-color: var(--border-strong); background: var(--surface); }
/* Pressed: navy and a tick, not colour alone. */
.fchip[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-50); color: var(--navy); box-shadow: inset 0 0 0 1px var(--teal); }
.fchip[aria-pressed="true"]::before { content: "✓"; font-weight: 800; color: var(--lines-teal-text); }
.fchip:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.fchip .icon--seal { width: 18px; height: 18px; }

.lines-status { margin: 8px 0; font-weight: 600; }
.lines-status:empty { display: none; }
.lines-count { display: flex; margin: 0 0 4px; }
.lines-count__clear {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.lines-count__clear:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* ── Cards ── */

/* A card reads top to bottom: the name, «من» over «إلى» on a short stretch of the line in its own
   colour (dashed while unconfirmed, as on the map), then one quiet row: the vehicle, the counts
   that are not zero, and the badges at its end. */
.lines-list { display: grid; gap: 10px; margin: 0; padding: 0 0 4px; list-style: none; }
.line-card {
  position: relative;
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 14px 18px 12px;
  border: 1px solid #E3EAF1;
  border-radius: 18px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  text-align: start;
  box-shadow: 0 1px 2px rgba(20, 45, 78, 0.05), 0 6px 18px -14px rgba(20, 45, 78, 0.35);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s, box-shadow 0.2s, transform 0.2s;
}
.line-card:hover { border-color: #C9D5E1; box-shadow: 0 1px 2px rgba(20, 45, 78, 0.06), 0 12px 26px -16px rgba(20, 45, 78, 0.45); transform: translateY(-1px); }
.line-card:active { transform: none; }
.line-card:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

.line-card__name { font-size: 1.0625rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }

.line-card__route {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding-inline-start: 24px;
  font-size: 0.9375rem;
  line-height: 1.45;
}
/* The stretch of line between the two stops */
.line-card__route::before {
  content: "";
  position: absolute;
  top: 0.8em;
  bottom: 0.8em;
  inset-inline-start: 6.5px;
  width: 4px;
  border-radius: 2px;
  background: var(--line);
}
.line-card.is-new .line-card__route::before { border-radius: 0; background: repeating-linear-gradient(to bottom, var(--line) 0 5px, transparent 5px 9px); }
.line-card__end { position: relative; display: block; color: #2A4060; font-weight: 600; }
/* A long place name stops after two lines (the marker sits outside, so it is not clipped) */
.line-card__end > [data-field] {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
}
/* Start: a yellow circle; end: a teal square (as on the map) */
.line-card__end::before {
  content: "";
  position: absolute;
  top: calc(0.725em - 7px);
  inset-inline-start: -24px;
  width: 13px;
  height: 13px;
  border: 2.5px solid var(--navy);
  box-sizing: border-box;
  box-shadow: 0 0 0 2px var(--white);
}
.line-card__end--from::before { border-radius: 50%; background: var(--yellow); }
.line-card__end--to::before { border-radius: 3px; background: var(--teal); }

.line-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding-top: 10px;
  border-top: 1px solid #EEF2F6;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}
.line-card__vehicle { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.line-card__vehicle .icon { width: 16px; height: 16px; color: #7A8CA0; }
.line-card__stat { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.line-card__stat .icon { width: 15px; height: 15px; }
.line-card__stat--ok { color: var(--lines-teal-text); }
.line-card__stat--bad { color: var(--lines-red-text); }
.line-card__badges { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.line-card__badges:not(:has(> :not([hidden]))) { display: none; }
.line-card__seal,
.line-card__gps {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.line-card__seal { padding-inline-start: 3px; background: var(--navy); color: var(--white); }
.line-card__seal .icon--seal { width: 16px; height: 16px; }
.line-card__gps { background: var(--teal-50); color: var(--lines-teal-text); }

/* ── Empty states and the legend ── */

.lines-empty { padding: 20px 4px 8px; text-align: center; }
.lines-empty__text { margin: 0 0 4px; font-size: 1.0625rem; font-weight: 700; }
.lines-empty__hint { margin: 0 0 14px; color: var(--muted); }
.lines-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.lines-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid var(--control-edge);
  border-radius: 999px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.lines-btn:hover { background: var(--surface); color: var(--navy); }
.lines-btn--primary { border-color: var(--navy); background: var(--navy); color: var(--white); }
.lines-btn--primary:hover { background: var(--navy-700); color: var(--white); }
.lines-btn:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

.lines-legend { margin: 16px 0 0; border-top: 1px solid var(--border); }
.lines-legend summary { display: flex; align-items: center; min-height: 44px; font-size: 0.9375rem; font-weight: 700; cursor: pointer; }
.lines-legend summary:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.lines-legend .legend { margin: 4px 0 0; }

/* ── One line: head and detail ───────────────────────────────── */

.detail-head__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
.detail-head__back,
.detail-head__share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s;
}
.detail-head__back { margin-inline-start: -8px; padding-inline-start: 8px; }
.detail-head__share { margin-inline-end: -8px; color: var(--lines-teal-text); }
.detail-head__back:hover,
.detail-head__share:hover { background: var(--surface); }
.detail-head__back:focus-visible,
.detail-head__share:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.detail-head__back .icon,
.detail-head__share .icon { width: 18px; height: 18px; }
.detail-head__title { margin: 0; font: 800 1.375rem/1.35 var(--shell-display, var(--font)); overflow-wrap: anywhere; }

.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: #34496A;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
}
.detail-badge--useful { padding-inline-start: 4px; border-color: var(--navy); background: var(--navy); color: var(--white); font-weight: 700; }
.detail-badge--new { border-color: var(--yellow); background: var(--yellow-50); font-weight: 700; }
.detail-badge--gps { border-color: var(--teal); background: var(--teal-50); color: var(--lines-teal-text); font-weight: 700; }

/* Both directions, each with its map colour, and chips to show / hide each. */
.detail-route { margin: 0 0 8px; padding: 8px 12px; border-radius: 14px; background: var(--surface); }
.sheet__meta { margin: 4px 0; color: var(--muted); overflow-wrap: anywhere; }
.detail-route .sheet__meta { color: var(--navy); font-weight: 600; }
.sheet__dir { display: flex; align-items: center; gap: 8px; }
/* «صفحة الخط»: a quiet text link to the line's own page (/lines/12-…). */
.sheet__page a { display: inline-flex; align-items: center; min-height: 44px; color: var(--navy); font-weight: 600; }
.dir-swatch { flex-shrink: 0; width: 24px; height: 5px; border-radius: 3px; background: var(--teal); }
.dir-swatch--return { background: var(--purple); }
.dir-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.dir-chip {
  --dir: var(--teal);
  --dir-tint: var(--teal-50);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px 0 12px;
  border: 1.5px solid var(--control-edge);
  border-radius: 12px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.dir-chip--return { --dir: var(--purple); --dir-tint: #F3EAFB; }
/* A small box in the direction's colour: empty when hidden, ticked when shown (not colour alone) */
.dir-chip::before {
  content: "";
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 2px solid var(--dir);
  border-radius: 5px;
  color: var(--white);
  font-size: 0.6875rem;
  font-weight: 800;
  line-height: 1;
}
.dir-chip:hover { border-color: var(--dir); }
.dir-chip[aria-pressed="true"] { border-color: var(--dir); background: var(--dir-tint); color: var(--navy); }
.dir-chip[aria-pressed="true"]::before { content: "✓"; background: var(--dir); }
.dir-chip:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* The counts read as facts, not as buttons */
.counters { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 12px 0 4px; }
.counter { font-weight: 700; font-size: 0.9375rem; color: var(--muted); }
.counter--ok { color: var(--lines-teal-text); }
.counter--wrong { color: var(--lines-red-text); }

.sheet__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.sheet__actions .btn { min-height: 44px; padding: 8px 12px; border-radius: 12px; font-size: 0.9375rem; }
.btn--vote { border: 1.5px solid var(--control-edge); background: var(--white); color: var(--navy); transition: background-color 0.15s, border-color 0.15s; }
.btn--vote .icon { width: 18px; height: 18px; }
.btn--vote-ok .icon { color: var(--lines-teal-text); }
.btn--vote-wrong .icon { color: var(--lines-red-text); }
.btn--vote:hover { border-color: var(--border-strong); background: var(--surface); }
/* My answer: «صحيح، أركبه» stays tinted (#sheet-myvote also says it in words); an open form keeps its button marked */
.btn--vote-ok[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-50); }
.btn--vote-wrong[aria-expanded="true"] { border-color: var(--lines-red-text); background: #FDF2F2; }
.btn--quiet { grid-column: 1 / -1; border: 0; background: var(--quiet); color: var(--navy); }
.btn--quiet .icon { width: 17px; height: 17px; color: var(--muted); }
.btn--quiet:hover { background: var(--quiet-hover); }
.btn--quiet[aria-expanded="true"] { background: var(--quiet-hover); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.sheet__form { margin: 8px 0 12px; padding: 12px; border: 1.5px solid var(--border); border-radius: var(--radius-input); }
/* «عدّل الطريق الحالي» / «ارسم من جديد»: side by side where there is room, one above the other on phones. */
.draw-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.draw-choice .btn { flex: 1 1 12rem; }
.sheet__subtitle { margin: 16px 0 8px; font-size: 1rem; }

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

/* ── From 900px: the sheet is a side panel ───────────────────── */

/* Phones: a slimmer head, so the list starts higher at «half». */
@media (max-width: 899.98px) {
  .lines-head__title { margin-bottom: 8px; font-size: 1.3125rem; }
  .detail-head__title { font-size: 1.25rem; }
  /* The drawing bar keeps the map in view: the editing tips (and their keyboard part) stay for wider screens. */
  .draw-bar__hint { display: none; }
  .draw-bar__row .btn--small { padding: 6px 10px; }
}

@media (min-width: 900px) {
  .filter-bar { flex-wrap: wrap; row-gap: 8px; margin: 0 -20px; padding: 8px 20px; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  /* A mouse, a wider panel: smaller chips, so the filters take two short rows */
  .filter-bar__group { flex-wrap: wrap; gap: 6px; }
  .fchip { min-height: 36px; padding: 0 12px; font-size: 0.875rem; }
  .draw-bar { inset-inline: 16px; bottom: 16px; }
  .map-toast { top: 16px; }
}

@media (forced-colors: active) {
  .fchip[aria-pressed="true"],
  .dir-chip[aria-pressed="true"] { outline: 2px solid CanvasText; }
  /* The search field's focus ring is a box-shadow, which forced colours drop. */
  .lines-search:focus-within { outline: 3px solid Highlight; outline-offset: 2px; }
  .line-card__route::before,
  .line-card__end::before,
  .dir-swatch { forced-color-adjust: none; }
  .line-card__seal,
  .detail-badge--useful { border: 1px solid CanvasText; }
}
