/* zones module styles (prefix .zones-) and map extras owned by the map feature (.tg-map-*, .route-elev-*).
   Uses app.css tokens only. */

.tg-map-dot-business { background: conic-gradient(#765b87 0 25%, #b57640 0 50%, #c0533a 0 75%, #49817b 0); }
.tg-basemap canvas, canvas.tg-basemap { image-rendering: auto; }
.tg-map-canvas.leaflet-container { background: #b5d6d4; }
@media (prefers-color-scheme: dark) { .tg-map-canvas.leaflet-container { background: #0f2b33; } }

/* ---------- Zones editor (#zones) ---------- */
.zones-page { padding-bottom: 24px; }
.zones-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.zones-side, .zones-map-wrap, .zones-form { min-width: 0; }
.zones-map-wrap { position: relative; }
.zones-map { position: relative; height: 56vh; min-height: 320px; max-height: 560px; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); border: 1px solid var(--line); background: #b5d6d4; }
@media (prefers-color-scheme: dark) { .zones-map { background: #0f2b33; } }
.zones-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 2px 0; color: var(--muted); font-size: 12.5px; font-weight: 650; }
.zones-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 2px solid; margin-left: 6px; vertical-align: -2px; }
.zones-swatch.is-avoid { border-color: #b3372b; background: rgba(179, 55, 43, .14); border-style: dashed; }
.zones-swatch.is-closed { border-color: #8f1f16; background: rgba(143, 31, 22, .26); }
.zones-swatch.is-prefer { border-color: #2f7d5a; background: rgba(47, 125, 90, .16); }
.zones-form h2 { font: 650 21px/1.2 var(--display); margin: 2px 0 10px; }
.zones-form-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.zones-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.zones-toolbar .chip-button[disabled] { opacity: .45; }
.zones-hint { margin: 10px 0 2px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--sea-soft); color: var(--ink-2); font-size: 13.5px; font-weight: 650; }
.zones-help { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.zones-radius output { color: var(--ink); }
.zones-radius input[type="range"] { accent-color: var(--accent); min-height: 0; padding: 0; border: 0; background: none; }
.zones-kind { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; }
.zones-kind legend { width: 100%; font-size: 13px; color: var(--ink-2); margin-bottom: 0; }
.zones-schedule { margin: 8px 0; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); }
.zones-schedule legend { float: left; width: 100%; font-size: 13px; color: var(--ink-2); margin: 0; }
.zones-slots { display: grid; gap: 10px; margin: 6px 0 10px; clear: both; }
.zones-slot { display: grid; gap: 8px; padding: 10px; border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--shadow-1); }
.zones-days { display: flex; flex-wrap: wrap; gap: 5px; }
.zones-day { position: relative; }
.zones-day input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.zones-day span { display: inline-grid; place-items: center; min-width: 40px; height: 32px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 750; box-shadow: inset 0 0 0 1.5px var(--line); }
.zones-day input:checked + span { background: var(--ink); color: var(--bg); box-shadow: none; }
.zones-day input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.zones-times { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.zones-times label { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.zones-times input[type="time"] { min-width: 0; min-height: 40px; padding: 0 10px; border-radius: var(--r-sm); border: 1.5px solid var(--line-strong); background: var(--bg-elev); color: var(--ink); font-weight: 650; width: 100%; }
.zones-icon-button { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 20px; line-height: 1; }
.zones-list-title { margin-top: 18px; }
.zones-list { display: grid; gap: 10px; }
.zones-card { padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.zones-card.is-editing { box-shadow: 0 0 0 2px var(--accent); }
.zones-card h3 { font-size: 16px; margin: 8px 0 4px; }
.zones-card p { margin: 0 0 4px; color: var(--ink-2); font-size: 14px; }
.zones-card .actions { margin-top: 10px; gap: 6px; }
.zones-meta { color: var(--muted) !important; font-size: 12.5px !important; }
.zones-card-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.zones-tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 800; letter-spacing: .02em; }
.zones-tag.is-avoid { background: var(--danger-soft); color: var(--danger); }
.zones-tag.is-closed { background: var(--danger); color: #fff; }
.zones-tag.is-prefer { background: var(--ok-soft); color: var(--ok); }
.zones-live { font-size: 12px; font-weight: 750; color: var(--muted); }
.zones-live.is-live { color: var(--ok); }
.zones-live.is-live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; box-shadow: 0 0 0 3px var(--ok-soft); }
.zones-delete.is-confirm { background: var(--danger); color: #fff; }
.zones-vertex span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); color: var(--ink); border: 2.5px solid var(--accent); font: 800 11px/1 var(--font); box-shadow: var(--shadow-1); }
/* Phone and tablet: title, map, then form and list (the side column only groups them on desktop). */
.zones-side { display: contents; }
.zones-intro { order: -2; }
.zones-map-wrap { order: -1; }
.zones-footnote { order: 1; }

/* Desktop: full-screen map with a floating side panel, like the Map page. */
@media (min-width: 960px) {
  body[data-page="zones"] main { max-width: none; padding: 0; animation: none; }
  body[data-page="zones"] .app-footer { display: none; }
  .zones-page { position: fixed; inset: calc(var(--header-h) + var(--safe-top)) 0 0 96px; padding: 0; z-index: 1; }
  .zones-layout { display: block; height: 100%; }
  .zones-map-wrap { position: absolute; inset: 0; }
  .zones-map { height: 100%; min-height: 0; max-height: none; border-radius: 0; border: 0; box-shadow: none; }
  .zones-legend { position: absolute; right: 12px; bottom: 26px; z-index: 500; margin: 0; padding: 8px 12px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow-2); color: var(--ink-2); }
  .zones-side { display: block; position: absolute; top: 12px; left: 12px; bottom: 12px; z-index: 600; width: min(460px, 40vw); overflow-y: auto; overscroll-behavior: contain; padding: 18px 18px 8px; border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-3); }
  .zones-side .zones-intro { margin-top: 0; }
  .zones-side .app-page-title { font-size: 30px; }
  .zones-side .zones-form { box-shadow: none; border: 1px solid var(--line); }
  .zones-map .leaflet-top.leaflet-left { left: calc(min(460px, 40vw) + 12px); }
}
@media (min-width: 1500px) {
  .zones-side { width: 500px; }
  .zones-map .leaflet-top.leaflet-left { left: 512px; }
}

/* ---------- Route elevation (route card in app.js routeHTML) ---------- */
.route-elevation { margin: 12px 0 4px; padding: 12px 14px 10px; border-radius: var(--r-md); background: var(--surface-2); }
.route-elevation-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; font-size: 13px; color: var(--ink-2); }
.route-elevation-head strong { font-size: 13.5px; color: var(--ink); }
.route-elevation-stats { display: flex; gap: 12px; font-weight: 750; }
.route-elevation-stats .is-up { color: var(--accent-deep); }
.route-elevation-stats .is-down { color: var(--sea); }
.route-elevation svg { display: block; width: 100%; height: 76px; margin-top: 6px; overflow: visible; }
.route-elevation .elev-area { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.route-elevation .elev-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.route-elevation .elev-stop { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.route-elevation .elev-axis { font: 700 10px/1 var(--font); fill: var(--muted); }
.route-elevation-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.route-leg-elev { color: var(--muted); font-weight: 700; white-space: nowrap; }
.route-zone-notice { margin: 10px 0; }
.route-zone-notice ul { margin: 6px 0 0; padding-left: 18px; }

/* Small route maps: keep the attribution on one line. */
.tg-map-route .tg-map-attribution { font-size: 10.5px; }
.zones-form .form-grid > * { min-width: 0; }
.zones-form input[type="date"] { min-width: 0; padding: 0 10px; }
.tg-map-route .tg-map-attribution a[href*="fixthemap"] { display: none; }
