/* SIForm design system.
   Light, Figma-grade chrome. Tokens first; every module below uses them. */

:root {
  --accent: #6366f1;
  --accent-600: #4f46e5;
  --accent-soft: #eef2ff;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e4e7ec;
  --border-strong: #cfd4dc;
  --text: #101828;
  --muted: #667085;
  --faint: #98a2b3;
  --danger: #e5484d;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 16px -2px rgba(16, 24, 40, .12);
  --shadow-lg: 0 12px 40px -4px rgba(16, 24, 40, .22);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  --tb-h: 52px;

  /* ---- spacing scale (4px base) ---------------------------------------- */
  --sp-0: 0;
  --sp-1: 2px;
  --sp-2: 4px;
  --sp-3: 6px;
  --sp-4: 8px;
  --sp-5: 12px;
  --sp-6: 16px;
  --sp-7: 20px;
  --sp-8: 24px;
  --sp-9: 32px;
  --sp-10: 40px;

  /* ---- typography scale ------------------------------------------------- */
  --fs-caption: 11px;
  --fs-small: 12px;
  --fs-body: 13.5px;
  --fs-label: 12.5px;
  --fs-h6: 14px;
  --fs-h5: 15px;
  --fs-h4: 17px;
  --fs-h3: 20px;
  --fs-h2: 24px;
  --fs-h1: 30px;
  --lh-tight: 1.25;
  --lh-body: 1.55;
  --fw-regular: 400;
  --fw-medium: 600;
  --fw-bold: 700;

  /* ---- radius ----------------------------------------------------------- */
  --radius-sm: 5px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* ---- icon sizes ------------------------------------------------------- */
  --icon-sm: 13px;
  --icon-md: 15px;   /* the family's natural size */
  --icon-lg: 20px;
  --icon-xl: 24px;

  /* ---- motion ----------------------------------------------------------- */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(0, 0, .2, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 260ms;

  /* ---- semantic surfaces ------------------------------------------------ */
  --surface: #ffffff;
  --surface-sunken: #f9fafb;
  --surface-raised: #ffffff;
  --info: #0ea5e9;
  --success-soft: #ecfdf5;
  --warning-soft: #fffbeb;
  --danger-soft: #fef2f2;
  --info-soft: #eff6ff;

  /* Chevron used by CSS-drawn affordances (sort carets, disclosure marks),
     masked so it inherits currentColor like the inline SVG family. */
  --ff-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Motion is a preference, not a decoration. */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
kbd {
  font: 600 10.5px var(--mono);
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--muted);
}
code { font-family: var(--mono); font-size: .92em; background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
svg { flex-shrink: 0; }

/* ================= app frame ================= */

#app { display: flex; flex-direction: column; height: 100vh; max-width: 100vw; overflow-x: hidden; }
#fb-topbar::-webkit-scrollbar { display: none; }
#fb-body { display: flex; flex: 1; min-height: 0; }

/* One sidebar: tabs on top, one section showing below, a resize handle on
   the edge. Width is a custom property so the handle can set it (panel.js). */
#fb-side {
  position: relative;
  width: var(--side-w, 320px); flex-shrink: 0; min-width: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 6;
}
.fb-side-tabs {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.fb-side-tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 2px 9px; min-width: 0;
  font-size: 11px; font-weight: 600; color: var(--muted);
  transition: color .12s ease, background-color .12s ease;
}
.fb-side-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-side-tab svg { width: 17px; height: 17px; }
.fb-side-tab:hover { color: var(--text); background: var(--bg); }
.fb-side-tab[aria-selected="true"] { color: var(--accent-600); }
.fb-side-tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -1px; height: 2px;
  border-radius: 2px 2px 0 0; background: var(--accent);
}
.fb-side-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fb-side-panels { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
#fb-palette, #fb-tree, #fb-inspector {
  flex: 1; min-height: 0; min-width: 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel);
}
#fb-palette[hidden], #fb-tree[hidden], #fb-inspector[hidden] { display: none; }

/* Resize handle: a wide hit area, a hairline that lights up on hover. */
.fb-side-resize {
  position: absolute; top: 0; right: -4px; bottom: 0; width: 8px;
  cursor: col-resize; z-index: 8; touch-action: none;
}
.fb-side-resize::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px;
  background: transparent; transition: background-color .12s ease;
}
.fb-side-resize:hover::after, .fb-side-resize:focus-visible::after, body.fb-resizing .fb-side-resize::after { background: var(--accent); }
.fb-side-resize:focus-visible { outline: none; }
body.fb-resizing, body.fb-resizing * { cursor: col-resize !important; user-select: none !important; }
.fb-side-scrim { display: none; }
#fb-topbar .tb-panel-btn { display: none; } /* beats the generic .tb-btn display */
#fb-canvas-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Field options with nothing selected. */
.ins-empty { margin: auto; padding: 40px 24px; text-align: center; color: var(--muted); max-width: 300px; }
.ins-empty-icon {
  width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-600);
}
.ins-empty-icon svg { width: 20px; height: 20px; }
.ins-empty h3 { margin: 0 0 6px; font-size: 14px; color: var(--text); }
.ins-empty p { margin: 0 0 16px; font-size: 12.5px; line-height: 1.55; }
.ins-empty-acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ================= topbar ================= */

#fb-topbar {
  height: var(--tb-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  /* Buttons have intrinsic widths, so a full toolbar is wider than a narrow
     window. Contain it here: the toolbar scrolls, the document never does. */
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  z-index: 20;
}
.tb-group { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* Left and right share the room equally, so the centre stays centred and the title can use its side. */
@media (min-width: 1100px) {
  .tb-left, .tb-right { flex: 1 1 0; }
  .tb-right { justify-content: flex-end; }
  .tb-center { flex: none; }
}
/* The SIForm mark, without a wordmark. */
.tb-logo {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 8px;
  color: var(--accent-600); background: var(--accent-soft);
}
.tb-logo svg { width: 18px; height: 18px; }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.tb-title {
  font-weight: 600; color: var(--muted); cursor: pointer;
  max-width: 360px; min-width: 4ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 5px 8px; border-radius: 6px;
}
.tb-title:hover { background: var(--bg); color: var(--text); }
.tb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 9px; border-radius: 7px;
  color: var(--muted);
  transition: background .12s, color .12s;
}
.tb-btn:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.tb-btn:disabled { opacity: .35; cursor: default; }
.tb-btn.is-active { background: var(--accent-soft); color: var(--accent-600); }
.tb-btn-primary {
  background: var(--accent); color: #fff; font-weight: 600; padding: 0 14px;
}
.tb-btn-primary:hover:not(:disabled) { background: var(--accent-600); color: #fff; }
.tb-devices { display: flex; background: var(--bg); border-radius: 8px; padding: 2px; gap: 1px; }
.tb-devices .tb-btn { height: 28px; }
/* Save: icon only; the state shows as a dot (unsaved), a spinner, or an alert. */
.tb-save { position: relative; }
.tb-save-dot {
  position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--panel); display: none;
}
.tb-save.is-dirty .tb-save-dot { display: block; }
.tb-save.is-error { color: var(--danger); }
.tb-save .fbm-spinner { width: 15px; height: 15px; }
.tb-icon-only { padding-inline: 9px; }
.tb-tip {
  position: fixed; z-index: 400; pointer-events: none;
  padding: 5px 9px; border-radius: 6px; background: #111827; color: #fff;
  font-size: 11.5px; font-weight: 500; white-space: nowrap; box-shadow: var(--shadow-md);
}
.tb-tip[hidden] { display: none; }
.tb-history-wrap, .tb-more-wrap { position: relative; }
.tb-history, .tb-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 240px; max-height: 420px; overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 5px; z-index: 300;
}
.tb-history { left: 0; right: auto; width: 280px; }
.tb-history button, .tb-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; border-radius: 6px; text-align: left; color: var(--text);
}
.tb-history button { justify-content: space-between; }
.tb-history button small { color: var(--faint); }
.tb-history button:hover, .tb-menu button:hover { background: var(--bg); }
.tb-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }
.tb-menu-danger { color: var(--danger) !important; }
.tb-menu-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); padding: 8px 9px 4px; }
.tb-menu-empty { color: var(--faint); padding: 6px 9px 10px; font-size: 12.5px; }

/* ================= palette ================= */

.fb-pal-search { position: relative; padding: 10px 10px 6px; }
.fb-pal-search-icon { position: absolute; left: 20px; top: 19px; color: var(--faint); }
#fb-pal-query {
  width: 100%; height: 34px; padding: 0 10px 0 32px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
#fb-pal-query:focus { border-color: var(--accent); background: var(--panel); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
/* The palette is the other long menu in the product: it scrolls on its own,
   and reaching its end must not start scrolling the canvas behind it. */
.fb-pal-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 4px 10px 10px;
  overscroll-behavior: contain; scroll-behavior: smooth;
  scrollbar-width: thin;
}
.fb-pal-scroll::-webkit-scrollbar { width: 8px; }
.fb-pal-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.fb-pal-scroll::-webkit-scrollbar-track { background: transparent; }
.fb-tree-body { overscroll-behavior: contain; scroll-behavior: smooth; scrollbar-width: thin; }
#fb-inspector .ins-scroll,
.ins-scroll { overscroll-behavior: contain; }
@media (prefers-reduced-motion: reduce) {
  .fb-pal-scroll, .fb-tree-body { scroll-behavior: auto; }
}
.fb-pal-cat-head {
  display: flex; align-items: center; gap: 6px; width: 100%;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 10px 2px 6px;
}
.fb-pal-caret { display: inline-flex; transition: transform .15s; color: var(--faint); }
.fb-pal-cat.is-collapsed .fb-pal-caret { transform: rotate(-90deg); }
.fb-pal-cat.is-collapsed .fb-pal-grid { display: none; }
.fb-pal-count { margin-left: auto; font-weight: 600; color: var(--faint); background: var(--bg); border-radius: 99px; padding: 1px 7px; }
/* Tiles: a grid of equal rectangles, icon above label. The column count
   follows the sidebar width, so widening the panel shows more per row. */
.fb-pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 6px; }
.fb-pal-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  min-height: 66px; padding: 10px 4px 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel);
  cursor: grab; user-select: none; touch-action: none;
  transition: border-color .12s, box-shadow .12s, background-color .12s;
  text-align: center; min-width: 0;
}
.fb-pal-item:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.fb-pal-item:active { cursor: grabbing; }
/* The icon is what the eye lands on in a two-column grid of short labels, so
   it is sized as an icon rather than as punctuation beside the text. */
.fb-pal-icon { color: var(--accent-600); display: inline-flex; flex-shrink: 0; }
.fb-pal-icon svg { width: 20px; height: 20px; }
.fb-pal-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fb-pal-cat-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.fb-pal-label { font-size: 11.5px; font-weight: 500; line-height: 1.2; max-width: 100%; overflow: hidden; color: var(--text);
  /* Two lines rather than cut off: "Number Spinner", "Image Choice"… */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.fb-pal-fav {
  position: absolute; top: 3px; right: 3px; color: var(--faint);
  opacity: 0; transition: opacity .12s; padding: 2px; border-radius: 4px;
}
.fb-pal-item:hover .fb-pal-fav, .fb-pal-fav.is-fav { opacity: 1; }
.fb-pal-fav.is-fav { color: #f59e0b; }
.fb-pal-none { color: var(--faint); text-align: center; padding: 28px 10px; }
.fb-pal-foot { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); }
.fb-pal-foot-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; border-radius: 7px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: var(--bg);
}
.fb-pal-foot-btn:hover { color: var(--accent-600); background: var(--accent-soft); }

/* ================= tree ================= */

.fb-tree-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 12px 8px; font-weight: 700; font-size: 12.5px;
}
.fb-tree-head span { display: inline-flex; align-items: center; gap: 7px; }
.fb-tree-search { padding: 0 10px 8px; }
.fb-tree-search input {
  width: 100%; height: 30px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--bg);
}
.fb-tree-body { flex: 1; overflow: auto; padding: 0 6px 10px; }
.fb-tree-item {
  display: flex; align-items: center; gap: 5px;
  padding: 4.5px 6px 4.5px calc(6px + var(--depth, 0) * 14px);
  border-radius: 6px; cursor: pointer; user-select: none;
  color: var(--muted); font-size: 12.5px;
  position: relative;
}
.fb-tree-item:hover { background: var(--bg); color: var(--text); }
.fb-tree-item.is-selected { background: var(--accent-soft); color: var(--accent-600); }
.fb-tree-item.page { font-weight: 700; color: var(--text); }
.fb-tree-item.field .fb-tree-label { font-weight: 500; }
.fb-tree-caret { display: inline-flex; color: var(--faint); transition: transform .12s; padding: 2px; }
.fb-tree-caret.is-open { transform: rotate(90deg); }
.fb-tree-caret-spacer { width: 18px; flex-shrink: 0; }
.fb-tree-icon { display: inline-flex; color: var(--faint); flex-shrink: 0; }
.fb-tree-icon svg { width: 16px; height: 16px; }
.fb-tree-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fb-tree-item.is-selected .fb-tree-icon { color: var(--accent-600); }
.fb-tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-tree-flag { display: inline-flex; color: var(--faint); }
.fb-tree-acts { display: none; gap: 2px; }
.fb-tree-item:hover .fb-tree-acts { display: inline-flex; }
.fb-tree-acts [data-tree-act="up"] svg { transform: rotate(180deg); }

/* ================= page bar ================= */

#fb-pagebar {
  display: flex; align-items: center; justify-content: space-between;
  height: 42px; flex-shrink: 0; padding: 0 14px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.fb-pages { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
.fb-page-tab {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 10px; border-radius: 7px;
  color: var(--muted); font-weight: 500; white-space: nowrap;
}
.fb-page-tab:hover { background: var(--bg); }
.fb-page-tab.is-active { background: var(--accent-soft); color: var(--accent-600); font-weight: 600; }
.fb-page-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--border); font-size: 10.5px; font-weight: 700; color: var(--muted);
}
.fb-page-tab.is-active .fb-page-num { background: var(--accent); color: #fff; }
.fb-page-x { display: none; color: var(--faint); border-radius: 4px; padding: 1px; }
.fb-page-tab:hover .fb-page-x { display: inline-flex; }
.fb-page-x:hover { color: var(--danger); }
.fb-page-add { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px; border-radius: 7px; color: var(--faint); font-weight: 500; }
.fb-page-add:hover { color: var(--accent-600); background: var(--accent-soft); }
.fb-field-count { color: var(--faint); font-size: 12px; }

/* ================= canvas ================= */

#fb-canvas-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  background-image: radial-gradient(circle, var(--border-strong) 1px, transparent 1px);
  background-size: 22px 22px;
}
#fb-canvas { display: flex; justify-content: center; padding: 28px 24px 120px; }
.fb-page {
  width: 100%; max-width: 760px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 34px 38px 30px;
  min-height: 400px;
  transition: max-width .25s ease;
}
.fb-device-tablet .fb-page { max-width: 620px; }
.fb-device-mobile .fb-page { max-width: 400px; padding: 24px 20px; }

.fb-form-head { margin-bottom: 18px; }
.fb-form-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; border-radius: 6px; padding: 2px 4px; margin-left: -4px; }
.fb-form-desc { color: var(--muted); margin: 0; border-radius: 6px; padding: 2px 4px; margin-left: -4px; }
.fb-form-desc.is-empty { color: var(--faint); font-style: italic; }
.fb-form-title:hover, .fb-form-desc:hover { background: color-mix(in srgb, currentColor 9%, transparent); cursor: text; }
[contenteditable="true"]:not(.ff-richtext-area) { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; background: color-mix(in srgb, currentColor 9%, transparent) !important; cursor: text; }
.fb-page-title-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--accent-600);
  background: var(--accent-soft); border-radius: 99px; padding: 4px 12px; margin-bottom: 14px;
}

.fb-rows { display: flex; flex-direction: column; gap: 4px; min-height: 40px; }
.fb-rows-empty { min-height: 300px; }
.fb-drop-hint {
  border: 1.5px dashed var(--border-strong); border-radius: 8px;
  color: var(--faint); text-align: center; padding: 14px; font-size: 12.5px;
}
.is-drop-target { outline: 2px dashed var(--accent) !important; outline-offset: -2px; background: var(--accent-soft) !important; border-radius: 8px; }

/* Empty canvas: a drop zone with one-click starters, then quieter alternatives. */
.fb-empty { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 28px 8px 8px; text-align: center; }
.fb-empty-drop {
  width: 100%; max-width: 560px; padding: 30px 24px 24px;
  border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--bg);
  transition: border-color .15s ease, background-color .15s ease;
}
.fb-empty-icon {
  width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel); color: var(--accent-600); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.fb-empty-icon svg { width: 20px; height: 20px; }
.fb-empty h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.fb-empty-drop > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.fb-empty-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fb-empty-chip {
  display: flex; align-items: center; gap: 7px; min-width: 0; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--panel);
  font-size: 12.5px; font-weight: 500; color: var(--text); text-align: left;
  transition: border-color .12s ease, box-shadow .12s ease, color .12s ease;
}
.fb-empty-chip svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent-600); }
.fb-empty-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-empty-chip:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.fb-empty-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fb-empty-alt { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.fb-empty-alt button {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); border-radius: 6px;
}
.fb-empty-alt button svg { width: 15px; height: 15px; }
.fb-empty-alt button:hover { color: var(--accent-600); }
.fb-empty-alt button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fb-empty-tip { margin: 0; color: var(--faint); font-size: 11.5px; }
.fb-empty-tip kbd {
  display: inline-block; min-width: 20px; padding: 1px 5px; margin: 0 1px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--panel);
  font: 600 10.5px/1.5 var(--mono, ui-monospace, monospace); color: var(--muted); text-align: center;
}
/* Dragging over the empty page lights up the drop zone itself. */
.fb-rows-empty.is-drop-target { outline: none !important; background: transparent !important; }
.fb-rows-empty.is-drop-target .fb-empty-drop { border-color: var(--accent); border-style: solid; background: var(--accent-soft); }
@media (max-width: 600px) {
  .fb-empty-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fb-empty-drop { padding: 22px 14px 16px; }
}
@media (pointer: coarse), (max-width: 767px) {
  .fb-empty-chip, .fb-empty-alt button { min-height: 44px; }
}

/* rows & columns */
.fb-row { position: relative; border-radius: 8px; }
.fb-row-grip {
  position: absolute; left: -26px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 28px; display: flex; align-items: center; justify-content: center;
  color: var(--faint); opacity: 0; border-radius: 5px; cursor: grab; touch-action: none;
}
.fb-row:hover > .fb-row-grip { opacity: 1; }
.fb-row-grip:hover { background: var(--bg); color: var(--muted); }
.fb-cols { display: grid; gap: 10px; align-items: start; }
/* Stacked (tablet/mobile): every column takes the full width, like the live form. */
.fb-cols.is-stacked { display: flex; flex-direction: column; align-items: stretch; gap: 4px; } /* same rhythm as rows and fields */
.fb-col { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 30px; border-radius: 8px; }
.fb-col-empty {
  border: 1.5px dashed var(--border); border-radius: 8px; color: var(--faint);
  font-size: 12px; text-align: center; padding: 16px 6px;
}
.fb-col-resizer {
  position: absolute; top: 0; bottom: 0; right: -7px; width: 7px;
  cursor: col-resize; z-index: 3; border-radius: 3px;
}
.fb-col-resizer:hover, body.fb-resizing .fb-col-resizer { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
body.fb-resizing { cursor: col-resize; user-select: none; }

/* field chrome */
.fb-field {
  position: relative;
  border: 1px solid transparent; border-radius: 8px;
  padding: 8px 10px;
  transition: border-color .1s, background .1s;
  cursor: default;
}
/* Accent-tinted, so it reads on light and dark form themes alike. */
.fb-field:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.fb-field.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fb-field.is-drag-source { opacity: .35; }
.fb-field.is-locked { background: repeating-linear-gradient(45deg, transparent 0 12px, rgba(16,24,40,.02) 12px 24px); }
.fb-field.is-hidden-field { opacity: .45; }
/* Hidden at the simulated breakpoint: dimmed but still selectable/editable. */
.fb-field.is-bp-hidden { opacity: .5; outline: 1px dashed var(--border-strong); outline-offset: 2px; }
.fb-badge-bp { color: var(--muted); font-weight: 700; letter-spacing: .03em; }
.fb-field.is-disabled-field .fb-control { opacity: .5; }
.fb-field.is-unknown { border: 1px dashed var(--danger); color: var(--danger); padding: 12px; }
.fb-field .fb-control { pointer-events: none; }
.fb-field .fb-control [data-inline], .fb-field .fb-control [data-inline-option] { pointer-events: auto; }
.fb-render-error { color: var(--danger); font-size: 12px; }

.fb-field-tools {
  position: absolute; top: -14px; right: 8px; z-index: 4;
  display: none; align-items: center; gap: 1px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 7px; box-shadow: var(--shadow-md); padding: 2px;
}
.fb-field:hover > .fb-field-tools, .fb-field.is-selected > .fb-field-tools { display: inline-flex; }
.fb-field .fb-field .fb-field-tools { display: none; } /* only innermost on hover */
.fb-field .fb-field:hover > .fb-field-tools, .fb-field .fb-field.is-selected > .fb-field-tools { display: inline-flex; }
.fb-tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 5px; color: var(--muted);
}
.fb-tool:hover { background: var(--bg); color: var(--text); }
.fb-field-grip { cursor: grab; touch-action: none; }
.fb-field-grip:active { cursor: grabbing; }
.ins-danger:hover { background: #fef2f2 !important; color: var(--danger) !important; }

.fb-badges { position: absolute; top: -9px; left: 10px; display: flex; gap: 4px; z-index: 3; }
.fb-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--muted); border-radius: 6px; padding: 1px 5px; font-size: 10px;
}
.fb-badge svg { width: 11px; height: 11px; }
.fb-badge-logic { color: var(--warning); border-color: #fde68a; background: #fffbeb; }
.fb-badge-soft { position: static; color: var(--faint); font-size: 10.5px; }
.fb-badge-logic-mini { display: inline-flex; color: var(--warning); }
.fb-badge-logic-mini svg { width: 11px; height: 11px; }

.fb-label {
  display: flex; align-items: center; gap: 5px;
  font-weight: 600; font-size: 13px; margin-bottom: 6px;
}
.fb-label [data-inline]:hover { background: color-mix(in srgb, currentColor 9%, transparent); border-radius: 4px; cursor: text; }
.fb-req { color: var(--danger); font-weight: 700; }
.fb-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--border); color: var(--muted); font-size: 10px; font-weight: 700;
  cursor: help; position: relative;
}
.fb-tip:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; font-size: 11px; font-weight: 500;
  padding: 5px 9px; border-radius: 6px; white-space: nowrap; max-width: 240px; z-index: 30;
}
.fb-help { color: var(--faint); font-size: 12px; margin-top: 5px; }
.fb-help:hover { background: var(--bg); border-radius: 4px; cursor: text; }
.fb-control.has-affix { display: flex; align-items: center; gap: 6px; }
.fb-affix { color: var(--muted); font-weight: 600; font-size: 12.5px; flex-shrink: 0; }

.fb-section-head { display: flex; align-items: center; gap: 7px; padding: 2px 0 8px; }
.fb-section-caret { display: inline-flex; color: var(--faint); cursor: pointer; }
.fb-section-title { font-weight: 700; font-size: 14px; }
.fb-section-title:hover { background: color-mix(in srgb, currentColor 9%, transparent); border-radius: 4px; cursor: text; }
.fb-section-desc { color: var(--faint); font-size: 12px; }
.fb-field.is-container { border: 1px dashed var(--border-strong); background: rgba(244, 245, 247, .5); }
.fb-field.is-container.is-selected { border-style: solid; }
.fb-field.is-collapsed .fb-section-body { display: none; }
.fb-section-body .fb-rows { padding: 2px; }

.fb-submit-row { margin-top: 22px; display: flex; align-items: center; gap: 12px; }
.fb-submit-note { color: var(--faint); font-size: 11.5px; opacity: 0; transition: opacity .15s; }
.fb-submit-row:hover .fb-submit-note { opacity: 1; }
.fb-hidden-chip {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  background: var(--bg); border: 1px dashed var(--border-strong);
  border-radius: 6px; padding: 6px 10px; display: inline-block;
}

/* ================= shared form controls (canvas + preview) ================= */

.ff-input {
  width: 100%; min-height: 38px; padding: 7px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--panel); transition: border-color .12s, box-shadow .12s;
}
textarea.ff-input { resize: vertical; }
.ff-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ff-sm { min-height: 32px; padding: 4px 10px; font-size: 12.5px; }
.ff-lg { min-height: 46px; font-size: 15px; }

.ff-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 18px; border-radius: 8px;
  font-weight: 600; transition: background .12s, transform .05s;
}
.ff-btn:active { transform: translateY(1px); }
.ff-btn-primary { background: var(--accent); color: #fff; }
.ff-btn-primary:hover { background: var(--accent-600); }
.ff-btn-secondary { background: var(--panel); border: 1px solid var(--border-strong); color: var(--text); }
.ff-btn-secondary:hover { background: var(--bg); }
.ff-btn-ghost { color: var(--muted); }
.ff-btn-ghost:hover { background: color-mix(in srgb, currentColor 9%, transparent); }
.ff-btn-danger { background: var(--danger); color: #fff; }
.ff-btn-lg { min-height: 44px; padding: 10px 26px; font-size: 14.5px; }
.ff-btn-sm { min-height: 30px; padding: 4px 12px; font-size: 12.5px; }
.ff-btn-block { width: 100%; }
.ff-btn-paypal { background: #ffc439; color: #003087; }
.ff-btn-paypal i { font-style: normal; font-weight: 900; }

.ff-choices { display: flex; flex-direction: column; gap: 8px; }
.ff-choices.ff-inline { flex-direction: row; flex-wrap: wrap; gap: 14px; }
.ff-choice { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ff-choice input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.ff-choice-label:hover { background: color-mix(in srgb, currentColor 9%, transparent); border-radius: 4px; }

.ff-toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.ff-toggle input { position: absolute; opacity: 0; }
.ff-toggle-track {
  width: 38px; height: 22px; background: var(--border-strong); border-radius: 99px;
  padding: 3px; transition: background .15s; display: inline-block;
}
.ff-toggle-thumb {
  display: block; width: 16px; height: 16px; background: #fff; border-radius: 50%;
  box-shadow: var(--shadow-sm); transition: transform .15s;
}
.ff-toggle input:checked + .ff-toggle-track { background: var(--accent); }
.ff-toggle input:checked + .ff-toggle-track .ff-toggle-thumb { transform: translateX(16px); }
.ff-toggle input:focus-visible + .ff-toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.ff-slider-wrap { display: flex; align-items: center; gap: 12px; }
.ff-slider-wrap input[type=range] { flex: 1; accent-color: var(--accent); }
.ff-slider-value {
  min-width: 38px; text-align: center; font-weight: 700; font-size: 12.5px;
  background: var(--accent-soft); color: var(--accent-600); border-radius: 6px; padding: 3px 7px;
}
.ff-rating { display: flex; gap: 3px; }
.ff-star { font-size: 24px; color: var(--border-strong); transition: color .1s, transform .1s; line-height: 1; }
.ff-star svg { width: 1em; height: 1em; display: block; }
.ff-star:hover { transform: scale(1.15); }
.ff-star.is-on { color: #f59e0b; }

/* ---- file upload ------------------------------------------------------- */

.ff-upload { position: relative; }
/* The picker is opened by the drop zone, which is the real control. Hiding it
   this way rather than with display:none keeps it operable for assistive tech
   that drives the input directly. */
.ff-upload input[type=file] {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.ff-upload-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1.5px dashed var(--border-strong); border-radius: 10px;
  padding: 22px 14px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.ff-upload-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.ff-upload-drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ff-upload.is-dragover .ff-upload-drop {
  border-color: var(--accent); background: var(--accent-soft); border-style: solid;
}
/* A field that already holds everything it can still has to explain itself,
   so it dims rather than disappearing. */
.ff-upload.is-full .ff-upload-drop { opacity: .55; }
.ff-upload-icon { display: inline-flex; color: var(--accent-600); }
.ff-upload-icon svg { width: 22px; height: 22px; }
.ff-upload-drop small { color: var(--faint); }
.ff-upload-note { margin: 6px 0 0; font-size: 12px; color: var(--danger, #b91c1c); }

.ff-upload-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ff-up-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
  background: var(--panel); font-size: 12.5px; min-width: 0;
}
.ff-up-item.is-failed { border-color: var(--danger, #dc2626); background: color-mix(in srgb, var(--danger, #dc2626) 6%, transparent); }
.ff-up-item.is-cancelled { opacity: .7; }
.ff-up-thumb {
  width: 38px; height: 38px; flex-shrink: 0; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg);
}
.ff-up-thumb-doc { display: inline-flex; align-items: center; justify-content: center; color: var(--faint); }
.ff-up-thumb-doc svg { width: 18px; height: 18px; }
.ff-up-thumb-btn { padding: 0; border: 0; background: none; cursor: zoom-in; line-height: 0; border-radius: 8px; }
.ff-up-thumb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ff-up-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ff-up-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-up-meta { color: var(--faint); font-size: 11.5px; }
.ff-up-bar { display: block; height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.ff-up-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .15s linear; }
.ff-up-item.is-done .ff-up-bar i { background: #16a34a; }
.ff-up-item.is-failed .ff-up-bar i,
.ff-up-item.is-cancelled .ff-up-bar i { background: var(--danger, #dc2626); }
.ff-up-item.is-done .ff-up-bar,
.ff-up-item.is-cancelled .ff-up-bar { display: none; }
.ff-up-error { color: var(--danger, #b91c1c); font-size: 11.5px; overflow-wrap: anywhere; }
.ff-up-actions { display: flex; gap: 2px; flex-shrink: 0; }
.ff-up-act {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: 7px;
  background: none; color: var(--faint); cursor: pointer;
}
.ff-up-act:hover { background: color-mix(in srgb, currentColor 9%, transparent); }
.ff-up-act:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Preview overlay: images and PDFs, from the local file while the visitor
   still has it and from the server's inline route afterwards. */
.ff-up-preview {
  position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center;
  background: rgba(16, 24, 40, .62); padding: 24px;
}
.ff-up-preview-inner {
  display: flex; flex-direction: column; gap: 10px; max-width: min(920px, 100%); max-height: 100%;
  background: var(--panel); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-lg);
}
.ff-up-preview-head { display: flex; align-items: center; gap: 10px; }
.ff-up-preview-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-up-preview-close {
  display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: var(--bg); color: var(--muted); cursor: pointer;
}
.ff-up-preview-img { max-width: 100%; max-height: 74vh; object-fit: contain; border-radius: 8px; }
.ff-up-preview-doc { width: min(860px, 80vw); height: 74vh; border: 0; border-radius: 8px; background: #fff; }

.ff-color { display: flex; align-items: center; gap: 10px; }
.ff-color input[type=color] { width: 46px; height: 34px; border: 1px solid var(--border-strong); border-radius: 7px; padding: 2px; background: var(--panel); cursor: pointer; }

.ff-richtext { border: 1px solid var(--ffs-input-border, var(--border-strong)); border-radius: 8px; overflow: hidden; background: var(--ffs-input-bg, transparent); color: var(--ffs-input-color, inherit); }
.ff-richtext-bar { display: flex; gap: 2px; background: color-mix(in srgb, currentColor 6%, transparent); border-bottom: 1px solid var(--ffs-input-border, var(--border)); padding: 4px; }
.ff-richtext-bar button { width: 28px; height: 26px; border-radius: 5px; font-size: 12px; color: inherit; }
.ff-richtext-bar button:hover { background: color-mix(in srgb, currentColor 9%, transparent); }
.ff-richtext-area { padding: 10px 12px; }
.ff-richtext-area:empty::before { content: attr(data-placeholder); color: var(--faint); }
.ff-richtext-area:focus { outline: none; }

.ff-code { position: relative; }
.ff-code textarea { font-family: var(--mono); font-size: 12.5px; background: #0f172a; color: #e2e8f0; border-color: #0f172a; }
.ff-code-lang {
  position: absolute; top: 6px; right: 10px; z-index: 2;
  font-size: 10px; font-weight: 700; text-transform: uppercase; color: #64748b;
}
.ff-map-canvas {
  margin-top: 8px; height: 120px; border-radius: 8px;
  background: repeating-conic-gradient(var(--bg) 0% 25%, var(--panel) 0% 50%) 0 0/24px 24px;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--faint); font-size: 12px;
}
.ff-map-canvas span { font-size: 22px; }

.ff-address { display: flex; flex-direction: column; gap: 8px; }
.ff-address-grid { display: grid; grid-template-columns: 2fr 1.4fr 1fr; gap: 8px; }
.fb-device-mobile .ff-address-grid, .pv-mobile .ff-address-grid { grid-template-columns: 1fr; }

.ff-matrix-wrap { overflow-x: auto; }
.ff-matrix { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ff-matrix th, .ff-matrix td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--border); }
.ff-matrix tbody th { text-align: left; font-weight: 600; }
.ff-matrix thead th { color: var(--muted); font-weight: 600; }
.ff-matrix input { accent-color: var(--accent); width: 15px; height: 15px; }

.ff-product {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 12px 14px;
}
.ff-product-name { font-weight: 600; }
.ff-product-price { font-weight: 800; color: var(--accent-600); }
/* Customer-priced product: the visitor types the amount that is charged. */
.ff-product-amount { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.ff-product-cur { font-weight: 800; color: var(--accent-600); }
.ff-product-amount .ff-input { width: 8rem; max-width: 100%; text-align: right; }
.ff-qty { display: inline-flex; align-items: center; gap: 6px; }
.ff-qty input { width: 70px; text-align: center; }
.ff-qty-btn {
  width: 34px; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 16px; font-weight: 700; color: var(--muted);
}
.ff-qty-btn:hover { background: color-mix(in srgb, currentColor 9%, transparent); }
.ff-coupon { display: flex; gap: 8px; }
.ff-money {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px; color: var(--muted); border-bottom: 1px dashed var(--border);
}
.ff-money-total { border-bottom: 0; color: var(--text); font-size: 15px; }
.ff-money-total strong { color: var(--accent-600); font-size: 17px; }

.ff-gateway { border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.ff-gateway-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.ff-gateway-badge { font-size: 10px; font-weight: 800; color: var(--warning); background: #fffbeb; border: 1px solid #fde68a; border-radius: 5px; padding: 1px 6px; }
.ff-gateway-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ff-gateway-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ff-gateway-note { display: block; padding: 0 12px 10px; color: var(--faint); }
.ff-gateway > .ff-btn { margin: 12px; width: calc(100% - 24px); }

.ff-nps-scale { display: flex; gap: 4px; flex-wrap: wrap; }
.ff-nps-btn {
  width: 34px; height: 34px; border: 1px solid var(--border-strong); border-radius: 7px;
  font-weight: 600; color: var(--muted); transition: all .1s;
}
.ff-nps-btn:hover { border-color: var(--accent); color: var(--accent-600); }
.ff-nps-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ff-nps-labels { display: flex; justify-content: space-between; color: var(--faint); font-size: 11.5px; margin-top: 5px; }
.ff-likert { display: flex; gap: 6px; flex-wrap: wrap; }
.ff-likert-opt {
  flex: 1; min-width: 90px; text-align: center; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 6px; font-size: 12px;
}
.ff-likert-opt:hover { border-color: var(--accent); }
.ff-likert-opt input { position: absolute; opacity: 0; }
.ff-likert-opt:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-600); font-weight: 600; }
.ff-captcha {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 12px 14px; background: var(--bg);
}
.ff-captcha-logo { font-size: 20px; }
.ff-consent span { font-size: 12.5px; color: var(--muted); }

.ff-signature { position: relative; }
.ff-signature-pad {
  width: 100%; height: 120px; border: 1.5px dashed var(--border-strong);
  border-radius: 10px; touch-action: none; cursor: crosshair;
  /* The pad takes the form's input colours; the ink is the input text colour. */
  background: var(--ffs-input-bg, var(--panel)); color: var(--ffs-input-color, var(--text));
}
.ff-signature-clear {
  position: absolute; top: 6px; right: 8px; font-size: 11px; color: var(--faint);
  padding: 2px 8px; border-radius: 5px;
}
.ff-signature-clear:hover { background: color-mix(in srgb, currentColor 9%, transparent); }

.ff-heading { margin: 0; }
.ff-paragraph { margin: 0; color: var(--muted); line-height: 1.55; }
.ff-divider { border: 0; border-top: 1.5px solid var(--border-strong); margin: 8px 0; }
.ff-spacer { display: flex; align-items: center; justify-content: center; border-radius: 6px; }
/* The stripes show the gap while building; on the form it is just space. */
#fb-canvas .ff-spacer { background: repeating-linear-gradient(90deg, transparent 0 8px, color-mix(in srgb, currentColor 7%, transparent) 8px 16px); }
.ff-spacer span { font-size: 10px; color: var(--faint); }
.ff-image-placeholder {
  border: 1.5px dashed var(--border-strong); border-radius: 10px;
  color: var(--faint); text-align: center; padding: 26px 10px; font-size: 12.5px;
}
.ff-html { font-size: 13px; }

/* ================= dnd ================= */

#fb-ghost {
  position: fixed; top: 0; left: 0; z-index: 999; pointer-events: none;
  will-change: transform;
}
.fb-ghost-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--text); color: #fff; font-size: 12.5px; font-weight: 600;
  border-radius: 8px; padding: 7px 13px; box-shadow: var(--shadow-lg);
}
#fb-indicator {
  position: fixed; top: 0; left: 0; z-index: 998; pointer-events: none;
  background: var(--accent); border-radius: 3px;
  box-shadow: 0 0 0 1px #fff, 0 0 8px rgba(99, 102, 241, .6);
  will-change: transform;
}
#fb-indicator[data-dir="vertical"]::before, #fb-indicator[data-dir="horizontal"]::before {
  content: ''; position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px #fff;
}
#fb-indicator[data-dir="horizontal"]::before { left: -4px; top: 50%; transform: translateY(-50%); }
#fb-indicator[data-dir="vertical"]::before { top: -4px; left: 50%; transform: translateX(-50%); }
body.fb-dragging { cursor: grabbing !important; user-select: none; }
body.fb-dragging .fb-field-tools { display: none !important; }

/* ================= inspector ================= */

.ins-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 12px; border-bottom: 1px solid var(--border);
}
.ins-head-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-600); border-radius: 9px;
}
.ins-head-text { flex: 1; min-width: 0; }
.ins-head-text strong { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-head-text small { color: var(--faint); font-size: 11.5px; }
.ins-head-acts { display: flex; gap: 2px; }
/* Field option tabs wrap into a grid that always fits the sidebar — a
   single scrolling row hid the last tabs off the edge. */
.ins-tabs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 4px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.ins-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; padding: 7px 4px 6px; border-radius: 7px;
  color: var(--muted); font-size: 10.5px; font-weight: 600;
  transition: background-color .12s ease, color .12s ease;
}
.ins-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-tab:hover { color: var(--text); background: var(--bg); }
.ins-tab.is-active { color: var(--accent-600); background: var(--accent-soft); }
.ins-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ins-body { flex: 1; overflow-y: auto; padding: 14px; }
.ins-ctl { margin-bottom: 13px; }
.ins-label { display: flex; align-items: center; gap: 6px; justify-content: space-between; font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.ins-input {
  width: 100%; min-height: 33px; padding: 5px 10px;
  border: 1px solid var(--border-strong); border-radius: 7px; background: var(--panel);
  font-size: 12.5px;
}
.ins-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.ins-input { resize: vertical; font-family: inherit; }
.ins-check { display: flex; align-items: center; gap: 8px; padding: 7px 0; cursor: pointer; font-size: 12.5px; font-weight: 500; }
.ins-check input { width: 15px; height: 15px; accent-color: var(--accent); }
.ins-help { color: var(--faint); font-size: 11.5px; line-height: 1.5; margin: 6px 0 12px; }
/* minmax(0, 1fr), not 1fr: a plain fr track cannot shrink below its content,
   so one long label or wide input pushed the sidebar into sideways scrolling. */
.ins-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.ins-3col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ins-2col > *, .ins-3col > *, .dz-2col > * { min-width: 0; }
#fb-side .ins-input, #fb-side select, #fb-side textarea { min-width: 0; max-width: 100%; }
.ins-group { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 10px; overflow: hidden; }
.ins-group summary {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; font-weight: 600; font-size: 12.5px; color: var(--text);
  cursor: pointer; list-style: none; user-select: none;
}
.ins-group summary::-webkit-details-marker { display: none; }
.ins-group-icon {
  width: 26px; height: 26px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; background: var(--bg); color: var(--muted);
}
.ins-group-icon svg { width: 15px; height: 15px; }
.ins-group[open] .ins-group-icon { background: var(--accent-soft); color: var(--accent-600); }
.ins-group-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-group-caret { display: inline-flex; flex-shrink: 0; color: var(--faint); transition: transform .15s ease; }
.ins-group-caret svg { width: 16px; height: 16px; }
.ins-group[open] .ins-group-caret { transform: rotate(180deg); }
.ins-group summary:hover { background: var(--bg); }
.ins-group summary:hover .ins-group-icon { background: var(--panel); }
.ins-group summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ins-group[open] summary { border-bottom: 1px solid var(--border); }
@media (prefers-reduced-motion: reduce) { .ins-group-caret { transition: none; } }
.ins-group-body { padding: 12px 12px 10px; }
.ins-mini { font-size: 10.5px; font-weight: 700; color: var(--accent-600); padding: 2px 6px; border-radius: 5px; }
.ins-mini:hover { background: var(--accent-soft); }
.ins-options { display: flex; flex-direction: column; gap: 6px; }
.ins-opt { display: flex; gap: 5px; align-items: center; }
.ins-opt .ins-input { min-height: 30px; }
.ins-opt-value { max-width: 90px; font-family: var(--mono); font-size: 11px !important; }
/* Priced choices add a fourth control; let the row wrap rather than squeeze
   every input past legibility in a 300px inspector. */
.ins-options.is-priced .ins-opt { flex-wrap: wrap; }
.ins-options.is-priced .ins-opt .ins-input { min-width: 0; }
.ins-options.is-priced .ins-opt-value { max-width: 70px; }
.ins-opt-correct { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none; border-radius: 6px; cursor: pointer; color: var(--muted, #94a3b8); border: 1px solid var(--border, #e2e8f0); }
.ins-opt-correct input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ins-opt-correct svg { width: 14px; height: 14px; }
.ins-opt-correct:has(input:checked) { background: #16a34a; border-color: #16a34a; color: #fff; }
.ins-opt-correct:has(input:focus-visible) { outline: 2px solid var(--accent, #6366f1); outline-offset: 1px; }
.ins-opt-limit { flex: 0 1 56px; max-width: 56px; text-align: right; font-family: var(--mono); font-size: 11px !important; }
.ins-opt-price { flex: 0 1 68px; max-width: 68px; text-align: right; font-family: var(--mono); font-size: 11px !important; }
.ins-opt-move, .ins-opt-del {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 10px;
}
.ins-opt-move:hover { background: var(--bg); color: var(--text); }
.ins-opt-del:hover { background: #fef2f2; color: var(--danger); }
.ins-add {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-600); font-weight: 600; font-size: 12px;
  padding: 6px 10px; border-radius: 7px; border: 1px dashed var(--border-strong);
  justify-content: center;
}
.ins-add:hover { background: var(--accent-soft); border-color: var(--accent); }
.ins-add-sm { padding: 4px 8px; font-size: 11px; margin-top: 6px; }
.ins-rules { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.ins-rule { display: grid; grid-template-columns: 1.1fr 1fr .8fr 24px; gap: 5px; align-items: center; }
.ins-rule .ins-input { min-height: 30px; font-size: 11.5px; padding: 4px 7px; }
.ins-rule-novalue { color: var(--faint); text-align: center; }
.ins-rule-group { border: 1px dashed var(--border-strong); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 7px; }
.ins-rule-group-head { display: flex; gap: 6px; align-items: center; }
.ins-rule-group-head .ins-input { min-height: 30px; }
.ins-rule-adds { display: flex; gap: 8px; }
.ins-logic-summary {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg); border-radius: 8px; padding: 9px 12px;
  color: var(--faint); font-size: 12px; margin: 4px 0 12px;
}
.ins-logic-summary.is-on { background: #fffbeb; color: var(--warning); font-weight: 600; }
.ins-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.ins-preset {
  display: flex; gap: 3px; height: 34px; padding: 5px;
  border: 1px solid var(--border-strong); border-radius: 7px;
}
.ins-preset span { background: var(--border); border-radius: 3px; height: 100%; }
.ins-preset:hover { border-color: var(--accent); }
.ins-preset.is-active { border-color: var(--accent); background: var(--accent-soft); }
.ins-preset.is-active span { background: var(--accent); }
.ins-ntf { border: 1px solid var(--border); border-radius: 9px; padding: 10px; margin-bottom: 9px; }
.ins-ntf-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ins-ntf-list { display: flex; flex-direction: column; }
/* Email templates, merge tags, design and preview */
.ins-ntf-tpl { margin-bottom: 8px; padding: 8px; border-radius: 8px; background: var(--accent-soft); }
.ins-ntf-tpl .ins-label { margin-top: 0; color: var(--accent-600); }
.ins-ntf-msg { min-height: 110px; resize: vertical; line-height: 1.5; }
.ins-ntf-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0 8px; }
.ins-ntf-tags-h { font-size: 10.5px; font-weight: 700; color: var(--faint); margin-inline-end: 2px; }
.ins-tag { padding: 2px 8px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel); color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.5; cursor: pointer; }
.ins-tag.is-field { color: var(--accent-600); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.ins-tag:hover, .ins-tag:focus-visible { border-color: var(--accent); color: var(--accent-600); background: var(--accent-soft); }
.ins-ntf-more { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
.ins-ntf-more summary { cursor: pointer; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 3px 0; }
.ins-ntf-more[open] summary { margin-bottom: 4px; }
.ins-ntf-color { display: flex; align-items: center; gap: 8px; }
.ins-ntf-color input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }
.ins-ntf-preview { width: 100%; justify-content: center; margin-top: 10px; }
.ins-ntf-designs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; margin-top: 4px; border-radius: 9px; background: var(--bg); }
.ins-ntf-designs button { padding: 6px 4px; border-radius: 7px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ins-ntf-designs button[aria-checked="true"] { background: var(--panel); color: var(--accent-600); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.ins-ntf-designer { width: 100%; justify-content: center; margin: 2px 0 4px; }
.ins-ep { padding: 0 !important; }
.ins-ep-loading { display: flex; align-items: center; gap: 8px; padding: 24px; color: var(--muted); }
.ins-ep-meta { margin: 0; padding: 12px 18px; display: grid; gap: 4px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.ins-ep-meta div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.ins-ep-meta dt { color: var(--faint); font-weight: 600; }
.ins-ep-meta dd { margin: 0; overflow-wrap: anywhere; }
.ins-ep-frame-wrap { padding: 10px; background: #f3f4f6; text-align: center; }
.ins-ep-sizes { display: inline-flex; gap: 2px; padding: 2px; margin-bottom: 8px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); }
.ins-ep-sizes button { padding: 3px 10px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ins-ep-sizes button.is-on { background: var(--accent-soft); color: var(--accent-600); }
.ins-ep-frame { display: block; width: 100%; height: 520px; margin: 0 auto; border: 0; border-radius: 8px; background: #f3f4f6; transition: width .15s; }
.ins-ep > .ins-help { padding: 8px 18px 14px; margin: 0; }

/* ================= context menu ================= */

.fb-ctx {
  position: fixed; z-index: 300; min-width: 210px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px;
}
.fb-ctx button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 10px; border-radius: 6px; font-size: 12.5px; text-align: left;
}
.fb-ctx button:hover:not(:disabled) { background: var(--bg); }
.fb-ctx button:disabled { opacity: .4; cursor: default; }
.fb-ctx button kbd { margin-left: auto; }
.fb-ctx button.is-danger { color: var(--danger); }
.fb-ctx button.is-danger:hover { background: #fef2f2; }
.fb-ctx hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }

/* ================= command palette ================= */

.ck-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(16, 24, 40, .4); backdrop-filter: blur(2px);
  display: flex; justify-content: center; padding-top: 12vh;
}
.ck-box {
  width: min(560px, 92vw); height: fit-content;
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg);
  overflow: hidden; animation: ck-in .14s ease;
}
@keyframes ck-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.ck-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--faint); }
.ck-input { flex: 1; border: 0; outline: none; font-size: 15px; background: none; }
.ck-list { max-height: 340px; overflow-y: auto; padding: 6px; }
.ck-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.ck-item.is-active { background: var(--accent-soft); color: var(--accent-600); }
.ck-item kbd { margin-left: auto; }
.ck-icon { display: inline-flex; color: var(--faint); }
.ck-item.is-active .ck-icon { color: var(--accent-600); }
.ck-empty { text-align: center; color: var(--faint); padding: 26px; }
.ck-foot {
  display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border);
  color: var(--faint); font-size: 11.5px;
}

/* ================= modals ================= */

.md-overlay {
  position: fixed; inset: 0; z-index: 350;
  background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.md-box {
  width: 100%; max-height: 86vh; max-height: 86dvh; overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: ck-in .15s ease;
}
/* A dialog on a phone: less gutter, a taller box, and a footer whose buttons
   stack rather than being pushed off the edge. */
@media (max-width: 560px) {
  .md-overlay { padding: 10px; align-items: flex-end; }
  .md-box { max-height: 92vh; max-height: 92dvh; border-radius: 14px 14px 10px 10px; }
  .md-head { padding: 14px 14px 10px; }
  .md-body { padding: 4px 14px 14px; }
  .md-foot { padding: 0 14px 14px; flex-wrap: wrap; }
  .md-foot .ff-btn { flex: 1 1 auto; justify-content: center; }
  .md-grid { grid-template-columns: 1fr; }
}
.md-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; font-size: 15px;
}
.md-head strong { display: inline-flex; align-items: center; gap: 8px; }
.md-body { padding: 4px 18px 16px; }
.md-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 16px; }
.md-note { color: var(--muted); font-size: 12.5px; line-height: 1.55; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.md-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; padding-bottom: 18px; }
.md-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  border: 1px solid var(--border); border-radius: 11px; padding: 14px;
  text-align: left; transition: border-color .12s, box-shadow .12s;
}
.md-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.md-card small { color: var(--faint); }
.md-card-icon { color: var(--accent-600); display: inline-flex; }
.md-card-icon svg { width: 22px; height: 22px; }
.md-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.md-chip {
  font-size: 11.5px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 11px;
}
.md-chip:hover { border-color: var(--accent); color: var(--accent-600); background: var(--accent-soft); }
.md-chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-600); background: var(--accent-soft); font-weight: 600; }
.md-chip span { color: var(--faint); font-weight: 500; margin-left: 2px; }
.md-group-title { margin: 6px 0 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.md-ai-result { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 10px 0; background: var(--bg); }
.md-ai-head { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.md-ai-head small { color: var(--faint); }
.md-ai-result ul { margin: 0 0 10px; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.md-ai-actions { display: flex; gap: 8px; }
.md-drop {
  display: block; border: 1.5px dashed var(--border-strong); border-radius: 10px;
  padding: 20px; text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 8px;
}
.md-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.md-drop.is-dragover,
[data-ff-dropzone].is-dragover {
  border-color: var(--accent); background: var(--accent-soft); border-style: solid;
  outline: 2px dashed var(--accent); outline-offset: -6px;
}
.md-keys { width: 100%; border-collapse: collapse; }
.md-keys td { padding: 7px 6px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.md-keys td:first-child { width: 45%; }
.md-presence { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.md-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 12px; border-radius: 99px;
  background: var(--c, var(--accent)); color: #fff; font-size: 12px; font-weight: 700;
}
.md-avatar-ghost { background: var(--bg); color: var(--faint); border: 1.5px dashed var(--border-strong); width: 30px; padding: 0; }

/* ================= toasts ================= */

#fb-toasts {
  position: fixed; bottom: 18px; right: 18px; z-index: 500;
  display: flex; flex-direction: column; gap: 8px;
}
.fb-toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--text); color: #fff; font-size: 12.5px; font-weight: 500;
  border-radius: 10px; padding: 10px 15px; box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease;
}
.fb-toast.is-success svg { color: #4ade80; }
.fb-toast.is-error svg { color: #f87171; }
.fb-toast.is-info svg { color: #a5b4fc; }
.fb-toast.is-out { opacity: 0; transform: translateY(6px); transition: all .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ================= preview ================= */

.pv-overlay {
  position: fixed; inset: 0; z-index: 320;
  background: rgba(16, 24, 40, .55); backdrop-filter: blur(3px);
  display: flex; align-items: stretch; justify-content: center; padding: 18px;
}
.pv-chrome {
  display: flex; flex-direction: column; width: 100%; max-width: 1200px;
  background: var(--bg); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.pv-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 10px 14px; gap: 10px;
}
.pv-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; }
/* Device sizes: one row of equal icon buttons in a segmented track; the
   active width range reads once, on one line, beside it. */
.pv-bar-center { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pv-seg {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.pv-dev {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 28px; padding: 0; border-radius: 7px; color: var(--muted);
}
.pv-dev svg { width: 16px; height: 16px; }
.pv-dev:hover { background: var(--panel); color: var(--text); }
.pv-dev.is-active { background: var(--panel); color: var(--accent-600); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.pv-dev:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pv-dev-size {
  min-width: 78px; text-align: center; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) { .pv-dev-size { display: none; } }
.pv-close { display: inline-flex; padding: 6px; border-radius: 7px; color: var(--muted); }
.pv-close:hover { background: var(--bg); }
.pv-stage { flex: 1; overflow-y: auto; display: flex; justify-content: center; padding: 26px 16px; }
/* Width, padding and every responsive rule now live in styles/form.css, which
   drives the rendered form from its own container width. Only the frame's
   chrome remains here. */
.pv-frame {
  width: 100%; height: fit-content;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-md);
  padding: var(--ff-pad, 34px);
}
.pv-frame.pv-dark { background: #16181d; color: #e5e7eb; }
.pv-frame.pv-dark { --panel: #1e2128; --bg: #23262e; --border: #333845; --border-strong: #414759; --text: #e5e7eb; --muted: #9ca3af; --faint: #6b7280; --accent-soft: rgba(99, 102, 241, .18); }
.pv-form-head h1 { margin: 0 0 6px; font-size: 23px; letter-spacing: -.02em; }
.pv-form-head p { margin: 0 0 8px; color: var(--muted); }
.pv-page-title { font-size: 16px; margin: 18px 0 4px; }
.pv-fields { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.pv-row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; margin-bottom: 8px; }
.pv-field { margin-bottom: 6px; }
.pv-field.is-logic-hidden { display: none; }
.pv-row:has(> .pv-col > .pv-field):not(:has(> .pv-col > .pv-field:not(.is-logic-hidden))) { display: none; }
.pv-label { display: flex; align-items: center; gap: 5px; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.pv-help { color: var(--faint); font-size: 12px; margin-top: 5px; }
.pv-error { color: var(--danger); font-size: 12px; font-weight: 500; margin-top: 5px; }
.pv-field.has-error .ff-input, .pv-field.has-error .ff-signature-pad { border-color: var(--danger); }
.pv-field.has-error .ff-input:focus { box-shadow: 0 0 0 3px rgba(229, 72, 77, .15); }
/* The honeypot is hidden by its wrapper (.pv-hp-wrap in styles/form.css), which
   clips instead of pushing a box off-screen — off-screen boxes can still create
   horizontal overflow in a host page. */
.pv-hp { width: 100%; }
.pv-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; gap: 10px; }
.pv-footer-right { display: flex; gap: 8px; }
.pv-progress { margin: 14px 0 6px; }
.pv-progress-bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.pv-progress-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.pv-progress small { color: var(--faint); display: block; margin-top: 5px; }
.pv-steps { display: flex; align-items: center; margin: 16px 0 8px; }
.pv-step { display: flex; align-items: center; gap: 7px; }
.pv-step-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border-strong);
  font-size: 12px; font-weight: 700; color: var(--muted); flex-shrink: 0;
}
.pv-step.is-active .pv-step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.pv-step.is-done .pv-step-dot { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-600); }
.pv-step-dot svg { width: 14px; height: 14px; }
.pv-step-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.pv-step.is-active .pv-step-label { color: var(--text); }
.pv-step-line { flex: 1; height: 1.5px; background: var(--border-strong); margin: 0 10px; min-width: 18px; }
.pv-breadcrumb { color: var(--faint); font-size: 12.5px; margin: 14px 0 4px; }
.pv-breadcrumb .is-active { color: var(--accent-600); font-weight: 700; }
.pv-section { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 10px; }
.pv-section-card { background: var(--bg); }
.pv-section-title { font-weight: 700; margin-bottom: 10px; display: flex; flex-direction: column; }
.pv-section-title small { color: var(--faint); font-weight: 400; }
.pv-repeater { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 14px; }
.pv-repeat-group { position: relative; border-bottom: 1px dashed var(--border); padding: 4px 0 10px; margin-bottom: 10px; }
.pv-repeat-del { position: absolute; top: 2px; right: 0; color: var(--faint); padding: 3px; border-radius: 5px; }
.pv-repeat-del:hover { color: var(--danger); background: #fef2f2; }
.pv-success { text-align: center; padding: 40px 20px; }
.pv-success-icon {
  width: 62px; height: 62px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: #dcfce7; color: var(--success); font-size: 30px; font-weight: 800; border-radius: 50%;
}
.pv-success-icon svg { width: 30px; height: 30px; stroke-width: 2; }
.pv-success h2 { margin: 0 0 8px; }
.pv-success p { color: var(--muted); }
.pv-success-note { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; }
.pv-success-note.is-error { color: var(--danger); }
.ff-density-compact .pv-field { margin-bottom: 2px; }
.ff-density-compact .ff-input { min-height: 33px; }
.ff-labels-left .pv-field:not(.pv-type-heading):not(.pv-type-paragraph) { display: grid; grid-template-columns: 160px 1fr; gap: 4px 14px; align-items: start; }
.ff-labels-left .pv-label { margin-top: 9px; }
.ff-labels-left .pv-help, .ff-labels-left .pv-error { grid-column: 2; }

/* ================= print ================= */

@media print {
  #app, #fb-toasts { display: none !important; }
  .pv-overlay { position: static; background: none; padding: 0; }
  .pv-chrome { box-shadow: none; background: #fff; }
  .pv-bar, .pv-footer { display: none !important; }
  .pv-stage { overflow: visible; padding: 0; }
  .pv-frame { box-shadow: none; max-width: 100%; }
  body { overflow: visible; }
}

/* ================= responsive builder chrome ================= */

@media (max-width: 760px) {
  .tb-title { display: none; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* high contrast */
@media (prefers-contrast: more) {
  :root { --border: #98a2b3; --border-strong: #667085; --faint: #475467; }
}

/* ================= design panel (styling customizer) ================= */

.dz-nav {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px;
  padding: 8px; border-bottom: 1px solid var(--border);
  max-height: 176px; overflow-y: auto;
}
.dz-nav-btn {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  padding: 7px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  color: var(--muted); text-align: left;
}
.dz-nav-btn svg { flex-shrink: 0; }
.dz-nav-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-nav-btn:hover { background: var(--bg); color: var(--text); }
.dz-nav-btn.is-active { background: var(--accent-soft); color: var(--accent-600); }
.dz-nav-btn.is-off { color: var(--faint); }

.dz-body { padding: 12px 14px 40px; min-width: 0; }
.dz-ctl { margin-bottom: 12px; }
.dz-label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.dz-h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 20px 0 10px; }
.dz-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }

.dz-color { display: flex; align-items: center; gap: 6px; }
.dz-color input[type="color"] {
  width: 34px; height: 30px; padding: 2px; flex-shrink: 0;
  border: 1px solid var(--border-strong); border-radius: 7px; background: var(--panel); cursor: pointer;
}
.dz-color-text { min-height: 30px !important; font-family: var(--mono); font-size: 11px !important; }
.dz-clear { display: inline-flex; color: var(--faint); padding: 3px; border-radius: 5px; flex-shrink: 0; }
.dz-clear:hover { color: var(--danger); background: #fef2f2; }

.dz-range { display: flex; align-items: center; gap: 8px; }
.dz-range input[type="range"] { flex: 1; accent-color: var(--accent); min-width: 0; }
.dz-range input[type="number"] { max-width: 68px; min-height: 30px; }
.dz-range em { font-style: normal; color: var(--faint); font-size: 10.5px; }

.dz-seg { display: inline-flex; background: var(--bg); border-radius: 8px; padding: 2px; gap: 1px; }
.dz-seg-btn { padding: 5px 11px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.dz-seg-btn.is-active { background: var(--panel); color: var(--accent-600); box-shadow: var(--shadow-sm); }

.dz-group { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 9px; }
.dz-group summary {
  padding: 9px 12px; font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; user-select: none;
}
.dz-group summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dz-group summary::-webkit-details-marker { display: none; }
.dz-group summary::after { content: ""; width: 16px; height: 16px; flex-shrink: 0; background-color: var(--faint); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 16px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 16px no-repeat; transition: transform .15s ease; }
.dz-group[open] summary::after { transform: rotate(180deg); }
.dz-group summary:hover { background: var(--bg); }
.dz-group-body { padding: 4px 12px 10px; }

.dz-resp { display: grid; gap: 8px; margin-bottom: 14px; }
.dz-resp-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 9px; background: var(--bg); border: 1px solid var(--border); }
.dz-resp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0;
  height: 30px; padding: 0 6px; border-radius: 7px; color: var(--muted);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.dz-resp-btn svg { width: 15px; height: 15px; flex: none; }
.dz-resp-btn span { overflow: hidden; text-overflow: ellipsis; }
.dz-resp-btn:hover { color: var(--text); }
.dz-resp-btn.is-active { background: var(--panel); color: var(--accent-600); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.dz-resp-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dz-resp-note { display: flex; gap: 6px; align-items: flex-start; margin: 0; padding: 7px 9px; border-radius: 8px; font-size: 11.5px; line-height: 1.45; color: var(--text); background: color-mix(in srgb, var(--warning) 12%, transparent); }
.dz-resp-note svg { width: 14px; height: 14px; flex: none; margin-top: 1px; color: var(--warning); }

/* Theme cards wrap to one column in a narrow panel, two or more when wider. */
.dz-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; margin-bottom: 14px; }
.dz-theme {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px;
  font-size: 12px; font-weight: 600; text-align: left;
}
.dz-theme:hover { border-color: var(--accent); }
.dz-theme.is-active { border-color: var(--accent); background: var(--accent-soft); }
.dz-theme-chip { display: inline-flex; gap: 3px; flex-shrink: 0; }
.dz-theme-chip i { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
.dz-theme strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dz-off { text-align: center; padding: 40px 18px; }
.dz-off-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(120deg, rgba(245,158,11,.15), rgba(249,115,22,.15));
  color: #d97706; margin-bottom: 12px;
}
.dz-off-icon svg { width: 22px; height: 22px; }
.dz-off h3 { margin: 0 0 6px; font-size: 14px; }
.dz-off p { color: var(--muted); font-size: 12.5px; line-height: 1.55; }

.dz-css { position: relative; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.dz-css-hl, .dz-css-input {
  margin: 0; padding: 10px 12px; font: 12px/1.55 var(--mono);
  min-height: 180px; max-height: 320px; width: 100%; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.dz-css-hl { position: absolute; inset: 0; pointer-events: none; color: #6b7280; background: #0f172a; }
.dz-css-hl .s { color: #7dd3fc; font-style: normal; }
.dz-css-hl .v { color: #bef264; font-style: normal; }
.dz-css-hl .b { color: #f9a8d4; font-style: normal; }
.dz-css-hl .c { color: #64748b; font-style: italic; }
.dz-css-input { position: relative; background: transparent; color: transparent; caret-color: #fff; border: 0; resize: vertical; }
.dz-css-input:focus { outline: none; }
.dz-css-status { font-size: 11.5px; color: var(--success); margin-top: 7px; }
.dz-css-status.is-err { color: var(--danger); }
.dz-varlist code { display: inline-block; margin: 2px 3px 2px 0; font-size: 10.5px; }

.dz-preset-new { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.dz-preset-new .ins-input { flex: 1 1 180px; }
.dz-presets { display: flex; flex-direction: column; gap: 8px; }
.dz-preset {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
}
.dz-preset-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.dz-preset-acts { display: inline-flex; gap: 3px; align-items: center; }


/* ==========================================================================
   RESPONSIVE — application chrome
   --------------------------------------------------------------------------
   The builder is a three-column desktop tool. It cannot become three columns
   on a phone, so below the laptop breakpoint the palette, tree and inspector
   become overlay drawers and the canvas takes the full width. Nothing is
   removed: every panel is still reachable from the toolbar.

   Breakpoints follow the standard set: 1200 / 992 / 768.
   ========================================================================== */

/* ---- Laptop: tighten the side panels, keep all three columns ------------- */


/* ---- Tablet: panels become overlays over a full-width canvas ------------- */
@media (max-width: 991px) {
  /* The sidebar becomes a drawer over a full-width canvas; the toolbar's
     panel button opens it and the backdrop closes it. */
  #fb-side {
    position: absolute;
    top: var(--tb-h);
    bottom: 0;
    left: 0;
    width: min(360px, 88vw);
    z-index: 40;
    box-shadow: var(--shadow-lg);
    transition: transform var(--dur-base, 180ms) var(--ease, ease);
  }
  /* Hidden once it has slid away, so keyboard focus cannot land inside it. */
  #fb-side.is-closed {
    transform: translateX(-101%); box-shadow: none; visibility: hidden;
    transition: transform var(--dur-base, 180ms) var(--ease, ease), visibility 0s linear var(--dur-base, 180ms);
  }
  .fb-side-resize { display: none; }
  #fb-topbar .tb-panel-btn { display: inline-flex; }
  #fb-canvas-wrap { width: 100%; }
}

/* ---- Mobile: full-width drawers, larger touch targets ------------------- */
@media (max-width: 767px) {
  :root { --tb-h: 56px; }

  #fb-topbar { -webkit-overflow-scrolling: touch; }
  .tb-left, .tb-right { flex-shrink: 0; }

  /* The device-preview switcher is a desktop affordance; the preview itself
     still offers every size from its own bar. */
  .tb-devices { display: none; }

  #fb-side { width: min(380px, 94vw); }
  #fb-pagebar { overflow-x: auto; scrollbar-width: thin; }
}

/* ---- Touch: the 44px minimum, wherever the pointer is coarse ------------ */
@media (pointer: coarse), (max-width: 767px) {
  .tb-btn,
  .tb-save,
  .fb-tool {
    min-height: 44px;
    min-width: 44px;
    padding-inline: 10px;
  }
  .tb-btn svg,
  .fb-tool svg { width: 18px; height: 18px; }
  .tb-sep { margin-inline: 4px; }

  .ff-btn,
  .ins-input,
  #fb-topbar select,
  #fb-pagebar button { min-height: 44px; }

  .fb-side-tab { min-height: 52px; }
}

/* ---- Very small screens: nothing may push the layout wider -------------- */
@media (max-width: 400px) {
  #fb-topbar { padding-inline: 8px; gap: 4px; }
  .tb-title { display: none; }
  #fb-side { width: 100vw; }
}

/* Dragging out of an overlay drawer.

   Below 992px the palette sits *on top of* the canvas. The drag engine finds
   its drop target with document.elementFromPoint(), so mid-drag that call hits
   the drawer and there is nowhere to drop — the gesture starts but can never
   complete. Making the drawers pointer-transparent while a drag is in flight
   lets the canvas beneath receive the drop, without touching the engine. */
@media (max-width: 991px) {
  body.fb-dragging .fb-side-scrim { display: none; }
  body.fb-dragging #fb-side {
    pointer-events: none;
    opacity: .38;
    transition: opacity var(--dur-fast, 120ms) var(--ease, ease);
  }
  body.fb-dragging #fb-body::after { opacity: 0; }
}

/* A drawer sitting over the canvas needs a backdrop, or a tap meant for the
   drawer lands on the canvas behind it. */
@media (max-width: 991px) {
  #fb-body { position: relative; }
  #fb-body::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, .32);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-base, 180ms) var(--ease, ease);
    z-index: 35;
  }
  #fb-body:has(#fb-side:not(.is-closed))::after { opacity: 1; }
  .fb-side-scrim { display: block; position: absolute; inset: 0; z-index: 36; }
  #fb-side.is-closed ~ .fb-side-scrim { display: none; }
}

/* Rows palette: a small picture of the column split. */
.fb-pal-rowprev { display: flex; gap: 3px; width: 34px; height: 16px; background: none; }
.fb-pal-rowprev i { display: block; min-width: 0; border: 1.5px solid currentColor; border-radius: 3px; }
/* Delete a row (shown with the grip). */
.fb-row-del {
  position: absolute; top: 4px; right: -30px; width: 24px; height: 24px; display: none;
  align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel); color: var(--muted); cursor: pointer; padding: 0;
}
.fb-row-del svg { width: 13px; height: 13px; }
.fb-row:hover > .fb-row-del, .fb-row-del:focus-visible { display: inline-flex; }
.fb-row-del:hover { color: var(--danger); border-color: var(--danger); }
/* Keep the row "hovered" across the gutters, so the grip (left) and delete
   (right) buttons stay reachable as the pointer moves out to them. */
.fb-row::before { content: ''; position: absolute; top: 0; bottom: 0; left: -34px; right: -34px; }

/* Opening a form: cover the builder until that form has loaded. */
.fb-form-loading { display: none; }
#app.is-form-loading { position: relative; }
#app.is-form-loading > .fb-form-loading {
  display: flex; position: absolute; inset: 0; z-index: 500; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: var(--muted); font-size: 13px; font-weight: 500;
}

/* ---------- Design → General: margins & padding box, background image ---------- */
.dz-sub { margin: 16px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dz-box { font-size: 10.5px; }
.dz-box-margin, .dz-box-padding {
  position: relative; display: grid; grid-template-columns: 52px 1fr 52px; grid-template-rows: 34px 1fr 34px;
  align-items: center; justify-items: center; border-radius: 8px;
}
.dz-box-margin { padding: 2px; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); border: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent); }
.dz-box-padding { grid-column: 2; grid-row: 2; width: 100%; background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.dz-box-t { grid-column: 2; grid-row: 1; }
.dz-box-b { grid-column: 2; grid-row: 3; }
.dz-box-l { grid-column: 1; grid-row: 2; }
.dz-box-r { grid-column: 3; grid-row: 2; }
.dz-box-core { grid-column: 2; grid-row: 2; width: 100%; padding: 12px 6px; border-radius: 5px; background: var(--panel); border: 1px solid var(--border); text-align: center; color: var(--muted); font-weight: 600; }
.dz-box-tag { position: absolute; top: 4px; left: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-600); font-size: 9.5px; pointer-events: none; }
.dz-box-in {
  width: 44px; height: 26px; padding: 0 4px; text-align: center; font: inherit; font-size: 12px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); -moz-appearance: textfield;
}
.dz-box-in::-webkit-inner-spin-button, .dz-box-in::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.dz-box-in:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.dz-box-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 4px; }
.dz-box-foot .ins-help { margin: 0; flex: 1 1 auto; }
.dz-link { display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; border: 0; background: none; color: var(--accent-600); font-size: 12px; cursor: pointer; }
.dz-link svg { width: 12px; height: 12px; }
.dz-link:hover { text-decoration: underline; }
.dz-bgimg { display: flex; gap: 10px; align-items: stretch; margin-bottom: 10px; }
.dz-bgimg-thumb {
  flex: 0 0 76px; height: 76px; border-radius: 8px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center;
  color: var(--faint); background: var(--bg) center / cover no-repeat;
}
.dz-bgimg-side { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.dz-bgimg-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.dz-pos { display: inline-grid; grid-template-columns: repeat(3, 26px); gap: 3px; padding: 3px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.dz-pos-btn { width: 26px; height: 22px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 5px; background: transparent; cursor: pointer; }
.dz-pos-btn i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.dz-pos-btn:hover { background: var(--panel); }
.dz-pos-btn.is-active { background: var(--panel); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.dz-pos-btn.is-active i { background: var(--accent-600); width: 8px; height: 8px; }

/* Range + number pair: the number box keeps its size so the slider is usable. */
.dz-range input.ins-input[type="number"] { flex: 0 0 62px; width: 62px; max-width: 62px; padding-inline: 6px; }
/* A colour that is not set: a checkerboard, so it never reads as black. */
.dz-color input[type="color"].is-empty { background: repeating-conic-gradient(#d0d5dd 0 25%, #fff 0 50%) 0 0 / 8px 8px; }
.dz-color input[type="color"].is-empty::-webkit-color-swatch { opacity: 0; }
.dz-color input[type="color"].is-empty::-moz-color-swatch { opacity: 0; }
.dz-box-foot .ins-help { flex-basis: 100%; }

/* ---------- Style bar above the canvas (theme, accent, width, bg, shadow, padding) ---------- */
.fb-stylebar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px;
  width: fit-content; max-width: calc(100% - 32px); margin: 14px auto 0; padding: 5px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-sm, 0 1px 2px rgba(16,24,40,.06));
  font-size: 12px; color: var(--text);
}
.fb-stylebar .sb-item { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px; border-radius: 8px; }
.fb-stylebar .sb-item + .sb-item { border-inline-start: 1px solid var(--border); padding-inline-start: 10px; border-radius: 0; }
.fb-stylebar .sb-tag { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; }
.fb-stylebar .sb-tag svg, .fb-stylebar .sb-more svg { width: 14px; height: 14px; }
.fb-stylebar .sb-select, .fb-stylebar .sb-num {
  height: 28px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); font: inherit; font-size: 12px;
}
.fb-stylebar .sb-num { width: 64px; font-variant-numeric: tabular-nums; }
.fb-stylebar .sb-select:focus, .fb-stylebar .sb-num:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.fb-stylebar input[type="color"] { width: 28px; height: 28px; padding: 2px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); cursor: pointer; }
.fb-stylebar input[type="color"].is-empty { background: repeating-conic-gradient(#d0d5dd 0 25%, #fff 0 50%) 0 0 / 8px 8px; }
.fb-stylebar input[type="color"].is-empty::-webkit-color-swatch { opacity: 0; }
.fb-stylebar .sb-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.fb-stylebar .sb-item.sb-seg { padding-inline-start: 2px; border-inline-start-width: 1px; border-radius: 8px; margin-inline-start: 4px; }
.fb-stylebar .sb-seg button { min-width: 28px; height: 24px; padding: 0 7px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.fb-stylebar .sb-seg button:hover { color: var(--text); }
.fb-stylebar .sb-seg button.is-on { background: var(--panel); color: var(--accent-600); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.fb-stylebar .sb-shadow { display: block; width: 14px; height: 12px; border-radius: 3px; background: var(--panel); border: 1px solid var(--border); }
.fb-stylebar .sb-shadow-light { box-shadow: 0 2px 3px rgba(16,24,40,.18); }
.fb-stylebar .sb-shadow-dark { box-shadow: 0 3px 6px rgba(16,24,40,.55); }
.fb-stylebar .sb-more { border: 0; background: transparent; color: var(--accent-600); font: inherit; font-weight: 600; cursor: pointer; }
.fb-stylebar .sb-more:hover { text-decoration: underline; }
@media (max-width: 900px) { .fb-stylebar .sb-tag span, .fb-stylebar .sb-more span { display: none; } }
/* The canvas page follows the form width set here or in Design → General. */
:where(#fb-canvas) .fb-page { max-width: var(--ffs-form-max-w, 760px); }

/* ---------- Structure: drag to reorder ---------- */
#fb-tree { position: relative; }
.fb-tree-item[data-drag] { cursor: grab; touch-action: none; }
.fb-tree-grip { display: inline-flex; width: 12px; margin-inline-end: -2px; color: var(--faint); opacity: 0; transition: opacity .12s; }
.fb-tree-grip svg { width: 12px; height: 12px; }
.fb-tree-item:hover .fb-tree-grip, .fb-tree-item.is-selected .fb-tree-grip { opacity: 1; }
@media (hover: none) { .fb-tree-grip { opacity: 1; } }
.fb-tree-item.is-dragging { opacity: .45; }
.fb-tree-item.is-drop-inside { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); border-radius: 6px; }
.fb-tree-dropline { position: absolute; right: 10px; height: 2px; border-radius: 2px; background: var(--accent); pointer-events: none; z-index: 2; }
.fb-tree-dropline::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.fb-tree-ghost {
  position: fixed; left: 0; top: 0; z-index: 10000; pointer-events: none; max-width: 240px; padding: 5px 10px;
  border-radius: 7px; background: var(--text); color: var(--panel); font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 8px 24px rgba(16, 24, 40, .25);
}
body.fb-tree-dragging, body.fb-tree-dragging * { cursor: grabbing !important; user-select: none !important; }

/* The style bar stays at the top of the canvas while it scrolls. */
.fb-stylebar { position: sticky; top: 0; z-index: 6; border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 0; border-top: 0; }

/* Hidden field on the canvas: a quiet chip in the form's own text colour. */
.ff-hidden-chip { color: var(--ffs-label-color, var(--muted)); display: inline-block; padding: 4px 10px; border-radius: 6px; font: 12px/1.4 var(--mono, ui-monospace, monospace); background: color-mix(in srgb, currentColor 8%, transparent); border: 1px dashed color-mix(in srgb, currentColor 30%, transparent); opacity: .85; }
/* Each field keeps its padding inside its own box, and the box extends outward
   by that padding (+ border), so field content lines up with the form title
   and the Submit button — exactly where it sits on the live form. */
#fb-canvas .fb-col:first-child > .fb-field { margin-inline-start: -11px; }
#fb-canvas .fb-col:last-child > .fb-field { margin-inline-end: -11px; }
.fb-stylebar .sb-unit { color: var(--faint); font-size: 11px; margin-inline-start: -2px; }

/* ---------- Toolbar: Tools menu (modules grouped by purpose) ---------- */
.tb-btn-label { display: inline-flex; align-items: center; gap: 6px; padding-inline: 10px 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.tb-btn-label svg:last-child { width: 14px; height: 14px; opacity: .6; }
.tb-btn-label[aria-expanded="true"] { background: var(--bg); }
.tb-tools-menu { min-width: 236px; padding: 6px; }
.tb-menu-group + .tb-menu-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.tb-menu-group .tb-menu-title { padding: 6px 10px 4px; }
.tb-tools-menu button { display: flex; align-items: center; gap: 10px; width: 100%; }
.tb-tools-menu button svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.tb-tools-menu button:hover svg, .tb-tools-menu button:focus-visible svg { color: var(--accent-600); }
.tb-menu kbd { margin-inline-start: auto; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; font: 11px var(--mono, ui-monospace, monospace); color: var(--muted); background: var(--bg); }
@media (max-width: 760px) { .tb-btn-label span { display: none; } }

/* Stacked columns are full width, so their fields line up on both edges. */
#fb-canvas .fb-cols.is-stacked > .fb-col > .fb-field { margin-inline: -11px; }
/* Margins & padding box: fits any sidebar width (the panel is resizable). */
.dz-box-margin, .dz-box-padding { grid-template-columns: 42px minmax(0, 1fr) 42px; grid-template-rows: 32px auto 32px; }
.dz-box-in { width: 38px; padding: 0 2px; }
.dz-box-core { min-width: 0; padding: 10px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-box-tag { font-size: 9px; }
.dz-box { container-type: inline-size; }
@container (max-width: 250px) { .dz-box-tag { display: none; } }

/* ---------- Field option tabs: one row, More / Less below ---------- */
.ins-tabs.is-collapsed { max-height: 56px; overflow: hidden; }
.ins-tabs-more {
  display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%;
  padding: 5px 10px 6px; margin-top: -4px; border: 0; border-bottom: 1px solid var(--border);
  background: none; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.ins-tabs-more:hover { color: var(--accent-600); }
.ins-tabs-more svg { width: 13px; height: 13px; transition: transform .15s; }
.ins-tabs-more.is-open svg { transform: rotate(180deg); }
.ins-tabs-more[hidden] { display: none; }
.ins-tabs:has(+ .ins-tabs-more:not([hidden])) { border-bottom: 0; }
.dz-nav.is-collapsed, .ins-tabs.is-collapsed { overflow: hidden; }
.dz-nav + .ins-tabs-more { margin-top: 0; }
/* The section menu shows all its rows when open (More / Less handles length). */
.dz-nav { max-height: none; overflow: visible; }
.dz-nav:has(+ .ins-tabs-more:not([hidden])) { border-bottom: 0; }

/* ---------- Generate with AI ---------- */
.md-note > span { flex: 1 1 0; min-width: 0; }
.md-note kbd { padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; font: 11px var(--mono, ui-monospace, monospace); background: var(--bg); }
.md-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.md-ai-fields { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 4px; }
.md-ai-fields span { padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
.md-ai-undo { color: var(--faint); font-size: 11.5px; }
.md-ai-error { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-radius: 8px; background: #fef2f2; color: #b42318; font-size: 13px; }
.md-ai-error svg { width: 15px; height: 15px; flex-shrink: 0; }


/* =====================================================================
 * Professional polish: scrollbars, design-panel controls, slider,
 * colour picker. Scoped to the builder chrome — never the form itself.
 * ===================================================================== */

/* Slim scrollbars everywhere in the app (the form canvas keeps its own). */
@supports selector(::-webkit-scrollbar) {
  #app ::-webkit-scrollbar, body.fbm ::-webkit-scrollbar { width: 10px; height: 10px; }
  #app ::-webkit-scrollbar-track, body.fbm ::-webkit-scrollbar-track { background: transparent; }
  #app ::-webkit-scrollbar-thumb, body.fbm ::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text, #101828) 16%, transparent); border-radius: 99px;
    border: 3px solid transparent; background-clip: padding-box; min-height: 40px;
  }
  #app ::-webkit-scrollbar-thumb:hover, body.fbm ::-webkit-scrollbar-thumb:hover:hover { background-color: color-mix(in srgb, var(--text, #101828) 32%, transparent); }
  #app ::-webkit-scrollbar-button, body.fbm ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  #app ::-webkit-scrollbar-corner, body.fbm ::-webkit-scrollbar-corner { background: transparent; }
}
@supports not selector(::-webkit-scrollbar) {
  #app *, body.fbm * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text, #101828) 22%, transparent) transparent; }
}
/* The panel's scrollbar sits in its own gutter, not over the controls. */
.dz-body { scrollbar-gutter: stable; }

/* Labels: one calm weight; headings separate groups. */
.dz-body .dz-label { font-size: 12px; font-weight: 600; color: var(--text); opacity: .78; margin-bottom: 6px; letter-spacing: 0; }
.dz-body .dz-ctl { margin-bottom: 14px; }
.dz-body .dz-h4 { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--faint); }
.dz-body .dz-h4::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.dz-body .dz-2col { gap: 10px 12px; }

/* Colour: label and field on one row; the field is swatch + value. */
.dz-body .dz-ctl:has(> .dz-color) { display: grid; grid-template-columns: minmax(0, 1fr) 148px; align-items: center; column-gap: 10px; }
.dz-body .dz-ctl:has(> .dz-color) > .dz-label { margin: 0; }
.dz-body .dz-ctl:has(> .dz-color) > .ins-help { grid-column: 1 / -1; }
.dz-body .dz-2col .dz-ctl:has(> .dz-color) { display: block; }
.dz-body .dz-2col .dz-ctl:has(> .dz-color) > .dz-label { margin-bottom: 6px; }
.dz-color { position: relative; display: flex; align-items: center; gap: 0; height: 32px; padding: 0 4px 0 4px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); transition: border-color .12s, box-shadow .12s; }
.dz-color:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.dz-color:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dz-swatch { flex: 0 0 22px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; cursor: pointer; background: linear-gradient(var(--c), var(--c)), repeating-conic-gradient(#e4e7ec 0 25%, #fff 0 50%) 0 0 / 8px 8px; box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .14); }
.dz-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-swatch.is-empty { background: linear-gradient(135deg, transparent calc(50% - .75px), #f04438 calc(50% - .75px), #f04438 calc(50% + .75px), transparent calc(50% + .75px)), repeating-conic-gradient(#e4e7ec 0 25%, #fff 0 50%) 0 0 / 8px 8px; }
.dz-color input.dz-native-color[type="color"] { position: absolute; left: 4px; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.dz-color .dz-color-text, .dz-color .dz-color-text.ins-input { flex: 1 1 auto; min-width: 0; height: 28px; min-height: 0 !important; padding: 0 6px 0 8px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; font-family: var(--mono, ui-monospace, monospace); font-size: 12px !important; text-transform: lowercase; color: var(--text); }
.dz-color .dz-color-text::placeholder { font-family: var(--font, system-ui, sans-serif); text-transform: none; color: var(--faint); }
.dz-color .dz-clear { flex: 0 0 22px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--faint); cursor: pointer; }
.dz-color .dz-clear:hover { background: var(--bg); color: var(--text); }
.dz-color .dz-clear svg { width: 13px; height: 13px; }

/* Numbers carry their unit inside the field. */
.dz-num { position: relative; display: inline-flex; align-items: center; flex: 0 0 76px; width: 76px; height: 32px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); transition: border-color .12s, box-shadow .12s; }
.dz-num:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.dz-num:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dz-range .dz-num input.ins-input[type="number"] { flex: 1 1 auto; width: 100%; max-width: none; min-width: 0; height: 30px; min-height: 0; padding: 0 2px 0 9px; border: 0; background: transparent; box-shadow: none; font-size: 12.5px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.dz-range .dz-num input[type="number"]::-webkit-inner-spin-button, .dz-range .dz-num input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.dz-range .dz-num input::placeholder { color: var(--faint); }
.dz-range .dz-num em { flex-shrink: 0; padding-right: 8px; font-style: normal; font-size: 11px; color: var(--faint); pointer-events: none; }
.dz-body .dz-range { gap: 12px; }
/* In two columns the field alone is clearer than a stub of a slider. */
.dz-body .dz-2col .dz-range input[type="range"] { display: none; }
.dz-body .dz-2col .dz-num { flex: 1 1 auto; width: 100%; }

/* The slider: a thin track filled to the value, a crisp thumb. */
.dz-range input[type="range"] { --fill: 50%; -webkit-appearance: none; appearance: none; flex: 1 1 auto; min-width: 0; height: 20px; margin: 0; background: transparent; cursor: pointer; }
.dz-range input[type="range"]:focus { outline: none; }
.dz-range input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(to right, var(--accent) 0 var(--fill), color-mix(in srgb, var(--text) 12%, transparent) var(--fill) 100%); }
.dz-range input[type="range"]::-moz-range-track { height: 4px; border-radius: 99px; background: color-mix(in srgb, var(--text) 12%, transparent); }
.dz-range input[type="range"]::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
.dz-range input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent); box-shadow: 0 1px 3px rgba(16, 24, 40, .22); transition: transform .12s ease, box-shadow .12s ease; }
.dz-range input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent); box-shadow: 0 1px 3px rgba(16, 24, 40, .22); }
.dz-range input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.1); }
.dz-range input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); box-shadow: 0 0 0 5px var(--accent-soft), 0 1px 3px rgba(16, 24, 40, .22); }
.dz-range input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft), 0 1px 3px rgba(16, 24, 40, .22); }
.dz-range input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }

/* Selects match the fields. */
.dz-body select.ins-input { height: 34px; min-height: 0; border-radius: 8px; font-size: 13px; }

/* Collapsible text styles: a summary of what is set. */
.dz-group { background: var(--panel); transition: border-color .12s, box-shadow .12s; }
.dz-group:hover { border-color: var(--border-strong); }
.dz-group[open] { border-color: var(--border-strong); box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.dz-group summary { min-height: 40px; padding: 0 12px !important; font-size: 13px; font-weight: 600; }
.dz-group summary > span:first-child { flex: 1 1 auto; min-width: 0; }
.dz-group-sum { display: inline-flex; align-items: center; gap: 6px; max-width: 55%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11.5px; font-weight: 500; color: var(--faint); }
.dz-group-sum i { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .15); }
.dz-group[open] .dz-group-sum { display: none; }
.dz-group-body { padding: 6px 12px 12px; border-top: 1px solid var(--border); }

/* Colour popover. */
.dz-cp { position: fixed; z-index: 3000; width: 248px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 16px 40px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .08); font-family: var(--font, system-ui, sans-serif); }
.dz-cp-h { margin: 2px 0 6px; font-size: 11px; font-weight: 600; color: var(--faint); }
.dz-cp-h ~ .dz-cp-h { margin-top: 10px; }
.dz-cp-grid, .dz-cp-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dz-cp-sw { aspect-ratio: 1; width: 100%; padding: 0; border: 0; border-radius: 6px; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .12); transition: transform .1s ease; }
.dz-cp-sw:hover { transform: scale(1.1); }
.dz-cp-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-cp-sw.is-on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.dz-cp-foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dz-cp-hex { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 8px; }
.dz-cp-hex:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dz-cp-hex i { flex: 0 0 16px; height: 16px; border-radius: 4px; background: linear-gradient(var(--c), var(--c)), repeating-conic-gradient(#e4e7ec 0 25%, #fff 0 50%) 0 0 / 6px 6px; box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .14); }
.dz-cp-hex input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-family: var(--mono, ui-monospace, monospace); font-size: 12px; color: var(--text); text-transform: lowercase; }
.dz-cp-default { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 8px; padding: 6px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.dz-cp-default:hover { background: var(--bg); color: var(--text); }
.dz-cp-default svg { width: 13px; height: 13px; }

.dz-range input[type="range"].is-auto::-webkit-slider-thumb { border-color: var(--border-strong); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.dz-range input[type="range"].is-auto::-moz-range-thumb { border-color: var(--border-strong); }
.dz-range input[type="range"].is-auto::-moz-range-progress { background: transparent; }

.dz-color .dz-clear[hidden] { display: none; }

/* Native colour inputs elsewhere in the builder: a clean rounded swatch. */
:is(#fb-inspector, .fb-stylebar, .fx-drawer, .md-overlay) input[type="color"]:not(.dz-native-color) {
  -webkit-appearance: none; appearance: none; width: 32px; height: 32px; min-height: 0; padding: 4px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); cursor: pointer;
}
:is(#fb-inspector, .fb-stylebar, .fx-drawer, .md-overlay) input[type="color"]:not(.dz-native-color):hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
:is(#fb-inspector, .fb-stylebar, .fx-drawer, .md-overlay) input[type="color"]:not(.dz-native-color):focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
:is(#fb-inspector, .fb-stylebar, .fx-drawer, .md-overlay) input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
:is(#fb-inspector, .fb-stylebar, .fx-drawer, .md-overlay) input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .14); }
:is(#fb-inspector, .fb-stylebar, .fx-drawer, .md-overlay) input[type="color"]::-moz-color-swatch { border: 0; border-radius: 5px; }
.fb-stylebar input[type="color"]:not(.dz-native-color) { width: 26px; height: 26px; padding: 3px; border-radius: 7px; }

/* Native sliders elsewhere in the builder: the same track and thumb. */
:is(#fb-inspector, .fx-drawer, .md-overlay) input[type="range"]:not(.dz-range input) { -webkit-appearance: none; appearance: none; height: 20px; background: transparent; cursor: pointer; }
:is(#fb-inspector, .fx-drawer, .md-overlay) input[type="range"]:not(.dz-range input)::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: color-mix(in srgb, var(--text) 14%, transparent); }
:is(#fb-inspector, .fx-drawer, .md-overlay) input[type="range"]:not(.dz-range input)::-moz-range-track { height: 4px; border-radius: 99px; background: color-mix(in srgb, var(--text) 14%, transparent); }
:is(#fb-inspector, .fx-drawer, .md-overlay) input[type="range"]:not(.dz-range input)::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
:is(#fb-inspector, .fx-drawer, .md-overlay) input[type="range"]:not(.dz-range input)::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent); box-shadow: 0 1px 3px rgba(16, 24, 40, .22); }
:is(#fb-inspector, .fx-drawer, .md-overlay) input[type="range"]:not(.dz-range input)::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1.5px solid var(--accent); }
:is(#fb-inspector, .fx-drawer, .md-overlay) input[type="range"]:not(.dz-range input):focus-visible { outline: none; }
:is(#fb-inspector, .fx-drawer, .md-overlay) input[type="range"]:not(.dz-range input):focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }

/* ---------- Inspector: WooCommerce product picker ---------- */
.ins-woo { margin-bottom: 14px; }
.ins-woo-search { position: relative; }
.ins-woo-search svg { position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.ins-woo-search input { padding-left: 30px; }
.ins-woo-results { margin-top: 6px; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); box-shadow: 0 8px 24px rgba(16, 24, 40, .12); }
.ins-woo-hit { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: start; cursor: pointer; font: inherit; color: var(--text); }
.ins-woo-hit:last-child { border-bottom: 0; }
.ins-woo-hit:hover:not(:disabled) { background: var(--bg); }
.ins-woo-hit:disabled { opacity: .55; cursor: default; }
.ins-woo-add { margin-left: auto; font-size: 11px; color: var(--accent-600); }
.ins-woo-add svg { width: 15px; height: 15px; }
.ins-woo-msg { padding: 12px; font-size: 12.5px; color: var(--muted); }
.ins-woo-msg.is-bad { color: #b42318; }
.ins-woo-list { list-style: none; margin: 8px 0 6px; padding: 0; }
.ins-woo-list li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.ins-woo-list li:last-child { border-bottom: 0; }
.ins-woo-none { color: var(--muted); font-size: 12.5px; justify-content: center; }
.ins-woo-thumb { flex: 0 0 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--bg); overflow: hidden; }
.ins-woo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ins-woo-thumb svg { width: 16px; height: 16px; color: var(--faint); }
.ins-woo-meta { flex: 1 1 auto; min-width: 0; }
.ins-woo-meta strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-woo-meta small { display: block; font-size: 11.5px; color: var(--faint); }
.ins-woo-meta em { color: #b42318; font-style: normal; }

/* Unset colour: a quiet empty square, not a red slash on every row; set
   colours carry no extra frame line (that read as a border inside a border). */
.dz-swatch { box-shadow: none; }
.dz-swatch:not(.is-empty) { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .1); }
.dz-swatch.is-empty { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); background-image: none; }
.dz-swatch.is-empty::after { content: ""; display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(135deg, transparent 46%, var(--border-strong) 46%, var(--border-strong) 54%, transparent 54%); opacity: .7; }

/* Every dropdown in the panel looks the same (native selects matched to the searchable ones). */
.dz-body select.ins-input { -webkit-appearance: none; appearance: none; height: 36px; padding: 0 34px 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 10px center / 16px no-repeat; font-size: 13px; color: var(--text); cursor: pointer; }
.dz-body select.ins-input:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.dz-body select.ins-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dz-body .ff-ss-input { height: 36px; font-size: 13px; }

/* Custom CSS: light, like WordPress's code editor. */
.dz-css { border: 1px solid #dcdcde; border-radius: 8px; background: #fff; box-shadow: none; }
.dz-css:focus-within { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; }
.dz-css-hl, .dz-css-input { font: 13px/1.6 Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; padding: 10px 12px; }
.dz-css-hl { background: #fff; color: #1d2327; }
.dz-css-hl .s { color: #116329; font-style: normal; }   /* selectors */
.dz-css-hl .v { color: #164; font-style: normal; }       /* values */
.dz-css-hl .b { color: #50575e; font-style: normal; }    /* braces */
.dz-css-hl .c { color: #a50; font-style: italic; }       /* comments */
.dz-css-hl i.s:where([class]) { color: #116329; }
.dz-css-input { caret-color: #1d2327; }
.dz-css-input::placeholder { color: #a7aaad; }
.dz-css-input::selection { background: rgba(34, 113, 177, .2); color: transparent; }

/* Code editor gutter (line numbers); lines scroll sideways rather than wrap,
   so numbers stay level with their lines. */
.dz-css .dz-css-hl, .dz-css .dz-css-input { white-space: pre; word-break: normal; overflow-wrap: normal; padding-left: 50px; }
.dz-css-gutter { position: absolute; top: 0; left: 0; bottom: 0; z-index: 1; width: 40px; margin: 0; padding: 10px 8px 10px 0; overflow: hidden; background: #f6f7f7; border-right: 1px solid #dcdcde; color: #a7aaad; font: 13px/1.6 Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; text-align: end; pointer-events: none; user-select: none; }

/* =====================================================================
 * One look for every control in the builder and the admin pages:
 * text fields, dropdowns, text areas and code boxes share the design
 * panel's style (height, corners, hover, focus ring, arrow).
 * ===================================================================== */
.ins-input { min-height: 36px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background-color: var(--panel); color: var(--text); font-size: 13px; transition: border-color .12s, box-shadow .12s; }
.ins-input::placeholder { color: var(--faint); }
.ins-input:hover:not(:disabled):not([readonly]) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.ins-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ins-input:disabled, .ins-input[readonly] { background-color: var(--bg); color: var(--muted); }
select.ins-input:not([multiple]) { -webkit-appearance: none; appearance: none; height: 36px; padding: 0 34px 0 12px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 10px center / 16px no-repeat; cursor: pointer; }
[dir="rtl"] select.ins-input:not([multiple]) { padding: 0 12px 0 34px; background-position: left 10px center; }
textarea.ins-input { padding: 8px 12px; line-height: 1.5; }
.ins-label { font-size: 12px; font-weight: 600; color: var(--text); opacity: .78; }

/* Code boxes look like WordPress's code editor: light, monospace. */
textarea.ins-input:is([data-bind$="customCss"], [data-bind="modules.valid.custom"], [data-code]) {
  font: 13px/1.6 Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; background: #fff; color: #1d2327; border-color: #dcdcde; tab-size: 2;
}

/* ---------- Form settings → Translation ---------- */
.ins-i18n { margin-bottom: 12px; font-size: 13px; }
.ins-i18n .fbm-spinner { vertical-align: -2px; margin-inline-end: 6px; }
.ins-i18n-off, .ins-i18n-warn { display: flex; gap: 10px; padding: 12px; border-radius: 10px; }
.ins-i18n-off { background: var(--bg); }
.ins-i18n-off > svg, .ins-i18n-warn > svg { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.ins-i18n-off > div > strong:first-child { display: block; font-size: 13px; }
.ins-i18n-off p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ins-i18n-warn { border: 1px solid #fedf89; background: #fffaeb; color: #93370d; font-size: 12.5px; }
.ins-i18n-warn > svg { color: inherit; }
.ins-i18n-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ins-i18n-head svg { width: 16px; height: 16px; color: var(--accent-600); }
.ins-i18n-langs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ins-i18n-lang { padding: 3px 9px; border-radius: 99px; background: var(--bg); font-size: 12px; }
.ins-i18n-lang.is-default { background: var(--accent-soft); color: var(--accent-600); font-weight: 600; }

/* ---------- Code boxes: line numbers like WordPress's code editor ---------- */
.code-field { position: relative; border: 1px solid #dcdcde; border-radius: 8px; background: #fff; overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.code-field:focus-within { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; }
.code-field > .code-gutter { position: absolute; top: 0; left: 0; z-index: 1; width: 40px; height: 100%; margin: 0; padding: 8px 8px 8px 0; overflow: hidden; background: #f6f7f7; border-right: 1px solid #dcdcde; color: #a7aaad; font: 13px/1.6 Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; text-align: end; pointer-events: none; user-select: none; box-sizing: border-box; }
[dir="rtl"] .code-field > .code-gutter { left: auto; right: 0; border-right: 0; border-left: 1px solid #dcdcde; }
.code-field > textarea.ins-input { display: block; width: 100%; margin: 0; padding: 8px 12px 8px 50px; border: 0 !important; border-radius: 0; box-shadow: none !important; background: transparent; font: 13px/1.6 Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; color: #1d2327; white-space: pre; overflow: auto; resize: vertical; tab-size: 2; }
[dir="rtl"] .code-field > textarea.ins-input { padding: 8px 50px 8px 12px; }
.code-field > textarea.ins-input:focus { outline: none; }
.code-field > textarea.ins-input::placeholder { color: #a7aaad; }

/* Module rules shown inside the Logic / Validation tab. */
.ins-merged { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.ins-merged-h { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.ins-merged-h svg { width: 14px; height: 14px; color: var(--accent-600); }

/* ---------- Row lists (key/value pairs, sources, codes…) ---------- */
.rows-field { display: grid; gap: 6px; }
.rows-head, .rows-row { display: flex; align-items: center; gap: 6px; }
.rows-head span { flex: 1 1 0; min-width: 0; font-size: 11.5px; font-weight: 600; color: var(--faint); }
.rows-head .rows-del-sp { flex: 0 0 28px; }
.rows-list { display: grid; gap: 6px; }
.rows-list:empty { display: none; }
.rows-row > .ins-input { flex: 1 1 0; min-width: 0; }
.rows-del { flex: 0 0 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--faint); cursor: pointer; }
.rows-del:hover, .rows-del:focus-visible { background: #fef3f2; color: #d92d20; }
.rows-del svg { width: 14px; height: 14px; }
.rows-add { justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px dashed var(--border-strong, #cbd5e1); border-radius: 8px; background: transparent; color: var(--accent-600); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.rows-add:hover, .rows-add:focus-visible { border-color: var(--accent-600); background: var(--accent-soft); }
.rows-add svg { width: 14px; height: 14px; }
.dyn-n { flex: 0 0 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 700; }
.dyn-row > [data-dyn="source"] { flex: 0 0 112px; }

/* Data tab */
.ins-sub + .ins-sub { margin-top: 18px; }
.data-test { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 4px 0 8px; }
.data-status { font-size: 12.5px; color: var(--muted); }
.data-status.is-ok { color: #067647; }
.data-status.is-error { color: #d92d20; }

/* ================= Email designer ================= */
.ed-overlay { position: fixed; inset: 0; z-index: 340; display: flex; padding: 18px; background: rgba(16, 24, 40, .5); backdrop-filter: blur(2px); }
.ed { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 14px; background: var(--panel); box-shadow: 0 24px 60px rgba(16, 24, 40, .25); }
.ed-loading, .ed-err { display: flex; align-items: center; gap: 8px; margin: auto; padding: 24px; color: var(--muted); }
.ed-err { color: var(--danger); }
.ed-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.ed-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.ed-head h2 svg { width: 18px; height: 18px; color: var(--accent-600); }
.ed-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.ed-head-acts { display: flex; gap: 8px; flex-shrink: 0; }
.ed-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px minmax(0, 1fr); }
.ed-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.ed-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 12px; padding: 3px; border-radius: 10px; background: var(--bg); }
.ed-modes button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ed-modes button svg { width: 15px; height: 15px; }
.ed-modes button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.ed-side-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 16px; }
.ed-sec { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--panel); }
.ed-sec-h { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px 12px; font-size: 13px; font-weight: 700; color: var(--text); text-align: start; }
.ed-sec-h > svg:first-child { width: 16px; height: 16px; color: var(--accent-600); }
.ed-sec-h span { flex: 1; }
.ed-sec-h > svg:last-child { width: 15px; height: 15px; color: var(--faint); transition: transform .15s; }
.ed-sec.is-open .ed-sec-h > svg:last-child { transform: rotate(180deg); }
.ed-sec-b { padding: 0 12px; }
.ed-sec.is-open .ed-sec-b { padding: 0 12px 12px; }
.ed-help { margin: 4px 0 10px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.ed-label { display: block; margin: 12px 0 5px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.ed-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-preset { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; text-align: start; }
.ed-preset:hover, .ed-preset:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ed-preset strong { font-size: 12px; }
.ed-preset small { font-size: 10.5px; color: var(--faint); line-height: 1.3; }
.ed-preset-art { display: block; width: 100%; height: 66px; margin-bottom: 6px; padding: 8px 12px; border-radius: 7px; }
.ed-preset-art > span { position: relative; display: flex; flex-direction: column; gap: 5px; height: 100%; padding: 12px 10px 8px; border: 1px solid; overflow: hidden; }
.ed-preset-art i { position: absolute; inset: 0 0 auto; }
.ed-preset-art i.bar { height: 3px; background: var(--accent); }
.ed-preset-art i.band { height: 9px; background: var(--accent); }
.ed-preset-art b { display: block; height: 5px; width: 80%; border-radius: 3px; background: rgba(17, 24, 39, .14); }
.ed-preset-art b.s { width: 50%; }
.ed-logo { display: flex; align-items: center; gap: 10px; }
.ed-logo-img, .ed-logo-empty { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 64px; padding: 8px; border: 1px dashed var(--border-strong); border-radius: 9px; background: repeating-conic-gradient(#f3f4f6 0 25%, #fff 0 50%) 0 0 / 14px 14px; color: var(--faint); font-size: 11.5px; }
.ed-logo-img img { max-width: 100%; max-height: 54px; }
.ed-logo-acts { display: flex; flex-direction: column; gap: 6px; }
.ed-logo-acts label { cursor: pointer; }
.ed-logo-acts label.is-busy { opacity: .6; pointer-events: none; }
.ed-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 9px; background: var(--bg); }
.ed-seg button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ed-seg button svg { width: 14px; height: 14px; }
.ed-seg button[aria-checked="true"] { background: var(--panel); color: var(--accent-600); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.ed-range { margin-top: 12px; }
.ed-range label { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.ed-range output { font-weight: 600; color: var(--text); }
.ed-range input { width: 100%; accent-color: var(--accent); }
.ed-color { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.ed-color:last-child { border-bottom: 0; }
.ed-color-in { display: inline-flex; align-items: center; gap: 6px; }
.ed-color-in input[type=color] { width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.ed-color-in input[data-empty] { opacity: .45; }
.ed-color-in .ins-input { width: 118px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.ed-switch { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; cursor: pointer; font-size: 12.5px; }
.ed-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ed-switch-ui { flex-shrink: 0; position: relative; width: 32px; height: 18px; margin-top: 1px; border-radius: 99px; background: var(--border-strong); transition: background .15s; }
.ed-switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.ed-switch input:checked + .ed-switch-ui { background: var(--accent); }
.ed-switch input:checked + .ed-switch-ui::after { transform: translateX(14px); }
.ed-switch input:focus-visible + .ed-switch-ui { box-shadow: 0 0 0 3px var(--accent-soft); }
.ed-switch strong { display: block; font-weight: 600; }
.ed-switch small { display: block; color: var(--faint); }
.ed-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ed-links { display: flex; flex-direction: column; gap: 6px; }
.ed-link { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; align-items: center; }
.ed-html { padding-top: 2px; }
.ed-html-acts { margin-bottom: 8px; }
.ed-code { min-height: 340px; font-size: 12px; }
.ed-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #eceef2; }
.ed-stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--panel); }
.ed-pick { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ed-pick select { width: auto; min-width: 180px; }
.ed-mailmeta { display: flex; flex-wrap: wrap; gap: 4px 22px; padding: 9px 16px; border-bottom: 1px solid var(--border); background: var(--panel); font-size: 12px; color: var(--text); }
.ed-mailmeta b { margin-inline-end: 6px; color: var(--faint); font-weight: 600; }
.ed-frame-wrap { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 16px; text-align: center; }
.ed-frame { display: block; height: 100%; min-height: 520px; margin: 0 auto; border: 0; border-radius: 10px; background: #fff; box-shadow: 0 8px 26px rgba(16, 24, 40, .12); transition: width .2s ease; }
.ed-busy { position: absolute; top: 24px; right: 28px; padding: 6px; border-radius: 99px; background: var(--panel); box-shadow: 0 2px 6px rgba(16, 24, 40, .15); }
.ed-note { margin: 0; padding: 8px 16px 12px; font-size: 11.5px; color: var(--muted); text-align: center; }
@media (max-width: 900px) {
  .ed-overlay { padding: 0; }
  .ed { border-radius: 0; }
  .ed-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .ed-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .ed-head { flex-wrap: wrap; }
}

/* Design panel → Quick style */
.dz-shapes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 3px; border-radius: 10px; background: var(--bg); }
.dz-shape { display: grid; place-items: center; height: 34px; border-radius: 8px; color: var(--muted); }
.dz-shape:hover { color: var(--text); }
.dz-shape.is-active { background: var(--panel); color: var(--accent-600); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.dz-shape-art { display: block; width: 26px; height: 14px; border: 1.5px solid currentColor; }
.dz-shape-art.is-square { border-radius: 0; }
.dz-shape-art.is-rounded { border-radius: 4px; }
.dz-shape-art.is-pill { border-radius: 99px; }
.dz-shape-art.is-underline { border-width: 0 0 1.5px; }
.dz-quick-more { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* Form settings → Entry editing: field list */
.ins-edit-fields { display: grid; gap: 2px; max-height: 220px; overflow: auto; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }

/* Date field settings */
.ins-date-offset { display: grid; grid-template-columns: 1fr 1.2fr; gap: 6px; margin-top: 6px; }
.ins-ctl > select + input[type="date"], .ins-ctl > select + select { margin-top: 6px; }
.ins-date-days { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.ins-date-day { position: relative; }
.ins-date-day input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.ins-date-day span { display: inline-block; min-width: 38px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 8px; text-align: center; font-size: 12px; color: var(--muted); }
.ins-date-day input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-600); font-weight: 600; }
.ins-date-day input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------- Date picker (ui/datePicker.js) ---------------- */
.ff-date-box { position: relative; }
.ff-date-box .ff-date-text { padding-inline-end: 42px; }
.ff-date-btn { position: absolute; inset-block: 0; inset-inline-end: 0; display: grid; place-items: center; width: 40px; color: var(--muted); border-radius: 0 var(--ffs-input-radius, 8px) var(--ffs-input-radius, 8px) 0; }
.ff-date-btn:hover, .ff-date-btn:focus-visible { color: var(--accent); }
.ff-date-btn svg { width: 18px; height: 18px; }
.ff-date-cal { margin-top: 6px; }
.ff-date.is-inline .ff-date-cal { margin-top: 0; }
.ff-cal { width: 100%; max-width: 340px; padding: 12px; border: 1px solid var(--ffs-input-border, var(--border-strong)); border-radius: var(--ffs-input-radius, 10px); background: var(--ffs-input-bg, var(--panel)); box-shadow: 0 8px 24px rgba(15, 23, 42, .08); }
.ff-date.is-inline .ff-cal { box-shadow: none; }
.ff-cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ff-cal-title { display: flex; flex: 1; gap: 6px; justify-content: center; }
.ff-cal-title select { min-height: 32px; padding: 3px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.ff-cal-title select:hover, .ff-cal-title select:focus-visible { border-color: var(--border-strong); outline: none; }
.ff-cal-nav { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: inherit; }
.ff-cal-nav:hover, .ff-cal-nav:focus-visible { background: var(--accent-soft); color: var(--accent); outline: none; }
.ff-cal-nav svg { width: 16px; height: 16px; }
[dir="rtl"] .ff-cal-nav svg { transform: scaleX(-1); }
.ff-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ff-cal-wd { padding: 4px 0; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ff-cal-day { display: grid; place-items: center; aspect-ratio: 1; min-height: 34px; border-radius: 8px; font-size: 13.5px; color: inherit; font-variant-numeric: tabular-nums; }
button.ff-cal-day { cursor: pointer; }
button.ff-cal-day:hover { background: var(--accent-soft); }
.ff-cal-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ff-cal-day.is-today { box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.ff-cal-day.is-between { background: var(--accent-soft); border-radius: 0; }
.ff-cal-day.is-selected, .ff-cal-day.is-start, .ff-cal-day.is-end { background: var(--accent); color: #fff; font-weight: 600; }
.ff-cal-day.is-start { border-start-end-radius: 0; border-end-end-radius: 0; }
.ff-cal-day.is-end { border-start-start-radius: 0; border-end-start-radius: 0; }
.ff-cal-day.is-off { color: var(--faint, #9ca3af); text-decoration: line-through; cursor: not-allowed; background: none; }
button.ff-cal-day.is-off:hover { background: none; }
.ff-cal-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 28px; }
.ff-cal-note { flex: 1; font-size: 12.5px; color: var(--muted); }
.ff-cal-foot button { padding: 4px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.ff-cal-foot button:hover, .ff-cal-foot button:focus-visible { background: var(--accent-soft); outline: none; }
.ff-canvas .ff-date .ff-cal, .fb-canvas .ff-date .ff-cal { pointer-events: none; }
@media (max-width: 420px) { .ff-cal { max-width: none; padding: 10px 8px; } .ff-cal-day { min-height: 38px; } }

/* ---------------- Form settings popup (ui/formSettings.js) ---------------- */
.md-overlay.fs-overlay { z-index: 330; }
.fs-box { display: flex; flex-direction: column; max-width: 920px; height: min(760px, 88vh); height: min(760px, 88dvh); overflow: hidden; }
.fs-head { gap: 10px; border-bottom: 1px solid var(--border); }
.fs-head strong { flex: none; }
.fs-sub { flex: 1; font-size: 12.5px; color: var(--muted); }
.fs-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr; }
.fs-nav { overflow-y: auto; padding: 10px 8px; border-inline-end: 1px solid var(--border); background: var(--bg); overscroll-behavior: contain; }
.fs-nav-btn { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--text); text-align: start; }
.fs-nav-btn svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.fs-nav-btn:hover { background: var(--panel); }
.fs-nav-btn.is-active { background: var(--panel); color: var(--accent-600); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.fs-nav-btn.is-active svg { color: var(--accent); }
.fs-nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fs-body { overflow-y: auto; padding: 4px 22px 22px; overscroll-behavior: contain; }
.fs-body > .ins-head { display: none; }
.fs-body .ins-body { padding: 0; }
.fs-body .ins-group { border: 0; box-shadow: none; background: none; margin: 0; }
.fs-body .ins-group > summary { pointer-events: none; padding: 16px 0 10px; font-size: 15px; }
.fs-body .ins-group > summary .ins-group-caret { display: none; }
.fs-body .ins-group-body { padding: 14px 0 0; max-width: 620px; }
@media (max-width: 720px) {
  .fs-box { height: 92dvh; }
  .fs-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .fs-nav { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; padding: 8px; border-inline-end: 0; border-bottom: 1px solid var(--border); }
  .fs-nav-btn { width: auto; flex: none; white-space: nowrap; }
  .fs-body { padding: 4px 14px 16px; }
  .fs-sub { display: none; }
}

/* Form settings → Show entries on your site: shortcodes */
.ins-codes { display: grid; gap: 6px; margin-bottom: 8px; }
.ins-code { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; align-items: center; padding: 7px 8px 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.ins-code span { grid-column: 1; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ins-code code { grid-column: 1; font-size: 11.5px; word-break: break-all; background: none; padding: 0; }
.ins-code .fb-tool { grid-column: 2; grid-row: 1 / span 2; }

/* Form settings → Actions after sending */
.ins-act { display: grid; gap: 4px; margin-bottom: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.ins-act-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.ins-act-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.ins-act-adds { display: flex; flex-wrap: wrap; gap: 8px; }

/* Other confirmations; a notification's rules and recipients. */
.ins-sub { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border, #e2e8f0); }
.ins-conf, .ins-route { border: 1px solid var(--border, #e2e8f0); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.ins-conf .ins-label select { display: inline-block; width: auto; margin-inline-start: 6px; }
.ins-ntf-rules { margin: 6px 0 10px; }

.ins-opt-outcome { flex: 0 1 120px; max-width: 120px; font-size: 11.5px !important; }

/* Dragging: repeaters and sections show room to drop at the end of their rows. */
.fb-dragging .fb-rows-inner { padding-bottom: 34px; position: relative; }
.fb-dragging .fb-rows-inner::after { content: attr(data-drop-label); position: absolute; left: 6px; right: 6px; bottom: 4px; height: 24px; display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--border-strong); border-radius: 6px; color: var(--faint); font-size: 11.5px; pointer-events: none; }
.fb-dragging .fb-rows-inner.is-drop-target::after, .fb-dragging .fb-field.is-container:hover .fb-rows-inner::after { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* AI Generate: the AI model failed, the built-in engine stepped in. */
.md-ai-warn { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px; border: 1px solid color-mix(in srgb, #d97706 45%, transparent); background: color-mix(in srgb, #f59e0b 10%, transparent); color: var(--text); }
.md-ai-warn svg { width: 18px; height: 18px; flex: none; color: #b45309; margin-top: 1px; }
.md-ai-warn strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.md-ai-warn p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

/* ================= AI assistant dialog (ui/aiDialog.js) ================= */
.aid-head { gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.aid-head strong { margin-inline-end: auto; }
.aid-head strong svg { color: var(--accent); }
.aid-engine { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px 10px; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.aid-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.aid-engine.is-live { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); background: color-mix(in srgb, var(--success) 7%, transparent); }
.aid-engine.is-live .aid-dot { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.aid-tabs { display: flex; gap: 4px; padding: 10px 18px 0; border-bottom: 1px solid var(--border); }
.aid-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: var(--fs-label); font-weight: var(--fw-medium); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.aid-tabs button svg { width: var(--icon-sm); height: var(--icon-sm); }
.aid-tabs button:hover { color: var(--text); background: var(--bg); }
.aid-tabs button.is-active { color: var(--accent-600, var(--accent)); border-bottom-color: var(--accent); }
.aid-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.aid-body { padding-top: 16px; min-height: 210px; }
.aid-foot { align-items: center; border-top: 1px solid var(--border); padding-top: 12px; }
.aid-prompt { resize: vertical; min-height: 96px; font-size: var(--fs-body); line-height: var(--lh-body); }
.aid-row { display: flex; align-items: flex-start; gap: 10px; }
.aid-row .md-chips { flex: 1; }
.aid-count { font-size: var(--fs-caption); color: var(--faint); margin-top: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.aid-tip { margin: 8px 0 0; font-size: var(--fs-small); color: var(--muted); line-height: var(--lh-body); }
.aid-kbd { color: var(--faint); font-size: var(--fs-caption); }
.aid-error { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin-top: 10px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); font-size: var(--fs-label); overflow-wrap: anywhere; }
.aid-error svg { color: var(--danger); flex: none; width: 16px; height: 16px; margin-top: 1px; }
.aid-warn { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 10%, transparent); }
.aid-warn svg { width: 18px; height: 18px; flex: none; color: var(--warning); margin-top: 1px; }
.aid-warn strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.aid-warn p { margin: 4px 0 0; font-size: var(--fs-label); color: var(--muted); }

/* Progress */
.aid-steps { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 4px; }
.aid-step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); transition: background var(--dur-base) var(--ease); }
.aid-step.is-active { background: var(--accent-soft); }
.aid-step strong { font-size: var(--fs-body); font-weight: var(--fw-medium); }
.aid-step.is-pending strong { color: var(--faint); font-weight: var(--fw-regular); }
.aid-step small { display: block; margin-top: 3px; font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.aid-step-icon { width: 22px; height: 22px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.aid-step.is-done .aid-step-icon { background: var(--success); color: #fff; }
.aid-step.is-warn .aid-step-icon { background: var(--warning); color: #fff; }
.aid-step-icon svg { width: 13px; height: 13px; }
.aid-pending { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border-strong); }
.aid-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: aid-spin .8s linear infinite; }
.aid-time { margin-inline-start: 6px; font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes aid-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .aid-spin { animation-duration: 2.4s; } }

/* Results */
.aid-result { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; background: var(--bg); }
.aid-result-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.aid-result-head strong { font-size: 15px; }
.aid-badge { display: inline-block; font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--accent-600, var(--accent)); background: var(--accent-soft); border-radius: var(--radius-pill); padding: 2px 8px; white-space: nowrap; }
.aid-desc { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-label); line-height: var(--lh-body); }
.aid-summary { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-label); color: var(--muted); }
.aid-summary li { display: flex; align-items: center; gap: 6px; }
.aid-summary svg { width: 13px; height: 13px; color: var(--success); flex: none; }
.aid-intro { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--accent-soft); }
.aid-intro > svg { width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 1px; }
.aid-intro.is-good { background: color-mix(in srgb, var(--success) 8%, transparent); }
.aid-intro.is-good > svg { color: var(--success); }
.aid-intro p { margin: 4px 0 0; font-size: var(--fs-label); color: var(--muted); line-height: var(--lh-body); }
.aid-sugg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 6px; font-size: var(--fs-label); color: var(--muted); flex-wrap: wrap; }
.aid-sugg { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); max-height: 46vh; overflow: auto; }
.aid-sugg li + li { border-top: 1px solid var(--border); }
.aid-sugg label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; cursor: pointer; }
.aid-sugg label:hover { background: var(--bg); }
.aid-sugg input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.aid-sugg-main { display: grid; gap: 3px; min-width: 0; }
.aid-sugg-field { font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--faint); text-transform: uppercase; letter-spacing: .03em; }
.aid-sugg-diff { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-body); overflow-wrap: anywhere; }
.aid-sugg-diff svg { width: 12px; height: 12px; color: var(--faint); flex: none; }
[dir="rtl"] .aid-sugg-diff svg { transform: scaleX(-1); }
.aid-sugg-diff del { color: var(--muted); text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.aid-sugg-diff ins { text-decoration: none; color: var(--text); font-weight: var(--fw-medium); }
.aid-sugg-main > small { font-size: var(--fs-small); color: var(--muted); }
@media (max-width: 560px) {
  .aid-tabs { padding-inline: 14px; }
  .aid-tabs button { flex: 1; justify-content: center; padding-inline: 6px; }
  .aid-engine { max-width: 40%; }
  .aid-row { flex-direction: column; gap: 0; }
  .aid-kbd { display: none; }
}
.aid-engine.is-checking .aid-dot { background: var(--accent); animation: aid-pulse 1s ease-in-out infinite alternate; }
@keyframes aid-pulse { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .aid-engine.is-checking .aid-dot { animation: none; } }
.aid-sugg-gh { padding: 10px 12px 2px; display: grid; gap: 2px; }
.aid-sugg-gh strong { font-size: var(--fs-label); }
.aid-sugg-gh small { font-size: var(--fs-small); color: var(--muted); line-height: var(--lh-body); }
.aid-sugg-item { padding-block: 7px !important; }
.aid-sugg-group { padding-bottom: 4px; }

/* ================= Map field and address suggestions (ui/geo.js) ================= */
.ff-map { position: relative; }
.ff-map-bar { display: flex; gap: 6px; position: relative; }
.ff-map-bar > input { flex: 1; min-width: 0; }
.ff-map-locate { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; border: 1px solid var(--border, #d0d5dd); border-radius: var(--ff-radius, 8px); background: var(--panel, #fff); color: var(--accent, #4f46e5); cursor: pointer; }
.ff-map-locate:hover { background: var(--accent-soft, #eef2ff); }
.ff-map-locate:focus-visible { outline: 2px solid var(--accent, #4f46e5); outline-offset: 2px; }
.ff-map-locate:disabled { opacity: .6; cursor: progress; }
.ff-map-locate svg { width: 18px; height: 18px; }
.ff-map.is-looking .ff-map-bar > input { background-image: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent, #4f46e5) 12%, transparent), transparent); background-size: 200% 100%; animation: ff-geo-busy 1.2s linear infinite; }
@keyframes ff-geo-busy { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.ff-map-canvas.ff-map-live { position: relative; overflow: hidden; display: block; padding: 0; background: #e9eef3; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.ff-map-canvas.ff-map-live:focus-visible { outline: 2px solid var(--accent, #4f46e5); outline-offset: 2px; }
.ff-map-live.is-dragging { cursor: grabbing; }
.ff-map-tiles { position: absolute; inset: 0; will-change: transform; }
.ff-map-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; pointer-events: none; }
.ff-map-pin { position: absolute; width: 34px; height: 34px; margin: -32px 0 0 -17px; color: var(--accent, #4f46e5); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); cursor: grab; z-index: 2; }
.ff-map-pin svg { width: 34px; height: 34px; fill: currentColor; stroke: #fff; stroke-width: 1.4; }
.ff-map-zoom { position: absolute; top: 8px; inset-inline-end: 8px; display: grid; z-index: 3; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); border-radius: 6px; overflow: hidden; }
.ff-map-zoom button { width: 32px; height: 32px; border: 0; background: #fff; color: #1f2937; font-size: 18px; line-height: 1; cursor: pointer; }
.ff-map-zoom button + button { border-top: 1px solid #e5e7eb; }
.ff-map-zoom button:hover { background: #f3f4f6; }
.ff-map-zoom button:focus-visible { outline: 2px solid var(--accent, #4f46e5); outline-offset: -2px; }
.ff-map-attr { position: absolute; bottom: 0; inset-inline-end: 0; z-index: 3; padding: 1px 6px; font-size: 10.5px; color: #374151; background: rgba(255, 255, 255, .8); border-start-start-radius: 4px; pointer-events: none; }
.ff-map-note { margin: 6px 0 0; font-size: 12.5px; color: var(--muted, #667085); }
.ff-geo-list { position: absolute; z-index: 30; inset-inline: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--panel, #fff); border: 1px solid var(--border, #d0d5dd); border-radius: 10px; box-shadow: 0 10px 30px -6px rgba(16, 24, 40, .25); max-height: 280px; overflow: auto; }
.ff-geo-list li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 7px; font-size: 13.5px; line-height: 1.4; cursor: pointer; color: var(--text, #101828); }
.ff-geo-list li svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--faint, #98a2b3); }
.ff-geo-list li[aria-selected="true"], .ff-geo-list li[role=option]:hover { background: var(--accent-soft, #eef2ff); }
.ff-geo-list .ff-geo-msg { cursor: default; color: var(--muted, #667085); }
.ff-geo-list .ff-geo-msg.is-error { color: var(--danger, #e5484d); }
.ff-address[data-ff-geo-address] { position: relative; }
.ff-address [data-geo-input] + .ff-geo-list { top: 44px; }
@media (prefers-reduced-motion: reduce) { .ff-map.is-looking .ff-map-bar > input { animation: none; } }
.pv-offline-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; background: color-mix(in srgb, var(--success, #16a34a) 10%, transparent); border: 1px solid color-mix(in srgb, var(--success, #16a34a) 35%, transparent); }
.tb-logo .fbm-brand-img { width: 22px; height: 22px; object-fit: contain; }
.tb-logo:has(.fbm-brand-img) { background: transparent; }

/* A hovered row shows its outline, so its grip (left) and delete button (right) visibly belong to it. */
.fb-row:hover { outline: 1px dashed var(--border-strong); outline-offset: 3px; border-radius: 8px; }
.fb-row:has(.fb-field.is-selected):hover, .fb-dragging .fb-row:hover { outline: none; }
/* Email designer: send the email as it looks now. */
.ed-test { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg); }
.ed-test[hidden] { display: none; }
.ed-test-l { font-size: 12.5px; font-weight: 600; color: var(--text); }
.ed-test .ins-input { flex: 1 1 260px; min-width: 0; }
.ed-test-msg { flex-basis: 100%; font-size: 12.5px; }
.ed-test-msg:empty { display: none; }
.ed-test-msg.is-ok { color: var(--success); }
.ed-test-msg.is-err { color: var(--danger); }
