/* ============================================================
   Content Machine — Design System
   Brand: ProductiveBot dark navy + cyan
   ============================================================ */

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

:root {
  --bg:           #09182f;
  --surface:      #0d2340;
  --surface-2:    #0a1628;
  --accent:       #66f7ff;
  --accent-dim:   rgba(102, 247, 255, 0.15);
  --accent-glow:  rgba(102, 247, 255, 0.08);
  --border:       rgba(102, 247, 255, 0.1);
  --border-hover: rgba(102, 247, 255, 0.3);
  --heading:      #f8fafc;
  --body:         #c8d6e5;
  --muted:        #94a3b8;
  --danger:       #ff6b6b;
  --success:      #4ecdc4;
  --warning:      #fbbf24;
  --radius-card:  12px;
  --radius-btn:   8px;
  --sidebar-w:    220px;
  --font:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient radial glow — echoes the ProductiveBot hero energy */
body::before {
  content: '';
  position: fixed;
  top: -15%;
  right: -5%;
  width: 55%;
  height: 65%;
  background: radial-gradient(ellipse at center, rgba(102, 247, 255, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: 10%;
  left: 10%;
  width: 40%;
  height: 50%;
  background: radial-gradient(ellipse at center, rgba(102, 247, 255, 0.025) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(102,247,255,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(102,247,255,0.4); }

/* ---- Top Bar ---- */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 20px;
  z-index: 300;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

.top-bar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  width: var(--sidebar-w);
}

.top-bar-wordmark {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-workspace {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.top-bar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(102, 247, 255, 0.3);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 10px rgba(102, 247, 255, 0.12);
}

.top-bar-avatar:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(102, 247, 255, 0.3);
}

.logo-mark-sm {
  flex-shrink: 0;
  border-radius: 6px;
  opacity: 0.7;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 48px;
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - 48px);
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.4);
  transition: transform .2s ease;
}
.sidebar-hidden { transform: translateX(-100%); pointer-events: none; }
.main-no-sidebar { margin-left: 0 !important; }
.banner-no-sidebar { left: 0 !important; }

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.logo-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  box-shadow: 0 0 24px rgba(102, 247, 255, 0.4), 0 0 8px rgba(102, 247, 255, 0.2);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-btn);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--body);
  background: var(--accent-glow);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
  box-shadow: inset 3px 0 0 var(--accent);
  text-shadow: 0 0 12px rgba(102, 247, 255, 0.4);
}

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

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

.phase-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg);
  padding-top: 88px; /* 48px top-bar + 40px pilot banner */
  position: relative;
  z-index: 1;
}

#app-root {
  max-width: 1060px;
  margin: 0 auto;
  padding: 32px 40px 140px;
}

/* ---- Page Headers ---- */
.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  animation: fadeIn 0.3s ease both;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 20px rgba(102, 247, 255, 0.06);
}

.card-sm {
  padding: 16px 20px;
}

.card-accent {
  border-color: rgba(102, 247, 255, 0.35);
  box-shadow: 0 0 32px rgba(102, 247, 255, 0.12), 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  animation: fadeIn 0.3s ease both;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(102, 247, 255, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  border-color: rgba(102, 247, 255, 0.25);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 24px rgba(102, 247, 255, 0.1);
}

.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-icon svg { color: var(--accent); }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1;
  margin-bottom: 4px;
  text-shadow: 0 0 20px rgba(248, 250, 252, 0.15);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #09182f;
  box-shadow: 0 0 16px rgba(102, 247, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: #8fffff;
  box-shadow: 0 0 28px rgba(102, 247, 255, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--accent-dim);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #ff8787;
}

.btn-success {
  background: var(--success);
  color: #09182f;
}

.btn-success:hover:not(:disabled) {
  background: #6eddd9;
}

.btn-warning {
  background: var(--warning);
  color: #09182f;
}

.btn-warning:hover:not(:disabled) {
  background: #fcd34d;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--body);
  border-color: var(--border-hover);
}

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

.btn-lg {
  padding: 13px 24px;
  font-size: 0.95rem;
}

/* Loading spinner in button */
.btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #09182f;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-secondary .spinner, .btn-ghost .spinner {
  border-color: rgba(102,247,255,0.2);
  border-top-color: var(--accent);
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--body);
  font-family: var(--font);
  font-size: 0.9375rem;
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  resize: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 247, 255, 0.14), 0 0 12px rgba(102, 247, 255, 0.08);
}

.form-control::placeholder { color: var(--muted); opacity: 0.7; }

select.form-control { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.form-row .form-group {
  flex: 1;
}

textarea.form-control { min-height: 140px; resize: none; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Status badges */
.badge-pending   { background: rgba(251,191,36,0.15);  color: var(--warning); }
.badge-processing {
  background: rgba(102,247,255,0.12);
  color: var(--accent);
  animation: pulseBadge 1.5s ease infinite;
}
.badge-ready     { background: rgba(78,205,196,0.15);  color: var(--success); }
.badge-approved  { background: rgba(78,205,196,0.2);   color: var(--success); }
.badge-error     { background: rgba(255,107,107,0.15); color: var(--danger); }
.badge-complete  { background: rgba(78,205,196,0.15);  color: var(--success); }

/* Pillar badges — use title case, not all-caps */
[class^="badge-pillar"] { text-transform: none; letter-spacing: 0; font-size: 0.75rem; }
.badge-pillar-authority   { background: rgba(147,51,234,0.2);  color: #c084fc; }
.badge-pillar-social      { background: rgba(59,130,246,0.2);  color: #93c5fd; }
.badge-pillar-education   { background: rgba(16,185,129,0.2);  color: #6ee7b7; }
.badge-pillar-story       { background: rgba(245,158,11,0.2);  color: #fcd34d; }
.badge-pillar-product     { background: rgba(102,247,255,0.15); color: var(--accent); }
.badge-pillar-community   { background: rgba(249,115,22,0.2);  color: #fdba74; }
.badge-pillar-default     { background: var(--accent-dim);      color: var(--accent); }

/* Format badges */
.badge-format-talking_head       { background: rgba(102,247,255,0.1); color: var(--accent); }
.badge-format-screen_recording   { background: rgba(147,51,234,0.15); color: #c084fc; }
.badge-format-b_roll             { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-format-text_overlay       { background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge-format-split_screen       { background: rgba(59,130,246,0.15); color: #93c5fd; }
.badge-format-default            { background: var(--accent-dim);     color: var(--accent); }

/* Platform badges */
.badge-youtube   { background: rgba(255,0,0,0.15);   color: #f87171; }
.badge-tiktok    { background: rgba(0,240,255,0.12); color: #67e8f9; }
.badge-instagram { background: rgba(236,72,153,0.15);color: #f9a8d4; }
.badge-platform-default { background: var(--accent-dim); color: var(--accent); }

/* ---- Table ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid rgba(102,247,255,0.04);
  transition: background 0.12s;
  cursor: pointer;
}

tbody tr:hover { background: var(--accent-glow); }

tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 12px 16px;
  color: var(--body);
  vertical-align: middle;
}

tbody tr:nth-child(even) { background: rgba(13,35,64,0.5); }
tbody tr:nth-child(even):hover { background: var(--accent-glow); }

/* ---- Timeline ---- */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 16px;
  bottom: 16px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 8px;
  animation: slideIn 0.3s ease both;
}

.timeline-item:nth-child(2) { animation-delay: 0.06s; }
.timeline-item:nth-child(3) { animation-delay: 0.12s; }
.timeline-item:nth-child(4) { animation-delay: 0.18s; }

.timeline-dot {
  position: absolute;
  left: -27px;
  top: 18px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.timeline-dot.complete {
  background: var(--success);
  border-color: var(--success);
  box-shadow: 0 0 8px rgba(78,205,196,0.4);
}

.timeline-dot.active {
  background: var(--surface-2);
  border-color: var(--accent);
  animation: pulseRing 1.5s ease infinite;
}

.timeline-dot.error {
  background: var(--danger);
  border-color: var(--danger);
}

.timeline-dot svg { width: 10px; height: 10px; color: #09182f; }

.timeline-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: border-color 0.2s;
}

.timeline-content.complete { border-color: rgba(78,205,196,0.2); }
.timeline-content.active   { border-color: rgba(102,247,255,0.25); }
.timeline-content.error    { border-color: rgba(255,107,107,0.25); }

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}

.timeline-header:hover { background: var(--accent-glow); }

.timeline-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--heading);
  font-size: 0.9rem;
}

.timeline-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.2s;
}

.timeline-body {
  display: none;
  padding: 0 18px 16px;
  border-top: 1px solid var(--border);
}

.timeline-body.open { display: block; }

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

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-btn);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--body);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 280px;
  max-width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: toastIn 0.25s ease both;
}

.toast.removing { animation: toastOut 0.25s ease forwards; }

.toast-success { border-color: rgba(78,205,196,0.3); background: rgba(13,35,64,0.95); }
.toast-success .toast-dot { background: var(--success); }

.toast-error { border-color: rgba(255,107,107,0.3); background: rgba(13,35,64,0.95); }
.toast-error .toast-dot { background: var(--danger); }

.toast-info { border-color: rgba(102,247,255,0.2); background: rgba(13,35,64,0.95); }
.toast-info .toast-dot { background: var(--accent); }

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

/* ---- API Error Banner ---- */
.pilot-banner {
  position: fixed;
  top: 48px;
  left: var(--sidebar-w);
  right: 0;
  background: rgba(245, 158, 11, 0.08);
  border: none;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 0;
  color: #fcd34d;
  padding: 7px 0;
  font-size: 0.8rem;
  line-height: 1.35;
  font-weight: 500;
  display: flex;
  align-items: stretch;
  z-index: 201;
}

/* Inner wrapper aligns banner content to the same column as page body */
.pilot-banner-inner {
  max-width: 1060px;
  margin: 0 auto;
  width: 100%;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pilot-banner span {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pilot-banner strong {
  color: #fde68a;
}

.pilot-banner-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fcd34d;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.pilot-banner-close:hover {
  opacity: 1;
}

.api-error-banner {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  background: rgba(255,107,107,0.12);
  border-bottom: 1px solid rgba(255,107,107,0.3);
  color: #fca5a5;
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
}

.api-error-banner code {
  background: rgba(0,0,0,0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ---- Brief View ---- */
.brief-meta-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.match-score-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.match-score-track {
  width: 80px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.match-score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--accent));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.hooks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.hook-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  align-self: stretch; /* equal height in grid rows */
  display: flex;
  flex-direction: column;
}

.hook-card-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.hook-card-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}

.hook-card-text {
  color: var(--body);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Script bullets */
.script-bullets { display: flex; flex-direction: column; gap: 10px; }

.script-bullet {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 14px 16px;
  transition: border-color 0.15s;
}

.script-bullet:hover { border-color: var(--border-hover); }

.bullet-num {
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.bullet-text { color: var(--body); font-size: 0.9rem; line-height: 1.5; }

/* Visual cues */
.visual-cues-table table thead th:first-child,
.visual-cues-table table tbody td:first-child {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--accent);
  white-space: nowrap;
}

/* 2-col production notes */
.production-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* CTA section */
.cta-section {
  border-color: rgba(102,247,255,0.3);
  box-shadow: 0 0 24px rgba(102,247,255,0.04);
}

.cta-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 16px;
}

.cta-item-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

.cta-item-text { color: var(--body); font-size: 0.9rem; }

/* Checklist */
.checklist { display: flex; flex-direction: column; gap: 10px; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: all 0.15s;
}

.checklist-item:hover { border-color: var(--border-hover); }

.checklist-item.checked { border-color: rgba(78,205,196,0.3); }

.checklist-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border-hover);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.checklist-item.checked .checklist-box {
  background: var(--success);
  border-color: var(--success);
}

.checklist-box svg { width: 10px; height: 10px; color: #09182f; display: none; }
.checklist-item.checked .checklist-box svg { display: block; }

.checklist-label {
  font-size: 0.875rem;
  color: var(--body);
  transition: color 0.15s;
}

.checklist-item.checked .checklist-label {
  color: var(--muted);
  text-decoration: line-through;
}

/* Bottom action bar */
.action-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: rgba(10, 22, 40, 0.97);
  border-top: 1px solid var(--border);
  z-index: 200;
  backdrop-filter: blur(12px);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.action-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
}

/* Refine Brief toggle button */
.btn-chat-toggle {
  background: rgba(102,247,255,.08);
  color: var(--accent);
  border: 1px solid rgba(102,247,255,.22);
  gap: 6px;
  transition: all .15s ease;
}
.btn-chat-toggle:hover {
  background: rgba(102,247,255,.16);
  border-color: rgba(102,247,255,.4);
}

/* Chat panel that slides up from the action bar */
.bar-chat-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
  border-bottom: 1px solid transparent;
}
.bar-chat-panel.open {
  max-height: 380px;
  border-bottom-color: var(--border);
}
.bar-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 32px;
  cursor: pointer;
  font-weight: 700;
  font-size: .88rem;
  color: var(--heading);
}
.bar-chat-header:hover .bar-chat-close { opacity: 1; }
.bar-chat-close { opacity: .5; transition: opacity .15s; }
.bar-chat-body { padding: 0 32px 16px; }
.bar-chat-history {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding-right: 4px;
}
.bar-chat-hint {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
  padding: 8px 12px;
  background: rgba(102,247,255,.04);
  border-radius: 10px;
  border: 1px solid rgba(102,247,255,.08);
}
.bar-chat-msg {
  font-size: .86rem;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 85%;
  animation: fadeIn .2s ease both;
}
.bar-chat-user {
  align-self: flex-end;
  background: rgba(102,247,255,.12);
  border: 1px solid rgba(102,247,255,.2);
  color: var(--heading);
}
.bar-chat-assistant {
  align-self: flex-start;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--body);
}
.bar-chat-error {
  align-self: flex-start;
  background: rgba(255,107,107,.1);
  border: 1px solid rgba(255,107,107,.2);
  color: var(--danger);
}
.bar-chat-thinking { display: flex; align-items: center; gap: 8px; }
.spinner-sm {
  width: 12px; height: 12px;
  border: 2px solid rgba(102,247,255,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.bar-chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.bar-chat-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--body);
  font-family: var(--font);
  font-size: .88rem;
  padding: 10px 14px;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  transition: border-color .15s;
}
.bar-chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102,247,255,.1);
}
.bar-chat-send { flex-shrink: 0; min-width: 64px; justify-content: center; }

/* Spacer so fixed action bar doesn't cover content */
.action-bar-page-spacer {
  height: 80px;
}

/* Rejected state inline on brief page */
.brief-rejected-state {
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: var(--radius-card);
  background: rgba(255, 107, 107, 0.06);
  padding: 20px 24px;
  margin-top: 24px;
}

.brief-rejected-state h3 {
  color: var(--danger);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.brief-rejected-state p {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 14px;
}

.btn-approve {
  background: rgba(78, 205, 196, 0.15);
  color: var(--success);
  border: 1px solid rgba(78, 205, 196, 0.35);
  font-weight: 600;
}

.btn-approve:hover:not(:disabled) {
  background: rgba(78, 205, 196, 0.25);
  box-shadow: 0 0 16px rgba(78, 205, 196, 0.2);
}

.btn-request-changes {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
  font-weight: 600;
}

.btn-request-changes:hover:not(:disabled) {
  background: rgba(251, 191, 36, 0.18);
}

.btn-reject {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 500;
}

.btn-reject:hover:not(:disabled) {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.4);
}

.action-bar-spacer { flex: 1; }

.feedback-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.feedback-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--body);
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 8px 12px;
  outline: none;
}

.feedback-input:focus {
  border-color: var(--accent);
}

/* ---- Reference videos ---- */
.ref-videos { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }

.ref-video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  transition: border-color 0.15s;
}

.ref-video-card:hover { border-color: var(--border-hover); }

.ref-video-title {
  font-weight: 600;
  color: var(--heading);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.ref-video-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.ref-video-why {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

/* ---- Research bank ---- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 9px 16px;
  border-radius: var(--radius-btn) var(--radius-btn) 0 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--body); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-glow);
}

/* Research search */
.research-search-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
}

.research-search { position: relative; flex: 1; }

.research-search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--body);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 10px 12px 10px 38px;
  outline: none;
  transition: border-color 0.15s;
}

.research-search input:focus { border-color: var(--accent); }

.research-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  width: 16px; height: 16px;
}

/* Expandable card */
.expand-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}

.expand-card:hover { border-color: var(--border-hover); }

.expand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}

.expand-title {
  font-weight: 600;
  color: var(--heading);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.expand-body {
  display: none;
  padding: 0 18px 16px;
  border-top: 1px solid var(--border);
}

.expand-body.open { display: block; padding-top: 16px; }

/* Star rating */
.stars { color: var(--warning); letter-spacing: 1px; }

/* ---- Gaps/warnings ---- */
.gaps-list { display: flex; flex-direction: column; gap: 8px; }

.gap-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.85rem;
  color: #fcd34d;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.15);
  border-radius: var(--radius-btn);
  padding: 8px 12px;
}

/* ---- List items ---- */
.item-list { display: flex; flex-direction: column; gap: 8px; }

.item-list-entry {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.875rem;
  color: var(--body);
  padding: 6px 0;
  border-bottom: 1px solid rgba(102,247,255,0.04);
}

.item-list-entry:last-child { border-bottom: none; }

.item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 7px;
}

/* ---- Section dividers ---- */
.section {
  margin-bottom: 28px;
  animation: fadeIn 0.3s ease both;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.01em;
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Empty states ---- */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--body);
  margin-bottom: 6px;
}

.empty-state p { font-size: 0.875rem; margin-bottom: 20px; }

/* ---- Loading skeleton ---- */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface) 25%, rgba(102,247,255,0.06) 50%, var(--surface) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 1em;
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Generating dots ---- */
.generating-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.generating-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 1.4s infinite ease-in-out both;
}

.generating-dots span:nth-child(2) { animation-delay: 0.2s; }
.generating-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ---- Quick data pairs ---- */
.data-pair { margin-bottom: 10px; }
.data-pair-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 2px; }
.data-pair-value { font-size: 0.9rem; color: var(--body); }

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40%           { transform: scale(1); opacity: 1; }
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(102,247,255,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(102,247,255,0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(0.97); }
}

/* ---- Utility ---- */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.text-muted  { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-sm     { font-size: 0.8rem; }
.text-xs     { font-size: 0.72rem; }
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.w-full.btn { justify-content: center; }


/* ---- Original prompt + hook inspiration + live chat ---- */
.original-prompt-card {
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: var(--body);
  border-color: rgba(102,247,255,0.18);
}

.hook-examples {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.hook-example-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--body);
}

.hook-example-source {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}

.brief-chat-card {
  border-color: rgba(102,247,255,0.28);
  box-shadow: 0 0 24px rgba(102,247,255,0.04);
}

.brief-chat-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.chat-turn {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
}

.chat-user {
  color: var(--heading);
  font-size: 0.85rem;
  font-weight: 600;
}

.chat-user::before { content: 'Reviewer: '; color: var(--accent); }

.chat-assistant {
  color: var(--muted);
  font-size: 0.82rem;
}

.chat-assistant::before { content: 'Content Machine: '; color: var(--success); }

.brief-chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.brief-chat-input {
  min-height: 58px !important;
  resize: vertical;
}

/* ---- Hook-first Brief Flow ---- */
.hook-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.hook-choice-card {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  background: linear-gradient(145deg, rgba(12, 31, 59, 0.96), rgba(7, 18, 36, 0.96));
  color: var(--body);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.hook-choice-card:hover {
  transform: translateY(-2px);
  border-color: rgba(102, 247, 255, 0.45);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

.hook-choice-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(102, 247, 255, 0.35), 0 18px 50px rgba(102, 247, 255, 0.08);
}

.hook-choice-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 9px;
}

.hook-choice-num {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(102, 247, 255, 0.12);
  color: var(--accent);
  font-weight: 800;
}

.hook-choice-text {
  color: var(--heading);
  font-weight: 750;
  line-height: 1.28;
  font-size: .98rem;
  margin-bottom: 8px;
}

.hook-choice-why {
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.35;
  margin-bottom: 10px;
}

.hook-signal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.hook-signal-strip span {
  border: 1px solid rgba(102, 247, 255, .18);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(102, 247, 255, .06);
  padding: 3px 7px;
  font-size: .68rem;
  letter-spacing: .02em;
}

.hook-signals-detail {
  border-top: 1px solid rgba(102, 247, 255, .12);
  padding-top: 8px;
  margin-top: 8px;
}

.hook-signals-detail summary {
  color: var(--muted);
  cursor: pointer;
  font-size: .78rem;
  list-style: none;
}

.hook-signals-detail summary::-webkit-details-marker { display: none; }

.hook-signals-detail[open] summary { margin-bottom: 8px; }

.hook-signal-list {
  display: grid;
  gap: 7px;
  font-size: .78rem;
  color: var(--muted);
}

.hook-signal-list div {
  border-left: 2px solid rgba(102, 247, 255, .28);
  padding-left: 9px;
}

.hook-signal-list span {
  display: block;
  color: var(--accent);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 2px;
}

.selected-script-card { padding: 0; overflow: hidden; }

.selected-hook-line {
  padding: 16px 18px;
  background: rgba(102, 247, 255, 0.08);
  border-bottom: 1px solid var(--border);
  color: var(--heading);
  font-weight: 750;
}

.selected-hook-line span {
  display: block;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .7rem;
  margin-bottom: 4px;
}

.selected-script-card .script-bullets { padding: 18px; }

.optional-filming-details > summary,
.original-prompt-details > summary {
  cursor: pointer;
  list-style: none;
}

.optional-filming-details > summary::-webkit-details-marker,
.original-prompt-details > summary::-webkit-details-marker { display: none; }

.optional-filming-details[open] > summary,
.original-prompt-details[open] > summary { margin-bottom: 14px; }

.compact-hook-examples .hook-example-card {
  padding: 10px 12px;
  font-size: .84rem;
}

/* ---- Phase 0 SaaS Settings / Recommender Layers ---- */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.75fr);
  gap: 20px;
  align-items: start;
}

.layer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch; /* equal-height columns */
}

.brand-research-bank-card {
  border-color: rgba(102, 247, 255, .24);
  background: linear-gradient(145deg, rgba(12, 31, 59, .98), rgba(7, 18, 36, .98));
}

.brand-research-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.mr-8 { margin-right: 8px; }

.layer-card .section-title { margin-bottom: 4px; }

/* Equal-height lower cards with pinned add button */
.layer-grid .layer-card {
  display: flex;
  flex-direction: column;
}

.layer-grid .layer-card .layer-list { flex: 1; }

.layer-grid .layer-card .layer-add-btn,
.layer-grid .layer-card .layer-inline-form { margin-top: auto; }

/* Expanded BRB form — full-width below action row */
.brb-full-form {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 8px;
  animation: fadeIn 0.18s ease both;
}

.layer-form {
  display: grid;
  gap: 8px;
}

.layer-list {
  display: grid;
  gap: 8px;
}

.layer-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: rgba(9, 24, 47, 0.42);
  transition: border-color 0.15s, background 0.15s;
}

.layer-item:hover {
  border-color: rgba(102, 247, 255, 0.2);
  background: rgba(9, 24, 47, 0.7);
}

.layer-empty-state {
  padding: 16px 18px;
  border: 1px dashed rgba(102, 247, 255, 0.12);
  border-radius: var(--radius-btn);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.layer-inline-form {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
  animation: fadeIn 0.18s ease both;
}

.layer-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  transition: color 0.15s, opacity 0.15s;
}

.brb-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}

.brb-add-slot {
  flex: 1;
  min-width: 200px;
}

.empty-state.compact {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-btn);
}

@media (max-width: 1100px) {
  .layer-grid { grid-template-columns: 1fr; }
  .brand-research-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  :root { --sidebar-w: 64px; }

  .logo span { display: none; }
  .nav-link  { justify-content: center; padding: 10px; gap: 0; }
  .nav-link span { display: none; }
  .phase-badge { display: none; }
  .sidebar-footer { padding: 12px; }
  .sidebar-header { padding: 16px 10px; }
  .logo { justify-content: center; }
  .top-bar-workspace { display: none; }

  #app-root { padding: 20px 16px 80px; }

  .hook-choice-grid { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hooks-grid { grid-template-columns: 1fr; }
  .production-grid { grid-template-columns: 1fr; }
  .cta-grid { grid-template-columns: 1fr; }
  .ref-videos { grid-template-columns: 1fr; }
  .hook-examples { grid-template-columns: 1fr; }
  .brief-chat-input-row { flex-direction: column; }
  .brief-chat-input-row .btn { width: 100%; justify-content: center; }
  .form-row { flex-direction: column; }
  .action-bar { left: var(--sidebar-w); }
  .action-bar-row { padding: 12px 16px; flex-wrap: wrap; }
  .bar-chat-header { padding: 10px 16px; }
  .bar-chat-body { padding: 0 16px 12px; }
  .bar-chat-msg { max-width: 92%; }
  .btn-chat-toggle { width: 100%; justify-content: center; order: -1; }
}

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

/* ---- URL Analysis Panel ---- */
.url-analysis-panel {
  padding: 12px 0 4px;
}

.url-analysis-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.url-check {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(102,247,255,0.08);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.url-check.ok {
  background: rgba(78,205,196,0.15);
  color: var(--success);
}

.url-analysis-detail {
  margin-top: 10px;
  font-size: 0.82rem;
}

.url-analysis-detail summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.url-analysis-detail p {
  color: var(--body);
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
}

/* ---- Tips Page ---- */
.tips-steps {
  display: grid;
  gap: 14px;
}

.tips-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.tips-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(102, 247, 255, 0.3);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tips-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.tips-link:hover { text-decoration: underline; }

.tips-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tips-compare-bad,
.tips-compare-good {
  padding: 14px 16px;
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  line-height: 1.5;
}

.tips-compare-bad {
  background: rgba(255, 107, 107, 0.06);
  border: 1px solid rgba(255, 107, 107, 0.2);
  color: var(--muted);
}

.tips-compare-good {
  background: rgba(78, 205, 196, 0.06);
  border: 1px solid rgba(78, 205, 196, 0.2);
  color: var(--body);
}

.tips-compare-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.7;
}

.tips-command {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  margin-bottom: 6px;
  transition: border-color 0.15s;
}

.tips-command:hover { border-color: rgba(102, 247, 255, 0.25); }

.tips-command code {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.825rem;
  color: var(--body);
  background: none;
}

.tips-copy-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
  flex-shrink: 0;
}

.tips-copy-btn:hover { color: var(--accent); }

.tips-commands-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.tips-tab-list {
  display: grid;
  gap: 10px;
}

.tips-tab-row {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
}

.tips-tab-name {
  font-weight: 600;
  color: var(--accent);
  min-width: 120px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .tips-compare { grid-template-columns: 1fr; }
  .tips-commands-grid { grid-template-columns: 1fr; }
}


/* Alex feedback pass — clearer brief top card, model value prop, CTA, refs */
.idea-source-card { padding: 0; overflow: hidden; }
.idea-source-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 24px;
  cursor: pointer;
  list-style: none;
}
.idea-source-summary::-webkit-details-marker { display: none; }
.idea-source-summary h2 { margin: 0 0 8px; }
.idea-source-expanded {
  border-top: 1px solid var(--border);
  padding: 18px 24px 24px;
  background: rgba(102, 247, 255, 0.025);
}
.idea-source-prompt { max-height: 280px; overflow: auto; margin-top: 8px; }
.source-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.source-chip,
.ref-link {
  color: var(--accent);
  background: rgba(102, 247, 255, 0.10);
  border: 1px solid rgba(102, 247, 255, 0.24);
  border-radius: 999px;
  padding: 4px 9px;
  text-decoration: none;
  font-weight: 700;
}
.ref-link { border-radius: 8px; padding: 2px 7px; line-height: 1.8; }
.source-chip:hover,
.ref-link:hover { background: rgba(102, 247, 255, 0.18); color: #e8feff; }
.idea-refactor-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 14px; align-items: start; }
.hook-example-text { color: var(--heading); font-weight: 650; margin-bottom: 8px; }
.hook-example-fit { font-size: .78rem; color: var(--muted); line-height: 1.35; border-top: 1px solid rgba(102,247,255,.10); padding-top: 8px; }
.hook-example-fit strong { color: var(--accent); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; display: block; margin-bottom: 3px; }
.hook-tighten {
  margin: 8px 0 10px;
  padding: 9px 10px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(78, 205, 196, .24);
  background: rgba(78, 205, 196, .06);
  color: var(--heading);
  font-size: .84rem;
  line-height: 1.35;
}
.hook-tighten span { display: block; color: var(--success); text-transform: uppercase; letter-spacing: .07em; font-size: .65rem; font-weight: 800; margin-bottom: 3px; }
.selected-script-header { scroll-margin-top: 24px; }
#selected-script-section { scroll-margin-top: 24px; }
.cta-simple { display: grid; gap: 12px; }
.cta-primary {
  padding: 14px 16px;
  border-radius: var(--radius-btn);
  background: rgba(102,247,255,0.08);
  border: 1px solid rgba(102,247,255,0.22);
}
.cta-main-text { color: var(--heading); font-size: 1.05rem; font-weight: 800; line-height: 1.35; }
.cta-support { color: var(--body); font-size: .9rem; line-height: 1.45; }
.cta-support span { display: block; color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .07em; font-size: .68rem; margin-bottom: 4px; }
.ref-video-card { padding: 0; overflow: hidden; }
.ref-video-card > :not(.ref-thumb-wrap) { margin-left: 16px; margin-right: 16px; }
.ref-video-title { margin-top: 14px; }
.ref-video-why { margin-bottom: 12px; }
.ref-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, rgba(102,247,255,.12), rgba(9,24,47,.88));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ref-video-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-thumb-fallback { display: none; color: var(--muted); font-size: .82rem; font-weight: 700; text-align: center; padding: 18px; }
.ref-thumb-wrap.thumb-missing .ref-thumb-fallback { display: block; }
@media (max-width: 760px) {
  .idea-source-summary,
  .idea-refactor-box { grid-template-columns: 1fr; display: grid; }
  .ref-videos { grid-template-columns: 1fr; }
}

/* Alex/Amanda UI polish pass — presentation clarity */
.idea-source-card {
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.idea-source-card:hover { border-color: rgba(102,247,255,.45); background: rgba(18,50,88,.82); }
.idea-source-summary {
  min-height: 132px;
  align-items: center;
  gap: 18px;
}
.idea-source-summary::-webkit-details-marker { display: none; }
.idea-source-copy { min-width: 0; }
.idea-source-kicker {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: .72rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.idea-source-action {
  display: inline-flex;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(102,247,255,.12);
  border: 1px solid rgba(102,247,255,.28);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.idea-source-chevron {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(102,247,255,.25);
  background: rgba(102,247,255,.08);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  transition: transform .18s ease, background .18s ease;
}
.idea-source-card[open] .idea-source-chevron { transform: rotate(180deg); background: rgba(102,247,255,.16); }

.productbot-context-card { position: relative; overflow: hidden; }
.productbot-context-card::after {
  content: '';
  position: absolute;
  right: -54px;
  top: -54px;
  width: 170px;
  height: 170px;
  background: radial-gradient(circle, rgba(102,247,255,.16), transparent 65%);
  pointer-events: none;
}
.backend-title { font-weight: 800; font-size: 1.08rem; margin: 2px 0 4px; }
.backend-note { max-width: 720px; line-height: 1.6; }

.brief-meta-explained {
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(102,247,255,.14);
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(18,50,88,.72);
  border: 1px solid rgba(102,247,255,.15);
  color: var(--muted);
  font-size: .82rem;
  cursor: help;
  position: relative;
}

/* Instant CSS tooltips for meta chips */
.meta-chip[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f2847;
  color: var(--body);
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.45;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(102,247,255,.22);
  box-shadow: 0 8px 32px rgba(0,0,0,.5), 0 0 12px rgba(102,247,255,.08);
  white-space: normal;
  width: max-content;
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s ease, visibility .12s ease;
  z-index: 500;
}
.meta-chip[data-tip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(102,247,255,.22);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s ease, visibility .12s ease;
  z-index: 501;
}
.meta-chip[data-tip]:hover::after,
.meta-chip[data-tip]:hover::before {
  opacity: 1;
  visibility: visible;
}
.meta-chip-primary {
  color: var(--accent);
  background: rgba(102,247,255,.13);
  border-color: rgba(102,247,255,.25);
  font-weight: 800;
  text-transform: capitalize;
}
.match-score-bar.meta-chip { color: var(--body); }
.match-score-bar.meta-chip strong { color: var(--body); }

.section-help { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.compact-hook-examples { gap: 14px; }
.hook-example-card { padding: 16px; }
.reference-pattern-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.reference-patterns-intro {
  margin-top: 8px;
  line-height: 1.55;
}
.reference-pattern-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.reference-pattern-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.reference-pattern-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.reference-pattern-text {
  margin-bottom: 8px;
}
.reference-pattern-hook {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
  margin-bottom: 2px;
}
.reference-pattern-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-start;
}
.hook-example-text {
  font-size: .98rem;
  line-height: 1.45;
  margin: 10px 0 12px;
  color: var(--body);
}
.hook-example-divider { height: 1px; background: rgba(102,247,255,.12); margin: 12px 0; }
.hook-example-reason { margin-top: 10px; }
.hook-example-reason span {
  display: block;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .68rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.hook-example-reason p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }

.hook-choice-card { padding: 18px; text-align: left; }
.hook-choice-topline { margin-bottom: 12px; }
.hook-choice-text { font-size: 1.02rem; line-height: 1.45; margin-bottom: 12px; }
.hook-choice-why {
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  color: var(--muted);
  line-height: 1.45;
  margin-top: 10px;
}
.hook-tighten {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(102,247,255,.18);
  background: rgba(102,247,255,.055);
  color: var(--body);
}
.hook-tighten span { display: block; margin-bottom: 4px; color: var(--accent); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 800; }
.hook-signal-strip { gap: 6px; margin-top: 12px; opacity: .72; }
.hook-signal-strip span {
  padding: 4px 7px;
  font-size: .64rem;
  background: rgba(255,255,255,.045);
  border-color: rgba(255,255,255,.08);
}
.selected-script-card { border-top: 1px solid rgba(102,247,255,.28); }
.selected-hook-line {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: rgba(102,247,255,.08);
  border: 1px solid rgba(102,247,255,.18);
}
.selected-hook-line span { color: var(--accent); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }

.visual-cues-table table td .badge[class*="badge-format"] {
  background: rgba(102,247,255,.08);
  color: var(--accent);
  border: 1px solid rgba(102,247,255,.14);
  font-size: .68rem;
  padding: 4px 8px;
  line-height: 1.2;
  max-width: 120px;
  white-space: normal;
}
.visual-cues-table td { vertical-align: top; }

.cta-rows { display: grid; gap: 10px; padding: 18px; }
.cta-row {
  display: grid;
  grid-template-columns: 96px minmax(0,1fr);
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 13px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(102,247,255,.12);
}
.cta-row span {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .7rem;
  font-weight: 900;
  white-space: nowrap;
}
.cta-row strong { color: var(--body); font-weight: 700; line-height: 1.45; }
.cta-primary-row { background: rgba(102,247,255,.08); border-color: rgba(102,247,255,.22); }

.ref-videos { grid-template-columns: 1fr; }
.ref-video-split {
  display: grid;
  grid-template-columns: clamp(160px, 28%, 260px) minmax(0,1fr);
  gap: 18px;
  align-items: start;
  padding: 16px;
  overflow: hidden;
}
.ref-video-split .ref-thumb-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,.22);
}
.ref-video-split .ref-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ref-video-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ref-video-title { font-size: 1rem; line-height: 1.35; }
.ref-video-why { color: var(--muted); line-height: 1.5; font-size: .9rem; }
.ref-video-why strong { color: var(--body); }
.ref-link { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ref-link:hover { color: #fff; }

.review-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.review-actions-label { color: var(--muted); font-size: .82rem; margin-right: 4px; }
.review-primary { min-width: 104px; justify-content: center; }
.review-secondary { background: rgba(255,209,102,.08); border-color: rgba(255,209,102,.28); }
.review-tertiary { opacity: .78; }

@media (max-width: 760px) {
  .ref-video-split { grid-template-columns: 1fr; }
  .ref-video-split .ref-thumb-wrap { max-height: 220px; }
  .reference-pattern-grid { grid-template-columns: 1fr; }
  .reference-pattern-topline { flex-direction: column; }
  .reference-pattern-badges { justify-content: flex-start; }
  .cta-row { grid-template-columns: 1fr; gap: 6px; }
  .cta-row span { margin-bottom: 2px; }
  .review-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .review-actions-label { width: 100%; text-align: right; }
}

/* ---- Collapsible brief sections ---- */
.collapsible-section > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.collapsible-section > summary::-webkit-details-marker { display: none; }
.collapsible-section > summary .section-header { flex: 1; margin-bottom: 0; }
.collapsible-section > summary .collapse-indicator {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(102,247,255,.08);
  border: 1px solid rgba(102,247,255,.15);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: .75rem;
  font-weight: 800;
  transition: transform .18s ease, background .18s ease;
  flex-shrink: 0;
}
.collapsible-section[open] > summary .collapse-indicator { transform: rotate(90deg); background: rgba(102,247,255,.14); }
.collapsible-section > summary .collapse-count {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.collapsible-section > .collapsible-body {
  animation: fadeIn .2s ease both;
  margin-top: 16px;
}

/* ============================================================
   Auth Pages — Login / Register
   ============================================================ */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px);
  padding: 40px 16px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-wordmark {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--danger);
  border-radius: var(--radius-btn);
  padding: 10px 14px;
  font-size: 0.87rem;
}

.auth-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.87rem;
}

.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s;
}
.auth-link:hover { opacity: 0.75; }

.btn-full { width: 100%; justify-content: center; }

.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.87rem;
  color: var(--body);
  line-height: 1.5;
}
.auth-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

/* Account page modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* Top bar auth avatar */
.top-bar-avatar-auth {
  font-size: 0.72rem;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s;
}
.top-bar-avatar-auth:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}
