@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-soft: #f2f4fb;
  --surface-2: #eef1fa;
  --line: #e5e8f2;
  --line-2: #edeffe;
  --text: #0f1733;
  --text-2: #2a3458;
  --muted: #6a7497;
  --muted-2: #8590b4;
  --accent: #4d3af8;
  --accent-2: #6f5dff;
  --accent-soft: #ece9ff;
  --success: #18a05f;
  --success-soft: #e3f6ec;
  --warning: #f59f0a;
  --warning-soft: #fef2dc;
  --danger: #e14d5f;
  --danger-soft: #fce6e9;
  --shadow: 0 4px 12px rgba(18, 28, 72, 0.06), 0 1px 3px rgba(18, 28, 72, 0.04);
  --shadow-md: 0 12px 32px rgba(18, 28, 72, 0.09);
  --shadow-accent: 0 10px 24px rgba(77, 58, 248, 0.28);
  --radius: 18px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
svg { flex-shrink: 0; }

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 480px at 100% -5%, rgba(77, 58, 248, 0.10), transparent 58%),
    linear-gradient(180deg, #fafbff 0%, var(--bg) 100%);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.program-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 12px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.brand { display: block; padding: 2px 4px 6px; flex-shrink: 0; }
.brand img { width: 180px; max-width: 100%; display: block; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.nav-section {
  margin: 10px 0 4px 10px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover { background: var(--surface-soft); color: var(--text); }
.nav-item:hover .nav-icon { color: var(--accent); }
.nav-item.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.nav-item.active .nav-icon { color: #fff; }

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted-2);
  transition: color 0.15s var(--ease);
}
.nav-icon svg { width: 15px; height: 15px; }

.sidebar-note {
  flex-shrink: 0;
  margin-top: auto;
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, #fff 0%, #f4f6ff 100%);
}

.sidebar-note strong { font-size: 12.5px; color: var(--text-2); }
.sidebar-note span { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.workspace {
  padding: 24px;
  display: grid;
  gap: 16px;
}
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.03em;
}
.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.meta-line span:not(:empty) {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}
.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.primary,
.ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s var(--ease), background 0.15s var(--ease);
  line-height: 1;
  white-space: nowrap;
}
.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-accent);
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(77, 58, 248, 0.36); }
.primary:active { transform: translateY(0); }
.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.ghost {
  color: var(--text-2);
  border-color: var(--line);
  background: #fff;
}
.ghost:hover { background: var(--surface-soft); border-color: #d0d6ec; transform: translateY(-1px); }
.ghost:active { transform: translateY(0); }
.ghost.strong { font-weight: 800; }
.compact { padding: 8px 10px; font-size: 13px; }

.card,
.state-card,
.choice-card,
dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}
.card,
.state-card,
.choice-card { padding: 20px; }
.state-card h2,
.choice-card h2 { margin: 0 0 8px; letter-spacing: -0.01em; }
.state-card p,
.choice-card p,
.muted { color: var(--muted); }
.choice-grid {
  min-height: min(560px, 70vh);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: center;
}
.choice-card {
  min-height: 280px;
  display: grid;
  align-content: center;
  gap: 10px;
}
.choice-card span {
  color: var(--accent);
  font-weight: 800;
}
.choice-card p { line-height: 1.6; }
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.wide { grid-column: span 2; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.section-head h2 {
  margin: 0;
  font-size: 18px;
}
.section-head a { color: var(--accent); font-weight: 800; font-size: 13px; }
.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
  margin-bottom: 14px;
}
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7f76ff);
}
.readiness-item,
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.readiness-item:first-child,
.list-row:first-child { border-top: 0; }
.readiness-item strong.done { color: var(--success); }
.readiness-item strong.warning { color: var(--warning); }
.readiness-item strong.error { color: var(--danger); }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.metric {
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-soft);
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.metric strong { font-size: 26px; }
.ai-card article,
[data-audit-result],
[data-ai-panel] {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.wizard-layout {
  display: grid;
  grid-template-columns: 220px minmax(420px, 1fr) 280px;
  gap: 12px;
  align-items: start;
}
.stepper {
  display: grid;
  gap: 8px;
}
.step-button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  text-align: left;
  background: #fff;
}
.step-button.active { border-color: var(--accent); background: var(--accent-soft); }
.step-button.done { color: var(--success); }
.wizard-card form,
.stack-form {
  display: grid;
  gap: 12px;
}
.wizard-card label,
.stack-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.wizard-card input,
.wizard-card textarea,
.wizard-card select,
.stack-form input,
.stack-form textarea,
.stack-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 12px);
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.wizard-card input:focus,
.wizard-card textarea:focus,
.wizard-card select:focus,
.stack-form input:focus,
.stack-form textarea:focus,
.stack-form select:focus {
  outline: none;
  border-color: #b0b8f0;
  box-shadow: 0 0 0 3px rgba(77, 58, 248, 0.12);
}
.wizard-card textarea,
.stack-form textarea { min-height: 96px; resize: vertical; }
.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}
.template-grid,
.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.template-option,
.channel-row {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}
.template-option input { width: auto; }
.helper-card > h2 { margin-top: 0; font-size: 18px; }
.helper-card a {
  display: block;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
}
.inline-check input { width: auto; }
.existing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.publish-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 320px;
  gap: 12px;
}
.publish-card {
  display: grid;
  align-content: start;
  gap: 10px;
}
.table-card table {
  width: 100%;
  border-collapse: collapse;
}
.table-card th,
.table-card td {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.table-card th {
  color: var(--muted);
  font-size: 12px;
}
.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 12px;
}
dialog {
  width: min(440px, calc(100% - 24px));
  padding: 24px;
}
dialog::backdrop { background: rgba(18, 26, 53, .32); }
dialog div { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 1180px) {
  .program-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; overflow: visible; }
  .sidebar-nav { overflow: visible; max-height: none; }
  .overview-grid,
  .wizard-layout,
  .existing-grid,
  .publish-layout,
  .choice-grid {
    grid-template-columns: 1fr;
  }
  .wide { grid-column: auto; }
}
