:root {
  --ink: #054752;
  --muted: #708c91;
  --line: #d7e2e4;
  --soft: #eef7f8;
  --accent: #00aff5;
  --accent-dark: #007f9f;
  --green: #00a870;
  --surface: #ffffff;
  --bg: #f5f8f9;
  --shadow: 0 2px 12px rgba(5, 71, 82, 0.08);
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(82px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 18px 13px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(215, 226, 228, 0.85);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin-bottom: 2px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.icon-button.loading span {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

main {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 14px 12px 28px;
}

.route-tabs {
  display: flex;
  gap: 8px;
  margin: 1px 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.route-tabs::-webkit-scrollbar {
  display: none;
}

.route-chip {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.route-chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.search-card {
  position: relative;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.route-menu-button {
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
}

.search-card.has-menu .search-route {
  padding-right: 34px;
}

.search-route {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  column-gap: 10px;
}

.search-line {
  display: grid;
  grid-template-rows: 16px 27px 16px;
  justify-items: center;
  padding-top: 3px;
}

.search-line .dot {
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.search-line .dot:first-child {
  background: var(--ink);
}

.search-line .line {
  width: 2px;
  height: 100%;
  background: var(--ink);
}

.search-place {
  min-width: 0;
  padding-bottom: 12px;
}

.search-place:last-child {
  padding-bottom: 0;
}

.search-place .label {
  font-size: 16px;
  font-weight: 800;
}

.search-place .sub {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-meta {
  display: flex;
  gap: 8px;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

button.meta-pill {
  cursor: pointer;
}

button.meta-pill::after {
  content: '›';
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 21px 4px 10px;
}

.results-title {
  font-size: 17px;
  font-weight: 800;
}

.updated-at {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.count-pill {
  min-width: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.trip-list {
  display: grid;
  gap: 11px;
}

.trip-card {
  overflow: hidden;
  border: 1px solid rgba(215, 226, 228, 0.9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.trip-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 17px 16px 15px;
}

.timeline {
  display: grid;
  grid-template-columns: 48px 18px minmax(0, 1fr);
  column-gap: 6px;
  min-width: 0;
}

.time-col {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  padding: 1px 0;
}

.time {
  font-size: 15px;
  font-weight: 800;
}

.line-col {
  display: grid;
  grid-template-rows: 14px 1fr 14px;
  justify-items: center;
  min-height: 100px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.line-col .dot {
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: white;
}

.line-col .dot-filled {
  background: var(--ink);
}

.route-line {
  width: 2px;
  height: calc(100% + 4px);
  background: var(--ink);
}

.location-col {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.city {
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.address {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}

.duration-row {
  display: flex;
  align-items: center;
  min-height: 32px;
}

.duration {
  color: var(--muted);
  font-size: 12px;
}

.price-col {
  min-width: 78px;
  text-align: right;
}

.price {
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.seat-label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.card-divider {
  height: 1px;
  margin: 0 16px;
  background: var(--line);
}

.driver-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px 8px;
}

.avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.avatar,
.avatar-fallback {
  position: absolute;
  inset: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.avatar {
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  background: #d8edef;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
}

.driver-main {
  min-width: 0;
  flex: 1;
}

.driver-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.driver-rating {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.verified-badge {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 900;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px 71px;
}

.badge {
  padding: 5px 7px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.badge.good {
  background: #e8f8f2;
  color: var(--green);
}

.vehicle-row {
  margin: 0 16px 12px 71px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
}

.open-trip {
  display: flex;
  width: calc(100% - 32px);
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 4px 16px 16px;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: var(--accent);
  color: white;
  font-weight: 850;
  box-shadow: 0 7px 18px rgba(0, 175, 245, 0.22);
  cursor: pointer;
}

.open-trip:active {
  transform: translateY(1px);
}

.open-trip span {
  font-size: 22px;
  line-height: 0.8;
}

.bottom-nav {
  position: fixed;
  z-index: 25;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 7px 16px calc(7px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  gap: 2px;
  justify-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.nav-item.active {
  color: var(--accent-dark);
}

.nav-icon {
  font-size: 19px;
}

.state-card {
  margin-top: 70px;
  padding: 26px 20px;
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
  text-align: center;
}

.state-card h2 {
  margin: 10px 0 7px;
  font-size: 20px;
}

.state-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.state-icon {
  font-size: 33px;
}

.loading-stack {
  display: grid;
  gap: 12px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #e7eef0;
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.65) 50%, transparent 80%);
  content: "";
  animation: shimmer 1.2s infinite;
}

.search-skeleton {
  height: 175px;
}

.trip-skeleton {
  height: 250px;
}

.sheet-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: 70px;
  background: rgba(2, 35, 41, 0.34);
  backdrop-filter: blur(2px);
}

.route-sheet {
  width: min(100%, 680px);
  max-height: calc(100vh - 54px);
  overflow-y: auto;
  padding: 8px 16px calc(22px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: white;
  box-shadow: 0 -12px 40px rgba(5, 71, 82, 0.16);
  animation: sheet-in 0.2s ease-out;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 2px auto 14px;
  border-radius: 999px;
  background: #c9d6d8;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sheet-head h2 {
  margin: 1px 0 0;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.sheet-head.compact {
  margin-bottom: 11px;
}

.sheet-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.route-field-wrap {
  position: relative;
}

.route-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
}

.route-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 175, 245, 0.09);
}

.route-field-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: white;
}

.route-field-icon.filled {
  background: var(--ink);
}

.route-field-body {
  min-width: 0;
  flex: 1;
}

.route-field-label,
.option-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.route-field input,
.option-card input,
.option-card select {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
}

.route-field input::placeholder {
  color: #9fb2b5;
  font-weight: 600;
}

.route-field-connector {
  width: 2px;
  height: 13px;
  margin-left: 18px;
  background: var(--ink);
}

.place-suggestions {
  position: absolute;
  z-index: 95;
  right: 0;
  left: 0;
  overflow: hidden;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 12px 32px rgba(5, 71, 82, 0.16);
}

.place-option {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
}

.place-option:last-child {
  border-bottom: 0;
}

.place-pin {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  font-size: 14px;
}

.place-loading {
  pointer-events: none;
}

.place-spinner {
  animation: spin 0.8s linear infinite;
}

.place-copy {
  min-width: 0;
}

.place-name {
  font-size: 14px;
  font-weight: 800;
}

.place-address {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.route-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}

.option-card {
  min-width: 0;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--soft);
}

.option-card select {
  appearance: none;
}

.primary-button {
  width: 100%;
  margin-top: 16px;
  padding: 15px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 15px;
  font-weight: 850;
  box-shadow: 0 7px 18px rgba(0, 175, 245, 0.22);
}

.primary-button:disabled {
  opacity: 0.6;
}

.action-sheet,
.confirm-sheet {
  width: min(100%, 680px);
  padding: 8px 16px calc(18px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: white;
  box-shadow: 0 -12px 40px rgba(5, 71, 82, 0.16);
  animation: sheet-in 0.2s ease-out;
}

.action-route-summary {
  margin-bottom: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: var(--soft);
}

.action-route-main {
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
}

.action-route-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.action-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border: 0;
  border-radius: 14px;
  background: white;
  text-align: left;
}

.action-row.danger {
  background: #fff3f3;
  color: #b73b3b;
}

.action-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
  background: rgba(183, 59, 59, 0.1);
}

.action-row strong,
.action-row small {
  display: block;
}

.action-row strong {
  font-size: 14px;
}

.action-row small {
  margin-top: 3px;
  color: #8e6666;
  font-size: 11px;
  line-height: 1.35;
}

.confirm-sheet {
  text-align: center;
}

.confirm-icon {
  width: 54px;
  height: 54px;
  margin: 2px auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff0f0;
  font-size: 25px;
}

.confirm-sheet h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.confirm-sheet p {
  margin: 8px auto 18px;
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.danger-button,
.secondary-button {
  width: 100%;
  padding: 14px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 850;
}

.danger-button {
  border: 0;
  background: #d94343;
  color: white;
}

.danger-button:disabled {
  opacity: 0.6;
}

.secondary-button {
  margin-top: 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.schedule-editor {
  margin-top: 4px;
}

.schedule-option {
  display: block;
  padding: 14px;
}

.schedule-option input {
  font-size: 17px;
}

.seat-stepper {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--soft);
}

.seat-stepper button {
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.seat-stepper button:disabled {
  opacity: 0.35;
}

.seat-stepper div {
  text-align: center;
}

.seat-stepper strong,
.seat-stepper span {
  display: block;
}

.seat-stepper strong {
  font-size: 28px;
  line-height: 1.05;
}

.seat-stepper span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  background: #fff0f0;
  color: #a43b3b;
  font-size: 12px;
  font-weight: 700;
}

.route-chip.add-route {
  border-style: dashed;
  color: var(--accent-dark);
}

.hidden {
  display: none !important;
}

@keyframes sheet-in {
  from {
    transform: translateY(20px);
    opacity: 0.7;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 640px) {
  main {
    padding-right: 18px;
    padding-left: 18px;
  }

  .trip-list {
    grid-template-columns: 1fr;
  }
}
