:root {
  color-scheme: dark;
  --bg: #0d0e0c;
  --panel: #171a17;
  --panel-strong: #1f241f;
  --panel-soft: #22221c;
  --text: #f4f2e8;
  --muted: #a5a699;
  --line: rgba(244, 242, 232, 0.14);
  --green: #6ae1b8;
  --amber: #f0b35b;
  --blue: #87a8ff;
  --red: #ef7b72;
  --ink: #080908;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.app-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 26px 0 40px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.96;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.8rem, 5vw, 4.6rem);
  line-height: 0.94;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.provider-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel);
  white-space: nowrap;
  font-size: 0.88rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  flex: 0 0 auto;
}

.provider-strip.is-good .status-dot {
  background: var(--green);
}

.provider-strip.is-warn .status-dot {
  background: var(--amber);
}

.provider-strip.is-bad .status-dot {
  background: var(--red);
}

.search-panel {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.flight-form {
  flex: 1 1 420px;
}

.flight-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 8px;
  max-width: 520px;
}

.input-row input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #0f110f;
  outline: none;
  text-transform: uppercase;
}

.input-row input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(106, 225, 184, 0.14);
}

.input-row button {
  display: grid;
  place-items: center;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: var(--green);
}

.input-row svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.quick-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #111310;
}

.message-panel {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.message-panel.is-bad {
  border-color: rgba(239, 123, 114, 0.44);
  color: #ffd8d4;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.hero-card,
.route-panel,
.timeline-card,
.detail-card,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.hero-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  min-height: 214px;
  padding: 24px;
  align-items: center;
  background: #151914;
}

.hero-copy p:last-child {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.progress-ring {
  position: relative;
  width: clamp(120px, 17vw, 168px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg,
.ring-value {
  fill: none;
  stroke-width: 9;
}

.ring-bg {
  stroke: rgba(244, 242, 232, 0.12);
}

.ring-value {
  stroke: var(--green);
  stroke-linecap: round;
  transition: stroke-dashoffset 220ms ease;
}

.progress-ring span {
  position: absolute;
  font-weight: 800;
  font-size: 1.25rem;
}

.route-panel,
.timeline-card,
.detail-card {
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  margin-bottom: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #242820;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

#routeCanvas {
  width: 100%;
  min-height: 278px;
  aspect-ratio: 2.55 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  background: #10120f;
}

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

.route-endpoints div {
  min-width: 0;
}

.route-endpoints strong {
  display: block;
  font-size: 1.2rem;
}

.route-endpoints span {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 128px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 0.83rem;
}

.metric-card strong {
  font-size: clamp(1.1rem, 2.3vw, 1.8rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.metric-card.tone-good {
  border-color: rgba(106, 225, 184, 0.35);
}

.metric-card.tone-warn {
  border-color: rgba(240, 179, 91, 0.42);
}

.metric-card.tone-bad {
  border-color: rgba(239, 123, 114, 0.45);
}

.metric-card.tone-blue {
  border-color: rgba(135, 168, 255, 0.36);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111310;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--muted);
}

.timeline-item.is-complete .timeline-dot {
  background: var(--green);
}

.timeline-item.is-active .timeline-dot {
  background: var(--amber);
}

.timeline-item strong,
.timeline-item small {
  display: block;
  overflow-wrap: anywhere;
}

.timeline-item small {
  color: var(--muted);
  margin-top: 3px;
}

.delay-chip {
  white-space: nowrap;
  color: var(--amber);
  font-weight: 800;
}

.fact-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
}

.fact-list div,
.coverage-item {
  display: grid;
  grid-template-columns: minmax(120px, 0.55fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 38px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.fact-list div:last-child,
.coverage-item:last-child {
  border-bottom: 0;
}

dt,
.coverage-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

dd,
.coverage-item strong {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.full-span {
  grid-column: 1 / -1;
}

.coverage-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
}

.coverage-warning {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(240, 179, 91, 0.32);
  color: #f7d9a6;
  background: rgba(240, 179, 91, 0.08);
}

.is-loading .input-row button svg {
  animation: pulse 820ms ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.84);
  }
}

@media (max-width: 860px) {
  .topbar,
  .search-panel,
  .hero-card {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .provider-strip {
    width: fit-content;
    white-space: normal;
  }

  .quick-actions {
    justify-content: flex-start;
  }

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

  .hero-card {
    min-height: auto;
  }

  .progress-ring {
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100vw - 18px, 1180px);
    padding-top: 14px;
  }

  .metrics-grid,
  .coverage-list,
  .route-endpoints {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .route-panel,
  .timeline-card,
  .detail-card {
    padding: 13px;
  }

  .timeline-item {
    grid-template-columns: 16px 1fr;
  }

  .delay-chip {
    grid-column: 2;
    justify-self: start;
  }

  .fact-list div,
  .coverage-item {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
