:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --accent: #10b981;
  --accent-strong: #059669;
  --accent-tint: #ecfdf5;
  --accent-tint-strong: #d1fae5;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.03);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-mark svg { width: 16px; height: 16px; }

.brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13.5px;
  transition: background-color 0.12s, color 0.12s;
}

.nav-list a:hover { background: var(--surface-muted); color: var(--text); }
.nav-list a.active { background: var(--accent-tint); color: var(--accent-strong); font-weight: 600; }
.nav-list svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.connection-state { font-size: 12px; color: var(--text-muted); }
.connection-state .eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.connection-state strong { color: var(--text); font-weight: 600; word-break: break-all; }

.text-button {
  background: none;
  border: 0;
  color: var(--text-muted);
  text-align: left;
  padding: 4px 0;
  font-size: 12px;
}
.text-button:hover { color: var(--accent-strong); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.search { flex: 1; max-width: 560px; position: relative; }

.search input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.search input:focus { background: var(--surface); border-color: var(--border-strong); }

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.topbar-spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.notif-bell {
  position: relative;
  background: none;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.notif-bell:hover { background: var(--surface-muted); color: var(--text); }
.notif-bell .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%;
  border: 2px solid var(--surface);
}

.content { padding: 28px; max-width: 1400px; width: 100%; }

.page { display: grid; gap: 24px; }
.page[hidden] { display: none; }

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text);
}
.page-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  max-width: 640px;
}

.page-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

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

.page-main, .page-side { display: grid; gap: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px;
  letter-spacing: -0.005em;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin: 0 0 8px;
}

.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.pill.success { background: var(--accent-tint); color: var(--accent-strong); }
.pill.neutral { background: var(--surface-muted); color: var(--text-muted); }
.pill.warning { background: #fef3c7; color: #92400e; }

.hero-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 60%);
  border: 1px solid var(--accent-tint-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.hero-card h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-strong);
  margin: 0 0 12px;
  max-width: 380px;
  line-height: 1.2;
}

.hero-card p {
  color: var(--text-muted);
  margin: 0 0 24px;
  max-width: 420px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.step { text-align: center; padding: 12px 6px; }

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  font-weight: 600;
  font-size: 13px;
}

.step.done .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.current .step-num {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent-strong);
  box-shadow: 0 0 0 4px var(--accent-tint);
}

.step-title { font-size: 12.5px; font-weight: 600; color: var(--text); display: block; margin-bottom: 4px; }
.step-desc { font-size: 11px; color: var(--text-muted); line-height: 1.35; }

.hero-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(0.5px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not([disabled]) { background: var(--surface-muted); }

.stats { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }

.stat { display: flex; align-items: center; gap: 12px; }

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 18px; height: 18px; }

.stat-body { flex: 1; min-width: 0; }
.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  display: block;
  line-height: 1.1;
}
.stat-label { font-size: 11.5px; color: var(--text-muted); }

.stat-pill {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-strong);
  font-weight: 600;
}

.channels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.channel-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
}
.channel-chip svg { width: 14px; height: 14px; }

.flow { display: grid; gap: 6px; }

.flow-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.flow-node.center { background: var(--accent-tint); border-color: var(--accent-tint-strong); }

.flow-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text-muted);
}
.flow-node.center .flow-icon { background: var(--accent); color: #fff; }

.flow-body strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.flow-body span { font-size: 11px; color: var(--text-muted); }

.flow-arrow { text-align: center; color: var(--text-faint); font-size: 14px; line-height: 1; }
.flow-fork { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 14px;
}
.section-heading h2 { font-size: 16px; font-weight: 600; margin: 0; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.product-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: grid;
  gap: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.product-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.product-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

.product-art {
  aspect-ratio: 16/10;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fde68a, #fca5a5, #c4b5fd);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.5);
  font-size: 22px;
  overflow: hidden;
}
.product-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.product-card strong { font-size: 13.5px; display: block; }
.product-card .price { font-size: 12.5px; font-weight: 600; color: var(--accent-strong); }

.channel-list { display: grid; gap: 8px; margin: 12px 0; }
.channel-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.generate-button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.generate-button:hover:not([disabled]) { background: var(--accent-strong); }
.generate-button[disabled] { opacity: 0.5; cursor: not-allowed; }

.output-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

.asset-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 880px) { .asset-layout { grid-template-columns: 1fr; } }

.creative-preview { display: grid; gap: 10px; }

.asset-card {
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-strong);
}
.asset-card.warm { background: #fef3c7; border-color: #fde68a; }
.asset-card.cool { background: #e0e7ff; border-color: #c7d2fe; }
.asset-card .asset-art { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 12px; line-height: 1.3; }
.asset-card strong { font-size: 13px; }
.asset-meta { font-size: 11px; color: var(--text-muted); margin: 0; }

.copy-stack { display: grid; gap: 14px; }
.copy-stack h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 6px;
}
.copy-stack ul { margin: 0; padding-left: 16px; display: grid; gap: 4px; }
.copy-stack li { font-size: 13px; }

.cta-list { display: flex; gap: 6px; flex-wrap: wrap; }
.cta-list span {
  display: inline-block;
  padding: 4px 10px;
  background: var(--surface-muted);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
}
.empty-state h2 { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.empty-state p { color: var(--text-muted); margin: 0 auto; max-width: 380px; }

.brand-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-strong);
  border-radius: var(--radius-md);
  font-size: 13px;
}
.brand-banner.warning { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.brand-banner.error { background: #fee2e2; border-color: #fecaca; color: var(--danger); }
.brand-banner .spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--accent-tint-strong);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.brand-banner button {
  margin-left: auto;
  background: none;
  border: 1px solid var(--accent-strong);
  color: var(--accent-strong);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
