/* Pagetna website editor chrome (design-system/pagetna/MASTER.md §4 "Editor").
   Covers the DirectHtml editor (wizard/_direct_html_*), the legacy inline/
   component editor (wizard/_workspace_editor, _component_editor) and the shared
   undo/redo control (wizard/_editor_history).
   The customer's website renders inside a sandboxed iframe (DirectHtml) or
   inside .inline-canvas (legacy); nothing here styles that content.
   Class names stay `direct-*` / `ie-*` because the Stimulus controllers and the
   browser tests use them as hooks. */

/* ======================================================================
   1. Editor root, local tokens and resets
   ====================================================================== */
.pg .direct-html-editor {
  --ed-sticky-top: var(--pg-topbar);
  --ed-panel-w: 360px;
  --ed-ctl: 40px;
  --ed-canvas-bg: var(--pg-surface-3);
  --ed-scrim: color-mix(in srgb, var(--pg-night) 62%, transparent);
  --ed-selected: color-mix(in srgb, var(--pg-halo) 24%, transparent);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100dvh - var(--pg-topbar));
  color: var(--pg-text);
  font-size: var(--pg-text-md);
  line-height: 1.5;
}
/* Touch screens get full 44px targets. */
@media (pointer: coarse) { .pg .direct-html-editor { --ed-ctl: 44px; } }
/* The hidden attribute must beat every display rule below: the controllers
   show and hide whole panels with it. */
.pg .direct-html-editor [hidden] { display: none !important; }
.pg .direct-html-editor :where(button, input, select, textarea) { font: inherit; color: inherit; }
.pg .direct-html-editor :where(h2, h3, h4) { margin: 0; color: var(--pg-ink); }
.pg .direct-html-editor :where(p) { margin: 0; }
.pg .direct-html-editor .direct-icon,
.pg .direct-html-editor .pg-icon { width: var(--pg-icon-md); height: var(--pg-icon-md); flex: none; stroke-width: 1.75; }
.pg .direct-html-editor :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--pg-primary); outline-offset: 2px; }
.pg .direct-html-editor :is(button, input, select, textarea):disabled { opacity: .45; cursor: not-allowed; }
.pg .direct-html-editor .muted { color: var(--pg-muted); }
.pg .direct-html-editor .small-text { font-size: var(--pg-text-sm); }
.pg .direct-html-editor .direct-kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--pg-line-strong); border-block-end-width: 2px; border-radius: var(--pg-radius-xs); background: var(--pg-surface); color: var(--pg-muted); font-family: var(--pg-font-mono); font-size: var(--pg-text-xs); font-weight: var(--pg-weight-medium); line-height: 1; }

/* ======================================================================
   2. Shared editor buttons
   ====================================================================== */
.pg .direct-html-editor :is(.direct-save-button, .direct-add-button, .direct-secondary-button, .direct-danger-button, .direct-publish-link) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--pg-space-2);
  min-height: var(--ed-ctl); padding: 0 var(--pg-space-4);
  border: 1px solid transparent; border-radius: var(--pg-radius-sm);
  font-size: var(--pg-text-md); font-weight: var(--pg-weight-semibold); line-height: 1.25; text-align: center; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background-color var(--pg-dur) var(--pg-ease), border-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease), color var(--pg-dur) var(--pg-ease), filter var(--pg-dur) var(--pg-ease), transform var(--pg-dur-fast) var(--pg-ease);
}
.pg .direct-html-editor :is(.direct-save-button, .direct-add-button, .direct-secondary-button, .direct-danger-button, .direct-publish-link):active:not(:disabled) { transform: scale(.98); }
.pg .direct-html-editor :is(.direct-save-button, .direct-add-button, .direct-secondary-button, .direct-danger-button, .direct-publish-link) .direct-icon,
.pg .direct-html-editor :is(.direct-save-button, .direct-add-button, .direct-secondary-button, .direct-danger-button, .direct-publish-link) .pg-icon { width: 18px; height: 18px; }
/* Save is the one gradient action; it keeps the brand blue on the midnight toolbar too. */
.pg .direct-html-editor .direct-save-button { border-color: transparent; background: var(--pg-gradient-start) border-box; color: var(--pg-on-primary); box-shadow: 0 1px 2px color-mix(in srgb, var(--pg-brand) 30%, transparent), 0 6px 16px color-mix(in srgb, var(--pg-brand) 24%, transparent), inset 0 1px 0 color-mix(in srgb, var(--pg-on-primary) 22%, transparent); }
.pg .direct-html-editor .direct-save-button:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 1px 2px color-mix(in srgb, var(--pg-brand) 30%, transparent), 0 10px 28px color-mix(in srgb, var(--pg-brand) 34%, transparent), inset 0 1px 0 color-mix(in srgb, var(--pg-on-primary) 22%, transparent); }
.pg .direct-html-editor .direct-add-button { background: var(--pg-primary-soft); color: var(--pg-primary-hover); }
.pg .direct-html-editor .direct-add-button:hover { background: var(--pg-primary-soft-2); }
.pg .direct-html-editor :is(.direct-secondary-button, .direct-publish-link) { background: var(--pg-surface); border-color: var(--pg-line-strong); color: var(--pg-ink); box-shadow: var(--pg-shadow-xs); }
.pg .direct-html-editor :is(.direct-secondary-button, .direct-publish-link):hover { background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-danger-button { background: var(--pg-danger); border-color: var(--pg-danger); color: var(--pg-on-primary); }
.pg .direct-html-editor .direct-danger-button:hover { background: var(--pg-danger-hover); }
.pg .direct-html-editor .direct-icon-button {
  display: inline-grid; place-items: center; flex: none;
  width: var(--ed-ctl); height: var(--ed-ctl); padding: 0;
  border: 1px solid transparent; border-radius: var(--pg-radius-sm);
  background: transparent; color: var(--pg-muted); cursor: pointer;
  transition: background-color var(--pg-dur) var(--pg-ease), color var(--pg-dur) var(--pg-ease), border-color var(--pg-dur) var(--pg-ease), transform var(--pg-dur-fast) var(--pg-ease);
}
.pg .direct-html-editor .direct-icon-button:hover { background: var(--pg-surface-2); color: var(--pg-ink); }
.pg .direct-html-editor .direct-icon-button:active:not(:disabled, .direct-panel-handle) { transform: scale(.92); }
.pg .direct-html-editor .direct-icon-button[aria-pressed=true] { background: var(--pg-primary-soft); color: var(--pg-primary-hover); }
.pg .direct-html-editor .direct-danger { color: var(--pg-danger); }
.pg .direct-html-editor .direct-icon-button.direct-danger:hover { background: var(--pg-danger-soft); color: var(--pg-danger); }
.pg .direct-html-editor .direct-text-button {
  display: inline-flex; align-items: center; gap: var(--pg-space-2); min-height: var(--ed-ctl); padding: 0 var(--pg-space-1);
  border: 0; background: none; color: var(--pg-primary); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); text-align: start; cursor: pointer;
}
.pg .direct-html-editor .direct-text-button:hover { color: var(--pg-primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.pg .direct-html-editor .direct-text-button .direct-icon { width: 16px; height: 16px; }
.pg .direct-html-editor .direct-text-button.direct-danger { color: var(--pg-danger); }

/* Pending actions keep their size and show a spinner. */
.pg .direct-html-editor [aria-busy=true] { cursor: progress; }
.pg .direct-html-editor :is(button, a, input[type=submit])[aria-busy=true] { position: relative; pointer-events: none; }
.pg .direct-html-editor :is(button, a)[aria-busy=true]::after,
.pg .direct-html-editor .direct-save-status[data-state=saving]::before {
  content: ""; display: inline-block; flex: none; inline-size: 14px; block-size: 14px; box-sizing: border-box;
  border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
  animation: pg-spin .65s linear infinite; vertical-align: middle;
}

/* The editor toolbar owns saving and the publish hand-off, so the workspace's
   own save bar and header call to action stay in the DOM (the controllers
   measure the bar) but are not shown twice while the DirectHtml editor is open. */
.pg:has(.direct-html-editor) .pg-pub-savebar.publication-action-bar,
.pg:has(.direct-html-editor) .publication-heading-actions > a.pg-btn:not(.pg-pub-bar__visit) { display: none; }

/* ======================================================================
   3. Top toolbar (sticky): page context row + tools row
   ====================================================================== */
.pg .direct-html-editor .direct-editor-toolbar {
  position: sticky; z-index: var(--pg-z-sticky); inset-block-start: var(--ed-sticky-top);
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "pages langs . save" "tools tools tools tools";
  align-items: center;
  gap: 0 var(--pg-space-4);
  border-block-end: 1px solid var(--pg-night-line-strong);
  background: radial-gradient(70% 180% at 50% -90%, color-mix(in srgb, var(--pg-brand) 34%, transparent), transparent 70%), color-mix(in srgb, var(--pg-night) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 18px 32px -22px color-mix(in srgb, var(--pg-night-3) 72%, transparent);
}
/* Midnight tool deck: the header carries pg-night, so the neutrals below are
   the night set. The aurora hairline is the only decoration. */
.pg .direct-html-editor .direct-editor-toolbar::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: -1px; height: 1px; background: var(--pg-aurora); opacity: .6; pointer-events: none; }
.pg .direct-html-editor .direct-editor-toolbar .direct-page-picker select { border-color: var(--pg-line-strong); background-color: var(--pg-surface-2); box-shadow: none; }
.pg .direct-html-editor .direct-editor-toolbar :is(.direct-language-picker [aria-current=page], .direct-preview-tools .direct-icon-button[aria-pressed=true]) { background: var(--ed-selected); color: var(--pg-ink); box-shadow: inset 0 0 0 1px var(--pg-line-strong); }
.pg .direct-html-editor .direct-editor-toolbar .direct-add-button { border-color: var(--pg-primary-line); }
.pg .direct-html-editor .direct-editor-toolbar .direct-publish-link { border-color: var(--pg-line-strong); background: var(--pg-surface-2); box-shadow: none; }
.pg .direct-html-editor .direct-editor-toolbar .direct-publish-link:hover { background: var(--pg-surface-3); }
.pg .direct-html-editor .direct-editor-toolbar .direct-publish-link .pg-icon { color: var(--pg-gold); }
.pg .direct-html-editor .direct-editor-toolbar .direct-delete-page-button:hover:enabled { background: color-mix(in srgb, var(--pg-danger) 28%, transparent); color: color-mix(in srgb, var(--pg-danger) 36%, var(--pg-on-inverse)); }
.pg .direct-html-editor .direct-editor-toolbar .direct-save-status { color: color-mix(in srgb, var(--pg-success) 34%, var(--pg-on-inverse)); }
.pg .direct-html-editor .direct-editor-toolbar .direct-save-status[data-state=pending] { color: var(--pg-gold); }
.pg .direct-html-editor .direct-editor-toolbar .direct-save-status[data-state=saving] { color: var(--pg-primary); }
.pg .direct-html-editor .direct-editor-toolbar .direct-save-status[data-state=error] { color: color-mix(in srgb, var(--pg-danger) 40%, var(--pg-on-inverse)); }
.pg .direct-html-editor .direct-editor-toolbar .editor-history-feedback { border: 1px solid var(--pg-night-line-strong); }
.pg .direct-html-editor .direct-editor-toolbar .editor-history.editor-history-floating { border-color: var(--pg-night-line-strong); background: var(--pg-night-2); }
.pg .direct-html-editor .direct-editor-pages { grid-area: pages; display: flex; align-items: center; gap: var(--pg-space-1); min-width: 0; padding: var(--pg-space-2) 0 var(--pg-space-2) 0; padding-inline-start: var(--pg-space-4); }
.pg .direct-html-editor .direct-editor-languages { grid-area: langs; display: flex; align-items: center; gap: var(--pg-space-3); min-width: 0; }
.pg .direct-html-editor .direct-editor-saving { grid-area: save; display: flex; align-items: center; justify-content: flex-end; gap: var(--pg-space-2); min-width: 0; padding-inline-end: var(--pg-space-4); }
.pg .direct-html-editor .direct-editor-tools {
  grid-area: tools; display: flex; align-items: center; gap: var(--pg-space-2);
  min-width: 0; min-height: 52px; padding: var(--pg-space-1) var(--pg-space-4);
  border-block-start: 1px solid var(--pg-line); background: var(--pg-surface);
}

/* Page switcher */
.pg .direct-html-editor .direct-page-picker { position: relative; display: flex; align-items: center; min-width: 0; }
.pg .direct-html-editor .direct-page-picker-icon { position: absolute; inset-inline-start: 12px; display: grid; color: var(--pg-subtle); pointer-events: none; }
.pg .direct-html-editor .direct-page-picker select {
  width: 220px; max-width: 100%; min-height: var(--ed-ctl); padding: 0 36px 0 36px;
  border: 1px solid var(--pg-line-strong); border-radius: var(--pg-radius-sm);
  background: var(--pg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  color: var(--pg-ink); font-size: var(--pg-text-md); font-weight: var(--pg-weight-semibold); text-overflow: ellipsis;
  box-shadow: var(--pg-shadow-xs); appearance: none; cursor: pointer;
}
html[dir=rtl] .pg .direct-html-editor .direct-page-picker select { background-position: left 10px center; }
.pg .direct-html-editor .direct-page-picker select:hover { border-color: var(--pg-subtle); }
.pg .direct-html-editor .direct-editor-page-actions { display: flex; gap: 2px; }
.pg .direct-html-editor :is(.direct-new-page-button, .direct-delete-page-button) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--pg-space-2);
  min-width: var(--ed-ctl); min-height: var(--ed-ctl); padding: 0 var(--pg-space-2);
  border: 1px solid transparent; border-radius: var(--pg-radius-sm); background: transparent;
  color: var(--pg-muted); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); white-space: nowrap; cursor: pointer;
  transition: background-color var(--pg-dur) var(--pg-ease), color var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-new-page-button:hover { background: var(--pg-primary-soft); color: var(--pg-primary-hover); }
.pg .direct-html-editor .direct-delete-page-button:hover:enabled { background: var(--pg-danger-soft); color: var(--pg-danger); }
.pg .direct-html-editor .direct-toolbar-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Language switch + "all languages" switch */
.pg .direct-html-editor .direct-language-picker { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--pg-radius-md); background: var(--pg-surface-3); }
.pg .direct-html-editor .direct-language-picker a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 var(--pg-space-3);
  border-radius: var(--pg-radius-sm); color: var(--pg-muted); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); white-space: nowrap;
  transition: background-color var(--pg-dur) var(--pg-ease), color var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-language-picker a:hover { color: var(--pg-ink); }
.pg .direct-html-editor .direct-language-picker [aria-current=page] { background: var(--pg-surface); color: var(--pg-ink); box-shadow: var(--pg-shadow-sm); }
.pg .direct-html-editor .direct-language-scope { position: relative; display: inline-flex; align-items: center; gap: var(--pg-space-2); min-height: var(--ed-ctl); color: var(--pg-text); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-medium); white-space: nowrap; cursor: pointer; }
.pg .direct-html-editor .direct-language-scope input { position: absolute; inset-inline-start: 0; width: 34px; height: 20px; margin: 0; opacity: 0; cursor: pointer; }
.pg .direct-html-editor .direct-language-scope-track { position: relative; flex: none; width: 34px; height: 20px; border-radius: var(--pg-radius-full); background: var(--pg-line-strong); transition: background-color var(--pg-dur) var(--pg-ease); }
.pg .direct-html-editor .direct-language-scope-track::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--pg-on-inverse); box-shadow: var(--pg-shadow-sm); transition: transform var(--pg-dur) var(--pg-ease); }
.pg .direct-html-editor .direct-language-scope:has(input:checked) .direct-language-scope-track { background: var(--pg-brand); }
.pg .direct-html-editor .direct-language-scope:has(input:checked) .direct-language-scope-track::after { transform: translateX(14px); }
html[dir=rtl] .pg .direct-html-editor .direct-language-scope:has(input:checked) .direct-language-scope-track::after { transform: translateX(-14px); }
.pg .direct-html-editor .direct-language-scope:has(input:focus-visible) .direct-language-scope-track { outline: 2px solid var(--pg-primary); outline-offset: 2px; }
.pg .direct-html-editor .direct-language-scope:has(input:disabled) { opacity: .55; cursor: default; }

/* Tools row */
.pg .direct-html-editor .direct-tool-group { display: flex; align-items: center; gap: 2px; }
.pg .direct-html-editor .direct-tool-group--end { margin-inline-start: auto; }
.pg .direct-html-editor .direct-editor-tools > .direct-add-button { padding-inline: var(--pg-space-3) var(--pg-space-4); }
.pg .direct-html-editor .direct-preview-tools { display: inline-flex; gap: 2px; margin-inline-start: auto; padding: 3px; border-radius: var(--pg-radius-md); background: var(--pg-surface-3); }
.pg .direct-html-editor .direct-preview-tools .direct-icon-button { width: 38px; height: 36px; color: var(--pg-muted); }
.pg .direct-html-editor .direct-preview-tools .direct-icon-button:hover { background: color-mix(in srgb, var(--pg-surface) 60%, transparent); color: var(--pg-ink); }
.pg .direct-html-editor .direct-preview-tools .direct-icon-button[aria-pressed=true] { background: var(--pg-surface); color: var(--pg-ink); box-shadow: var(--pg-shadow-sm); }
.pg .direct-html-editor .direct-preview-tools .direct-icon { width: 18px; height: 18px; }

/* Save area, hand-off links */
.pg .direct-html-editor .direct-editor-handoff { display: flex; align-items: center; gap: 2px; padding-inline-end: var(--pg-space-2); margin-inline-end: var(--pg-space-1); border-inline-end: 1px solid var(--pg-line); }
.pg .direct-html-editor .direct-save-status {
  display: inline-block; min-width: 0; max-width: 220px;
  color: var(--pg-success); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-medium); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 6em;
}
.pg .direct-html-editor .direct-save-status[data-state=saved]::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pg .direct-html-editor .direct-save-status[data-state=pending] { color: var(--pg-warning); }
.pg .direct-html-editor .direct-save-status::before { display: inline-block; margin-inline-end: var(--pg-space-2); vertical-align: middle; }
.pg .direct-html-editor .direct-save-status[data-state=pending]::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pg .direct-html-editor .direct-save-status[data-state=saving] { color: var(--pg-primary); }
.pg .direct-html-editor .direct-save-status[data-state=error] { color: var(--pg-danger); }
.pg .direct-html-editor .direct-save-shortcut { display: none; gap: 2px; margin-inline-start: var(--pg-space-1); }
.pg .direct-html-editor .direct-save-shortcut .direct-kbd { border-color: color-mix(in srgb, var(--pg-on-primary) 45%, transparent); background: color-mix(in srgb, var(--pg-on-primary) 14%, transparent); color: var(--pg-on-primary); }

/* ======================================================================
   4. Undo / redo (shared with the legacy editor)
   ====================================================================== */
.pg .editor-history-anchor { display: inline-flex; align-items: center; flex-shrink: 0; }
.pg .editor-history-anchor.editor-history-docked { inline-size: var(--history-width); block-size: var(--history-height); }
.pg .editor-history { position: relative; display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.pg .editor-history .editor-history-button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--pg-space-2);
  min-width: 40px; min-height: 40px; padding: 0 var(--pg-space-2);
  border: 1px solid transparent; border-radius: var(--pg-radius-sm); background: transparent;
  color: var(--pg-muted); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); cursor: pointer;
  transition: background-color var(--pg-dur) var(--pg-ease), color var(--pg-dur) var(--pg-ease);
}
.pg .editor-history .editor-history-button:hover:enabled { background: var(--pg-surface-2); color: var(--pg-ink); }
.pg .editor-history .editor-history-button:disabled { opacity: .4; cursor: default; }
.pg .editor-history .editor-history-button .pg-icon { width: 18px; height: 18px; }
.pg .editor-history .editor-history-button[aria-busy=true]::after { content: ""; display: inline-block; inline-size: 14px; block-size: 14px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: pg-spin .65s linear infinite; }
.pg .direct-html-editor .editor-history-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pg .editor-history-feedback {
  position: absolute; z-index: var(--pg-z-dropdown); inset-block-start: calc(100% + 8px); inset-inline-start: 0;
  width: max-content; max-width: 280px; padding: var(--pg-space-2) var(--pg-space-3);
  border-radius: var(--pg-radius-sm); background: var(--pg-inverse); color: var(--pg-on-inverse);
  font-size: var(--pg-text-sm); line-height: 1.45; white-space: normal; pointer-events: none; box-shadow: var(--pg-shadow-md);
  animation: pg-pop-in var(--pg-dur) var(--pg-ease);
}
.pg .editor-history-feedback:empty { display: none; }
.pg .editor-history.editor-history-floating {
  position: fixed; z-index: var(--pg-z-dropdown); inset-block-start: calc(var(--pg-topbar) + var(--pg-space-3)); inset-inline-start: 50%; transform: translateX(-50%);
  gap: var(--pg-space-1); padding: var(--pg-space-1); border: 1px solid var(--pg-line); border-radius: var(--pg-radius-md);
  background: var(--pg-surface); box-shadow: var(--pg-shadow-lg); max-inline-size: calc(100vw - 24px);
}
html[dir=rtl] .pg .editor-history.editor-history-floating { transform: translateX(50%); }
.pg .editor-history-floating .editor-history-button { min-height: 44px; }
.pg .editor-history-floating .editor-history-feedback { inset-inline-start: 50%; transform: translateX(-50%); text-align: center; }
html[dir=rtl] .pg .editor-history-floating .editor-history-feedback { transform: translateX(50%); }

/* ======================================================================
   5. Hint bar, notices, canvas
   ====================================================================== */
.pg .direct-html-editor .direct-editor-hintbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--pg-space-1) var(--pg-space-3);
  padding: var(--pg-space-2) var(--pg-space-4); border-block-end: 1px solid var(--pg-line);
  background: var(--pg-bg); color: var(--pg-muted); font-size: var(--pg-text-sm); line-height: 1.5;
}
.pg .direct-html-editor .direct-editor-hintbar > .direct-icon { width: 16px; height: 16px; color: var(--pg-primary); }
.pg .direct-html-editor .direct-editor-hintbar { background: var(--pg-surface); }
.pg .direct-html-editor .direct-editor-guide strong { color: var(--pg-ink); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-draft-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; margin-inline-start: auto; padding: 2px 10px; border: 1px solid var(--pg-success-line); border-radius: var(--pg-radius-full); background: var(--pg-success-soft); color: var(--pg-success); font-size: var(--pg-text-xs); font-weight: var(--pg-weight-semibold); white-space: nowrap; }
.pg .direct-html-editor .direct-draft-badge .direct-icon { width: 14px; height: 14px; }
.pg .direct-html-editor .direct-editor-notice { display: flex; align-items: flex-start; gap: var(--pg-space-2); margin: var(--pg-space-3) var(--pg-space-4) 0; padding: var(--pg-space-3) var(--pg-space-4); border: 1px solid var(--pg-warning-line); border-radius: var(--pg-radius-md); background: var(--pg-warning-soft); color: var(--pg-warning); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-medium); }
.pg .direct-html-editor .direct-editor-notice .pg-icon { margin-block-start: 2px; }

.pg .direct-html-editor .direct-editor-layout { display: block; flex: 1; min-width: 0; }
.pg .direct-html-editor .direct-editor-canvas {
  min-width: 0; min-height: 100%; padding: var(--pg-space-5) var(--pg-space-5) var(--pg-space-16);
  background-color: var(--ed-canvas-bg);
  background-image: radial-gradient(color-mix(in srgb, var(--pg-subtle) 22%, transparent) 1px, transparent 1px);
  background-size: 16px 16px;
  overflow-x: auto;
}
.pg .direct-html-editor .direct-editor-canvas iframe {
  display: block; width: var(--direct-preview-width, 100%); max-width: none; height: 1800px; margin-inline: auto;
  border: 0; border-radius: var(--pg-radius-md); background: var(--pg-surface);
  box-shadow: 0 0 0 1px var(--pg-line), var(--pg-shadow-lg);
}

/* ======================================================================
   6. Inspector: floating panel on wide screens, bottom sheet below 1024px.
   Position and height come from direct_html_panel_controller, which measures
   physical viewport pixels, so `left`/`top` (not logical insets) are used here.
   ====================================================================== */
.pg .direct-html-editor .direct-editor-fields {
  position: fixed; z-index: var(--pg-z-dropdown);
  inset-block-start: var(--direct-panel-y, 140px); inset-inline-start: auto;
  left: var(--direct-panel-x, auto);
  width: var(--ed-panel-w); max-width: calc(100vw - 24px);
  height: var(--direct-panel-height, calc(100dvh - 160px)); max-height: var(--direct-panel-height, calc(100dvh - 160px));
  margin: 0; padding: 0 var(--pg-space-4) var(--pg-space-5);
  overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scroll-padding-top: 96px;
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-lg);
  background: var(--pg-surface); box-shadow: var(--pg-shadow-lg), 0 0 0 1px color-mix(in srgb, var(--pg-brand) 8%, transparent);
  animation: ed-panel-in var(--pg-dur-slow) var(--pg-ease);
}
.pg .direct-html-editor .direct-editor-fields:focus { outline: none; }
.pg .direct-html-editor .direct-component-heading {
  position: sticky; z-index: 2; inset-block-start: 0;
  display: flex; align-items: center; gap: var(--pg-space-2);
  margin: 0 calc(-1 * var(--pg-space-4)) var(--pg-space-4); padding: var(--pg-space-3) var(--pg-space-3);
  border-block-end: 1px solid var(--pg-line); background: var(--pg-surface);
}
/* Aurora hairline under the panel header (the grabber uses ::before on sheets). */
.pg .direct-html-editor .direct-component-heading::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: -1px; height: 2px; background: var(--pg-gradient-start); opacity: .85; pointer-events: none; }
.pg .direct-html-editor .direct-panel-title { flex: 1; min-width: 0; }
.pg .direct-html-editor .direct-panel-title h3 { color: var(--pg-ink); font-family: var(--pg-font-display); font-size: var(--pg-text-base); font-weight: var(--pg-weight-bold); line-height: 1.35; overflow-wrap: anywhere; }
.pg .direct-html-editor .direct-eyebrow { margin: 0 0 2px; color: var(--pg-primary); font-size: var(--pg-text-xs); font-weight: var(--pg-weight-semibold); letter-spacing: .02em; }
html[dir=rtl] .pg .direct-html-editor .direct-eyebrow { letter-spacing: 0; }
.pg .direct-html-editor .direct-component-heading > .direct-icon-button { width: 36px; height: 36px; }
.pg .direct-html-editor .direct-panel-handle { cursor: grab; touch-action: none; }
.pg .direct-html-editor .direct-panel-handle:active { cursor: grabbing; }
.pg .direct-html-editor .direct-panel-moving { user-select: none; box-shadow: var(--pg-shadow-lg), 0 0 0 2px var(--pg-primary-line); }
.pg .direct-html-editor .direct-panel-moving * { cursor: grabbing; }
.pg .direct-html-editor .direct-panel-launcher {
  position: fixed; z-index: var(--pg-z-dropdown);
  left: var(--direct-panel-launcher-x, 16px); top: var(--direct-panel-launcher-y, calc(100dvh - 72px));
  display: flex; align-items: center; gap: var(--pg-space-2); min-height: 44px; max-width: calc(100vw - 24px);
  padding: 0 var(--pg-space-4); border: 1px solid var(--pg-night-line-strong); border-radius: var(--pg-radius-full);
  background: var(--pg-night-2); color: var(--pg-on-inverse); box-shadow: var(--pg-shadow-lg);
  font-size: var(--pg-text-md); font-weight: var(--pg-weight-semibold); cursor: pointer;
  transition: background-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-panel-launcher:hover { background: var(--pg-night-3); box-shadow: var(--pg-shadow-lg), var(--pg-shadow-glow); }
.pg .direct-html-editor .direct-panel-launcher .direct-icon { width: 18px; height: 18px; color: var(--pg-halo); }
.pg .direct-html-editor .direct-panel-launcher .direct-icon:last-child { rotate: 180deg; }
.pg .direct-html-editor.direct-panel-offscreen :is(.direct-editor-fields, .direct-panel-launcher) { visibility: hidden; pointer-events: none; }
.pg .direct-html-editor .direct-page-back {
  display: flex; align-items: center; gap: var(--pg-space-2); width: 100%; min-height: 44px; margin: 0 0 var(--pg-space-3); padding: 0 var(--pg-space-3);
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-sm); background: var(--pg-surface-2);
  color: var(--pg-primary-hover); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); text-align: start; cursor: pointer;
}
.pg .direct-html-editor .direct-page-back:hover { background: var(--pg-primary-soft); border-color: var(--pg-primary-line); }
.pg .direct-html-editor .direct-page-back .direct-icon { width: 16px; height: 16px; transform: rotate(90deg); }
html[dir=rtl] .pg .direct-html-editor .direct-page-back .direct-icon { transform: rotate(-90deg); }

/* Empty state, quick tasks */
.pg .direct-html-editor .direct-inspector-empty { display: flex; flex-direction: column; align-items: center; gap: var(--pg-space-2); padding: var(--pg-space-3) var(--pg-space-2) var(--pg-space-5); text-align: center; }
.pg .direct-html-editor .direct-inspector-empty > span { display: grid; place-items: center; width: 48px; height: 48px; margin-block-end: var(--pg-space-1); border-radius: var(--pg-radius-md); background: var(--pg-gradient); color: var(--pg-on-primary); box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--pg-brand) 50%, transparent); }
.pg .direct-html-editor .direct-inspector-empty > span .direct-icon { width: 24px; height: 24px; }
.pg .direct-html-editor .direct-inspector-empty h4 { font-family: var(--pg-font-display); font-size: var(--pg-text-base); font-weight: var(--pg-weight-bold); }
.pg .direct-html-editor .direct-inspector-empty p { max-width: 34ch; color: var(--pg-muted); font-size: var(--pg-text-sm); margin-block-end: var(--pg-space-2); }
.pg .direct-html-editor .direct-inspector-empty > .direct-add-button { width: 100%; min-height: 44px; }
.pg .direct-html-editor .direct-quick-tasks { display: grid; gap: var(--pg-space-2); margin: 0 0 var(--pg-space-4); }
.pg .direct-html-editor .direct-quick-tasks > button {
  display: flex; align-items: center; gap: var(--pg-space-3); min-height: 48px; padding: 0 var(--pg-space-3);
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-md); background: var(--pg-surface);
  color: var(--pg-ink); font-size: var(--pg-text-md); font-weight: var(--pg-weight-medium); text-align: start; cursor: pointer;
  transition: border-color var(--pg-dur) var(--pg-ease), background-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-quick-tasks > button:hover { border-color: var(--pg-primary-line); background: var(--pg-primary-soft); box-shadow: var(--pg-shadow-sm); }
.pg .direct-html-editor .direct-quick-tasks .direct-icon { display: grid; width: 32px; height: 32px; padding: 7px; border-radius: var(--pg-radius-sm); background: var(--pg-primary-soft); color: var(--pg-primary); }

/* Disclosure sections inside the panel */
.pg .direct-html-editor .direct-editor-fields details > summary,
.pg .direct-html-editor .direct-dialog details > summary {
  display: flex; align-items: center; gap: var(--pg-space-2); min-height: 44px;
  color: var(--pg-ink); font-size: var(--pg-text-md); font-weight: var(--pg-weight-semibold); line-height: 1.4;
  list-style: none; cursor: pointer;
}
.pg .direct-html-editor details > summary::-webkit-details-marker { display: none; }
.pg .direct-html-editor .direct-editor-fields details > summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin-inline-start: auto; margin-inline-end: 4px;
  border-inline-end: 2px solid var(--pg-subtle); border-block-end: 2px solid var(--pg-subtle);
  transform: rotate(45deg) translateY(-2px); transition: transform var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-editor-fields details[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.pg .direct-html-editor .direct-editor-fields details > summary > .direct-icon { width: 18px; height: 18px; color: var(--pg-subtle); }
.pg .direct-html-editor .direct-editor-fields details[open] > summary { margin-block-end: var(--pg-space-2); }
.pg .direct-html-editor :is(.direct-outline, .direct-page-appearance, .direct-arrange-details, .direct-shared-details, .direct-navigation-panel, .direct-background-panel, .direct-arrangement-panel) {
  margin: 0 0 var(--pg-space-3); padding-block-start: var(--pg-space-2); border-block-start: 1px solid var(--pg-line);
}
.pg .direct-html-editor .direct-subtle-details { margin-block-start: var(--pg-space-2); }
.pg .direct-html-editor .direct-subtle-details > summary { min-height: 40px; color: var(--pg-primary-hover); font-size: var(--pg-text-sm); }

/* Outline (layers) */
.pg .direct-html-editor .direct-outline-search, .pg .direct-html-editor .direct-photo-search {
  display: flex; align-items: center; gap: var(--pg-space-2); min-width: 0; min-height: var(--ed-ctl); padding: 0 var(--pg-space-3);
  border: 1px solid var(--pg-line-strong); border-radius: var(--pg-radius-sm); background: var(--pg-surface); color: var(--pg-subtle);
  transition: border-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-outline-search { margin-block-end: var(--pg-space-2); }
.pg .direct-html-editor :is(.direct-outline-search, .direct-photo-search):focus-within { border-color: var(--pg-primary); box-shadow: var(--pg-ring); }
.pg .direct-html-editor :is(.direct-outline-search, .direct-photo-search) > .direct-icon { width: 16px; height: 16px; }
.pg .direct-html-editor :is(.direct-outline-search, .direct-photo-search) input[type=search],
.pg .direct-html-editor :is(.direct-outline-search, .direct-photo-search) input[type=search]:focus {
  flex: 1; width: 100%; min-width: 0; min-height: 36px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none;
  color: var(--pg-ink); font-size: var(--pg-text-md);
}
.pg .direct-html-editor .direct-outline > .direct-text-button { width: auto; min-height: 36px; margin-block-end: var(--pg-space-1); }
.pg .direct-html-editor .direct-outline-list { display: grid; gap: 1px; max-height: 300px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.pg .direct-html-editor .direct-outline-list button {
  display: flex; align-items: center; gap: var(--pg-space-2); width: 100%; min-height: 36px;
  padding-block: 6px; padding-inline: calc(8px + var(--direct-depth, 0) * 14px) 8px;
  position: relative; border: 0; border-radius: var(--pg-radius-sm); background: transparent; color: var(--pg-text); font-size: var(--pg-text-sm); text-align: start; cursor: pointer;
  transition: background-color var(--pg-dur-fast) var(--pg-ease), color var(--pg-dur-fast) var(--pg-ease);
}
.pg .direct-html-editor .direct-outline-list button:hover { background: var(--pg-surface-2); color: var(--pg-ink); }
.pg .direct-html-editor .direct-outline-list button[aria-pressed=true]::before { content: ""; position: absolute; inset-block: 6px; inset-inline-start: 0; width: 3px; border-radius: var(--pg-radius-full); background: var(--pg-gradient); }
.pg .direct-html-editor .direct-outline-list button[aria-pressed=true] { background: var(--pg-primary-soft); color: var(--pg-primary-hover); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-outline-list .direct-icon-wrap { display: inline-flex; flex: none; color: var(--pg-subtle); }
.pg .direct-html-editor .direct-outline-list button[aria-pressed=true] .direct-icon-wrap { color: var(--pg-primary); }
.pg .direct-html-editor .direct-outline-list .direct-icon { width: 16px; height: 16px; }
.pg .direct-html-editor .direct-outline-list button > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Selection header */
.pg .direct-html-editor .direct-selection-caption { margin: 0 0 var(--pg-space-2); color: var(--pg-muted); font-size: var(--pg-text-sm); overflow-wrap: anywhere; }
.pg .direct-html-editor .direct-selection-path { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pg-space-1); min-width: 0; margin: 0 0 var(--pg-space-3); }
.pg .direct-html-editor .direct-selection-path:empty { display: none; }
.pg .direct-html-editor .direct-selection-path button {
  display: inline-flex; align-items: center; gap: var(--pg-space-1); max-width: 100%; min-height: 32px; padding: 0 var(--pg-space-2);
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-full); background: var(--pg-surface);
  color: var(--pg-muted); font-size: var(--pg-text-xs); font-weight: var(--pg-weight-medium); text-align: start; overflow-wrap: anywhere; cursor: pointer;
}
.pg .direct-html-editor .direct-selection-path button:hover, .pg .direct-html-editor .direct-selection-path button[aria-current=true] { border-color: var(--pg-primary-line); background: var(--pg-primary-soft); color: var(--pg-primary-hover); }
.pg .direct-html-editor .direct-selection-path .direct-icon { width: 12px; height: 12px; color: var(--pg-subtle); }
.pg .direct-html-editor .direct-item-actions { display: flex; align-items: center; gap: var(--pg-space-1); margin: 0 0 var(--pg-space-3); padding: var(--pg-space-1); border: 1px solid var(--pg-line); border-radius: var(--pg-radius-md); background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-item-actions .direct-icon-button { width: 38px; height: 38px; }
.pg .direct-html-editor .direct-item-actions .direct-icon-button:hover { background: var(--pg-surface); }
.pg .direct-html-editor .direct-item-actions .direct-danger { margin-inline-start: auto; }
.pg .direct-html-editor .direct-replace-button {
  display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: var(--pg-space-1); min-width: 0; min-height: 38px; padding: 0 var(--pg-space-2);
  border: 0; border-radius: var(--pg-radius-sm); background: transparent; color: var(--pg-primary-hover); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); cursor: pointer;
}
.pg .direct-html-editor .direct-replace-button:hover { background: var(--pg-surface); }
.pg .direct-html-editor .direct-replace-button .direct-icon { width: 16px; height: 16px; }
.pg .direct-html-editor .direct-collection-shortcut {
  display: flex; align-items: center; gap: var(--pg-space-2); width: 100%; min-height: 44px; margin: 0 0 var(--pg-space-3); padding: 0 var(--pg-space-3);
  border: 1px solid var(--pg-primary-line); border-radius: var(--pg-radius-md); background: var(--pg-primary-soft);
  color: var(--pg-primary-hover); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); text-align: start; cursor: pointer;
}
.pg .direct-html-editor .direct-collection-shortcut:hover { background: var(--pg-primary-soft-2); }
.pg .direct-html-editor .direct-collection-shortcut .direct-icon { width: 18px; height: 18px; }
.pg .direct-html-editor .direct-collection-shortcut::after { content: ""; flex: none; width: 7px; height: 7px; margin-inline-start: auto; border-inline-end: 2px solid currentColor; border-block-start: 2px solid currentColor; transform: rotate(45deg); }
html[dir=rtl] .pg .direct-html-editor .direct-collection-shortcut::after { transform: rotate(-45deg); }

/* Inspector tabs (Content / Design / Effects) and Style / Advanced */
.pg .direct-html-editor :is(.direct-inspector-tabs, .component-mode-tabs) {
  position: relative; z-index: 1; display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 2px;
  margin: 0 0 var(--pg-space-4); padding: 3px; box-shadow: inset 0 -1px 0 var(--pg-line);
}
.pg .direct-html-editor :is(.direct-inspector-tabs, .component-mode-tabs) > button {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 var(--pg-space-2);
  border: 0; border-radius: var(--pg-radius-sm); background: transparent; color: var(--pg-muted);
  font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); line-height: 1.3; overflow-wrap: anywhere; cursor: pointer;
  transition: background-color var(--pg-dur) var(--pg-ease), color var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor :is(.direct-inspector-tabs, .component-mode-tabs) > button::after { content: ""; position: absolute; inset-inline: var(--pg-space-2); inset-block-end: -3px; height: 3px; border-radius: var(--pg-radius-full); background: var(--pg-gradient-start); opacity: 0; transform: scaleX(.4); transition: opacity var(--pg-dur) var(--pg-ease), transform var(--pg-dur) var(--pg-ease); }
.pg .direct-html-editor :is(.direct-inspector-tabs, .component-mode-tabs) > button:hover { background: var(--pg-surface-2); color: var(--pg-ink); }
.pg .direct-html-editor :is(.direct-inspector-tabs, .component-mode-tabs) > button[aria-selected=true] { background: transparent; color: var(--pg-ink); }
.pg .direct-html-editor :is(.direct-inspector-tabs, .component-mode-tabs) > button[aria-selected=true]::after { opacity: 1; transform: none; }
.pg .direct-html-editor :is(.direct-inspector-tabs, .component-mode-tabs) .direct-icon { width: 16px; height: 16px; }
.pg .direct-html-editor .direct-inspector-tabs > button[aria-selected=true] .direct-icon { color: var(--pg-primary); }
.pg .direct-html-editor .component-mode-tabs { gap: var(--pg-space-1); margin-block: var(--pg-space-4); padding: 0; border-block-end: 1px solid var(--pg-line); box-shadow: none; }
.pg .direct-html-editor .component-mode-tabs > button { min-height: 40px; }
.pg .direct-html-editor .component-mode-tabs > button::after { inset-block-end: -1px; height: 2px; }

/* Fields */
.pg .direct-html-editor .direct-content-section { margin-block-end: var(--pg-space-4); }
.pg .direct-html-editor .direct-content-section:empty { display: none; }
.pg .direct-html-editor .direct-content-section > h4, .pg .direct-html-editor :is(.direct-layout-panel, .direct-website-width, .direct-panel-heading) h4 { margin-block-end: var(--pg-space-1); font-size: var(--pg-text-md); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-editor-fields .muted, .pg .direct-html-editor .direct-dialog .muted { margin: 0 0 var(--pg-space-3); color: var(--pg-muted); font-size: var(--pg-text-sm); line-height: 1.55; }
.pg .direct-html-editor .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0 0 var(--pg-space-4); }
.pg .direct-html-editor :is(.field > label, .direct-setting-label, .direct-comparison-photos > div > label) { display: block; margin: 0; color: var(--pg-ink); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); line-height: 1.4; }
.pg .direct-html-editor .direct-setting-label { margin: var(--pg-space-4) 0 var(--pg-space-2); }
/* Inputs need the long :not() chain to outrank the global input rule in application.css. */
.pg .direct-html-editor input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=search]), .pg .direct-html-editor select, .pg .direct-html-editor textarea {
  width: 100%; max-width: 100%; min-height: var(--ed-ctl); padding: 8px 12px;
  border: 1px solid var(--pg-line-strong); border-radius: var(--pg-radius-sm); background-color: var(--pg-surface);
  color: var(--pg-ink); font-size: var(--pg-text-md); line-height: 1.5; box-shadow: var(--pg-shadow-xs);
  transition: border-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=search]):hover, .pg .direct-html-editor select:hover, .pg .direct-html-editor textarea:hover { border-color: var(--pg-subtle); }
.pg .direct-html-editor input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=search]):focus, .pg .direct-html-editor select:focus, .pg .direct-html-editor textarea:focus { outline: none; border-color: var(--pg-primary); box-shadow: var(--pg-ring); }
.pg .direct-html-editor .direct-editor-fields textarea { min-height: 64px; resize: vertical; }
.pg .direct-html-editor .direct-editor-fields select {
  padding-inline-end: 36px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: right 10px center;
}
html[dir=rtl] .pg .direct-html-editor .direct-editor-fields select { background-position: left 10px center; }
.pg .direct-html-editor input[type=range], .pg .direct-html-editor input[type=range]:focus {
  width: 100%; min-height: 28px; height: 28px; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; accent-color: var(--pg-primary); cursor: ew-resize;
}
.pg .direct-html-editor input[type=color] {
  width: 40px; height: 36px; min-width: 40px; margin: 0; padding: 3px;
  border: 1px solid var(--pg-line-strong); border-radius: var(--pg-radius-sm); background: var(--pg-surface); cursor: pointer;
}
.pg .direct-html-editor input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--pg-primary); flex: none; }

/* Preset choice rows (segmented) */
.pg .direct-html-editor .direct-presets { display: flex; flex-wrap: wrap; gap: var(--pg-space-1); margin: 0 0 var(--pg-space-3); }
.pg .direct-html-editor .direct-presets > button {
  display: inline-flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 38px; padding: 4px var(--pg-space-2);
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-sm); background: var(--pg-surface);
  color: var(--pg-text); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-medium); line-height: 1.3; cursor: pointer;
  transition: border-color var(--pg-dur) var(--pg-ease), background-color var(--pg-dur) var(--pg-ease), color var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-presets > button:hover { border-color: var(--pg-line-strong); background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-presets > button[aria-pressed=true], .pg .direct-html-editor .direct-presets > button[data-current-spacing=true] { border-color: var(--pg-primary); background: var(--pg-primary-soft); color: var(--pg-primary-hover); box-shadow: 0 0 0 1px var(--pg-primary); }
.pg .direct-html-editor .direct-presets .direct-icon { width: 16px; height: 16px; }
.pg .direct-html-editor .direct-alignment { display: inline-flex; gap: 2px; margin: 0 0 var(--pg-space-4); padding: 3px; border-radius: var(--pg-radius-md); background: var(--pg-surface-3); }
.pg .direct-html-editor .direct-alignment .direct-icon-button { width: 40px; height: 36px; }
.pg .direct-html-editor .direct-alignment .direct-icon-button[aria-pressed=true] { background: var(--pg-surface); color: var(--pg-ink); box-shadow: var(--pg-shadow-sm); }
.pg .direct-html-editor .direct-flip-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pg .direct-html-editor .direct-flip-controls > button { min-height: 44px; white-space: normal; }
.pg .direct-html-editor .direct-photo-fit > button, .pg .direct-html-editor .direct-spacing-presets > button { min-height: 40px; }

/* Photo preview buttons */
.pg .direct-html-editor .direct-photo-preview {
  display: block; width: 100%; padding: 0; overflow: hidden;
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-md); background: var(--pg-surface-2);
  color: var(--pg-primary-hover); text-align: start; cursor: pointer;
  transition: border-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-photo-preview:hover { border-color: var(--pg-primary-line); box-shadow: var(--pg-shadow-sm); }
.pg .direct-html-editor .direct-photo-preview > span:first-child { display: grid; place-items: center; min-height: 128px; color: var(--pg-subtle); }
.pg .direct-html-editor .direct-photo-preview > span:first-child .direct-icon { width: 32px; height: 32px; }
.pg .direct-html-editor .direct-photo-preview img { display: block; width: 100%; height: 148px; object-fit: cover; }
.pg .direct-html-editor .direct-photo-preview > span:last-child { display: flex; align-items: center; justify-content: center; gap: var(--pg-space-2); min-height: 40px; padding: 0 var(--pg-space-3); border-block-start: 1px solid var(--pg-line); background: var(--pg-surface); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-photo-preview > span:last-child .direct-icon { width: 16px; height: 16px; }
.pg .direct-html-editor .direct-comparison-photos { display: grid; grid-template-columns: 1fr 1fr; gap: var(--pg-space-2); margin-block-end: var(--pg-space-3); }
.pg .direct-html-editor .direct-comparison-photos > div { display: grid; gap: 6px; }
.pg .direct-html-editor .direct-comparison-photos .direct-photo-preview img { height: 96px; }
.pg .direct-html-editor .direct-comparison-photos .direct-photo-preview > span:first-child { min-height: 96px; }
.pg .direct-html-editor .direct-image-unavailable { opacity: .5; }

/* Layout variants */
.pg .direct-html-editor .direct-layout-panel { margin-block-end: var(--pg-space-4); }
.pg .direct-html-editor .direct-layout-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pg-space-2); margin-block-start: var(--pg-space-2); }
.pg .direct-html-editor :is(.direct-layout-card, .direct-navigation-card, .direct-effect-card, .direct-menu-looks > button) {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; padding: 6px 6px var(--pg-space-2);
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-md); background: var(--pg-surface);
  color: var(--pg-text); font-size: var(--pg-text-xs); font-weight: var(--pg-weight-medium); line-height: 1.35; text-align: center; overflow-wrap: anywhere; cursor: pointer;
  transition: border-color var(--pg-dur) var(--pg-ease), background-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor :is(.direct-layout-card, .direct-navigation-card, .direct-effect-card, .direct-menu-looks > button):hover { border-color: var(--pg-line-strong); box-shadow: var(--pg-shadow-sm); }
.pg .direct-html-editor :is(.direct-layout-card, .direct-navigation-card, .direct-effect-card, .direct-menu-looks > button)[aria-pressed=true] { border-color: var(--pg-primary); background: var(--pg-primary-soft); color: var(--pg-primary-hover); box-shadow: 0 0 0 1px var(--pg-primary); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-layout-preview { position: relative; display: flex; align-items: stretch; gap: 4px; width: 100%; height: 52px; padding: 7px; overflow: hidden; border-radius: var(--pg-radius-xs); background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-layout-preview i { position: relative; display: block; flex: 1; min-width: 0; border-radius: 3px; background: var(--pg-primary-line); }
.pg .direct-html-editor .direct-layout-preview i::after { content: ""; position: absolute; inset: 6px 5px; background: repeating-linear-gradient(to bottom, var(--pg-surface-2) 0 2px, transparent 2px 7px); }
.pg .direct-html-editor .direct-layout-preview[data-variant=original] i:first-child { flex: 2; background: var(--pg-primary-soft-2); }
.pg .direct-html-editor .direct-layout-preview[data-variant=original] i:last-child { display: none; }
.pg .direct-html-editor .direct-layout-preview:is([data-variant=stacked], [data-variant=accordion], [data-variant=underline], [data-variant=pills]) { flex-direction: column; }
.pg .direct-html-editor .direct-layout-preview[data-variant=accordion] i::after { inset: 4px 8px; background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-layout-preview:is([data-variant=two_columns], [data-variant=split]) i:last-child { display: none; }
.pg .direct-html-editor .direct-layout-preview[data-variant=split] i:first-child { flex: 1.4; background: var(--pg-primary-soft-2); }
.pg .direct-html-editor .direct-layout-preview[data-variant=centered] { flex-direction: column; align-items: center; }
.pg .direct-html-editor .direct-layout-preview[data-variant=centered] i { flex: 1; width: 60%; min-height: 7px; }
.pg .direct-html-editor .direct-layout-preview[data-variant=centered] i:first-child { width: 80%; }
.pg .direct-html-editor .direct-layout-preview[data-variant=cards] i { border: 1px solid var(--pg-primary-line); background: var(--pg-surface); }
.pg .direct-html-editor .direct-layout-preview:is([data-variant=pills], [data-variant=underline]) { padding-block-start: 18px; }
.pg .direct-html-editor .direct-layout-preview:is([data-variant=pills], [data-variant=underline])::before { content: ""; position: absolute; inset: 5px 7px auto; height: 7px; border-radius: 4px; background: linear-gradient(to right, var(--pg-primary) 0 30%, transparent 30% 34%, var(--pg-line-strong) 34% 64%, transparent 64% 68%, var(--pg-line-strong) 68%); }
.pg .direct-html-editor .direct-layout-preview[data-variant=underline]::before { height: 4px; border-radius: 0; background: linear-gradient(to right, var(--pg-primary) 0 30%, transparent 30%); }

/* Repeaters (lists, tabs, FAQ…) */
.pg .direct-html-editor .direct-repeater-panel { padding-block-end: var(--pg-space-4); border-block-end: 1px solid var(--pg-line); }
.pg .direct-html-editor .direct-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-space-2); margin-block-end: var(--pg-space-1); }
.pg .direct-html-editor .direct-panel-heading > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--pg-radius-sm); background: var(--pg-primary-soft); color: var(--pg-primary); }
.pg .direct-html-editor .direct-panel-heading .direct-icon { width: 16px; height: 16px; }
.pg .direct-html-editor .direct-repeater-actions { display: flex; flex-wrap: wrap; gap: var(--pg-space-2); }
.pg .direct-html-editor .direct-repeater-actions > button { flex: 1 1 120px; }
.pg .direct-html-editor .direct-repeater-list { display: grid; gap: var(--pg-space-2); margin-block: var(--pg-space-3); }
.pg .direct-html-editor .direct-repeater-item { min-width: 0; padding: var(--pg-space-3); border: 1px solid var(--pg-line); border-radius: var(--pg-radius-md); background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-repeater-item-header { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-space-2); margin-block-end: var(--pg-space-2); }
.pg .direct-html-editor .direct-repeater-item-header > strong { min-width: 0; color: var(--pg-ink); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); overflow-wrap: anywhere; }
.pg .direct-html-editor .direct-repeater-item-actions { display: flex; flex: none; gap: 2px; }
.pg .direct-html-editor .direct-repeater-item-actions .direct-icon-button { width: 36px; height: 36px; border-color: var(--pg-line); background: var(--pg-surface); }
.pg .direct-html-editor .direct-repeater-item-actions .direct-icon { width: 16px; height: 16px; }
.pg .direct-html-editor .direct-repeater-item .field { margin-block-end: var(--pg-space-2); }
.pg .direct-html-editor .direct-repeater-item textarea { min-height: 88px; }
.pg .direct-html-editor .direct-repeater-item > .direct-secondary-button { width: 100%; color: var(--pg-primary-hover); }

/* Data grid (tables, charts) */
.pg .direct-html-editor .direct-data-grid { display: grid; gap: 6px; max-height: 340px; margin-block-end: var(--pg-space-3); overflow: auto; }
.pg .direct-html-editor .direct-data-grid-row, .pg .direct-html-editor .direct-data-grid-column { display: flex; gap: 6px; min-width: 0; }
.pg .direct-html-editor .direct-data-grid-row input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=search]) { min-width: 72px; min-height: 36px; padding: 6px 8px; font-size: var(--pg-text-sm); }
.pg .direct-html-editor .direct-data-grid-row:first-child input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=search]) { background-color: var(--pg-primary-soft); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-data-grid-row .direct-icon-button { width: 36px; height: 36px; }
.pg .direct-html-editor .direct-data-grid-column button { flex: 1; min-height: 32px; border: 0; border-radius: var(--pg-radius-xs); background: var(--pg-surface-2); color: var(--pg-muted); font-size: var(--pg-text-xs); cursor: pointer; }
.pg .direct-html-editor .direct-data-actions { display: flex; flex-wrap: wrap; gap: var(--pg-space-2); margin-block-end: var(--pg-space-3); }

/* Managed photos, slideshow */
.pg .direct-html-editor .direct-managed-photos { display: grid; gap: var(--pg-space-2); margin-block-start: var(--pg-space-4); }
.pg .direct-html-editor .direct-managed-photo { display: flex; align-items: center; gap: var(--pg-space-2); min-width: 0; padding: var(--pg-space-2); border: 1px solid var(--pg-line); border-radius: var(--pg-radius-md); background: var(--pg-surface); }
.pg .direct-html-editor .direct-managed-photo img { flex: none; width: 48px; height: 48px; border-radius: var(--pg-radius-xs); object-fit: cover; }
.pg .direct-html-editor .direct-managed-photo strong { flex: 1; min-width: 0; color: var(--pg-ink); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-medium); overflow-wrap: anywhere; }
.pg .direct-html-editor .direct-managed-photo .direct-icon-button { width: 36px; height: 40px; }
.pg .direct-html-editor :is(.direct-slideshow-settings, .direct-background-overlay) { min-width: 0; margin: var(--pg-space-4) 0; padding: var(--pg-space-3); border: 1px solid var(--pg-line); border-radius: var(--pg-radius-md); background: var(--pg-surface-2); }
.pg .direct-html-editor :is(.direct-slideshow-settings, .direct-background-overlay) > legend { padding-inline: var(--pg-space-1); margin: 0; color: var(--pg-ink); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-slideshow-autoplay { display: flex; align-items: center; gap: var(--pg-space-3); min-height: 44px; margin-block-end: var(--pg-space-2); font-size: var(--pg-text-md); cursor: pointer; }
.pg .direct-html-editor .direct-slideshow-settings .field { margin-block-end: var(--pg-space-3); }
.pg .direct-html-editor .direct-slideshow-settings .muted { margin-block-end: 0; }

/* Background photo */
.pg .direct-html-editor .direct-background-panel .direct-photo-preview { margin-block-end: var(--pg-space-3); }
.pg .direct-html-editor .direct-background-crop { display: grid; gap: 2px; }
.pg .direct-html-editor .direct-background-crop .field { margin-block-end: var(--pg-space-3); }
.pg .direct-html-editor .direct-background-overlay-color { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-space-3); margin-block-end: var(--pg-space-3); }
.pg .direct-html-editor :is(.direct-background-overlay-color, .direct-background-overlay-darkness) > label { color: var(--pg-ink); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-medium); }
.pg .direct-html-editor .direct-background-overlay-darkness { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--pg-space-1) var(--pg-space-3); }
.pg .direct-html-editor .direct-background-overlay-darkness > output { color: var(--pg-muted); font-size: var(--pg-text-sm); font-variant-numeric: tabular-nums; direction: ltr; }
.pg .direct-html-editor .direct-background-overlay-darkness > input { grid-column: 1 / -1; }
.pg .direct-html-editor .direct-background-overlay > .muted { margin-block-end: var(--pg-space-3); }

/* Site header (navigation) */
.pg .direct-html-editor .direct-navigation-scope { display: flex; align-items: flex-start; gap: var(--pg-space-3); margin-block-end: var(--pg-space-4); padding: var(--pg-space-3); border: 1px solid var(--pg-primary-line); border-radius: var(--pg-radius-md); background: var(--pg-primary-soft); cursor: pointer; }
.pg .direct-html-editor .direct-navigation-scope > input { margin-block-start: 2px; }
.pg .direct-html-editor .direct-navigation-scope > span { display: grid; gap: 2px; min-width: 0; }
.pg .direct-html-editor .direct-navigation-scope strong { color: var(--pg-ink); font-size: var(--pg-text-sm); }
.pg .direct-html-editor .direct-navigation-scope > span > span { color: var(--pg-muted); font-size: var(--pg-text-sm); }
.pg .direct-html-editor .direct-navigation-match-all { width: 100%; justify-content: flex-start; white-space: normal; text-align: start; }
.pg .direct-html-editor .direct-navigation-match-all-hint { margin: var(--pg-space-2) 0 var(--pg-space-4); }
.pg .direct-html-editor .direct-navigation-layouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--pg-space-2); margin-block-end: var(--pg-space-3); }
.pg .direct-html-editor .direct-navigation-card { min-height: 96px; }
.pg .direct-html-editor .direct-navigation-card > span:last-child { margin-block: auto; }
.pg .direct-html-editor .direct-navigation-preview { position: relative; display: flex; align-items: center; gap: 4px; width: 100%; height: 42px; padding: 6px; overflow: hidden; border-radius: var(--pg-radius-xs); background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-navigation-preview-logo { display: block; flex: none; width: 13px; height: 7px; border-radius: 2px; background: var(--pg-primary); }
.pg .direct-html-editor .direct-navigation-preview-menu { display: flex; align-items: center; justify-content: center; gap: 2px; width: 28px; height: 8px; }
.pg .direct-html-editor .direct-navigation-preview-menu > b { display: block; width: 6px; height: 3px; border-radius: 1px; background: var(--pg-line-strong); }
.pg .direct-html-editor .direct-navigation-preview[data-navigation-preview=center] .direct-navigation-preview-menu { position: absolute; inset-inline-start: 50%; transform: translateX(-50%); }
html[dir=rtl] .pg .direct-html-editor .direct-navigation-preview[data-navigation-preview=center] .direct-navigation-preview-menu { transform: translateX(50%); }
.pg .direct-html-editor .direct-navigation-preview[data-navigation-preview=end] .direct-navigation-preview-menu { margin-inline-start: auto; }
.pg .direct-html-editor .direct-navigation-preview[data-navigation-preview=stacked] { flex-direction: column; justify-content: center; gap: 5px; }
.pg .direct-html-editor .direct-menu-looks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pg-space-2); margin-block-end: var(--pg-space-4); }
.pg .direct-html-editor .direct-menu-looks > button { align-items: center; justify-content: center; min-height: 72px; }
.pg .direct-html-editor .direct-menu-look-preview { display: flex; align-items: center; gap: 4px; height: 22px; }
.pg .direct-html-editor .direct-menu-look-preview i { display: block; width: 16px; height: 9px; border-radius: 1px; background: var(--pg-line-strong); }
.pg .direct-html-editor .direct-menu-look-preview i:first-child { background: var(--pg-primary); }
.pg .direct-html-editor .direct-menu-look-preview[data-look=pills] i { height: 16px; border-radius: var(--pg-radius-full); }
.pg .direct-html-editor .direct-menu-look-preview[data-look=underline] i { border-block-end: 2px solid var(--pg-primary); border-radius: 0; background: transparent; }
.pg .direct-html-editor .direct-menu-look-preview[data-look=outlined] i { height: 16px; border: 1px solid var(--pg-primary); border-radius: 3px; background: transparent; }
.pg .direct-html-editor .direct-navigation-spacing { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--pg-space-2); }
.pg .direct-html-editor .direct-navigation-spacing .field:last-child { grid-column: 1 / -1; }
.pg .direct-html-editor .direct-navigation-match { margin-block-start: var(--pg-space-2); padding-block-start: var(--pg-space-2); border-block-start: 1px solid var(--pg-line); }
.pg .direct-html-editor .direct-navigation-match .direct-secondary-button { width: 100%; }
.pg .direct-html-editor .direct-navigation-edit-hint { display: flex; align-items: flex-start; gap: var(--pg-space-2); margin-block-start: var(--pg-space-3); }
.pg .direct-html-editor .direct-navigation-edit-hint > .direct-icon { width: 16px; height: 16px; margin-block-start: 2px; color: var(--pg-primary); }
.pg .direct-html-editor .direct-navigation-status { margin-block-start: var(--pg-space-3); padding: var(--pg-space-2) var(--pg-space-3); border-radius: var(--pg-radius-sm); background: var(--pg-success-soft); color: var(--pg-success); font-size: var(--pg-text-sm); }
.pg .direct-html-editor .direct-appearance-reset { margin-block-end: var(--pg-space-4); }
.pg .direct-html-editor .direct-appearance-reset > .direct-secondary-button { width: 100%; justify-content: flex-start; white-space: normal; text-align: start; }
.pg .direct-html-editor .direct-appearance-reset > .muted { margin: var(--pg-space-2) 0 0; }

/* Effects */
.pg .direct-html-editor .direct-effects-intro { margin-block-end: var(--pg-space-3); color: var(--pg-muted); font-size: var(--pg-text-sm); }
.pg .direct-html-editor .direct-effect-group { margin-block-end: var(--pg-space-4); padding-block-end: var(--pg-space-4); border-block-end: 1px solid var(--pg-line); }
.pg .direct-html-editor .direct-effect-group h4 { margin-block-end: var(--pg-space-2); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-effect-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--pg-space-2); }
.pg .direct-html-editor .direct-effect-card { min-height: 84px; }
.pg .direct-html-editor .direct-effect-swatch { display: grid; place-items: center; block-size: 40px; overflow: hidden; border-radius: var(--pg-radius-xs); background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-effect-swatch i { display: block; width: 34px; height: 24px; border-radius: 4px; background: linear-gradient(145deg, var(--pg-primary-soft-2) 45%, var(--pg-brand) 46%, var(--pg-violet)); box-shadow: var(--pg-shadow-xs); }
.pg .direct-html-editor [data-effect=photo_tone-mono] i { filter: grayscale(1); }
.pg .direct-html-editor [data-effect=photo_tone-warm] i { filter: sepia(.4) saturate(1.2); }
.pg .direct-html-editor [data-effect=photo_tone-cool] i { filter: hue-rotate(15deg); }
.pg .direct-html-editor [data-effect=photo_tone-muted] i { filter: saturate(.4); }
.pg .direct-html-editor [data-effect^=surface-] i { background: var(--pg-surface); }
.pg .direct-html-editor [data-effect=surface-soft] i { box-shadow: var(--pg-shadow-sm); }
.pg .direct-html-editor [data-effect=surface-outlined] i { border: 1px solid var(--pg-subtle); box-shadow: none; }
.pg .direct-html-editor [data-effect=surface-elevated] i { box-shadow: var(--pg-shadow-md); }
.pg .direct-html-editor [data-effect=entrance-fade] i { opacity: .45; }
.pg .direct-html-editor [data-effect=entrance-rise] i { translate: 0 -4px; }
.pg .direct-html-editor [data-effect=hover_effect-lift] i { translate: 0 -4px; box-shadow: var(--pg-shadow-md); }
.pg .direct-html-editor [data-effect=hover_effect-zoom] i { scale: 1.15; }
.pg .direct-html-editor [data-preview-effect] { width: 100%; margin-block-end: var(--pg-space-2); }

/* ======================================================================
   7. Dialogs (library, replace, help, photos, remove, pages)
   ====================================================================== */
.pg .direct-html-editor .direct-dialog {
  width: min(640px, calc(100% - 32px)); max-height: min(88dvh, 820px); padding: 0;
  overflow: auto; overscroll-behavior: contain;
  border: 0; border-radius: var(--pg-radius-xl); background: var(--pg-surface); color: var(--pg-text); box-shadow: var(--pg-shadow-lg), 0 0 0 1px color-mix(in srgb, var(--pg-halo) 30%, transparent);
}
.pg .direct-html-editor .direct-dialog[open] { animation: pg-dialog-in var(--pg-dur-slow) var(--pg-ease); }
.pg .direct-html-editor .direct-dialog::backdrop { background: var(--ed-scrim); backdrop-filter: blur(6px); }
.pg .direct-html-editor .direct-dialog-header {
  position: sticky; z-index: 3; inset-block-start: 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--pg-space-4);
  padding: var(--pg-space-6) var(--pg-space-6) var(--pg-space-4); background: var(--pg-surface);
}
/* Every dialog opens under a brand hairline. */
.pg .direct-html-editor .direct-dialog-header::before { content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; height: 3px; background: var(--pg-gradient-start); pointer-events: none; }
.pg .direct-html-editor .direct-dialog-header h3 { margin: 0 0 var(--pg-space-1); color: var(--pg-ink); font-family: var(--pg-font-display); font-size: var(--pg-text-xl); font-weight: var(--pg-weight-extrabold); line-height: 1.3; letter-spacing: var(--pg-tracking-tight); overflow-wrap: anywhere; }
html[dir=rtl] .pg .direct-html-editor .direct-dialog-header h3 { letter-spacing: 0; }
.pg .direct-html-editor .direct-dialog-header p:not(.direct-eyebrow) { max-width: 60ch; color: var(--pg-muted); font-size: var(--pg-text-md); line-height: 1.55; }
.pg .direct-html-editor .direct-dialog-header p + p { margin-block-start: var(--pg-space-2); }
.pg .direct-html-editor .direct-dialog-header .direct-eyebrow { color: var(--pg-primary); }
.pg .direct-html-editor .direct-dialog-header .direct-icon-button { margin: -6px -8px 0 0; }
html[dir=rtl] .pg .direct-html-editor .direct-dialog-header .direct-icon-button { margin: -6px 0 0 -8px; }
.pg .direct-html-editor .direct-dialog-footer {
  position: sticky; z-index: 2; inset-block-end: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--pg-space-3);
  padding: var(--pg-space-4) var(--pg-space-6); border-block-start: 1px solid var(--pg-line); background: var(--pg-bg);
}
.pg .direct-html-editor .direct-dialog-footer > span { flex: 1 1 200px; min-width: 0; color: var(--pg-muted); font-size: var(--pg-text-sm); line-height: 1.5; }
.pg .direct-html-editor .direct-dialog-footer :is(.direct-save-button, .direct-secondary-button, .direct-danger-button) { min-height: 44px; }
.pg .direct-html-editor .direct-dialog-note { display: flex; align-items: flex-start; gap: var(--pg-space-2); margin: 0; padding: var(--pg-space-2) var(--pg-space-6) var(--pg-space-6); color: var(--pg-muted); font-size: var(--pg-text-sm); line-height: 1.55; }
.pg .direct-html-editor .direct-dialog-note .direct-icon { width: 16px; height: 16px; margin-block-start: 2px; color: var(--pg-subtle); }

/* Add-content library */
.pg .direct-html-editor .direct-library-dialog { width: min(880px, calc(100% - 32px)); }
.pg .direct-html-editor .direct-library-dialog .direct-dialog-header { position: relative; }
.pg .direct-html-editor .direct-library-tools { position: sticky; z-index: 2; inset-block-start: var(--ed-library-top, 0); display: grid; gap: var(--pg-space-3); padding: 0 var(--pg-space-6) var(--pg-space-4); border-block-end: 1px solid var(--pg-line); background: var(--pg-surface); }
.pg .direct-html-editor .direct-library-tools > .muted { margin: 0; }
.pg .direct-html-editor .direct-library-categories { display: flex; flex-wrap: wrap; gap: var(--pg-space-2); }
.pg .direct-html-editor .direct-library-categories > button {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--pg-space-4);
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-full); background: var(--pg-surface);
  color: var(--pg-text); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-medium); cursor: pointer;
  transition: border-color var(--pg-dur) var(--pg-ease), background-color var(--pg-dur) var(--pg-ease), color var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-library-categories > button:hover { border-color: var(--pg-line-strong); background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-library-categories > button[aria-pressed=true] { border-color: var(--pg-night-3); background: var(--pg-night-3); color: var(--pg-on-inverse); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-library-group { padding-block-start: var(--pg-space-5); }
.pg .direct-html-editor .direct-library-group h4 { padding-inline: var(--pg-space-6); color: var(--pg-muted); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(176px, 100%), 1fr)); gap: var(--pg-space-3); padding: var(--pg-space-3) var(--pg-space-6) var(--pg-space-2); }
.pg .direct-html-editor .direct-library-group:last-of-type .direct-library-grid { padding-block-end: var(--pg-space-5); }
.pg .direct-html-editor .direct-library-card {
  display: flex; flex-direction: column; align-items: stretch; gap: var(--pg-space-1); min-width: 0; padding: var(--pg-space-2) var(--pg-space-2) var(--pg-space-3);
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-lg); background: var(--pg-surface);
  color: var(--pg-ink); text-align: start; cursor: grab; user-select: none; -webkit-user-drag: element;
  transition: border-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease), transform var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-library-card:hover { border-color: var(--pg-primary-line); box-shadow: var(--pg-shadow-glow); transform: translateY(-2px); }
.pg .direct-html-editor .direct-library-card:active { cursor: grabbing; }
.pg .direct-html-editor .direct-library-card strong { padding-inline: var(--pg-space-1); font-size: var(--pg-text-md); font-weight: var(--pg-weight-semibold); line-height: 1.35; }
.pg .direct-html-editor .direct-library-card > span:last-child { padding-inline: var(--pg-space-1); color: var(--pg-muted); font-size: var(--pg-text-xs); line-height: 1.5; }
.pg .direct-html-editor .direct-library-visual {
  position: relative; isolation: isolate; display: grid; place-items: center; height: 72px; margin-block-end: var(--pg-space-1); overflow: hidden;
  border-radius: var(--pg-radius-md); background: linear-gradient(145deg, var(--pg-surface-2), var(--pg-primary-soft)); color: var(--pg-primary);
}
.pg .direct-html-editor .direct-library-visual > :is(.direct-icon, .direct-icon-wrap) { position: relative; z-index: 1; width: 22px; height: 22px; }
.pg .direct-html-editor .direct-library-visual::before { content: ""; position: absolute; inset-block-start: 14px; inset-inline: 18%; height: 44px; border: 1px solid var(--pg-primary-line); border-radius: var(--pg-radius-xs); background: var(--pg-surface); box-shadow: var(--pg-shadow-xs); }
.pg .direct-html-editor .direct-library-visual[data-preview=faq]::before { border: 0; background: repeating-linear-gradient(to bottom, var(--pg-surface) 0 10px, var(--pg-primary-line) 10px 14px); }
.pg .direct-html-editor .direct-library-visual[data-preview=tabs]::before { border-block-start: 7px solid var(--pg-primary-line); }
.pg .direct-html-editor .direct-library-visual[data-preview=gallery]::before { background: linear-gradient(to right, var(--pg-primary-soft-2) 0 30%, var(--pg-surface) 30% 35%, var(--pg-primary-soft-2) 35% 65%, var(--pg-surface) 65% 70%, var(--pg-primary-soft-2) 70%); }
.pg .direct-html-editor .direct-library-visual[data-preview=heading]::before { inset-block-start: 24px; height: 24px; }
.pg .direct-html-editor .direct-library-visual[data-preview=cta]::before { inset-block-start: 22px; inset-inline: 30%; height: 28px; border-radius: var(--pg-radius-sm); background: var(--pg-primary-soft-2); }
.pg .direct-html-editor .direct-library-visual[data-preview=body]::before { background: repeating-linear-gradient(to bottom, var(--pg-primary-soft-2) 0 3px, var(--pg-surface) 3px 8px); }
.pg .direct-html-editor .direct-library-visual[data-preview=image]::before { background: linear-gradient(145deg, var(--pg-primary-soft-2), var(--pg-primary-line)); }
.pg .direct-html-editor .direct-library-visual:is([data-preview=services], [data-preview=team], [data-preview=steps], [data-preview=testimonial], [data-preview=banner]) { background: linear-gradient(135deg, var(--pg-primary-soft), var(--pg-success-soft)); }
.pg .direct-html-editor .direct-replace-choices .direct-library-card > .direct-icon-wrap { display: grid; place-items: center; height: 72px; border-radius: var(--pg-radius-md); background: var(--pg-primary-soft); color: var(--pg-primary); }

/* Help + shortcuts */
.pg .direct-html-editor .direct-help-dialog { width: min(760px, calc(100% - 32px)); }
.pg .direct-html-editor .direct-help-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pg-space-5) var(--pg-space-6); padding: var(--pg-space-2) var(--pg-space-6) var(--pg-space-6); }
.pg .direct-html-editor .direct-help-step { display: flex; gap: var(--pg-space-3); min-width: 0; }
.pg .direct-html-editor .direct-help-step > span { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--pg-radius-md); background: var(--pg-night-3); color: var(--pg-halo); }
.pg .direct-html-editor .direct-help-step h4 { margin-block-end: var(--pg-space-1); font-size: var(--pg-text-md); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-help-step p:not(.direct-eyebrow) { color: var(--pg-muted); font-size: var(--pg-text-sm); line-height: 1.6; }
.pg .direct-html-editor .direct-shortcuts { margin: 0 var(--pg-space-6) var(--pg-space-6); padding: var(--pg-space-4); border-radius: var(--pg-radius-lg); background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-shortcuts h4 { display: flex; align-items: center; gap: var(--pg-space-2); font-size: var(--pg-text-md); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-shortcuts h4 .direct-icon { width: 18px; height: 18px; color: var(--pg-primary); }
.pg .direct-html-editor .direct-shortcuts > p { margin: var(--pg-space-1) 0 var(--pg-space-3); color: var(--pg-muted); font-size: var(--pg-text-sm); }
.pg .direct-html-editor .direct-shortcut-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pg-space-2) var(--pg-space-6); margin: 0; }
.pg .direct-html-editor .direct-shortcut-list > div { display: flex; align-items: center; justify-content: space-between; gap: var(--pg-space-3); min-height: 32px; }
.pg .direct-html-editor .direct-shortcut-list dt { display: inline-flex; flex: none; align-items: center; gap: 4px; order: 2; color: var(--pg-subtle); font-size: var(--pg-text-xs); }
.pg .direct-html-editor .direct-shortcut-list dd { margin: 0; color: var(--pg-text); font-size: var(--pg-text-sm); }

/* Photo picker */
.pg .direct-html-editor .direct-photo-dialog { width: min(820px, calc(100% - 32px)); }
.pg .direct-html-editor .direct-photo-dialog.is-dragging { outline: 3px dashed var(--pg-primary); outline-offset: -10px; }
.pg .direct-html-editor .direct-photo-tools { display: flex; flex-wrap: wrap; gap: var(--pg-space-3); padding: 0 var(--pg-space-6) var(--pg-space-2); }
.pg .direct-html-editor .direct-photo-search { flex: 1 1 260px; }
.pg .direct-html-editor .direct-photo-tools .direct-secondary-button { min-height: var(--ed-ctl); }
.pg .direct-html-editor .direct-photo-upload-hint { margin: 0; padding: 0 var(--pg-space-6) var(--pg-space-3); color: var(--pg-subtle); font-size: var(--pg-text-sm); }
.pg .direct-html-editor .direct-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(168px, 100%), 1fr)); gap: var(--pg-space-3); min-height: 120px; padding: var(--pg-space-1) var(--pg-space-6) var(--pg-space-6); }
.pg .direct-html-editor .direct-photo-tile {
  position: relative; min-width: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--pg-line); border-radius: var(--pg-radius-lg); background: var(--pg-surface);
  color: var(--pg-ink); text-align: start; cursor: pointer;
  transition: border-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease);
}
.pg .direct-html-editor .direct-photo-tile:hover { border-color: var(--pg-line-strong); box-shadow: var(--pg-shadow-md); }
.pg .direct-html-editor .direct-photo-tile img { display: block; width: 100%; height: 124px; object-fit: cover; background: var(--pg-surface-2); }
.pg .direct-html-editor .direct-photo-tile > span { display: block; padding: var(--pg-space-2) var(--pg-space-3); overflow: hidden; font-size: var(--pg-text-xs); text-overflow: ellipsis; white-space: nowrap; }
.pg .direct-html-editor .direct-photo-tile[aria-pressed=true] { border-color: var(--pg-primary); box-shadow: 0 0 0 2px var(--pg-primary); }
.pg .direct-html-editor .direct-photo-tile > .direct-photo-tick { position: absolute; inset-block-start: var(--pg-space-2); inset-inline-end: var(--pg-space-2); display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 50%; background: var(--pg-gradient); color: var(--pg-on-primary); box-shadow: var(--pg-shadow-sm); }
.pg .direct-html-editor .direct-photo-tick .direct-icon { width: 15px; height: 15px; }
.pg .direct-html-editor .direct-photo-empty { display: flex; flex-direction: column; align-items: center; gap: var(--pg-space-2); padding: var(--pg-space-8) var(--pg-space-6) var(--pg-space-10); text-align: center; }
.pg .direct-html-editor .direct-photo-empty > .direct-icon { width: 40px; height: 40px; color: var(--pg-subtle); }
.pg .direct-html-editor .direct-photo-empty h4 { font-size: var(--pg-text-lg); }
.pg .direct-html-editor .direct-photo-empty p { max-width: 44ch; margin-block-end: var(--pg-space-2); color: var(--pg-muted); }

/* Remove / page dialogs */
.pg .direct-html-editor :is(.direct-remove-dialog, .direct-new-page-dialog, .direct-delete-page-dialog) { width: min(480px, calc(100% - 32px)); }
.pg .direct-html-editor .direct-new-page-fields { padding: 0 var(--pg-space-6) var(--pg-space-6); }
.pg .direct-html-editor .direct-new-page-fields .field { margin: 0; }
.pg .direct-html-editor :is(.direct-new-page-error, .direct-delete-page-error) { margin: 0 0 var(--pg-space-3); padding: var(--pg-space-3); border: 1px solid var(--pg-danger-line); border-radius: var(--pg-radius-sm); background: var(--pg-danger-soft); color: var(--pg-danger); font-size: var(--pg-text-sm); font-weight: var(--pg-weight-medium); }
.pg .direct-html-editor .direct-delete-page-error { margin: 0 var(--pg-space-6) var(--pg-space-4); }

/* ======================================================================
   8. Responsive
   ====================================================================== */
@media (min-width: 1600px) {
  .pg .direct-html-editor .direct-editor-toolbar { grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "pages langs tools save"; }
  .pg .direct-html-editor .direct-editor-tools { min-height: 0; padding: var(--pg-space-2) 0; border: 0; background: transparent; }
  .pg .direct-html-editor .direct-save-shortcut { display: inline-flex; }
}
@media (min-width: 1280px) {
  .pg .direct-html-editor .direct-save-shortcut { display: inline-flex; }
}
@media (max-width: 1279px) {
  .pg .direct-html-editor .direct-editor-toolbar { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "pages save" "langs tools"; }
  .pg .direct-html-editor .direct-editor-languages { align-self: stretch; padding-inline-start: var(--pg-space-4); border-block-start: 1px solid var(--pg-line); background: var(--pg-surface); }
  .pg .direct-html-editor .direct-editor-guide { flex: 1 1 0; min-width: 0; }
  .pg .direct-html-editor .direct-draft-badge { display: none; }
}
/* Languages and tools share the second row here: the tools cell reaches back
   over the column gap so the row reads as one band on the midnight deck. */
@media (min-width: 1024px) and (max-width: 1279px) {
  .pg .direct-html-editor .direct-editor-tools { margin-inline-start: calc(-1 * var(--pg-space-4)); padding-inline-start: var(--pg-space-8); }
}
@media (max-width: 1023px) {
  .pg .direct-html-editor { --ed-panel-w: auto; }
  .pg .direct-html-editor .direct-editor-toolbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "pages save" "langs langs" "tools tools"; }
  .pg .direct-html-editor .direct-editor-languages { flex-wrap: wrap; padding: 0 var(--pg-space-4) var(--pg-space-2); border: 0; }
  .pg .direct-html-editor .direct-editor-handoff { display: none; }
  /* Bottom sheet: sizes come from the panel controller. */
  .pg .direct-html-editor .direct-editor-fields {
    inset-inline: 8px; left: 8px; right: 8px; inset-block-start: auto; bottom: var(--direct-panel-bottom, 12px);
    width: auto; max-width: none; height: auto; max-height: var(--direct-panel-height, 44dvh);
    padding-inline: var(--pg-space-4); border-radius: var(--pg-radius-xl) var(--pg-radius-xl) var(--pg-radius-lg) var(--pg-radius-lg);
    animation-name: ed-sheet-in;
  }
  .pg .direct-html-editor .direct-component-heading { padding-block-start: var(--pg-space-4); }
  .pg .direct-html-editor .direct-component-heading::before { content: ""; position: absolute; inset-block-start: 6px; inset-inline-start: calc(50% - 18px); width: 36px; height: 4px; border-radius: var(--pg-radius-full); background: var(--pg-line-strong); }
  .pg .direct-html-editor .direct-panel-handle { display: none; }
}
@media (max-width: 767px) {
  .pg .direct-html-editor .direct-editor-toolbar { position: relative; inset-block-start: auto; grid-template-columns: minmax(0, 1fr); grid-template-areas: "pages" "save" "langs" "tools"; -webkit-backdrop-filter: none; backdrop-filter: none; background: radial-gradient(90% 60% at 50% -20%, color-mix(in srgb, var(--pg-brand) 30%, transparent), transparent 70%), var(--pg-night); }
  .pg .direct-html-editor .direct-editor-pages { padding-inline-end: var(--pg-space-4); }
  .pg .direct-html-editor .direct-page-picker { flex: 1; }
  .pg .direct-html-editor .direct-page-picker select { width: 100%; }
  /* A fixed grid keeps the row height stable while the status text changes. */
  .pg .direct-html-editor .direct-editor-saving { display: grid; grid-template-columns: 1fr 1fr; gap: var(--pg-space-2); padding: 0 var(--pg-space-4) var(--pg-space-2); }
  .pg .direct-html-editor .direct-save-status { grid-column: 1 / -1; max-width: none; }
  .pg .direct-html-editor .direct-editor-languages { justify-content: space-between; }
  .pg .direct-html-editor .direct-editor-tools { flex-wrap: wrap; gap: var(--pg-space-1) var(--pg-space-2); padding-block: var(--pg-space-2); }
  .pg .direct-html-editor .direct-editor-tools > .direct-add-button { margin-inline-start: auto; }
  .pg .direct-html-editor .direct-preview-tools { order: 3; margin-inline-start: 0; }
  .pg .direct-html-editor .direct-tool-group--end { order: 4; }
  .pg .direct-html-editor .direct-editor-hintbar { padding-inline: var(--pg-space-4); }
  .pg .direct-html-editor .direct-editor-canvas { padding: 0 0 var(--pg-space-16); background-image: none; }
  .pg .direct-html-editor .direct-editor-canvas iframe { border-radius: 0; box-shadow: none; }
  .pg .direct-html-editor .direct-dialog { width: calc(100% - 16px); max-height: 92dvh; border-radius: var(--pg-radius-lg); }
  .pg .direct-html-editor .direct-dialog-header { padding: var(--pg-space-5) var(--pg-space-4) var(--pg-space-3); }
  .pg .direct-html-editor .direct-dialog-header h3 { font-size: var(--pg-text-lg); }
  .pg .direct-html-editor .direct-dialog-footer { padding: var(--pg-space-3) var(--pg-space-4); }
  .pg .direct-html-editor :is(.direct-library-tools, .direct-photo-tools) { padding-inline: var(--pg-space-4); }
  .pg .direct-html-editor .direct-library-tools { position: static; }
  .pg .direct-html-editor .direct-library-group h4 { padding-inline: var(--pg-space-4); }
  .pg .direct-html-editor :is(.direct-library-grid, .direct-photo-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pg-space-2); padding-inline: var(--pg-space-4); }
  .pg .direct-html-editor :is(.direct-dialog-note, .direct-photo-upload-hint) { padding-inline: var(--pg-space-4); }
  .pg .direct-html-editor .direct-help-steps { grid-template-columns: 1fr; padding-inline: var(--pg-space-4); }
  .pg .direct-html-editor .direct-shortcuts { margin-inline: var(--pg-space-4); }
  .pg .direct-html-editor .direct-shortcut-list { grid-template-columns: 1fr; }
  .pg .direct-html-editor .direct-new-page-fields { padding-inline: var(--pg-space-4); }
}
@media (max-width: 379px) {
  .pg .direct-html-editor .direct-preview-tools .direct-icon-button { width: 36px; }
  .pg .direct-html-editor .direct-editor-tools > .direct-add-button { padding-inline: var(--pg-space-3); }
}

@keyframes ed-panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ed-sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .pg .direct-html-editor .direct-editor-fields { animation: none; }
  .pg .direct-html-editor .direct-library-card:hover { transform: none; }
  .pg .direct-html-editor :is(.direct-save-button, .direct-add-button, .direct-secondary-button, .direct-danger-button, .direct-publish-link, .direct-icon-button):active { transform: none; }
  .pg .direct-html-editor :is(.direct-inspector-tabs, .component-mode-tabs) > button::after { transition: none; }
}

/* ======================================================================
   9. Legacy inline / component editor (layout versions before DirectHtml).
   Its panels keep inline_editor.css and component_editor.css; these rules
   only align shared pieces with the Pagetna system.
   ====================================================================== */
.pg .pg-editor-legacy .ie-panel-card-icon .pg-icon { width: var(--pg-icon-lg); height: var(--pg-icon-lg); color: var(--pg-primary); }
.pg .pg-editor-legacy .ie-translation-notice { display: flex; align-items: center; gap: var(--pg-space-2); }
.pg .pg-editor-legacy .ie-lang-note .pg-icon { flex: none; margin-block-start: 3px; color: var(--pg-primary); }
@media (max-width: 600px) {
  .pg .pg-editor-legacy .ie-topbar-right { flex-wrap: wrap; }
  .pg .pg-editor-legacy .ie-topbar-right .editor-history-anchor { flex-basis: 100%; }
  .pg .pg-editor-legacy .editor-history .editor-history-button { min-height: 44px; }
}
.pg .pg-editor-legacy .component-library-icon .direct-icon { width: var(--pg-icon-md); height: var(--pg-icon-md); }
.pg .pg-editor-legacy .component-library-plus .direct-icon { width: 14px; height: 14px; }
.pg .pg-editor-legacy .ie-topbar .direct-icon, .pg .pg-editor-legacy .editor-history .pg-icon { width: 18px; height: 18px; }


/* Colour swatches: owners recolour only from the site's own palette. */
.pg .direct-html-editor .direct-design-controls { display: flex; flex-direction: column; gap: var(--pg-space-4); }
.pg .direct-html-editor .direct-palette .direct-setting-label { margin-block-end: var(--pg-space-2); }
.pg .direct-html-editor .direct-swatches { display: flex; flex-wrap: wrap; gap: var(--pg-space-2); }
.pg .direct-html-editor .direct-swatch { display: grid; place-items: center; inline-size: 44px; block-size: 44px; padding: 0; border: 1px solid var(--pg-line-strong); border-radius: var(--pg-radius-full); background: var(--swatch, var(--pg-surface)); color: var(--pg-muted); cursor: pointer; box-shadow: inset 0 0 0 3px var(--pg-surface); transition: box-shadow var(--pg-dur-fast) var(--pg-ease), border-color var(--pg-dur-fast) var(--pg-ease); }
.pg .direct-html-editor .direct-swatch:hover { border-color: var(--pg-primary); }
.pg .direct-html-editor .direct-swatch[aria-pressed=true] { border-color: var(--pg-primary); box-shadow: inset 0 0 0 3px var(--pg-surface), 0 0 0 2px var(--pg-primary); }
.pg .direct-html-editor .direct-swatch:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--pg-surface), var(--pg-ring); }
.pg .direct-html-editor .direct-swatch--reset { --swatch: var(--pg-surface); border-style: dashed; }
.pg .direct-html-editor .direct-swatch--reset .pg-icon, .pg .direct-html-editor .direct-swatch--reset svg { inline-size: 18px; block-size: 18px; }
.pg .direct-html-editor .direct-design-note { margin: 0; }


/* ======================================================================
   10. Finish pass: spacing, direction-aware alignment, pressed feedback
   ====================================================================== */
/* Setting labels sit a step below the control before them and close to
   their own control (the shared label reset above outranks the base rule). */
.pg .direct-html-editor .direct-editor-fields .direct-setting-label { margin: var(--pg-space-4) 0 var(--pg-space-2); }
.pg .direct-html-editor .direct-editor-fields .direct-setting-label:first-child,
.pg .direct-html-editor .direct-editor-fields .direct-design-controls .direct-setting-label { margin-block-start: 0; }
.pg .direct-html-editor .direct-editor-fields [data-feature-settings] > p { margin: 0 0 var(--pg-space-3); color: var(--pg-muted); font-size: var(--pg-text-sm); line-height: 1.55; }
.pg .direct-html-editor .direct-editor-fields [data-feature-settings] > .direct-secondary-button { margin-block-end: var(--pg-space-2); }

/* Text alignment follows the language being edited, not the language of the
   editor: in Arabic content "start" is the right edge, so the group runs
   right to left and its start/end icons mirror. */
.pg .direct-html-editor .direct-alignment { direction: ltr; }
.pg .direct-html-editor[data-direct-html-editor-locale-value=ar] .direct-alignment { direction: rtl; }
.pg .direct-html-editor[data-direct-html-editor-locale-value=ar] .direct-alignment :is([data-style-value=start], [data-style-value=end]) .direct-icon { transform: scaleX(-1); }

/* Choice cards, tiles and swatches answer a press. */
.pg .direct-html-editor :is(.direct-layout-card, .direct-navigation-card, .direct-effect-card, .direct-menu-looks > button, .direct-presets > button, .direct-quick-tasks > button, .direct-photo-tile, .direct-photo-preview, .direct-library-categories > button, .direct-selection-path button):active { transform: scale(0.98); }
.pg .direct-html-editor .direct-swatch:active { transform: scale(0.92); }

@media (max-width: 767px) {
  /* The upload button fills its own row instead of hanging at one edge. */
  .pg .direct-html-editor .direct-photo-tools .direct-secondary-button { flex: 1 1 100%; justify-content: center; }
}
@media (max-width: 480px) {
  /* Dialog actions span the sheet so the main action is easy to reach. */
  .pg .direct-html-editor .direct-dialog-footer :is(.direct-save-button, .direct-secondary-button, .direct-danger-button) { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .pg .direct-html-editor :is(.direct-layout-card, .direct-navigation-card, .direct-effect-card, .direct-menu-looks > button, .direct-presets > button, .direct-quick-tasks > button, .direct-photo-tile, .direct-photo-preview, .direct-swatch, .direct-library-categories > button, .direct-selection-path button):active { transform: none; }
}
/* Midnight toolbar: device and language choices light up under the pointer. */
.pg .direct-html-editor .direct-editor-toolbar .direct-preview-tools .direct-icon-button:not([aria-pressed=true]):hover,
.pg .direct-html-editor .direct-editor-toolbar .direct-language-picker a:not([aria-current=page]):hover { background: color-mix(in srgb, var(--pg-ink) 10%, transparent); }
/* Table and chart editor: the column-names row is the highlighted one (in a
   table it follows the remove-column row; a chart has no header row), and the
   remove-column chips line up with their columns. */
.pg .direct-html-editor .direct-data-grid-column { padding-inline-end: 42px; }
.pg .direct-html-editor .direct-data-grid-column button { border: 1px dashed var(--pg-line-strong); background: transparent; font-weight: var(--pg-weight-medium); transition: background-color var(--pg-dur-fast) var(--pg-ease), border-color var(--pg-dur-fast) var(--pg-ease), color var(--pg-dur-fast) var(--pg-ease); }
.pg .direct-html-editor .direct-data-grid-column button:hover { border-color: var(--pg-danger-line); background: var(--pg-danger-soft); color: var(--pg-danger); }
.pg .direct-html-editor .direct-data-grid-column + .direct-data-grid-row input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=search]) { background-color: var(--pg-primary-soft); font-weight: var(--pg-weight-semibold); }
.pg .direct-html-editor .direct-data-grid-row:first-child:has(input[type=number]) input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=search]) { background-color: var(--pg-surface); font-weight: var(--pg-weight-regular); }
