:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --panel: #ffffff;
  --ink: #1d2522;
  --muted: #64716b;
  --line: #d7ded8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --route: #2563eb;
  --mapped: #0f766e;
  --unmapped: #c2410c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 650;
}

button:disabled {
  border-color: #bdc7c0;
  background: #d9e0db;
  color: #718078;
  cursor: not-allowed;
}

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  height: 100vh;
  min-height: 620px;
}

.sidebar {
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #eef2ee;
  padding: 14px;
}

.panel {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 13px;
}

.brand-row h1,
.panel-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand-row h1 {
  font-size: 24px;
  line-height: 1.1;
}

.brand-row p,
.hint {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  font-size: 16px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.file-picker {
  display: grid;
  border: 1px dashed #9aa8a0;
  border-radius: 8px;
  padding: 12px;
}

.control-grid,
.form-row,
.journey-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#routeLinkSelect {
  min-height: 170px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.journey-list {
  display: grid;
  gap: 6px;
  max-height: 285px;
  overflow: auto;
  padding-right: 2px;
}

.journey-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #fbfcfb;
}

.journey-item input {
  width: auto;
  min-height: 0;
  margin-top: 3px;
}

.journey-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.journey-meta {
  margin-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.4;
}

.garage-editor {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.map-wrap {
  position: relative;
  min-width: 0;
}

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

.status-bar {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 500;
  max-width: min(720px, calc(100% - 28px));
  border: 1px solid rgba(29, 37, 34, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(29, 37, 34, 0.12);
  padding: 9px 11px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.leaflet-marker-icon.vertex-marker {
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--route);
  box-shadow: 0 2px 8px rgba(29, 37, 34, 0.35);
}

.stop-dot {
  border: 2px solid #fff;
  border-radius: 999px;
  background: #111827;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 48vh minmax(520px, auto);
    height: auto;
  }

  .map-wrap {
    grid-row: 1;
  }

  .sidebar {
    grid-row: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
}
