.center-canvas{
  flex:1;
  position:relative;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:36px max(20px, env(safe-area-inset-right, 0px)) calc(64px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  background-color:var(--canvas-bg,#f1f2f5);
  background-image:none;
  touch-action:none;
  user-select:none;
}
.canvas-container{
  position:relative;
  background:#ffffff;
  box-shadow:0 2px 14px rgba(20,24,32,0.1);
  border-radius:2px;
  flex-shrink:0;
  transform-origin:center center;
  will-change:transform;
  margin:auto;
}
#pdfCanvas{display:block}
.overlay-container{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  pointer-events:auto;
}
.field-overlay{
  position:absolute;
  border:1.5px solid #94A3B8;
  background:#F8FAFC;
  box-shadow:0 1px 2px rgba(0,0,0,0.04);
  pointer-events:auto;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  cursor:move;
  font-family:inherit;
  font-size:11px;
  color:#1c1f26;
  border-radius:3px;
  overflow:visible;
  transition:border-color var(--anim-fast),box-shadow var(--anim-fast),background var(--anim-fast);
  touch-action:none;
}
.field-overlay:not(.selected):hover{
  border:1.5px solid #8a909c !important;
  background:#F1F5F9 !important;
  color:#1c1f26 !important;
  box-shadow:0 0 0 2px rgba(100,116,139,0.18);
}
.field-overlay.selected{
  border:2px solid #1D4ED8 !important;
  background:#EFF6FF !important;
  color:#1c1f26 !important;
  box-shadow:0 0 0 3px rgba(29,78,216,0.22);
  z-index:50;
  animation:fieldSelectPulse 0.18s cubic-bezier(0.16,1,0.3,1);
}
.field-overlay.selected.multi-selected{
  border:1px solid #93C5FD !important;
  background:rgba(239,246,255,0.50) !important;
  box-shadow:none !important;
  z-index:45;
  animation:none;
}
.field-overlay:focus-visible{
  outline:2px solid #1D4ED8 !important;
  outline-offset:2px !important;
  z-index:55;
}
.field-overlay.low-confidence-field:not(.selected){
  border:1.5px dashed #f59e0b !important;
  background:rgba(254,243,199,0.30) !important;
}
.field-confidence-badge{
  position:absolute;
  top:-9px;
  right:-2px;
  z-index:20;
  pointer-events:none;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  font-size:8.5px;
  font-weight:700;
  color:#b45309;
  background:#fef3c7;
  border:1px solid #fde68a;
  border-radius:3px;
  padding:1px 4px;
  line-height:1.1;
  display:inline-flex;
  align-items:center;
  gap:2px;
  box-shadow:0 1px 2px rgba(0,0,0,0.06);
}
.overlay-label{
  pointer-events:none;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  padding:0 4px;
  font-family:inherit;
  font-size:11px;
  font-weight:500;
  color:#1c1f26;
  width:100%;
}
.field-floating-badge{
  position:absolute;
  top:-22px;
  left:0;
  background:#2f5bea;
  color:#ffffff;
  font-size:11px;
  font-weight:600;
  padding:0 6px;
  height:18px;
  border-radius:4px;
  white-space:nowrap;
  pointer-events:none;
  line-height:18px;
  box-shadow:0 2px 6px rgba(0,0,0,0.18);
  display:none;
  z-index:60;
}
.field-overlay:not(.selected):hover .field-floating-badge{display:block}
.field-overlay.selected .field-floating-badge{display:none !important}
.resize-handle{
  position:absolute;
  background:#ffffff;
  border:1.5px solid var(--selection-color,#1D4ED8);
  pointer-events:auto;
  box-shadow:0 1px 3px rgba(29,78,216,0.25);
  z-index:70;
  transition:transform 0.12s ease,background 0.12s ease,border-color 0.12s ease;
}
.resize-handle:hover{
  transform:scale(1.35);
  background:var(--selection-color,#1D4ED8);
  border-color:#ffffff;
}
.resize-handle.handle-nw{width:9px;height:9px;border-radius:2px;top:-4.5px;left:-4.5px;cursor:nwse-resize}
.resize-handle.handle-ne{width:9px;height:9px;border-radius:2px;top:-4.5px;right:-4.5px;cursor:nesw-resize}
.resize-handle.handle-se{width:9px;height:9px;border-radius:2px;bottom:-4.5px;right:-4.5px;cursor:nwse-resize}
.resize-handle.handle-sw{width:9px;height:9px;border-radius:2px;bottom:-4.5px;left:-4.5px;cursor:nesw-resize}
.resize-handle.handle-n{width:7px;height:7px;border-radius:2px;top:-3.5px;left:calc(50% - 3.5px);cursor:ns-resize}
.resize-handle.handle-e{width:7px;height:7px;border-radius:2px;top:calc(50% - 3.5px);right:-3.5px;cursor:ew-resize}
.resize-handle.handle-s{width:7px;height:7px;border-radius:2px;bottom:-3.5px;left:calc(50% - 3.5px);cursor:ns-resize}
.resize-handle.handle-w{width:7px;height:7px;border-radius:2px;top:calc(50% - 3.5px);left:-3.5px;cursor:ew-resize}
.field-overlay.is-locked{cursor:default !important}
.field-overlay.is-locked .resize-handle{display:none !important}
.field-overlay.is-hidden{opacity:0.25 !important}
.multi-selection-bounding-frame{
  position:absolute;
  border:1.5px solid var(--selection-color,#1D4ED8);
  border-radius:4px;
  pointer-events:none;
  z-index:95;
  background:rgba(79,70,229,0.03);
  box-shadow:none;
  animation:selectionFramePop 0.18s cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes selectionFramePop{0%{opacity:0.35;transform:scale(0.994)}100%{opacity:1;transform:scale(1)}}
@keyframes fieldSelectPulse{0%{box-shadow:0 0 0 0px var(--selection-glow,rgba(79,70,229,0.30))}100%{box-shadow:0 0 0 3px var(--selection-glow,rgba(79,70,229,0.12))}}
.group-resize-handle{
  position:absolute;
  width:7.5px;
  height:7.5px;
  background:#ffffff;
  border:1.5px solid var(--selection-color,#2563eb);
  border-radius:2px;
  pointer-events:auto;
  box-shadow:0 1px 3px rgba(37,99,235,0.25);
  z-index:100;
  transition:transform 0.12s ease,background 0.12s ease,border-color 0.12s ease;
}
.group-resize-handle.group-handle-se{cursor:se-resize}
.group-resize-handle.group-handle-e{cursor:ew-resize}
.group-resize-handle.group-handle-s{cursor:ns-resize}
.group-resize-handle:hover{transform:scale(1.4);background:var(--selection-color,#2563eb);border-color:#ffffff}
#selectionBox{
  position:absolute;
  border:1.5px dashed var(--selection-color,#2563eb);
  background:rgba(37,99,235,0.08);
  border-radius:3px;
  pointer-events:none;
  display:none;
  z-index:1000;
  box-shadow:0 0 0 1px rgba(255,255,255,0.85);
}
.smart-guides-container{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  pointer-events:none;
  z-index:999;
}
.align-line{
  position:absolute;
  background:#2f5bea;
  display:none;
  pointer-events:none;
  z-index:999;
  box-shadow:0 0 4px rgba(47,91,234,0.4);
}
.align-line.horizontal{height:1px;width:100%;left:0}
.align-line.vertical{width:1px;height:100%;top:0}
.align-line.center-guide.vertical{
  background:repeating-linear-gradient(to bottom,#2f5bea 0,#2f5bea 4px,transparent 4px,transparent 8px);
  box-shadow:none;
}
.align-line.center-guide.horizontal{
  background:repeating-linear-gradient(to right,#2f5bea 0,#2f5bea 4px,transparent 4px,transparent 8px);
  box-shadow:none;
}
.spacing-badge{
  position:absolute;
  display:none;
  transform:translate(-50%,-50%);
  background:#2f5bea;
  color:#ffffff;
  font-size:11px;
  font-weight:600;
  font-family:'DM Sans',-apple-system,BlinkMacSystemFont,sans-serif;
  padding:2px 7px;
  border-radius:5px;
  white-space:nowrap;
  pointer-events:none;
  z-index:1000;
  box-shadow:0 2px 6px rgba(47,91,234,0.3);
}
.snap-point-dot{
  position:absolute;
  width:8px;
  height:8px;
  background:#2f5bea;
  border:2px solid #ffffff;
  border-radius:50%;
  transform:translate(-50%,-50%);
  display:none;
  pointer-events:none;
  z-index:1001;
  box-shadow:0 0 0 2px rgba(47,91,234,0.4),0 0 8px rgba(47,91,234,0.7);
  animation:snapPulse 1.2s ease-in-out infinite;
}
@keyframes snapPulse{
  0%,100%{transform:translate(-50%,-50%) scale(1);box-shadow:0 0 0 2px rgba(47,91,234,0.4),0 0 8px rgba(47,91,234,0.7)}
  50%{transform:translate(-50%,-50%) scale(1.25);box-shadow:0 0 0 3px rgba(47,91,234,0.6),0 0 12px rgba(47,91,234,0.9)}
}
.edge-snap-point{
  position:absolute;
  width:7px;
  height:7px;
  background:#ffffff;
  border:2px solid #2563eb;
  border-radius:50%;
  transform:translate(-50%,-50%);
  pointer-events:none;
  z-index:65;
  opacity:1;
  box-shadow:0 0 0 1px #ffffff,0 1px 3px rgba(0,0,0,0.3);
  transition:transform 0.12s ease,background 0.12s ease,box-shadow 0.12s ease;
}
.edge-snap-point.snap-tl{top:0;left:0}
.edge-snap-point.snap-tm{top:0;left:50%}
.edge-snap-point.snap-tr{top:0;left:100%}
.edge-snap-point.snap-ml{top:50%;left:0}
.edge-snap-point.snap-mr{top:50%;left:100%}
.edge-snap-point.snap-bl{top:100%;left:0}
.edge-snap-point.snap-bm{top:100%;left:50%}
.edge-snap-point.snap-br{top:100%;left:100%}
.edge-snap-point.active-snap{
  background:#2f5bea !important;
  border-color:#ffffff !important;
  transform:translate(-50%,-50%) scale(1.5) !important;
  box-shadow:0 0 0 2px rgba(47,91,234,0.5),0 0 8px #2f5bea !important;
}
.spin{
  animation:roundSpin 1s linear infinite !important;
  display:inline-block;
  transform-origin:center;
}
@keyframes roundSpin{
  0%{transform:rotate(0deg)}
  100%{transform:rotate(360deg)}
}
.scan-hud{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:1200;
  overflow:hidden;
  border-radius:4px;
}
.scan-overlay{
  position:absolute;
  inset:0;
  background:radial-gradient(circle at center,rgba(2,132,199,0.05) 0%,rgba(2,132,199,0.18) 100%);
  backdrop-filter:blur(0.5px);
  animation:scanOverlayPulse 1.2s ease-in-out infinite alternate;
}
.scan-line{
  position:absolute;
  left:0;
  width:100%;
  height:3.5px;
  background:linear-gradient(90deg,rgba(2,132,199,0) 0%,rgba(56,189,248,1) 30%,rgba(14,165,233,1) 70%,rgba(2,132,199,0) 100%);
  box-shadow:0 0 16px 4px rgba(56,189,248,0.8),0 0 32px 8px rgba(14,165,233,0.45);
  animation:laserScanSweep 1.8s ease-in-out infinite alternate;
}
.scan-status-pill{
  position:absolute;
  top:max(24px, calc(12px + env(safe-area-inset-top, 0px)));
  left:50%;
  transform:translateX(-50%);
  background:rgba(15,23,42,0.92);
  backdrop-filter:blur(10px);
  color:#ffffff;
  font-size:12.5px;
  font-weight:500;
  padding:8px 18px;
  border-radius:9999px;
  border:1px solid rgba(56,189,248,0.4);
  box-shadow:0 10px 25px rgba(0,0,0,0.25),0 0 15px rgba(2,132,199,0.35);
  display:flex;
  align-items:center;
  gap:8px;
  z-index:1300;
  animation:statusPillFadeIn 0.3s ease-out;
  white-space:nowrap;
}
@keyframes laserScanSweep{
  0%{top:3%;opacity:0.35}
  50%{opacity:1}
  100%{top:97%;opacity:0.35}
}
@keyframes scanOverlayPulse{0%{opacity:0.6}100%{opacity:1}}
@keyframes statusPillFadeIn{from{opacity:0;transform:translate(-50%,-10px) scale(0.95)}to{opacity:1;transform:translate(-50%,0) scale(1)}}
.field-overlay.field-spawned{animation:fieldSpawnPop 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards}
@keyframes fieldSpawnPop{0%{opacity:0;transform:scale(0.85);box-shadow:0 0 0 0 rgba(2,132,199,0.6)}70%{transform:scale(1.03);box-shadow:0 0 10px 3px rgba(2,132,199,0.35)}100%{opacity:1;transform:scale(1);box-shadow:none}}
.field-overlay.field-scan-wave{animation:fieldScanWave 0.65s cubic-bezier(0.16,1,0.3,1) forwards !important}
@keyframes fieldScanWave{
  0%{transform:scale(0.92);border-color:#2563eb !important;background:rgba(37,99,235,0.25) !important;box-shadow:0 0 16px 4px rgba(37,99,235,0.6),0 0 0 2px rgba(37,99,235,0.5) !important}
  40%{transform:scale(1.04);border-color:#1d4ed8 !important;background:rgba(37,99,235,0.18) !important;box-shadow:0 0 20px 6px rgba(29,78,216,0.45),0 0 0 3px rgba(29,78,216,0.35) !important}
  100%{transform:scale(1);border-color:#94a3b8;background:#f8fafc;box-shadow:0 1px 2px rgba(0,0,0,0.04)}
}
.field-overlay.field-deleting{
  transform:scale(0.82) !important;
  opacity:0 !important;
  filter:blur(3px) !important;
  transition:transform 0.12s cubic-bezier(0.4,0,1,1),opacity 0.12s cubic-bezier(0.4,0,1,1),filter 0.12s ease !important;
  pointer-events:none !important;
}
.field-overlay.layer-hover-highlight{
  outline:2px dashed #3b82f6 !important;
  outline-offset:2.5px !important;
  box-shadow:0 0 14px rgba(59,130,246,0.45) !important;
  z-index:52 !important;
}
.canvas-zoom-hud{
  position:absolute;
  bottom:calc(60px + env(safe-area-inset-bottom, 0px));
  left:50%;
  transform:translateX(-50%) translateY(10px) scale(0.92);
  background:rgba(15,23,42,0.88);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  color:#ffffff;
  padding:6px 14px;
  border-radius:9999px;
  font-size:12px;
  font-weight:600;
  letter-spacing:0.02em;
  display:flex;
  align-items:center;
  gap:6px;
  box-shadow:0 8px 24px rgba(0,0,0,0.22),0 0 0 1px rgba(255,255,255,0.15);
  opacity:0;
  pointer-events:none;
  transition:opacity 0.2s cubic-bezier(0.16,1,0.3,1),transform 0.2s cubic-bezier(0.16,1,0.3,1);
  z-index:60;
}
.canvas-zoom-hud.visible{opacity:1;transform:translateX(-50%) translateY(0) scale(1)}
.notice-toast{
  position:fixed;
  bottom:calc(58px + env(safe-area-inset-bottom, 0px));
  left:50%;
  transform:translateX(-50%);
  background:#1c1f26;
  color:#ffffff;
  padding:9px 18px;
  border-radius:9999px;
  font-size:12.5px;
  font-weight:500;
  display:flex;
  align-items:center;
  gap:8px;
  box-shadow:0 12px 30px rgba(0,0,0,0.2),0 0 20px rgba(2,132,199,0.25);
  border:1px solid rgba(56,189,248,0.3);
  z-index:99999;
  animation:aiToastIn 0.35s cubic-bezier(0.16,1,0.3,1) forwards;
  transition:opacity 0.3s ease,transform 0.3s ease;
}
@keyframes aiToastIn{from{opacity:0;transform:translate(-50%,15px) scale(0.94)}to{opacity:1;transform:translate(-50%,0) scale(1)}}
.floating-tool-stamp{
  position:fixed;
  pointer-events:none;
  z-index:999999;
  display:none;
  align-items:center;
  gap:6px;
  background:#1c1f26;
  color:#ffffff;
  padding:6px 12px;
  border-radius:20px;
  font-size:12px;
  font-weight:600;
  box-shadow:0 8px 24px rgba(0,0,0,0.3),0 0 0 1px rgba(255,255,255,0.18);
  white-space:nowrap;
  transform:translate(16px,16px);
  will-change:left,top;
  transition:opacity 0.15s ease;
}
.floating-tool-stamp .stamp-icon{font-size:13.5px}
.floating-tool-stamp .stamp-hint{color:#60a5fa;font-size:10.5px;font-weight:500;margin-left:2px}
.field-placement-ghost{
  position:absolute !important;
  border:1.5px solid #2f5bea !important;
  background:rgba(47,91,234,0.08) !important;
  box-shadow:0 0 0 1px rgba(47,91,234,0.2),0 4px 16px rgba(47,91,234,0.12) !important;
  border-radius:6px !important;
  pointer-events:none !important;
  z-index:100000 !important;
  align-items:center !important;
  justify-content:flex-start !important;
  padding:0 8px !important;
  box-sizing:border-box !important;
  will-change:left,top,width,height;
}
.field-placement-ghost.snapped{
  border:1.5px solid #2f5bea !important;
  background:rgba(47,91,234,0.12) !important;
  box-shadow:0 0 0 2px rgba(47,91,234,0.3),0 4px 16px rgba(47,91,234,0.16) !important;
}
.field-placement-ghost.is-drawing{
  border:1.5px solid #2f5bea !important;
  background:rgba(47,91,234,0.10) !important;
  box-shadow:0 0 0 1px rgba(47,91,234,0.25),0 4px 16px rgba(47,91,234,0.15) !important;
}
.ghost-origin-dot{
  position:absolute !important;
  top:50% !important;
  left:50% !important;
  transform:translate(-50%,-50%) !important;
  width:6px !important;
  height:6px !important;
  background:#2f5bea !important;
  border:1.5px solid #ffffff !important;
  border-radius:50% !important;
  box-shadow:0 1px 4px rgba(0,0,0,0.3) !important;
  pointer-events:none !important;
  z-index:10 !important;
}
.field-placement-ghost.snapped .ghost-origin-dot{background:#2f5bea !important}
.ghost-badge{
  position:absolute !important;
  top:-26px !important;
  left:0 !important;
  background:#1c1f26 !important;
  border:1px solid rgba(255,255,255,0.12) !important;
  color:#ffffff !important;
  font-family:'DM Sans',-apple-system,BlinkMacSystemFont,sans-serif !important;
  font-size:11px !important;
  font-weight:600 !important;
  padding:3px 8px !important;
  border-radius:6px !important;
  box-shadow:0 4px 12px rgba(0,0,0,0.2) !important;
  white-space:nowrap !important;
  display:flex !important;
  align-items:center !important;
  gap:5px !important;
  pointer-events:none !important;
  line-height:1.3 !important;
  letter-spacing:normal !important;
  z-index:100001 !important;
}
.field-placement-ghost.snapped .ghost-badge{
  background:#1c1f26 !important;
  border-color:rgba(47,91,234,0.5) !important;
}
.ghost-center-label{
  font-family:'DM Sans',-apple-system,BlinkMacSystemFont,sans-serif !important;
  font-size:12px !important;
  font-weight:600 !important;
  color:#2f5bea !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  pointer-events:none !important;
  user-select:none !important;
}
.field-placement-ghost.snapped .ghost-center-label{color:#2f5bea !important}
@keyframes ghostPulse{
  0%{border-color:#2f5bea;box-shadow:0 0 0 1px rgba(47,91,234,0.2),0 4px 14px rgba(47,91,234,0.1)}
  50%{border-color:#5c82ff;box-shadow:0 0 0 2px rgba(47,91,234,0.35),0 6px 18px rgba(47,91,234,0.2)}
  100%{border-color:#2f5bea;box-shadow:0 0 0 1px rgba(47,91,234,0.2),0 4px 14px rgba(47,91,234,0.1)}
}
.field-placement-ghost:not(.snapped){animation:ghostPulse 1.8s infinite ease-in-out}
.placing-mode,.placing-mode #centerCanvas,.placing-mode #canvasContainer,.placing-mode #overlayContainer,.placing-mode .field-overlay{cursor:crosshair !important}
label.scrubbable,.scrub-label{
  cursor:ew-resize !important;
  user-select:none !important;
  display:inline-flex !important;
  align-items:center !important;
  gap:3px !important;
  transition:color 0.15s ease;
}
label.scrubbable:hover,.scrub-label:hover{color:#2563eb !important}
label.scrubbable::after{content:"↔";font-size:10px;opacity:0.45;margin-left:2px}
label.scrubbable:hover::after{opacity:1;color:#2563eb}
body.is-scrubbing,body.is-scrubbing *{cursor:ew-resize !important;user-select:none !important}
body.tool-hand .center-canvas,body.tool-hand .canvas-container,body.tool-hand .overlay-container,body.tool-hand .field-overlay,body.is-space-panning .center-canvas,body.is-space-panning .canvas-container,body.is-space-panning .overlay-container,body.is-space-panning .field-overlay{cursor:grab !important}
body.is-panning,body.is-panning *{cursor:grabbing !important;user-select:none !important}
.field-overlay.fill-mode{
  cursor:default !important;
  user-select:text !important;
  transition:border-color 0.15s ease,box-shadow 0.15s ease,background 0.15s ease;
}
.field-overlay.fill-mode:hover{border-color:#2563eb !important;box-shadow:0 2px 6px rgba(37,99,235,0.12) !important}
.field-overlay.fill-mode:focus-within{border-color:#2563eb !important;box-shadow:0 0 0 3px rgba(37,99,235,0.25) !important;z-index:100 !important}
.fill-input-text,.fill-input-textarea,.fill-input-date,.fill-input-select{
  width:100%;
  height:100%;
  border:none;
  background:transparent;
  font-family:'Carlito',Calibri,'Inter',-apple-system,sans-serif;
  color:#1c1f26;
  outline:none;
  box-sizing:border-box;
}
.fill-input-text::placeholder,.fill-input-textarea::placeholder{color:#8a909c}
.fill-sign-prompt:hover{background:rgba(224,242,254,0.95) !important}
/* ── Word Processing & Document Typography ───────────────────────── */
.field-overlay.type-staticText {
  border: 1.5px solid transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: text !important;
  border-radius: 2px !important;
}

.field-overlay.type-staticText:not(.selected):not(.is-editing-text):hover {
  border: 1px dashed rgba(37, 99, 235, 0.45) !important;
  background: rgba(239, 246, 255, 0.15) !important;
  box-shadow: none !important;
}

.field-overlay.type-staticText.selected:not(.is-editing-text) {
  border: 1px solid #2563eb !important;
  background: transparent !important;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25) !important;
}

.field-overlay.is-editing-text,
.field-overlay.type-staticText.is-editing-text {
  border: 1px solid #2563eb !important;
  background: #ffffff !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08), 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
  z-index: 200 !important;
  border-radius: 4px !important;
}

.inline-text-editor {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  padding: 2px 4px;
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  line-height: inherit;
  box-sizing: border-box;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.inline-text-editor::placeholder {
  color: #94a3b8;
  font-weight: 400;
  font-style: italic;
}

/* ── Modern Word Processor Inline Editor ──────────────────────────── */
.wp-editor-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.wp-editable {
  width: 100%;
  min-height: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 4px 6px;
  margin: 0;
  box-sizing: border-box;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  cursor: text;
  -webkit-user-modify: read-write-plaintext-only;
  -webkit-user-modify: read-write;
}

.wp-editable:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-weight: 400;
  font-style: italic;
  pointer-events: none;
}

.wp-editable ul, .wp-editable ol {
  margin: 2px 0;
  padding-left: 20px;
}

.wp-editable ul li, .wp-editable ol li {
  margin: 1px 0;
}

/* ── Floating Format Toolbar (Google Docs style) ──────────────────── */
.wp-format-toolbar {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 1px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 3px 4px;
  z-index: 9999;
  pointer-events: auto;
  user-select: none;
  animation: wpToolbarPop 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  white-space: nowrap;
  left: 0;
  bottom: calc(100% + 6px);
}

@keyframes wpToolbarPop {
  from { opacity: 0; transform: translateY(4px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.wp-format-toolbar .wp-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: #4a505c;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', -apple-system, sans-serif;
  padding: 0;
  transition: background 0.1s ease, color 0.1s ease;
  position: relative;
}

.wp-format-toolbar .wp-tb-btn:hover {
  background: #f1f5f9;
  color: #1c1f26;
}

.wp-format-toolbar .wp-tb-btn.active {
  background: #dbeafe;
  color: #1d4ed8;
}

.wp-format-toolbar .wp-tb-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.wp-format-toolbar .wp-tb-divider {
  width: 1px;
  height: 20px;
  background: #e2e8f0;
  margin: 0 3px;
  flex-shrink: 0;
}

.wp-format-toolbar .wp-tb-select {
  height: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #ffffff;
  font-size: 11.5px;
  font-weight: 500;
  font-family: 'Inter', -apple-system, sans-serif;
  color: #1c1f26;
  padding: 0 6px;
  cursor: pointer;
  outline: none;
  min-width: 72px;
  transition: border-color 0.1s ease;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  padding-right: 18px;
}

.wp-format-toolbar .wp-tb-select:hover,
.wp-format-toolbar .wp-tb-select:focus {
  border-color: #93c5fd;
}

/* ── Floating toolbar for table cells ─────────────────────────────── */
.wp-table-toolbar {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 1px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 3px 4px;
  z-index: 9999;
  pointer-events: auto;
  user-select: none;
  animation: wpToolbarPop 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  white-space: nowrap;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 6px);
}

/* ── Word Processor Table & Unified Grid Layout ───────────────────── */
.field-overlay.is-table-cell {
  border-radius: 0 !important;
  box-shadow: none !important;
}

.field-overlay.is-table-cell:not(.selected):not(.is-editing-text) {
  border: 1px solid #cbd5e1 !important;
}

.field-overlay.is-table-cell:not(.selected):not(.is-editing-text):hover {
  border-color: #94a3b8 !important;
  background-color: rgba(241, 245, 249, 0.55) !important;
}

.field-overlay.is-table-cell.is-table-header {
  font-weight: 600 !important;
  background: #f1f5f9 !important;
  border-bottom: 2px solid #94a3b8 !important;
}

.field-overlay.is-table-cell.selected:not(.is-editing-text) {
  border: 1.5px solid #2563eb !important;
  box-shadow: inset 0 0 0 1px #2563eb !important;
  z-index: 50 !important;
}

.field-overlay.is-table-cell.is-editing-text {
  border: 1.5px solid #2563eb !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25) !important;
  background: #ffffff !important;
  z-index: 100 !important;
}

.vernier-hud{
  position:fixed;
  pointer-events:none;
  background:rgba(15,23,42,0.92);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  color:#ffffff;
  padding:3.5px 9px;
  border-radius:5px;
  font-size:11px;
  font-weight:600;
  font-family:'IBM Plex Mono',ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  box-shadow:0 4px 14px rgba(0,0,0,0.28),0 0 0 1px rgba(255,255,255,0.15);
  z-index:99999;
  opacity:0;
  transform:translateY(3px) scale(0.96);
  transition:opacity 0.12s ease,transform 0.12s ease;
  white-space:nowrap;
  display:flex;
  align-items:center;
  gap:6px;
  line-height:1.3;
}
.vernier-hud.visible{opacity:1;transform:translateY(0) scale(1)}
.vernier-hud .vernier-axis{color:#94a3b8;font-weight:500}
.vernier-hud .vernier-val{color:#38bdf8;font-weight:700}
.vernier-hud .vernier-delta{color:#34d399;font-size:10px;font-weight:600}
.vernier-hud .vernier-count{color:#a78bfa;font-size:10px;font-weight:600}
.field-overlay.is-alt-duplicating{cursor:copy !important;outline:2px dashed #10b981 !important;outline-offset:2px !important}
.inline-field-input{
  width:100%;
  height:100%;
  border:none;
  outline:none;
  background:rgba(255,255,255,0.95);
  padding:0 6px;
  margin:0;
  font-family:inherit;
  font-size:11.5px;
  font-weight:600;
  color:#1c1f26;
  box-sizing:border-box;
  border-radius:2px;
}
.contextual-quick-bar{
  position:absolute;
  display:flex;
  align-items:center;
  gap:2px;
  background:#1c1f26;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:10px;
  box-shadow:0 8px 24px rgba(20,24,32,0.3);
  color:#ffffff;
  padding:0 6px;
  height:40px;
  z-index:1000;
  pointer-events:auto;
  user-select:none;
  transform:translateX(-50%) translateY(-24px);
  animation:quickBarPop 0.14s cubic-bezier(0.16,1,0.3,1) forwards;
  white-space:nowrap;
  max-width:calc(100% - 16px);
  overflow-x:auto;
  scrollbar-width:none;
  box-sizing:border-box;
}
.contextual-quick-bar::-webkit-scrollbar{display:none;}
.contextual-quick-bar[data-placement="below"],
.contextual-quick-bar.placed-below{
  transform:translateX(-50%) translateY(14px) !important;
}
@keyframes quickBarPop{
  from{opacity:0;transform:translateX(-50%) translateY(-16px) scale(0.96)}
  to{opacity:1;transform:translateX(-50%) translateY(-24px) scale(1)}
}
.contextual-quick-bar .quick-bar-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  background:transparent;
  border:none;
  color:#ffffff;
  font-size:13px;
  font-weight:500;
  font-family:inherit;
  padding:0 8px;
  height:28px;
  border-radius:6px;
  cursor:pointer;
  transition:background 0.12s ease,color 0.12s ease;
  line-height:1;
}
.contextual-quick-bar .quick-bar-btn:hover{background:rgba(255,255,255,0.12);color:#ffffff}
.contextual-quick-bar .quick-bar-btn.active{background:#2f5bea;color:#ffffff;font-weight:600}
.contextual-quick-bar .quick-bar-btn-danger{color:#ffb4a8}
.contextual-quick-bar .quick-bar-btn-danger:hover{background:rgba(239,68,68,0.2);color:#ef4444}
.contextual-quick-bar .quick-bar-btn-accent{color:#6ee7b7;font-weight:600}
.contextual-quick-bar .quick-bar-btn-accent:hover{background:rgba(16,185,129,0.2);color:#a7f3d0}
.contextual-quick-bar .quick-bar-divider{width:1px;height:18px;background:#4a505c;margin:0 4px;flex-shrink:0}
.contextual-quick-bar .req-icon{opacity:0.85;transition:opacity 0.12s ease,transform 0.12s ease;flex-shrink:0}
.contextual-quick-bar .quick-bar-btn:hover .req-icon{opacity:1}
.contextual-quick-bar .quick-bar-btn.active .req-icon{opacity:1;color:#ffffff}

.field-bottom-name-badge{
  position:absolute;
  left:0;
  top:calc(100% + 4px);
  height:18px;
  padding:0 6px;
  background:#2f5bea;
  color:#ffffff;
  font-size:11px;
  font-weight:600;
  border-radius:4px;
  display:flex;
  align-items:center;
  white-space:nowrap;
  z-index:60;
  pointer-events:none;
  box-shadow:0 1px 3px rgba(47,91,234,0.25);
  font-family:inherit;
}