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

:root {
  --bg: #f0ece4;
  --bg-alt: #e8e3d9;
  --bg-card: #f6f3ed;
  --ink: #111;
  --ink-50: #666;
  --ink-30: #999;
  --ink-15: #c4c0b8;
  --rule: #111;
  --rule-light: #ccc8be;
  --accent: #b8320a;
  --accent-dim: #d4896e;

  --seg-dormant: #8a8680;
  --seg-dormant-bg: #e0ddd7;
  --seg-new: #5a7a4a;
  --seg-new-bg: #dde6d6;
  --seg-warming: #b07a1a;
  --seg-warming-bg: #f0e4c8;
  --seg-hot: #b8320a;
  --seg-hot-bg: #f2d8cc;
  --seg-vip: #111;
  --seg-vip-bg: #d4d0c8;

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Newsreader', Georgia, serif;
  --font-mono: 'Geist Mono', 'Courier New', monospace;
}

html { font-size: 18px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ─── LAYOUT ─── */

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── MASTHEAD ─── */

.masthead {
  border-bottom: 3px solid var(--ink);
  padding: 20px 0 16px;
  margin-bottom: 0;
}

.masthead-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.masthead h1 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.masthead h1 span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-50);
  margin-left: 14px;
  vertical-align: baseline;
  position: relative;
  top: -1px;
}

.masthead-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-50);
  letter-spacing: 0.04em;
}

/* ─── NAV ─── */

nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav button {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 14px 24px 12px;
  color: var(--ink-50);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

nav button:hover { color: var(--ink); }

nav button.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ─── STATS BAR ─── */

.stats-bar {
  display: flex;
  border-bottom: 1px solid var(--rule-light);
  padding: 14px 0;
  gap: 0;
}

.stat {
  flex: 1;
  text-align: center;
  border-right: 1px solid var(--rule-light);
}

.stat:last-child { border-right: none; }

.stat-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-value.accent { color: var(--accent); }

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-50);
  margin-top: 6px;
}

/* ─── FILTERS ─── */

.filters {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-light);
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-group label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-50);
}

.filter-group select {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--rule-light);
  padding: 6px 12px;
  color: var(--ink);
  border-radius: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.filter-group select:focus {
  outline: 1px solid var(--ink);
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-30);
  margin-left: auto;
}

/* ─── SUB NAV ─── */

.sub-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule-light);
  padding: 12px 0;
  margin-bottom: 16px;
}

.sub-nav-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 16px;
  color: var(--ink-50);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 0;
  transition: all 0.15s;
}

.sub-nav-link:hover {
  color: var(--ink);
  border-color: var(--rule-light);
}

.sub-nav-link.active {
  color: var(--ink);
  border-color: var(--rule);
  background: var(--bg-card);
}

/* ─── PAGE HEADER ─── */

.page-header {
  padding: 20px 0;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 0;
}

.page-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--ink-50);
  line-height: 1.4;
}

/* ─── DORMANT CARDS ─── */

.dormant-cards {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--rule-light);
  border: 1px solid var(--rule);
  margin-top: 16px;
}

.dormant-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  animation: fadeUp 0.25s ease both;
  border-left: 4px solid var(--seg-dormant);
}

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

.dormant-card.priority-high {
  border-left-color: var(--seg-hot);
}

.dormant-card.priority-medium {
  border-left-color: var(--seg-warming);
}

.dormant-card.priority-low {
  border-left-color: var(--seg-dormant);
}

.dormant-card-priority {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--rule-light);
  padding-right: 16px;
}

.priority-indicator {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 8px;
  border-radius: 2px;
}

.dormant-card.priority-high .priority-indicator {
  color: var(--seg-hot);
  background: var(--seg-hot-bg);
}

.dormant-card.priority-medium .priority-indicator {
  color: var(--seg-warming);
  background: var(--seg-warming-bg);
}

.dormant-card.priority-low .priority-indicator {
  color: var(--seg-dormant);
  background: var(--seg-dormant-bg);
}

.dormant-card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dormant-card-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.dormant-identity {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.dormant-avatar,
.dormant-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dormant-avatar {
  object-fit: cover;
}

.dormant-avatar-placeholder {
  background: var(--bg-alt);
  border: 1px solid var(--rule-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-50);
}

.dormant-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dormant-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dormant-name:hover {
  color: var(--accent);
}

.dormant-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.dormant-days {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  background: var(--seg-dormant-bg);
  border-radius: 4px;
}

.days-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--seg-dormant);
  line-height: 1;
}

.days-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-50);
}

.dormant-quote {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-50);
  font-style: italic;
  border-left: 3px solid var(--rule-light);
  padding-left: 12px;
}

.dormant-stats {
  display: flex;
  gap: 24px;
  padding: 8px 0;
}

.dormant-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
}

.dormant-stat-value {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
}

.dormant-stat-value.quality-high { color: var(--seg-new); }
.dormant-stat-value.quality-medium { color: var(--seg-warming); }
.dormant-stat-value.quality-low { color: var(--seg-dormant); }

.dormant-stat-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-50);
}

.dormant-card-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

.dormant-card-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 0;
  transition: all 0.15s;
}

.dormant-card-link:hover {
  background: var(--accent);
  color: #fff;
}

/* ─── TABLE ─── */

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

.leads-table th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-50);
  text-align: left;
  padding: 14px 12px 12px;
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}

.leads-table th.r { text-align: right; }
.leads-table th.c { text-align: center; }

.leads-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--rule-light);
  vertical-align: middle;
  font-size: 1rem;
}

.leads-table tr {
  cursor: pointer;
  transition: background 0.1s;
}

.leads-table tbody tr:hover { background: var(--bg-alt); }

.leads-table .rank {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-30);
  width: 40px;
  text-align: center;
}

.lead-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 44px;
  height: 44px;
  background: var(--bg-alt);
  border: 1px solid var(--rule-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-50);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lead-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.2;
}

.lead-handle {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-50);
}

.platform-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid var(--rule-light);
  color: var(--ink-50);
}

.score-cell {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.score-bar-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.score-bar {
  width: 70px;
  height: 6px;
  background: var(--rule-light);
  position: relative;
}

.score-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--ink);
  transition: width 0.3s;
}

.score-bar-fill.hot { background: var(--seg-hot); }
.score-bar-fill.vip { background: var(--seg-vip); }
.score-bar-fill.warming { background: var(--seg-warming); }
.score-bar-fill.new { background: var(--seg-new); }
.score-bar-fill.dormant { background: var(--seg-dormant); }

.segment {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  display: inline-block;
}

.segment.dormant { color: var(--seg-dormant); background: var(--seg-dormant-bg); }
.segment.new { color: var(--seg-new); background: var(--seg-new-bg); }
.segment.warming { color: var(--seg-warming); background: var(--seg-warming-bg); }
.segment.hot { color: var(--seg-hot); background: var(--seg-hot-bg); }
.segment.vip { color: var(--seg-vip); background: var(--seg-vip-bg); }

.trajectory {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  text-align: center;
}

.trajectory.up { color: var(--seg-new); }
.trajectory.down { color: var(--seg-hot); }
.trajectory.stable { color: var(--ink-30); }

.last-eng {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--ink-50);
  white-space: nowrap;
}

.actions-cell {
  text-align: right;
}

.btn-sm {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--rule-light);
  background: none;
  color: var(--ink-50);
  cursor: pointer;
  transition: all 0.1s;
}

.btn-sm:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ─── VIEW PANELS ─── */

.view { display: none; }
.view.active { display: block; }

/* ─── DETAIL VIEW ─── */

.detail-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 2px solid var(--ink);
  align-items: start;
}

.detail-identity {
  min-width: 0;
  overflow: hidden;
}

.detail-avatar {
  width: 80px;
  height: 80px;
  background: var(--bg-alt);
  border: 1px solid var(--rule-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink-50);
}

.detail-identity h2 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 400;
  line-height: 1.1;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 8px;
  align-items: center;
}

.detail-meta a {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-meta span {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-50);
}

.detail-meta a {
  color: var(--accent);
  text-decoration: none;
}

.detail-meta a:hover { text-decoration: underline; }

.detail-score-block {
  text-align: right;
}

.detail-score-num {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
}

.detail-score-sub {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  min-height: 500px;
}

.detail-main {
  border-right: 1px solid var(--rule-light);
  padding-right: 24px;
}

.detail-side {
  padding-left: 24px;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-50);
  padding: 20px 0 12px;
  border-bottom: 1px solid var(--rule-light);
  margin-bottom: 0;
}

/* sparkline */
.sparkline-wrap {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule-light);
}

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 64px;
}

.spark-bar {
  flex: 1;
  background: var(--ink-15);
  min-width: 4px;
  transition: background 0.15s;
  position: relative;
}

.spark-bar:hover { background: var(--ink); }

.spark-bar::after {
  content: attr(data-val);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-50);
  opacity: 0;
  transition: opacity 0.1s;
  white-space: nowrap;
}

.spark-bar:hover::after { opacity: 1; }

.spark-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.spark-labels span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-30);
}

/* engagement timeline */
.engagement-item {
  display: grid;
  grid-template-columns: 90px 36px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-light);
  align-items: start;
  font-size: 0.95rem;
}

.eng-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-50);
  padding-top: 2px;
}

.eng-direction {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 0;
  text-align: center;
}

.eng-direction.inbound { color: var(--seg-new); }
.eng-direction.outbound { color: var(--seg-warming); }

.eng-content {
  line-height: 1.4;
}

.eng-type {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-50);
}

.eng-text {
  color: var(--ink);
  margin-top: 4px;
  font-style: italic;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.eng-post-ctx {
  font-size: 0.88rem;
  color: var(--ink-50);
  margin-top: 4px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.eng-quality {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
  padding-top: 2px;
}

.eng-sentiment {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 8px;
}

.eng-sentiment.positive {
  background: #d4edda;
  color: #155724;
}

.eng-sentiment.negative {
  background: #f8d7da;
  color: #721c24;
}

.eng-sentiment.neutral {
  background: #e2e3e5;
  color: #383d41;
}

/* Sentiment breakdown */
.sentiment-breakdown {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
}

.sentiment-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 12px;
}

.sentiment-pill.positive {
  background: #d4edda;
  color: #155724;
}

.sentiment-pill.negative {
  background: #f8d7da;
  color: #721c24;
}

.sentiment-pill.neutral {
  background: #e2e3e5;
  color: #383d41;
}

/* LLM assessment card */
.assessment-card {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule-light);
}

.assessment-card p {
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 12px;
}

.signal-list {
  list-style: none;
  padding: 0;
  margin-bottom: 14px;
}

.signal-list li {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 6px 0;
  color: var(--ink);
  border-bottom: 1px dotted var(--rule-light);
}

.signal-list li::before {
  content: ">";
  margin-right: 8px;
  color: var(--ink-30);
}

.suggested-action {
  background: var(--seg-warming-bg);
  padding: 14px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.45;
}

.suggested-action strong {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
  color: var(--seg-warming);
}

/* dimension breakdown */
.dimension-table {
  width: 100%;
  border-collapse: collapse;
}

.dimension-table td {
  padding: 8px 0;
  border-bottom: 1px dotted var(--rule-light);
  font-size: 0.9rem;
}

.dimension-table td:first-child {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-50);
  width: 130px;
}

.dimension-table td:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
  width: 55px;
}

.dim-bar {
  height: 8px;
  background: var(--rule-light);
  flex: 1;
}

.dim-bar-inner {
  height: 100%;
  background: var(--ink);
}

.dim-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* detail actions */
.detail-actions {
  display: flex;
  gap: 8px;
  padding: 16px 0;
}

.btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s;
}

.btn:hover {
  background: var(--ink);
  color: var(--bg);
}

.btn.primary {
  background: var(--ink);
  color: var(--bg);
}

.btn.primary:hover {
  background: none;
  color: var(--ink);
}

.btn.danger {
  border-color: var(--accent);
  color: var(--accent);
}

.btn.danger:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ─── ATTENTION VIEW ─── */

.segment-section {
  margin-bottom: 36px;
}

.segment-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-light);
  margin-bottom: 16px;
}

.segment-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
}

.segment-badge.vip { background: var(--seg-vip-bg); color: var(--seg-vip); }
.segment-badge.hot { background: var(--seg-hot-bg); color: var(--seg-hot); }
.segment-badge.warming { background: var(--seg-warming-bg); color: var(--seg-warming); }
.segment-badge.new { background: var(--seg-new-bg); color: var(--seg-new); }
.segment-badge.dormant { background: var(--seg-dormant-bg); color: var(--seg-dormant); }

.segment-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-50);
}

.segment-instruction {
  font-size: 0.9rem;
  color: var(--ink-50);
  flex-basis: 100%;
  margin-top: 4px;
}

.segment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.lead-box {
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--rule-light);
  text-decoration: none;
  color: var(--ink);
  transition: all 0.15s;
  height: 120px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.lead-box:hover {
  background: var(--bg-alt);
  border-color: var(--ink-30);
}

.lead-box-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.lead-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ink-15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-50);
  overflow: hidden;
}

.lead-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lead-score {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--bg-alt);
}

.lead-score.sc-vip { background: var(--seg-vip-bg); color: var(--seg-vip); }
.lead-score.sc-hot { background: var(--seg-hot-bg); color: var(--seg-hot); }
.lead-score.sc-warming { background: var(--seg-warming-bg); color: var(--seg-warming); }
.lead-score.sc-new { background: var(--seg-new-bg); color: var(--seg-new); }
.lead-score.sc-dormant { background: var(--seg-dormant-bg); color: var(--seg-dormant); }

.lead-box .lead-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.lead-box .lead-handle {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-50);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

/* ─── SETTINGS VIEW ─── */

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.settings-panel {
  padding: 0 24px 24px 0;
  border-right: 1px solid var(--rule-light);
}

.settings-panel:nth-child(even) {
  padding: 0 0 24px 24px;
  border-right: none;
}

.settings-panel h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  padding: 22px 0 14px;
  border-bottom: 1px solid var(--rule-light);
  margin-bottom: 14px;
}

.config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dotted var(--rule-light);
}

.config-key {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--ink-50);
}

.config-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
}

.config-input {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  width: 72px;
  text-align: right;
  border: 1px solid var(--rule-light);
  padding: 4px 8px;
  background: var(--bg-card);
  border-radius: 0;
}

.config-input:focus {
  outline: 1px solid var(--ink);
  border-color: var(--ink);
}

/* ─── BACK LINK ─── */

.back-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-50);
  text-decoration: none;
  padding: 18px 0;
  display: inline-block;
  cursor: pointer;
}

.back-link:hover { color: var(--ink); }

/* ─── FOOTER ─── */

footer {
  border-top: 2px solid var(--ink);
  padding: 16px 0 40px;
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-30);
}

/* ─── ANIMATIONS ─── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.leads-table tbody tr {
  animation: fadeUp 0.25s ease both;
}

.leads-table tbody tr:nth-child(1) { animation-delay: 0.02s; }
.leads-table tbody tr:nth-child(2) { animation-delay: 0.04s; }
.leads-table tbody tr:nth-child(3) { animation-delay: 0.06s; }
.leads-table tbody tr:nth-child(4) { animation-delay: 0.08s; }
.leads-table tbody tr:nth-child(5) { animation-delay: 0.10s; }
.leads-table tbody tr:nth-child(6) { animation-delay: 0.12s; }
.leads-table tbody tr:nth-child(7) { animation-delay: 0.14s; }
.leads-table tbody tr:nth-child(8) { animation-delay: 0.16s; }
.leads-table tbody tr:nth-child(9) { animation-delay: 0.18s; }
.leads-table tbody tr:nth-child(10) { animation-delay: 0.20s; }
.leads-table tbody tr:nth-child(11) { animation-delay: 0.22s; }
.leads-table tbody tr:nth-child(12) { animation-delay: 0.24s; }

.lead-box {
  animation: fadeUp 0.2s ease both;
}

.engagement-item {
  animation: fadeUp 0.2s ease both;
}

/* score color helper */
.sc-vip { color: var(--seg-vip); }
.sc-hot { color: var(--seg-hot); }
.sc-warming { color: var(--seg-warming); }
.sc-new { color: var(--seg-new); }
.sc-dormant { color: var(--seg-dormant); }

/* crm synced indicator */
.crm-synced {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 6px;
  background: var(--seg-new-bg);
  color: var(--seg-new);
}

/* ─── POST ANALYTICS CARDS ─── */

.post-cards {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--rule-light);
  border: 1px solid var(--rule);
  margin-top: 16px;
}

.post-card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  animation: fadeUp 0.25s ease both;
  align-items: center;
}

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

.post-card-rank {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-30);
  padding-top: 2px;
}

.post-card-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  align-self: stretch;
  justify-content: center;
}

.post-card-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
  /* Clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  gap: 12px;
  align-items: center;
}

.post-card-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

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

.post-card-stats {
  display: flex;
  gap: 20px;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
}

.post-card-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 50px;
  white-space: nowrap;
}

.post-card-stat-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.post-card-stat-value.quality-high {
  color: var(--seg-new);
}

.post-card-stat-value.quality-medium {
  color: var(--seg-warming);
}

.post-card-stat-value.quality-low {
  color: var(--ink-30);
}

.post-card-stat-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-50);
  margin-top: 2px;
}

/* Responsive */
@media (max-width: 800px) {
  .post-card {
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
  }

  .post-card-stats {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 12px;
    border-top: 1px dotted var(--rule-light);
    margin-top: 8px;
  }
}

/* ─── THEME CARDS ─── */

.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.theme-card {
  background: var(--bg-card);
  border: 1px solid var(--rule-light);
  border-radius: 8px;
  padding: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeSlideIn 0.4s ease forwards;
}

.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.theme-card.effect-high {
  border-left: 4px solid var(--seg-hot);
}

.theme-card.effect-medium {
  border-left: 4px solid var(--seg-warming);
}

.theme-card.effect-low {
  border-left: 4px solid var(--seg-new);
}

.theme-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.theme-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.theme-score {
  text-align: right;
}

.theme-score .score-value {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  line-height: 1;
}

.theme-score .score-label {
  font-size: 0.75rem;
  color: var(--ink-50);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.theme-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dotted var(--rule-light);
}

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

.theme-metric .metric-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  display: block;
  line-height: 1.2;
}

.theme-metric .metric-label {
  font-size: 0.75rem;
  color: var(--ink-50);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
  display: block;
}

.theme-bar-container {
  margin-bottom: 14px;
}

.theme-bar-wrapper {
  margin-bottom: 6px;
  position: relative;
}

.theme-bar {
  height: 6px;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.theme-bar-effectiveness {
  background: var(--accent);
}

.theme-bar-quality {
  background: var(--seg-new);
}

.theme-bar-wrapper::before {
  content: attr(data-label);
  position: absolute;
  left: -70px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--ink-50);
  white-space: nowrap;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-top-post {
  background: var(--bg);
  border-radius: 6px;
  padding: 12px;
  margin-top: 12px;
}

.top-post-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-50);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.top-post-context {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 8px;
  font-style: italic;
}

.top-post-stats {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-50);
}

.top-post-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.top-post-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ─── EMPTY STATE ─── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  background: var(--bg-card);
  border: 1px solid var(--rule-light);
  border-radius: 0;
  text-align: center;
}

.empty-message {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 12px;
}

.empty-submessage {
  font-size: 1rem;
  color: var(--ink-50);
  line-height: 1.5;
  max-width: 500px;
}

/* Responsive for theme cards */
@media (max-width: 800px) {
  .themes-grid {
    grid-template-columns: 1fr;
  }

  .theme-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .theme-header {
    flex-direction: column;
    gap: 8px;
  }

  .theme-score {
    text-align: left;
  }
}
