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

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e4e7ec;
  --text: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --sidebar-w: 220px;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  font-size: 15px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-logo {
  font-weight: 700;
  font-size: .95rem;
  color: var(--accent);
  letter-spacing: -0.01em;
}

/* ── Layout: sidebar + main ───────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: calc(100vh - 52px);
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

.sidebar-new-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
  transition: background .15s;
}
.sidebar-new-btn:hover { background: var(--accent-hover); }

.sidebar-nav { flex: 1; padding: 6px 0; }

.sidebar-item {
  display: flex;
  align-items: center;
  border-left: 2px solid transparent;
  transition: background .12s, color .12s;
}
.sidebar-item:hover { background: var(--bg); }
.sidebar-item:hover .sidebar-delete-btn { opacity: 1; }
.sidebar-item.active {
  background: var(--accent-light);
  border-left-color: var(--accent);
}
.sidebar-item.active .sidebar-item-link { color: var(--accent); font-weight: 500; }

.sidebar-item-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 8px 6px 8px 14px;
  font-size: .82rem;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
}
.sidebar-item:hover .sidebar-item-link { color: var(--text); }

.sidebar-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-delete-btn {
  flex-shrink: 0;
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity .12s, color .12s;
}
.sidebar-delete-btn:hover { color: #e55; }

.sidebar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sidebar-dot.draft      { background: var(--border); }
.sidebar-dot.pre_check  { background: #a78bfa; }
.sidebar-dot.analyzing  { background: var(--warn); animation: pulse 1.2s infinite; }
.sidebar-dot.complete   { background: var(--success); }
.sidebar-dot.error      { background: var(--danger); }

.sidebar-empty {
  padding: 20px 14px;
  font-size: .8rem;
  color: var(--text-light);
}

/* ── Main content ─────────────────────────────────────────────────────────── */
#app {
  flex: 1;
  min-width: 0;
  padding: 36px 40px 80px;
  max-width: 900px;
}

.loading-state {
  color: var(--text-muted);
  text-align: center;
  padding: 80px 0;
  font-size: .9rem;
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.subtitle {
  color: var(--text-muted);
  font-size: .9rem;
  margin-top: 4px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

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

.btn-tiny {
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent);
  border: none;
  cursor: pointer;
  margin-left: 8px;
  font-weight: 500;
}
.btn-tiny:hover { background: var(--accent); color: #fff; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.card-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

/* ── Ideas grid ──────────────────────────────────────────────────────────── */
.ideas-grid {
  display: grid;
  gap: 14px;
}

.idea-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s;
  cursor: pointer;
}
.idea-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #c7d2fe;
}

.idea-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.idea-title {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
}

.idea-date {
  font-size: .8rem;
  color: var(--text-light);
}

/* ── Status badges ───────────────────────────────────────────────────────── */
.status-badge {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.status-draft      { background: #f3f4f6; color: var(--text-muted); }
.status-pre_check  { background: #ede9fe; color: #7c3aed; }
.status-analyzing  { background: #fef9c3; color: #854d0e; }
.status-complete   { background: var(--success-bg); color: var(--success); }
.status-error      { background: var(--danger-bg); color: var(--danger); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h2 { font-size: 1.2rem; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 24px; font-size: .9rem; }

/* ── New idea form ───────────────────────────────────────────────────────── */
.idea-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  max-width: 680px;
}

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

.form-group label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  background: var(--surface);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-spinner { display: none; }

/* ── Pre-check view ──────────────────────────────────────────────────────── */
.pre-check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .pre-check-grid { grid-template-columns: 1fr; }
}

.editable-field {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s;
}
.editable-field:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

/* ── Tag lists ───────────────────────────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .875rem;
}

.tag-item-name { font-weight: 500; }
.tag-item-meta { color: var(--text-muted); font-size: .8rem; }

.tag-remove {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
}
.tag-remove:hover { color: var(--danger); }

/* ── Analysis progress ───────────────────────────────────────────────────── */
.agent-progress {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 600px) {
  .agent-progress { grid-template-columns: 1fr; }
}

.agent-lane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.agent-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background .3s;
}
.agent-dot.running  { background: var(--warn); animation: pulse 1.2s infinite; }
.agent-dot.complete { background: var(--success); animation: none; }
.agent-dot.error    { background: var(--danger); animation: none; }

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

.agent-name { font-weight: 600; font-size: .9rem; }
.agent-status { font-size: .8rem; color: var(--text-muted); margin-left: auto; }

.progress-feed {
  background: #0f172a;
  border-radius: var(--radius);
  padding: 16px 20px;
  max-height: 320px;
  overflow-y: auto;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: .8rem;
}

.progress-entry {
  padding: 3px 0;
  color: #94a3b8;
  line-height: 1.5;
}
.progress-entry .agent-tag { color: #38bdf8; margin-right: 6px; }
.progress-entry .tool-tag  { color: #a78bfa; margin-right: 4px; }
.progress-entry .query-text { color: #e2e8f0; }
.progress-entry.complete   { color: #4ade80; }
.progress-entry.error      { color: #f87171; }

/* ── Results view ────────────────────────────────────────────────────────── */
.summary-card {
  margin-bottom: 20px;
}

.summary-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.summary-card h3 {
  font-size: .9rem;
  font-weight: 600;
  margin: 18px 0 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .75rem;
}

.tldr-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tldr-list li {
  display: flex;
  gap: 10px;
  font-size: .9rem;
  line-height: 1.4;
}

.tldr-list li::before {
  content: "→";
  color: var(--accent);
  flex-shrink: 0;
  font-weight: 700;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.actions-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.actions-table th, .data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.actions-table td, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.4;
}

.actions-table tr:last-child td,
.data-table tr:last-child td {
  border-bottom: none;
}

.priority-high   { color: var(--danger); font-weight: 600; }
.priority-medium { color: var(--warn); font-weight: 600; }
.priority-low    { color: var(--text-muted); font-weight: 600; }

/* ── Expandable sections ────────────────────────────────────────────────── */
.sections { display: flex; flex-direction: column; gap: 12px; }

.result-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.result-section summary {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: .95rem;
  list-style: none;
  user-select: none;
  transition: background .1s;
}
.result-section summary:hover { background: var(--bg); }
.result-section summary::-webkit-details-marker { display: none; }

.section-meta {
  font-size: .8rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: auto;
  margin-right: 12px;
}

.chevron {
  color: var(--text-light);
  transition: transform .2s;
  font-style: normal;
  font-size: 1.1rem;
}
.result-section[open] .chevron { transform: rotate(90deg); }

.section-body {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}

/* ── Source links ────────────────────────────────────────────────────────── */
.source-link {
  color: var(--accent);
  font-size: .8rem;
  word-break: break-all;
}
.source-link:hover { text-decoration: underline; }

/* ── Competitor sub-card ─────────────────────────────────────────────────── */
.company-block {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.company-block:last-child { border-bottom: none; }

.company-name {
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: 10px;
}

.signal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 4px;
}

.signal-item {
  font-size: .875rem;
  display: block;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.signal-item:last-child { border-bottom: none; }
.signal-text {
  margin-bottom: 4px;
  color: var(--text);
  line-height: 1.45;
}
.signal-date {
  display: inline-block;
  font-size: .72rem;
  color: var(--text-light);
  margin-left: 7px;
  white-space: nowrap;
}

.signal-quote {
  font-style: italic;
  color: var(--text-muted);
  font-size: .85rem;
  margin-top: 3px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

/* ── New competitors table ───────────────────────────────────────────────── */
.new-competitor-card {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.new-competitor-card:last-child { border-bottom: none; }

.nc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.nc-name {
  font-weight: 600;
}
.nc-category {
  font-size: .75rem;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.nc-funding {
  font-size: .75rem;
  color: var(--success);
  font-weight: 500;
}
.nc-desc { font-size: .875rem; color: var(--text-muted); margin-bottom: 4px; }
.nc-jtbd { font-size: .8rem; color: var(--text-muted); }
.nc-why { font-size: .875rem; margin-top: 6px; }

/* ── Observations & quotes ───────────────────────────────────────────────── */
.obs-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.obs-list li {
  display: flex;
  gap: 10px;
  font-size: .9rem;
  line-height: 1.4;
}
.obs-list li::before { content: "·"; color: var(--accent); font-weight: 900; }

.quote-block {
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
  border-radius: 0 6px 6px 0;
  margin: 8px 0;
}
.quote-text { font-style: italic; font-size: .9rem; margin-bottom: 4px; }
.quote-context { font-size: .8rem; color: var(--text-muted); }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.hidden { display: none !important; }
.no-data { color: var(--text-muted); font-size: .875rem; font-style: italic; padding: 8px 0; }

/* ── Section summaries ───────────────────────────────────────────────────── */
.section-summary-text {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.section-summary-text.loading { color: var(--text-light); font-style: italic; }

/* ── Next Steps ───────────────────────────────────────────────────────────── */
.next-steps-section {
  margin-top: 32px;
}
.next-steps-header {
  margin-bottom: 18px;
}
.next-steps-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.next-steps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 680px) { .next-steps-grid { grid-template-columns: 1fr; } }

.ns-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.ns-block-title {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}
.ns-icon { margin-right: 4px; }
.ns-icon-svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; flex-shrink: 0; }

/* ── Research feeds-into hint ─────────────────────────────────────────────── */
.ns-feeds-into {
  margin-left: auto;
  font-size: .7rem;
  font-weight: 500;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background .12s, opacity .12s;
  flex-shrink: 0;
}
.ns-feeds-into:hover { background: var(--accent-light); opacity: 1; }
.ns-feeds-into svg { width: 11px; height: 11px; }

/* ── Highlight pulse (used when scrolling to Research Plan btn) ───────────── */
@keyframes highlight-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,.5); }
  60%  { box-shadow: 0 0 0 8px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}
.btn-highlight-pulse {
  animation: highlight-pulse 1.4s ease-out;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

.ns-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.ns-item:last-child { border-bottom: none; }
.ns-item-title {
  font-weight: 600;
  font-size: .875rem;
  margin-bottom: 4px;
}
.ns-item-detail {
  font-size: .825rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.ns-item-type {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}
.ns-questions {
  margin-top: 8px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}
.ns-questions li {
  font-size: .8rem;
  color: var(--text-muted);
  padding: 2px 0;
  list-style: disc inside;
}
.ns-skeleton {
  font-size: .85rem;
  color: var(--text-light);
  font-style: italic;
}

/* ── Evidence upload ─────────────────────────────────────────────────────── */
.evidence-section { }
.evidence-hint {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}
.evidence-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px dashed var(--border);
  border-radius: 7px;
  font-size: .875rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.upload-btn:hover { border-color: var(--accent); color: var(--accent); }

.or-divider { font-size: .8rem; color: var(--text-light); }

.paste-area {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .875rem;
  font-family: inherit;
  resize: vertical;
  background: var(--bg);
}
.paste-area:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.evidence-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

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

.evidence-response {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  border-radius: 7px;
  font-size: .875rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.evidence-history {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.evidence-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--text-muted);
}
.evidence-item-name { font-weight: 500; color: var(--text); }

/* ── Product Brief ───────────────────────────────────────────────────────── */
.brief-section { }
.brief-hint {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}
.brief-action-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.brief-action-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .875rem;
  padding: 6px 0;
}
.brief-action-item input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}
.brief-action-label { line-height: 1.4; }
.brief-priority { font-size: .75rem; font-weight: 600; margin-right: 6px; }

.brief-cta { margin-top: 4px; }

.brief-output {
  margin-top: 20px;
  padding: 20px 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  line-height: 1.7;
}
.brief-output h1 { font-size: 1.1rem; margin-bottom: 12px; }
.brief-output h2 { font-size: .95rem; font-weight: 700; margin: 16px 0 6px; color: var(--accent); }
.brief-output h3 { font-size: .875rem; font-weight: 600; margin: 12px 0 4px; }
.brief-output p  { margin-bottom: 8px; }
.brief-output ul { padding-left: 18px; margin-bottom: 8px; }
.brief-output li { margin-bottom: 4px; }

/* ── Cost breakdown ──────────────────────────────────────────────────────── */
.cost-section { margin-top: 32px; }

.cost-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cost-summary-label {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  list-style: none;
  user-select: none;
}
.cost-summary-label:hover { background: var(--bg); }
.cost-summary-label::-webkit-details-marker { display: none; }
.cost-summary-label .chevron { margin-left: auto; color: var(--text-light); transition: transform .2s; font-style: normal; }
.cost-details[open] .chevron { transform: rotate(90deg); }

.cost-total {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  margin-left: 8px;
}

.cost-body { padding: 0 20px 16px; border-top: 1px solid var(--border); }

.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  margin-top: 10px;
}
.cost-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}
.cost-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.cost-table tr:last-child td { border-bottom: none; font-weight: 600; color: var(--text); }
.cost-table .cost-val { font-variant-numeric: tabular-nums; text-align: right; }

/* ── Idea description (results page) ────────────────────────────────────── */
.idea-desc { font-size:.85rem; color:var(--text-muted); margin-top:4px; line-height:1.5; max-width:640px; }

/* ── Section summaries (always visible above toggle) — canonical rule at line ~775 */

/* ── Team badges (immediate actions) ────────────────────────────────────── */
.team-badge-row { display:flex; flex-wrap:wrap; gap:4px; }
.team-badge { display:inline-block; font-size:.68rem; font-weight:600; padding:1px 7px; border-radius:9px; letter-spacing:.02em; white-space:nowrap; }
.team-product    { background:#eff6ff; color:#1d4ed8; }
.team-engineering { background:#f0fdf4; color:#15803d; }
.team-marketing  { background:#fdf4ff; color:#7e22ce; }
.team-design     { background:#fff7ed; color:#c2410c; }
.team-sales      { background:#fef9c3; color:#854d0e; }
.team-research   { background:#f1f5f9; color:#475569; }

/* ── Action category tags ────────────────────────────────────────────────── */
.action-tag { display:inline-block; font-size:.72rem; padding:2px 8px; border-radius:10px; font-weight:500; white-space:nowrap; }
.tag-feature-dev  { background:#dbeafe; color:#1e40af }
.tag-marketing    { background:#fce7f3; color:#9d174d }
.tag-research     { background:#fef9c3; color:#854d0e }
.tag-partnerships { background:#dcfce7; color:#166534 }
.tag-tech         { background:#f3e8ff; color:#6b21a8 }
.tag-process      { background:#f1f5f9; color:#475569 }
.tag-other        { background:#f3f4f6; color:var(--text-muted) }

/* ── Results header actions ──────────────────────────────────────────────── */
.page-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:4px; }
.results-header-actions { display:flex; gap:8px; align-items:center; flex-shrink:0; }
.share-hint { font-size:.78rem; color:var(--text-light); margin-bottom:20px; }

/* ── Sidebar owner ───────────────────────────────────────────────────────── */
.sidebar-item-text { display:flex; flex-direction:column; min-width:0; flex:1; }
.sidebar-item-owner { font-size:.68rem; color:var(--text-light); margin-top:1px; }

/* ── Tracked competitors ─────────────────────────────────────────────────── */
.tracked-comp-item { display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:6px 0; border-bottom:1px solid var(--border); }
.tracked-comp-item:last-child { border-bottom:none; }
.tracked-comp-name { font-weight:500; font-size:.85rem; }
.form-input-sm { width:100%; padding:6px 10px; border:1px solid var(--border); border-radius:6px; font-size:.82rem; outline:none; }
.form-input-sm:focus { border-color:var(--accent); }

/* ── Brief Modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:1000;
  display:flex; align-items:center; justify-content:center; padding:16px;
}
.modal-box {
  background:var(--surface); border-radius:var(--radius); box-shadow:0 20px 60px rgba(0,0,0,.2);
  width:100%; max-width:720px; height:90vh; display:flex; flex-direction:column; overflow:hidden;
}
#modal-step-1, #modal-step-2 { display:flex; flex-direction:column; flex:1; min-height:0; overflow:hidden; }
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 24px; border-bottom:1px solid var(--border); flex-shrink:0;
}
.modal-title { font-weight:600; font-size:1rem; }
.modal-close { background:none; border:none; font-size:1.1rem; cursor:pointer; color:var(--text-muted); padding:2px 6px; border-radius:4px; }
.modal-close:hover { background:var(--bg); }
.modal-body { padding:20px 24px; overflow-y:auto; flex:1; }
.modal-brief-body { font-size:.88rem; line-height:1.7; }
.modal-brief-body h1 { font-size:1.1rem; margin:0 0 12px; }
.modal-brief-body h2 { font-size:.95rem; margin:16px 0 6px; }
.modal-brief-body h3 { font-size:.88rem; margin:12px 0 4px; }
.modal-brief-body ul { padding-left:18px; margin:4px 0 10px; }
.modal-brief-body li { margin-bottom:3px; }
.modal-footer {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:14px 24px; border-top:1px solid var(--border); flex-shrink:0; flex-wrap:wrap;
}
.modal-hint { font-size:.83rem; color:var(--text-muted); margin-bottom:16px; }
.modal-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.modal-field { width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:6px; font-size:.85rem; outline:none; resize:vertical; }
.modal-field:focus { border-color:var(--accent); }
.modal-action-list { display:flex; flex-direction:column; gap:6px; margin-top:6px; }
.brief-action-item { display:flex; align-items:center; gap:8px; font-size:.85rem; }
.brief-action-label { cursor:pointer; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

/* ── Brief focus-area table (replaces checkboxes) ────────────────────────── */
.modal-action-list-table { margin-top:8px; }
.brief-focus-table { width:100%; }
.brief-focus-row { cursor:pointer; transition:background .1s; }
.brief-focus-row:hover { background: var(--bg); }
.brief-focus-row.brief-focus-selected { background: var(--accent-light); }
.brief-focus-row.brief-focus-selected td { color: var(--text); }
.brief-focus-cb { accent-color: var(--accent); width:14px; height:14px; cursor:pointer; }

/* ── Markdown rendered content (summary cards only) ──────────────────────── */
.section-summary-text p { margin-bottom: 6px; line-height: 1.55; }
.section-summary-text ul { padding-left: 0; list-style: none; margin: 6px 0 0; }
.section-summary-text li {
  padding: 4px 0 4px 14px;
  position: relative;
  line-height: 1.45;
  font-size: .875rem;
}
.section-summary-text li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-weight: 700; font-size: .8rem; top: 5px; }
.section-summary-text strong { color: var(--text); font-weight: 650; }
.md-spacer { height: 6px; }

/* ── View home ───────────────────────────────────────────────────────────── */
.view-home { display: flex; justify-content: center; align-items: flex-start; padding-top: 60px; }

/* ── Results tabs ─────────────────────────────────────────────────────────── */
.results-tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.results-tab {
  padding: 9px 18px;
  font-size: .875rem;
  font-weight: 500;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 4px 4px 0 0;
  transition: color .15s;
}
.results-tab:hover { color: var(--text); background: var(--bg); }
.results-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ── Top signal callout ───────────────────────────────────────────────────── */
.top-signal-callout {
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .9rem;
  line-height: 1.5;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 20px;
}

/* ── Summary stack (Tab 1 AI summaries) ──────────────────────────────────── */
.summary-tldr-card { margin-bottom: 20px; }
.summary-tldr-card h2 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.summary-stack { display: flex; flex-direction: column; gap: 12px; }
.summary-stack-item { padding: 16px 20px; }
.summary-stack-item .card-label { margin-bottom: 8px; }

/* ── Section count badge ──────────────────────────────────────────────────── */
.section-count-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ── Filter tabs (actions table) ─────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.filter-tab {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.filter-tab:hover { background: var(--bg); color: var(--text); }
.filter-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Sortable table headers ───────────────────────────────────────────────── */
.sortable-th { cursor: pointer; user-select: none; transition: color .12s; }
.sortable-th:hover { color: var(--text); }
.sort-indicator { color: var(--accent); font-weight: 700; font-size: .8rem; }

/* ── ICP type filter pills ───────────────────────────────────────────────── */
.icp-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 0 12px;
}
.icp-filter-pill {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
  text-transform: capitalize;
}
.icp-filter-pill:hover { background: var(--bg); color: var(--text); }
.icp-filter-pill.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* ── Artifact CTA bar (compact) ──────────────────────────────────────────── */
.artifact-cta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.artifact-cta-bar-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  flex-shrink: 0;
}
.artifact-cta-bar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.artifact-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.artifact-cta-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Artifact output panel ───────────────────────────────────────────────── */
.artifact-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  overflow: hidden;
}
.artifact-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.artifact-panel-title { font-weight: 600; font-size: .9rem; }
.artifact-panel-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: background .12s;
}
.artifact-panel-toggle:hover { background: var(--border); }
.artifact-panel-toggle svg { width: 16px; height: 16px; }
.artifact-panel-body {
  padding: 20px 24px;
  max-height: 480px;
  overflow-y: auto;
}
.artifact-loading {
  font-size: .875rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 12px 0;
}
.artifact-content { font-size: .875rem; line-height: 1.7; }
.artifact-content h1 { font-size: 1.1rem; margin: 0 0 12px; }
.artifact-content h2 { font-size: .95rem; font-weight: 700; margin: 16px 0 6px; color: var(--accent); }
.artifact-content h3 { font-size: .875rem; font-weight: 600; margin: 12px 0 4px; }
.artifact-content ul { padding-left: 18px; margin: 4px 0 10px; }
.artifact-content li { margin-bottom: 4px; line-height: 1.5; }
.artifact-content p { margin-bottom: 8px; line-height: 1.6; }
.artifact-content strong { color: var(--text); font-weight: 650; }
.artifact-panel-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}

/* ── Analysis status (replaces progress feed terminal) ────────────────────── */
.analysis-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
}
.analysis-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s infinite;
  flex-shrink: 0;
}
#analysis-status-text {
  font-size: .875rem;
  color: var(--text-muted);
}

/* ── Summary CTA strip ────────────────────────────────────────────────────── */
.summary-cta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  margin-top: 20px;
  background: var(--accent-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
}
.summary-cta-text {
  font-size: .875rem;
  color: var(--accent);
  font-weight: 500;
}

/* ── Card label link (e.g. "View sources in Full Report →") ──────────────── */
.card-label-link {
  font-size: .7rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  margin-left: 8px;
  opacity: .85;
  text-transform: none;
  letter-spacing: 0;
}
.card-label-link:hover { text-decoration: underline; opacity: 1; }
