/* ============================================================
   GLIDEPATH — Aero demand forecasting
   Dark / bold-fintech system · pink #ff3ea5 accent
   ============================================================ */

:root {
  /* surfaces */
  --bg:        #08090c;
  --bg-1:      #0e1015;
  --bg-2:      #14171f;
  --bg-3:      #1b1f29;
  --line:      rgba(255,255,255,0.07);
  --line-2:    rgba(255,255,255,0.13);
  --line-3:    rgba(255,255,255,0.20);

  /* ink */
  --text:      #f3f4f7;
  --dim:       #aab0bd;
  --faint:     #8b92a2;
  --mute:      #6a7180;

  /* brand */
  --pink:      #ff3ea5;
  --pink-2:    #ff6fbd;
  --pink-deep: #c4196f;
  --pink-soft: rgba(255,62,165,0.13);
  --pink-line: rgba(255,62,165,0.40);
  --pink-glow: rgba(255,62,165,0.28);

  /* data series */
  --cyan:      #38e1ff;
  --lime:      #c4ff4d;
  --violet:    #9b8cff;
  --amber:     #ffb03a;

  /* status */
  --ok:        #34e0a1;
  --warn:      #ffb03a;
  --bad:       #ff5d6c;

  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;

  --shadow: 0 18px 50px -18px rgba(0,0,0,0.7);
  --glow:   0 0 0 1px var(--pink-line), 0 8px 30px -8px var(--pink-glow);

  --sans: "Space Grotesk", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;

  --nav-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

#root { height: 100vh; }

/* ambient texture */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(1100px 700px at 88% -8%, rgba(255,62,165,0.10), transparent 60%),
    radial-gradient(900px 600px at -6% 108%, rgba(56,225,255,0.05), transparent 55%);
  pointer-events: none; z-index: 0;
}

::selection { background: var(--pink); color: #fff; }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: content-box; }

/* ---------- typography helpers ---------- */
.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

h1,h2,h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-family: var(--sans);
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 18px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text);
  cursor: pointer; transition: all .16s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--line-3); background: var(--bg-3); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--pink); border-color: var(--pink);
  color: #12030a; box-shadow: 0 8px 24px -10px var(--pink-glow);
}
.btn-primary:hover { background: var(--pink-2); border-color: var(--pink-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text); }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--bg-2); color: var(--dim); cursor: pointer; transition: all .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

/* chips / tags */
.chip {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em;
  padding: 4px 9px; border-radius: 100px; border: 1px solid var(--line-2);
  color: var(--dim); display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.chip-pink { color: var(--pink-2); border-color: var(--pink-line); background: var(--pink-soft); }
.chip-ok   { color: var(--ok); border-color: rgba(52,224,161,0.35); background: rgba(52,224,161,0.08); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot-ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot-pink { background: var(--pink); box-shadow: 0 0 10px var(--pink); }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.panel-pad { padding: 22px; }

.kpi {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  position: relative; overflow: hidden;
}
.kpi-accent::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--pink); box-shadow: 0 0 18px var(--pink-glow);
}
.kpi-label { display: flex; align-items: center; gap: 8px; }
.kpi-value { font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 10px; line-height: 1; }
.kpi-sub { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--dim); }

.delta { font-family: var(--mono); font-size: 12.5px; display: inline-flex; align-items: center; gap: 3px; }
.delta-up { color: var(--ok); }
.delta-down { color: var(--bad); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: grid; grid-template-columns: var(--nav-w) 1fr; height: 100vh; position: relative; z-index: 1; }

.nav {
  background: var(--bg-1); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--pink); display: grid; place-items: center; color: #12030a;
  box-shadow: 0 6px 18px -6px var(--pink-glow);
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.03em; }
.brand-name span { color: var(--pink); }

.nav-section { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); padding: 16px 10px 6px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--dim); font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .14s; position: relative;
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active { background: var(--pink-soft); color: var(--pink-2); border-color: var(--pink-line); }
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item .step-n { font-family: var(--mono); font-size: 11px; width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; background: var(--bg-2); color: var(--faint); }
.nav-item.active .step-n { background: var(--pink); color: #12030a; }
.nav-item.done .step-n { background: rgba(52,224,161,0.15); color: var(--ok); }
.nav-disabled { opacity: .4; pointer-events: none; }

.nav-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.nav-air {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-sm);
  background: var(--bg-2); border: 1px solid var(--line);
}
.nav-air-code { font-family: var(--mono); font-weight: 700; font-size: 15px; color: var(--pink-2); }

/* main column */
/* min-width:0 lets this grid item shrink below the intrinsic width of its
   content (e.g. a chart SVG mid-resize), preventing horizontal blowout. */
.main { overflow-y: auto; overflow-x: hidden; height: 100vh; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 30px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
}
.topbar-title { display: flex; align-items: baseline; gap: 12px; }
.topbar-title h2 { font-size: 19px; }
.content { padding: 30px; max-width: 1320px; margin: 0 auto; }

.grid { display: grid; gap: 16px; }
/* grid items default to min-width:auto and won't shrink below their content's
   intrinsic width — a chart SVG mid-resize would otherwise blow out the track.
   Letting them shrink keeps every column bound to its share of the row. */
.grid > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2,1fr); }
.g-3 { grid-template-columns: repeat(3,1fr); }
.g-4 { grid-template-columns: repeat(4,1fr); }

/* segmented control */
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--dim);
  padding: 7px 14px; border: none; background: transparent; border-radius: 7px; cursor: pointer; transition: all .14s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--pink); color: #12030a; }
.seg.seg-sub button.on { background: var(--bg-3); color: var(--pink-2); }

/* compact select (event simulator) */
.seg-select {
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-xs);
  padding: 5px 7px; cursor: pointer; outline: none; flex: none;
}
.seg-select:hover { border-color: var(--line-3); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); text-align: right; padding: 10px 14px; border-bottom: 1px solid var(--line-2); font-weight: 400; }
.tbl th:first-child { text-align: left; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl td:first-child { text-align: left; font-family: var(--sans); color: var(--dim); }
.tbl tr:hover td { background: var(--bg-1); }
.tbl tr:last-child td { border-bottom: none; }

/* sliders */
.lever { padding: 16px 0; border-bottom: 1px solid var(--line); }
.lever:last-child { border-bottom: none; }
.lever-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lever-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.lever-val { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--pink-2); }
.lever-desc { font-size: 13px; color: var(--faint); margin-top: 3px; max-width: 90%; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--bg-3); outline: none; cursor: pointer; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--pink); border: 3px solid #1a0710; box-shadow: 0 0 0 1px var(--pink), 0 0 14px var(--pink-glow); cursor: grab;
}
input[type=range]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.1); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--pink); border: 3px solid #1a0710; cursor: grab; }

/* charts */
.chart-wrap { width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--dim); }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend-line { width: 16px; height: 0; border-top: 2px solid; flex: none; }

.tip {
  position: absolute; pointer-events: none; z-index: 50;
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  padding: 9px 11px; font-size: 12px; box-shadow: var(--shadow); min-width: 130px;
  transform: translate(-50%, -110%); transition: opacity .1s;
}
.tip-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.tip-k { color: var(--dim); display: flex; align-items: center; gap: 6px; }
.tip-v { font-family: var(--mono); font-weight: 700; }

/* progress / connect */
.src-row {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-1);
  transition: all .3s;
}
.src-row.connected { border-color: rgba(52,224,161,0.3); }
.src-ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line-2); flex: none; color: var(--pink-2); font-family: var(--mono); font-weight: 700; font-size: 13px; }
.src-bar { height: 4px; border-radius: 4px; background: var(--bg-3); overflow: hidden; margin-top: 9px; }
.src-bar > i { display: block; height: 100%; background: var(--pink); border-radius: 4px; transition: width .4s ease; box-shadow: 0 0 10px var(--pink-glow); }
.src-row.connected .src-bar > i { background: var(--ok); box-shadow: 0 0 10px rgba(52,224,161,0.5); }

/* method note */
.method {
  font-size: 13px; color: var(--dim); line-height: 1.6;
  border-left: 2px solid var(--pink-line); padding: 2px 0 2px 14px; background: var(--pink-soft);
  border-radius: 0 8px 8px 0; padding: 12px 14px;
}
.method b { color: var(--dim); font-weight: 600; }
.formula { font-family: var(--mono); font-size: 12.5px; color: var(--cyan); }

/* data caveat — amber, for low-confidence / proxy series */
.caveat {
  font-size: 13px; color: var(--dim); line-height: 1.6;
  border-left: 2px solid var(--warn); background: rgba(255,176,58,0.09);
  border-radius: 0 8px 8px 0; padding: 12px 14px;
}
.caveat b { color: var(--warn); font-weight: 700; }
.caveat em { color: var(--text); font-style: normal; font-weight: 600; }

/* search */
.search {
  display: flex; align-items: center; gap: 11px; padding: 14px 18px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-md);
}
.search input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--sans); font-size: 16px; }
.search input::placeholder { color: var(--faint); }

.air-card {
  display: flex; align-items: center; gap: 16px; padding: 15px 18px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-1); transition: all .14s;
}
.air-card:hover { border-color: var(--line-2); background: var(--bg-2); transform: translateX(2px); }
.air-card.sel { border-color: var(--pink-line); background: var(--pink-soft); box-shadow: var(--glow); }
.air-code { font-family: var(--mono); font-weight: 700; font-size: 16px; color: var(--pink-2); width: 46px; flex: none; }
.air-meta { font-size: 12.5px; color: var(--faint); font-family: var(--mono); }

.fade-in { animation: fade .4s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

hr.sep { border: none; border-top: 1px solid var(--line); margin: 0; }

.stat-strip { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.stat-strip > div { flex: 1; padding: 14px 18px; border-right: 1px solid var(--line); }
.stat-strip > div:last-child { border-right: none; }
.stat-strip .num { font-size: 18px; font-weight: 700; }

/* ============================================================
   RESPONSIVE / MOBILE
   The desktop shell is a fixed sidebar + scrolling main column.
   On narrow screens the sidebar becomes an off-canvas drawer,
   the topbar trims to essentials, and every multi-column grid
   collapses so the whole flow reads top-to-bottom on a phone.
   ============================================================ */
.mobile-only { display: none; }
.nav-overlay { display: none; }

@media (max-width: 860px) {
  .mobile-only { display: inline-flex; }

  /* sidebar → off-canvas drawer */
  .app { grid-template-columns: 1fr; }
  .nav {
    position: fixed; top: 0; left: 0; bottom: 0; width: 270px; max-width: 84vw;
    z-index: 60; transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--shadow); overflow-y: auto;
  }
  .nav.open { transform: none; }
  .nav-overlay {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px);
    animation: fade .2s ease both;
  }

  /* topbar: drop the verbose chips, keep nav + title + export */
  .topbar { padding: 12px 14px; gap: 10px; }
  .topbar-chips { display: none !important; }
  .topbar-title { gap: 8px; min-width: 0; }
  .topbar-title h2 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .btn-sm { padding: 7px 10px; }

  /* tighten the canvas */
  .content { padding: 18px 14px; }
  .panel-pad { padding: 16px; }

  /* collapse every multi-column grid (overrides inline templates) */
  .content .grid { grid-template-columns: 1fr !important; }
  .content .grid.g-4 { grid-template-columns: repeat(2, 1fr) !important; }

  /* screen-specific tweaks */
  /* Airport picker: drop the inner scroll entirely on mobile. With its own
     overflow:auto + overscroll-behavior:contain, a touch-drag over the cards
     was captured by a container that couldn't scroll, so the gesture never
     chained up to the page and the screen felt frozen. Letting the list flow
     into the normal page scroll fixes that. */
  .air-grid {
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
  }
  .lever-panel { position: static !important; }         /* don't pin levers */
  .confirm-bar { flex-direction: column; align-items: stretch !important; }
  .confirm-bar .btn { width: 100%; justify-content: center; }

  /* wide tables scroll horizontally instead of bursting the panel */
  .tbl { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* typography */
  h1 { font-size: 27px !important; }
  .kpi-value { font-size: 25px; }
}

@media (max-width: 460px) {
  .content .grid.g-4 { grid-template-columns: 1fr !important; }
  .stat-strip { flex-wrap: wrap; }
  .stat-strip > div { flex: 1 0 50%; }
}
