:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1c2530;
  --ink-soft: #55606e;
  --line: #e2e6ea;
  --accent: #0f5c6b;      /* deep teal */
  --accent-soft: #e4eff1;
  --good: #2e7d54;
  --warn: #b06a00;
  --bad: #b3352e;
  --neutral: #6b7684;
  --shadow: 0 1px 2px rgba(20,30,45,.06), 0 4px 12px rgba(20,30,45,.05);
  --radius: 10px;
  --maxw: 1240px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
.small { font-size: .82rem; color: var(--ink-soft); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* Layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { font-weight: 700; font-size: 1.02rem; letter-spacing: -.2px; }
.brand small { display: block; font-weight: 500; color: var(--ink-soft); font-size: .74rem; margin-top: 2px; }
.synthetic-badge {
  display: inline-block; margin-top: 12px; padding: 3px 8px; border-radius: 999px;
  background: #fff4e0; color: var(--warn); font-size: .72rem; font-weight: 600; border: 1px solid #f0dcb4;
}
nav { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; }
nav button {
  text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px;
  color: var(--ink-soft); font-size: .9rem; cursor: pointer; font-weight: 500;
}
nav button:hover { background: var(--bg); color: var(--ink); }
nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.main { padding: 20px clamp(14px, 3vw, 32px) 60px; max-width: var(--maxw); width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 22px; align-items: end; }
.filters .field { display: flex; flex-direction: column; gap: 3px; }
.filters label { font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.filters select, .filters button {
  font-size: .86rem; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
}
.filters button.clear { cursor: pointer; color: var(--accent); border-color: var(--accent-soft); }
.filter-note { font-size: .8rem; color: var(--ink-soft); align-self: center; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow); }
.kpi .v { font-size: 1.5rem; font-weight: 700; letter-spacing: -.5px; }
.kpi .l { font-size: .8rem; color: var(--ink-soft); margin-top: 2px; }
.kpi .sub { font-size: .74rem; color: var(--neutral); margin-top: 6px; }

/* Cards + charts */
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 17px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: 2px; }
.card .interp { font-size: .82rem; color: var(--ink-soft); margin: 4px 0 12px; }
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--ink-soft); font-size: 11px; }
.chart .val { fill: var(--ink); font-weight: 600; }

/* Tables */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #fafbfc; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Badges / pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.pill.good { background: #e6f2ec; color: var(--good); }
.pill.warn { background: #fdf1df; color: var(--warn); }
.pill.bad { background: #fbe9e8; color: var(--bad); }
.pill.neutral { background: #eef1f4; color: var(--neutral); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.section-head { display:flex; align-items:baseline; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom: 10px;}
.legend { display:flex; gap:14px; flex-wrap:wrap; font-size:.78rem; color:var(--ink-soft); }
.legend span { display:inline-flex; align-items:center; gap:5px; }
.swatch { width:11px; height:11px; border-radius:3px; display:inline-block; }

/* Pipeline funnel */
.funnel { display:flex; flex-direction:column; gap:6px; }
.funnel .row { display:flex; align-items:center; gap:10px; }
.funnel .bar { height:26px; background:var(--accent); border-radius:6px; min-width:2px; opacity:.85; }
.funnel .stage-label { width:120px; font-size:.82rem; color:var(--ink-soft); flex:none; }
.funnel .count { font-size:.82rem; font-weight:600; }

/* Risk matrix */
.matrix { border-collapse: collapse; }
.matrix td { width: 46px; height: 40px; text-align: center; border: 1px solid var(--line); font-weight: 600; font-size: .82rem; }
.matrix .axis { background: none; border: 0; color: var(--ink-soft); font-weight: 500; font-size: .74rem; }
.cell-low { background: #e6f2ec; }
.cell-med { background: #fdf1df; }
.cell-high { background: #fbe9e8; }

.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
footer.note { margin-top: 30px; font-size: .78rem; color: var(--neutral); border-top:1px solid var(--line); padding-top:14px; }

/* Mobile */
.menu-toggle { display:none; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: flex; flex-direction: column; }
  nav { flex-direction: row; flex-wrap: wrap; }
  nav button { flex: 1 1 40%; }
}
