/* ══════════════════════════════════════════════════════════════
   WEO Competitive Intelligence — Command Center Design
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-hover: #f1f5f9;

  /* Sidebar — dark navy */
  --sidebar-bg: #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-text-active: #f1f5f9;
  --sidebar-hover: #1e293b;
  --sidebar-accent: #475569;

  /* Borders */
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  /* Text — slate palette */
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #64748b;

  /* Brand — blue/indigo gradient */
  --brand: linear-gradient(135deg, #3b82f6, #6366f1);
  --brand-solid: #3b82f6;

  /* Category colors */
  --cat-visibility: #3b82f6;
  --cat-content: #22c55e;
  --cat-demand: #f97316;
  --cat-ai: #a855f7;

  /* CTA — amber gradient */
  --cta-bg: linear-gradient(135deg, #f59e0b, #d97706);
  --cta-hover: linear-gradient(135deg, #d97706, #b45309);
  --cta-shadow: rgba(217, 119, 6, 0.3);

  /* Semantic */
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --success-text: #166534;
  --warning: #f59e0b;
  --warning-bg: #fefce8;
  --warning-text: #854d0e;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --info-bg: #eff6ff;
  --info-text: #1e40af;

  /* Depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);

  /* Radii */
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;

  /* Typography */
  --font: "Geist Sans", "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "SF Mono", "Fira Code", monospace;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select { font: inherit; }
button { cursor: pointer; border: none; background: none; }
input, select { outline: none; }
a { text-decoration: none; color: inherit; }

/* ══════════════════════════════════════════════════════════════
   LAYOUT SHELL
   ══════════════════════════════════════════════════════════════ */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR — dark navy
   ══════════════════════════════════════════════════════════════ */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--brand);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--sidebar-text-active);
  letter-spacing: -0.01em;
}

.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--sidebar-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
  padding-left: 42px;
}

/* Sidebar sections */
.sidebar-section {
  padding: 16px 12px 8px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-accent);
  padding: 0 8px 8px;
}

/* Nav items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text);
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-hover);
}

.nav-item.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--brand-solid);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: var(--sidebar-hover);
  color: var(--ink-soft);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
}

.nav-item.active .nav-badge {
  background: #334155;
  color: var(--sidebar-text);
}

.sidebar-spacer { flex: 1; }

/* Sidebar admin */
.sidebar-admin {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
}

.admin-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all 0.15s ease;
}

.admin-trigger:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.admin-trigger .nav-icon { font-size: 14px; }

.admin-expanded {
  margin-top: 8px;
}

.sidebar .admin-input {
  width: 100%;
  height: 34px;
  background: var(--sidebar-hover);
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 12px;
  color: var(--sidebar-text-hover);
}

.sidebar .admin-input::placeholder { color: var(--sidebar-accent); }
.sidebar .admin-input:focus { border-color: var(--brand-solid); }

.admin-status {
  font-size: 11px;
  margin-top: 6px;
  padding-left: 2px;
}

.admin-status.locked { color: #f59e0b; }
.admin-status.unlocked { color: #22c55e; }
.admin-status.error { color: #ef4444; }

/* ══════════════════════════════════════════════════════════════
   MAIN AREA
   ══════════════════════════════════════════════════════════════ */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top bar */
.topbar {
  height: 52px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-faint);
}

.breadcrumb-sep {
  font-size: 11px;
  color: var(--line-strong);
}

.breadcrumb-current {
  color: var(--ink);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.status-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-badge.ready { background: var(--success-bg); color: var(--success-text); }
.status-badge.ready .dot { background: var(--success); }
.status-badge.running { background: var(--info-bg); color: var(--info-text); }
.status-badge.running .dot { background: var(--brand-solid); animation: pulse 1.5s infinite; }
.status-badge.locked { background: var(--warning-bg); color: var(--warning-text); }
.status-badge.locked .dot { background: var(--warning); }
.status-badge.error { background: var(--danger-bg); color: var(--danger-text); }
.status-badge.error .dot { background: var(--danger); }

.topbar-button {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.topbar-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

/* Content area */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}

/* ══════════════════════════════════════════════════════════════
   VIEW PANELS (switchable)
   ══════════════════════════════════════════════════════════════ */
.view-panel { display: none; }
.view-panel.active { display: block; }

/* ══════════════════════════════════════════════════════════════
   HERO BANNER
   ══════════════════════════════════════════════════════════════ */
.hero-banner {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 20px 32px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 70% 90% at 90% 40%, rgba(59, 130, 246, 0.1), transparent 70%),
    radial-gradient(ellipse 50% 80% at 70% 80%, rgba(99, 102, 241, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 70% at 10% 60%, rgba(168, 85, 247, 0.07), transparent 65%),
    radial-gradient(ellipse 40% 50% at 30% 20%, rgba(34, 197, 94, 0.05), transparent 60%),
    linear-gradient(145deg, #0c1222 0%, #131d36 35%, #1a2744 65%, #1e293b 100%);
  color: #fff;
  overflow: hidden;
  position: relative;
}

.hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-content {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.hero-title {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #f1f5f9;
}

.hero-desc {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: #94a3b8;
  max-width: 38ch;
}

.hero-visual {
  flex-shrink: 0;
  width: 280px;
  height: 150px;
  position: relative;
  z-index: 1;
}

.hero-svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 960px) {
  .hero-visual { display: none; }
  .hero-banner { padding: 24px; }
}

@media (max-width: 860px) {
  .hero-title { font-size: 18px; }
  .hero-desc { font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   SECTION HEADERS
   ══════════════════════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.section-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  background: var(--surface-muted);
  padding: 3px 10px;
  border-radius: 12px;
}

/* ══════════════════════════════════════════════════════════════
   PRESET BAR — outlined chips, dark fill on active
   ══════════════════════════════════════════════════════════════ */
.preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.preset-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-right: 4px;
}

.preset-chip {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg);
  transition: all 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--line-strong);
  color: #334155;
}

.preset-chip.active {
  background: var(--sidebar-bg);
  border-color: var(--sidebar-bg);
  color: #fff;
}

/* ══════════════════════════════════════════════════════════════
   SOURCE GROUPS — category-colored left bars
   ══════════════════════════════════════════════════════════════ */
.source-group-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}

.source-group-header .source-group-label + .source-group-accent {
  margin-left: 12px;
}

.source-group-header:first-child {
  margin-top: 0;
}

.source-group-accent {
  width: 3px;
  height: 16px;
  border-radius: 2px;
}

.source-group-accent.visibility { background: var(--cat-visibility); }
.source-group-accent.content { background: var(--cat-content); }
.source-group-accent.demandGen { background: var(--cat-demand); }
.source-group-accent.narrative { background: var(--cat-ai); }

.source-group-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.source-group-desc {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 400;
  margin-left: 4px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 50% 60% at 20% 30%, rgba(59, 130, 246, 0.03), transparent),
    radial-gradient(ellipse 40% 50% at 80% 70%, rgba(168, 85, 247, 0.025), transparent),
    linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%);
}

/* ── Source cards — subtle glassmorphism ──────────────────── */
.source-card {
  border: 1px solid rgba(226, 232, 240, 0.6);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  cursor: pointer;
  position: relative;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.source-card:hover {
  border-color: rgba(203, 213, 225, 0.8);
  background: rgba(255, 255, 255, 0.7);
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.06),
    0 1px 3px rgba(15, 23, 42, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.source-card.active {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(226, 232, 240, 0.5);
  box-shadow:
    0 2px 8px rgba(15, 23, 42, 0.05),
    0 1px 2px rgba(15, 23, 42, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.source-card.active.visibility { border-left-color: var(--cat-visibility); }
.source-card.active.content { border-left-color: var(--cat-content); }
.source-card.active.demandGen { border-left-color: var(--cat-demand); }
.source-card.active.narrative { border-left-color: var(--cat-ai); }

.source-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.source-card-name {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.source-card-desc {
  font-size: 11px;
  color: var(--ink-faint);
  line-height: 1.4;
  margin-top: 4px;
}

/* Toggle switch */
.toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--line);
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s ease;
  margin-top: 1px;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Category-colored toggles */
.source-card.active .toggle-track.visibility { background: var(--cat-visibility); }
.source-card.active .toggle-track.content { background: var(--cat-content); }
.source-card.active .toggle-track.demandGen { background: var(--cat-demand); }
.source-card.active .toggle-track.narrative { background: var(--cat-ai); }
.source-card.active .toggle-track::after {
  transform: translateX(14px);
}

/* ══════════════════════════════════════════════════════════════
   ACTION BAR — sticky with frosted glass
   ══════════════════════════════════════════════════════════════ */
.action-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-top: 8px;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.action-bar .field-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-bar .field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  white-space: nowrap;
}

.action-bar select,
.action-bar input[type="number"] {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  min-width: 0;
}

.action-bar select {
  padding-right: 28px;
  min-width: 140px;
}

.action-bar input[type="number"] { width: 72px; }

.action-bar select:focus,
.action-bar input[type="number"]:focus {
  border-color: var(--brand-solid);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.action-spacer { flex: 1; }

.source-count {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
  white-space: nowrap;
}

/* Generate button — amber gradient with dark text shadow for WCAG */
.generate-button {
  height: 40px;
  padding: 0 24px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--cta-bg);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px var(--cta-shadow);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.generate-button:hover:not(:disabled) {
  background: var(--cta-hover);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
  transform: translateY(-1px);
}

.generate-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.generate-button svg {
  width: 16px;
  height: 16px;
}

/* ══════════════════════════════════════════════════════════════
   REPORT LIBRARY — horizontal scroll cards
   ══════════════════════════════════════════════════════════════ */
.library-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.library-scroll::-webkit-scrollbar { height: 6px; }
.library-scroll::-webkit-scrollbar-track { background: var(--surface-muted); border-radius: 3px; }
.library-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.library-card {
  flex: 0 0 280px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  scroll-snap-align: start;
  transition: all 0.15s ease;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.library-card:first-child {
  border-color: var(--brand-solid);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.library-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.library-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  margin-bottom: 10px;
  width: fit-content;
}

.library-card-badge.latest {
  background: var(--info-bg);
  color: #1d4ed8;
}

.library-card-badge.archive {
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.library-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.3;
}

.library-card-meta {
  font-size: 11px;
  color: var(--ink-faint);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.library-card-actions {
  display: flex;
  gap: 8px;
}

.library-card-actions a,
.library-card-actions button {
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.btn-download {
  background: var(--sidebar-bg);
  color: #fff;
  border: none;
}

.btn-download:hover { background: var(--sidebar-hover); }

.btn-template {
  background: var(--bg);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.btn-template:hover {
  border-color: var(--line-strong);
  color: #334155;
}

/* ── Empty state — solid border + icon + CTA ─────────────── */
.library-empty {
  padding: 48px 32px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink-faint);
  background: var(--surface-muted);
}

.library-empty svg {
  width: 48px;
  height: 48px;
  color: var(--line-strong);
  margin-bottom: 12px;
}

.library-empty h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.library-empty p {
  font-size: 12px;
  max-width: 36ch;
  margin: 0 auto 16px;
  line-height: 1.5;
}

.library-empty .empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg);
  transition: all 0.15s ease;
}

.library-empty .empty-cta:hover {
  border-color: var(--brand-solid);
  color: var(--brand-solid);
}

/* ══════════════════════════════════════════════════════════════
   COMPETITORS GRID
   ══════════════════════════════════════════════════════════════ */
.competitors-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.competitor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: all 0.1s ease;
}

.competitor-row:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.competitor-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.competitor-name {
  font-weight: 600;
  color: var(--ink);
}

.competitor-domain {
  font-size: 11px;
  color: var(--ink-faint);
}

.competitor-own {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--info-bg);
  color: #1d4ed8;
}

/* ══════════════════════════════════════════════════════════════
   RUN ACTIVITY — stepper + log shell
   ══════════════════════════════════════════════════════════════ */
.run-highlight {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

.run-highlight h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.run-highlight p {
  margin: 4px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}

.run-highlight .run-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.step {
  padding: 10px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.step-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.5;
}

.step-title {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
}

.step.complete {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.step.complete .step-label { opacity: 0.8; }

.step.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.step.active .step-label { opacity: 1; }

.step.pending { opacity: 0.35; }

.log-shell {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.log-shell summary {
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.log-shell summary::-webkit-details-marker { display: none; }

.log-shell summary::before {
  content: '\25B6';
  margin-right: 8px;
  font-size: 9px;
  transition: transform 0.15s ease;
  display: inline-block;
}

.log-shell[open] summary::before {
  transform: rotate(90deg);
}

.log-output {
  margin: 0;
  padding: 0 14px 14px;
  max-height: 260px;
  overflow-y: auto;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Run complete state */
.run-complete {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.run-complete a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--success);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.run-complete a:hover {
  background: #16a34a;
}

.run-complete span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

/* Run error state */
.run-error {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 13px;
  color: #fca5a5;
}

/* ══════════════════════════════════════════════════════════════
   LOADING & ANIMATIONS
   ══════════════════════════════════════════════════════════════ */
.loading-shimmer {
  display: grid;
  gap: 10px;
}

.shimmer {
  height: 14px;
  border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--surface-muted), var(--surface-hover), var(--surface-muted));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.shimmer.large {
  height: 48px;
  border-radius: var(--radius-md);
}

.fade-in {
  animation: fadeIn 0.2s ease-out both;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .source-grid { grid-template-columns: repeat(2, 1fr); }
  .competitors-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .source-grid { grid-template-columns: 1fr; }
  .competitors-grid { grid-template-columns: 1fr; }
  .action-bar { flex-wrap: wrap; }
  .stepper { grid-template-columns: repeat(2, 1fr); }
  .content-area { padding: 20px; }
}

@media (max-width: 480px) {
  .stepper { grid-template-columns: 1fr; }
  .action-bar { gap: 10px; padding: 12px 14px; }
  .action-bar .field-group { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .shimmer { animation: none; }
  .fade-in { animation: none; }

  .preset-chip,
  .source-card,
  .toggle-track,
  .toggle-track::after,
  .library-card,
  .competitor-row,
  .nav-item,
  .admin-trigger,
  .topbar-button,
  .generate-button,
  .btn-download,
  .btn-template {
    transition: none;
  }

  .status-badge.running .dot { animation: none; }
}

/* Focus visible */
.source-card:focus-visible,
.preset-chip:focus-visible,
.generate-button:focus-visible,
.nav-item:focus-visible,
.admin-trigger:focus-visible,
.topbar-button:focus-visible,
.btn-download:focus-visible,
.btn-template:focus-visible,
.library-card:focus-visible,
.empty-cta:focus-visible {
  outline: 2px solid var(--brand-solid);
  outline-offset: 2px;
}

.sidebar .admin-input:focus-visible,
.action-bar select:focus-visible,
.action-bar input:focus-visible {
  outline: 2px solid var(--brand-solid);
  outline-offset: 1px;
}

.log-shell summary:focus-visible {
  outline: 2px solid var(--brand-solid);
  outline-offset: -2px;
}
