:root {
  --accent: #d8232a;
  --accent-dark: #a91b21;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #dfe2e6;
  --text: #1c1f24;
  --muted: #6b7280;
  --success: #1a7f37;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  background: var(--accent);
  color: white;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

header h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 600;
}

header .subtitle {
  font-size: 12px;
  opacity: 0.85;
}

nav.tabs {
  display: flex;
  gap: 4px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

nav.tabs .tab-link {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

nav.tabs .tab-link.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

nav.tabs .account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

nav.tabs .account button {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

main {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  height: calc(100vh - 92px);
}

.panel {
  padding: 20px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

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

.page { display: none; }
.page.active { display: block; }

.page-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

input[type=text], input[type=number], input[type=datetime-local] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.name-row {
  display: flex;
  gap: 8px;
}

.name-row > div {
  flex: 1;
  min-width: 0;
}

.name-row > div.narrow { flex: 0 0 80px; }

.point-picker {
  display: flex;
  gap: 8px;
  align-items: center;
}

.point-picker button {
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
}

.point-picker button.picking {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.autocomplete {
  position: relative;
  flex: 1;
  min-width: 0;
}

.autocomplete-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1000;
}

.autocomplete-list.show { display: block; }

.autocomplete-list li {
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.3;
}

.autocomplete-list li:hover,
.autocomplete-list li.active {
  background: var(--bg);
}

.coord-readout {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.submit-btn {
  margin-top: 20px;
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.submit-btn:hover { background: var(--accent-dark); }
.submit-btn:disabled { background: var(--muted); cursor: not-allowed; }

.submit-btn.secondary {
  margin-top: 4px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.submit-btn.secondary:hover { background: var(--border); }

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.status-msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: none;
}

.status-msg.show { display: block; }
.status-msg.ok { background: #e6f4ea; color: var(--success); }
.status-msg.err { background: #fdecea; color: #b3261e; }

.drive-list { margin-top: 8px; }

.drive-card, .match-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg);
}

.drive-card.clickable { cursor: pointer; }
.drive-card.clickable:hover { border-color: var(--muted); }

.link-btn {
  margin-top: 6px;
  padding: 0;
  border: none;
  background: none;
  color: #b3261e;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.drive-card .route, .match-card .route {
  font-weight: 600;
  font-size: 14px;
}

.drive-card .meta, .match-card .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.match-card .score {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #e6f4ea;
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
}

.match-card .score.warn {
  background: #fff4e5;
  color: #995c00;
}

.last-mile, .transit-box {
  margin-top: 8px;
  padding: 8px 10px;
  background: white;
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.transit-box.alt {
  border-style: solid;
  border-color: var(--border);
}

.transit-box .conn {
  padding: 4px 0;
  border-top: 1px solid var(--border);
}

.transit-box .conn:first-of-type { border-top: none; }

.empty-state {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  margin: 18px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #eef0f3;
  color: var(--muted);
  margin-left: 6px;
}

/* Public transport connections, flight-search style (see renderConnections) */
.pt-conn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.pt-conn:first-of-type { border-top: none; }

.pt-logos {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 28px;
  align-items: center;
}
.pt-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  text-decoration: none;
}
.pt-logo img { width: 20px; height: 20px; }
.pt-code {
  font-size: 8px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
}

.pt-body { flex: 1; min-width: 0; }
.pt-times { font-size: 14px; font-weight: 600; }
.pt-meta { color: var(--muted); }
.pt-legs { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 3px; }
.pt-leg {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: #eef0f3;
  color: var(--text);
}
.pt-ops { margin-top: 3px; color: var(--muted); }
.pt-ops a { color: var(--muted); }

.pt-book {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.pt-book:hover { background: var(--accent-dark); }
