:root {
  --bg: #0f0f23;
  --panel: #16213e;
  --panel-2: #1a1a2e;
  --border: #2a2a4a;
  --text: #e8e8f0;
  --muted: #9090b0;
  --accent: #4a90d9;
  --hook: #e94560;
  --lead: #f5a623;
  --trip: #7ed321;
  --core: #4a90d9;
  --asc: #9013fe;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 30px; color: var(--accent); }
header h1 { font-size: 20px; letter-spacing: 0.5px; }
.tagline { color: var(--muted); font-size: 12px; }

main { max-width: 1200px; margin: 0 auto; padding: 24px; }

.build-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 24px;
}
.build-panel h2 { font-size: 17px; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

.build-form { display: flex; gap: 10px; flex-wrap: wrap; }
.build-form input {
  flex: 1; min-width: 200px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.build-form input:focus { outline: none; border-color: var(--accent); }
.build-form button {
  background: var(--accent);
  color: #fff; border: none;
  padding: 11px 26px;
  border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.build-form button:disabled { opacity: 0.5; cursor: not-allowed; }

.status { margin-top: 12px; font-size: 13px; color: var(--muted); min-height: 18px; }
.status.working { color: var(--lead); }
.status.done { color: var(--trip); }
.status.error { color: var(--hook); }
.progress { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.progress-bar { position: relative; flex: 1; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.progress-fill { position: absolute; left: 0; top: 0; height: 100%; width: 35%; border-radius: 999px;
  background: linear-gradient(90deg, var(--lead, #4a6cf7), var(--trip, #12b76a)); animation: progress-slide 1.4s ease-in-out infinite; }
.progress-time { font-size: 12px; color: var(--muted, #8a8aa0); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
@keyframes progress-slide {
  0% { left: -35%; }
  100% { left: 100%; }
}
.activity { margin-top: 12px; max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(255,255,255,0.02); padding: 8px 10px; font-size: 12.5px; }
.act-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; animation: act-in 0.25s ease; }
.act-i { flex: 0 0 auto; width: 16px; text-align: center; color: var(--muted, #8a8aa0); }
.act-msg { flex: 1; color: var(--text, #e8e8f0); }
.act-t { flex: 0 0 auto; color: var(--muted, #8a8aa0); font-variant-numeric: tabular-nums; font-size: 11px; }
.act-tool .act-i { color: var(--lead, #4a6cf7); }
.act-agent .act-i { color: #b07cf7; }
.act-done .act-i, .act-done .act-msg { color: #12b76a; }
.act-error .act-i, .act-error .act-msg { color: #e5484d; }
.act-system .act-msg { color: var(--muted, #a5a5b8); }
@keyframes act-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }

.layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }

.sidebar { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; height: fit-content; }
.sidebar h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 12px; }
.topic-list { list-style: none; }
.topic-list li {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  font-size: 14px; margin-bottom: 4px; transition: background 0.15s;
}
.topic-list li:hover { background: var(--panel-2); }
.topic-list li.active { background: var(--accent); color: #fff; }
.topic-list li .count { float: right; color: var(--muted); font-size: 12px; }
.topic-list li.active .count { color: #cfe; }

.content { min-height: 300px; }
.empty-state { color: var(--muted); text-align: center; padding: 80px 20px; }
.hidden { display: none !important; }

#topicTitle { font-size: 22px; margin-bottom: 16px; }

/* Guided overview */
.guide-intro {
  background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 20px;
  font-size: 13px; color: var(--text);
}
.guide-intro strong { color: var(--accent); }
.ladder-wrap { margin-bottom: 26px; }
.section-h { font-size: 16px; margin-bottom: 4px; }
.section-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

.ladder-list { list-style: none; counter-reset: rung; }
.ladder-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 10px;
  cursor: pointer; transition: border-color 0.15s, transform 0.05s;
}
.ladder-item:hover { border-color: var(--accent); transform: translateX(2px); }
.rung-num {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.rung-body { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.rung-title { display: flex; align-items: center; gap: 8px; }
.rung-name { font-weight: 600; font-size: 15px; }
.rung-note { font-size: 12px; color: var(--muted); }
.rung-go { flex: none; color: var(--accent); font-size: 13px; white-space: nowrap; }

/* Detail view */
.back-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
  margin-bottom: 16px;
}
.back-btn:hover { border-color: var(--accent); }
.ladder-note {
  font-size: 13px; color: var(--muted); background: var(--panel-2);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px;
}
.detail-nav { display: flex; justify-content: space-between; margin-top: 18px; }
.detail-nav .btn-sm { cursor: pointer; }

/* Deliverables */
#deliverables { margin-top: 30px; }
.deliverable-list { list-style: none; }
.deliverable-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 16px; margin-bottom: 9px;
}
.deliverable-item.guide { border-color: var(--accent); background: rgba(74,144,217,0.08); }
.dl-name { font-size: 14px; font-weight: 500; }
.dl-links { display: flex; gap: 12px; white-space: nowrap; }
.dl-links a { color: var(--accent); text-decoration: none; font-size: 13px; }
.dl-links a:hover { text-decoration: underline; }

/* Go-live launch panel */
.golive {
  margin: 18px 0 6px; padding: 18px 20px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(74,108,247,0.12), rgba(124,58,237,0.12));
  border: 1px solid rgba(124,58,237,0.35);
}
.golive-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.golive-title { font-size: 15px; font-weight: 700; }
.golive-sub { font-size: 13px; color: var(--muted, #8a8aa0); }
.launch-badge { display: inline-block; align-self: flex-start; margin-top: 6px; font-size: 12px;
  font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; }
.launch-badge:empty { display: none; }
.launch-badge.ok { color: #0f7b3f; background: #e7f7ee; border-color: #b6e3c8; }
.launch-badge.warn { color: #a35a00; background: #fdf1e0; border-color: #f0d3a6; }
.golive-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-go {
  cursor: pointer; border: 1px solid var(--border); background: var(--panel);
  color: var(--text, #e8e8f0); border-radius: 9px; padding: 10px 16px;
  font-size: 14px; font-weight: 600;
}
.btn-go:hover { border-color: var(--accent); }
.btn-go-primary {
  background: linear-gradient(135deg, #4a6cf7, #7c3aed); color: #fff; border: 0;
}
.golive-status { margin-top: 10px; font-size: 13px; min-height: 18px; }
.golive-status .working { color: var(--accent); }
.golive-status .done { color: #12b76a; }
.golive-status .err { color: #e5484d; }
.golive-status a { color: var(--accent); }
.golive-status .hint { margin-top: 8px; font-size: 12px; color: var(--muted, #8a8aa0); }
.golive-status .hint.err { color: #e5a24d; }

/* Conversion stats */
.golive-analytics { margin-top: 12px; }
.stats-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.stats-card h4 { margin: 0 0 12px; font-size: 14px; }
.stat-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.stat-label { flex: 0 0 150px; font-size: 12px; color: var(--muted, #b7b7c8); }
.stat-bar { flex: 1; height: 16px; background: rgba(255,255,255,0.06); border-radius: 8px; overflow: hidden; }
.stat-fill { display: block; height: 100%; background: linear-gradient(90deg, #4a6cf7, #7c3aed); }
.stat-val { flex: 0 0 40px; text-align: right; font-weight: 700; font-size: 13px; }
.stat-rates { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted, #b7b7c8); }
.stat-rates b { color: var(--text, #e8e8f0); }
.stat-note { margin-top: 10px; font-size: 12px; color: var(--muted, #8a8aa0); }

/* Coolify connect form */
.coolify-form { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-top: 8px; }
.coolify-intro { margin: 0; font-size: 13px; font-weight: 600; }
.coolify-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted, #b7b7c8); }
.coolify-form input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text, #e8e8f0); font-size: 13px; }
.coolify-form input:focus { outline: none; border-color: #4a6cf7; }
.coolify-form-actions { display: flex; gap: 10px; margin-top: 4px; }
.golive-link { color: var(--accent, #7c9cf7); font-size: 12px; margin-left: 8px; }
.gumroad-results { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.gumroad-row { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,0.03); font-size: 12px; }
.gumroad-row a { display: block; margin-top: 2px; word-break: break-all; }

.tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab {
  background: none; border: none; color: var(--muted);
  padding: 10px 16px; cursor: pointer; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Artifact cards */
.artifact-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.artifact-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.artifact-head h3 { font-size: 17px; }
.badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--panel-2); color: var(--muted);
  padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border);
}
.artifact-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm {
  font-size: 12px; color: var(--accent); text-decoration: none;
  border: 1px solid var(--border); background: var(--panel-2);
  padding: 4px 10px; border-radius: 6px; white-space: nowrap;
}
.btn-sm:hover { border-color: var(--accent); }

/* Visual funnel — layers narrow downward (Dotcom Secrets style) */
.funnel { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.layer {
  width: 100%;
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  background: var(--panel-2);
  padding: 12px 16px; border-radius: 8px; text-align: center;
  transition: width 0.2s;
}
.layer .lname { font-weight: 600; font-size: 14px; }
.layer .ltype { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.layer .ldesc { font-size: 13px; color: var(--text); margin-top: 3px; }
.layer .lprice { color: var(--lead); font-weight: 600; }
.layer .lcta { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 4px; }

.layer.hook { border-color: var(--hook); background: rgba(233,69,96,0.10); }
.layer.lead { border-color: var(--lead); background: rgba(245,166,35,0.10); }
.layer.trip { border-color: var(--trip); background: rgba(126,211,33,0.10); }
.layer.core { border-color: var(--core); background: rgba(74,144,217,0.10); }
.layer.asc  { border-color: var(--asc);  background: rgba(144,19,254,0.10); }

.followup { margin-top: 14px; }
.followup h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 6px; }
.followup ol { margin-left: 18px; font-size: 13px; color: var(--text); }
.followup li { margin-bottom: 4px; }

.unverified { margin-top: 12px; font-size: 12px; color: var(--hook); }
.unverified span { background: rgba(233,69,96,0.12); padding: 2px 6px; border-radius: 4px; margin-right: 4px; }

/* Canvas grid */
.canvas-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.canvas-frame {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.canvas-frame .cf-head { padding: 10px 14px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.canvas-frame .cf-links { display: flex; gap: 12px; }
.canvas-frame iframe { width: 100%; height: 720px; border: none; background: #16213e; }
.canvas-frame a { color: var(--accent); text-decoration: none; font-size: 12px; }

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