:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #66737f;
  --line: #d7dee6;
  --surface: #ffffff;
  --soft: #f3f7f9;
  --green: #0f8a5f;
  --red: #b42318;
  --amber: #b86b00;
  --blue: #2266b3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #e8eef1;
}

button,
input,
select {
  font: inherit;
}

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

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: auto;
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.kicker,
.label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.08;
}

.brand-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.live-dot {
  width: 12px;
  height: 12px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(15, 138, 95, 0.14);
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--soft);
}

.field select {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
}

.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(34, 102, 179, 0.12);
}

.data-summary,
.empty-state {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.quick-access {
  display: grid;
  gap: 8px;
}

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

.chip-row button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--blue);
  border: 1px solid #bfd5ea;
  border-radius: 999px;
  background: #f0f6fc;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.combo {
  position: relative;
}

.route-button {
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  cursor: pointer;
}

.route-button:hover,
.route-button.active {
  background: #f0f6fc;
}

.route-button strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.route-button span,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.route-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 800;
  display: none;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(23, 33, 43, 0.16);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 120ms ease-out, transform 120ms ease-out;
}

.route-dropdown.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.route-dropdown .empty-state {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.status-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.status-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce6ed;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 260ms ease-out;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pills span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.journey-timeline {
  display: grid;
  padding: 4px 0;
}

.timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  min-height: 54px;
}

.timeline-row::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: -18px;
  width: 2px;
  background: var(--line);
}

.timeline-row:last-child::before {
  display: none;
}

.timeline-dot {
  z-index: 1;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--line);
  box-shadow: 0 0 0 1px var(--line);
}

.timeline-row.done .timeline-dot {
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}

.timeline-row.current .timeline-dot {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(34, 102, 179, 0.12);
}

.timeline-row strong {
  display: block;
  font-size: 14px;
}

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

.timeline-time {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.tracker-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.badge {
  min-width: 74px;
  padding: 7px 10px;
  text-align: center;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.badge.low {
  color: var(--amber);
  background: #fff3df;
}

.badge.medium {
  color: var(--blue);
  background: #e7f1fd;
}

.badge.high {
  color: var(--green);
  background: #e4f7ee;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.actions button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.actions .primary {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.primary {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.consent-note,
.footer-links {
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.footer-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}

.tool-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.watch-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #bcd8cc;
  border-radius: 8px;
  background: #f1faf6;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-title strong {
  display: block;
  font-size: 15px;
}

.trust-score,
.premium-pill,
.risk-badge {
  align-self: flex-start;
  min-width: max-content;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.trust-score {
  color: var(--green);
  background: #e4f7ee;
}

.premium-pill {
  color: var(--blue);
  background: #e7f1fd;
}

.risk-badge {
  color: var(--amber);
  background: #fff3df;
}

.risk-badge.high {
  color: var(--red);
  background: #fee4df;
}

.risk-badge.low {
  color: var(--green);
  background: #e4f7ee;
}

.trust-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trust-breakdown span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.section-title button,
.secondary-actions button,
.segmented button,
.report-grid button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.section-title button.active,
.segmented button.active,
.secondary-actions button.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.compact-field {
  gap: 6px;
}

.eta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.eta-row div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.eta-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.eta-row strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.report-grid button.reported {
  border-color: var(--blue);
  background: #e7f1fd;
  color: var(--blue);
}

.secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button:disabled,
select:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.status-grid div {
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.status-grid strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
}

.map-wrap {
  position: relative;
  min-height: 100vh;
  background: #eef3f5;
}

.map-wrap.is-hidden {
  display: none;
}

#map {
  position: absolute;
  inset: 0;
}

.map-caption {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 500;
  display: grid;
  gap: 3px;
  max-width: min(460px, calc(100% - 40px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 45px rgba(23, 33, 43, 0.16);
}

.map-caption span {
  color: var(--muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(6 28 47 / 42%);
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgb(6 28 47 / 22%);
}

.modal-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.route-corridor {
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: none;
}

.route-corridor-dash {
  stroke-linecap: round;
}

.stop-pin {
  width: 16px;
  height: 16px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 6px 18px rgba(23, 33, 43, 0.28);
}

.stop-pin.destination {
  background: var(--red);
}

.bus-pulse {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #ffffff;
  border-radius: 8px;
  background: var(--green);
  box-shadow: 0 4px 14px rgba(23, 33, 43, 0.22);
}

.bus-pulse::before {
  content: "";
  width: 13px;
  height: 8px;
  border-radius: 3px;
  background: #ffffff;
  box-shadow:
    -4px 6px 0 -2px #ffffff,
    4px 6px 0 -2px #ffffff;
}

.bus-pulse::after {
  display: none;
}

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

  .panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .map-wrap {
    min-height: 58vh;
  }
}

@media (max-width: 520px) {
  .panel {
    padding: 20px;
  }

  .actions,
  .status-grid,
  .eta-row,
  .secondary-actions {
    grid-template-columns: 1fr;
  }

  .report-grid {
    grid-template-columns: 1fr 1fr;
  }
}
