/* ThinkTank design v2 - loaded after styles.css.
   Direction from Mobbin research references: Sprig / Linear / Cursor settings (warm off-white canvas,
   left sidebar nav, hairline-bordered white cards, stacked settings cards), Typeform / Hotjar / Dovetail
   survey results (KPI cards, donut + bars, calm neutral palette with one accent). */

:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --panel-2: #f2f0eb;
  --line: #e5e2da;
  --text: #1d1c1a;
  --muted: #6b6860;
  --accent: #e8590c;
  --accent-soft: #fff1e8;
  --blue: #2563eb;
  --green: #15803d;
  --red: #dc2626;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(29, 28, 26, .05);
  --shadow-md: 0 4px 16px rgba(29, 28, 26, .07);
  --sidebar-w: 232px;
}

body { background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }

/* ---------- App shell: sidebar + main ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
  padding: 20px 14px; background: #fbfaf7; border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--text); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em;
}
.brand strong { display: block; font-size: 16px; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 11px; }

.tabs-top {
  display: flex; flex-direction: column; gap: 2px; padding: 0; background: transparent;
  border: 0; position: static; overflow: visible;
}
.tab {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 8px; color: var(--muted); background: transparent;
  font-size: 14px; font-weight: 600; text-align: left;
}
.tab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tab:hover { background: #efede7; color: var(--text); }
.tab.active { background: #ebe8e0; color: var(--text); font-weight: 700; }
.tab.active svg { color: var(--accent); }

.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 0 6px; }
.sidebar-foot p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.status-pill { background: #fff; border-color: var(--line); color: var(--muted); font-size: 12px; padding: 6px 10px; width: fit-content; }
.status-pill.ok { border-color: #b7e4c7; color: #15803d; background: #f0fbf4; }
.status-pill.bad { border-color: #f5c2c0; color: #b91c1c; background: #fff4f3; }

.app-main { min-width: 0; }
.page { padding: 24px 28px 40px; }
.report-layout { height: calc(100vh - 64px); grid-template-columns: 320px minmax(0, 1fr); gap: 20px; }

/* ---------- Surfaces ---------- */
.side-panel, .panel-surface { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: var(--radius-md); }
h2 { font-size: 17px; font-weight: 700; }
select, input, textarea {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--text);
  padding: 9px 11px; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus, textarea:focus { outline: 0; border-color: #d4a98c; box-shadow: 0 0 0 3px rgba(232, 89, 12, .12); }
label { color: var(--muted); font-size: 12px; font-weight: 600; }

button { border-radius: 8px; }
.primary-btn { background: var(--text); color: #fff; padding: 10px 14px; font-weight: 700; }
.primary-btn:hover { background: #34322e; }
.ghost-btn, .icon-btn { background: #fff; color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-weight: 600; }
.ghost-btn:hover, .icon-btn:hover { background: var(--panel-2); }
.small-note, .metric-row span { color: var(--muted); }

.topic-card, .summary-panel, .candidate-preview, .method-box, .next-checks,
.axis-matrix-wrap, .menu-overview-wrap, .lineup, .group-builder-left, .group-builder-right {
  background: var(--panel-2); border-color: var(--line); color: var(--text);
}
.topic-card { color: var(--muted); }
.considerations-note { background: #fff8e6; border-color: #f0d28a; color: #8a5a00; }
.metric-row div { background: var(--panel-2); }
.metric-row strong { font-size: 24px; }
.recent-item { background: #fff; }
.recent-item-main, .recent-item-del { background: #fff; color: var(--text); }
.recent-item-del { color: var(--muted); }
.recent-item-del:hover { background: #fdecec; color: var(--red); }
.recent-item.active { border-color: var(--accent); background: var(--accent-soft); }
.recent-item.active .recent-item-main, .recent-item.active .recent-item-del { background: var(--accent-soft); }

/* ---------- Report hero ---------- */
.hero, .panel-hero { background: #fff; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 4px 0 18px; margin-bottom: 4px; }
.hero h2 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.eyebrow { color: var(--accent); letter-spacing: .1em; }
.run-state { background: var(--panel-2); color: var(--muted); font-size: 12px; border: 1px solid var(--line); }
.report-main { padding: 24px 28px; }

/* ---------- Pale-on-dark text patches ---------- */
.brief-body p, .finding-card p, .stance-card ul, .axis-name, .deep-dive-card p, .turn p { color: #2d2b27; }
.taste-line { color: #9a3412; }
.chip { background: var(--panel-2); color: #3f3d38; border-color: var(--line); }
.chip.segment-consumer { background: #e8f0fe; color: #1d4ed8; border-color: #bfd3fb; }
.chip.segment-expert { background: #f3e8ff; color: #7e22ce; border-color: #dcc1fa; }
.chip.segment-operator { background: #fff4e0; color: #b45309; border-color: #f2d49b; }
.kd.ok, .decision-badge.ok, .ov-status.kept, .ov-score.high, .name-keep { color: #15803d; }
.kd.warn, .decision-badge.warn, .ov-score.mid { color: #b45309; }
.kd.info, .decision-badge.info, .ov-score.low, .risk-tag { color: #b91c1c; }
.menu-card { background: #fff; box-shadow: var(--shadow-sm); }
.menu-card-photo, .avatar-img, .new-menu-photo-preview, .menu-photo-cell img, .lineup-seat img { background: var(--panel-2); }
.menu-card-score.high strong { color: #15803d; }
.menu-card-score.mid strong { color: #b45309; }
.menu-card-score.low strong { color: #b91c1c; }
.score-track, .cand-support-track, .mini-meter, .cat-pill { background: #ece9e2; }
.menu-overview-table thead th { background: var(--panel-2); color: var(--text); }
.turn.typing .bubble { background: var(--panel-2); }
.persona-card.selected .select-badge { color: #fff; }

/* ---------- Admin: Mobbin settings pattern (stacked cards, centered column) ---------- */
.admin-page.tab-page.active { display: block; max-width: 780px; margin: 0 auto; }
.admin-gate {
  max-width: 380px; margin: 48px auto; padding: 28px; display: grid; gap: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.admin-gate h3 { font-size: 18px; }
.admin-gate .primary-btn { margin-top: 4px; width: 100%; }
.set-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.set-card > header { margin-bottom: 14px; }
.set-card h3 { font-size: 15px; font-weight: 700; grid-column: auto; }
.set-card header p, .card-sub { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.set-grid .wide { grid-column: 1 / -1; }
.settings-form { display: block; }
.settings-form .set-card textarea { width: 100%; min-height: 110px; }
.save-bar { display: flex; gap: 10px; align-items: center; padding: 4px 0 20px; }
.save-bar .primary-btn { width: auto; margin-top: 0; padding: 10px 20px; }
.button-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.button-row .primary-btn, .button-row .ghost-btn { width: auto; margin-top: 0; }
.ai-status { border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.ai-status-head { align-items: flex-start; }
.ai-status-head .button-row { margin-top: 0; }
.ai-status-head .primary-btn { padding: 8px 14px; }
.ai-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; }
.ai-row { border-top-color: var(--line); }
.ai-row.bad .ai-row-detail { color: #b91c1c; }
.chip-btn { background: #fff; border-color: var(--line); color: var(--text); }
.chip-btn:hover, .chip-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- Report details ---------- */
.vote-glance { background: var(--panel-2); border-color: var(--line); }

/* ---------- Responsive: sidebar -> top bar ---------- */
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center;
    gap: 8px; padding: 8px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; flex: none; }
  .brand div { display: none; }
  .tabs-top { flex-direction: row; gap: 2px; flex: none; }
  .tab { width: auto; padding: 8px 10px; white-space: nowrap; }
  .tab svg { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; flex: none; }
  .sidebar-foot p { display: none; }
  .page { padding: 14px; }
  .report-main { padding: 16px; }
  .set-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .report-layout { height: auto; grid-template-columns: 1fr; }
  .side-panel { height: auto; overflow: visible; }
  .report-main { height: auto; overflow: visible; }
}

/* doc-mode (paper) keeps its own chrome-free layout */
body.doc-mode .sidebar { display: none; }
body.doc-mode .app-shell { display: block; }
@media print { .sidebar { display: none !important; } .app-shell { display: block !important; } }

/* hero: title on its own row, actions wrap below instead of squeezing the title */
.hero { flex-wrap: wrap; align-items: flex-start; }
.hero > div:first-child { flex: 1 1 360px; min-width: 0; }
.hero-actions { flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
.hero-actions .ghost-btn, .run-state { white-space: nowrap; }
.hero-actions .ghost-btn { padding: 7px 12px; font-size: 13px; }
.run-state { padding: 7px 12px; min-width: 0; }

@media (max-width: 720px) {
  .hero > div:first-child { flex: none; }
  .hero-actions { margin-top: 4px; }
}
.sidebar { scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
