:root {
  color-scheme: light;
  --ink: #102c2b;
  --muted: #64716f;
  --paper: #fffdf8;
  --surface: #f3efe7;
  --accent: #d6a25e;
  --line: #d9d4c9;
  --shadow: 0 24px 70px rgba(16, 44, 43, .14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(214, 162, 94, .18), transparent 28rem),
    linear-gradient(180deg, #f8f5ef 0%, #ece8df 100%);
  color: var(--ink);
  font: 15px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button, select, input[type="file"], input[type="color"], input[type="range"] { cursor: pointer; }

.site-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(16, 44, 43, .1);
  background: rgba(255, 253, 248, .82);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  color: var(--paper); background: var(--ink); font: 800 13px/1 Georgia, serif; letter-spacing: .12em;
  box-shadow: 0 8px 22px rgba(16, 44, 43, .2);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; }
.privacy-badge {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #bbd0c4;
  border-radius: 999px; color: #275b43; background: #edf7f1; font-size: 12px; font-weight: 700;
}
.privacy-badge span { color: #3c9a68; font-size: 10px; }

.app-shell {
  width: min(1540px, calc(100% - 40px));
  margin: 34px auto 44px;
  display: grid;
  grid-template-columns: minmax(480px, 620px) minmax(520px, 1fr);
  gap: 26px;
  align-items: start;
}

.editor-panel, .preview-panel {
  border: 1px solid rgba(16, 44, 43, .11);
  border-radius: 26px;
  background: rgba(255, 253, 248, .92);
  box-shadow: var(--shadow);
}
.editor-panel { padding: clamp(24px, 3vw, 38px); }
.preview-panel { padding: clamp(20px, 2.6vw, 34px); position: sticky; top: 100px; }
.panel-heading, .preview-toolbar, .export-bar, .project-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.eyebrow { margin: 0 0 5px; color: #9a713e; font-size: 10px; font-weight: 850; letter-spacing: .18em; }
h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
h1 { font-size: clamp(29px, 3vw, 42px); line-height: 1.02; }
h2 { font-size: 28px; }
.intro { color: var(--muted); margin: 14px 0 24px; max-width: 54ch; }
.recovery-panel {
  margin: 0 0 12px; padding: 15px; border: 1px solid #d7b16f; border-radius: 15px;
  background: #fff8e7; color: #67491b; display: grid; gap: 12px;
}
.recovery-panel[hidden] { display: none; }
.recovery-panel.is-warning { border-color: #d9a39c; background: #fff0ee; color: #7d3029; }
.recovery-panel.is-conflict { border-color: #9aaecb; background: #eef4ff; color: #294a75; }
.recovery-panel strong { display: block; font-size: 13px; }
.recovery-panel p { margin: 4px 0 0; font-size: 12px; }
.recovery-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.autosave-bar {
  min-height: 30px; margin: -4px 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: var(--muted); font-size: 11px;
}
.autosave-bar.is-saved { color: #275b43; }
.autosave-bar.is-warning { color: #8a332c; }
.text-button { border: 0; padding: 4px 0; color: inherit; background: transparent; font-size: 11px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

details { border-top: 1px solid var(--line); padding: 17px 0 3px; }
summary { display: flex; align-items: center; gap: 11px; list-style: none; cursor: pointer; font-weight: 850; letter-spacing: -.01em; }
summary::-webkit-details-marker { display: none; }
summary span { color: #9a713e; font-size: 11px; letter-spacing: .12em; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin: 17px 0; }
.span-2 { grid-column: span 2; }
label { display: grid; gap: 6px; color: #4d5a57; font-size: 11px; font-weight: 800; letter-spacing: .025em; }
input, select, textarea {
  width: 100%; min-width: 0; border: 1px solid #d4d0c7; border-radius: 11px; color: var(--ink); background: #fff;
  padding: 11px 12px; outline: none; transition: border-color .18s, box-shadow .18s;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(214, 162, 94, .2); }
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; color: #65706d; background: #ece9e1; opacity: .86; }
input[type="color"] { min-height: 43px; padding: 5px; }
.field-note { margin: 8px 0 17px; color: var(--muted); font-size: 12px; }
.mls-context { display: flex; align-items: center; min-height: 43px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: #faf8f2; font-size: 12px; }
.mls-rights-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.mls-rights-row small { color: var(--muted); }
.module-subheading { margin: 18px 0 10px; color: var(--ink); font: 800 13px/1.2 Inter, ui-sans-serif, sans-serif; letter-spacing: .02em; }
.module-confirmation { margin-top: 18px; padding: 16px; border: 1px solid rgba(16,44,43,.14); border-radius: 14px; background: rgba(214,162,94,.08); }
.module-confirmation .module-toggle { align-items: flex-start; line-height: 1.45; }
.module-editor { display: grid; gap: 10px; margin: 14px 0; }
.module-card { border: 1px solid var(--line); border-radius: 15px; padding: 13px; background: #faf8f2; }
.module-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.module-card-header strong { font-size: 12px; }
.module-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.module-card-grid .span-2 { grid-column: span 2; }
.module-actions { display: flex; gap: 5px; }
.module-actions .icon-button { padding: 5px 8px; }
.module-toggle { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.module-toggle input { width: auto; }
.inline-upload { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 1px dashed #bcb5a8; border-radius: 10px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 800; }
.inline-upload input { position: absolute; inset: 0; opacity: 0; }
.module-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.module-empty { padding: 15px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; text-align: center; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 17px 0 12px; }
.upload-card { position: relative; min-height: 88px; padding: 16px; border: 1px dashed #bcb5a8; border-radius: 14px; background: #faf8f2; }
.upload-card:hover { border-color: var(--accent); background: #fffaf0; }
.upload-card strong, .upload-card small { display: block; }
.upload-card small { color: var(--muted); font-weight: 500; margin-top: 4px; }
.upload-card input { position: absolute; inset: 0; opacity: 0; }
.focal-pad {
  min-height: 180px; display: grid; place-items: center; position: relative; overflow: hidden;
  border-radius: 15px; background: linear-gradient(145deg, #cfd8d3, #8fa09a); background-size: cover; background-position: center;
  color: white; text-align: center; outline: none;
}
.focal-pad:focus { box-shadow: 0 0 0 4px rgba(214, 162, 94, .38); }
.focal-pad p { width: 28ch; margin: 0; padding: 18px; font-weight: 750; text-shadow: 0 2px 12px #0008; }
.focal-marker {
  display: none; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%);
  border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 3px var(--accent), 0 4px 16px #0008;
}
.range-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 13px 0 18px; }
.range-grid label { grid-template-columns: 1fr auto; }
.range-grid input { grid-column: 1 / -1; padding: 0; accent-color: var(--accent); }
.range-grid output { color: #9a713e; }

.bedroom-editor {
  min-width: 0; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 9px 12px; align-items: end; background: #faf8f2;
}
.bedroom-editor legend { padding: 0 7px; color: #4d5a57; font-size: 11px; font-weight: 850; }
.bedroom-plus { padding-bottom: 12px; color: var(--muted); font-size: 21px; font-weight: 800; }
.bedroom-preview { grid-column: 1 / -1; display: block; padding: 9px 11px; border-radius: 9px; background: #edf4f1; color: #275b43; font-size: 12px; font-weight: 800; }
.bedroom-editor > small { grid-column: 1 / -1; color: var(--muted); line-height: 1.4; }

.media-list { display: grid; gap: 8px; margin: 10px 0 14px; }
.media-row {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #faf8f2;
}
.media-row img { width: 48px; height: 42px; border-radius: 8px; object-fit: cover; background: #d9dedb; }
.media-row strong, .media-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-row small { color: var(--muted); }
.media-row-actions { display: flex; gap: 5px; }
.icon-button { border: 1px solid #d5d0c5; border-radius: 8px; background: white; color: var(--ink); padding: 6px 8px; font-weight: 800; }
.icon-button:disabled { opacity: .38; cursor: not-allowed; }

.lock-grid { margin: 10px 0 16px; border: 1px solid var(--line); border-radius: 14px; padding: 13px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.lock-grid legend { padding: 0 7px; color: #4d5a57; font-size: 11px; font-weight: 850; }
.lock-grid label { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; }
.lock-grid input { width: auto; }

.change-summary { margin: 15px 0 10px; padding: 13px 14px; border-radius: 13px; background: #f2f0ea; color: #4d5a57; font-size: 12px; }
.change-summary ul { margin: 7px 0 0; padding-left: 20px; }
.validation-summary { display: grid; gap: 10px; margin: 15px 0 10px; color: #4d5a57; font-size: 12px; }
#mls-completeness.validation-summary { display: block; padding: 13px 14px; border-radius: 13px; background: #f2f0ea; }
#mls-completeness strong { display: block; margin-bottom: 6px; }
#mls-completeness.is-blocked { border: 1px solid #d9a39c; background: #fff0ee; color: #7d3029; }
#mls-completeness.has-warnings { border: 1px solid #e4c489; background: #fff8e7; color: #76551e; }
#mls-completeness.is-ready { border: 1px solid #b9d4c3; background: #edf8f1; color: #275b43; }
.preflight-panel { overflow: hidden; border: 1px solid; border-radius: 15px; }
.preflight-panel-blocked { border-color: #d9a39c; background: #fff6f4; color: #702b26; }
.preflight-panel-warning { border-color: #dfbd76; background: #fffaf0; color: #684a17; }
.preflight-panel-ready { border-color: #b9d4c3; background: #edf8f1; color: #275b43; }
.preflight-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 15px; }
.preflight-heading strong { display: block; margin: 2px 0 3px; font-size: 14px; }
.preflight-heading p, .preflight-copy p { margin: 0; line-height: 1.45; }
.preflight-kicker { display: block; font-size: 9px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; opacity: .72; }
.preflight-count { display: grid; flex: 0 0 auto; place-items: center; min-width: 28px; min-height: 28px; border-radius: 999px; background: #8f3c35; color: white; font-size: 12px; font-weight: 900; }
.preflight-list { border-top: 1px solid currentColor; border-top-color: color-mix(in srgb, currentColor 22%, transparent); }
.preflight-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 15px; }
.preflight-item + .preflight-item { border-top: 1px solid currentColor; border-top-color: color-mix(in srgb, currentColor 16%, transparent); }
.preflight-symbol { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 999px; background: #8f3c35; color: white; font-size: 11px; font-weight: 900; }
.preflight-item-warning .preflight-symbol { background: #9b6a18; }
.preflight-copy strong { display: block; margin-bottom: 2px; color: inherit; font-size: 12px; }
.preflight-copy p { color: color-mix(in srgb, currentColor 82%, #24312e); }
.preflight-action { min-height: 34px; border: 1px solid currentColor; border-radius: 9px; padding: 7px 10px; background: rgba(255, 255, 255, .72); color: inherit; font: inherit; font-weight: 850; white-space: nowrap; }
.preflight-action:hover { background: white; transform: translateY(-1px); }
.preflight-action:focus-visible { outline: 3px solid #1d6f68; outline-offset: 2px; }
.active-profile { margin: 13px 2px 0; color: #775b34; font-size: 11px; font-weight: 800; }

.button { border: 0; border-radius: 11px; padding: 11px 15px; font-weight: 820; letter-spacing: -.01em; }
.button-primary { color: white; background: var(--ink); box-shadow: 0 10px 24px rgba(16, 44, 43, .2); }
.button-secondary { color: var(--ink); background: #e9e4d9; }
.button-quiet { color: var(--ink); background: transparent; border: 1px solid #d4d0c7; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.project-actions { justify-content: flex-start; margin-top: 18px; }
.project-actions-wrap { flex-wrap: wrap; }
.file-button { display: inline-flex; position: relative; }
.file-button input { position: absolute; inset: 0; opacity: 0; }

.preview-toolbar { margin-bottom: 20px; }
.preset-select { width: min(240px, 45%); }
.preset-select select { padding: 9px 10px; }
.canvas-stage {
  min-height: 560px; max-height: calc(100vh - 290px); display: grid; place-items: center; padding: 24px;
  border-radius: 20px; overflow: hidden; background:
    linear-gradient(45deg, rgba(255,255,255,.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,.04) 25%, transparent 25%), #173837;
  background-size: 24px 24px;
}
canvas { max-width: 100%; max-height: calc(100vh - 340px); width: auto; height: auto; display: block; background: white; box-shadow: 0 22px 60px #071817b0; }
.export-bar { justify-content: flex-start; flex-wrap: wrap; margin-top: 18px; }
.status { margin: 12px 2px 0; color: var(--muted); font-size: 12px; }

footer {
  width: min(1540px, calc(100% - 40px)); margin: 0 auto 32px; display: flex; justify-content: space-between;
  color: #66726f; font-size: 12px;
}

@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .canvas-stage { max-height: none; }
  canvas { max-height: 72vh; }
}

@media (max-width: 620px) {
  .site-header { height: auto; padding-block: 14px; align-items: flex-start; gap: 14px; }
  .privacy-badge { max-width: 185px; border-radius: 14px; }
  .app-shell { width: min(100% - 22px, 1540px); margin-top: 14px; }
  .editor-panel, .preview-panel { border-radius: 20px; padding: 20px; }
  .form-grid, .upload-grid, .range-grid, .module-card-grid { grid-template-columns: 1fr; }
  .bedroom-editor { grid-template-columns: 1fr; }
  .bedroom-plus { display: none; }
  .span-2 { grid-column: span 1; }
  .module-card-grid .span-2 { grid-column: span 1; }
  .lock-grid { grid-template-columns: 1fr 1fr; }
  .preflight-item { grid-template-columns: 24px minmax(0, 1fr); align-items: start; }
  .preflight-action { grid-column: 2; width: 100%; white-space: normal; }
  .autosave-bar { align-items: flex-start; flex-direction: column; }
  .preview-toolbar { align-items: flex-start; flex-direction: column; }
  .preset-select { width: 100%; }
  .canvas-stage { min-height: 440px; padding: 12px; }
  .export-bar .button { flex: 1 1 100%; }
  footer { width: calc(100% - 30px); flex-direction: column; gap: 5px; }
}
