@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;
  --text: #0f1733;
  --text-2: #2a3458;
  --muted: #6a7497;
  --muted-2: #8590b4;
  --accent: #4d3af8;
  --accent-2: #6f5dff;
  --accent-soft: #ece9ff;
  --success: #18a05f;
  --danger: #e14d5f;
  --shadow: 0 4px 12px rgba(18, 28, 72, 0.06), 0 1px 3px rgba(18, 28, 72, 0.04);
  --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; }
body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(800px 520px at 100% 0%, rgba(68, 55, 241, 0.12), transparent 62%),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.builder-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
}
.builder-sidebar {
  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);
  position: sticky;
  top: 0;
  height: 100vh;
  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; }
.builder-workspace {
  padding: 24px;
  display: grid;
  gap: 16px;
}
.builder-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}
.builder-header p { margin: 0 0 6px; color: var(--accent); font-weight: 800; }
.builder-header h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); }
.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.meta span:not(:empty) {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.84);
  color: var(--muted);
  font-size: 13px;
}
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.primary, .ghost {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 15px;
  font-weight: 800;
  cursor: pointer;
}
.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #6b61ff);
}
.primary:disabled { opacity: .45; cursor: not-allowed; }
.ghost { border-color: var(--line); background: #fff; }
.compact { padding: 8px 10px; }
.state-card, .panel, dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
.state-card { padding: 24px; }
.state-card h2 { margin-top: 0; }
.state-card p { color: var(--muted); }
.builder-grid {
  display: grid;
  grid-template-columns: 240px minmax(320px, 1fr) 280px;
  gap: 12px;
  align-items: start;
}
.panel { padding: 16px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 18px; }
.blocks-panel { display: grid; gap: 10px; }
.block-item {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.block-item.active { border-color: var(--accent); background: #f3f2ff; }
.block-item span { color: var(--muted); font-size: 12px; }
.preview-panel { min-height: 620px; }
.preview-switcher { display: flex; gap: 6px; }
.preview-switcher button {
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface-soft);
}
.preview-switcher button.active { color: #fff; background: var(--accent); }
.preview-frame {
  margin-inline: auto;
  display: grid;
  gap: 12px;
  padding: 16px;
  min-height: 540px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--line);
  transition: width .2s ease;
}
.preview-frame.desktop { width: 100%; }
.preview-frame.tablet { width: min(720px, 100%); }
.preview-frame.mobile { width: min(390px, 100%); }
.preview-frame section {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}
.mini-hero { background: linear-gradient(135deg, #f3f2ff, #fff); }
.mini-hero h2, .preview-frame h3 { margin: 6px 0; }
.settings-panel form { display: grid; gap: 12px; }
.settings-panel label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.settings-panel input, .settings-panel textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  color: var(--text);
}
.settings-panel textarea { min-height: 80px; resize: vertical; }
.readiness-panel { grid-column: 1 / 2; }
.progress {
  height: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #7f76ff); }
.issue {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-soft);
  margin-top: 10px;
}
.issue span { color: var(--muted); font-size: 12px; }
.issue.critical strong { color: var(--danger); }
.ok { color: var(--success); font-weight: 800; }
.ai-panel { grid-column: 3 / 4; }
.ai-actions { display: grid; gap: 8px; }
.ai-actions button {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
}
.ai-panel article {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.ai-panel article span { color: var(--muted); font-size: 12px; }
dialog {
  width: min(440px, calc(100% - 24px));
  padding: 24px;
}
dialog::backdrop { background: rgba(18, 26, 53, .32); }
dialog h2 { margin-top: 0; }
dialog div { display: flex; justify-content: flex-end; gap: 10px; }

.preview-page,
.public-page {
  min-height: 100vh;
}
.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.public-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  display: grid;
  gap: 14px;
}
.public-hero,
.public-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,.95);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 34px);
}
.public-hero {
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(68,55,241,.18), transparent 72%),
    #fff;
}
.public-hero span {
  color: var(--accent);
  font-weight: 800;
}
.public-hero h1 {
  margin: 10px 0;
  font-size: clamp(28px, 5vw, 48px);
}
.public-hero p {
  max-width: 700px;
  color: var(--muted);
}
.public-hero a,
.form-card button {
  display: inline-block;
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #6b61ff);
  font-weight: 800;
}
.public-card h2 { margin-top: 0; }
.public-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.public-grid article {
  display: grid;
  gap: 5px;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-soft);
}
.public-grid span, .empty { color: var(--muted); }
.faq-list details {
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-soft);
}
.faq-list details + details { margin-top: 8px; }
.form-card form {
  display: grid;
  gap: 12px;
}
.form-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.form-card input,
.form-card textarea,
.form-card select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}
.form-card textarea { min-height: 110px; }
.checkbox {
  display: flex !important;
  align-items: center;
}
.legal-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
[data-form-status][data-tone="error"] { color: var(--danger); }
[data-form-status][data-tone="success"] { color: var(--success); }

@media (max-width: 1180px) {
  .builder-shell { grid-template-columns: 1fr; }
  .builder-grid { grid-template-columns: 1fr; }
  .readiness-panel, .ai-panel { grid-column: auto; }
}
@media (max-width: 760px) {
  .builder-workspace { padding: 16px; }
  .builder-header { flex-direction: column; }
}
