/* The post editor (editor/src). The admin's own colours for the chrome; the
   page itself uses the site's fonts and colours (Sites -> How posts look),
   passed in as --pe-* variables, so writing looks like the published post. */

/* ---------- frame: header, toolbar, page, settings ---------- */
main:has(> .pe) { padding: 0; }
main > .pe { max-width: none; }
.pe { min-height: calc(100vh - 52px); display: flex; flex-direction: column; }

.pe-head {
  position: sticky; top: 52px; z-index: 31; height: 52px;
  display: flex; align-items: center; gap: .6rem; padding: 0 .75rem 0 .5rem;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.pe-back {
  display: inline-flex; align-items: center; gap: .25rem; padding: .35rem .55rem; border-radius: 6px;
  color: var(--fg); text-decoration: none; font-weight: 550;
}
.pe-back:hover { background: var(--panel-hover); }
.pe-back-icon { width: 16px; height: 16px; transform: rotate(90deg); }
.pe-status {
  font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--fg-muted); border: 1px solid var(--border); white-space: nowrap;
}
.pe-status[data-status="published"] { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-border); }
.pe-status[data-status="scheduled"] { background: color-mix(in srgb, var(--link) 12%, transparent); color: var(--link); border-color: color-mix(in srgb, var(--link) 30%, transparent); }
.pe-saved { font-size: .8rem; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pe-saved.is-error { color: var(--danger); }
.pe-head-fill { flex: 1; }
.pe-words { font-size: .75rem; color: var(--fg-muted); white-space: nowrap; }
.pe-head-btn { height: 32px; padding: 0 .9rem; font-size: .85rem; display: inline-flex; align-items: center; }
.pe-head .button.is-quiet { background: var(--accent-soft); color: var(--fg); border: 1px solid var(--border); }
.pe-head-btn:disabled { opacity: .45; cursor: not-allowed; }
.pe-icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; border-radius: 6px;
  background: transparent; color: var(--fg-muted); cursor: pointer;
}
.pe-icon-btn:hover { background: var(--panel-hover); color: var(--fg); }
.pe-icon-btn .icon { width: 18px; height: 18px; }

.pe-toolbar {
  position: sticky; top: 104px; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 5px 10px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.pe-tb-group { display: flex; gap: 1px; align-items: center; }
.pe-tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 5px; flex: none; }
.pe-tb-fill { flex: 1; }
.pe-tb {
  height: 32px; min-width: 32px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--fg);
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; flex: none;
}
.pe-tb:hover:not(:disabled) { background: var(--panel-hover); }
.pe-tb.is-on { background: color-mix(in srgb, var(--link) 12%, transparent); color: var(--link); }
.pe-tb:disabled { opacity: .3; cursor: default; }
.pe-tb[aria-expanded="true"] { background: var(--panel-hover); }
.pe-i { width: 18px; height: 18px; flex: none; }
.pe-tb-select { justify-content: space-between; min-width: 124px; border-color: var(--border); padding: 0 6px 0 10px; }
.pe-tb-size { min-width: 92px; }
.pe-tb-text { overflow: hidden; text-overflow: ellipsis; }
.pe-chev { width: 14px; height: 14px; opacity: .55; }
.pe-tb-colour { flex-direction: column; gap: 0; padding-top: 3px; }
.pe-tb-colour .pe-i { width: 16px; height: 16px; }
.pe-colour-bar { width: 18px; height: 4px; border-radius: 2px; margin-top: 1px; border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent); }
.pe-tb-insert { background: var(--accent); color: var(--accent-fg); padding: 0 12px 0 8px; font-weight: 600; }
.pe-tb-insert:hover:not(:disabled) { background: var(--accent-hover); }

.pe-body { flex: 1; display: flex; align-items: flex-start; }
.pe-canvas {
  flex: 1; min-width: 0; container-type: inline-size; overflow-x: clip;
  padding: 32px 24px 160px; background: var(--bg-subtle);
}
.pe-page {
  position: relative; box-sizing: content-box; max-width: var(--pe-width); margin: 0 auto; min-height: 60vh;
  padding: 56px 76px 96px;
  background: var(--pe-bg); color: var(--pe-text);
  font-family: var(--pe-font-body); font-size: var(--pe-size); line-height: var(--pe-lh);
  border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.05);
  color-scheme: light;
}
.pe-title {
  display: block; width: 100%; resize: none; overflow: hidden; border: 0; outline: none; padding: 0; margin: 0 0 .6em;
  background: transparent; color: var(--pe-heading); font-family: var(--pe-font-heading);
  font-size: 2.3em; font-weight: 700; line-height: 1.15; letter-spacing: -.01em;
}
.pe-title::placeholder { color: color-mix(in srgb, var(--pe-text) 30%, transparent); }
.pe-title:focus { box-shadow: none; }

.pe-side {
  width: 300px; flex: none; position: sticky; top: 150px; max-height: calc(100vh - 150px); overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--border); align-self: stretch;
}
.pe-side .metabox { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; margin: 0; box-shadow: none; }
body.pe-side-closed .pe-side { display: none; }

@media (max-width: 1100px) {
  .pe-side {
    position: fixed; right: 0; top: 104px; bottom: 0; max-height: none; z-index: 44; display: none;
    box-shadow: -12px 0 32px rgba(0,0,0,.15);
  }
  body.pe-side-open .pe-side { display: block; }
}
@media (max-width: 720px) {
  .pe-canvas { padding: 12px 8px 120px; }
  .pe-page { padding: 28px 18px 64px; }
  .pe-words, .pe-saved, .pe-back span, [data-pe-settings] { display: none; }
  .pe-head { gap: .4rem; }
  .pe-head-btn { padding: 0 .7rem; }
  .pe-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .pe-block-handle { display: none !important; }
}

/* ---------- the writing: prose in the site's style ---------- */
.pe-prose { outline: none; min-height: 12em; }
.pe-prose > * { margin-top: 0; }
.pe-prose p { margin: 0 0 1em; }
.pe-prose h2, .pe-prose h3, .pe-prose h4 {
  font-family: var(--pe-font-heading); color: var(--pe-heading); line-height: 1.25; font-weight: 700; letter-spacing: -.01em;
  margin: 1.5em 0 .5em;
}
.pe-prose h2 { font-size: 1.75em; }
.pe-prose h3 { font-size: 1.4em; }
.pe-prose h4 { font-size: 1.15em; }
.pe-prose > :first-child { margin-top: 0; }
.pe-prose a { color: var(--pe-link); text-decoration: underline; text-underline-offset: .15em; }
.pe-prose ul, .pe-prose ol { margin: 0 0 1em; padding-left: 1.6em; }
.pe-prose ul { list-style: disc; }
.pe-prose ol { list-style: decimal; }
.pe-prose ul ul { list-style: circle; }
.pe-prose li { margin: .2em 0; }
.pe-prose li > p { margin: 0; }
.pe-prose li > ul, .pe-prose li > ol { margin: .2em 0 0; }
.pe-prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: color-mix(in srgb, var(--pe-text) 8%, transparent); padding: .1em .3em; border-radius: 4px; }
.pe-prose mark { color: inherit; padding: 0 .1em; border-radius: .15em; }
.pe-prose .fs-sm { font-size: .875em; }
.pe-prose .fs-lg { font-size: 1.25em; }
.pe-prose .fs-xl { font-size: 1.5em; }
.pe-prose ::selection { background: color-mix(in srgb, #2563eb 25%, transparent); }

/* Placeholders */
.pe-prose .is-empty:not([data-block="button"])::before {
  content: attr(data-placeholder); float: left; height: 0; pointer-events: none;
  color: color-mix(in srgb, var(--pe-text) 35%, transparent);
}
.pe-prose [data-block="button"] > span:empty::before,
.pe-prose [data-block="button"].is-empty > span::before { content: attr(data-placeholder); opacity: .6; }
.pe-prose figcaption.is-empty[data-placeholder="Add a caption"]::before { display: none; }
.pe-prose .pe-figure.is-selected figcaption.is-empty::before,
.pe-prose .pe-figure:hover figcaption.is-empty::before { display: block; }

/* Quote */
.pe-prose blockquote[data-block="quote"] {
  margin: 1.6em 0; padding: .1em 0 .1em 1.2em; font-style: italic;
  border-left: 4px solid color-mix(in srgb, var(--pe-link) 45%, transparent);
}
.pe-prose blockquote p { margin: 0; }
.pe-prose blockquote cite { display: block; margin-top: .5em; font-style: normal; font-size: .9em; opacity: .75; }
.pe-prose blockquote cite:not(.is-empty)::before { content: "— "; }
.pe-prose blockquote[data-style="large"] {
  border: 0; padding: .4em 1em; text-align: center; font-family: var(--pe-font-heading);
  font-size: 1.45em; line-height: 1.35; color: var(--pe-heading);
}
.pe-prose blockquote[data-style="large"] cite { font-family: var(--pe-font-body); font-size: .62em; }

/* Callout */
.pe-prose aside[data-block="callout"] {
  margin: 1.5em 0; padding: 1em 1.25em; border-radius: 10px;
  background: color-mix(in srgb, var(--pe-text) 5%, var(--pe-bg)); border: 1px solid color-mix(in srgb, var(--pe-text) 12%, transparent);
}
.pe-prose aside[data-tone="positive"] { background: #ecfdf3; border-color: #a7f3c4; }
.pe-prose aside[data-tone="warning"] { background: #fff7ed; border-color: #fdcf9b; }

/* Button: its label is typed in place */
.pe-prose div[data-block="button"] { margin: 1.5em 0; }
.pe-prose div[data-block="button"] > span {
  display: inline-block; min-width: 3em; padding: .65em 1.5em; border-radius: 10px;
  background: var(--btn, var(--pe-link)); color: #fff; font-weight: 600; line-height: 1.3; text-decoration: none;
}
.pe-prose div[data-block="button"] > span[data-style="outline"] {
  background: transparent; color: var(--btn, var(--pe-link)); box-shadow: inset 0 0 0 2px var(--btn, var(--pe-link));
}

/* Divider */
.pe-prose hr[data-block="divider"] {
  border: 0; border-top: 1px solid color-mix(in srgb, var(--pe-text) 22%, transparent); margin: 2.2em 0; overflow: visible;
}
.pe-prose hr[data-style="dots"] { border: 0; text-align: center; height: 1.5em; }
.pe-prose hr[data-style="dots"]::after { content: "• • •"; letter-spacing: .8em; opacity: .5; }
.pe-prose hr[data-style="space"] { border: 0; height: 2.5em; margin: 0; }
.pe-prose hr[data-style="space"]:hover { outline: 1px dashed color-mix(in srgb, var(--pe-text) 25%, transparent); }
.pe-prose hr.ProseMirror-selectednode { outline: 3px solid #2563eb; outline-offset: 6px; border-radius: 2px; }

/* Table */
.pe-prose .tableWrapper { margin: 1.5em 0; overflow-x: auto; padding-bottom: 2px; }
.pe-prose table { border-collapse: collapse; width: 100%; font-size: .95em; table-layout: fixed; border: 0; background: none; }
.pe-prose th, .pe-prose td {
  display: table-cell !important; position: relative; padding: .5em .7em; vertical-align: top; text-align: left;
  border: 1px solid color-mix(in srgb, var(--pe-text) 22%, transparent); color: inherit; font-size: inherit;
}
.pe-prose th { background: color-mix(in srgb, var(--pe-text) 6%, transparent); font-weight: 700; text-transform: none; letter-spacing: 0; }
.pe-prose td p, .pe-prose th p { margin: 0; }
.pe-prose .selectedCell::after { content: ""; position: absolute; inset: 0; background: rgba(37, 99, 235, .15); pointer-events: none; }

/* Columns */
.pe-prose div[data-block="columns"] {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1.6em; margin: 1.5em 0;
}
.pe-prose div[data-widths="2-1"] { grid-template-columns: 2fr 1fr; grid-auto-flow: row; }
.pe-prose div[data-widths="1-2"] { grid-template-columns: 1fr 2fr; grid-auto-flow: row; }
.pe-prose div[data-valign="center"] { align-items: center; }
.pe-prose div[data-block="column"] { min-width: 0; border-radius: 6px; outline: 1px dashed transparent; outline-offset: 6px; }
.pe-prose div[data-block="columns"]:hover > div[data-block="column"],
.pe-prose div[data-block="columns"]:focus-within > div[data-block="column"] { outline-color: color-mix(in srgb, var(--pe-text) 22%, transparent); }
.pe-prose div[data-block="column"] > :last-child { margin-bottom: 0; }

/* ---------- pictures, galleries, embeds ---------- */
.pe-figure { position: relative; margin: 1.6em auto; max-width: 100%; clear: both; }
.pe-figure[data-align="left"] { margin-left: 0; margin-right: auto; }
.pe-figure[data-align="right"] { margin-left: auto; margin-right: 0; }
.pe-figure[data-wrap="1"][data-align="left"] { float: left; clear: left; margin: .35em 1.6em 1em 0; }
.pe-figure[data-wrap="1"][data-align="right"] { float: right; clear: right; margin: .35em 0 1em 1.6em; }
.pe-figure[data-layout="wide"] {
  width: auto; max-width: none;
  margin-left: calc((100% - min(100% + 320px, 100cqw - 48px)) / 2);
  margin-right: calc((100% - min(100% + 320px, 100cqw - 48px)) / 2);
}
.pe-figure[data-layout="full"] { width: auto; max-width: none; margin-left: calc((100% - 100cqw) / 2); margin-right: calc((100% - 100cqw) / 2); }
.pe-prose h2, .pe-prose h3, .pe-prose h4, .pe-prose div[data-block="columns"], .pe-prose .tableWrapper { clear: both; }

.pe-frame { position: relative; line-height: 0; }
.pe-frame img {
  display: block; width: 100%; height: auto; border-radius: inherit; border: var(--pe-border, none);
  box-sizing: border-box; background: color-mix(in srgb, var(--pe-text) 6%, transparent); cursor: default;
}
.pe-frame[data-shadow="soft"] img, .pe-frame[data-shadow="soft"] iframe { box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.pe-frame[data-shadow="strong"] img, .pe-frame[data-shadow="strong"] iframe { box-shadow: 0 16px 44px rgba(0,0,0,.28); }
.pe-figure.is-selected > .pe-frame img, .pe-figure.is-selected > .pe-frame iframe,
.pe-figure.is-selected > .pe-gallery-grid { outline: 3px solid #2563eb; outline-offset: 3px; }
.pe-frame.is-broken img { min-height: 140px; }
.pe-frame.is-broken::after {
  content: "Picture not found"; position: absolute; inset: 0; display: grid; place-items: center;
  font: 600 13px/1.3 ui-sans-serif, system-ui, sans-serif; color: #b4191f;
}

.pe-handle {
  position: absolute; z-index: 3; width: 14px; height: 14px; display: none; touch-action: none;
  background: #fff; border: 2px solid #2563eb; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.pe-handle-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.pe-handle-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.pe-handle-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.pe-handle-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.pe-figure.is-selected .pe-handle, .pe-figure.is-resizing .pe-handle { display: block; }
.pe-size-badge {
  position: absolute; z-index: 3; top: 10px; left: 50%; transform: translateX(-50%); display: none;
  padding: 3px 9px; border-radius: 6px; background: rgba(17,17,17,.82); color: #fff;
  font: 600 12px/1.4 ui-sans-serif, system-ui, sans-serif;
}
.pe-figure.is-resizing .pe-size-badge { display: block; }
.pe-alt-pill {
  position: absolute; z-index: 2; left: 10px; bottom: 10px; opacity: 0; transition: opacity .12s;
  border: 0; border-radius: 999px; padding: 3px 9px; cursor: pointer;
  background: rgba(17,17,17,.7); color: #fff; font: 600 11px/1.4 ui-sans-serif, system-ui, sans-serif;
}
.pe-alt-pill.is-missing { background: #b45309; }
.pe-figure:hover .pe-alt-pill, .pe-figure.is-selected .pe-alt-pill { opacity: 1; }
.pe-link-badge {
  position: absolute; z-index: 2; right: 10px; top: 10px; width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(17,17,17,.7); color: #fff;
}
.pe-link-badge svg { width: 14px; height: 14px; }
.pe-link-badge[hidden] { display: none; }
.pe-uploading {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255,255,255,.65); color: #111; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif;
}
.pe-uploading[hidden] { display: none; }
.pe-uploading span {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(0,0,0,.2); border-top-color: #2563eb;
  animation: pe-spin .8s linear infinite;
}
@keyframes pe-spin { to { transform: rotate(360deg); } }

.pe-caption {
  margin-top: .6em; text-align: center; font-size: .85em; line-height: 1.45;
  color: color-mix(in srgb, var(--pe-text) 72%, transparent);
}

.pe-gallery-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px; border-radius: 4px; }
.pe-gallery-tile { position: relative; line-height: 0; }
.pe-gallery-tile img { width: 100%; height: auto; display: block; }
.pe-gallery-grid[data-aspect=""] { align-items: start; }
.pe-gallery-grid:not([data-aspect=""]) .pe-gallery-tile img { object-fit: cover; }
.pe-gallery-tools {
  position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; opacity: 0; transition: opacity .12s;
}
.pe-gallery-tile:hover .pe-gallery-tools { opacity: 1; }
.pe-gallery-tools button {
  width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px; cursor: pointer;
  background: rgba(17,17,17,.75); color: #fff;
}
.pe-gallery-tools svg { width: 14px; height: 14px; }
.pe-gallery-add {
  min-height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 2px dashed color-mix(in srgb, var(--pe-text) 25%, transparent); border-radius: 8px; background: transparent;
  color: color-mix(in srgb, var(--pe-text) 70%, transparent); cursor: pointer; font: 600 13px/1.3 ui-sans-serif, system-ui, sans-serif;
}
.pe-gallery-add:hover { border-color: #2563eb; color: #2563eb; }
.pe-gallery-add svg { width: 22px; height: 22px; }

.pe-embed-frame { aspect-ratio: 16 / 9; background: #111; border-radius: inherit; }
.pe-embed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: inherit; }
.pe-embed-cover { position: absolute; inset: 0; z-index: 1; cursor: default; }
.pe-embed-frame:has(.pe-embed-empty) { aspect-ratio: auto; background: color-mix(in srgb, var(--pe-text) 5%, var(--pe-bg)); border: 1px dashed color-mix(in srgb, var(--pe-text) 25%, transparent); border-radius: 10px; }
.pe-embed-empty { display: flex; align-items: center; gap: 8px; padding: 18px; line-height: 1.4; font: 14px/1.4 ui-sans-serif, system-ui, sans-serif; color: #111; }
.pe-embed-empty > span svg { width: 22px; height: 22px; opacity: .6; }
.pe-embed-empty .pe-field { flex: 1; }

/* ---------- block handle ---------- */
.pe-block-handle { position: absolute; z-index: 5; display: flex; gap: 1px; }
.pe-block-handle[hidden] { display: none; }
.pe-handle-btn {
  width: 26px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: color-mix(in srgb, var(--pe-text) 45%, transparent); cursor: pointer;
}
.pe-handle-btn:hover { background: color-mix(in srgb, var(--pe-text) 8%, transparent); color: var(--pe-text); }
.pe-handle-btn svg { width: 18px; height: 18px; }
.pe-grip { cursor: grab; }
.pe-grip:active { cursor: grabbing; }

/* ---------- floating bars ---------- */
.pe-bubble {
  position: fixed; z-index: 50; display: flex; align-items: center; gap: 1px; padding: 4px;
  background: #151515; color: #fff; border-radius: 9px; box-shadow: 0 10px 28px rgba(0,0,0,.25);
}
.pe-bubble[hidden] { display: none; }
.pe-bubble .pe-tb { color: #fff; height: 30px; min-width: 30px; }
.pe-bubble .pe-tb:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.pe-bubble .pe-tb.is-on { background: rgba(255,255,255,.22); color: #fff; }
.pe-bubble .pe-tb-sep { background: rgba(255,255,255,.2); height: 18px; }

.pe-objbar {
  position: fixed; z-index: 45; display: flex; align-items: center; gap: 1px; padding: 4px;
  max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none;
  background: var(--panel); color: var(--fg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06); font-size: 13px;
}
.pe-objbar[hidden] { display: none; }
.pe-objbar .pe-tb.is-on { background: color-mix(in srgb, var(--link) 14%, transparent); }
.pe-objbar-label { font-size: 12px; color: var(--fg-muted); padding: 0 4px 0 8px; white-space: nowrap; }

.pe-linkcard {
  z-index: 50; display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 13px;
  background: var(--panel); color: var(--fg); border: 1px solid var(--border); border-radius: 9px;
  box-shadow: 0 10px 28px rgba(0,0,0,.14);
}
.pe-linkcard[hidden] { display: none; }
.pe-linkcard-url {
  display: inline-flex; align-items: center; gap: 5px; max-width: 280px; color: var(--link);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 4px;
}
.pe-linkcard-url svg { width: 14px; height: 14px; flex: none; }

/* ---------- popovers, menus, forms ---------- */
.pe-pop {
  z-index: 60; max-height: min(72vh, 560px); overflow: auto; padding: 6px;
  background: var(--panel); color: var(--fg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0,0,0,.16), 0 2px 6px rgba(0,0,0,.06);
  font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.pe-menu { display: flex; flex-direction: column; min-width: 220px; }
.pe-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: 6px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.pe-menu-item:hover, .pe-menu-item:focus-visible { background: var(--panel-hover); outline: none; }
.pe-menu-item.is-active { font-weight: 600; }
.pe-menu-item.is-danger { color: var(--danger); }
.pe-menu-label { flex: 1; }
.pe-menu-hint { font-size: 12px; color: var(--fg-muted); }
.pe-check { width: 16px; height: 16px; color: var(--link); }
.pe-menu-sep { height: 1px; background: var(--border); margin: 5px 2px; }
.pe-menu-head { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-muted); }
.pe-custom { display: flex; align-items: center; gap: 6px; padding: 6px 8px; }
.pe-custom-label { font-size: 13px; }
.pe-size-input { width: 76px; }

.pe-colour { width: 272px; }
.pe-swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; padding: 3px 8px; }
.pe-swatch {
  aspect-ratio: 1; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(0,0,0,.14); transition: transform .08s;
}
.pe-swatch:hover { transform: scale(1.18); }
.pe-swatch.is-on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--link); }
.pe-colour-none {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.pe-colour-none:hover { background: var(--panel-hover); }
.pe-colour-none svg { width: 16px; height: 16px; }
.pe-native-colour { width: 34px; height: 34px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.pe-hex { width: 96px; flex: 1; }

.pe-form { display: flex; flex-direction: column; gap: 10px; padding: 8px; width: 330px; max-width: calc(100vw - 32px); }
.pe-form-label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.pe-form-label output { font-weight: 400; }
.pe-form-help { margin: 0; font-size: 12px; color: var(--fg-muted); }
.pe-form-row { display: flex; gap: 6px; justify-content: flex-end; }
.pe-field {
  width: 100%; padding: 7px 9px; font: inherit; font-size: 14px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: 7px;
}
.pe-field:focus { outline: 2px solid var(--ring); border-color: var(--link); }
.pe-field.is-invalid, .pe-hex.is-invalid { border-color: var(--danger); }
textarea.pe-field { resize: vertical; }
.pe-mini-btn {
  padding: 5px 11px; font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap;
  color: var(--fg); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 7px;
}
.pe-mini-btn:hover { background: var(--panel-hover); }
.pe-mini-btn.is-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pe-mini-btn.is-primary:hover { background: var(--accent-hover); }
.pe-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pe-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer;
  color: var(--fg); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 999px;
}
.pe-chip:hover { background: var(--panel-hover); }
.pe-chip.is-on { color: var(--link); border-color: var(--link); background: color-mix(in srgb, var(--link) 10%, transparent); }
.pe-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); }
.pe-range { width: 100%; accent-color: #2563eb; }

.pe-insert-wrap { width: 320px; display: flex; flex-direction: column; gap: 6px; }
.pe-insert, .pe-slash { display: flex; flex-direction: column; max-height: 380px; overflow: auto; }
.pe-slash {
  position: fixed; z-index: 60; width: 320px; padding: 6px;
  background: var(--panel); color: var(--fg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0,0,0,.16); font: 14px/1.4 ui-sans-serif, system-ui, sans-serif;
}
.pe-insert-item {
  display: flex; align-items: center; gap: 10px; padding: 5px 8px; border: 0; border-radius: 7px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.pe-insert-item.is-active { background: var(--panel-hover); }
.pe-insert-item .pe-i {
  width: 34px; height: 34px; padding: 7px; flex: none; border: 1px solid var(--border); border-radius: 7px; background: var(--bg);
}
.pe-insert-label { font-weight: 600; }
.pe-insert-hint { margin-left: auto; font-size: 12px; color: var(--fg-muted); white-space: nowrap; }
.pe-insert-empty { padding: 10px; color: var(--fg-muted); }

.pe-toast {
  position: fixed; z-index: 70; left: 50%; bottom: 24px; max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: 9px; background: #151515; color: #fff; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); pointer-events: none;
  opacity: 0; transform: translate(-50%, 16px); transition: opacity .18s, transform .18s;
}
.pe-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.pe-toast.is-error { background: #b4191f; }
