* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Design tokens + typography scale (theme-independent) ──────────────── */
:root {
  /* Typography scale */
  --font-size-page:    1.4rem;
  --font-size-section: 1.05rem;
  --font-size-card:    0.925rem;
  --font-size-body:    0.875rem;
  --font-size-meta:    0.8rem;
  --font-size-micro:   0.7rem;

  --font-weight-heavy:    800;
  --font-weight-bold:     700;
  --font-weight-semibold: 600;
  --font-weight-medium:   500;
  --font-weight-regular:  400;

  --line-height-tight:  1.2;
  --line-height-snug:   1.4;
  --line-height-normal: 1.6;

  --tracking-tight:  -0.025em;
  --tracking-normal:  0em;
  --tracking-wide:    0.04em;
  --tracking-wider:   0.08em;

  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;

  /* Status colours (same in both themes) */
  --status-healthy: #10b981;
  --status-watch:   #f59e0b;
  --status-risk:    #ef4444;
  --status-info:    #6366f1;
}

:root[data-theme="dark"] {
  --bg:          #111827;
  --bg-elevated: #1c2128;
  --bg-card:     #161b22;
  --border:      #30363d;
  --text:        #e6edf3;
  --text-muted:  #484f58;
  --green:       #22d3a0;
  --green-bg:    #0a2e25;
  --yellow:      #f5a623;
  --yellow-bg:   #2a1f08;
  --red:         #f05c6e;
  --red-bg:      #2e0e14;
  --blue:        #60a5fa;
  --accent:      #7c6aff;
  --accent-2:    #06d6b0;
  --color-accent: #7c6aff;

  --text-primary:   var(--text);
  --text-secondary: #8b949e;
  --text-accent:    var(--accent);

  --card-border:   1px solid rgba(255,255,255,0.06);
  --card-hover-bg: rgba(255,255,255,0.04);
  --shadow-card:   0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --border-subtle:  1px solid rgba(255,255,255,0.08);
  --border-default: 1px solid rgba(255,255,255,0.08);
  --border-strong:  1px solid rgba(255,255,255,0.15);
}

:root[data-theme="light"] {
  --bg:          #f7f5ff;
  --bg-elevated: #f2eeff;
  --bg-card:     #ffffff;
  --border:      #eae5ff;
  --text:        #1a1040;
  --text-muted:  #9b90c0;
  --green:       #10b981;
  --green-bg:    #e8faf2;
  --yellow:      #d97706;
  --yellow-bg:   #fff8e6;
  --red:         #ef4444;
  --red-bg:      #fff0f0;
  --blue:        #0969da;
  --accent:      #1f883d;   /* MUST NOT CHANGE — green tab underlines */
  --color-accent: #7c6aff;

  --text-primary:   var(--text);
  --text-secondary: #9b90c0;
  --text-accent:    var(--color-accent);

  --card-border:   1px solid #eae5ff;
  --card-hover-bg: rgba(124,92,255,0.03);
  --shadow-card:   0 4px 16px rgba(124,92,255,0.07);
  --shadow-md:     0 4px 16px rgba(124,92,255,0.07);
  --border-subtle:  1px solid #f0ebff;
  --border-default: 1px solid #eae5ff;
  --border-strong:  1px solid #c4b8f0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem;
  max-width: 420px;
  width: 100%;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.input-group {
  margin-bottom: 1.25rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.input-group input,
.input-group select,
.input-group textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.input-group textarea {
  resize: vertical;
  min-height: 80px;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card);
}

.btn-icon {
  padding: 0.35rem 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.detail-tab-btn {
  padding: 0.6rem 1.1rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
  margin-bottom: -1px;
}
.detail-tab-btn:hover { color: var(--text); background: var(--bg-elevated); }
.detail-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.detail-tab-content { display: none; }
.detail-tab-content.active { display: block; }

.playbook-tab-btn {
  padding: 0.6rem 1.1rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
  margin-bottom: -1px;
}
.playbook-tab-btn:hover { color: var(--text); background: var(--bg-elevated); }
.playbook-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.playbook-tab-content { display: none; }
.playbook-tab-content.active { display: block; }
.playbook-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: all 0.2s;
}
.playbook-card:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(62,207,142,0.1); }
.playbook-milestone {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--bg-elevated);
  border-radius: 0 8px 8px 0;
}

.ai-chip {
  padding: 0.35rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.ai-chip:hover {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--blue);
  color: var(--blue);
}

.analytics-tab-btn {
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}
.analytics-tab-btn:hover {
  color: var(--text);
  background: var(--bg-elevated);
}
.analytics-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.analytics-tab-content { display: none; }
.analytics-tab-content.active { display: block; }

.link {
  text-decoration: none;
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.dashboard {
  display: none;
}

.dashboard.active {
  display: block;
}

.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h2 {
  font-size: 1.25rem;
  font-weight: 900;
}

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}
[data-theme="dark"] .sidebar {
  background: #161b22;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;

  min-height: 0;
}

.nav-section-label {
  padding: 0.6rem 1.25rem 0.2rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  opacity: 0.6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.nav-item.active {
  background: var(--bg-elevated);
  color: var(--accent);
  border-left-color: var(--accent);
}

.nav-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

/* Main content area with sidebar */
.main-content {
  margin-left: 240px;
  min-height: 100vh;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Alert Card */
.alert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.alert-actions {
  display: flex;
  gap: 0.5rem;
}

/* Task Card */
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.task-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Bulk select checkbox — hidden until hover or task is selected */
.bulk-select-wrapper {
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.task-card:hover .bulk-select-wrapper,
.task-card.task-selected .bulk-select-wrapper {
  opacity: 1;
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-top: 2px;
}

.task-content {
  flex: 1;
}

.task-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.task-account {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.task-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.task-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.task-group {
  margin-bottom: 2rem;
}

.task-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.task-group-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-group-count {
  background: var(--bg-elevated);
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
}

.task-group-content {
  display: block;
}

.task-group-content.collapsed {
  display: none;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Badge styles */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: var(--card-border, 1px solid var(--border));
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 150ms ease, color 150ms ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--card-hover-bg, var(--bg-elevated));
  color: var(--text-primary, var(--text));
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: var(--accent);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.2;
  letter-spacing: -0.02em;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Smaller font for very large numbers */
.stat-value:has(span) {
  font-size: 2rem;
}

.stat-value.green { color: var(--green); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.red { color: var(--red); }
.stat-value.blue { color: var(--blue); }

/* ── Typography utility classes ───────────────────────────────────────── */
.page-title {
  font-size: var(--font-size-page);
  font-weight: var(--font-weight-heavy);
  line-height: var(--line-height-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  margin: 0;
}

.section-title {
  font-size: var(--font-size-section);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
  color: var(--text-primary);
}

.card-title {
  font-size: var(--font-size-card);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
  color: var(--text-primary);
}

.body-text {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
}

.meta-text {
  font-size: var(--font-size-meta);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-snug);
  color: var(--text-secondary);
}

.micro-text {
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  letter-spacing: var(--tracking-wide);
  color: var(--text-secondary);
}

.section-label {
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-secondary);
}

.insight-text {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--text-secondary);
}

.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.chart-container {
  background: var(--bg-elevated);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.filter-item label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-item select,
.filter-item input {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.875rem;
}

.search-bar {
  margin-top: 1rem;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

.import-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 1rem;
}

.import-area:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-elevated);
}

th {
  padding: 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  position: relative;
}

th:hover {
  background: var(--bg-card);
}

th.sortable::after {
  content: ' ⇅';
  opacity: 0.3;
}

th.sorted-asc::after {
  content: ' ▲';
  opacity: 1;
}

th.sorted-desc::after {
  content: ' ▼';
  opacity: 1;
}

td {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

tbody tr {
  transition: background-color 0.2s;
  cursor: pointer;
}

tbody tr:hover {
  background: var(--bg-elevated);
}

.health-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.health-badge.healthy {
  background: var(--green-bg);
  color: var(--green);
}

.health-badge.watch {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.health-badge.at-risk {
  background: var(--red-bg);
  color: var(--red);
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.tier-badge.tier-1 {
  background: #a855f7;
  color: white;
  border-color: #a855f7;
}

.tier-badge.tier-2 {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pagination-info {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
}

.pagination-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg-card);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  padding: 2rem;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Standalone .modal — full-screen overlay wrapper */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-sizing: border-box;
}
.modal.active { display: flex; }

/* Inner content card inside .modal or .modal-overlay */
.modal-overlay.active > .modal,
.modal-overlay.active > div {
  display: flex !important;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  max-height: 88vh;
  width: 100%;
}

/* Legacy modal-content class */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Header — fixed at top, never scrolls */
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  flex-shrink: 0;
  z-index: 10;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  background: var(--bg-card);
  flex-shrink: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.account-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border-color: var(--accent);
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 2000;
  max-width: 400px;
}

.toast.active {
  display: block;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }

@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }
  .main-content {
    margin-left: 200px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .filters-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .container {
    padding: 1rem;
  }
  .pagination {
    flex-direction: column;
    gap: 1rem;
  }
}

/* ── LOGIN SCREEN PREMIUM TREATMENT ── */
.login-container {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,106,255,0.10) 0%, transparent 70%),
              var(--bg) !important;
}
[data-theme="light"] .login-container {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(91,71,255,0.05) 0%, transparent 70%),
              var(--bg) !important;
}
.login-box {
  border-radius: 16px !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(124,106,255,0.15) !important;
  padding: 2.5rem !important;
}
[data-theme="light"] .login-box {
  box-shadow: 0 8px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(91,71,255,0.1) !important;
}
.login-logo h1 {
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
}
/* Login input labels — uppercase tracking */
#loginScreen .input-group label,
#signupScreen .input-group label {
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── TOP BAR THEME CONSISTENCY ── */
[data-theme="dark"] #appTopBar {
  background: rgba(13,17,23,0.97) !important;
  backdrop-filter: blur(8px);
  border-bottom-color: rgba(255,255,255,0.06) !important;
}
[data-theme="light"] #appTopBar {
  background: rgba(255,255,255,0.96) !important;
  backdrop-filter: blur(8px);
}

/* ── DASHBOARD GREETING AREA POLISH ── */
#tab-dashboard .container > div:first-child {
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem !important;
}
#dashboardGreeting {
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
}

/* ── SIDEBAR USER BOTTOM AREA ── */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
}


/* ── LOGIN SCREEN PREMIUM TREATMENT ── */
.login-container {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,106,255,0.10) 0%, transparent 70%),
              var(--bg) !important;
}
[data-theme="light"] .login-container {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(91,71,255,0.05) 0%, transparent 70%),
              var(--bg) !important;
}
.login-box {
  border-radius: 16px !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(124,106,255,0.15) !important;
  padding: 2.5rem !important;
}
[data-theme="light"] .login-box {
  box-shadow: 0 8px 40px rgba(0,0,0,0.12), 0 0 0 1px rgba(91,71,255,0.1) !important;
}
.login-logo h1 {
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
}
/* Login input labels — uppercase tracking */
#loginScreen .input-group label,
#signupScreen .input-group label {
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── TOP BAR THEME CONSISTENCY ── */
[data-theme="dark"] #appTopBar {
  background: rgba(13,17,23,0.97) !important;
  backdrop-filter: blur(8px);
  border-bottom-color: rgba(255,255,255,0.06) !important;
}
[data-theme="light"] #appTopBar {
  background: rgba(255,255,255,0.96) !important;
  backdrop-filter: blur(8px);
}

/* ── DASHBOARD GREETING AREA POLISH ── */
#tab-dashboard .container > div:first-child {
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem !important;
}
#dashboardGreeting {
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
}

/* ── SIDEBAR USER BOTTOM AREA ── */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
}

/* ── ACCOUNTS LIST UPGRADE — Portfolio Insights Bar ── */
.portfolio-insights-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.pi-chip {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  min-width: 110px;
}
.pi-chip--risk  { border-color: rgba(231,76,60,0.35);  background: rgba(231,76,60,0.07); }
.pi-chip--warn  { border-color: rgba(240,173,78,0.35); background: rgba(240,173,78,0.07); }
.pi-chip--green { border-color: rgba(62,207,142,0.35); background: rgba(62,207,142,0.07); }
.pi-chip--alert { border-color: rgba(240,173,78,0.35); background: rgba(240,173,78,0.07); }
.pi-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pi-value {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ── Portfolio Attention Queue ── */
.attention-queue {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
}
.aq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--bg-elevated);
  cursor: pointer;
  user-select: none;
}
.aq-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--yellow);
}
.aq-toggle {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.aq-body {
  padding: 0.25rem 0;
}
.aq-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.aq-row:last-child { border-bottom: none; }
.aq-row:hover { background: var(--bg-elevated); }
.aq-name {
  font-weight: 600;
  font-size: 0.82rem;
  min-width: 140px;
  color: var(--text);
}
.aq-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex: 1;
}
.aq-alert {
  font-size: 0.67rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
}
.aq-alert--red    { background: rgba(231,76,60,0.15);  color: var(--red);    border: 1px solid rgba(231,76,60,0.35); }
.aq-alert--yellow { background: rgba(240,173,78,0.15); color: var(--yellow); border: 1px solid rgba(240,173,78,0.35); }
.aq-alert--orange { background: rgba(240,150,50,0.15); color: var(--yellow); border: 1px solid rgba(240,150,50,0.35); }
.aq-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
}

/* ── Quick Filter Pills ── */
.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.qf-pill {
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.qf-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.qf-pill--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* ── Table chip cells (Score, Coverage, Risks) ── */
.col-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.col-chip--risk { cursor: help; }

/* ── Task badge (open tasks count) ── */
.task-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 20px;
  background: var(--blue);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Overflow action menu ── */
.acct-overflow-wrap {
  display: inline-block;
  position: relative;
  vertical-align: middle;
}
.btn-overflow {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1;
  transition: background 0.15s;
  margin-left: 4px;
}
.btn-overflow:hover { background: var(--bg-elevated); color: var(--text); }
.overflow-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 100;
  min-width: 160px;
  overflow: hidden;
}
.overflow-menu--open { display: block; }
.overflow-menu div {
  padding: 0.55rem 0.9rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.12s;
}
.overflow-menu div:hover { background: var(--bg-elevated); }

/* ── Small button variant ── */
.btn-sm {
  padding: 0.25rem 0.65rem !important;
  font-size: 0.75rem !important;
  height: auto !important;
}

/* ── CS Card components ──────────────────────────────────────────────── */
.cs-card {
  background: var(--bg-card);
  border: var(--card-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-fast);
}
.cs-card:hover { box-shadow: var(--shadow-md); }
.cs-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}
.cs-card-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }
.cs-card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: var(--space-1); }
.cs-card-action {
  font-size: 12px; color: var(--color-accent);
  text-decoration: none; white-space: nowrap;
  opacity: 0.85; transition: opacity var(--transition-fast);
}
.cs-card-action:hover { opacity: 1; text-decoration: underline; }
.cs-kpi-card {
  background: var(--bg-card);
  border: var(--card-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
}
.cs-kpi-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: var(--space-2);
}
.cs-kpi-value {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1;
  color: var(--text);
}
.cs-kpi-sublabel { font-size: 12px; color: var(--text-muted); margin-top: var(--space-2); }

/* ── Button system ───────────────────────────────────────────────────── */
/* Reset base .btn to use tokens */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
}
.btn-primary {
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent, #7c6aff) !important;
  color: #ffffff !important;
  border: none;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); opacity: 1; }
.btn-secondary {
  padding: var(--space-2) var(--space-4);
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--card-hover-bg) !important; border-color: var(--border) !important; color: var(--text) !important; }
.btn-danger {
  padding: var(--space-2) var(--space-4);
  background: transparent;
  color: var(--status-risk);
  border: 1px solid var(--status-risk);
}
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-ghost {
  padding: var(--space-1) var(--space-3);
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { color: var(--text); background: var(--card-hover-bg); }
.btn-sm { padding: var(--space-1) var(--space-3) !important; font-size: 12px !important; }

/* ── Badge system ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-healthy { background: rgba(16,185,129,0.12); color: #10b981; }
.badge-watch   { background: rgba(245,158,11,0.12);  color: #f59e0b; }
.badge-risk    { background: rgba(239,68,68,0.12);   color: #ef4444; }
.badge-info    { background: rgba(99,102,241,0.12);  color: #6366f1; }
.badge-neutral { background: var(--card-hover-bg);   color: var(--text-muted); }
.badge-critical{ background: rgba(239,68,68,0.15);   color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
.badge-warning { background: rgba(245,158,11,0.15);  color: #f59e0b; border: 1px solid rgba(245,158,11,0.2); }
.badge-success { background: rgba(16,185,129,0.15);  color: #10b981; border: 1px solid rgba(16,185,129,0.2); }

/* ── Spacing tokens applied to layout ───────────────────────────────── */
.container { padding: var(--space-6); }
.tab-content .section { margin-bottom: var(--space-5); }

/* ── Colour discipline: hardcoded overrides ──────────────────────────── */
/* The old .btn-primary used var(--accent) which is green in light mode;
   our new btn-primary rule already overrides this with !important purple.
   Ensure inline gradient AI-report buttons always show dark text (legible
   on both purple-gradient dark and light backgrounds). */

/* ── KPI grid (both themes) ───────────────────────────────────────────── */
.kpi-grid,
#dashKPIs,
.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

/* ── KPI / stat card unified box model (both themes) ─────────────────── */
.stat-card,
.cs-kpi-card {
  padding: 16px;
  min-height: 110px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
/* Dashboard KPI cards are .section inside #dashKPIs — same sizing */
#dashKPIs > .section {
  min-height: 110px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ══════════════════════════════════════════════════════
   LIGHT MODE COLOUR OVERHAUL
   ══════════════════════════════════════════════════════ */

/* ── Body and base text ── */
[data-theme="light"] body,
[data-theme="light"] .app-content {
  color: #111827;
}

/* ── Headings ── */
[data-theme="light"] .page-title,
[data-theme="light"] h1,
[data-theme="light"] h2 {
  color: #111827 !important;
  font-weight: 800;
}
[data-theme="light"] .card-title,
[data-theme="light"] h3,
[data-theme="light"] .section-title {
  color: #111827 !important;
  font-weight: 700;
}

/* ── KPI label and sub text ── */
[data-theme="light"] .stat-label,
[data-theme="light"] .kpi-label,
[data-theme="light"] .stat-card .label,
[data-theme="light"] .cs-kpi-label {
  color: #6b7280 !important;
}
[data-theme="light"] .stat-sublabel,
[data-theme="light"] .kpi-sublabel,
[data-theme="light"] .stat-card .sublabel,
[data-theme="light"] .cs-kpi-sublabel {
  color: #6b7280 !important;
}

/* ── General text elements ── */
[data-theme="light"] p,
[data-theme="light"] span,
[data-theme="light"] td,
[data-theme="light"] li {
  color: #374151;
}

/* ── Cards: white bg, exact border/shadow/radius ── */
[data-theme="light"] .cs-card,
[data-theme="light"] .stat-card,
[data-theme="light"] .cs-kpi-card,
[data-theme="light"] .section,
[data-theme="light"] .account-card,
[data-theme="light"] .task-card,
[data-theme="light"] .alert-card,
[data-theme="light"] .playbook-card {
  background: #ffffff;
  border: 1px solid #e9ecf3;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
[data-theme="light"] .cs-card:hover,
[data-theme="light"] .stat-card:hover,
[data-theme="light"] .section:hover,
[data-theme="light"] .account-card:hover,
[data-theme="light"] .task-card:hover,
[data-theme="light"] .alert-card:hover,
[data-theme="light"] .playbook-card:hover {
  border-color: #d4d8e8;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

/* ── KPI / stat card top stripe (default purple, position:absolute = no layout impact) ── */
[data-theme="light"] .stat-card,
[data-theme="light"] .cs-kpi-card {
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .stat-card::before,
[data-theme="light"] .cs-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 10px 10px 0 0;
  background: #7c6aff;
}

/* ── Dashboard KPI cards (rendered inside #dashKPIs as .section) ── */
[data-theme="light"] #dashKPIs > .section {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}
[data-theme="light"] #dashKPIs > .section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 10px 10px 0 0;
  background: #7c6aff;
}
/* At-Risk ARR (card 2) — red stripe */
[data-theme="light"] #dashKPIs > .section:nth-child(2)::before { background: #ef4444; }
/* Overdue Tasks (card 3) — red stripe */
[data-theme="light"] #dashKPIs > .section:nth-child(3)::before { background: #ef4444; }
/* Renewals in 90d (card 4) — amber stripe */
[data-theme="light"] #dashKPIs > .section:nth-child(4)::before { background: #f59e0b; }
/* NRR (card 6) — green stripe */
[data-theme="light"] #dashKPIs > .section:nth-child(6)::before { background: #10b981; }

/* KPI value color overrides (color only — font-size matches dark mode inline 2.3rem) */
[data-theme="light"] #dashKPIs > .section:nth-child(1) > div:nth-child(2) { color: #7c6aff !important; }
[data-theme="light"] #dashKPIs > .section:nth-child(5) > div:nth-child(2) { color: #7c6aff !important; }

/* KPI label and sub text typography */
[data-theme="light"] #dashKPIs .section-label {
  color: #6b7280 !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
}
[data-theme="light"] #dashKPIs .meta-text {
  color: #6b7280 !important;
  font-size: 10px !important;
  font-weight: 400 !important;
}

/* ── Sidebar ── */
[data-theme="light"] .sidebar {
  background: #ffffff !important;
  border-right: 1px solid #e9ecf3 !important;
  box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}
[data-theme="light"] .sidebar-logo {
  color: #111827;
  font-size: 13px !important;
  font-weight: 800 !important;
}
[data-theme="light"] .sidebar-footer {
  color: #6b7280;
  border-top-color: #e9ecf3;
}

/* ── Table ── */
[data-theme="light"] thead {
  background: #f0f2f8;
}
[data-theme="light"] th {
  color: #374151 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
}
[data-theme="light"] tbody tr { color: #111827; }
[data-theme="light"] tbody tr:hover { background: #f5f7fc; }
[data-theme="light"] td { border-top-color: #f0f2f8; color: #374151; }

/* ── Badges ── */
[data-theme="light"] .badge-healthy { background: #e8faf2; color: #059669; }
[data-theme="light"] .badge-watch   { background: #fff8e6; color: #d97706; }
[data-theme="light"] .badge-risk    { background: #fff0f0; color: #dc2626; }
[data-theme="light"] .badge-info    { background: #ede9ff; color: #5038d0; }
[data-theme="light"] .badge-neutral { background: #ede9ff; color: #5038d0; }
[data-theme="light"] .health-badge.healthy { background: #e8faf2; color: #059669; }
[data-theme="light"] .health-badge.watch   { background: #fff8e6; color: #d97706; }
[data-theme="light"] .health-badge.at-risk { background: #fff0f0; color: #dc2626; }

/* ── Inputs and selects ── */
[data-theme="light"] .input-group input,
[data-theme="light"] .input-group select,
[data-theme="light"] .input-group textarea,
[data-theme="light"] .filter-item select,
[data-theme="light"] .filter-item input {
  background: #ffffff;
  border-color: #e9ecf3;
  color: #111827;
}
[data-theme="light"] .input-group input:focus,
[data-theme="light"] .input-group select:focus,
[data-theme="light"] .input-group textarea:focus {
  border-color: #7c6aff;
  box-shadow: 0 0 0 3px rgba(124,106,255,0.12) !important;
}

/* ── Search / filter bars ── */
[data-theme="light"] .search-bar input,
[data-theme="light"] .filter-bar input,
[data-theme="light"] .filter-bar select {
  background: #ffffff;
  border-color: #e9ecf3;
  color: #111827;
}
[data-theme="light"] .search-bar input:focus,
[data-theme="light"] .filter-bar input:focus,
[data-theme="light"] .filter-bar select:focus {
  border-color: #7c6aff !important;
  box-shadow: 0 0 0 3px rgba(124,106,255,0.12) !important;
}

/* ── Buttons ── */
[data-theme="light"] .btn-primary {
  background: #7c6aff !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}
[data-theme="light"] .btn-secondary {
  background: #ffffff !important;
  border: 1px solid #e2e0f0 !important;
  color: #374151 !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}
[data-theme="light"] .btn-secondary:hover {
  background: #f3f0ff !important;
  border-color: #c4bef0 !important;
  color: #5038d0 !important;
}

/* ── "View all" action links inside cards ── */
[data-theme="light"] .section button[style*="color:var(--accent)"],
[data-theme="light"] .section-header button[style*="color:var(--accent)"],
[data-theme="light"] .section a[style*="color:var(--accent)"] {
  color: #7c6aff !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

/* ── Nav ── */
[data-theme="light"] .nav-item {
  color: #374151 !important;
  font-weight: 500;
}
[data-theme="light"] .nav-item.active {
  color: #5038d0 !important;
  font-weight: 700 !important;
}

/* ── Top bar (light) ── */
[data-theme="light"] #appTopBar {
  background: rgba(255,255,255,0.97) !important;
  border-bottom: 1px solid #e9ecf3 !important;
}

/* ══════════════════════════════════════════════════════
   DARK MODE OVERHAUL — navy/slate, purple as accent only
   ══════════════════════════════════════════════════════ */

/* ── Step 5: Sidebar (flat colour, no gradient) ── */
[data-theme="dark"] .sidebar {
  background: #161b22 !important;
  border-right: 1px solid rgba(255,255,255,0.06) !important;
  box-shadow: none;
}

/* ── Step 6: Nav ── */
[data-theme="dark"] .nav-item {
  color: #8b949e;
  font-weight: 500;
}
[data-theme="dark"] .nav-item i { color: #484f58; }
[data-theme="dark"] .nav-item:hover {
  background: rgba(255,255,255,0.04) !important;
  color: #e6edf3 !important;
}
[data-theme="dark"] .nav-item.active {
  background: #2d1f7a !important;
  color: #ffffff !important;
  border-left: 3px solid #7c6aff !important;
  font-weight: 700 !important;
  padding-left: 5px !important;
}
[data-theme="dark"] .nav-item.active i { color: #ffffff !important; }
[data-theme="dark"] .nav-section-label,
[data-theme="dark"] .sidebar-section,
[data-theme="dark"] .nav-group-label {
  color: #484f58 !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase;
}

/* ── Step 7: KPI / stat cards ── */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .cs-kpi-card {
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
[data-theme="dark"] .stat-card::before,
[data-theme="dark"] .cs-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 10px 10px 0 0;
  background: #7c6aff;
}
[data-theme="dark"] .stat-label,
[data-theme="dark"] .cs-kpi-label,
[data-theme="dark"] .kpi-label {
  color: #484f58 !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase;
}
[data-theme="dark"] .stat-sublabel,
[data-theme="dark"] .cs-kpi-sublabel { color: #484f58 !important; }

/* Dashboard KPI cards (dynamically rendered as .section in #dashKPIs) */
[data-theme="dark"] #dashKPIs > .section {
  position: relative;
  overflow: hidden;
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border-radius: 10px;
}
[data-theme="dark"] #dashKPIs > .section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 10px 10px 0 0;
  background: #7c6aff;
}
/* Per-card stripe overrides */
[data-theme="dark"] #dashKPIs > .section:nth-child(2)::before { background: #ef4444; }
[data-theme="dark"] #dashKPIs > .section:nth-child(3)::before { background: #ef4444; }
[data-theme="dark"] #dashKPIs > .section:nth-child(4)::before { background: #f59e0b; }
[data-theme="dark"] #dashKPIs > .section:nth-child(6)::before { background: #10b981; }
/* Per-card value colour overrides */
[data-theme="dark"] #dashKPIs > .section:nth-child(1) > div:nth-child(2) { color: #a78bff !important; }
[data-theme="dark"] #dashKPIs > .section:nth-child(2) > div:nth-child(2) { color: #f87171 !important; }
[data-theme="dark"] #dashKPIs > .section:nth-child(3) > div:nth-child(2) { color: #f87171 !important; }
[data-theme="dark"] #dashKPIs > .section:nth-child(4) > div:nth-child(2) { color: #fbbf24 !important; }
[data-theme="dark"] #dashKPIs > .section:nth-child(5) > div:nth-child(2) { color: #a78bff !important; }
[data-theme="dark"] #dashKPIs > .section:nth-child(6) > div:nth-child(2) { color: #34d399 !important; }
/* KPI label and sub text */
[data-theme="dark"] #dashKPIs .section-label { color: #484f58 !important; }
[data-theme="dark"] #dashKPIs .meta-text     { color: #484f58 !important; }

/* ── Step 8: General cards ── */
[data-theme="dark"] .cs-card,
[data-theme="dark"] .section,
[data-theme="dark"] .account-card,
[data-theme="dark"] .task-card,
[data-theme="dark"] .alert-card,
[data-theme="dark"] .modal-content {
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
[data-theme="dark"] .cs-card:hover,
[data-theme="dark"] .stat-card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
[data-theme="dark"] .cs-card-title,
[data-theme="dark"] .card-title,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 { color: #e6edf3; }
[data-theme="dark"] .cs-card-action,
[data-theme="dark"] .view-all,
[data-theme="dark"] a { color: #7c6aff; }
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] td,
[data-theme="dark"] li { color: #8b949e; }

/* ── Step 9: Badges ── */
[data-theme="dark"] .badge-healthy  { background: rgba(16,185,129,0.15);  color: #34d399; }
[data-theme="dark"] .badge-watch    { background: rgba(245,158,11,0.15);  color: #fbbf24; }
[data-theme="dark"] .badge-risk     { background: rgba(239,68,68,0.15);   color: #f87171; }
[data-theme="dark"] .badge-info     { background: rgba(124,106,255,0.15); color: #a78bff; }
[data-theme="dark"] .badge-neutral  { background: rgba(255,255,255,0.06); color: #8b949e; }
[data-theme="dark"] .badge-critical { background: rgba(239,68,68,0.2);    color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
[data-theme="dark"] .badge-warning  { background: rgba(245,158,11,0.2);   color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
[data-theme="dark"] .badge-success  { background: rgba(16,185,129,0.2);   color: #34d399; border: 1px solid rgba(16,185,129,0.3); }

/* ── Step 10: Table ── */
[data-theme="dark"] table th {
  background: #1c2128;
  color: #8b949e !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase;
}
[data-theme="dark"] table td {
  color: #e6edf3;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
[data-theme="dark"] table tr:hover td { background: rgba(255,255,255,0.03); }

/* ── Step 11: Inputs ── */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1c2128;
  border: 1px solid rgba(255,255,255,0.08);
  color: #e6edf3;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #484f58; }
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: #7c6aff;
  box-shadow: 0 0 0 3px rgba(124,106,255,0.2);
  outline: none;
}

/* ── Step 12: Buttons ── */
[data-theme="dark"] .btn-secondary {
  background: #1c2128;
  border: 1px solid rgba(255,255,255,0.1);
  color: #8b949e;
}
[data-theme="dark"] .btn-secondary:hover {
  background: #2d333b;
  border-color: rgba(255,255,255,0.08);
  color: #e6edf3;
}
[data-theme="dark"] .btn-danger { color: #f87171; border-color: rgba(248,113,113,0.4); }
[data-theme="dark"] .btn-danger:hover { background: rgba(248,113,113,0.1); }

/* ══════════════════════════════════════════════════════
   DASHBOARD REDESIGN — utility classes
   ══════════════════════════════════════════════════════ */

/* KPI strip — always 6 equal columns */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

/* KPI card */
.dash-kpi-card {
  position: relative;
  overflow: hidden;
  border-radius: 9px;
  padding: 12px 12px 10px;
  min-height: 100px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
[data-theme="light"] .dash-kpi-card {
  background: #ffffff;
  border: 1px solid #e9ecf3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
[data-theme="dark"] .dash-kpi-card {
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.dash-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 9px 9px 0 0;
  background: var(--kpi-stripe, #7c6aff);
}
.dash-kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #8b85a8;
}
[data-theme="dark"] .dash-kpi-label { color: #484f58; }
.dash-kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.dash-kpi-trend {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 5px;
}

/* 3-column widget row */
.dash-widget-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
}

/* Widget cards */
.dash-widget {
  border-radius: 10px;
  padding: 16px;
  box-sizing: border-box;
  min-height: 0;
  overflow: hidden;
}
[data-theme="light"] .dash-widget {
  background: #ffffff;
  border: 1px solid #eae5ff;
  box-shadow: 0 4px 16px rgba(124,92,255,0.06);
}
[data-theme="dark"] .dash-widget {
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.dash-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.dash-widget-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1040;
}
[data-theme="dark"] .dash-widget-title { color: #e6edf3; }
.dash-widget-link {
  font-size: 12px;
  font-weight: 600;
  color: #7c6aff;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 0;
}

/* Portfolio Summary widget internals */
.port-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.port-summary-cell {
  background: #f7f5ff;
  border: 1px solid #e9ecf3;
  border-radius: 7px;
  padding: 8px 10px;
}
[data-theme="dark"] .port-summary-cell {
  background: #1c2128;
  border-color: rgba(255,255,255,0.06);
}
.port-summary-val {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.port-summary-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b85a8;
  margin-top: 3px;
}
[data-theme="dark"] .port-summary-label { color: #484f58; }
.port-health-legend {
  display: flex;
  gap: 10px;
  font-size: 11px;
  font-weight: 500;
  color: #4b4570;
  flex-wrap: wrap;
}
[data-theme="dark"] .port-health-legend { color: #8b949e; }

/* ── Dashboard greeting ── */
#tab-dashboard #dashboardGreeting { font-size: 24px !important; font-weight: 800 !important; }
#tab-dashboard #dashboardDate     { font-size: 13px !important; color: #8b85a8 !important; }

/* ── Needs Attention item overrides (inline-style elements) ── */
#dashUrgent > div { padding: 9px 0 !important; }
#dashUrgent > div > div > div:first-child {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
}
#dashUrgent > div > div > div:last-child {
  font-size: 11px !important;
  margin-top: 2px !important;
  color: var(--text-muted) !important;
}
#dashUrgent > div > span {
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 3px 9px !important;
}

/* ── Upcoming Renewals item overrides (inline-style elements) ── */
#dashRenewals > div { padding: 9px 0 !important; }
#dashRenewals > div > div:first-child > div:first-child {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
}
#dashRenewals > div > div:first-child > div:last-child {
  font-size: 11px !important;
  color: var(--text-muted) !important;
}
#dashRenewals > div > div:last-child > div {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #7c6aff !important;
}
#dashRenewals > div > div:last-child > span {
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 3px 8px !important;
}

/* ── Portfolio health bar height ── */
#dashPortfolio > div:nth-child(2) { height: 8px !important; }

/* ══════════════════════════════════════════════════════
   HERO CARDS — 3-card executive summary grid
   ══════════════════════════════════════════════════════ */

.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1.75fr 1.25fr;
  gap: 10px;
  align-items: stretch;
}

.hero-card {
  background: #ffffff;
  border: 1px solid #eae5ff;
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(124,92,255,0.07);
  display: flex;
  flex-direction: column;
}
[data-theme="dark"] .hero-card {
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: 12px 12px 0 0;
  background: var(--hero-stripe, #7c6aff);
}

.hero-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c4b8f0;
}
[data-theme="dark"] .hero-card-label { color: #484f58; }

.hero-card-value {
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  margin: 8px 0 4px;
}

.hero-card-sub {
  font-size: 12px;
  font-weight: 500;
}

.hero-card-trend {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 14px;
}

.hero-card-divider {
  border: none;
  border-top: 1px solid #f0ebff;
  margin: 12px 0;
}
[data-theme="dark"] .hero-card-divider { border-top-color: rgba(255,255,255,0.06); }

.hero-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}
.hero-metric-label {
  font-size: 11px;
  color: #9b90c0;
  font-weight: 500;
}
.hero-metric-value {
  font-size: 12px;
  font-weight: 700;
  color: #1a1040;
}
[data-theme="dark"] .hero-metric-value { color: #e6edf3; }

/* At-risk account rows inside hero card 2 */
.hero-risk-row {
  background: #fff8f8;
  border: 1px solid rgba(239,68,68,0.12);
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
[data-theme="dark"] .hero-risk-row {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.15);
}

/* Health distribution bar track (widget 2) */
.health-bar-track {
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  background: #e9ecf3;
}
[data-theme="dark"] .health-bar-track { background: rgba(255,255,255,0.06); }

/* ── SPLIT CREATE BUTTON ── */
.create-split-btn {
  position: relative;
  display: inline-flex;
}
.create-main {
  background: linear-gradient(135deg, #7c5cff, #9b87ff);
  border: none;
  color: #ffffff;
  padding: 9px 16px;
  border-radius: 8px 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(124,92,255,0.3);
}
.create-main:hover { opacity: 0.9; }
.create-dropdown {
  background: linear-gradient(135deg, #7c5cff, #9b87ff);
  border: none;
  border-left: 1px solid rgba(255,255,255,0.3);
  color: #ffffff;
  padding: 9px 10px;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(124,92,255,0.3);
}
.create-dropdown:hover { opacity: 0.9; }
.create-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid #eae5ff;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(124,92,255,0.15);
  z-index: 1000;
  min-width: 160px;
}
[data-theme="dark"] .create-menu {
  background: #1c2128;
  border-color: rgba(255,255,255,0.08);
}
.create-menu-item {
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #1a1040;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
[data-theme="dark"] .create-menu-item { color: #e6edf3; }
.create-menu-item:hover { background: #f2eeff; color: #5038d0; }
[data-theme="dark"] .create-menu-item:hover { background: rgba(124,92,255,0.1); color: #a78bff; }

/* ── LIGHT MODE — inline-style colour freeze fix ─────────────────────────────
   renderHeroCards() and renderHealthDistWidget() bake nameColor (#e6edf3 dark /
   #1a1040 light) into inline styles at render time. When the user switches theme
   those inline styles don't re-evaluate, so dark-mode text (#e6edf3 ≈ white)
   becomes invisible on the light background. We override any element inside the
   hero grid or health-dist widget that still carries the dark-mode colour.
   ── */

/* Override baked-in dark text colour inside hero cards */
[data-theme="light"] .hero-card [style*="color:#e6edf3"] {
  color: #1a1040 !important;
}

/* Override baked-in dark text colour inside health distribution widget */
[data-theme="light"] #dashHealthDist [style*="color:#e6edf3"] {
  color: #1a1040 !important;
}

/* Override baked-in dark text colour in needs-attention widget */
[data-theme="light"] #dashUrgent [style*="color:#e6edf3"] {
  color: #1a1040 !important;
}

/* Extra safety: at-risk row account name (first span child) */
[data-theme="light"] .hero-risk-row > span:first-child {
  color: #1a1040 !important;
}

/* Broad default — elements without an inline colour inherit correctly */
[data-theme="light"] .hero-card {
  color: #1a1040;
}
[data-theme="light"] .dash-widget {
  color: #1a1040;
}

/* ── Dark mode: keep all card dividers subtle ── */
[data-theme="dark"] .hero-card hr,
[data-theme="dark"] .dash-widget hr,
[data-theme="dark"] .cs-card hr,
[data-theme="dark"] .divider {
  border-color: rgba(255,255,255,0.06) !important;
  border-top-color: rgba(255,255,255,0.06) !important;
}

/* ── Health Distribution — Portfolio Score + Trend blocks ── */
.health-score-block,
.health-trend-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.health-score-label,
.health-trend-label {
  font-size: 11px;
  font-weight: 500;
  color: #9b90c0;
}
[data-theme="dark"] .health-score-label,
[data-theme="dark"] .health-trend-label {
  color: #484f58;
}
.health-score-value {
  font-size: 22px;
  font-weight: 800;
  color: #1a1040;
  letter-spacing: -0.5px;
  line-height: 1;
}
[data-theme="dark"] .health-score-value { color: #e6edf3; }
.health-score-max {
  font-size: 13px;
  font-weight: 500;
  color: #9b90c0;
}
[data-theme="dark"] .health-score-max { color: #484f58; }
.health-trend-value {
  font-size: 16px;
  font-weight: 700;
  color: #10b981;
}

/* ── DARK MODE: override baked light-mode inline text colours ─────────────────
   When renderHeroCards/renderHealthDistWidget run in light mode they bake
   nameColor=#1a1040 and legColor=#6b5fa0 into inline styles. Switching to dark
   leaves those values invisible on the dark background. Mirror of the existing
   light-mode fix but in the opposite direction.
   ── */

/* Dark-primary names baked as light-primary (#1a1040) */
[data-theme="dark"] .hero-card [style*="color:#1a1040"],
[data-theme="dark"] #dashHealthDist [style*="color:#1a1040"],
[data-theme="dark"] #dashUrgent [style*="color:#1a1040"] {
  color: #e6edf3 !important;
}

/* Legend/nav colour (#6b5fa0) baked from light render */
[data-theme="dark"] .hero-card [style*="color:#6b5fa0"] {
  color: #8b949e !important;
}

/* Faint lavender (#c4b8f0) — visible in light, near-invisible in dark.
   Covers: urgent-item meta baked at light-render time AND task account
   names which hardcode this colour with no theme check. */
[data-theme="dark"] #dashUrgent [style*="color:#c4b8f0"],
[data-theme="dark"] #dashTasks [style*="color:#c4b8f0"],
[data-theme="dark"] .hero-card [style*="color:#c4b8f0"] {
  color: #8b949e !important;
}

/* Global dark default for card containers — catchall for anything without
   an explicit inline colour (e.g. elements added in future) */
[data-theme="dark"] .hero-card  { color: #e6edf3; }
[data-theme="dark"] .dash-widget { color: #e6edf3; }

/* ── Account Overview — mission control grid ── */
.acct-ov-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.acct-ov-grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.acct-ov-card {
  background: #ffffff;
  border: 1px solid #eae5ff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(124,92,255,0.05);
}
[data-theme="dark"] .acct-ov-card {
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  color: #e6edf3;
}
.acct-ov-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a1040;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
[data-theme="dark"] .acct-ov-title { color: #e6edf3; }
.acct-ov-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f7f5ff;
}
[data-theme="dark"] .acct-ov-row { border-bottom-color: rgba(255,255,255,0.04); }
.acct-ov-row:last-child { border-bottom: none; }
.acct-ov-label {
  font-size: 11px;
  font-weight: 500;
  color: #9b90c0;
}
[data-theme="dark"] .acct-ov-label { color: #8b949e; }
.acct-ov-value {
  font-size: 12px;
  font-weight: 700;
  color: #1a1040;
}
[data-theme="dark"] .acct-ov-value { color: #e6edf3; }
.acct-ov-divider {
  border: none;
  border-top: 1px solid #f0ebff;
  margin: 10px 0;
}
[data-theme="dark"] .acct-ov-divider { border-top-color: rgba(255,255,255,0.06); }

/* action rows inside recommended actions card */
.acct-action-row {
  background: #f7f5ff;
  border: 1px solid #eae5ff;
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 7px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s, border-color 0.15s;
}
.acct-action-row:last-child { margin-bottom: 0; }
.acct-action-row:hover { background: #ede9ff; border-color: #c4b8f0; }
[data-theme="dark"] .acct-action-row {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .acct-action-row:hover {
  background: rgba(124,92,255,0.1);
  border-color: rgba(124,92,255,0.3);
}
.acct-action-label {
  font-size: 12px;
  font-weight: 600;
  color: #1a1040;
}
[data-theme="dark"] .acct-action-label { color: #e6edf3; }
.acct-action-sub {
  font-size: 10px;
  color: #9b90c0;
  margin-top: 2px;
}
[data-theme="dark"] .acct-action-sub { color: #8b949e; }

/* ═══════════════════════════════════════════════════════════════════════════
   ACCOUNT OVERVIEW — FONT SCALE
   All rules scoped to #accountDetailContent / #accountDetailPage.
   Inline-style overrides use !important (values are baked by JS at render
   time and cannot be changed without a logic edit).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Grid & Card Spacing ─────────────────────────────────────────────────── */
#accountDetailContent .acct-ov-grid2,
#accountDetailContent .acct-ov-grid3 { gap: 12px; }

#accountDetailContent .acct-ov-card  { padding: 20px; }

/* ── Card Titles ─────────────────────────────────────────────────────────── */
#accountDetailContent .acct-ov-title { font-size: 15px; margin-bottom: 16px; }

/* ── Success Snapshot rows ───────────────────────────────────────────────── */
#accountDetailContent .acct-ov-row   { padding: 8px 0; }
#accountDetailContent .acct-ov-label { font-size: 12px; }
#accountDetailContent .acct-ov-value { font-size: 14px; font-weight: 700; }

/* ── Recommended Actions ─────────────────────────────────────────────────── */
#accountDetailContent .acct-action-label { font-size: 14px; font-weight: 600; }
#accountDetailContent .acct-action-sub   { font-size: 11px; }

/* ── Health Score card ───────────────────────────────────────────────────── */
/* Score number: 48px → 64px */
#accountDetailContent [style*="font-size:48px"] { font-size: 64px !important; }

/* Status line (direct child of card, has margin-bottom:14px) */
#accountDetailContent .acct-ov-card > div[style*="margin-bottom:14px"] {
  font-size: 13px !important;
}

/* Driver row labels (span with fixed width:130px) */
#accountDetailContent span[style*="width:130px"] { font-size: 13px !important; }

/* Driver row values (span with width:28px + text-align:right) */
#accountDetailContent span[style*="width:28px"][style*="text-align:right"] {
  font-size: 13px !important;
}

/* Progress bar track: 5px → 7px tall */
#accountDetailContent [style*="height:5px"][style*="border-radius:99px"] {
  height: 7px !important;
}

/* ── Health Drivers card ─────────────────────────────────────────────────── */
/* Signal dot description text (has line-height:1.4) */
#accountDetailContent span[style*="line-height:1.4"] { font-size: 13px !important; }

/* ── Next Best Action card ───────────────────────────────────────────────── */
/* Headline: 18px → 22px */
#accountDetailContent [style*="font-size:18px"] { font-size: 22px !important; }

/* Supporting row values (have max-width:65%) */
#accountDetailContent [style*="max-width:65%"] { font-size: 13px !important; }

/* Supporting row labels (font-size:11px + colour #9b90c0 inline) */
#accountDetailContent span[style*="font-size:11px"][style*="color:#9b90c0"] {
  font-size: 12px !important;
}

/* ── Customer Journey card ───────────────────────────────────────────────── */
/* Stage icons: 24px → 26px */
#accountDetailContent [style*="width:24px"][style*="height:24px"][style*="border-radius:50%"] {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px;
}

/* Stage names: font-size:12px/600 → 14px (exclude NBA values which have max-width) */
#accountDetailContent [style*="font-size:12px"][style*="font-weight:600"]:not([style*="max-width"]) {
  font-size: 14px !important;
}

/* Stage detail text: 10px/margin-top:1px → 11px */
#accountDetailContent [style*="margin-top:1px"][style*="font-size:10px"] {
  font-size: 11px !important;
}

/* ── Stakeholder Coverage card ───────────────────────────────────────────── */
/* Role labels + Risk text: font-size:12px/weight:500 → 13px */
#accountDetailContent [style*="font-size:12px"][style*="font-weight:500"] {
  font-size: 13px !important;
}

/* Status values (Identified/Missing): font-size:12px/weight:700 → 13px */
#accountDetailContent [style*="font-size:12px"][style*="font-weight:700"] {
  font-size: 13px !important;
}

/* Coverage score: 16px/800 → 20px */
#accountDetailContent [style*="font-size:16px"][style*="font-weight:800"] {
  font-size: 20px !important;
}

/* ── Risk Factors card ───────────────────────────────────────────────────── */
/* Sub text: 10px/margin-top:2px → 11px */
#accountDetailContent [style*="margin-top:2px"][style*="font-size:10px"] {
  font-size: 11px !important;
}

/* ── Account Detail Header ───────────────────────────────────────────────── */
/* Account name */
#detailAccountName { font-size: 26px !important; }

/* Industry / Region / CSM subtitle */
#detailAccountMeta { font-size: 13px !important; }

/* KPI chip labels (ARR, Renewal, Health) */
#accountDetailPage [style*="font-size:0.6rem"][style*="letter-spacing"] {
  font-size: 11px !important;
}

/* KPI chip values */
#detailARR,
#detailRenewalDays,
#detailHealthScore { font-size: 22px !important; }

/* Detail tab labels */
#accountDetailPage .detail-tab-btn { font-size: 13px !important; font-weight: 600 !important; }

/* ── Live Score info box ─────────────────────────────────────────────────── */
.live-score-info {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  background: #f7f5ff;
  border: 1px solid #eae5ff;
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 14px;
  font-size: 11px;
  color: #9b90c0;
  line-height: 1.4;
}

[data-theme="dark"] .live-score-info {
  background: rgba(124,92,255,0.08);
  border-color: rgba(124,92,255,0.2);
  color: #8b949e;
}

.live-score-info-icon {
  font-size: 13px;
  color: #7c5cff;
  flex-shrink: 0;
  margin-top: 1px;
}

.live-score-info-text strong {
  color: #1a1040;
  font-weight: 700;
}

[data-theme="dark"] .live-score-info-text strong {
  color: #e6edf3;
}

/* ── Score explanation toggle ─────────────────────────────────────────────── */
.score-explanation {
  background: #f7f5ff;
  border: 1px solid #eae5ff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 12px;
  color: #6b5fa0;
  line-height: 1.6;
  display: none;
}

.score-explanation.visible {
  display: block;
}

.score-explanation ul {
  margin: 6px 0 0 14px;
  color: #9b90c0;
}

.score-explanation strong {
  color: #1a1040;
  font-weight: 600;
}

[data-theme="dark"] .score-explanation {
  background: rgba(124,92,255,0.08);
  border-color: rgba(124,92,255,0.2);
  color: #8b949e;
}

[data-theme="dark"] .score-explanation strong {
  color: #e6edf3;
}

/* ── Overview Tab Readability — Light & Dark Mode Fixes ──────────────────── */

/* Journey detail text baked as #c4b8f0 in light mode — invisible on white */
[data-theme="light"] #accountDetailContent [style*="color:#c4b8f0"] {
  color: #6b5fa0 !important;
}

/* Journey detail text and pending icon baked as #484f58 in dark mode —
   near-black on dark background */
[data-theme="dark"] #accountDetailContent [style*="color:#484f58"] {
  color: #8b949e !important;
}

/* Risk item sub-text (color:#9b90c0;margin-top:2px) — lighten in light mode */
[data-theme="light"] #accountDetailContent [style*="color:#9b90c0"][style*="margin-top:2px"] {
  color: #6b5fa0 !important;
}

/* NBA card — light mode: swap gradient for white + purple border */
[data-theme="light"] #accountDetailContent .acct-ov-card[style*="linear-gradient"] {
  background: #ffffff !important;
  border: 2px solid #7c5cff !important;
  box-shadow: 0 4px 16px rgba(124,92,255,0.12) !important;
}

/* NBA card — dark mode: keep gradient, strengthen border */
[data-theme="dark"] #accountDetailContent .acct-ov-card[style*="linear-gradient"] {
  background: linear-gradient(135deg, #1c1836 0%, #161b22 100%) !important;
  border: 1px solid rgba(124,92,255,0.3) !important;
}

/* NBA headline text in light mode (color:#1a1040 already, but reinforce) */
[data-theme="light"] #accountDetailContent .acct-ov-card[style*="linear-gradient"]
  [style*="font-weight:800"] {
  color: #1a1040 !important;
}

/* NBA headline text in dark mode */
[data-theme="dark"] #accountDetailContent .acct-ov-card[style*="linear-gradient"]
  [style*="font-weight:800"] {
  color: #e6edf3 !important;
}

/* NBA value text (Owner, Impact, Due values) in light mode */
[data-theme="light"] #accountDetailContent .acct-ov-card[style*="linear-gradient"]
  [style*="max-width:65%"],
[data-theme="light"] #accountDetailContent .acct-ov-card[style*="linear-gradient"]
  [style*="font-weight:600"][style*="font-size:12px"] {
  color: #1a1040 !important;
}

/* Acct-ov-title: ensure dark in light mode, light in dark mode (safety net) */
[data-theme="light"] #accountDetailContent .acct-ov-title {
  color: #1a1040 !important;
}
[data-theme="dark"] #accountDetailContent .acct-ov-title {
  color: #e6edf3 !important;
}

/* Sub/muted text (#9b90c0) — slightly more readable in dark mode */
[data-theme="dark"] #accountDetailContent [style*="color:#9b90c0"] {
  color: #8b949e !important;
}

/* ── ACCOUNTS TABLE — Row health border (Change 3) ── */
.account-row {
  border-left: 4px solid transparent;
  transition: border-color 150ms ease;
}
.row-healthy { border-left-color: #10b981; }
.row-watch   { border-left-color: #f59e0b; }
.row-risk    { border-left-color: #ef4444; }

/* ── ACCOUNTS TABLE — Stakeholder badge (Change 2) ── */
.stk-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── TASK CARD ENRICHMENT ─────────────────────────────────────────────────── */

/* Change 1 — context line */
.task-context-line {
  font-size: 12px;
  color: #9b90c0;
  font-weight: 400;
  font-style: italic;
  margin-top: 3px;
  margin-bottom: 6px;
  line-height: 1.4;
}
[data-theme="dark"] .task-context-line {
  color: #8b949e;
}

/* Change 2 — impact line */
.task-impact-line {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.task-impact-label {
  color: #9b90c0;
  font-size: 11px;
  font-weight: 600;
}
[data-theme="dark"] .task-impact-label {
  color: #484f58;
}

/* Change 3 — health dot */
.task-health-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Change 5 — source label / card footer */
.task-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.task-source-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ══════════════════════════════════════════════════════════════════
   NOTES PAGE UPGRADE — Communication Intelligence Module
   ══════════════════════════════════════════════════════════════════ */

/* ── Layout: 65/35 notes list + sidebar ── */
.notes-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 1024px) {
  .notes-layout { grid-template-columns: 1fr; }
  .notes-sidebar { order: -1; }
}

/* ── Sidebar ── */
.notes-sidebar {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.nsb-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}
.nsb-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.nsb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.nsb-card {
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.nsb-val {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.nsb-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}
.nsb-total {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 0.25rem;
}

/* Sentiment progress bars */
.nsb-sent-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
}
.nsb-sent-row:last-child { margin-bottom: 0; }
.nsb-bar-wrap {
  flex: 1;
  background: var(--bg-elevated);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.nsb-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 400ms ease;
}
.nsb-pct {
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

/* Top accounts by notes */
.nsb-acc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  cursor: pointer;
  border-radius: 6px;
  transition: background 150ms;
}
.nsb-acc-row:hover { background: var(--bg-elevated); padding: 0.35rem 0.4rem; margin: 0 -0.4rem; }
.nsb-acc-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nsb-acc-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 1px 7px;
}
.nsb-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem 0;
}

/* ── Note card ── */
.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: box-shadow 150ms ease, transform 150ms ease;
  cursor: default;
}
.note-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}

/* Top row: type badge + sentiment + visibility + date */
.note-card-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.note-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.note-type-badge { font-size: 0.72rem; font-weight: 700; }
.note-sent-badge { }
.note-vis-badge  { }
.note-date {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Title */
.note-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

/* Stakeholder row */
.note-stakeholder-row {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Account chip */
.note-account-row {
  margin-bottom: 0.5rem;
}
.note-account-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Content (3-line clamp) */
.note-content {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

/* Linked tasks */
.note-linked-tasks {
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.note-linked-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.note-linked-task {
  font-size: 0.78rem;
  color: var(--text);
  padding: 0.15rem 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.note-linked-done {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Tags */
.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.4rem 0 0;
}
.note-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Footer: actions */
.note-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.note-footer .btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
}

/* ── Modal: sentiment pill buttons ── */
.note-sent-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 150ms, background 150ms, color 150ms;
}
.note-sent-pill:hover {
  border-color: #9b90c0;
  color: var(--text);
}
.note-sent-pill.active {
  border-color: #9b90c0;
  background: rgba(155,144,192,0.15);
  color: #6b5fa0;
}
#sent-positive.active  { border-color:#10b981; background:rgba(16,185,129,0.12); color:#059669; }
#sent-concerned.active { border-color:#f59e0b; background:rgba(245,158,11,0.12); color:#d97706; }
#sent-escalated.active { border-color:#ef4444; background:rgba(239,68,68,0.12);  color:#dc2626; }

/* ── Dark mode overrides ── */
[data-theme="dark"] .note-card {
  box-shadow: none;
}
[data-theme="dark"] .note-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
[data-theme="dark"] .nsb-section {
  background: var(--bg-card);
}
[data-theme="dark"] .note-sent-pill.active {
  background: rgba(155,144,192,0.20);
}
[data-theme="dark"] #sent-positive.active  { background: rgba(16,185,129,0.18); }
[data-theme="dark"] #sent-concerned.active { background: rgba(245,158,11,0.18); }
[data-theme="dark"] #sent-escalated.active { background: rgba(239,68,68,0.18); }

/* ══════════════════════════════════════════════════════════════════
   QBR PAGE UPGRADE — Executive Metrics Module
   ══════════════════════════════════════════════════════════════════ */

/* ── CSS custom prop for strip dividers ── */
:root                  { --qbr-strip-divider: #eae5ff; }
[data-theme="dark"]    { --qbr-strip-divider: rgba(255,255,255,0.06); }

/* ── Portfolio summary strip (Change 2) ── */
.qbr-portfolio-strip {
  background: #ffffff;
  border: 1px solid #eae5ff;
  border-radius: 10px;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  box-shadow: 0 2px 8px rgba(124,92,255,0.05);
}
[data-theme="dark"] .qbr-portfolio-strip {
  background: #161b22;
  border-color: rgba(255,255,255,0.06);
}
.qbr-strip-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 16px;
}
.qbr-strip-metric:last-child { border-right: none !important; padding-right: 0; }
.qbr-strip-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #9b90c0;
}
[data-theme="dark"] .qbr-strip-label { color: #484f58; }
.qbr-strip-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

/* ── Missing QBR panel (Change 3) ── */
.qbr-missing-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.qbr-missing-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 150ms;
}
.qbr-missing-header:hover { background: var(--bg-elevated); }
.qbr-missing-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.qbr-missing-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  padding: 1px 7px;
  border-radius: 999px;
}
.qbr-missing-arrow { font-size: 0.7rem; color: var(--text-muted); }
.qbr-missing-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}
.qbr-account-chips {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.75rem 0;
  scrollbar-width: thin;
}
.qbr-account-chip {
  flex: 0 0 auto;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid #eae5ff;
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: box-shadow 150ms;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
[data-theme="dark"] .qbr-account-chip {
  background: #161b22;
  border-color: rgba(255,255,255,0.06);
}
.qbr-account-chip:hover { box-shadow: 0 2px 8px rgba(124,92,255,0.15); }
.qbr-chip-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .qbr-chip-name { color: #e6edf3; }
.qbr-chip-arr {
  font-size: 11px;
  font-weight: 600;
  color: #7c5cff;
}
[data-theme="dark"] .qbr-chip-arr { color: #a78bff; }
.qbr-chip-health {
  font-size: 11px;
  font-weight: 600;
}
.qbr-chip-days {
  font-size: 10px;
  color: #9b90c0;
}
[data-theme="dark"] .qbr-chip-days { color: #8b949e; }
.qbr-missing-arr-total {
  font-size: 12px;
  font-weight: 600;
  color: #ef4444;
  padding-top: 0.25rem;
}
.qbr-missing-all-clear {
  font-size: 13px;
  font-weight: 600;
  color: #10b981;
  padding: 0.75rem 0 0;
  margin: 0;
}

/* ── Readiness score bar bg (Change 6) ── */
:root              { --qbr-ready-bg: #f0ebff; }
[data-theme="dark"] { --qbr-ready-bg: rgba(255,255,255,0.06); }

/* ══════════════════════════════════════════════════════════════════
   STAKEHOLDERS PAGE UPGRADE — Coverage Intelligence Module
   ══════════════════════════════════════════════════════════════════ */

/* ── CSS custom props ── */
:root              { --stk-strip-divider: #eae5ff; }
[data-theme="dark"] { --stk-strip-divider: rgba(255,255,255,0.06); }

/* ── Portfolio coverage strip (Change 2) ── */
.stk-coverage-strip {
  background: #ffffff;
  border: 1px solid #eae5ff;
  border-radius: 10px;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(124,92,255,0.05);
}
[data-theme="dark"] .stk-coverage-strip {
  background: #161b22;
  border-color: rgba(255,255,255,0.06);
}
.stk-strip-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 16px;
}
.stk-strip-section:last-child { border-right: none !important; padding-right: 0; }
.stk-strip-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #9b90c0;
}
[data-theme="dark"] .stk-strip-label { color: #484f58; }
.stk-strip-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.stk-strip-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Missing roles per account group (Changes 3 + 6) ── */
.stk-role-row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.stk-role-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.stk-role-pill-ok {
  background: #e8faf2;
  color: #059669;
}
.stk-role-pill-missing {
  background: #fff0f0;
  color: #dc2626;
}
[data-theme="dark"] .stk-role-pill-ok {
  background: rgba(16,185,129,0.15);
  color: #34d399;
}
[data-theme="dark"] .stk-role-pill-missing {
  background: rgba(239,68,68,0.12);
  color: #f87171;
}
.stk-cov-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid;
  line-height: 1.4;
}

/* ── Enhanced contact card elements (Change 4) ── */
.stk-risk-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}
[data-theme="dark"] .stk-risk-badge[style*="#e8faf2"] {
  background: rgba(16,185,129,0.15) !important;
  color: #34d399 !important;
}
[data-theme="dark"] .stk-risk-badge[style*="#fff8e6"] {
  background: rgba(245,158,11,0.15) !important;
  color: #fbbf24 !important;
}
[data-theme="dark"] .stk-risk-badge[style*="#fff0f0"] {
  background: rgba(239,68,68,0.15) !important;
  color: #f87171 !important;
}

/* ══════════════════════════════════════════════════════════════════
   TEAM PAGE UPGRADE — Management Dashboard
   ══════════════════════════════════════════════════════════════════ */

/* ── Attention Queue (Change 2) ── */
.team-aq-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: background 150ms;
}
.team-aq-header:hover { background: var(--bg-elevated); }
.team-aq-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.team-aq-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: #ef4444;
  padding: 1px 7px;
  border-radius: 999px;
}
.team-aq-body {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--bg-elevated);
}
.team-aq-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.team-aq-card {
  background: #fff;
  border: 1px solid #eae5ff;
  border-left-width: 4px;
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 220px;
  flex: 1 1 220px;
  max-width: 320px;
}
[data-theme="dark"] .team-aq-card {
  background: #161b22;
  border-color: rgba(255,255,255,0.06);
}
.team-aq-allclear {
  font-size: 13px;
  font-weight: 600;
  color: #10b981;
  margin: 0;
}
.team-avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* ── Expansion upgrade ───────────────────────────────────────────────── */
.exp-top-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: #e8faf2;
  color: #059669;
  margin-left: 6px;
  vertical-align: middle;
}
[data-theme="dark"] .exp-top-badge {
  background: rgba(16,185,129,0.15);
  color: #34d399;
}

/* ── Renewals upgrade ────────────────────────────────────────────────── */
.ren-nrr-card {
  border: 1px solid var(--border);
}
[data-theme="dark"] .ren-nrr-card {
  background: #161b22;
  border-color: rgba(255,255,255,0.06);
}
.ren-conf-pill {
  transition: transform 0.1s;
}
.ren-conf-pill:hover { transform: scale(1.02); }

/* ── Onboarding upgrade ───────────────────────────────────────────────── */
.ob-mil-row { transition: background 0.12s; }
.ob-mil-row:hover { background: var(--bg-elevated); }
.ob-mil-row:hover .ob-mil-del { opacity: 1 !important; }
.ob-mil-done { opacity: 0.75; }

.ob-health-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid currentColor;
  vertical-align: middle;
}
.ob-tmpl-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  vertical-align: middle;
}

/* ── Churn upgrade ────────────────────────────────────────────────────── */
.churn-prev-card {
  border-top: 3px solid #ef4444;
}
[data-theme="dark"] .churn-prev-card {
  background: #161b22;
  border-color: rgba(255,255,255,0.06);
  border-top-color: #ef4444;
}
[data-theme="dark"] .churn-prev-card .stat-label {
  color: #8b949e;
}

.churn-patterns-wrap {
  --churn-bar-track: #f0ebff;
  --churn-insight-bg: #f7f5ff;
  --churn-insight-border: #eae5ff;
}
[data-theme="dark"] .churn-patterns-wrap {
  --churn-bar-track: rgba(255,255,255,0.06);
  --churn-insight-bg: rgba(255,255,255,0.03);
  --churn-insight-border: rgba(255,255,255,0.06);
}

/* ── Signal AI — Reports page ─────────────────────────────────────────── */
.sig-ai-powered-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c5cff, #9b87ff);
  color: #ffffff;
}

.sig-ai-card {
  background: #ffffff;
  border: 1px solid #c4b8f0;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(124,92,255,0.08);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.sig-ai-card:hover {
  border-color: #7c5cff;
  box-shadow: 0 6px 20px rgba(124,92,255,0.18);
  transform: translateY(-2px);
}
[data-theme="dark"] .sig-ai-card {
  background: #161b22;
  border-color: rgba(124,92,255,0.2);
  box-shadow: 0 4px 16px rgba(124,92,255,0.06);
}

.sig-ai-stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #7c5cff, #9b87ff);
}

.sig-ai-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: #ede9ff;
  color: #5038d0;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
[data-theme="dark"] .sig-ai-badge {
  background: rgba(124,92,255,0.18);
  color: #a78bff;
}

.sig-ai-btn {
  margin-top: 0.85rem;
  padding: 7px 14px;
  background: linear-gradient(135deg, #7c5cff, #9b87ff);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
  align-self: flex-start;
}
.sig-ai-btn:hover { opacity: 0.88; }
.sig-ai-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.sig-ai-output {
  margin-top: 12px;
  background: #f7f5ff;
  border: 1px solid #eae5ff;
  border-radius: 10px;
  padding: 20px;
  font-size: 13px;
  line-height: 1.7;
  color: #1a1040;
}
[data-theme="dark"] .sig-ai-output {
  background: rgba(124,92,255,0.05);
  border-color: rgba(124,92,255,0.15);
  color: #e6edf3;
}

.sig-ai-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7c5cff;
}
[data-theme="dark"] .sig-ai-section-label { color: #a78bff; }

/* Quick Generate strip */
.qgen-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.qgen-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #eae5ff;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #1a1040;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.qgen-btn:hover {
  background: #ede9ff;
  border-color: #c4b8f0;
  color: #5038d0;
}
[data-theme="dark"] .qgen-btn {
  background: #161b22;
  border-color: rgba(255,255,255,0.08);
  color: #e6edf3;
}
[data-theme="dark"] .qgen-btn:hover {
  background: rgba(124,92,255,0.1);
  border-color: rgba(124,92,255,0.3);
  color: #a78bff;
}

/* Signal AI nav dot */
.sig-ai-nav-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #9b87ff);
  margin-left: 4px;
  flex-shrink: 0;
}
[data-theme="dark"] .qgen-title { color: #e6edf3; }

/* ── Signal AI report modal ───────────────────────────────────────────── */
.ai-report-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.ai-report-modal {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 760px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  overflow: hidden;
}
[data-theme="dark"] .ai-report-modal {
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.08);
}
.ai-report-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #eae5ff;
}
[data-theme="dark"] .ai-report-modal-header {
  border-bottom-color: rgba(255,255,255,0.06);
}
.ai-report-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1040;
}
[data-theme="dark"] .ai-report-modal-title {
  color: #e6edf3;
}
.ai-badge {
  background: #ede9ff;
  color: #5038d0;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
[data-theme="dark"] .ai-badge {
  background: rgba(124,92,255,0.18);
  color: #a78bff;
}
.ai-report-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #9b90c0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  font-family: inherit;
}
.ai-report-modal-close:hover {
  background: #f0ebff;
  color: #1a1040;
}
.ai-report-modal-body {
  padding: 24px;
  max-height: 65vh;
  overflow-y: auto;
  color: #374151;
  font-size: 13px;
  line-height: 1.7;
}
[data-theme="dark"] .ai-report-modal-body {
  color: #e6edf3;
}
[data-theme="dark"] .ai-report-modal-body h2,
[data-theme="dark"] .ai-report-modal-body h3,
[data-theme="dark"] .ai-report-modal-body h4,
[data-theme="dark"] .ai-report-modal-body strong {
  color: #e6edf3 !important;
}
.ai-report-modal-footer {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #eae5ff;
  justify-content: flex-end;
}
[data-theme="dark"] .ai-report-modal-footer {
  border-top-color: rgba(255,255,255,0.06);
}
.ai-report-modal-footer button {
  background: #f7f5ff;
  border: 1px solid #eae5ff;
  color: #5038d0;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.ai-report-modal-footer button:hover { background: #ede9ff; }
.ai-report-modal-footer button:last-child {
  background: #7c5cff;
  border-color: #7c5cff;
  color: #ffffff;
}
.ai-report-modal-footer button:last-child:hover { background: #6a4de8; }
[data-theme="dark"] .ai-report-modal-footer button {
  background: rgba(124,92,255,0.12);
  border-color: rgba(124,92,255,0.25);
  color: #a78bff;
}
[data-theme="dark"] .ai-report-modal-footer button:last-child {
  background: #7c5cff;
  color: #fff;
}

/* ── Playbook AI Section ──────────────────────────────────────────────────── */
.pb-ai-section {
  background: #f7f5ff;
  border: 1px solid #eae5ff;
}
[data-theme="dark"] .pb-ai-section {
  background: rgba(124,92,255,0.05);
  border-color: rgba(124,92,255,0.15);
}
[data-theme="dark"] #pbAIOutput {
  background: rgba(124,92,255,0.05) !important;
  border-color: rgba(124,92,255,0.15) !important;
}

/* ── Playbook Performance Tab ─────────────────────────────────────────────── */
[data-theme="dark"] .pb-perf-kpi {
  background: #161b22;
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .pb-perf-thead th {
  background: rgba(255,255,255,0.03) !important;
  color: #8b949e !important;
}
[data-theme="dark"] .pb-perf-row td {
  color: #e6edf3 !important;
  border-color: rgba(255,255,255,0.04) !important;
}
[data-theme="dark"] .pb-perf-row { border-bottom-color: rgba(255,255,255,0.04) !important; }
[data-theme="dark"] .pb-perf-row:nth-child(even) { background: rgba(255,255,255,0.02) !important; }
[data-theme="dark"] .pb-perf-best {
  background: rgba(16,185,129,0.08) !important;
  border-color: rgba(16,185,129,0.2) !important;
}
[data-theme="dark"] .pb-perf-best .card-title { color: #e6edf3 !important; }

/* ── Playbook → Communications integration ─────────────────────────────────── */
.pb-launch-tpl-btn {
  background: transparent;
  border: 1px solid #7c5cff;
  border-radius: 5px;
  color: #7c5cff;
  font-size: 11px;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.pb-launch-tpl-btn:hover {
  background: #ede9ff;
  color: #5038d0;
}
[data-theme="dark"] .pb-launch-tpl-btn {
  border-color: #7c5cff;
  color: #a78bff;
}
[data-theme="dark"] .pb-launch-tpl-btn:hover {
  background: rgba(124,92,255,0.15);
  color: #c4b5fd;
}

.pb-tpl-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  background: #f7f5ff;
  color: #5038d0;
  border: 1px solid #eae5ff;
  letter-spacing: 0.01em;
}
[data-theme="dark"] .pb-tpl-chip {
  background: rgba(124,92,255,0.08);
  color: #a78bff;
  border-color: rgba(124,92,255,0.2);
}

/* ── Signal AI — Playbook Recommendations output panel ──────────────────────── */
.ai-pb-recs-out {
  background: #f7f5ff;
  border: 1px solid #eae5ff;
  border-radius: 10px;
  padding: 20px;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text);
}
[data-theme="dark"] .ai-pb-recs-out {
  background: rgba(124,92,255,0.05);
  border-color: rgba(124,92,255,0.15);
}

/* ── Pulse bar trend indicators ──────────────────────────────────────────────── */
.pulse-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.pulse-trend.up      { color: #10b981; }
.pulse-trend.down    { color: #ef4444; }
.pulse-trend.neutral { color: #9b90c0; }
[data-theme="dark"] .pulse-trend.up      { color: #34d399; }
[data-theme="dark"] .pulse-trend.down    { color: #f87171; }
[data-theme="dark"] .pulse-trend.neutral { color: #9b90c0; }

/* ── Insight card action buttons ──────────────────────────────────────────────── */
.ai-insight-btn-primary {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  color: #fff;
  font-family: inherit;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.ai-insight-btn-primary:hover { opacity: 0.85; }
.ai-insight-btn-secondary {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(124,92,255,0.08);
  color: #5038d0;
  border: 1px solid rgba(124,92,255,0.18);
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
.ai-insight-btn-secondary:hover { background: #ede9ff; }
.ai-insight-btn-ghost {
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.ai-insight-btn-ghost:hover { background: var(--bg-elevated); color: var(--text); }
[data-theme="dark"] .ai-insight-btn-secondary {
  background: rgba(255,255,255,0.06);
  color: #e6edf3;
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .ai-insight-btn-secondary:hover { background: rgba(255,255,255,0.1); }
[data-theme="dark"] .ai-insight-btn-ghost { color: #8b949e; }

/* ── Playbook library stats row ───────────────────────────────────────────────── */
.pb-stats-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 1rem 0.75rem;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0ebff;
}
[data-theme="dark"] .pb-stats-row { border-top-color: rgba(255,255,255,0.06); }
.pb-stat-item { font-size: 11px; font-weight: 600; }
.pb-stat-sep  { font-size: 11px; color: #9b90c0; }

/* ── AI Chat chips ────────────────────────────────────────────────────────────── */
.ai-chat-chip {
  background: #f7f5ff;
  border: 1px solid #eae5ff;
  color: #5038d0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
.ai-chat-chip:hover { background: #ede9ff; }
[data-theme="dark"] .ai-chat-chip {
  background: rgba(124,92,255,0.08);
  border-color: rgba(124,92,255,0.2);
  color: #a78bff;
}
[data-theme="dark"] .ai-chat-chip:hover { background: rgba(124,92,255,0.15); }
