/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy-950: #060f1a;
  --navy-900: #0d1b2a;
  --navy-800: #112240;
  --navy-700: #1a2f4a;
  --navy-600: #1e3a5f;
  --navy-500: #254e7a;
  --blue-500: #2563eb;
  --blue-400: #3b82f6;
  --blue-300: #60a5fa;
  --blue-200: #93c5fd;
  --gold-500: #f59e0b;
  --gold-400: #fbbf24;
  --gold-300: #fcd34d;
  --white:    #ffffff;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --green:       #10b981;
  --green-light: #34d399;
  --green-dim:   #064e3b;
  --green-badge: rgba(16,185,129,.15);
  --yellow:       #f59e0b;
  --yellow-light: #fbbf24;
  --yellow-dim:   #78350f;
  --yellow-badge: rgba(245,158,11,.15);
  --red:       #ef4444;
  --red-light: #f87171;
  --red-dim:   #7f1d1d;
  --red-badge: rgba(239,68,68,.15);
  --border:   rgba(255,255,255,.08);
  --border-md: rgba(255,255,255,.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'SF Mono', 'Fira Code', monospace;
}

html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--navy-950);
  color: var(--gray-100);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--navy-800); }
::-webkit-scrollbar-thumb { background: var(--navy-500); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-400); }

/* ── Layout ─────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ─────────────────────────────────────────────────────── */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy-900);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  font-size: 28px;
  color: var(--gold-400);
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(251,191,36,.4));
}
.logo-product {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: .3px;
}
.logo-subtitle {
  font-size: 11px;
  color: var(--gray-400);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.role-toggle {
  display: flex;
  background: var(--navy-800);
  border: 1px solid var(--border-md);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.role-btn {
  background: transparent;
  border: none;
  color: var(--gray-400);
  padding: 7px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .3px;
}
.role-btn:hover { color: var(--white); background: var(--navy-700); }
.role-btn.active {
  background: var(--blue-500);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(37,99,235,.4);
}

.last-updated { font-size: 12px; color: var(--gray-500); }

/* ── KPI Row ────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  padding: 16px 24px;
  background: var(--navy-900);
  border-bottom: 1px solid var(--border);
}

.kpi-card {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent, var(--blue-400));
}
.kpi-card:hover { border-color: var(--border-md); }
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .7px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  letter-spacing: -.5px;
}
.kpi-sub {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}
.kpi-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  opacity: 1;
  color: var(--white);
}

/* ── Alerts ─────────────────────────────────────────────────────── */
.alerts-container {
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all .2s;
}
.alerts-container:not(:empty) { padding: 12px 24px; }

.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.25);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 13px;
  color: var(--red-light);
  animation: slideIn .2s ease;
}
.alert-item.warn {
  background: rgba(245,158,11,.08);
  border-color: rgba(245,158,11,.2);
  border-left-color: var(--yellow);
  color: var(--gold-300);
}
.alert-icon { font-size: 14px; flex-shrink: 0; }

/* ── Filter Bar ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--navy-900);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .6px;
}
.filter-group select {
  background: var(--navy-800);
  border: 1px solid var(--border-md);
  color: var(--gray-200);
  padding: 7px 28px 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color .2s;
  min-width: 140px;
}
.filter-group select:hover,
.filter-group select:focus { border-color: var(--blue-400); outline: none; }

/* Active filter state */
.filter-group.filter-group-active label {
  color: var(--blue-300);
}
.filter-group.filter-group-active label::after {
  content: ' ●';
  color: var(--blue-400);
  font-size: 8px;
  vertical-align: middle;
  margin-left: 2px;
}
.filter-group select.filter-is-active {
  border-color: var(--blue-400);
  background-color: rgba(59,130,246,.07);
  color: var(--white);
}

.filter-actions { display: flex; align-items: center; gap: 12px; }
.results-count { font-size: 12px; color: var(--gray-500); white-space: nowrap; }

.btn-secondary {
  background: var(--navy-700);
  border: 1px solid var(--border-md);
  color: var(--gray-300);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--navy-600); color: var(--white); }

.btn-primary {
  background: var(--blue-500);
  border: 1px solid rgba(59,130,246,.3);
  color: var(--white);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--blue-400); }

/* ── Content Area ───────────────────────────────────────────────── */
.content-area {
  display: grid;
  grid-template-columns: 1fr;
  flex: 1;
  transition: grid-template-columns .3s ease;
  align-items: start;
}
.content-area.panel-open {
  grid-template-columns: 1fr 440px;
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  overflow: hidden;
}

/* ── Account Table ──────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  position: relative;
  /* Right-edge fade — hidden when .at-end is set by JS */
  box-shadow: inset -56px 0 28px -20px var(--navy-950);
  transition: box-shadow .25s;
}
.table-container.at-end { box-shadow: none; }

/* Stronger, more visible scrollbar on the table */
.table-container::-webkit-scrollbar          { height: 8px; }
.table-container::-webkit-scrollbar-track    { background: var(--navy-700); border-radius: 4px; margin: 0 4px; }
.table-container::-webkit-scrollbar-thumb    { background: var(--blue-400); border-radius: 4px; }
.table-container::-webkit-scrollbar-thumb:hover { background: var(--blue-300); }

/* Scroll hint */
.table-scroll-hint {
  font-size: 11px;
  color: var(--gray-500);
  padding: 6px 24px 4px;
  letter-spacing: .3px;
}

.account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.account-table thead tr {
  background: var(--navy-800);
  border-bottom: 2px solid var(--border-md);
}
/* Sticky Account column */
.account-table th.col-sticky,
.account-table td.col-sticky {
  position: sticky;
  left: 0;
  z-index: 3;
}
.account-table thead th.col-sticky { background: var(--navy-800); }
.account-table tbody td.col-sticky { background: var(--navy-950); }
.account-table tbody tr:hover td.col-sticky   { background: #0d1b2a; }
.account-table tbody tr.selected td.col-sticky { background: #0f1f38; }
/* Separator shadow on sticky col */
.account-table th.col-sticky::after,
.account-table td.col-sticky::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 6px;
  background: linear-gradient(to right, rgba(0,0,0,.25), transparent);
  pointer-events: none;
}

.account-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .6px;
  white-space: nowrap;
}
.account-table th:first-child { padding-left: 20px; }
.account-table th:last-child  { padding-right: 20px; }

.account-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.account-table tbody tr:hover { background: rgba(255,255,255,.03); }
.account-table tbody tr.selected { background: rgba(37,99,235,.12); border-left: 3px solid var(--blue-400); }
.account-table tbody tr.selected td:first-child { padding-left: 21px; }

.account-table td {
  padding: 11px 12px;
  vertical-align: middle;
}
.account-table td:first-child { padding-left: 20px; }
.account-table td:last-child  { padding-right: 20px; }

.acct-name {
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-sub {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: var(--green-badge);  color: var(--green-light); border: 1px solid rgba(16,185,129,.3); }
.badge-yellow { background: var(--yellow-badge); color: var(--yellow-light); border: 1px solid rgba(245,158,11,.3); }
.badge-red    { background: var(--red-badge);    color: var(--red-light); border: 1px solid rgba(239,68,68,.3); }
.badge-blue   { background: rgba(59,130,246,.12); color: var(--blue-300); border: 1px solid rgba(59,130,246,.25); }
.badge-gray   { background: rgba(148,163,184,.1); color: var(--gray-400); border: 1px solid rgba(148,163,184,.2); }

.col-account { min-width: 175px; }
.col-health  { min-width: 118px; }

.health-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}
.health-bar-track {
  flex: 1;
  height: 5px;
  background: var(--navy-700);
  border-radius: 3px;
  overflow: hidden;
}
.health-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}
.health-score-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  min-width: 26px;
  text-align: right;
}

.trend-up    { color: var(--green-light); font-size: 16px; }
.trend-down  { color: var(--red-light);   font-size: 16px; }
.trend-stable { color: var(--gray-400);   font-size: 16px; }

.risk-chip {
  display: inline-block;
  font-size: 11px;
  color: var(--gray-400);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-text {
  font-size: 11px;
  color: var(--blue-300);
  font-style: italic;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Risk Heatmap ───────────────────────────────────────────────── */
.heatmap-container {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}
.heatmap-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}
.heatmap-desc {
  font-size: 11px;
  color: var(--gray-500);
  margin-bottom: 16px;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: 80px repeat(3, 1fr);
  gap: 6px;
  font-size: 11px;
}
.heatmap-col-header {
  text-align: center;
  padding: 6px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.heatmap-row-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-size: 11px;
  font-weight: 600;
}
.heatmap-cell {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
}
.heatmap-cell.heat-critical {
  border-color: rgba(239,68,68,.3);
  background: rgba(127,29,29,.2);
}
.heatmap-cell.heat-warn {
  border-color: rgba(245,158,11,.2);
  background: rgba(120,53,15,.1);
}

.heatmap-account {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity .15s;
}
.heatmap-account:hover { opacity: .8; }
.heatmap-account.green  { background: var(--green-badge);  color: var(--green-light); }
.heatmap-account.yellow { background: var(--yellow-badge); color: var(--yellow-light); }
.heatmap-account.red    { background: var(--red-badge);    color: var(--red-light); }

/* ── Detail Panel ───────────────────────────────────────────────── */
.detail-panel {
  background: var(--navy-900);
  border-left: 1px solid var(--border-md);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  position: sticky;
  top: 64px;
  overflow-y: auto;
  animation: slideIn .25s ease;
}
.detail-panel.hidden { display: none; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.detail-header {
  padding: 20px 20px 16px;
  background: var(--navy-800);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.detail-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.detail-account-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}
.detail-industry {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 3px;
}
.detail-close {
  background: none;
  border: 1px solid var(--border-md);
  color: var(--gray-400);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.detail-close:hover { background: var(--navy-700); color: var(--white); }

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.detail-meta-item {
  background: var(--navy-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  color: var(--gray-300);
}
.detail-meta-item span { color: var(--gray-500); margin-right: 4px; }

.detail-actions {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--navy-800);
}

.detail-body { padding: 0; }

.detail-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.detail-section:last-child { border-bottom: none; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Score summary row */
.score-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 0;
}
.score-card {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: center;
}
.score-card-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.score-card-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.score-card-sub {
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 3px;
}
.score-card.active {
  border-color: var(--blue-400);
  background: rgba(37,99,235,.1);
}

/* Lifecycle context */
.lifecycle-card {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lifecycle-focus {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lifecycle-focus-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
.lifecycle-focus-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-400);
}
.lifecycle-interpretation {
  font-size: 12px;
  color: var(--gray-300);
  line-height: 1.6;
}
.lifecycle-watch {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.lifecycle-watch-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  white-space: nowrap;
}
.lifecycle-signal-chip {
  font-size: 10px;
  font-weight: 600;
  color: var(--blue-300);
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.2);
  border-radius: 10px;
  padding: 2px 8px;
}

/* Health score drivers */
.drivers-list { display: flex; flex-direction: column; gap: 8px; }
.driver-item {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
}
.driver-item.driver-positive { border-left-color: var(--green); }
.driver-item.driver-negative { border-left-color: var(--red); }
.driver-item.driver-neutral  { border-left-color: var(--gray-500); }
.driver-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.driver-factor {
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  flex: 1;
}
.driver-score {
  font-size: 13px;
  font-weight: 700;
  min-width: 24px;
  text-align: right;
}
.driver-impact-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.impact-positive { color: var(--green-light);  background: var(--green-badge);  }
.impact-negative { color: var(--red-light);    background: var(--red-badge);    }
.impact-neutral  { color: var(--gray-400);     background: rgba(148,163,184,.1); }
.driver-note { font-size: 11px; color: var(--gray-400); line-height: 1.4; }

/* Playbook chip — table column */
.playbook-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  max-width: 164px;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .2px;
}
.pb-high   { background: rgba(239,68,68,.12);  color: var(--red-light);    border: 1px solid rgba(239,68,68,.25); }
.pb-medium { background: rgba(245,158,11,.1);  color: var(--yellow-light); border: 1px solid rgba(245,158,11,.25); }
.pb-low    { background: rgba(59,130,246,.1);  color: var(--blue-300);     border: 1px solid rgba(59,130,246,.2); }

/* Rich playbook section — detail drawer */
.playbook-full {
  background: var(--navy-800);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 0;
}
.playbook-full-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.playbook-full-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}
.playbook-full-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pb-priority-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.pb-owner-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-400);
  background: var(--navy-700);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.playbook-why {
  font-size: 12px;
  color: var(--gray-300);
  line-height: 1.6;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.playbook-actions-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}
.playbook-actions-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.playbook-actions-list li {
  font-size: 12px;
  color: var(--gray-300);
  line-height: 1.5;
}

/* Playbook reason */
.playbook-reason {
  font-size: 11px;
  color: var(--blue-200);
  margin-top: 6px;
  line-height: 1.5;
  font-style: italic;
  opacity: .85;
}

/* Churn risk section */
.churn-risk-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.churn-risk-badge-block {
  flex-shrink: 0;
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.churn-risk-label-text {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.churn-risk-pill { font-size: 12px; padding: 4px 10px; }
.churn-renewal-context { font-size: 11px; font-weight: 600; }
.churn-alert-flag {
  font-size: 10px;
  color: var(--gray-500);
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--navy-700);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.churn-alert-flag.active {
  color: var(--yellow-light);
  background: var(--yellow-badge);
  border-color: rgba(245,158,11,.3);
}
.churn-drivers-list {
  flex: 1;
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.churn-drivers-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.churn-driver-item {
  font-size: 12px;
  color: var(--gray-300);
  padding: 4px 0;
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}
.churn-driver-item::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--gray-500);
}
.churn-tam-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--gray-500);
  font-style: italic;
  padding: 6px 10px;
  background: var(--navy-800);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Score bars */
.score-bar-item { margin-bottom: 10px; }
.score-bar-item:last-child { margin-bottom: 0; }
.score-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray-300);
  margin-bottom: 4px;
}
.score-bar-label-name { color: var(--gray-300); }
.score-bar-value { font-weight: 600; color: var(--white); }
.score-bar-track {
  height: 6px;
  background: var(--navy-700);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s ease;
}
.score-bar-weight {
  font-size: 10px;
  color: var(--gray-500);
}

/* Data confidence banner */
.confidence-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 20px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.5;
}
.confidence-banner.confidence-low {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.25);
  color: var(--red-light);
}
.confidence-banner.confidence-medium {
  background: rgba(245,158,11,.07);
  border: 1px solid rgba(245,158,11,.2);
  color: var(--gold-300);
}
.confidence-banner-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.confidence-banner-level { font-weight: 700; }
.confidence-banner-reason { opacity: .9; }
.confidence-human-note { font-weight: 600; display: block; margin-top: 3px; }

/* Sentiment risk tag */
.sentiment-risk-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  margin-top: 6px;
}
.tag-red    { background: var(--red-badge);    color: var(--red-light);    border: 1px solid rgba(239,68,68,.3); }
.tag-yellow { background: var(--yellow-badge); color: var(--yellow-light); border: 1px solid rgba(245,158,11,.3); }

/* Stale engagement note in churn risk section */
.stale-engagement-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(245,158,11,.07);
  border: 1px solid rgba(245,158,11,.2);
  border-left: 3px solid var(--yellow);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 12px;
  color: var(--gold-300);
  margin-top: 10px;
  line-height: 1.5;
}
.stale-note-icon { flex-shrink: 0; font-size: 13px; }

/* Sentiment block */
.sentiment-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.sentiment-score-block {
  flex-shrink: 0;
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
  min-width: 90px;
}
.sentiment-score {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
.sentiment-label {
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.sentiment-weight {
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 4px;
}
.sentiment-note {
  flex: 1;
  font-size: 12px;
  color: var(--gray-300);
  line-height: 1.6;
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-style: italic;
}

/* Alert overflow */
.alert-overflow {
  font-size: 12px;
  color: var(--gray-500);
  padding: 6px 14px;
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

/* Risk column in table */
.risk-main-text {
  font-size: 12px;
  color: var(--gray-300);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.risk-count-sub {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* Spotlight cards (Usage/Adoption + Support Trend) */
.spotlight-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.spotlight-card {
  background: var(--navy-800);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.spotlight-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.spotlight-metric { margin-bottom: 9px; }
.spotlight-metric:last-child { margin-bottom: 0; }
.spotlight-metric-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--gray-400);
  margin-bottom: 4px;
}
.spotlight-metric-val { font-weight: 700; color: var(--white); }
.spotlight-note { font-size: 10px; color: var(--gray-500); }
.spotlight-bar-track {
  height: 5px;
  background: var(--navy-700);
  border-radius: 3px;
  overflow: hidden;
}
.spotlight-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}

/* Signal cards (Relationship + Financial — 2 cards) */
.signal-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.signal-card {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.signal-card-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.signal-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.signal-stat:last-child { margin-bottom: 0; }
.signal-stat-name { font-size: 11px; color: var(--gray-400); }
.signal-stat-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
}

/* Trend notes */
.trend-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.trend-note-card {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.trend-note-period {
  font-size: 10px;
  font-weight: 700;
  color: var(--blue-300);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.trend-note-text { font-size: 11px; color: var(--gray-400); line-height: 1.4; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 14px;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--navy-700);
  border: 2px solid var(--blue-400);
  flex-shrink: 0;
  margin-top: 3px;
  position: relative;
  z-index: 1;
}
.timeline-content { flex: 1; }
.timeline-date {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 2px;
  font-family: var(--mono);
}
.timeline-note { font-size: 12px; color: var(--gray-300); line-height: 1.4; }

/* Risk list */
.risk-list { display: flex; flex-direction: column; gap: 6px; }
.risk-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--red-badge);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  color: var(--red-light);
}
.risk-item::before { content: '⚠'; font-size: 11px; flex-shrink: 0; }

/* Playbook box */
.playbook-box {
  background: rgba(37,99,235,.08);
  border: 1px solid rgba(37,99,235,.2);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}
.playbook-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--blue-300);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.playbook-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
}

.action-box {
  background: rgba(16,185,129,.06);
  border: 1px solid rgba(16,185,129,.2);
  border-radius: var(--radius);
  padding: 12px;
}
.action-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--green-light);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.action-text-box {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
}

/* Owner row */
.owner-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.owner-card {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.owner-label { font-size: 10px; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.owner-name { font-size: 13px; font-weight: 600; color: var(--white); margin-top: 3px; }

/* ARR display */
.arr-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.arr-card {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.arr-label { font-size: 10px; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.arr-value { font-size: 15px; font-weight: 700; color: var(--gold-400); margin-top: 3px; }
.renewal-value { font-size: 13px; font-weight: 600; color: var(--white); margin-top: 3px; }
.renewal-days {
  font-size: 11px;
  margin-top: 2px;
}

/* Empty state */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--gray-500);
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: .4; }
.empty-state-text { font-size: 14px; }

/* Utility */
.text-green  { color: var(--green-light); }
.text-yellow { color: var(--yellow-light); }
.text-red    { color: var(--red-light); }
.text-gold   { color: var(--gold-400); }
.text-muted  { color: var(--gray-500); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1400px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .content-area.panel-open {
    grid-template-columns: 1fr;
  }
  .detail-panel {
    position: fixed !important;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(440px, 100vw);
    height: 100vh !important;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
  }
}

@media (max-width: 768px) {
  #app-header { padding: 0 16px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); padding: 12px 16px; }
  .filter-bar { padding: 12px 16px; }
  .heatmap-container { padding: 16px; }
  .account-table td, .account-table th { padding: 10px 10px; }
  .account-table th:first-child,
  .account-table td:first-child { padding-left: 16px; }
  .logo-subtitle { display: none; }
  .header-right { display: none; }
  .role-btn { padding: 7px 14px; }
}

@media (max-width: 580px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .filters { gap: 8px; }
  .filter-group select { min-width: 120px; }
}
