/* ═══════════════════════════════════════════════════════════════════════════
   Telecom Tracker — Styles
   T-Mobile magenta (#E20074) as primary accent
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  --bg:          #0D1117;
  --bg2:         #161B22;
  --bg3:         #1C2128;
  --bg4:         #21262D;
  --border:      #30363D;
  --border2:     #3D444D;
  --txt:         #E6EDF3;
  --txt2:        #8B949E;
  --txt3:        #656D76;
  --green:       #3FB950;
  --green-dim:   rgba(63, 185, 80, 0.12);
  --red:         #F85149;
  --red-dim:     rgba(248, 81, 73, 0.12);
  --yellow:      #D29922;
  --yellow-dim:  rgba(210, 153, 34, 0.15);
  --blue:        #388BFD;
  --blue-dim:    rgba(56, 139, 253, 0.12);

  /* Primary accent — T-Mobile magenta (replaces blue for interactive elements) */
  --magenta:     #E20074;
  --magenta-dim: rgba(226, 0, 116, 0.12);

  /* Competitor brand */
  --tmobile:  #E20074;
  --verizon:  #CD040B;
  --att:      #009FDB;
  --mint:     #52B848;
  --usmobile: #1B1464;

  /* Platform accent */
  --ig:  #E1306C;
  --tt:  #69C9D0;
  --x:   #9CA3AF;
  --th:  #C4C4C4;
  --fb:  #1877F2;
  --yt:  #FF4040;

  --radius:  10px;
  --radius2: 6px;
  --shadow:  0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow2: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--magenta); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(226,0,116,.3); color: #fff; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 58px;
  padding: 0 24px;
  background: rgba(13, 17, 23, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  flex: 1;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 20px;
  color: var(--magenta);
  filter: drop-shadow(0 0 8px rgba(226, 0, 116, 0.6));
}

.brand-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--txt);
  letter-spacing: -0.3px;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: none;
  border: none;
  border-radius: var(--radius2);
  color: var(--txt2);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.nav-tab:hover { background: var(--bg3); color: var(--txt); }
.nav-tab.active { background: var(--bg3); color: var(--txt); }

.nav-tab .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tab-star { font-size: 12px; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.last-update {
  font-size: 12px;
  color: var(--txt3);
}

/* Status dot */
.status-dot-wrap {
  display: none;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
}
.status-dot.pulsing { animation: pulse-dot 1.2s ease-in-out infinite; }
.status-dot-label { font-size: 12px; color: var(--yellow); font-weight: 500; }

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

.btn-update {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--magenta);
  color: #fff;
  border: none;
  border-radius: var(--radius2);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-update:hover { background: #B8005D; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(226, 0, 116, 0.4); }
.btn-update:active { transform: translateY(0); }
.btn-update:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-icon { font-size: 15px; line-height: 1; }
.btn-label {}

/* ── Status bar ───────────────────────────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 11.5px;
  color: var(--txt2);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.status-bar .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: pulse-dot 2s ease infinite;
}
.status-bar .status-dot.stale { background: var(--yellow); }
.status-bar .status-dot.error { background: var(--red); }

.status-text { font-weight: 500; }
.subtitle-text {
  margin-left: auto;
  color: var(--txt3);
  font-size: 11px;
}

/* ── Alert banner ──────────────────────────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--yellow-dim);
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
}
.alert-banner.error {
  background: var(--red-dim);
  border-color: var(--red);
}
.alert-banner-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-banner-body { flex: 1; }
.alert-banner-title { font-weight: 700; margin-bottom: 2px; }
.alert-banner-detail { color: var(--txt2); font-size: 12px; }

.alert-text { flex: 1; }
.alert-close {
  background: none;
  border: none;
  color: var(--txt2);
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
  cursor: pointer;
}
.alert-close:hover { color: var(--txt); }

/* Subtle scrape error dot */
.scrape-err-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--txt3);
  opacity: 0.5;
  margin-left: 3px;
  vertical-align: middle;
  cursor: help;
  flex-shrink: 0;
}

/* ── Loading overlay ───────────────────────────────────────────────────────── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
}
.loading-overlay.visible { display: flex; }

/* ── Hosted update info overlay ────────────────────────────────────────────── */
.hosted-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(13, 17, 23, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hosted-fade-in 0.2s ease;
}
@keyframes hosted-fade-in { from { opacity: 0; } to { opacity: 1; } }

.hosted-overlay-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 40px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow);
}
.hosted-overlay-icon { font-size: 32px; margin-bottom: 12px; }
.hosted-overlay-title { font-size: 18px; font-weight: 700; color: var(--txt); margin-bottom: 8px; }
.hosted-overlay-body { font-size: 14px; color: var(--txt2); line-height: 1.5; margin-bottom: 12px; }
.hosted-overlay-body strong { color: var(--txt); font-weight: 600; }
.hosted-overlay-ts { font-size: 12px; color: var(--txt3); margin-bottom: 20px; }
.hosted-overlay-btn {
  padding: 8px 28px;
  background: var(--magenta);
  color: #fff;
  border: none;
  border-radius: var(--radius2);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.hosted-overlay-btn:hover { background: #B8005D; }

/* Hosted card (from HTML) */
.hosted-card {
  text-align: center;
  padding: 40px 48px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 90%;
  animation: fadeInUp .25s ease;
}
.hosted-icon { font-size: 40px; margin-bottom: 16px; }
.hosted-title { font-size: 18px; font-weight: 700; color: var(--txt); margin-bottom: 10px; }
.hosted-body { font-size: 13.5px; color: var(--txt2); line-height: 1.6; margin-bottom: 24px; }
.hosted-btn {
  padding: 10px 32px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--magenta);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.hosted-btn:hover { background: #B8005D; }

.loading-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 48px;
  text-align: center;
  max-width: 460px;
  width: 90%;
  box-shadow: var(--shadow);
}

.spinner, .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--magenta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.loading-subtitle { font-size: 13px; color: var(--txt2); line-height: 1.6; margin-bottom: 20px; }

.loading-passes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  margin-bottom: 20px;
}

.loading-pass {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg3);
  border-radius: var(--radius2);
  font-size: 12px;
  color: var(--txt2);
}

.lp-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  color: var(--txt3);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.3s, color 0.3s;
}

.loading-pass.active .lp-num { background: var(--magenta); color: #fff; }
.loading-pass.active .lp-label { color: var(--txt); font-weight: 500; }
.loading-pass.done .lp-num { background: color-mix(in srgb, var(--green) 20%, var(--bg3)); color: var(--green); }
.loading-pass.done .lp-label { color: var(--txt3); }

.loading-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}
.loading-platforms span {
  padding: 3px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--txt2);
  animation: pulse-fade 1.5s ease-in-out infinite;
}
.loading-platforms span:nth-child(1) { animation-delay: 0s; }
.loading-platforms span:nth-child(2) { animation-delay: 0.25s; }
.loading-platforms span:nth-child(3) { animation-delay: 0.5s; }
.loading-platforms span:nth-child(4) { animation-delay: 0.75s; }
.loading-platforms span:nth-child(5) { animation-delay: 1s; }
.loading-platforms span:nth-child(6) { animation-delay: 1.25s; }

@keyframes pulse-fade {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.loading-timer {
  font-size: 12px;
  color: var(--txt3);
  font-variant-numeric: tabular-nums;
}

/* ── Main content ──────────────────────────────────────────────────────────── */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

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

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--txt2);
}

.week-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--txt2);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}
.empty-icon { font-size: 48px; color: var(--txt3); margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { color: var(--txt2); margin-bottom: 24px; }

/* ── Competitor grid (overview) ────────────────────────────────────────────── */
.competitor-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

@media (max-width: 1200px) { .competitor-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .competitor-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .competitor-grid { grid-template-columns: 1fr; } }

/* ── Competitor overview card ──────────────────────────────────────────────── */
.comp-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeInUp 0.4s ease both;
}
.comp-card:hover {
  border-color: var(--border2);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.comp-card:nth-child(1) { animation-delay: 0s; }
.comp-card:nth-child(2) { animation-delay: 0.06s; }
.comp-card:nth-child(3) { animation-delay: 0.12s; }
.comp-card:nth-child(4) { animation-delay: 0.18s; }
.comp-card:nth-child(5) { animation-delay: 0.24s; }

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.card-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.card-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.card-total {
  text-align: right;
  flex-shrink: 0;
}

.card-total strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--txt);
  line-height: 1.2;
}

.card-total-label {
  font-size: 10px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.card-platforms { padding: 4px 0; }

.platform-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 5px 14px;
  gap: 0;
  transition: background 0.1s;
}
.platform-row:hover { background: var(--bg3); }

.platform-row-line {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.platform-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.platform-name {
  font-size: 12px;
  color: var(--txt2);
  width: 68px;
  flex-shrink: 0;
}

.platform-count {
  font-size: 12px;
  font-weight: 600;
  flex: 1;
  text-align: right;
}

.platform-flag {
  font-size: 12px;
  cursor: help;
  flex-shrink: 0;
}

.verified-ts {
  font-size: 10px;
  color: var(--txt3);
  margin-left: 2px;
}

.change {
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  min-width: 72px;
}
.change.positive { color: var(--green); }
.change.negative { color: var(--red); }
.change.neutral  { color: var(--txt3); }
.change.na       { color: var(--txt3); font-weight: 400; }
.change.pending  { color: var(--txt3); font-style: italic; font-size: 10px; }

.card-footer {
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-footer-link { font-size: 12px; color: var(--txt3); font-weight: 500; }
.card-arrow { font-size: 14px; color: var(--txt3); transition: transform 0.15s; }
.comp-card:hover .card-arrow { transform: translateX(3px); color: var(--txt2); }

/* ── Key Takeaways page ────────────────────────────────────────────────────── */
.takeaways-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) { .takeaways-grid { grid-template-columns: 1fr; } }

.takeaway-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeInUp 0.4s ease both;
}
.takeaway-card:nth-child(1) { animation-delay: 0s; }
.takeaway-card:nth-child(2) { animation-delay: 0.06s; }
.takeaway-card:nth-child(3) { animation-delay: 0.12s; }
.takeaway-card:nth-child(4) { animation-delay: 0.18s; }
.takeaway-card:nth-child(5) { animation-delay: 0.24s; }

.tk-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.tk-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.tk-name { font-size: 15px; font-weight: 700; }
.tk-meta { font-size: 11px; color: var(--txt3); margin-top: 1px; }

.tk-body { padding: 0; }

.tk-section {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.tk-section:last-child { border-bottom: none; }

.tk-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--txt3);
  margin-bottom: 8px;
}

.tk-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tk-bullet {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.tk-bullet-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--txt3);
  flex-shrink: 0;
  margin-top: 7px;
}

.tk-bullet.positive .tk-bullet-dot { background: var(--green); }
.tk-bullet.negative .tk-bullet-dot { background: var(--red); }
.tk-bullet.warn     .tk-bullet-dot { background: var(--yellow); }

.tk-news-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.tk-news-item:last-child { border-bottom: none; }

.tk-news-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--magenta);
  text-decoration: none;
  line-height: 1.4;
}
.tk-news-title:hover { text-decoration: underline; }

.tk-news-meta { font-size: 11px; color: var(--txt3); }

.tk-no-news {
  font-size: 12px;
  color: var(--txt3);
  font-style: italic;
}

.tk-alert {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: var(--yellow);
  line-height: 1.4;
}

/* ── Competitor detail page ────────────────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.detail-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  color: var(--txt2);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  flex-shrink: 0;
}
.detail-back:hover { border-color: var(--border2); color: var(--txt); background: var(--bg3); text-decoration: none; }

.detail-logo {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.detail-title { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.detail-subtitle { font-size: 13px; color: var(--txt2); margin-top: 2px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-main { display: flex; flex-direction: column; gap: 20px; }
.detail-side { display: flex; flex-direction: column; gap: 20px; }

/* ── Panels ────────────────────────────────────────────────────────────────── */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--txt2);
}

.panel-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--txt2);
}

.panel-body { padding: 20px; }

/* ── Chart ─────────────────────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 300px;
}

/* ── Stats table ───────────────────────────────────────────────────────────── */
.stats-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--txt3);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.stats-table th:not(:first-child) { text-align: right; }

.stats-table td {
  padding: 9px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.stats-table tr:last-child td { border-bottom: none; }
.stats-table td:not(:first-child) { text-align: right; }
.stats-table tr:hover td { background: var(--bg3); }

.platform-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.platform-badge {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.stat-followers { font-weight: 600; }
.stat-na { color: var(--txt3); font-weight: 400; }

/* Warning flag inline */
.flag-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}
.flag-icon.warn { color: var(--yellow); }

/* Tooltip */
.tooltip-wrap {
  position: relative;
  display: inline-block;
}
.tooltip-text {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: var(--radius2);
  padding: 8px 12px;
  font-size: 11px;
  color: var(--txt);
  white-space: nowrap;
  z-index: 10;
  box-shadow: var(--shadow2);
  pointer-events: none;
}
.tooltip-wrap:hover .tooltip-text { display: block; }

/* ── News section ──────────────────────────────────────────────────────────── */
.news-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.news-item:first-child { padding-top: 4px; }
.news-item:last-child { border-bottom: none; padding-bottom: 4px; }

.news-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--magenta);
  text-decoration: none;
  line-height: 1.4;
}
.news-title:hover { text-decoration: underline; }

.news-meta { font-size: 11px; color: var(--txt3); }

.news-snippet {
  font-size: 12px;
  color: var(--txt2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Posts section ─────────────────────────────────────────────────────────── */
.posts-platform-group { border-bottom: 1px solid var(--border); }
.posts-platform-group:last-child { border-bottom: none; }

.posts-platform-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--txt2);
  background: var(--bg3);
  border-top: 1px solid var(--border);
}

.posts-platform-title .pdot,
.pdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.posts-count-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.post-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px;
  border-top: 1px solid var(--border);
  transition: background 0.1s;
}
.post-item:hover { background: var(--bg3); }

.post-num { font-size: 11px; color: var(--txt3); width: 16px; flex-shrink: 0; }

.post-link {
  font-size: 12px;
  color: var(--magenta);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.post-link:hover { text-decoration: underline; }

.post-date { font-size: 11px; color: var(--txt3); white-space: nowrap; flex-shrink: 0; }

.no-posts {
  padding: 10px 20px;
  font-size: 12px;
  color: var(--txt3);
  font-style: italic;
}

/* ── Summary section ───────────────────────────────────────────────────────── */
.summary-content {
  font-size: 14px;
  line-height: 1.75;
  color: var(--txt);
  white-space: pre-wrap;
  word-break: break-word;
}

.summary-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--txt3);
}
.summary-source .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.summary-source.custom .dot { background: var(--magenta); }

.summary-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.btn-sm {
  padding: 6px 14px;
  border-radius: var(--radius2);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--txt);
  transition: all 0.15s;
}
.btn-sm:hover { border-color: var(--border2); background: var(--bg4); }
.btn-sm.primary { background: var(--magenta); color: #fff; border-color: var(--magenta); }
.btn-sm.primary:hover { background: #B8005D; border-color: #B8005D; }
.btn-sm.danger { color: var(--red); }
.btn-sm.danger:hover { background: var(--red-dim); border-color: var(--red); }

.summary-editor { display: none; flex-direction: column; gap: 10px; }
.summary-editor.visible { display: flex; }

.summary-textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  color: var(--txt);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.15s;
}
.summary-textarea:focus { outline: none; border-color: var(--magenta); }

.summary-editor-actions { display: flex; gap: 8px; }

/* ── Scrape log ────────────────────────────────────────────────────────────── */
.scrape-log { padding: 0; }

.log-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.4;
}
.log-item:last-child { border-bottom: none; }

.log-item.error    { background: var(--red-dim); }
.log-item.warn     { background: var(--yellow-dim); }
.log-item.ok       { background: var(--green-dim); }
.log-item.fallback { border-left-color: var(--magenta); opacity: 0.8; }
.log-item.fallback .log-icon { color: var(--magenta); }

.log-icon { flex-shrink: 0; font-size: 13px; margin-top: 1px; }
.log-label { font-weight: 600; color: var(--txt); }
.log-detail { color: var(--txt2); margin-top: 1px; }

.no-issues {
  padding: 12px 20px;
  font-size: 12px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Week nav ──────────────────────────────────────────────────────────────── */
.week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.week-nav-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  color: var(--txt2);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.week-nav-btn:hover { border-color: var(--border2); color: var(--txt); }
.week-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.week-nav-label { font-size: 12px; font-weight: 600; color: var(--txt); white-space: nowrap; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideUp 0.25s ease;
  max-width: 340px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warn    { border-left: 3px solid var(--yellow); }
.toast.info    { border-left: 3px solid var(--blue); }

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

/* ── Utility ───────────────────────────────────────────────────────────────── */
.text-muted { color: var(--txt3); }
.text-sm    { font-size: 12px; }

/* ── Mode toggle ───────────────────────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 2px;
  gap: 1px;
  flex-shrink: 0;
}

.mode-btn {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: none;
  color: var(--txt2);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.mode-btn:hover:not(.active) { color: var(--txt); }

.mode-btn.active {
  background: var(--bg4);
  color: var(--txt);
  border-color: var(--border2);
}

/* ── Social Tracker ────────────────────────────────────────────────────────── */
.social-matrix-section { margin-bottom: 20px; }

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--txt3);
  margin-bottom: 12px;
}

.social-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.social-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--txt3);
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  white-space: nowrap;
}

.social-th-plat {
  text-align: left;
  min-width: 110px;
}

.social-th-comp {
  text-align: center;
  min-width: 110px;
}

.social-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.social-table tr:last-child td { border-bottom: none; }
.social-table tr:hover td { background: var(--bg3); }

.matrix-platform {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--txt2);
  white-space: nowrap;
}

.matrix-platform .pdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.matrix-cell {
  text-align: center;
  vertical-align: middle;
}

.matrix-val {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.matrix-change {
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}

.matrix-change.positive { color: var(--green); }
.matrix-change.negative { color: var(--red); }
.matrix-change.neutral  { color: var(--txt3); }

.matrix-flag {
  font-size: 11px;
  color: var(--yellow);
  margin-left: 3px;
}

.matrix-zero .matrix-val { color: var(--txt3); font-weight: 400; }
.matrix-high .matrix-val { color: var(--green); }

.matrix-total-row td {
  background: var(--bg3);
  border-top: 2px solid var(--border2);
}

.matrix-posts-link {
  font-size: 10px;
  color: var(--magenta);
  cursor: pointer;
  margin-top: 2px;
}
.matrix-posts-link:hover { text-decoration: underline; }

.matrix-anomaly {
  background: color-mix(in srgb, var(--yellow) 8%, var(--bg2)) !important;
}

/* ── Patterns grid ─────────────────────────────────────────────────────────── */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.pattern-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.pattern-card.positive { border-left: 3px solid var(--green); }
.pattern-card.negative { border-left: 3px solid var(--red); }
.pattern-card.warn     { border-left: 3px solid var(--yellow); }

.pattern-icon { font-size: 20px; flex-shrink: 0; line-height: 1; margin-top: 1px; }

.pattern-label {
  font-size: 11px;
  color: var(--txt3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
  margin-bottom: 3px;
}

.pattern-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--txt);
  line-height: 1.4;
}

/* ── Intel Feed ────────────────────────────────────────────────────────────── */
.intel-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.intel-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--txt2);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.intel-filter-btn:hover { border-color: var(--border2); color: var(--txt); }

.intel-filter-btn.active {
  background: var(--bg4);
  color: var(--txt);
  border-color: var(--border2);
}

.intel-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.intel-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.intel-item:last-child { border-bottom: none; }
.intel-item:hover { background: var(--bg3); }

.intel-company-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--txt2);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
  min-width: 96px;
  justify-content: center;
}

.intel-content { flex: 1; min-width: 0; }

.intel-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--magenta);
  text-decoration: none;
  line-height: 1.4;
  margin-bottom: 4px;
}

.intel-title:hover { text-decoration: underline; }

.intel-meta {
  font-size: 11px;
  color: var(--txt3);
}

.intel-snippet {
  font-size: 12px;
  color: var(--txt2);
  line-height: 1.5;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Post fallback links ──────────────────────────────────────────────────── */
.post-fallback-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 4px 0;
  background: color-mix(in srgb, var(--magenta) 8%, var(--bg2));
  border: 1px solid color-mix(in srgb, var(--magenta) 20%, var(--border));
  border-radius: 8px;
  font-size: 13px;
  color: var(--magenta);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.post-fallback-link:hover {
  background: color-mix(in srgb, var(--magenta) 14%, var(--bg2));
  border-color: color-mix(in srgb, var(--magenta) 40%, var(--border));
  text-decoration: none;
}

.post-fallback-arrow {
  margin-left: auto;
  opacity: 0.6;
  font-size: 14px;
}

.post-fallback-brief {
  font-size: 11px;
  color: var(--magenta);
  text-decoration: none;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--magenta) 30%, var(--border));
  border-radius: 4px;
  margin-left: 4px;
  white-space: nowrap;
}
.post-fallback-brief:hover { text-decoration: underline; }

.matrix-fallback { opacity: 0.65; }

.matrix-fallback-link {
  display: inline-block;
  font-size: 10px;
  color: var(--magenta);
  text-decoration: none;
  margin-top: 2px;
  opacity: 0.85;
}
.matrix-fallback-link:hover { text-decoration: underline; }

/* ── Scrape Status Panel ─────────────────────────────────────────────────── */
.scrape-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  color: var(--txt2);
  user-select: none;
  transition: background 0.15s;
}
.scrape-status-bar:hover { background: var(--bg3); }

.scrape-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--txt3);
}
.scrape-dot.green  { background: var(--green); }
.scrape-dot.yellow { background: var(--yellow); }
.scrape-dot.red    { background: var(--red); }

.scrape-status-text { flex: 1; }

.scrape-expand-label {
  font-size: 11px;
  color: var(--txt3);
  margin-left: auto;
}

.scrape-status-detail {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px 16px;
  overflow-x: auto;
}

.scrape-status-table {
  border-collapse: collapse;
  font-size: 11px;
  width: 100%;
  min-width: 500px;
}
.scrape-status-table th {
  text-align: left;
  padding: 4px 10px;
  color: var(--txt3);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.scrape-status-table td {
  padding: 4px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  color: var(--txt2);
  white-space: nowrap;
}
.scrape-status-table td.ok    { color: var(--green); }
.scrape-status-table td.warn  { color: var(--yellow); }
.scrape-status-table td.error { color: var(--red); }

/* ── Scrape status panel (fixed position) ─────────────────────────────────── */
.scrape-status-panel {
  position: fixed;
  right: 20px;
  bottom: 80px;
  z-index: 500;
  width: 360px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fadeInUp .2s ease;
}

.scrape-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--txt);
}

.scrape-status-close {
  background: none;
  border: none;
  color: var(--txt2);
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
  cursor: pointer;
}
.scrape-status-close:hover { color: var(--txt); }

.scrape-status-body {
  padding: 12px 16px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--txt2);
}

/* ── Anomaly warning banners ─────────────────────────────────────────────── */
.anomaly-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 2px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--yellow) 10%, var(--bg2));
  border: 1px solid color-mix(in srgb, var(--yellow) 30%, var(--border));
  border-radius: 6px;
  font-size: 11px;
  color: var(--yellow);
}
.anomaly-banner-icon { font-size: 12px; flex-shrink: 0; }
.anomaly-banner-text { flex: 1; min-width: 0; line-height: 1.4; }
.anomaly-banner-text strong { font-weight: 600; }

.anomaly-confirm-btn, .anomaly-dismiss-btn {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.anomaly-confirm-btn:hover, .anomaly-dismiss-btn:hover { opacity: 0.8; }
.anomaly-confirm-btn {
  background: color-mix(in srgb, var(--green) 15%, transparent);
  border-color: color-mix(in srgb, var(--green) 40%, var(--border));
  color: var(--green);
}
.anomaly-dismiss-btn {
  background: color-mix(in srgb, var(--red) 15%, transparent);
  border-color: color-mix(in srgb, var(--red) 40%, var(--border));
  color: var(--red);
}

.anomaly-val { color: var(--yellow); }
.verified-small { font-size: 10px; margin-left: 2px; }
.anomaly-confirmed { color: var(--green); }
.anomaly-dismissed { color: var(--txt3); }

/* Discrepancy choice UI */
.disc-choice {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.disc-choice-btn {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--txt2);
  transition: all 0.15s;
  white-space: nowrap;
}
.disc-choice-btn:hover {
  background: var(--bg4);
  color: var(--txt);
  border-color: var(--magenta);
}
.disc-choice-label {
  font-size: 10px;
  color: var(--yellow);
  margin-top: 2px;
  display: block;
}

/* ── Platform hyperlinks ─────────────────────────────────────────────────── */
.platform-link {
  font-size: 12px;
  color: var(--txt2);
  text-decoration: none;
  width: 68px;
  flex-shrink: 0;
  display: inline-block;
  transition: color 0.12s;
}
.platform-link:hover { color: var(--magenta); text-decoration: underline; }

.platform-cell-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.platform-cell-link:hover { color: var(--magenta); }

.matrix-ext-link {
  display: inline-block;
  font-size: 9px;
  color: var(--txt3);
  text-decoration: none;
  margin-left: 3px;
  opacity: 0.7;
}
.matrix-ext-link:hover { color: var(--magenta); opacity: 1; }

/* ── Auto-update progress bar ────────────────────────────────────────────── */
.auto-update-bar {
  position: sticky;
  top: 56px;
  z-index: 89;
  height: 34px;
  background: color-mix(in srgb, var(--magenta) 8%, var(--bg));
  border-bottom: 1px solid color-mix(in srgb, var(--magenta) 25%, var(--border));
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  overflow: hidden;
}
.auto-update-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: color-mix(in srgb, var(--magenta) 15%, transparent);
  width: 0%;
  transition: width 1.5s ease;
  pointer-events: none;
}
.auto-update-icon {
  position: relative;
  font-size: 13px;
  color: var(--magenta);
  flex-shrink: 0;
  display: inline-block;
}
.auto-update-icon.spinning { animation: au-spin 1.2s linear infinite; }
@keyframes au-spin { to { transform: rotate(360deg); } }
.auto-update-text {
  position: relative;
  font-size: 12px;
  color: var(--txt2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.auto-update-dismiss {
  position: relative;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--txt3);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.auto-update-dismiss:hover { color: var(--txt2); }

/* ── Ideas to Watch ────────────────────────────────────────────────────────── */
.ideas-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ideas-type-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.ideas-count {
  font-size: 12px;
  color: var(--txt3);
  margin-bottom: 12px;
}

.ideas-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.idea-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.idea-item:last-child { border-bottom: none; }

.idea-priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.idea-item.priority-high .idea-priority-dot   { background: var(--red); }
.idea-item.priority-medium .idea-priority-dot { background: var(--yellow); }
.idea-item.priority-low .idea-priority-dot    { background: var(--txt3); }

.idea-body {
  flex: 1;
  min-width: 0;
}

.idea-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.idea-type-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.idea-type-badge.type-content  { background: var(--blue-dim); color: var(--blue); }
.idea-type-badge.type-collab   { background: color-mix(in srgb, #a855f7 15%, var(--bg3)); color: #a855f7; }
.idea-type-badge.type-product  { background: var(--green-dim); color: var(--green); }
.idea-type-badge.type-campaign { background: color-mix(in srgb, #f97316 15%, var(--bg3)); color: #f97316; }

.idea-comp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  background: var(--bg3);
  color: var(--txt2);
}

.idea-platform-tag {
  display: inline-flex;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--txt3);
}

.idea-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--txt);
}

.ideas-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--txt3);
  font-size: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Ideas panel (competitor detail side) ─────────────────────────────────── */
.idea-panel-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.idea-panel-item:last-child { border-bottom: none; }

.idea-panel-content {
  flex: 1;
  min-width: 0;
}

.idea-type-tag {
  display: inline;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-right: 6px;
}
.idea-type-tag.type-content  { color: var(--blue); }
.idea-type-tag.type-collab   { color: #a855f7; }
.idea-type-tag.type-product  { color: var(--green); }
.idea-type-tag.type-campaign { color: #f97316; }

.idea-panel-text {
  font-size: 12px;
  line-height: 1.5;
  color: var(--txt2);
}

/* ── Mobile Responsive ────────────────────────────────────────────────────── */

/* ── Tablet (≤ 768px) ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    padding: 10px 16px 6px;
    gap: 0;
  }
  .nav-left { display: contents; }
  .nav-brand { grid-column: 1; grid-row: 1; align-self: center; }
  .nav-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 8px 0 2px;
  }
  .nav-right {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    gap: 8px;
  }

  .mode-toggle { display: none; }
  .last-update { display: none; }
  .subtitle-text { display: none; }

  .main-content { padding: 20px 16px 60px; }
  .page-title { font-size: 22px; }

  .social-matrix-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .panel-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .auto-update-bar { position: relative; top: auto; }

  .takeaways-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }

  /* Social tables: ensure horizontal scroll with min-width */
  .social-table { min-width: 600px; }

  /* Scrape status panel: prevent overflow on small viewports */
  .scrape-status-panel {
    right: 8px;
    left: 8px;
    width: auto;
  }

  /* Detail header: stack week-nav on its own row when wrapping */
  .detail-header .week-nav {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  /* Summary editor actions wrap */
  .summary-editor-actions { flex-wrap: wrap; }
}

/* ── Mobile (≤ 480px) ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .navbar { padding: 8px 12px 4px; }
  .nav-tab { padding: 8px 10px; font-size: 12px; }

  .btn-label { display: none; }
  .btn-update { padding: 8px 10px; }
  .btn-icon { font-size: 16px; }

  .status-dot-label { display: none; }
  .brand-text { display: none; }

  .main-content { padding: 16px 12px 48px; }

  .page-header {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
  }
  .page-title { font-size: 20px; }
  .page-subtitle { font-size: 12px; }
  .week-badge { align-self: flex-start; }

  .competitor-grid { gap: 12px; }

  .detail-title { font-size: 18px; }
  .detail-logo { width: 36px; height: 36px; border-radius: 9px; font-size: 14px; }
  .detail-subtitle { font-size: 12px; }

  .chart-wrap { height: 220px; }

  .panel-header { padding: 10px 14px; }
  .panel-body { padding: 14px; }

  .post-item { padding: 6px 14px; }
  .posts-platform-title { padding: 8px 14px; }

  .intel-item {
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
  }
  .intel-company-chip { min-width: auto; align-self: flex-start; }

  .idea-item { padding: 12px 14px; }

  .tk-header { padding: 12px 14px; }
  .tk-section { padding: 10px 14px; }

  .log-item { padding: 8px 14px; }

  .toast { left: 12px; right: 12px; max-width: none; }

  .loading-card { padding: 28px 20px; }

  .scrape-status-bar { padding: 6px 12px; }
  .scrape-status-detail { padding: 10px 12px; }

  .alert-banner { padding: 10px 12px; }

  .intel-filter-bar, .ideas-filter-bar { padding: 10px 12px; gap: 6px; }

  /* Hide vertical divider in ideas filter bar — meaningless when wrapped */
  .ideas-type-divider { display: none; }

  /* Anomaly banners: allow text wrapping */
  .anomaly-banner { font-size: 10px; }
  .anomaly-banner-text { word-break: break-word; }

  /* Disc-choice buttons wrap tighter */
  .disc-choice { gap: 4px; }

  /* Toast full-width on mobile */
  .toast-container { right: 12px; left: 12px; }

  .hosted-overlay-card, .hosted-card { padding: 28px 24px; }

  /* Week nav: full width */
  .detail-header .week-nav {
    margin-left: 0;
    width: 100%;
  }

  /* Loading pass labels: tighter padding */
  .loading-pass { padding: 6px 10px; gap: 8px; }
  .lp-label { font-size: 11px; }
}
