/* =============================================================================
   Flamingo Network Lab — design system
   "Airbnb for airlines": warm, generous, card-based, calm. Coral/flamingo
   accent, soft shadows, rounded corners, friendly geometric sans.
   ============================================================================= */

:root {
  /* palette */
  --bg: #f6f8fb;
  --bg-2: #edf3f7;
  --surface: #ffffff;
  --ink: #17202a;
  --ink-2: #506070;
  --ink-3: #8290a0;
  --line: #dfe7ee;
  --line-2: #edf2f6;

  --coral: #ef476f;
  --coral-600: #d9365f;
  --coral-50: #fff1f5;
  --flamingo: #ff7d98;
  --teal: #119c8d;
  --teal-50: #e6f6f4;
  --amber: #d9902f;
  --amber-50: #fff6e8;
  --violet: #6f63d2;
  --green: #198754;
  --red: #d6455d;

  --grad: linear-gradient(120deg, #ef476f 0%, #f97361 100%);
  --grad-soft: linear-gradient(120deg, #ffffff 0%, #eef6f7 100%);

  --shadow-sm: 0 1px 2px rgba(20, 32, 44, .05), 0 1px 3px rgba(20, 32, 44, .04);
  --shadow: 0 10px 28px rgba(20, 32, 44, .08), 0 2px 8px rgba(20, 32, 44, .05);
  --shadow-lg: 0 22px 58px rgba(20, 32, 44, .14);

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 8px;
  --maxw: 1240px;

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .4em; letter-spacing: 0; font-weight: 700; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; color: var(--ink-2); }
a { color: var(--coral-600); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--ink-3); }
.muted { color: var(--ink-3); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.center { text-align: center; }

/* ---- top navigation ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 250, 247, .82);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 8px; height: 66px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.12rem; letter-spacing: 0; margin-right: auto; white-space: nowrap; }
.brand .mark { width: 30px; height: 30px; display: grid; place-items: center; }
.brand .mark svg { width: 30px; height: 30px; }
.brand .logo-mark { width: 148px; height: 48px; overflow: visible; }
.brand .logo-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-title { color: var(--coral-600); font-weight: 800; font-size: 1.08rem; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--ink-2); font-weight: 600; font-size: .92rem;
  padding: 8px 14px; border-radius: 999px; text-decoration: none; transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--bg-2); color: var(--ink); }
.nav-links a.active { background: var(--ink); color: #fff; }
@media (max-width: 860px) { .nav-links { display: none; } }

/* ---- buttons & controls ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: .95rem;
  padding: 12px 20px; border-radius: 999px; border: 0;
  background: var(--grad); color: #fff; box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .15s, filter .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); filter: brightness(1.03); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--ink-3); background: var(--bg-2); }
.btn.sm { padding: 8px 14px; font-size: .85rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-weight: 600; font-size: .85rem; padding: 7px 13px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); transition: all .14s;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700;
  padding: 4px 9px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2);
  letter-spacing: .02em; text-transform: uppercase;
}
.tag.coral { background: var(--coral-50); color: var(--coral-600); }
.tag.teal { background: var(--teal-50); color: var(--teal); }
.tag.amber { background: var(--amber-50); color: #b9791f; }

/* ---- cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 20px;
}
.card.pad-lg { padding: 28px; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.card-title h3 { margin: 0; }
.card .sub { color: var(--ink-3); font-size: .88rem; margin: 0 0 16px; }

/* ---- sections ---- */
section { padding: 72px 0; }
section.tight { padding: 44px 0; }
.eyebrow { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .76rem; color: var(--coral-600); margin-bottom: 10px; }
.section-head { max-width: 720px; margin-bottom: 36px; }
.section-head.center { margin-left: auto; margin-right: auto; }

/* ---- hero ---- */
.hero { background: var(--grad-soft); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.hero .wrap { position: relative; z-index: 2; padding-top: 70px; padding-bottom: 64px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
@media (max-width: 940px) { .hero-grid { grid-template-columns: 1fr; gap: 28px; } }
.hero h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p.lead { font-size: 1.16rem; color: var(--ink-2); max-width: 540px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-stats { display: flex; gap: 28px; margin-top: 34px; flex-wrap: wrap; }
.hero-stats .stat .n { font-size: 1.7rem; font-weight: 800; letter-spacing: 0; }
.hero-stats .stat .l { font-size: .82rem; color: var(--ink-3); font-weight: 600; }

/* hero visual: mini network */
.hero-visual { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 18px; }
.hero-visual svg { width: 100%; height: auto; display: block; }

/* ---- studio layout ---- */
.studio-grid { display: grid; grid-template-columns: 340px 1fr; gap: 26px; align-items: start; }
@media (max-width: 1040px) { .studio-grid { grid-template-columns: 1fr; } }
.rail { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1040px) { .rail { position: static; } }

.rail-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.rail-card > .rc-head { padding: 14px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rail-card > .rc-head h4 { margin: 0; font-size: .95rem; }
.rail-card > .rc-body { padding: 14px 16px; }
.rc-head .hint { font-size: .72rem; color: var(--ink-3); font-weight: 600; }

/* preset chips */
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* sliders / inputs */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: .86rem; margin-bottom: 7px; }
.field label .val { font-weight: 800; color: var(--coral-600); font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px; border-radius: 999px;
  background: var(--line); outline: none; margin: 6px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--coral); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--coral); cursor: pointer; }
.range-grad::-webkit-slider-runnable-track { border-radius: 999px; }

select, input[type="number"] {
  font-family: inherit; font-size: .9rem; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%;
}

/* fleet stepper */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 1.1rem; font-weight: 700; cursor: pointer; color: var(--ink); line-height: 1; }
.stepper button:hover { background: var(--bg-2); border-color: var(--ink-3); }
.stepper .num { min-width: 26px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

.fleet-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.fleet-row:last-child { border-bottom: 0; }
.fleet-row .ac { display: flex; align-items: center; gap: 9px; }
.fleet-row .dot { width: 11px; height: 11px; border-radius: 3px; }
.fleet-row .nm { font-weight: 600; font-size: .88rem; }
.fleet-row .sub { font-size: .74rem; color: var(--ink-3); }

/* dual-range bound control */
.bound-row { padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.bound-row:last-child { border-bottom: 0; }
.bound-row .top { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; font-weight: 600; }
.bound-row .top .rng { font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 700; font-size: .78rem; }
.minmax { display: flex; gap: 10px; margin-top: 4px; }
.minmax .mm { flex: 1; }
.minmax .mm span { font-size: .68rem; color: var(--ink-3); display: block; }

/* ---- KPI row ---- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm); }
.kpi .l { font-size: .76rem; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.kpi .n { font-size: 1.62rem; font-weight: 800; letter-spacing: 0; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: .78rem; font-weight: 600; margin-top: 2px; }
.kpi .d.up { color: var(--green); }
.kpi .d.down { color: var(--red); }
.kpi.accent { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.accent .l { color: rgba(255,255,255,.6); }
.kpi.accent .d { color: rgba(255,255,255,.7); }

/* ---- live formula ---- */
.formula {
  font-family: var(--mono); background: #1d1c22; color: #f3eee9; border-radius: var(--r);
  padding: 22px 22px; overflow-x: auto; line-height: 2; font-size: .95rem;
}
.formula .lhs { color: #ffd9a0; font-weight: 700; }
.formula .op { color: #8c8896; margin: 0 2px; }
.formula .term { padding: 2px 7px; border-radius: 7px; transition: background .2s, color .2s; white-space: nowrap; display: inline-block; }
.formula .term.profit { background: rgba(47,170,106,.16); color: #8be0ad; }
.formula .term.conn { background: rgba(123,97,201,.18); color: #c7b6f2; }
.formula .term.own { background: rgba(224,80,106,.16); color: #ff9fb0; }
.formula .term .c { font-weight: 700; }
.formula .term .vname { color: #fff; opacity: .85; }
.formula .w { color: #ffd9a0; font-weight: 700; }
.formula .small { font-size: .8rem; color: #8c8896; }
.formula-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: .8rem; }
.formula-legend .lg { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-weight: 600; }
.formula-legend .sw { width: 13px; height: 13px; border-radius: 4px; }

/* math (clean HTML typesetting for the reference equations) */
.math { font-family: var(--mono); font-size: .95rem; color: var(--ink); background: var(--bg-2); border-radius: var(--r-sm); padding: 14px 16px; overflow-x: auto; }
.math sub { font-size: .72em; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 3px; }
.frac .nu { border-bottom: 1.5px solid currentColor; padding: 0 5px; }
.frac .de { padding: 2px 5px; }

/* ---- result schedule grid ---- */
.sched { display: grid; gap: 9px; }
.sched-row { display: grid; grid-template-columns: 96px 30px 1fr 92px; align-items: center; gap: 12px; }
.sched-row .rk { font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; }
.sched-row .ac-dot { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: .62rem; font-weight: 800; }
.freqbar { display: flex; gap: 5px; align-items: center; }
.freqbar .f { width: 26px; height: 26px; border-radius: 7px; background: var(--bg-2); border: 1px dashed var(--line); display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: var(--ink-3); }
.freqbar .f.on { background: var(--grad); color: #fff; border: 0; box-shadow: var(--shadow-sm); }
.freqbar .f.min { box-shadow: inset 0 0 0 2px rgba(0,0,0,.18); }
.sched-row .ebit { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .88rem; }
.sched-row .ebit.neg { color: var(--red); }
.sched-row .ebit.pos { color: var(--green); }
.sched-row.dropped { opacity: .45; }

/* ---- constraint bars ---- */
.cons { display: flex; flex-direction: column; gap: 12px; }
.con { }
.con .top { display: flex; justify-content: space-between; font-size: .82rem; font-weight: 600; margin-bottom: 5px; }
.con .top .nm { color: var(--ink); }
.con .top .sp { color: var(--ink-3); font-weight: 700; font-variant-numeric: tabular-nums; }
.con .track { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; position: relative; }
.con .fill { height: 100%; border-radius: 999px; background: var(--teal); transition: width .4s ease; }
.con.binding .fill { background: var(--grad); }
.con .rhs-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .35; }
.con.binding .tag-b { color: var(--coral-600); }

/* ---- charts ---- */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .chart-grid { grid-template-columns: 1fr; } }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--ink-2); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .grid-l { stroke: var(--line-2); stroke-width: 1; }
.legend-inline { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-2); font-weight: 600; margin-top: 8px; }
.legend-inline .li { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline .sw { width: 11px; height: 11px; border-radius: 3px; }

/* route selector pills */
.route-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* ---- generic grids ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* feature card (learn) */
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 1.4rem; margin-bottom: 14px; }

/* table */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.tbl th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); font-weight: 700; }
.tbl td { font-variant-numeric: tabular-nums; }
.tbl tr:hover td { background: var(--bg); }
.tbl .num { text-align: right; }
.type-codes { display: flex; flex-wrap: wrap; gap: 4px; }
.type-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: .72rem;
  font-weight: 800;
}
.type-code.legacy {
  background: var(--amber-50);
  color: #9a641a;
  border: 1px dashed #e6c58e;
}

/* network map */
.netmap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 12px; }
.netmap svg { width: 100%; height: auto; display: block; }

/* callout */
.callout { background: var(--coral-50); border: 1px solid #ffd9df; border-left: 4px solid var(--coral); border-radius: var(--r-sm); padding: 14px 16px; font-size: .9rem; color: var(--ink-2); }
.callout.teal { background: var(--teal-50); border-color: #c4ece8; border-left-color: var(--teal); }
.callout strong { color: var(--ink); }

/* solve status */
.solve-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dot-status { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(47,170,106,.16); }
.dot-status.warn { background: var(--amber); box-shadow: 0 0 0 4px rgba(240,162,59,.16); }
.dot-status.err { background: var(--red); box-shadow: 0 0 0 4px rgba(224,80,106,.16); }
.spin { width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--coral); border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* footer */
footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--ink-3); font-size: .85rem; background: var(--bg-2); }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* accordion */
.acc { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.acc + .acc { margin-top: 12px; }
.acc summary { cursor: pointer; padding: 16px 20px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary .plus { color: var(--coral); font-size: 1.3rem; transition: transform .2s; }
.acc[open] summary .plus { transform: rotate(45deg); }
.acc .acc-body { padding: 0 20px 20px; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---- preset stickiness + slider help ---- */
.chip.modified { border-color: var(--coral); color: var(--coral-600); border-style: dashed; background: var(--coral-50); }
.applied { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); margin-top: 4px; }
.applied .dot-status { width: 8px; height: 8px; }
.mod-badge { background: var(--coral-50); color: var(--coral-600); font-weight: 800; font-size: .68rem; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.reset-link { background: none; border: 0; color: var(--coral-600); font-weight: 700; cursor: pointer; font-size: .8rem; font-family: inherit; padding: 0; }
.reset-link:hover { text-decoration: underline; }
.hint-text { font-size: .76rem; color: var(--ink-3); line-height: 1.45; margin-top: 5px; }
.hint-text a { font-weight: 700; }
.ass-link { display: inline-block; margin-top: 12px; font-size: .82rem; font-weight: 700; }

/* fleet thumbnail in rail */
.ac-thumb { width: 58px; height: 30px; object-fit: contain; flex-shrink: 0; }
.fleet-row .ac { gap: 7px; }

/* partnership row */
.partner-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.partner-row .nm { font-weight: 700; font-size: .9rem; }
.partner-row .sub { font-size: .74rem; color: var(--ink-3); }

/* schedule stats */
.sched-stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.sched-stats .ss { flex: 1; min-width: 120px; background: var(--bg-2); border-radius: var(--r-sm); padding: 12px 14px; }
.sched-stats .ss .n { font-size: 1.4rem; font-weight: 800; letter-spacing: 0; }
.sched-stats .ss .l { font-size: .74rem; color: var(--ink-3); font-weight: 600; }
.sched-stats .ss.warn { background: var(--coral-50); }
.sched-stats .ss.warn .n { color: var(--coral-600); }
.routing-table { margin-top: 8px; }
.routing-table td { vertical-align: top; }
.flight-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  margin: 0 4px 5px 0;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--ink);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: help;
}
.flight-chip em { color: var(--ink-3); font-style: normal; font-weight: 600; }
.tbl tr.warn-row td { background: var(--coral-50); }
.ron { color: var(--coral-600); font-weight: 700; background: var(--coral-50); padding: 2px 9px; border-radius: 999px; font-size: .75rem; white-space: nowrap; }
.hb { color: var(--ink-3); font-size: .75rem; font-weight: 600; white-space: nowrap; }

/* fleet photo gallery */
.fleet-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 8px; }
.fleet-photo { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); transition: transform .15s, box-shadow .15s; }
.fleet-photo:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.fleet-photo .ph { background: linear-gradient(180deg, #fbf7f4, #f4eeea); padding: 6px 10px; }
.fleet-photo .ph img { width: 100%; height: auto; display: block; }
.fleet-photo .meta { padding: 12px 16px 16px; }
.fleet-photo .role { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.fleet-photo .mdl { font-weight: 800; font-size: 1.02rem; margin-top: 2px; }
.fleet-photo .spec { font-size: .82rem; color: var(--ink-3); }

/* codeshare definition grid */
.def-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 4px; }
.def { background: var(--bg-2); border-radius: var(--r-sm); padding: 14px 16px; }
.def h4 { margin: 0 0 4px; font-size: .92rem; }
.def p { margin: 0; font-size: .84rem; }
.arch-card { margin-bottom: 18px; }
.arch-flow {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) auto minmax(175px, 1.2fr) auto minmax(155px, 1fr) auto minmax(155px, 1fr) auto minmax(145px, 1fr);
  gap: 8px;
  align-items: stretch;
  margin: 18px 0;
}
.arch-node {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  background: var(--surface);
  min-width: 0;
}
.arch-node b { display: block; font-size: .86rem; margin-bottom: 5px; color: var(--ink); }
.arch-node span { display: block; font-size: .78rem; line-height: 1.4; color: var(--ink-2); }
.arch-node.input { background: var(--bg-2); }
.arch-node.opt { border-color: #ffd9df; background: var(--coral-50); }
.arch-node.sim { border-color: #c4ece8; background: var(--teal-50); }
.arch-node.output { background: #eef5ff; }
.arch-arrow { display: grid; place-items: center; color: var(--ink-3); font-weight: 800; }
.arch-table { margin-top: 12px; }
.arch-table td { vertical-align: top; }
@media (max-width: 980px) {
  .arch-flow { grid-template-columns: 1fr; }
  .arch-arrow { transform: rotate(90deg); min-height: 14px; }
}

/* assumptions editor */
.ass-tbl input[type="number"] { width: 78px; text-align: right; font-variant-numeric: tabular-nums; padding: 6px 8px; }
.ass-tbl td.num { white-space: nowrap; }
.ass-tbl .sub { font-size: .72rem; color: var(--ink-3); font-weight: 500; }
.fee-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.fee { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; background: var(--bg-2); border-radius: var(--r-sm); padding: 8px 12px; }
.fee .sub { font-weight: 500; color: var(--ink-3); font-size: .72rem; }
.fee input { margin-left: auto; }

/* sticky KPI bar — headline numbers stay visible while you change levers */
.kpi-bar { position: sticky; top: 70px; z-index: 20; background: var(--bg); padding: 10px 0 12px; box-shadow: 0 12px 16px -14px rgba(40,25,20,.22); }
@media (max-width: 1040px) { .kpi-bar { top: 66px; } }

/* crew pairings */
.crew-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.crewp { display: flex; align-items: center; gap: 10px; padding: 7px 11px; background: var(--bg-2); border-radius: var(--r-sm); font-size: .85rem; flex-wrap: wrap; }
.crewp .cl { color: #fff; font-weight: 800; font-size: .72rem; padding: 3px 8px; border-radius: 6px; flex-shrink: 0; min-width: 46px; text-align: center; }
.crewp .legs { font-variant-numeric: tabular-nums; font-weight: 600; }
.crewp .duty { margin-left: auto; color: var(--ink-3); font-weight: 700; font-variant-numeric: tabular-nums; }
.crewp .ron { color: var(--coral-600); font-weight: 700; background: var(--coral-50); padding: 2px 9px; border-radius: 999px; font-size: .75rem; }
.crewp .hb { color: var(--ink-3); font-size: .75rem; font-weight: 600; }

/* methodology list */
ol.method { margin: 0 0 12px; padding-left: 20px; color: var(--ink-2); font-size: .9rem; }
ol.method li { margin-bottom: 7px; }
ol.method b { color: var(--ink); }

/* legacy fleet group in the rail */
.legacy-group { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.lg-head { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--amber); margin-bottom: 4px; }
.fleet-photo.legacy .ph { background: linear-gradient(180deg, #f6f1ee, #efe7e2); }
.fleet-photo.legacy .spec .muted { font-size: .76rem; }

/* segmented control (e.g. 2 / 3 banks) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg-btn { border: 0; background: var(--surface); font-family: inherit; font-weight: 700; font-size: .78rem; padding: 6px 13px; cursor: pointer; color: var(--ink-2); }
.seg-btn.on { background: var(--ink); color: #fff; }
.seg-btn:hover:not(.on) { background: var(--bg-2); }

/* "not flown" route flag */
.route-flag { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.route-flag.off { color: var(--coral-600); background: var(--coral-50); padding: 1px 7px; border-radius: 999px; }

/* per-route aircraft assignment dropdown */
.rk-nm { font-weight: 700; font-variant-numeric: tabular-nums; }
.rk-ctl { display: inline-flex; align-items: center; gap: 8px; }
.ac-select { font-size: .74rem; padding: 3px 6px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; color: var(--coral-600); width: auto; cursor: pointer; }
.ac-select:hover:not(:disabled) { border-color: var(--coral); }
.ac-select:disabled { opacity: .55; cursor: default; color: var(--ink-3); }

/* ===== guided wizard shell ===== */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.94); backdrop-filter: saturate(150%) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-row { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; align-items: center; gap: 16px; min-height: 62px; }
.topbar .brand { margin-right: 0; }
.stepper { display: flex; gap: 4px; margin: 0 auto; flex-wrap: nowrap; justify-content: center; min-width: 0; max-width: 100%; overflow: hidden; }
.topbar-row > .stepper { width: 100%; display: grid; grid-template-columns: repeat(6, minmax(96px, 1fr)); gap: 8px; overflow: visible; }
.step-dot { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; cursor: pointer; padding: 6px 9px; border-radius: 999px; color: var(--ink-3); font-family: inherit; transition: background .14s; }
.topbar-row .step-dot { justify-content: center; min-width: 0; width: 100%; background: var(--surface); border: 1px solid var(--line); }
.step-dot .sd-n { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; font-size: .68rem; font-weight: 800; background: var(--bg-2); color: var(--ink-3); border: 1px solid var(--line); flex-shrink: 0; }
.step-dot .sd-t { font-size: .82rem; font-weight: 700; white-space: nowrap; }
.step-dot:hover { background: var(--bg-2); color: var(--ink); }
.step-dot.on { color: var(--ink); }
.step-dot.on .sd-n { background: var(--grad); color: #fff; border: 0; }
.step-dot.done { color: var(--ink-2); }
.step-dot.done .sd-n { background: var(--teal); color: #fff; border: 0; }
@media (max-width: 1320px) {
  .topbar-row { grid-template-columns: max-content minmax(0, 1fr) max-content; }
  .topbar-row > .stepper { grid-template-columns: repeat(6, minmax(34px, 1fr)); gap: 5px; }
  .topbar-row .step-dot .sd-t { display: none; }
  .topbar-row .step-dot { padding: 6px; }
}
@media (max-width: 760px) {
  .topbar-row { grid-template-columns: 1fr auto; gap: 10px; }
  .topbar-row > .stepper { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; padding-bottom: 8px; }
  .topbar-row { height: auto; padding-top: 10px; }
}

.kpi-strip { border-top: 1px solid var(--line-2); padding: 8px 0 10px; }
.kpi-strip:empty { display: none; }
.kpi-strip .kpis {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.kpi-strip .kpi { padding: 8px 12px; }
.kpi-strip .kpi .n { font-size: 1.22rem; }
.kpi-strip .kpi .d { font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .kpi-strip .kpis { grid-template-columns: repeat(2, 1fr); } }

.journey { padding: 28px 24px 64px; }
.step-head { margin-bottom: 22px; }
.step-eyebrow { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .74rem; color: var(--coral-600); margin-bottom: 8px; }
.step-head h2 { margin: 0 0 6px; }
.step-purpose { font-size: 1.06rem; color: var(--ink-2); max-width: 780px; margin: 0; }

.turnaround-brief {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(420px, 1.05fr);
  gap: 22px;
  align-items: stretch;
}
.turnaround-main {
  background: linear-gradient(135deg, #fff 0%, #f3f9fb 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.step-token {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-right: 12px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: .88rem;
  font-weight: 800;
  vertical-align: middle;
}
.brief-panel {
  display: grid;
  grid-template-columns: 1fr 1fr .78fr;
  gap: 10px;
}
.brief-mini {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.brief-mini span,
.impact-label,
.loss-label {
  display: block;
  color: var(--ink-3);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}
.brief-mini b {
  display: block;
  color: var(--ink);
  font-size: .94rem;
  line-height: 1.35;
}
.brief-mini.metric b {
  font-size: 1.55rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.brief-mini small {
  display: block;
  margin-top: 8px;
}
.pos { color: var(--green) !important; }
.neg { color: var(--red) !important; }
@media (max-width: 1040px) {
  .turnaround-brief { grid-template-columns: 1fr; }
  .brief-panel { grid-template-columns: 1fr; }
}

.diagnosis-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: stretch;
  background: linear-gradient(135deg, #17202a 0%, #23394a 100%);
  border-radius: var(--r-lg);
  padding: 28px;
  color: #fff;
  box-shadow: var(--shadow);
}
.diagnosis-hero h2 {
  max-width: 820px;
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  margin: 12px 0;
}
.diagnosis-hero p {
  color: rgba(255,255,255,.78);
  max-width: 760px;
  font-size: 1.02rem;
}
.diagnosis-hero p strong { color: #fff; }
.loss-meter {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--r-lg);
  padding: 20px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.loss-meter .loss-label { color: rgba(255,255,255,.65); }
.loss-number {
  color: #ff8ca2;
  font-size: 2.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.loss-sub { color: rgba(255,255,255,.66); font-size: .86rem; margin-top: 10px; }
.driver-grid,
.action-path {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.driver,
.action-path div {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fff;
  padding: 16px;
}
.driver.critical {
  border-color: #ffd3dd;
  background: var(--coral-50);
}
.driver span,
.action-path span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: .76rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.driver h4 { margin: 0 0 6px; font-size: .96rem; }
.driver p,
.action-path p { margin: 0 0 12px; font-size: .86rem; }
.driver b {
  color: var(--coral-600);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.action-path b {
  display: block;
  margin-bottom: 6px;
}
.action-card {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 18px;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.action-copy p { margin-bottom: 8px; }
.action-impact {
  border-radius: var(--r);
  background: var(--bg-2);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.impact-number {
  font-size: 1.95rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.impact-sub {
  color: var(--ink-3);
  font-size: .82rem;
  margin-top: 10px;
}
@media (max-width: 900px) {
  .diagnosis-hero,
  .action-card { grid-template-columns: 1fr; }
  .driver-grid,
  .action-path { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .driver-grid,
  .action-path { grid-template-columns: 1fr; }
}

.studio-grid .rail { position: static; top: auto; }
.studio-grid.no-rail { grid-template-columns: 1fr; }
.studio-grid.no-rail .rail { display: none; }

.step-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; gap: 12px; }
.step-nav .btn { min-width: 150px; justify-content: center; }

/* reference drawer */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(25,18,14,.42); }
.modal-panel { position: relative; background: var(--surface); border-radius: var(--r-lg); max-width: 1040px; width: 94%; margin: 36px auto; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 16px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.ref-tabs { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.modal-x { background: none; border: 0; font-size: 1.05rem; cursor: pointer; color: var(--ink-3); padding: 4px 8px; border-radius: 8px; }
.modal-x:hover { background: var(--bg-2); color: var(--ink); }
.modal-body { padding: 22px; overflow: auto; }

.hidden { display: none !important; }

.cost-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}
.cost-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
  padding: 10px;
}
.cost-pair div {
  background: var(--surface);
  border-radius: 6px;
  padding: 10px;
}
.cost-pair span,
.cost-pair small {
  display: block;
  color: var(--ink-3);
  font-size: .72rem;
  font-weight: 700;
}
.cost-pair b {
  display: block;
  color: var(--ink);
  margin: 3px 0;
  font-variant-numeric: tabular-nums;
}
.constraint-guide {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.constraint-guide div {
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  background: var(--teal-50);
}
.constraint-guide b,
.constraint-guide span {
  display: block;
}
.constraint-guide span {
  color: var(--ink-2);
  font-size: .82rem;
  margin-top: 2px;
}
@media (max-width: 760px) {
  .cost-pair-grid { grid-template-columns: 1fr; }
}

/* ===== mobile hardening =====
   On phones, plain `1fr` grid tracks resolve to `minmax(auto, 1fr)`, whose
   `auto` minimum equals the content's min-content. Cards with padding (e.g.
   .diagnosis-hero) then refuse to shrink below the viewport and overflow,
   making neighbouring boxes appear to overlap. Forcing `minmax(0, 1fr)` plus
   `min-width: 0` lets every track shrink and the content reflow cleanly. */
@media (max-width: 720px) {
  .studio-grid,
  .studio-grid.no-rail,
  .turnaround-brief,
  .brief-panel,
  .diagnosis-hero,
  .action-card,
  .driver-grid,
  .action-path,
  .grid-2,
  .grid-3,
  .chart-grid,
  .cost-pair-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .stack,
  .stack > *,
  .studio-grid > *,
  .card,
  .turnaround-main,
  .diagnosis-hero,
  .loss-meter,
  .action-impact,
  .brief-mini {
    min-width: 0;
  }
  /* Long, unbreakable figures shouldn't dictate the layout width. */
  .loss-number,
  .impact-number,
  .brief-mini b,
  .kpi .n {
    overflow-wrap: anywhere;
  }
  /* Wide tables scroll within their own box instead of stretching the page. */
  .tbl {
    display: block;
    width: 100%;
    overflow-x: auto;
  }
  /* Keep the brand from nudging the sticky header past the viewport edge. */
  .topbar .brand { min-width: 0; }
}
/* On the narrowest phones, the flamingo mark alone carries the brand. */
@media (max-width: 460px) {
  .topbar .brand-title { display: none; }
}
