/* Centurion Creator — dark "Centurion Ops" design system (MCN Dashboard V2 template) */

:root {
  color-scheme: dark;

  --color-bg: #09090B;
  --color-surface: #131316;
  --color-surface-sunken: #1B1B20;
  --color-surface-raised: #202027;
  --color-border: #26262D;
  --color-border-strong: #34343D;
  --color-text: #F4F4F6;
  --color-text-muted: #A2A2AC;
  --color-text-faint: #71717A;

  --color-primary: #E6195E;
  --color-primary-bright: #FF4D8D;
  --color-primary-dark: #C01450;
  --color-primary-soft: rgba(230, 25, 94, 0.14);

  --color-ai: #A78BFA;
  --color-ai-soft: rgba(167, 139, 250, 0.13);
  --color-ai-blue: #38BDF8;

  --color-good: #34D399;
  --color-good-soft: rgba(52, 211, 153, 0.12);
  --color-amber: #FBBF24;
  --color-amber-soft: rgba(251, 191, 36, 0.11);
  --color-danger: #F87171;
  --color-danger-soft: rgba(248, 113, 113, 0.12);

  --color-cyan: #22D3EE;
  --color-yellow: #FACC15;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.65);
  --shadow-nav: 0 -4px 20px rgba(0, 0, 0, 0.5);

  --header-h: 64px;
  --bottom-nav-h: 64px;
  --sidebar-w: 250px;

  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }

a { color: var(--color-primary-bright); }

button {
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--color-primary-bright);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: rgba(230, 25, 94, 0.35); }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }

/* ---------- App shell ---------- */

#app {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  display: none;
}

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

.app-header .header-titles { min-width: 0; flex: 1; }
.hide-xs { display: none; }
@media (min-width: 420px) { .hide-xs { display: inline; } }
.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .header-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.page-content {
  flex: 1;
  padding: 16px 16px calc(var(--bottom-nav-h) + 24px) 16px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-bright); }
.btn-secondary { background: var(--color-surface-raised); color: var(--color-text); border-color: var(--color-border-strong); }
.btn-secondary:hover { background: #282830; border-color: #43434e; }
.btn-ghost { background: transparent; color: var(--color-primary-bright); }
.btn-ghost:hover { background: var(--color-primary-soft); }
.btn-ai { background: var(--color-ai-soft); color: var(--color-ai); border-color: rgba(167, 139, 250, 0.25); }
.btn-ai:hover { background: rgba(167, 139, 250, 0.22); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon-only { padding: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Cards & panels ---------- */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

/* nested cards sit on a lighter sunken tone */
.card .card { box-shadow: none; }

.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 28px 0 12px;
}
.section-title-row:first-child { margin-top: 0; }
.section-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-link { font-size: 12px; color: var(--color-primary-bright); font-weight: 600; cursor: pointer; text-decoration: none; }
.section-link:hover { text-decoration: underline; }

.grid {
  display: grid;
  gap: 12px;
}
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ---------- Collapsible sections ---------- */

details.collapse-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  margin: 16px 0;
}
details.collapse-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--color-text);
  user-select: none;
}
details.collapse-section > summary::-webkit-details-marker { display: none; }
details.collapse-section > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-faint);
  border-bottom: 2px solid var(--color-text-faint);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  margin-right: 4px;
}
details.collapse-section[open] > summary::after { transform: rotate(225deg); }
details.collapse-section > summary:hover { color: var(--color-primary-bright); }
details.collapse-section > .collapse-body { padding: 0 16px 16px; }
details.collapse-section > .collapse-body > .section-title-row:first-child { margin-top: 0; }
.collapse-hint { font-size: 11.5px; font-weight: 600; color: var(--color-text-faint); }

/* ---------- KPI / score card ---------- */

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.kpi-card .kpi-label { font-size: 11px; color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-card .kpi-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.kpi-card .kpi-value .kpi-suffix { font-size: 13px; font-weight: 600; color: var(--color-text-muted); }
.kpi-card .kpi-change { font-size: 11px; font-weight: 600; display: inline-flex; align-items: flex-start; gap: 4px; width: fit-content; line-height: 1.35; }

.tone-good { color: var(--color-good); }
.tone-amber { color: var(--color-amber); }
.tone-danger { color: var(--color-danger); }
.tone-ai { color: var(--color-ai); }

.chip {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-good { background: var(--color-good-soft); color: var(--color-good); border-color: rgba(52, 211, 153, 0.22); }
.chip-amber { background: var(--color-amber-soft); color: var(--color-amber); border-color: rgba(251, 191, 36, 0.22); }
.chip-danger { background: var(--color-danger-soft); color: var(--color-danger); border-color: rgba(248, 113, 113, 0.22); }
.chip-ai { background: var(--color-ai-soft); color: var(--color-ai); border-color: rgba(167, 139, 250, 0.22); }
.chip-neutral { background: var(--color-surface-raised); color: var(--color-text-muted); border-color: var(--color-border-strong); }

/* status dot on stateful chips, like the template's status pills */
.chip-good::before, .chip-amber::before, .chip-danger::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ---------- score gauge (circular) ---------- */

.score-gauge { position: relative; width: 76px; height: 76px; flex-shrink: 0; }
.score-gauge svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.score-gauge .gauge-track { fill: none; stroke: var(--color-surface-raised); stroke-width: 8; }
.score-gauge .gauge-value { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.score-gauge .gauge-number {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
}

/* ---------- AI insight panel ---------- */

.insight-panel {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.12), rgba(56, 189, 248, 0.06) 120%);
  border: 1px solid rgba(167, 139, 250, 0.22);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.insight-panel .insight-kicker,
.insight-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--color-ai);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.insight-panel h3 { font-size: 16px; margin-bottom: 8px; }
.insight-panel p { font-size: 13.5px; line-height: 1.55; color: var(--color-text); }
.insight-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--color-text-muted);
}
.insight-meta span { display: inline-flex; align-items: center; gap: 4px; }
.insight-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Chart containers ---------- */

.chart-card .chart-card-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.chart-card .chart-card-sub { font-size: 11.5px; color: var(--color-text-muted); margin-bottom: 8px; }
.chart { width: 100%; height: auto; display: block; }
.chart-label { font-size: 9.5px; fill: var(--color-text-muted); font-family: inherit; }
.chart-value { font-size: 10.5px; fill: var(--color-text); font-weight: 700; font-family: inherit; }
.chart-label-radar { font-size: 9px; fill: var(--color-text-muted); }
.chart-label-quadrant { font-size: 9.5px; fill: var(--color-text); font-weight: 600; }

.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--color-text-muted); }
.donut-legend .legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

.quadrant-wrap { position: relative; }
.quadrant-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-size: 10px;
  color: var(--color-text-faint);
  font-weight: 600;
  margin-top: 4px;
}

/* ---------- Opportunity / recommendation cards ---------- */

.opportunity-card, .recommendation-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.opportunity-card .card-head, .recommendation-card .card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.opportunity-card h4, .recommendation-card h4 { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.opportunity-card p, .recommendation-card p { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.45; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 8px; flex-wrap: wrap; }

/* ---------- Checklist ---------- */

.checklist { display: flex; flex-direction: column; gap: 2px; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13.5px;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item .check-box {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--color-border-strong);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.checklist-item.done .check-box { background: var(--color-good); border-color: var(--color-good); color: #06251A; }
.checklist-item.done span.check-label { text-decoration: line-through; color: var(--color-text-faint); }

/* ---------- Video card ---------- */

.video-card { display: flex; flex-direction: column; gap: 0; overflow: hidden; padding: 0; }
.video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 10px;
}
.video-thumb .thumb-format {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.video-thumb .thumb-status {
  position: absolute;
  top: 10px;
  right: 10px;
}
.video-thumb-svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.9; }

.video-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.video-title { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.video-meta-row { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: var(--color-text-muted); }
.video-meta-row b { color: var(--color-text); font-weight: 700; }
.video-scores-row { display: flex; gap: 14px; font-size: 11px; color: var(--color-text-muted); }
.video-scores-row b { color: var(--color-text); }
.video-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }

.video-list-table { display: none; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; }

table.data-table,
table.video-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.data-table th,
table.video-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
}
table.data-table td,
table.video-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  color: var(--color-text);
}
table.data-table tr:last-child td,
table.video-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover,
table.video-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

table.data-table td .filter-bar,
table.video-table td .filter-bar { flex-wrap: wrap; overflow: visible; margin-top: 0; min-width: 160px; }

.table-thumb { width: 64px; height: 36px; border-radius: 8px; flex-shrink: 0; }
.table-title-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.table-title-cell .t-title { font-weight: 600; font-size: 12.5px; }
.table-title-cell .t-sub { font-size: 11px; color: var(--color-text-muted); }

/* ---------- Filters / search / forms ---------- */

.filter-bar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; align-items: center; }
.filter-bar::-webkit-scrollbar { display: none; }
/* chip rows inside cards are badges, not scrollers — let them wrap */
.card .filter-bar, .selected-channel-banner .filter-bar { flex-wrap: wrap; overflow: visible; }
.filter-chip {
  flex-shrink: 0;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.filter-chip:hover { color: var(--color-text); border-color: #43434e; }
.filter-chip.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.search-input, .text-input, textarea.text-input, select.text-input {
  width: 100%;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-sunken);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--color-text);
}
.search-input::placeholder, .text-input::placeholder { color: var(--color-text-faint); }
.search-input:focus, .text-input:focus { outline: none; border-color: var(--color-primary); }
select.text-input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.field-label { font-size: 11px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; display: block; }
.field-group { margin-bottom: 14px; }
.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.segmented button {
  flex: 1;
  padding: 9px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
}
.segmented button.active { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary-bright); }

input[type="checkbox"] { accent-color: var(--color-primary); width: 15px; height: 15px; }

/* ---------- Admin demo scan ---------- */

.admin-scan-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}
.admin-scan-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-scan-main h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 5px;
}
.admin-scan-main p,
.admin-subcard p {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.admin-scan-controls {
  display: grid;
  gap: 10px;
}
.admin-scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-scan-actions .btn {
  flex: 1 1 160px;
}
.admin-scan-status {
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.admin-scan-grid {
  display: grid;
  gap: 12px;
}
.admin-subcard {
  background: var(--color-surface-sunken);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.admin-chip-block {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-alert {
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
}
.admin-alert-warning {
  background: var(--color-amber-soft);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #FDE68A;
}
.admin-alert-danger {
  background: var(--color-danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #FCA5A5;
}
.admin-delta-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* ---------- Selected channel banner ---------- */

.selected-channel-banner {
  margin: 16px auto 0;
  width: calc(100% - 32px);
  max-width: 1208px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px 12px;
}
.selected-channel-banner.no-channel {
  align-items: flex-start;
  background: var(--color-amber-soft);
  border-color: rgba(251, 191, 36, 0.3);
}
.selected-channel-banner .selected-channel-thumb {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--color-primary-soft);
  color: var(--color-primary-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
}
.selected-channel-banner .selected-channel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.selected-channel-copy {
  min-width: 0;
  flex: 1;
}
.selected-channel-title {
  font-size: 14px;
  font-weight: 800;
  margin-top: 2px;
}
.selected-channel-copy p {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.selected-channel-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}
.selected-channel-actions .btn { margin-left: auto; }

/* ---------- Scanned channels ---------- */

.scanned-channels-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.scanned-channels-page-card {
  margin-bottom: 0;
}
.scanned-channel-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 10px;
}
.scanned-channels-head {
  display: grid;
  gap: 6px;
}
.scanned-channels-head p {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.scanned-channel-list {
  display: grid;
  gap: 12px;
}
.scanned-channel-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.scanned-channel-card.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-soft);
}
.scanned-channel-identity {
  display: flex;
  gap: 12px;
  min-width: 0;
}
.scanned-channel-thumb {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--color-primary-soft);
  color: var(--color-primary-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  overflow: hidden;
}
.scanned-channel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scanned-channel-card h4 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 3px;
}
.scanned-channel-id {
  font-size: 11.5px;
  color: var(--color-text-faint);
  overflow-wrap: anywhere;
}
.scanned-channel-badges {
  margin-top: 8px;
  flex-wrap: wrap;
  overflow: visible;
}
.scanned-channel-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.scanned-channel-metrics .kpi-card {
  box-shadow: none;
  padding: 12px;
}
.scanned-channel-metrics .kpi-value {
  font-size: 16px;
}
.scanned-channel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.scanned-channel-actions .btn {
  flex: 1 1 130px;
}

/* ---------- Reports ---------- */

.report-history-page-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.report-history-list {
  display: grid;
  gap: 12px;
}
.report-history-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.report-history-card h4 {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  margin: 4px 0;
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.report-history-card p {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.report-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.share-status-block {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.share-url-input {
  font-size: 11.5px;
  min-height: 34px;
}

/* ---------- Public share page ---------- */

.public-share-mode {
  background: var(--color-bg);
}
.public-report-shell {
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 40px;
}
.public-report-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.public-report-brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary), #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}
.public-report-brand .brand-name {
  font-size: 15px;
  font-weight: 800;
}
.public-report-brand .brand-sub {
  font-size: 11.5px;
  color: var(--color-text-muted);
}
.public-report-hero {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  padding: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.public-report-hero h1 {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 4px 0 6px;
}
.public-report-hero p,
.public-report-cta p,
.public-report-footer {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.55;
}
.public-disclaimer {
  margin-bottom: 16px;
}
.public-report-cta {
  margin-top: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  padding: 18px;
}
.public-report-cta h2 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}
.public-report-cta .btn {
  margin-top: 12px;
  width: fit-content;
  text-decoration: none;
}
.public-report-footer {
  text-align: center;
  margin-top: 18px;
}

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 4px; background: var(--color-surface); border: 1px solid var(--color-border); padding: 4px; border-radius: 999px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1;
  white-space: nowrap;
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { background: var(--color-primary); color: #fff; }
.tab-panel { display: none; margin-top: 16px; }
.tab-panel.active { display: block; }

/* ---------- Protection category card ---------- */

.protection-card { display: flex; flex-direction: column; gap: 10px; }
.protection-card .pc-head { display: flex; align-items: center; gap: 12px; }
.protection-card .pc-name { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.protection-meaning { font-size: 12px; color: var(--color-text-muted); line-height: 1.45; }
.protection-row { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; }
.protection-row .p-label { font-weight: 700; min-width: 78px; flex-shrink: 0; color: var(--color-text-muted); }
.protection-row > span:last-child { flex: 1 1 120px; min-width: 0; overflow-wrap: break-word; }

/* ---------- Rewrite / before-after ---------- */

.rewrite-grid { display: grid; gap: 10px; }
.rewrite-box { border-radius: var(--radius-md); padding: 12px; font-size: 13px; font-weight: 600; line-height: 1.45; border: 1px solid transparent; }
.rewrite-before { background: var(--color-danger-soft); border-color: rgba(248, 113, 113, 0.25); color: #FCA5A5; }
.rewrite-after { background: var(--color-good-soft); border-color: rgba(52, 211, 153, 0.25); color: #6EE7B7; }
.rewrite-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 4px; opacity: 0.75; }

/* ---------- Benchmark card ---------- */

.benchmark-card { display: flex; flex-direction: column; gap: 8px; }
.benchmark-head { display: flex; align-items: center; gap: 10px; }
.benchmark-avatar {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
}
.benchmark-stats { display: flex; gap: 14px; font-size: 12px; color: var(--color-text-muted); }
.benchmark-stats b { color: var(--color-text); }

/* ---------- Trend card ---------- */

.trend-card { display: flex; flex-direction: column; gap: 8px; }
.trend-card .tc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Prompts page ---------- */

.scanned-channels-layout {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}
.prompt-editor { display: flex; flex-direction: column; }
.prompt-editor textarea.text-input {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
}
.prompt-editor pre {
  margin: 0;
  padding: 10px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--color-text-muted);
}

/* ---------- Empty / loading states ---------- */

.empty-state, .loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--color-text-muted);
}
.empty-state .es-icon { font-size: 30px; margin-bottom: 4px; opacity: 0.85; }
.empty-state p { font-size: 13.5px; max-width: 340px; line-height: 1.5; }

.skeleton-card { height: 84px; border-radius: var(--radius-lg); background: linear-gradient(90deg, var(--color-surface-sunken) 25%, var(--color-surface-raised) 37%, var(--color-surface-sunken) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Upgrade prompt ---------- */

.upgrade-card {
  background: linear-gradient(135deg, #2A0F1E, #4C1D95 140%);
  border: 1px solid rgba(230, 25, 94, 0.3);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 18px;
}
.upgrade-card h4 { font-size: 15px; margin-bottom: 4px; }
.upgrade-card p { font-size: 12.5px; color: rgba(255, 255, 255, 0.72); line-height: 1.45; }
.usage-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; margin: 10px 0 4px; }
.usage-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; margin-bottom: 10px; }
.usage-bar-fill { height: 100%; background: var(--color-primary-bright); border-radius: 999px; }
.usage-bar-fill.tone-amber { background: var(--color-amber); }

/* ---------- Lifecycle timeline ---------- */

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 12px; }
.timeline-marker { display: flex; flex-direction: column; align-items: center; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--color-border-strong); flex-shrink: 0; margin-top: 3px; }
.timeline-item.done .timeline-dot { background: var(--color-good); }
.timeline-item.active .timeline-dot { background: var(--color-primary); box-shadow: 0 0 0 4px var(--color-primary-soft); }
.timeline-line { flex: 1; width: 2px; background: var(--color-border); margin: 2px 0; }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-content { padding-bottom: 20px; }
.timeline-label { font-size: 13px; font-weight: 700; }
.timeline-detail { font-size: 12px; color: var(--color-text-muted); }

/* ---------- Comment themes ---------- */

.comment-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; color: var(--color-text-muted); }
.comment-item:last-child { border-bottom: none; }

/* ---------- Bottom nav (mobile) ---------- */

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: rgba(15, 15, 18, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border);
  box-shadow: var(--shadow-nav);
  display: flex;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--color-text-faint);
  font-size: 10px;
  font-weight: 600;
}
.bottom-nav-item.active { color: var(--color-primary-bright); }
.bottom-nav-item .icon { width: 21px; height: 21px; }

/* ---------- More sheet ---------- */

.more-sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  z-index: 40; display: none;
}
.more-sheet-backdrop.open { display: block; }
.more-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 10px 16px calc(24px + env(safe-area-inset-bottom, 0));
  z-index: 41;
  transform: translateY(100%);
  transition: transform 0.22s ease;
}
.more-sheet.open { transform: translateY(0); }
.more-sheet-handle { width: 36px; height: 4px; border-radius: 999px; background: var(--color-border-strong); margin: 8px auto 14px; }
.more-sheet-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 6px; border: none; background: transparent; width: 100%;
  font-size: 14.5px; font-weight: 600; color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.more-sheet-item:hover { color: var(--color-primary-bright); }
.more-sheet-item:last-child { border-bottom: none; }
.more-sheet-item .icon { color: var(--color-primary-bright); }

/* ---------- Page router ---------- */

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

/* ---------- Header buttons on scan ---------- */

.scanning-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--color-primary-bright);
  font-weight: 600;
}
.scanning-indicator.active { display: inline-flex; }
.scanning-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-primary-bright); animation: pulse 1s ease infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ---------- Scrollbars ---------- */

* { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 999px; border: 2px solid var(--color-bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Tablet
   ============================================================ */
@media (min-width: 640px) {
  .grid-sm-2 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .page-content { padding-left: 24px; padding-right: 24px; }
  .video-grid { grid-template-columns: repeat(2, 1fr); }
  .idea-grid { grid-template-columns: repeat(2, 1fr); }
  .opportunity-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 479px) {
  /* content cards stack on small phones; compact KPI tiles stay two-up */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid, .summary-grid, .protection-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 639px) {
  .video-grid { grid-template-columns: 1fr; }
  .selected-channel-banner {
    align-items: flex-start;
  }
  .selected-channel-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .scanned-channel-toolbar {
    grid-template-columns: 1fr;
  }
  .report-history-card {
    flex-direction: column;
  }
  .report-card-actions {
    justify-content: flex-start;
  }
}

/* ============================================================
   Desktop
   ============================================================ */
@media (min-width: 1024px) {
  :root { --header-h: 72px; }

  .bottom-nav, .more-sheet-backdrop, .more-sheet { display: none !important; }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
  .sidebar-brand .brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--color-primary), #7C3AED);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 14px;
  }
  .sidebar-brand .brand-name { font-size: 14px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
  .sidebar-brand .brand-sub { font-size: 11px; color: var(--color-text-faint); }

  .sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .sidebar-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    border: none; background: transparent; color: var(--color-text-muted);
    font-size: 13.5px; font-weight: 600; text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .sidebar-nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--color-text); }
  .sidebar-nav-item.active { background: var(--color-primary-soft); color: var(--color-primary-bright); }

  .sidebar-footer { border-top: 1px solid var(--color-border); padding-top: 12px; margin-top: 12px; }
  .sidebar-channel { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
  .sidebar-channel .channel-avatar {
    width: 32px; height: 32px; border-radius: 9px;
    background: var(--color-primary-soft); color: var(--color-primary-bright);
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px;
    overflow: hidden; flex-shrink: 0;
  }
  .sidebar-channel .channel-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .sidebar-channel .channel-name { font-size: 12.5px; font-weight: 700; }
  .sidebar-channel .channel-handle { font-size: 11px; color: var(--color-text-muted); overflow-wrap: anywhere; }
  .sidebar-status { display: flex; align-items: center; gap: 7px; padding: 8px 10px 0; font-size: 11px; color: var(--color-text-faint); font-weight: 600; }
  .sidebar-status .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-good); }

  .page-content { padding: 24px 32px 48px; }
  .app-header { padding: 0 32px; }

  .kpi-grid { grid-template-columns: repeat(6, 1fr); }
  .opportunity-grid { grid-template-columns: repeat(3, 1fr); }
  .video-grid { display: none; }
  .video-list-table { display: block; }
  .idea-grid { grid-template-columns: repeat(3, 1fr); }
  .protection-overview-grid { grid-template-columns: repeat(6, 1fr); }
  .dashboard-charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
  .two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
  .admin-scan-main { flex-direction: row; align-items: flex-start; justify-content: space-between; }
  .admin-scan-controls { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
  .admin-scan-actions .btn { flex: 0 1 auto; }
  .admin-scan-grid { grid-template-columns: 1.2fr 1fr; }
  .scanned-channel-card { display: grid; grid-template-columns: 1.1fr 1fr; align-items: start; }
  .scanned-channel-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .scanned-channel-actions .btn { flex: 0 0 auto; }
  .report-history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .benchmark-grid { grid-template-columns: repeat(3, 1fr); }
  .lesson-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-grid { grid-template-columns: repeat(5, 1fr); }
  .scanned-channels-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

@media (min-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(6, 1fr); }
}
