:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --ink: #17201c;
  --muted: #657168;
  --line: #dde5dd;
  --green: #197850;
  --green-soft: #dff3e9;
  --blue: #2569a9;
  --blue-soft: #e1eefb;
  --amber: #9a640c;
  --amber-soft: #fff0cc;
  --red: #b33a32;
  --red-soft: #ffe3df;
  --shadow: 0 16px 40px rgba(28, 42, 35, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.9), transparent 30%),
    linear-gradient(160deg, #eef6ef 0%, #f8f7f0 55%, #eef3f9 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 96px;
  position: relative;
}

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

.eyebrow {
  margin: 0 0 2px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.icon-button,
.swap-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(28, 42, 35, 0.06);
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.search-field span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-weight: 750;
  background: transparent;
}

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

.stats-grid article {
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.stats-grid strong {
  display: block;
  font-size: 24px;
}

.stats-grid span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 6px;
  margin: 14px 0 10px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.toolbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.date-filter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.date-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.date-filter input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 650;
}

.chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 650;
}

.chip.active {
  border-color: transparent;
  background: var(--green-soft);
  color: var(--green);
}

.feed {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.feed.active {
  display: flex;
}

.ride-card,
.driver-card,
.profile-card,
.match-card,
.empty-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 24px rgba(28, 42, 35, 0.07);
}

.empty-card {
  color: var(--muted);
  line-height: 1.45;
}

.empty-card code {
  display: block;
  margin-top: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #f0f4f0;
  color: var(--ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.muted-card {
  opacity: 0.92;
}

.card-head,
.driver-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.badge.live {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.verified {
  background: var(--green-soft);
  color: var(--green);
}

.badge.match {
  background: var(--amber-soft);
  color: var(--amber);
  margin-bottom: 12px;
}

.time,
.details,
.quote,
.driver-row p,
.match-grid span,
.label {
  color: var(--muted);
}

.time {
  font-size: 12px;
}

.route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 14px 0 8px;
  font-size: 20px;
  font-weight: 850;
  line-height: 1.12;
}

.route span {
  min-width: 0;
}

.route span:last-child {
  text-align: right;
}

.route i {
  width: 28px;
  height: 2px;
  background: var(--green);
  position: relative;
}

.route i::after {
  content: "";
  position: absolute;
  right: 0;
  top: -4px;
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--green);
  border-right: 2px solid var(--green);
  transform: rotate(45deg);
}

.details,
.quote {
  margin: 0 0 10px;
  line-height: 1.35;
}

.debug-line {
  margin: -4px 0 10px;
  color: var(--amber);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.quote {
  color: var(--ink);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.actions.single-action {
  grid-template-columns: 1fr;
}

.actions button,
.action-link,
.fab {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.actions .ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.actions .danger {
  background: var(--red-soft);
  color: var(--red);
}

.action-link {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.edit-dialog {
  width: min(calc(100vw - 28px), 430px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.edit-dialog::backdrop {
  background: rgba(23, 32, 28, 0.35);
}

.edit-dialog form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head strong {
  font-size: 16px;
}

.edit-field span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.edit-field input,
.edit-field select,
.edit-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.edit-field input,
.edit-field select {
  min-height: 40px;
}

.edit-field textarea {
  min-height: 76px;
  resize: vertical;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.dialog-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.dialog-actions .ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button:disabled {
  opacity: 0.55;
}

.driver-row {
  justify-content: flex-start;
}

.driver-row .badge {
  margin-left: auto;
}

.avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.avatar.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.driver-row h2 {
  margin: 0 0 2px;
  font-size: 16px;
}

.driver-row p {
  margin: 0;
  font-size: 12px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 10px;
}

.profile-meta span {
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.profile-card .quote {
  margin-top: 8px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.check-field input {
  width: 18px;
  height: 18px;
}

.match-grid {
  display: grid;
  gap: 10px;
}

.match-grid > div {
  padding: 10px;
  border-radius: 8px;
  background: #f7faf7;
}

.label {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.match-grid strong,
.match-grid span {
  display: block;
}

.match-grid strong {
  margin-bottom: 4px;
}

.fab {
  position: fixed;
  left: 50%;
  bottom: 18px;
  width: min(428px, calc(100% - 32px));
  transform: translateX(-50%);
  box-shadow: 0 18px 34px rgba(25, 120, 80, 0.32);
}

@media (max-width: 380px) {
  .app-shell {
    padding-inline: 12px;
  }

  h1 {
    font-size: 26px;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .swap-button {
    width: 100%;
  }

  .route {
    font-size: 18px;
  }
}
