:root {
  color-scheme: light;
  --ink: #17202f;
  --muted: #607084;
  --line: #d9e1ea;
  --panel: #ffffff;
  --paper: #f3f6fa;
  --soft: #eef4f2;
  --accent: #0f8f83;
  --accent-dark: #0a655f;
  --warning: #bd7a10;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(21, 31, 46, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-status {
  min-width: 84px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(420px, 1fr) 380px;
  gap: 14px;
  min-height: calc(100vh - 70px);
  padding: 14px;
}

.panel,
.preview-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  overflow: auto;
  max-height: calc(100vh - 98px);
  padding: 16px;
}

.panel-header,
.section-title-row,
.preview-toolbar,
.download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 12px;
  font-size: 18px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.stack {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

label,
fieldset {
  display: grid;
  gap: 7px;
}

label span,
legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  min-height: 88px;
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 143, 131, 0.14);
}

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

.automation-fieldset {
  grid-template-columns: 1fr;
  gap: 9px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.automation-fieldset label,
.fake-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.automation-fieldset input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.segment,
.tab {
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button,
.ghost-button,
.icon-button,
.segment,
.tab {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.secondary-button,
.ghost-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

.icon-button {
  min-width: 48px;
  height: 38px;
  padding: 0 10px;
  font-size: 12px;
}

.button-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.18);
}

.manual-controls {
  display: grid;
  gap: 13px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.swatch {
  height: 32px;
  border: 2px solid transparent;
  border-radius: 8px;
}

.swatch.active {
  border-color: var(--ink);
}

.preview-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.preview-toolbar {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.preview-toolbar h2,
.preview-toolbar p {
  margin-bottom: 0;
}

.preview-toolbar p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.segment {
  height: 32px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.segment.active,
.tab.active {
  background: var(--ink);
  color: #fff;
}

.preview-stage {
  overflow: auto;
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(23, 32, 47, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(23, 32, 47, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
}

.site-preview {
  overflow: hidden;
  width: min(100%, 980px);
  min-height: 760px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--site-ink, #17202f);
}

.site-preview.mobile {
  width: min(100%, 390px);
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 760px;
  padding: 40px;
  text-align: center;
}

.empty-state p {
  max-width: 460px;
  margin: 0 auto;
  color: var(--muted);
}

.site-nav,
.site-section {
  padding: 22px clamp(18px, 4vw, 48px);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(23, 32, 47, 0.12);
}

.site-nav strong {
  font-size: 18px;
}

.site-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--site-muted, #607084);
  font-size: 13px;
  font-weight: 800;
}

.site-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
  gap: 26px;
  align-items: center;
  padding-top: 44px;
  padding-bottom: 44px;
  background: linear-gradient(135deg, rgba(15, 143, 131, 0.12), rgba(242, 184, 75, 0.14));
}

.site-hero h2 {
  max-width: 660px;
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
}

.site-hero p {
  max-width: 620px;
  color: var(--site-muted, #607084);
  font-size: 18px;
}

.site-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.site-button,
.site-button-secondary {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 15px;
  border-radius: var(--site-radius, 8px);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.site-button {
  background: var(--site-accent, #0f8f83);
  color: #fff;
}

.site-button-secondary {
  border: 1px solid rgba(23, 32, 47, 0.18);
  color: var(--site-ink, #17202f);
  background: #fff;
}

.site-visual {
  min-height: 260px;
  border-radius: var(--site-radius, 8px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.6)),
    repeating-linear-gradient(45deg, rgba(15, 143, 131, 0.16) 0 12px, rgba(242, 184, 75, 0.14) 12px 24px);
  border: 1px solid rgba(23, 32, 47, 0.14);
  display: grid;
  place-items: center;
  padding: 22px;
}

.site-visual-card {
  width: min(100%, 280px);
  padding: 18px;
  border-radius: var(--site-radius, 8px);
  background: #fff;
  box-shadow: 0 18px 40px rgba(21, 31, 46, 0.12);
}

.site-visual-card strong {
  display: block;
  margin-bottom: 7px;
}

.site-visual-card span {
  display: block;
  color: var(--site-muted, #607084);
  font-size: 13px;
}

.section-eyebrow {
  margin-bottom: 6px;
  color: var(--site-accent, #0f8f83);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.section-heading {
  margin-bottom: 16px;
  font-size: 26px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.site-card,
.form-card,
.notice-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(23, 32, 47, 0.12);
  border-radius: var(--site-radius, 8px);
  background: #fff;
}

.site-card h3,
.form-card h3,
.notice-card h3 {
  margin-bottom: 8px;
}

.site-card p,
.notice-card p {
  margin-bottom: 0;
  color: var(--site-muted, #607084);
  font-size: 14px;
}

.steps {
  display: grid;
  gap: 10px;
  counter-reset: step;
}

.step {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--site-accent, #0f8f83);
  color: #fff;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-card input,
.form-card textarea,
.form-card select {
  background: #f8fafc;
}

.site-footer {
  padding: 24px clamp(18px, 4vw, 48px);
  background: var(--site-ink, #17202f);
  color: #fff;
}

.site-footer p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.74);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.tab {
  height: 36px;
  font-size: 13px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.json-editor {
  min-height: 420px;
  margin-bottom: 12px;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.check-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.check-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: #fff;
}

.score-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--ink);
  border-radius: 8px;
  background: #fff;
}

.score-card strong,
.score-card span {
  display: block;
}

.score-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.check-item.warn {
  border-left-color: var(--warning);
}

.check-item.fail {
  border-left-color: var(--danger);
}

.check-item strong,
.check-item span {
  display: block;
}

.check-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.setup-list {
  padding-left: 21px;
  color: var(--muted);
}

.setup-list li {
  margin: 8px 0;
}

.ai-notes {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.ai-notes p {
  margin: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: 330px minmax(420px, 1fr);
  }

  .output-panel {
    grid-column: 1 / -1;
    max-height: none;
  }
}

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

  .panel {
    max-height: none;
  }

  .site-hero,
  .card-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .app-topbar,
  .topbar-actions,
  .preview-toolbar,
  .panel-header,
  .download-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .save-status {
    text-align: left;
  }

  .workspace {
    padding: 10px;
  }

  .split-fields {
    grid-template-columns: 1fr;
  }

  .site-nav {
    align-items: flex-start;
    flex-direction: column;
  }
}
