@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --sidebar: #111318;
  --ink: #111318;
  --muted: #6b7280;
  --caption: #374151;
  --accent: #e04f2f;
  --accent-soft: #fef2ee;
  --green: #0d9488;
  --green-soft: #ecfdf5;
  --line: #e5e7eb;
  --radius: 10px;
  --sidebar-w: 220px;
  --font: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* —— App shell: sidebar fixed, main scrolls —— */
#demo-banner {
  flex-shrink: 0;
  background: #fef3c7;
  color: #92400e;
  text-align: center;
  font-size: 0.75rem;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid #fde68a;
  font-family: var(--mono);
}

#demo-banner a { color: inherit; font-weight: 600; }

.app-frame {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* Sidebar stays put */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  color: #9ca3af;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid #1f2937;
}

.sidebar-brand {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid #1f2937;
}

.sidebar-brand h1 {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.sidebar-brand p {
  font-size: 0.72rem;
  color: #6b7280;
  margin: 0.35rem 0 0;
  line-height: 1.4;
}

.sync-line {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: #4b5563;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.sync-dot.demo { background: #d97706; }

.sidebar-nav { flex: 1; padding: 0.35rem 0; }

.nav-group-label {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;
}

.nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 1rem;
  border: none;
  background: none;
  color: #d1d5db;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  border-left: 3px solid transparent;
}

.nav-btn:hover { background: rgba(255,255,255,0.04); color: #fff; }

.nav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.nav-btn.active {
  color: #fff;
  background: rgba(224, 79, 47, 0.12);
  border-left-color: var(--accent);
  font-weight: 500;
}

.sidebar-foot {
  padding: 0.85rem 1rem;
  font-size: 0.65rem;
  color: #4b5563;
  line-height: 1.45;
  border-top: 1px solid #1f2937;
}

/* Main scrolls independently */
.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 247, 249, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.75rem;
}

.topbar h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.content {
  padding: 1.25rem 1.75rem 2.5rem;
  max-width: 900px;
}

/* —— Intro card (playbook hero) —— */
.playbook-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--accent);
}

.playbook-hero .eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.playbook-hero h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0.4rem 0 0;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.playbook-hero p {
  color: var(--caption);
  font-size: 0.9rem;
  margin: 0.65rem 0 0;
  line-height: 1.6;
  max-width: 36rem;
}

.hero-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.playbook-steps {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.playbook-steps span {
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* —— Contrast: simple list —— */
.contrast-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.contrast-list li {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.84rem;
}

.contrast-list li:last-child { border-bottom: none; }

.contrast-list .not {
  color: var(--muted);
  text-decoration: line-through;
}

.contrast-list .is {
  color: var(--ink);
  font-weight: 500;
}

/* —— Panels —— */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.panel-head {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.panel-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.panel-head .meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.panel-body { padding: 1rem; }
.panel-body.flush { padding: 0; }

/* —— Stages: simple timeline —— */
.stage-list { margin: 0; padding: 0; list-style: none; }

.stage-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

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

.stage-marker {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.stage-content h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.stage-content .chip {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.stage-rows {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
}

.stage-rows p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--caption);
  line-height: 1.45;
}

.stage-rows strong {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
}

/* —— Layers —— */
.layer-list { margin: 0; padding: 0; list-style: none; }

.layer-item {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}

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

.layer-item h4 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.layer-item p {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

/* —— Briefing —— */
.briefing-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
}

.briefing-hero .eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.briefing-hero h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.35rem 0 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.briefing-hero p {
  color: var(--caption);
  font-size: 0.85rem;
  margin: 0.55rem 0 0;
  line-height: 1.55;
}

.signal-box {
  margin-top: 0.75rem;
  padding: 0.65rem 0.8rem;
  background: var(--accent-soft);
  border-radius: 6px;
  font-size: 0.8rem;
  color: #9a3412;
}

.rec-box {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--green);
  font-weight: 500;
}

/* —— Metrics —— */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}

.metric-card .label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.metric-card .value {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

.metric-card .meta {
  font-size: 0.65rem;
  color: var(--muted);
}

/* —— Action queue —— */
.action-queue {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.action-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  border-top: 3px solid var(--accent);
}

.action-step .num {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.action-step .label {
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.action-step .detail {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* —— Cards —— */
.adapt-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: var(--surface);
}

.adapt-card.tier1 { border-left: 3px solid var(--green); }

.adapt-card .hook {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
  margin-top: 0.35rem;
}

.adapt-card .why {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.tier-pill {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.tier-pill.tier1 { background: var(--green-soft); color: var(--green); }
.tier-pill.tier2 { background: var(--accent-soft); color: var(--accent); }
.tier-pill.tier3 { background: var(--bg); color: var(--muted); }

.shock-ring {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  background: var(--bg);
  border-radius: 4px;
  color: var(--caption);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.3rem; }

.chip {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.12rem 0.38rem;
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
}

.chip.hot { background: var(--accent-soft); color: var(--accent); }

/* —— Spotlight & directives —— */
.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}

.spot-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.spot-card .thumb {
  height: 140px;
  background: var(--bg);
  position: relative;
}

.spot-card .thumb img { width: 100%; height: 100%; object-fit: cover; }

.spot-card .body { padding: 0.85rem; }
.spot-card .why { font-size: 0.76rem; color: var(--muted); margin-top: 0.4rem; line-height: 1.45; }
.spot-card ul { margin: 0.4rem 0 0; padding-left: 1rem; font-size: 0.72rem; color: var(--muted); }

.directive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
}

.play-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
}

.play-card .type {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.play-card h4 { font-size: 0.88rem; margin: 0.3rem 0 0; font-weight: 600; }
.play-card p { font-size: 0.76rem; color: var(--muted); margin: 0.3rem 0 0; }
.play-card .act { font-size: 0.72rem; color: var(--green); margin-top: 0.4rem; font-weight: 500; }

/* —— Reels —— */
.reel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
}

.reel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  position: relative;
}

.reel-card img { width: 100%; height: 168px; object-fit: cover; background: var(--bg); display: block; }

.reel-thumb {
  height: 168px;
  padding: 1rem 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.reel-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}

.reel-thumb > * { position: relative; z-index: 1; }

.reel-thumb-user {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  opacity: 0.85;
  text-transform: lowercase;
}

.reel-thumb-hook {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reel-thumb-meta {
  font-size: 0.6rem;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reel-thumb--mindset { background: linear-gradient(145deg, #1e40af 0%, #0f172a 55%, #020617 100%); }
.reel-thumb--content-strategy { background: linear-gradient(145deg, #6d28d9 0%, #312e81 55%, #1e1b4b 100%); }
.reel-thumb--business-models { background: linear-gradient(145deg, #b45309 0%, #78350f 55%, #1c1917 100%); }
.reel-thumb--entrepreneurship { background: linear-gradient(145deg, #0d9488 0%, #115e59 55%, #042f2e 100%); }
.reel-thumb--sales { background: linear-gradient(145deg, #dc2626 0%, #991b1b 55%, #1c1917 100%); }
.reel-thumb--execution { background: linear-gradient(145deg, #ea580c 0%, #9a3412 55%, #1c1917 100%); }
.reel-thumb--default { background: linear-gradient(145deg, #374151 0%, #111827 100%); }

.spot-card .thumb .reel-thumb { height: 148px; }
.reel-card .body { padding: 0.8rem; }

.breakout-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--ink);
  color: #5eead4;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* —— Patterns —— */
.pattern-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

.pattern-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}

.pattern-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

.pattern-label { font-size: 0.78rem; font-weight: 500; min-width: 110px; }
.pattern-meta { font-family: var(--mono); font-size: 0.62rem; color: var(--muted); }

/* —— Buttons & forms —— */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.48rem 0.9rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-dark { background: var(--ink); color: #fff; }

.form-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.65rem; }

input, textarea {
  font-family: inherit;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  background: #fff;
}

input:focus, textarea:focus {
  outline: 2px solid rgba(224, 79, 47, 0.2);
  border-color: var(--accent);
}

.score-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 0.12rem 0.35rem;
  background: var(--bg);
  border-radius: 4px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.start-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.84rem;
  color: var(--caption);
  line-height: 1.75;
}

.agent-copy {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.agent-copy p { margin: 0; font-size: 0.78rem; color: var(--muted); }

.preview-badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.4rem;
  background: var(--bg);
  color: var(--muted);
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.preview-ghost { opacity: 0.92; }

#toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  max-width: 18rem;
  padding: 0.65rem 1rem;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-size: 0.8rem;
  z-index: 100;
}

.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.15rem;
  border: 1px solid var(--line);
}

@media (max-width: 768px) {
  .app-frame { flex-direction: column; }
  .sidebar { width: 100%; max-height: 40vh; }
  .action-queue { grid-template-columns: 1fr; }
  .contrast-list li { grid-template-columns: 1fr; gap: 0.25rem; }
  .two-col { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
