:root {
  color-scheme: light;
  --ink: #1d252c;
  --muted: #61707d;
  --line: #d7dde2;
  --panel: #f7f8f9;
  --paper: #ffffff;
  --teal: #008b8b;
  --green: #4a9b45;
  --gold: #d49b22;
  --red: #cc5a49;
  --violet: #6e5aa8;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: #e9edf0;
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) repeat(6, minmax(104px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select,
.field output,
button {
  height: 38px;
  border: 1px solid #bfc9d1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.field output {
  display: flex;
  align-items: center;
}

button {
  min-width: 86px;
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 0;
}

.map-pane {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #f3f0e8;
}

#map {
  width: 100%;
  height: 100%;
  background: #edf1f4;
}

.isochrone-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.isochrone-tooltip {
  border: 1px solid rgba(29, 37, 44, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-weight: 750;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.leaflet-container.isochrone-cell-hover {
  cursor: pointer;
}

.leaflet-control-zoom {
  border: 1px solid rgba(29, 37, 44, 0.18) !important;
  border-radius: 6px !important;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12) !important;
}

.leaflet-control-scale-line {
  border-color: rgba(29, 37, 44, 0.36) !important;
  color: var(--ink);
}

.origin-marker {
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border: 3px solid #1d252c;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
}

.legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(29, 37, 44, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.band {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 4px;
  border-radius: 50%;
}

.band-15 {
  background: var(--teal);
}

.band-30 {
  background: var(--green);
}

.band-45 {
  background: var(--gold);
}

.band-60 {
  background: var(--red);
}

.band-90 {
  background: var(--violet);
}

.results {
  min-height: 0;
  overflow: auto;
  background: var(--paper);
  border-left: 1px solid var(--line);
}

.status {
  padding: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.progress {
  height: 6px;
  background: #e8edf1;
  border-bottom: 1px solid var(--line);
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--teal);
  transition: width 120ms linear;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
}

.metric {
  background: var(--panel);
  padding: 10px 12px;
}

.metric strong {
  display: block;
  font-size: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.detail-panel {
  padding: 14px 14px 18px;
}

.detail-panel h2,
.detail-panel h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.detail-panel h2 {
  font-size: 22px;
}

.detail-panel h3 {
  margin-top: 16px;
}

.detail-panel p {
  margin: 0 0 12px;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.detail-grid div {
  background: var(--panel);
  padding: 10px;
}

.detail-grid strong {
  display: block;
  font-size: 17px;
}

.detail-grid span,
.plan-list span {
  color: var(--muted);
  font-size: 12px;
}

.plan-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.plan-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.plan-list strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-list em {
  align-self: center;
  font-style: normal;
  font-weight: 750;
}

.detail-note {
  margin-top: 14px !important;
  font-size: 12px;
}

@media (max-width: 860px) {
  .toolbar {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .origin-field {
    grid-column: 1 / -1;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(420px, 58vh) minmax(260px, 42vh);
  }

  .results {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
