/* WPCanvex — Editor styles */

/* ── Fonts ─────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Noto Sans';
  src: url('./fonts/NotoSans-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Dancing Script';
  src: url('./fonts/DancingScript-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('./fonts/Roboto-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('./fonts/Montserrat-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('./fonts/PlayfairDisplay-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Carlito: metric-compatible with Calibri, so flow documents break lines the
   same in the editor, the PDF (which embeds the full TTFs) and Word (Calibri). */
@font-face {
  font-family: 'Carlito';
  src: url('./fonts/carlito-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Carlito';
  src: url('./fonts/carlito-latin-400-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Carlito';
  src: url('./fonts/carlito-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Carlito';
  src: url('./fonts/carlito-latin-700-italic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Carlito';
  src: url('./fonts/carlito-latin-ext-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Carlito';
  src: url('./fonts/carlito-latin-ext-400-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Carlito';
  src: url('./fonts/carlito-latin-ext-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Carlito';
  src: url('./fonts/carlito-latin-ext-700-italic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ── Button wrapper (AdSense clearance — 25px on all sides) ─────────────── */
.wpcanvex-btn-wrapper {
  margin: 25px 0;
  min-height: 56px; /* reserve space to prevent layout shift */
  display: flex;
  align-items: center;
}

/* Anything an author has connected to a template in the block editor. */
[data-wpcanvex-template] { cursor: pointer; }
/* Words linked from the editor need to look clickable; authors can restyle. */
.wpcanvex-template-link { text-decoration: underline dotted; text-underline-offset: 3px; }
.wpcanvex-template-link:hover { color: #2563eb; }
[data-wpcanvex-template]:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.wpcanvex-loading { opacity: .6; cursor: progress; }

.wpcanvex-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: #1a6bb5;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.wpcanvex-open-btn:hover,
.wpcanvex-open-btn:focus-visible {
  background: #155294;
  outline: 3px solid #155294;
  outline-offset: 2px;
}
.wpcanvex-open-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ── Inline button (inside figcaption, next to download link) ───────────── */
/* AdSense note: figcaption is not an ad-adjacent zone.
   The 25px clearance rule applies to standalone .wpcanvex-btn-wrapper only. */
.wpcanvex-inline-btn {
  margin-inline-start: 8px;
  padding: 4px 12px;
  font-size: 0.85em;
  vertical-align: middle;
}

/* ── Dialog ─────────────────────────────────────────────────────────────── */
dialog.wpcanvex-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: #f2f4f6;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
dialog.wpcanvex-dialog::backdrop {
  background: rgba(0,0,0,0.7);
}

.wpcanvex-dialog-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Feedback widget ("Help us improve") ──────────────────────────────────
   Appended as a direct child of dialog.wpcanvex-dialog (position: fixed,
   fills the viewport), so position: fixed here is relative to the viewport
   too — it sits above the editor's own content regardless of which engine
   (chromeless canvas, or the toolbar'd pdf-overlay/docx-fill) is active. */
.wpcanvex-feedback {
  position: fixed;
  /* Clear of the icon sidebar (--wpcanvex-sidebar-w) + the "Powered by"
     brand mark pinned near its bottom, and above the bottom status bar
     (--wpcanvex-bottom-h), so neither is covered. */
  left: calc(var(--wpcanvex-sidebar-w) + 20px);
  bottom: calc(var(--wpcanvex-bottom-h) + 20px);
  z-index: 100000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/*
 * !important throughout this widget: the active theme's own global button
 * styles (observed: a `button:not(:hover):not(:active):not(.has-background)`
 * rule setting a dark background via a WordPress global-styles CSS variable)
 * can out-specificity a plain class selector regardless of source order, even
 * though this widget is meant to live inside an isolated iframe document —
 * forcing these wins the cascade unconditionally instead of depending on
 * guessing every theme's selector specificity correctly.
 */
.wpcanvex-feedback-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a1a1a !important;
  color: #fff !important;
  padding: 12px 16px;
  border: none !important;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  cursor: pointer;
}
.wpcanvex-feedback-pill-star { width: 16px; height: 16px; fill: #f5a623; stroke: #f5a623; flex-shrink: 0; }
.wpcanvex-feedback-pill-text { font-size: 13.5px; font-weight: 600; white-space: nowrap; color: #fff !important; }

.wpcanvex-feedback-card {
  width: 320px;
  background: #fff !important;
  border-radius: 14px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.22);
  border: 1px solid #ececee !important;
  overflow: hidden;
}
.wpcanvex-feedback-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 0;
}
.wpcanvex-feedback-card-eyebrow {
  font-size: 11.5px; font-weight: 700; color: #9a9ca1 !important;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.wpcanvex-feedback-card-close {
  width: 22px; height: 22px; border: none !important; background: transparent !important;
  color: #9a9ca1 !important; cursor: pointer; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; padding: 0; flex-shrink: 0;
}
.wpcanvex-feedback-card-close:hover { background: #f4f4f5 !important; color: #555 !important; }

/* Step: rate */
.wpcanvex-feedback-step-rate { padding: 6px 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.wpcanvex-feedback-question { font-size: 15.5px; font-weight: 700; color: #1a1a1a !important; line-height: 1.35; }
.wpcanvex-feedback-subtext { font-size: 12.5px; color: #8a8a90 !important; margin-top: 5px; line-height: 1.5; }
.wpcanvex-feedback-stars { display: flex; gap: 6px; }
.wpcanvex-feedback-star-btn { border: none !important; background: transparent !important; cursor: pointer; padding: 2px; color: #f5a623 !important; }
.wpcanvex-feedback-star-btn svg { width: 30px; height: 30px; }
.wpcanvex-feedback-scale-labels { font-size: 12px; color: #b5b7bb !important; display: flex; justify-content: space-between; padding: 0 2px; }

/* Step: detail */
.wpcanvex-feedback-step-detail { padding: 6px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.wpcanvex-feedback-summary-stars { display: flex; gap: 4px; color: #f5a623 !important; }
.wpcanvex-feedback-summary-stars svg { width: 15px; height: 15px; }
.wpcanvex-feedback-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.wpcanvex-feedback-chip {
  border: 1px solid #e2e2e4 !important; background: #fff !important; color: #4a4a4a !important;
  font-size: 12.5px; font-weight: 500; padding: 7px 12px;
  border-radius: 999px; cursor: pointer; font-family: inherit;
}
.wpcanvex-feedback-chip.selected { border-color: #140af5 !important; background: #eef0ff !important; color: #140af5 !important; }
.wpcanvex-feedback-note {
  resize: none; border: 1px solid #e2e2e4 !important; border-radius: 8px;
  padding: 9px 10px; font-size: 13px; font-family: inherit;
  background: #fff !important; color: #1a1a1a !important; height: 60px; outline: none; width: 100%; box-sizing: border-box;
}
.wpcanvex-feedback-note:focus { border-color: #140af5 !important; }
.wpcanvex-feedback-submit {
  background: #140af5 !important; color: #fff !important; border: none !important;
  padding: 10px 0;
  border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer; width: 100%;
  font-family: inherit;
}
.wpcanvex-feedback-submit:hover { background: #0d06c7 !important; }
.wpcanvex-feedback-submit:disabled { opacity: 0.6; cursor: default; }

/* Step: thanks */
.wpcanvex-feedback-step-thanks {
  padding: 10px 18px 26px; display: flex; flex-direction: column;
  align-items: center; text-align: center; gap: 10px;
}
.wpcanvex-feedback-check-circle {
  width: 40px; height: 40px; border-radius: 50%; background: #eafaf1;
  display: flex; align-items: center; justify-content: center;
}
.wpcanvex-feedback-thanks-title { font-size: 14.5px; font-weight: 700; color: #1a1a1a; }
.wpcanvex-feedback-thanks-body { font-size: 12.5px; color: #8a8a90; line-height: 1.5; }

@media (max-width: 480px) {
  .wpcanvex-feedback { left: 12px; bottom: 12px; right: 12px; }
  .wpcanvex-feedback-card { width: 100%; }
}

.wpcanvex-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1a1f2e;
  color: #fff;
  flex-shrink: 0;
}

.wpcanvex-dialog-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wpcanvex-dialog-title {
  font-size: 15px;
  font-weight: 600;
  font-family: 'Noto Sans', sans-serif;
}

.wpcanvex-dialog-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.wpcanvex-dialog-close:hover,
.wpcanvex-dialog-close:focus-visible {
  background: rgba(255,255,255,0.15);
  outline: 2px solid #fff;
}

.wpcanvex-dialog-content {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

.wpcanvex-privacy-note {
  text-align: center;
  font-size: 11px;
  color: #666;
  padding: 6px;
  margin: 0;
  flex-shrink: 0;
  background: #f2f4f6;
}

/* ── Dialog loading spinner ──────────────────────────────────────────────── */
.wpcanvex-dialog-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1f2e;
  z-index: 10;
}
.wpcanvex-dialog-spinner::after {
  content: '';
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: wpcanvex-spin 0.75s linear infinite;
}
@keyframes wpcanvex-spin {
  to { transform: rotate(360deg); }
}

/* ── Engine root ─────────────────────────────────────────────────────────── */
.wpcanvex-engine-root {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.wpcanvex-toolbar-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #dde1e7;
  flex-shrink: 0;
}

.wpcanvex-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.wpcanvex-tool-btn {
  padding: 6px 10px;
  font-size: 16px;
  line-height: 1;
  background: #f0f1f3;
  border: 1px solid #cdd0d5;
  border-radius: 4px;
  cursor: pointer;
  color: #1a1f2e;
  font-family: inherit;
  transition: background 0.1s;
}
.wpcanvex-tool-btn:hover,
.wpcanvex-tool-btn:focus-visible {
  background: #dde1e7;
  outline: 2px solid #1a6bb5;
  outline-offset: 1px;
}

.wpcanvex-toolbar-sep {
  width: 1px;
  height: 28px;
  background: #cdd0d5;
  margin: 0 4px;
  align-self: center;
}

.wpcanvex-page-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wpcanvex-page-indicator {
  font-size: 13px;
  color: #444;
  min-width: 80px;
  text-align: center;
}

.wpcanvex-export-btn {
  align-self: flex-start;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #1a6bb5;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.wpcanvex-export-btn:hover,
.wpcanvex-export-btn:focus-visible {
  background: #155294;
  outline: 3px solid #155294;
  outline-offset: 2px;
}
.wpcanvex-export-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ── Viewport + pages ────────────────────────────────────────────────────── */
.wpcanvex-viewport {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  background: #e5e7eb;
}

.wpcanvex-page-wrapper {
  position: relative;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  background: #fff;
  flex-shrink: 0;
}

.wpcanvex-bg-canvas,
.wpcanvex-fabric-canvas {
  position: absolute;
  top: 0;
  left: 0;
}

.wpcanvex-bg-canvas {
  z-index: 1;
  pointer-events: none;
}

.wpcanvex-fabric-canvas {
  z-index: 2;
}

/* ── Error ───────────────────────────────────────────────────────────────── */
.wpcanvex-error {
  padding: 24px;
  color: #b91c1c;
  font-family: 'Noto Sans', sans-serif;
  font-size: 14px;
}

/* ── Form panel ──────────────────────────────────────────────────────────── */
.wpcanvex-form-panel {
  background: #fff;
  border-bottom: 1px solid #dde1e7;
  padding: 10px 14px;
  font-size: 13px;
  font-family: 'Noto Sans', sans-serif;
}
.wpcanvex-form-panel summary {
  cursor: pointer;
  font-weight: 600;
  color: #1a1f2e;
  padding: 4px 0;
}
.wpcanvex-form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.wpcanvex-form-label {
  min-width: 140px;
  font-size: 12px;
  color: #444;
}
.wpcanvex-form-input,
.wpcanvex-form-select {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #cdd0d5;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}

/* ── Signature panel ─────────────────────────────────────────────────────── */
.wpcanvex-sig-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.wpcanvex-sig-panel {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  width: min(500px, 100%);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.wpcanvex-sig-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 2px solid #e5e7eb;
}
.wpcanvex-sig-tab {
  padding: 6px 16px;
  font-size: 14px;
  border: none;
  background: none;
  cursor: pointer;
  color: #555;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.wpcanvex-sig-tab.active {
  color: #1a6bb5;
  border-bottom-color: #1a6bb5;
  font-weight: 600;
}

.wpcanvex-sig-draw-canvas {
  display: block;
  width: 100%;
  border: 1.5px solid #cdd0d5;
  border-radius: 6px;
  cursor: crosshair;
  background: #fafafa;
  touch-action: none;
}

.wpcanvex-sig-clear {
  margin-top: 6px;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  background: none;
  border: 1px solid #cdd0d5;
  border-radius: 4px;
  color: #555;
}

.wpcanvex-sig-type-input {
  width: 100%;
  font-family: 'Dancing Script', cursive;
  font-size: 32px;
  padding: 8px 12px;
  border: 1.5px solid #cdd0d5;
  border-radius: 6px;
  box-sizing: border-box;
}
.wpcanvex-sig-font-note {
  font-size: 11px;
  color: #888;
  margin: 4px 0 0;
}

.wpcanvex-sig-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.wpcanvex-sig-cancel {
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  background: none;
  border: 1px solid #cdd0d5;
  border-radius: 6px;
  font-family: inherit;
  color: #444;
}
.wpcanvex-sig-confirm {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #1a6bb5;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
}

.wpcanvex-hidden {
  display: none !important;
}

/* ── Mobile — 360px+ ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .wpcanvex-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .wpcanvex-tool-btn {
    flex-shrink: 0;
    padding: 8px;
    font-size: 18px;
  }
  .wpcanvex-export-btn {
    width: 100%;
    text-align: center;
  }
  dialog.wpcanvex-dialog {
    /* Ensure it doesn't cover the browser chrome in a broken way */
    height: 100dvh;
  }
  .wpcanvex-viewport {
    padding: 8px;
  }
  .wpcanvex-sig-panel {
    padding: 14px;
  }
  .wpcanvex-sig-type-input {
    font-size: 24px;
  }
}

/* ── DocxFill engine ─────────────────────────────────────────────────────── */
.wpcanvex-docx-root {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.wpcanvex-docx-toolbar {
  border-bottom: 1px solid #dde1e7;
}

.wpcanvex-docx-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.wpcanvex-docx-form-pane {
  width: 260px;
  min-width: 200px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px;
  background: #fff;
  border-right: 1px solid #dde1e7;
}

.wpcanvex-docx-form-heading {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 12px;
  color: #1a1f2e;
  font-family: 'Noto Sans', sans-serif;
}

.wpcanvex-docx-field-row {
  margin-bottom: 12px;
}

.wpcanvex-docx-label {
  display: block;
  font-size: 12px;
  color: #555;
  margin-bottom: 3px;
  font-family: 'Noto Sans', sans-serif;
}

.wpcanvex-docx-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #cdd0d5;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}
.wpcanvex-docx-input:focus {
  outline: 2px solid #1a6bb5;
  outline-offset: 1px;
}

.wpcanvex-docx-no-tags {
  font-size: 12px;
  color: #666;
  line-height: 1.5;
}
.wpcanvex-docx-no-tags code {
  background: #f0f1f3;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

.wpcanvex-docx-preview-pane {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: #e5e7eb;
}

/* docx-preview default class override — constrain width */
.wpcanvex-docx-rendered {
  max-width: 860px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

/* ── Button group (multiple engines on same post) ────────────────────────── */
.wpcanvex-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 25px 0;
  min-height: 56px;
  align-items: center;
}

/* When multiple buttons appear, each btn-wrapper has no outer margin
   (the group handles it). Override the wrapper margin inside a group. */
.wpcanvex-btn-group .wpcanvex-btn-wrapper {
  margin: 0;
  min-height: 0;
}

/* ── Mobile docx adjustments ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .wpcanvex-docx-layout {
    flex-direction: column;
  }
  .wpcanvex-docx-form-pane {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #dde1e7;
    max-height: 220px;
  }
}

/* ── Admin canvas builder — Canva-style light theme ─────────────────────────
   .wpcanvex-shell  →  top bar + body row (sidebar | panel | centre | props)
   centre = workspace + page strip + bottom bar
   All styles scoped to .wpcanvex-shell so they don't leak into wp-admin.        */

:root {
  --wpcanvex-bg:        #f0f0f0;   /* workspace background — medium grey */
  --wpcanvex-bar:       #ffffff;   /* top bar / bottom bar / sidebars */
  --wpcanvex-border:    #e0e0e0;
  --wpcanvex-surface:   #f5f5f5;   /* panel items, inputs */
  --wpcanvex-text:      #1a1a1a;
  --wpcanvex-muted:     #777777;
  --wpcanvex-accent:    #2563eb;   /* Blue accent */
  --wpcanvex-accent-h:  #1d4ed8;
  --wpcanvex-panel-w:   340px;
  --wpcanvex-sidebar-w: 80px;
  --wpcanvex-strip-h:   108px;
  --wpcanvex-bottom-h:  38px;
}

/* ── Shell ───────────────────────────────────────────────────────────────── */
.wpcanvex-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  min-height: 600px;
  background: var(--wpcanvex-bg);
  border-radius: 8px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  color: var(--wpcanvex-text);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.wpcanvex-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  height: 60px;
  min-height: 60px;
  background: var(--wpcanvex-theme-bg, #180dff);
  border-bottom: 1px solid var(--wpcanvex-theme-bar-border, transparent);
  flex-shrink: 0;
  color: var(--wpcanvex-theme-on-bar, #e0e0e0);
  position: relative;
}

/* Centre cluster: fullscreen / undo / redo / sep / hand — pinned to the
   exact middle of the topbar regardless of left/right content width. */
.wpcanvex-topbar-center {
  display: flex; align-items: center; gap: 4px;
  padding: 0 14px;
  height: 100%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
}

/* Visitor-mode left: back arrow + truncated template title */
.wpcanvex-topbar-left {
  display: flex; align-items: center; gap: 6px;
  padding: 0 8px 0 4px;
  height: 100%;
  flex-shrink: 0;
  min-width: 0;
}
.wpcanvex-visitor-back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--wpcanvex-theme-on-bar, rgba(255,255,255,0.75));
  opacity: 0.75;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.wpcanvex-visitor-back:hover { background: rgba(128,128,128,0.12); opacity: 1; }
.wpcanvex-visitor-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--wpcanvex-theme-on-bar, #fff);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* Close button — more prominent than a plain icon-btn */
.wpcanvex-close-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: rgba(128,128,128,0.1);
  border: 1px solid rgba(128,128,128,0.18);
  border-radius: 6px;
  color: var(--wpcanvex-theme-on-bar, #fff);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.wpcanvex-close-btn:hover { background: rgba(128,128,128,0.18); border-color: rgba(128,128,128,0.32); }

/* Right cluster: toggle pill + Save draft (+ Settings/Publish on the
   standalone editor page, where the chrome controls are folded in). */
.wpcanvex-topbar-right {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  margin-left: auto;
  flex-shrink: 0;
}

.wpcanvex-topbar-sep {
  width: 1px; height: 22px;
  background: var(--wpcanvex-theme-bar-border, rgba(255,255,255,0.15));
  margin: 0 4px;
}

/* Shared button base */
.wpcanvex-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--wpcanvex-text);
  cursor: pointer;
  font-size: 15px;
  transition: background 0.1s, border-color 0.1s;
}
.wpcanvex-icon-btn:hover { background: var(--wpcanvex-surface); border-color: var(--wpcanvex-border); }
.wpcanvex-icon-btn.active {
  background: var(--wpcanvex-accent);
  border-color: var(--wpcanvex-accent);
  color: #fff;
}

/* Topbar overrides for icon buttons — theme-aware */
.wpcanvex-topbar .wpcanvex-icon-btn { color: var(--wpcanvex-theme-on-bar, #fff); opacity: 0.75; }
.wpcanvex-topbar .wpcanvex-icon-btn:hover { background: var(--wpcanvex-theme-topbar-hover, rgba(255,255,255,0.12)); border-color: transparent; opacity: 1; }
.wpcanvex-topbar .wpcanvex-icon-btn.active { background: var(--wpcanvex-theme-topbar-hover, rgba(255,255,255,0.2)); border-color: transparent; opacity: 1; }

.wpcanvex-text-btn {
  display: inline-flex; align-items: center;
  padding: 5px 11px;
  background: var(--wpcanvex-surface);
  border: 1px solid var(--wpcanvex-border);
  border-radius: 6px;
  color: var(--wpcanvex-text);
  font-size: 12px; font-family: inherit;
  cursor: pointer; white-space: nowrap;
}
.wpcanvex-text-btn:hover { background: var(--wpcanvex-border); }

.wpcanvex-btn-primary {
  display: inline-flex; align-items: center;
  padding: 8px 20px;
  background: var(--wpcanvex-accent);
  border: none; border-radius: 8px;
  color: #fff; font-size: 13px; font-family: inherit; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background 0.1s;
  letter-spacing: 0.01em;
}
.wpcanvex-btn-primary:hover { background: var(--wpcanvex-accent-h); }
/* Inside the topbar: button background/color driven by theme vars.
   Dark themes: white bg + theme-solid label.
   Light theme: dark bg (#18181b) + white label. */
.wpcanvex-topbar .wpcanvex-btn-primary { background: var(--wpcanvex-theme-topbar-btn-bg, #ffffff); color: var(--wpcanvex-theme-topbar-btn-color, var(--wpcanvex-theme-solid, #180dff)); }
.wpcanvex-topbar .wpcanvex-btn-primary:hover { background: var(--wpcanvex-theme-topbar-btn-hover, #eceaff); }

/* ── Body row ────────────────────────────────────────────────────────────── */
.wpcanvex-body {
  display: flex;
  flex: 1;
  min-height: 0; /* see .wpcanvex-workspace — flex's auto minimum must be cleared
                    at every level of the chain, not just the innermost. */
  overflow: hidden;
}

/* ── Left sidebar (icon strip) ───────────────────────────────────────────── */
.wpcanvex-sidebar {
  width: var(--wpcanvex-sidebar-w);
  background: #ffffff;
  border-right: 1px solid var(--wpcanvex-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 80px;
  gap: 8px;
  flex-shrink: 0;
  overflow-y: auto;
  position: relative;
}

.wpcanvex-sidebar-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  width: 72px; min-height: 64px;
  padding: 8px 4px;
  background: transparent;
  border: none; border-radius: 8px;
  color: #5c5f66;
  cursor: pointer;
  font-size: 12px; font-family: inherit;
  transition: background 0.12s, color 0.12s;
  text-align: center;
  letter-spacing: 0.01em;
}
.wpcanvex-sidebar-btn:hover { background: #f4f4f5; color: var(--wpcanvex-text); }
.wpcanvex-sidebar-btn.active { background: #eef0ff; color: var(--wpcanvex-accent); font-weight: 600; }
.wpcanvex-sidebar-btn svg { flex-shrink: 0; width: 22px; height: 22px; }

.wpcanvex-sidebar-brand {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  user-select: none;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s;
}
.wpcanvex-sidebar-brand:hover { filter: brightness(1.15); }
.wpcanvex-sidebar-brand-icon {
  width: 28px;
  height: 28px;
  background: #000;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wpcanvex-sidebar-brand-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.wpcanvex-sidebar-brand-powered {
  font-size: 7.5px;
  font-weight: 600;
  color: #888c91;
  letter-spacing: 0.02em;
  font-family: inherit;
  line-height: 1.2;
}
.wpcanvex-sidebar-brand-name {
  font-size: 8.5px;
  font-weight: 700;
  color: #6e7075;
  letter-spacing: 0.02em;
  font-family: inherit;
  line-height: 1.2;
  margin-top: -3px;
}

/* ── Left sliding panel ──────────────────────────────────────────────────── */
.wpcanvex-panel {
  width: var(--wpcanvex-panel-w);
  background: var(--wpcanvex-bar);
  border-right: 1px solid var(--wpcanvex-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
/* An author `display` beats the UA rule for [hidden], so the attribute alone
   would not hide the panel. */
.wpcanvex-panel[hidden] { display: none; }

.wpcanvex-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--wpcanvex-border);
  flex-shrink: 0;
}
.wpcanvex-panel-title { font-weight: 600; font-size: 14px; color: var(--wpcanvex-text); }

.wpcanvex-panel-body {
  flex: 1; overflow-y: auto; padding: 12px;
}

.wpcanvex-panel-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--wpcanvex-muted);
  margin: 4px 0 10px;
}
.wpcanvex-panel-hint {
  font-size: 11px; color: var(--wpcanvex-muted); line-height: 1.6; margin: 0;
}

/* Elements grid */
.wpcanvex-elements-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.wpcanvex-el-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 6px;
  background: var(--wpcanvex-surface); border: 1px solid var(--wpcanvex-border);
  border-radius: 8px; cursor: pointer; color: var(--wpcanvex-text);
  font-size: 10px; font-family: inherit;
  transition: background 0.1s, border-color 0.1s;
}
.wpcanvex-el-btn:hover { background: #dbeafe; border-color: var(--wpcanvex-accent); }
.wpcanvex-el-btn svg { width: 30px; height: 30px; color: #57606a; transition: color 0.1s; }
.wpcanvex-el-btn:hover svg { color: var(--wpcanvex-accent); }

/* Text presets */
.wpcanvex-text-preset {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 12px 8px; margin-bottom: 8px;
  background: var(--wpcanvex-surface); border: 1px solid var(--wpcanvex-border);
  border-radius: 8px; cursor: pointer; color: var(--wpcanvex-text);
  font-family: inherit; text-align: center;
  transition: background 0.1s, border-color 0.1s;
}
.wpcanvex-text-preset:hover { background: #dbeafe; border-color: var(--wpcanvex-accent); }

/* Image upload */
.wpcanvex-upload-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; padding: 24px 10px;
  background: var(--wpcanvex-surface); border: 2px dashed var(--wpcanvex-border);
  border-radius: 10px; cursor: pointer; color: var(--wpcanvex-muted);
  font-family: inherit; font-size: 12px; text-align: center;
  transition: border-color 0.1s, background 0.1s;
}
.wpcanvex-upload-btn:hover { border-color: var(--wpcanvex-accent); background: #dbeafe; color: var(--wpcanvex-accent); }
.wpcanvex-upload-btn small { font-size: 10px; }

/* Sits above the image grid in the Library tab, so it has to stay out of the
   way: a single row rather than the tall drop zone it was on its own tab. */
.wpcanvex-upload-btn--compact {
  flex-direction: row; justify-content: center;
  padding: 11px 10px; font-size: 12px; font-weight: 500;
}

/* Background panel: solid-color and gradient swatches, same grid/tile look
   so the two sections read as one picker rather than two different widgets. */
.wpcanvex-bg-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
}
.wpcanvex-bg-swatch {
  width: 100%; aspect-ratio: 1; padding: 0;
  border-radius: 10px; border: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.wpcanvex-bg-swatch:hover { transform: translateY(-2px) scale(1.04); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.14); }
.wpcanvex-bg-swatch:active { transform: translateY(0) scale(0.97); }
.wpcanvex-bg-swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wpcanvex-accent); }

/* Panel sub-tabs (Images panel: Upload / Media / Stock) */
.wpcanvex-tabs {
  display: flex; gap: 2px;
  margin-bottom: 14px;
  background: var(--wpcanvex-surface);
  border-radius: 7px; padding: 3px;
}
.wpcanvex-tab {
  flex: 1; padding: 6px 0;
  border: none; border-radius: 5px;
  background: transparent; color: var(--wpcanvex-muted);
  font-size: 12px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background 0.1s, color 0.1s;
}
.wpcanvex-tab:hover { color: var(--wpcanvex-text); }
.wpcanvex-tab.active { background: #fff; color: var(--wpcanvex-text); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* Plugin images grid (Images panel) */
.wpcanvex-image-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 10px;
}
.wpcanvex-image-tile {
  position: relative;
  aspect-ratio: 1; padding: 0; overflow: hidden;
  border-radius: 8px; border: 1px solid var(--wpcanvex-border);
  background: #fff; cursor: grab;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.wpcanvex-image-tile:hover { border-color: var(--wpcanvex-accent); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.wpcanvex-image-tile:active { cursor: grabbing; }
/* Stock photos: masonry, not a cropped grid. Pixabay results come in all
   shapes (portrait, landscape, square); forcing every tile into a uniform
   square via object-fit:cover was cropping a lot of each photo away. A
   multi-column flow instead keeps each tile at the photo's real aspect
   ratio (set inline per tile — see searchStockPhotos) and packs them in
   like Pinterest/Canva's own stock picker, so nothing is cropped. These
   come after the base .wpcanvex-image-tile rule above so aspect-ratio:auto
   wins the cascade (same specificity — source order decides). */
.wpcanvex-image-grid--stock {
  display: block; column-count: 2; column-gap: 10px;
}
.wpcanvex-image-tile--stock {
  display: block; width: 100%; aspect-ratio: auto;
  break-inside: avoid; margin-bottom: 10px;
}
.wpcanvex-image-tile--stock img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Shown on a tile from click to the image actually landing on the canvas —
   a full-size stock photo can take a couple of seconds over a slow connection,
   with nothing else on screen to show it's working. */
.wpcanvex-image-tile--loading { cursor: wait; pointer-events: none; }
.wpcanvex-image-tile--loading img { opacity: 0.35; }
.wpcanvex-image-tile--loading::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 22px; height: 22px;
  border: 3px solid rgba(0,0,0,0.12); border-top-color: var(--wpcanvex-accent);
  border-radius: 50%;
  animation: wpcanvex-tile-spin 0.7s linear infinite;
}
@keyframes wpcanvex-tile-spin { to { transform: rotate(360deg); } }

/* Icon search (Elements panel) */
.wpcanvex-icon-search {
  width: 100%; height: 34px; padding: 0 10px;
  border: 1px solid var(--wpcanvex-border); border-radius: 6px;
  background: #fff; color: var(--wpcanvex-text);
  font-size: 13px; font-family: inherit; box-sizing: border-box;
}
.wpcanvex-icon-search:focus { outline: none; border-color: var(--wpcanvex-accent); }
/* Icons sit on their own tile (not a full-bleed photo) — pad them in and
   centre, rather than the cover-fit used for Media/Stock photo thumbnails. */
#wpcanvex-icon-results .wpcanvex-image-tile { display: flex; align-items: center; justify-content: center; padding: 8px; cursor: pointer; }
#wpcanvex-icon-results .wpcanvex-image-tile img { width: auto; height: 100%; object-fit: contain; }

/* Quick-pick category chips (Stock tab) */
.wpcanvex-chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.wpcanvex-chip {
  padding: 6px 13px;
  border: none; border-radius: 999px;
  background: var(--wpcanvex-surface); color: var(--wpcanvex-muted);
  font-size: 11.5px; font-weight: 600; font-family: inherit; letter-spacing: 0.1px;
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.wpcanvex-chip:hover { background: #e7edff; color: var(--wpcanvex-accent); }
.wpcanvex-chip:active { transform: scale(0.96); }
.wpcanvex-chip.active { background: var(--wpcanvex-accent); color: #fff; }
.wpcanvex-image-tile img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

/* Layers list */
.wpcanvex-layers-list { display: flex; flex-direction: column; gap: 2px; }
.wpcanvex-layer-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px;
  border-radius: 6px; cursor: pointer;
  transition: background 0.1s;
}
.wpcanvex-layer-row:hover { background: var(--wpcanvex-surface); }
.wpcanvex-layer-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
.wpcanvex-layer-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--wpcanvex-text); }

/* ── Centre column ───────────────────────────────────────────────────────── */
.wpcanvex-centre {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

/* ── Canvas workspace ────────────────────────────────────────────────────── */
.wpcanvex-workspace {
  flex: 1;
  /* min-height/width:0 — without these, flex's implicit `auto` minimum lets the
     Fabric canvas inflate this box, so clientWidth/Height report the canvas size
     rather than the space available, and the fit calculation collapses. */
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
  background: var(--wpcanvex-bg);
}
/* Fabric injects .canvas-container and sets explicit px width/height on the
   canvas elements. Pin it so it can never drive the parent's size. */
.wpcanvex-workspace .canvas-container {
  position: absolute;
  top: 0;
  left: 0;
}
/* Empty probe that always fills the workspace. Measured in place of the
   workspace itself, which contains the canvas and is therefore circular. */
.wpcanvex-builder-viewport-probe {
  position: absolute;
  inset: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ── Page thumbnail strip ────────────────────────────────────────────────── */
.wpcanvex-page-strip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 10px 20px;
  height: var(--wpcanvex-strip-h);
  position: relative;
  z-index: 10;
  background: var(--wpcanvex-bar);
  border-top: 1px solid var(--wpcanvex-border);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
}
.wpcanvex-page-strip:focus { outline: none; }
.wpcanvex-page-strip {
  transition: height 0.45s cubic-bezier(0.4, 0, 0.2, 1), padding 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}
.wpcanvex-page-strip.wpcanvex-page-strip--closing {
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
  border-top-width: 0;
}
.wpcanvex-page-strip::-webkit-scrollbar { height: 4px; }
.wpcanvex-page-strip::-webkit-scrollbar-thumb { background: var(--wpcanvex-border); border-radius: 2px; }

.wpcanvex-thumb {
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

/* Fixed landscape card; the page preview is letterboxed inside it. */
.wpcanvex-thumb-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1.5px solid #e2e2e4;
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wpcanvex-thumb:hover .wpcanvex-thumb-tile { border-color: #b0b0b8; }
.wpcanvex-thumb.active .wpcanvex-thumb-tile {
  border-color: var(--wpcanvex-accent);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.18);
}

.wpcanvex-thumb-canvas {
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.wpcanvex-thumb-canvas canvas { display: block; }

/* Page number sits inside the card, bottom-left. */
.wpcanvex-thumb-num {
  position: absolute;
  left: 7px; bottom: 5px;
  font-size: 12px; line-height: 1;
  color: #6a6a70;
}
.wpcanvex-thumb.active .wpcanvex-thumb-num { color: #1a1a1a; font-weight: 700; }

/* Three-dot menu button */
.wpcanvex-thumb-menu-btn {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px; padding: 0;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2.5px;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s;
  z-index: 2;
}
.wpcanvex-thumb-menu-btn span {
  display: block;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #444;
  pointer-events: none;
}
.wpcanvex-thumb:hover .wpcanvex-thumb-menu-btn { opacity: 1; }
.wpcanvex-thumb-menu-btn:hover { background: #fff; border-color: rgba(0,0,0,0.22); }

/* Dropdown menu — fixed so it escapes the overflow:auto strip container */
.wpcanvex-thumb-menu {
  position: fixed;
  min-width: 152px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.13);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  padding: 4px;
  z-index: 100001;
  display: none;
  flex-direction: column;
  gap: 1px;
}
.wpcanvex-thumb-menu.open { display: flex; }

.wpcanvex-thumb-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 10px;
  background: none; border: none; border-radius: 5px;
  font-size: 12px; color: #222; cursor: pointer;
  text-align: left; white-space: nowrap;
  transition: background 0.1s;
}
.wpcanvex-thumb-menu-item:hover { background: #f3f4f6; }
.wpcanvex-thumb-menu-item.wpcanvex-thumb-del { color: #dc2626; }
.wpcanvex-thumb-menu-item.wpcanvex-thumb-del:hover { background: #fef2f2; }
.wpcanvex-thumb-menu-item svg { flex-shrink: 0; opacity: 0.7; }

.wpcanvex-thumb-menu-sep {
  height: 1px; background: #e5e7eb; margin: 3px 4px;
}

.wpcanvex-add-page-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border: 1.5px solid #e2e2e4;
  border-radius: 8px;
  overflow: hidden;
  background: #f4f4f5;
  height: 84px;
}
.wpcanvex-add-page-btn {
  display: flex; align-items: center; justify-content: center;
  width: 84px; height: 100%;
  background: transparent; border: none;
  color: #6a6a70; cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.wpcanvex-add-page-btn:hover { background: #dbeafe; color: var(--wpcanvex-accent); }

/* ── Bottom bar ──────────────────────────────────────────────────────────── */
.wpcanvex-bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--wpcanvex-bottom-h);
  padding: 0 14px;
  background: var(--wpcanvex-bar);
  border-top: 1px solid var(--wpcanvex-border);
  flex-shrink: 0;
}

/* Pages toggle + separator inside bottom bar zoom controls */
.wpcanvex-bb-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--wpcanvex-muted);
  font-size: 12px; font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.wpcanvex-bb-btn:hover { background: var(--wpcanvex-surface); color: var(--wpcanvex-text); border-color: var(--wpcanvex-border); }
.wpcanvex-bb-btn.active { background: #dbeafe; color: var(--wpcanvex-accent); border-color: #c4b5fd; }

.wpcanvex-bb-sep {
  width: 1px; height: 18px;
  background: var(--wpcanvex-border);
  margin: 0 6px;
  flex-shrink: 0;
}

.wpcanvex-status {
  font-size: 11px; color: var(--wpcanvex-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Right-hand cluster of the bottom bar (zoom slider + Pages toggle). */
.wpcanvex-zoom-controls {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

/* Zoom slider — styled on both WebKit and Firefox tracks. */
.wpcanvex-zoom-slider {
  -webkit-appearance: none; appearance: none;
  width: 120px; height: 4px;
  background: #d8d8dc;
  border-radius: 2px;
  outline: none; cursor: pointer;
  flex-shrink: 0;
}
.wpcanvex-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px;
  background: #fff;
  border: 1px solid #c2c2c8;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  cursor: pointer;
}
.wpcanvex-zoom-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  background: #fff;
  border: 1px solid #c2c2c8;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  cursor: pointer;
}
.wpcanvex-zoom-slider::-moz-range-track {
  height: 4px; background: #d8d8dc; border-radius: 2px;
}

.wpcanvex-zoom-val {
  font-size: 12px; color: var(--wpcanvex-text);
  min-width: 38px; text-align: right;
  font-variant-numeric: tabular-nums;
}

.wpcanvex-zoom-step {
  padding: 0; width: 22px; height: 22px;
  justify-content: center;
  font-size: 14px; font-weight: 600; line-height: 1;
}

.wpcanvex-page-count {
  font-size: 12px; color: var(--wpcanvex-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Visitor-editable toggle pill (top bar) ──────────────────────────────── */
.wpcanvex-toggle-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  background: var(--wpcanvex-theme-ctrl-bg, rgba(128,128,128,0.08));
  border: 1px solid var(--wpcanvex-theme-ctrl-border, rgba(255,255,255,0.12));
  border-radius: 20px;
  color: var(--wpcanvex-theme-on-bar, #f3e8fb);
  font-size: 12px; font-family: inherit;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.wpcanvex-toggle-pill svg { stroke: var(--wpcanvex-theme-on-bar, #f4c9ff); opacity: 0.7; }
.wpcanvex-toggle-pill:hover { background: rgba(128,128,128,0.13); }
.wpcanvex-toggle-pill:has(input:checked) { border-color: var(--wpcanvex-theme-topbar-btn-bg, rgba(255,255,255,0.3)); background: rgba(128,128,128,0.14); }
.wpcanvex-toggle-pill:has(input:disabled) { opacity: 0.4; cursor: default; pointer-events: none; }
.wpcanvex-toggle-pill input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }

.wpcanvex-toggle-track {
  position: relative;
  display: inline-block;
  width: 32px; height: 18px;
  background: rgba(128,128,128,0.3);
  border-radius: 9px;
  flex-shrink: 0;
  transition: background 0.2s;
}
.wpcanvex-toggle-pill:has(input:checked) .wpcanvex-toggle-track { background: var(--wpcanvex-theme-topbar-btn-bg, #ffffff); }
.wpcanvex-toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--wpcanvex-theme-on-bar, #ffffff);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.wpcanvex-toggle-pill:has(input:checked) .wpcanvex-toggle-thumb { background: var(--wpcanvex-theme-topbar-btn-color, #ffffff); }
.wpcanvex-toggle-pill:has(input:checked) .wpcanvex-toggle-thumb { transform: translateX(14px); }

/* ── Pinned properties bar (top of centre column) ────────────────────────── */
/* Overlays the workspace so showing/hiding it never resizes the canvas. */
.wpcanvex-prop-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  background: #ffffff;
  border-bottom: 1px solid #e2e2e4;
  overflow-x: auto;
  white-space: nowrap;
  height: 48px;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  color: #1a1a1a;
}
.wpcanvex-prop-bar::-webkit-scrollbar { height: 0; }

.wpcanvex-fb-group { display: inline-flex; align-items: center; gap: 0; }

/* [hidden] needs an explicit rule wherever an author `display` is set. */
.wpcanvex-prop-bar[hidden],
.wpcanvex-fb-group[hidden],
.wpcanvex-formula-bar[hidden],
.wpcanvex-page-strip[hidden] { display: none !important; }

/* Formula bar — mirrors the active table cell's raw value, spreadsheet-style.
   Sits directly under the 48px prop bar, same absolute-overlay positioning. */
.wpcanvex-formula-bar {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 34px;
  background: #fafafa;
  border-bottom: 1px solid #e2e2e4;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.wpcanvex-formula-bar-ref {
  flex-shrink: 0;
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  text-align: center;
}
.wpcanvex-formula-bar-fx {
  flex-shrink: 0;
  font-size: 12px;
  font-style: italic;
  font-weight: 700;
  color: #8a8a90;
}
.wpcanvex-formula-bar-input {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  color: #1a1a1a;
  outline: none;
}
.wpcanvex-formula-bar-input:hover { background: #fff; border-color: #e2e2e4; }
.wpcanvex-formula-bar-input:focus { background: #fff; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }

/* Pages hint toast — bottom-right corner, auto-dismisses */
#wpcanvex-pages-hint {
  position: absolute;
  bottom: 52px;
  right: 16px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: #1e1b4b;
  color: #e9d5ff;
  font-size: 12px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  pointer-events: none;
  animation: wpcanvex-hint-in .3s ease both;
}
#wpcanvex-pages-hint strong { color: #fff; }
#wpcanvex-pages-hint svg { flex-shrink: 0; }
#wpcanvex-pages-hint::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 28px;
  width: 12px; height: 12px;
  background: #1e1b4b;
  transform: rotate(45deg);
  border-radius: 2px;
}
.wpcanvex-pages-hint--out { animation: wpcanvex-hint-out .35s ease both !important; }
@keyframes wpcanvex-hint-in  { from { opacity:0; transform:translateY(8px) } to { opacity:1; transform:translateY(0) } }
@keyframes wpcanvex-hint-out { from { opacity:1; transform:translateY(0) } to { opacity:0; transform:translateY(6px) } }

/* Thin vertical divider */
.wpcanvex-fb-sep {
  display: inline-block;
  width: 1px; height: 20px;
  background: #e2e2e4;
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── 1. Bare style select (Paragraph ˅) — no box, plain text look ── */
.wpcanvex-fb-bare-select {
  border: none; background: transparent; outline: none;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: #1a1a1a; cursor: pointer;
  padding: 0 2px;
  appearance: auto;
  -webkit-appearance: auto;
  height: 32px;
  min-width: 96px;
}
.wpcanvex-fb-bare-select:focus { outline: none; }

/* ── 2. Font family custom pill (styled div + hidden select overlay) ── */
.wpcanvex-fb-font-pill {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #e2e2e4;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s;
  min-width: 110px;
  max-width: 140px;
  margin-right: 6px;
}
.wpcanvex-fb-font-pill:hover { border-color: #c7c7cb; }
.wpcanvex-fb-font-label {
  flex: 1;
  font-size: 13px; color: #1a1a1a;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  pointer-events: none;
}
.wpcanvex-fb-font-select {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
  font-size: 13px;
}

/* ── 3. Size pill: [−] [num] [+] grouped with one border ── */
.wpcanvex-fb-size-pill {
  display: inline-flex; align-items: center;
  height: 32px;
  border: 1px solid #e2e2e4;
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}
.wpcanvex-fb-sz-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 100%;
  background: #fff; border: none;
  font-size: 15px; color: #4a4a4a; cursor: pointer; line-height: 1;
  flex-shrink: 0;
}
.wpcanvex-fb-sz-btn:hover { background: #f4f4f5; color: #1a1a1a; }
.wpcanvex-fb-size {
  width: 38px; height: 100%;
  /* WP admin gives number inputs 8px side padding, which clips the digits. */
  padding: 0; min-height: 0; box-shadow: none; border-radius: 0;
  border: none; border-left: 1px solid #e2e2e4; border-right: 1px solid #e2e2e4;
  text-align: center; background: transparent;
  font-family: inherit; font-size: 13px; color: #1a1a1a;
  outline: none; -moz-appearance: textfield;
}
.wpcanvex-fb-size::-webkit-outer-spin-button,
.wpcanvex-fb-size::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── 4. Color button (A with underline, no border) ── */
.wpcanvex-fb-color-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 32px;
  cursor: pointer;
  border: 1px solid #e2e2e4;
  border-radius: 6px;
  background: #fff;
  transition: background 0.1s;
}
.wpcanvex-fb-color-btn:hover { background: #f4f4f5; }
.wpcanvex-fb-color-icon {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: #1a1a1a;
  pointer-events: none;
}
.wpcanvex-fb-color-bar {
  display: block; width: 14px; height: 3px; border-radius: 1px;
}
.wpcanvex-fb-color-swatch {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}

/* ── 5. Plain icon buttons (duplicate, lock, delete) ── */
.wpcanvex-fb-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px;
  padding: 0 4px;
  background: transparent; border: none;
  border-radius: 5px;
  color: #6a6a70;
  font-family: inherit; font-size: 14px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.wpcanvex-fb-icon-btn:hover  { background: #f4f4f5; color: #1a1a1a; }
.wpcanvex-fb-icon-btn.active { background: #dbeafe; color: #2563eb; }
.wpcanvex-fb-danger          { color: #b5474f; }
.wpcanvex-fb-danger:hover    { background: #fcebec !important; color: #b91c1c !important; }

/* ── 6. Grouped bordered pill for B I U S and align ── */
/* Must come AFTER .wpcanvex-fb-icon-btn so the specificity wins */
.wpcanvex-fb-pill-group {
  display: inline-flex; align-items: center;
  height: 32px;
  border: 1px solid #e2e2e4;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.wpcanvex-fb-pill-group .wpcanvex-fb-icon-btn {
  border-radius: 0 !important;
  border: none !important;
  border-right: 1px solid #e2e2e4 !important;
  margin: 0 !important;
  height: 100% !important;
  min-width: 30px !important;
  background: #fff !important;
  color: #4a4a4a !important;
}
.wpcanvex-fb-pill-group .wpcanvex-fb-icon-btn:last-child { border-right: none !important; }
.wpcanvex-fb-pill-group .wpcanvex-fb-icon-btn:hover { background: #f4f4f5 !important; color: #1a1a1a !important; }
.wpcanvex-fb-pill-group .wpcanvex-fb-icon-btn.active { background: #dbeafe !important; color: #2563eb !important; }

/* ── 7. Stroke width input ── */
.wpcanvex-fb-stroke-w {
  width: 36px; height: 28px; border: none;
  text-align: center; background: transparent;
  font-family: inherit; font-size: 13px; color: #1a1a1a; outline: none;
  -moz-appearance: textfield;
}
.wpcanvex-fb-stroke-w::-webkit-outer-spin-button,
.wpcanvex-fb-stroke-w::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Label beside inputs */
.wpcanvex-fb-label { font-size: 12px; color: #888; white-space: nowrap; padding: 0 2px; }

/* ── Expanded in-tab mode ────────────────────────────────────────────────── */
.wpcanvex-shell.wpcanvex-expanded {
  position: fixed;
  inset: 0;
  z-index: 999999;
  height: 100vh;
  border-radius: 0;
}
body.wpcanvex-body-expanded { overflow: hidden; }

/* ── Visitor canvas engine ───────────────────────────────────────────────────*/
.wpcanvex-canvas-visitor {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.wpcanvex-cv-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #13131f;
  border-bottom: 1px solid #2e2e42;
}

.wpcanvex-cv-page-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #c9d1d9;
  font-size: 13px;
}

.wpcanvex-cv-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: #c9d1d9;
  background: #21213a;
  border: 1px solid #30304a;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s;
}
.wpcanvex-cv-btn:hover { background: #30304a; color: #fff; }
.wpcanvex-cv-btn-primary {
  margin-left: auto;
  background: #1a6bb5;
  color: #fff;
  border-color: #1a6bb5;
}
.wpcanvex-cv-btn-primary:hover { background: #155294; }

.wpcanvex-cv-workspace {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  background: #2a2a3e;
}

.wpcanvex-cv-canvas-wrap {
  box-shadow: 0 4px 32px rgba(0,0,0,0.5);
  border-radius: 2px;
  line-height: 0;
}

/* ── Visitor canvas editor (same editor as the admin, trimmed) ─────────────── */
.wpcanvex-dialog-chromeless .wpcanvex-dialog-header,
.wpcanvex-dialog-chromeless .wpcanvex-privacy-note { display: none; }
.wpcanvex-dialog-chromeless .wpcanvex-dialog-content { overflow: hidden; min-height: 0; }
.wpcanvex-editor-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.wpcanvex-shell.wpcanvex-visitor {
  flex: 1; height: auto; min-height: 0;
  border-radius: 0; box-shadow: none;
}

.wpcanvex-export-menu { position: relative; flex-shrink: 0; }
.wpcanvex-export-trigger { gap: 8px; }
.wpcanvex-export-trigger:disabled { opacity: .6; cursor: default; }
.wpcanvex-export-trigger svg:last-child { transition: transform .15s; }
.wpcanvex-export-menu:hover .wpcanvex-export-trigger,
.wpcanvex-export-menu.open .wpcanvex-export-trigger { background: var(--wpcanvex-theme-topbar-btn-hover, #eceaff); color: var(--wpcanvex-theme-topbar-btn-color, var(--wpcanvex-theme-solid, #180dff)); }
.wpcanvex-export-menu:hover .wpcanvex-export-trigger svg:last-child,
.wpcanvex-export-menu.open .wpcanvex-export-trigger svg:last-child { transform: rotate(180deg); }
/* padding-top bridges the gap so the menu stays open while the pointer crosses it. */
.wpcanvex-export-list { display: none; position: absolute; top: 100%; right: 0; min-width: 270px; padding-top: 6px; z-index: 1000; }
.wpcanvex-export-menu:hover .wpcanvex-export-list,
.wpcanvex-export-menu.open .wpcanvex-export-list { display: block; }
.wpcanvex-export-card {
  padding: 8px; background: #fff; color: #1a1a1a;
  border: 1px solid #e0e0e0; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.22);
}
.wpcanvex-export-heading { padding: 6px 10px 8px; font-size: 12px; font-weight: 600; color: #777; }
.wpcanvex-export-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px; border: none; border-radius: 8px;
  background: transparent; color: inherit; text-align: left;
  font: inherit; cursor: pointer;
}
.wpcanvex-export-item:hover, .wpcanvex-export-item:focus-visible { background: var(--wpcanvex-theme-menu-hover, #f5f3ff); outline: none; }
.wpcanvex-export-item svg { flex-shrink: 0; color: #555; }
.wpcanvex-export-item strong { display: block; font-size: 14px; font-weight: 600; }
.wpcanvex-export-item small { display: block; margin-top: 1px; font-size: 12px; color: #777; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.wpcanvex-table-picker { display: grid; gap: 3px; }
.wpcanvex-table-pick {
  aspect-ratio: 1; padding: 0; min-height: 0;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 2px; cursor: pointer;
}
.wpcanvex-table-pick.on { background: #dbeafe; border-color: var(--wpcanvex-accent); }
.wpcanvex-table-picker-label { margin-top: 8px; font-size: 12px; color: var(--wpcanvex-muted); min-height: 16px; }

.wpcanvex-table-templates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wpcanvex-table-tpl {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 6px; background: var(--wpcanvex-surface);
  border: 1px solid var(--wpcanvex-border); border-radius: 8px;
  color: var(--wpcanvex-text); font-size: 11px; font-family: inherit; cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.wpcanvex-table-tpl svg { width: 100%; height: auto; background: #fff; border-radius: 4px; }
.wpcanvex-table-tpl:hover { background: #dbeafe; border-color: var(--wpcanvex-accent); }

.wpcanvex-fb-text-btn {
  height: 32px; padding: 0 10px; margin-right: 4px;
  background: #fff; border: 1px solid #e2e2e4; border-radius: 6px;
  color: #1a1a1a; font-size: 12px; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.wpcanvex-fb-text-btn:hover { background: #eff6ff; border-color: #bfdbfe; }
.wpcanvex-fb-text-btn.active { background: #dbeafe; border-color: var(--wpcanvex-accent); color: var(--wpcanvex-accent); }
/* Applied to <select> (e.g. the border-style and number-format pickers) too —
   without this the OS draws its own control chrome over the border/radius above. */
select.wpcanvex-fb-text-btn {
  appearance: none; -webkit-appearance: none;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238a8a90' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
#wpcanvex-fb-tb-borders,
#wpcanvex-fb-tb-format {
  border: 1px solid #e2e2e4;
  border-radius: 6px;
}

.wpcanvex-cell-editor {
  position: absolute; z-index: 5; box-sizing: border-box; margin: 0;
  border: 2px solid var(--wpcanvex-accent); background: #fff;
  resize: none; overflow: hidden; outline: none; line-height: 1.25;
}

/* ── Flow mode (TipTap document editor) ──────────────────────────────────── */
.wpcanvex-doc-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 6px 12px;
  background: var(--wpcanvex-bar);
  border-bottom: 1px solid var(--wpcanvex-border);
  flex-shrink: 0;
}
.wpcanvex-doc-table-tools { display: contents; }
.wpcanvex-doc-table-tools[hidden] { display: none; }
.wpcanvex-doc-sep { width: 1px; height: 20px; background: var(--wpcanvex-border); margin: 0 6px; }
.wpcanvex-doc-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--wpcanvex-text); cursor: pointer;
}
.wpcanvex-doc-btn svg { width: 17px; height: 17px; }
.wpcanvex-doc-btn:hover { background: var(--wpcanvex-surface); border-color: var(--wpcanvex-border); }
.wpcanvex-doc-btn.active { background: #dbeafe; border-color: #bfdbfe; color: var(--wpcanvex-accent); }
.wpcanvex-doc-color input[type=color] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; border: 0; padding: 0;
}
.wpcanvex-doc-select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--wpcanvex-border);
  border-radius: 6px !important;
  background: #fff;
  color: var(--wpcanvex-text);
  font-size: 13px !important;
  font-family: inherit;
  border-color: var(--wpcanvex-border) !important;
}
.wpcanvex-doc-text-btn {
  height: 28px; padding: 0 10px;
  border: 1px solid var(--wpcanvex-border); border-radius: 6px;
  background: var(--wpcanvex-surface); color: var(--wpcanvex-text);
  font-size: 12px; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.wpcanvex-doc-text-btn:hover { background: var(--wpcanvex-border); }
.wpcanvex-topbar .wpcanvex-icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.wpcanvex-topbar .wpcanvex-icon-btn svg { width: 17px; height: 17px; }

.wpcanvex-doc-workspace {
  flex: 1; min-height: 0; overflow: auto;
  padding: 32px 16px 64px;
  background: var(--wpcanvex-bg);
}
.wpcanvex-doc-page {
  --wpcanvex-doc-page-h: 1123px;
  box-sizing: border-box;
  max-width: 100%;
  margin: 0 auto;
  background-color: #fff;
  /* Thin line at every page height, so authors see where pages will break. */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--wpcanvex-doc-page-h) - 1px),
    #cbd5e1 calc(var(--wpcanvex-doc-page-h) - 1px),
    #cbd5e1 var(--wpcanvex-doc-page-h)
  );
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.08);
  cursor: text;
}

/* Explicit rules for every node type: on the admin screen this sits inside
   wp-admin's stylesheet, and the exports reproduce what is shown here. */
/* Sizes and spacing in pt mirror doc-export.js (PDF) and the DOCX styles, so
   the three agree on where lines and pages break. 1.465 = 1.2 x Carlito's
   natural line height, which is what pdfmake's lineHeight 1.2 produces. */
.wpcanvex-doc-content {
  outline: none;
  min-height: 100%;
  color: #111827;
  font-family: Carlito, Calibri, 'Segoe UI', Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.465;
  text-align: left;
}
.wpcanvex-doc-content > * + * { margin-top: 6pt; }
.wpcanvex-doc-content p { margin: 0; }
.wpcanvex-doc-content p + p { margin-top: 6pt; }
.wpcanvex-doc-content h1,
.wpcanvex-doc-content h2,
.wpcanvex-doc-content h3 { color: #111827; font-family: inherit; font-weight: 700; line-height: 1.22; }
.wpcanvex-doc-content h1 { font-size: 21pt; margin: 12pt 0 5pt; }
.wpcanvex-doc-content h2 { font-size: 16.5pt; margin: 10pt 0 4pt; }
.wpcanvex-doc-content h3 { font-size: 13.5pt; margin: 8pt 0 3pt; }
.wpcanvex-doc-content > :first-child { margin-top: 0; }
.wpcanvex-doc-content ul,
.wpcanvex-doc-content ol { margin: .6em 0; padding-left: 1.6em; }
.wpcanvex-doc-content ul { list-style: disc; }
.wpcanvex-doc-content ol { list-style: decimal; }
.wpcanvex-doc-content li { margin: .2em 0; }
.wpcanvex-doc-content li > p { margin: 0; }
.wpcanvex-doc-content blockquote { margin: .8em 0; padding: 0 0 0 1em; border-left: 3px solid #d1d5db; color: #4b5563; }
.wpcanvex-doc-content hr { margin: 1.2em 0; border: 0; border-top: 1px solid #d1d5db; }
.wpcanvex-doc-content a { color: #2563eb; text-decoration: underline; }
.wpcanvex-doc-content code { padding: 1px 4px; background: #f3f4f6; border-radius: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
.wpcanvex-doc-content pre { padding: 10px 12px; background: #f3f4f6; border-radius: 6px; white-space: pre-wrap; }
.wpcanvex-doc-content pre code { padding: 0; background: none; }
.wpcanvex-doc-content img { display: block; max-width: 100%; height: auto; }
.wpcanvex-doc-content img.ProseMirror-selectednode { outline: 2px solid var(--wpcanvex-accent); }
.wpcanvex-doc-content table { width: 100%; margin: .8em 0; border-collapse: collapse; table-layout: fixed; }
.wpcanvex-doc-content th,
.wpcanvex-doc-content td { position: relative; min-width: 40px; padding: 6px 8px; border: 1px solid #9ca3af; vertical-align: top; text-align: left; }
.wpcanvex-doc-content th { background: #f3f4f6; font-weight: 700; }
.wpcanvex-doc-content .selectedCell::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(37,99,235,.12); pointer-events: none;
}
.wpcanvex-doc-content p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left; height: 0;
  color: #9ca3af; pointer-events: none;
}
