:root {
  --navy: #1b2a4a;
  --amber: #f2a93b;
  --coral: #e8543e;
  --teal: #3f7c74;
  --paper: #fdfbf6;
  --bg: #eeece3;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, #00000009 1px, transparent 0);
  background-size: 22px 22px;
  color: #2c2c2a;
}

#app { max-width: 780px; margin: 0 auto; padding: 24px 16px 64px; }

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--navy);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
h1 svg { flex-shrink: 0; color: var(--coral); }

p.muted, .muted { color: #8a8880; font-size: 0.8rem; }
.mono { font-family: var(--font-mono); letter-spacing: -0.02em; }

.card {
  background: var(--paper);
  border-radius: 14px;
  border: 1px solid #e4e1d6;
  padding: 16px 18px;
  margin-bottom: 16px;
}

label { font-size: 0.7rem; color: #8a8880; text-transform: lowercase; }

.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 3px; }

input, select {
  font: inherit;
  border: none;
  border-bottom: 1.5px dashed #ccc7b8;
  background: transparent;
  padding: 5px 2px;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-bottom-color: var(--coral);
  border-bottom-style: solid;
}
input[type="checkbox"] { accent-color: var(--navy); }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 9px 15px;
  background: var(--navy);
  color: white;
  transition: opacity 0.15s, transform 0.1s;
}
button:hover { opacity: 0.9; }
button:active { transform: scale(0.98); }
button:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
button.secondary { background: #e4e1d6; color: var(--navy); }
button.ghost { background: transparent; color: var(--navy); padding: 5px 9px; }
button.danger { background: transparent; color: #b23; padding: 2px 6px; }
button:disabled { opacity: 0.5; cursor: default; }

.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

/* ---- login: boarding pass ---- */
.login-wrap { display: flex; justify-content: center; padding-top: 12vh; }
.ticket {
  display: flex;
  background: var(--paper);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 0 #00000008;
  border: 1px solid #e4e1d6;
  max-width: 420px;
  width: 100%;
  position: relative;
}
.ticket::before {
  content: "";
  position: absolute;
  right: 118px;
  top: 0; bottom: 0;
  width: 0;
  border-left: 2px dashed #d9d5c7;
}
.ticket-main { flex: 1; padding: 26px 24px; }
.ticket-brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--navy);
  margin-bottom: 2px;
}
.ticket-brand svg { color: var(--coral); }
.ticket-sub { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; color: #a39d8a; text-transform: uppercase; margin: 0 0 18px; }
.ticket-stub {
  width: 118px;
  background: var(--navy);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 8px;
}
.ticket-stub .mono { font-size: 0.62rem; letter-spacing: 0.08em; opacity: 0.7; text-align: center; }
.ticket-stub .stub-big { font-size: 1.6rem; font-weight: 600; opacity: 1; }

/* ---- trip list ---- */
.trip-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border: 1px solid #e4e1d6; border-radius: 12px; margin-bottom: 8px; background: var(--paper);
  cursor: pointer;
  transition: border-color 0.15s;
}
.trip-item:hover { border-color: var(--coral); }

/* ---- tabs ---- */
.tabbar {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin: 12px 0 18px; padding-bottom: 2px; border-bottom: 1px solid #e4e1d6;
}
.tabbar button {
  background: transparent; color: #8a8880; padding: 7px 12px; font-size: 0.85rem;
  border-radius: 8px 8px 0 0; position: relative;
}
.tabbar button.active { color: var(--navy); font-weight: 600; }
.tabbar button.active::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -3px; height: 2px; background: var(--coral);
}

/* ---- routes ---- */
.routes { display: flex; gap: 16px; flex-wrap: wrap; }
.route-pass { flex: 1; min-width: 280px; border-radius: 14px; overflow: hidden; border: 1px solid #ddd; background: var(--paper); }
.route-pass.chosen { border-width: 2px; }
.route-head {
  padding: 10px 14px; color: white; font-weight: 600; font-family: var(--font-display);
  display: flex; justify-content: space-between; align-items: center;
}
.route-body { padding: 14px; }

.leg { background: rgba(255,255,255,0.7); border: 1px solid #e4e1d6; border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; }

.mode-toggle { display: flex; border: 1px solid #ccc; border-radius: 999px; overflow: hidden; font-size: 0.7rem; }
.mode-toggle button { padding: 3px 9px; border-radius: 0; background: transparent; color: #888; }
.mode-toggle button.active { background: var(--navy); color: white; }

.badge { font-size: 0.65rem; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.badge.direct { background: #3f7c7422; color: var(--teal); }
.badge.stop { background: #e8543e22; color: var(--coral); }

.result-option {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; text-align: left; padding: 5px 8px; margin-bottom: 4px;
  border: 1px solid #e4e1d6; border-radius: 6px; background: white; font-size: 0.8rem;
}
.result-option.selected { border-color: var(--amber); background: #f2a93b22; }

.totals { border-top: 2px dotted #ccc; padding-top: 10px; margin-top: 10px; font-size: 0.85rem; }
.totals .grand { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 10px; }
.totals .grand .amount { font-size: 1.4rem; font-weight: 700; font-family: var(--font-mono); }

.banner {
  background: #f2a93b22; border: 1px solid #f2a93b66; border-radius: 14px;
  padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; margin-top: 12px;
}

.share-box { padding: 10px 14px; margin-bottom: 12px; }

.error { color: #b23; font-size: 0.8rem; margin-top: 6px; }
.success { color: var(--teal); font-size: 0.8rem; margin-top: 6px; }

.autocomplete { position: relative; }
.autocomplete-list {
  position: absolute; z-index: 5; background: white; border: 1px solid #ddd; border-radius: 8px;
  width: 100%; max-height: 180px; overflow-y: auto; box-shadow: 0 6px 16px rgba(0,0,0,0.1); margin-top: 2px;
}
.autocomplete-list div { padding: 7px 10px; font-size: 0.8rem; cursor: pointer; }
.autocomplete-list div:hover { background: #f1efe8; }

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
