:root {
  --bg: #0d0f12;
  --panel: #15181d;
  --panel-2: #1c2026;
  --line: #2a2f37;
  --text: #e9ecf1;
  --muted: #949cab;
  --accent: #d6342b;      /* Mustang red */
  --accent-2: #f0b31e;    /* amber */
  --ok: #4ec07a;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- header ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.stripe {
  width: 6px; height: 26px; border-radius: 3px; flex: none;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.bar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag {
  flex: none;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  height: calc(100% - 57px);
}
.panel {
  padding: 20px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.map-wrap { position: relative; }
#map { position: absolute; inset: 0; background: #11141a; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .map-wrap { height: 60vh; }
}

/* ---------- form ---------- */
.field { margin-bottom: 18px; }
label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.row { display: flex; gap: 8px; }
input[type=text] {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
}
input[type=text]:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
  border-color: transparent;
}
.hint { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }
.hint.empty { margin-bottom: 14px; }
.hint.ok { color: var(--ok); }
.hint.bad { color: #ff8e85; }

button {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 9px 14px;
  border: 1px solid transparent;
  transition: filter .12s ease, background .12s ease;
}
button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.primary { background: var(--accent); color: #fff; flex: 1; }
.primary:hover { filter: brightness(1.1); }
.primary:disabled { opacity: .55; cursor: progress; }
.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.ghost:hover { background: var(--panel-2); }

.check { display: flex; align-items: center; gap: 9px; margin: 4px 0 18px; text-transform: none; letter-spacing: 0; font-size: .92rem; font-weight: 500; color: var(--text); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.actions { display: flex; gap: 8px; }

/* ---------- stops ---------- */
.stops { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 7px; }
.stops li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stops .n {
  flex: none;
  width: 23px; height: 23px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .76rem;
  font-weight: 700;
}
.stops .label {
  flex: 1;
  min-width: 0;
  font-size: .86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stops .kill {
  flex: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 2px 6px;
  font-size: 1.1rem;
  line-height: 1;
}
.stops .kill:hover { color: #ff8e85; }

/* ---------- result ---------- */
.error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #3a1a18;
  border: 1px solid #6b2a26;
  color: #ffc9c4;
  font-size: .88rem;
}
.result {
  margin-top: 18px;
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.total-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.total strong {
  font-size: 1.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}
.breakdown { margin: 0; display: grid; gap: 10px; }
.breakdown .item { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.breakdown dt { font-weight: 600; font-size: .92rem; }
.breakdown dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.breakdown .detail { margin: 2px 0 0; font-size: .78rem; color: var(--muted); }
.summary {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: .84rem;
  color: var(--muted);
}

/* ---------- rates ---------- */
.rates { margin-top: 18px; }
.rates summary {
  cursor: pointer;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: 6px 0;
}
.rates dl { margin: 8px 0 0; display: grid; gap: 5px; }
.rates .item { display: flex; justify-content: space-between; gap: 12px; font-size: .84rem; }
.rates dt { color: var(--muted); }
.rates dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- address picker ---------- */
.picker {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .6);
}
.picker-inner {
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.picker-inner h2 { margin: 0 0 12px; font-size: 1rem; }
.picker-inner ul { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.picker-inner li button {
  width: 100%;
  text-align: left;
  font-weight: 500;
  font-size: .87rem;
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}
.picker-inner li button:hover { background: #242933; }

/* Leaflet dark-mode tweaks */
.leaflet-container { background: #11141a; }
.leaflet-bar a, .leaflet-control-attribution {
  background: var(--panel) !important;
  color: var(--muted) !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a { border-bottom-color: var(--line) !important; }
