:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: #101c2e;
  --panel-2: #14243a;
  --line: #263a55;
  --text: #f4f7fb;
  --muted: #95a7bd;
  --accent: #28d7a1;
  --accent-2: #1ea7ff;
  --danger: #ff667a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 5%, rgba(30, 167, 255, .18), transparent 28rem),
    radial-gradient(circle at 15% 30%, rgba(40, 215, 161, .10), transparent 26rem),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select { font: inherit; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0 36px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 10px;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
}

h1 {
  margin: 10px 0 14px;
  font-size: clamp(38px, 7vw, 72px);
  line-height: .95;
  letter-spacing: -.06em;
  overflow-wrap: anywhere;
}

.hero p,
.muted {
  margin: 0;
  color: var(--muted);
}

.status-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr .65fr;
  gap: 14px;
  margin-bottom: 14px;
}

.metric,
.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 28, 46, .88);
  backdrop-filter: blur(14px);
}

.metric {
  display: flex;
  min-width: 0;
  min-height: 132px;
  padding: 20px;
  flex-direction: column;
}

.metric > span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metric strong {
  margin-top: auto;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.metric small {
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.state.ok { color: var(--accent); }
.state.error { color: var(--danger); }
.state.running,
.state.queued { color: var(--accent-2); }

.state.running::before,
.state.queued::before {
  display: inline-block;
  width: .7em;
  height: .7em;
  margin-right: .45em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: spin .8s linear infinite;
}

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

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

.card {
  min-width: 0;
  padding: 24px;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.card-heading > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.step {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

h3 {
  margin: 26px 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 11px;
}

.pill.ready {
  border-color: rgba(40, 215, 161, .4);
  color: var(--accent);
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

label {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #091523;
  color: var(--text);
}

select { cursor: pointer; }

input:focus,
select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(30, 167, 255, .12);
}

.button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.button:hover:not(:disabled) { filter: brightness(1.15); }
.button:disabled { cursor: progress; opacity: .7; }

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #03140e;
}

.button.quiet { background: transparent; }

.button.danger {
  margin-top: 16px;
  border-color: rgba(255, 102, 122, .45);
  background: transparent;
  color: var(--danger);
}

.link-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 22px;
}

.link-box input {
  min-width: 0;
  margin: 0;
  border-radius: 10px 0 0 10px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
}

.copy {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 0 10px 10px 0;
  background: var(--accent-2);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.settings-grid,
.trip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 760px;
  gap: 14px;
}

.presentation-grid { max-width: 900px; }

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

.check { position: relative; }

.check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check span {
  display: block;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
}

.check input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(30, 167, 255, .2);
}

.check input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #03140e;
}

.trip-toggle {
  display: flex;
  margin: 24px 0;
  padding: 18px;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #091523;
}

.compact-toggle {
  max-width: 900px;
  margin-top: 14px;
}

.trip-toggle input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 2px 0 0;
  flex: 0 0 18px;
  accent-color: var(--accent);
}

.trip-toggle span {
  display: grid;
  min-width: 0;
  gap: 3px;
  color: var(--text);
}

.trip-toggle small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.trip-card { margin-top: 14px; }
.trip-form { margin-top: 22px; }

.notice {
  margin: 0 0 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow-wrap: anywhere;
}

.notice.success { border-color: rgba(40, 215, 161, .5); }
.notice.error { border-color: rgba(255, 102, 122, .5); }

footer {
  padding-top: 28px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.login-page {
  display: grid;
  padding: 24px;
  place-items: center;
}

.login-shell {
  width: min(430px, 100%);
}

.login-card { padding: clamp(24px, 6vw, 38px); }

.login-card h1 {
  margin: 16px 0 12px;
  font-size: clamp(38px, 12vw, 58px);
}

.login-card .notice { margin-top: 20px; }
.login-form .button { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  .state.running::before,
  .state.queued::before { animation: none; }
}

@media (max-width: 780px) {
  .shell { padding-top: 28px; }
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .status-grid,
  .columns { grid-template-columns: 1fr; }
  .settings-grid,
  .trip-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 540px) {
  input,
  select { font-size: 16px; }
  .shell { width: min(100% - 20px, 1120px); }
  .hero-actions,
  .hero-actions form,
  .hero-actions .button { width: 100%; }
  .settings-grid,
  .trip-grid { grid-template-columns: 1fr; }
  .card,
  .metric { padding: 18px; }
  .card-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .link-box { grid-template-columns: 1fr; }
  .link-box input { border-radius: 10px 10px 0 0; font-size: 16px; }
  .copy {
    padding: 11px 14px;
    border-radius: 0 0 10px 10px;
  }
  .button.danger { width: 100%; }
}
