/* =========================================================
   Portal panels (React-rendered section pages)

   New per-section React components that replace the v1 mockup
   HTML where the static content was hardcoded to AlphaCore.
   See components/portal/panels/*.tsx. Styles here are scoped
   to each panel's wrapper class (.seo-wrap, .reviews-wrap,
   etc.) so nothing leaks into the rest of the portal.
   ========================================================= */

/* --- Generic panel head + KPI grid (shared across panels) --- */

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 32px 0 14px;
  gap: 16px;
  flex-wrap: wrap;
}
.panel-head h2 {
  font-family: var(--font-display, serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.panel-head .panel-meta {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 8px 0 16px;
}
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Table styling shared across panels --- */

.kw-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  font-size: 13.5px;
}
.kw-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--n-50);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.kw-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  vertical-align: middle;
}
.kw-table tbody tr:last-child td { border-bottom: none; }
.kw-table tbody tr:hover td { background: var(--n-50); }
.kw-table .right, .kw-table th.right { text-align: right; }
.kw-table .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.kw-table .muted { color: var(--text-dim); }
.kw-table .kw-text { color: var(--ink); }

.pos-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0;
}
.pos-pill.top { background: color-mix(in srgb, var(--pop, #F47620) 8%, transparent); color: var(--pop, #C4540A); }
.pos-pill.mid { background: var(--blue-100); color: var(--blue-700); }
.pos-pill.low { background: var(--n-100); color: var(--text-soft); }

.change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
}
.change.up { color: var(--pop, #C4540A); background: color-mix(in srgb, var(--pop, #F47620) 8%, transparent); }
.change.down { color: var(--red-600); background: var(--red-50); }
.change.flat { color: var(--text-dim); background: var(--n-100); }

/* --- Tracked-keyword chip row --- */

.kw-chip-row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.kw-chip {
  font-size: 12.5px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 500;
}

/* --- Page list --- */

.page-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.page-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.page-row:last-child { border-bottom: none; }
.page-cell { min-width: 0; }
.page-title-text { color: var(--ink); font-weight: 500; font-size: 13.5px; }
.page-url { color: var(--text-dim); font-size: 12px; font-family: 'JetBrains Mono', monospace; margin-top: 2px; word-break: break-all; }
.page-traffic { color: var(--ink); font-weight: 600; }

/* --- Two-card "twin" grid (SERP features + backlinks) --- */

.seo-twins {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}
@media (max-width: 900px) {
  .seo-twins { grid-template-columns: 1fr; }
}
.seo-twin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.twin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 8px;
}
.twin-stat .twin-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.twin-stat .twin-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 6px;
}

/* --- Reviews panel --- */

.reviews-platforms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .reviews-platforms { grid-template-columns: 1fr; }
}
.review-platform-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.review-platform-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.review-platform-stars {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.review-platform-meta {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 6px;
}
.review-feed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 720px) {
  .review-feed { grid-template-columns: 1fr; }
}
.review-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.review-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--text-dim);
}
.review-card-author { font-weight: 600; color: var(--ink); }
.review-card-stars { color: var(--pop, #D45A0F); letter-spacing: 1px; }
.review-card-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  margin: 8px 0 0;
}
.sentiment-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--n-100);
  margin-top: 8px;
}
.sentiment-seg.pos { background: var(--pop, var(--orange-500, #F47620)); }
.sentiment-seg.neutral { background: var(--n-300, #BDBDBD); }
.sentiment-seg.neg { background: var(--red-500, #C42B1C); }
.sentiment-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}
.sentiment-legend strong { color: var(--ink); }

/* --- Competitive leaderboard --- */

.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.lb-row {
  display: grid;
  grid-template-columns: 32px 1fr 160px 80px;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.lb-row:last-child { border-bottom: none; }
.lb-row.self { background: color-mix(in srgb, var(--pop, #F47620) 8%, transparent); }
.lb-rank {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.lb-name { color: var(--ink); font-weight: 500; }
.lb-row.self .lb-name { font-weight: 700; }
.lb-row.self .lb-name::after {
  content: ' (You)';
  color: var(--pop, #C4540A);
  font-weight: 600;
  font-size: 12px;
  margin-left: 4px;
}
.lb-sov-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lb-sov-bar {
  flex: 1;
  height: 8px;
  background: var(--n-100);
  border-radius: 999px;
  overflow: hidden;
}
.lb-sov-fill {
  height: 100%;
  background: var(--pop, var(--orange-500, #F47620));
  border-radius: 999px;
}
.lb-row:not(.self) .lb-sov-fill { background: var(--blue-400, #6B9EC2); }
.lb-sov-num {
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: right;
}
.lb-mentions { text-align: right; color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .lb-row { grid-template-columns: 24px 1fr 60px; }
  .lb-sov-cell, .lb-mentions { display: none; }
}

.versus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 720px) { .versus-grid { grid-template-columns: 1fr; } }
.versus-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.versus-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--text-dim); margin: 0 0 10px; }
.versus-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.versus-list li { font-size: 13px; padding: 4px 10px; background: var(--n-50); border-radius: 999px; color: var(--ink); }

/* --- Mentions panel --- */

.mention-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mention-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
}
.mention-source {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.mention-title {
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}
.mention-title:hover { text-decoration: underline; }
.mention-snippet { font-size: 13px; color: var(--text-soft); line-height: 1.55; margin-top: 6px; }

.outlet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.outlet-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.outlet-row:last-child { border-bottom: none; }
.outlet-name { color: var(--ink); font-weight: 500; }
.outlet-meta { color: var(--text-dim); font-size: 12px; }

.ai-citations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 720px) {
  .ai-citations { grid-template-columns: 1fr; }
}
.ai-cite-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: center;
}
.ai-cite-name {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ai-cite-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: 6px;
}
.ai-cite-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* --- Brand voice radar --- */

.voice-wrap {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}
@media (max-width: 900px) { .voice-wrap { grid-template-columns: 1fr; } }
.voice-radar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.voice-score {
  font-size: 48px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 8px 0;
}
.voice-score .unit { font-size: 18px; color: var(--text-dim); font-weight: 600; }
.voice-summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
}
.voice-summary-card h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--text-dim);
  margin: 0 0 12px;
}
.voice-summary-card p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
}
.dim-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 18px;
  margin-top: 18px;
}
.dim-row {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.dim-name { color: var(--text-soft); text-transform: capitalize; }
.dim-bar { height: 6px; background: var(--n-100); border-radius: 999px; overflow: hidden; }
.dim-fill { height: 100%; background: var(--pop, var(--orange-500, #F47620)); border-radius: 999px; }
.dim-num { color: var(--ink); font-family: 'JetBrains Mono', monospace; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- PM panel --- */

.pm-projects-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pm-project {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.pm-project-head { display: flex; justify-content: space-between; align-items: baseline; }
.pm-project-name { color: var(--ink); font-weight: 600; font-size: 14.5px; }
.pm-project-status {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pm-project-bar { height: 6px; background: var(--n-100); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.pm-project-fill { height: 100%; background: var(--pop, var(--orange-500, #F47620)); }
.pm-project-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* --- Empty state hooks (PanelEmpty.tsx already inlines its own styles) --- */

.panel-empty + .panel-empty { margin-top: 12px; }

/* --- Page header (shared) --- */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.breadcrumb {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.breadcrumb .sep { margin: 0 6px; opacity: 0.5; }
.breadcrumb .cur { color: var(--ink); font-weight: 600; }
.date-range {
  display: flex;
  gap: 4px;
  background: var(--n-50);
  border-radius: 8px;
  padding: 3px;
}
.date-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
}
.date-pill.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }

/* --- Strategy panel: responsive grid --- */
@media (max-width: 900px) {
  .strategy-hero { grid-template-columns: 1fr !important; }
  .strategy-grid { grid-template-columns: 1fr !important; }
}

/* --- Competitor compare table (deep view) --- */
.comp-deep td.num {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.comp-deep tbody tr:last-child td { border-bottom: none; }
.comp-deep tbody tr:hover { background: var(--n-50, #F7F6F2); }
@media (max-width: 900px) {
  .comp-deep-charts { grid-template-columns: 1fr !important; }
}
