/* =============================================================================
   Roadbooker components, per docs/design/components.md (S1-1).
   Every component and state is shown in /_dev/components/.
   Token values only; a raw value is commented where the spec gives a literal.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Icons (inline SVG line icons, stroke --icon-stroke)
   --------------------------------------------------------------------------- */
.icon {
  width: var(--icon-size-inline);
  height: var(--icon-size-inline);
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--ui { width: var(--icon-size-ui); height: var(--icon-size-ui); }
.icon--perk { width: var(--icon-size-perk); height: var(--icon-size-perk); }
.icon--feature { width: var(--icon-size-feature); height: var(--icon-size-feature); }

.icon-tile {
  display: inline-grid;
  place-items: center;
  width: var(--icon-tile-feature);
  height: var(--icon-tile-feature);
  border-radius: var(--radius-lg);
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  color: var(--accent);
  flex: none;
}
.icon-tile--sm { width: var(--icon-tile-perk); height: var(--icon-tile-perk); }
.icon-tile--muted { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--overlay); border-color: transparent; color: var(--text-2); }

/* ---------------------------------------------------------------------------
   §4 Buttons. Orange is the only action colour. Pills; 48px, small 44px.
   --------------------------------------------------------------------------- */
.btn {
  --btn-h: var(--btn-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--btn-h);
  min-width: var(--target-min);
  padding: 0 var(--btn-pad-x);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: var(--type-button);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--dur-base), border-color var(--dur-base), color var(--dur-base), box-shadow var(--dur-base), transform var(--dur-fast);
}
.btn--sm { --btn-h: var(--btn-height-sm); padding: 0 var(--btn-pad-x-sm); }
.btn--lg { padding: 0 var(--space-7); font-size: var(--type-body); }
.btn--block { display: flex; width: 100%; }

.btn--primary { background: var(--accent); color: var(--on-accent); font-weight: var(--fw-bold); box-shadow: var(--shadow-cta); }
.btn--primary:hover { background: var(--accent-lt); color: var(--on-accent); box-shadow: var(--shadow-cta-hover); transform: var(--lift-sm); }
.btn--primary.btn--hero:hover { transform: var(--lift-md); }        /* landing hero only */
.btn--primary:active { background: var(--accent); transform: none; }

.btn--secondary { background: var(--surface); color: var(--text-1); border-color: var(--border-md); }
.btn--secondary:hover { background: var(--overlay); color: var(--text-1); border-color: var(--field-border-hover); }
.btn--secondary:active { background: var(--elevated); }

.btn--ghost { background: transparent; color: var(--text-1); }
.btn--ghost:hover { background: rgba(255,255,255,0.06); color: var(--text-1); }   /* spec literal */
.btn--ghost:active { background: rgba(255,255,255,0.10); }

.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger-bd); }
.btn--danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn--danger-solid { background: var(--danger); color: var(--on-danger); font-weight: var(--fw-bold); }
.btn--danger-solid:hover { color: var(--on-danger); filter: brightness(1.08); }

.btn--link {
  min-width: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-semibold);
}
.btn--link:hover { color: var(--accent-lt); text-decoration: underline; text-underline-offset: 3px; }

/* Disabled: prefer aria-disabled (stays focusable, explains itself) */
.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--overlay);
  color: var(--text-disabled);
  border-color: transparent;
  box-shadow: none;
  transform: none;
  filter: none;
  cursor: not-allowed;
}
.btn--secondary[disabled], .btn--secondary[aria-disabled="true"],
.btn--danger[disabled], .btn--danger[aria-disabled="true"] { background: var(--surface); border-color: var(--border); }
.btn--ghost[disabled], .btn--ghost[aria-disabled="true"], .btn--link[aria-disabled="true"] { background: transparent; }

.btn[aria-busy="true"] { cursor: progress; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; flex: none; }
@media (prefers-reduced-motion: no-preference) { .spinner { animation: rb-spin 0.8s linear infinite; } }
@keyframes rb-spin { to { transform: rotate(360deg); } }

/* Icon button: 44x44; radius md (map/toolbar) or full (close) */
.btn--icon, .btn-icon {
  display: inline-grid;
  place-items: center;
  width: var(--target-min);
  height: var(--target-min);
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-1);
  transition: background-color var(--dur-base), color var(--dur-base);
}
.btn--icon:hover, .btn-icon:hover { background: var(--overlay); }
.btn--icon.is-round, .btn-icon.is-round { border-radius: var(--radius-full); }
.btn--icon .icon, .btn-icon .icon { width: var(--icon-size-ui); height: var(--icon-size-ui); }

/* Store button (Google Play): light fill, dark text, radius 16. Replace with
   the official badge artwork when the designer supplies it (brand/). */
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--text-1);
  color: var(--on-accent);
  text-decoration: none;
  transition: opacity var(--dur-base), transform var(--dur-fast);
}
.store-btn:hover { color: var(--on-accent); opacity: 0.92; transform: var(--lift-sm); }
.store-btn > svg { width: 26px; height: 28px; flex: none; }
.store-btn__text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.store-btn__small { font-size: 11px; font-weight: var(--fw-semibold); letter-spacing: 0.04em; text-transform: uppercase; color: #3A4D61; /* 8.0:1 on --text-1 */ }
.store-btn__big { font-size: 18px; font-weight: var(--fw-bold); letter-spacing: -0.01em; }

/* §4.3 Links */
.link-target { display: inline-flex; align-items: center; min-height: var(--target-min); }

.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; margin: 0; padding: 0; font-size: var(--type-xs); }
.breadcrumb li + li::before { content: "/"; color: var(--text-3); padding: 0 var(--space-2); }
.breadcrumb a { display: inline-flex; align-items: center; min-height: var(--target-min); color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-1); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text-1); }
.breadcrumb a { min-width: var(--target-min); }

/* ---------------------------------------------------------------------------
   Badges and chips
   --------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  border-radius: var(--radius-full);
  background: var(--accent-bg);
  border: 1px solid var(--accent-bd);
  color: var(--accent);
  font-size: var(--type-eyebrow);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-badge);
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}
.badge--solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.badge--info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
@media (prefers-reduced-motion: no-preference) { .badge__dot--pulse { animation: rb-pulse 2s infinite; } }
@keyframes rb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.count-badge {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--overlay); color: var(--text-1);
  font-size: var(--type-xs); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums;
}

/* Neutral chip / R13 status chip ("iOS: coming soon") */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-md);
  background: transparent;
  color: var(--text-2);
  font-size: var(--type-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  white-space: nowrap;
}
.chip--soon { color: var(--text-3); border-color: var(--border); padding-inline: var(--space-3); min-height: 32px; }
.chip--neutral { background: var(--overlay); border-color: transparent; }
.chip .icon { width: 14px; height: 14px; }

/* §10.1 Warning chip: tint bg, status-colour icon, --text-1 label */
.chip--info, .chip--caution, .chip--warning, .chip--critical, .chip--danger, .chip--success { color: var(--text-1); }
.chip--info     { background: var(--info-bg);    border-color: var(--info-bd); }
.chip--caution, .chip--warning { background: var(--warning-bg); border-color: var(--warning-bd); }
.chip--critical, .chip--danger { background: var(--danger-bg);  border-color: var(--danger-bd); }
.chip--success  { background: var(--success-bg); border-color: var(--success-bd); }
.chip--info .icon     { color: var(--info); }
.chip--caution .icon, .chip--warning .icon { color: var(--warning); }
.chip--critical .icon, .chip--danger .icon { color: var(--danger); }
.chip--success .icon  { color: var(--success); }

/* §7.1 Day badge: fill = route colour, number in --day-badge-fg */
.day-badge {
  --day-color: var(--route-day-1);
  display: inline-grid;
  place-items: center;
  width: var(--day-badge-size);
  height: var(--day-badge-size);
  border-radius: 50%;
  background: var(--day-color);
  color: var(--day-badge-fg);
  box-shadow: var(--day-badge-ring);
  font-size: 13px;
  font-weight: var(--fw-extrabold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  flex: none;
}
.day-badge--sm { width: var(--day-badge-size-sm); height: var(--day-badge-size-sm); font-size: 11px; }
.day-badge--lg { width: var(--day-badge-size-lg); height: var(--day-badge-size-lg); font-size: 18px; }
[data-day-color="1"]  { --day-color: var(--route-day-1); }
[data-day-color="2"]  { --day-color: var(--route-day-2); }
[data-day-color="3"]  { --day-color: var(--route-day-3); }
[data-day-color="4"]  { --day-color: var(--route-day-4); }
[data-day-color="5"]  { --day-color: var(--route-day-5); }
[data-day-color="6"]  { --day-color: var(--route-day-6); }
[data-day-color="7"]  { --day-color: var(--route-day-7); }
[data-day-color="8"]  { --day-color: var(--route-day-8); }
[data-day-color="9"]  { --day-color: var(--route-day-9); }
[data-day-color="10"] { --day-color: var(--route-day-10); }

/* §7.2 Route swatch */
.route-swatch { display: inline-block; width: 24px; height: 4px; border-radius: var(--radius-full); background: var(--day-color, var(--route-day-1)); flex: none; }
.route-swatch--unpaved { background: repeating-linear-gradient(90deg, var(--day-color, var(--route-day-1)) 0 8px, transparent 8px 14px); }

/* ---------------------------------------------------------------------------
   §6 Cards and panels
   --------------------------------------------------------------------------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--card-pad);
}
.card--lg { padding: var(--card-pad-lg); }
.card h3 { margin-bottom: var(--space-2); }
.card p { font-size: var(--type-small); line-height: var(--lh-relaxed); }
.card .icon-tile { margin-bottom: var(--space-5); }
/* Linked card: the real <a> is on the title, stretched over the card */
.card--link { transition: border-color var(--dur-card), transform var(--dur-card); }
.card--link:hover { border-color: var(--accent-bd); transform: var(--lift-card); }
.card--link .card__link { color: inherit; text-decoration: none; }
.card--link .card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card--link .card__link:focus-visible { outline: none; }
.card--link:has(.card__link:focus-visible) { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

/* §20 Coming-soon card */
.card--soon { border: 1px dashed var(--border-md); }
.card--soon:hover { border-color: var(--field-border-hover); transform: none; }
.card--soon .card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-4); }
.card--soon h3 { font-size: var(--type-h4); }
.card--soon p { font-size: var(--type-xs); color: var(--text-2); }
.card--soon .icon-tile { margin: 0; }
.card .card__more { margin-top: var(--space-3); color: var(--accent); font-size: var(--type-xs); font-weight: var(--fw-semibold); text-decoration: underline; text-underline-offset: 3px; }   /* visual cue; the stretched title link is the one tab stop */

.offer-panel {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--accent-bd);
  border-radius: var(--radius-2xl);
  padding: var(--space-8) var(--space-5);
  text-align: center;
}
.offer-panel::before {
  content: "";
  position: absolute;
  inset: -40% 10% auto;
  height: 320px;
  background: var(--grad-card-glow);
  pointer-events: none;
}
.offer-panel > * { position: relative; }
@media (min-width: 768px) { .offer-panel { padding: var(--space-10); } }

.panel {
  background: var(--surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* Check list with green tick circles (PRO) */
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3) var(--space-6); text-align: left; }
@media (min-width: 480px) { .ticks--2 { grid-template-columns: 1fr 1fr; } }
.ticks li { display: flex; align-items: center; gap: var(--space-3); color: var(--text-1); font-size: var(--type-small); font-weight: var(--fw-medium); }
.ticks li::before {
  content: "";
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--success-bg) url("../img/icons/tick-success.svg?v=6a945f3") center / 12px no-repeat;
  border: 1px solid var(--success-bd);
}

/* ---------------------------------------------------------------------------
   §10.2 Callouts (info / caution / critical / success)
   --------------------------------------------------------------------------- */
.callout {
  --c: var(--info); --c-bg: var(--info-bg); --c-bd: var(--info-bd);
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--c-bg);
  border: 1px solid var(--c-bd);
  color: var(--text-2);
  font-size: var(--type-small);
  line-height: var(--lh-body);
}
.callout > .icon { color: var(--c); width: 20px; height: 20px; margin-top: 1px; }
.callout > :not(.icon) { grid-column: 2; }
.callout__meta { color: var(--c); font-size: var(--type-eyebrow); font-weight: var(--fw-bold); letter-spacing: var(--ls-badge); text-transform: uppercase; }
.callout__title { color: var(--text-1); font-weight: var(--fw-bold); font-size: var(--type-body); line-height: var(--lh-snug); overflow-wrap: anywhere; }   /* QA-W1: a long unbroken address wraps at 375 */
.callout--compact .callout__title { font-size: var(--type-small); }
.callout__body { color: var(--text-2); overflow-wrap: anywhere; }
.callout ul { margin: var(--space-1) 0 0; padding-left: 1.2em; }
.callout a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.callout--caution, .callout--warning { --c: var(--warning); --c-bg: var(--warning-bg); --c-bd: var(--warning-bd); }
.callout--critical, .callout--danger { --c: var(--danger); --c-bg: var(--danger-bg); --c-bd: var(--danger-bd); }
.callout--success { --c: var(--success); --c-bg: var(--success-bg); --c-bd: var(--success-bd); }
.callout--success .callout__body { color: var(--text-1); }

/* ---------------------------------------------------------------------------
   §5 Forms. Labels above, hint, control, error. Inputs carry no name attr.
   --------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field + .field, .field + .fieldset, .fieldset + .field, .fieldset + .fieldset { margin-top: var(--space-5); }
.field__label, .fieldset > legend {
  color: var(--field-label-color);
  font-size: var(--field-label-size);
  font-weight: var(--field-label-weight);
  line-height: 1.4;
}
.field__optional { color: var(--text-3); font-weight: var(--fw-regular); }
.field__help { color: var(--field-help-color); font-size: var(--type-xs); line-height: 1.5; }
.field__help--met { color: var(--success-text); display: inline-flex; gap: 6px; align-items: center; }
.field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  color: var(--field-error-color);
  font-size: var(--type-small);
  font-weight: var(--fw-medium);
  line-height: 1.45;
}
.field__error .icon { margin-top: 2px; }
.field__row { display: grid; gap: var(--space-5); }
@media (min-width: 768px) { .field__row { grid-template-columns: 1fr 1fr; } .field__row > .field + .field { margin-top: 0; } }

.input, .select, .textarea {
  width: 100%;
  min-height: var(--field-height);
  padding: 0 var(--field-pad-x);
  border-radius: var(--field-radius);
  border: 1px solid var(--field-border);
  background-color: var(--field-bg);
  color: var(--text-1);
  font-size: var(--type-body);
  line-height: 1.4;
  color-scheme: dark;
  transition: border-color var(--dur-base), background-color var(--dur-base);
  appearance: none;
}
.textarea { min-height: 96px; padding-block: var(--space-3); line-height: var(--lh-body); resize: vertical; }
.select {
  padding-right: 44px;
  background-image: url("../img/icons/chevron-down.svg?v=6a945f3");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}
.input::placeholder, .textarea::placeholder { color: var(--placeholder); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--field-border-hover); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--field-border-focus);
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--field-error-border);
  background-color: var(--field-error-bg);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background-color: var(--field-bg-disabled);
  border-color: var(--border);
  color: var(--text-disabled);
  cursor: not-allowed;
}
.input[readonly] { background: var(--surface); border-color: var(--border-md); font-family: var(--font-mono); font-size: 14px; }
.input--pill { border-radius: var(--radius-full); min-height: 52px; padding-inline: var(--space-5); }

/* Password with a Show toggle; numbers with a unit */
.input-wrap { position: relative; display: flex; }
.input-wrap .input { flex: 1; }
.input-wrap--action .input { padding-right: 52px; }
.input-wrap__action { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
.input-wrap__unit { position: absolute; right: var(--field-pad-x); top: 50%; transform: translateY(-50%); color: var(--text-2); font-size: var(--type-small); pointer-events: none; }
.input-wrap--unit .input { padding-right: 48px; font-variant-numeric: tabular-nums; }

.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset > legend { padding: 0; margin-bottom: var(--space-2); }

/* §5.5 Checkbox / radio rows: 20px box, whole row is the label, >= 44px */
.check {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--target-min);
  color: var(--text-1);
  font-size: var(--type-body);
  cursor: pointer;
}
.check__sub { display: block; color: var(--text-2); font-size: var(--type-xs); }
.check input {
  appearance: none;
  width: max(var(--control-size), var(--target-min-dense));   /* UI fix L-1: at least 24 px (WCAG 2.5.8) */
  height: max(var(--control-size), var(--target-min-dense));
  margin: 0;
  flex: none;
  border: 1.5px solid var(--field-border);
  border-radius: 6px;
  background: var(--field-bg);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.check input[type="radio"] { border-radius: 50%; }
.check input::before {
  content: "";
  width: 14px; height: 14px;
  transform: scale(0);
  transition: transform var(--dur-fast);
  background: var(--on-accent);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.check input[type="radio"]::before { clip-path: circle(50%); width: 10px; height: 10px; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::before { transform: scale(1); }
.check input:hover:not(:disabled) { border-color: var(--field-border-hover); }
.check input:checked:hover { border-color: var(--accent); }
.check input:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.check input:disabled { border-color: var(--border-md); background: var(--field-bg-disabled); cursor: not-allowed; }
.check:has(input:disabled) { color: var(--text-disabled); cursor: not-allowed; }

/* §5.6 Switch: <button role="switch" aria-checked> + visible label + On/Off */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--target-min);
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-1);
  font-size: var(--type-body);
  text-align: left;
}
.switch__track {
  position: relative;
  width: 44px; height: 24px;
  flex: none;
  border-radius: var(--radius-full);
  background: var(--overlay);
  border: 1px solid var(--field-border);
  transition: background-color var(--dur-base), border-color var(--dur-base);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-1);
  transition: transform var(--dur-base), background-color var(--dur-base);
}
.switch[aria-checked="true"] .switch__track { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .switch__track::after { transform: translateX(20px); background: var(--on-accent); }
.switch__state { color: var(--text-2); font-size: var(--type-small); }
.switch:focus-visible { outline: none; }
.switch:focus-visible .switch__track { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }

/* §5.7 Segmented control: a radio group styled as joined buttons */
.segmented {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  min-width: 0;
}
.segmented legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.segmented label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--target-min);        /* the option itself is 44 px (border-box) */
  min-width: var(--target-min);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: calc(var(--radius-md) - 3px);
  color: var(--text-2);
  font-size: var(--type-small);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  white-space: nowrap;
}
.segmented label:hover { color: var(--text-1); }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented .seg-check { display: none; width: 14px; height: 14px; }
.segmented label:has(input:checked) { background: var(--elevated); color: var(--text-1); border-color: var(--field-border); }
.segmented label:has(input:checked) .seg-check { display: block; }
.segmented label:has(input:focus-visible) { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 1px; }

/* §5.8 Form status (role="status") and error summary */
.form-status { margin-top: var(--space-4); }
.form-status:empty { display: none; }
.form-note { margin-bottom: var(--space-5); }

/* ---------------------------------------------------------------------------
   §1 Header and navigation (rendered by layout.js)
   --------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(var(--blur-nav));
  backdrop-filter: blur(var(--blur-nav));
  border-bottom: 1px solid var(--border);
}
.site-header__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--nav-height);
}
.site-header--app .site-header__bar { max-width: none; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target-min);
  padding-block: 6px;
  margin-right: auto;
  color: var(--text-1);
  text-decoration: none;
  font-size: var(--type-logo);
  font-weight: var(--fw-bold);
  letter-spacing: -0.3px;
  border-radius: var(--radius-sm);
}
.brand:hover { color: var(--text-1); }
.brand img { height: var(--logo-wordmark-height); width: auto; }
.brand__text-mark {         /* placeholder until logo-wordmark.svg exists */
  display: inline-grid;
  place-items: center;
  width: var(--logo-mark-size);
  height: var(--logo-mark-size);
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-sky), var(--brand-lime) 55%, var(--accent));
  color: var(--on-accent);
  font-weight: var(--fw-extrabold);
  font-size: 18px;
}
.site-footer .brand img { height: var(--logo-mark-size-footer); }
.site-footer .brand__text-mark { width: var(--logo-mark-size-footer); height: var(--logo-mark-size-footer); font-size: 15px; }

.site-nav { display: none; margin-right: auto; }
.site-nav ul { display: flex; align-items: center; gap: var(--space-1); list-style: none; margin: 0; padding: 0; }
.site-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: var(--type-small);
  font-weight: var(--fw-medium);
  text-decoration: none;
}
.site-nav a:hover, .site-nav a[aria-current] { color: var(--text-1); }
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px;
  bottom: calc((var(--target-min) - var(--nav-height)) / 2);   /* sits on the header's bottom edge */
  height: 2px;
  background: var(--accent);
}
.site-header__actions { display: none; align-items: center; gap: var(--space-2); }

.menu-toggle { margin-right: calc(-1 * var(--space-2)); }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

.mobile-nav {
  position: absolute;
  inset: 100% 0 auto;
  z-index: var(--z-menu);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  max-height: calc(100dvh - var(--nav-height));
  overflow-y: auto;
}
@media (prefers-reduced-motion: no-preference) { .mobile-nav:not([hidden]) { animation: rb-fade-in var(--dur-card) ease; } }
.mobile-nav ul { list-style: none; margin: 0; padding: 0; }
.mobile-nav li { border-bottom: 1px solid var(--border); }
.mobile-nav li > a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 var(--gutter);
  color: var(--text-1);
  font-size: var(--type-body);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}
.mobile-nav li > a:hover { background: var(--overlay); }
.mobile-nav li > a[aria-current="page"] { color: var(--accent); }
.mobile-nav li > a:focus-visible { outline-offset: -3px; }
.mobile-nav__actions { display: grid; gap: var(--space-3); padding: var(--space-4) var(--gutter); }
.mobile-nav__meta { padding: var(--space-3) var(--gutter); color: var(--text-3); font-size: var(--type-xs); border-bottom: 1px solid var(--border); }

/* §1.2 Account menu (App variant) */
.account { position: relative; }
.account__btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--target-min);
  padding: 0 var(--space-4) 0 var(--space-3);
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border-md);
  color: var(--text-1);
  font-size: var(--type-small);
  font-weight: var(--fw-semibold);
}
.account__btn:hover { background: var(--overlay); }
.account__btn[aria-expanded="true"] .icon:last-child { transform: rotate(180deg); }
.account__menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  z-index: var(--z-menu);
  min-width: 220px;
  padding: var(--space-1) 0;
  background: var(--menu-bg);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  list-style: none;
  margin: 0;
}
.account__menu li > span { display: block; padding: var(--space-2) var(--space-4); color: var(--text-3); font-size: var(--type-xs); }
.account__menu a {
  display: flex; align-items: center; gap: var(--space-2);
  min-height: var(--target-min);
  padding: 0 var(--space-4);
  color: var(--text-1);
  font-size: var(--type-small);
  text-decoration: none;
}
.account__menu a:hover { background: var(--overlay); color: var(--text-1); }
.account__menu a:focus-visible { outline-offset: -3px; }

@media (min-width: 768px) {
  .site-nav { display: block; }
  .site-header__actions { display: flex; }
  .menu-toggle, .mobile-nav { display: none !important; }
}
@media (max-width: 479.98px) {
  .account__btn .account__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .account__btn { padding: 0 var(--space-3); }
}

/* §2 Preview banner: after the header, before <main>. Sticky with the header
   from md; scrolls away on phone. No dismiss in Stage 1. */
.preview-banner {
  background: var(--base);
  border-bottom: 1px var(--preview-border-style) var(--preview-bd);
}
.preview-banner__inner {
  background: var(--preview-bg);
}
.preview-banner__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-3);
  min-height: var(--preview-height);
  padding-block: var(--space-1);
}
.preview-banner__pill {
  position: relative;
  flex: none;
  display: inline-block;
  margin-right: var(--space-2);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--preview-pill-bg);
  color: var(--preview-pill-fg);
  font-size: var(--type-eyebrow);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-badge);
  text-transform: uppercase;
  line-height: 1.4;
  vertical-align: 1px;
}
.preview-banner__text { flex: 1 1 14rem; color: var(--text-1); font-size: var(--type-small); line-height: 1.6; padding-block: var(--space-1); }
.preview-banner__short { display: none; }
@media (max-width: 479.98px) {
  .preview-banner__full { display: none; }
  .preview-banner__short { display: inline; }
  .preview-banner__text { flex-basis: auto; }
}
.preview-banner__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--target-min);
  color: var(--accent);
  font-size: var(--type-small);
  font-weight: var(--fw-semibold);
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (min-width: 480px) and (max-width: 767.98px) { .preview-banner__link { flex-basis: 100%; } }
@media (min-width: 768px) {
  .preview-banner { position: sticky; top: var(--nav-height); z-index: calc(var(--z-header) - 1); }
  .has-preview { --sticky-offset: calc(var(--nav-height) + var(--preview-height)); }
}

/* ---------------------------------------------------------------------------
   §3 Footer (full and compact)
   --------------------------------------------------------------------------- */
.site-footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding-block: var(--space-10) var(--space-7);
  color: var(--text-3);
  font-size: var(--type-xs);
}
@media (min-width: 1024px) { .site-footer { padding-top: var(--space-12); } }
.site-footer__grid { display: grid; gap: var(--space-7); }
@media (min-width: 480px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--space-9); } }
.site-footer__brand { grid-column: 1 / -1; }
@media (min-width: 1024px) { .site-footer__brand { grid-column: auto; } }
.site-footer__brand .brand { margin: 0 0 var(--space-3); }
.site-footer__brand p { max-width: 280px; color: var(--text-3); line-height: var(--lh-body); font-size: var(--type-xs); }
.site-footer h2 {
  margin-bottom: var(--space-2);
  color: var(--text-3);
  font-size: var(--type-fine);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-footer-h);
  text-transform: uppercase;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  color: var(--text-2);
  min-width: var(--target-min);
  font-size: var(--type-xs);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.site-footer li a:hover { color: var(--text-1); text-decoration: underline; text-underline-offset: 3px; }
.site-footer li a[aria-current="page"] { color: var(--text-1); }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  font-size: var(--type-fine);
  color: var(--text-3);
}
.site-footer--compact { padding-block: var(--space-5); }
.site-footer--compact .site-footer__bottom { margin: 0; padding-block: 0; border: 0; }   /* UI review 2026-11: was padding: 0, which removed the .container gutter (links touched the edge) */
.site-footer--compact ul { display: flex; flex-wrap: wrap; column-gap: var(--space-5); }

/* ---------------------------------------------------------------------------
   §14 Dialogs: native <dialog>; centred from md, bottom sheet on phone
   --------------------------------------------------------------------------- */
.dialog {
  --dialog-pad: 24px;
  width: 100%;
  max-width: 100%;
  max-height: 92dvh;
  margin: auto 0 0;
  padding: 0;
  border: 1px solid var(--dialog-border);
  border-bottom: 0;
  border-radius: var(--map-sheet-radius);
  background: var(--dialog-bg);
  color: var(--text-2);
  box-shadow: var(--shadow-dialog);
  overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: var(--scrim); }
@media (prefers-reduced-motion: no-preference) {
  .dialog[open] { animation: rb-rise-in var(--dur-card) var(--ease-standard); }
  .dialog[open]::backdrop { animation: rb-fade-in var(--dur-card) ease; }
}
@keyframes rb-rise-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rb-fade-in { from { opacity: 0; } to { opacity: 1; } }
.dialog::before {   /* decorative grab handle on phone (not draggable) */
  content: "";
  display: block;
  width: 36px; height: 4px;
  margin: var(--space-3) auto 0;
  border-radius: 2px;
  background: var(--border-md);
  flex: none;
}
.dialog__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--dialog-pad) 0;
}
.dialog__title { flex: 1; font-size: var(--type-h-modal); font-weight: var(--fw-extrabold); letter-spacing: var(--ls-heading); line-height: var(--lh-snug); padding-top: 8px; }
.dialog__close { margin-right: calc(-1 * var(--space-2)); color: var(--text-2); border-radius: var(--radius-full); }
.dialog__close:hover { color: var(--text-1); }
.dialog__body { padding: var(--space-4) var(--dialog-pad); overflow-y: auto; flex: 1; }
.dialog__body > * + * { margin-top: var(--space-4); }
.dialog__foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--dialog-pad) var(--dialog-pad);
  border-top: 1px solid var(--border);
}
.dialog__foot .btn { width: 100%; }
@media (min-width: 768px) {
  .dialog {
    --dialog-pad: 32px;
    width: min(var(--dialog-width), 100vw - 48px);
    max-height: calc(100dvh - 48px);
    margin: auto;
    border-bottom: 1px solid var(--dialog-border);
    border-radius: var(--dialog-radius);
  }
  .dialog--lg { width: min(var(--dialog-width-lg), 100vw - 48px); }
  .dialog::before { display: none; }
  .dialog__head { padding-top: var(--dialog-pad); }
  .dialog__foot { flex-direction: row-reverse; justify-content: flex-start; }   /* primary rightmost */
  .dialog__foot .btn { width: auto; }
}
html.has-modal { overflow: hidden; }

/* ---------------------------------------------------------------------------
   §16 Toasts: one region per page, one toast at a time
   --------------------------------------------------------------------------- */
.toasts {
  position: fixed;
  z-index: var(--z-toast);
  left: var(--space-4);
  right: var(--space-4);
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
@media (min-width: 768px) { .toasts { left: auto; right: var(--space-6); bottom: var(--space-6); align-items: flex-end; } }
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: min(var(--toast-width), 100%);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  box-shadow: var(--shadow-pop);
  color: var(--text-1);
  font-size: var(--type-small);
  line-height: 1.5;
  pointer-events: auto;
}
.toast > .icon { color: var(--info); }
.toast--success > .icon { color: var(--success); }
.toast--caution > .icon, .toast--warning > .icon { color: var(--warning); }
.toast--critical > .icon, .toast--danger > .icon { color: var(--danger); }
.toast__msg { flex: 1; min-width: 0; padding-block: var(--space-2); overflow-wrap: anywhere; }   /* QA-W1 */
.toast__close { color: var(--text-2); border-radius: var(--radius-full); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rb-rise-in var(--dur-card) var(--ease-standard); } }

/* ---------------------------------------------------------------------------
   §15 Tabs (WAI-ARIA, automatic activation)
   --------------------------------------------------------------------------- */
.tabs__list {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.tabs__list::-webkit-scrollbar { display: none; }
.tabs__tab {
  flex: none;
  min-height: var(--target-min);
  padding: 0 var(--space-4);
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-2);
  font-size: var(--type-small);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.tabs__tab:hover { color: var(--text-1); }
.tabs__tab[aria-selected="true"] { color: var(--text-1); border-bottom-color: var(--accent); }
.tabs__tab:focus-visible { outline-offset: -3px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tabs__panel { padding-top: var(--space-5); }
.tabs__panel:focus-visible { outline-offset: 4px; border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------------------
   §9 Stat tiles (<dl class="stats">)
   --------------------------------------------------------------------------- */
/* Wrap in .stats-wrap (container) so the column count follows the panel width */
.stats-wrap { container-type: inline-size; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); margin: 0; }
@container (min-width: 420px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stats--4 { grid-template-columns: repeat(2, 1fr); }
@container (min-width: 420px) { .stats--4 { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--stat-bg);
  border: 1px solid var(--stat-border);
  border-radius: var(--stat-radius);
  padding: var(--stat-pad);
  min-width: 0;
}
.stat dt { color: var(--stat-label); font-size: var(--type-xs); font-weight: var(--fw-semibold); }
.stat dd { margin: 0; }
.stat__value { display: block; color: var(--text-1); font-size: var(--type-stat); font-weight: var(--fw-extrabold); font-variant-numeric: tabular-nums; letter-spacing: var(--ls-title); line-height: 1.25; }
.stat__unit, .unit { color: var(--text-2); font-size: var(--type-unit); font-weight: var(--fw-semibold); letter-spacing: 0; }
.stat__sub { display: block; color: var(--text-3); font-size: var(--type-xs); margin-top: 2px; }
.progress { display: block; height: 6px; border-radius: var(--radius-full); background: var(--overlay); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--success); border-radius: inherit; }

/* ---------------------------------------------------------------------------
   §8 Timeline (vertical rail through day badges)
   --------------------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: var(--timeline-node-size) 1fr auto;
  gap: var(--space-3);
  align-items: start;
  min-height: 72px;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  margin-bottom: var(--timeline-item-gap);
}
.timeline__item::before {   /* rail from this node to the next */
  content: "";
  position: absolute;
  left: calc(var(--space-2) + var(--timeline-node-size) / 2 - var(--timeline-rail-width) / 2);
  top: calc(var(--space-3) + var(--timeline-node-size));
  bottom: calc(-1 * var(--timeline-item-gap) - var(--space-3));
  width: var(--timeline-rail-width);
  background: var(--timeline-rail);
}
.timeline__item:last-child::before { display: none; }
.timeline__node {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--timeline-node-size);
  height: var(--timeline-node-size);
  border-radius: 50%;
  background: var(--timeline-node-bg);
  border: 1px solid var(--timeline-node-border);
  color: var(--timeline-node-fg);
  font-size: 13px;
  font-weight: var(--fw-extrabold);
  font-variant-numeric: tabular-nums;
}
.timeline__item--current .timeline__node { background: var(--timeline-node-current); border-color: var(--timeline-node-current); color: var(--on-accent); }
.timeline__item--done .timeline__node { background: var(--timeline-node-done); border-color: var(--timeline-node-done); color: var(--on-accent); }
.timeline__item > .day-badge { position: relative; }
.timeline__body { min-width: 0; }
.timeline__item:has(a:hover), .timeline__item:has(a:focus-visible) { background: var(--overlay); }
.timeline__item[aria-current="true"], .timeline__item.is-selected { background: var(--accent-bg); }
.timeline__item a.timeline__link { color: inherit; text-decoration: none; }
.timeline__item a.timeline__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.timeline__item a.timeline__link:focus-visible { outline: none; }
.timeline__item:has(a.timeline__link:focus-visible) { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: var(--focus-ring-offset); }
.timeline__kicker { color: var(--text-2); font-size: var(--type-xs); font-weight: var(--fw-semibold); letter-spacing: var(--ls-badge); text-transform: uppercase; }
.timeline__title { display: block; color: var(--text-1); font-size: var(--type-body); font-weight: var(--fw-bold); }
.timeline__meta { color: var(--text-2); font-size: var(--type-xs); font-variant-numeric: tabular-nums; }
.timeline__chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.timeline__chev { color: var(--text-3); align-self: center; }
.timeline__item--caution .timeline__body, .timeline__item--warning .timeline__body { border-left: var(--timeline-warning-edge); padding-left: var(--space-3); }
.timeline__item--critical .timeline__body { border-left: var(--timeline-critical-edge); padding-left: var(--space-3); }

/* ---------------------------------------------------------------------------
   §19 Empty, loading, error
   --------------------------------------------------------------------------- */
.empty { max-width: 480px; margin-inline: auto; padding-top: var(--space-10); text-align: center; }
.empty svg.empty__art { width: 160px; height: 120px; margin: 0 auto var(--space-5); }
.empty h2 { font-size: var(--type-h2-app); margin-bottom: var(--space-2); }
.empty p { margin-bottom: var(--space-6); }
.empty .cluster { justify-content: center; }

.skeleton { display: block; border-radius: var(--radius-sm); background: var(--skeleton-base); min-height: 1em; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton { background: linear-gradient(90deg, var(--skeleton-base) 0%, var(--skeleton-shine) 50%, var(--skeleton-base) 100%) 0 0 / 200% 100%; animation: rb-shine 1.2s linear infinite; }
}
@keyframes rb-shine { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------------------
   §13 Map component (map.js)
   --------------------------------------------------------------------------- */
.rb-map {
  position: relative;
  width: 100%;
  min-height: 280px;
  background: var(--map-bg);
  overflow: hidden;
  isolation: isolate;
}
.rb-map[data-theme="light"] { background: var(--basemap-light-land); }
.rb-map__canvas { position: absolute; inset: 0; }
.rb-map__chip {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-map-ui);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: calc(100% - 24px);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--map-chip-radius);
  background: var(--map-chip-bg);
  -webkit-backdrop-filter: blur(var(--blur-chip));
  backdrop-filter: blur(var(--blur-chip));
  color: var(--text-1);
  font-size: var(--type-small);
  font-weight: var(--fw-semibold);
}
.rb-map__chip--top { top: var(--space-3); transform: translateX(-50%); flex-wrap: wrap; justify-content: center; border-radius: var(--radius-md); }
.rb-map .maplibregl-canvas:focus-visible { outline: none; box-shadow: inset var(--focus-ring); }
.rb-map .maplibregl-ctrl-top-right, .rb-map .maplibregl-ctrl-top-left { z-index: var(--z-map-ui); }
.rb-map .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 12px 12px 0 0; }
.rb-map .maplibregl-ctrl-top-left .maplibregl-ctrl { margin: 12px 0 0 12px; }
@media (min-width: 768px) {
  .rb-map .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 16px 16px 0 0; }
  .rb-map .maplibregl-ctrl-top-left .maplibregl-ctrl { margin: 16px 0 0 16px; }
}
.rb-map .maplibregl-ctrl-top-right .maplibregl-ctrl + .maplibregl-ctrl { margin-top: 8px; }
.rb-map .maplibregl-ctrl-group {
  background: var(--map-panel-bg);
  -webkit-backdrop-filter: blur(var(--map-panel-blur));
  backdrop-filter: blur(var(--map-panel-blur));
  border: 1px solid var(--map-panel-border);
  border-radius: var(--map-control-radius);
  box-shadow: var(--map-panel-shadow);
}
.rb-map .maplibregl-ctrl-group:not(:empty) { box-shadow: var(--map-panel-shadow); }
.rb-map .maplibregl-ctrl-group button {
  width: var(--map-control-size);
  height: var(--map-control-size);
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text-1);
}
.rb-map .maplibregl-ctrl-group button:first-child { border-radius: calc(var(--map-control-radius) - 1px) calc(var(--map-control-radius) - 1px) 0 0; }
.rb-map .maplibregl-ctrl-group button:last-child { border-radius: 0 0 calc(var(--map-control-radius) - 1px) calc(var(--map-control-radius) - 1px); }
.rb-map .maplibregl-ctrl-group button:only-child { border-radius: calc(var(--map-control-radius) - 1px); }
.rb-map .maplibregl-ctrl-group button + button { border-top: 1px solid var(--map-panel-border); }
.rb-map .maplibregl-ctrl-group button:not(:disabled):hover { background-color: var(--overlay); }
.rb-map .maplibregl-ctrl-group button:focus-visible,
.rb-map .maplibregl-ctrl button:focus:focus-visible { outline: none; box-shadow: var(--focus-ring); position: relative; z-index: 1; }
.rb-map .maplibregl-ctrl-group button:focus:not(:focus-visible) { box-shadow: none; }
.rb-map .rb-ctrl-btn .icon { width: var(--icon-size-ui); height: var(--icon-size-ui); }
.rb-map .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
.rb-map .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon { display: none; }

/* Basemap segmented control (top-left) */
.rb-map .rb-basemap { padding: 3px; }
.rb-map .rb-basemap .segmented { border: 0; background: transparent; padding: 0; }
.rb-map .rb-basemap .segmented label { min-height: var(--target-min); }   /* D4: 44 px options */
.rb-map .rb-basemap .rb-basemap__toggle { display: none; }
.rb-map .rb-basemap__pop { display: contents; }
@media (max-width: 479.98px) {
  .rb-map .rb-basemap { padding: 0; }
  .rb-map .rb-basemap .rb-basemap__toggle { display: grid; }
  .rb-map .rb-basemap__pop { display: block; position: absolute; top: calc(100% + 8px); left: 0; padding: 3px; background: var(--map-panel-bg); border: 1px solid var(--map-panel-border); border-radius: var(--map-control-radius); box-shadow: var(--map-panel-shadow); }
  .rb-map .rb-basemap__pop[hidden] { display: none; }
  .rb-map .rb-basemap .segmented { flex-direction: column; }
}

/* §13.4 Attribution: always visible, never collapsed */
.rb-map .maplibregl-ctrl-bottom-right { z-index: var(--z-map-ui); max-width: 100%; }
.rb-map .maplibregl-ctrl-attrib {
  background: var(--map-chip-bg) !important;
  color: var(--text-2);
  font-size: var(--type-fine);
  line-height: 1.45;
  padding: 2px 8px;
  border-radius: var(--radius-sm) 0 0 0;
  margin: 0 !important;
}
.rb-map .maplibregl-ctrl-attrib a { display: inline-flex; align-items: center; min-height: 24px; color: var(--text-1); text-decoration: underline; text-underline-offset: 2px; }   /* D5: 24 px target (WCAG 2.5.8) */
.rb-map .maplibregl-ctrl-attrib a:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 1px; }
.rb-map .maplibregl-ctrl-attrib-button { display: none; }
.rb-map .maplibregl-ctrl-attrib.maplibregl-compact { min-height: 0; padding: 2px 8px; }
.rb-map .maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner { display: block; }

/* §13.5 Markers: <button>s with a 44px hit area */
.rb-marker {
  --m: var(--accent);
  --fg: var(--on-accent);
  display: grid;
  place-items: center;
  width: var(--target-min);
  height: var(--target-min);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.rb-marker__pin {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--m);
  color: var(--fg);
  box-shadow: 0 0 0 2px var(--base);
  transition: transform var(--dur-fast);
}
.rb-marker__pin .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.rb-marker:hover .rb-marker__pin { transform: scale(1.12); }
.rb-marker:focus-visible { outline: none; }
.rb-marker.is-zoom-hidden { visibility: hidden; }
.rb-marker:focus-visible .rb-marker__pin { box-shadow: var(--focus-ring); }
/* Start/end teardrop pins and stop badges (art in assets/js/marker-art.js). The button keeps its 44 px hit target; the art sits on the point. */
.rb-marker--pin { align-items: end; }
.rb-marker--pin .rb-marker__art { width: 30px; height: 40px; overflow: visible; transition: transform var(--dur-fast); transform-origin: 50% 100%; }
.rb-marker--badge .rb-marker__art { width: 22px; height: 22px; overflow: visible; transition: transform var(--dur-fast); }
.rb-marker--pin:hover .rb-marker__art, .rb-marker--badge:hover .rb-marker__art { transform: scale(1.1); }
.rb-marker--pin:focus-visible .rb-marker__art, .rb-marker--badge:focus-visible .rb-marker__art { filter: drop-shadow(0 0 0 var(--focus-ring-color)) drop-shadow(0 0 3px var(--focus-ring-color)); }
.rb-map[data-theme="dark"] .rb-badge__body { fill: #64748B; }
.rb-legend__mk.rb-legend__mk--art { background: none; width: 20px; height: 24px; }
.rb-legend__mk.rb-legend__mk--art .rb-marker__art { width: 18px; height: 24px; }
@media (max-width: 599px) {
  .rb-marker--pin .rb-marker__art { width: 26px; height: 35px; }
  .rb-marker--badge .rb-marker__art { width: 20px; height: 20px; }
}
.rb-marker--overnight .rb-marker__pin { width: 28px; height: 28px; }
.rb-marker--overnight .rb-marker__pin .icon { width: 16px; height: 16px; }
.rb-marker--overnight { --m: var(--brand-chalk); }
.rb-marker--fuel, .rb-marker--border { --m: var(--map-chip-bg); --fg: var(--text-1); }
.rb-marker--fuel .rb-marker__pin, .rb-marker--border .rb-marker__pin { width: 22px; height: 22px; box-shadow: 0 0 0 1px var(--map-panel-border); }
.rb-marker--warning, .rb-marker--caution { --m: var(--warning); --fg: var(--on-warning); }
.rb-marker--critical { --m: var(--danger); --fg: var(--on-danger); }
.rb-map[data-theme="light"] .rb-marker--fuel, .rb-map[data-theme="light"] .rb-marker--border { --m: rgba(9,14,21,0.85); }

.rb-map .maplibregl-popup { z-index: var(--z-map-ui); max-width: min(280px, calc(100% - 24px)) !important; }
.rb-map .maplibregl-popup-content {
  background: var(--map-panel-bg);
  -webkit-backdrop-filter: blur(var(--map-panel-blur));
  backdrop-filter: blur(var(--map-panel-blur));
  border: 1px solid var(--map-panel-border);
  border-radius: var(--map-panel-radius);
  box-shadow: var(--map-panel-shadow);
  color: var(--text-2);
  padding: var(--space-3) 48px var(--space-3) var(--space-4);
  font: inherit;
  font-size: var(--type-xs);
  line-height: 1.5;
}
.rb-map .maplibregl-popup-content strong { display: block; color: var(--text-1); font-size: var(--type-small); }
.rb-map .maplibregl-popup-content .btn { margin-top: var(--space-3); }
.rb-map .maplibregl-popup-close-button { width: 44px; height: 44px; top: 0; right: 0; color: var(--text-2); font-size: 22px; border-radius: var(--radius-full); }
.rb-map .maplibregl-popup-close-button:hover { background: var(--overlay); color: var(--text-1); }
.rb-map .maplibregl-popup-close-button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.rb-map .maplibregl-popup-tip { display: none; }

.map-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--map-chip-radius);
  background: var(--map-chip-bg);
  -webkit-backdrop-filter: blur(var(--blur-chip));
  backdrop-filter: blur(var(--blur-chip));
  color: var(--text-1);
  font-size: var(--type-small);
  font-weight: var(--fw-extrabold);
  font-variant-numeric: tabular-nums;
}
.map-chip small { font-size: var(--type-unit); font-weight: var(--fw-semibold); color: var(--text-2); }

/* One day badge per day (HTML, above markers: designer gate 2 §4) */
.rb-map .rb-day-badge { z-index: 2; cursor: pointer; transition: opacity var(--dur-base); }
.rb-map .rb-day-badge.is-dim > .day-badge { opacity: var(--route-dim-opacity); }   /* inner child: MapLibre owns the marker's own opacity */
.rb-map .rb-day-badge.is-hidden { visibility: hidden; }
.rb-map .rb-day-badge .day-badge { box-shadow: 0 0 0 2px var(--base); }
.rb-map .rb-marker.is-dim > .rb-marker__pin { opacity: var(--route-dim-opacity); }

/* §13.3 Legend (bottom-left, above the attribution) */
.rb-map .maplibregl-ctrl-bottom-left { z-index: var(--z-map-ui); }
.rb-map .rb-legend { margin: 0 0 32px 12px; max-width: min(300px, calc(100vw - 48px)); }
@media (min-width: 768px) { .rb-map .rb-legend { margin-left: 16px; } }
.rb-legend__btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--target-min); padding: 0 var(--space-4);
  border-radius: var(--radius-full);
  background: var(--map-panel-bg);
  -webkit-backdrop-filter: blur(var(--map-panel-blur)); backdrop-filter: blur(var(--map-panel-blur));
  border: 1px solid var(--map-panel-border);
  box-shadow: var(--map-panel-shadow);
  color: var(--text-1); font-size: var(--type-small); font-weight: var(--fw-semibold);
}
.rb-legend__btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.rb-legend__sw { display: inline-flex; gap: 2px; }
.rb-legend__key {
  display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: center;
  margin-bottom: var(--space-2); padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--map-panel-bg);
  -webkit-backdrop-filter: blur(var(--map-panel-blur)); backdrop-filter: blur(var(--map-panel-blur));
  border: 1px solid var(--map-panel-border);
  box-shadow: var(--map-panel-shadow);
  color: var(--text-1); font-size: var(--type-xs);
}
.rb-legend__key[hidden] { display: none; }
.rb-legend__key > span { display: inline-flex; align-items: center; gap: var(--space-2); }
.rb-legend__note { margin: var(--space-2) 0 0; color: var(--text-2); font-size: var(--type-xs); }
.rb-map .rb-surface-tip { pointer-events: none; }
.rb-map .rb-surface-tip--click { pointer-events: auto; }
.rb-map .rb-surface-tip .maplibregl-popup-content { padding: var(--space-2) var(--space-3); color: var(--text-1); font-size: var(--type-small); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rb-map .rb-surface-tip--click .maplibregl-popup-content { padding-right: 48px; }
.rb-map .rb-surface-line { margin: var(--space-2) 0 0; color: var(--text-1); font-variant-numeric: tabular-nums; }
.rb-legend__sw i { display: block; width: 10px; height: 4px; border-radius: 2px; }
.rb-legend__panel {
  margin-bottom: var(--space-2);
  max-height: 50cqh; max-height: 260px; overflow-y: auto;
  padding: var(--space-3);
  background: var(--map-panel-bg);
  -webkit-backdrop-filter: blur(var(--map-panel-blur)); backdrop-filter: blur(var(--map-panel-blur));
  border: 1px solid var(--map-panel-border);
  border-radius: var(--map-panel-radius);
  box-shadow: var(--map-panel-shadow);
  color: var(--text-2); font-size: var(--type-xs);
}
.rb-legend { display: flex; flex-direction: column-reverse; align-items: flex-start; }
.rb-legend__panel h3 { font-size: var(--type-xs); color: var(--text-1); margin: var(--space-2) 0 var(--space-1); }
.rb-legend__panel h3:first-child { margin-top: 0; }
.rb-legend__panel ul { list-style: none; margin: 0; padding: 0; }
.rb-legend__panel button {
  display: flex; align-items: center; gap: var(--space-2); width: 100%;
  min-height: var(--target-min-dense); padding: 4px var(--space-2);
  border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--text-1); font-size: var(--type-xs); text-align: left;
}
@media (pointer: coarse) { .rb-legend__panel button { min-height: var(--target-min); } }
.rb-legend__panel button:hover { background: var(--overlay); }
.rb-legend__panel button[aria-pressed="true"] { background: var(--accent-bg); }
.rb-legend__panel button:focus-visible { outline-offset: -2px; }
.rb-legend__static li { display: flex; align-items: center; gap: var(--space-2); min-height: 26px; padding: 0 var(--space-2); }
.rb-legend__mk { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--m); color: var(--fg); flex: none; }
.rb-legend__mk .icon { width: 12px; height: 12px; stroke-width: 2.2; }
.rb-legend__mk.rb-marker--fuel, .rb-legend__mk.rb-marker--border { border: 1px solid var(--map-panel-border); }
.rb-legend__mk.rb-marker--overnight { --m: var(--brand-chalk); --fg: var(--on-accent); }
.rb-legend__mk.rb-marker--fuel, .rb-legend__mk.rb-marker--border { --m: var(--map-chip-bg); --fg: var(--text-1); }
.rb-legend__mk.rb-marker--caution { --m: var(--warning); --fg: var(--on-warning); }
.rb-legend__mk.rb-marker--critical { --m: var(--danger); --fg: var(--on-danger); }

.rb-map__fallback { position: absolute; inset: 0; overflow: hidden; background: var(--map-bg); }   /* not a scroll region: the overview is sized to fit */

/* Full-screen map dialog (< 1024) */
.map-fullscreen {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--map-bg);
}
.map-fullscreen::backdrop { background: var(--scrim); }
.map-fullscreen .rb-map { position: absolute; inset: 0; height: auto; border-radius: 0; }
.map-fullscreen__close { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: calc(var(--z-map-ui) + 1); }
.map-fullscreen__close:hover { transform: translateX(-50%); }

/* ---------------------------------------------------------------------------
   §22 Print basics (the print page adds its own sheet)
   --------------------------------------------------------------------------- */
@media print {
  .site-header, .preview-banner, .site-footer, .skip-link, .toasts, .maplibregl-control-container, .btn, .menu-toggle, .rb-map { display: none !important; }
  body { background: #fff; color: var(--print-ink); }
  h1, h2, h3, h4, strong { color: var(--print-ink); }
  .day-badge, .route-swatch, .callout { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .day-badge { box-shadow: 0 0 0 1px #111; }
}

/* map.js helpers (kept out of inline styles for the CSP) */
.route-swatch--neutral { --day-color: var(--text-2); }
.rb-legend__sw .route-swatch { width: 10px; }
.rb-popup__detail { margin-top: var(--space-1); }
.rb-map__fallback-note { margin: var(--space-3); }
.form-helper { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-3); color: var(--text-2); font-size: var(--type-xs); }
.form-helper .icon { color: var(--info); width: 14px; height: 14px; }
.from-status { margin-bottom: var(--space-5); }
.btn--icon-outline { border-color: var(--border-md); }

/* F2 (Stage 2, api mode): Log out is a button (it POSTs), styled like the link rows around it */
.account__menu button.menu-row, .mobile-nav li > button.menu-row {
  display: flex; align-items: center; width: 100%;
  background: none; border: 0; border-radius: 0; text-align: start; cursor: pointer;
  color: var(--text-1); font: inherit;
}
.account__menu button.menu-row { min-height: var(--target-min); padding: 0 var(--space-4); font-size: var(--type-small); }
.mobile-nav li > button.menu-row { min-height: 52px; padding: 0 var(--gutter); font-size: var(--type-body); font-weight: var(--fw-semibold); }
.account__menu button.menu-row:hover, .mobile-nav li > button.menu-row:hover { background: var(--overlay); }
.account__menu button.menu-row:focus-visible, .mobile-nav li > button.menu-row:focus-visible { outline-offset: -3px; }
.form-alert { margin-bottom: var(--space-5); }
.form-alert:focus { outline: none; }
.form-alert .btn--link { display: inline-flex; min-height: var(--target-min); vertical-align: middle; }
.combo__meta { color: var(--text-2); font-size: var(--type-xs); }   /* B10 place search: kind and country */

/* R4 fuel planning (fuel-planning-spec §3.1): station, planned and suggested fill-up markers, the "D" badge, the popover */
.chip--accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rb-marker--plain .rb-marker__pin { background: var(--map-chip-bg); color: var(--text-1); }
/* QF: a planned fill-up is the fuel-pump pin in the success green ("confirmed"): --on-accent icon on --success is 8.6:1; the dark ring keeps the edge on the light map */
.rb-marker--planned .rb-marker__pin, .rb-marker--confirmed .rb-marker__pin { background: var(--success); color: var(--on-accent); box-shadow: 0 0 0 2px var(--base), 0 0 0 4px var(--success); }
.rb-map[data-theme="light"] .rb-marker--confirmed .rb-marker__pin { box-shadow: 0 0 0 2px var(--base), 0 0 0 4px var(--success), 0 0 0 5px rgba(9,14,21,0.6); }
.rb-marker--suggested .rb-marker__pin { background: var(--map-chip-bg); color: var(--text-1); box-shadow: 0 0 0 2px var(--base); outline: 2px dashed var(--accent); outline-offset: 2px; }
.rb-marker--off .rb-marker__pin { background: var(--map-chip-bg); color: var(--text-3); opacity: 0.6; box-shadow: 0 0 0 2px var(--base); }
/* Markers must stay position:absolute (MapLibre's own rule): an in-flow marker is shifted by 44 px per earlier marker. The "D" badge below anchors to the absolute marker itself. */
.maplibregl-map .maplibregl-marker { position: absolute; }
.rb-marker__badge { position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center; min-width: 14px; height: 14px; padding: 0 2px; border-radius: 7px; background: var(--base); color: var(--text-1); font-size: 10px; font-weight: var(--fw-bold); line-height: 1; box-shadow: 0 0 0 1px var(--map-panel-border); }
.rb-pop { display: grid; gap: var(--space-2); max-width: 280px; }
.rb-pop__title { font-size: var(--type-body); }
.rb-pop__line { margin: 0; font-size: var(--type-small); }
.rb-pop__table { border-collapse: collapse; font-size: var(--type-small); }
.rb-pop__table th { padding: 2px var(--space-3) 2px 0; font-weight: var(--fw-regular); text-align: left; }
.rb-pop__table td { padding: 2px 0; font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); }
.rb-pop__actions { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
/* R4: station markers sit above the route line and below the point markers (S, stops, E), planned and suggested ones above plain stations */
.rb-map .maplibregl-marker.rb-marker--plain { z-index: 1; }
.rb-map .maplibregl-marker.rb-marker--planned, .rb-map .maplibregl-marker.rb-marker--suggested, .rb-map .maplibregl-marker.rb-marker--off { z-index: 2; }
.rb-map .maplibregl-marker.rb-pt { z-index: 3; }

/* Fuel phase 2: the station sheet on a phone (a docked bottom sheet instead of the map popup, 600 px and narrower) and the "all stations in view" control */
.rb-pop__hint { color: var(--text-2); font-size: var(--type-xs); }
.rb-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-menu, 300); max-height: 62vh; display: flex; flex-direction: column; background: var(--elevated); color: var(--text-1); border-top: 1px solid var(--map-panel-border, var(--border-md)); border-radius: var(--map-sheet-radius, 16px) var(--map-sheet-radius, 16px) 0 0; box-shadow: var(--map-panel-shadow, var(--shadow-pop)); padding-bottom: env(safe-area-inset-bottom, 0); }
.rb-sheet__bar { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2) var(--space-3) 0 var(--space-4); }
.rb-sheet__grip { width: 36px; height: 4px; border-radius: 2px; background: var(--border-md); margin: var(--space-2) 0; }
.rb-sheet__close { margin-left: auto; }
.rb-sheet__body { overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--space-4) var(--space-4); }
.rb-sheet .rb-pop { max-width: none; }
.rb-sheet .rb-pop__title { font-size: var(--type-h4, var(--type-body)); }
.rb-sheet .rb-pop__line, .rb-sheet .rb-pop__table { font-size: var(--type-body); }
.rb-sheet .btn { min-height: var(--target-min); }
.has-sheet .toasts { bottom: calc(var(--space-4) + 38vh); }
.rb-allst { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); background: transparent; box-shadow: none; }
.rb-allst__btn.is-on { background: var(--accent); color: var(--on-accent); }
.rb-allst__status { margin: 0; max-width: 210px; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); background: var(--map-panel-bg, var(--surface)); border: 1px solid var(--map-panel-border, var(--border)); color: var(--text-1); font-size: var(--type-xs); }

/* fuel prices (amount and kind tag; shown once per trip, see planner.css .fuel-prices) */
.rb-price__amount { font-variant-numeric: tabular-nums; color: var(--text-1); font-weight: var(--fw-semibold); }
.rb-price__tag { color: var(--text-2); font-size: var(--type-small); }
.rb-price--stale .rb-price__tag { font-weight: var(--fw-semibold); color: var(--text-1); }

/* a map popup never outgrows the screen: it scrolls inside, and its action ("Fill up here") stays in view */
.rb-map .maplibregl-popup-content .rb-pop { max-height: min(50vh, 340px); overflow-y: auto; overflow-x: hidden; grid-template-columns: minmax(0, 1fr); width: 232px; overscroll-behavior: contain; }
.rb-map .maplibregl-popup-content .rb-pop__actions { position: sticky; bottom: 0; padding-top: var(--space-1); background: var(--map-panel-bg); }

/* "More" disclosure (S3 simplify): rarely used fields sit behind a plain summary; nothing is removed */
details.more > summary {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--target-min); cursor: pointer;
  color: var(--accent); font-weight: var(--fw-semibold); font-size: var(--type-small); list-style: none;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; flex: none;
}
details.more[open] > summary::before { transform: rotate(45deg); }
details.more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
details.more[open] > summary { margin-bottom: var(--space-2); }
details.more > .more__body { display: grid; gap: var(--space-3); }
@media (prefers-reduced-motion: reduce) { details.more > summary::before { transition: none; } }

/* S-12: stacked boxes never touch */
.callout + .callout, .callout + .fuel-plan-line, .fuel-plan-line + .callout { margin-top: var(--space-3); }
.fuel-plan-host { margin-top: var(--space-5); }

/* ---- UI review 2026-11 ---------------------------------------------------- */
/* Mobile header: the primary action stays in view (hidden from 768px, where .site-header__actions shows) */
.site-header__cta { display: inline-flex; margin-left: auto; margin-right: var(--space-2); }
.site-header .btn.site-header__cta { padding: 0 14px; font-size: var(--type-small); box-shadow: none; }   /* compact: no glow next to the logo, still a 44px target */
@media (max-width: 399.98px) { .site-header--site .brand img { height: 26px; } }
@media (min-width: 768px) { .site-header__cta { display: none; } }
/* A Fuel tile sub line can hold a caution chip on its own line */
.stat__sub { overflow-wrap: break-word; }
.stat__sub .chip { display: flex; width: fit-content; max-width: 100%; margin-top: var(--space-2); white-space: normal; }
/* ---- UI review 2026-11, pass 3: Fuel is a KPI tile only -------------------- */
/* Same frame as Distance / Drive time / Nights; one tiny info button with a CSS tooltip (hover, focus, tap) */
.stat--fuel { position: relative; }
.stat--fuel dt { display: flex; align-items: center; gap: var(--space-1); }
.stat__info { position: relative; display: inline-grid; place-items: center; width: 24px; height: 24px; margin: -4px 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-3); cursor: help; }
.stat__info::before { content: ""; position: absolute; inset: -10px; }   /* 44px hit area */
.stat__info .icon { width: 14px; height: 14px; }
.stat__info:hover, .stat__info:focus-visible { color: var(--text-1); }
.stat__tip { position: absolute; z-index: 5; left: var(--space-2); right: var(--space-2); top: calc(100% - var(--space-2)); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--elevated); border: 1px solid var(--border-md); box-shadow: var(--shadow-pop); color: var(--text-2); font-size: var(--type-xs); font-weight: var(--fw-regular); line-height: var(--lh-snug); opacity: 0; visibility: hidden; transition: opacity var(--dur-base); pointer-events: none; }
.stat__info:hover + .stat__tip, .stat__info:focus-visible + .stat__tip, .stat__info:focus + .stat__tip { opacity: 1; visibility: visible; }
.stat__est { color: var(--text-3); font-weight: var(--fw-medium); }
/* ---- UI review 2026-11, pass 4: one KPI grid, cost tiles always shown ------ */
/* Two <dl>s that read as one grid: trip figures (2x2, 4 across from 420px), then costs */
.stats-wrap > .stats + .stats { margin-top: var(--space-2); }
.stats--costs { grid-template-columns: repeat(2, 1fr); }
.stats--costs > .stat:first-child { grid-column: 1 / -1; }          /* Total cost spans the row on 2 columns */
@container (min-width: 420px) {
  .stats--costs { grid-template-columns: repeat(3, 1fr); }
  .stats--costs > .stat:first-child { grid-column: auto; }
}
/* Empty state: a cost tile is never hidden; with no costs it says so quietly */
.stat__value--empty { color: var(--text-3); font-size: var(--type-h3); font-weight: var(--fw-bold); line-height: 1.6; }
/* Caption under the booking-cost tiles: they never include fuel */
.stats__note { margin: var(--space-2) 0 0; color: var(--text-3); font-size: var(--type-xs); line-height: var(--lh-snug); }

/* UI refresh 2026-11, tester round: D1 a lone tile in the first grid (no routes) spans the row; D4 "from R" stays with its number */
.stats--4 > .stat:only-child { grid-column: 1 / -1; }
.stat__value { white-space: nowrap; }

/* Markers on the same spot: stop badge and pins above the overnight marker above fuel and the rest */
.rb-marker--overnight { z-index: 2; }
.rb-marker--badge { z-index: 3; }
.rb-marker--pin { z-index: 4; }

/* The selected day's number rides inside its distance chip, so the two can never overlap (web-map-pick-scope §7) */
.map-chip .day-badge { margin-right: var(--space-2); vertical-align: middle; }
.rb-day-badge.is-chip-hidden { display: none; }
.rb-map .maplibregl-marker.map-chip { z-index: 5; }   /* the distance chip reads above fuel and stop markers */

/* ---------------------------------------------------------------------------
   Date and time inputs (native, themed; the open popup stays the browser's own)
   Segment focus uses the accent, not the system blue; a token-coloured
   self-hosted icon replaces the browser glyph while the native hit area is kept.
   --------------------------------------------------------------------------- */
.input[type="date"], .input[type="time"] {
  position: relative;
  accent-color: var(--accent);
  text-align: left;
  -webkit-appearance: none;
}
.input[type="date"]::-webkit-date-and-time-value, .input[type="time"]::-webkit-date-and-time-value { text-align: left; min-height: 1.4em; }
.input[type="date"]::-webkit-datetime-edit, .input[type="time"]::-webkit-datetime-edit { padding: 0; }
/* Chromium applies the UA :focus highlight to the active segment; author rules only match via :focus-within */
.input::-webkit-datetime-edit-year-field:focus-within, .input::-webkit-datetime-edit-month-field:focus-within,
.input::-webkit-datetime-edit-day-field:focus-within, .input::-webkit-datetime-edit-hour-field:focus-within,
.input::-webkit-datetime-edit-minute-field:focus-within, .input::-webkit-datetime-edit-ampm-field:focus-within {
  background-color: var(--accent-bd);
  color: var(--text-1);
  border-radius: 4px;
  outline: none;
}
/* Chromium and Safari: our icon + the native hit area kept (Firefox keeps its own icon). */
@supports selector(::-webkit-calendar-picker-indicator) {
  .input[type="date"], .input[type="time"] {
    padding-right: 44px;
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
  }
  .input[type="date"] { background-image: url("../img/icons/calendar.svg?v=6a945f3"); }
  .input[type="time"] { background-image: url("../img/icons/clock.svg?v=6a945f3"); }
  .input[type="date"]:hover, .input[type="date"]:focus { background-image: url("../img/icons/calendar-strong.svg?v=6a945f3"); }
  .input[type="time"]:hover, .input[type="time"]:focus { background-image: url("../img/icons/clock-strong.svg?v=6a945f3"); }
  .input[type="date"]:disabled { background-image: url("../img/icons/calendar.svg?v=6a945f3"); }
  .input[type="time"]:disabled { background-image: url("../img/icons/clock.svg?v=6a945f3"); }
  .input[type="date"]::-webkit-calendar-picker-indicator, .input[type="time"]::-webkit-calendar-picker-indicator {
    position: absolute; right: 0; top: 0; width: 48px; height: 100%;
    margin: 0; padding: 0; opacity: 0; cursor: pointer;
  }
}

/* ---------------------------------------------------------------------------
   Calendar popup (assets/js/datepicker.js; desktop pointers only)
   --------------------------------------------------------------------------- */
.dp {
  z-index: calc(var(--z-dialog) + 10);
  width: 304px;
  max-width: calc(100vw - 16px);
  padding: var(--space-3);
  background: var(--elevated);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  color: var(--text-1);
  font-size: var(--type-small);
}
.dp__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.dp__title { flex: 1; text-align: center; font-weight: var(--fw-bold); font-size: var(--type-body); }
.dp__nav {
  display: inline-grid; place-items: center; width: var(--target-min); height: var(--target-min);
  border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-2); cursor: pointer;
}
.dp__nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dp__nav:hover:not(:disabled) { background: var(--overlay); color: var(--text-1); }
.dp__nav:disabled { color: var(--text-disabled); cursor: not-allowed; }
.dp__grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.dp__grid th { padding: var(--space-1) 0 var(--space-2); color: var(--text-3); font-size: var(--type-xs); font-weight: var(--fw-semibold); text-align: center; }
.dp__grid td { padding: 1px; text-align: center; }
.dp__day {
  width: 100%; min-height: 38px; border: 1px solid transparent; border-radius: var(--radius-md);
  background: transparent; color: var(--text-1); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer;
}
.dp__day.is-out { color: var(--text-3); }
.dp__day:hover:not(:disabled) { background: var(--overlay); }
.dp__day.is-today { border-color: var(--accent-bd); color: var(--accent); font-weight: var(--fw-bold); }
.dp__day.is-selected, .dp__day.is-selected:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: var(--fw-bold); }
.dp__day:disabled { color: var(--text-disabled); cursor: not-allowed; text-decoration: line-through; }
.dp__day:focus-visible, .dp__nav:focus-visible, .dp__text:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring-color); outline-offset: 1px; }
.dp__foot { display: flex; justify-content: space-between; margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border); }
.dp__text { min-height: var(--target-min-dense, 36px); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--accent); font: inherit; font-weight: var(--fw-semibold); cursor: pointer; }
.dp__text:hover:not(:disabled) { background: var(--accent-bg); }
.dp__text:disabled { color: var(--text-disabled); cursor: not-allowed; }
