:root {
  --editor-pink: #e77bac;
  --editor-pink-dark: #ad4e7b;
  --editor-pink-light: #ffe4f1;
  --editor-paper: #fffafd;
  --editor-line: #e7b8cf;
  --editor-text: #513b47;
  --editor-muted: #806c77;
  --editor-shadow: rgba(121, 49, 82, .16);
  --editor-good: #2d7b58;
  --editor-danger: #a83c58;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #f6c5da; }

body.editor-page {
  margin: 0;
  min-height: 100vh;
  color: var(--editor-text);
  font-family: "DotGothic16", Arial, sans-serif;
  background:
    radial-gradient(circle at 10px 10px, rgba(255,255,255,.55) 0 2px, transparent 2.5px) 0 0 / 22px 22px,
    #f6c5da;
}

button, input, textarea, select { font: inherit; }
button, .file-button { touch-action: manipulation; }


.editor-status {
  padding: 5px 9px;
  color: #6b2f4c;
  background: #fff6fb;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(99, 31, 62, .15);
}

.editor-status.is-saved { color: var(--editor-good); }
.editor-status.is-error { color: var(--editor-danger); }

.editor-tabs {
  width: min(1180px, calc(100% - 24px));
  margin: 14px auto 0;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.editor-tabs button {
  min-height: 42px;
  padding: 8px 14px;
  flex: 0 0 auto;
  color: #6a3a51;
  border: 1px solid var(--editor-line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #fbeaf3;
}

.editor-tabs button.is-active {
  color: #7c2d55;
  font-weight: 700;
  background: var(--editor-paper);
  box-shadow: 0 -3px 10px var(--editor-shadow);
}

.editor-main {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto max(32px, env(safe-area-inset-bottom));
  min-height: 620px;
  padding: 18px;
  background: var(--editor-paper);
  border: 1px solid var(--editor-line);
  box-shadow: 0 8px 26px var(--editor-shadow);
}

.editor-panel[hidden] { display: none; }
.editor-panel.is-active { display: block; }

.editor-section {
  margin: 0 0 18px;
  padding: 15px;
  border: 1px solid var(--editor-line);
  background: #fff;
  box-shadow: inset 0 0 0 4px #fff4f9;
}

.editor-section h2,
.export-card h2 {
  margin: 0 0 5px;
  color: var(--editor-pink-dark);
  font-size: 18px;
}

.editor-section > p,
.editor-section-heading p,
.export-card > p {
  margin: 0 0 13px;
  color: var(--editor-muted);
}

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

.editor-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.editor-grid.one { grid-template-columns: 1fr; }

.editor-field {
  min-width: 0;
  display: grid;
  gap: 5px;
  align-content: start;
}

.editor-field.is-wide { grid-column: 1 / -1; }
.editor-field > span:first-child { font-weight: 700; color: #71435a; }
.editor-help { color: var(--editor-muted); font-size: 11px; }

.editor-field input[type="text"],
.editor-field input[type="url"],
.editor-field input[type="date"],
.editor-field input[type="number"],
.editor-field select,
.editor-field textarea,
.preview-toolbar select {
  width: 100%;
  min-height: 42px;
  padding: 8px 9px;
  color: #3f3038;
  border: 1px solid #cfa1b8;
  border-radius: 5px;
  background: #fff;
  box-shadow: inset 1px 1px 2px rgba(86, 36, 59, .08);
}

.editor-field textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.editor-field textarea.tall { min-height: 180px; }

.editor-field input:focus,
.editor-field textarea:focus,
.editor-field select:focus,
.preview-toolbar select:focus {
  outline: 3px solid rgba(231,123,172,.24);
  border-color: var(--editor-pink);
}

.color-field-row {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 7px;
}
.color-field-row input[type="color"] { width: 54px; min-height: 42px; padding: 2px; border: 1px solid #cfa1b8; background: #fff; }

.editor-checkbox {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-checkbox input { width: 20px; height: 20px; accent-color: var(--editor-pink); }

.list-editor { display: grid; gap: 7px; }
.list-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 38px 38px 38px;
  gap: 5px;
  align-items: center;
}
.list-row input { min-width: 0; min-height: 39px; padding: 7px; border: 1px solid #cfa1b8; border-radius: 4px; }
.drag-handle { color: #a77990; text-align: center; }

button, .file-button {
  min-height: 40px;
  padding: 7px 11px;
  color: #694056;
  cursor: pointer;
  border: 1px solid #c58fa9;
  border-radius: 5px;
  background: linear-gradient(#fff, #f8dce9);
  box-shadow: 0 2px 5px rgba(93, 40, 65, .11);
}
button:hover, .file-button:hover { background: linear-gradient(#fff, #f2c7db); }
button:active, .file-button:active { transform: translateY(1px); }
button:focus-visible, .file-button:focus-within { outline: 3px solid rgba(231,123,172,.3); }

.primary-button {
  color: #fff;
  font-weight: 700;
  border-color: #a84272;
  background: linear-gradient(#ed8fbb, #cf5c91);
}
.primary-button:hover { background: linear-gradient(#f2a1c5, #c95087); }
.danger-button { color: #8d2945; background: linear-gradient(#fff, #ffdbe5); }
.danger-icon { padding: 0; color: #9e3552; font-size: 20px; }

.add-list-button { justify-self: start; margin-top: 6px; }

.editor-section-heading {
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.editor-section-heading h2 { margin: 0 0 4px; color: var(--editor-pink-dark); }

.entry-editor-list { display: grid; gap: 14px; }
.entry-card {
  border: 1px solid var(--editor-line);
  background: #fff;
  box-shadow: 0 4px 13px var(--editor-shadow);
}
.entry-card-header {
  padding: 9px 11px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  background: #ffe8f3;
  border-bottom: 1px solid var(--editor-line);
}
.entry-card-header h3 { margin: 0; color: #8c3f65; }
.entry-card-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.entry-card-body { padding: 13px; }

.preview-toolbar {
  margin-bottom: 12px;
  padding: 10px;
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  background: #fff0f7;
  border: 1px solid var(--editor-line);
}
.preview-toolbar label { min-width: min(100%, 260px); display: grid; gap: 4px; font-weight: 700; }

.preview-frame-shell {
  height: min(72vh, 760px);
  min-height: 440px;
  overflow: hidden;
  border: 1px solid #a76a88;
  background: #fff;
  box-shadow: 0 5px 17px var(--editor-shadow);
}
.preview-frame-shell iframe { width: 100%; height: 100%; border: 0; background: #fff; }

.export-card {
  margin-top: 16px;
  padding: 15px;
  border: 1px solid var(--editor-line);
  background: #fff;
}
.export-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file-button { display: inline-flex; align-items: center; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-steps { margin: 14px 0 0; padding-left: 24px; }
.upload-steps li { margin: 6px 0; }

.image-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  gap: 8px;
  align-items: end;
}
.image-preview {
  width: 100px;
  height: 82px;
  object-fit: contain;
  border: 1px solid var(--editor-line);
  background: #fff8fc;
}

code {
  padding: 1px 4px;
  color: #7c3056;
  background: #fff0f7;
  border: 1px solid #f0c9dc;
}

@media (max-width: 760px) {
  .editor-main { padding: 10px; }
  .editor-grid, .editor-grid.three { grid-template-columns: 1fr; }
  .editor-section-heading { align-items: stretch; flex-direction: column; }
  .entry-card-header { align-items: flex-start; flex-direction: column; }
  .preview-frame-shell { height: 66vh; min-height: 390px; }
}

@media (max-width: 480px) {
  .editor-tabs, .editor-main { width: calc(100% - 12px); }
  .editor-tabs button { padding-inline: 10px; }
  .editor-section { padding: 10px; }
  .list-row { grid-template-columns: 18px minmax(0, 1fr) 35px 35px 35px; }
  .image-preview-row { grid-template-columns: 1fr; }
  .image-preview { width: 100%; height: 130px; }
}

/* ==========================================================
   VISUAL RESPONSIVE LAYOUT DESIGNER
   ========================================================== */
.layout-editor-panel { min-width: 0; }

.layout-topbar {
  margin-bottom: 12px;
  padding: 10px;
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--editor-line);
  background: #fff;
  box-shadow: 0 3px 12px var(--editor-shadow);
}
.layout-select-field { min-width: 210px; display: grid; gap: 4px; font-weight: 700; }
.layout-select-field select { min-height: 42px; }
.device-switcher {
  margin: 0;
  padding: 0;
  display: flex;
  gap: 5px;
  border: 0;
}
.device-switcher legend { margin-bottom: 4px; font-weight: 700; }
.device-switcher button { min-width: 94px; }
.device-switcher button.is-active {
  color: #fff;
  font-weight: 700;
  border-color: #9b3d6b;
  background: linear-gradient(#ed8fbb, #c95189);
}
.layout-history-actions { margin-left: auto; display: flex; gap: 6px; }

.layout-designer-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 260px;
  gap: 12px;
  align-items: stretch;
}
.layout-sidebar {
  min-width: 0;
  height: var(--layout-editor-panel-height, 76vh);
  max-height: none;
  overflow: auto;
  border: 1px solid var(--editor-line);
  background: #fff;
  box-shadow: 0 4px 14px var(--editor-shadow);
}
.layout-panel-heading {
  padding: 10px;
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #7d365a;
  border-bottom: 1px solid var(--editor-line);
  background: #ffe9f3;
}
.layout-panel-heading > div { min-width: 0; display: grid; gap: 2px; }
.layout-panel-heading span { color: var(--editor-muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.layout-component-list { padding: 8px; display: grid; gap: 10px; }
.layout-component-group { display: grid; gap: 5px; }
.layout-component-group h3 {
  margin: 0;
  padding: 3px 5px;
  color: #96627c;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px dotted #e4b9ce;
}
.layout-component-button {
  min-height: 50px;
  padding: 6px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 7px;
  text-align: left;
  background: #fffafd;
}
.layout-component-button.is-selected {
  color: #fff;
  border-color: #9e3c69;
  background: linear-gradient(#ec88b6, #cf5a91);
}
.layout-component-button.is-selected small { color: #fff4fa; }
.layout-component-button.is-hidden-component { opacity: .62; border-style: dashed; }
.layout-component-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 18px;
  border-radius: 50%;
  background: #ffe2ef;
}
.layout-component-button.is-selected .layout-component-icon { color: #a83d6e; background: #fff; }
.layout-component-copy { min-width: 0; display: grid; gap: 2px; }
.layout-component-copy strong,
.layout-component-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout-component-copy small { color: var(--editor-muted); font-size: 10px; }
.layout-component-eye { font-size: 11px; }
.layout-panel-help { margin: 0 8px 8px; padding: 9px; color: #765166; font-size: 11px; border: 1px dashed #deb0c7; background: #fff6fb; }
.layout-panel-help p { margin: 4px 0 0; }

.layout-canvas-column { min-width: 0; }
.layout-canvas-toolbar {
  min-height: 48px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  border: 1px solid #b86f91;
  border-bottom: 0;
  background: linear-gradient(#fff, #f9e3ee);
}
.layout-canvas-toolbar > span { margin-right: auto; color: #7e355a; font-weight: 700; }
.layout-canvas-toolbar label { display: flex; align-items: center; gap: 5px; }
.layout-canvas-toolbar select { min-height: 38px; }
.layout-guide-toggle,
.layout-guide-size {
  min-height: 38px;
  padding: 4px 7px;
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  color: #75415d;
  border: 1px solid #d7abc0;
  border-radius: 5px;
  background: #fff8fb;
}
.layout-guide-toggle input { width: 17px; height: 17px; accent-color: #d65b96; }
.layout-guide-size input {
  width: 48px;
  min-height: 28px;
  padding: 2px 4px;
  text-align: right;
  border: 1px solid #c990aa;
  background: #fff;
}
.layout-guide-size:has(input:disabled) { opacity: .55; }
.layout-guide-size span { font-size: 10px; }
.layout-preview-viewport {
  width: 100%;
  height: 70vh;
  min-height: 520px;
  padding: 12px;
  overflow: auto;
  display: block;
  border: 1px solid #a85e82;
  background:
    linear-gradient(45deg, #e9d9e2 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, #e9d9e2 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(45deg, transparent 75%, #e9d9e2 75%) 0 0 / 18px 18px,
    linear-gradient(-45deg, transparent 75%, #e9d9e2 75%) 0 0 / 18px 18px,
    #f8eff4;
  box-shadow: inset 0 0 18px rgba(81,44,62,.15);
  -webkit-overflow-scrolling: touch;
}
.layout-preview-scaler {
  margin: 0 auto;
  position: relative;
  overflow: visible;
  background: #fff;
  box-shadow: 0 8px 30px rgba(52,24,38,.28);
}
.layout-preview-native-canvas {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: top left;
  background: #fff;
}
.layout-preview-native-canvas iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #fff;
  transform: none !important;
}
.layout-preview-tip { margin: 7px 0 0; color: var(--editor-muted); font-size: 11px; text-align: center; }
.layout-preview-viewport.is-tablet .layout-preview-scaler { border-radius: 18px; outline: 8px solid #4b4046; }
.layout-preview-viewport.is-mobile .layout-preview-scaler { border-radius: 24px; outline: 9px solid #3e363a; }

.layout-properties-panel { padding-bottom: 8px; }
.layout-property-section { padding: 10px; display: grid; gap: 10px; }
.layout-property-section h3 { margin: 0; color: var(--editor-pink-dark); font-size: 15px; }
.layout-property-description { margin: -5px 0 2px; color: var(--editor-muted); font-size: 11px; }
.layout-property-field { display: grid; gap: 5px; }
.layout-property-field > strong { color: #6c465a; font-size: 12px; }
.layout-property-field.compact input { min-height: 40px; width: 100%; }
.layout-property-label { display: flex; justify-content: space-between; gap: 8px; color: #6c465a; font-size: 12px; }
.layout-property-label output { color: #a33d6b; font-weight: 700; }
.layout-range-row { display: grid; grid-template-columns: minmax(0, 1fr) 68px; gap: 6px; align-items: center; }
.layout-range-row input[type="range"] { width: 100%; accent-color: var(--editor-pink); }
.layout-range-row input[type="number"] { min-height: 36px; width: 68px; padding: 5px; }
.layout-property-field select { min-height: 40px; }
.layout-toggle-field { min-height: 46px; padding: 8px; display: flex; align-items: center; gap: 8px; border: 1px solid #dcb0c5; background: #fff5fa; }
.layout-toggle-field input { width: 21px; height: 21px; accent-color: var(--editor-pink); }
.layout-two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.layout-property-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.selected-component-title { display: flex; align-items: center; gap: 8px; }
.layout-selected-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #9f3d6c; background: #ffe0ee; }
.layout-edit-content-button { width: 100%; color: #6b3d55; border-color: #a9a0c8; background: linear-gradient(#fff, #eeeafd); }
.layout-reset-component-button { width: 100%; color: #8d435e; background: #fff6f8; }
.empty-selection { min-height: 220px; padding: 22px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--editor-muted); text-align: center; }
.empty-selection span { font-size: 38px; }
.empty-selection p { margin: 0; }


@media (max-width: 1050px) {
}

@media (max-width: 760px) {
  .layout-topbar { align-items: stretch; flex-direction: column; }
  .layout-select-field { min-width: 0; }
  .device-switcher { display: grid; grid-template-columns: repeat(3, 1fr); }
  .device-switcher legend { grid-column: 1 / -1; }
  .device-switcher button { min-width: 0; padding-inline: 5px; }
  .layout-history-actions { width: 100%; margin-left: 0; display: grid; grid-template-columns: 1fr 1fr; }
  .layout-designer-grid { display: flex; flex-direction: column; }
  .layout-sidebar { width: 100%; max-height: none; }
  .layout-canvas-column { width: 100%; order: 1; }
  .layout-preview-viewport { height: 62vh; min-height: 430px; }
}

@media (max-width: 430px) {
  .layout-canvas-toolbar { align-items: stretch; }
  .layout-canvas-toolbar > span { width: 100%; }
  .layout-canvas-toolbar label { flex: 1; }
  .layout-preview-viewport { padding: 7px; min-height: 390px; }
  .layout-two-fields, .layout-property-actions { grid-template-columns: 1fr; }
  .layout-range-row { grid-template-columns: minmax(0, 1fr) 62px; }
  .layout-range-row input[type="number"] { width: 62px; }
}

.image-local-tools {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.compact-file-button { min-height: 36px; padding: 6px 9px; }
.image-local-tools .editor-help { flex: 1 1 260px; }
.theme-preset-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-preset-buttons button { min-width: 140px; }

/* ==========================================================
   VISUAL DESIGNER INTERACTION UPDATE
   Sortable section list, free/grid movement, quick paint/size.
   ========================================================== */
.layout-component-group-body {
  min-height: 8px;
  display: grid;
  gap: 5px;
  position: relative;
}

.layout-component-button {
  grid-template-columns: 22px 30px minmax(0, 1fr) 16px;
  position: relative;
  user-select: none;
  touch-action: pan-y;
  cursor: pointer;
  border: 1px solid #c58fa9;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(93, 40, 65, .11);
}

.layout-component-button:focus-visible {
  outline: 3px solid #d45391;
  outline-offset: 2px;
}

.layout-component-grip {
  width: 22px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #a14c74;
  font: 700 21px/1 Arial, sans-serif;
  cursor: grab;
  touch-action: none;
  border-right: 1px dotted #dfabc4;
}

.layout-component-grip:active,
.layout-component-button.is-list-dragging .layout-component-grip {
  cursor: grabbing;
}

.layout-component-button.is-list-dragging {
  opacity: .42;
  border-style: dashed;
}

.layout-component-button.is-list-drop-before::before,
.layout-component-button.is-list-drop-after::after {
  content: "";
  position: absolute;
  z-index: 8;
  left: 3px;
  right: 3px;
  height: 4px;
  border-radius: 5px;
  background: #16a4c7;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
}
.layout-component-button.is-list-drop-before::before { top: -5px; }
.layout-component-button.is-list-drop-after::after { bottom: -5px; }
.layout-component-group-body.is-list-drop-zone {
  min-height: 56px;
  padding: 4px;
  outline: 3px dashed #16a4c7;
  outline-offset: 2px;
  background: #edfbff;
}

.layout-list-drag-ghost {
  width: 190px;
  min-height: 50px;
  padding: 6px;
  position: fixed;
  z-index: 2147483600;
  display: grid;
  grid-template-columns: 22px 30px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 7px;
  color: #fff;
  pointer-events: none;
  border: 1px solid #8f315f;
  border-radius: 6px;
  background: linear-gradient(#ed8fbb, #c95189);
  box-shadow: 0 8px 24px rgba(76, 24, 48, .35);
  transform: rotate(1deg);
}
.layout-list-drag-ghost small { color: #fff4fa; }
.layout-list-drag-ghost .layout-component-icon { color: #9f3d6c; background: #fff; }

.layout-mode-buttons,
.layout-quick-tool-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.layout-mode-buttons button,
.layout-quick-tool-buttons button {
  min-height: 39px;
  padding: 6px 7px;
}
.layout-mode-buttons button.is-active {
  color: #fff;
  font-weight: 700;
  border-color: #96365f;
  background: linear-gradient(#ec83b2, #c84882);
}
.layout-quick-tool-buttons button {
  color: #75415d;
  border-color: #bd83a0;
  background: linear-gradient(#fff, #f8e5ef);
}
.layout-field-help {
  color: var(--editor-muted);
  font-size: 10px;
  line-height: 1.35;
}
.layout-subheading {
  margin: 4px 0 -2px;
  padding-top: 8px;
  color: #9c3f6c;
  font-size: 12px;
  border-top: 1px dotted #dcaac2;
}

/* Keep numeric text editable while its paired slider remains live. */
.layout-range-row {
  grid-template-columns: minmax(0, 1fr) 78px;
}
.layout-range-row input[type="number"] {
  width: 78px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.layout-range-row input[type="number"]:focus {
  outline: 2px solid #d75a96;
  outline-offset: 1px;
  background: #fff;
}

@media (max-width: 430px) {
  .layout-component-button,
  .layout-list-drag-ghost {
    grid-template-columns: 24px 30px minmax(0, 1fr) 16px;
  }
  .layout-component-grip { width: 24px; }
  .layout-range-row { grid-template-columns: minmax(0, 1fr) 72px; }
  .layout-range-row input[type="number"] { width: 72px; }
}

.layout-component-button.is-list-drag-source { pointer-events: none; }

.layout-component-grip.is-disabled { color: #c6abb8; cursor: default; border-right-color: #ead5df; }

.layout-component-button:hover { background: #fff0f7; border-color: #d47ba6; }
.layout-component-button.is-selected:hover { background: linear-gradient(#ec88b6, #cf5a91); }


/* v4.2: stable numeric editing and pixel-snap wording. */
.layout-range-row input[type="number"] { touch-action: manipulation; }
.layout-mode-buttons + .layout-property-field { margin-top: 7px; padding: 7px; border: 1px dashed #dfb0c7; background: #fff8fb; }

/* v4.3 exact fitted canvas and designer guides. */
@media (max-width: 620px) {
  .layout-guide-toggle, .layout-guide-size { flex: 1 1 auto; justify-content: center; }
}


/* v4.4: true native-size canvas, persistent site limits, and clearer editor framing. */
.layout-preview-boundaries {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  border: 2px solid rgba(177, 29, 98, .92);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.92),
    0 0 0 4px rgba(221, 91, 148, .22),
    inset 0 0 0 1px rgba(255,255,255,.75);
}
.layout-boundary-edge {
  position: absolute;
  display: block;
  color: #8e2457;
  font: 700 9px/1 Arial, sans-serif;
  letter-spacing: .055em;
  text-shadow: 0 1px #fff, 1px 0 #fff, -1px 0 #fff, 0 -1px #fff;
}
.layout-boundary-edge b {
  padding: 3px 6px;
  display: inline-block;
  border: 1px solid rgba(165, 43, 98, .68);
  border-radius: 4px;
  background: rgba(255, 244, 250, .94);
  box-shadow: 0 2px 7px rgba(82, 27, 53, .18);
  white-space: nowrap;
}
.layout-boundary-edge.is-top { left: 8px; top: 7px; }
.layout-boundary-edge.is-left { left: 7px; top: 50%; transform: translateY(-50%); }
.layout-boundary-edge.is-right { right: 7px; top: 50%; transform: translateY(-50%); }
.layout-boundary-edge.is-bottom { left: 50%; bottom: 7px; transform: translateX(-50%); }
.layout-preview-viewport.is-measuring .layout-preview-scaler { opacity: .985; }
.layout-preview-viewport.is-desktop .layout-preview-scaler,
.layout-preview-viewport.is-tablet .layout-preview-scaler,
.layout-preview-viewport.is-mobile .layout-preview-scaler { transition: width 100ms ease, height 100ms ease; }

@media (max-width: 620px) {
  .layout-boundary-edge b { padding: 2px 4px; font-size: 8px; }
  .layout-boundary-edge.is-left,
  .layout-boundary-edge.is-right { top: 34px; transform: none; }
  .layout-boundary-edge.is-left { left: 5px; }
  .layout-boundary-edge.is-right { right: 5px; }
}

/* v4.5: stable native canvas, adjustable guide palette, and strict editor limits. */
.layout-guide-style {
  position: relative;
  min-height: 38px;
  color: #75415d;
}
.layout-guide-style > summary {
  min-height: 38px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  list-style: none;
  cursor: pointer;
  user-select: none;
  border: 1px solid #d7abc0;
  border-radius: 5px;
  background: #fff8fb;
}
.layout-guide-style > summary::-webkit-details-marker { display: none; }
.layout-guide-style > summary::after {
  content: "▾";
  margin-left: 7px;
  font-size: 10px;
}
.layout-guide-style[open] > summary {
  color: #fff;
  border-color: #9e3d6b;
  background: linear-gradient(#e77dad, #c94d87);
}
.layout-guide-style-panel {
  width: min(290px, calc(100vw - 30px));
  padding: 10px;
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 80;
  display: grid;
  gap: 9px;
  color: #5b3549;
  border: 1px solid #9e3d6b;
  border-radius: 7px;
  background: #fffafd;
  box-shadow: 0 8px 24px rgba(70, 22, 46, .3);
}
.layout-guide-style-panel label {
  display: grid !important;
  grid-template-columns: 92px minmax(0, 1fr) 42px;
  gap: 7px;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
}
.layout-guide-style-panel input[type="color"] {
  width: 100%;
  min-height: 34px;
  grid-column: 2 / 4;
  padding: 2px;
  border: 1px solid #c990aa;
  background: #fff;
}
.layout-guide-style-panel input[type="range"] {
  width: 100%;
  accent-color: #d65b96;
}
.layout-guide-style-panel output {
  text-align: right;
  color: #9b3c69;
  font-variant-numeric: tabular-nums;
}
.layout-preview-scaler,
.layout-preview-native-canvas {
  contain: layout paint;
}
.layout-preview-native-canvas {
  overflow: hidden;
}
.layout-preview-boundaries {
  transition: none !important;
}
.layout-boundary-edge.is-bottom b::after {
  content: "";
}
@media (max-width: 760px) {
  .layout-guide-style { flex: 1 1 auto; }
  .layout-guide-style > summary { justify-content: center; }
  .layout-guide-style-panel { left: 0; right: auto; }
}


/* v4.6 universal component resizing. */
.layout-property-section .layout-subheading + .layout-property-field { margin-top: 4px; }
.layout-property-section select { min-height: 38px; }
.layout-property-section .layout-field-help { display: block; margin-top: 4px; }


/* v4.7 universal section sizing and one-tap fitting. */
.layout-inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.layout-inline-actions button {
  min-height: 38px;
  padding: 6px 7px;
  color: #75415d;
  border-color: #bd83a0;
  background: linear-gradient(#fff, #f8e5ef);
}
@media (max-width: 430px) {
  .layout-inline-actions { grid-template-columns: 1fr; }
}


/* v4.8: quiet boundary frame and stable 2000px design runway. */
.layout-boundary-edge,
.layout-boundary-edge b { display: none !important; }

/* v4.9: Windows-style outline resizing; size controls stay in Properties. */
.layout-quick-tool-buttons.is-single { grid-template-columns: 1fr; }


/* v5.0: selection tools live above the preview; movement lives on the outline. */
.layout-selection-toolbar {
  flex: 1 0 100%; min-width: 0; min-height: 48px; padding: 7px 9px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #d7abc0; border-radius: 7px;
  background: linear-gradient(90deg, #fffafd, #f9e5ef);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.9);
}
.layout-selection-toolbar-label { min-width: 150px; max-width: 240px; overflow: hidden; color: #8d3e66; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.layout-selection-toolbar-controls { min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.layout-selection-movement-label { color: #704055; font-size: 11px; font-weight: 700; }
.layout-selection-toolbar button { min-height: 36px; padding: 6px 11px; }
.layout-selection-toolbar button.is-active { color: #fff; font-weight: 700; border-color: #96365f; background: linear-gradient(#ec83b2, #c84882); }
.layout-selection-snap { min-height: 36px; padding: 3px 7px; display: inline-flex !important; align-items: center; gap: 5px; color: #75415d; border: 1px solid #d7abc0; border-radius: 5px; background: #fff; }
.layout-selection-snap input { width: 54px; min-height: 27px; padding: 2px 4px; text-align: right; border: 1px solid #c990aa; background: #fff; }
.layout-selection-snap span { font-size: 10px; }
.layout-selection-toolbar.is-disabled { color: #9d9297; background: #f0ecee; border-color: #d7cfd3; box-shadow: none; }
.layout-selection-toolbar.is-disabled .layout-selection-toolbar-label, .layout-selection-toolbar.is-disabled .layout-selection-movement-label { color: #9d9297; }
.layout-selection-toolbar button:disabled, .layout-selection-snap.is-disabled { opacity: .48; cursor: not-allowed; filter: grayscale(.75); }
@media (max-width: 760px) {
  .layout-selection-toolbar { align-items: stretch; flex-direction: column; gap: 6px; }
  .layout-selection-toolbar-label { max-width: none; }
  .layout-selection-toolbar-controls { width: 100%; }
  .layout-selection-toolbar-controls > button { flex: 1 1 auto; }
}


/* ==========================================================
   v5.1 — page-centric section list and session-only designer
   ========================================================== */
.layout-history-stack {
  margin-left: auto;
  display: grid;
  gap: 6px;
  justify-items: end;
}
.layout-reset-actions,
.layout-history-actions {
  margin-left: 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.layout-reset-actions button,
.layout-history-actions button { min-height: 36px; }

.layout-component-page-button {
  margin: 8px 8px 2px;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  border-width: 2px;
  background: linear-gradient(#fff, #fff0f7);
}
.layout-component-page-button .layout-component-icon {
  color: #9f3d6c;
  background: #ffe0ee;
}
.layout-component-page-button.is-selected {
  color: #fff;
  background: linear-gradient(#ec88b6, #cf5a91);
}
.layout-component-page-button.is-selected .layout-component-icon {
  color: #9f3d6c;
  background: #fff;
}
.layout-component-page-button .layout-component-copy small { white-space: normal; }
.layout-component-group[data-editor-group="top"] { order: 1; }
.layout-component-group[data-editor-group="bottom"] { order: 2; }
.layout-component-group[data-editor-group="left"] { order: 3; }
.layout-component-group[data-editor-group="right"] { order: 4; }
.layout-component-group[data-editor-group="main"] { order: 5; }

.layout-canvas-toolbar {
  align-items: center;
}
.layout-selection-toolbar {
  flex: 1 1 540px;
  min-width: 280px;
  min-height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.layout-selection-toolbar-label {
  min-width: 110px;
  max-width: 180px;
}
.layout-selection-toolbar.is-disabled {
  background: transparent;
  border: 0;
}
.layout-selection-toolbar button { min-height: 38px; }
.layout-selection-snap { min-height: 38px; }
.layout-selection-toolbar + * { margin-left: 0; }

#layout-component-properties[hidden] { display: none !important; }


@media (max-width: 760px) {
  .layout-history-stack { width: 100%; justify-items: stretch; }
  .layout-reset-actions,
  .layout-history-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .layout-selection-toolbar {
    flex: 1 1 100%;
    min-width: 0;
    align-items: center;
    flex-direction: row;
  }
  .layout-selection-toolbar-label {
    width: 100%;
    max-width: none;
  }
}
@media (max-width: 430px) {
  .layout-reset-actions,
  .layout-history-actions {
    grid-template-columns: 1fr;
  }
}
.layout-component-empty-zone {
  margin: 3px 0;
  padding: 10px 8px;
  color: #a4788e;
  text-align: center;
  font-size: 11px;
  border: 1px dashed #db9fbc;
  background: #fff8fc;
}
.layout-page-geometry-summary {
  margin: 8px 0;
  padding: 9px;
  color: #6e4a5d;
  border: 1px solid #d9aec3;
  background: #fff8fc;
}
.layout-page-geometry-summary p { margin: 5px 0 0; font-size: 11px; line-height: 1.4; }


/* ==========================================================
   v5.3 — structural Top/Bottom selectors and matched panels
   ========================================================== */
.layout-structural-zone-button {
  min-height: 46px;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  border-width: 2px;
  border-style: solid;
  background: linear-gradient(#f9feff, #eafaff);
}
.layout-structural-zone-button .layout-component-icon {
  color: #087f9e;
  background: #dff8ff;
}
.layout-structural-zone-button.is-selected {
  color: #fff;
  border-color: #087f9e;
  background: linear-gradient(#3ab9d6, #0d92b2);
}
.layout-structural-zone-button.is-selected .layout-component-icon {
  color: #087f9e;
  background: #fff;
}
.layout-structural-zone-button.is-selected small { color: #effcff; }
@media (max-width: 760px) {
  .layout-sidebar { height: auto; max-height: none; }
}


/* ==========================================================
   v5.4 — deterministic section reordering
   Only a row overlap or the explicit empty drop box is valid.
   ========================================================== */
.layout-component-empty-zone.is-list-drop-zone {
  min-height: 48px;
  color: #087f9d;
  font-weight: 700;
  outline: 3px dashed #16a4c7;
  outline-offset: 2px;
  background: #edfbff;
}
.layout-component-group-body > .layout-component-empty-zone.is-list-drop-zone {
  padding: 12px 8px;
}
.layout-structural-zone-button .layout-component-grip,
.layout-structural-zone-button .layout-preview-outline-move-handle {
  display: none !important;
}


/* ==========================================================
   v5.5 — full-width canvas with synchronized overlay drawers
   ========================================================== */
.layout-editor-panel {
  --layout-drawer-width: min(330px, calc(50% - 34px));
}

.layout-designer-grid {
  min-width: 0;
  position: relative;
  display: block;
  isolation: isolate;
}

.layout-canvas-column {
  width: 100%;
  min-width: 0;
}

.layout-sidebar.layout-drawer {
  width: var(--layout-drawer-width);
  height: var(--layout-editor-panel-height, 76vh);
  max-height: none;
  position: absolute;
  top: 0;
  bottom: auto;
  z-index: 45;
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 170ms ease, opacity 140ms ease, visibility 0s linear 170ms;
  box-shadow: 0 10px 32px rgba(76, 26, 51, .28);
}

.layout-components-panel.layout-drawer {
  left: 0;
  transform: translateX(calc(-100% - 14px));
}

.layout-properties-panel.layout-drawer {
  right: 0;
  padding-bottom: 8px;
  transform: translateX(calc(100% + 14px));
}

.layout-designer-grid.is-components-open .layout-components-panel,
.layout-designer-grid.is-properties-open .layout-properties-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition: transform 170ms ease, opacity 140ms ease;
}

.layout-drawer-tab {
  min-width: 42px;
  min-height: 126px;
  padding: 10px 7px;
  position: absolute;
  top: 92px;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #7b3157;
  font-weight: 700;
  border: 1px solid #b96e92;
  background: linear-gradient(#fffafd, #f5dce8);
  box-shadow: 0 5px 18px rgba(84, 31, 57, .22);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transition: left 170ms ease, right 170ms ease, color 140ms ease, background 140ms ease;
}
.layout-drawer-tab:hover,
.layout-drawer-tab:focus-visible,
.layout-drawer-tab[aria-expanded="true"] {
  color: #fff;
  border-color: #96365f;
  background: linear-gradient(#eb82b2, #c94d86);
}
.layout-drawer-tab-left { left: 0; border-radius: 0 10px 10px 0; }
.layout-drawer-tab-right { right: 0; border-radius: 10px 0 0 10px; }
.layout-designer-grid.is-components-open .layout-drawer-tab-left { left: var(--layout-drawer-width); }
.layout-designer-grid.is-properties-open .layout-drawer-tab-right { right: var(--layout-drawer-width); }

.layout-drawer-close {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

.layout-components-panel .layout-panel-help {
  margin-bottom: 12px;
}

.layout-preview-viewport {
  min-height: 560px;
}

@media (max-width: 760px) {
  .layout-editor-panel {
    --layout-drawer-width: min(320px, calc(100% - 52px));
  }
  .layout-designer-grid { display: block; }
  .layout-sidebar.layout-drawer {
    width: var(--layout-drawer-width);
    height: var(--layout-editor-panel-height, 70vh);
    max-height: none;
  }
  .layout-drawer-tab {
    min-height: 104px;
    top: 74px;
  }
  .layout-preview-viewport { min-height: 470px; }
}

@media (max-width: 430px) {
  .layout-editor-panel { --layout-drawer-width: calc(100% - 44px); }
  .layout-drawer-tab {
    min-width: 38px;
    min-height: 92px;
    padding: 7px 5px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .layout-sidebar.layout-drawer,
  .layout-drawer-tab { transition: none; }
}

/* ==========================================================
   v5.6 — compact creator workflow and iPad-first controls
   ========================================================== */
.editor-page {
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
}
.editor-save-button { min-width: 128px; }
.editor-session-note {
  margin: 8px 12px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #6d4359;
  font-size: 11px;
  border: 1px solid #ebc5d7;
  border-radius: 8px;
  background: rgba(255,255,255,.86);
}
.editor-session-note > span { color: #55a77c; }
.editor-tabs {
  position: sticky;
  top: 64px;
  z-index: 490;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: rgba(248, 198, 220, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.editor-tabs::-webkit-scrollbar { display: none; }
.editor-tabs button { min-width: max-content; min-height: 46px; padding: 9px 16px; }
.editor-main { width: 100%; max-width: none; padding: 10px max(10px, env(safe-area-inset-left)) 18px max(10px, env(safe-area-inset-right)); }
.layout-topbar { margin-bottom: 8px; padding: 9px; }
.layout-canvas-toolbar {
  position: sticky;
  top: 112px;
  z-index: 80;
  padding: 7px;
  background: rgba(255,247,251,.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.layout-preview-tip { margin: 4px 0 0; font-size: 9px; opacity: .72; }
.layout-drawer-tab { min-width: 48px; min-height: 116px; font-size: 12px; }
.layout-drawer-close { min-width: 44px; min-height: 44px; }
.layout-sidebar.layout-drawer { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.layout-component-button { min-height: 58px; }
.layout-component-grip { min-width: 44px; touch-action: none; }
.layout-component-button-main { min-height: 48px; }
.layout-property-field input,
.layout-property-field select,
.layout-property-field textarea,
.layout-toggle-field,
.layout-mode-buttons button,
.layout-property-actions button,
.layout-custom-item-actions button { min-height: 44px; }
.layout-property-field textarea { resize: vertical; font: inherit; }
.layout-advanced-properties { margin-top: 10px; border: 1px solid #e7bfd2; border-radius: 8px; background: #fffafd; }
.layout-advanced-properties > summary { min-height: 46px; padding: 10px 12px; display: flex; align-items: center; color: #873c63; font-weight: 700; cursor: pointer; }
.layout-advanced-properties-body { padding: 0 10px 10px; display: grid; gap: 10px; }
.layout-custom-content-editor { margin-top: 10px; padding: 10px; display: grid; gap: 9px; border: 1px solid #e7bfd2; border-radius: 8px; background: #fff; }
.layout-custom-content-editor h4 { margin: 0; }
.layout-custom-content-field textarea { min-height: 110px; }
.layout-custom-file-button { justify-content: center; }
.layout-custom-item-actions { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }


@media (pointer: coarse) {
  button, select, input[type="number"], input[type="text"], input[type="url"], .file-button { min-height: 44px; }
  .layout-component-button { min-height: 64px; }
  .layout-preview-viewport { touch-action: pan-x pan-y; }
}

/* iPad portrait and compact landscape: drawers become split bottom sheets. */
@media (max-width: 1100px) and (pointer: coarse) {
  .editor-tabs { top: 0; }
  .layout-canvas-toolbar { top: 46px; }
  .layout-editor-panel { --layout-drawer-width: 50vw; }
  .layout-sidebar.layout-drawer {
    position: fixed;
    top: auto;
    bottom: max(0px, env(safe-area-inset-bottom));
    width: 50vw;
    height: min(62dvh, 720px);
    max-height: none;
    z-index: 1200;
    transform: translateY(calc(100% + 24px));
    box-shadow: 0 -10px 30px rgba(71, 25, 48, .28);
  }
  .layout-components-panel { left: 0; right: auto; border-radius: 0 14px 0 0; }
  .layout-properties-panel { right: 0; left: auto; border-radius: 14px 0 0 0; }
  .layout-designer-grid.is-components-open .layout-components-panel,
  .layout-designer-grid.is-properties-open .layout-properties-panel { transform: translateY(0); }
  .layout-drawer-tab { position: fixed; top: 45%; z-index: 1210; }
  .layout-designer-grid.is-components-open .layout-drawer-tab-left { left: 0; }
  .layout-designer-grid.is-properties-open .layout-drawer-tab-right { right: 0; }
  .layout-preview-viewport { min-height: 68dvh; height: 68dvh; }
}

@media (max-width: 680px) {
  .editor-session-note { display: none; }
  .editor-save-button { min-width: 96px; }
  .layout-sidebar.layout-drawer { width: 100vw; }
  .layout-components-panel, .layout-properties-panel { left: 0; right: 0; border-radius: 14px 14px 0 0; }
  .layout-designer-grid.is-components-open.is-properties-open .layout-properties-panel { display: none; }
}

/* ==========================================================
   v5.7 — stable creator workflow
   Header removed; save controls live with the active layout.
   ========================================================== */
.editor-tabs {
  top: 0;
  margin-top: 8px;
}
.layout-canvas-toolbar { top: 46px; }
.layout-publish-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 220px;
}
.layout-publish-actions .editor-status {
  min-width: 64px;
  text-align: center;
}
.layout-publish-actions .editor-save-button {
  min-width: 128px;
}
.layout-history-stack { margin-left: 0; }

@media (max-width: 980px) {
  .layout-publish-actions {
    order: 3;
    margin-left: 0;
    flex: 1 1 auto;
  }
  .layout-history-stack {
    order: 4;
    margin-left: auto;
  }
}

@media (max-width: 680px) {
  .layout-publish-actions {
    width: 100%;
    justify-content: space-between;
  }
  .layout-publish-actions .editor-save-button { flex: 1; }
}


/* Creator v5.8 — compact Listbox controls and iPad-sized inputs. */
.layout-listbox-section{border:1px solid #e7bfd2;border-radius:8px;background:#fffafc;overflow:clip}
.layout-listbox-section>summary{padding:10px 12px;cursor:pointer;font-weight:700;color:#9d3b6b;background:#fff0f7}
.layout-listbox-section-body{padding:10px;display:grid;gap:10px}.layout-listbox-size-list{display:grid;gap:7px;padding-top:4px}.layout-listbox-size-list>strong{font-size:12px;color:#7c3d5d}
.layout-custom-content-editor .layout-listbox-section .layout-property-field{margin:0}
@media(pointer:coarse){.layout-listbox-section>summary{min-height:44px;display:flex;align-items:center}.layout-listbox-section-body select,.layout-listbox-section-body input,.layout-listbox-section-body textarea,.layout-listbox-section-body button{min-height:44px}}


/* ==========================================================
   v5.9 — drag-and-drop element toolbox
   ========================================================== */
.layout-toolbox-toggle {
  width: 100%;
  min-height: 48px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  text-align: left;
  color: #7f345b;
  border-style: dashed;
  background: #fff5fa;
}
.layout-toolbox-toggle > span {
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  border-radius: 50%;
  background: #d65391;
}
.layout-toolbox-toggle strong { font-size: 13px; }
.layout-toolbox-toggle small { color: var(--editor-muted); font-size: 10px; }
.layout-toolbox-toggle[aria-expanded="true"] { border-style: solid; background: #ffe4f1; }
.layout-toolbox[hidden] { display: none !important; }
.layout-toolbox {
  padding: 8px;
  display: grid;
  gap: 8px;
  border: 1px solid #e5b7cd;
  border-radius: 8px;
  background: #fffafd;
  box-shadow: inset 0 0 0 2px #fff;
}
.layout-toolbox-heading { display: grid; gap: 2px; }
.layout-toolbox-heading strong { color: #8b3c62; font-size: 12px; }
.layout-toolbox-heading small { color: var(--editor-muted); font-size: 9px; line-height: 1.3; }
.layout-toolbox-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.layout-tool-card {
  min-width: 0;
  min-height: 68px;
  padding: 7px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  text-align: left;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  background: #fff;
}
.layout-tool-card:active { cursor: grabbing; }
.layout-tool-card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #9a3e6c;
  font-size: 19px;
  border-radius: 50%;
  background: #ffe2ef;
}
.layout-tool-card-copy { min-width: 0; display: grid; gap: 2px; }
.layout-tool-card-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.layout-tool-card-copy small { color: var(--editor-muted); font-size: 8px; line-height: 1.2; }
.layout-tool-drag-ghost {
  position: fixed;
  z-index: 2147483600;
  min-width: 132px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  pointer-events: none;
  border: 2px solid #fff;
  border-radius: 10px;
  background: #c84c87;
  box-shadow: 0 10px 28px rgba(53,18,37,.34);
  transform: translateZ(0);
}
.layout-tool-drag-ghost span { font-size: 20px; }
.layout-tool-drag-ghost strong { font-size: 12px; }
html.is-tool-dragging, html.is-tool-dragging * { cursor: grabbing !important; }

@media (pointer: coarse) {
  .layout-toolbox-tools { grid-template-columns: 1fr; }
  .layout-tool-card { min-height: 58px; }
  .layout-tool-card-copy strong { font-size: 13px; }
  .layout-tool-card-copy small { font-size: 10px; }
}

/* Packet 04 — canonical Layers and content tools */
#layout-component-list[data-packet4-layers="true"] { display:block; padding:8px; }
.ls-layers-top { display:grid; gap:8px; margin-bottom:10px; }
.ls-layers-page,
.ls-add-element > summary { min-height:44px; display:flex; align-items:center; gap:8px; padding:8px 10px; border:1px solid #d7a7bf; border-radius:9px; background:#fff8fc; color:#723453; font-weight:700; cursor:pointer; }
.ls-layers-page.is-selected { border-color:#d34d8c; box-shadow:0 0 0 2px rgba(211,77,140,.16); }
.ls-add-element > summary { list-style:none; }
.ls-add-element > summary::-webkit-details-marker { display:none; }
.ls-add-tools { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; padding:8px 0 0; }
.ls-add-tools button { min-height:42px; }
.ls-layer-group { margin:7px 0; border:1px solid #ead0dd; border-radius:9px; background:rgba(255,255,255,.8); overflow:visible; }
.ls-layer-group > summary { min-height:42px; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; cursor:pointer; color:#7c3c5c; font-weight:700; background:#fff4fa; }
.ls-layer-group > summary small { min-width:24px; padding:2px 6px; border-radius:999px; text-align:center; background:#efd5e3; }
.ls-layer-group-list { display:grid; gap:4px; padding:6px; }
.ls-layer-row { position:relative; display:grid; grid-template-columns:minmax(0,1fr) 38px 38px 38px; align-items:center; gap:4px; min-height:46px; padding:3px; border:1px solid transparent; border-radius:8px; }
.ls-layer-row.is-selected { border-color:#df6fa9; background:#fff1f8; }
.ls-layer-row.is-hidden-layer { opacity:.58; }
.ls-layer-row.is-locked-layer .ls-layer-select { color:#75636c; }
.ls-layer-select { min-width:0; min-height:38px; display:flex; align-items:center; gap:8px; padding:6px 8px; border:0; background:transparent; color:#49333e; text-align:left; }
.ls-layer-select:hover { background:#fff; }
.ls-layer-icon { width:24px; height:24px; display:grid; place-items:center; flex:0 0 auto; border-radius:6px; background:#f2d5e4; color:#9c3e6b; font-weight:700; }
.ls-layer-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ls-layer-icon-button { min-width:38px; min-height:38px; padding:0; }
.ls-layer-more { position:relative; }
.ls-layer-more > summary { width:38px; height:38px; display:grid; place-items:center; list-style:none; cursor:pointer; border:1px solid #d9b7c8; border-radius:7px; background:#fff; }
.ls-layer-more > summary::-webkit-details-marker { display:none; }
.ls-layer-menu { position:absolute; z-index:100; top:42px; right:0; width:min(280px,80vw); padding:10px; display:grid; gap:8px; border:1px solid #b97b9a; border-radius:10px; background:#fff; box-shadow:0 10px 28px rgba(73,35,54,.22); }
.ls-layer-field { display:grid; gap:4px; color:#70405a; font-size:12px; font-weight:700; }
.ls-layer-field input,.ls-layer-field select { width:100%; min-height:40px; }
.ls-layer-menu-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.ls-layer-menu-grid button { min-height:40px; }
.ls-layer-empty { margin:5px; padding:8px; color:#8d7581; text-align:center; }
.ls-presets { margin-top:10px; border-top:1px solid #ead0dd; padding-top:8px; }
.ls-presets > summary { cursor:pointer; font-weight:700; color:#7c3c5c; }
.ls-preset-list { display:grid; gap:5px; margin-top:7px; }

.ls-p4-content-panel { display:grid; gap:10px; margin:0 0 12px; padding:10px; border:1px solid #e0b5ca; border-radius:10px; background:#fffafd; }
.ls-p4-content-heading { display:flex; align-items:center; gap:9px; padding-bottom:8px; border-bottom:1px solid #efd7e3; }
.ls-p4-content-heading > div { min-width:0; display:grid; }
.ls-p4-content-heading strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#6e3251; }
.ls-p4-content-heading small { color:#8e7782; }
.ls-p4-type-icon { width:34px; height:34px; display:grid; place-items:center; border-radius:8px; background:#f2d5e4; color:#9c3e6b; font-weight:700; }
.ls-p4-field { display:grid; gap:5px; color:#68394f; font-size:12px; font-weight:700; }
.ls-p4-field input,.ls-p4-field textarea,.ls-p4-field select { width:100%; min-height:42px; font:inherit; }
.ls-p4-field textarea { resize:vertical; min-height:88px; }
.ls-p4-field small,.ls-p4-help { color:#8e7782; font-weight:400; }
.ls-localized-field { min-width:0; display:grid; gap:7px; padding:8px; border:1px solid #efd8e3; border-radius:8px; }
.ls-localized-field legend { padding:0 5px; color:#743b57; font-weight:700; }
.ls-rich-toolbar { display:grid; grid-template-columns:44px 44px minmax(0,1fr) 70px 48px; gap:5px; align-items:center; }
.ls-rich-toolbar > * { min-height:42px; min-width:0; }
.ls-rich-toolbar button.is-active { background:#df6fa9; color:#fff; }
.ls-p4-image-preview { width:100%; max-height:180px; object-fit:contain; border:1px solid #ead0dd; border-radius:8px; background:#f8f8f8; }
.ls-p4-properties-group { border:1px solid #ead0dd; border-radius:8px; overflow:hidden; }
.ls-p4-properties-group > summary { min-height:42px; display:flex; align-items:center; padding:8px 10px; cursor:pointer; color:#743b57; font-weight:700; background:#fff4fa; }
.ls-p4-properties-group > :not(summary) { margin:8px; }
.ls-p4-grid-2 { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.ls-native-content-fallback { display:grid; gap:8px; padding:9px; border-radius:8px; background:#fff1f8; }
.ls-native-content-fallback p { margin:0; }
.ls-repeater-fields,.ls-repeater-items { display:grid; gap:7px; }
.ls-repeater-field-row { display:grid; grid-template-columns:minmax(0,1fr) 92px 72px 38px; gap:5px; align-items:center; }
.ls-repeater-field-row input,.ls-repeater-field-row select { min-width:0; min-height:40px; }
.ls-repeater-item { border:1px solid #ecd1de; border-radius:8px; overflow:hidden; }
.ls-repeater-item > summary { min-height:42px; padding:8px; display:flex; align-items:center; cursor:pointer; font-weight:700; background:#fff7fb; }
.ls-repeater-item > :not(summary) { margin:8px; }
.ls-repeater-item-actions { display:flex; gap:6px; flex-wrap:wrap; }
.ls-repeater-item-actions button { min-height:40px; }
.ls-repeater-value-editor { display:grid; gap:6px; padding:7px; border-top:1px dashed #ead0dd; }

@media (pointer:coarse) {
  .ls-layer-row { grid-template-columns:minmax(0,1fr) 46px 46px 46px; min-height:54px; }
  .ls-layer-icon-button,.ls-layer-more > summary { width:46px; height:46px; min-width:46px; min-height:46px; }
  .ls-layer-select,.ls-layer-group > summary,.ls-layers-page,.ls-add-element > summary { min-height:50px; }
  .ls-add-tools button,.ls-layer-menu-grid button,.ls-p4-field input,.ls-p4-field textarea,.ls-p4-field select { min-height:48px; }
}
@media (max-width:900px) {
  .ls-layer-menu { position:fixed; inset:auto max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left)); width:auto; max-height:65vh; overflow:auto; }
  .ls-repeater-field-row { grid-template-columns:minmax(0,1fr) 90px; }
  .ls-repeater-field-row > :nth-child(3),.ls-repeater-field-row > :nth-child(4) { grid-row:2; }
}
html[data-packet4-layers-content="true"] .layout-custom-content-editor,
html[data-packet4-layers-content="true"] .layout-custom-item-actions { display:none!important; }

/* Packet 05 — validation, clean preview, and publishing */
.editor-session-note.is-dirty{background:#fff4d4;color:#6f4800;border-bottom-color:#dfab29}
.packet5-publish-card{display:grid;gap:14px}
.packet5-publish-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;flex-wrap:wrap}
.packet5-publish-heading h2{margin-bottom:4px}
.packet5-publish-heading p{margin:0;max-width:760px}
.packet5-hash-box{display:grid;grid-template-columns:auto minmax(180px,1fr) auto;align-items:center;gap:7px;padding:9px 10px;border:1px solid #c7afd7;border-radius:10px;background:#fff;max-width:100%}
.packet5-hash-box span{font-weight:700}
.packet5-hash-box code{overflow-wrap:anywhere;font-size:12px}
.packet5-hash-box button{min-height:36px}
.packet5-validation-summary{padding:12px 14px;border:2px solid #a896b4;border-radius:10px;background:#f7f2fa;font-weight:800}
.packet5-validation-summary.is-valid{border-color:#4f9d69;background:#edf9f1;color:#1d5c31}
.packet5-validation-summary.is-error{border-color:#c6485d;background:#fff0f3;color:#831b31}
.packet5-validation-details,.packet5-legacy-tools{border:1px solid #cbb9d7;border-radius:10px;background:#fff}
.packet5-validation-details>summary,.packet5-legacy-tools>summary{padding:11px 13px;cursor:pointer;font-weight:800}
.packet5-validation-list{display:grid;gap:8px;max-height:330px;overflow:auto;margin:0;padding:0 13px 13px;list-style:none}
.packet5-validation-list li{display:grid;grid-template-columns:minmax(120px,auto) 1fr;gap:4px 10px;padding:9px;border-left:4px solid #b67a00;background:#fff9e8}
.packet5-validation-list li.is-error{border-left-color:#b32640;background:#fff1f4}
.packet5-validation-list li.is-valid{border-left-color:#328b52;background:#effaf2}
.packet5-validation-list code{grid-column:1/-1;overflow-wrap:anywhere;font-size:11px;opacity:.75}
.packet5-primary-actions{align-items:stretch}
.packet5-primary-actions button,#packet5-validate,#packet5-clean-preview,#packet5-open-clean-preview,#packet5-download-zip,#packet5-download-separate{min-height:46px}
.packet5-legacy-tools .export-actions{padding:0 13px 13px}
.packet5-separate-files{display:grid;gap:9px;padding:12px;border:1px solid #cbb9d7;border-radius:10px;background:#fffafd}
.packet5-separate-files[hidden]{display:none}
.packet5-separate-file-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:7px}
.packet5-separate-file{min-height:46px;display:flex;align-items:center;overflow-wrap:anywhere;text-decoration:none}
.packet5-separate-file.is-downloaded{border-color:#4f9d69;background:#edf9f1;color:#1d5c31}
@media (max-width:700px){.packet5-hash-box{grid-template-columns:1fr auto}.packet5-hash-box span{grid-column:1/-1}.packet5-validation-list li{grid-template-columns:1fr}.packet5-validation-list code{grid-column:1}}
@media (pointer:coarse){.packet5-hash-box button,.packet5-validation-details>summary,.packet5-legacy-tools>summary{min-height:44px}}

/* Packet 06.0.3 visual surface controls. */
.ls-surface-row { grid-template-columns: minmax(0, 1fr); }
.ls-surface-row .ls-layer-select { width: 100%; }
.ls-color-text-control { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 7px; align-items: center; }
.ls-color-text-control input[type="color"] { width: 46px; min-width: 46px; padding: 3px; }
.ls-color-text-control input[type="text"] { min-width: 0; }
.ls-p4-properties-group .ls-p4-properties-group { margin: 8px; }

/* Packet 06.0.3: page-surface selection has its own property model. */
#layout-component-properties[data-packet4-surface-properties] > :not(.ls-p4-content-panel) {
  display: none !important;
}


/* Packet 09: hierarchical Layers and Container controls. */
.ls-layer-row { padding-left: calc(var(--ls-layer-depth, 0) * 16px); }
.ls-layer-row[data-depth]:not([data-depth="0"]) { border-left: 1px dotted rgba(188,82,130,.38); }
.ls-layer-row.is-drop-target { outline: 2px dashed #d64c91; outline-offset: -2px; background: rgba(255,220,237,.7); }
.ls-layer-check { flex: 0 0 auto; width: 16px; height: 16px; margin: 0 2px; }
.ls-group-checked { width: 100%; }
.ls-group-checked.is-disabled { opacity: .55; }


/* Packet 10: responsive inheritance, repeater templates, and tree presets. */
.ls-responsive-property{display:grid;gap:5px;min-width:0;color:#68394f;font-size:12px;font-weight:700}
.ls-responsive-property>input,.ls-responsive-property>select{width:100%;min-height:42px}
.ls-responsive-property-head{display:flex;align-items:center;gap:6px;min-height:22px}
.ls-responsive-property-head>span{margin-right:auto}
.ls-responsive-property-head small{padding:2px 6px;border-radius:999px;font-size:10px;font-weight:800}
.ls-responsive-property-head .is-inherited{background:#e9eef7;color:#53657b}
.ls-responsive-property-head .is-override{background:#ffe0ef;color:#9b3567}
.ls-responsive-reset{min-height:28px;padding:2px 7px;font-size:11px}
.ls-responsive-tools{display:flex;gap:7px;flex-wrap:wrap;margin:8px}
.ls-responsive-tools button{min-height:40px}
.ls-preset-row{display:grid;grid-template-columns:minmax(0,1fr) 40px;gap:6px}
.ls-preset-row button{min-height:40px}
.ls-repeater-field-row{grid-template-columns:minmax(0,1fr) 92px 82px 38px}

/* Packet 12.0.1 — repair Layers rows after full primitive-page migration.
   Every editable row now contains: group checkbox, name, visibility, lock, menu. */
.ls-layer-row:not(.ls-surface-row) {
  grid-template-columns: 18px minmax(0, 1fr) 38px 38px 38px;
  padding-left: 3px;
}
.ls-layer-row:not(.ls-surface-row) .ls-layer-select {
  padding-left: calc(6px + (var(--ls-layer-depth, 0) * 12px));
}
.ls-layer-row[data-depth]:not([data-depth="0"]) {
  border-left: 0;
}
.ls-layer-row:not(.ls-surface-row) > .ls-layer-check {
  grid-column: 1;
  justify-self: center;
  align-self: center;
  margin: 0;
}
.ls-layer-row:not(.ls-surface-row) > .ls-layer-select {
  grid-column: 2;
  width: 100%;
  overflow: hidden;
}
.ls-layer-row:not(.ls-surface-row) > .ls-layer-icon-button:nth-of-type(2) { grid-column: 3; }
.ls-layer-row:not(.ls-surface-row) > .ls-layer-icon-button:nth-of-type(3) { grid-column: 4; }
.ls-layer-row:not(.ls-surface-row) > .ls-layer-more { grid-column: 5; }
.ls-layer-name { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (pointer: coarse) {
  .ls-layer-row:not(.ls-surface-row) {
    grid-template-columns: 20px minmax(0, 1fr) 46px 46px 46px;
  }
  .ls-layer-row:not(.ls-surface-row) .ls-layer-select {
    padding-left: calc(6px + (var(--ls-layer-depth, 0) * 11px));
  }
}

/* ==========================================================
   STAGE 1 — FULL-SCREEN CARRD-INSPIRED EDITOR SHELL
   Keeps the LarSheen pink visual language and all existing IDs,
   commands, canonical state, page model, and property renderers.
   ========================================================== */

html.is-layout-workspace,
body.editor-page.is-layout-workspace {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body.editor-page.is-layout-workspace {
  --stage1-drawer-width: min(360px, calc(100vw - 72px));
  margin: 0;
  padding: 0;
  background: #f7d4e4;
}

body.is-layout-workspace .editor-session-note { display: none; }

body.is-layout-workspace .editor-tabs {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 5px;
  position: fixed;
  z-index: 1500;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  gap: 4px;
  overflow: visible;
  border: 1px solid rgba(183, 99, 138, .72);
  border-radius: 15px;
  background: rgba(255, 249, 252, .94);
  box-shadow: 0 10px 28px rgba(105, 39, 71, .22), inset 0 0 0 2px rgba(255,255,255,.66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.is-layout-workspace .editor-tabs button {
  min-width: 0;
  min-height: 42px;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #7c4661;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

body.is-layout-workspace .editor-tabs button:hover {
  color: #8c315f;
  border-color: #efbfd6;
  background: #fff0f7;
}

body.is-layout-workspace .editor-tabs button.is-active {
  color: #fff;
  border-color: #ad4679;
  background: linear-gradient(180deg, #ee98c0, #d45f96);
  box-shadow: 0 4px 12px rgba(156, 55, 104, .24);
}

.editor-tab-icon {
  min-width: 18px;
  font-family: Arial, sans-serif;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.editor-tab-label { white-space: nowrap; }

body.is-layout-workspace .editor-main {
  width: 100%;
  max-width: none;
  min-height: 0;
  height: 100dvh;
  margin: 0;
  padding: 0;
  position: fixed;
  inset: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.is-layout-workspace .layout-editor-panel {
  --layout-drawer-width: var(--stage1-drawer-width);
  width: 100%;
  height: 100%;
  min-width: 0;
  position: fixed;
  inset: 0;
}

body.is-layout-workspace .layout-topbar {
  width: max-content;
  max-width: calc(100vw - 350px);
  min-height: 54px;
  margin: 0;
  padding: 6px;
  position: fixed;
  z-index: 1500;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  border: 1px solid rgba(183, 99, 138, .72);
  border-radius: 15px;
  background: rgba(255, 249, 252, .95);
  box-shadow: 0 10px 28px rgba(105, 39, 71, .22), inset 0 0 0 2px rgba(255,255,255,.66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.is-layout-workspace .layout-topbar::-webkit-scrollbar { display: none; }

body.is-layout-workspace .layout-topbar button,
body.is-layout-workspace .layout-topbar summary {
  min-width: 42px;
  min-height: 40px;
  padding: 6px 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  box-shadow: none;
  white-space: nowrap;
}

body.is-layout-workspace .layout-topbar button:hover,
body.is-layout-workspace .layout-topbar summary:hover {
  background: #ffeaf4;
}

body.is-layout-workspace .layout-topbar .primary-button {
  color: #fff;
  border-color: #a84272;
  background: linear-gradient(#ed8fbb, #cf5c91);
  box-shadow: 0 3px 9px rgba(141, 48, 91, .22);
}

body.is-layout-workspace .layout-drawer-tab {
  min-width: 42px;
  min-height: 40px;
  padding: 6px 9px;
  position: static;
  inset: auto;
  z-index: auto;
  display: inline-flex;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  color: #7b3157;
  border-radius: 10px;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

body.is-layout-workspace .layout-drawer-tab[aria-expanded="true"] {
  color: #fff;
  border-color: #96365f;
  background: linear-gradient(#eb82b2, #c94d86);
}

body.is-layout-workspace .layout-toolbar-divider {
  width: 1px;
  height: 30px;
  flex: 0 0 1px;
  margin: 0 2px;
  background: #e9bfd2;
}

body.is-layout-workspace .layout-select-field {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #86506a;
  font-size: 10px;
  font-weight: 700;
}

body.is-layout-workspace .layout-select-field select {
  width: 126px;
  min-height: 40px;
  padding: 6px 28px 6px 9px;
  color: #633d51;
  border: 1px solid #dfb0c7;
  border-radius: 10px;
  background-color: #fffafd;
}

body.is-layout-workspace .layout-select-field-language select { width: 102px; }

body.is-layout-workspace .device-switcher {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}

body.is-layout-workspace .device-switcher legend {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body.is-layout-workspace .device-switcher button {
  min-width: 42px;
  min-height: 40px;
  padding-inline: 8px;
}

body.is-layout-workspace .layout-history-actions {
  margin: 0;
  display: flex;
  gap: 3px;
}

body.is-layout-workspace .layout-publish-actions {
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

body.is-layout-workspace .layout-publish-actions .editor-status {
  min-width: 0;
  max-width: 88px;
  padding: 5px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-layout-workspace .layout-publish-actions .editor-save-button { min-width: 104px; }

.layout-more-menu {
  position: relative;
  flex: 0 0 auto;
}

.layout-more-menu > summary {
  list-style: none;
  color: #774158;
  cursor: pointer;
  border: 1px solid #c58fa9;
  background: linear-gradient(#fff, #f8dce9);
}

.layout-more-menu > summary::-webkit-details-marker { display: none; }
.layout-more-menu[open] > summary { color: #fff; border-color: #96365f; background: linear-gradient(#eb82b2, #c94d86); }

.layout-more-popover {
  width: min(280px, calc(100vw - 28px));
  padding: 13px;
  position: fixed;
  z-index: 1900;
  top: 80px;
  right: max(16px, env(safe-area-inset-right));
  display: grid;
  gap: 9px;
  color: #6e4057;
  border: 1px solid #dca9c2;
  border-radius: 14px;
  background: rgba(255, 250, 253, .98);
  box-shadow: 0 14px 38px rgba(85, 29, 56, .28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.layout-more-popover p { margin: 0; color: var(--editor-muted); font-size: 11px; line-height: 1.45; }
.layout-more-popover .layout-reset-actions { display: grid; gap: 7px; }
.layout-more-popover .layout-reset-actions button { width: 100%; }

body.is-layout-workspace .layout-designer-grid {
  width: 100%;
  height: 100%;
  min-width: 0;
  position: fixed;
  inset: 0;
  display: block;
  isolation: isolate;
  overflow: hidden;
}

body.is-layout-workspace .layout-canvas-column {
  width: 100%;
  height: 100%;
  min-width: 0;
  margin-left: 0;
  position: relative;
  transition: width 180ms ease, margin-left 180ms ease;
}

@media (min-width: 861px) {
  body.is-layout-workspace .layout-designer-grid.is-components-open .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-canvas-column {
    width: calc(100% - var(--stage1-drawer-width));
    margin-left: var(--stage1-drawer-width);
  }
}

body.is-layout-workspace .layout-preview-viewport {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  padding: 92px 28px 96px;
  overflow: auto;
  border: 0;
  background:
    radial-gradient(circle at 12px 12px, rgba(255,255,255,.56) 0 2px, transparent 2.5px) 0 0 / 24px 24px,
    linear-gradient(135deg, rgba(255,255,255,.38), rgba(255,255,255,0) 46%),
    #f2e9ee;
  box-shadow: none;
  overscroll-behavior: contain;
}

body.is-layout-workspace .layout-preview-scaler {
  border-radius: 2px;
  box-shadow: 0 16px 46px rgba(72, 35, 54, .24);
}

body.is-layout-workspace .layout-preview-tip { display: none; }

body.is-layout-workspace .layout-canvas-toolbar {
  width: max-content;
  max-width: calc(100vw - 36px);
  min-height: 52px;
  margin: 0;
  padding: 6px;
  position: fixed;
  z-index: 1400;
  top: auto;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  border: 1px solid rgba(183, 99, 138, .72);
  border-radius: 15px;
  background: rgba(255, 249, 252, .95);
  box-shadow: 0 10px 28px rgba(105, 39, 71, .22), inset 0 0 0 2px rgba(255,255,255,.66);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: left 180ms ease;
}

body.is-layout-workspace .layout-canvas-toolbar::-webkit-scrollbar { display: none; }
body.is-layout-workspace .layout-canvas-toolbar > span { flex: 0 0 auto; margin-right: 3px; }
body.is-layout-workspace .layout-canvas-toolbar label { flex: 0 0 auto; white-space: nowrap; }
body.is-layout-workspace .layout-canvas-toolbar button { flex: 0 0 auto; }

@media (min-width: 861px) {
  body.is-layout-workspace.is-editor-drawer-open .layout-canvas-toolbar {
    left: calc(50% + (var(--stage1-drawer-width) / 2));
  }
}

body.is-layout-workspace .layout-selection-toolbar {
  min-width: 0;
  flex: 0 0 auto;
  padding: 4px;
  flex-wrap: nowrap;
  border-radius: 10px;
}

body.is-layout-workspace .layout-selection-toolbar-label { max-width: 180px; }

body.is-layout-workspace .layout-sidebar.layout-drawer {
  width: var(--stage1-drawer-width);
  height: 100dvh;
  max-height: none;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  position: fixed;
  z-index: 1700;
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  border: 0;
  border-right: 1px solid #d99fbc;
  border-radius: 0 18px 18px 0;
  background: #fffafd;
  transform: translateX(calc(-100% - 18px));
  transition: transform 180ms ease, opacity 140ms ease, visibility 0s linear 180ms;
  box-shadow: 12px 0 36px rgba(76, 26, 51, .24);
}

body.is-layout-workspace .layout-properties-panel.layout-drawer,
body.is-layout-workspace .layout-components-panel.layout-drawer {
  left: 0;
  right: auto;
  transform: translateX(calc(-100% - 18px));
}

body.is-layout-workspace .layout-designer-grid.is-components-open .layout-components-panel,
body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-properties-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition: transform 180ms ease, opacity 140ms ease;
}

body.is-layout-workspace .layout-panel-heading {
  min-height: 72px;
  padding: max(14px, env(safe-area-inset-top)) 14px 12px;
  top: 0;
  z-index: 20;
  color: #713850;
  border-bottom: 1px solid #e5b5cc;
  background:
    linear-gradient(180deg, rgba(255,255,255,.8), rgba(255,255,255,.12)),
    #ffddea;
  box-shadow: 0 4px 14px rgba(104, 42, 72, .08);
}

body.is-layout-workspace .layout-panel-heading strong { font-size: 20px; }
body.is-layout-workspace .layout-panel-heading span { margin-top: 2px; font-size: 11px; }
body.is-layout-workspace .layout-drawer-close { border-radius: 50%; background: rgba(255,255,255,.7); }
body.is-layout-workspace .layout-component-list { padding: 12px; }
body.is-layout-workspace .layout-component-properties { padding-bottom: 20px; }

body.is-layout-workspace .layout-property-section {
  margin: 10px;
  padding: 12px;
  gap: 11px;
  border: 1px solid #ebc5d7;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(106, 42, 73, .07);
}

body.is-layout-workspace .layout-component-button {
  border-radius: 10px;
  box-shadow: none;
}

body.is-layout-workspace .layout-component-button.is-selected {
  box-shadow: 0 4px 12px rgba(151, 54, 100, .2);
}

@media (max-width: 1400px) {
  body.is-layout-workspace .layout-topbar { max-width: calc(100vw - 245px); }
  body.is-layout-workspace .layout-topbar .layout-toolbar-button-label,
  body.is-layout-workspace .layout-device-label { display: none; }
  body.is-layout-workspace .layout-publish-actions .editor-status { display: none; }
  body.is-layout-workspace .layout-publish-actions .editor-save-button { min-width: 44px; }
}

@media (max-width: 1040px) {
  body.is-layout-workspace .editor-tabs .editor-tab-label { display: none; }
  body.is-layout-workspace .editor-tabs button { width: 42px; padding-inline: 6px; }
  body.is-layout-workspace .layout-topbar { max-width: calc(100vw - 220px); }
  body.is-layout-workspace .layout-select-field > span { display: none; }
  body.is-layout-workspace .layout-select-field select { width: 112px; }
  body.is-layout-workspace .layout-select-field-language select { width: 92px; }
}

@media (max-width: 860px) {
  body.editor-page.is-layout-workspace { --stage1-drawer-width: min(350px, calc(100vw - 58px)); }
  body.is-layout-workspace .editor-tabs {
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    flex-direction: column;
  }
  body.is-layout-workspace .layout-topbar {
    max-width: calc(100vw - 88px);
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }
  body.is-layout-workspace .layout-preview-viewport { padding: 82px 16px 92px 78px; }
  body.is-layout-workspace .layout-sidebar.layout-drawer { border-radius: 0 16px 16px 0; }
  body.is-layout-workspace .layout-canvas-toolbar { max-width: calc(100vw - 24px); bottom: max(10px, env(safe-area-inset-bottom)); }
}

@media (max-width: 620px) {
  body.editor-page.is-layout-workspace { --stage1-drawer-width: 100vw; }
  body.is-layout-workspace .layout-topbar { max-width: calc(100vw - 82px); }
  body.is-layout-workspace .layout-topbar .layout-toolbar-divider { display: none; }
  body.is-layout-workspace .layout-select-field-page select { width: 105px; }
  body.is-layout-workspace .layout-select-field-language select { width: 82px; }
  body.is-layout-workspace .layout-sidebar.layout-drawer {
    width: 100vw;
    border-right: 0;
    border-radius: 0;
  }
  body.is-layout-workspace .layout-preview-viewport { padding-right: 10px; padding-bottom: 88px; }
  body.is-layout-workspace .layout-canvas-toolbar > #layout-preview-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body.is-layout-workspace .layout-canvas-column,
  body.is-layout-workspace .layout-canvas-toolbar,
  body.is-layout-workspace .layout-sidebar.layout-drawer { transition: none; }
}

/* Drawers must escape the canvas stacking context so their header and close
   control cover the compact workspace switcher on the left edge. */
body.is-layout-workspace .layout-designer-grid { isolation: auto; }

body.is-layout-workspace .editor-tabs {
  transition: transform 180ms ease, opacity 140ms ease;
}
body.is-layout-workspace.is-editor-drawer-open .editor-tabs {
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(-100% - 24px));
}

/* Keep the More menu outside the horizontally scrollable command strip. */
body.is-layout-workspace .layout-topbar { overflow: visible; }
body.is-layout-workspace .layout-toolbar-scroll {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
body.is-layout-workspace .layout-toolbar-scroll::-webkit-scrollbar { display: none; }
.layout-more-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
}


/* Stage 2 — canonical hover and selection synchronization */
.ls-layer-row.is-hovered:not(.is-selected),
.ls-layers-page.is-hovered:not(.is-selected) {
  border-color: #e48ab5;
  background: #fff7fb;
  box-shadow: 0 0 0 2px rgba(228, 138, 181, .12);
}
.ls-layer-row.is-hovered:not(.is-selected) .ls-layer-icon,
.ls-layers-page.is-hovered:not(.is-selected) .layout-component-icon {
  color: #a83d6e;
  background: #ffe5f1;
}
.ls-layer-row[aria-selected="true"] .ls-layer-select,
.ls-layers-page[aria-selected="true"] {
  font-weight: 700;
}

/* Stage 3 — simplified Carrd-like property schemas, LarSheen visual skin. */
body.is-layout-workspace .layout-component-properties {
  padding: 0 0 12px;
  background: #fffafd;
}
body.is-layout-workspace .ls-p4-content-panel {
  min-height: calc(100dvh - 72px);
  margin: 0;
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body.is-layout-workspace .ls-p4-content-heading {
  min-height: 68px;
  padding: 12px 14px;
  gap: 11px;
  border-bottom: 1px solid #eed0df;
  background: linear-gradient(180deg, #fffafd, #fff4f9);
}
body.is-layout-workspace .ls-p4-content-heading strong {
  font-size: 17px;
  color: #6c2f4e;
}
body.is-layout-workspace .ls-p4-content-heading small {
  margin-top: 2px;
  font-size: 10px;
  text-transform: capitalize;
}
body.is-layout-workspace .ls-p4-type-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border: 1px solid #e4aac7;
  border-radius: 12px;
  color: #a33d6f;
  background: #ffe2ef;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.ls-property-workspace {
  min-height: calc(100dvh - 140px);
  display: flex;
  flex-direction: column;
}
.ls-property-tabs {
  min-height: 58px;
  padding: 7px 8px 6px;
  position: sticky;
  z-index: 12;
  top: 72px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  border-bottom: 1px solid #e6b8cf;
  background: rgba(255, 244, 249, .97);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(104,42,72,.06);
}
.ls-property-tab {
  min-width: 0;
  min-height: 44px;
  padding: 5px 3px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  color: #8b6075;
  border-color: transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  font-size: 9px;
}
.ls-property-tab > span:first-child { font-size: 15px; line-height: 1; }
.ls-property-tab:hover { color: #7b3157; border-color: #edbfd5; background: #fff; }
.ls-property-tab.is-active,
.ls-property-tab[aria-selected="true"] {
  color: #fff;
  border-color: #c14b82;
  background: linear-gradient(180deg, #ed8fba, #cf5a91);
  box-shadow: 0 3px 9px rgba(151,54,100,.22);
}
.ls-property-tab-panels { flex: 1 1 auto; }
.ls-property-tab-panel {
  padding: 12px 11px 88px;
  display: grid;
  align-content: start;
  gap: 10px;
}
.ls-property-tab-panel[hidden] { display: none !important; }
.ls-property-card,
.ls-property-callout,
body.is-layout-workspace .ls-property-tab-panel > .ls-localized-field,
body.is-layout-workspace .ls-property-tab-panel > .ls-native-content-fallback,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-image-preview + .ls-p4-field {
  margin: 0;
  padding: 12px;
  display: grid;
  gap: 10px;
  border: 1px solid #e8c5d6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(106,42,73,.055);
}
.ls-property-card h3 {
  margin: 0;
  color: #71354f;
  font-size: 13px;
}
.ls-property-card-help,
.ls-property-callout p {
  margin: -3px 0 1px;
  color: #927687;
  font-size: 10px;
  line-height: 1.45;
}
.ls-property-callout {
  color: #6f3b55;
  border-style: dashed;
  background: #fff7fb;
}
.ls-property-callout strong { color: #7d3458; font-size: 13px; }
body.is-layout-workspace .ls-property-details,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group {
  margin: 0;
  overflow: hidden;
  border: 1px solid #e7c3d5;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(106,42,73,.045);
}
body.is-layout-workspace .ls-property-details > summary,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group > summary {
  min-height: 48px;
  padding: 10px 12px;
  color: #703650;
  background: linear-gradient(180deg, #fff, #fff5fa);
}
body.is-layout-workspace .ls-property-details[open] > summary,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group[open] > summary {
  border-bottom: 1px solid #efd5e2;
}
body.is-layout-workspace .ls-property-details > :not(summary),
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group > :not(summary) {
  margin: 10px 11px;
}
body.is-layout-workspace .ls-property-tab-panel .ls-p4-properties-group .ls-p4-properties-group {
  margin: 9px 0;
  box-shadow: none;
}
body.is-layout-workspace .ls-p4-field {
  gap: 6px;
  color: #6d4357;
  font-size: 11px;
}
body.is-layout-workspace .ls-p4-field > span:first-child,
body.is-layout-workspace .ls-localized-field legend {
  font-weight: 700;
}
body.is-layout-workspace .ls-p4-field input:not([type="checkbox"]):not([type="color"]):not([type="range"]),
body.is-layout-workspace .ls-p4-field select,
body.is-layout-workspace .ls-p4-field textarea,
body.is-layout-workspace .ls-responsive-property > input,
body.is-layout-workspace .ls-responsive-property > select {
  min-height: 42px;
  border-radius: 8px;
  border-color: #dcb1c6;
  background: #fffafd;
}
body.is-layout-workspace .ls-p4-field textarea { min-height: 112px; resize: vertical; }
body.is-layout-workspace .ls-p4-field input:focus,
body.is-layout-workspace .ls-p4-field select:focus,
body.is-layout-workspace .ls-p4-field textarea:focus {
  outline: 2px solid rgba(221, 92, 151, .28);
  border-color: #d85b96;
}
body.is-layout-workspace .ls-localized-field {
  padding: 11px;
  gap: 9px;
  border-color: #e8c5d6;
  border-radius: 12px;
  background: #fff;
}
body.is-layout-workspace .ls-localized-field legend {
  padding: 0 5px;
  color: #71354f;
}
body.is-layout-workspace .ls-rich-toolbar {
  padding: 8px;
  border: 1px solid #efd3e1;
  border-radius: 9px;
  background: #fff7fb;
}
body.is-layout-workspace .ls-p4-image-preview {
  width: 100%;
  max-height: 190px;
  object-fit: contain;
  padding: 7px;
  border: 1px solid #e4bfd2;
  border-radius: 12px;
  background: #fff;
}
.ls-property-toggle-grid,
.ls-property-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.ls-property-toggle-grid .ls-p4-field {
  min-height: 52px;
  padding: 8px;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  border: 1px solid #edd0de;
  border-radius: 9px;
  background: #fff7fb;
}
.ls-property-toggle-grid input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #d65b96;
}
.ls-property-action-grid button { min-height: 42px; }
.ls-property-footer {
  min-height: 78px;
  padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  position: sticky;
  z-index: 14;
  bottom: 0;
  margin-top: auto;
  display: grid;
  border-top: 1px solid #e3b0c9;
  background: rgba(255, 244, 249, .97);
  backdrop-filter: blur(10px);
  box-shadow: 0 -7px 18px rgba(92,36,63,.09);
}
.ls-property-done {
  width: 100%;
  min-height: 52px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 800;
}
body.is-layout-workspace .ls-responsive-tools { margin: 0; }
body.is-layout-workspace .ls-responsive-property { font-size: 11px; }
body.is-layout-workspace .ls-repeater-items { max-height: none; }

@media (max-width: 620px) {
  .ls-property-tabs { top: 72px; }
  .ls-property-tab { font-size: 10px; }
  .ls-property-tab > span:first-child { font-size: 17px; }
}


/* ==========================================================
   STAGE 4 — CONTEXTUAL ELEMENT NAVIGATION
   Breadcrumbs and nearby-element lists replace the permanently
   expanded full tree. The full hierarchy remains optional.
   ========================================================== */

#layout-component-list[data-stage4-contextual-navigation="true"] {
  display: block;
  padding: 12px;
}

.ls-context-root-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.ls-context-root-actions .ls-layers-page {
  min-width: 0;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ls-context-browser {
  display: grid;
  gap: 10px;
  margin: 8px 0 12px;
  padding: 10px;
  border: 1px solid #e5b7cd;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,247,251,.96)),
    #fffafd;
  box-shadow: 0 5px 18px rgba(112, 47, 78, .08);
}

.ls-context-breadcrumbs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 1px 6px;
  scrollbar-width: thin;
  scrollbar-color: #e4a7c4 transparent;
}

.ls-context-crumb {
  min-width: 0;
  min-height: 30px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid #e3bed0;
  border-radius: 999px;
  color: #7a3c59;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: none;
}

.ls-context-crumb > span:last-child {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ls-context-crumb:hover {
  border-color: #d66c9f;
  background: #fff1f8;
}

.ls-context-crumb.is-current {
  color: #fff;
  border-color: #b84278;
  background: linear-gradient(180deg, #e97db0, #c94f88);
}

.ls-context-separator {
  flex: 0 0 auto;
  color: #b67a97;
  font-weight: 800;
}

.ls-context-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 2px 2px 8px;
  border-bottom: 1px dashed #e7bfd2;
}

.ls-context-heading > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.ls-context-heading strong {
  min-width: 0;
  overflow: hidden;
  color: #6f3652;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ls-context-heading span {
  color: #967588;
  font-size: 10px;
  line-height: 1.4;
}

.ls-context-parent {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 5px 9px;
  font-size: 11px;
}

.ls-area-card-grid {
  display: grid;
  gap: 6px;
}

.ls-area-card {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  text-align: left;
  border: 1px solid #ead0dd;
  border-radius: 10px;
  color: #593647;
  background: #fff;
  box-shadow: none;
}

.ls-area-card:hover,
.ls-area-card.is-hovered:not(.is-selected) {
  border-color: #dc82ad;
  background: #fff4fa;
}

.ls-area-card.is-selected {
  border-color: #ce4e88;
  background: #ffedf6;
  box-shadow: 0 0 0 2px rgba(206, 78, 136, .12);
}

.ls-area-card-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #a34070;
  background: #f7d9e8;
}

.ls-area-card-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.ls-area-card-copy strong,
.ls-area-card-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ls-area-card-copy small {
  color: #967588;
  font-size: 10px;
}

.ls-area-card-count,
.ls-all-layers > summary small {
  min-width: 25px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #8b4567;
  background: #f4d9e6;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.ls-context-list {
  min-height: 54px;
  display: grid;
  gap: 4px;
  padding: 2px;
  border-radius: 10px;
}

.ls-context-list:empty {
  display: none;
}

.ls-context-empty {
  min-height: 90px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 14px;
  border: 1px dashed #e0a9c4;
  border-radius: 10px;
  color: #966b80;
  background: rgba(255, 242, 249, .66);
  text-align: center;
}

.ls-context-empty span {
  font-size: 22px;
}

.ls-context-empty p {
  margin: 0;
  max-width: 230px;
  font-size: 11px;
  line-height: 1.5;
}

.ls-all-layers {
  margin: 10px 0;
  border: 1px solid #e3bfd0;
  border-radius: 11px;
  background: rgba(255,255,255,.75);
  overflow: visible;
}

.ls-all-layers > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  list-style: none;
  cursor: pointer;
  color: #75405a;
  font-weight: 800;
  background: #fff4fa;
  border-radius: 10px;
}

.ls-all-layers[open] > summary {
  border-bottom: 1px solid #ead0dd;
  border-radius: 10px 10px 0 0;
}

.ls-all-layers > summary::-webkit-details-marker {
  display: none;
}

.ls-all-layers > summary::before {
  content: "›";
  color: #bc4e82;
  transition: transform 140ms ease;
}

.ls-all-layers[open] > summary::before {
  transform: rotate(90deg);
}

.ls-all-layers-body {
  padding: 4px 7px 8px;
}

.ls-selection-navigator {
  display: grid;
  gap: 7px;
  padding: 9px 12px;
  border-bottom: 1px solid #eac5d7;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,242,248,.96)),
    #fff8fc;
}

.ls-selection-navigator .ls-context-breadcrumbs {
  padding-bottom: 2px;
}

.ls-selection-stepper {
  display: grid;
  grid-template-columns: 34px 34px minmax(52px, 1fr) 34px;
  gap: 5px;
  align-items: center;
}

.ls-selection-step-button {
  min-width: 34px;
  min-height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 16px;
  line-height: 1;
}

.ls-selection-position {
  min-width: 0;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid #ebcfdd;
  border-radius: 999px;
  color: #8a6578;
  background: rgba(255,255,255,.8);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-layout-workspace .ls-selection-navigator + .ls-p4-content-heading {
  min-height: 62px;
}

@media (max-width: 620px) {
  .ls-context-browser {
    margin-inline: 0;
    border-radius: 12px;
  }

  .ls-context-crumb > span:last-child {
    max-width: 105px;
  }

  .ls-context-root-actions {
    grid-template-columns: 1fr 1fr;
  }

  .ls-selection-navigator {
    padding-inline: 10px;
  }
}

/* Stage 5 — fixed add menu and contextual movement feedback. */
.layout-add-menu { position: relative; flex: 0 0 auto; }
.layout-add-menu > summary {
  list-style: none; min-height: 38px; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid #c878a0; border-radius: 10px;
  color: #71324f; background: linear-gradient(#fff8fc, #fbdceb); font-weight: 800;
  cursor: pointer; box-shadow: 0 2px 6px rgba(94, 39, 66, .12);
}
.layout-add-menu > summary::-webkit-details-marker { display: none; }
.layout-add-menu[open] > summary { color: #fff; border-color: #9a2f63; background: linear-gradient(#e979ad, #c84680); }
.layout-add-popover {
  position: absolute; z-index: 90; top: calc(100% + 10px); right: 0; width: min(330px, calc(100vw - 30px));
  max-height: min(620px, calc(100vh - 90px)); overflow: auto; padding: 12px;
  border: 1px solid #c879a1; border-radius: 14px; color: #633047; background: rgba(255, 249, 252, .98);
  box-shadow: 0 12px 32px rgba(78, 31, 55, .24), 0 0 0 3px rgba(255,255,255,.72);
}
.layout-add-heading { display: grid; gap: 3px; padding: 3px 4px 10px; border-bottom: 1px dashed #e3b0ca; }
.layout-add-heading strong { font-size: 15px; }
.layout-add-heading span { color: #98607b; font-size: 11px; line-height: 1.35; }
.layout-add-popover section { margin-top: 11px; }
.layout-add-popover h3 { margin: 0 0 6px; color: #9b3f6c; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.layout-add-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.layout-add-grid button {
  min-height: 43px; display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border: 1px solid #d8a4bd; border-radius: 10px; color: #6e3450; background: #fff;
  font: inherit; font-weight: 750; text-align: left; cursor: pointer;
}
.layout-add-grid button:hover, .layout-add-grid button:focus-visible { border-color: #c84d86; background: #fff0f7; transform: translateY(-1px); }
.layout-add-grid button span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; color: #fff; background: #d65a91; font-weight: 900; }
.layout-selection-toolbar.is-flow-managed #layout-move-free,
.layout-selection-toolbar.is-flow-managed #layout-move-grid,
.layout-selection-toolbar.is-flow-managed #layout-snap-size-wrap { opacity: .42; }
.layout-selection-toolbar[data-positioning="vertical"] .layout-selection-movement-label::after { content: " Stack"; }
.layout-selection-toolbar[data-positioning="horizontal"] .layout-selection-movement-label::after { content: " Row"; }
.layout-selection-toolbar[data-positioning="grid"] .layout-selection-movement-label::after { content: " Grid"; }

.ls-add-tools { display: grid; gap: 10px; }
.ls-add-tool-group { display: grid; gap: 6px; }
.ls-add-tool-group > strong { color: #98516f; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.ls-add-tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ls-add-tool-grid button { min-width: 0; }

.ls-layer-row.is-layer-dragging { opacity: .45; }
.ls-layer-row.is-drop-before::before,
.ls-layer-row.is-drop-after::after {
  content: ""; position: absolute; z-index: 5; left: 8px; right: 8px; height: 3px;
  border-radius: 999px; background: #e34c91; box-shadow: 0 0 0 2px #fff;
}
.ls-layer-row.is-drop-before::before { top: -2px; }
.ls-layer-row.is-drop-after::after { bottom: -2px; }
.ls-layer-row.is-drop-inside { outline: 2px dashed #d44b8b; outline-offset: -3px; background: #fff0f7; }

@media (max-width: 760px) {
  .layout-add-popover { position: fixed; left: 10px; right: 10px; top: 68px; width: auto; }
  .layout-add-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout-add-grid button { justify-content: center; text-align: center; flex-direction: column; gap: 4px; }
}

/* ==========================================================
   STAGE 6 — MODERN CUTE VISUAL SKIN
   Carrd-inspired clarity with the existing LarSheen pink theme.
   This layer changes presentation only; document structure,
   commands, IDs, selection, movement, save, and export stay intact.
   ========================================================== */

body.editor-page.is-layout-workspace {
  --ls6-rose-50: #fff9fc;
  --ls6-rose-100: #fff0f7;
  --ls6-rose-150: #ffe7f2;
  --ls6-rose-200: #f8d2e4;
  --ls6-rose-300: #eeb0ce;
  --ls6-rose-400: #e584b2;
  --ls6-rose-500: #d85f98;
  --ls6-rose-600: #b94379;
  --ls6-ink: #553544;
  --ls6-muted: #8e6c7d;
  --ls6-line: rgba(183, 91, 135, .25);
  --ls6-card: rgba(255, 252, 254, .96);
  --ls6-glass: rgba(255, 250, 253, .89);
  --ls6-shadow-soft: 0 8px 26px rgba(92, 38, 64, .13);
  --ls6-shadow-float: 0 16px 44px rgba(92, 38, 64, .19);
  --ls6-radius-sm: 10px;
  --ls6-radius-md: 14px;
  --ls6-radius-lg: 19px;
  --stage1-drawer-width: min(378px, calc(100vw - 72px));
  color: var(--ls6-ink);
  background:
    radial-gradient(circle at 14% 18%, rgba(255,255,255,.75) 0 2px, transparent 2.5px) 0 0 / 31px 31px,
    linear-gradient(135deg, rgba(255,255,255,.35), transparent 46%),
    #f4ccdf;
}

body.is-layout-workspace *,
body.is-layout-workspace *::before,
body.is-layout-workspace *::after {
  scrollbar-color: #d98ab0 #fff0f7;
  scrollbar-width: thin;
}

body.is-layout-workspace *::-webkit-scrollbar { width: 10px; height: 10px; }
body.is-layout-workspace *::-webkit-scrollbar-track { background: #fff0f7; }
body.is-layout-workspace *::-webkit-scrollbar-thumb {
  border: 3px solid #fff0f7;
  border-radius: 999px;
  background: #d98ab0;
}

/* Global buttons and fields receive one consistent modern surface. */
body.is-layout-workspace button,
body.is-layout-workspace .file-button,
body.is-layout-workspace summary,
body.is-layout-workspace select,
body.is-layout-workspace input,
body.is-layout-workspace textarea {
  transition:
    color 135ms ease,
    background-color 135ms ease,
    border-color 135ms ease,
    box-shadow 135ms ease,
    transform 110ms ease,
    opacity 135ms ease;
}

body.is-layout-workspace button:not(.primary-button):not(.danger-button),
body.is-layout-workspace .file-button {
  border-color: #ddafc5;
  color: #693b52;
  background: linear-gradient(180deg, #fff, #fff2f8);
  box-shadow: 0 2px 7px rgba(94, 38, 66, .08);
}

body.is-layout-workspace button:not(:disabled):hover,
body.is-layout-workspace .file-button:hover {
  border-color: #d36d9e;
  background: #fff0f7;
  box-shadow: 0 5px 14px rgba(113, 43, 77, .12);
  transform: translateY(-1px);
}

body.is-layout-workspace button:active,
body.is-layout-workspace .file-button:active {
  transform: translateY(0) scale(.985);
}

body.is-layout-workspace button:disabled {
  opacity: .42;
  box-shadow: none;
  cursor: not-allowed;
}

body.is-layout-workspace button:focus-visible,
body.is-layout-workspace summary:focus-visible,
body.is-layout-workspace select:focus-visible,
body.is-layout-workspace input:focus-visible,
body.is-layout-workspace textarea:focus-visible {
  outline: 3px solid rgba(216, 95, 152, .24);
  outline-offset: 2px;
}

/* Compact workspace switcher — visually related to, but separate from, commands. */
body.is-layout-workspace .editor-tabs {
  padding: 6px;
  gap: 5px;
  border-color: var(--ls6-line);
  border-radius: var(--ls6-radius-lg);
  background: var(--ls6-glass);
  box-shadow: var(--ls6-shadow-float), inset 0 1px 0 rgba(255,255,255,.9);
}

body.is-layout-workspace .editor-tabs::before {
  content: "";
  width: 7px;
  height: 7px;
  position: absolute;
  top: 5px;
  right: 8px;
  border-radius: 50%;
  background: #f0a7c8;
  box-shadow: -10px 0 #f7cadf;
  pointer-events: none;
}

body.is-layout-workspace .editor-tabs button {
  min-height: 44px;
  padding: 7px 12px;
  border-radius: 12px;
  font-weight: 700;
}

body.is-layout-workspace .editor-tabs button.is-active {
  border-color: #b74478;
  background: linear-gradient(180deg, #ee95bd, #d45a94);
  box-shadow: 0 6px 16px rgba(171, 58, 112, .25), inset 0 1px 0 rgba(255,255,255,.45);
}

body.is-layout-workspace .editor-tabs button.is-active .editor-tab-icon {
  filter: drop-shadow(0 1px 0 rgba(111, 29, 69, .22));
}

/* Primary command bar. */
body.is-layout-workspace .layout-topbar {
  min-height: 58px;
  padding: 7px;
  gap: 6px;
  border-color: var(--ls6-line);
  border-radius: var(--ls6-radius-lg);
  background: var(--ls6-glass);
  box-shadow: var(--ls6-shadow-float), inset 0 1px 0 rgba(255,255,255,.9);
}

body.is-layout-workspace .layout-toolbar-scroll { gap: 5px; }

body.is-layout-workspace .layout-topbar button,
body.is-layout-workspace .layout-topbar summary {
  min-width: 43px;
  min-height: 42px;
  border-radius: 12px;
}

body.is-layout-workspace .layout-drawer-tab[aria-expanded="true"],
body.is-layout-workspace .layout-topbar button.is-active,
body.is-layout-workspace .device-switcher button.is-active,
.layout-add-menu[open] > summary,
.layout-more-menu[open] > summary {
  color: #fff;
  border-color: #aa376e;
  background: linear-gradient(180deg, #ed8db9, #ce4f89);
  box-shadow: 0 5px 14px rgba(155, 48, 99, .23), inset 0 1px 0 rgba(255,255,255,.35);
}

body.is-layout-workspace .layout-toolbar-divider {
  height: 28px;
  margin-inline: 3px;
  background: linear-gradient(transparent, #dfaec5 20%, #dfaec5 80%, transparent);
}

body.is-layout-workspace .layout-select-field {
  min-height: 42px;
  padding: 3px 4px 3px 8px;
  gap: 7px;
  border: 1px solid #ead0dd;
  border-radius: 12px;
  background: rgba(255,255,255,.72);
}

body.is-layout-workspace .layout-select-field > span {
  color: #96627c;
  letter-spacing: .04em;
}

body.is-layout-workspace .layout-select-field select {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background-color: #fff7fb;
  box-shadow: none;
  font-weight: 700;
}

body.is-layout-workspace .device-switcher {
  padding: 3px;
  border: 1px solid #ead0dd;
  border-radius: 12px;
  background: rgba(255,255,255,.7);
}

body.is-layout-workspace .device-switcher button {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

body.is-layout-workspace .layout-publish-actions .editor-status {
  border-color: #ead0dd;
  color: #81546a;
  background: #fff8fc;
  box-shadow: none;
}

body.is-layout-workspace .layout-publish-actions .editor-save-button {
  min-height: 42px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ed8fbb, #cb4d86);
  box-shadow: 0 5px 14px rgba(146, 43, 91, .24), inset 0 1px 0 rgba(255,255,255,.36);
}

/* Add and More popovers. */
.layout-add-popover,
.layout-more-popover,
.layout-guide-style-panel,
.ls-layer-menu {
  border-color: rgba(185, 73, 126, .42);
  border-radius: 17px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,247,251,.98));
  box-shadow: var(--ls6-shadow-float), 0 0 0 4px rgba(255,255,255,.62);
  animation: ls6-popover-in 140ms ease-out both;
}

@keyframes ls6-popover-in {
  from { opacity: 0; transform: translateY(-5px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.layout-add-heading {
  padding: 4px 5px 12px;
  border-bottom-color: #e9bfd2;
}

.layout-add-heading strong { color: #71344f; font-size: 16px; }
.layout-add-popover h3 { color: #a24975; }

.layout-add-grid button {
  min-height: 50px;
  border-color: #e6bfd2;
  background: rgba(255,255,255,.88);
  box-shadow: 0 2px 8px rgba(99, 38, 68, .06);
}

.layout-add-grid button span {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(180deg, #e880ae, #ca4b84);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.38);
}

/* Full-screen canvas and artboard framing. */
body.is-layout-workspace .layout-preview-viewport {
  padding: 94px 34px 102px;
  background:
    radial-gradient(circle at 10px 10px, rgba(255,255,255,.56) 0 1.5px, transparent 2px) 0 0 / 24px 24px,
    linear-gradient(rgba(222, 157, 187, .1) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(222, 157, 187, .1) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(135deg, #f7edf2, #eee5ea);
}

body.is-layout-workspace .layout-preview-scaler {
  overflow: visible;
  border: 1px solid rgba(119, 66, 90, .24);
  border-radius: 5px;
  background: #fff;
  box-shadow:
    0 24px 60px rgba(65, 33, 48, .23),
    0 0 0 5px rgba(255,255,255,.72),
    0 0 0 6px rgba(187, 116, 149, .18);
}

body.is-layout-workspace .layout-preview-scaler::before {
  content: "";
  height: 8px;
  position: absolute;
  left: 14px;
  right: 14px;
  top: -13px;
  border-radius: 999px;
  background: rgba(203, 92, 143, .14);
  filter: blur(3px);
  pointer-events: none;
}

/* Bottom context toolbar behaves like one quiet control tray. */
body.is-layout-workspace .layout-canvas-toolbar {
  min-height: 58px;
  padding: 7px;
  gap: 7px;
  border-color: var(--ls6-line);
  border-radius: var(--ls6-radius-lg);
  background: var(--ls6-glass);
  box-shadow: var(--ls6-shadow-float), inset 0 1px 0 rgba(255,255,255,.9);
}

body.is-layout-workspace .layout-canvas-toolbar > #layout-preview-label {
  max-width: 180px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid #ead0dd;
  border-radius: 11px;
  color: #78445d;
  background: rgba(255,255,255,.75);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-layout-workspace .layout-canvas-toolbar > label,
body.is-layout-workspace .layout-guide-style > summary {
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid #e5bfd1;
  border-radius: 11px;
  color: #77455d;
  background: rgba(255,255,255,.76);
}

body.is-layout-workspace .layout-canvas-toolbar select,
body.is-layout-workspace .layout-canvas-toolbar input[type="number"] {
  min-height: 30px;
  border-color: #dfb1c7;
  border-radius: 8px;
  background: #fffafd;
}

body.is-layout-workspace .layout-selection-toolbar {
  min-height: 42px;
  padding: 4px;
  gap: 5px;
  border-color: #e4b7cd;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.84), rgba(255,239,247,.84));
  box-shadow: none;
}

body.is-layout-workspace .layout-selection-toolbar-label {
  padding-inline: 6px;
  color: #79435c;
}

body.is-layout-workspace .layout-selection-toolbar.is-disabled {
  border-style: dashed;
  background: rgba(244,239,242,.82);
}

/* Sliding drawers. */
body.is-layout-workspace .layout-sidebar.layout-drawer {
  border-right: 1px solid rgba(183, 91, 135, .28);
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,246,251,.98));
  box-shadow: 16px 0 42px rgba(76, 29, 53, .17);
}

body.is-layout-workspace .layout-sidebar.layout-drawer::after {
  content: "";
  width: 5px;
  position: absolute;
  top: 0;
  right: -1px;
  bottom: 0;
  background: linear-gradient(180deg, #ed96be, #d75d97 44%, #f3bbd4);
  opacity: .42;
  pointer-events: none;
}

body.is-layout-workspace .layout-panel-heading {
  min-height: 76px;
  padding: 13px 15px;
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom-color: #eac4d6;
  background:
    radial-gradient(circle at 18px 16px, rgba(231, 122, 172, .18) 0 3px, transparent 3.5px),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,241,248,.98));
  box-shadow: 0 5px 18px rgba(96, 36, 66, .07);
}

body.is-layout-workspace .layout-panel-heading strong {
  color: #69324e;
  font-size: 19px;
  letter-spacing: .01em;
}

body.is-layout-workspace .layout-panel-heading span {
  color: #987486;
  line-height: 1.35;
}

body.is-layout-workspace .layout-drawer-close {
  min-width: 38px;
  min-height: 38px;
  color: #8b4568;
  border-color: #e3b9cd;
  background: rgba(255,255,255,.82);
  box-shadow: none;
}

body.is-layout-workspace .layout-drawer-close:hover {
  color: #fff;
  border-color: #b63d74;
  background: #cf548c;
  transform: rotate(4deg);
}

/* Elements navigator. */
body.is-layout-workspace .layout-component-list {
  padding: 12px 12px 24px;
  background: transparent;
}

.ls-layers-top,
.ls-context-browser,
.ls-all-layers {
  border-color: #e8c6d6;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 4px 16px rgba(94, 37, 65, .055);
}

.ls-context-browser { padding: 11px; }

.ls-context-breadcrumbs {
  padding: 2px 1px 8px;
  gap: 4px;
}

.ls-context-crumb {
  min-height: 30px;
  border-color: #e6bfd2;
  background: rgba(255,255,255,.88);
  box-shadow: none;
}

.ls-context-crumb.is-current {
  border-color: #b93e76;
  background: linear-gradient(180deg, #e982b0, #ca4d85);
}

.ls-area-card,
.ls-layer-row,
.layout-component-button {
  border-color: #ead0dc;
  border-radius: 11px;
  background: rgba(255,255,255,.9);
  box-shadow: none;
}

.ls-area-card:hover,
.ls-layer-row:hover,
.layout-component-button:hover,
.ls-area-card.is-hovered:not(.is-selected),
.ls-layer-row.is-hovered:not(.is-selected) {
  border-color: #d97aaa;
  background: #fff3f9;
  box-shadow: 0 4px 12px rgba(112, 40, 76, .08);
}

.ls-area-card.is-selected,
.ls-layer-row.is-selected,
.layout-component-button.is-selected {
  color: #6d3150;
  border-color: #ce4f88;
  background: linear-gradient(180deg, #fff2f8, #ffe5f1);
  box-shadow: 0 0 0 2px rgba(206,79,136,.11), 0 5px 13px rgba(126,43,83,.1);
}

.ls-layer-row.is-selected .ls-layer-icon,
.layout-component-button.is-selected .layout-component-icon,
.ls-area-card.is-selected .ls-area-card-icon {
  color: #fff;
  background: linear-gradient(180deg, #e77dad, #ca4b84);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}

.ls-context-empty {
  min-height: 106px;
  border-color: #dda2be;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(255,249,252,.94), rgba(255,237,246,.75));
}

.ls-all-layers > summary {
  border-radius: 13px;
  background: linear-gradient(180deg, #fff, #fff2f8);
}

/* Properties: clear hierarchy, softer cards, compact advanced controls. */
body.is-layout-workspace .layout-component-properties {
  background:
    linear-gradient(180deg, #fffafd, #fff5fa);
}

body.is-layout-workspace .ls-p4-content-heading {
  min-height: 72px;
  padding: 13px 15px;
  border-bottom-color: #eac4d6;
  background: linear-gradient(180deg, #fff, #fff4f9);
}

body.is-layout-workspace .ls-p4-type-icon {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-color: #dda7c1;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(180deg, #ea8ab6, #ce5089);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.42), 0 4px 12px rgba(128,43,84,.14);
}

.ls-property-tabs {
  min-height: 62px;
  padding: 8px;
  top: 76px;
  gap: 5px;
  border-bottom-color: #e8bfd2;
  background: rgba(255,247,251,.95);
  box-shadow: 0 5px 15px rgba(94,37,65,.055);
}

.ls-property-tab {
  min-height: 46px;
  border-radius: 11px;
  font-size: 9px;
  font-weight: 800;
}

.ls-property-tab > span:first-child { font-size: 16px; }

.ls-property-tab.is-active,
.ls-property-tab[aria-selected="true"] {
  border-color: #b63d74;
  background: linear-gradient(180deg, #e989b6, #cd4e87);
  box-shadow: 0 5px 13px rgba(149,48,96,.2), inset 0 1px 0 rgba(255,255,255,.38);
}

.ls-property-tab-panel {
  padding: 13px 12px 96px;
  gap: 11px;
}

.ls-property-card,
.ls-property-callout,
body.is-layout-workspace .ls-property-tab-panel > .ls-localized-field,
body.is-layout-workspace .ls-property-details,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group {
  border-color: #e8c7d7;
  border-radius: 14px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 4px 15px rgba(101,39,69,.055);
}

.ls-property-card h3 { color: #6b334e; font-size: 13px; }

body.is-layout-workspace .ls-property-details > summary,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group > summary {
  min-height: 50px;
  border-radius: 13px;
  background: linear-gradient(180deg, #fff, #fff5fa);
}

body.is-layout-workspace .ls-p4-field input:not([type="checkbox"]):not([type="color"]):not([type="range"]),
body.is-layout-workspace .ls-p4-field select,
body.is-layout-workspace .ls-p4-field textarea,
body.is-layout-workspace .ls-responsive-property > input,
body.is-layout-workspace .ls-responsive-property > select,
body.is-layout-workspace .ls-layer-field input,
body.is-layout-workspace .ls-layer-field select {
  min-height: 43px;
  border: 1px solid #ddb2c7;
  border-radius: 10px;
  color: #553544;
  background: #fffafd;
  box-shadow: inset 0 1px 2px rgba(93,36,64,.045);
}

body.is-layout-workspace input[type="range"] { accent-color: var(--ls6-rose-500); }
body.is-layout-workspace input[type="checkbox"] { accent-color: var(--ls6-rose-500); }

.ls-selection-navigator {
  padding: 10px 13px;
  border-bottom-color: #e8bfd2;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,243,249,.98));
}

.ls-selection-step-button {
  border-radius: 10px;
  box-shadow: none;
}

.ls-selection-position {
  border-color: #e8c6d6;
  background: rgba(255,255,255,.9);
}

/* Empty property state is intentionally calm and helpful. */
body.is-layout-workspace .empty-selection {
  min-height: calc(100dvh - 92px);
  padding: 30px 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: #8f6a7c;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(245,190,216,.22), transparent 42%);
}

body.is-layout-workspace .empty-selection > span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid #e3b6cc;
  border-radius: 18px;
  color: #b34b7d;
  background: #fff2f8;
  font-size: 25px;
  box-shadow: 0 7px 19px rgba(111,42,76,.1);
}

body.is-layout-workspace .empty-selection p {
  max-width: 260px;
  margin: 0;
  line-height: 1.55;
}

/* Other editor sections retain the same design language when leaving Design. */
body.is-layout-workspace .editor-panel:not(.layout-editor-panel) {
  width: 100%;
  height: 100dvh;
  padding: 92px max(22px, calc((100vw - 1120px) / 2)) 36px;
  overflow: auto;
  background:
    radial-gradient(circle at 12px 12px, rgba(255,255,255,.62) 0 2px, transparent 2.5px) 0 0 / 26px 26px,
    linear-gradient(135deg, #f7d9e7, #f0c9db);
}

body.is-layout-workspace .editor-panel:not(.layout-editor-panel) > * {
  max-width: 1120px;
  margin-inline: auto;
}

body.is-layout-workspace .editor-panel:not(.layout-editor-panel) .editor-section,
body.is-layout-workspace .editor-panel:not(.layout-editor-panel) .entry-card,
body.is-layout-workspace .editor-panel:not(.layout-editor-panel) .export-card,
body.is-layout-workspace .editor-panel:not(.layout-editor-panel) .preview-toolbar {
  border-color: rgba(184, 92, 135, .28);
  border-radius: 17px;
  background: rgba(255,252,254,.96);
  box-shadow: var(--ls6-shadow-soft);
}

body.is-layout-workspace .editor-panel:not(.layout-editor-panel) .entry-card { overflow: hidden; }
body.is-layout-workspace .editor-panel:not(.layout-editor-panel) .entry-card-header {
  background: linear-gradient(180deg, #fff2f8, #ffe6f1);
}

/* Responsive refinement keeps controls reachable without changing behavior. */
@media (max-width: 1400px) {
  body.is-layout-workspace .layout-topbar { max-width: calc(100vw - 250px); }
  body.is-layout-workspace .layout-canvas-toolbar { max-width: calc(100vw - 28px); }
}

@media (max-width: 1040px) {
  body.is-layout-workspace .layout-select-field { padding-left: 4px; }
  body.is-layout-workspace .layout-topbar { max-width: calc(100vw - 216px); }
}

@media (max-width: 860px) {
  body.editor-page.is-layout-workspace { --stage1-drawer-width: min(360px, calc(100vw - 58px)); }
  body.is-layout-workspace .layout-preview-viewport { padding: 86px 16px 98px 80px; }
  body.is-layout-workspace .layout-sidebar.layout-drawer { border-radius: 0 20px 20px 0; }
  body.is-layout-workspace .layout-canvas-toolbar { border-radius: 16px; }
}

@media (max-width: 620px) {
  body.editor-page.is-layout-workspace { --stage1-drawer-width: 100vw; }
  body.is-layout-workspace .editor-tabs { border-radius: 16px; }
  body.is-layout-workspace .layout-topbar { border-radius: 16px; }
  body.is-layout-workspace .layout-sidebar.layout-drawer { border-radius: 0; }
  body.is-layout-workspace .layout-sidebar.layout-drawer::after { display: none; }
  body.is-layout-workspace .layout-panel-heading { min-height: 70px; }
  body.is-layout-workspace .layout-preview-viewport { padding-bottom: 92px; }
  .layout-add-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout-add-grid button { min-height: 58px; }
  .ls-property-tabs { top: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  .layout-add-popover,
  .layout-more-popover,
  .layout-guide-style-panel,
  .ls-layer-menu { animation: none; }
}

/* ==========================================================
   TOOLBAR ARRANGEMENT PATCH
   Compact icon commands and contextual actions in More menu.
   ========================================================== */
body.is-layout-workspace .layout-icon-button {
  width: 42px;
  min-width: 42px;
  padding-inline: 0;
  flex: 0 0 42px;
}

body.is-layout-workspace .layout-toolbar-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.is-layout-workspace .layout-toolbar-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.is-layout-workspace .layout-toolbar-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  font-size: 23px;
  line-height: 1;
}

body.is-layout-workspace .layout-preview-glyph {
  padding-left: 2px;
  font-size: 21px;
}

body.is-layout-workspace .device-switcher {
  gap: 2px;
}

body.is-layout-workspace .layout-history-actions {
  gap: 2px;
}

.layout-more-popover {
  width: min(330px, calc(100vw - 28px));
  gap: 12px;
}

.layout-more-popover > strong {
  color: #71344f;
  font-size: 16px;
}

.layout-more-section {
  display: grid;
  gap: 7px;
}

.layout-more-section + .layout-more-section {
  padding-top: 10px;
  border-top: 1px solid #edcadb;
}

.layout-more-section-title {
  color: #a14d76;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.layout-more-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

body.is-layout-workspace .layout-more-popover .layout-more-action {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 7px 9px;
  position: static;
  inset: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  writing-mode: horizontal-tb;
  color: #753d58;
  border: 1px solid #e5bed1;
  border-radius: 11px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 2px 8px rgba(99, 38, 68, .06);
}

body.is-layout-workspace .layout-more-popover .layout-more-action:hover,
body.is-layout-workspace .layout-more-popover .layout-more-action:focus-visible {
  color: #8f2f60;
  border-color: #dc8fb4;
  background: #fff0f7;
}

body.is-layout-workspace .layout-more-popover .layout-more-action[aria-expanded="true"],
body.is-layout-workspace .layout-more-popover .layout-more-action.is-active {
  color: #fff;
  border-color: #aa376e;
  background: linear-gradient(180deg, #ed8db9, #ce4f89);
}

body.is-layout-workspace .layout-more-popover .layout-more-action > span:first-child {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #a43e70;
  background: #ffe5f1;
  font-family: Arial, sans-serif;
  font-size: 16px;
}

body.is-layout-workspace .layout-more-popover .layout-more-action[aria-expanded="true"] > span:first-child,
body.is-layout-workspace .layout-more-popover .layout-more-action.is-active > span:first-child {
  color: #fff;
  background: rgba(255,255,255,.18);
}

.layout-more-recovery p {
  margin: 0;
}

body.is-layout-workspace .layout-canvas-toolbar > #layout-preview-label {
  max-width: 150px;
}

body.is-layout-workspace .layout-selection-toolbar {
  min-width: 0;
}

body.is-layout-workspace .layout-selection-movement-label {
  padding-inline: 6px 2px;
  color: #79435c;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .layout-more-action-grid { grid-template-columns: 1fr; }
}

/* ==========================================================
   STABLE DRAWER RESERVE + COMPACT BOTTOM TOOLBAR PATCH
   The desktop canvas always reserves the left drawer width, so opening
   Elements or Properties does not change the artboard scale or viewport.
   ========================================================== */
@media (min-width: 861px) {
  body.is-layout-workspace .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-components-open .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-canvas-column {
    width: calc(100% - var(--stage1-drawer-width));
    margin-left: var(--stage1-drawer-width);
    transition: none;
  }

  body.is-layout-workspace .layout-canvas-toolbar,
  body.is-layout-workspace.is-editor-drawer-open .layout-canvas-toolbar {
    left: calc(50% + (var(--stage1-drawer-width) / 2));
    max-width: calc(100vw - var(--stage1-drawer-width) - 28px);
    transition: none;
  }
}

body.is-layout-workspace .layout-canvas-toolbar {
  min-height: 46px;
  padding: 4px;
  gap: 4px;
  border-radius: 13px;
}

body.is-layout-workspace .layout-canvas-toolbar > #layout-preview-label {
  max-width: 132px;
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 11px;
}

body.is-layout-workspace .layout-canvas-toolbar > label,
body.is-layout-workspace .layout-guide-style > summary,
body.is-layout-workspace .layout-bottom-icon-button {
  min-height: 34px;
  padding: 4px 7px;
  border-radius: 9px;
}

body.is-layout-workspace .layout-canvas-toolbar select,
body.is-layout-workspace .layout-canvas-toolbar input[type="number"] {
  min-height: 26px;
  border-radius: 7px;
}

body.is-layout-workspace .layout-canvas-toolbar > label:first-of-type {
  gap: 4px;
}

body.is-layout-workspace .layout-canvas-toolbar > label:first-of-type select {
  width: 62px;
  padding: 3px 22px 3px 7px;
}

body.is-layout-workspace .layout-guide-toggle {
  gap: 5px;
  padding-inline: 7px;
}

body.is-layout-workspace .layout-guide-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
}

body.is-layout-workspace .layout-guide-size {
  gap: 4px;
  padding-inline: 6px;
}

body.is-layout-workspace .layout-guide-size-label {
  color: #8a5870;
  font-size: 10px;
  font-weight: 700;
}

body.is-layout-workspace .layout-guide-size input {
  width: 42px;
  min-height: 25px;
}

body.is-layout-workspace .layout-guide-style {
  min-height: 34px;
  flex: 0 0 auto;
}

body.is-layout-workspace .layout-guide-style > summary {
  width: 34px;
  min-width: 34px;
  padding: 0;
  justify-content: center;
}

body.is-layout-workspace .layout-guide-style > summary::after {
  content: none;
}

body.is-layout-workspace .layout-guide-settings-icon {
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 1;
}

body.is-layout-workspace .layout-guide-style-panel {
  top: auto;
  right: 0;
  bottom: calc(100% + 8px);
  transform-origin: right bottom;
  animation: ls-guide-popover-up 140ms ease-out both;
}

@keyframes ls-guide-popover-up {
  from { opacity: 0; transform: translateY(5px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

body.is-layout-workspace .layout-bottom-icon-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #77455d;
  border: 1px solid #e5bfd1;
  background: rgba(255,255,255,.76);
  box-shadow: none;
}

body.is-layout-workspace .layout-bottom-icon-button:hover,
body.is-layout-workspace .layout-bottom-icon-button:focus-visible {
  color: #8f2f60;
  border-color: #dc8fb4;
  background: #fff0f7;
}

body.is-layout-workspace .layout-bottom-icon-button > span {
  font-family: Arial, sans-serif;
  font-size: 18px;
  line-height: 1;
}

body.is-layout-workspace .layout-selection-toolbar {
  min-height: 36px;
  padding: 3px;
  gap: 3px;
  border-radius: 10px;
}

body.is-layout-workspace .layout-selection-movement-label {
  padding-inline: 5px 2px;
  font-size: 10px;
}

body.is-layout-workspace .layout-selection-toolbar button {
  min-height: 30px;
  padding: 4px 8px;
}

body.is-layout-workspace .layout-selection-snap {
  min-height: 30px;
  padding: 2px 5px;
  gap: 4px;
}

body.is-layout-workspace .layout-selection-snap input {
  width: 43px;
  min-height: 24px;
}

@media (max-width: 860px) {
  body.is-layout-workspace .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-components-open .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-canvas-column {
    width: 100%;
    margin-left: 0;
  }

  body.is-layout-workspace .layout-canvas-toolbar,
  body.is-layout-workspace.is-editor-drawer-open .layout-canvas-toolbar {
    left: 50%;
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 620px) {
  body.is-layout-workspace .layout-guide-style-panel {
    left: auto;
    right: 0;
  }
}

/* ==========================================================
   COMPACT CARRD-INSPIRED PROPERTIES PATCH
   Keeps LarSheen styling while reducing repeated navigation,
   oversized tabs, cards, fields, spacing, and footer height.
   ========================================================== */
body.is-layout-workspace .layout-properties-panel .layout-panel-heading {
  min-height: 58px;
  padding: max(8px, env(safe-area-inset-top)) 11px 7px;
  gap: 8px;
  box-shadow: 0 3px 12px rgba(96, 36, 66, .055);
}

body.is-layout-workspace .layout-properties-panel .layout-panel-heading strong {
  font-size: 17px;
  line-height: 1.05;
}

body.is-layout-workspace .layout-properties-panel .layout-panel-heading span {
  max-width: 286px;
  margin-top: 1px;
  font-size: 9px;
  line-height: 1.2;
}

body.is-layout-workspace .layout-properties-panel .layout-drawer-close {
  min-width: 34px;
  min-height: 34px;
  width: 34px;
  height: 34px;
  font-size: 18px;
}

body.is-layout-workspace .layout-component-properties {
  padding: 0;
}

body.is-layout-workspace .ls-p4-content-panel {
  min-height: calc(100dvh - 58px);
}

body.is-layout-workspace .ls-p4-content-heading {
  min-height: 54px;
  padding: 7px 9px;
  gap: 8px;
  align-items: center;
  border-bottom-color: #e8c5d6;
  background: linear-gradient(180deg, #fff, #fff6fa);
}

body.is-layout-workspace .ls-p4-content-heading-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 1px;
}

body.is-layout-workspace .ls-p4-content-heading-copy strong {
  overflow: hidden;
  color: #68304c;
  font-size: 15px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-layout-workspace .ls-p4-content-heading-copy small {
  margin: 0;
  overflow: hidden;
  color: #9a7688;
  font-size: 9px;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

body.is-layout-workspace .ls-p4-type-icon {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-radius: 10px;
  font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.42), 0 3px 8px rgba(128,43,84,.11);
}

body.is-layout-workspace .ls-p4-content-heading .ls-selection-navigator {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  display: block;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.is-layout-workspace .ls-p4-content-heading .ls-selection-stepper {
  display: grid;
  grid-template-columns: repeat(3, 29px);
  gap: 3px;
}

body.is-layout-workspace .ls-p4-content-heading .ls-selection-step-button {
  min-width: 29px;
  width: 29px;
  min-height: 29px;
  height: 29px;
  padding: 0;
  border-radius: 8px;
  font-size: 14px;
  background: rgba(255,255,255,.78);
}

body.is-layout-workspace .ls-p4-content-heading .ls-selection-position {
  display: none;
}

body.is-layout-workspace .ls-property-workspace {
  min-height: calc(100dvh - 112px);
}

body.is-layout-workspace .ls-property-tabs {
  min-height: 48px;
  padding: 4px 7px;
  top: 58px;
  gap: 4px;
  grid-auto-columns: 42px;
  justify-content: start;
  border-bottom-color: #e5bdd0;
  background: rgba(255,247,251,.98);
  box-shadow: 0 3px 10px rgba(94,37,65,.045);
}

body.is-layout-workspace .ls-property-tab {
  width: 42px;
  min-width: 42px;
  min-height: 38px;
  height: 38px;
  padding: 0;
  border-radius: 9px;
}

body.is-layout-workspace .ls-property-tab > span:first-child {
  font-size: 16px;
  line-height: 1;
}

body.is-layout-workspace .ls-property-tab > span:last-child {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

body.is-layout-workspace .ls-property-tab.is-active,
body.is-layout-workspace .ls-property-tab[aria-selected="true"] {
  box-shadow: 0 3px 8px rgba(149,48,96,.17), inset 0 1px 0 rgba(255,255,255,.36);
}

body.is-layout-workspace .ls-property-tab-panel {
  padding: 8px 8px 70px;
  gap: 7px;
}

body.is-layout-workspace .ls-property-card,
body.is-layout-workspace .ls-property-callout,
body.is-layout-workspace .ls-property-tab-panel > .ls-localized-field,
body.is-layout-workspace .ls-property-tab-panel > .ls-native-content-fallback,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-image-preview + .ls-p4-field,
body.is-layout-workspace .ls-property-details,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group {
  padding: 8px;
  gap: 7px;
  border-radius: 10px;
  box-shadow: none;
}

body.is-layout-workspace .ls-property-card h3 {
  font-size: 12px;
}

body.is-layout-workspace .ls-property-card-help,
body.is-layout-workspace .ls-property-callout p {
  margin: -1px 0 0;
  font-size: 9px;
  line-height: 1.35;
}

body.is-layout-workspace .ls-property-details,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group {
  padding: 0;
  overflow: hidden;
}

body.is-layout-workspace .ls-property-details > summary,
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group > summary {
  min-height: 38px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 11px;
}

body.is-layout-workspace .ls-property-details > :not(summary),
body.is-layout-workspace .ls-property-tab-panel > .ls-p4-properties-group > :not(summary) {
  margin: 7px 8px;
}

body.is-layout-workspace .ls-property-tab-panel .ls-p4-properties-group .ls-p4-properties-group {
  margin: 6px 0;
}

body.is-layout-workspace .ls-p4-field,
body.is-layout-workspace .ls-responsive-property {
  gap: 4px;
  font-size: 10px;
}

body.is-layout-workspace .ls-p4-field input:not([type="checkbox"]):not([type="color"]):not([type="range"]),
body.is-layout-workspace .ls-p4-field select,
body.is-layout-workspace .ls-p4-field textarea,
body.is-layout-workspace .ls-responsive-property > input,
body.is-layout-workspace .ls-responsive-property > select {
  min-height: 34px;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 11px;
}

body.is-layout-workspace .ls-p4-field textarea {
  min-height: 82px;
  line-height: 1.28;
}

body.is-layout-workspace .ls-localized-field {
  padding: 7px 8px 8px;
  gap: 6px;
  border-radius: 10px;
}

body.is-layout-workspace .ls-localized-field legend {
  padding: 0 4px;
  font-size: 12px;
}

body.is-layout-workspace .ls-rich-toolbar {
  padding: 5px;
  gap: 4px;
  border-radius: 7px;
}

body.is-layout-workspace .ls-rich-toolbar button,
body.is-layout-workspace .ls-rich-toolbar select,
body.is-layout-workspace .ls-rich-toolbar input {
  min-height: 30px;
}

body.is-layout-workspace .ls-p4-image-preview {
  max-height: 140px;
  padding: 5px;
  border-radius: 9px;
}

body.is-layout-workspace .ls-property-toggle-grid,
body.is-layout-workspace .ls-property-action-grid {
  gap: 5px;
}

body.is-layout-workspace .ls-property-toggle-grid .ls-p4-field {
  min-height: 43px;
  padding: 6px;
  border-radius: 7px;
}

body.is-layout-workspace .ls-property-action-grid button {
  min-height: 35px;
}

body.is-layout-workspace .ls-property-footer {
  min-height: 58px;
  padding: 7px 9px max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 12px rgba(92,36,63,.065);
}

body.is-layout-workspace .ls-property-done {
  min-height: 43px;
  border-radius: 9px;
  font-size: 14px;
}

@media (max-width: 620px) {
  body.is-layout-workspace .layout-properties-panel .layout-panel-heading {
    min-height: 56px;
  }

  body.is-layout-workspace .ls-property-tabs {
    top: 56px;
  }
}

/* ==========================================================
   COMPACT COMMAND BARS + CARRD-LIKE PROPERTY CONTROLS
   Keeps the LarSheen visual language while making both toolbars,
   property actions, and bounded numeric controls consistently compact.
   ========================================================== */
body.is-layout-workspace .layout-topbar {
  min-height: 50px;
  padding: 5px;
  gap: 4px;
  overflow: visible;
}

body.is-layout-workspace .layout-toolbar-scroll {
  gap: 4px;
  overflow: visible;
}

body.is-layout-workspace .layout-topbar button,
body.is-layout-workspace .layout-topbar summary,
body.is-layout-workspace .device-switcher button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
}

body.is-layout-workspace .layout-toolbar-button-label,
body.is-layout-workspace .layout-publish-actions .editor-status {
  display: none !important;
}

body.is-layout-workspace .layout-publish-actions,
body.is-layout-workspace .layout-publish-actions .editor-save-button,
body.is-layout-workspace .layout-add-menu > summary,
body.is-layout-workspace .layout-more-menu > summary {
  width: 38px;
  min-width: 38px !important;
  height: 38px;
  min-height: 38px;
}

body.is-layout-workspace .layout-select-field {
  min-height: 38px;
  padding: 2px 3px 2px 7px;
  gap: 5px;
  border-radius: 10px;
}

body.is-layout-workspace .layout-select-field select {
  min-height: 32px;
  border-radius: 7px;
}

body.is-layout-workspace .device-switcher {
  padding: 2px;
  gap: 2px;
  border-radius: 10px;
}

body.is-layout-workspace .device-switcher button {
  min-height: 32px;
  height: 32px;
}

body.is-layout-workspace .layout-history-actions { gap: 2px; }
body.is-layout-workspace .layout-toolbar-divider { height: 25px; margin-inline: 1px; }

/* Align the lower tray to the same right-hand anchor as the top command bar. */
body.is-layout-workspace .layout-canvas-toolbar,
body.is-layout-workspace.is-editor-drawer-open .layout-canvas-toolbar {
  left: auto;
  right: max(16px, env(safe-area-inset-right));
  transform: none;
  overflow: visible;
}

@media (min-width: 861px) {
  body.is-layout-workspace .layout-canvas-toolbar,
  body.is-layout-workspace.is-editor-drawer-open .layout-canvas-toolbar {
    left: auto;
    right: max(16px, env(safe-area-inset-right));
    max-width: calc(100vw - var(--stage1-drawer-width) - 32px);
  }
}

@media (max-width: 860px) {
  body.is-layout-workspace .layout-canvas-toolbar,
  body.is-layout-workspace.is-editor-drawer-open .layout-canvas-toolbar {
    left: auto;
    right: max(12px, env(safe-area-inset-right));
    max-width: calc(100vw - 24px);
  }
}

/* The upward guide popover must escape the toolbar instead of being clipped. */
body.is-layout-workspace .layout-guide-style {
  z-index: 2200;
  overflow: visible;
}

body.is-layout-workspace .layout-guide-style-panel {
  z-index: 2300;
  display: grid;
  visibility: visible;
  overflow: visible;
}

/* Properties never scroll sideways, even with long paths or nested controls. */
body.is-layout-workspace .layout-properties-panel,
body.is-layout-workspace .layout-component-properties,
body.is-layout-workspace .ls-p4-content-panel,
body.is-layout-workspace .ls-property-workspace,
body.is-layout-workspace .ls-property-tabs,
body.is-layout-workspace .ls-property-tab-panels,
body.is-layout-workspace .ls-property-tab-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden !important;
  box-sizing: border-box;
}

body.is-layout-workspace .layout-properties-panel *,
body.is-layout-workspace .layout-properties-panel *::before,
body.is-layout-workspace .layout-properties-panel *::after {
  box-sizing: border-box;
}

body.is-layout-workspace .layout-properties-panel .layout-panel-heading > div,
body.is-layout-workspace .ls-p4-content-heading,
body.is-layout-workspace .ls-p4-content-heading-copy,
body.is-layout-workspace .ls-property-card,
body.is-layout-workspace .ls-property-details,
body.is-layout-workspace .ls-p4-properties-group,
body.is-layout-workspace .ls-p4-field,
body.is-layout-workspace .ls-responsive-property,
body.is-layout-workspace .ls-p4-grid-2 > *,
body.is-layout-workspace .ls-property-toggle-grid > *,
body.is-layout-workspace .ls-property-action-grid > * {
  min-width: 0;
  max-width: 100%;
}

body.is-layout-workspace .layout-properties-panel input,
body.is-layout-workspace .layout-properties-panel select,
body.is-layout-workspace .layout-properties-panel textarea,
body.is-layout-workspace .layout-properties-panel button {
  max-width: 100%;
}

body.is-layout-workspace .layout-properties-panel .layout-panel-heading span,
body.is-layout-workspace .ls-p4-content-heading-copy strong,
body.is-layout-workspace .ls-p4-content-heading-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Carrd-like bounded numeric control: slider plus a compact exact value box. */
body.is-layout-workspace .ls-range-control {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(68px, 1fr) 58px;
  align-items: center;
  gap: 7px;
}

body.is-layout-workspace .ls-range-control input[type="range"] {
  width: 100%;
  min-width: 0;
  height: 24px;
  margin: 0;
  padding: 0;
  accent-color: #d65b96;
  background: transparent;
}

body.is-layout-workspace .ls-range-control .ls-range-value {
  width: 58px;
  min-width: 0;
  min-height: 29px !important;
  height: 29px;
  padding: 3px 5px !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

body.is-layout-workspace .ls-range-control.is-disabled { opacity: .48; }

body.is-layout-workspace .ls-rich-toolbar .ls-range-control {
  min-width: 126px;
  flex: 1 1 150px;
}

/* Carrd-style footer: duplicate/delete/more on the left and Done on the right. */
body.is-layout-workspace .ls-property-footer {
  min-height: 58px;
  padding: 7px 9px max(8px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 7px;
}

body.is-layout-workspace .ls-property-footer-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

body.is-layout-workspace .ls-property-footer-action {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8b6075;
  border-color: transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  font-family: Arial, sans-serif;
  font-size: 18px;
  line-height: 1;
}

body.is-layout-workspace .ls-property-footer-action:hover,
body.is-layout-workspace .ls-property-footer-action:focus-visible {
  color: #8b315d;
  border-color: #e8bdd2;
  background: #fff;
}

body.is-layout-workspace .ls-property-footer-delete:hover,
body.is-layout-workspace .ls-property-footer-delete:focus-visible {
  color: #a62e55;
  border-color: #efb4c3;
  background: #fff0f4;
}

body.is-layout-workspace .ls-property-footer-more {
  font-size: 15px;
  letter-spacing: 1px;
}

body.is-layout-workspace .ls-property-done {
  width: auto;
  min-width: 132px;
  min-height: 43px;
  margin-left: auto;
  padding-inline: 22px;
}

body.is-layout-workspace .ls-property-footer.is-simple .ls-property-done {
  width: 100%;
  margin-left: 0;
}

@media (max-width: 420px) {
  body.is-layout-workspace .ls-property-done {
    min-width: 112px;
    padding-inline: 16px;
  }
  body.is-layout-workspace .ls-property-footer-action {
    width: 34px;
    min-width: 34px;
  }
}

/* ==========================================================
   FIXED PROPERTY ACTION BAR + CHILD NAVIGATION
   Keeps duplicate/delete/more/Done visible while only the active
   property panel scrolls. Adds a compact first-child navigation step.
   ========================================================== */
body.is-layout-workspace .layout-properties-panel.layout-drawer {
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.is-layout-workspace .layout-properties-panel > .layout-panel-heading {
  flex: 0 0 auto;
  position: relative;
  top: auto;
}

body.is-layout-workspace .layout-properties-panel > .layout-component-properties {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body.is-layout-workspace .layout-properties-panel > .layout-component-properties.is-empty {
  overflow-y: auto;
}

body.is-layout-workspace .ls-p4-content-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.is-layout-workspace .ls-p4-content-heading {
  flex: 0 0 auto;
}

body.is-layout-workspace .ls-property-workspace {
  flex: 1 1 auto;
  min-height: 0 !important;
  overflow: hidden;
}

body.is-layout-workspace .ls-property-tabs {
  flex: 0 0 auto;
  position: relative;
  top: auto;
}

body.is-layout-workspace .ls-property-tab-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden !important;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.is-layout-workspace .ls-property-tab-panel {
  padding-bottom: 12px;
}

body.is-layout-workspace .ls-property-footer {
  flex: 0 0 auto;
  position: relative;
  bottom: auto;
  margin-top: 0;
}

body.is-layout-workspace .ls-p4-content-heading .ls-selection-stepper {
  grid-template-columns: repeat(4, 29px);
}

@media (max-width: 420px) {
  body.is-layout-workspace .ls-p4-content-heading .ls-selection-stepper {
    grid-template-columns: repeat(4, 27px);
  }

  body.is-layout-workspace .ls-p4-content-heading .ls-selection-step-button {
    width: 27px;
    min-width: 27px;
    height: 27px;
    min-height: 27px;
  }
}

/* ==========================================================
   SOURCE-ONLY ASSETS + NATIVE / CUSTOM DECORATION EDITORS
   ========================================================== */
body.is-layout-workspace .ls-source-path-control {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}

body.is-layout-workspace .ls-source-path-control > input {
  min-width: 0;
  width: 100%;
}

body.is-layout-workspace .ls-source-path-preview {
  width: 42px;
  height: 42px;
  padding: 3px;
  border: 1px solid rgba(214, 102, 151, .42);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  object-fit: contain;
}

body.is-layout-workspace .ls-source-path-preview[hidden] { display: none; }

body.is-layout-workspace .ls-decoration-slot-editor {
  margin-top: 7px;
  border-color: rgba(221, 126, 166, .34);
  background: rgba(255,255,255,.45);
}

body.is-layout-workspace .ls-decoration-slot-editor > summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-layout-workspace .ls-four-side-control {
  min-width: 0;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(216, 113, 158, .26);
}

body.is-layout-workspace .ls-four-side-title {
  display: block;
  margin-bottom: 6px;
  color: #7d3458;
  font-size: 11px;
  letter-spacing: .02em;
}

body.is-layout-workspace .ls-four-side-grid,
body.is-layout-workspace .ls-decoration-slot-editor .ls-p4-grid-2 {
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.is-layout-workspace .ls-decoration-slot-editor .ls-range-control,
body.is-layout-workspace .ls-four-side-control .ls-range-control {
  grid-template-columns: minmax(48px, 1fr) 48px;
}

body.is-layout-workspace .ls-decoration-slot-editor .ls-property-callout {
  margin: 7px 0 2px;
  padding: 8px 9px;
}

body.is-layout-workspace .ls-decoration-slot-editor .ls-property-callout p {
  overflow-wrap: anywhere;
}

body.is-layout-workspace .ls-property-tab-panel > .ls-property-card,
body.is-layout-workspace .ls-property-tab-panel > .ls-property-details,
body.is-layout-workspace .ls-property-details > .ls-property-card,
body.is-layout-workspace .ls-property-details > .ls-property-details {
  max-width: 100%;
  min-width: 0;
}

body.is-layout-workspace .ls-property-details select,
body.is-layout-workspace .ls-property-details input,
body.is-layout-workspace .ls-property-details textarea {
  max-width: 100%;
}

body.is-layout-workspace .ls-property-details > .secondary-button {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 420px) {
  body.is-layout-workspace .ls-source-path-control {
    grid-template-columns: minmax(0, 1fr) 38px;
  }
  body.is-layout-workspace .ls-source-path-preview {
    width: 38px;
    height: 38px;
  }
}

/* ==========================================================
   POPOVER BUTTON WIDTH REPAIR
   Command-bar sizing applies only to toolbar commands. Buttons inside
   Add and More popovers keep their own full-width content layouts.
   ========================================================== */
body.is-layout-workspace .layout-topbar .layout-add-popover button,
body.is-layout-workspace .layout-topbar .layout-more-popover button {
  width: auto;
  min-width: 0;
  height: auto;
  max-width: 100%;
  white-space: normal;
}

body.is-layout-workspace .layout-topbar .layout-add-popover .layout-add-grid button {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  height: auto;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: left;
  overflow: hidden;
}

body.is-layout-workspace .layout-topbar .layout-add-popover .layout-add-grid button > span:first-child {
  width: 28px;
  min-width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

body.is-layout-workspace .layout-topbar .layout-more-popover .layout-more-action {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  height: auto;
  padding: 7px 9px;
}

body.is-layout-workspace .layout-topbar .layout-more-popover .layout-reset-actions button {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  height: auto;
  padding: 7px 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  body.is-layout-workspace .layout-topbar .layout-add-popover .layout-add-grid button {
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
}

/* ==========================================================
   IPAD TOOLBAR + PROPERTY DRAWER FIT / TYPE SCALE PATCH
   Keeps command buttons on one row, contains fixed property chrome,
   and increases property text by approximately twenty percent.
   ========================================================== */

/* Never allow the history pair to collapse into a vertical stack. */
body.is-layout-workspace .layout-toolbar-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
body.is-layout-workspace .layout-toolbar-scroll::-webkit-scrollbar { display: none; }

body.is-layout-workspace .layout-history-actions {
  width: auto !important;
  min-width: 78px;
  margin-left: 0;
  flex: 0 0 auto;
  display: flex !important;
  flex-direction: row !important;
  grid-template-columns: none !important;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap !important;
  gap: 2px;
}

body.is-layout-workspace .layout-history-actions > button {
  flex: 0 0 38px;
}

/* The Add and More commands stay outside the scrollable command strip. */
body.is-layout-workspace .layout-add-menu,
body.is-layout-workspace .layout-more-menu {
  flex: 0 0 auto;
}

/* Keep all fixed property chrome inside the drawer's usable inline size. */
body.is-layout-workspace .layout-properties-panel.layout-drawer {
  box-sizing: border-box;
  max-width: 100vw;
  overflow-x: clip !important;
}

body.is-layout-workspace .layout-properties-panel > .layout-panel-heading,
body.is-layout-workspace .layout-properties-panel .ls-p4-content-heading,
body.is-layout-workspace .layout-properties-panel .ls-property-tabs,
body.is-layout-workspace .layout-properties-panel .ls-property-footer {
  width: auto !important;
  max-width: 100%;
  min-width: 0;
  margin-inline: 0;
  align-self: stretch;
  box-sizing: border-box;
  overflow-x: clip;
}

body.is-layout-workspace .layout-properties-panel .layout-component-properties,
body.is-layout-workspace .layout-properties-panel .ls-p4-content-panel,
body.is-layout-workspace .layout-properties-panel .ls-property-workspace,
body.is-layout-workspace .layout-properties-panel .ls-property-tab-panels,
body.is-layout-workspace .layout-properties-panel .ls-property-tab-panel {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body.is-layout-workspace .layout-properties-panel .ls-property-tab-panels {
  scrollbar-gutter: auto;
  overflow-x: clip !important;
}

body.is-layout-workspace .layout-properties-panel .ls-p4-content-heading-copy {
  overflow: hidden;
}

body.is-layout-workspace .layout-properties-panel .ls-property-footer {
  padding-left: 8px;
  padding-right: 8px;
}

/* Property typography: approximately 20% larger on every device. */
body.is-layout-workspace .layout-properties-panel .layout-panel-heading strong { font-size: 20.4px; }
body.is-layout-workspace .layout-properties-panel .layout-panel-heading span { font-size: 10.8px; }
body.is-layout-workspace .layout-properties-panel .ls-p4-content-heading-copy strong { font-size: 18px; }
body.is-layout-workspace .layout-properties-panel .ls-p4-content-heading-copy small { font-size: 10.8px; }
body.is-layout-workspace .layout-properties-panel .ls-p4-type-icon { font-size: 18px; }
body.is-layout-workspace .layout-properties-panel .ls-selection-step-button { font-size: 16.8px; }
body.is-layout-workspace .layout-properties-panel .ls-property-tab > span:first-child { font-size: 19.2px; }
body.is-layout-workspace .layout-properties-panel .ls-property-card h3 { font-size: 14.4px; }
body.is-layout-workspace .layout-properties-panel .ls-property-card-help,
body.is-layout-workspace .layout-properties-panel .ls-property-callout p { font-size: 10.8px; }
body.is-layout-workspace .layout-properties-panel .ls-property-callout strong { font-size: 15.6px; }
body.is-layout-workspace .layout-properties-panel .ls-property-details > summary,
body.is-layout-workspace .layout-properties-panel .ls-property-tab-panel > .ls-p4-properties-group > summary { font-size: 13.2px; }
body.is-layout-workspace .layout-properties-panel .ls-p4-field,
body.is-layout-workspace .layout-properties-panel .ls-responsive-property,
body.is-layout-workspace .layout-properties-panel .layout-property-field,
body.is-layout-workspace .layout-properties-panel .layout-property-label,
body.is-layout-workspace .layout-properties-panel .ls-layer-field { font-size: 12px; }
body.is-layout-workspace .layout-properties-panel .ls-p4-field input:not([type="checkbox"]):not([type="color"]):not([type="range"]),
body.is-layout-workspace .layout-properties-panel .ls-p4-field select,
body.is-layout-workspace .layout-properties-panel .ls-p4-field textarea,
body.is-layout-workspace .layout-properties-panel .ls-responsive-property > input,
body.is-layout-workspace .layout-properties-panel .ls-responsive-property > select,
body.is-layout-workspace .layout-properties-panel .layout-property-field input,
body.is-layout-workspace .layout-properties-panel .layout-property-field select,
body.is-layout-workspace .layout-properties-panel .layout-property-field textarea,
body.is-layout-workspace .layout-properties-panel .ls-layer-field input,
body.is-layout-workspace .layout-properties-panel .ls-layer-field select { font-size: 13.2px; }
body.is-layout-workspace .layout-properties-panel .ls-localized-field legend { font-size: 14.4px; }
body.is-layout-workspace .layout-properties-panel .ls-four-side-title { font-size: 13.2px; }
body.is-layout-workspace .layout-properties-panel .layout-property-section h3 { font-size: 18px; }
body.is-layout-workspace .layout-properties-panel .layout-property-description { font-size: 13.2px; }
body.is-layout-workspace .layout-properties-panel .layout-property-field > strong { font-size: 14.4px; }
body.is-layout-workspace .layout-properties-panel .ls-property-done { font-size: 16.8px; }

/* iPad and other medium viewports retain the same single-row command model. */
@media (min-width: 621px) and (max-width: 1180px) {
  body.is-layout-workspace .layout-topbar {
    max-width: calc(100vw - 24px);
  }

  body.is-layout-workspace .layout-select-field-page select { width: 112px; }
  body.is-layout-workspace .layout-select-field-language select { width: 96px; }

  body.is-layout-workspace .layout-history-actions {
    width: auto !important;
    display: flex !important;
    grid-template-columns: none !important;
  }
}
body.is-layout-workspace .layout-properties-panel .ls-property-tab-panel button:not(.ls-property-footer-action) {
  font-size: 14.4px;
}

/* Theme Workspace v15 ------------------------------------------------------ */
body.is-layout-workspace .layout-topbar {
  max-width: min(690px, calc(100vw - 24px));
  padding: 6px;
  gap: 5px;
  border-radius: 16px;
}
body.is-layout-workspace .layout-toolbar-scroll { gap: 5px; }
body.is-layout-workspace .layout-select-field { min-width: 142px; max-width: 178px; }
body.is-layout-workspace .layout-select-field span { font-size: 10px; }
body.is-layout-workspace .layout-icon-button,
body.is-layout-workspace .layout-add-menu > summary,
body.is-layout-workspace .layout-more-menu > summary,
body.is-layout-workspace .editor-save-button {
  width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0;
  border-radius: 11px;
}

/* More actions: compact, readable single-column menu like the reference. */
body.is-layout-workspace .layout-more-popover {
  width: 270px;
  padding: 14px;
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(112, 50, 80, .2);
}
body.is-layout-workspace .layout-more-popover > strong { display:block; margin: 1px 2px 12px; font-size: 17px; }
body.is-layout-workspace .layout-more-section { padding: 10px 0; border-top: 1px solid rgba(214,118,161,.22); }
body.is-layout-workspace .layout-more-section:first-of-type { border-top: 0; }
body.is-layout-workspace .layout-more-section-title { display:block; margin:0 4px 7px; color:#aa5c82; font-size:10px; letter-spacing:.08em; text-transform:uppercase; }
body.is-layout-workspace .layout-more-action-grid { display:grid; grid-template-columns:1fr; gap:5px; }
body.is-layout-workspace .layout-more-action {
  width:100%; min-height:40px; padding:7px 10px; display:flex; align-items:center; justify-content:flex-start; gap:10px;
  border-radius:11px; text-align:left;
}
body.is-layout-workspace .layout-more-action > span:first-child { width:24px; height:24px; display:grid; place-items:center; border-radius:8px; background:#fff2f8; }
body.is-layout-workspace .layout-more-action:hover,
body.is-layout-workspace .layout-more-action[aria-expanded="true"] { background:#fff0f7; }
body.is-layout-workspace .layout-more-recovery p { margin:0 4px 8px; font-size:11px; }
body.is-layout-workspace .layout-reset-actions { display:grid; gap:5px; }
body.is-layout-workspace .layout-reset-actions button { width:100%; min-height:36px; }

/* Theme drawer follows the same shell as Properties, but remains independent. */
body.is-layout-workspace .layout-theme-drawer.layout-drawer {
  left: 0; right:auto; top:0; bottom:0;
  width: var(--stage1-drawer-width, 380px);
  max-width: min(420px, 100vw);
  padding:0;
  overflow:hidden;
  transform:translateX(-105%);
  z-index:1450;
  border-radius:0 20px 20px 0;
  background:rgba(255,250,253,.98);
}
body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-theme-drawer { transform:translateX(0); }
body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-canvas-column { margin-left:var(--stage1-drawer-width, 380px); }
.layout-theme-shell { height:100%; min-height:0; display:grid; grid-template-rows:auto auto auto minmax(0,1fr) auto; overflow:hidden; }
.layout-theme-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:15px 15px 11px; border-bottom:1px solid #f1bfd3; }
.layout-theme-header > div { min-width:0; display:grid; gap:2px; }
.layout-theme-header strong { color:#6d3151; font-size:20px; }
.layout-theme-header small { color:#a06c84; font-size:10px; }
.layout-theme-profilebar { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; padding:10px 14px; border-bottom:1px solid #f4d1df; }
.layout-theme-profilebar select { width:100%; min-height:38px; }
.layout-theme-profile-actions { display:flex; gap:5px; }
.layout-theme-profile-actions button { width:38px; min-width:38px; height:38px; padding:0; }
.layout-theme-tabs { display:grid; grid-template-columns:repeat(6,1fr); border-bottom:1px solid #f0bfd2; background:#fffafd; }
.layout-theme-tabs button { min-width:0; min-height:57px; padding:6px 2px; border:0; border-radius:0; background:transparent; display:grid; place-items:center; gap:2px; color:#78405e; }
.layout-theme-tabs button span { font-size:16px; line-height:1; }
.layout-theme-tabs button small { font-size:9px; white-space:nowrap; }
.layout-theme-tabs button.is-active { color:#c23976; background:linear-gradient(#fff,#ffeaf3); box-shadow:inset 0 -3px #df6fa9; }
.layout-theme-content { min-height:0; overflow:auto; overflow-x:hidden; padding:10px; overscroll-behavior:contain; }
.layout-theme-footer { display:grid; grid-template-columns:1fr 1.15fr; gap:8px; padding:10px 12px max(10px,env(safe-area-inset-bottom)); border-top:1px solid #efbfd2; background:rgba(255,250,253,.98); }
.layout-theme-footer button { min-height:42px; }
.theme-workspace-section { margin:0 0 10px; padding:11px; border:1px solid #efbfd2; border-radius:14px; background:rgba(255,255,255,.76); box-shadow:0 2px 8px rgba(183,91,131,.05); }
.theme-workspace-section-heading { display:grid; gap:2px; margin-bottom:9px; }
.theme-workspace-section-heading strong { color:#6f3554; font-size:14px; }
.theme-workspace-section-heading small { color:#9c7185; font-size:9px; line-height:1.4; }
.theme-token-grid { display:grid; gap:6px; }
.theme-token-row { display:grid; grid-template-columns:minmax(72px,.7fr) 34px minmax(0,1fr); align-items:center; gap:7px; }
.theme-token-row > span { font-size:11px; color:#704259; }
.theme-token-row input[type="color"] { width:34px; min-width:34px; height:28px; padding:2px; }
.theme-token-row input[type="text"] { min-width:0; height:32px; font-size:11px; }
.theme-quick-palette-grid { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.theme-palette-card { min-height:50px; padding:8px; display:grid; gap:6px; text-align:left; }
.theme-palette-swatches { display:flex; gap:3px; }
.theme-palette-swatches b { width:18px; height:10px; border-radius:4px; border:1px solid rgba(120,50,80,.12); }
.theme-type-row { margin-top:7px; padding:8px; border:1px solid #f3d4e0; border-radius:11px; background:#fffafd; }
.theme-type-row > strong { display:block; margin-bottom:6px; }
.theme-simple-row,.theme-range-row,.theme-compact-field { display:grid; gap:4px; margin-top:6px; }
.theme-simple-row > span,.theme-range-row > span,.theme-compact-field > span { font-size:10px; color:#704259; }
.theme-range-row { grid-template-columns:70px minmax(0,1fr) 58px; align-items:center; }
.theme-range-row > span { grid-column:1; }
.theme-range-row input[type="range"] { grid-column:2; }
.theme-range-row input[type="number"] { grid-column:3; min-width:0; }
.theme-base-element-row { margin-top:7px; border:1px solid #efd0dd; border-radius:11px; background:#fff; overflow:hidden; }
.theme-base-element-row summary { min-height:44px; display:grid; grid-template-columns:32px minmax(0,1fr) auto; align-items:center; gap:8px; padding:7px; cursor:pointer; list-style:none; }
.theme-base-element-row summary::-webkit-details-marker { display:none; }
.theme-base-element-row summary small { color:#a36080; font-size:9px; }
.theme-base-icon { width:30px; height:30px; display:grid; place-items:center; border-radius:9px; color:white; background:linear-gradient(#ec83b2,#ce4f88); }
.theme-base-element-body { display:grid; grid-template-columns:1fr 1fr; gap:7px; padding:8px; border-top:1px solid #f1d5e0; background:#fffafd; }
.theme-preset-grid { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.theme-preset-card { min-height:68px; padding:9px; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:3px 7px; text-align:left; align-content:center; }
.theme-preset-card strong { font-size:11px; }
.theme-preset-card small { grid-column:1; color:#a06c84; font-size:9px; }
.theme-preset-card span { grid-row:1/3; grid-column:2; align-self:center; font-size:20px; color:#ce4f88; }
.theme-workspace-note { margin:0; color:#8c6277; font-size:11px; line-height:1.5; }

@media (max-width: 860px) {
  body.is-layout-workspace .layout-theme-drawer.layout-drawer { width:min(390px,calc(100vw - 34px)); max-width:none; border-radius:0 18px 18px 0; }
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-canvas-column { margin-left:0; }
}
@media (max-width: 520px) {
  body.is-layout-workspace .layout-theme-drawer.layout-drawer { width:100vw; border-radius:0; }
  .layout-theme-tabs button small { font-size:8px; }
  .theme-preset-grid,.theme-quick-palette-grid { grid-template-columns:1fr; }
}

/* Theme workspace repair + reference toolbar alignment v15.1 */
body.is-layout-workspace .layout-topbar {
  top: 14px;
  right: 14px;
  left: auto;
  width: auto;
  max-width: calc(100vw - 28px);
  padding: 6px;
  gap: 5px;
  border-radius: 17px;
  background: rgba(255,250,253,.96);
  box-shadow: 0 8px 24px rgba(131,67,96,.14);
}
body.is-layout-workspace .layout-toolbar-scroll { flex: 0 0 auto; width: auto; overflow: visible; }
body.is-layout-workspace .device-switcher { padding: 0; gap: 2px; border: 1px solid #efbfd2; border-radius: 13px; background:#fffafd; }
body.is-layout-workspace .layout-icon-button,
body.is-layout-workspace .layout-add-menu > summary,
body.is-layout-workspace .layout-more-menu > summary,
body.is-layout-workspace .editor-save-button {
  width: 38px; min-width: 38px; height: 38px; min-height: 38px;
  border-radius: 11px;
}
body.is-layout-workspace .layout-history-actions { min-width: 78px; gap: 2px; }
body.is-layout-workspace .layout-toolbar-divider { height: 24px; }

body.is-layout-workspace .layout-more-popover {
  width: 250px;
  right: 0;
  padding: 13px;
  border-radius: 17px;
}
body.is-layout-workspace .layout-more-action { grid-template-columns: 26px minmax(0,1fr) auto; display:grid; }
body.is-layout-workspace .layout-more-action kbd { color:#af8296; font: 9px/1.2 inherit; background:transparent; border:0; }
body.is-layout-workspace .layout-more-action b { color:#ca4b84; font-size:12px; }
body.is-layout-workspace .layout-more-action[aria-expanded="true"],
body.is-layout-workspace #layout-open-theme[aria-expanded="true"] {
  color:#fff;
  border-color:#b64073;
  background:linear-gradient(#eb84b3,#ce4f88);
}
body.is-layout-workspace #layout-open-theme[aria-expanded="true"] > span:first-child { background:rgba(255,255,255,.2); }
body.is-layout-workspace #layout-open-theme[aria-expanded="true"] b { color:#fff; }

body.is-layout-workspace .layout-canvas-toolbar {
  right: 14px;
  left: auto;
  bottom: 14px;
  width: auto;
  max-width: calc(100vw - 28px);
  min-height: 48px;
  padding: 5px 7px;
  gap: 5px;
  justify-content:flex-end;
  border-radius: 16px;
  background:rgba(255,250,253,.96);
  box-shadow:0 8px 24px rgba(131,67,96,.13);
}
body.is-layout-workspace .layout-bottom-select {
  display:flex; align-items:center; gap:5px; height:38px; padding:0 8px;
  border:1px solid #efbfd2; border-radius:11px; background:#fffafd;
}
body.is-layout-workspace .layout-bottom-select span { display:none; }
body.is-layout-workspace .layout-bottom-select select { min-width:92px; max-width:120px; height:30px; padding:0 22px 0 7px; border:0; background:transparent; }
body.is-layout-workspace .layout-bottom-language select { min-width:76px; }
body.is-layout-workspace .layout-preview-label-compact { display:none; }
body.is-layout-workspace .layout-canvas-toolbar > label:not(.layout-bottom-select),
body.is-layout-workspace .layout-selection-toolbar,
body.is-layout-workspace .layout-guide-style,
body.is-layout-workspace .layout-bottom-icon-button { min-height:38px; border-radius:10px; }

body.is-layout-workspace .layout-theme-drawer.layout-drawer {
  width: min(560px, calc(100vw - 90px));
  max-width: 560px;
  border-radius: 0 20px 20px 0;
  box-shadow: 16px 0 38px rgba(120,52,84,.18);
}
body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-canvas-column { margin-left:min(560px, calc(100vw - 90px)); }
.layout-theme-header { padding:14px 16px 10px; }
.layout-theme-header strong { font-size:19px; }
.layout-theme-profilebar { grid-template-columns:minmax(0,1fr) auto; padding:9px 14px; }
.layout-theme-profile-actions button { width:36px; min-width:36px; height:36px; }
.layout-theme-tabs button { min-height:55px; }
.layout-theme-content { padding:10px 12px; }
.layout-theme-footer { grid-template-columns:1fr 1.25fr; }

@media (max-width: 860px) {
  body.is-layout-workspace .layout-topbar { top:10px; right:10px; max-width:calc(100vw - 20px); }
  body.is-layout-workspace .layout-canvas-toolbar { right:10px; bottom:10px; max-width:calc(100vw - 20px); overflow-x:auto; }
  body.is-layout-workspace .layout-theme-drawer.layout-drawer { width:min(430px,calc(100vw - 26px)); max-width:none; }
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-canvas-column { margin-left:0; }
}

/* Theme drawer visibility repair v15.2
   The generic drawer system hides every drawer with opacity/visibility.
   Theme previously changed only its transform, so the canvas moved but the
   drawer remained invisible. Keep Theme on the same canonical open-state path
   as Elements and Properties. */
body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-theme-drawer.layout-drawer {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition: transform 180ms ease, opacity 140ms ease;
}

/* Theme workspace readability + stable fitted canvas v15.3 ---------------- */
/* Keep the canvas column anchored. Opening Theme changes the available
   viewport padding and Fit zoom, rather than pushing the entire canvas. */
body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-canvas-column {
  width: 100%;
  margin-left: 0;
}
body.is-layout-workspace .layout-preview-viewport {
  transition: padding-left 180ms ease, padding-right 180ms ease;
}
@media (min-width: 861px) {
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-preview-viewport {
    padding-left: calc(min(560px, calc(100vw - 90px)) + 34px);
  }
}

/* Theme text is intentionally larger than the compact canvas controls. */
body.is-layout-workspace .layout-theme-drawer.layout-drawer {
  font-size: 14.4px;
}
.layout-theme-header strong { font-size: 23px; }
.layout-theme-header small { font-size: 12px; }
.layout-theme-profilebar select,
.layout-theme-profile-actions button,
.layout-theme-footer button { font-size: 14px; }
.layout-theme-tabs button span { font-size: 19px; }
.layout-theme-tabs button small { font-size: 10.8px; }
.theme-workspace-section-heading strong { font-size: 16.8px; }
.theme-workspace-section-heading small { font-size: 10.8px; }
.theme-token-row > span,
.theme-simple-row > span,
.theme-range-row > span,
.theme-compact-field > span { font-size: 12.5px; }
.theme-token-row input[type="text"],
.theme-token-row input[type="number"],
.theme-simple-row input,
.theme-simple-row select,
.theme-range-row input,
.theme-compact-field input,
.theme-compact-field select,
.theme-base-element-body input,
.theme-base-element-body select { font-size: 13px; }
.theme-base-element-row summary { min-height: 49px; }
.theme-base-element-row summary strong { font-size: 13.5px; }
.theme-base-element-row summary small { font-size: 10.8px; }
.theme-preset-card strong { font-size: 13.2px; }
.theme-preset-card small { font-size: 10.8px; }
.theme-workspace-note { font-size: 13.2px; }
.theme-palette-card { font-size: 13px; }
.theme-type-row > strong { font-size: 13.5px; }

@media (max-width: 860px) {
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-preview-viewport {
    padding-left: 34px;
  }
}


/* Theme workspace fixed-scale positioning v15.6 ---------------------------
   Reduce the desktop Theme drawer by another 50 px while preserving the same
   8 px drawer-to-canvas spacing and the user's current canvas zoom. */
@media (min-width: 861px) {
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: min(470px, calc(100vw - 90px));
    max-width: 470px;
  }
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-preview-viewport {
    padding-left: calc(min(470px, calc(100vw - 90px)) + 8px);
  }
}


/* Theme workspace fixed-scale positioning v15.7 ---------------------------
   Make the desktop Theme drawer 450 px wide and keep the canvas in the same
   horizontal position when Theme opens. The drawer should overlay the left
   workspace area instead of changing the artboard fit padding. */
@media (min-width: 861px) {
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: min(450px, calc(100vw - 90px));
    max-width: 450px;
  }
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-preview-viewport {
    padding-left: 34px !important;
  }
}


/* Theme workspace permanent canvas lane v15.8 -----------------------------
   Reserve a fixed desktop lane for the 450 px Theme drawer at all times.
   The artboard therefore occupies the same position whether Theme is open or
   closed, and opening Theme cannot cover, push, or resize the layout view. */
@media (min-width: 861px) {
  body.is-layout-workspace .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-preview-viewport {
    padding-left: 458px !important;
  }
}


/* 1920x1080 fixed editor canvas lane v15.9 -------------------------------
   Desktop uses one permanent 450 px left workspace lane whether Theme,
   Elements, Properties, or no drawer is visible. The canvas viewport keeps
   exactly the same dimensions and position, so opening Theme cannot move or
   resize the artboard. Tight viewport padding maximizes the 1600 px desktop
   canvas while retaining a 12 px gap and avoiding horizontal scrolling. */
@media (min-width: 861px) {
  body.editor-page.is-layout-workspace {
    --stage1-drawer-width: 450px;
    --ls-fixed-canvas-lane: 450px;
  }

  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: 450px;
    max-width: 450px;
  }

  body.is-layout-workspace .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-components-open .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-canvas-column {
    width: calc(100vw - var(--ls-fixed-canvas-lane)) !important;
    margin-left: var(--ls-fixed-canvas-lane) !important;
    transition: none !important;
  }

  body.is-layout-workspace .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-components-open .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-preview-viewport {
    width: 100%;
    padding: 80px 12px 78px !important;
    transition: none !important;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.is-layout-workspace .layout-canvas-toolbar,
  body.is-layout-workspace.is-editor-drawer-open .layout-canvas-toolbar {
    left: auto !important;
    right: 12px !important;
    max-width: calc(100vw - var(--ls-fixed-canvas-lane) - 24px) !important;
  }
}

/* Compact contextual toolbar v16.1 -----------------------------------------
   Rework the bottom toolbar so it matches the top toolbar language: same
   height, icon scale, label size, corner radius, and grouped control rhythm. */
body.is-layout-workspace .layout-canvas-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
  min-height: 50px;
  padding: 5px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
}
body.is-layout-workspace .layout-canvas-toolbar::-webkit-scrollbar { display: none; }

body.is-layout-workspace .layout-bottom-select,
body.is-layout-workspace .layout-zoom-control,
body.is-layout-workspace .layout-toolbar-group,
body.is-layout-workspace .layout-selection-toolbar {
  flex: 0 0 auto;
  min-height: 38px;
  height: 38px;
  box-sizing: border-box;
  border: 1px solid #efbfd2;
  border-radius: 10px;
  background: #fffafd;
  color: #78405e;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
  font-size: 12px;
  line-height: 1;
}

body.is-layout-workspace .layout-bottom-select {
  display: inline-flex;
  align-items: center;
  padding: 2px 3px 2px 7px;
  gap: 5px;
}
body.is-layout-workspace .layout-bottom-select select,
body.is-layout-workspace .layout-zoom-control select {
  min-height: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #78405e;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}
body.is-layout-workspace .layout-bottom-select select {
  field-sizing: content;
  min-width: 0;
  max-width: none;
  padding: 0 22px 0 6px;
}
body.is-layout-workspace .layout-bottom-language { padding-inline: 3px; }
body.is-layout-workspace .layout-bottom-language select {
  width: 56px !important;
  min-width: 56px;
  padding-left: 8px;
  padding-right: 20px;
  text-align: center;
}

body.is-layout-workspace .layout-zoom-control {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 2px 4px 2px 8px;
}
body.is-layout-workspace .layout-zoom-control select {
  width: 82px;
  min-width: 82px;
  padding: 0 22px 0 2px;
}

body.is-layout-workspace .layout-toolbar-svg-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-grid;
  place-items: center;
}
body.is-layout-workspace .layout-toolbar-svg-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.is-layout-workspace .layout-toolbar-group,
body.is-layout-workspace .layout-selection-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 2px;
  overflow: visible;
}
body.is-layout-workspace .layout-toolbar-group > * + *,
body.is-layout-workspace .layout-selection-toolbar > * + * {
  border-left: 1px solid rgba(222,132,173,.24);
}
body.is-layout-workspace .layout-compact-toggle,
body.is-layout-workspace #layout-move-grid {
  min-width: 82px;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #78405e;
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
}
body.is-layout-workspace .layout-compact-toggle:hover,
body.is-layout-workspace #layout-move-grid:hover:not(:disabled),
body.is-layout-workspace .layout-guide-style > summary:hover,
body.is-layout-workspace .layout-guide-style[open] > summary,
body.is-layout-workspace .layout-bottom-icon-button:hover {
  background: #fff0f7;
}
body.is-layout-workspace .layout-compact-toggle.is-active,
body.is-layout-workspace #layout-move-grid.is-active {
  color: #fff;
  background: linear-gradient(#e97ead,#cd4f88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

body.is-layout-workspace .layout-guide-size,
body.is-layout-workspace .layout-selection-snap {
  min-height: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #78405e;
  font-size: 12px;
  font-weight: 600;
}
body.is-layout-workspace .layout-guide-size input,
body.is-layout-workspace .layout-selection-snap input {
  width: 44px;
  min-width: 44px;
  height: 26px;
  min-height: 26px;
  padding: 1px 4px;
  text-align: center;
  border: 1px solid #ecc4d5;
  border-radius: 7px;
  background: #fff;
  color: #78405e;
  font-size: 12px;
}
body.is-layout-workspace .layout-guide-size span,
body.is-layout-workspace .layout-selection-snap span {
  font-size: 12px;
  white-space: nowrap;
}
body.is-layout-workspace .layout-guide-style {
  position: relative;
  height: 32px;
  min-height: 32px;
}
body.is-layout-workspace .layout-guide-style > summary,
body.is-layout-workspace .layout-bottom-icon-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #78405e;
  list-style: none;
  cursor: pointer;
  box-shadow: none;
}
body.is-layout-workspace .layout-guide-style-panel {
  bottom: calc(100% + 10px);
  top: auto;
  right: 0;
  z-index: 2000;
}
body.is-layout-workspace .layout-guide-settings-icon {
  font-size: 14px;
  line-height: 1;
}

body.is-layout-workspace .layout-selection-toolbar.is-disabled {
  color: #9d9297;
  border-color: #e2d8dd;
  background: #f8f4f6;
  box-shadow: none;
}
body.is-layout-workspace #layout-move-grid:disabled,
body.is-layout-workspace .layout-selection-snap.is-disabled {
  opacity: .46;
  cursor: not-allowed;
  filter: grayscale(.65);
}
body.is-layout-workspace .layout-bottom-icon-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  border: 1px solid #efbfd2;
  border-radius: 10px;
  background: #fffafd;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

@media (max-width: 860px) {
  body.is-layout-workspace .layout-canvas-toolbar {
    gap: 4px;
    min-height: 48px;
    padding: 4px;
  }
  body.is-layout-workspace .layout-bottom-select,
  body.is-layout-workspace .layout-zoom-control,
  body.is-layout-workspace .layout-toolbar-group,
  body.is-layout-workspace .layout-selection-toolbar,
  body.is-layout-workspace .layout-bottom-icon-button { height: 36px; min-height: 36px; }
  body.is-layout-workspace .layout-bottom-select select,
  body.is-layout-workspace .layout-zoom-control select { min-height: 30px; height: 30px; }
  body.is-layout-workspace .layout-zoom-control select { width: 78px; min-width: 78px; }
  body.is-layout-workspace .layout-compact-toggle,
  body.is-layout-workspace #layout-move-grid { min-width: 76px; height: 30px; min-height: 30px; padding-inline: 8px; }
  body.is-layout-workspace .layout-guide-size,
  body.is-layout-workspace .layout-selection-snap,
  body.is-layout-workspace .layout-guide-style { height: 30px; min-height: 30px; }
  body.is-layout-workspace .layout-guide-style > summary { height: 30px; min-height: 30px; }
}

@media (max-width: 520px) {
  body.is-layout-workspace .layout-canvas-toolbar { max-width: calc(100vw - 12px) !important; right: 6px !important; }
  body.is-layout-workspace .layout-compact-toggle,
  body.is-layout-workspace #layout-move-grid { min-width: 68px; }
  body.is-layout-workspace .layout-guide-size-label,
  body.is-layout-workspace .layout-selection-snap > span:first-child { display: none; }
  body.is-layout-workspace .layout-guide-size input,
  body.is-layout-workspace .layout-selection-snap input { width: 38px; min-width: 38px; }
}

/* Guide settings use viewport positioning so the upward panel cannot be
   clipped by the compact toolbar on desktop, tablet, or phone. */
body.is-layout-workspace .layout-guide-style-panel {
  position: fixed;
  right: auto;
  bottom: auto;
  transform-origin: right bottom;
}
@media (min-width: 861px) {
  body.is-layout-workspace .layout-canvas-toolbar { overflow: visible; }
}


/* Shared left drawers + guide popover repair v16.2 -------------------------
   - Guide settings popover uses viewport positioning again so it actually shows.
   - Elements and Properties drawers use the same 450 px shell language as Theme.
   - Desktop keeps one permanent 450 px lane so opening any left drawer never
     resizes or shifts the layout canvas. Optimized for 1920x1080 first. */
body.is-layout-workspace .layout-guide-style-panel {
  position: fixed !important;
  z-index: 5000 !important;
}
body.is-layout-workspace .layout-guide-style[open] > .layout-guide-style-panel {
  display: grid;
}

body.is-layout-workspace .layout-components-panel.layout-drawer,
body.is-layout-workspace .layout-properties-panel.layout-drawer,
body.is-layout-workspace .layout-theme-drawer.layout-drawer {
  background: rgba(255,250,253,.985);
  box-shadow: 16px 0 38px rgba(120,52,84,.18);
}
body.is-layout-workspace .layout-components-panel.layout-drawer,
body.is-layout-workspace .layout-properties-panel.layout-drawer {
  border-radius: 0 20px 20px 0;
  padding: 0;
  overflow: hidden;
}
body.is-layout-workspace .layout-components-panel.layout-drawer {
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
}
body.is-layout-workspace .layout-properties-panel.layout-drawer {
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
}
body.is-layout-workspace .layout-components-panel .layout-panel-heading,
body.is-layout-workspace .layout-properties-panel .layout-panel-heading {
  min-height: auto;
  padding: 14px 16px 10px;
  color: #6d3151;
  border-bottom: 1px solid #f1bfd3;
  background: transparent;
  box-shadow: none;
}
body.is-layout-workspace .layout-components-panel .layout-panel-heading strong,
body.is-layout-workspace .layout-properties-panel .layout-panel-heading strong {
  font-size: 22px;
  line-height: 1.05;
  color: #6d3151;
}
body.is-layout-workspace .layout-components-panel .layout-panel-heading span,
body.is-layout-workspace .layout-properties-panel .layout-panel-heading span,
body.is-layout-workspace #layout-selected-name {
  font-size: 12px;
  color: #a06c84;
}
body.is-layout-workspace .layout-components-panel .layout-drawer-close,
body.is-layout-workspace .layout-properties-panel .layout-drawer-close {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 999px;
}
body.is-layout-workspace .layout-components-panel .layout-component-list,
body.is-layout-workspace .layout-properties-panel .layout-component-properties {
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: 10px 12px;
  overscroll-behavior: contain;
  background: transparent;
}
body.is-layout-workspace .layout-components-panel #layout-component-list[data-packet4-layers="true"] {
  padding: 10px 12px;
}
body.is-layout-workspace .layout-components-panel .layout-panel-help,
body.is-layout-workspace .layout-properties-panel .empty-selection {
  margin: 0;
  padding: 14px;
  border: 1px solid #efbfd2;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 2px 8px rgba(183,91,131,.05);
}
body.is-layout-workspace .layout-properties-panel .empty-selection {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 180px;
  text-align: center;
}
body.is-layout-workspace .layout-properties-panel .empty-selection > span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-size: 22px;
  background: linear-gradient(#ec83b2,#ce4f88);
}
body.is-layout-workspace .layout-properties-panel .empty-selection p {
  margin: 0;
  color: #86566f;
  font-size: 13px;
  line-height: 1.5;
}
body.is-layout-workspace .layout-shared-drawer-footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px 12px max(10px,env(safe-area-inset-bottom));
  border-top: 1px solid #efbfd2;
  background: rgba(255,250,253,.98);
}
body.is-layout-workspace .layout-shared-drawer-footer button {
  min-height: 42px;
}

/* Preserve the Packet 4 properties workflow inside the refreshed drawer shell. */
body.is-layout-workspace .layout-properties-panel > .layout-component-properties {
  padding-bottom: 16px;
}
body.is-layout-workspace .layout-properties-panel .ls-p4-content-heading,
body.is-layout-workspace .layout-properties-panel .ls-property-tabs,
body.is-layout-workspace .layout-properties-panel .ls-property-footer {
  background: rgba(255,250,253,.98);
}

@media (min-width: 861px) {
  body.editor-page.is-layout-workspace {
    --stage1-drawer-width: 450px;
    --ls-fixed-canvas-lane: 450px;
  }
  body.is-layout-workspace .layout-components-panel.layout-drawer,
  body.is-layout-workspace .layout-properties-panel.layout-drawer,
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: 450px !important;
    max-width: 450px !important;
  }
  body.is-layout-workspace .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-components-open .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-canvas-column {
    width: calc(100vw - var(--ls-fixed-canvas-lane)) !important;
    margin-left: var(--ls-fixed-canvas-lane) !important;
    transition: none !important;
  }
  body.is-layout-workspace .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-components-open .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-preview-viewport {
    width: 100%;
    padding: 80px 12px 78px !important;
    transition: none !important;
    overflow-x: hidden;
    overflow-y: auto;
  }
  body.is-layout-workspace .layout-canvas-toolbar,
  body.is-layout-workspace.is-editor-drawer-open .layout-canvas-toolbar {
    left: auto !important;
    right: 12px !important;
    max-width: calc(100vw - var(--ls-fixed-canvas-lane) - 24px) !important;
  }
}

@media (max-width: 860px) {
  body.is-layout-workspace .layout-components-panel.layout-drawer,
  body.is-layout-workspace .layout-properties-panel.layout-drawer,
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: min(430px, calc(100vw - 26px)) !important;
    max-width: none !important;
    border-radius: 0 18px 18px 0;
  }
}
@media (max-width: 520px) {
  body.is-layout-workspace .layout-components-panel.layout-drawer,
  body.is-layout-workspace .layout-properties-panel.layout-drawer,
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
  }
}

/* Unified Theme / Elements / Properties workspaces v16.3 -----------------
   All three left workspaces use the same 450 px shell, header rhythm, content
   cards, tab language, and fixed-foot action treatment. */
body.is-layout-workspace .layout-components-panel.layout-drawer,
body.is-layout-workspace .layout-properties-panel.layout-drawer,
body.is-layout-workspace .layout-theme-drawer.layout-drawer {
  color: #6d3151;
  font-size: 14px;
  background: rgba(255,250,253,.985);
  border-right: 1px solid #efbfd2;
  box-shadow: 16px 0 38px rgba(120,52,84,.18);
}

body.is-layout-workspace .layout-shared-drawer-header,
body.is-layout-workspace .layout-theme-header {
  min-height: 68px;
  padding: 14px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #6d3151;
  border-bottom: 1px solid #f1bfd3;
  background: rgba(255,250,253,.98);
  box-shadow: none;
}
body.is-layout-workspace .layout-shared-drawer-header > div,
body.is-layout-workspace .layout-theme-header > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
body.is-layout-workspace .layout-shared-drawer-header strong,
body.is-layout-workspace .layout-theme-header strong {
  color: #6d3151;
  font-size: 22px;
  line-height: 1.05;
  font-weight: 700;
}
body.is-layout-workspace .layout-shared-drawer-header span,
body.is-layout-workspace .layout-theme-header small,
body.is-layout-workspace #layout-selected-name {
  max-width: 330px;
  overflow: hidden;
  color: #a06c84;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.is-layout-workspace .layout-shared-drawer-header .layout-drawer-close,
body.is-layout-workspace .layout-theme-header .layout-drawer-close {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  font-size: 20px;
}

/* Elements uses a Theme-style context bar above the structural list. */
body.is-layout-workspace .layout-elements-contextbar {
  min-height: 58px;
  padding: 9px 14px;
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #f4d1df;
  background: #fffafd;
}
body.is-layout-workspace .layout-elements-contextbar > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  font-size: 17px;
  background: linear-gradient(#ec83b2,#ce4f88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 3px 8px rgba(128,43,84,.11);
}
body.is-layout-workspace .layout-elements-contextbar > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}
body.is-layout-workspace .layout-elements-contextbar strong {
  color: #6f3554;
  font-size: 15px;
}
body.is-layout-workspace .layout-elements-contextbar small {
  color: #9c7185;
  font-size: 11px;
}

body.is-layout-workspace .layout-components-panel.layout-drawer {
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr) auto;
  padding: 0;
  overflow: hidden;
  border-radius: 0 20px 20px 0;
}
body.is-layout-workspace .layout-components-panel .layout-component-list,
body.is-layout-workspace .layout-components-panel #layout-component-list[data-packet4-layers="true"] {
  min-height: 0;
  padding: 10px 12px 18px;
  overflow: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: transparent;
}
body.is-layout-workspace .layout-components-panel .ls-layers-top,
body.is-layout-workspace .layout-components-panel .ls-context-browser,
body.is-layout-workspace .layout-components-panel .ls-all-layers,
body.is-layout-workspace .layout-components-panel .ls-layer-group,
body.is-layout-workspace .layout-components-panel .ls-presets {
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid #efbfd2;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 2px 8px rgba(183,91,131,.05);
}
body.is-layout-workspace .layout-components-panel .ls-layer-group {
  padding: 0;
  overflow: visible;
}
body.is-layout-workspace .layout-components-panel .ls-layer-group > summary,
body.is-layout-workspace .layout-components-panel .ls-presets > summary {
  min-height: 44px;
  padding: 9px 11px;
  color: #6f3554;
  font-size: 13px;
  border-radius: 13px;
  background: #fffafd;
}
body.is-layout-workspace .layout-components-panel .ls-layer-group[open] > summary {
  border-bottom: 1px solid #f1d5e0;
  border-radius: 13px 13px 0 0;
}
body.is-layout-workspace .layout-components-panel .ls-layer-group-list {
  gap: 5px;
  padding: 7px;
}
body.is-layout-workspace .layout-components-panel .ls-layers-page,
body.is-layout-workspace .layout-components-panel .ls-add-element > summary,
body.is-layout-workspace .layout-components-panel .ls-layer-row,
body.is-layout-workspace .layout-components-panel .ls-area-card,
body.is-layout-workspace .layout-components-panel .layout-component-button {
  min-height: 46px;
  border: 1px solid #ead0dc;
  border-radius: 11px;
  background: rgba(255,255,255,.92);
  box-shadow: none;
}
body.is-layout-workspace .layout-components-panel .ls-layers-page,
body.is-layout-workspace .layout-components-panel .ls-add-element > summary {
  padding: 8px 10px;
  font-size: 13px;
}
body.is-layout-workspace .layout-components-panel .ls-layer-row:hover,
body.is-layout-workspace .layout-components-panel .ls-area-card:hover,
body.is-layout-workspace .layout-components-panel .layout-component-button:hover {
  border-color: #d97aaa;
  background: #fff3f9;
}
body.is-layout-workspace .layout-components-panel .ls-layer-row.is-selected,
body.is-layout-workspace .layout-components-panel .ls-area-card.is-selected,
body.is-layout-workspace .layout-components-panel .layout-component-button.is-selected,
body.is-layout-workspace .layout-components-panel .ls-layers-page.is-selected {
  color: #6d3150;
  border-color: #ce4f88;
  background: linear-gradient(#fff2f8,#ffe5f1);
  box-shadow: 0 0 0 2px rgba(206,79,136,.10);
}
body.is-layout-workspace .layout-components-panel .ls-layer-select {
  min-height: 40px;
  color: #6d4258;
  font-size: 13px;
}
body.is-layout-workspace .layout-components-panel .ls-layer-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
body.is-layout-workspace .layout-components-panel .ls-layer-icon-button,
body.is-layout-workspace .layout-components-panel .ls-layer-more > summary {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 9px;
}
body.is-layout-workspace .layout-shared-drawer-footer {
  padding: 10px 12px max(10px,env(safe-area-inset-bottom));
  border-top: 1px solid #efbfd2;
  background: rgba(255,250,253,.98);
}
body.is-layout-workspace .layout-shared-drawer-footer button {
  min-height: 42px;
  border-radius: 10px;
  font-size: 15px;
}

/* Properties reuses Theme's profile-bar and category-tab logic. */
body.is-layout-workspace .layout-properties-panel.layout-drawer {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 0 20px 20px 0;
}
body.is-layout-workspace .layout-properties-panel > .layout-component-properties {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
body.is-layout-workspace .layout-properties-panel .ls-p4-content-panel {
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body.is-layout-workspace .layout-properties-panel .ls-p4-content-heading {
  flex: 0 0 auto;
  min-height: 58px;
  margin: 0;
  padding: 9px 14px;
  gap: 9px;
  border-bottom: 1px solid #f4d1df;
  background: #fffafd;
}
body.is-layout-workspace .layout-properties-panel .ls-p4-type-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(#ec83b2,#ce4f88);
}
body.is-layout-workspace .layout-properties-panel .ls-p4-content-heading-copy strong {
  color: #6f3554;
  font-size: 15px;
}
body.is-layout-workspace .layout-properties-panel .ls-p4-content-heading-copy small {
  color: #9c7185;
  font-size: 11px;
}
body.is-layout-workspace .layout-properties-panel .ls-property-workspace {
  flex: 1 1 auto;
  min-height: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.is-layout-workspace .layout-properties-panel .ls-property-tabs {
  flex: 0 0 auto;
  min-height: 58px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 0;
  position: relative;
  top: auto;
  border-bottom: 1px solid #f0bfd2;
  background: #fffafd;
  box-shadow: none;
}
body.is-layout-workspace .layout-properties-panel .ls-property-tab {
  width: auto;
  min-width: 0;
  height: 58px;
  min-height: 58px;
  padding: 5px 2px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  position: relative;
  border: 0;
  border-radius: 0;
  color: #78405e;
  background: transparent;
  box-shadow: none;
}
body.is-layout-workspace .layout-properties-panel .ls-property-tab > span:first-child {
  font-size: 18px;
  line-height: 1;
}
body.is-layout-workspace .layout-properties-panel .ls-property-tab > span:last-child {
  width: auto;
  height: auto;
  position: static;
  overflow: visible;
  clip: auto;
  clip-path: none;
  color: inherit;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}
body.is-layout-workspace .layout-properties-panel .ls-property-tab.is-active,
body.is-layout-workspace .layout-properties-panel .ls-property-tab[aria-selected="true"] {
  color: #c23976;
  background: linear-gradient(#fff,#ffeaf3);
  box-shadow: inset 0 -3px #df6fa9;
}
body.is-layout-workspace .layout-properties-panel .ls-property-tab-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  background: transparent;
}
body.is-layout-workspace .layout-properties-panel .ls-property-tab-panel {
  padding: 10px 12px 18px;
  gap: 10px;
}
body.is-layout-workspace .layout-properties-panel .ls-property-card,
body.is-layout-workspace .layout-properties-panel .ls-property-callout,
body.is-layout-workspace .layout-properties-panel .ls-property-details,
body.is-layout-workspace .layout-properties-panel .ls-localized-field,
body.is-layout-workspace .layout-properties-panel .ls-p4-properties-group {
  margin: 0 0 10px;
  padding: 11px;
  border: 1px solid #efbfd2;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 2px 8px rgba(183,91,131,.05);
}
body.is-layout-workspace .layout-properties-panel .ls-property-details,
body.is-layout-workspace .layout-properties-panel .ls-p4-properties-group {
  padding: 0;
  overflow: hidden;
}
body.is-layout-workspace .layout-properties-panel .ls-property-details > summary,
body.is-layout-workspace .layout-properties-panel .ls-p4-properties-group > summary {
  min-height: 42px;
  padding: 9px 11px;
  color: #6f3554;
  font-size: 13px;
  border-radius: 13px;
  background: #fffafd;
}
body.is-layout-workspace .layout-properties-panel .ls-property-card h3 {
  color: #6f3554;
  font-size: 14px;
}
body.is-layout-workspace .layout-properties-panel .ls-property-card-help,
body.is-layout-workspace .layout-properties-panel .ls-property-callout p {
  color: #9c7185;
  font-size: 11px;
  line-height: 1.4;
}
body.is-layout-workspace .layout-properties-panel .ls-p4-field,
body.is-layout-workspace .layout-properties-panel .ls-responsive-property,
body.is-layout-workspace .layout-properties-panel .layout-property-field,
body.is-layout-workspace .layout-properties-panel .layout-property-label,
body.is-layout-workspace .layout-properties-panel .ls-layer-field {
  color: #704259;
  font-size: 12px;
}
body.is-layout-workspace .layout-properties-panel input:not([type="checkbox"]):not([type="color"]):not([type="range"]),
body.is-layout-workspace .layout-properties-panel select,
body.is-layout-workspace .layout-properties-panel textarea {
  min-height: 38px;
  border-radius: 9px;
  font-size: 13px;
}
body.is-layout-workspace .layout-properties-panel .ls-property-footer {
  flex: 0 0 auto;
  min-height: 62px;
  padding: 9px 10px max(9px,env(safe-area-inset-bottom));
  border-top: 1px solid #efbfd2;
  background: rgba(255,250,253,.98);
  box-shadow: none;
}
body.is-layout-workspace .layout-properties-panel .ls-property-footer-action,
body.is-layout-workspace .layout-properties-panel .ls-property-done {
  min-height: 42px;
  border-radius: 10px;
}

/* Guide settings is a body-level dialog, not a clipped <details> descendant. */
body.is-layout-workspace .layout-guide-style {
  position: static;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
}
body.is-layout-workspace #layout-guide-settings-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #78405e;
  background: transparent;
  box-shadow: none;
}
body.is-layout-workspace #layout-guide-settings-button:hover {
  background: #fff0f7;
}
body.is-layout-workspace #layout-guide-settings-button.is-active {
  color: #fff;
  background: linear-gradient(#e97ead,#cd4f88);
}
body.is-layout-workspace .layout-guide-style-panel[hidden] {
  display: none !important;
}
body.is-layout-workspace .layout-guide-style-panel {
  position: fixed !important;
  z-index: 10000 !important;
  padding: 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: 0;
  overflow: hidden;
  color: #6d3151;
  border: 1px solid #e8b7cd;
  border-radius: 16px;
  background: rgba(255,250,253,.99);
  box-shadow: 0 18px 44px rgba(90,35,62,.28);
  animation: ls-guide-dialog-in 140ms ease-out both;
}
@keyframes ls-guide-dialog-in {
  from { opacity: 0; transform: translateY(5px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
body.is-layout-workspace .layout-guide-panel-header {
  min-height: 58px;
  padding: 10px 11px 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #f1bfd3;
  background: #fffafd;
}
body.is-layout-workspace .layout-guide-panel-header > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}
body.is-layout-workspace .layout-guide-panel-header strong {
  color: #6d3151;
  font-size: 16px;
}
body.is-layout-workspace .layout-guide-panel-header small {
  color: #a06c84;
  font-size: 10px;
}
body.is-layout-workspace #layout-guide-settings-close {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 999px;
}
body.is-layout-workspace .layout-guide-panel-fields {
  padding: 11px;
  display: grid;
  gap: 9px;
}
body.is-layout-workspace .layout-guide-panel-fields label {
  min-height: 38px;
  padding: 7px 8px;
  display: grid !important;
  grid-template-columns: 92px minmax(0,1fr) 42px;
  align-items: center;
  gap: 7px;
  color: #704259;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #f0d1df;
  border-radius: 10px;
  background: #fff;
}
body.is-layout-workspace .layout-guide-panel-fields label:has(input[type="color"]) {
  grid-template-columns: minmax(0,1fr) 48px;
}
body.is-layout-workspace .layout-guide-panel-fields input[type="color"] {
  width: 48px;
  height: 30px;
  padding: 2px;
}
body.is-layout-workspace .layout-guide-panel-fields input[type="range"] {
  width: 100%;
}
body.is-layout-workspace .layout-guide-panel-fields output {
  text-align: right;
  color: #a05d7d;
  font-size: 10px;
}

/* Desktop lane remains fixed whether Theme, Elements, or Properties is open. */
@media (min-width: 861px) {
  body.editor-page.is-layout-workspace {
    --stage1-drawer-width: 450px;
    --ls-fixed-canvas-lane: 450px;
  }
  body.is-layout-workspace .layout-components-panel.layout-drawer,
  body.is-layout-workspace .layout-properties-panel.layout-drawer,
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: 450px !important;
    max-width: 450px !important;
  }
  body.is-layout-workspace .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-components-open .layout-canvas-column,
  body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-canvas-column {
    width: calc(100vw - var(--ls-fixed-canvas-lane)) !important;
    margin-left: var(--ls-fixed-canvas-lane) !important;
    transition: none !important;
  }
  body.is-layout-workspace .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-theme-open .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-components-open .layout-preview-viewport,
  body.is-layout-workspace .layout-designer-grid.is-properties-open .layout-preview-viewport {
    width: 100%;
    padding: 80px 12px 78px !important;
    transition: none !important;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 860px) {
  body.is-layout-workspace .layout-components-panel.layout-drawer,
  body.is-layout-workspace .layout-properties-panel.layout-drawer,
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: min(430px,calc(100vw - 26px)) !important;
    max-width: none !important;
    border-radius: 0 18px 18px 0;
  }
}
@media (max-width: 520px) {
  body.is-layout-workspace .layout-components-panel.layout-drawer,
  body.is-layout-workspace .layout-properties-panel.layout-drawer,
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
  }
  body.is-layout-workspace .layout-properties-panel .ls-property-tabs {
    grid-template-columns: repeat(5,minmax(62px,1fr));
    overflow-x: auto;
  }
}

/* Properties section sizing correction v16.3.1 ---------------------------
   Based on v2.4. Only the tab strip and fixed footer are narrowed slightly so
   they remain inside the drawer's usable width beside its right edge. */
body.is-layout-workspace .layout-properties-panel .ls-property-tabs,
body.is-layout-workspace .layout-properties-panel .ls-property-footer {
  width: calc(100% - 6px) !important;
  max-width: calc(100% - 6px) !important;
  align-self: flex-start !important;
}

/* 450 px drawer control containment v16.3.2 ------------------------------
   Keep Theme, Elements, and Properties at their existing drawer widths while
   preventing nested controls from using intrinsic widths that overlap nearby
   controls. */
body.is-layout-workspace .layout-components-panel.layout-drawer,
body.is-layout-workspace .layout-properties-panel.layout-drawer,
body.is-layout-workspace .layout-theme-drawer.layout-drawer,
body.is-layout-workspace .layout-theme-shell,
body.is-layout-workspace .layout-component-list,
body.is-layout-workspace .layout-component-properties,
body.is-layout-workspace .layout-theme-content {
  min-width: 0;
  box-sizing: border-box;
}

body.is-layout-workspace .layout-components-panel *,
body.is-layout-workspace .layout-components-panel *::before,
body.is-layout-workspace .layout-components-panel *::after,
body.is-layout-workspace .layout-properties-panel *,
body.is-layout-workspace .layout-properties-panel *::before,
body.is-layout-workspace .layout-properties-panel *::after,
body.is-layout-workspace .layout-theme-drawer *,
body.is-layout-workspace .layout-theme-drawer *::before,
body.is-layout-workspace .layout-theme-drawer *::after {
  box-sizing: border-box;
}

body.is-layout-workspace .layout-components-panel input,
body.is-layout-workspace .layout-components-panel select,
body.is-layout-workspace .layout-components-panel textarea,
body.is-layout-workspace .layout-properties-panel input,
body.is-layout-workspace .layout-properties-panel select,
body.is-layout-workspace .layout-properties-panel textarea,
body.is-layout-workspace .layout-theme-drawer input,
body.is-layout-workspace .layout-theme-drawer select,
body.is-layout-workspace .layout-theme-drawer textarea {
  max-width: 100%;
}

/* Text formatting: the general slider/value control is 133 px wide, but the
   toolbar previously allocated only 70 px to it. Give it a compact bounded
   track/value layout so the color picker owns a separate, non-overlapping cell. */
body.is-layout-workspace .layout-properties-panel .ls-rich-toolbar {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: 44px 44px minmax(92px, 1fr) minmax(96px, 104px) 48px;
  align-items: center;
  overflow: hidden;
}
body.is-layout-workspace .layout-properties-panel .ls-rich-toolbar > * {
  min-width: 0;
  max-width: 100%;
}
body.is-layout-workspace .layout-properties-panel .ls-rich-toolbar .ls-range-control {
  width: 100%;
  min-width: 0;
  max-width: 104px;
  grid-template-columns: minmax(46px, 1fr) 42px;
  gap: 4px;
}
body.is-layout-workspace .layout-properties-panel .ls-rich-toolbar .ls-range-control .ls-range-value {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
}
body.is-layout-workspace .layout-properties-panel .ls-rich-toolbar > input[type="color"] {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  justify-self: end;
}

/* Other 450 px workspace rows: allow the flexible cells to shrink instead of
   pushing buttons, color pickers, number fields, or menus outside the drawer. */
body.is-layout-workspace .layout-components-panel .ls-layer-row > *,
body.is-layout-workspace .layout-components-panel .ls-layer-menu-grid > *,
body.is-layout-workspace .layout-components-panel .ls-add-tools > *,
body.is-layout-workspace .layout-components-panel .ls-preset-row > *,
body.is-layout-workspace .layout-theme-drawer .layout-theme-profilebar > *,
body.is-layout-workspace .layout-theme-drawer .theme-token-row > *,
body.is-layout-workspace .layout-theme-drawer .theme-range-row > *,
body.is-layout-workspace .layout-theme-drawer .theme-simple-row > *,
body.is-layout-workspace .layout-theme-drawer .theme-compact-field > *,
body.is-layout-workspace .layout-theme-drawer .theme-base-element-body > *,
body.is-layout-workspace .layout-theme-drawer .theme-preset-card > * {
  min-width: 0;
  max-width: 100%;
}
body.is-layout-workspace .layout-theme-drawer .theme-token-row input[type="text"],
body.is-layout-workspace .layout-theme-drawer .theme-simple-row input,
body.is-layout-workspace .layout-theme-drawer .theme-compact-field input,
body.is-layout-workspace .layout-theme-drawer .theme-range-row input[type="range"] {
  width: 100%;
  min-width: 0;
}

@media (max-width: 380px) {
  body.is-layout-workspace .layout-properties-panel .ls-rich-toolbar {
    grid-template-columns: 44px 44px minmax(0, 1fr) 48px;
  }
  body.is-layout-workspace .layout-properties-panel .ls-rich-toolbar > select {
    grid-column: 3;
    grid-row: 1;
  }
  body.is-layout-workspace .layout-properties-panel .ls-rich-toolbar > .ls-range-control {
    grid-column: 1 / 4;
    grid-row: 2;
    max-width: none;
  }
  body.is-layout-workspace .layout-properties-panel .ls-rich-toolbar > input[type="color"] {
    grid-column: 4;
    grid-row: 1 / 3;
    align-self: stretch;
    height: 100%;
  }
}


/* ==========================================================
   v2.4.3 — unified top command dock
   Places the workspace switcher directly beside the command bar while
   preserving two separate surfaces and all existing toolbar behavior.
   ========================================================== */
body.is-layout-workspace .editor-tabs {
  left: auto;
  right: var(--ls-editor-tabs-right, 620px);
  top: 14px;
  min-height: 52px;
  padding: 6px;
  gap: 5px;
  flex-direction: row;
  align-items: center;
  border-color: var(--ls6-line);
  border-radius: 17px;
  background: rgba(255,250,253,.96);
  box-shadow: 0 8px 24px rgba(131,67,96,.14);
}

body.is-layout-workspace .editor-tabs::before { display: none; }

body.is-layout-workspace .layout-topbar {
  min-height: 52px;
  height: 52px;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
}

body.is-layout-workspace .layout-toolbar-scroll {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  overflow-x: auto;
  overflow-y: hidden;
}


body.is-layout-workspace .editor-tabs button {
  min-width: 38px;
  min-height: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 11px;
}

/* Add is the first command; More remains the final command. */
body.is-layout-workspace .layout-topbar > .layout-add-menu { order: -1; }
body.is-layout-workspace .layout-add-popover {
  left: 0;
  right: auto;
}

@media (max-width: 860px) {
  body.is-layout-workspace .editor-tabs {
    top: 10px;
    flex-direction: row;
  }
  body.is-layout-workspace .layout-topbar { max-width: calc(100vw - 142px); }
}

@media (max-width: 620px) {
  body.is-layout-workspace .layout-topbar { max-width: calc(100vw - 136px); }
  body.is-layout-workspace .layout-add-popover {
    width: auto;
    max-height: calc(100vh - 96px);
    position: fixed;
    top: max(78px, calc(env(safe-area-inset-top) + 66px));
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
  }
}

/* Page workspace v2.5.0 Packet 02 ----------------------------------------- */
body.is-layout-workspace .layout-theme-drawer.layout-drawer {
  width: 450px !important;
  max-width: 450px !important;
  min-width: 450px !important;
}
.layout-theme-profilebar {
  grid-template-columns: minmax(0, 1fr) !important;
}
.layout-theme-profilebar select {
  min-width: 0;
  width: 100% !important;
}
.layout-theme-tabs {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.layout-theme-tabs button {
  min-width: 0;
  overflow: hidden;
}
.layout-theme-tabs button small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layout-theme-footer {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
}
.layout-theme-footer button {
  min-width: 0;
  white-space: normal;
  line-height: 1.2;
}

.page-layout-control-grid,
.page-spacing-control,
.page-layout-field,
.page-region-geometry,
.page-appearance-details,
.page-decoration-slot,
.page-appearance-field,
.page-color-control,
.page-layout-input-row,
.page-responsive-summary,
.page-structural-toggle {
  min-width: 0;
}
.page-layout-control-grid {
  display: grid;
  gap: 9px;
}
.page-layout-field {
  display: grid;
  gap: 5px;
}
.page-layout-field-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.page-layout-field-heading > span:first-child {
  min-width: 0;
  color: #704259;
  font-size: 12.5px;
  line-height: 1.3;
}
.page-responsive-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid #dda5bd;
  border-radius: 999px;
  color: #963f68;
  background: #fff3f8;
  font-size: 9px;
  font-weight: 700;
}
.page-responsive-badge.is-inherited {
  color: #6e5b66;
  border-style: dashed;
  background: #fff;
}
.page-layout-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}
.page-layout-input-row.has-range {
  grid-template-columns: minmax(0, 1fr) 76px auto;
}
.page-layout-input-row input,
.page-layout-input-row select {
  min-width: 0;
  width: 100%;
}
.page-layout-input-row input[type="number"] {
  width: 76px;
  max-width: 76px;
}
.page-layout-input-row input[type="range"] {
  width: 100%;
}
.page-layout-field-reset {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
}
.page-layout-field-help {
  color: #9c7185;
  font-size: 10.5px;
  line-height: 1.4;
}
.page-layout-action {
  width: 100%;
  min-width: 0;
  margin-top: 9px;
}

.page-spacing-control {
  margin-top: 9px;
  padding: 9px;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid #f0cfdd;
  border-radius: 11px;
  background: #fffafd;
}
.page-spacing-arrow {
  min-width: 0;
  height: 96px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  justify-items: center;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}
.page-spacing-arrow-glyph {
  height: var(--page-spacing-arrow-length, 18px);
  min-height: 18px;
  display: grid;
  place-items: center;
  color: #c3487d;
  font-size: clamp(18px, calc(var(--page-spacing-arrow-length, 18px) * .48), 38px);
  line-height: 1;
  transition: height 120ms ease, font-size 120ms ease;
}
.page-spacing-arrow b {
  color: #713c56;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.page-spacing-arrow small {
  color: #9c7185;
  font-size: 8.8px;
  text-align: center;
}

.page-structural-toggle {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}
.page-structural-toggle > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.page-structural-toggle strong {
  color: #704259;
  font-size: 12.5px;
}
.page-structural-toggle small {
  color: #9c7185;
  font-size: 10px;
  line-height: 1.35;
}
.page-structural-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.page-toggle-switch {
  width: 46px;
  height: 26px;
  position: relative;
  border: 1px solid #d9a9bd;
  border-radius: 999px;
  background: #f6e7ee;
  transition: background 120ms ease, border-color 120ms ease;
}
.page-toggle-switch::after {
  content: "";
  width: 20px;
  height: 20px;
  position: absolute;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(94, 45, 69, .25);
  transition: transform 120ms ease;
}
.page-structural-toggle input:checked + .page-toggle-switch {
  border-color: #bd4779;
  background: #d95f93;
}
.page-structural-toggle input:checked + .page-toggle-switch::after {
  transform: translateX(20px);
}

.page-region-map {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(54px, .62fr) minmax(0, 1.8fr) minmax(54px, .62fr);
  grid-template-rows: 32px 62px 30px;
  gap: 4px;
  padding: 5px;
  border: 1px solid #ddb1c4;
  border-radius: 12px;
  background: #fff6fa;
}
.page-region-map button {
  min-width: 0;
  min-height: 0;
  padding: 4px 5px;
  border-radius: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
}
.page-region-map button.is-active {
  color: #fff;
  border-color: #a93869;
  background: linear-gradient(#df76a6, #c94c84);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.38);
}
.page-region-page {
  grid-column: 2;
  grid-row: 1 / 4;
  pointer-events: auto;
  border-style: dashed !important;
  z-index: 0;
}
.page-region-left { grid-column: 1; grid-row: 1 / 4; }
.page-region-right { grid-column: 3; grid-row: 1 / 4; }
.page-region-top,
.page-region-body,
.page-region-bottom {
  grid-column: 2;
  position: relative;
  z-index: 1;
  margin: 2px 8px;
}
.page-region-top { grid-row: 1; }
.page-region-body { grid-row: 2; }
.page-region-bottom { grid-row: 3; }

.page-region-geometry {
  margin: 7px 0 9px;
  padding: 8px;
  border: 1px dashed #dfb0c7;
  border-radius: 10px;
  background: #fff9fc;
}
.page-readonly-value {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.page-readonly-value span {
  color: #765064;
  font-size: 11.5px;
}
.page-readonly-value strong {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid #e5ccd7;
  border-radius: 7px;
  color: #7c5770;
  background: #f7f1f4;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.page-appearance-details {
  margin-top: 8px;
  border: 1px solid #efd0dd;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.page-appearance-details > summary {
  min-width: 0;
  padding: 9px 10px;
  cursor: pointer;
  color: #713c56;
  background: #fff8fb;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}
.page-appearance-details > summary::-webkit-details-marker { display: none; }
.page-appearance-details > summary::after {
  content: "＋";
  float: right;
  color: #b44b78;
}
.page-appearance-details[open] > summary::after { content: "−"; }
.page-appearance-details > :not(summary) {
  margin-left: 9px;
  margin-right: 9px;
}
.page-appearance-details > :last-child { margin-bottom: 9px; }
.page-decoration-slot {
  margin: 7px 9px 0 !important;
  background: #fffafd;
}
.page-appearance-field {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}
.page-appearance-field > span {
  color: #704259;
  font-size: 11px;
}
.page-appearance-field input,
.page-appearance-field select {
  min-width: 0;
  width: 100%;
}
.page-appearance-field small {
  color: #9c7185;
  font-size: 9.5px;
  line-height: 1.35;
}
.page-color-control {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 7px;
}
.page-color-control input[type="color"] {
  width: 38px;
  min-width: 38px;
  height: 34px;
  padding: 2px;
}
.page-color-control input[type="text"] {
  min-width: 0;
}
.page-responsive-summary {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid #ead0dc;
  border-radius: 9px;
  background: #fffafd;
}
.page-responsive-summary strong { color: #723e58; font-size: 12px; }
.page-responsive-summary span { color: #9a7083; font-size: 10px; }

.page-spacing-overlay-layer {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 35;
  pointer-events: none;
  overflow: visible;
}
.page-spacing-overlay-layer[hidden] { display: none !important; }
.page-spacing-overlay {
  position: absolute;
  min-height: 14px;
  display: grid;
  place-items: center;
  color: #bd2f70;
  border: 1px dashed rgba(199, 54, 116, .9);
  background: rgba(255, 228, 240, .52);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7);
  font: 700 11px/1.1 Arial, sans-serif;
  overflow: visible;
}
.page-spacing-overlay span {
  font-size: 20px;
  text-shadow: 0 1px #fff;
}
.page-spacing-overlay b {
  padding: 2px 5px;
  border: 1px solid rgba(183, 60, 111, .5);
  border-radius: 5px;
  background: rgba(255,255,255,.92);
  font-size: 10px;
  white-space: nowrap;
}
.page-spacing-overlay.is-zero {
  border-style: solid;
  background: rgba(255, 244, 249, .72);
}
.page-spacing-overlay.is-end {
  color: #8e3a9f;
  border-color: rgba(125, 64, 165, .82);
  background: rgba(240, 226, 255, .48);
}

.ls-structural-page-notice {
  gap: 10px;
}
.ls-structural-page-notice .primary-button {
  width: min(220px, 100%);
}

@media (max-width: 860px) {
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: min(450px, calc(100vw - 26px)) !important;
    min-width: 0 !important;
    max-width: none !important;
  }
  .page-spacing-control {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}
@media (max-width: 520px) {
  body.is-layout-workspace .layout-theme-drawer.layout-drawer {
    width: 100vw !important;
  }
  .layout-theme-tabs button small { font-size: 8.5px; }
  .page-spacing-control { grid-template-columns: 1fr; }
  .page-spacing-arrow { height: 70px; }
}
/* Keep the selected structural region visually authoritative over the global
   neutral button surface. */
body.is-layout-workspace .layout-theme-drawer .page-region-map button.is-active {
  color: #fff;
  border-color: #a93869;
  background: linear-gradient(#df76a6, #c94c84);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.38);
}

/* Packet 04 — Theme, Type, Elements, and Presets consolidation. */
.theme-workspace-section,
.theme-workspace-section * { box-sizing: border-box; }
.theme-token-grid,
.theme-type-body,
.theme-base-element-body,
.theme-preset-editor-body,
.theme-preset-editor-list { min-width: 0; }
.theme-check-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  color: #704259;
  font-size: 11px;
}
.theme-check-row input { width: 18px; height: 18px; margin: 0; }
.theme-type-row,
.theme-preset-editor {
  min-width: 0;
  margin-top: 8px;
  border: 1px solid #efd0dd;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.theme-type-row > summary,
.theme-preset-editor > summary {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  cursor: pointer;
  list-style: none;
  color: #713c56;
  background: #fff8fb;
}
.theme-type-row > summary::-webkit-details-marker,
.theme-preset-editor > summary::-webkit-details-marker { display: none; }
.theme-type-row > summary strong,
.theme-preset-editor > summary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.theme-type-row > summary small,
.theme-preset-editor > summary small {
  max-width: 180px;
  overflow: hidden;
  color: #9a7083;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-type-body,
.theme-preset-editor-body {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 9px;
  border-top: 1px solid #f2dce5;
}
.theme-role-color { min-width: 0; display: grid; gap: 4px; }
.theme-preset-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin: 8px 0;
}
.theme-preset-toolbar button { min-width: 0; }
.theme-preset-editor-list { display: grid; gap: 1px; }
.theme-preset-live-preview {
  min-width: 0;
  min-height: 78px;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px dashed #dcaac1;
  border-radius: 9px;
  color: #73445c;
  background-color: #fff9fc;
  background-repeat: no-repeat;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.theme-preset-live-preview.is-border-image { border-style: solid; }
.theme-preset-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 7px;
  border-top: 1px dashed #efd0dd;
}
.theme-preset-actions button { min-width: 0; }
.preset-inset-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 0 9px 9px;
}
.preset-inset-grid .page-appearance-field { min-width: 0; }
.ls-role-summary {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px dashed #dfb0c7;
  border-radius: 8px;
  background: #fff9fc;
}
.ls-role-summary strong { color: #703f57; font-size: 11.5px; }
.ls-role-summary small {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #956d80;
  font-size: 9.5px;
}
body.is-layout-workspace .layout-theme-drawer .theme-token-row,
body.is-layout-workspace .layout-theme-drawer .theme-simple-row,
body.is-layout-workspace .layout-theme-drawer .theme-range-row,
body.is-layout-workspace .layout-theme-drawer .theme-compact-field,
body.is-layout-workspace .layout-theme-drawer .page-appearance-field {
  min-width: 0;
  max-width: 100%;
}
body.is-layout-workspace .layout-theme-drawer input,
body.is-layout-workspace .layout-theme-drawer select,
body.is-layout-workspace .layout-theme-drawer textarea {
  min-width: 0;
  max-width: 100%;
}
body.is-layout-workspace .layout-theme-drawer .theme-range-row {
  grid-template-columns: minmax(82px, .75fr) minmax(0, 1fr) 72px;
}
body.is-layout-workspace .layout-theme-drawer .theme-token-row {
  grid-template-columns: minmax(82px, .72fr) 38px minmax(0, 1fr);
}
@media (max-width: 520px) {
  .preset-inset-grid { grid-template-columns: 1fr; }
  body.is-layout-workspace .layout-theme-drawer .theme-range-row,
  body.is-layout-workspace .layout-theme-drawer .theme-token-row { grid-template-columns: 1fr; }
}

/* Packet 05: Divider editor preview. */
body.is-layout-workspace .ls-p4-divider-preview { width:100%; height:48px; object-fit:contain; border:1px solid #ead0dd; border-radius:8px; background:#fffafd; padding:6px; box-sizing:border-box; }

/* Packet 06 — scrollable Container properties and reusable scrollbar presets. */
.ls-scroll-warning,
.ls-scroll-metrics,
.ls-scroll-state-editor,
.theme-scrollbar-toolbar,
.theme-scrollbar-live-preview,
.theme-scrollbar-state,
.theme-scrollbar-slice-grid,
.theme-scrollbar-preview-content { box-sizing: border-box; min-width: 0; max-width: 100%; }

.ls-scroll-warning {
  display: grid;
  gap: 7px;
  margin-top: 9px;
  padding: 10px;
  border: 1px solid #e7b0c6;
  border-radius: 9px;
  color: #714259;
  background: #fff7fa;
}
.ls-scroll-warning strong { font-size: 11px; }
.ls-scroll-warning p { margin: 0; color: #946d80; font-size: 9.5px; line-height: 1.45; }
.ls-scroll-warning button { justify-self: start; min-width: 0; }

.ls-scroll-state-editor {
  display: grid;
  gap: 7px;
  margin: 7px 0;
  padding: 8px;
  border: 1px dashed #e3b8cb;
  border-radius: 8px;
  background: #fffafd;
}
.ls-scroll-state-editor > strong { color: #733f58; font-size: 10.5px; }

.ls-scroll-metrics {
  display: grid;
  grid-template-columns: minmax(82px, .7fr) minmax(0, 1fr);
  gap: 5px 9px;
  margin: 0;
  font-size: 10px;
}
.ls-scroll-metrics dt { color: #8e6578; }
.ls-scroll-metrics dd { min-width: 0; margin: 0; color: #60374c; overflow-wrap: anywhere; }

.theme-scrollbar-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  margin: 8px 0;
}
.theme-scrollbar-toolbar select,
.theme-scrollbar-toolbar button { min-width: 0; max-width: 100%; }
.theme-scrollbar-toolbar button { padding-inline: 9px; white-space: nowrap; }

.theme-scrollbar-live-preview {
  display: grid;
  place-items: center;
  min-height: 180px;
  margin: 9px 0;
  padding: 14px;
  border: 1px dashed #dcaac1;
  border-radius: 10px;
  background:
    linear-gradient(45deg, rgba(247,170,200,.08) 25%, transparent 25%) 0 0/18px 18px,
    linear-gradient(-45deg, rgba(247,170,200,.08) 25%, transparent 25%) 0 9px/18px 18px,
    #fffafd;
  overflow: visible;
}
.theme-scrollbar-live-preview .ls-custom-container {
  position: relative;
  flex: none;
  border: 1px solid #e5b2c8;
  border-radius: 5px;
  color: #60374c;
  background: #fff;
  box-shadow: 0 4px 14px rgba(110,58,83,.08);
}
.theme-scrollbar-preview-content {
  position: relative;
  padding: 8px;
  color: #674055;
  background:
    linear-gradient(rgba(255,255,255,.88), rgba(255,255,255,.88)),
    repeating-linear-gradient(0deg, #fbd8e6 0 1px, transparent 1px 23px);
  font-size: 10px;
  line-height: 1.45;
}
.theme-scrollbar-preview-content strong { color: #a93869; font-size: 11px; }
.theme-scrollbar-preview-content p { max-width: 240px; margin: 9px 0; }

.theme-scrollbar-state {
  display: grid;
  gap: 7px;
  margin: 7px 0;
  padding: 8px;
  border: 1px dashed #e2b7c9;
  border-radius: 8px;
  background: #fffafd;
}
.theme-scrollbar-state > strong { color: #734057; font-size: 10.5px; }
.theme-scrollbar-slice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

body.is-layout-workspace .layout-theme-drawer .theme-scrollbar-toolbar,
body.is-layout-workspace .layout-theme-drawer .theme-scrollbar-live-preview,
body.is-layout-workspace .layout-theme-drawer .theme-scrollbar-state,
body.is-layout-workspace .layout-theme-drawer .theme-scrollbar-slice-grid,
body.is-layout-workspace .content-properties-drawer .ls-scroll-warning,
body.is-layout-workspace .content-properties-drawer .ls-scroll-metrics,
body.is-layout-workspace .content-properties-drawer .ls-scroll-state-editor {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 520px) {
  .theme-scrollbar-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .theme-scrollbar-toolbar button:last-child { grid-column: 1 / -1; }
  .theme-scrollbar-slice-grid { grid-template-columns: 1fr; }
  .ls-scroll-metrics { grid-template-columns: 1fr; gap: 2px; }
  .ls-scroll-metrics dd { margin-bottom: 5px; }
}

/* Preserve the locked 450 px width for every desktop editor drawer. */
@media (min-width: 861px) {
  body.is-layout-workspace #layout-components-drawer.layout-drawer,
  body.is-layout-workspace #layout-properties-drawer.layout-drawer,
  body.is-layout-workspace #layout-theme-drawer.layout-drawer {
    width: 450px !important;
    min-width: 450px !important;
    max-width: 450px !important;
  }
}
