:root {
  --sidebar-width: 268px;
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --bg4: #222222;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #e8e6e0;
  --text2: #9a9890;
  --text3: #5a5856;
  --font-mono: 'DM Mono', ui-monospace, monospace;
  --teal: #1D9E75;
  --teal-light: #5DCAA5;
  --teal-dim: rgba(29,158,117,0.15);
  --teal-glow: rgba(29,158,117,0.08);
  --amber: #EF9F27;
  --amber-dim: rgba(239,159,39,0.12);
  --red: #E24B4A;
  --red-dim: rgba(226,75,74,0.12);
  --purple: #8B7CF8;
  --purple-dim: rgba(139,124,248,0.12);
  --blue: #4A9EF8;
  --blue-dim: rgba(74,158,248,0.12);
  --coral: #F07055;
  --coral-dim: rgba(240,112,85,0.12);
  --pink: #E87AB0;
  --pink-dim: rgba(232,122,176,0.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; }

/* API KEY SCREEN */
#keyscreen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; flex-direction: column; gap: 0;
}
.key-card {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 16px; padding: 40px 48px; width: 480px; max-width: 90vw;
}
.key-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.key-logo-mark {
  width: 36px; height: 36px; background: var(--teal); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.key-logo-mark svg { width: 20px; height: 20px; }
.key-logo-text { font-family: 'Fraunces', serif; font-size: 20px; color: var(--text); }
.key-logo-sub { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text3); letter-spacing: .1em; }
.key-title { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 300; color: var(--text); margin-bottom: 8px; }
.key-sub { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 28px; }
.key-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 10px; padding: 14px 16px; color: var(--text);
  font-family: 'DM Mono', monospace; font-size: 13px; outline: none;
  transition: border-color .2s; margin-bottom: 12px;
}
.key-input:focus { border-color: var(--teal); }
.key-input::placeholder { color: var(--text3); }
.key-btn {
  width: 100%; background: var(--teal); border: none; border-radius: 10px;
  padding: 14px; color: #fff; font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 500; cursor: pointer; transition: opacity .2s;
}
.key-btn:hover { opacity: .88; }
.key-note { font-size: 11px; color: var(--text3); margin-top: 12px; text-align: center; font-family: 'DM Mono', monospace; }

/* MAIN LAYOUT */
#app { display: none; height: 100vh; flex-direction: column; }
#app.visible { display: flex; }

/* HEADER */
.header {
  height: 56px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px;
  gap: 16px; flex-shrink: 0; background: var(--bg);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  min-width: 0;
}
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 28px; height: 28px; background: var(--teal); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-mark svg { width: 16px; height: 16px; }
.logo-name { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 400; color: var(--text); }
.logo-tag { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text3); letter-spacing: .08em; }
.header-sep { width: 1px; height: 20px; background: var(--border); }
.live-dot { width: 6px; height: 6px; background: var(--teal); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.3;} }
.live-label { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--teal); letter-spacing: .06em; }
.phase-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  white-space: nowrap;
}
.phase-build { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.phase-launch { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.phase-grow { background: rgba(16, 185, 129, 0.15); color: #34d399; }

.phase-switcher {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 12px;
  z-index: 200;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.phase-switcher-title {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  padding: 0 4px;
}
.phase-option {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  margin-bottom: 4px;
}
.phase-option span {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.6;
  margin-top: 2px;
}
.phase-option-build { color: #60a5fa; }
.phase-option-build:hover { background: rgba(59, 130, 246, 0.1); }
.phase-option-launch { color: #fbbf24; }
.phase-option-launch:hover { background: rgba(245, 158, 11, 0.1); }
.phase-option-grow { color: #34d399; }
.phase-option-grow:hover { background: rgba(16, 185, 129, 0.1); }

.connector-strip {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text3);
  margin-left: 8px;
  white-space: nowrap;
}
.setup-banner {
  flex-shrink: 0;
  padding: 8px 20px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--amber);
  background: var(--amber-dim);
  border-bottom: 1px solid var(--border);
}
.setup-banner code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
}

/* Finance banner (metrics + live Wise/Stripe row) */
.fin-banner {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  padding: 0;
}
#app.dept-expanded .fin-banner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#app.dept-expanded .body {
  display: none;
}
#app.dept-expanded .cfo-finance-wrap {
  flex: 1;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
}
#app.dept-expanded #finExpanded {
  overflow-y: auto;
}
.dept-metrics-shell[hidden] {
  display: none !important;
}
.dept-strip[hidden],
.cfo-finance-wrap[hidden] {
  display: none !important;
}
.dept-strip-collapsed {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.dept-strip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 8px 20px;
}
.dept-strip-metric-sep {
  color: var(--text3);
  opacity: 0.45;
  user-select: none;
  padding: 0 2px;
}
.dept-strip-metrics-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  flex: 1;
  min-width: 0;
  align-items: center;
}
.dept-strip-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-light);
  border: 1px solid rgba(29, 158, 117, 0.35);
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.dept-strip-badge--cfo {
  color: var(--amber);
  border-color: rgba(239, 159, 39, 0.4);
}
.dept-strip-badge--eng {
  color: #6eb6fa;
  border-color: rgba(74, 158, 248, 0.35);
}
.dept-strip-badge--cmo {
  color: #a89cf8;
  border-color: rgba(139, 124, 248, 0.35);
}
.dept-strip-badge--comms {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}
.dept-strip-expanded {
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.08);
}
#finExpanded {
  padding: 0;
}

/* ── CFO Dashboard — full-viewport layout ── */

/* Expanded dashboard fills viewport */

/* Row 1: 5 KPI cards */
.cfo-top-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 14px 24px 0;
  align-items: stretch;
}
.cfo-narrative {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg3);
  border-left: 3px solid var(--text3);
  border-radius: 10px;
}
.cfo-narrative-icon { font-size: 22px; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.cfo-narrative-headline { font-size: 13px; font-weight: 700; line-height: 1.35; }
.cfo-narrative-context { font-size: 10px; color: var(--text2); margin-top: 3px; line-height: 1.5; }

.cfo-kpi-card {
  background: var(--bg3);
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
}
.cfo-kpi-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}
.cfo-kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 5px;
}
.cfo-kpi-value--teal { color: var(--teal-light); }
.cfo-kpi-value--amber { color: var(--amber); }
.cfo-kpi-value--red { color: var(--red); }
.cfo-kpi-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
}
.cfo-kpi-secondary {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text2);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* Row 2: all 4 charts in one row */
.cfo-charts-quad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 12px 24px 0;
}
.cfo-chart-card {
  background: var(--bg3);
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  position: relative;
  min-width: 0;
  overflow: hidden;
}
.cfo-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
  padding: 0;
}
.cfo-chart-wrap {
  position: relative;
  height: 140px;
  overflow: hidden;
}
.cfo-chart-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.cfo-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
}
.cfo-chart-empty[hidden] { display: none; }

/* Row 3: plan tables — left (Solo Coach) / right (Gym + insights) */
.cfo-plans-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 24px 0;
  align-items: stretch;
}
.cfo-plan-left,
.cfo-plan-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cfo-plan-left .cfo-plan-col {
  flex: 1;
}
.cfo-plan-col {
  background: var(--bg3);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px 0;
  overflow: hidden;
}
.cfo-plan-col .cfo-section-label { padding: 0 16px; }
.cfo-plan-col-totals {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.cfo-plan-col-totals strong { color: var(--teal-light); font-weight: 600; }
.cfo-plan-table {
  width: 100%;
  border-collapse: collapse;
}
.cfo-plan-table th {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
}
.cfo-plan-table th:last-child,
.cfo-plan-table td:last-child { text-align: right; }
.cfo-plan-table th:nth-child(3),
.cfo-plan-table td:nth-child(3) { text-align: center; }
.cfo-plan-table td {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.cfo-plan-table tbody tr:last-child td { border-bottom: none; }
.cfo-plan-table td:first-child { color: var(--text); font-weight: 500; }
.cfo-plan-table tfoot td {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text);
  border-top: 2px solid var(--border2);
  font-weight: 600;
}
.cfo-plan-table tfoot td:last-child { color: var(--teal-light); }
.cfo-plan-table-empty {
  text-align: center !important;
  color: var(--text3) !important;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 18px 16px !important;
}
.cfo-plan-group td {
  font-family: var(--font-mono) !important;
  font-size: 8px !important;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text3) !important;
  background: var(--bg2);
  padding: 5px 12px !important;
  font-weight: 400 !important;
  border-bottom: 1px solid var(--border) !important;
}
.cfo-plan-pop {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--teal-light);
  background: var(--teal-dim);
  padding: 2px 8px;
  border-radius: 8px;
  margin-left: 8px;
  white-space: nowrap;
}
.cfo-plan-free {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  background: var(--bg2);
  padding: 2px 8px;
  border-radius: 8px;
  margin-left: 8px;
}

.cfo-kpi-unit {
  font-size: 13px;
  color: var(--text3);
  margin-left: 4px;
  font-family: var(--font-mono);
}
.cfo-cash-row-inner { display: flex; align-items: baseline; }

/* Plan insight cards — side by side below their parent table */
.cfo-plan-insights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cfo-plan-insight-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
}
.cfo-plan-insight-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}
.cfo-plan-insight--top .cfo-plan-insight-label { color: var(--teal-light); }
.cfo-plan-insight--bottom .cfo-plan-insight-label { color: var(--amber); }
.cfo-plan-insight-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
}
.cfo-plan-insight-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
}

/* Row 4: balance cards — full width, 4 columns */
.cfo-balance-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 12px 24px 16px;
}
.cfo-balance-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
}
.cfo-balance-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.cfo-balance-body { min-width: 0; flex: 1; }
.cfo-balance-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}
.cfo-balance-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--text);
}
.cfo-balance-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  line-height: 1.4;
}
.cfo-balance-secondary {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text2);
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
}
.cfo-foot-teal { color: var(--teal-light) !important; }
.cfo-foot-amber { color: var(--amber) !important; }

@media (max-width: 900px) {
  .cfo-top-row { grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 16px 0; }
  .cfo-charts-quad { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px 16px 0; max-height: none; }
  .cfo-plans-row { grid-template-columns: 1fr; gap: 8px; padding: 12px 16px 0; }
  .cfo-balance-row { grid-template-columns: 1fr; gap: 8px; padding: 12px 16px 16px; }
}
.pm-strip-task-body {
  padding: 12px 20px 16px;
  max-height: min(56vh, 480px);
  overflow-y: auto;
}
.pm-strip-hero {
  padding: 16px 20px 0;
}
.pm-strip-hero[hidden] {
  display: none !important;
}
.pm-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 12px;
  margin-bottom: 4px;
}
@media (min-width: 900px) {
  .pm-hero-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr);
    align-items: stretch;
  }
}
.pm-hero-tile {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.pm-hero-tile--accent {
  border-color: rgba(29, 158, 117, 0.35);
  background: linear-gradient(145deg, rgba(29, 158, 117, 0.08), var(--bg3));
}
.pm-hero-tile--focus {
  border-left: 3px solid var(--teal);
  padding-left: 13px;
}
.pm-hero-tile--span {
  grid-column: 1 / -1;
}
@media (min-width: 900px) {
  .pm-hero-tile--span {
    grid-column: span 1;
  }
}
.pm-hero-label {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
}
.pm-hero-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--teal-light);
  line-height: 1.1;
}
.pm-hero-hint {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.35;
}
.pm-hero-focus {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.pm-task-epic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
  align-items: start;
}
.pm-strip-task-body .task-epic {
  margin-bottom: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 4px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}
.pm-strip-task-body .task-epic-head {
  margin-bottom: 8px;
}
.pm-strip-task-body .task-epic-id {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0.02em;
}
.pm-strip-task-body .task-epic-meta {
  font-size: 11px;
  color: var(--teal-light);
}
.cos-expanded-grid,
.dept-dash-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 14px;
  padding: 16px 20px 22px;
}
.cos-exp-card,
.dept-dash-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  min-height: 108px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}
.dept-dash-card--product {
  grid-column: 1 / -1;
}
@media (min-width: 960px) {
  .dept-dash-card--product {
    grid-column: span 2;
  }
}
.cos-exp-h,
.dept-dash-card-h {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
}
.cos-exp-h-sub {
  display: block;
  margin-top: 5px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--text2);
  line-height: 1.35;
}
.cos-briefing-rail .cos-rail-kicker {
  font-size: 9px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  flex-shrink: 0;
}
.cos-rail-divider {
  width: 1px;
  height: 14px;
  background: var(--border2);
  flex-shrink: 0;
  align-self: center;
  opacity: 0.85;
  margin: 0 2px 0 6px;
}
.cos-exp-t,
.dept-dash-card-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text2);
}
.cos-briefing-card.cos-exp-t {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.cos-briefing-headline {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.cos-briefing-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text2);
  font-size: 13px;
  line-height: 1.55;
}
.cos-briefing-list li {
  margin-bottom: 6px;
}
.cos-briefing-list li:last-child {
  margin-bottom: 0;
}
.cos-product-lead {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 13px !important;
  color: var(--text2) !important;
}
.cos-signal-list {
  margin: 0;
  padding-left: 1.1rem;
  list-style: disc;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.5;
  font-family: 'DM Sans', sans-serif;
}
.cos-signal-list li {
  margin-bottom: 6px;
}
.cos-signal-flag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--amber);
  margin-right: 6px;
}
.cos-exp-lead {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text3);
  margin: 0 0 4px;
  font-family: var(--font-mono);
}

/* Product rollups: compact KPI chips inside Chief expanded */
.dept-dash-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.dept-dash-kpi-chip {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 10px 12px;
  text-align: center;
  min-width: 0;
}
.dept-dash-kpi-chip-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
  line-height: 1.25;
}
.dept-dash-kpi-chip-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--teal-light);
  line-height: 1.2;
  word-break: break-word;
}
.dept-dash-kpi-signals {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
}
.eng-commits-mount {
  padding: 4px 20px 0;
  max-height: min(40vh, 320px);
  overflow-y: auto;
}
.eng-commit-row {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text2);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.eng-sha {
  color: var(--teal);
  margin-right: 8px;
}
.eng-msg {
  color: var(--text);
}
.eng-meta {
  display: block;
  margin-top: 4px;
  color: var(--text3);
  font-size: 10px;
}
.dept-strip-footnote {
  padding: 0 20px 14px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text3);
}

/* ── DEPT STRIP TILE GRID ────────────────────────────────── */
/* Replaces the horizontal rail in each dept's collapsed view */
.dept-strip-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 14px 12px;
}
.dept-strip-tiles--6 {
  grid-template-columns: repeat(6, 1fr);
}
/* dst = dept strip tile */
.dst {
  background: var(--bg3);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 0;
  border: 1px solid transparent;
  transition: border-color .15s;
}
.dept-strip-collapsed:hover .dst {
  border-color: var(--border);
}
.dst-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dst-val {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dst-val--sm { font-size: 13px; line-height: 1.3; padding-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dst--wide { grid-column: span 1; min-width: 0; }
.dst-val--teal { color: var(--teal-light); }
.dst-val--amber { color: var(--amber); }
.dst-val--red { color: var(--red); }
.dst-val--muted { color: var(--text3); }
.dst-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Dept name label that replaces the old scrolling rail in the header row */
.dept-strip-name {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--text3);
  font-family: var(--font-mono);
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmo-placeholder {
  padding: 14px 20px 18px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
}
/* Single horizontal row: scroll on narrow viewports, no stacked “two lines” collapse */
.dept-strip-metrics-wrap--rail {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.dept-strip-metrics-wrap--rail::-webkit-scrollbar {
  height: 4px;
}
.dept-strip-metrics-wrap--rail::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
}
.dept-strip-metrics-wrap--rail .dept-strip-metric-line {
  flex-wrap: nowrap;
  gap: 14px 22px;
  padding-right: 8px;
}
.dept-strip-metrics-wrap--rail .fin-metric {
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11px;
}
.dept-strip-metrics-wrap--rail .fin-metric strong,
.dept-strip-metrics-wrap--rail .fin-metric-val {
  font-size: 12px;
}

.dept-strip-metrics-wrap--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  min-width: 0;
}
.dept-strip-metric-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}
.dept-strip-metric-line--dense {
  font-size: 10px;
}
.dept-strip-metric-line--dense .fin-metric {
  font-size: 10px;
}
.dept-strip-hook--below-rail {
  width: 100%;
  padding: 0 20px 6px;
  margin-top: -2px;
}
.dept-strip-hook {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text3);
  line-height: 1.35;
  max-width: 52rem;
}
.dept-strip-muted {
  font-weight: 400;
  color: var(--text3);
  font-size: 9px;
}
.fin-banner-row-saas {
  background: rgba(239, 159, 39, 0.06);
  border-top: 1px solid var(--border);
  padding-top: 6px;
  padding-bottom: 6px;
}
.fin-banner-row-saas .fin-metric {
  font-size: 10px;
}
.dept-strip-badge--sales {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.45);
}
.dept-kpi-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 4px 20px 8px;
}
.dept-kpi-section-label--readable {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text2);
  padding: 10px 20px 6px;
}
.dept-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 0 20px 14px;
}
.dept-kpi-grid--tight {
  gap: 8px;
}
.dept-kpi-tile {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 0;
}
.dept-kpi-tile-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.dept-kpi-tile-val {
  font-size: 17px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.2;
}

/* Expanded department strips: larger KPI tiles — fill row width */
.dept-kpi-grid--hero {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr));
  gap: 12px;
  padding: 0 20px 18px;
  width: 100%;
  box-sizing: border-box;
}
.dept-kpi-grid--hero .dept-kpi-tile {
  padding: 14px 16px;
  border-radius: 10px;
}
.dept-kpi-grid--hero .dept-kpi-tile-label {
  font-size: 9px;
  margin-bottom: 8px;
}
.dept-kpi-grid--hero .dept-kpi-tile-val {
  font-size: 22px;
  font-weight: 600;
}

/* CFO collapsed: primary metrics in one scrollable row */
.fin-banner-row--rail {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  gap: 14px 22px;
  padding-bottom: 8px;
}
.fin-banner-row--rail .fin-metric {
  white-space: nowrap;
  flex-shrink: 0;
}

.fin-hero-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}
.fin-hero-metric-cell {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.fin-hero-metric-cell-label {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.fin-hero-metric-cell-val {
  font-size: 24px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.15;
}
.fin-hero-metric-cell-val.fin-hero-val-teal {
  color: var(--teal-light);
}
.cmo-placeholder-foot {
  padding: 0 20px 16px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text3);
  line-height: 1.5;
  max-width: 48rem;
}
#commsStripExpanded {
  padding: 10px 20px 14px;
}
.comms-live-col-label--hero {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.04em;
}
.resend-metrics-block {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.resend-expanded-mount {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.resend-panel {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px 16px;
}
.resend-panel--warn {
  border-color: rgba(239, 159, 39, 0.35);
  background: var(--amber-dim);
}
.resend-panel-title {
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin: 0 0 12px;
  font-weight: 600;
}
.resend-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
  gap: 12px;
}
.resend-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.resend-stat-label {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.3;
}
.resend-stat-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  color: var(--teal-light);
  line-height: 1.1;
}
.resend-stat-sub {
  font-size: 10px;
  color: var(--text3);
}
.resend-quiet {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--text3);
  line-height: 1.45;
}
.resend-quiet code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text2);
}
.resend-lede {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.4;
}
.fin-banner-collapsed {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fin-banner-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 8px 20px;
}
.fin-banner-row-metrics {
  padding-bottom: 6px;
}
.fin-banner-row-live {
  border-top: 1px solid var(--border);
  background: rgba(29, 158, 117, 0.06);
  padding-top: 8px;
  padding-bottom: 8px;
  align-items: center;
}
.fin-metric {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text2);
}
.fin-metric-val { color: var(--text); }
.fin-metric-teal { color: var(--teal); }
.fin-banner-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fin-chevron-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text3);
}
.fin-live-pill {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--teal-light);
  border: 1px solid rgba(29, 158, 117, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.fin-live-item {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text2);
}
.fin-live-strong {
  color: var(--teal);
  font-weight: 600;
}
.fin-live-refresh {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  flex-shrink: 0;
}
.fin-live-refresh:hover {
  color: var(--teal-light);
  border-color: var(--teal);
}

/* Live finance row · “alive” feedback */
.fin-banner-row-live.is-fetching {
  background: linear-gradient(
    105deg,
    rgba(29, 158, 117, 0.07) 0%,
    rgba(29, 158, 117, 0.18) 45%,
    rgba(29, 158, 117, 0.07) 90%
  );
  background-size: 220% 100%;
  animation: fin-live-shimmer 1.15s ease-in-out infinite;
}
.fin-banner-row-live.is-fetching .fin-live-pill {
  box-shadow: 0 0 0 1px rgba(29, 158, 117, 0.4);
  animation: fin-pill-pulse 1s ease-in-out infinite;
}
@keyframes fin-live-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@keyframes fin-pill-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}
.fin-live-refresh.is-spinning {
  animation: fin-refresh-spin 0.75s linear infinite;
}
@keyframes fin-refresh-spin {
  to { transform: rotate(360deg); }
}
.fin-live-strong.live-flash {
  animation: fin-value-flash 0.9s ease-out;
}
@keyframes fin-value-flash {
  0% {
    color: var(--teal);
    text-shadow: 0 0 0 transparent;
  }
  40% {
    color: var(--teal-light);
    text-shadow: 0 0 14px rgba(29, 158, 117, 0.5);
  }
  100% {
    color: var(--teal);
    text-shadow: 0 0 0 transparent;
  }
}

.connector-strip.is-tick {
  color: var(--teal-light);
  transition: color 0.35s ease;
}

#deptStripComms.is-fetching {
  opacity: 0.92;
  pointer-events: none;
}
#deptStripComms.is-fetching .comms-live-meta {
  color: var(--teal-light);
}
.comms-inbox-row-enter {
  animation: comms-row-enter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--stagger, 0) * 42ms);
}
@keyframes comms-row-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fin-banner-row-live.is-fetching,
  .fin-banner-row-live.is-fetching .fin-live-pill,
  .fin-live-refresh.is-spinning,
  .fin-live-strong.live-flash,
  .comms-inbox-row-enter,
  .connector-strip.is-tick,
  #deptStripComms.is-fetching {
    animation: none !important;
  }
  .fin-banner-row-live.is-fetching {
    background: rgba(29, 158, 117, 0.1);
  }
}

.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.auto-route-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text3);
  cursor: pointer;
  user-select: none;
  margin-right: 2px;
}
.auto-route-label input { accent-color: var(--teal); cursor: pointer; }
.clear-btn {
  font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text3);
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 10px; cursor: pointer; transition: all .2s;
}
.clear-btn:hover { color: var(--text2); border-color: var(--border2); }

/* BODY */
.body { display: flex; flex: 1; overflow: hidden; min-width: 0; }

/* SIDEBAR */
.sidebar-shell {
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  align-items: stretch;
}
.sidebar-resize-handle {
  width: 6px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  align-self: stretch;
  margin-left: -3px;
  margin-right: -1px;
  z-index: 3;
  transition: background 0.15s;
  position: relative;
}
.sidebar-resize-handle::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: transparent;
  border-radius: 2px;
  transition: background 0.15s;
}
.sidebar-resize-handle:hover::after,
.sidebar-resize-handle:focus-visible::after {
  background: var(--teal);
  opacity: 0.45;
}
.sidebar-resize-handle:focus-visible {
  outline: none;
}
.sidebar {
  width: var(--sidebar-width);
  min-width: 200px;
  max-width: 100vw;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 0;
}
.sidebar-chart-top {
  position: relative;
  padding-bottom: 4px;
}
.sidebar-show-chat {
  position: absolute;
  top: 6px;
  right: 10px;
  z-index: 6;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--teal);
  background: var(--bg2);
  color: var(--teal-light);
  cursor: pointer;
}
.sidebar-show-chat:hover {
  background: var(--teal-dim);
}
.sidebar-show-chat[hidden] {
  display: none !important;
}
.sidebar-fill-btn {
  margin-left: 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  vertical-align: middle;
}
.sidebar-fill-btn:hover {
  border-color: var(--teal);
  color: var(--teal-light);
}
.sidebar-fill-btn[hidden] {
  display: none !important;
}
.org-chart-exec-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar--chart .org-chart-exec-row {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 16px 24px;
  max-width: 720px;
  margin: 0 auto;
}
.sidebar--fullscreen .org-chart-exec-row {
  max-width: 960px;
  gap: 24px 32px;
}
.sidebar--chart .org-chart-exec-row .agent-btn {
  flex: 1 1 200px;
  max-width: 320px;
  justify-content: flex-start;
  border: 1px solid var(--border2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.org-chart-spine {
  display: none;
  flex-direction: column;
  align-items: center;
  margin: 10px 12px 14px;
  pointer-events: none;
}
.sidebar--chart .org-chart-spine {
  display: flex;
}
.org-chart-spine-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: min(100%, 1100px);
}
.org-chart-spine-v {
  display: block;
  width: 2px;
  height: 18px;
  background: var(--text3);
  opacity: 0.45;
  border-radius: 2px;
}
.org-chart-spine-h {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text3);
  opacity: 0.4;
  border-radius: 2px;
  margin-top: 0;
}
.sidebar-org-chart-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar--chart .sidebar-org-chart-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: start;
}
@media (max-width: 900px) {
  .sidebar--chart .sidebar-org-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.sidebar-tier-depts .sidebar-tier-label {
  text-align: center;
}
.sidebar--chart .sidebar-tier-depts .sidebar-tier-label {
  margin-bottom: 12px;
  font-size: 10px;
}
.sidebar--fullscreen .quick-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 10px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 0;
}
.sidebar--fullscreen .quick-section .sidebar-label {
  grid-column: 1 / -1;
}
.sidebar-tier {
  padding: 0 12px;
  margin-bottom: 18px;
}
.sidebar-tier-label {
  font-size: 9px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text3);
  margin-bottom: 8px;
  line-height: 1.35;
}
.sidebar-dept-block {
  margin-bottom: 14px;
}
.sidebar-dept-block:last-child {
  margin-bottom: 0;
}
.sidebar-org-hint {
  font-size: 10px;
  color: var(--text3);
  line-height: 1.5;
  padding: 0 14px 10px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.sidebar--fullscreen .sidebar-org-hint {
  padding-right: 120px;
}
.sidebar-tier-outside .agent-btn-ceo {
  margin-top: 0;
}
.agent-btn-ceo {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}
.sidebar-org-column {
  margin-bottom: 10px;
}
.sidebar-org-connector {
  width: 2px;
  height: 8px;
  margin: 2px auto 4px;
  background: var(--text3);
  opacity: 0.35;
  border-radius: 2px;
}
.sidebar-org-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
/* Wide sidebar ≈ org chart: department “box”, spine, stacked roles */
.sidebar--org .sidebar-org-column {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 8px 8px 6px;
  margin-bottom: 12px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.28);
}
.sidebar--org .sidebar-org-column .sidebar-dept-block {
  margin-bottom: 0;
}
.sidebar--org .sidebar-dept-header {
  justify-content: center;
  text-align: center;
  padding: 8px 10px;
  margin-bottom: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.sidebar--chart .sidebar-dept-header {
  background: linear-gradient(
    180deg,
    rgba(125, 180, 255, 0.14) 0%,
    rgba(30, 40, 55, 0.9) 100%
  );
  border-color: rgba(125, 180, 255, 0.28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}
.sidebar--org .sidebar-dept-header .dept-label {
  font-size: 11px;
  letter-spacing: 0.11em;
}
.sidebar--org .sidebar-org-connector {
  height: 12px;
  margin-top: 6px;
  margin-bottom: 8px;
  opacity: 0.5;
  background: linear-gradient(180deg, var(--text3) 0%, transparent 100%);
}
.sidebar--org .sidebar-org-stack {
  margin-left: 4px;
  padding-left: 10px;
  border-left: 2px solid rgba(29, 158, 117, 0.25);
  gap: 2px;
}
.sidebar--org .agent-btn-sub {
  margin-left: 0;
  width: 100%;
  padding-left: 8px;
  border-left: none;
}
.sidebar--org .agent-btn .agent-btn-role {
  white-space: normal;
  line-height: 1.35;
}
.sidebar-section { padding: 0 12px; margin-bottom: 20px; }
.sidebar-rex { padding: 0 12px; margin-bottom: 16px; }
.sidebar-dept-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0 4px;
  cursor: pointer;
  user-select: none;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.sidebar-dept-header .dept-label {
  flex: 1;
  min-width: 0;
}
.sidebar-dept-header:hover { color: var(--text2); }
.sidebar-dept-header .sidebar-chevron {
  font-size: 10px;
  color: var(--text2);
  letter-spacing: 0;
  text-transform: none;
  flex-shrink: 0;
  line-height: 1;
}
.sidebar-label {
  font-family: 'DM Mono', monospace; font-size: 9px; color: var(--text3);
  letter-spacing: .12em; text-transform: uppercase; padding: 0 8px; margin-bottom: 6px;
}
.sidebar-label.sidebar-label-toggle {
  margin-bottom: 6px;
  user-select: none;
}
.sidebar-label-toggle .sidebar-chevron {
  font-size: 10px;
  color: var(--text2);
  letter-spacing: 0;
  text-transform: none;
  flex-shrink: 0;
  line-height: 1;
}
.sidebar-section-body {
  overflow: hidden;
  transition: max-height 0.22s ease;
}
.sidebar-section-body.collapsed { max-height: 0; }
.sidebar-section-body.open { max-height: 900px; }
.agent-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 8px; border: none; background: none;
  cursor: pointer; transition: background .15s; text-align: left; margin-bottom: 2px;
}
.agent-btn-apex {
  border: 1px solid rgba(29, 158, 117, 0.22);
  background: rgba(29, 158, 117, 0.06);
}
.agent-btn-head .agent-btn-name {
  font-weight: 600;
}
.agent-btn:hover { background: var(--bg3); }
.agent-btn.active { background: var(--teal-dim); border-color: transparent; }
.agent-btn.active .agent-btn-name { color: var(--teal-light); }
.agent-btn[data-phase-state="active"] { opacity: 1; }
.agent-btn[data-phase-state="supporting"] { opacity: 0.7; }
.agent-btn[data-phase-state="dormant"] { opacity: 0.4; }
.agent-btn[data-phase-state="supporting"] .agent-status {
  background: var(--text3);
  border-color: transparent;
}
.agent-btn-sub {
  margin-left: 14px;
  width: calc(100% - 14px);
  padding-left: 8px;
  border-left: 2px solid rgba(255, 255, 255, 0.06);
}
.agent-btn-sub .agent-icon {
  width: 28px;
  height: 28px;
  font-size: 12px;
}
.agent-btn-sub .agent-btn-name { font-size: 12px; }
.agent-btn-sub .agent-btn-role { font-size: 10px; }
.agent-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.agent-btn-text { flex: 1; min-width: 0; }
.agent-btn-name { font-size: 12px; font-weight: 500; color: var(--text); display: block; }
.agent-btn-role { font-size: 10px; color: var(--text3); display: block; font-family: 'DM Mono', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-status { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-active { background: var(--teal); }
.status-idle { background: var(--bg4); border: 1px solid var(--border2); }

.quick-section { padding: 0 12px; }
.quick-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border-radius: 8px; border: none; background: none;
  cursor: pointer; transition: background .15s; text-align: left; margin-bottom: 2px;
  font-size: 12px; color: var(--text2);
}
.quick-btn:hover { background: var(--bg3); color: var(--text); }
.quick-icon { font-size: 13px; width: 20px; text-align: center; }

/* CHAT AREA */
.chat-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* AGENT HEADER BAR */
.agent-bar {
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; flex-shrink: 0;
  background: var(--bg);
}
.agent-bar-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.agent-bar-name { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 300; color: var(--text); }
.agent-bar-desc { font-size: 12px; color: var(--text2); }
.agent-bar-right { margin-left: auto; }
.thinking-badge {
  display: none; align-items: center; gap: 6px;
  font-family: 'DM Mono', monospace; font-size: 10px; color: var(--teal);
  background: var(--teal-glow); border: 1px solid rgba(29,158,117,0.2);
  border-radius: 20px; padding: 4px 12px;
}
.thinking-badge.visible { display: flex; }
.think-dot { width: 5px; height: 5px; background: var(--teal); border-radius: 50%; animation: blink .8s infinite; }
.think-dot:nth-child(2) { animation-delay: .15s; }
.think-dot:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%,100%{opacity:.2;} 50%{opacity:1;} }

/* MESSAGES */
.messages {
  flex: 1; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column; gap: 20px;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }

.welcome-state { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; text-align: center; padding: 40px; }
.welcome-glyph { font-size: 40px; margin-bottom: 20px; }
.welcome-title { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 300; color: var(--text); margin-bottom: 8px; }
.welcome-sub { font-size: 14px; color: var(--text2); line-height: 1.6; max-width: 400px; margin-bottom: 32px; }
.quick-prompts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 560px; }
.qp-btn {
  padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border2);
  background: var(--bg2); color: var(--text2); font-size: 12px; cursor: pointer;
  transition: all .2s; font-family: 'DM Sans', sans-serif;
}
.qp-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--teal); }

.msg { display: flex; gap: 14px; animation: fadeUp .3s ease; max-width: 100%; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  margin-top: 2px;
}
.msg-avatar.user { background: var(--bg4); font-size: 12px; font-family: 'DM Mono', monospace; color: var(--text2); font-weight: 500; }
.msg-body { flex: 1; min-width: 0; }
.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.msg-name { font-size: 12px; font-weight: 500; color: var(--text); }
.msg-time { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text3); }
.msg-agent-tag {
  font-family: 'DM Mono', monospace; font-size: 9px; padding: 2px 7px;
  border-radius: 4px; letter-spacing: .05em;
}
.msg-content {
  font-size: 14px; line-height: 1.7; color: var(--text);
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 4px 12px 12px 12px; padding: 14px 16px;
}
.msg.user-msg { flex-direction: row-reverse; }
.msg.user-msg .msg-body { align-items: flex-end; display: flex; flex-direction: column; }
.msg.user-msg .msg-content {
  background: var(--bg3); border-radius: 12px 4px 12px 12px;
  border-color: var(--border2);
}
.msg.user-msg .msg-meta { flex-direction: row-reverse; }
.msg-content h1,.msg-content h2,.msg-content h3 { font-family: 'Fraunces', serif; font-weight: 400; margin: 16px 0 8px; color: var(--text); }
.msg-content h1 { font-size: 18px; }
.msg-content h2 { font-size: 16px; }
.msg-content h3 { font-size: 14px; color: var(--text2); }
.msg-content p { margin-bottom: 10px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content ul,.msg-content ol { padding-left: 20px; margin-bottom: 10px; }
.msg-content li { margin-bottom: 4px; }
.msg-content code { font-family: 'DM Mono', monospace; font-size: 12px; background: var(--bg3); padding: 2px 6px; border-radius: 4px; color: var(--teal-light); }
.msg-content pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px; overflow-x: auto; margin: 10px 0; }
.msg-content pre code { background: none; padding: 0; color: var(--text2); }
.msg-content strong { color: var(--text); font-weight: 500; }
.msg-content .flag-red { color: var(--red); }
.msg-content .flag-amber { color: var(--amber); }
.msg-content .flag-green { color: var(--teal-light); }
.msg-content a { color: var(--teal-light); text-decoration: none; }
.msg-content a:hover { text-decoration: underline; }

.memory-toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: var(--bg2);
  border: 1px solid var(--teal-light);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--teal-light);
  z-index: 1000;
  max-width: 280px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: toastIn 0.3s ease forwards;
  cursor: pointer;
}
.memory-toast .toast-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.memory-toast .toast-items {
  opacity: 0.8;
  font-size: 11px;
  line-height: 1.5;
}
.memory-toast.toast-out {
  animation: toastOut 0.4s ease forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px); }
}
.msg-content hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.msg-content blockquote { border-left: 3px solid var(--teal); padding-left: 14px; color: var(--text2); margin: 10px 0; font-style: italic; }

/* INPUT */
.input-area {
  position: relative;
  padding: 16px 24px 20px; border-top: 1px solid var(--border);
  flex-shrink: 0; background: var(--bg);
}
.input-wrap {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 12px 14px; transition: border-color .2s;
}
.input-wrap:focus-within { border-color: var(--teal); }
#chatInput {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 14px;
  resize: none; min-height: 24px; max-height: 140px; line-height: 1.6;
}
#chatInput::placeholder { color: var(--text3); }
.send-btn {
  width: 36px; height: 36px; background: var(--teal); border: none;
  border-radius: 9px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: opacity .2s;
}
.send-btn:hover { opacity: .85; }
.send-btn:disabled { opacity: .35; cursor: not-allowed; }
.send-btn svg { width: 16px; height: 16px; fill: white; }
.attach-btn {
  width: 36px; height: 36px; background: var(--bg3); border: none;
  border-radius: 9px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: opacity .2s, color .2s;
  margin-right: 6px; color: var(--text2);
}
.attach-btn:hover { opacity: .85; color: var(--text); }
.attach-btn:disabled { opacity: .35; cursor: not-allowed; }
.attach-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.attach-btn.skill-picker-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  margin-right: 0;
}
.skill-picker-popup {
  display: none;
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 100%;
  margin-bottom: 8px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.45);
  z-index: 30;
}
.skill-picker-popup.open { display: block; }
.skill-picker-popup::-webkit-scrollbar { width: 4px; }
.skill-picker-popup::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }
.skill-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin: 2px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.skill-picker-item:hover {
  background: var(--bg3);
  color: var(--text);
}
.input-hint { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text3); margin-top: 8px; padding: 0 4px; }

/* Task panel — slide-in from right */
.task-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.task-panel-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.task-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 92vw);
  background: var(--bg2);
  border-left: 1px solid var(--border2);
  z-index: 96;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.4);
}
.task-panel.open {
  transform: translateX(0);
}
.task-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}
.task-panel-title {
  font-family: 'Fraunces', serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
}
.task-panel-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  color: var(--text2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.task-panel-close:hover {
  border-color: var(--border2);
  color: var(--text);
}
.task-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 20px;
}
.task-panel-body::-webkit-scrollbar { width: 5px; }
.task-panel-body::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }
.task-epic {
  margin-bottom: 18px;
}
.task-epic-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.task-epic-id {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--teal-light);
  text-transform: uppercase;
}
.task-epic-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
}
.task-epic-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--bg3);
  overflow: hidden;
  margin-bottom: 10px;
}
.task-epic-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--teal);
  transition: width 0.25s ease;
}
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0 6px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.35;
  color: var(--text2);
}
.task-row:last-child { border-bottom: none; }
.task-row-status {
  font-family: var(--font-mono);
  font-size: 11px;
  flex-shrink: 0;
  width: 1.25em;
  color: var(--text3);
}
.task-row-title { flex: 1; min-width: 0; }
.task-row.pri-critical .task-row-title { color: var(--red); }
.task-row.pri-high .task-row-title { color: var(--amber); }
.task-row.pri-medium .task-row-title { color: var(--text2); }
.task-row.pri-low .task-row-title,
.task-row.pri-default .task-row-title { color: var(--text3); }
.task-panel-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  padding: 24px 8px;
  text-align: center;
}

/* Comms · live channels (inside department strip expanded) */
.comms-live-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.comms-live-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text3);
  text-transform: uppercase;
}
.comms-live-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text2);
  flex: 1;
  min-width: 0;
}
.comms-live-refresh {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
}
.comms-live-refresh:hover {
  color: var(--text);
  border-color: var(--teal);
}
.comms-live-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  min-height: 112px;
  overflow: hidden;
}
@media (max-width: 720px) {
  .comms-live-columns {
    grid-template-columns: 1fr;
    max-height: 50vh;
  }
}
.comms-live-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}
.comms-live-col-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.comms-inbox-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
  min-height: 96px;
  max-height: 220px;
}
.comms-inbox-row {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.comms-inbox-subj {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}
.comms-inbox-from {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-top: 4px;
  word-break: break-word;
}
.comms-inbox-preview {
  font-size: 11px;
  color: var(--text2);
  margin-top: 6px;
  line-height: 1.45;
  max-height: 4.35em;
  overflow: hidden;
}
.comms-inbox-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  line-height: 1.5;
  padding: 8px 0;
}
.comms-soon-line {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text2);
  line-height: 1.45;
}
.comms-live-col-soon {
  border-left: 1px solid var(--border);
  padding-left: 14px;
}
@media (max-width: 720px) {
  .comms-live-col-soon {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 10px;
  }
}
