/* Jarvis Mission Control 2.0 — self-contained dark theme. No external fonts/CDNs. */
:root {
  --bg: #090d15;
  --bg-2: #0e1320;
  --panel: #121829;
  --panel-2: #161d31;
  --line: #20283d;
  --line-2: #2b3450;
  --txt: #e6ebf5;
  --txt-dim: #95a0b8;
  --txt-faint: #5f6b85;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --cyan: #38d6e0;
  --good: #2ecc8f;
  --good-dim: #15402f;
  --warn: #f5b942;
  --warn-dim: #3d2f12;
  --bad: #ff5470;
  --bad-dim: #3d1722;
  --glow: 0 0 0 1px var(--line), 0 8px 30px rgba(0,0,0,.45);
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--txt);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(79,140,255,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(124,92,255,.10), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.45;
}
::selection { background: rgba(79,140,255,.35); }

/* thin custom scrollbars to match the theme */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: #3a456a; }

/* entrance animation for cards / sections */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Top bar ----------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18,24,41,.9), rgba(10,14,23,.6));
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--cyan), var(--accent));
  box-shadow: 0 0 22px rgba(79,140,255,.5);
  position: relative; animation: spin 16s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.brand-mark::after {
  content: ""; position: absolute; inset: 6px; border-radius: 5px;
  background: var(--bg-2);
}
.brand-title { font-weight: 800; letter-spacing: 3px; font-size: 17px; }
.brand-sub { color: var(--txt-faint); font-size: 11px; letter-spacing: .4px; text-transform: uppercase; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.meta { color: var(--txt-dim); font-family: var(--mono); font-size: 12px; }
.uptime { color: var(--txt-faint); font-family: var(--mono); font-size: 11px; letter-spacing: .3px; }

.conn { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--txt-dim); }
.conn .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--txt-faint); box-shadow: 0 0 0 0 rgba(0,0,0,0); }
.conn.ok .dot { background: var(--good); box-shadow: 0 0 10px var(--good); animation: pulse 2.4s infinite; }
.conn.err .dot { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  border: 1px solid var(--line-2); background: var(--accent); color: #fff;
  border-radius: 9px; padding: 8px 14px; font-weight: 600; cursor: pointer;
  font-size: 13px; transition: transform .06s ease, filter .15s ease, background .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--txt-dim); }
.btn.ghost:hover { color: var(--txt); border-color: var(--accent); }
.btn.danger { background: var(--bad); }
.btn.good { background: var(--good); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Live banner ------------------------------------------------------- */
.live-banner {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 22px 4px; padding: 16px 20px; border-radius: var(--radius);
  border: 1px solid var(--line); position: relative; overflow: hidden;
  animation: rise .4s ease both;
}
.live-banner::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
}
.live-banner.safe { background: linear-gradient(90deg, rgba(46,204,143,.10), transparent); }
.live-banner.safe::before { background: var(--good); box-shadow: 0 0 18px var(--good); }
.live-banner.live { background: linear-gradient(90deg, rgba(255,84,112,.16), transparent); animation: liveglow 2.6s ease-in-out infinite; }
.live-banner.live::before { background: var(--bad); box-shadow: 0 0 22px var(--bad); }
@keyframes liveglow { 0%,100% { box-shadow: inset 0 0 0 1px rgba(255,84,112,.25);} 50% { box-shadow: inset 0 0 30px rgba(255,84,112,.18);} }
.live-banner-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.live-pill {
  font-weight: 800; letter-spacing: 1.5px; font-size: 13px; padding: 6px 12px;
  border-radius: 8px;
}
.live-banner.safe .live-pill { background: var(--good-dim); color: var(--good); border: 1px solid var(--good); }
.live-banner.live .live-pill { background: var(--bad-dim); color: var(--bad); border: 1px solid var(--bad); }
.live-msg { color: var(--txt-dim); font-size: 13px; }
.paused-pill {
  font-weight: 800; letter-spacing: 1.5px; font-size: 11px; padding: 4px 10px;
  border-radius: 8px; background: var(--warn-dim); color: var(--warn);
  border: 1px solid var(--warn); animation: pulse 1.8s infinite;
}
.paused-pill.hidden { display: none; }
.live-banner-right { display: flex; align-items: center; gap: 12px; }
.live-switch-label { color: var(--txt-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }

/* big toggle switch */
.switch {
  --w: 64px; --h: 32px;
  width: var(--w); height: var(--h); border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: #1b2236; position: relative;
  transition: background .2s ease, border-color .2s ease; padding: 0;
}
.switch .switch-knob {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #c4ccde; transition: left .2s ease, background .2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.switch[aria-checked="true"] { background: var(--bad); border-color: var(--bad); box-shadow: 0 0 16px rgba(255,84,112,.5); }
.switch[aria-checked="true"] .switch-knob { left: 35px; background: #fff; }

/* ---- KPI header -------------------------------------------------------- */
.kpis {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
  padding: 12px 22px 4px;
}
.kpi {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; position: relative; overflow: hidden;
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease;
  animation: rise .4s ease both;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: 0 10px 26px rgba(0,0,0,.4); }
.kpi::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(79,140,255,.5), transparent);
  opacity: 0; transition: opacity .2s ease;
}
.kpi:hover::after { opacity: 1; }
.kpi .kpi-label { color: var(--txt-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.kpi .kpi-val { font-size: 26px; font-weight: 750; margin-top: 4px; font-family: var(--mono); line-height: 1.1; }
.kpi .kpi-foot { font-size: 11px; color: var(--txt-dim); margin-top: 4px; }
.kpi.good .kpi-val { color: var(--good); }
.kpi.warn .kpi-val { color: var(--warn); }
.kpi.bad .kpi-val { color: var(--bad); }
.kpi.accent .kpi-val { color: var(--accent); }
.kpi .spark { position: absolute; right: 10px; bottom: 10px; width: 78px; height: 24px; opacity: .9; }

/* sparkline strokes */
.spark { display: block; overflow: visible; }
.spark .spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark .spark-fill { fill: rgba(79,140,255,.12); stroke: none; }
.spark .spark-dot { fill: var(--accent); }
.spark.good .spark-line { stroke: var(--good); } .spark.good .spark-fill { fill: rgba(46,204,143,.14); } .spark.good .spark-dot { fill: var(--good); }
.spark.warn .spark-line { stroke: var(--warn); } .spark.warn .spark-fill { fill: rgba(245,185,66,.14); } .spark.warn .spark-dot { fill: var(--warn); }
.spark.bad .spark-line { stroke: var(--bad); } .spark.bad .spark-fill { fill: rgba(255,84,112,.14); } .spark.bad .spark-dot { fill: var(--bad); }
.spark.accent .spark-line { stroke: var(--accent-2); } .spark.accent .spark-fill { fill: rgba(124,92,255,.14); } .spark.accent .spark-dot { fill: var(--accent-2); }

/* ---- Charts row -------------------------------------------------------- */
.charts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  padding: 14px 22px 4px;
}
.charts .span-2 { grid-column: span 2; }
.chart-card { display: flex; flex-direction: column; }
.chart-host { position: relative; flex: 1; min-height: 200px; }
.linechart { width: 100%; height: 200px; display: block; }
.linechart .grid { stroke: var(--line); stroke-width: 1; }
.linechart .grid.zero { stroke: var(--line-2); stroke-dasharray: 3 3; }
.linechart .axis { fill: var(--txt-faint); font-size: 9px; font-family: var(--mono); }
.linechart .area { stroke: none; }
.linechart .area-rev { fill: rgba(46,204,143,.12); }
.linechart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.linechart .line-rev { stroke: var(--good); filter: drop-shadow(0 0 4px rgba(46,204,143,.5)); }
.linechart .line-cost { stroke: var(--warn); }
.linechart .line-net { stroke: var(--accent); stroke-dasharray: 4 3; opacity: .85; }
.linechart .dot-rev { fill: var(--good); }
.linechart .dot-cost { fill: var(--warn); }
.chart-legend { display: flex; gap: 16px; padding-top: 8px; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--txt-dim); }
.chart-legend .lg i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend .lg-rev i { background: var(--good); }
.chart-legend .lg-cost i { background: var(--warn); }
.chart-legend .lg-net i { background: var(--accent); }

/* bar chart (idea-score distribution) */
.chart-host.bars { display: flex; align-items: flex-end; gap: 10px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar-track { width: 100%; flex: 1; display: flex; align-items: flex-end; background: linear-gradient(180deg, transparent, rgba(255,255,255,.02)); border-radius: 6px; }
.bar-fill {
  width: 100%; border-radius: 6px 6px 3px 3px; position: relative; min-height: 3px;
  background: linear-gradient(180deg, var(--accent), rgba(79,140,255,.4));
  transition: height .5s cubic-bezier(.2,.7,.3,1);
}
.bar-fill.mid { background: linear-gradient(180deg, var(--warn), rgba(245,185,66,.4)); }
.bar-fill.hot { background: linear-gradient(180deg, var(--good), rgba(46,204,143,.4)); }
.bar-num { position: absolute; top: -16px; left: 0; right: 0; text-align: center; font-size: 10px; font-family: var(--mono); color: var(--txt-dim); }
.bar-lab { font-size: 10px; color: var(--txt-faint); font-family: var(--mono); }

/* funnel */
.chart-host.funnel { display: flex; flex-direction: column; justify-content: center; gap: 7px; }
.funnel-row { display: grid; grid-template-columns: 64px 1fr 22px; align-items: center; gap: 8px; }
.funnel-stage { font-size: 10px; font-weight: 700; letter-spacing: .5px; color: var(--txt-dim); text-align: right; }
.funnel-bar-wrap { background: var(--bg); border-radius: 5px; overflow: hidden; height: 16px; }
.funnel-bar {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .5s cubic-bezier(.2,.7,.3,1); min-width: 6%;
}
.funnel-count { font-size: 11px; font-family: var(--mono); color: var(--txt-dim); text-align: right; }

/* ---- Grid + cards ------------------------------------------------------ */
.grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  padding: 16px 22px 30px;
}
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--glow); padding: 16px 18px; min-width: 0;
  animation: rise .45s ease both;
}
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.card-head h2 { margin: 0; font-size: 14px; letter-spacing: .5px; text-transform: uppercase; color: var(--txt); }
.card-sub { color: var(--txt-faint); font-size: 11px; }
.card-tools { display: flex; align-items: center; gap: 10px; }
.sort-btn {
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt-dim);
  border-radius: 7px; padding: 3px 9px; font-size: 11px; cursor: pointer; font-family: var(--mono);
  transition: color .15s ease, border-color .15s ease;
}
.sort-btn:hover { color: var(--txt); border-color: var(--accent); }
.badge {
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt-dim);
  border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600;
}
.badge.alert { background: var(--bad-dim); border-color: var(--bad); color: var(--bad); animation: pulse 2s infinite; }

/* ---- Table ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; color: var(--txt-faint); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .6px; padding: 8px 10px;
  border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--panel);
}
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr { transition: background .12s ease; }
table.data tr:hover td { background: rgba(79,140,255,.05); }
.proj-name { font-weight: 600; }
.proj-slug { color: var(--txt-faint); font-family: var(--mono); font-size: 11px; }
.bar { height: 6px; border-radius: 4px; background: var(--line-2); overflow: hidden; min-width: 70px; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--accent); transition: width .5s ease; }
.bar.done > span { background: var(--good); }

/* chips / tags */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--line-2); white-space: nowrap; }
.chip.stage { background: rgba(79,140,255,.12); color: var(--accent); border-color: rgba(79,140,255,.4); }
.chip.stage.MEASURE { background: rgba(46,204,143,.12); color: var(--good); border-color: rgba(46,204,143,.4); }
.chip.stage.KILLED { background: var(--bad-dim); color: var(--bad); border-color: var(--bad); }
.chip.stage.DEPLOY { background: rgba(124,92,255,.14); color: var(--accent-2); border-color: rgba(124,92,255,.4); }
.chip.status-active { color: var(--good); border-color: rgba(46,204,143,.4); }
.chip.status-killed { color: var(--bad); border-color: var(--bad); }
.deadline.over { color: var(--bad); font-weight: 700; }
.deadline.soon { color: var(--warn); }

/* ---- Per-project P&L --------------------------------------------------- */
.pnl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pnl {
  border: 1px solid var(--line-2); border-left: 3px solid var(--line-2); border-radius: 11px;
  padding: 12px 13px; background: var(--panel-2);
  transition: transform .12s ease, border-color .15s ease;
}
.pnl:hover { transform: translateY(-2px); }
.pnl.good { border-left-color: var(--good); }
.pnl.bad { border-left-color: var(--bad); }
.pnl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pnl-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pnl-slug { color: var(--txt-faint); font-family: var(--mono); font-size: 10px; margin-top: 2px; }
.pnl-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 11px 0 8px; }
.pnl-cell { display: flex; flex-direction: column; gap: 2px; }
.pnl-k { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--txt-faint); }
.pnl-v { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.pnl-v.good { color: var(--good); } .pnl-v.warn { color: var(--warn); } .pnl-v.bad { color: var(--bad); }
.pnl-foot { font-size: 11px; color: var(--txt-dim); border-top: 1px solid var(--line); padding-top: 7px; }

/* ---- Approvals --------------------------------------------------------- */
.approvals { display: flex; flex-direction: column; gap: 10px; max-height: 440px; overflow-y: auto; }
.approval {
  border: 1px solid var(--line-2); border-radius: 11px; padding: 12px;
  background: var(--panel-2);
}
.approval.pending { border-color: rgba(245,185,66,.4); box-shadow: inset 0 0 0 1px rgba(245,185,66,.08); }
.approval .ap-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gate { font-size: 10px; font-weight: 800; letter-spacing: .8px; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }
.gate-spend { background: var(--warn-dim); color: var(--warn); }
.gate-deploy_public { background: rgba(124,92,255,.18); color: var(--accent-2); }
.gate-outbound_comms { background: var(--bad-dim); color: var(--bad); }
.gate-access_change { background: rgba(79,140,255,.16); color: var(--accent); }
.ap-slug { font-family: var(--mono); font-size: 11px; color: var(--txt-dim); }
.ap-summary { margin: 8px 0 4px; font-weight: 600; }
.ap-details { color: var(--txt-dim); font-size: 12px; max-height: 3.2em; overflow: hidden; transition: max-height .2s ease; cursor: pointer; }
.ap-details.open { max-height: 400px; }
.ap-meta { color: var(--txt-faint); font-size: 11px; margin-top: 6px; }
.ap-actions { display: flex; gap: 8px; margin-top: 10px; }
.ap-actions .btn { padding: 6px 12px; font-size: 12px; }
.ap-status { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; }
.ap-status.approved { background: var(--good-dim); color: var(--good); }
.ap-status.denied { background: var(--bad-dim); color: var(--bad); }
.ap-status.pending { background: var(--warn-dim); color: var(--warn); }
.empty { color: var(--txt-faint); font-size: 13px; padding: 18px; text-align: center; display: grid; place-items: center; height: 100%; }

/* ---- Kanban ------------------------------------------------------------ */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.lane { background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px; min-height: 90px; }
.lane-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.lane-title { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--txt-dim); }
.lane-count { font-size: 11px; color: var(--txt-faint); background: var(--panel-2); border-radius: 999px; padding: 1px 8px; }
.lane.KILLED .lane-title { color: var(--bad); }
.lane.MEASURE .lane-title { color: var(--good); }
.kcard { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; transition: transform .12s ease; }
.kcard:hover { transform: translateX(2px); }
.kcard.over { border-left-color: var(--bad); }
.kcard.on { border-left-color: var(--good); }
.kcard .k-name { font-size: 12px; font-weight: 600; }
.kcard .k-slug { font-family: var(--mono); font-size: 10px; color: var(--txt-faint); }
.kcard .k-foot { font-size: 10px; color: var(--txt-dim); margin-top: 3px; }

/* ---- Ideas ------------------------------------------------------------- */
.ideas { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.idea { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); transition: border-color .15s ease, transform .12s ease; }
.idea:hover { border-color: var(--line-2); transform: translateX(2px); }
.idea .score { font-family: var(--mono); font-weight: 800; font-size: 13px; min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--bg); border: 1px solid var(--line-2); }
.idea .score.hot { color: var(--good); border-color: rgba(46,204,143,.5); box-shadow: 0 0 12px rgba(46,204,143,.2); }
.idea .score.mid { color: var(--warn); }
.idea .idea-text { flex: 1; min-width: 0; }
.idea .idea-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-chip {
  display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; color: var(--accent); background: rgba(79,140,255,.10);
  border: 1px solid rgba(79,140,255,.3); max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

/* ---- Brain activity feed ----------------------------------------------- */
.feed { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.ev-row { display: grid; grid-template-columns: 4px 66px 1fr auto; gap: 10px; align-items: start; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 12px; animation: rise .3s ease both; }
.ev-rail { width: 3px; border-radius: 3px; align-self: stretch; background: var(--accent); }
.ev-kind { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--accent); padding-top: 1px; }
.ev-body { min-width: 0; }
.ev-msg { color: var(--txt); display: block; }
.ev-slug { display: inline-block; margin-top: 3px; font-family: var(--mono); font-size: 10px; color: var(--txt-faint); }
.ev-ts { color: var(--txt-faint); font-family: var(--mono); font-size: 10px; white-space: nowrap; }
/* kind-coloured rails + labels */
.kind-control { color: var(--warn); } .ev-rail.kind-control { background: var(--warn); }
.kind-approval { color: var(--accent-2); } .ev-rail.kind-approval { background: var(--accent-2); }
.kind-build { color: var(--accent); } .ev-rail.kind-build { background: var(--accent); }
.kind-review { color: var(--cyan); } .ev-rail.kind-review { background: var(--cyan); }
.kind-deploy { color: var(--accent-2); } .ev-rail.kind-deploy { background: var(--accent-2); }
.kind-measure { color: var(--good); } .ev-rail.kind-measure { background: var(--good); }
.kind-research { color: var(--txt-dim); } .ev-rail.kind-research { background: var(--txt-dim); }
.kind-kill, .kind-killed { color: var(--bad); } .ev-rail.kind-kill, .ev-rail.kind-killed { background: var(--bad); }
.kind-idea, .kind-promote { color: var(--good); } .ev-rail.kind-idea, .ev-rail.kind-promote { background: var(--good); }
.kind-outreach { color: var(--bad); } .ev-rail.kind-outreach { background: var(--bad); }

/* ---- Controls ---------------------------------------------------------- */
.control-body { display: flex; flex-direction: column; gap: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { color: var(--txt-dim); font-size: 12px; }
.field select, .field input {
  background: var(--bg); border: 1px solid var(--line-2); color: var(--txt);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: var(--sans);
}
.field select:focus, .field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79,140,255,.2); }
.check-field { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--txt); cursor: pointer; }
.check-field input { width: 16px; height: 16px; accent-color: var(--bad); }
.check-field em { color: var(--txt-faint); font-style: normal; font-size: 11px; }
.hint { color: var(--txt-faint); font-size: 11px; margin: 0; }
.hint code, .footer code { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-family: var(--mono); font-size: 11px; }
.control-foot { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.dossiers { list-style: none; margin: 8px 0 0; padding: 0; }
.dossiers li { font-family: var(--mono); font-size: 12px; color: var(--txt-dim); padding: 3px 0; }
.dossiers li::before { content: "📄 "; }
details summary { cursor: pointer; color: var(--txt-dim); font-size: 12px; }

/* ---- Lessons ----------------------------------------------------------- */
.lessons { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; max-height: 300px; overflow: auto; font-family: var(--mono); font-size: 12px; color: var(--txt-dim); white-space: pre-wrap; margin: 0; }

/* ---- Footer ------------------------------------------------------------ */
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 14px 22px 30px; color: var(--txt-faint); font-size: 11px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---- Modal ------------------------------------------------------------- */
.modal-root { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal-root.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,7,13,.7); backdrop-filter: blur(3px); }
.modal {
  position: relative; width: min(480px, 92vw); background: var(--panel);
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: pop .15s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h3 { margin: 0 0 10px; }
.modal p { color: var(--txt-dim); }
.modal-state { margin: 14px 0; font-size: 14px; }
.modal-state strong.on { color: var(--bad); }
.modal-state strong.off { color: var(--good); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---- Toast ------------------------------------------------------------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--txt);
  padding: 12px 18px; border-radius: 10px; font-size: 13px; z-index: 60;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); transition: opacity .2s ease, transform .2s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(12px); }
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .charts { grid-template-columns: repeat(2, 1fr); }
  .charts .span-2 { grid-column: span 2; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .span-2, .span-3 { grid-column: span 2; }
}
@media (max-width: 700px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .charts .span-2 { grid-column: span 1; }
  .grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .live-banner { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ---- Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- Money / Forecast -------------------------------------------------- */
.forecast { display: flex; flex-wrap: wrap; gap: 1rem; }
.fc-stat { flex: 1 1 150px; padding: .65rem .85rem; border-radius: 12px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); }
.fc-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; opacity: .6; }
.fc-val { font-size: 1.55rem; font-weight: 700; margin: .15rem 0; }
.fc-sub { font-size: .72rem; opacity: .6; }
.fc-stat.good .fc-val { color: var(--good, #46d39a); }
.fc-stat.accent .fc-val { color: var(--accent, #6ea8fe); }
