/* TrAIn Growth Partners — live pilot example */
:root {
  --navy: #0b1d3a; --navy-2: #13294f; --ink: #15202f; --muted: #5b6676; --soft: #8a95a5;
  --line: #e4e9f0; --tint: #f4f6f9; --white: #fff;
  --green: #8cc63f; --green-deep: #4b8512; --red: #c23d37; --amber: #b57b0e;
  --actual: #1f4f8f; --budget: #b8c5d6;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--tint); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; border-radius: 6px; }

/* Layout */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--navy); color: #d5deea; padding: 22px 14px; display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; line-height: 1.1; padding: 0 6px; }
.side-brand img { border-radius: 50%; }
.side-brand b { color: var(--green); font-weight: 800; }
.side-brand em { display: block; font-style: normal; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--green); font-weight: 600; margin-top: 2px; }
.side-co { border-top: 1px solid rgba(255,255,255,.1); padding: 16px 6px 0; }
.side-co-name { margin: 0; color: #fff; font-weight: 700; font-size: 14px; }
.side-co-sub { margin: 2px 0 0; font-size: 12px; color: #8fa2bd; }
.side-nav { display: grid; gap: 3px; }
.side-nav button {
  display: flex; align-items: center; gap: 12px; background: none; border: 0; color: #c9d4e4;
  padding: 10px 10px; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s;
}
.side-nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav button[aria-current="page"] { background: rgba(140,198,63,.16); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.side-nav .n { font-size: 11px; font-weight: 700; color: var(--green); width: 18px; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 14px; }
.side-foot p { margin: 0 0 8px; font-size: 13px; color: #fff; font-weight: 600; }
.side-foot a { display: block; text-align: center; background: var(--green); color: var(--navy); text-decoration: none; font-weight: 700; font-size: 12.5px; padding: 9px 10px; border-radius: 999px; }
.side-foot a:hover { background: #9fd352; }

.main { min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 20px 28px 16px; background: var(--white); border-bottom: 1px solid var(--line);
}
.crumb { margin: 0; font-size: 11.5px; color: var(--soft); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.topbar h1 { margin: 3px 0 0; font-size: 24px; font-weight: 800; color: var(--navy); letter-spacing: -.015em; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; }
.controls label { display: grid; gap: 4px; font-size: 10.5px; color: var(--soft); text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }
.controls select {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 32px 8px 11px; background: #fff; color: var(--ink);
  font-size: 13.5px; font-weight: 500; min-width: 158px; cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.controls select:hover { border-color: #c9d3df; }
.notice { margin: 0; background: #f2f8e8; color: #3b620f; font-size: 12.5px; padding: 8px 28px; border-bottom: 1px solid #dfeccb; }
.view { padding: 22px 28px 48px; display: grid; gap: 18px; animation: fadein .28s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card h2 { font-size: 15px; margin: 0; color: var(--navy); font-weight: 700; letter-spacing: -.005em; }
.card .sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 18px; }
.grid-half { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.eyebrow { margin: 0 0 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--green-deep); }

/* About + briefing */
.about { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.about-badge { width: 44px; height: 44px; border-radius: 12px; background: var(--navy); color: var(--green); display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.about p { margin: 0; color: #334155; font-size: 13.5px; max-width: 980px; }
.brief { background: var(--navy); border: 0; color: #d6e0ee; }
.brief .eyebrow { color: var(--green); }
.brief-text { font-size: 15.5px; line-height: 1.65; color: #eef3f9; margin: 0; max-width: 1000px; }
.brief-meta { margin: 10px 0 0; font-size: 11.5px; color: #8fa2bd; }
.asks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ask {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); color: #fff; border-radius: 999px;
  padding: 7px 14px; cursor: pointer; font-size: 13px; font-weight: 500; transition: background .15s, border-color .15s;
}
.ask:hover { background: rgba(140,198,63,.15); border-color: var(--green); }
.ask[aria-pressed="true"] { background: var(--green); color: var(--navy); border-color: var(--green); font-weight: 600; }
.answer { margin-top: 14px; background: rgba(255,255,255,.05); border-left: 3px solid var(--green); border-radius: 0 10px 10px 0; padding: 12px 14px; }
.answer p { margin: 0 0 10px; color: #eef3f9; font-size: 14px; }
.answer .go { background: none; border: 0; color: var(--green); font-weight: 700; cursor: pointer; padding: 0; font-size: 13px; }
.answer .go:hover { text-decoration: underline; }

/* KPIs */
.kpi { cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; text-align: left; width: 100%; }
.kpi:hover { border-color: #c9d3df; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(11,29,58,.07); }
.kpi .label { font-size: 11px; color: var(--soft); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.kpi .val { display: block; font-size: 25px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12.5px; font-weight: 600; }
.kpi .delta span { color: var(--soft); font-weight: 500; }
.spark { width: 100%; height: 34px; margin-top: 10px; display: block; }

.pos { color: var(--green-deep); } .neg { color: var(--red); } .muted { color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.good { background: #e7f3d6; color: #3b620f; }
.pill.bad { background: #fbe2e0; color: #962a25; }
.pill.watch { background: #fbefd2; color: #865a07; }
.pill.info { background: #e8eef7; color: #26446f; }

/* Attention list */
.att { display: grid; gap: 8px; }
.att button {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: start; text-align: left; width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.att button:hover { border-color: #c9d3df; background: #fafbfd; }
.att .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; }
.att .dot.high { background: var(--red); } .att .dot.med { background: #e0a526; }
.att strong { display: block; color: var(--navy); font-size: 13.5px; }
.att span.d { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.att .arrow { color: var(--soft); font-weight: 700; margin-top: 2px; }

/* Charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: inherit; font-size: 11px; fill: var(--soft); }
.chart text.val { font-size: 11.5px; font-weight: 700; fill: var(--ink); }
.chart .grid { stroke: #edf1f6; stroke-width: 1; }
.chart .zero { stroke: #c9d3df; stroke-width: 1; }
.chart .area { fill: rgba(31,79,143,.08); }
.chart .aline { fill: none; stroke: var(--actual); stroke-width: 2.5; stroke-linejoin: round; }
.chart .bline { fill: none; stroke: var(--budget); stroke-width: 2; stroke-dasharray: 5 5; }
.chart .dot { fill: #fff; stroke: var(--actual); stroke-width: 2; cursor: pointer; transition: r .15s; }
.chart .dot:hover { r: 6; }
.chart .bar { fill: var(--actual); cursor: pointer; transition: opacity .15s; }
.chart .bar.sel { fill: var(--green-deep); }
.chart .bar:hover { opacity: .8; }
.chart .tick { stroke: var(--navy); stroke-width: 2; }
.chart .gmline { fill: none; stroke: #e0a526; stroke-width: 2; }
.chart .gmdot { fill: #e0a526; }
.chart .wf { cursor: pointer; transition: opacity .15s; }
.chart .wf:hover { opacity: .8; }
.chart .wf.pos { fill: #7db436; } .chart .wf.neg { fill: #d4554f; } .chart .wf.tot { fill: var(--navy); }
.chart .hit { fill: transparent; cursor: pointer; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend i.a { background: var(--actual); } .legend i.b { background: var(--budget); height: 0; border-top: 2px dashed var(--budget); }
.legend i.g { background: #e0a526; } .legend i.t { background: var(--navy); height: 2px; width: 12px; }
.seg { display: inline-flex; background: var(--tint); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(11,29,58,.1); }

/* Tables */
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
.tbl th { text-align: right; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { text-align: right; padding: 10px 10px; border-bottom: 1px solid #f0f3f7; white-space: nowrap; }
.tbl tr.strong td { font-weight: 700; color: var(--navy); background: #fafbfd; }
.tbl tr.sub td:first-child { color: var(--muted); padding-left: 22px; }
.tbl tbody tr:hover td { background: #f8fafc; }
.tbl th button { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
.tbl th button:hover { color: var(--navy); }
.tbl th .on { color: var(--navy); }
.tbl td .nm { font-weight: 600; color: var(--navy); }
.tbl td .meta { display: block; font-size: 11.5px; color: var(--soft); font-weight: 400; }
.tbl td.left { text-align: left; }

/* Decomposition tree */
.tree-sum { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: baseline; padding: 12px 14px; background: var(--tint); border-radius: 12px; margin-bottom: 14px; }
.tree-sum b { font-size: 18px; color: var(--navy); font-variant-numeric: tabular-nums; }
.tree-sum span { font-size: 11px; color: var(--soft); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; display: block; }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.crumbs b { color: var(--navy); }
.tree { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; position: relative; }
.tcol h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--soft); margin: 0 0 8px; font-weight: 700; }
.node {
  display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 12px 11px; margin-bottom: 8px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.node:hover { border-color: #c4cfdc; transform: translateX(2px); }
.node.is-sel { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11,29,58,.07); background: #fbfcfe; }
.node .row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.node .nm { font-weight: 700; color: var(--navy); font-size: 13.5px; }
.node .v { font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.node .row.sm { font-size: 11.5px; color: var(--soft); margin-top: 1px; font-variant-numeric: tabular-nums; }
.node .bar { display: block; height: 5px; border-radius: 3px; background: #eef2f6; margin-top: 8px; overflow: hidden; }
.node .bar i { display: block; height: 100%; border-radius: 3px; }
.node .bar i.neg { background: #d4554f; } .node .bar i.pos { background: #7db436; }
.placeholder { border: 1px dashed #cdd6e1; border-radius: 11px; padding: 18px 14px; color: var(--soft); font-size: 12.5px; text-align: center; }
.callout { margin-top: 6px; background: #f2f8e8; border-left: 3px solid var(--green-deep); border-radius: 0 10px 10px 0; padding: 11px 14px; font-size: 13px; color: #2f4a10; }
.btn-sm { background: var(--navy); color: #fff; border: 0; border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.btn-sm:hover { background: var(--navy-2); }
.btn-sm.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn-sm.ghost:hover { border-color: #c4cfdc; }

/* Funnel + bars */
.funnel { display: grid; gap: 9px; }
.frow { display: grid; grid-template-columns: 96px 1fr 70px; gap: 10px; align-items: center; font-size: 12.5px; }
.frow .lbl { color: var(--muted); font-weight: 600; }
.frow .track { background: #eef2f6; border-radius: 6px; height: 26px; overflow: hidden; }
.frow .fill { height: 100%; background: var(--actual); border-radius: 6px; display: flex; align-items: center; padding-left: 8px; color: #fff; font-weight: 700; font-size: 11.5px; white-space: nowrap; }
.frow .conv { text-align: right; color: var(--soft); font-variant-numeric: tabular-nums; }
.cov { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.cov b { font-size: 22px; color: var(--navy); }
.att-bar { display: inline-block; width: 90px; height: 6px; border-radius: 3px; background: #eef2f6; vertical-align: middle; margin-right: 8px; overflow: hidden; }
.att-bar i { display: block; height: 100%; border-radius: 3px; }

/* Heatmap */
.heat { display: grid; grid-template-columns: 112px repeat(12, minmax(40px, 1fr)); gap: 4px; font-size: 11.5px; min-width: 640px; }
.heat .hd { color: var(--soft); text-align: center; font-weight: 600; padding-bottom: 2px; }
.heat .rl { color: var(--navy); font-weight: 600; display: flex; align-items: center; font-size: 12px; }
.heat .c { height: 34px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums; cursor: default; }
.heat .c.in { outline: 2px solid var(--navy); outline-offset: -2px; }
.h-good { background: #dcefc2; color: #2f5a0c; } .h-warn { background: #f8e7bd; color: #6b4a06; } .h-bad { background: #f6d0cc; color: #7d1f1a; }
.heat-key { display: flex; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.heat-key i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }

/* What-if */
.whatif { background: var(--navy); color: #d6e0ee; border: 0; }
.whatif h2 { color: #fff; }
.whatif .sub { color: #a9b8cc; }
.wi-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: center; }
.wi-grid label { display: block; font-size: 12px; color: #a9b8cc; margin-bottom: 8px; }
.wi-grid input[type="range"] { width: 100%; accent-color: var(--green); }
.wi-scale { display: flex; justify-content: space-between; font-size: 11px; color: #8fa2bd; margin-top: 4px; }
.wi-num { font-size: 26px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.wi-num.g { color: var(--green); }
.wi-lbl { font-size: 11px; color: #a9b8cc; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.wi-note { margin: 14px 0 0; font-size: 12px; color: #8fa2bd; }

/* Market */
.tone { display: inline-block; width: 80px; height: 8px; background: #eef2f6; border-radius: 4px; position: relative; vertical-align: middle; }
.tone::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: #c9d3df; }
.tone i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.tbl tr.us td { background: #f2f8e8; }
.cal { display: grid; gap: 8px; }
.cal-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.cal-date { text-align: center; background: var(--tint); border-radius: 8px; padding: 4px 0; line-height: 1.15; }
.cal-date b { display: block; font-size: 16px; color: var(--navy); }
.cal-date span { font-size: 10px; color: var(--soft); text-transform: uppercase; font-weight: 700; letter-spacing: .08em; }
.cal-item strong { display: block; color: var(--navy); font-size: 13px; }
.cal-item .d { font-size: 12px; color: var(--muted); }
.read { margin: 0; font-size: 13.5px; color: #334155; }
.read + .read { margin-top: 8px; }

/* Team strip */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; }
.strip > div { padding: 14px 18px; border-right: 1px solid var(--line); }
.strip > div:last-child { border-right: 0; }
.strip .label { font-size: 10.5px; color: var(--soft); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.strip b { display: block; font-size: 18px; color: var(--navy); margin-top: 2px; font-variant-numeric: tabular-nums; }
.foot-note { font-size: 11.5px; color: var(--soft); margin: 10px 0 0; }

/* Tooltip */
.tip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--navy); color: #fff; font-size: 12px; font-weight: 500;
  padding: 7px 10px; border-radius: 8px; box-shadow: 0 8px 20px rgba(11,29,58,.25); max-width: 280px;
}

/* Responsive */
@media (max-width: 1180px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-main, .grid-half { grid-template-columns: 1fr; }
  .wi-grid { grid-template-columns: 1fr 1fr; }
  .wi-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side-brand { flex: 0 0 auto; padding: 0; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; padding: 10px 12px; gap: 8px; flex-direction: row; align-items: center; overflow: visible; }
  .side-brand span, .side-co, .side-foot { display: none; }
  .side-nav { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; flex: 1; min-width: 0; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav button { white-space: nowrap; padding: 8px 10px; font-size: 13px; }
  .side-nav button[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--green); }
  .side-nav .n { display: none; }
  .topbar, .notice { padding-left: 16px; padding-right: 16px; }
  .view { padding: 16px 16px 40px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-5 { grid-template-columns: 1fr 1fr; }
  .tree { grid-template-columns: 1fr; }
  .chart-wrap .chart { min-width: 640px; }
  .chart-wrap { margin: 0 -4px; padding-bottom: 4px; }
  .strip { grid-template-columns: 1fr 1fr; }
  .strip > div:nth-child(2) { border-right: 0; }
  .strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .about { grid-template-columns: 1fr; }
  .about-badge { display: none; }
}
@media (max-width: 520px) {
  .controls { width: 100%; }
  .controls label { flex: 1; }
  .controls select { min-width: 0; width: 100%; }
  .grid-4, .grid-5 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .val { font-size: 20px; }
  .card { padding: 14px; }
  .wi-grid { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 78px 1fr 54px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
