/* Product layout using minimal-app-style v1 semantic tokens. */
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 16px/1.5 var(--font-sans); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--control-border); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500; transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
button:hover:not(:disabled) { background: var(--surface-raised); }
button:active:not(:disabled) { background: var(--border); }
button:disabled { cursor: not-allowed; background: var(--surface-raised); color: var(--text-muted); border-color: var(--border); }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
input, select { min-height: 40px; padding: 8px 12px; border: 1px solid var(--control-border); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font-size: 14px; }
input::placeholder { color: var(--text-muted); opacity: 1; }
label { font-size: 14px; font-weight: 500; }
.header { min-height: 80px; padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 22px; font-weight: 600; letter-spacing: -.6px; flex-shrink: 0; }
.brand-mark { width: 32px; height: 36px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); clip-path: polygon(50% 0,96% 25%,96% 75%,50% 100%,4% 75%,4% 25%); font-size: 26px; font-weight: 600; }
.brand-mark span { display: none; }
.header nav, .header-right, .theme-control { display: flex; align-items: center; gap: 8px; }
.header-right { gap: 16px; min-width: 0; }
.theme-control { gap: 8px; }
.theme-control label { color: var(--text-muted); }
.nav-button { color: var(--text-muted); border-color: transparent; background: transparent; white-space: nowrap; }
.nav-button.active { color: var(--accent); background: var(--accent-subtle); font-weight: 600; box-shadow: inset 0 -2px var(--accent); }
.nav-button.active:hover { background: var(--accent-subtle); }
.button { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; padding: 8px 16px; }
.button span { font-size: 18px; }
.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary:active:not(:disabled) { background: var(--accent-pressed); }
.text-button { background: transparent; border-color: transparent; color: var(--accent); }
#account-button { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
main { display: grid; grid-template-columns: 400px minmax(0,1fr); height: calc(100dvh - 81px); min-height: 560px; }
.sidebar { padding: 32px; display: flex; flex-direction: column; overflow-y: auto; border-right: 1px solid var(--border); scrollbar-width: thin; scrollbar-color: var(--control-border) var(--canvas); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 12px; }
h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.6px; font-weight: 600; margin: 0 0 12px; }
h2 { font-size: 24px; line-height: 1.3; font-weight: 600; margin: 0 0 12px; }
p { max-width: 65ch; }
p.intro { font-size: 14px; line-height: 1.5; color: var(--text-muted); margin: 0 0 32px; }
.section-label { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); margin: 24px 0 12px; }
.section-label span { color: var(--text); font-size: 14px; font-weight: 600; }
.activity-switch { display: flex; gap: 4px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 4px; }
.activity-switch button { flex: 1; border-color: transparent; background: transparent; color: var(--text-muted); display: flex; gap: 8px; align-items: center; justify-content: center; }
.activity-switch button.selected { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent); }
.activity-switch button span { font-size: 18px; line-height: 20px; }
.search-label { display: block; margin-bottom: 8px; }
.search { display: flex; gap: 8px; }
.search input { width: 100%; min-width: 0; }
.search button { min-width: 40px; font-size: 20px; }
.search-results { margin-top: 8px; }
.search-results button { display: block; width: 100%; margin: 4px 0; padding: 12px; text-align: left; overflow-wrap: anywhere; }
.search-results p { font-size: 14px; color: var(--text-muted); }
.waypoint-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.waypoint-heading > span { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.helper { font-size: 14px; color: var(--text-muted); margin: 0 0 12px; line-height: 1.5; }
.waypoints { list-style: none; padding: 0; margin: 0; max-height: 216px; overflow-y: auto; }
.waypoints li { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 12px; }
.waypoints li span:nth-child(2) { flex: 1; overflow-wrap: anywhere; }
.empty-point { padding: 16px; border: 1px dashed var(--control-border); border-radius: var(--radius-control); color: var(--text-muted); font-size: 14px !important; }
.point-dot { width: 8px; height: 8px; border: 2px solid var(--text-muted); border-radius: 50%; flex-shrink: 0; }
.point-number { width: 24px; height: 24px; flex-shrink: 0; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); border-radius: 50%; font-weight: 600; }
.waypoints button { border-color: transparent; background: transparent; color: var(--text-muted); min-width: 40px; font-size: 20px; }
.route-tools { display: flex; justify-content: space-between; gap: 4px; margin: 8px 0 24px; }
.route-tools button { padding: 8px; border-color: transparent; background: transparent; font-size: 14px; }
.route-tools button:disabled { color: var(--text-muted); }
.route-summary { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); padding: 24px; }
.summary-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: .5px; }
.unit-switch { display: flex; gap: 4px; }
.unit-switch button { min-width: 40px; padding: 8px; background: transparent; border-color: transparent; color: var(--text-muted); }
.unit-switch button.selected { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent); }
.metrics { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 16px 0; font-variant-numeric: tabular-nums; }
.metrics strong { font-size: 32px; font-weight: 600; letter-spacing: -.8px; }
.metrics small { display: block; margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.metrics > div > span { font-size: 14px; }
.time-metric { text-align: right; }
.time-metric strong { font-size: 20px; letter-spacing: -.3px; }
.route-status { font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 12px; }
.save-actions { display: flex; gap: 8px; margin-top: 16px; }
.save-actions .primary { flex: 1; }
.export { padding: 8px 12px; }
.access-note { display: flex; gap: 8px; margin: 24px 0 0; color: var(--text-muted); }
.access-note p { margin: 0; font-size: 12px; line-height: 1.5; }
.sidebar-footer { display: flex; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 12px; padding-top: 32px; margin-top: auto; }
.map-shell { position: relative; min-width: 0; background: var(--surface-raised); }
#map { position: absolute; inset: 0; z-index: 1; cursor: crosshair; background: var(--surface-raised); }
/* Preserve original cartographic colours in both themes. Theme only map UI and route overlays. */
.map-title { position: absolute; z-index: 500; top: 24px; left: 24px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-overlay); pointer-events: none; max-width: calc(100% - 104px); }
.map-title strong { font-size: 14px; font-weight: 600; }
.map-title div > span { display: block; font-size: 12px; margin-top: 4px; color: var(--text-muted); }
.map-controls { position: absolute; z-index: 500; right: 24px; top: 128px; display: flex; flex-direction: column; gap: 8px; }
.map-controls button, .map-help { width: 40px; padding: 0; font-size: 20px; box-shadow: var(--shadow-overlay); }
.map-bottom { position: absolute; z-index: 500; bottom: 40px; left: 24px; right: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; }
.map-bottom > * { pointer-events: auto; }
.map-tip { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); font-size: 14px; box-shadow: var(--shadow-overlay); }
.tip-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--accent); }
.map-help { flex-shrink: 0; }
.routing-badge { position: absolute; z-index: 500; left: 24px; bottom: 108px; max-width: calc(100% - 48px); padding: 8px 12px; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius-control); color: var(--warning); background: var(--surface); }
.routing-badge.ready { color: var(--success); }
.leaflet-control-zoom { margin: 24px 24px 0 0 !important; border: 1px solid var(--control-border) !important; border-radius: var(--radius-control) !important; overflow: hidden; box-shadow: var(--shadow-overlay) !important; }
.leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 40px !important; background: var(--surface) !important; color: var(--text) !important; border-color: var(--control-border) !important; font-weight: 400 !important; }
.leaflet-control-zoom a:hover { background: var(--surface-raised) !important; }
.leaflet-control-zoom a:focus-visible { outline-offset: -4px; }
.leaflet-control-attribution { color: var(--text-muted) !important; background: var(--surface) !important; font: 12px/1.4 var(--font-sans) !important; }
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-control-scale { margin-bottom: 8px !important; }
.leaflet-control-scale-line { background: var(--surface); color: var(--text); border-color: var(--text-muted); text-shadow: none; }
.route-marker { border: 3px solid var(--surface); border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 600 12px/24px var(--font-sans); text-align: center; box-shadow: 0 0 0 1px var(--control-border); }
.route-marker.start { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent); }
.route-line { stroke: var(--accent); filter: drop-shadow(1px 0 0 var(--surface)) drop-shadow(-1px 0 0 var(--surface)) drop-shadow(0 1px 0 var(--surface)) drop-shadow(0 -1px 0 var(--surface)); }
.saved-card { margin-bottom: 16px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.saved-card h3 { margin: 0 0 12px; font-size: 20px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.saved-card p { color: var(--text-muted); font-size: 14px; }
.saved-card-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.saved-card-actions button { background: transparent; border-color: transparent; padding: 8px; }
.saved-card-actions button:first-child { color: var(--accent); font-weight: 600; }
.saved-card-actions button:last-child { color: var(--danger); }
.empty-saved { font-size: 14px; line-height: 1.5; color: var(--text-muted); padding: 16px 0; }
#new-route { width: 100%; margin-top: 24px; }
dialog { width: min(460px,calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius-dialog); color: var(--text); background: var(--surface-raised); box-shadow: var(--shadow-overlay); }
dialog::backdrop { background: rgb(0 0 0 / .48); }
dialog .eyebrow { padding-right: 24px; }
dialog p { color: var(--text-muted); font-size: 14px; line-height: 1.5; }
dialog form { display: flex; flex-direction: column; gap: 16px; margin: 24px 0 12px; }
dialog label { display: flex; flex-direction: column; gap: 8px; }
dialog input { width: 100%; }
dialog small { font-size: 12px; color: var(--text-muted); }
dialog .primary { justify-content: center; }
.dialog-close { position: absolute; right: 12px; top: 12px; width: 40px; padding: 0; border-color: transparent; background: transparent; color: var(--text-muted); font-size: 24px; }
.error { color: var(--danger) !important; font-size: 14px; margin: 0; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 3000; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; padding: 16px 24px; border: 1px solid var(--control-border); border-radius: var(--radius-control); background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-overlay); font-size: 14px; }
.help-list { font-size: 14px; padding-left: 24px; line-height: 1.5; }
.help-list li { margin-bottom: 12px; }
details { margin-top: 16px; font-size: 14px; }
summary { cursor: pointer; color: var(--accent); min-height: 40px; padding: 8px 0; }
#instructions { padding-left: 24px; max-height: 240px; overflow-y: auto; }
#instructions li { padding: 8px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 1100px) {
  .header { padding: 16px 24px; gap: 16px; flex-wrap: wrap; }
  .header-right { gap: 8px; }
  .theme-control label { display: none; }
  main { grid-template-columns: 360px minmax(0,1fr); }
  .sidebar { padding: 24px; }
  .map-title { top: 16px; left: 16px; padding: 12px; }
  .map-title div > span { max-width: 180px; }
}
@media (max-width: 900px) {
  .header { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
  .header nav { grid-column: 1 / -1; grid-row: 2; }
  .header nav button { flex: 1; }
  main { height: calc(100dvh - 137px); }
  .theme-control label { display: block; }
  .map-title { max-width: calc(100% - 88px); }
  .map-title div > span { display: none; }
  .map-bottom { left: 16px; right: 16px; }
  .map-tip { font-size: 12px; padding: 12px; }
  .routing-badge { left: 16px; max-width: calc(100% - 32px); bottom: 120px; }
}
@media (max-width: 700px) {
  button, select, input { min-height: 44px; }
  .header { padding: 12px 16px; gap: 12px 8px; }
  .brand { font-size: 20px; gap: 8px; }
  .brand-mark { width: 28px; height: 32px; font-size: 24px; }
  .header-right { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .theme-control label { display: none; }
  .theme-control select { max-width: 96px; padding: 8px; }
  #account-button { max-width: 88px; padding: 8px; }
  #account-button span { display: none; }
  #logout-button { padding: 8px; }
  main { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .map-shell { order: -1; height: 420px; min-height: 360px; }
  .sidebar { padding: 24px 16px; overflow: visible; border-right: 0; }
  h1 { font-size: 28px; }
  .route-summary, .saved-card { padding: 16px; }
  .map-title { top: 16px; left: 16px; }
  .map-title div > span { display: block; font-size: 12px; max-width: 200px; }
  .map-controls { right: 16px; top: 128px; }
  .map-controls button, .map-help { width: 44px; }
  .leaflet-control-zoom { margin: 16px 16px 0 0 !important; }
  .leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 44px !important; }
  .map-bottom { bottom: 48px; }
  .routing-badge { bottom: 116px; }
  .map-tip { font-size: 12px; }
  .leaflet-control-scale { margin-bottom: 24px !important; }
  dialog { padding: 24px; }
  .route-tools button { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; }
}
