:root {
  --bg: #ebe7df;
  --panel: #fbfaf7;
  --line: #d8d1c4;
  --text: #17211f;
  --muted: #6c736f;
  --accent: #2f7d6d;
  --accent-strong: #1f5f53;
  --danger: #b2473e;
  --shadow: 0 18px 50px rgba(35, 42, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  min-height: 36px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button:disabled:hover {
  border-color: var(--line);
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 700;
}

.danger {
  color: var(--danger);
}

.iconButton {
  width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loginPanel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.loginPanel h1 {
  margin: 0 0 8px;
}

.loginPanel p {
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 10px 11px;
}

input[type="color"] {
  width: 54px;
  min-width: 54px;
  height: 38px;
  padding: 4px;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}

.colorControl {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.colorControl b {
  min-height: 38px;
  display: grid;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.settingsGroup {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: rgba(255,255,255,.5);
}

.logoPreview {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: white;
}

.fileButton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 12px;
  background: white;
  cursor: pointer;
  font-weight: 700;
}

.fileButton input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(360px, 1fr) 330px;
  overflow: hidden;
  min-height: 0;
}

.sidebar,
.inspector,
.chat {
  background: var(--panel);
  border-color: var(--line);
}

.sidebar {
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
}

.brand,
.userBar,
.panelHeader {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.brand strong {
  display: block;
}

.brand small,
.userBar small,
.muted {
  color: var(--muted);
}

.projectList {
  overflow: auto;
  padding: 10px;
  min-height: 0;
  overscroll-behavior: contain;
}

.projectItem {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.projectItem.active {
  border-color: var(--accent);
  background: #eff8f4;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
}

.topbar {
  min-height: 66px;
  max-height: 148px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.82);
  overflow: auto;
  overscroll-behavior: contain;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.mainGrid {
  min-height: 0;
  display: grid;
  grid-template-columns: 360px minmax(320px, 1fr);
  overflow: hidden;
}

.chat {
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.briefComposer {
  padding: 14px;
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
}

.briefComposer h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.briefComposer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.bigAction {
  min-height: 48px;
  font-size: 16px;
}

.compactMessages {
  padding-top: 10px;
}

.messages {
  overflow: auto;
  padding: 14px;
  min-height: 0;
  overscroll-behavior: contain;
}

.message {
  padding: 11px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  line-height: 1.45;
  background: white;
  border: 1px solid var(--line);
}

.message.user {
  background: #e8f3ef;
  border-color: #bfddd3;
}

.events {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.event {
  color: var(--muted);
  font-size: 13px;
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}

.chatForm {
  padding: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  max-height: 42vh;
  overflow: auto;
  overscroll-behavior: contain;
}

.chatActions {
  display: flex;
  gap: 8px;
}

.selectedHint {
  padding: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  background: white;
}

.previewWrap {
  overflow: auto;
  padding: 18px;
  min-height: 0;
  overscroll-behavior: contain;
}

.preview {
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  min-height: calc(100vh - 104px);
  box-shadow: var(--shadow);
}

.preview.mobile {
  max-width: 390px;
}

.preview.desktop {
  max-width: 1120px;
}

.startGuide {
  min-height: calc(100vh - 104px);
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 56px;
  background: #fbfaf7;
}

.startGuide h2 {
  margin: 0;
  font-size: 34px;
}

.startGuide p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.promptExample {
  max-width: 820px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
  line-height: 1.5;
}

.startSteps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.startSteps span {
  border: 1px solid #bfddd3;
  border-radius: 999px;
  background: #eff8f4;
  color: var(--accent-strong);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}

.landing {
  --landing-accent: #2f7d6d;
  --landing-bg: #f7f2ea;
  --landing-text: #17211f;
  --landing-font: Inter, system-ui, sans-serif;
  --heading-scale: 1;
  --body-scale: 1;
  background: var(--landing-bg);
  color: var(--landing-text);
  font-family: var(--landing-font);
  min-height: 100%;
}

.landingChrome {
  padding: 18px 32px;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  border-color: rgba(23, 33, 31, 0.12);
  border-style: solid;
  border-width: 0;
}

.landingHeader {
  border-bottom-width: 1px;
}

.landingFooter {
  border-top-width: 1px;
  color: rgba(23, 33, 31, 0.68);
  flex-wrap: wrap;
}

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

.landingBrand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}

.landingBlock {
  position: relative;
  padding: 54px 32px;
  border-bottom: 1px solid rgba(23, 33, 31, 0.12);
  cursor: pointer;
  font-family: var(--block-font-family, inherit);
}

.landingBlock.selected {
  outline: 3px solid var(--landing-accent);
  outline-offset: -3px;
}

.landingBlock h2,
.landingBlock h1 {
  margin: 0 0 16px;
  font-weight: var(--block-title-weight, 800);
}

.landingBlock h1 {
  font-size: calc(clamp(36px, 6vw, 78px) * var(--heading-scale) * var(--block-title-scale, 1));
}

.landingBlock h2 {
  font-size: calc(clamp(28px, 4vw, 48px) * var(--heading-scale) * var(--block-title-scale, 1));
  line-height: 1.04;
}

.landingBlock p,
.landingBlock li,
.landingBlock summary {
  font-size: calc(18px * var(--body-scale) * var(--block-body-scale, 1));
  font-weight: var(--block-body-weight, 400);
  line-height: var(--block-line-height, 1.55);
}

.landingHero {
  min-height: var(--block-min-height, 520px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.8fr);
  gap: 26px;
  align-items: center;
}

.landingText {
  max-width: 760px;
}

.landingButton {
  display: inline-flex;
  margin-top: 18px;
  background: var(--landing-accent);
  color: white;
  padding: 13px 18px;
  border-radius: 8px;
  font-weight: 800;
  font-size: calc(16px * var(--block-button-scale, 1));
}

.landingMedia {
  min-height: 260px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(47, 125, 109, 0.28);
  background: rgba(47, 125, 109, 0.12);
  color: var(--landing-accent);
  overflow: hidden;
}

.landingMedia img {
  width: 100%;
  height: 100%;
  object-fit: var(--block-media-fit, cover);
}

.landingColumns {
  display: grid;
  grid-template-columns: repeat(var(--block-columns, 3), minmax(0, 1fr));
  gap: 14px;
}

.landingCard {
  border: 1px solid rgba(23, 33, 31, 0.14);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.48);
}

.landingImageText {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}

.landingImageText .landingMedia {
  order: var(--block-image-order, 0);
}

.landingCta {
  background: var(--landing-text);
  color: var(--landing-bg);
}

.previewLeadForm {
  display: grid;
  gap: 12px;
  max-width: 620px;
}

.previewLeadForm label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.previewLeadForm input,
.previewLeadForm textarea {
  min-height: 42px;
  background: rgba(255, 255, 255, 0.72);
}

.fieldHelp {
  color: rgba(23, 33, 31, 0.62);
  font-size: 13px;
  font-weight: 500;
}

.inspector {
  border-left: 1px solid var(--line);
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
}

.panelBody {
  padding: 14px;
  min-height: 0;
}

.blockPalette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

.blockCatalogItem {
  display: grid;
  gap: 6px;
  min-height: 104px;
  text-align: left;
  align-content: start;
  background: white;
}

.blockCatalogItem strong {
  font-size: 15px;
}

.blockCatalogItem span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.blockNavigator {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.blockNavItem {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 3px 8px;
  text-align: left;
  align-items: center;
  min-height: 48px;
  background: white;
}

.blockNavItem span {
  grid-row: span 2;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #eef4f1;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.blockNavItem b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

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

.blockNavItem.active {
  border-color: var(--accent);
  background: #eff8f4;
}

.stack {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row > * {
  flex: 1;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.modalShade {
  position: fixed;
  inset: 0;
  background: rgba(23, 33, 31, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 10;
  overflow: auto;
  overscroll-behavior: contain;
}

.modal {
  width: min(620px, 100%);
  max-height: min(92vh, 920px);
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.wideModal {
  width: min(860px, 100%);
}

.modalHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.modalHeader h2 {
  margin: 0;
  font-size: 18px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.modal > .panelBody,
.modal > form.panelBody {
  overflow: auto;
  overscroll-behavior: contain;
}

.userForm {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.userForm button {
  min-height: 41px;
}

.userList {
  display: grid;
  gap: 8px;
}

.publishLinks {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.publishLinks a {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.userItem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 110px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.formFieldRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 72px 34px;
  gap: 6px;
  align-items: center;
}

.nestedPanel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.miniCheck {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.leadItem {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.backupItem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

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

.planWide {
  grid-column: 1 / -1;
}

.planSection {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 160px minmax(0, 1.4fr) 150px;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.planSection .field {
  margin: 0;
}

.leadFields {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.leadFields div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px;
}

.leadFields span {
  color: var(--muted);
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 220px minmax(320px, 1fr);
  }
  .inspector {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(360px, 96vw);
    z-index: 5;
    box-shadow: var(--shadow);
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .mainGrid {
    grid-template-columns: 1fr;
  }
  .chat {
    min-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .landingHero,
  .landingImageText,
  .landingColumns {
    grid-template-columns: 1fr;
  }
  .landingChrome {
    align-items: flex-start;
    flex-direction: column;
  }
  .userForm,
  .userItem,
  .backupItem,
  .planGrid,
  .planSection,
  .formFieldRow,
  .leadFields div,
  .blockCatalog {
    grid-template-columns: 1fr;
  }
}
