/* ============================================================
   Mapview GTM Strategy Dashboard — design system
   Monitor/Decide surface. Teal primary, MVPS band colours as
   the semantic scale (green ≥75 / amber 50–74 / red 0–49).
   ============================================================ */
:root {
  --teal: #0d9488;
  --teal-strong: #0b7f74;
  --teal-soft: #ccfbf1;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --bg: #f6f8fb;
  --bg-alt: #eef2f7;

  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;

  --null: #9ca3af;

  --radius: 4px;
  --radius-lg: 10px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --nav-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- header / nav ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  margin-right: 12px;
  white-space: nowrap;
}
.brand .logo {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: var(--teal);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 13px;
}
.brand small { color: var(--muted); font-weight: 500; font-size: 11px; }

nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav a {
  padding: 7px 12px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 13.5px;
  text-decoration: none;
  border: 1px solid transparent;
}
nav a:hover { background: var(--bg-alt); text-decoration: none; }
nav a.active { background: var(--teal-soft); color: var(--teal-strong); border-color: #99f6e4; }

.scenario-switch {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}
.scenario-switch .seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.scenario-switch button {
  border: 0; background: var(--surface); color: var(--ink-2);
  padding: 6px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border-right: 1px solid var(--line);
}
.scenario-switch button:last-child { border-right: 0; }
.scenario-switch button.on { background: var(--teal); color: #fff; }

/* ---------- layout ---------- */
main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 90px; }

.route { display: none; }
.route.active { display: block; }

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin: 34px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 15.5px; margin: 22px 0 8px; }
.lede { color: var(--ink-2); font-size: 16px; max-width: 70ch; margin: 0 0 8px; }
.subtle { color: var(--muted); font-size: 13px; }

.kicker {
  text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 11.5px; font-weight: 700; color: var(--teal-strong);
  margin-bottom: 6px;
}

/* ---------- cards / grids ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  main { padding: 18px 14px 70px; }
  header { height: auto; padding: 10px 14px; gap: 6px; }
  .scenario-switch { margin-left: 0; width: 100%; justify-content: space-between; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px;
}
.card h3 { margin-top: 0; }

/* ---------- stat cards ---------- */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat .unit { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat .note { font-size: 12px; color: var(--muted); margin-top: 4px; }

.band-green  { color: var(--green); }
.band-amber  { color: var(--amber); }
.band-red    { color: var(--red); }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill.green  { background: #dcfce7; color: #15803d; }
.pill.amber  { background: #fef3c7; color: #b45309; }
.pill.red    { background: #fee2e2; color: #b91c1c; }
.pill.teal   { background: var(--teal-soft); color: var(--teal-strong); }
.pill.grey   { background: #f1f5f9; color: var(--muted); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  background: var(--bg-alt);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line);
}
tbody tr:nth-child(even) { background: #fbfcfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.flag-red td { background: #fef2f2; }

/* ---------- charts ---------- */
.chart-wrap { position: relative; width: 100%; }
.chart-wrap.tall { height: 380px; }
.chart-wrap.med  { height: 320px; }
.caption {
  font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.45;
}
.caption .tag { font-weight: 700; color: var(--teal-strong); }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input, .field select {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13.5px; font-family: var(--font); font-variant-numeric: tabular-nums;
  background: var(--surface); color: var(--ink);
}
.field input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.field .hint { font-size: 11px; color: var(--muted); }

.control-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
}

/* ---------- gantt / loop / tree ---------- */
.gantt-row { display: grid; grid-template-columns: 220px 1fr 90px; gap: 10px; align-items: center; padding: 5px 0; }
.gantt-row .name { font-size: 13px; font-weight: 600; }
.gantt-track { position: relative; height: 22px; background: var(--bg-alt); border-radius: 3px; }
.gantt-bar { position: absolute; top: 3px; height: 16px; border-radius: 3px; background: var(--teal); }
.gantt-bar.amber { background: var(--amber); }
.gantt-bar.red { background: var(--red); }
.gantt-row .own { font-size: 12px; color: var(--muted); text-align: right; }
.gantt-scale { display: grid; grid-template-columns: repeat(12, 1fr); font-size: 10px; color: var(--muted); margin: 4px 0 10px 230px; }
@media (max-width: 640px) { .gantt-row { grid-template-columns: 1fr; gap: 2px; } .gantt-scale { display:none; } }

.loop { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.loop .node {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; font-size: 13px; font-weight: 600; min-width: 120px; text-align: center;
}
.loop .node.engine { border-color: var(--teal); background: var(--teal-soft); }
.loop .arrow { color: var(--muted); font-weight: 700; }

.tree ul { list-style: none; padding-left: 20px; margin: 6px 0; }
.tree li { padding: 2px 0; font-size: 13.5px; }
.tree .root { font-weight: 700; color: var(--teal-strong); }
.tree .muted { color: var(--muted); }

/* ---------- misc ---------- */
.callout {
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px;
}
.callout.warn { border-left-color: var(--amber); background: #fef3c7; }
.callout.risk { border-left-color: var(--red); background: #fee2e2; }
.callout p { margin: 0 0 6px; }
.callout p:last-child { margin: 0; }

.delta-pos { color: var(--teal-strong); font-weight: 700; }
.delta-neg { color: var(--red); font-weight: 700; }

.foot { color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); margin-top: 40px; padding-top: 16px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.null { color: var(--null); }

/* ============================================================
   v2 additions — fundability dashboard
   ============================================================ */
.hero-band { border: 2px solid var(--teal); }
.retention-key { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.retention-key span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 2px; display: inline-block; flex: 0 0 auto; }
.gate { border-left: 4px solid var(--teal); }
.gate.go { border-left-color: var(--green); }
.gate.hold { border-left-color: var(--amber); }
.gate.kill { border-left-color: var(--red); }
.gate .gt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.clock-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .clock-grid { grid-template-columns: 1fr; } }
.clock-lane { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.clock-lane h4 { margin: 0 0 10px; }
.milestone { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.milestone:last-child { border-bottom: 0; }
.milestone .m { font-weight: 700; color: var(--teal-strong); min-width: 30px; flex: 0 0 auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.grey { background: var(--null); }
.guardrail { border: 1px solid #fecaca; background: #fef2f2; border-radius: var(--radius); padding: 14px 16px; }
.guardrail h4 { color: var(--red); margin: 0 0 6px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.bigflag { font-size: 13px; line-height: 1.5; }
.tag-model { background: #e0f2fe; color: #0369a1; }
.tag-target { background: #fef3c7; color: #b45309; }
.tag-actual { background: #dcfce7; color: #15803d; }
