/* ============================================================
   FirstThread — Dashboard shell
   Tokens sourced from C:\dev\firstthread\app\globals.css
   ============================================================ */

:root {
  --ink: #163357;
  --ink-soft: #1F4170;
  --ink-light: #5A6B82;
  --ink-faint: #8696AB;
  --bg: #FFFFFF;
  --bg-soft: #F8F9FD;
  --bg-warm: #F2F5FA;
  --line: #E5EBF2;
  --line-strong: #D5DDE8;
  --accent: #1855E1;
  --accent-hover: #1244B8;
  --accent-light: #5AA4FD;
  --accent-soft: rgba(24, 85, 225, 0.08);
  --warning: #E2873B;
  --warning-soft: rgba(226, 135, 59, 0.12);
  --success: #2BAF6A;
  --success-soft: rgba(43, 175, 106, 0.10);
  --shadow-sm: 0 1px 2px rgba(22, 51, 87, 0.04);
  --shadow-md: 0 4px 16px rgba(22, 51, 87, 0.06), 0 1px 3px rgba(22, 51, 87, 0.04);
  --shadow-lg: 0 12px 40px rgba(22, 51, 87, 0.08), 0 2px 8px rgba(22, 51, 87, 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-soft);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
  font-feature-settings: "ss01", "cv11";
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- Top nav ---------- */
.nav {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; max-width: 1320px; margin: 0 auto; gap: 24px;
}
.logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.logo img { height: 28px; width: auto; display: block; }
.nav-tabs { display: flex; gap: 28px; }
.nav-tab {
  font-size: 14.5px; font-weight: 500; color: var(--ink-light);
  padding: 6px 0; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-tab:hover { color: var(--ink); }
.nav-tab.active { color: var(--ink); border-color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 18px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-light);
  background: white; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-weight: 500;
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(43, 175, 106, 0.4);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(43, 175, 106, 0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(43, 175, 106, 0); }
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; letter-spacing: 0.01em;
}

/* ---------- Main ---------- */
.main { max-width: 1320px; margin: 0 auto; padding: 36px 32px 80px; }
.main.wide { max-width: 1440px; }

.welcome { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; gap: 24px; flex-wrap: wrap; }
.welcome h1 {
  font-size: 30px; letter-spacing: -0.025em; font-weight: 600;
  margin-bottom: 6px; line-height: 1.15;
}
.welcome-sub { color: var(--ink-light); font-size: 14.5px; }
.welcome-sub strong { color: var(--ink-soft); font-weight: 600; }
.welcome-actions { display: flex; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: 14px; font-weight: 500;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(24, 85, 225, 0.25); }
.btn-ghost { background: white; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--ink-light); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-danger { background: white; color: #c14848; border-color: var(--line-strong); }
.btn-danger:hover { background: #fdf3f3; border-color: #e7b6b6; }

/* ---------- Cards ---------- */
.card {
  background: white; border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.card-title {
  font-size: 11.5px; font-weight: 600; color: var(--ink-light);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.card-action { font-size: 13px; color: var(--accent); font-weight: 500; }
.card-action:hover { color: var(--accent-hover); }

/* ---------- Dashboard top grid ---------- */
.top-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 20px;
  margin-bottom: 20px;
}

/* Brand score card */
.score-main { display: flex; align-items: baseline; gap: 14px; margin-bottom: 4px; }
.score-number { font-size: 64px; font-weight: 600; letter-spacing: -0.045em; color: var(--ink); line-height: 1; }
.score-suffix { font-size: 22px; font-weight: 500; color: var(--ink-faint); letter-spacing: -0.02em; }
.score-delta {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--success); font-weight: 600; font-size: 13px;
  background: var(--success-soft); padding: 4px 10px;
  border-radius: 999px; margin-left: auto;
}
.score-context { color: var(--ink-light); font-size: 13.5px; margin-bottom: 22px; }
.score-breakdown {
  display: flex; flex-direction: column; gap: 16px;
  padding-top: 22px; border-top: 1px solid var(--line);
}
.score-row { display: grid; grid-template-columns: 1fr 120px 32px; gap: 16px; align-items: center; }
.score-row-name {
  font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 2px;
  display: flex; align-items: center; gap: 8px;
}
.score-row-weight {
  font-size: 10.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 2px 6px; border-radius: 4px;
  letter-spacing: 0.04em;
}
.score-row-detail { font-size: 12.5px; color: var(--ink-faint); }
.score-bar { height: 6px; background: var(--bg-warm); border-radius: 999px; overflow: hidden; position: relative; }
.score-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 999px; }
.score-row-value { font-size: 14.5px; font-weight: 600; color: var(--ink); text-align: right; }

/* Chart card */
.chart-card { display: flex; flex-direction: column; }
.chart-toggles { display: flex; gap: 2px; background: var(--bg-warm); padding: 3px; border-radius: 8px; }
.chart-toggle {
  padding: 6px 12px; font-size: 12.5px; font-weight: 500;
  color: var(--ink-light); border-radius: 6px; transition: all .15s;
}
.chart-toggle:hover { color: var(--ink); }
.chart-toggle.active { background: white; color: var(--ink); box-shadow: var(--shadow-sm); }
.chart-svg-wrap { position: relative; width: 100%; flex: 1; min-height: 220px; }
.chart-svg { width: 100%; height: 100%; display: block; }

/* ---------- Stats row ---------- */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  margin-bottom: 20px;
}
.stat-card { padding: 20px 22px; }
.stat-label { font-size: 12px; color: var(--ink-light); margin-bottom: 8px; font-weight: 500; }
.stat-value-row { display: flex; align-items: baseline; gap: 10px; }
.stat-value { font-size: 28px; font-weight: 600; color: var(--ink); letter-spacing: -0.025em; line-height: 1.1; }
.stat-value-suffix { font-size: 16px; color: var(--ink-faint); font-weight: 500; }
.stat-trend { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--warning); }
.stat-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; }

/* ---------- Feed (dashboard) ---------- */
.feed-card { padding: 0; overflow: hidden; }
.feed-header {
  padding: 18px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.feed-title { font-size: 16px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.feed-title-pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 3px rgba(43, 175, 106, 0.18);
}
.feed-meta { font-size: 12.5px; color: var(--ink-faint); margin-left: 4px; font-weight: 400; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; font-size: 13px; font-weight: 500;
  border-radius: 999px; color: var(--ink-light);
  border: 1px solid var(--line); background: white; transition: all .15s;
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.active { background: var(--ink); color: white; border-color: var(--ink); }
.chip-count { margin-left: 6px; font-size: 11px; opacity: 0.7; font-variant-numeric: tabular-nums; }

.lead-list { display: flex; flex-direction: column; }
.lead {
  display: grid; grid-template-columns: 1fr auto; gap: 24px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  transition: background .15s;
  cursor: pointer; position: relative;
}
.lead:hover { background: var(--bg-soft); }
.lead:last-child { border-bottom: none; }
.lead.is-new::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.lead-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-light); margin-bottom: 10px;
}
.lead-meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-faint); flex-shrink: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; font-size: 11px; font-weight: 600;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap;
}
.badge.new { background: var(--accent-soft); color: var(--accent); }
.badge.mentioned { background: var(--success-soft); color: var(--success); text-transform: none; letter-spacing: 0; font-size: 12px; }
.badge.awaiting { background: var(--warning-soft); color: var(--warning); }
.badge.late { background: rgba(22, 51, 87, 0.06); color: var(--ink-light); text-transform: none; letter-spacing: 0; font-size: 12px; }

.lead-source { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; color: var(--ink-light); }
.lead-snippet { font-size: 15px; color: var(--ink); line-height: 1.5; margin-bottom: 8px; font-weight: 500; }
.lead-author { font-size: 13px; color: var(--ink-light); }
.lead-author strong { color: var(--ink-soft); font-weight: 600; }
.lead-action { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 10px; }
.lead-cta {
  padding: 8px 14px; background: var(--bg-warm); color: var(--ink);
  border-radius: 8px; font-size: 13px; font-weight: 500;
  border: 1px solid transparent; white-space: nowrap; transition: all .15s;
}
.lead-cta:hover { background: var(--ink); color: white; }

.footer-note { margin-top: 28px; text-align: center; font-size: 12px; color: var(--ink-faint); }

/* ============================================================
   CONVERSATIONS PAGE
   ============================================================ */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { font-size: 28px; letter-spacing: -0.025em; font-weight: 600; line-height: 1.2; }
.page-header-sub { font-size: 14px; color: var(--ink-light); margin-top: 4px; }

.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.search {
  display: flex; align-items: center; gap: 8px;
  background: white; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 12px;
  flex: 1; min-width: 240px; max-width: 360px;
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent-light); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { color: var(--ink-faint); flex-shrink: 0; }
.search input { border: none; outline: none; flex: 1; background: none; font-size: 14px; color: var(--ink); }
.search input::placeholder { color: var(--ink-faint); }

.select {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: white; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 13.5px; color: var(--ink);
  font-weight: 500; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: border-color .15s;
}
.select:hover { border-color: var(--line-strong); }
.select svg { color: var(--ink-faint); }

.split {
  display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.3fr); gap: 20px;
  align-items: start;
}
.conv-list-card { padding: 0; overflow: hidden; max-height: calc(100vh - 240px); display: flex; flex-direction: column; }
.conv-list { overflow-y: auto; flex: 1; }
.conv-list::-webkit-scrollbar { width: 8px; }
.conv-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.conv-list::-webkit-scrollbar-track { background: transparent; }

.conv-row {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .12s;
  position: relative; display: flex; flex-direction: column; gap: 6px;
}
.conv-row:hover { background: var(--bg-soft); }
.conv-row.selected { background: var(--accent-soft); }
.conv-row.selected::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.conv-row-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-light); flex-wrap: wrap; }
.conv-row-meta strong { color: var(--ink); font-weight: 600; }
.conv-row-snippet {
  font-size: 14px; color: var(--ink); line-height: 1.45; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.conv-row-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-faint); }
.conv-row-foot strong { color: var(--ink-light); font-weight: 500; }

/* Detail panel */
.detail-card { padding: 0; overflow: hidden; max-height: calc(100vh - 240px); display: flex; flex-direction: column; }
.detail-head {
  padding: 22px 28px 20px; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
}
.detail-meta-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-light); flex-wrap: wrap; }
.detail-actions-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-thread { padding: 24px 28px 8px; overflow-y: auto; flex: 1; }
.detail-thread::-webkit-scrollbar { width: 8px; }
.detail-thread::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.original-post { margin-bottom: 24px; }
.poster {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.poster-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-warm); color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  border: 1px solid var(--line);
}
.poster-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.poster-time { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }
.post-body { font-size: 15.5px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }

.thread-divider {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--ink-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 24px 0 16px;
}
.thread-divider::before, .thread-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.reply { display: flex; gap: 12px; margin-bottom: 18px; }
.reply-body { flex: 1; }
.reply-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.reply-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.reply-time { font-size: 12px; color: var(--ink-faint); }
.reply-text { font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); }
.reply.ours .poster-avatar { background: var(--accent); color: white; border-color: var(--accent); }
.reply.ours .reply-name { color: var(--accent); }
.reply.ours .reply-text {
  background: var(--accent-soft); border: 1px solid rgba(24, 85, 225, 0.18);
  border-radius: var(--radius-sm); padding: 12px 14px; color: var(--ink);
  position: relative;
}
.reply.ours .reply-tag {
  font-size: 11px; font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 6px; display: inline-flex; align-items: center; gap: 4px;
}

.detail-actions {
  padding: 16px 28px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-soft); flex-wrap: wrap;
}
.detail-action-meta { font-size: 12.5px; color: var(--ink-light); display: flex; align-items: center; gap: 10px; }
.detail-action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   REPORTS PAGE
   ============================================================ */
.reports-grid { display: flex; flex-direction: column; gap: 20px; }

.headline-card { display: grid; grid-template-columns: 280px 1fr; gap: 32px; align-items: stretch; padding: 28px 28px 24px; }
.headline-stat { display: flex; flex-direction: column; gap: 6px; padding-right: 28px; border-right: 1px solid var(--line); justify-content: center; }
.headline-eyebrow { font-size: 11.5px; font-weight: 600; color: var(--ink-light); text-transform: uppercase; letter-spacing: 0.1em; }
.headline-value-row { display: flex; align-items: baseline; gap: 12px; }
.headline-value { font-size: 56px; font-weight: 600; letter-spacing: -0.045em; color: var(--ink); line-height: 1; }
.headline-suffix { font-size: 18px; font-weight: 500; color: var(--ink-faint); }
.headline-delta { font-size: 13px; font-weight: 600; color: var(--success); margin-top: 6px; }
.headline-chart { min-height: 200px; display: flex; flex-direction: column; }

.subscore-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.subscore-card { padding: 20px 24px; }
.subscore-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.subscore-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.subscore-weight { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; letter-spacing: 0.04em; }
.subscore-value-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.subscore-value { font-size: 32px; font-weight: 600; color: var(--ink); letter-spacing: -0.03em; line-height: 1; }
.subscore-delta { font-size: 12.5px; font-weight: 600; color: var(--success); }
.subscore-context { font-size: 12.5px; color: var(--ink-faint); }
.subscore-spark { height: 60px; margin-top: 12px; }

.report-grid-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; }
.report-grid-2-eq { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

/* Bar chart (top neighborhoods) */
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 32px; gap: 14px; align-items: center; }
.bar-label { font-size: 13.5px; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--bg-warm); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 999px; }
.bar-value { font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

/* Hour-of-day distribution */
.hours-chart { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 140px; }
.hour-bar { background: var(--accent-soft); border-radius: 3px 3px 0 0; min-height: 4px; transition: background .15s; position: relative; cursor: pointer; }
.hour-bar:hover { background: var(--accent); }
.hours-axis { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; margin-top: 6px; font-size: 10.5px; color: var(--ink-faint); text-align: center; }
.hours-axis span:not(:nth-child(6n+1)) { visibility: hidden; }

/* Mention rank */
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 60px 1fr 60px; gap: 14px; align-items: center; }
.rank-tag {
  font-size: 12px; font-weight: 600; color: var(--ink);
  background: var(--bg-warm); padding: 4px 8px; border-radius: 6px;
  text-align: center;
}
.rank-tag.gold { background: rgba(226, 135, 59, 0.12); color: var(--warning); }

/* Comparison table */
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th, .compare-table td { padding: 12px 14px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.compare-table th { font-size: 11.5px; font-weight: 600; color: var(--ink-light); text-transform: uppercase; letter-spacing: 0.08em; background: var(--bg-soft); }
.compare-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.compare-table td.delta-up { color: var(--success); font-weight: 600; }
.compare-table td.delta-down { color: var(--warning); font-weight: 600; }
.compare-table tr:last-child td { border-bottom: none; }

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings-nav {
  position: sticky; top: 88px;
  display: flex; flex-direction: column; gap: 2px;
}
.settings-nav-item {
  padding: 9px 14px; font-size: 14px; font-weight: 500;
  color: var(--ink-light); border-radius: var(--radius-sm);
  text-align: left; cursor: pointer; transition: all .15s;
  border: 1px solid transparent;
}
.settings-nav-item:hover { background: white; color: var(--ink); border-color: var(--line); }
.settings-nav-item.active { background: white; color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }

.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-section h2 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--ink); margin-bottom: 4px;
}
.settings-section-sub { font-size: 14px; color: var(--ink-light); margin-bottom: 24px; }

.settings-card { padding: 24px 28px; margin-bottom: 16px; }
.settings-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.settings-card-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.settings-card-sub { font-size: 13px; color: var(--ink-light); margin-top: 2px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.form-input, .form-select, .form-textarea {
  padding: 9px 12px; background: white; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-textarea { min-height: 110px; resize: vertical; line-height: 1.5; font-family: inherit; }
.form-help { font-size: 12px; color: var(--ink-faint); }

.settings-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 18px; border-top: 1px solid var(--line); margin-top: 22px;
}

/* Toggle switch */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.toggle-row:last-of-type { border-bottom: none; }
.toggle-text { display: flex; flex-direction: column; gap: 2px; }
.toggle-name { font-size: 14px; font-weight: 500; color: var(--ink); }
.toggle-desc { font-size: 12.5px; color: var(--ink-light); }

.toggle {
  position: relative; width: 38px; height: 22px; flex-shrink: 0;
  background: var(--line-strong); border-radius: 999px;
  transition: background .2s; cursor: pointer;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; background: white;
  border-radius: 50%; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(16px); }
.toggle.disabled { opacity: 0.5; cursor: not-allowed; }

/* Source / integration cards */
.source-row {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.source-row:last-of-type { border-bottom: none; }
.source-icon {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--bg-warm); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.source-info { flex: 1; }
.source-name { font-size: 14.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.source-status { font-size: 12.5px; color: var(--ink-light); margin-top: 2px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em;
}
.status-pill.active { background: var(--success-soft); color: var(--success); }
.status-pill.soon { background: var(--bg-warm); color: var(--ink-light); }

/* Brand voice template preview */
.template-preview {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 16px 18px;
  font-size: 14px; color: var(--ink-soft); line-height: 1.55;
  font-style: italic;
}
.template-preview::before {
  content: '“'; font-size: 28px; color: var(--accent); font-weight: 600;
  line-height: 0; vertical-align: -10px; margin-right: 4px; font-style: normal;
}

/* Team members list */
.team-row {
  display: grid; grid-template-columns: 1fr 140px 100px 32px; gap: 16px;
  align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.team-row:last-of-type { border-bottom: none; }
.team-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.team-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.team-name { font-size: 14px; font-weight: 500; color: var(--ink); }
.team-email { font-size: 12.5px; color: var(--ink-faint); }
.team-role-pill {
  font-size: 11.5px; font-weight: 600; padding: 3px 8px;
  background: var(--bg-warm); color: var(--ink-soft);
  border-radius: 4px; display: inline-block; text-align: center;
}
.team-action {
  width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); transition: all .15s;
}
.team-action:hover { background: var(--bg-warm); color: var(--ink); }

/* Billing */
.plan-card {
  padding: 24px 28px; background: linear-gradient(135deg, #163357 0%, #1F4170 100%);
  color: white; border-radius: var(--radius-md); margin-bottom: 16px;
}
.plan-eyebrow { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.7; }
.plan-name { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 6px 0 4px; }
.plan-price { font-size: 32px; font-weight: 600; letter-spacing: -0.025em; }
.plan-price-suffix { font-size: 14px; opacity: 0.7; font-weight: 500; }
.plan-features { display: flex; gap: 24px; margin-top: 20px; flex-wrap: wrap; font-size: 13px; opacity: 0.85; }
.plan-features span { display: flex; align-items: center; gap: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .top-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .conv-list-card, .detail-card { max-height: none; }
  .headline-card { grid-template-columns: 1fr; }
  .headline-stat { border-right: none; border-bottom: 1px solid var(--line); padding: 0 0 20px; }
  .report-grid-2, .report-grid-2-eq, .subscore-row { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 8px; }
  .settings-nav-item { white-space: nowrap; }
}
@media (max-width: 720px) {
  .nav-tabs { display: none; }
  .live-pill { display: none; }
  .main { padding: 24px 18px 60px; }
  .welcome h1, .page-header h1 { font-size: 22px; }
  .score-number, .headline-value { font-size: 48px; }
  .lead { grid-template-columns: 1fr; }
  .lead-action { flex-direction: row; align-items: center; justify-content: flex-start; }
  .form-grid, .team-row { grid-template-columns: 1fr; }
  .team-row > *:not(.team-person) { display: none; }
}
