:root {
  --bg: #081118;
  --bg-deep: #04080c;
  --panel: rgba(11, 24, 33, 0.86);
  --panel-strong: rgba(14, 31, 43, 0.95);
  --line: rgba(165, 202, 219, 0.18);
  --line-strong: rgba(165, 202, 219, 0.34);
  --text: #ecf4f6;
  --text-dim: rgba(236, 244, 246, 0.72);
  --text-soft: rgba(236, 244, 246, 0.56);
  --accent: #ff6f3c;
  --accent-2: #20c997;
  --accent-3: #f7b538;
  --danger: #ff5d73;
  --warn: #ffb020;
  --info: #58c4ff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.34);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(32, 201, 151, 0.17), transparent 42%),
    radial-gradient(circle at 88% 10%, rgba(255, 111, 60, 0.2), transparent 48%),
    radial-gradient(circle at 50% 100%, rgba(88, 196, 255, 0.08), transparent 52%),
    linear-gradient(180deg, #09131b 0%, #050a0f 60%, #030507 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 20px 20px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1400px, calc(100% - 2rem));
  margin: 1rem auto 2rem;
}

.hero {
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 28, 38, 0.93), rgba(10, 18, 25, 0.93));
  border-radius: calc(var(--radius-lg) + 4px);
  box-shadow: var(--shadow);
}

.hero__copy {
  padding: 0.35rem 0.25rem;
}

.hero__eyebrow {
  margin: 0;
  font-size: 0.77rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(236, 244, 246, 0.72);
}

.hero h1 {
  margin: 0.35rem 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  line-height: 0.95;
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.hero__lead {
  max-width: 70ch;
  margin: 0.7rem 0 0;
  color: var(--text-dim);
  line-height: 1.4;
}

.hero__summary {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.05), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
  min-height: 108px;
}

.summary-card__label {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-card__value {
  margin: 0.45rem 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  line-height: 1.05;
}

.summary-card__value--sm {
  font-size: 1.05rem;
  line-height: 1.2;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 700;
}

.summary-card__sub {
  margin: 0.45rem 0 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.dashboard {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr);
  grid-template-areas:
    "map route"
    "members alerts";
  align-items: start;
}

.panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 21, 29, 0.92), rgba(9, 15, 22, 0.94));
  box-shadow: var(--shadow);
  overflow: clip;
}

.panel--map {
  grid-area: map;
}

.panel--route {
  grid-area: route;
}

.panel--members {
  grid-area: members;
}

.panel--alerts {
  grid-area: alerts;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.05rem 0.85rem;
  border-bottom: 1px solid rgba(165, 202, 219, 0.1);
  background: rgba(255, 255, 255, 0.01);
}

.panel__head h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.3rem;
}

.panel__head p {
  margin: 0.35rem 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.panel__actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(88, 196, 255, 0.85);
  outline-offset: 2px;
}

.btn--primary {
  background: linear-gradient(135deg, #ff7b4f, #ff5f2d);
  box-shadow: 0 10px 24px rgba(255, 111, 60, 0.24);
}

.btn--secondary {
  background: linear-gradient(135deg, #1ebd90, #129f78);
  box-shadow: 0 10px 24px rgba(32, 201, 151, 0.2);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

.btn--small {
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
}

.map-card {
  padding: 1rem;
}

.map-canvas {
  position: relative;
  min-height: 360px;
  border-radius: 18px;
  border: 1px solid rgba(165, 202, 219, 0.18);
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 15%, rgba(255, 111, 60, 0.11), transparent 35%),
    radial-gradient(circle at 15% 85%, rgba(32, 201, 151, 0.14), transparent 40%),
    linear-gradient(180deg, rgba(18, 34, 45, 0.95), rgba(9, 18, 24, 0.98));
}

.map-canvas::before,
.map-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-canvas::before {
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 36px 36px;
}

.map-canvas::after {
  background:
    radial-gradient(circle at 82% 24%, rgba(255, 111, 60, 0.15), transparent 20%),
    radial-gradient(circle at 20% 72%, rgba(88, 196, 255, 0.1), transparent 22%);
}

.map-canvas__routes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-canvas__markers {
  position: absolute;
  inset: 0;
}

.map-canvas__empty {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: rgba(7, 13, 18, 0.82);
  border: 1px solid var(--line);
  color: var(--text-dim);
}

.map-route-line {
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-dasharray: 2.2 2.8;
  opacity: 0.9;
}

.map-route-line--destination {
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 0;
}

.map-route-dot {
  fill: rgba(255, 255, 255, 0.08);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 0.2;
}

.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
}

.map-marker__dot {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  background: var(--marker, var(--accent));
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.25);
  animation: pulse 2s infinite;
}

.map-marker__label {
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(6, 10, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.13);
  white-space: nowrap;
}

.map-marker--destination .map-marker__dot {
  width: 1.1rem;
  height: 1.1rem;
  background: linear-gradient(135deg, #ffc857, #ff8f2a);
  animation-duration: 2.6s;
}

.map-marker--destination .map-marker__label {
  background: rgba(30, 17, 4, 0.8);
  border-color: rgba(255, 200, 87, 0.35);
}

.map-card__footer {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgba(165, 202, 219, 0.1);
}

.map-card__footer p {
  margin: 0;
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(165, 202, 219, 0.1);
}

.map-card__footer .label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-soft);
}

.map-card__footer strong {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.95rem;
}

.stack-form {
  padding: 1rem 1rem 0;
  display: grid;
  gap: 0.8rem;
}

.stack-form--dense {
  padding-top: 0.9rem;
}

.stack-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--text-dim);
  font-size: 0.87rem;
}

.form-row {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

input,
select,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(165, 202, 219, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.7rem 0.8rem;
  font: inherit;
}

input::placeholder {
  color: rgba(236, 244, 246, 0.42);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

textarea::placeholder {
  color: rgba(236, 244, 246, 0.42);
}

select option {
  color: #111;
}

.list-block {
  padding: 1rem;
}

.list-block__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.list-block__head--compact {
  align-items: center;
  margin-bottom: -0.1rem;
}

.list-block__head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.list-block__head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.empty-inline {
  margin: 0.75rem 0 0;
  color: var(--text-soft);
  font-size: 0.85rem;
}

#agent-error {
  color: #ffc2cb;
}

.stop-list,
.member-list,
.alert-list {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
}

.stop-list {
  display: grid;
  gap: 0.55rem;
}

.form-row--actions {
  grid-template-columns: 1fr 1fr;
  align-items: end;
}

.form-row--actions .btn {
  width: 100%;
}

.list-block--agent {
  padding-top: 0.9rem;
}

.agent-result {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.agent-result__primary {
  padding: 0.85rem;
  border-radius: 16px;
  border: 1px solid rgba(165, 202, 219, 0.14);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 111, 60, 0.08), transparent 42%),
    rgba(255, 255, 255, 0.02);
}

.agent-result__eyebrow {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.agent-result__primary h4 {
  margin: 0.35rem 0 0;
  font-size: 1rem;
  font-family: "Fraunces", Georgia, serif;
}

.agent-result__detail {
  margin: 0.4rem 0 0;
  color: var(--text-dim);
  font-size: 0.86rem;
}

.agent-result__chips {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.agent-result__why {
  margin: 0.6rem 0 0;
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.35;
}

.agent-result__alts {
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(165, 202, 219, 0.1);
  background: rgba(255, 255, 255, 0.01);
}

.agent-result__alts .stop-list {
  margin-top: 0.6rem;
}

.agent-alt-item {
  display: grid;
  gap: 0.12rem;
}

.agent-alt-item__name {
  margin: 0;
  font-weight: 700;
  font-size: 0.88rem;
}

.agent-alt-item__meta {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.stop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(165, 202, 219, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.stop-item__name {
  margin: 0;
  font-weight: 700;
}

.stop-item__meta {
  margin: 0.18rem 0 0;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid rgba(165, 202, 219, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.member-list {
  padding: 1rem;
  padding-top: 0.9rem;
  display: grid;
  gap: 0.75rem;
}

.member-card {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 0;
  border-radius: 16px;
  border: 1px solid rgba(165, 202, 219, 0.12);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.member-card__swatch {
  background: linear-gradient(180deg, var(--member-color, var(--info)), transparent 110%);
}

.member-card__content {
  padding: 0.85rem 0.9rem;
}

.member-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.member-card__name {
  margin: 0;
  font-size: 1rem;
}

.member-card__eta {
  margin: 0.25rem 0 0;
  color: var(--text-dim);
  font-size: 0.86rem;
}

.member-card__chips {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(165, 202, 219, 0.17);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-size: 0.74rem;
  font-weight: 700;
}

.pill--ok {
  border-color: rgba(32, 201, 151, 0.34);
  color: #9df1d7;
  background: rgba(32, 201, 151, 0.08);
}

.pill--warn {
  border-color: rgba(255, 176, 32, 0.36);
  color: #ffd892;
  background: rgba(255, 176, 32, 0.08);
}

.pill--danger {
  border-color: rgba(255, 93, 115, 0.34);
  color: #ffc2cb;
  background: rgba(255, 93, 115, 0.08);
}

.pill--info {
  border-color: rgba(88, 196, 255, 0.34);
  color: #b9e7ff;
  background: rgba(88, 196, 255, 0.08);
}

.pill--muted {
  color: var(--text-soft);
}

.progress {
  margin-top: 0.7rem;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  border: 1px solid rgba(165, 202, 219, 0.08);
}

.progress__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 111, 60, 0.95), rgba(32, 201, 151, 0.95));
  transition: width 180ms ease;
}

.member-card__foot {
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.member-card__arrival {
  color: var(--text-dim);
  font-size: 0.82rem;
  text-align: right;
}

.switch {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 0.45rem;
  align-items: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  user-select: none;
}

.switch__label {
  font-weight: 700;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.switch__track {
  width: 2.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 0.12rem;
  left: 0.12rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  background: white;
  transition: transform 150ms ease;
}

.switch input:checked + .switch__track {
  background: rgba(32, 201, 151, 0.32);
  border-color: rgba(32, 201, 151, 0.42);
}

.switch input:checked + .switch__track::after {
  transform: translateX(0.98rem);
}

.weather-card {
  margin: 1rem;
  margin-bottom: 0.25rem;
  padding: 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(165, 202, 219, 0.14);
  background:
    radial-gradient(circle at 85% 12%, rgba(88, 196, 255, 0.1), transparent 30%),
    rgba(255, 255, 255, 0.02);
}

.weather-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.weather-card__head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.weather-card__advisory {
  margin: 0.65rem 0 0;
  line-height: 1.35;
}

.weather-card__meta {
  margin: 0.5rem 0 0;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.alert-list {
  display: grid;
  gap: 0.5rem;
}

.alert-item {
  display: grid;
  grid-template-columns: 0.6rem minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: start;
  padding: 0.75rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(165, 202, 219, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.alert-item__dot {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.36rem;
  border-radius: 999px;
  background: var(--alert-color, var(--info));
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.03);
}

.alert-item__message {
  margin: 0;
  font-weight: 700;
}

.alert-item__detail {
  margin: 0.18rem 0 0;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.3;
}

.alert-item__time {
  color: var(--text-soft);
  font-size: 0.75rem;
  white-space: nowrap;
  margin-top: 0.08rem;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.24);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

@media (max-width: 1180px) {
  .hero__summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "route"
      "members"
      "alerts";
  }

  .map-card__footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: calc(100% - 1rem);
    margin-top: 0.5rem;
  }

  .hero,
  .panel {
    border-radius: 16px;
  }

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

  .panel__head {
    flex-direction: column;
    align-items: stretch;
  }

  .panel__actions {
    width: 100%;
  }

  .panel__actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-row--actions {
    grid-template-columns: 1fr;
  }

  .map-canvas {
    min-height: 280px;
  }

  .map-card__footer {
    grid-template-columns: 1fr;
  }

  .member-card__head,
  .member-card__foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .member-card__arrival {
    text-align: left;
  }

  .alert-item {
    grid-template-columns: 0.6rem minmax(0, 1fr);
  }

  .alert-item__time {
    grid-column: 2;
    margin-top: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0ms !important;
    scroll-behavior: auto !important;
  }
}
