/* ═══════════════════════════════════════════════════════════
   GOLEM MARKETING — Design System
   Fonts: Heebo (body) + Suez One (display)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@400;700;900&family=Suez+One&display=swap');

:root {
  --bg-paper:    #E5ECE7;
  --ink-black:   #0B0B0B;
  --ink-red:     #E63935;
  --ink-purple:  #5E2BFF;
  --font-sans:   'Heebo', sans-serif;
  --font-serif:  'Suez One', serif;
  --font-mono:   'Courier New', Courier, monospace;
  --border-thick: 2px solid var(--ink-black);
  --border-thin:  1px solid var(--ink-black);
}

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

/* ── Body ── */
body {
  background-color: var(--bg-paper);
  background-image: radial-gradient(var(--ink-black) 0.5px, transparent 0.5px);
  background-size: 20px 20px;
  background-blend-mode: multiply;
  color: var(--ink-black);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem;
}

/* ── App Frame ── */
.app-frame {
  width: 100%;
  max-width: 1200px;
  background-color: var(--bg-paper);
  border: var(--border-thick);
  display: grid;
  grid-template-columns: 260px 1fr;
  position: relative;
  box-shadow: 6px 6px 0 var(--ink-black);
}

/* ── App Header (full-width row spanning both columns) ── */
.app-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 260px 1fr;
  border-bottom: var(--border-thick);
}

/* ── Sidebar ── */
.sidebar {
  border-left: var(--border-thick);
  display: flex;
  flex-direction: column;
  min-height: 600px;
  min-width: 0;
  overflow: hidden;
}

.brand-area {
  padding: 1.8rem 1.5rem;
  border-left: var(--border-thick);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end; /* align to bottom — matches page-header */
}

.brand-super {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 0.7rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-black);
  margin-bottom: 0.25rem;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 3.5rem;     /* matches .page-title */
  color: var(--ink-red);
  line-height: 1;        /* matches .page-title */
  letter-spacing: -1px;  /* matches .page-title */
  transform: scaleY(1.15);
  display: block;
}

.cta-wrapper {
  padding: 1.2rem 1.5rem;
  border-bottom: var(--border-thick);
  background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(11,11,11,0.05) 10px, rgba(11,11,11,0.05) 20px);
}

.btn-cta {
  background: var(--ink-purple);
  color: #fff;
  border: var(--border-thick);
  border-radius: 50px;
  padding: 0.6rem 1.5rem;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: opacity 0.1s;
}

.btn-cta:hover { opacity: 0.85; }

.nav-menu { list-style: none; }

.nav-item { border-bottom: var(--border-thin); }
.nav-item:last-child { border-bottom: none; }

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  text-decoration: none;
  color: var(--ink-black);
  font-weight: 900;
  font-size: 1rem;
  transition: background 0s;
}

.nav-link:hover, .nav-link.active {
  background: var(--ink-black);
  color: var(--bg-paper);
}

.nav-link.active::after { content: '✦'; color: var(--ink-red); }

/* ── Discovery Form ─────────────────────────────────────────────────── */
.discovery-form {
  background: var(--bg-paper, #f5f0e8);
  border: var(--border-thick, 2px solid #111);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.discovery-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  direction: rtl;
}
.discovery-icon { font-size: 14px; }
.discovery-toggle {
  margin-right: auto;
  background: none;
  border: 1px solid var(--ink-mid, #888);
  padding: 2px 10px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
}
.discovery-questions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.discovery-section-label {
  font-size: 0.75rem; font-weight: 900; letter-spacing: 1px;
  color: var(--ink-black); padding: 6px 0 2px;
  border-bottom: 1px solid #ddd; margin-bottom: 2px;
}
.discovery-question label {
  font-size: 11px;
  color: var(--ink-mid, #555);
  display: block;
  margin-bottom: 3px;
  direction: rtl;
}

/* ── Nav meta link (below sidebar art) ─────────────────────────────── */
.nav-item--meta { border-top: 1px solid var(--ink-light, #333); }
.nav-link--meta { color: var(--ink-mid, #888) !important; }
.nav-link--meta:hover { color: var(--ink-red, #E63935) !important; }

.sidebar-art {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

/* ── Main Content ── */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 600px;
  min-width: 0;   /* prevent grid blowout */
  overflow: hidden;
}

.page-header {
  padding: 1.8rem 2rem 1.8rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
  min-width: 0;
}

.pill-badge {
  border: var(--border-thick);
  border-radius: 50px;
  padding: 0.2rem 1rem;
  font-weight: 900;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  background: var(--bg-paper);
}

.pill-square {
  border: var(--border-thick);
  padding: 0.4rem 1rem;
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  color: var(--ink-red);
  line-height: 1;
  letter-spacing: -1px;
  margin-top: 0.4rem;
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--ink-black);
  gap: 2px;
  border-bottom: var(--border-thick);
}

.stat-cell {
  background: var(--bg-paper);
  padding: 1.2rem 1.8rem;
}

.stat-label {
  font-weight: 900;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.stat-value {
  font-size: 4.5rem;
  font-weight: 900;
  font-style: italic;
  color: var(--ink-red);
  line-height: 0.85;
  letter-spacing: -3px;
  transform: rotate(-3deg);
  display: inline-block;
  margin-top: 0.5rem;
}

/* ── Section Title ── */
.section-title {
  font-weight: 900;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 2rem 0.8rem;
}

.section-title::before, .section-title::after {
  content: '';
  flex-grow: 1;
  height: 2px;
  background: var(--ink-black);
}

/* ── Project Cards ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  padding: 0 2rem 2rem;
}

.project-card {
  border: var(--border-thick);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.card-header {
  padding: 1rem 1.2rem;
  border-bottom: var(--border-thick);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-name {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  line-height: 1;
}

.card-tag {
  border: var(--border-thin);
  border-radius: 50px;
  padding: 0.15rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 900;
}

.card-meta {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  background: var(--ink-black);
  gap: 1px;
  border-bottom: var(--border-thick);
}

.meta-cell {
  background: var(--bg-paper);
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.meta-cell.label { font-weight: 900; }

.card-footer {
  padding: 0.7rem 1.2rem;
  font-weight: 900;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  margin-top: auto;
}

.project-card:hover .card-footer {
  background: var(--ink-black);
  color: var(--bg-paper);
}

.card-footer a {
  color: inherit;
  text-decoration: none;
  font-weight: 900;
}

/* ── Campaign Form ── */
.form-section {
  padding: 1.5rem 2rem;
  border-bottom: var(--border-thick);
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 1rem;
  align-items: flex-end;
  min-width: 0;
}

.form-field { display: flex; flex-direction: column; gap: 0.4rem; }

.form-label {
  font-weight: 900;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-input, .form-select {
  border: var(--border-thick);
  padding: 0.6rem 1rem;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--bg-paper);
  color: var(--ink-black);
  width: 100%;
}

.form-select { cursor: pointer; }

.btn-run {
  background: var(--ink-purple);
  color: #fff;
  border: var(--border-thick);
  border-radius: 50px;
  padding: 0.6rem 1.8rem;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.1s;
}

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

/* ── Progress Bar ── */
.progress-section {
  padding: 1rem 2rem;
  border-bottom: var(--border-thick);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-weight: 900;
  font-size: 0.8rem;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.progress-current { color: var(--ink-purple); }

.progress-steps { display: flex; gap: 4px; margin-bottom: 0.4rem; }

.progress-step {
  flex: 1;
  height: 8px;
  background: #ccc;
  border: var(--border-thin);
}

.progress-step.done { background: var(--ink-black); }
.progress-step.active { background: var(--ink-purple); }

.progress-step-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

/* ── Live Log ── */
.live-log {
  margin: 1rem 2rem;
  border: var(--border-thick);
  background: var(--ink-black);
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 1rem;
  min-height: 180px;
  max-height: 320px;
  overflow-y: auto;
  line-height: 1.6;
}

.log-line { margin-bottom: 0.1rem; }
.log-line.done    { color: #4ade80; }
.log-line.active  { color: #facc15; }
.log-line.error   { color: var(--ink-red); }
.log-line.info    { color: #64748b; }
.log-line.thought {
  color: #888;
  font-size: 0.78rem;
  padding-right: 1.2rem;
  border-right: 2px solid #ddd;
  display: none;
}

.log-toolbar {
  display: flex;
  align-items: center;
  padding: 0.4rem 1rem;
  border-bottom: var(--border-thin);
  gap: 0.5rem;
}

.log-toggle {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.75rem;
  border: var(--border-thin);
  background: transparent;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  letter-spacing: 1px;
}
.log-toggle:hover { background: var(--ink-black); color: #fff; }

/* ── Phase Preview Box ── */
.phase-preview-box {
  margin: 1rem 2rem;
  border: var(--border-thick);
  background: var(--bg-paper);
}

.phase-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  border-bottom: var(--border-thin);
  background: var(--ink-black);
  color: #fff;
}

.phase-preview-label {
  font-size: 0.7rem;
  letter-spacing: 2px;
  font-weight: 900;
  opacity: 0.6;
}

.phase-preview-content {
  padding: 1rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.6;
  max-height: 250px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border-bottom: var(--border-thin);
  direction: rtl;
}

.phase-questions {
  padding: 1rem;
  border-bottom: var(--border-thin);
  background: #fafafa;
}
.phase-questions-title {
  font-weight: 900; font-size: 0.85rem; margin-bottom: 0.8rem;
}
.phase-question-row {
  display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem;
}
.phase-question-label {
  font-size: 0.8rem; color: #444;
}
.phase-question-input {
  font-size: 0.85rem;
}

.phase-preview-actions {
  display: flex;
  gap: 1rem;
  padding: 0.8rem 1rem;
  align-items: center;
}

.btn-continue {
  background: var(--ink-black);
  color: #fff;
  border: var(--border-thick);
  padding: 0.6rem 1.8rem;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.1s;
}
.btn-continue:hover { background: var(--ink-red); }

.btn-save-phase {
  background: transparent;
  color: var(--ink-black);
  border: var(--border-thin);
  padding: 0.5rem 1.2rem;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-save-phase:hover { background: rgba(0,0,0,0.06); }

/* Pulsing alive dot while running */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}
.running-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse-dot 1.2s infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.btn-results {
  display: none;
  margin: 0 2rem 1.5rem;
  background: var(--ink-black);
  color: var(--bg-paper);
  border: var(--border-thick);
  padding: 0.7rem 2rem;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  align-self: flex-start;
}

/* ── Project Editor ── */
.editor-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex-grow: 1;
  border-bottom: var(--border-thick);
}

.editor-panel { display: flex; flex-direction: column; }
.editor-panel + .editor-panel { border-right: var(--border-thick); }

.editor-panel-header {
  padding: 0.6rem 1.2rem;
  border-bottom: var(--border-thick);
  font-weight: 900;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(11,11,11,0.04) 8px, rgba(11,11,11,0.04) 16px);
}

.editor-textarea {
  flex-grow: 1;
  border: none;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-paper);
  color: var(--ink-black);
  resize: none;
  outline: none;
  min-height: 360px;
  line-height: 1.6;
}

.editor-footer {
  padding: 1rem 1.5rem;
  border-top: var(--border-thick);
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.btn-save {
  background: var(--ink-black);
  color: var(--bg-paper);
  border: var(--border-thick);
  padding: 0.5rem 1.5rem;
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-cancel {
  background: transparent;
  color: var(--ink-black);
  border: var(--border-thin);
  padding: 0.5rem 1.2rem;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.save-status {
  margin-right: auto;
  font-size: 0.75rem;
  color: #666;
}

/* ── Outputs ── */
.outputs-list { padding: 1rem 2rem 2rem; display: flex; flex-direction: column; gap: 1rem; }

.output-item {
  border: var(--border-thick);
  cursor: pointer;
}

.output-item-header {
  padding: 0.8rem 1.2rem;
  border-bottom: var(--border-thick);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
}

.output-item:hover .output-item-header {
  background: var(--ink-black);
  color: var(--bg-paper);
}

.output-run { font-size: 0.8rem; color: #666; }
.output-item:hover .output-run { color: #aaa; }

.output-actions { display: flex; gap: 4px; align-items: center; }
.out-action-btn {
  font-size: 0.7rem; font-weight: 700; font-family: inherit;
  padding: 2px 7px; cursor: pointer;
  border: 1px solid var(--ink-black); background: var(--bg-paper); color: var(--ink-black);
  transition: background 0.1s, color 0.1s;
}
.out-action-btn:hover { background: var(--ink-black); color: var(--bg-paper); }
.out-action-btn--danger { border-color: var(--ink-red); color: var(--ink-red); }
.out-action-btn--danger:hover { background: var(--ink-red); color: #fff; }

.output-content {
  display: none;
  padding: 1.5rem;
  font-size: 0.85rem;
  line-height: 1.7;
  border-top: var(--border-thick);
  white-space: pre-wrap;
  font-family: var(--font-mono);
  max-height: 400px;
  overflow-y: auto;
}

.output-content.open { display: block; }

/* ── Output tabs ── */
.out-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 12px 12px 0; border-bottom: 1px solid var(--border, #ccc); }
.out-tab {
  font-size: 11px; padding: 4px 12px; cursor: pointer;
  background: none; border: 1px solid var(--border, #ccc);
  font-family: inherit; color: var(--ink-mid, #555);
}
.out-tab:hover { background: var(--ink-black, #111); color: #fff; }
.out-tab--active { background: var(--ink-black, #111); color: #fff; border-color: var(--ink-black, #111); }
.out-panels { padding: 0; }

.out-panel { display: none; }
.out-panel--active { display: block; }

/* Toolbar: copy + expand buttons */
.out-panel-toolbar {
  display: flex; justify-content: flex-end; gap: 6px;
  padding: 6px 12px; border-bottom: 1px solid #eee; background: #fafafa;
}
.out-panel-copy, .out-panel-expand {
  font-size: 11px; font-family: inherit; font-weight: 700;
  padding: 3px 10px; cursor: pointer;
  border: 1px solid var(--ink-black); background: #fff; color: var(--ink-black);
}
.out-panel-copy:hover, .out-panel-expand:hover {
  background: var(--ink-black); color: #fff;
}

/* Panel body — scrollable, readable */
.out-panel-body {
  max-height: 55vh;
  overflow-y: auto;
  padding: 20px 24px;
  font-size: 0.9rem;
  line-height: 1.75;
}

/* ── Markdown rendering (md-body) ── */
.md-body { color: var(--ink-black); }
.md-body h1 { font-size: 1.4rem; font-weight: 900; margin: 1.5rem 0 0.5rem; border-bottom: 2px solid var(--ink-black); padding-bottom: 4px; }
.md-body h2 { font-size: 1.15rem; font-weight: 900; margin: 1.4rem 0 0.4rem; }
.md-body h3 { font-size: 1rem; font-weight: 900; margin: 1.2rem 0 0.3rem; color: #333; }
.md-body h4, .md-body h5 { font-size: 0.9rem; font-weight: 700; margin: 1rem 0 0.25rem; }
.md-body p  { margin: 0.6rem 0; }
.md-body ul, .md-body ol { padding-right: 1.4rem; margin: 0.5rem 0; }
.md-body li { margin: 0.3rem 0; }
.md-body strong { font-weight: 900; }
.md-body em { font-style: italic; color: #444; }
.md-body hr { border: none; border-top: 2px solid var(--ink-black); margin: 1.5rem 0; }
.md-body blockquote {
  border-right: 3px solid var(--ink-red, #E63935);
  padding: 4px 12px; margin: 0.8rem 0;
  background: #fafafa; color: #444; font-style: italic;
}
.md-body code {
  font-family: 'Courier New', monospace;
  background: #f0f0f0; padding: 1px 5px;
  font-size: 0.85em; border-radius: 2px;
}
.md-body pre {
  background: #f4f4f4; border: 1px solid #ddd;
  padding: 12px; overflow-x: auto;
  font-size: 0.82rem; line-height: 1.5;
}
.md-body pre code { background: none; padding: 0; }
.md-body table { border-collapse: collapse; width: 100%; margin: 0.8rem 0; }
.md-body th { background: var(--ink-black); color: #fff; padding: 6px 10px; text-align: right; }
.md-body td { border: 1px solid #ddd; padding: 6px 10px; }
.md-body tr:nth-child(even) td { background: #fafafa; }

/* ── Full-screen reader overlay ── */
.reader-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 2vh 2vw; overflow-y: auto;
}
.reader-modal {
  background: #fff;
  width: 100%; max-width: 780px;
  border: 2px solid var(--ink-black);
  display: flex; flex-direction: column;
  min-height: 80vh;
}
.reader-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1.2rem;
  background: var(--ink-black); color: #fff;
  position: sticky; top: 0; z-index: 1;
}
.reader-title { font-weight: 900; font-size: 0.95rem; }
.reader-close {
  background: none; border: 1px solid rgba(255,255,255,0.4);
  color: #fff; font-family: inherit; font-size: 0.8rem;
  padding: 3px 10px; cursor: pointer;
}
.reader-close:hover { background: rgba(255,255,255,0.15); }
.reader-body {
  padding: 2rem 2.5rem;
  font-size: 0.95rem;
  line-height: 1.85;
  flex: 1;
}

/* ── Skeleton loading ── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-card, .skeleton-row {
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.06) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border: var(--border-thin);
}

.skeleton-card {
  height: 110px;
  border-radius: 0;
}

.skeleton-row {
  height: 44px;
  margin-bottom: 1px;
}

/* ── Setup Wizard Banner ── */
.setup-banner {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 2rem;
  border-bottom: var(--border-thick);
  background-image: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(11,11,11,0.03) 8px, rgba(11,11,11,0.03) 16px);
  font-weight: 900;
  font-size: 0.85rem;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 1;
}

.setup-step.done { opacity: 0.35; text-decoration: line-through; }

.setup-num {
  background: var(--ink-red);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.setup-step.done .setup-num { background: #999; }

.setup-arrow { color: #999; font-size: 1rem; }

.setup-step a { color: var(--ink-black); text-decoration: underline; }

/* ── Settings Page ── */
.settings-section {
  padding: 1rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.settings-note {
  border: var(--border-thin);
  padding: 0.8rem 1rem;
  font-size: 0.8rem;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(11,11,11,0.03) 8px, rgba(11,11,11,0.03) 16px);
}

.settings-note code {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.settings-grid {
  display: flex;
  flex-direction: column;
  border: var(--border-thick);
}

.settings-row {
  display: grid;
  grid-template-columns: 1fr auto 260px;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: var(--border-thin);
}

.settings-row:last-child { border-bottom: none; }

.settings-key-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.settings-key-desc {
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.2rem;
}

.settings-key-status {
  font-weight: 900;
  font-size: 0.8rem;
  white-space: nowrap;
}

.settings-input {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.settings-row-required { background-image: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(230,57,53,0.04) 8px, rgba(230,57,53,0.04) 16px); }

.required-star {
  color: var(--ink-red);
  font-size: 0.7rem;
  font-weight: 900;
  margin-right: 0.4rem;
  letter-spacing: 1px;
}

.settings-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── Decorative star SVG ── */
.star-deco {
  position: absolute;
  width: 36px;
  height: 36px;
  stroke: var(--ink-red);
  stroke-width: 2;
  fill: none;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Tablet ≤ 900px
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  body { padding: 1rem; }

  .app-frame {
    grid-template-columns: 200px 1fr;
  }
  .app-header {
    grid-template-columns: 200px 1fr;
  }
  .brand-title { font-size: 2.6rem; }
  .page-title  { font-size: 2.6rem; }
  .page-header { padding: 1.2rem 1.4rem; }
  .brand-area  { padding: 1.2rem 1rem; }

  .stats-grid  { grid-template-columns: repeat(3, 1fr); }
  .stat-value  { font-size: 3rem; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Mobile ≤ 620px
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body { padding: 0; }

  .app-frame {
    grid-template-columns: 1fr;
    box-shadow: none;
    border-left: none;
    border-right: none;
    border-top: none;
  }

  /* Header: brand on top, page title below — stacked */
  .app-header {
    grid-template-columns: 1fr;
  }

  .brand-area {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    border-left: none;
    border-bottom: var(--border-thick);
  }

  .brand-super { margin-bottom: 0; font-size: 0.65rem; }
  .brand-title { font-size: 2.2rem; }

  .page-header {
    padding: 1rem 1.2rem;
  }
  .page-title { font-size: 2rem; }

  /* Sidebar: collapse to horizontal bottom nav */
  .sidebar {
    border-left: none;
    border-top: var(--border-thick);
    min-height: unset;
    order: 3; /* push below main content */
  }

  .cta-wrapper { padding: 0.8rem 1rem; }
  .btn-cta { font-size: 0.9rem; padding: 0.5rem 1rem; }

  .nav-menu {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
  }

  .nav-item {
    border-bottom: none;
    border-left: var(--border-thin);
    flex-shrink: 0;
  }
  .nav-item:first-child { border-left: none; }

  .nav-link {
    padding: 0.8rem 1.2rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  .sidebar-art { display: none; }

  /* Main content full width */
  .main-content { order: 2; }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .stat-value { font-size: 2.5rem; }
  .stat-label { font-size: 0.7rem; }

  /* Settings page */
  .settings-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .settings-input { width: 100%; }

  /* Editor panels stack */
  .editor-panels { flex-direction: column; }

  /* Form stacks vertically */
  .form-section {
    grid-template-columns: 1fr;
  }

  /* Setup banner stack */
  .setup-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .setup-arrow { display: none; }
}

/* ── Analyze Brief button ── */
.btn-analyze {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); padding: 0.5rem 1.5rem;
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.05em;
  cursor: pointer; transition: background 0.15s; margin-top: 1rem;
}
.btn-analyze:hover:not(:disabled) { background: rgba(230,57,53,0.08); }
.btn-analyze:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Dynamic discovery section ── */
.discovery-dynamic {
  margin: 1rem 0; padding: 1rem 1.25rem;
  border: 1px solid rgba(230,57,53,0.3);
  background: rgba(230,57,53,0.03);
}
.discovery-dynamic-header {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.8rem; color: var(--text-2);
  margin-bottom: 0.75rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.discovery-dynamic .discovery-question {
  border-right: 2px solid var(--accent);
  padding-right: 0.75rem;
}

/* ── Performance Tracker ── */
.perf-tracker {
  margin: 0; border-top: 2px solid var(--border);
  padding: 16px;
  background: #fafafa;
}
.perf-header {
  display: flex; align-items: baseline; gap: 12px;
  font-size: 13px; font-weight: 700;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.perf-sub { font-size: 11px; font-weight: 400; color: var(--text-2, #666); }
.perf-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}
.perf-row:last-of-type { border-bottom: none; }
.perf-channel {
  font-size: 12px; font-weight: 700;
  color: var(--ink-black, #111);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.perf-hook {
  font-size: 11px; color: #555;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  direction: rtl;
}
.perf-actions { display: flex; gap: 6px; flex-shrink: 0; }
.perf-btn {
  font-size: 11px; font-family: inherit; font-weight: 600;
  padding: 4px 10px; border: 1px solid var(--border, #ccc);
  background: #fff; cursor: pointer; border-radius: 3px;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.perf-btn:hover { border-color: #999; }
.perf-btn--win.perf-btn--active  { background: #dcfce7; border-color: #16a34a; color: #166534; }
.perf-btn--lose.perf-btn--active { background: #fee2e2; border-color: #dc2626; color: #991b1b; }
.perf-btn--fat.perf-btn--active  { background: #fef9c3; border-color: #ca8a04; color: #854d0e; }
.perf-toast {
  margin-top: 8px; font-size: 12px; padding: 6px 10px;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 3px;
}
