:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #142033;
  --muted: #667085;
  --line: #e4e9f2;
  --brand: #1668e3;
  --brand-dark: #0d4fb5;
  --brand-soft: #eaf1ff;
  --ok: #0f8a5f;
  --ok-soft: #e8f7f0;
  --warn: #a15c00;
  --warn-soft: #fff4df;
  --danger: #c7362f;
  --danger-soft: #fdeceb;
  --radius: 16px;
  --shadow: 0 12px 34px rgba(22, 43, 77, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, #e3efff 0, transparent 28%),
    radial-gradient(circle at 100% 12%, #e9e4ff 0, transparent 26%),
    var(--bg);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 24px 12px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #2e86ff, #1254c8);
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(22, 104, 227, .28);
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.env-pill {
  padding: 7px 11px;
  border: 1px solid #d8e4fa;
  border-radius: 999px;
  color: #2457a5;
  background: #f2f7ff;
  font-size: 12px;
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 10px 24px 56px;
  display: grid;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(220, 228, 242, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card.hidden, .hidden { display: none !important; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.card-head h2 { margin: 0; font-size: 17px; }
.muted { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.badge {
  flex: none;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 5px; }
label > span { color: #475467; font-size: 12px; font-weight: 600; }
input, select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d5deed;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: #7aa8f6;
  box-shadow: 0 0 0 3px rgba(22, 104, 227, .12);
}
input[readonly] { background: #f7f9fc; color: #475467; }
.form-actions { display: flex; align-items: flex-end; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

.primary, .ghost {
  min-height: 38px;
  border-radius: 9px;
  padding: 8px 16px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform .1s, box-shadow .15s, background .15s;
}
.primary {
  color: #fff;
  background: linear-gradient(145deg, #2b82ff, #1259ce);
  box-shadow: 0 7px 18px rgba(22, 104, 227, .22);
}
.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(22, 104, 227, .28); }
.ghost { color: #34507c; background: #f6f9ff; border-color: #dbe6f8; }
.ghost:hover { background: #eef5ff; }

.routing-list { display: grid; gap: 12px; }
.routing {
  display: grid;
  grid-template-columns: 1.5fr 1fr .9fr auto;
  gap: 16px;
  align-items: center;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fcfdff;
}
.routing:hover { border-color: #b9cff3; background: #f8fbff; }
.flight-line { display: flex; align-items: baseline; gap: 8px; }
.flight-no { font-size: 18px; font-weight: 800; letter-spacing: -.2px; }
.carrier { color: var(--muted); font-size: 12px; }
.route-line { margin-top: 5px; color: #344054; font-weight: 700; }
.time-line { margin-top: 4px; color: var(--muted); font-size: 12px; }
.cabin-box { color: #344054; font-size: 12px; }
.cabin-box strong { display: block; color: var(--ink); font-size: 15px; }
.price-box { text-align: right; }
.price { font-size: 23px; font-weight: 800; color: var(--brand-dark); letter-spacing: -.5px; }
.price small { font-size: 12px; font-weight: 600; color: var(--muted); }
.route-actions { display: flex; flex-direction: column; gap: 7px; }
.route-actions .primary, .route-actions .ghost { min-height: 34px; padding: 6px 12px; font-size: 12px; }

.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.steps span {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #f4f7fb;
  font-size: 12px;
  font-weight: 700;
}
.steps span.active { color: var(--brand-dark); background: var(--brand-soft); }
.steps span.done { color: var(--ok); background: var(--ok-soft); }

.flow-grid {
  display: grid;
  grid-template-columns: .9fr 1.4fr .9fr;
  gap: 14px;
  align-items: start;
}
.panel {
  min-height: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcff;
}
.panel h3 { margin: 0 0 12px; font-size: 14px; }
.passenger-list { display: grid; gap: 12px; margin-bottom: 16px; }
.passenger { min-width: 0; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.passenger legend { padding: 0 5px; font-weight: 700; }
.order-contact { margin-bottom: 12px; }
.summary {
  min-height: 104px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed #d9e2f1;
  color: #475467;
  font-size: 12px;
  white-space: pre-wrap;
}
.pay-session { grid-column: span 2; }
.pay-hint { margin: 10px 0 0; font-size: 11px; }
.result-box {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.result-box.ok { background: var(--ok-soft); color: #0b6b4a; }
.result-box.warn { background: var(--warn-soft); color: var(--warn); }
.result-box.bad { background: var(--danger-soft); color: var(--danger); }

.debug-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.debug-grid h3 { margin: 0 0 8px; font-size: 13px; }
.code {
  min-height: 120px;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #d7e3ff;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 11px;
  color: #fff;
  background: #17233a;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .22);
  font-size: 12px;
  z-index: 20;
}
.toast.bad { background: #a92f29; }

@media (max-width: 1100px) {
  .routing { grid-template-columns: 1.4fr 1fr auto; }
  .routing .cabin-box { display: none; }
  .flow-grid { grid-template-columns: 1fr 1fr; }
  .flow-grid .panel:last-child { grid-column: span 2; }
}
@media (max-width: 820px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .form-grid, .form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .routing, .debug-grid, .flow-grid { grid-template-columns: 1fr; }
  .flow-grid .panel:last-child { grid-column: auto; }
  .route-actions { flex-direction: row; }
  .price-box { text-align: left; }
}
