:root {
  color-scheme: light;
  --green-950: #073429;
  --green-900: #0b4f3a;
  --green-800: #126147;
  --green-700: #197356;
  --green-100: #dcece5;
  --green-50: #eef7f2;
  --gold-600: #b68a22;
  --gold-500: #d6a83f;
  --gold-100: #f6ebc9;
  --ink: #18221d;
  --muted: #68736d;
  --line: #dce2de;
  --surface: #ffffff;
  --canvas: #f3f5f1;
  --danger: #a43c37;
  --shadow-sm: 0 1px 2px rgba(7, 52, 41, 0.07);
  --shadow-md: 0 12px 34px rgba(7, 52, 41, 0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --focus: 0 0 0 3px rgba(214, 168, 63, 0.48);
  font-family: Inter, Aptos, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

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

.sr-only {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.skip-link {
  background: var(--gold-500);
  color: var(--green-950);
  font-weight: 800;
  left: 16px;
  padding: 12px 18px;
  position: fixed;
  top: -80px;
  z-index: 200;
}

.skip-link:focus {
  top: 12px;
}

.app-shell {
  display: grid;
  grid-template-rows: 76px 48px minmax(0, 1fr);
  height: 100vh;
  min-width: 1040px;
}

.topbar {
  align-items: center;
  background: var(--green-950);
  color: white;
  display: flex;
  gap: 32px;
  justify-content: space-between;
  padding: 0 22px;
}

.brand,
.top-actions,
.project-strip,
.project-title-wrap,
.strip-actions,
.panel-heading,
.build-heading,
.rail-heading,
.article-toolbar,
.block-card-head,
.block-card-actions,
.preview-toolbar,
.device-switch,
.modal-heading,
.modal-actions,
.progress-copy,
.colour-input {
  align-items: center;
  display: flex;
}

.brand {
  gap: 12px;
  min-width: 360px;
}

.brand-logos {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: center;
}

.brand-logos img {
  background: white;
  border: 2px solid var(--gold-500);
  border-radius: 50%;
  height: 44px;
  object-fit: contain;
  width: 44px;
}

.brand h1 {
  font-size: 18px;
  letter-spacing: -0.01em;
  margin: 2px 0 0;
}

.eyebrow,
.step-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  margin: 0;
  text-transform: uppercase;
}

.brand .eyebrow {
  color: #b9cec5;
}

.top-actions {
  gap: 8px;
}

.button,
.icon-button,
.mini-button,
.text-button,
.view-switch button,
.device-switch button,
.floating-block-button {
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 760;
  min-height: 44px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.button {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  padding: 0 16px;
}

.button.primary {
  background: var(--gold-500);
  color: var(--green-950);
}

.button.primary:hover {
  background: #e4bb58;
}

.a4-workspace {
  background: #d9ddda;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.a4-stage {
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.a4-stage iframe {
  background: #b9b9bd;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  height: 100%;
  width: 100%;
}

.page-type-card {
  max-width: 760px;
}

.page-type-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 18px;
}

.page-type-grid button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 92px;
  padding: 18px;
  text-align: left;
}

.page-type-grid button:hover {
  background: var(--green-50);
  border-color: var(--green-700);
}

.page-type-grid button strong {
  color: var(--green-900);
  font-size: 16px;
}

.page-type-grid button span {
  color: var(--muted);
  font-size: 13px;
}

.button.secondary {
  background: var(--green-100);
  color: var(--green-950);
}

.topbar .button.secondary {
  background: white;
}

.button.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: inherit;
}

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.button.danger {
  background: var(--danger);
  color: white;
}

.icon-button,
.mini-button {
  align-items: center;
  background: transparent;
  color: inherit;
  display: inline-flex;
  font-size: 22px;
  justify-content: center;
  min-width: 44px;
  padding: 0;
}

.topbar .icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.project-strip {
  background: white;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  justify-content: space-between;
  padding: 0 22px;
  position: relative;
  z-index: 3;
}

.project-title-wrap {
  gap: 8px;
}

.project-title-wrap label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.project-title-wrap input {
  border: 0;
  border-bottom: 1px solid transparent;
  font-weight: 760;
  min-width: 320px;
  padding: 5px 6px;
}

.project-title-wrap input:hover,
.project-title-wrap input:focus {
  border-color: var(--green-700);
}

.save-indicator {
  background: var(--green-700);
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.save-indicator.dirty {
  background: var(--gold-500);
}

.strip-actions {
  gap: 18px;
}

.text-button {
  background: transparent;
  color: var(--green-800);
  min-height: 38px;
  padding: 0 4px;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.text-button:hover {
  text-decoration-color: currentColor;
}

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

.privacy-pill,
.page-count {
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: 999px;
  color: var(--green-800);
  font-size: 11px;
  font-weight: 800;
  padding: 6px 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(520px, 50%) minmax(720px, 50%);
  min-height: 0;
}

.source-panel,
.live-preview-panel,
.build-panel {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.live-preview-panel {
  border-right: 1px solid var(--line);
  padding: 16px;
}

.live-preview-heading {
  flex: 0 0 auto;
}

.live-preview-help {
  color: var(--muted);
  font-size: 10px;
  margin: 0 0 10px;
}

.source-drawer-button {
  border-color: var(--line);
  color: var(--green-900);
  min-height: 34px;
  padding: 0 12px;
}

.live-preview-frame {
  background: #e7ece8;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 3px rgba(10, 39, 29, 0.08);
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.live-preview-frame iframe {
  background: white;
  border: 0;
  border-radius: 10px;
  height: 100%;
  width: 100%;
}

.source-dialog {
  background: white;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(7, 35, 26, 0.26);
  height: min(90vh, 940px);
  max-width: min(920px, 94vw);
  padding: 0;
  width: min(920px, 94vw);
}

.source-dialog::backdrop {
  background: rgba(6, 29, 22, 0.48);
  backdrop-filter: blur(2px);
}

.source-dialog .source-panel {
  height: 100%;
  padding: 18px;
  overflow: auto;
}

.source-dialog-heading {
  position: sticky;
  top: -18px;
  z-index: 4;
  background: white;
  padding: 16px 0 10px;
}

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

.source-dialog .pdf-pages {
  min-height: 420px;
}

.build-panel {
  padding-top: 16px;
}

.quick-theme-bar {
  align-items: center;
  background: #fbfcfb;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 12px;
}

.quick-theme-bar > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  margin-right: 2px;
  text-transform: uppercase;
}

.quick-colour-control {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  display: inline-flex;
  gap: 7px;
  min-height: 34px;
  padding: 3px 7px;
}

.quick-colour-control strong {
  font-size: 9px;
  font-weight: 850;
}

.quick-colour-control input[type="color"] {
  background: transparent;
  border: 0;
  cursor: pointer;
  height: 27px;
  padding: 0;
  width: 38px;
}

.quick-colour-control input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 1px;
}

.quick-colour-control input[type="color"]::-webkit-color-swatch {
  border: 1px solid #aab5af;
  border-radius: 6px;
}

.quick-colour-control output {
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.quick-colour-control:focus-within {
  border-color: var(--green-700);
  box-shadow: 0 0 0 2px rgba(18, 97, 71, 0.08);
}

.reset-theme-button {
  background: transparent;
  border: 0;
  color: var(--green-800);
  font-size: 9px;
  font-weight: 800;
  min-height: 32px;
  padding: 0 8px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.magazine-style-control {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  font-size: 9px;
  font-weight: 800;
  gap: 5px;
  min-height: 34px;
  padding: 3px 5px 3px 8px;
}

.magazine-style-control select {
  background: #f6f8f6;
  border: 0;
  border-radius: 6px;
  font-size: 9px;
  height: 26px;
  max-width: 105px;
  padding: 0 5px;
}

.panel-heading {
  justify-content: space-between;
  min-height: 44px;
}

.panel-heading h2,
.library-heading h3,
.rail-heading h3 {
  font-size: 17px;
  letter-spacing: -0.01em;
  margin: 2px 0 0;
}

.step-label {
  color: var(--green-700);
}

.drop-zone {
  align-items: center;
  background: var(--green-50);
  border: 1.5px dashed #84aa99;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 12px 0;
  padding: 20px 14px;
  text-align: center;
  transition: background 150ms ease, border-color 150ms ease;
}

.drop-zone.dragging {
  background: var(--gold-100);
  border-color: var(--gold-600);
}

.drop-zone > span {
  color: var(--muted);
  font-size: 12px;
}

.drop-zone .button {
  margin-top: 4px;
}

.drop-icon {
  align-items: center;
  background: var(--green-900);
  border-radius: 8px 8px 13px 8px;
  color: white;
  display: flex;
  font-size: 10px;
  font-weight: 900;
  height: 40px;
  justify-content: center;
  letter-spacing: 0.08em;
  position: relative;
  width: 34px;
}

.drop-icon::after {
  border-left: 8px solid transparent;
  border-top: 8px solid var(--gold-500);
  content: "";
  position: absolute;
  right: 0;
  top: 0;
}

.demo-card {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  gap: 12px;
  min-height: 84px;
  padding: 8px;
  text-align: left;
  width: 100%;
}

.demo-card:hover {
  border-color: #8cad9d;
  box-shadow: var(--shadow-sm);
}

.demo-card img {
  border-radius: 9px;
  height: 68px;
  object-fit: cover;
  object-position: top;
  width: 52px;
}

.demo-card span {
  display: grid;
  gap: 3px;
}

.demo-card small,
.demo-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.demo-card strong {
  color: var(--green-900);
  font-size: 13px;
}

.saved-newsletters {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.saved-newsletters-heading {
  align-items: center;
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.saved-newsletters-heading span {
  align-items: center;
  background: var(--green-100);
  border-radius: 999px;
  color: var(--green-900);
  display: inline-flex;
  font-size: 10px;
  font-weight: 850;
  height: 24px;
  justify-content: center;
  min-width: 24px;
  padding: 0 7px;
}

.saved-newsletter-list {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 3px;
}

.saved-newsletter-list > p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin: 2px 0;
}

.saved-newsletter-card {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: grid;
  gap: 9px;
  grid-template-columns: 44px minmax(0, 1fr);
  min-height: 64px;
  padding: 7px;
  text-align: left;
  width: 100%;
}

.saved-newsletter-card:hover,
.saved-newsletter-card:focus-visible {
  background: var(--green-50);
  border-color: #8cad9d;
}

.saved-newsletter-card img,
.saved-newsletter-placeholder {
  align-items: center;
  background: var(--green-100);
  border-radius: 7px;
  color: var(--green-800);
  display: flex;
  height: 50px;
  justify-content: center;
  object-fit: cover;
  width: 40px;
}

.saved-newsletter-card > span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.saved-newsletter-card small,
.saved-newsletter-card em {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.saved-newsletter-card strong {
  color: var(--green-900);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-progress {
  background: #f7f8f6;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-top: 12px;
  padding: 12px;
}

.progress-copy {
  font-size: 12px;
  justify-content: space-between;
}

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

.progress-track {
  background: #dfe7e2;
  border-radius: 20px;
  height: 7px;
  margin-top: 9px;
  overflow: hidden;
}

.progress-track span {
  background: linear-gradient(90deg, var(--green-700), var(--gold-500));
  display: block;
  height: 100%;
  transition: width 180ms ease;
  width: 0;
}

.import-report {
  background: #fff8e6;
  border: 1px solid #edd594;
  border-radius: var(--radius-sm);
  color: #5f4a16;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 12px;
  padding: 11px 12px;
}

.import-report.success {
  background: var(--green-50);
  border-color: #b9d5c8;
  color: var(--green-950);
}

.pdf-pages {
  align-content: start;
  display: grid;
  gap: 16px;
  grid-auto-rows: max-content;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-top: 14px;
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 24px 2px;
}

.pdf-page-card {
  align-self: start;
  background: #e8ece8;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  margin: 0;
  overflow: hidden;
  position: relative;
}

.pdf-page-card.selected {
  border-color: var(--gold-600);
  box-shadow: var(--focus);
}

.pdf-page-card button {
  background: transparent;
  border: 0;
  display: block;
  padding: 0;
  width: 100%;
}

.pdf-page-card canvas {
  background: white;
  display: block;
  height: auto;
  width: 100%;
}

.pdf-page-card figcaption {
  align-items: center;
  background: white;
  display: flex;
  font-size: 11px;
  font-weight: 750;
  justify-content: space-between;
  min-height: 34px;
  padding: 7px 9px;
}

.page-warning {
  background: #fff1c6;
  border-radius: 999px;
  color: #654e10;
  font-size: 9px;
  padding: 3px 6px;
}

.empty-panel {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 230px;
  padding: 24px;
  text-align: center;
}

.empty-panel span {
  color: #9aaaa2;
  font-size: 42px;
}

.empty-panel p {
  line-height: 1.6;
  max-width: 240px;
}

.build-heading {
  border-bottom: 1px solid var(--line);
  margin-top: -16px;
  padding: 8px 18px;
}

.view-switch,
.device-switch {
  background: #eef1ee;
  border-radius: 12px;
  gap: 3px;
  padding: 3px;
}

.view-switch button,
.device-switch button {
  background: transparent;
  color: var(--muted);
  min-height: 36px;
  padding: 0 13px;
}

.view-switch button.active,
.device-switch button.active {
  background: white;
  box-shadow: var(--shadow-sm);
  color: var(--green-900);
}

.build-workspace {
  display: grid;
  flex: 1;
  grid-template-columns: 176px minmax(360px, 1fr) 224px;
  min-height: 0;
}

.article-rail,
.block-library {
  min-height: 0;
  overflow-y: auto;
}

.article-rail {
  background: #f7f8f6;
  border-right: 1px solid var(--line);
  padding: 14px 12px;
}

.rail-heading {
  justify-content: space-between;
}

.mini-button {
  background: var(--green-100);
  color: var(--green-900);
  min-height: 36px;
  min-width: 36px;
}

.rail-help {
  color: var(--muted);
  font-size: 10px;
  margin: 3px 0 12px;
}

.article-list {
  display: grid;
  gap: 7px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.article-item {
  align-items: stretch;
  background: white;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: 24px 1fr;
  min-height: 54px;
  overflow: hidden;
}

.system-page-icon {
  align-items: center;
  background: var(--gold-100);
  border: 1px solid var(--gold-500);
  border-radius: 8px;
  color: var(--green-900);
  display: flex;
  flex: 0 0 32px;
  font-size: 16px;
  height: 32px;
  justify-content: center;
  margin-left: 7px;
}

.contents-editor-note {
  background: #f2f7f4;
  border-left: 4px solid var(--green-700);
  border-radius: 7px;
  color: #46524b;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  padding: 10px 12px;
}

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

.article-item.active {
  background: var(--green-50);
  border-color: #9bbcad;
}

.article-item.drag-over,
.block-card.drag-over {
  border-color: var(--gold-600);
  box-shadow: inset 0 3px 0 var(--gold-500);
}

.drag-handle {
  align-items: center;
  background: transparent;
  border: 0;
  color: #9aa69f;
  cursor: grab;
  display: flex;
  font-size: 16px;
  justify-content: center;
  min-width: 24px;
  padding: 0;
}

.article-item > button:last-child {
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 730;
  line-height: 1.35;
  padding: 9px 7px 9px 2px;
  text-align: left;
}

.article-item small {
  color: var(--muted);
  display: block;
  font-size: 9px;
  margin-top: 3px;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 14px;
}

.article-actions .text-button {
  font-size: 11px;
}

.editor-column {
  background:
    radial-gradient(circle at 20% 0%, rgba(214, 168, 63, 0.08), transparent 28%),
    #eef1ed;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.article-toolbar {
  background: white;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  justify-content: space-between;
  min-height: 62px;
  padding: 9px 14px;
}

.article-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
  width: 100%;
}

.article-meta label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-meta input {
  border: 0;
  border-bottom: 1px solid transparent;
  font-size: 16px;
  font-weight: 780;
  min-width: 0;
  padding: 2px 0;
  width: 100%;
}

.article-meta input:focus {
  border-color: var(--green-700);
}

.article-heading-options {
  align-items: center;
  background: #f7faf8;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 0.7fr) minmax(320px, 1.3fr);
  padding: 10px 16px;
}

.article-heading-options > label {
  color: #46524b;
  display: grid;
  font-size: 10px;
  font-weight: 800;
  gap: 5px;
  letter-spacing: 0.025em;
}

.article-heading-options input,
.article-heading-options select {
  background: white;
  border: 1px solid #ccd5d0;
  border-radius: 8px;
  font-size: 13px;
  min-height: 40px;
  padding: 8px 10px;
}

.article-heading-options label small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.35;
}

.article-heading-image-control {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.article-heading-image-control img {
  border: 2px solid var(--gold-500);
  border-radius: 50%;
  height: 48px;
  object-fit: cover;
  width: 48px;
}

.article-heading-image-control div {
  display: grid;
  margin-right: auto;
  min-width: 0;
}

.article-heading-image-control strong {
  font-size: 12px;
}

.article-heading-image-control span {
  color: var(--muted);
  font-size: 10px;
}

.toggle {
  align-items: center;
  color: var(--green-900);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  gap: 6px;
}

.toggle input {
  accent-color: var(--green-700);
  height: 18px;
  width: 18px;
}

.editor-canvas {
  background-image:
    linear-gradient(to right, rgba(11, 79, 58, 0.13) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(11, 79, 58, 0.035) 1px, transparent 1px);
  background-size: calc((100% - 22px) / 12) 100%;
  display: grid;
  flex: 1;
  grid-auto-flow: row dense;
  grid-auto-rows: max-content;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.editor-canvas.grid-hidden {
  background-image: none;
}

.grid-guide-bar {
  align-items: center;
  background: #eef6f1;
  border-bottom: 1px solid #c8dbd1;
  border-top: 1px solid #c8dbd1;
  display: grid;
  gap: 7px;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.4fr) auto;
  padding: 7px 12px;
}

.grid-guide-bar > div:first-child {
  display: grid;
  gap: 2px;
}

.grid-guide-bar strong {
  color: var(--green-900);
  font-size: 10px;
}

.grid-guide-bar > div:first-child span {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}

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

.grid-column-numbers span {
  align-items: center;
  background: rgba(11, 79, 58, 0.08);
  border-radius: 3px;
  color: var(--green-800);
  display: flex;
  font-size: 7px;
  height: 18px;
  justify-content: center;
}

.grid-toggle-button {
  background: white;
  border: 1px solid #b9cec3;
  border-radius: 7px;
  color: var(--green-900);
  font-size: 8px;
  font-weight: 800;
  min-height: 30px;
  padding: 0 8px;
}

.block-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  grid-column: span 12;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.block-card[data-span="9"] { grid-column: span 9; }
.block-card[data-span="8"] { grid-column: span 8; }
.block-card[data-span="6"] { grid-column: span 6; }
.block-card[data-span="4"] { grid-column: span 4; }
.block-card[data-span="3"] { grid-column: span 3; }

.editor-canvas > .empty-panel {
  grid-column: 1 / -1;
}

.block-width-control,
.block-position-control {
  align-items: center;
  display: flex;
  gap: 4px;
}

.block-width-control > span,
.block-position-control > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.block-width-control select,
.block-position-control select {
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  height: 28px;
  padding: 0 4px;
  width: 68px;
}

.block-position-control select {
  width: 44px;
}

.grid-resize-handle {
  background: linear-gradient(135deg, transparent 42%, #8fa29a 43% 50%, transparent 51% 62%, #8fa29a 63% 70%, transparent 71%);
  bottom: 2px;
  cursor: ew-resize;
  height: 22px;
  opacity: 0.65;
  position: absolute;
  right: 2px;
  width: 22px;
  z-index: 2;
}

.block-card.resizing {
  border-color: var(--gold-600);
  box-shadow: 0 0 0 2px rgba(214, 168, 63, 0.2);
  user-select: none;
}

.editor-canvas.dragging-new {
  background-color: #f3f8f5;
  outline: 2px dashed var(--green-700);
  outline-offset: -8px;
}

.block-card:focus-within {
  border-color: #9ab9ab;
  box-shadow: 0 0 0 2px rgba(18, 97, 71, 0.1);
}

.block-card-head {
  background: #fafbf9;
  border-bottom: 1px solid #edf0ed;
  gap: 8px;
  min-height: 42px;
  padding: 5px 7px;
}

.block-type-icon {
  align-items: center;
  background: var(--green-100);
  border-radius: 8px;
  color: var(--green-900);
  display: flex;
  font-size: 12px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.block-card-head strong {
  font-size: 11px;
  margin-right: auto;
}

.block-card-actions {
  gap: 2px;
}

.block-card-actions button {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  min-height: 32px;
  min-width: 32px;
}

.block-card-actions button:hover {
  background: #eef2ef;
  color: var(--ink);
}

.block-card-actions .delete-block:hover {
  background: #fbe9e7;
  color: var(--danger);
}

.block-body {
  display: grid;
  gap: 11px;
  padding: 13px;
}

.field-grid {
  display: grid;
  gap: 11px;
  grid-template-columns: 1fr 1fr;
}

.field-grid .full-field {
  grid-column: 1 / -1;
}

.checkbox-field {
  align-items: center !important;
  display: flex !important;
  font-size: 12px !important;
  gap: 9px !important;
}

.checkbox-field input {
  min-height: 20px !important;
  width: 20px !important;
}

.settings-section {
  border: 1px solid #ccd5d0;
  border-radius: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  padding: 14px;
}

.settings-section legend {
  color: var(--green-800);
  font-size: 13px;
  font-weight: 850;
  padding: 0 7px;
}

.settings-section label {
  color: #46524b;
  display: grid;
  font-size: 10px;
  font-weight: 800;
  gap: 5px;
}

.block-body label,
.settings-grid > label {
  color: #46524b;
  display: grid;
  font-size: 10px;
  font-weight: 800;
  gap: 5px;
  letter-spacing: 0.025em;
}

.block-body input,
.block-body textarea,
.block-body select,
.settings-grid input,
.settings-grid select,
.settings-grid textarea,
.block-search input {
  background: white;
  border: 1px solid #ccd5d0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  min-height: 42px;
  padding: 8px 10px;
  width: 100%;
}

.block-body textarea,
.settings-grid textarea {
  min-height: 88px;
  resize: vertical;
}

.rich-text-field {
  display: grid;
  gap: 6px;
}

.rich-text-label {
  color: #46524b;
  font-size: 10px;
  font-weight: 800;
}

.rich-text-toolbar {
  align-items: center;
  background: #f3f6f4;
  border: 1px solid #ccd5d0;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px;
}

.rich-text-toolbar button,
.rich-text-toolbar select {
  background: white;
  border: 1px solid #bfcac4;
  border-radius: 7px;
  color: var(--ink);
  font-size: 12px;
  min-height: 36px;
  padding: 0 10px;
}

.rich-text-toolbar button {
  min-width: 38px;
}

.rich-text-toolbar button:hover,
.rich-text-toolbar select:hover {
  border-color: var(--green-700);
}

.rich-colour-control {
  align-items: center !important;
  background: white;
  border: 1px solid #bfcac4;
  border-radius: 7px;
  display: flex !important;
  flex-direction: row !important;
  font-size: 11px !important;
  gap: 6px !important;
  min-height: 36px;
  padding: 3px 6px 3px 10px;
}

.rich-colour-control input[type="color"] {
  border: 0;
  height: 28px;
  min-height: 28px;
  padding: 0;
  width: 32px;
}

.rich-text-editor {
  background: white;
  border: 1px solid #ccd5d0;
  border-radius: 0 0 9px 9px;
  font-size: 14px;
  line-height: 1.65;
  min-height: 150px;
  outline: none;
  overflow-y: auto;
  padding: 11px 12px;
  white-space: pre-wrap;
}

.rich-text-editor:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(11, 79, 58, 0.12);
}

.large-textarea {
  min-height: 132px !important;
}

.media-picker {
  align-items: center;
  background: #f7f9f7;
  border: 1px dashed #b7c5bd;
  border-radius: 10px;
  display: flex;
  gap: 10px;
  padding: 10px;
}

.media-picker img,
.media-picker video {
  background: #dfe5e1;
  border-radius: 8px;
  height: 82px;
  object-fit: cover;
  width: 110px;
}

.media-picker-copy {
  display: grid;
  gap: 5px;
}

.media-picker-copy span {
  color: var(--muted);
  font-size: 10px;
}

.inline-upload {
  background: var(--green-100);
  border: 0;
  border-radius: 8px;
  color: var(--green-950);
  font-size: 11px;
  font-weight: 800;
  min-height: 38px;
  padding: 0 11px;
}

.gallery-assets {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}

.gallery-thumb {
  position: relative;
}

.gallery-thumb img {
  border-radius: 8px;
  height: 82px;
  object-fit: cover;
  width: 100%;
}

.gallery-thumb button {
  align-items: center;
  background: rgba(7, 52, 41, 0.85);
  border: 0;
  border-radius: 50%;
  color: white;
  display: flex;
  height: 26px;
  justify-content: center;
  position: absolute;
  right: 5px;
  top: 5px;
  width: 26px;
}

.question-row {
  background: #f7f9f7;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 8px;
  grid-template-columns: 130px 1fr 34px;
  padding: 8px;
}

.question-row button {
  background: transparent;
  border: 0;
  color: var(--danger);
}

.add-block-wide {
  background: white;
  border: 1px dashed #aab8b0;
  border-radius: var(--radius-sm);
  color: var(--green-800);
  font-size: 12px;
  font-weight: 800;
  margin: 0 18px 18px;
  min-height: 46px;
}

.add-block-wide:hover {
  background: var(--green-50);
}

.block-library {
  background: #fbfcfb;
  border-left: 1px solid var(--line);
  padding: 14px 12px;
}

.library-heading {
  position: relative;
}

.library-heading .close-library {
  display: none;
  position: absolute;
  right: -8px;
  top: -5px;
}

.block-search {
  display: block;
  margin: 12px 0 5px;
}

.block-search input {
  background: white;
  min-height: 40px;
}

.block-buttons {
  display: grid;
  gap: 14px;
}

.block-library-help {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
  margin: 0 0 12px;
}

.block-group {
  display: grid;
  gap: 5px;
}

.block-group h4 {
  color: var(--green-900);
  font-size: 9px;
  letter-spacing: 0.07em;
  margin: 0;
  text-transform: uppercase;
}

.block-group-list {
  display: grid;
  gap: 5px;
}

.block-button {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  display: flex;
  font-size: 10px;
  font-weight: 760;
  gap: 8px;
  justify-content: flex-start;
  line-height: 1.2;
  min-height: 50px;
  padding: 6px 7px;
  text-align: left;
  width: 100%;
}

.block-button:hover {
  background: var(--green-50);
  border-color: #9cbbae;
  color: var(--green-900);
  transform: translateY(-1px);
}

.block-button .block-button-icon {
  align-items: center;
  background: var(--green-50);
  border-radius: 8px;
  color: var(--green-800);
  display: flex;
  flex: 0 0 34px;
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 900;
  height: 34px;
  justify-content: center;
}

.block-button-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.block-button-copy strong {
  font-size: 10px;
}

.block-button-copy small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 550;
}

.block-button-drag {
  color: #9ca9a2;
  font-size: 12px;
  margin-left: auto;
}

.preview-workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.preview-toolbar {
  background: white;
  border-bottom: 1px solid var(--line);
  gap: 18px;
  justify-content: space-between;
  min-height: 62px;
  padding: 8px 18px;
}

.preview-toolbar > div:first-child {
  display: grid;
  gap: 2px;
}

.preview-toolbar span {
  color: var(--muted);
  font-size: 10px;
}

.preview-toolbar .button.ghost {
  border-color: var(--line);
  color: var(--green-900);
}

.device-stage {
  align-items: flex-start;
  background:
    linear-gradient(45deg, rgba(7, 52, 41, 0.025) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(-45deg, rgba(7, 52, 41, 0.025) 25%, transparent 25%) 0 12px / 24px 24px,
    #e5e9e5;
  display: flex;
  flex: 1;
  justify-content: center;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.device-frame {
  background: white;
  border: 8px solid #203029;
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  height: calc(100vh - 230px);
  min-height: 500px;
  overflow: hidden;
  transition: width 180ms ease;
}

.device-frame.desktop {
  border-radius: 10px;
  width: min(100%, 1200px);
}

.device-frame.tablet {
  width: 760px;
}

.device-frame.mobile {
  border-radius: 28px;
  width: 390px;
}

.device-frame iframe {
  border: 0;
  height: 100%;
  width: 100%;
}

.floating-block-button {
  background: var(--green-900);
  bottom: 20px;
  box-shadow: var(--shadow-md);
  color: white;
  display: none;
  padding: 0 18px;
  position: fixed;
  right: 20px;
  z-index: 20;
}

.modal {
  background: transparent;
  border: 0;
  max-height: 90vh;
  max-width: min(94vw, 760px);
  padding: 0;
  width: 100%;
}

.modal::backdrop {
  background: rgba(5, 28, 21, 0.65);
  backdrop-filter: blur(3px);
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
}

.modal-card.compact {
  margin: 0 auto;
  max-width: 460px;
}

.modal-card.wide {
  max-width: 760px;
}

.modal-heading {
  border-bottom: 1px solid var(--line);
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.modal-heading h2 {
  font-size: 22px;
  margin: 3px 0 0;
}

.settings-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.settings-grid .full-field {
  grid-column: 1 / -1;
}

.file-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.colour-input {
  gap: 8px;
}

.colour-input input[type="color"] {
  flex: 0 0 50px;
  padding: 4px;
}

.modal-actions {
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}

.modal-actions .button.ghost {
  border-color: var(--line);
  color: var(--ink);
}

.draft-list {
  display: grid;
  gap: 10px;
}

.publication-steps { display:grid; gap:14px; }
.publication-step { align-items:flex-start; background:var(--panel,#f5f8f6); border:1px solid var(--line); border-radius:var(--radius-md); display:grid; gap:14px; grid-template-columns:42px 1fr; padding:16px; }
.publication-step>span { align-items:center; background:var(--primary); border-radius:50%; color:#fff; display:flex; font-weight:900; height:36px; justify-content:center; width:36px; }
.publication-step h3 { margin:0 0 12px; }
.publication-step label { display:grid; font-size:11px; font-weight:800; gap:6px; margin:10px 0; }
.publication-step input { background:#fff; border:1px solid var(--line); border-radius:10px; font:inherit; min-height:42px; padding:9px 11px; width:100%; }
.publication-step input[readonly] { background:#edf3ef; color:var(--primary); font-weight:800; }
.publication-help { color:var(--muted); font-size:11px; line-height:1.55; margin:8px 0 12px; }
.publication-status { border-left:4px solid var(--accent); color:var(--muted); font-size:11px; margin:12px 0 0; padding:8px 10px; }
.publication-status.success { background:#e7f5ed; color:#0b6544; }
.publication-status.error { background:#fff0ef; color:#9b2b22; }
.publication-pdf-note>span { border-radius:9px; font-size:10px; }

.draft-card {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  padding: 12px;
}

.draft-card strong,
.draft-card small {
  display: block;
}

.draft-card small {
  color: var(--muted);
  margin-top: 3px;
}

.draft-card-actions {
  display: flex;
  gap: 6px;
}

.toast-region {
  bottom: 22px;
  display: grid;
  gap: 8px;
  max-width: 380px;
  position: fixed;
  right: 22px;
  z-index: 300;
}

.toast {
  align-items: flex-start;
  animation: toast-in 180ms ease both;
  background: var(--green-950);
  border-left: 5px solid var(--gold-500);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  color: white;
  display: flex;
  font-size: 12px;
  gap: 10px;
  line-height: 1.5;
  padding: 12px 14px;
}

.toast.error {
  background: #6c2723;
  border-color: #f0ada7;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1320px) {
  .build-workspace {
    grid-template-columns: 190px minmax(350px, 1fr);
  }

  .block-library {
    box-shadow: -10px 0 28px rgba(7, 52, 41, 0.12);
    display: none;
    max-width: 280px;
    position: absolute;
    right: 0;
    top: 125px;
    width: 260px;
    z-index: 15;
  }

  .block-library.open {
    display: block;
  }

  .library-heading .close-library,
  .floating-block-button {
    display: inline-flex;
  }
}

@media (max-width: 1120px) {
  .topbar {
    gap: 12px;
  }

  .brand {
    min-width: 290px;
  }

  .brand h1 {
    font-size: 15px;
  }

  .top-actions .button {
    padding: 0 11px;
  }

  .workspace {
    grid-template-columns: 520px minmax(720px, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
