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

:root {
  /* Surfaces — deep dark with subtle blue undertone */
  --bg: #07080c;
  --bg-elev: #0d0f15;
  --surface: #13161f;
  --surface-2: #1c2030;
  --surface-3: #2a2f42;

  /* Text scale */
  --text: #f5f6fa;
  --text-mid: #a3aab9;
  --text-dim: #6b7280;

  /* Borders */
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
  --border-focus: rgba(255,0,51,0.55);

  /* Accents */
  --red: #ff1744;
  --red-hover: #ff3860;
  --red-glow: rgba(255,23,68,0.45);
  --red-soft: rgba(255,23,68,0.14);
  --red-border: rgba(255,23,68,0.35);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34,211,238,0.14);
  --cyan-border: rgba(34,211,238,0.35);
  --green: #22c55e;
  --green-soft: rgba(34,197,94,0.15);
  --green-border: rgba(34,197,94,0.38);
  --yellow: #f59e0b;
  --yellow-soft: rgba(245,158,11,0.14);
  --yellow-border: rgba(245,158,11,0.36);
  --purple: #a78bfa;
  --purple-soft: rgba(167,139,250,0.14);
  --purple-border: rgba(167,139,250,0.38);

  /* Radii */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  /* Shadows — deep for dark mode */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 6px 20px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 18px 48px rgba(0,0,0,0.55), 0 4px 8px rgba(0,0,0,0.35);
  --glow-red: 0 0 24px rgba(255,23,68,0.35);

  /* Gradients */
  --grad-red: linear-gradient(135deg, #ff1744 0%, #e10035 100%);
  --grad-red-hover: linear-gradient(135deg, #ff3860 0%, #ff1744 100%);
  --grad-surface: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 200ms;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1100px 600px at 0% -10%, rgba(255,23,68,0.08), transparent 60%),
    radial-gradient(900px 500px at 100% -20%, rgba(34,211,238,0.05), transparent 60%),
    radial-gradient(800px 500px at 50% 120%, rgba(167,139,250,0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

.num, .kpi-value, .comp-stat-val, .comp-metric-val { font-variant-numeric: tabular-nums; }

/* ── Top nav ────────────────────────────────────────────────────────────── */
.topnav {
  background: rgba(13,15,21,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}
.topnav-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 54px;
}
.topnav-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 0.93rem;
  color: var(--text);
  letter-spacing: -0.015em;
  flex-shrink: 0;
  text-decoration: none;
}
.topnav-logo:hover { color: var(--text); }

.topnav-links { display: flex; gap: 2px; }
.topnav-link {
  color: var(--text-mid);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.topnav-link:hover { color: var(--text); background: var(--surface-2); }
.topnav-link.active {
  color: var(--text);
  background: var(--red-soft);
  box-shadow: inset 0 0 0 1px var(--red-border);
}

/* ── Hero header (channel banner) ───────────────────────────────────────── */
.header {
  position: relative;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  overflow: hidden;
}
.header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(700px 240px at 20% 0%, rgba(255,23,68,0.10), transparent 60%),
    radial-gradient(700px 240px at 90% 100%, rgba(34,211,238,0.08), transparent 60%);
  pointer-events: none;
}
.header-inner {
  position: relative;
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.channel-info {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.channel-avatar-wrap img,
.channel-avatar-wrap .avatar-skeleton {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}
.channel-meta { min-width: 0; }
.channel-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.channel-sub {
  font-size: 0.83rem;
  color: var(--text-mid);
  margin-top: 4px;
}

.header-actions { display: flex; gap: 10px; }

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 550;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform 150ms var(--ease),
              box-shadow var(--dur) var(--ease);
}
.btn-refresh:hover {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: #ff7a90;
  box-shadow: var(--shadow), var(--glow-red);
  transform: translateY(-1px);
}
.btn-refresh:active { transform: translateY(0); }
.btn-refresh:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.btn-refresh:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-refresh svg { flex-shrink: 0; }

/* ── Main ───────────────────────────────────────────────────────────────── */
.main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 32px 28px 72px;
}
.section { margin-bottom: 40px; }
.section:last-child { margin-bottom: 0; }

.section-title {
  font-size: 1.1rem;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.015em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: "";
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--red);
}
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.section-title-row .section-title { margin-bottom: 0; }

/* ── KPI grid ───────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  overflow: hidden;
}
.kpi-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--kpi-accent, var(--border-strong));
  opacity: 0.9;
}
.kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.kpi-card.skeleton-card { min-height: 94px; }

.kpi-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.kpi-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--kpi-accent-soft, var(--surface-2));
  color: var(--kpi-accent, var(--text-mid));
  flex-shrink: 0;
}
.kpi-icon svg { width: 14px; height: 14px; }
.kpi-label {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-mid);
  letter-spacing: 0.005em;
}
.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.kpi-sub {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.kpi-accent-red    { --kpi-accent: var(--red);    --kpi-accent-soft: var(--red-soft); }
.kpi-accent-cyan   { --kpi-accent: var(--cyan);   --kpi-accent-soft: var(--cyan-soft); }
.kpi-accent-green  { --kpi-accent: var(--green);  --kpi-accent-soft: var(--green-soft); }
.kpi-accent-yellow { --kpi-accent: var(--yellow); --kpi-accent-soft: var(--yellow-soft); }
.kpi-accent-purple { --kpi-accent: var(--purple); --kpi-accent-soft: var(--purple-soft); }

/* ── Chart grids ────────────────────────────────────────────────────────── */
.charts-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.charts-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 1000px) {
  .charts-grid-2, .charts-grid-3 { grid-template-columns: 1fr; }
}

.chart-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.chart-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.chart-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.chart-title {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}
.chart-sub {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.chart-wrap    { position: relative; height: 300px; }
.chart-wrap-sm { position: relative; height: 240px; }
.chart-wrap-xs { position: relative; height: 170px; }

/* Compact comparison-charts grid on Competitors page */
.charts-compact .chart-card { padding: 12px 14px; }
.charts-compact .chart-card-header { margin-bottom: 8px; }
.charts-compact .chart-title { font-size: 0.82rem; font-weight: 600; }

.charts-fold {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
}
.charts-fold-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.charts-fold-summary::-webkit-details-marker { display: none; }
.charts-fold-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--text-dim);
  font-size: 0.85rem;
  transition: transform var(--dur) var(--ease);
}
[dir="rtl"] .charts-fold-summary::before { margin-right: 0; margin-left: 8px; }
.charts-fold[open] .charts-fold-summary::before { transform: rotate(90deg); }
.charts-fold[open] .charts-grid-3.charts-compact { margin-top: 14px; }
.charts-fold-hint { font-size: 0.78rem; color: var(--text-dim); }
@media (max-width: 1100px) {
  .charts-grid-3.charts-compact { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .charts-grid-3.charts-compact { grid-template-columns: 1fr; }
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.search-input, .sort-select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus,
.sort-select:focus {
  border-color: var(--red-border);
  box-shadow: 0 0 0 3px var(--red-soft);
}
.search-input { min-width: 220px; }

.sort-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a3aab9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.video-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.video-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
}
.video-table thead tr { border-bottom: 1px solid var(--border-strong); }
.video-table th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mid);
  white-space: nowrap;
}
.video-table th.num { text-align: right; }
.video-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.video-table td.num { text-align: right; }
.video-table tr:last-child td { border-bottom: none; }
.video-table tbody tr { transition: background var(--dur) var(--ease); }
.video-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
.video-table tbody tr:hover td { background: var(--surface-2); }

.video-cell { display: flex; align-items: center; gap: 10px; }
.video-thumb {
  width: 68px; height: 38px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.video-title-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 340px;
  transition: color var(--dur) var(--ease);
}
.video-title-link:hover { color: var(--cyan); }
.video-title-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 2px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}
.badge-short { background: var(--red-soft);  color: var(--red);  border-color: var(--red-border); }
.badge-long  { background: var(--cyan-soft); color: var(--cyan); border-color: var(--cyan-border); }

.engagement-bar-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  min-width: 110px;
}
.engagement-bar {
  width: 54px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.engagement-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  border-radius: 2px;
  transition: width 0.4s var(--ease);
}

.loading-cell {
  text-align: center;
  color: var(--text-mid);
  padding: 32px;
}

/* ── Skeleton ───────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { display: block; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.avatar-skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}

/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--surface-3);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 0.84rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  z-index: 9999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Competitor page header ─────────────────────────────────────────────── */
.comp-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin: 8px 0 28px;
}
.comp-page-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}
.comp-page-sub {
  font-size: 0.88rem;
  color: var(--text-mid);
  margin-top: 4px;
}

.btn-add-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--grad-red);
  border: none;
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(255,23,68,0.32), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 150ms var(--ease),
              box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.btn-add-open:hover {
  background: var(--grad-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(255,23,68,0.42), inset 0 1px 0 rgba(255,255,255,0.22);
}
.btn-add-open:active { transform: translateY(0); }
.btn-add-open:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* ── Add panel ──────────────────────────────────────────────────────────── */
.add-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  animation: slideDown 0.2s var(--ease);
  overflow: hidden;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.add-panel-inner { padding: 20px 24px; }
.add-panel-title { font-size: 1rem; font-weight: 650; margin-bottom: 4px; letter-spacing: -0.015em; }
.add-panel-sub   { font-size: 0.82rem; color: var(--text-mid); margin-bottom: 14px; }

.add-form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.add-input {
  flex: 1;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.add-input::placeholder { color: var(--text-dim); }
.add-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-soft);
}

.btn-resolve {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn-resolve:hover:not(:disabled) {
  border-color: var(--cyan);
  color: var(--cyan);
  background: var(--cyan-soft);
}
.btn-resolve:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-resolve:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.add-preview {
  margin-top: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.add-preview-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.add-preview-meta  { flex: 1; min-width: 140px; }
.add-preview-name  { font-weight: 650; font-size: 0.92rem; }
.add-preview-stats { font-size: 0.78rem; color: var(--text-mid); margin-top: 3px; }

.btn-confirm-add {
  background: linear-gradient(135deg, #22c55e 0%, #15a34a 100%);
  border: none;
  color: #ffffff;
  padding: 10px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(34,197,94,0.28), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: opacity var(--dur) var(--ease),
              transform 150ms var(--ease),
              box-shadow var(--dur) var(--ease);
}
.btn-confirm-add:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(34,197,94,0.4), inset 0 1px 0 rgba(255,255,255,0.22);
}
.btn-confirm-add:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-confirm-add:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.add-error {
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}

/* ── Competitor cards grid ──────────────────────────────────────────────── */
.comp-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.comp-empty, .comp-error {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-mid);
  padding: 40px 20px;
  font-size: 0.88rem;
}
.comp-error { color: var(--red); }

.comp-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  overflow: hidden;
}
.comp-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent, var(--border-strong));
  opacity: 0.9;
}
.comp-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.comp-card-own {
  background:
    linear-gradient(180deg, rgba(255,23,68,0.10), transparent 50%),
    var(--surface);
  border-color: var(--red-border);
}
.comp-card-error { opacity: 0.55; }

.comp-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.comp-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.comp-avatar-placeholder {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  flex-shrink: 0;
}
.comp-avatar-sm {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.comp-card-meta { flex: 1; min-width: 0; }
.comp-card-name {
  font-weight: 650;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.comp-card-name a { color: var(--text); text-decoration: none; transition: color var(--dur) var(--ease); }
.comp-card-name a:hover { color: var(--cyan); }
.comp-card-country {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn-remove:hover { color: var(--red); background: var(--red-soft); }
.btn-remove:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }

.badge-own {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid var(--red-border);
  flex-shrink: 0;
}

.comp-stat-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.comp-stat { flex: 1; min-width: 0; }
.comp-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 3px;
}
.comp-stat-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.comp-mini-bar {
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.comp-mini-fill {
  height: 100%;
  background: var(--accent, var(--cyan));
  border-radius: 2px;
  transition: width 0.5s var(--ease);
}

.comp-metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.comp-metric { display: flex; flex-direction: column; gap: 2px; }
.comp-metric-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.comp-metric-val {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Comparison table extras ────────────────────────────────────────────── */
.comp-table-channel {
  display: flex;
  align-items: center;
  gap: 8px;
}
.comp-table-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
}
.comp-table-thumb {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.cell-best {
  color: var(--green) !important;
  font-weight: 700;
}

/* ── Recent per channel ─────────────────────────────────────────────────── */
.recent-channel-block { margin-bottom: 28px; }
.recent-channel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.recent-channel-name { font-weight: 650; font-size: 0.94rem; }

/* ── Planning page ──────────────────────────────────────────────────────── */
.week-nav {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.week-nav-title { display: flex; flex-direction: column; gap: 4px; }
.week-nav-title .section-title { margin-bottom: 0; }
.week-nav-sub {
  font-size: 0.95rem;
  color: var(--text-mid);
  font-weight: 500;
}
.week-nav-actions {
  display: flex;
  gap: 8px;
}
.btn-week {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              transform 150ms var(--ease),
              box-shadow var(--dur) var(--ease);
}
.btn-week:hover {
  background: var(--surface-2);
  border-color: var(--red-border);
  color: #ff7a90;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn-week:active { transform: translateY(0); }

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.day-card {
  position: relative;
  background: var(--surface);
  background-image: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 160px;
  transition: border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  overflow: hidden;
}
.day-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.day-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.day-card.is-today {
  border-color: var(--red-border);
  box-shadow: 0 0 0 1px var(--red-border), var(--glow-red);
}
.day-card.is-ready { border-color: var(--green-border); }
.day-card.is-ready.is-today { border-color: var(--red-border); }
.day-card.skeleton-card { min-height: 160px; }
.day-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.day-name {
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--text);
}
.day-date {
  font-size: 0.85rem;
  color: var(--text-mid);
}
.day-status { margin-top: -4px; }
.badge-ready {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--green-soft);
  color: #4ade80;
  border: 1px solid var(--green-border);
  font-weight: 600;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge-empty {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 999px;
}
.day-action { margin-top: auto; }
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--grad-red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 0.87rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255,23,68,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 150ms var(--ease),
              box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.btn-download:hover {
  background: var(--grad-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255,23,68,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-download:active { transform: translateY(0); }
.day-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.planning-hint {
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--text-mid);
}
.planning-hint code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.82rem;
}

/* ── Mijn Overview mini-row (index.html) ────────────────────────────────── */
.section-sub {
  font-size: 0.9rem;
  color: var(--text-mid);
  font-weight: 500;
}
.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 550;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.link-pill:hover {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: #ff7a90;
}

.mini-day-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 760px) {
  .mini-day-row {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow-x: auto;
  }
}
.mini-day {
  position: relative;
  background: var(--surface);
  background-image: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 92px;
  transition: border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.mini-day:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.mini-day.is-today {
  border-color: var(--red-border);
  box-shadow: 0 0 0 1px var(--red-border), 0 0 16px rgba(255,23,68,0.2);
}
.mini-day.is-ready { border-color: var(--green-border); }
.mini-day.is-ready.is-today { border-color: var(--red-border); }
.mini-day.skeleton-card { min-height: 92px; }
.mini-day-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}
.mini-day-name {
  font-weight: 650;
  font-size: 0.8rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mini-day-date {
  font-size: 0.75rem;
  color: var(--text-mid);
}
.mini-day-bottom { display: flex; align-items: center; }
.mini-day-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--grad-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,23,68,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 150ms var(--ease), box-shadow var(--dur) var(--ease);
}
.mini-day-btn:hover {
  background: var(--grad-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255,23,68,0.4), inset 0 1px 0 rgba(255,255,255,0.22);
}
.mini-day-btn:active { transform: translateY(0); }
.mini-day-dash {
  color: var(--text-dim);
  font-size: 0.95rem;
}
.error-cell {
  padding: 16px;
  background: var(--red-soft);
  color: #ff7a90;
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

[hidden] { display: none !important; }

/* ── New layout primitives ──────────────────────────────────────────────── */
.topnav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Language switcher ────────────────────────────────────────────────── */
.lang-switcher {
  position: relative;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-mid);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.lang-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.lang-btn-label { font-weight: 700; }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              visibility var(--dur) var(--ease);
  z-index: 300;
}
[dir="rtl"] .lang-menu { right: auto; left: 0; }
.lang-switcher.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.lang-option {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
[dir="rtl"] .lang-option { text-align: right; }
.lang-option:hover { background: var(--surface-2); }
.lang-option.active {
  background: var(--red-soft);
  color: #ff7a90;
}

/* ── Urdu (RTL) adjustments ───────────────────────────────────────────── */
html[lang="ur"] body,
html[lang="ur"] .channel-name,
html[lang="ur"] .page-title,
html[lang="ur"] .hero-day-name {
  font-family: 'Noto Nastaliq Urdu', 'Inter', system-ui, sans-serif;
  line-height: 1.9;
}
html[lang="ur"] .kpi-value,
html[lang="ur"] .stat-pill-num,
html[lang="ur"] .num,
html[lang="ur"] code {
  font-family: 'Inter', system-ui, sans-serif;
}
[dir="rtl"] .topnav-right { margin-left: 0; margin-right: auto; }
[dir="rtl"] .section-title::before {
  margin-right: 0;
  margin-left: 10px;
}
[dir="rtl"] .eyebrow,
[dir="rtl"] .hero-chip {
  letter-spacing: 0;
}
[dir="rtl"] .hero-card-inner.is-ready {
  background:
    radial-gradient(900px 240px at 100% 0%, rgba(255,23,68,0.18), transparent 60%),
    radial-gradient(700px 240px at 0% 100%, rgba(34,197,94,0.10), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg-elev) 100%);
}
[dir="rtl"] .hero-card-inner {
  background:
    radial-gradient(800px 200px at 100% 0%, rgba(255,23,68,0.12), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg-elev) 100%);
}
[dir="rtl"] .day-grid,
[dir="rtl"] .mini-day-row {
  direction: rtl;
}
[dir="rtl"] .hero-meta-sep { display: inline; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-mid);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              transform 150ms var(--ease);
}
.icon-btn:hover {
  background: var(--surface-2);
  color: #ff7a90;
  border-color: var(--red-border);
  transform: translateY(-1px);
}
.icon-btn:active { transform: translateY(0); }

.eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--red);
  margin-bottom: 6px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 28px 0 24px;
}
.page-header .channel-info { gap: 18px; }
.page-header .channel-avatar-wrap img,
.page-header .channel-avatar-wrap .avatar-skeleton {
  width: 56px;
  height: 56px;
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.page-header .channel-name { font-size: 1.5rem; }

.page-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.15;
}
.page-sub {
  font-size: 0.92rem;
  color: var(--text-mid);
  margin-top: 4px;
}

.section-tight { margin-bottom: 32px; }
.section-title-lg {
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}
.section-title-lg::before { height: 22px; width: 4px; }

/* ── Hero card (planning + overview) ───────────────────────────────────── */
.overview-hero,
.hero-card {
  margin-bottom: 14px;
}
.hero-card-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 28px 32px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(800px 200px at 0% 0%, rgba(255,23,68,0.12), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-card-inner.is-ready {
  background:
    radial-gradient(900px 240px at 0% 0%, rgba(255,23,68,0.18), transparent 60%),
    radial-gradient(700px 240px at 100% 100%, rgba(34,197,94,0.10), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg-elev) 100%);
  border-color: var(--red-border);
  box-shadow: var(--shadow), var(--glow-red);
}
.hero-card-inner.is-empty {
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--bg-elev) 100%);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.hero-card-content { flex: 1; min-width: 280px; }
.hero-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.hero-card-inner.is-empty .hero-chip {
  color: var(--text-dim);
  background: var(--surface-2);
  border-color: var(--border);
}
.hero-day-name {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 8px;
  text-transform: capitalize;
}
.hero-status {
  font-size: 0.95rem;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-status code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text);
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.hero-meta-item strong { color: var(--text-mid); }
.hero-meta-sep { opacity: 0.5; }
.hero-card-action { flex-shrink: 0; }
.hero-skeleton { border-radius: var(--radius-lg); overflow: hidden; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green { background: #22c55e; box-shadow: 0 0 10px rgba(34,197,94,0.6); }
.dot-dim { background: var(--surface-3); }
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ── Primary / secondary buttons (new generation) ──────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--grad-red);
  color: #fff;
  border: none;
  text-decoration: none;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255,23,68,0.32), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 150ms var(--ease),
              box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.btn-primary:hover {
  background: var(--grad-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(255,23,68,0.42), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  text-decoration: none;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              transform 150ms var(--ease);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--red-border);
  color: #ff7a90;
  transform: translateY(-1px);
}
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-lg {
  padding: 14px 24px;
  font-size: 0.98rem;
  border-radius: 14px;
}

.btn-soft {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  color: var(--text-mid);
  border: 1px solid var(--border);
  text-decoration: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  border-radius: 8px;
  padding: 6px 11px;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.btn-soft-red:hover {
  background: var(--red-soft);
  color: #ff7a90;
  border-color: var(--red-border);
}

.link-toggle {
  background: none;
  border: none;
  color: var(--text-mid);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 550;
  cursor: pointer;
  padding: 6px 0;
  transition: color var(--dur) var(--ease);
}
.link-toggle:hover { color: #ff7a90; }

/* ── KPI grid 4-column tighter ─────────────────────────────────────────── */
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .kpi-grid-4 { grid-template-columns: 1fr; } }
.kpi-grid-extra { margin-top: 12px; }

/* ── Tabs (analytics) ──────────────────────────────────────────────────── */
.tab-bar {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  gap: 2px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-mid);
  font-family: inherit;
  font-weight: 550;
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  background: var(--red-soft);
  color: #ff7a90;
  box-shadow: inset 0 0 0 1px var(--red-border);
}
.tab-panel { animation: fadeIn 0.2s var(--ease); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Segmented bar (videos) ────────────────────────────────────────────── */
.seg-bar {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-mid);
  font-family: inherit;
  font-weight: 550;
  font-size: 0.82rem;
  padding: 6px 13px;
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--surface-2);
  color: var(--text);
}

/* ── Stat pill (planning header) ───────────────────────────────────────── */
.planning-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 28px 0 24px;
}
.planning-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.stat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 16px;
}
.stat-pill-num {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.stat-pill-label {
  font-size: 0.82rem;
  color: var(--text-mid);
}

/* ── New day-card v2 (planning grid) ───────────────────────────────────── */
.day-card-v2 {
  position: relative;
  background: var(--surface);
  background-image: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  min-height: 130px;
  transition: border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.day-card-v2:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.day-card-v2.is-ready { border-color: var(--green-border); }
.day-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.day-card-meta { display: flex; flex-direction: column; gap: 2px; }
.day-card-name {
  font-weight: 650;
  font-size: 1rem;
  color: var(--text);
  text-transform: capitalize;
}
.day-card-date {
  font-size: 0.8rem;
  color: var(--text-mid);
}
.day-card-bottom { display: flex; align-items: center; }
.day-card-empty {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ── Mini day row v2 (overview) ───────────────────────────────────────── */
.mini-day-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 760px) {
  .mini-day-row {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow-x: auto;
  }
}
.mini-day {
  position: relative;
  background: var(--surface);
  background-image: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 90px;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.mini-day:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.mini-day.is-today {
  border-color: var(--red-border);
  box-shadow: 0 0 0 1px var(--red-border), 0 0 18px rgba(255,23,68,0.22);
}
.mini-day.is-ready { border-color: var(--green-border); }
.mini-day.is-today.is-ready { border-color: var(--red-border); }
.mini-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.mini-day-name {
  font-weight: 650;
  font-size: 0.78rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mini-day-date {
  font-size: 0.78rem;
  color: var(--text-mid);
}
.mini-day-cta {
  margin-top: auto;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mini-day.is-ready .mini-day-cta { color: #ff7a90; }
.mini-day.is-empty .mini-day-cta { color: var(--text-dim); }

/* ── Planning help (collapsible) ──────────────────────────────────────── */
.planning-help {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.planning-help summary {
  cursor: pointer;
  font-weight: 550;
  font-size: 0.88rem;
  color: var(--text-mid);
  user-select: none;
  list-style: none;
}
.planning-help summary::-webkit-details-marker { display: none; }
.planning-help summary::before {
  content: "›";
  display: inline-block;
  margin-right: 8px;
  transition: transform var(--dur) var(--ease);
}
.planning-help[open] summary::before { transform: rotate(90deg); }
.planning-help p {
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--text-mid);
  line-height: 1.6;
}
.planning-help code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.8rem;
  color: var(--text);
}

/* ── Performance badge (table cells) ──────────────────────────────────── */
.cell-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  line-height: 1.15;
}
.perf-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 650;
  padding: 1px 6px;
  border-radius: 5px;
  white-space: nowrap;
}
.perf-strong { background: var(--green-soft); color: #4ade80; border: 1px solid var(--green-border); }
.perf-ok     { background: var(--surface-2); color: var(--text-mid); border: 1px solid var(--border); }
.perf-weak   { background: var(--yellow-soft); color: var(--yellow); border: 1px solid var(--yellow-border); }
.perf-bad    { background: var(--red-soft); color: #ff7a90; border: 1px solid var(--red-border); }

.cell-eng-high { background: rgba(34,197,94,0.06) !important; }
.cell-eng-low  { background: rgba(255,23,68,0.06) !important; }

/* ── Row action icon ─────────────────────────────────────────────────── */
.action-col { width: 40px; padding-left: 4px !important; padding-right: 12px !important; }
.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.row-action:hover {
  background: var(--red-soft);
  color: #ff7a90;
  border-color: var(--red-border);
}

/* ── Folder warning banner ───────────────────────────────────────────── */
.folder-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--yellow-soft);
  border: 1px solid var(--yellow-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.folder-warning-icon {
  color: var(--yellow);
  display: flex;
  align-items: center;
  padding-top: 1px;
  flex-shrink: 0;
}
.folder-warning-body { flex: 1; min-width: 0; }
.folder-warning-title {
  font-weight: 650;
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 3px;
}
.folder-warning-sub {
  font-size: 0.82rem;
  color: var(--text-mid);
  line-height: 1.5;
}
.folder-warning-sub code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--text);
  font-size: 0.78rem;
}

/* ── Insights ─────────────────────────────────────────────────────────── */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.insight-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  background-image: var(--grad-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--surface-3);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.insight-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.insight-card.insight-positive { border-left-color: var(--green); }
.insight-card.insight-negative { border-left-color: var(--red); }
.insight-card.insight-warning  { border-left-color: var(--yellow); }
.insight-card.insight-neutral  { border-left-color: var(--cyan); }
[dir="rtl"] .insight-card { border-left: 1px solid var(--border); border-right: 3px solid var(--surface-3); }
[dir="rtl"] .insight-card.insight-positive { border-right-color: var(--green); }
[dir="rtl"] .insight-card.insight-negative { border-right-color: var(--red); }
[dir="rtl"] .insight-card.insight-warning  { border-right-color: var(--yellow); }
[dir="rtl"] .insight-card.insight-neutral  { border-right-color: var(--cyan); }

.insight-thumb {
  width: 64px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.insight-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--text-mid);
}
.insight-body { flex: 1; min-width: 0; }
.insight-title {
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mid);
  margin-bottom: 3px;
}
.insight-video {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insight-stats {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 5px;
  font-size: 0.82rem;
}
.insight-metric { font-weight: 700; color: var(--text); }
.insight-delta {
  font-weight: 650;
  font-size: 0.78rem;
}
.insight-delta.positive { color: #4ade80; }
.insight-delta.negative { color: #ff7a90; }
.insight-delta.neutral  { color: var(--text-mid); }
.insight-sub { color: var(--text-dim); font-size: 0.78rem; }
.insight-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-mid);
  flex-shrink: 0;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.insight-action:hover {
  background: var(--red-soft);
  color: #ff7a90;
  border-color: var(--red-border);
}

/* ── KPI trend delta ──────────────────────────────────────────────────── */
.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 6px;
  line-height: 1.4;
}
.kpi-delta-up {
  color: #4ade80;
  background: var(--green-soft);
}
.kpi-delta-down {
  color: #ff7a90;
  background: var(--red-soft);
}
.kpi-delta-flat {
  color: var(--text-mid);
  background: var(--surface-2);
}

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.modal-backdrop.show { opacity: 1; }
body.modal-open { overflow: hidden; }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
  transform: translateY(10px) scale(0.98);
  transition: transform var(--dur) var(--ease);
}
.modal-backdrop.show .modal { transform: translateY(0) scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.modal-close { width: 32px; height: 32px; }
.modal-sub {
  font-size: 0.85rem;
  color: var(--text-mid);
  margin-bottom: 20px;
  text-transform: capitalize;
}
.modal-form { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-mid);
  margin-top: 12px;
  margin-bottom: 4px;
}
.form-label:first-of-type { margin-top: 0; }
.form-input,
.form-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 14px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  resize: vertical;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-dim); }
.form-input:focus,
.form-textarea:focus {
  border-color: var(--red-border);
  box-shadow: 0 0 0 3px var(--red-soft);
}
.form-hint {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}

/* ── Status picker ────────────────────────────────────────────────────── */
.status-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.status-opt {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-mid);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 550;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.status-opt:hover { background: var(--surface-2); color: var(--text); }
.status-opt.active[data-status="pending"] {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.status-opt.active[data-status="in_progress"] {
  background: var(--yellow-soft);
  border-color: var(--yellow-border);
  color: var(--yellow);
}
.status-opt.active[data-status="finished"] {
  background: var(--green-soft);
  border-color: var(--green-border);
  color: var(--green);
}

/* ── Status badges ────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  vertical-align: middle;
  margin-left: 8px;
}
[dir="rtl"] .status-badge { margin-left: 0; margin-right: 8px; }
.status-badge.status-in_progress {
  background: var(--yellow-soft);
  color: var(--yellow);
  border-color: var(--yellow-border);
}
.status-badge.status-finished {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green-border);
}

/* ── New button variants ──────────────────────────────────────────────── */
.hero-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  min-width: 180px;
}
[dir="rtl"] .hero-actions-stack { align-items: flex-start; }
.btn-soft-green {
  color: #4ade80;
}
.btn-soft-green:hover {
  background: var(--green-soft);
  color: #4ade80;
  border-color: var(--green-border);
}
.btn-soft-neutral:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-action {
  align-self: stretch;
  justify-content: center;
}

/* Hero note + day-card note */
.hero-note {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--red-border);
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-mid);
  font-style: italic;
  max-width: 520px;
}
[dir="rtl"] .hero-note { border-left: none; border-right: 3px solid var(--red-border); }
.day-card-note {
  font-size: 0.8rem;
  color: var(--text-mid);
  font-style: italic;
  line-height: 1.4;
  margin: 2px 0 0;
}
.day-card-v2.is-finished {
  border-color: var(--green-border);
  background:
    linear-gradient(180deg, rgba(34,197,94,0.05) 0%, rgba(34,197,94,0) 40%),
    var(--surface);
}
.mini-day.is-finished {
  border-color: var(--green-border);
  background:
    linear-gradient(180deg, rgba(34,197,94,0.08) 0%, rgba(34,197,94,0) 50%),
    var(--surface);
}
.mini-day.is-finished .mini-day-cta { color: #4ade80; }

/* ── Progress bar (planning) ─────────────────────────────────────────── */
.progress-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.progress-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 160px;
}
.progress-label {
  font-weight: 650;
  font-size: 0.92rem;
  color: var(--text);
}
.progress-count {
  font-size: 0.82rem;
  color: var(--text-mid);
}
.progress-bar {
  flex: 1;
  min-width: 120px;
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--grad-red);
  border-radius: 4px;
  transition: width 0.6s var(--ease);
  min-width: 2px;
}

/* ── Last updated indicator ──────────────────────────────────────────── */
.last-updated {
  font-size: 0.74rem;
  color: var(--text-dim);
  white-space: nowrap;
  margin-left: auto;
}
[dir="rtl"] .last-updated { margin-left: 0; margin-right: auto; }

/* ── ZIP download button ─────────────────────────────────────────────── */
.btn-zip {
  padding: 9px 16px;
  font-size: 0.85rem;
  gap: 7px;
}
.btn-zip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── KPI benchmark sub-line ──────────────────────────────────────────── */
.kpi-bench {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
  font-style: italic;
}

/* ── Mobile optimization ─────────────────────────────────────────────── */
@media (max-width: 760px) {
  /* Smaller main padding */
  .main { padding: 20px 16px 60px; }

  /* Hero card stacks vertically */
  .hero-card-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    gap: 16px;
  }
  .hero-actions-stack {
    align-items: stretch;
    width: 100%;
    min-width: 0;
  }
  .hero-day-name { font-size: 1.35rem; }
  .hero-status { flex-wrap: wrap; }

  /* Tab bar horizontal scroll */
  .tab-bar {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar { display: none; }

  /* Insights single column */
  .insights-grid { grid-template-columns: 1fr; }

  /* Planning header stacks */
  .planning-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .planning-stats {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Week strip scroll snap */
  .mini-day-row {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .mini-day {
    scroll-snap-align: start;
    min-width: 120px;
  }

  /* Section titles smaller */
  .section-title { font-size: 0.98rem; }
  .section-title-lg { font-size: 1.2rem; }

  /* Page title smaller */
  .page-title { font-size: 1.4rem; }
  .page-header { padding: 20px 0 16px; }

  /* Progress bar full width */
  .progress-row { padding: 10px 14px; }
  .progress-info { min-width: 0; width: 100%; }
  .progress-bar { width: 100%; }

  /* Day grid responsive */
  .day-grid { grid-template-columns: repeat(2, 1fr); }

  /* Section title row stacks */
  .section-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 560px) {
  /* Single column day grid */
  .day-grid { grid-template-columns: 1fr; }

  /* KPI value smaller */
  .kpi-value { font-size: 1.4rem; }
  .kpi-card { padding: 14px 16px 12px; }

  /* Table: smaller font, hide less important cols */
  .video-table { font-size: 0.78rem; }
  .video-table th, .video-table td { padding: 8px 10px; }
  .video-thumb { width: 48px; height: 27px; }

  /* Topnav compact */
  .topnav-inner { padding: 0 14px; gap: 14px; }
  .topnav-link { padding: 6px 10px; font-size: 0.8rem; }

  /* Stat pill compact */
  .stat-pill { padding: 7px 12px; }
  .stat-pill-num { font-size: 0.9rem; }

  /* Insight cards compact */
  .insight-card { padding: 10px 12px; gap: 10px; }
  .insight-thumb { width: 48px; height: 32px; }
  .insight-video { font-size: 0.84rem; }

  /* Channel header compact */
  .page-header .channel-avatar-wrap img,
  .page-header .channel-avatar-wrap .avatar-skeleton { width: 44px; height: 44px; }
  .page-header .channel-name { font-size: 1.2rem; }
}

/* Table column hide on mobile */
@media (max-width: 760px) {
  .video-table .hide-mobile { display: none; }
}

/* ── Next Actions hero ───────────────────────────────────────────────── */
.next-actions-section {
  padding-top: 20px;
  margin-bottom: 28px;
}
.next-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.action-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  background-image:
    linear-gradient(135deg, rgba(255,23,68,0.08) 0%, rgba(255,23,68,0) 50%),
    var(--grad-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 16px 18px 16px 22px;
  transition: border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  overflow: hidden;
}
.action-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--grad-red);
}
[dir="rtl"] .action-card::before { left: auto; right: 0; }
.action-card:hover {
  border-color: var(--red-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 20px rgba(255,23,68,0.18);
}
.action-rank {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
[dir="rtl"] .action-rank { right: auto; left: 12px; }
.action-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  border-radius: 10px;
  color: #ff7a90;
}
.action-body { flex: 1; min-width: 0; }
.action-title {
  font-weight: 650;
  font-size: 0.97rem;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
  padding-right: 28px;
}
[dir="rtl"] .action-title { padding-right: 0; padding-left: 28px; }
.action-desc {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.45;
  margin-bottom: 10px;
}
.action-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.action-metric {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.action-delta {
  font-size: 0.78rem;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 5px;
}
.action-delta.positive { color: #4ade80; background: var(--green-soft); }
.action-delta.negative { color: #ff7a90; background: var(--red-soft); }
.action-delta.neutral  { color: var(--text-mid); background: var(--surface-2); }

/* ── Intelligence panel ──────────────────────────────────────────────── */
.intel-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.intel-subtabs::-webkit-scrollbar { display: none; }
.intel-tab {
  background: transparent;
  border: none;
  color: var(--text-mid);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.intel-tab:hover { color: var(--text); }
.intel-tab.active {
  background: var(--red-soft);
  color: #ff7a90;
  box-shadow: inset 0 0 0 1px var(--red-border);
}
.intel-panel { animation: fadeIn 0.2s var(--ease); }
.intel-card {
  background: var(--surface);
  background-image: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.intel-card-header { margin-bottom: 18px; }
.intel-card-title {
  font-size: 1.08rem;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}
.intel-card-hint {
  font-size: 0.84rem;
  color: var(--text-mid);
}
.intel-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
}
.intel-delta {
  font-size: 0.78rem;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 5px;
}
.intel-delta.positive { color: #4ade80; background: var(--green-soft); }
.intel-delta.negative { color: #ff7a90; background: var(--red-soft); }
.intel-delta.neutral  { color: var(--text-mid); background: var(--surface-2); }

/* ── Bars (patterns, topics, length) ─────────────────────────────────── */
.intel-bars, .topics-list, .length-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.intel-bar-row, .topic-row, .length-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 2fr minmax(150px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 8px 2px;
  border-radius: 8px;
  transition: background var(--dur) var(--ease);
}
.intel-bar-row:hover, .topic-row:hover, .length-row:hover {
  background: var(--surface-2);
}
.intel-bar-row.winner, .topic-row.winner, .length-row.winner {
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  padding-left: 10px;
  padding-right: 10px;
}
.intel-bar-label, .topic-label, .length-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}
.intel-bar-crown, .topic-crown {
  color: #facc15;
  font-size: 0.9rem;
}
.intel-bar-text, .topic-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.intel-bar-count, .topic-count, .length-count {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
}
.intel-bar-track, .topic-bar, .length-bar {
  height: 10px;
  background: var(--surface-3);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.intel-bar-fill, .topic-bar-fill, .length-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s var(--ease);
}
.intel-bar-fill.pos, .topic-bar-fill {
  background: linear-gradient(90deg, var(--red), #ff6380);
}
.intel-bar-fill.neg {
  background: linear-gradient(90deg, var(--surface-3), #6b7280);
}
.length-bar-fill {
  background: linear-gradient(90deg, var(--cyan), #67e8f9);
}
.length-bar-fill.winner {
  background: linear-gradient(90deg, var(--green), #4ade80);
}
.intel-bar-value, .topic-stats, .length-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  font-size: 0.86rem;
  flex-wrap: wrap;
}
.intel-bar-value strong, .topic-stats strong, .length-stats strong {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Heatmap ─────────────────────────────────────────────────────────── */
.hm-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.hm-summary-card {
  flex: 1;
  min-width: 180px;
  padding: 14px 18px;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
}
.hm-summary-label {
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ff7a90;
  margin-bottom: 4px;
}
.hm-summary-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}
.hm-summary-sub {
  font-size: 0.8rem;
  color: var(--text-mid);
}
.hm-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}
.hm-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 2px;
}
.hm-row.hm-header { margin-bottom: 4px; }
.hm-day-label {
  width: 38px;
  flex-shrink: 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hm-hour-label {
  width: 22px;
  flex-shrink: 0;
  font-size: 0.62rem;
  color: var(--text-dim);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.hm-cell {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 3px;
  background: rgba(255, 23, 68, calc(var(--hm-intensity, 0) * 0.95 + 0.05));
  transition: transform 0.12s var(--ease);
  cursor: help;
}
.hm-cell.hm-empty {
  background: var(--surface-2);
}
.hm-cell:hover:not(.hm-empty) {
  transform: scale(1.3);
  z-index: 2;
  position: relative;
  box-shadow: 0 0 0 2px var(--bg-elev), 0 0 12px rgba(255,23,68,0.6);
}
.hm-cell.hm-best {
  box-shadow: 0 0 0 2px #facc15, 0 0 12px rgba(250,204,21,0.4);
}
.hm-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  justify-content: flex-end;
}
.hm-legend-label {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.hm-legend-gradient {
  width: 140px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255,23,68,0.05), rgba(255,23,68,1));
}

/* ── Sweet spot card ─────────────────────────────────────────────────── */
.sweet-spot-card {
  padding: 18px 22px;
  background:
    linear-gradient(135deg, rgba(34,197,94,0.15), rgba(34,197,94,0.02)),
    var(--surface);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.sweet-spot-label {
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4ade80;
  margin-bottom: 6px;
}
.sweet-spot-value {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}
.sweet-spot-sub {
  font-size: 0.84rem;
  color: var(--text-mid);
}

/* ── Content gaps ────────────────────────────────────────────────────── */
.gaps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.gap-card {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.gap-card:hover {
  border-color: var(--yellow-border);
  transform: translateY(-1px);
}
.gap-token {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  text-transform: capitalize;
}
.gap-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gap-stat {
  font-size: 0.78rem;
  color: var(--text-mid);
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.gap-num {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── Mobile tweaks for new components ────────────────────────────────── */
@media (max-width: 760px) {
  .next-actions-grid { grid-template-columns: 1fr; }
  .action-title { padding-right: 26px; font-size: 0.92rem; }
  .action-desc { font-size: 0.82rem; }

  .intel-bar-row, .topic-row, .length-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px 8px;
  }
  .intel-bar-row.winner, .topic-row.winner, .length-row.winner {
    padding: 10px 8px;
  }
  .intel-bar-value, .topic-stats, .length-stats {
    justify-content: flex-start;
  }
  .hm-cell { width: 18px; height: 18px; }
  .hm-hour-label { width: 18px; font-size: 0.56rem; }
}

/* ── Momentum strip (compact, lives inside .page-header next to channel info) ── */
.momentum-strip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  min-width: 0;
  max-height: 60px;
}
.momentum-strip.mom-up    { border-color: var(--green-border); background: linear-gradient(135deg, rgba(34,197,94,0.10), rgba(34,197,94,0.02)), var(--surface); }
.momentum-strip.mom-down  { border-color: var(--red-border);   background: linear-gradient(135deg, rgba(255,23,68,0.10), rgba(255,23,68,0.02)), var(--surface); }
.momentum-strip-row {
  display: inline-flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.momentum-value {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.mom-up .momentum-value     { color: #4ade80; }
.mom-down .momentum-value   { color: #ff7a90; }
.mom-stable .momentum-value { color: var(--text); }
.momentum-signals {
  display: inline-flex; gap: 6px; flex-wrap: wrap;
}
.momentum-signal {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.74rem;
  white-space: nowrap;
}
.momentum-signal.signal-up   { color: #4ade80; border-color: var(--green-border); background: var(--green-soft); }
.momentum-signal.signal-down { color: #ff7a90; border-color: var(--red-border);   background: var(--red-soft); }
.signal-label { font-weight: 550; color: var(--text-mid); }
.signal-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.momentum-detail {
  font-size: 0.70rem;
  color: var(--text-dim);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
[dir="rtl"] .momentum-detail,
[dir="rtl"] .momentum-strip { align-items: flex-start; text-align: left; }
@media (max-width: 720px) {
  .momentum-strip { align-items: flex-start; max-height: none; }
  .momentum-strip-row { justify-content: flex-start; }
  .momentum-detail { text-align: left; white-space: normal; }
}

/* ── This week's top recommendation (slot #1 from Strategy plan) ──────── */
.top-rec-section { margin-bottom: 22px; }
.top-rec-card {
  background:
    radial-gradient(900px 240px at 0% 0%, rgba(255,23,68,0.10), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.top-rec-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
}
.top-rec-meta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mid);
  font-variant-numeric: tabular-nums;
}
.top-rec-body {
  display: flex; align-items: center; gap: 18px;
}
.top-rec-main { flex: 1; min-width: 0; }
.top-rec-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin-bottom: 4px;
}
.top-rec-why {
  font-size: 0.82rem;
  color: var(--text-mid);
  line-height: 1.45;
}
.top-rec-why strong { color: var(--text); font-weight: 600; }
.top-rec-signal {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  min-width: 70px;
  cursor: help;
  flex-shrink: 0;
}
.top-rec-signal-num {
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.top-rec-signal-label {
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  margin-top: 3px;
  white-space: nowrap;
}
.top-rec-signal.score-strong .top-rec-signal-num { color: #22c55e; }
.top-rec-signal.score-fair   .top-rec-signal-num { color: #facc15; }
.top-rec-signal.score-weak   .top-rec-signal-num { color: var(--red); }
.top-rec-signal.score-na     .top-rec-signal-num { color: var(--text-dim); }
.top-rec-foot {
  display: flex; justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.top-rec-cta {
  display: inline-flex; align-items: center;
  padding: 8px 14px;
  font-size: 0.82rem;
  text-decoration: none;
}
.top-rec-empty {
  text-align: center;
  padding: 6px 4px;
}
.top-rec-empty .section-title-lg { margin: 8px 0 6px; }
.top-rec-empty-sub {
  font-size: 0.86rem;
  color: var(--text-mid);
  margin: 0 0 14px;
}

/* ── Action cards v2 (impact + confidence) ──────────────────────────── */
.action-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  background-image:
    linear-gradient(135deg, rgba(255,23,68,0.08) 0%, rgba(255,23,68,0) 50%),
    var(--grad-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 14px 18px 16px 22px;
  min-height: 120px;
}
.action-card.impact-high { border-color: var(--red-border); }
.action-card.impact-medium { border-color: var(--yellow-border); }
.action-badges {
  position: absolute;
  top: 10px;
  right: 12px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
[dir="rtl"] .action-badges { right: auto; left: 12px; }
.badge-impact, .badge-confidence {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
}
.badge-impact.impact-high { background: var(--red-soft); color: #ff7a90; border: 1px solid var(--red-border); }
.badge-impact.impact-medium { background: var(--yellow-soft); color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-impact.impact-low { background: var(--surface-2); color: var(--text-mid); border: 1px solid var(--border); }
.badge-confidence.conf-high { background: var(--green-soft); color: #4ade80; border: 1px solid var(--green-border); }
.badge-confidence.conf-medium { background: var(--surface-2); color: var(--text-mid); border: 1px solid var(--border-strong); }
.badge-confidence.conf-low { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }
.action-rank { display: none; }
.action-expected {
  font-size: 0.78rem;
  font-weight: 650;
  color: #4ade80;
  padding: 2px 7px;
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  border-radius: 5px;
}
.action-title { padding-right: 180px; padding-top: 6px; }
[dir="rtl"] .action-title { padding-right: 0; padding-left: 180px; }

/* ── AI Tools ────────────────────────────────────────────────────────── */
.ai-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.ai-tool-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
[dir="rtl"] .ai-tool-btn { text-align: right; }
.ai-tool-btn:hover {
  border-color: var(--red-border);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.ai-tool-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}
.ai-tool-body { flex: 1; min-width: 0; }
.ai-tool-title {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 2px;
}
.ai-tool-sub {
  font-size: 0.78rem;
  color: var(--text-mid);
}

/* ── AI modal results ────────────────────────────────────────────────── */
.ai-modal { max-width: 640px; }
.ai-result {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-mid);
  padding: 12px 0;
}
.ai-error {
  padding: 12px 14px;
  background: var(--red-soft);
  color: #ff7a90;
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
  font-size: 0.88rem;
}
.ai-ideas, .ai-titles, .ai-hooks, .ai-thumbs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-idea, .ai-hook-item, .ai-thumb-item {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ai-idea-title { font-weight: 650; color: var(--text); margin-bottom: 3px; }
.ai-idea-meta { font-size: 0.78rem; color: var(--red); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.ai-idea-why { font-size: 0.85rem; color: var(--text-mid); line-height: 1.5; }
.ai-title-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ai-copy-text { flex: 1; font-weight: 500; color: var(--text); }
.ai-copy-btn { font-size: 0.74rem; flex-shrink: 0; }
.ai-hook-type {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ai-hook-text { font-size: 0.88rem; color: var(--text); line-height: 1.55; }
.ai-thumb-title {
  font-weight: 650;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.ai-thumb-mood {
  font-size: 0.72rem;
  padding: 2px 7px;
  background: var(--red-soft);
  color: #ff7a90;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ai-thumb-visual { font-size: 0.85rem; color: var(--text-mid); line-height: 1.5; margin-bottom: 4px; }
.ai-thumb-overlay { font-size: 0.78rem; color: var(--text-dim); font-style: italic; }

/* ── Diagnosis modal ─────────────────────────────────────────────────── */
.diagnosis-modal { max-width: 560px; }
.diag-video { margin-bottom: 18px; }
.diag-video-title {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 3px;
  line-height: 1.3;
}
.diag-video-stats {
  font-size: 0.84rem;
  color: var(--text-mid);
}
.diag-section { margin-bottom: 16px; }
.diag-section-title {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-bottom: 8px;
}
.diag-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.diag-list li {
  padding: 6px 0 6px 22px;
  font-size: 0.88rem;
  line-height: 1.5;
  position: relative;
  color: var(--text);
}
.diag-reasons li::before {
  content: "⚠";
  position: absolute;
  left: 0;
  color: var(--yellow);
}
.diag-fixes li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #4ade80;
  font-weight: 700;
}
.diag-empty { color: var(--text-dim); font-style: italic; }
.diag-empty::before { display: none; }
.diag-ai-wrap {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.diag-ai-result { margin-top: 14px; }
.diag-fix-card {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  background-image: linear-gradient(135deg, rgba(34,197,94,0.08), transparent);
}
.diag-fix-label {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-top: 10px;
  margin-bottom: 4px;
}
.diag-fix-label:first-child { margin-top: 0; }
.diag-fix-title {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text);
  line-height: 1.3;
}
.diag-fix-text {
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.55;
}

/* ── Mobile tweaks for new components ────────────────────────────────── */
@media (max-width: 760px) {
  .momentum-inner { gap: 14px; }
  .momentum-value { font-size: 1.35rem; }
  .nv-main-title { font-size: 1.15rem; }
  .nv-alts-list li { font-size: 0.88rem; }
  .action-title { padding-right: 12px; padding-top: 52px; }
  .action-badges { position: static; margin-bottom: 8px; }
  .ai-tool-btn { padding: 12px 14px; }
}

/* ── Upload button + modal ──────────────────────────────────────────── */
.btn-upload {
  padding: 9px 16px;
  font-size: 0.85rem;
}
.upload-status {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 8px;
  background: var(--surface-2);
  color: var(--text-mid);
}
.upload-status.upload-success {
  background: var(--green-soft);
  color: #4ade80;
  border: 1px solid var(--green-border);
}
.upload-status.upload-error {
  background: var(--red-soft);
  color: #ff7a90;
  border: 1px solid var(--red-border);
}

/* ── Channel switcher (topnav) ──────────────────────────────────────── */
.channel-switcher {
  position: relative;
  margin-right: 6px;
}
[dir="rtl"] .channel-switcher { margin-right: 0; margin-left: 6px; }
.channel-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 11px 7px 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.channel-btn:hover {
  background: var(--surface-2);
  border-color: var(--red-border);
}
.channel-btn-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-btn svg:first-child { color: var(--red); }
.channel-btn svg:last-child { color: var(--text-dim); }
.channel-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              visibility var(--dur) var(--ease);
  z-index: 300;
}
[dir="rtl"] .channel-menu { right: auto; left: 0; }
.channel-switcher.open .channel-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.channel-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
[dir="rtl"] .channel-option { text-align: right; }
.channel-option:hover { background: var(--surface-2); }
.channel-option.active {
  background: var(--red-soft);
  color: #ff7a90;
}
.channel-option-check { color: #4ade80; font-weight: 700; }
.channel-option-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Velocity / "best channel to copy" ───────────────────────────────── */
.velocity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}
.velocity-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.velocity-card.velocity-rank-1 {
  border-color: var(--red-border);
  background:
    radial-gradient(800px 200px at 0% 0%, rgba(255,23,68,0.18), transparent 60%),
    var(--surface);
  box-shadow: 0 0 0 1px var(--red-border), var(--glow-red);
}
.velocity-card.velocity-rank-2 {
  border-color: var(--yellow-border);
  background:
    radial-gradient(700px 200px at 0% 0%, rgba(245,158,11,0.10), transparent 60%),
    var(--surface);
}
.velocity-rank {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mid);
}
.velocity-rank-1 .velocity-rank { color: var(--red); }
.velocity-rank-2 .velocity-rank { color: var(--yellow); }

.velocity-channel {
  display: flex;
  align-items: center;
  gap: 12px;
}
.velocity-channel-thumb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
}
.velocity-rank-1 .velocity-channel-thumb { border-color: var(--red); }
.velocity-channel-meta { min-width: 0; flex: 1; }
.velocity-channel-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
}
.velocity-stats {
  font-size: 0.86rem;
  color: var(--text-mid);
  margin-top: 3px;
}
.velocity-stats strong {
  color: #4ade80;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.velocity-rank-1 .velocity-stats strong { color: var(--red); }
.velocity-sep { opacity: 0.5; margin: 0 4px; }
.velocity-avg { color: var(--text-dim); font-size: 0.82rem; }

.velocity-best {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.velocity-best-label {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-bottom: 10px;
}
.velocity-best-card {
  display: flex;
  gap: 12px;
}
.velocity-best-thumb-wrap {
  flex-shrink: 0;
  width: 120px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-3);
}
.velocity-best-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.velocity-best-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.velocity-best-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.velocity-best-title:hover { color: var(--red); }
.velocity-best-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-mid);
}
.vb-stat strong { color: var(--text); font-variant-numeric: tabular-nums; }
.btn-remake-velocity {
  align-self: flex-start;
  margin-top: 4px;
  padding: 6px 12px;
  font-size: 0.8rem;
}

@media (max-width: 760px) {
  .velocity-grid { grid-template-columns: 1fr; }
  .velocity-best-card { flex-direction: column; }
  .velocity-best-thumb-wrap { width: 100%; }
}

/* ── Velocity leaderboard (ranks 4–10) ──────────────────────────────── */
.velocity-list {
  grid-column: 1 / -1;            /* span the whole hero grid below the cards */
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.velocity-row {
  display: grid;
  grid-template-columns: 38px 32px minmax(120px, 1.1fr) 96px minmax(160px, 2fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.velocity-row:hover {
  border-color: var(--border-strong);
  transform: translateX(2px);
}
.velocity-row-rank {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.velocity-row-channel-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-strong);
}
.velocity-row-channel {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.velocity-row-channel-name {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.velocity-row-channel-vps {
  font-size: 0.74rem;
  color: var(--text-mid);
}
.velocity-row-channel-vps strong {
  color: #4ade80;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.velocity-row-thumb-wrap {
  flex-shrink: 0;
  width: 96px;
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface-3);
  display: block;
}
.velocity-row-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--dur) var(--ease);
}
.velocity-row-thumb-wrap:hover .velocity-row-thumb { transform: scale(1.04); }
.velocity-row-video { min-width: 0; }
.velocity-row-title {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.velocity-row-title:hover { color: var(--red); }
.velocity-row-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.velocity-row-action {
  padding: 6px 10px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
@media (max-width: 900px) {
  .velocity-row {
    grid-template-columns: 30px 28px 1fr 76px;
    gap: 10px;
    row-gap: 6px;
  }
  .velocity-row-video { grid-column: 1 / -1; padding-left: 4px; }
  .velocity-row-action-label { display: none; }
  .velocity-row-action { grid-column: 4 / 5; grid-row: 1 / 2; padding: 6px 8px; }
}

/* ── Top videos (competitors page) ───────────────────────────────────── */
.top-vid-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.top-videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.top-video-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.top-video-card:hover {
  transform: translateY(-2px);
  border-color: var(--red-border);
  box-shadow: var(--shadow);
}
.top-video-card.fresh-hot { border-color: var(--red-border); box-shadow: 0 0 0 1px var(--red-border), 0 0 14px rgba(255,23,68,0.18); }
.top-video-card.fresh-recent { border-color: var(--yellow-border); }
.top-video-card.fresh-medium { border-color: var(--border-strong); }
.top-video-card.fresh-old { opacity: 0.78; }

.top-video-thumb-wrap {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}
.top-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease);
}
.top-video-card:hover .top-video-thumb { transform: scale(1.05); }
.top-video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
[dir="rtl"] .top-video-duration { right: auto; left: 8px; }
.top-video-fresh {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.85);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}
.top-video-card.fresh-hot .top-video-fresh {
  background: var(--red);
  color: #fff;
}
.top-video-card.fresh-recent .top-video-fresh {
  background: var(--yellow);
  color: #0f0f0f;
}
[dir="rtl"] .top-video-fresh { left: auto; right: 8px; }

.top-video-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.top-video-channel {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--text-mid);
  min-width: 0;
}
.top-video-channel-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.top-video-channel-name {
  font-weight: 600;
  color: var(--text-mid);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-video-title {
  font-size: 0.94rem;
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
.top-video-title:hover { color: var(--red); }

.top-video-stats {
  display: flex;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-mid);
  margin-top: 2px;
}
.tv-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--text);
}
.tv-stat svg { color: var(--text-dim); }

.btn-remake {
  margin-top: 0;
  padding: 8px 14px;
  font-size: 0.84rem;
  justify-content: center;
  flex: 1 1 auto;
}

.top-video-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  align-items: stretch;
}
.btn-copy-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 0.84rem;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  white-space: nowrap;
  flex: 0 0 auto;
}
.btn-copy-thumb:hover { background: var(--surface-3, var(--surface-2)); border-color: var(--border-strong); }
.btn-copy-thumb:disabled { opacity: 0.6; cursor: progress; }
.btn-copy-thumb svg { color: var(--text-dim); }

.btn-download-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 0.84rem;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  white-space: nowrap;
  flex: 0 0 auto;
}
.btn-download-thumb:hover { background: var(--surface-3, var(--surface-2)); border-color: var(--border-strong); }
.btn-download-thumb:disabled { opacity: 0.6; cursor: progress; }
.btn-download-thumb svg { color: var(--text-dim); }

/* Remake-modal action hub */
.modal.modal-wide { max-width: 720px; }
.remake-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 14px;
}
@media (max-width: 560px) {
  .remake-actions { grid-template-columns: 1fr; }
}
.remake-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.remake-action:hover {
  background: var(--surface-3, var(--surface-2));
  border-color: var(--red-border, var(--border-strong));
  transform: translateY(-1px);
}
.remake-action-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,23,68,0.10);
  color: var(--red);
  border-radius: 10px;
  flex: 0 0 auto;
}
.remake-action-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.remake-action-title { font-weight: 600; font-size: 0.95rem; line-height: 1.2; }
.remake-action-sub { font-size: 0.8rem; color: var(--text-dim); line-height: 1.3; }

.remake-result-head {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.remake-result-meta { font-weight: 400; font-size: 0.78rem; color: var(--text-dim); }
.remake-textarea {
  width: 100%;
  min-height: 220px;
  max-height: 360px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  resize: vertical;
}
.remake-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.remake-thumb-preview {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* Recent videos collapsed by default */
.recent-fold {
  position: relative;
  background:
    radial-gradient(circle at 0% 0%, rgba(255,23,68,0.08), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(99,102,241,0.06), transparent 45%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.recent-fold:hover {
  border-color: var(--red-border, var(--border-strong));
  box-shadow: 0 8px 32px rgba(255,23,68,0.10), var(--shadow-sm);
}
.recent-fold[open] {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.recent-fold-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 2px;
}
.recent-fold-summary::-webkit-details-marker { display: none; }
.recent-fold-summary::before { content: none; }

.recent-fold-left {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.recent-fold-icon {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,23,68,0.18), rgba(255,23,68,0.05));
  color: var(--red);
  border: 1px solid rgba(255,23,68,0.22);
  flex: 0 0 auto;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.recent-fold:hover .recent-fold-icon { transform: scale(1.05); }
.recent-fold-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recent-fold-text .section-title { margin: 0; }
.recent-fold-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 400;
}

.recent-fold-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.recent-fold:hover .recent-fold-cta {
  color: var(--text);
  background: var(--surface-3, var(--surface-2));
  border-color: var(--border-strong);
}
.recent-fold-cta svg {
  transition: transform var(--dur) var(--ease);
}
.recent-fold[open] .recent-fold-cta svg { transform: rotate(180deg); }
.recent-fold-cta-collapse { display: none; }
.recent-fold[open] .recent-fold-cta-expand { display: none; }
.recent-fold[open] .recent-fold-cta-collapse { display: inline; }

@media (max-width: 760px) {
  .top-videos-grid { grid-template-columns: 1fr; }
  .top-vid-controls { width: 100%; flex-direction: column; }
  .top-vid-controls .sort-select { width: 100%; }
}

/* ── Utility ────────────────────────────────────────────────────────────── */
::selection { background: rgba(255,23,68,0.32); color: var(--text); }

:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

/* Scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3d4358; }

/* ───── RESEARCH PAGE ─────────────────────────────────────────── */
.research-header {
  margin: 18px 0 16px;
}
.research-header .page-title { margin: 6px 0 4px; }

.research-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
}
.research-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.research-tab:hover { color: var(--text); background: var(--surface-2); }
.research-tab.active {
  background: rgba(255,23,68,0.10);
  color: var(--red);
  border-color: rgba(255,23,68,0.25);
}
.research-tab svg { color: currentColor; }
.research-tab-count {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

.research-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.research-card-flat {
  background: transparent;
  border: 0;
  padding: 0 4px 4px;
}
.research-card-head { margin-bottom: 14px; }
.research-card-head .section-title { margin: 0 0 4px; }
.research-card-head .section-sub { color: var(--text-dim); font-size: 0.86rem; }
.research-card-head-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.research-feed-controls { display: flex; gap: 10px; flex-wrap: wrap; }

.research-input {
  flex: 1 1 auto;
  padding: 12px 14px;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.research-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255,23,68,0.15);
}
.research-lookup-form { display: flex; gap: 10px; flex-wrap: wrap; }
.research-lookup-form .btn-primary { padding: 12px 20px; }

.research-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.lookup-card {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 720px) {
  .lookup-card { grid-template-columns: 1fr; }
}
.lookup-thumb-wrap {
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.lookup-thumb { display: block; width: 100%; height: auto; }
.lookup-channel { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 4px; }
.lookup-title {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 12px;
}
.lookup-title:hover { color: var(--red); }
.lookup-stats {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 0.82rem; color: var(--text-dim);
  margin-bottom: 16px;
}
.lookup-open { padding: 10px 18px; }

.research-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.feed-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.feed-item:hover {
  border-color: var(--red-border, var(--border-strong));
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.feed-thumb-wrap { position: relative; width: 140px; flex: 0 0 140px; border-radius: 10px; overflow: hidden; }
.feed-thumb { display: block; width: 100%; height: 80px; object-fit: cover; }
.feed-dur {
  position: absolute; bottom: 4px; right: 4px;
  font-size: 0.7rem; padding: 2px 6px; border-radius: 4px;
  background: rgba(0,0,0,0.78); color: #fff; font-weight: 600;
}
.feed-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.feed-channel { font-size: 0.74rem; color: var(--text-dim); }
.feed-title { font-size: 0.88rem; font-weight: 600; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feed-stats { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-dim); margin-top: auto; }
.feed-action { padding: 6px 12px; font-size: 0.78rem; flex: 0 0 auto; align-self: center; }

.research-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.research-saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.saved-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.saved-thumb-wrap { display: block; }
.saved-thumb { display: block; width: 100%; height: 180px; object-fit: cover; }
.saved-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.saved-channel { font-size: 0.75rem; color: var(--text-dim); }
.saved-title { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.saved-notes {
  width: 100%;
  min-height: 70px;
  padding: 8px 10px;
  font-size: 0.84rem;
  font-family: inherit;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  resize: vertical;
}
.saved-notes:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 2px rgba(255,23,68,0.15); }
.saved-actions { display: flex; gap: 8px; }
.btn-soft.btn-soft-danger { background: rgba(255,23,68,0.10); color: var(--red); }
.btn-soft.btn-soft-danger:hover { background: rgba(255,23,68,0.18); }

.remake-action.remake-action-save .remake-action-icon {
  background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(34,197,94,0.05));
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.22);
}
.ai-success {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(34,197,94,0.10);
  border: 1px solid rgba(34,197,94,0.22);
  color: #22c55e;
  font-size: 0.88rem;
}

/* ───── Research → URL lookup workspace ──────────────────────── */
.lookup-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--text-dim);
}

.lookup-meta-strip {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin: 0 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}
.lookup-meta-channel { min-width: 0; flex: 1 1 320px; }
.lookup-meta-title {
  display: block;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 4px;
}
.lookup-meta-title:hover { color: var(--red); }
.lookup-meta-channel-name { font-size: 0.84rem; color: var(--text-dim); }
.lookup-meta-stats {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  font-size: 0.84rem; color: var(--text-dim);
}
.lookup-meta-stats strong { color: var(--text); font-weight: 700; }

.lookup-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 14px;
}
@media (max-width: 1000px) {
  .lookup-workspace { grid-template-columns: 1fr; }
}

.lookup-player-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lookup-player-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.lookup-player-wrap iframe,
.lookup-player-wrap > div {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.lookup-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lookup-act { padding: 9px 14px; font-size: 0.85rem; }

.lookup-transcript-col {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 380px;
  max-height: 70vh;
  overflow: hidden;
}
.lookup-transcript-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.lookup-transcript-title { font-weight: 700; font-size: 0.92rem; }
.lookup-transcript-meta { font-size: 0.74rem; color: var(--text-dim); }
.lookup-transcript-body {
  flex: 1; overflow-y: auto;
  padding: 8px 8px 12px;
}
.t-seg {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: flex-start;
  padding: 6px 10px;
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 6px;
  text-align: left;
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.5;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.t-seg:hover { background: var(--surface-2); color: var(--text); }
.t-seg.active {
  background: rgba(255,23,68,0.10);
  color: var(--text);
  border-left-color: var(--red);
}
.t-seg-time {
  flex: 0 0 56px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-top: 1px;
}
.t-seg.active .t-seg-time { color: var(--red); font-weight: 600; }
.t-seg-text { flex: 1; min-width: 0; }
.t-plain {
  padding: 12px 14px;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}
.lookup-transcript-fallback { padding: 14px 16px; }
.lookup-fallback-textarea {
  width: 100%;
  min-height: 160px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  resize: vertical;
  margin: 8px 0;
}

/* Brief panel */
.lookup-brief {
  margin-top: 18px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.lookup-brief-head {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 14px;
}
.lookup-brief-meta { font-size: 0.78rem; color: var(--text-dim); }

.brief-section { margin-bottom: 18px; }
.brief-section h4 {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 8px;
  font-weight: 700;
}
.brief-angle h4 { color: var(--red); }
.brief-md p { margin: 0 0 8px; font-size: 0.92rem; line-height: 1.6; }
.brief-md ul, .brief-md ol { padding-left: 22px; margin: 0 0 10px; font-size: 0.92rem; line-height: 1.6; }
.brief-md li { margin-bottom: 4px; }
.brief-md blockquote {
  margin: 6px 0 10px;
  padding: 8px 14px;
  border-left: 3px solid var(--red);
  background: rgba(255,23,68,0.06);
  border-radius: 6px;
  font-style: italic;
  color: var(--text);
}
.brief-md strong { color: var(--text); }
.brief-table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 0.86rem; }
.brief-table th, .brief-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.brief-table th { background: var(--surface-2); color: var(--text-dim); font-weight: 600; }

.lookup-brief-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px;
  border-top: 1px solid var(--border); padding-top: 14px;
}

/* ───── Research → Competitor feed filter bar ──────────────────── */
.feed-filterbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.feed-filter-group {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 12px;
}
.feed-filter-row {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end;
  margin-top: 4px;
}
.feed-filter-row .feed-filter-group { margin-bottom: 0; }
.feed-filter-label {
  font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 700;
  display: inline-flex; align-items: baseline; gap: 8px;
}
.feed-filter-label strong { font-size: 0.86rem; color: var(--text); }

.feed-chip-row {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.feed-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.feed-chip:hover { color: var(--text); border-color: var(--border-strong); }
.feed-chip.active {
  background: rgba(255,23,68,0.10);
  color: var(--red);
  border-color: rgba(255,23,68,0.30);
}
.feed-chip-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3, var(--surface-2));
  flex: 0 0 auto;
}

.feed-segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.feed-seg {
  padding: 6px 14px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.feed-seg:hover { color: var(--text); }
.feed-seg.active { background: var(--red); color: #fff; }

.feed-range {
  width: 180px;
  appearance: none;
  background: transparent;
  --thumb: var(--red);
}
.feed-range:focus { outline: none; }
.feed-range::-webkit-slider-runnable-track {
  height: 6px;
  background: var(--surface-3, var(--surface-2));
  border-radius: 999px;
  border: 1px solid var(--border);
}
.feed-range::-webkit-slider-thumb {
  appearance: none;
  width: 16px; height: 16px;
  background: var(--thumb);
  border-radius: 50%;
  margin-top: -6px;
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.feed-range::-moz-range-track {
  height: 6px;
  background: var(--surface-3, var(--surface-2));
  border-radius: 999px;
  border: 1px solid var(--border);
}
.feed-range::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--thumb);
  border: 2px solid var(--surface);
  border-radius: 50%;
  cursor: pointer;
}

.feed-clear {
  margin-left: auto;
  padding: 6px 12px;
  font-size: 0.78rem;
}
.feed-filter-summary {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Action button on cards: chevron */
.feed-action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  font-size: 0.8rem;
  align-self: center;
  flex: 0 0 auto;
}

/* ───── Popover ────────────────────────────────────────────────── */
.feed-popover {
  position: absolute;
  z-index: 100;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
  padding: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease);
  display: flex; flex-direction: column; gap: 2px;
}
.feed-popover.show { opacity: 1; transform: translateY(0); }
.feed-popover-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.feed-popover-item:hover { background: var(--surface-2); }
.feed-popover-item svg { color: var(--text-dim); flex: 0 0 auto; }

/* Brief in action panel — scrollable so it fits inside the modal */
.ap-brief-scroll {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 12px;
}

/* Embed-disabled fallback for the URL-lookup player */
.lookup-player-fallback {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: #000;
}
.lookup-fallback-thumb-link {
  position: relative;
  flex: 1;
  display: block;
  overflow: hidden;
  text-decoration: none;
}
.lookup-fallback-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.55);
  transition: filter var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.lookup-fallback-thumb-link:hover .lookup-fallback-thumb {
  filter: brightness(0.65);
  transform: scale(1.02);
}
.lookup-fallback-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 18px 20px;
  pointer-events: none;
}
.lookup-fallback-title {
  color: #fff; font-weight: 700; font-size: 1.05rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.lookup-fallback-cta {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.86rem;
  pointer-events: auto;
  box-shadow: 0 4px 18px rgba(255,23,68,0.4);
  transition: transform var(--dur) var(--ease);
}
.lookup-fallback-cta:hover { transform: translateY(-1px); }
.lookup-fallback-note {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 16px;
  background: rgba(0,0,0,0.78);
  color: var(--text-dim);
  font-size: 0.78rem;
  text-align: center;
  border-top: 1px solid var(--border);
}

/* ───── Research → Title brainstorm ──────────────────────────── */
.title-inspire {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.title-inspire-summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 4px 0;
}
.title-inspire-summary::-webkit-details-marker { display: none; }
.title-inspire-summary::before {
  content: "▸";
  display: inline-block;
  color: var(--text-dim);
  transition: transform var(--dur) var(--ease);
}
.title-inspire[open] .title-inspire-summary::before { transform: rotate(90deg); }
.title-inspire:hover .title-inspire-summary { color: var(--text); }

.title-inspire-body { margin-top: 10px; }
.title-inspire-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 8px 0;
}
.title-inspire-row .research-input { flex: 1 1 280px; }
.title-inspire-meta {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 8px;
}
.title-inspire-thumb {
  width: 96px; height: 54px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 auto;
}
.title-inspire-info { flex: 1; min-width: 0; }
.title-inspire-source-channel {
  font-size: 0.74rem; color: var(--text-dim); margin-bottom: 2px;
}
.title-inspire-source-title {
  font-size: 0.92rem; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 6px;
}
.title-inspire-tx-status {
  font-size: 0.74rem;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
}
.title-inspire-tx-status.ok {
  background: rgba(34,197,94,0.10);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.22);
}
.title-inspire-tx-status.warn {
  background: rgba(234,179,8,0.10);
  color: #eab308;
  border: 1px solid rgba(234,179,8,0.22);
}

/* Result chips */
.title-result {
  margin-top: 14px;
}
.title-result-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.title-meta-chips {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.meta-chip {
  display: inline-flex; align-items: center;
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-weight: 500;
}
.meta-chip-patterns {
  background: rgba(255,23,68,0.08);
  color: var(--red);
  border-color: rgba(255,23,68,0.22);
}
.meta-chip-inspire {
  background: rgba(99,102,241,0.10);
  color: #818cf8;
  border-color: rgba(99,102,241,0.22);
}

/* Title cards grid */
.title-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.title-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.title-card:hover {
  border-color: var(--red-border, var(--border-strong));
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.title-card-num {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,23,68,0.10);
  color: var(--red);
  border: 1px solid rgba(255,23,68,0.22);
  border-radius: 50%;
  font-size: 0.84rem;
  font-weight: 700;
}
.title-card-text {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}
.title-card-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.title-copy-btn, .title-save-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  font-size: 0.78rem;
}
.title-save-btn { padding: 7px 14px; }
@media (max-width: 700px) {
  .title-card { grid-template-columns: auto 1fr; }
  .title-card-actions { grid-column: 2; justify-self: end; }
}

/* Refine row */
.title-refine {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}
.title-refine-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 6px;
}
.title-refine-row .research-input { flex: 1 1 280px; }

.title-input-flash {
  animation: titleInputFlash 0.7s ease;
}
@keyframes titleInputFlash {
  0%   { background: var(--surface-2); border-color: var(--border); }
  30%  { background: rgba(255,23,68,0.18); border-color: var(--red); box-shadow: 0 0 0 3px rgba(255,23,68,0.18); }
  100% { background: var(--surface-2); border-color: var(--border); }
}

.title-stale-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin: 0 0 12px;
  background: rgba(234,179,8,0.10);
  border: 1px solid rgba(234,179,8,0.28);
  border-radius: 999px;
  color: #eab308;
  font-size: 0.82rem;
  font-weight: 500;
  animation: staleHintIn 0.18s ease;
}
.title-stale-hint svg { color: currentColor; flex: 0 0 auto; }
@keyframes staleHintIn {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ───── Research → Saved tab (Step 4) ────────────────────────── */
.saved-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.saved-search-wrap {
  position: relative;
  flex: 1 1 320px;
  display: flex; align-items: center;
}
.saved-search-icon {
  position: absolute; left: 12px;
  color: var(--text-dim); pointer-events: none;
}
.saved-search { padding-left: 36px !important; }

.saved-kind-filter {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.saved-kind-btn {
  padding: 6px 14px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.saved-kind-btn:hover { color: var(--text); }
.saved-kind-btn.active { background: var(--red); color: #fff; }

/* Sticky bulk bar */
.saved-bulkbar {
  position: sticky;
  top: 56px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: rgba(255,23,68,0.10);
  border: 1px solid rgba(255,23,68,0.28);
  border-radius: var(--radius-md);
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
}
.saved-bulkbar-count {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--red);
}
.saved-bulkbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.saved-bulkbar-actions .btn-soft { padding: 6px 12px; font-size: 0.78rem; }

/* Sections */
.saved-section { margin-bottom: 24px; }
.saved-section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 0 4px 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.saved-section-icon { color: var(--text-dim); display: inline-flex; }
.saved-section-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.saved-section-count {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-left: auto;
}
.saved-promoted-count { color: var(--red); font-weight: 600; }

.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

/* Card */
.saved-card {
  position: relative;
  display: flex;
  gap: 0;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.saved-card:hover { border-color: var(--border-strong); }
.saved-card.is-selected {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red), 0 4px 16px rgba(255,23,68,0.18);
}
.saved-card.is-promoted::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #facc15, #f59e0b);
  z-index: 1;
}

.saved-check-wrap {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  background: rgba(0,0,0,0.55);
  border-radius: 6px;
  padding: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.saved-check { cursor: pointer; }

.saved-thumb-wrap {
  display: block;
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.saved-thumb-wrap-static { cursor: default; }
.saved-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.saved-thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  color: var(--text-dim);
}

.saved-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.saved-card-meta {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 0.74rem;
}
.saved-kind-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.saved-kind-badge-video { background: rgba(99,102,241,0.14); color: #818cf8; }
.saved-kind-badge-brief { background: rgba(255,23,68,0.10); color: var(--red); }
.saved-kind-badge-title { background: rgba(34,197,94,0.10); color: #22c55e; }

.saved-promoted-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250,204,21,0.14);
  color: #facc15;
  border: 1px solid rgba(250,204,21,0.28);
  font-size: 0.7rem;
  font-weight: 700;
}
.saved-date { color: var(--text-dim); }

.saved-channel { font-size: 0.74rem; color: var(--text-dim); }
.saved-title {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.saved-tags {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.saved-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.74rem;
  padding: 2px 4px 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.saved-tag-remove {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1;
  padding: 0 5px;
  border-radius: 999px;
}
.saved-tag-remove:hover { color: var(--red); background: rgba(255,23,68,0.10); }
.saved-tag-add {
  font-size: 0.74rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 500;
}
.saved-tag-add:hover { color: var(--text); border-color: var(--border-strong); }

.saved-notes {
  width: 100%;
  min-height: 64px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  resize: vertical;
}
.saved-notes:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 2px rgba(255,23,68,0.15); }

.saved-brief-details {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
}
.saved-brief-summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 4px 0;
}
.saved-brief-summary::-webkit-details-marker { display: none; }
.saved-brief-summary:hover { color: var(--text); }
.saved-brief-details[open] .saved-brief-summary { color: var(--red); margin-bottom: 6px; }
.saved-brief-details textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
}

.saved-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}
.saved-actions .btn-soft { padding: 6px 12px; font-size: 0.78rem; }
.saved-act-promote { font-weight: 600; }
.saved-card.is-promoted .saved-act-promote {
  background: rgba(250,204,21,0.14);
  color: #facc15;
}

/* The cross-page handoff is the highest-value action in the Remake modal
   on the Competitors page, so make it visually prominent. */
.remake-action.remake-action-research {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(255,23,68,0.12), rgba(255,23,68,0.04));
  border-color: rgba(255,23,68,0.35);
}
.remake-action.remake-action-research:hover {
  border-color: var(--red);
  background: linear-gradient(135deg, rgba(255,23,68,0.18), rgba(255,23,68,0.06));
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(255,23,68,0.18);
}
.remake-action.remake-action-research .remake-action-icon {
  background: linear-gradient(135deg, var(--red), #d4163e);
  color: #fff;
  border-color: var(--red);
}
.remake-action.remake-action-research .remake-action-title {
  color: var(--red);
}

/* ───── My Channel → Recent Research strip ───────────────── */
.recent-research { margin: 4px 0 18px; }
.recent-research-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.recent-research-head .section-title { margin: 4px 0 0; }
.recent-research-strip {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
}
.recent-research-strip::-webkit-scrollbar { height: 6px; }

.rr-chip {
  display: flex;
  flex: 0 0 280px;
  gap: 10px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  scroll-snap-align: start;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.rr-chip:hover {
  border-color: var(--red-border, var(--border-strong));
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.rr-thumb {
  width: 64px; height: 64px;
  flex: 0 0 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
}
.rr-thumb-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.rr-chip-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rr-chip-meta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.7rem;
  color: var(--text-dim);
}
.rr-chip-badge {
  padding: 1px 7px; border-radius: 999px;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.rr-chip-badge-video { background: rgba(99,102,241,0.14); color: #818cf8; }
.rr-chip-badge-brief { background: rgba(255,23,68,0.10); color: var(--red); }
.rr-chip-badge-title { background: rgba(34,197,94,0.10); color: #22c55e; }
.rr-promoted-dot {
  color: #facc15;
  font-size: 0.84rem;
}
.rr-chip-age { margin-left: auto; }
.rr-chip-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.35;
}

/* ───── Google Connect pill (Wave 1, Feature 1) ─────────────── */
.google-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
  white-space: nowrap;
  font-family: inherit;
}
.google-pill-disconnected:hover {
  background: rgba(255,23,68,0.10);
  border-color: rgba(255,23,68,0.32);
  color: var(--red);
}
.google-pill-disconnected svg { color: #4285f4; }
.google-pill-disconnected:hover svg { color: var(--red); }

.google-pill-connected {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.28);
  color: #22c55e;
  cursor: default;
}
.google-pill-connected svg { color: #22c55e; }
.google-pill-email {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--text);
}
.google-pill-disconnect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  padding: 0;
  margin-left: 2px;
  border: 0;
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.google-pill-disconnect:hover { background: rgba(255,23,68,0.18); color: var(--red); }

@media (max-width: 720px) {
  .google-pill-email { max-width: 110px; }
}

/* The connect-required modal — uses the existing .modal-backdrop / .modal */
.google-modal .modal { max-width: 480px; }

/* ───── Editor handoff page (Wave 1, Feature 2) ─────────────── */
.handoff-main { max-width: 1080px; margin: 0 auto; }
.handoff-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  margin: 18px 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.handoff-header-meta { min-width: 0; flex: 1 1 320px; }
.handoff-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 6px 0 6px;
  letter-spacing: -0.01em;
}
.handoff-sub {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  font-size: 0.86rem;
  color: var(--text-dim);
  margin: 0;
}
.handoff-sub strong { color: var(--text); font-weight: 600; }
.handoff-yt-link {
  color: var(--red); text-decoration: none; font-weight: 600;
  font-size: 0.82rem;
}
.handoff-yt-link:hover { text-decoration: underline; }

.handoff-header-actions {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.handoff-theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  user-select: none;
}
.handoff-theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.handoff-theme-toggle input { accent-color: var(--red); }

.handoff-export-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  font-size: 0.84rem;
  text-decoration: none;
  white-space: nowrap;
}

.handoff-doc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 22px;
}
.handoff-section {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.handoff-section:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.handoff-section h2 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 12px;
}
.handoff-section-angle h2 { color: var(--red); }
.handoff-md p { margin: 0 0 8px; font-size: 0.94rem; line-height: 1.65; }
.handoff-md ul, .handoff-md ol { padding-left: 22px; margin: 0 0 12px; font-size: 0.94rem; line-height: 1.65; }
.handoff-md li { margin-bottom: 4px; }
.handoff-md blockquote {
  margin: 6px 0 12px;
  padding: 10px 16px;
  border-left: 3px solid var(--red);
  background: rgba(255,23,68,0.06);
  border-radius: 6px;
  font-style: italic;
  color: var(--text);
}
.handoff-md strong { color: var(--text); }
.brief-table-wrap { overflow-x: auto; margin: 6px 0 14px; }

/* Q&A log */
.handoff-qa {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 28px;
  margin-bottom: 28px;
}
.handoff-qa .section-title { margin: 0 0 14px; }
.handoff-qa-log {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 18px;
}
.handoff-qa-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.86rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}
.handoff-qa-entry {
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--border);
}
.handoff-qa-entry.handoff-qa-editor   { border-left-color: #818cf8; }
.handoff-qa-entry.handoff-qa-creator  { border-left-color: var(--red); }
.handoff-qa-meta {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.handoff-qa-meta .handoff-qa-ts { flex: 1; }
.handoff-qa-meta em { font-style: italic; opacity: 0.85; }
.handoff-qa-role { font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 0.04em; }
.handoff-qa-body p { margin: 0; font-size: 0.92rem; line-height: 1.6; }
.handoff-qa-tools {
  display: inline-flex; gap: 4px;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.handoff-qa-entry:hover .handoff-qa-tools,
.handoff-qa-entry:focus-within .handoff-qa-tools { opacity: 1; }
.handoff-qa-tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.handoff-qa-tool:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}
.handoff-qa-tool.handoff-qa-tool-danger:hover {
  color: var(--red);
  background: rgba(255,23,68,0.10);
  border-color: rgba(255,23,68,0.28);
}
.handoff-qa-edit-text { width: 100%; min-height: 64px; }
.handoff-qa-edit-actions {
  display: flex; gap: 6px; justify-content: flex-end;
  margin-top: 6px;
}
.handoff-qa-edit-actions .btn-soft,
.handoff-qa-edit-actions .btn-primary { padding: 5px 12px; font-size: 0.78rem; }

.handoff-qa-form {
  display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.handoff-qa-role {
  display: flex; gap: 14px;
  font-size: 0.84rem;
}
.handoff-qa-role-opt {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  color: var(--text-dim);
}
.handoff-qa-role-opt input { accent-color: var(--red); }
.handoff-qa-role-opt:has(input:checked) { color: var(--text); font-weight: 600; }
.handoff-qa-text { min-height: 70px; }
.handoff-qa-form .btn-primary { align-self: flex-start; }

@media (max-width: 720px) {
  .handoff-doc { padding: 20px 18px; }
  .handoff-export-btn { padding: 8px 12px; font-size: 0.78rem; }
}

.btn-soft.btn-soft-primary {
  background: rgba(255,23,68,0.10);
  color: var(--red);
  border: 1px solid rgba(255,23,68,0.28);
  text-decoration: none;
  font-weight: 600;
}
.btn-soft.btn-soft-primary:hover { background: rgba(255,23,68,0.18); border-color: var(--red); }

/* Server-rendered raw markdown placeholder before JS upgrades it to HTML */
.handoff-md-raw {
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  margin: 0;
  background: transparent;
}

/* ───── My Videos page (Wave 1, Feature 3) ────────────────────── */
.my-videos-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin: 18px 0 18px;
}
.my-videos-header .page-title { margin: 6px 0 4px; }
.my-videos-header .page-sub { margin: 0; color: var(--text-dim); font-size: 0.86rem; }
.mv-refresh-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  font-size: 0.84rem;
}

/* Channel-level totals strip */
.mv-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(220px, 1.4fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 1100px) { .mv-totals { grid-template-columns: repeat(2, 1fr); } .mv-top-card { grid-column: span 2; } }
@media (max-width: 560px)  { .mv-totals { grid-template-columns: 1fr; } .mv-top-card { grid-column: 1; } }

.mv-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.mv-stat-label {
  font-size: 0.74rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.mv-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.mv-top-card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(250,204,21,0.10), rgba(255,23,68,0.06));
  border: 1px solid rgba(250,204,21,0.28);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.mv-top-card:hover { transform: translateY(-1px); border-color: #facc15; }
.mv-top-badge {
  position: absolute;
  top: 6px; left: 10px;
  font-size: 0.7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(250,204,21,0.18);
  color: #facc15;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mv-top-thumb {
  width: 96px; height: 54px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 auto;
  background: #000;
}
.mv-top-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-top: 16px; }
.mv-top-views { font-size: 0.78rem; color: var(--text-dim); }
.mv-top-title {
  font-size: 0.88rem; font-weight: 600; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Filter bar (reuses .feed-filterbar bone) */
.mv-filterbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.mv-filterbar .feed-filter-row { margin-top: 0; }

/* Shorts badge on the thumbnail */
.mv-shorts-badge {
  position: absolute;
  top: 6px; left: 6px;
  padding: 2px 7px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 4px;
  background: var(--red);
  color: #fff;
}

/* Per-card action row */
.mv-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 8px;
}
.mv-actions .btn-soft {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font-size: 0.78rem;
  text-decoration: none;
}
.mv-act-report:disabled {
  opacity: 0.55; cursor: not-allowed;
}
.mv-act-yt svg { color: var(--red); }

/* The grid uses the existing .research-feed layout — no extra rules needed */

/* ───── My Videos → inline analytics panel (Wave 1, Feature 4) ── */
/* Each card is wrapped in .mv-card-wrap so the analytics panel sits
   BELOW the card row instead of squashed alongside the body column.
   When the panel is open, .is-expanded promotes the wrap to span the
   full grid row, giving the retention chart proper width (~1000px+
   on a typical desktop instead of ~360px). */
.mv-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.mv-card-wrap.is-expanded {
  grid-column: 1 / -1;
}
.mv-card-wrap.is-expanded .feed-item {
  border-color: var(--red-border, var(--border-strong));
  box-shadow: 0 4px 18px rgba(255,23,68,0.08);
}

.mv-analytics-panel {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* Loading + error states keep the header bar (with Refresh / Close)
   visible so the user is never stuck with a destroyed panel. */
.mv-analytics-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 12px;
  color: var(--text-dim);
  font-size: 0.86rem;
  text-align: center;
}
.mv-analytics-state.is-error {
  color: var(--red);
  background: rgba(255,23,68,0.06);
  border: 1px solid rgba(255,23,68,0.22);
  border-radius: var(--radius-md);
}
.mv-analytics-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.mv-analytics-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mv-analytics-actions { display: inline-flex; gap: 6px; }
.mv-act-refresh-analytics, .mv-act-collapse {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  font-size: 0.72rem;
}
.mv-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 6px;
}

.mv-analytics-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.6fr) minmax(280px, 1fr);
  gap: 16px;
}
@media (max-width: 760px) {
  .mv-analytics-grid { grid-template-columns: 1fr; }
}
.mv-analytics-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  min-width: 0;
}
.mv-analytics-block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.mv-analytics-block-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}
.mv-analytics-block-meta { font-size: 0.74rem; color: var(--text-dim); }
.mv-analytics-foot {
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
}

.mv-retention-svg {
  width: 100%;
  height: auto;
  min-height: 140px;
  display: block;
}
.mv-traffic-empty {
  padding: 16px 8px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.mv-traffic-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.mv-traffic-row {
  display: grid;
  grid-template-columns: minmax(80px, 90px) 1fr 44px 50px;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
}
.mv-traffic-label {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mv-traffic-bar-wrap {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.mv-traffic-bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), #d4163e);
  border-radius: 999px;
}
.mv-traffic-pct {
  text-align: right;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.mv-traffic-views {
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ───── 100% Research Report (Wave 2, Feature 5) ─────────────── */
.report-main { max-width: 1080px; margin: 0 auto; }

.report-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.84rem;
  color: var(--text-dim);
  text-decoration: none;
  margin: 14px 0 6px;
  padding: 4px 0;
}
.report-back:hover { color: var(--text); }

.report-header {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 18px;
  align-items: center;
  margin: 6px 0 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 880px) {
  .report-header { grid-template-columns: 1fr; }
  .report-thumb-wrap { max-width: 320px; }
}
.report-thumb-wrap {
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.report-thumb { display: block; width: 100%; height: auto; }
.report-header-meta { min-width: 0; }
.report-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 6px 0 6px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.report-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--text-dim);
}
.report-stats strong { color: var(--text); font-weight: 600; }

.report-action-bar {
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 8px;
}
.report-export-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  white-space: nowrap;
  text-decoration: none;
  min-width: 150px;
  justify-content: center;
}
@media (max-width: 880px) {
  .report-action-bar { flex-direction: row; flex-wrap: wrap; align-items: stretch; }
  .report-export-btn { min-width: 0; flex: 0 1 auto; }
}

/* Underperform callout */
.report-callout {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 18px;
  background: rgba(234,179,8,0.08);
  border: 1px solid rgba(234,179,8,0.28);
  border-radius: var(--radius-md);
  color: #facc15;
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 18px;
}
.report-callout strong { color: var(--text); font-weight: 700; }
.report-callout svg { flex: 0 0 auto; margin-top: 2px; }

/* Overall score block */
.report-overall {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
  gap: 4px;
}
.report-overall-num {
  font-size: 3.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.report-overall-of {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 4px;
}
.report-overall-label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.report-overall.score-strong .report-overall-num { color: #22c55e; }
.report-overall.score-fair   .report-overall-num { color: #facc15; }
.report-overall.score-weak   .report-overall-num { color: var(--red); }
.report-overall.score-na     .report-overall-num { color: var(--text-dim); }

/* Section accordion */
.report-sections { display: flex; flex-direction: column; gap: 10px; }
.report-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}
.report-section:hover { border-color: var(--border-strong); }
.report-section[open] {
  border-color: var(--red-border, var(--border-strong));
}
.report-section-summary {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.report-section-summary::-webkit-details-marker { display: none; }
.report-section-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.report-section[open] .report-section-num {
  background: rgba(255,23,68,0.12);
  color: var(--red);
}
.report-section-label {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text);
}
.report-section-score {
  font-size: 0.86rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 999px;
}
.report-section-score-of {
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 1px;
}
.score-strong { background: rgba(34,197,94,0.12); color: #22c55e; }
.score-fair   { background: rgba(234,179,8,0.12); color: #facc15; }
.score-weak   { background: rgba(255,23,68,0.10); color: var(--red); }
.score-na     { background: var(--surface-2); color: var(--text-dim); }
.report-section-chevron {
  color: var(--text-dim);
  transition: transform var(--dur) var(--ease);
}
.report-section[open] .report-section-chevron { transform: rotate(180deg); }

.report-section-body {
  padding: 4px 18px 18px 60px;
  border-top: 1px solid var(--border);
}
.report-block { margin-top: 14px; }
.report-block h4 {
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  margin: 0 0 8px;
}
.report-block ul { padding-left: 22px; margin: 0 0 6px; font-size: 0.92rem; line-height: 1.6; }
.report-block li { margin-bottom: 4px; }
.report-block p  { margin: 0; font-size: 0.92rem; line-height: 1.6; }
.report-block strong { color: var(--text); }

.report-block-differently {
  padding: 10px 14px;
  background: rgba(255,23,68,0.06);
  border-left: 3px solid var(--red);
  border-radius: 6px;
}
.report-block-differently h4 { color: var(--red); }

.report-skip {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.86rem;
  font-style: italic;
}

/* Empty / loading state */
.report-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  text-align: center;
}
.report-passes-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 18px;
  margin: 18px auto 0;
  padding: 0;
  max-width: 640px;
  list-style: none;
  text-align: left;
  color: var(--text-dim);
  font-size: 0.86rem;
}
.report-passes-list li {
  display: flex; align-items: center; gap: 8px;
}
.report-pass-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  opacity: 0.5;
  animation: reportPassPulse 1.4s ease-in-out infinite;
}
.report-passes-list li:nth-child(2) .report-pass-dot { animation-delay: 0.18s; }
.report-passes-list li:nth-child(3) .report-pass-dot { animation-delay: 0.36s; }
.report-passes-list li:nth-child(4) .report-pass-dot { animation-delay: 0.54s; }
.report-passes-list li:nth-child(5) .report-pass-dot { animation-delay: 0.72s; }
.report-passes-list li:nth-child(6) .report-pass-dot { animation-delay: 0.90s; }
.report-passes-list li:nth-child(7) .report-pass-dot { animation-delay: 1.08s; }
.report-passes-list li:nth-child(8) .report-pass-dot { animation-delay: 1.26s; }
@keyframes reportPassPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50%      { opacity: 1.0; transform: scale(1.15); }
}
@media (max-width: 600px) {
  .report-passes-list { grid-template-columns: 1fr; }
}

/* ───── Channel Insights (Wave 2, Feature 6) ───────────────── */
.channel-insights {
  margin: 4px 0 22px;
}
.channel-insights-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.channel-insights-head .section-title { margin: 4px 0 0; }
.channel-insights-head .section-sub { margin: 4px 0 0; color: var(--text-dim); font-size: 0.84rem; }
.channel-insights-actions { display: inline-flex; gap: 8px; align-items: center; }
.ci-refresh-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font-size: 0.78rem;
}

/* Bootstrap (empty-state) card */
.ci-bootstrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.ci-bootstrap-text h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 8px;
}
.ci-bootstrap-text p {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-dim);
}
.ci-bootstrap-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
}
.ci-bootstrap-progress { margin-top: 14px; }
.ci-progress-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.86rem;
}
.ci-progress-ok   { color: #22c55e; }
.ci-progress-fail { color: var(--red); }

/* Insights grid */
.ci-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 880px) {
  .ci-grid { grid-template-columns: 1fr; }
}
.ci-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}
.ci-card-head { display: flex; justify-content: space-between; align-items: baseline; }
.ci-card-title {
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
}

/* Trend sparklines */
.ci-trends { display: flex; flex-direction: column; gap: 6px; }
.ci-spark-row {
  display: grid;
  grid-template-columns: minmax(80px, auto) 1fr 32px 56px;
  gap: 10px;
  align-items: center;
  font-size: 0.82rem;
}
.ci-spark-label { color: var(--text); font-weight: 500; }
.ci-spark { width: 100%; height: 28px; }
.ci-spark-now {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}
.ci-spark-delta {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: right;
}
.ci-spark-delta.ci-trend-up   { color: #22c55e; }
.ci-spark-delta.ci-trend-down { color: var(--red); }

/* Pattern lists */
.ci-pat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.ci-pat-grid h5 {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 6px;
  font-weight: 700;
}
.ci-pat-grid ul,
.ci-killer-list,
.ci-title-list,
.ci-topic-grid ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.84rem;
  color: var(--text);
}
.ci-pat-grid li { line-height: 1.4; }
.ci-pat-grid li strong { color: var(--text); }
.ci-count {
  font-size: 0.74rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Retention killers */
.ci-killer { padding: 8px 10px; border-radius: 8px; background: rgba(255,23,68,0.06); border-left: 3px solid var(--red); }
.ci-killer-meta {
  display: flex; gap: 10px; align-items: baseline;
  margin-bottom: 4px;
}
.ci-killer-window {
  font-weight: 700;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
}
.ci-killer-cause {
  flex: 1;
  font-size: 0.84rem;
  color: var(--text);
}
.ci-killer-count { color: var(--text-dim); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.ci-killer-example {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.4;
}

/* Title patterns */
.ci-title-row {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
}
.ci-title-row-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 3px;
}
.ci-title-pattern { font-weight: 600; color: var(--text); font-size: 0.86rem; }
.ci-title-share { font-size: 0.74rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.ci-title-example {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Topics */
.ci-topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ci-topic-grid h5 {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 6px;
  font-weight: 700;
}
.ci-topic-grid > div:first-child h5 { color: #22c55e; }
.ci-topic-grid > div:last-child  h5 { color: var(--red); }
.ci-topic-grid li {
  display: flex; gap: 6px; align-items: baseline;
}
.ci-topic-score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  font-size: 0.78rem;
}

.ci-empty-line {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  font-style: italic;
}

.ci-progress-running { color: var(--text); }
.ci-progress-queued  { color: var(--text-dim); }
.ci-mini-spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: ciMiniSpin 0.8s linear infinite;
  margin-right: 4px;
  vertical-align: -1px;
}
@keyframes ciMiniSpin { to { transform: rotate(360deg); } }

/* ───── Channel-learnings feedback chip (Wave 2, Feature 7) ───────── */
.learnings-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(99,102,241,0.10);
  color: #818cf8;
  border: 1px solid rgba(99,102,241,0.22);
  cursor: help;
  white-space: nowrap;
}
.learnings-chip svg { color: currentColor; flex: 0 0 auto; }
.handoff-learnings-row {
  margin-bottom: 14px;
}

/* ───── Notifications banner (Wave 2, Feature 8) ───────────────── */
.ntf-banner {
  background: linear-gradient(135deg, rgba(99,102,241,0.14), rgba(255,23,68,0.10));
  border: 1px solid rgba(99,102,241,0.32);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 14px 0 18px;
  animation: ntfFadeIn 0.25s ease;
}
@keyframes ntfFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ntf-banner-inner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.ntf-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(99,102,241,0.20);
  color: #818cf8;
  flex: 0 0 auto;
}
.ntf-text { flex: 1; min-width: 0; font-size: 0.88rem; color: var(--text); line-height: 1.4; }
.ntf-text strong { color: var(--text); font-weight: 700; }
.ntf-underperf-tag {
  display: inline-block;
  padding: 1px 8px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(234,179,8,0.16);
  color: #facc15;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ntf-more {
  font-size: 0.74rem;
  color: var(--text-dim);
}
.ntf-cta {
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease);
}
.ntf-cta:hover { transform: translateY(-1px); }
.ntf-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  padding: 0;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ntf-close:hover { background: rgba(255,255,255,0.06); color: var(--text); }

/* ───── Strategy Brain page (Wave 3) ─────────────────────────────── */
.strategy-main { max-width: 1280px; margin: 0 auto; }

.strategy-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 18px; flex-wrap: wrap;
  margin: 18px 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.strategy-header-meta { min-width: 0; flex: 1 1 380px; }
.strategy-header .page-title { margin: 6px 0 4px; }
.strategy-header .page-sub { margin: 0; color: var(--text-dim); font-size: 0.86rem; }

.strategy-header-actions {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
}
.strategy-control {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.74rem; color: var(--text-dim);
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700;
}
.strategy-control select,
.strategy-num-input {
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}
.strategy-num-input { width: 80px; }
.strategy-num-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 2px rgba(255,23,68,0.15); }
.strategy-gen-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
}

/* Empty state */
.strategy-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  text-align: center;
}
.strategy-empty h2 { margin: 0 0 8px; font-size: 1.2rem; }
.strategy-empty p { margin: 0 0 18px; color: var(--text-dim); font-size: 0.94rem; line-height: 1.6; }
.strategy-empty-stat { margin-top: 16px; font-size: 0.84rem; color: var(--text-dim); }
.strategy-empty-stat strong { color: var(--text); }

/* Loading state */
.strategy-loading {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
}
.strategy-loading-hint {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Summary banner */
.strategy-summary {
  background:
    radial-gradient(circle at 0% 0%, rgba(255,23,68,0.06), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(99,102,241,0.05), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 14px;
}
.strategy-summary-text {
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 8px;
}
.strategy-summary-meta {
  font-size: 0.76rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.strategy-export-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.strategy-export-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
}

/* Calendar grid — column width adapts to how many slots are shown.
   Few slots → wide cards (so they don't look squashed). Many slots → tight. */
.strategy-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.strategy-calendar[data-slot-count="1"] { grid-template-columns: minmax(380px, 560px); }
.strategy-calendar[data-slot-count="2"] { grid-template-columns: repeat(2, minmax(360px, 1fr)); }
.strategy-calendar[data-slot-count="3"] { grid-template-columns: repeat(3, minmax(300px, 1fr)); }
@media (min-width: 1100px) {
  .strategy-calendar[data-slot-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .strategy-calendar[data-slot-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .strategy-calendar[data-slot-count="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .strategy-calendar[data-slot-count="7"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .strategy-calendar,
  .strategy-calendar[data-slot-count] { grid-template-columns: 1fr; }
}

/* Slot card */
.strategy-slot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: grab;
  position: relative;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  min-width: 0;
}
.strategy-slot:hover { border-color: var(--border-strong); }
.strategy-slot.dragging { opacity: 0.5; cursor: grabbing; }
.strategy-slot.drop-target {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(255,23,68,0.20);
  transform: translateY(-2px);
}

.strategy-slot-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px;
}
.strategy-slot-day {
  display: flex; flex-direction: column; gap: 2px;
}
.strategy-slot-num {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.strategy-slot-day-name {
  font-size: 1.0rem;
  font-weight: 700;
  color: var(--text);
}
.strategy-slot-time {
  font-size: 0.74rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Signal strength badge (text-only — small enough that a real ring is overkill).
   Hover the label to see the tooltip explaining what the score means. */
.strategy-slot-signal {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  min-width: 64px;
  cursor: help;
}
.strategy-slot-sig-num {
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.strategy-slot-sig-label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  margin-top: 3px;
  white-space: nowrap;
}
.strategy-sig-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 12px; height: 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-dim);
  background: transparent;
}
.strategy-slot-signal.score-strong .strategy-slot-sig-num { color: #22c55e; }
.strategy-slot-signal.score-fair   .strategy-slot-sig-num { color: #facc15; }
.strategy-slot-signal.score-weak   .strategy-slot-sig-num { color: var(--red); }
.strategy-slot-signal.score-na     .strategy-slot-sig-num { color: var(--text-dim); }

.strategy-slot-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}
.strategy-slot-topic {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: -4px;
}

/* Source video chip */
.strategy-source {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--dur) var(--ease);
}
.strategy-source:hover { border-color: var(--red); }
.strategy-source-thumb {
  width: 56px; height: 32px;
  object-fit: cover;
  border-radius: 4px;
  flex: 0 0 auto;
  background: #000;
}
.strategy-source-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
}
.strategy-source-empty {
  padding: 6px 8px;
  font-size: 0.74rem;
  color: var(--text-dim);
  font-style: italic;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

/* Risks */
.strategy-slot-risks {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.strategy-risk-chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(234,179,8,0.10);
  color: #facc15;
  border: 1px solid rgba(234,179,8,0.22);
}

/* Reasoning fold */
.strategy-slot-reasoning {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.strategy-slot-reasoning summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  padding: 4px 0;
}
.strategy-slot-reasoning summary::-webkit-details-marker { display: none; }
.strategy-slot-reasoning summary::before {
  content: "▸ "; color: var(--text-dim); transition: transform var(--dur) var(--ease); display: inline-block;
}
.strategy-slot-reasoning[open] summary::before { transform: rotate(90deg); }
.strategy-slot-reasoning p { margin: 4px 0 0; line-height: 1.5; color: var(--text); }

/* Slot foot — brief CTA + state badge + drag handle */
.strategy-slot-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.strategy-brief-cta {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  font-size: 0.74rem;
  text-decoration: none;
  flex: 0 1 auto;
}
.strategy-state-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.strategy-state-btn.state-idea          { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }
.strategy-state-btn.state-in_production { background: rgba(99,102,241,0.14); color: #818cf8; border-color: rgba(99,102,241,0.28); }
.strategy-state-btn.state-published     { background: rgba(34,197,94,0.14); color: #22c55e; border-color: rgba(34,197,94,0.28); }
.strategy-state-btn.state-skipped       { background: rgba(255,23,68,0.10); color: var(--red); border-color: rgba(255,23,68,0.28); }
.strategy-slot-drag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: transparent;
  color: var(--text-dim);
  border: 0;
  border-radius: 4px;
  cursor: grab;
}
.strategy-slot-drag:hover { background: var(--surface-2); color: var(--text); }

/* Deferred ideas */
.strategy-deferred {
  margin-top: 22px;
}
.strategy-deferred .section-title { margin: 0 0 12px; }
.strategy-deferred-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.strategy-deferred-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.strategy-deferred-reason {
  flex: 0 0 auto;
  padding: 3px 9px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
}
.strategy-deferred-lower_signal {
  background: rgba(99,102,241,0.10); color: #818cf8;
  border: 1px solid rgba(99,102,241,0.22);
}
.strategy-deferred-topic_overlap {
  background: rgba(234,179,8,0.10); color: #facc15;
  border: 1px solid rgba(234,179,8,0.22);
}
.strategy-deferred-editor_capacity {
  background: rgba(255,23,68,0.10); color: var(--red);
  border: 1px solid rgba(255,23,68,0.22);
}
.strategy-deferred-body { flex: 1; min-width: 0; }
.strategy-deferred-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.strategy-deferred-explanation {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.45;
}

/* ── KPI compact variant — used on My Channel ──────────────────────── */
.kpi-grid-compact .kpi-card {
  padding: 12px 14px 10px;
}
.kpi-grid-compact .kpi-card.skeleton-card { min-height: 70px; }

/* ── Clickable rows on the My Channel "Recent uploads" table ───────── */
.video-table-clickable tbody tr {
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.video-table-clickable tbody tr:hover {
  background: var(--surface-2);
}
.video-table-clickable tbody tr a:hover {
  text-decoration: underline;
}

/* ── Insights page empty state ─────────────────────────────────────── */
.insights-empty {
  text-align: center;
  padding: 48px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
}
.insights-empty h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}
.insights-empty p {
  font-size: 0.92rem;
  color: var(--text-mid);
  max-width: 540px;
  margin: 0 auto 18px;
  line-height: 1.5;
}
.insights-empty-stat {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.86rem;
  color: var(--text-dim);
  margin-bottom: 18px;
}
.insights-empty-stat strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ──────────────────────────────────────────────────────────────────────
 * Shorts Pattern Extractor
 * ──────────────────────────────────────────────────────────────────── */

/* Phase color tokens — used across timeline, cards, pills, and brief preview */
:root {
  --phase-declare:  #ff1744;
  --phase-assess:   #f59e0b;
  --phase-isolate:  #facc15;
  --phase-process:  #22d3ee;
  --phase-build:    #818cf8;
  --phase-reveal:   #22c55e;
}

.shorts-status {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-mid);
}
.shorts-loading {
  padding: 32px;
  display: flex; justify-content: center;
}

/* Result head ─ channel intro + actions */
.shorts-result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 22px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.shorts-result-head-meta { flex: 1; min-width: 280px; }
.shorts-result-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Scorecard */
.shorts-scorecard { margin-bottom: 22px; }
.shorts-scorecard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.shorts-crit {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.shorts-crit-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.shorts-crit-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.shorts-crit-label { font-size: 0.86rem; font-weight: 650; color: var(--text); flex: 1; }
.shorts-crit-rating {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
}
.shorts-crit.score-green  { border-color: #22c55e; background: linear-gradient(135deg, rgba(34,197,94,0.10), transparent 60%), var(--surface); }
.shorts-crit.score-green  .shorts-crit-dot { background: #22c55e; }
.shorts-crit.score-green  .shorts-crit-rating { color: #4ade80; }
.shorts-crit.score-yellow { border-color: #f59e0b; background: linear-gradient(135deg, rgba(245,158,11,0.10), transparent 60%), var(--surface); }
.shorts-crit.score-yellow .shorts-crit-dot { background: #f59e0b; }
.shorts-crit.score-yellow .shorts-crit-rating { color: #fbbf24; }
.shorts-crit.score-red    { border-color: var(--red-border); background: var(--red-soft); }
.shorts-crit.score-red    .shorts-crit-dot { background: var(--red); }
.shorts-crit.score-red    .shorts-crit-rating { color: var(--red); }
.shorts-crit-explain { font-size: 0.86rem; color: var(--text); line-height: 1.4; margin-bottom: 6px; }
.shorts-crit-evidence {
  font-size: 0.78rem; color: var(--text-mid);
  padding-left: 10px; border-left: 2px solid var(--border-strong);
  font-style: italic;
  line-height: 1.45;
}

.shorts-levers {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px;
}
.shorts-lever {
  display: inline-flex; flex-direction: column; gap: 2px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.shorts-lever-label {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
}
.shorts-lever-value { font-size: 0.9rem; font-weight: 600; color: var(--text); }

.shorts-coherence-warn {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(245,158,11,0.08);
  border: 1px solid #f59e0b;
  font-size: 0.84rem;
  color: var(--text);
}

/* 5-phase timeline */
.shorts-timeline-section { margin-bottom: 22px; }
.shorts-timeline-bar {
  display: flex;
  width: 100%;
  height: 64px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin: 14px 0;
}
.shorts-timeline-seg {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4px 6px;
  font-size: 0.74rem;
  font-weight: 650;
  color: rgba(0,0,0,0.85);
  text-align: center;
  border-right: 1px solid rgba(0,0,0,0.18);
  transition: opacity var(--dur) var(--ease);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shorts-timeline-seg:last-child { border-right: 0; }
.shorts-timeline-seg:hover { opacity: 0.85; }
.shorts-timeline-seg-label { font-weight: 700; }
.shorts-timeline-seg-dur { font-size: 0.7rem; opacity: 0.75; }

.phase-declare { background: var(--phase-declare); }
.phase-assess  { background: var(--phase-assess);  }
.phase-isolate { background: var(--phase-isolate); color: rgba(0,0,0,0.85); }
.phase-process { background: var(--phase-process); }
.phase-build   { background: var(--phase-build);   }
.phase-reveal  { background: var(--phase-reveal);  }

.shorts-phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.shorts-phase-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-dim);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.shorts-phase-card.phase-declare { border-left-color: var(--phase-declare); background: var(--surface); }
.shorts-phase-card.phase-assess  { border-left-color: var(--phase-assess);  background: var(--surface); }
.shorts-phase-card.phase-isolate { border-left-color: var(--phase-isolate); background: var(--surface); }
.shorts-phase-card.phase-process { border-left-color: var(--phase-process); background: var(--surface); }
.shorts-phase-card.phase-build   { border-left-color: var(--phase-build);   background: var(--surface); }
.shorts-phase-card.phase-reveal  { border-left-color: var(--phase-reveal);  background: var(--surface); }
.shorts-phase-card.shorts-phase-absent { opacity: 0.55; }
.shorts-phase-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 8px; }
.shorts-phase-name {
  font-size: 0.94rem; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text);
}
.shorts-phase-stats { font-size: 0.74rem; color: var(--text-dim); font-variant-numeric: tabular-nums; text-align: right; }
.shorts-phase-purpose { font-size: 0.82rem; color: var(--text-mid); line-height: 1.4; margin-bottom: 8px; }
.shorts-phase-formula {
  margin-bottom: 8px;
}
.shorts-phase-formula code {
  display: block;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.4;
}
.shorts-phase-examples {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.shorts-phase-examples li {
  font-size: 0.74rem; color: var(--text-dim);
  padding-left: 10px; border-left: 2px solid var(--border);
  line-height: 1.4;
}

/* Title + thumb formula row */
.shorts-formula-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.shorts-formula-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.shorts-formula-label {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim);
  margin-bottom: 8px;
}
.shorts-formula-text {
  font-size: 0.92rem; color: var(--text); line-height: 1.45;
}
code.shorts-formula-text {
  display: block;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Drill-down */
.shorts-drilldown {
  margin-bottom: 22px;
}
.shorts-drilldown-fold {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}
.shorts-drilldown-fold > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  font-weight: 650;
}
.shorts-drilldown-fold > summary::-webkit-details-marker { display: none; }
.shorts-drilldown-fold > summary::before {
  content: "▸"; color: var(--text-dim);
  transition: transform var(--dur) var(--ease);
}
.shorts-drilldown-fold[open] > summary::before { transform: rotate(90deg); }
.shorts-drilldown-count {
  margin-left: auto;
  padding: 2px 8px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.shorts-drilldown-list {
  padding: 0 16px 16px;
  display: flex; flex-direction: column; gap: 14px;
}

.shorts-vd-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.shorts-vd-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.shorts-vd-thumb { flex-shrink: 0; width: 80px; aspect-ratio: 9 / 16; border-radius: 6px; overflow: hidden; background: #000; }
.shorts-vd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.shorts-vd-meta { flex: 1; min-width: 0; }
.shorts-vd-rank {
  display: inline-block;
  font-size: 0.7rem; font-weight: 700; color: var(--text-dim);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.shorts-vd-title {
  display: block;
  font-size: 0.94rem; font-weight: 650; color: var(--text);
  text-decoration: none; margin: 2px 0 6px;
  line-height: 1.3;
}
.shorts-vd-title:hover { color: var(--red); }
.shorts-vd-stats { font-size: 0.76rem; color: var(--text-dim); }
.shorts-vd-formula { margin-top: 6px; }
.shorts-vd-formula code {
  font-size: 0.78rem; padding: 3px 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}
.shorts-vd-warn {
  padding: 8px 12px; margin-bottom: 10px;
  background: rgba(245,158,11,0.10);
  border-left: 3px solid #f59e0b;
  border-radius: 0 4px 4px 0;
  font-size: 0.82rem;
}
.shorts-vd-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.shorts-vd-table th, .shorts-vd-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.shorts-vd-table th {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
  background: var(--surface-3);
}
.shorts-vd-visual-cell { color: var(--text-mid); font-size: 0.78rem; }

/* Phase pill in tables / brief */
.phase-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.85);
}

/* Saved formulas index (within the Shorts tab itself) */
.shorts-saved-head { margin: 24px 0 10px; }
.shorts-saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.shorts-saved-card {
  display: flex; align-items: center; gap: 10px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.shorts-saved-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.shorts-saved-thumb, .shorts-saved-thumb-empty {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}
.shorts-saved-meta { min-width: 0; }
.shorts-saved-name {
  font-weight: 650; font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shorts-saved-stats { font-size: 0.72rem; color: var(--text-dim); }

/* Modal: Generate my channel's version */
.voice-toggle {
  display: flex !important; align-items: center !important; gap: 8px;
  flex-direction: row !important;
  font-weight: 500 !important;
  font-size: 0.86rem !important;
  color: var(--text-mid);
  margin: 4px 0 !important;
}
.voice-toggle input { width: 16px; height: 16px; }

/* Brief preview inside the modal */
.shorts-brief-preview {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 12px;
}
.shorts-brief-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 0.88rem;
}
.shorts-brief-label {
  font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); flex-shrink: 0; min-width: 90px;
}
.shorts-brief-alts {
  display: flex; gap: 6px; flex-wrap: wrap; margin-left: 100px;
}
.shorts-brief-alt {
  font-size: 0.78rem;
  padding: 3px 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-mid);
}
.shorts-brief-summary {
  font-size: 0.92rem; line-height: 1.5; color: var(--text);
  margin: 4px 0;
}
.shorts-brief-phases {
  display: flex; flex-direction: column; gap: 10px;
}
.shorts-brief-phase {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-dim);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.shorts-brief-phase.phase-declare { border-left-color: var(--phase-declare); }
.shorts-brief-phase.phase-assess  { border-left-color: var(--phase-assess);  }
.shorts-brief-phase.phase-isolate { border-left-color: var(--phase-isolate); }
.shorts-brief-phase.phase-process { border-left-color: var(--phase-process); }
.shorts-brief-phase.phase-build   { border-left-color: var(--phase-build);   }
.shorts-brief-phase.phase-reveal  { border-left-color: var(--phase-reveal);  }
.shorts-brief-phase > header {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.86rem; font-weight: 650; margin-bottom: 8px;
}
.shorts-brief-phase-dur { font-size: 0.74rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.shorts-brief-scene {
  border-top: 1px solid var(--border);
  padding: 8px 0 4px;
  font-size: 0.84rem;
  line-height: 1.4;
}
.shorts-brief-scene-head { display: flex; gap: 8px; font-size: 0.72rem; color: var(--text-dim); margin-bottom: 3px; }
.shorts-brief-scene-script,
.shorts-brief-scene-shot,
.shorts-brief-scene-text { margin: 2px 0; color: var(--text); }
.shorts-brief-foot {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.shorts-brief-meta { font-size: 0.78rem; color: var(--text-dim); }
.shorts-brief-warnings { font-size: 0.78rem; color: #fbbf24; }

/* Saved-tab variants for shorts items */
.saved-kind-badge-shorts_brief   { background: rgba(34,211,238,0.14); color: #67e8f9; border: 1px solid rgba(34,211,238,0.32); }
.saved-kind-badge-shorts_formula { background: rgba(167,139,250,0.14); color: #c4b5fd; border: 1px solid rgba(167,139,250,0.32); }
.saved-shorts-preview { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; font-size: 0.84rem; }
.saved-shorts-phase { padding: 6px 8px; border-left: 3px solid var(--text-dim); }
.saved-shorts-phase.phase-declare { border-left-color: var(--phase-declare); }
.saved-shorts-phase.phase-assess  { border-left-color: var(--phase-assess);  }
.saved-shorts-phase.phase-isolate { border-left-color: var(--phase-isolate); }
.saved-shorts-phase.phase-process { border-left-color: var(--phase-process); }
.saved-shorts-phase.phase-build   { border-left-color: var(--phase-build);   }
.saved-shorts-phase.phase-reveal  { border-left-color: var(--phase-reveal);  }
.saved-shorts-scene { font-size: 0.78rem; color: var(--text-mid); padding-left: 12px; }

/* ── Shorts: full-page generated-brief view (sits below the formula) ─── */
.shorts-brief-page {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 2px dashed var(--border);
}
.shorts-brief-page-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 18px;
}
.shorts-brief-page .shorts-brief-preview {
  /* Outside the modal we want the same generous spacing the formula uses */
  gap: 16px;
}
.shorts-brief-page .shorts-brief-phases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.shorts-brief-page .shorts-brief-foot {
  margin-top: 8px;
}
.shorts-brief-page .shorts-brief-row { font-size: 0.92rem; }
.shorts-brief-page .shorts-brief-label { min-width: 110px; }

/* Shorts brief — Save button inline status surface */
.shorts-brief-save-wrap {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.shorts-brief-save-error,
.shorts-brief-save-success {
  font-size: 0.84rem;
  padding: 4px 8px;
  border-radius: 4px;
}
.shorts-brief-save-error {
  color: #ff7a90;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
}
.shorts-brief-save-success {
  background: rgba(34,197,94,0.10);
  border: 1px solid rgba(34,197,94,0.32);
}
.shorts-brief-saved-link {
  color: #4ade80;
  text-decoration: none;
  font-weight: 600;
}
.shorts-brief-saved-link:hover { text-decoration: underline; }
.btn-primary.shorts-brief-saved {
  background: rgba(34,197,94,0.18);
  color: #4ade80;
  border-color: rgba(34,197,94,0.36);
  cursor: default;
}

/* ──────────────────────────────────────────────────────────────────────
 * MOBILE RESPONSIVE PASS — Shotpipe v1
 *
 * Strategy:
 *   1. Kill horizontal page scroll (overflow-x: hidden on body)
 *   2. Hamburger menu replaces the topnav at ≤768px (mobile-nav.js
 *      injects the button + toggles .is-open on .topnav-inner)
 *   3. Page headers, controls, modals all stack instead of wrapping
 *   4. Tables hide low-priority columns on small screens
 *   5. Forms/inputs respect viewport width
 * ──────────────────────────────────────────────────────────────────── */

/* Safety net: no widget should force the page wider than the viewport */
html, body { overflow-x: hidden; max-width: 100%; }
img, video, svg { max-width: 100%; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Hamburger button — only visible at ≤768px via the media query below */
.topnav-toggle {
  display: none;
  width: 38px; height: 38px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  transition: background var(--dur) var(--ease);
}
.topnav-toggle:hover { background: var(--surface-2); }
.topnav-toggle-bar {
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.topnav-inner.is-open .topnav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.topnav-inner.is-open .topnav-toggle-bar:nth-child(2) { opacity: 0; }
.topnav-inner.is-open .topnav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
body.topnav-locked { overflow: hidden; }

/* ── ≤768px (phones + small tablets in portrait) ──────────────────── */
@media (max-width: 768px) {

  /* Topnav becomes: [logo] [hamburger] only, with links + right-cluster
     collapsing into a slide-down panel triggered by JS adding .is-open. */
  .topnav-inner {
    padding: 0 14px;
    gap: 10px;
    height: 52px;
    flex-wrap: wrap;
    position: relative;
  }
  .topnav-toggle {
    display: inline-flex;
    margin-left: auto;
  }
  /* Links + right cluster: hidden by default, full-width below header
     when .is-open. Stack vertically. */
  .topnav-links,
  .topnav-right {
    display: none;
    flex-basis: 100%;
    width: 100%;
  }
  .topnav-inner.is-open .topnav-links,
  .topnav-inner.is-open .topnav-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    margin: 0 -14px;
    gap: 4px;
  }
  .topnav-inner.is-open .topnav-right {
    border-top: 0;
    padding-top: 4px;
    gap: 10px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }
  .topnav-link {
    padding: 12px 14px;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
  }
  .topnav-link.active { background: var(--red-soft); }

  /* Channel switcher / Google / lang controls: shrink labels on mobile */
  .channel-btn { max-width: 200px; }
  .channel-btn-label { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Main padding compact */
  .main, .main.strategy-main { padding: 16px 14px 56px; }

  /* Page header stacks on mobile */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 0 14px;
  }
  .page-header .channel-info { gap: 12px; width: 100%; }
  .page-header .channel-avatar-wrap img,
  .page-header .channel-avatar-wrap .avatar-skeleton { width: 44px; height: 44px; }
  .page-header .channel-name { font-size: 1.15rem; }
  .page-title { font-size: 1.4rem; }
  .page-sub { font-size: 0.86rem; }

  /* Momentum strip takes full width when stacked */
  .momentum-strip {
    width: 100%;
    align-items: flex-start;
    max-height: none;
  }
  .momentum-strip-row { justify-content: flex-start; flex-wrap: wrap; }
  .momentum-detail { text-align: left; white-space: normal; }

  /* Strategy page header actions stack */
  .strategy-header {
    flex-direction: column;
    align-items: stretch;
  }
  .strategy-header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .strategy-header-actions .strategy-control { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .strategy-gen-btn { flex: 1 1 100%; justify-content: center; }

  /* Section title row stays compact */
  .section-title-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .section-title { font-size: 1.1rem; }
  .section-title-lg { font-size: 1.25rem; }

  /* Tables: hide secondary columns on phones, keep Video/Date/Views/Duration */
  .video-table th:nth-child(4),  /* Likes */
  .video-table td:nth-child(4),
  .video-table th:nth-child(5),  /* Comments */
  .video-table td:nth-child(5),
  .video-table th:nth-child(6),  /* Engagement */
  .video-table td:nth-child(6) {
    display: none;
  }
  .video-table th, .video-table td { padding: 8px 8px; font-size: 0.82rem; }
  .video-table .video-cell { gap: 8px; }
  .video-thumb { width: 44px; height: 25px; flex-shrink: 0; }
  .video-title-link {
    font-size: 0.84rem;
    -webkit-line-clamp: 2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  /* Modals: tighter padding, edge-to-edge on narrow phones */
  .modal-backdrop { padding: 10px; }
  .modal {
    padding: 18px;
    max-height: calc(100vh - 20px);
    border-radius: var(--radius);
  }
  .modal-form .form-input,
  .modal-form .form-textarea { font-size: 16px; }  /* prevents iOS auto-zoom */
  .voice-toggle { flex-wrap: wrap; }

  /* Form inputs: edge-to-edge, no overflow */
  .research-input,
  .form-input,
  .form-textarea,
  .strategy-num-input,
  .sort-select { max-width: 100%; box-sizing: border-box; }
  .research-lookup-form {
    flex-wrap: wrap;
  }
  .research-lookup-form .research-input { flex: 1 1 100%; }
  .research-lookup-form button,
  .research-lookup-form select { flex: 1 1 auto; }

  /* Research tabs scroll horizontally on narrow screens */
  .research-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .research-tab {
    flex-shrink: 0;
    padding: 8px 12px;
  }

  /* Shorts pattern phase grid + scorecard already responsive — tighten gaps */
  .shorts-phase-grid,
  .shorts-scorecard-grid,
  .shorts-formula-row,
  .shorts-brief-page .shorts-brief-phases {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .shorts-result-head { flex-direction: column; gap: 12px; }
  .shorts-result-head-actions { flex: 1 1 100%; }

  /* Insights intel sub-tabs scroll horizontally too */
  .intel-subtabs, #intelSection .tab-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .intel-tab { flex-shrink: 0; }

  /* Velocity rows already compact at 900px (separate breakpoint) — fine */

  /* KPI cards tighter padding */
  .kpi-grid-compact .kpi-card { padding: 10px 12px 8px; }

  /* Toast positioning + sizing */
  .toast {
    left: 14px; right: 14px;
    bottom: 14px;
    max-width: none;
    font-size: 0.86rem;
  }

  /* Footer compact */
  .footer { padding: 16px 14px; font-size: 0.78rem; }
}

/* ── ≤480px (small phones, narrow Androids) ───────────────────────── */
@media (max-width: 480px) {
  .topnav-logo { font-size: 0.86rem; gap: 7px; }
  .topnav-logo svg { width: 18px; height: 18px; }
  .channel-btn { padding: 5px 9px; font-size: 0.78rem; }
  .channel-btn-label { max-width: 90px; }
  .lang-btn-label { display: none; }       /* icon-only language switcher */

  /* Table: drop Date column too at very small widths, keep Video / Views / Duration */
  .video-table th:nth-child(2),
  .video-table td:nth-child(2) { display: none; }

  /* Smaller buttons */
  .btn-primary, .btn-secondary { font-size: 0.82rem; padding: 8px 12px; }

  /* Headlines */
  .page-title { font-size: 1.2rem; }
  .section-title { font-size: 1rem; }
}

/* ──────────────────────────────────────────────────────────────────────
 * Auth pages (login / signup) — Shotpipe
 * Distinct shell from the dashboard: centered card, no topnav.
 * ──────────────────────────────────────────────────────────────────── */

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 400px at 20% 0%, rgba(255,23,68,0.10), transparent 60%),
    radial-gradient(800px 400px at 80% 100%, rgba(34,211,238,0.06), transparent 60%),
    var(--bg);
  padding: 24px 16px;
}
.auth-shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.015em;
}
.auth-logo:hover { color: var(--text); }
.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text);
}
.auth-sub {
  font-size: 0.9rem;
  color: var(--text-mid);
  margin: 0 0 22px;
  line-height: 1.5;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-label {
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 8px;
}
.auth-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 16px;  /* prevents iOS auto-zoom */
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.auth-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255,23,68,0.12);
}
.auth-hint {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 4px;
}
.auth-submit {
  width: 100%;
  margin-top: 18px;
  padding: 12px 16px;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
}
.auth-alt {
  margin: 18px 0 0;
  font-size: 0.86rem;
  color: var(--text-mid);
  text-align: center;
}
.auth-alt a {
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
}
.auth-alt a:hover { text-decoration: underline; }
.auth-error {
  padding: 10px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  color: #ff7a90;
  font-size: 0.86rem;
  line-height: 1.45;
}
.auth-notice {
  padding: 10px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.28);
  color: #4ade80;
  font-size: 0.86rem;
  line-height: 1.45;
}
.auth-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
}
.auth-foot a { color: var(--text-mid); text-decoration: none; }
.auth-foot a:hover { color: var(--text); }

@media (max-width: 480px) {
  .auth-card { padding: 24px 20px; }
  .auth-title { font-size: 1.3rem; }
}

/* Onboarding — wider auth card with extra footer */
.auth-shell-wide { max-width: 520px; }
.auth-card-wide { padding: 36px 32px; }
.auth-card-wide .eyebrow { display: inline-block; margin-bottom: 10px; }
.auth-input code,
.auth-hint code {
  font-size: 0.78rem;
  padding: 1px 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.onboard-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-mid);
}
.onboard-foot strong { color: var(--text); }
.onboard-logout-link {
  background: none;
  border: 0;
  color: var(--text-mid);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0;
}
.onboard-logout-link:hover { color: var(--red); }

/* ──────────────────────────────────────────────────────────────────────
 * POLISH v1 — first-impression coherence
 * Hero header, quickstart strip, settings page, channel-menu extras.
 * ──────────────────────────────────────────────────────────────────── */

/* Hero: unified channel header + primary CTAs */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 28px 0 20px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.hero-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-width: 280px;
}
.hero-left .channel-info {
  display: flex;
  align-items: center;
  gap: 16px;
}
.hero-left .channel-avatar-wrap img,
.hero-left .channel-avatar-wrap .avatar-skeleton {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.hero-left .channel-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}
.hero-left .channel-sub {
  font-size: 0.86rem;
  color: var(--text-mid);
  margin-top: 4px;
}
.hero-left .momentum-strip {
  align-self: flex-start;
  border: 0;
  background: transparent;
  padding: 0;
}
.hero-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.86rem;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .hero {
    padding: 18px 0 14px;
    gap: 14px;
  }
  .hero-left .channel-avatar-wrap img,
  .hero-left .channel-avatar-wrap .avatar-skeleton { width: 56px; height: 56px; }
  .hero-left .channel-name { font-size: 1.3rem; }
  .hero-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }
  .hero-cta { flex: 1; justify-content: center; }
}

/* Quickstart strip */
.quickstart {
  background:
    radial-gradient(900px 200px at 0% 0%, rgba(255,23,68,0.08), transparent 60%),
    var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 26px;
}
.quickstart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.quickstart-dismiss {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.quickstart-dismiss:hover { color: var(--text); background: var(--surface-2); }
.quickstart-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 6px 0 16px;
}
.quickstart-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.quickstart-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.quickstart-step.is-done {
  opacity: 0.6;
  border-color: rgba(34,197,94,0.32);
  background: rgba(34,197,94,0.04);
}
.quickstart-step.is-done .quickstart-num {
  background: rgba(34,197,94,0.18);
  color: #4ade80;
}
.quickstart-step.is-done .quickstart-num::after { content: "✓"; }
.quickstart-step.is-done .quickstart-num span { display: none; }
.quickstart-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-size: 0.86rem;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.quickstart-body { flex: 1; min-width: 0; }
.quickstart-step-title {
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 3px;
}
.quickstart-step-sub {
  font-size: 0.78rem;
  color: var(--text-mid);
  line-height: 1.45;
  margin-bottom: 10px;
}

/* Settings page */
.settings-main { max-width: 880px; }
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.settings-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.settings-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 12px;
}
.settings-section-head .settings-section-title { margin: 0; }
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}
.settings-row:last-child { border-bottom: 0; }
.settings-row-action { justify-content: flex-end; padding-top: 14px; }
.settings-row-action > div { flex: 1; }
.settings-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  min-width: 100px;
}
.settings-value {
  font-size: 0.88rem;
  color: var(--text-mid);
  text-align: right;
  max-width: 60%;
}
.settings-value-mid {
  text-align: left;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.settings-inline-form { display: inline; }

.settings-channel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-channel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  gap: 14px;
}
.settings-channel-row.is-active { border-color: var(--red-border); background: var(--red-soft); }
.settings-channel-meta { min-width: 0; }
.settings-channel-name {
  font-size: 0.94rem;
  font-weight: 650;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-channel-badge {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,23,68,0.10);
  border: 1px solid rgba(255,23,68,0.32);
}
.settings-channel-id {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.settings-channel-id code {
  background: transparent;
  font-size: 0.74rem;
  color: var(--text-mid);
  padding: 0;
}
.settings-empty {
  padding: 24px;
  text-align: center;
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-mid);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.settings-danger {
  border-color: rgba(255,23,68,0.20);
}
.settings-danger .settings-section-title { color: #ff7a90; }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* Channel menu extras (Add channel + Settings) */
.channel-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.channel-option-link {
  color: var(--text-mid);
  font-weight: 500;
}
.channel-option-link:hover { color: var(--text); background: var(--surface-2); }

@media (max-width: 768px) {
  .settings-section { padding: 18px; }
  .settings-channel-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ──────────────────────────────────────────────────────────────────────
 * POLISH v2 — friction reducers
 * Onboarding preview card · Empty-state component · Loading utility
 * ──────────────────────────────────────────────────────────────────── */

/* Onboarding channel-preview card (revealed after 600ms debounce) */
.onboard-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 10px 0;
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.32);
  border-radius: var(--radius);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.onboard-preview.is-warning {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.32);
}
.onboard-preview-thumb {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border-strong);
  background: var(--surface-2);
}
.onboard-preview-meta { flex: 1; min-width: 0; }
.onboard-preview-name {
  font-weight: 650;
  color: var(--text);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.onboard-preview-stats {
  font-size: 0.78rem;
  color: var(--text-mid);
  margin-top: 2px;
}
.onboard-preview-check {
  color: #4ade80;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}
.onboard-preview.is-warning .onboard-preview-check {
  color: #fbbf24;
}
.onboard-preview.is-warning .onboard-preview-check::before { content: "⚠"; font-size: 0.95rem; }
.onboard-preview.is-warning .onboard-preview-check { font-size: 1rem; }

/* Reusable empty-state component */
.empty-state {
  text-align: center;
  padding: 28px 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.empty-state-large { padding: 48px 32px; }
.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-dim);
  margin-bottom: 14px;
}
.empty-state-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.empty-state-body {
  font-size: 0.9rem;
  color: var(--text-mid);
  max-width: 480px;
  margin: 0 auto 18px;
  line-height: 1.5;
}

/* Loading utility (window.startLoading) — button-level spinner */
.btn-spinner {
  animation: btn-spin 0.9s linear infinite;
  flex-shrink: 0;
}
.btn-spinner-label { margin-left: 6px; }
.is-loading {
  cursor: wait !important;
  opacity: 0.85;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Logo render polish — kills baseline-alignment issues + adds subtle
   hover lift on the topnav wordmark. */
.topnav-mark,
.auth-logo-mark {
  display: block;
  flex-shrink: 0;
  image-rendering: -webkit-optimize-contrast;
}
.topnav-logo {
  transition: opacity var(--dur) var(--ease);
}
.topnav-logo:hover { opacity: 0.85; }
.auth-logo {
  transition: opacity var(--dur) var(--ease);
}
.auth-logo:hover { opacity: 0.85; }
