/* MioPDF v100: fluid toolbars and a dedicated fillable-field workspace. */
.editor-topbar-inner { max-width:100% !important; height:auto !important; min-height:78px !important; flex-wrap:wrap !important; }
.editor-topbar { height:auto !important; min-height:0 !important; }
.editor-primary-actions { flex:1 1 650px !important; width:auto !important; max-width:100% !important; flex-wrap:wrap !important; }
.editor-primary-actions .header-search-dock { flex:1 1 180px !important; width:auto !important; min-width:0 !important; max-width:450px !important; }
.header-search-dock .live-search-control { width:100% !important; min-width:0 !important; max-width:100% !important; }
.editor-toolbar { height:auto !important; min-height:0 !important; max-height:none !important; top:var(--main-header-height,78px) !important; }
.editor-toolbar > .commandbar {
  display:grid !important; width:100% !important; max-width:100% !important;
  grid-template-columns:minmax(112px,1.05fr) minmax(96px,.85fr) minmax(144px,1.25fr) minmax(118px,1fr) minmax(260px,2.35fr) minmax(126px,1.1fr) minmax(126px,1.1fr) minmax(128px,1.1fr) !important;
  grid-template-rows:none !important; grid-auto-rows:minmax(150px,auto) !important;
  height:auto !important; min-height:0 !important; padding:7px 10px !important;
  gap:8px !important; overflow:visible !important; box-sizing:border-box !important;
}
.editor-toolbar > .commandbar > .command-group {
  width:100% !important; min-width:0 !important; max-width:100% !important;
  height:auto !important; min-height:150px !important; max-height:none !important;
  grid-template-rows:28px minmax(118px,auto) !important; box-sizing:border-box !important;
}
.commandbar > .command-group > .toolbar-label { white-space:normal !important; text-align:center; line-height:1.1 !important; }
.commandbar .command-buttons { width:100% !important; min-width:0 !important; height:118px !important; min-height:118px !important; }
.commandbar .tool-tile > span:last-child { white-space:normal !important; overflow-wrap:anywhere; overflow:visible !important; text-overflow:clip !important; line-height:1.15 !important; }
.commandbar > .form-command { --panel-start:#c1418c; --panel-end:#9c2266; --panel-rgb:169,45,116; --panel-tint:#fcecf5; --panel-ink:#a62670; }
html[data-theme="dark"] .form-command { --panel-tint:#402b40; --panel-ink:#ff9acf; }
.form-command-controls { display:flex; flex-direction:column; align-items:stretch; justify-content:center; gap:4px; padding:4px 0; min-width:0; }
.commandbar .form-command .form-mode-btn { min-height:62px !important; height:62px !important; width:100% !important; min-width:0 !important; padding:4px !important; }
.form-command .tool-glyph { font-size:23px !important; }
.commandbar .form-command #formModeLabel { font-size:10px !important; }
.form-command-controls .form-field-count { font-size:10px; line-height:12px; text-align:center; font-weight:700; color:var(--panel-ink); }
.form-command-controls p { font-size:10px; line-height:12px; text-align:center; color:var(--ui-muted); margin:0 0 3px; white-space:normal; overflow-wrap:break-word; }
.form-mode-disabled { opacity:.38; pointer-events:none; }
.form-mode-active .page-card { cursor:crosshair; }
.form-page-badge { display:inline-flex; align-items:center; padding:3px 6px; border-radius:6px; background:#fce7f3; color:#9d174d; font-size:10px; font-weight:750; }

/* Existing page editor: let tools wrap into readable rows. */
.office-editor-card { grid-template-rows:auto minmax(120px,1fr) auto !important; max-width:calc(100vw - 12px) !important; }
.office-editor-card > #officeEditorToolbar {
  position:relative !important; display:flex !important; flex-wrap:wrap !important;
  align-items:flex-start !important; gap:6px !important; height:auto !important;
  min-height:0 !important; max-height:none !important; padding:8px 64px 8px 8px !important;
  width:100% !important; min-width:0 !important; overflow:visible !important; box-sizing:border-box !important;
}
#officeEditorToolbar > .office-visual-quick-tools {
  display:grid !important; flex:1 1 660px !important; order:10 !important;
  grid-template-columns:repeat(auto-fit,minmax(62px,1fr)) !important;
  grid-template-rows:none !important; grid-auto-rows:minmax(50px,auto) !important;
  width:auto !important; min-width:0 !important; max-width:100% !important;
  height:auto !important; min-height:0 !important; max-height:none !important;
  gap:5px !important; overflow:visible !important;
}
#officeEditorToolbar .office-visual-quick-tools > button {
  display:flex !important; flex-direction:column !important; gap:2px !important;
  width:100% !important; min-width:0 !important; max-width:100% !important;
  height:100% !important; min-height:50px !important; max-height:none !important;
  padding:4px 3px !important; white-space:normal !important; overflow:visible !important;
}
#officeEditorToolbar .office-visual-quick-tools > button.has-color-dropdown { padding-inline-end:18px !important; }
#officeEditorToolbar .office-visual-quick-tools > button > span:not(.office-tool-glyph) { font-size:9px !important; line-height:1.15 !important; white-space:normal !important; overflow-wrap:anywhere; overflow:visible !important; }
#officeEditorToolbar .office-editor-close-tool { position:absolute !important; right:8px !important; top:8px !important; width:44px !important; height:44px !important; min-width:44px !important; min-height:44px !important; margin:0 !important; background:#ed1834 !important; color:#fff !important; font-size:30px !important; }
.office-editor-card > .office-editor-actions { height:auto !important; min-height:48px !important; flex-wrap:wrap !important; gap:7px !important; }
.office-editor-card > #officeVisualOptions:not(.hidden) { max-width:calc(100% - 16px) !important; flex-wrap:wrap !important; }
.preview-head { flex-wrap:wrap !important; height:auto !important; min-height:0 !important; }
.preview-head .preview-zoom-tools { flex-wrap:wrap !important; min-width:0 !important; max-width:100% !important; }
.preview-edit-toolbar { display:grid !important; grid-template-columns:repeat(auto-fit,minmax(58px,1fr)) !important; min-width:0 !important; max-width:100% !important; height:auto !important; overflow:visible !important; }
.preview-page-toolbar { flex-wrap:wrap !important; height:auto !important; }

.form-editor-modal { z-index:10500; padding:10px; }
.form-editor-modal.hidden { display:none !important; }
.form-editor-card { width:min(1500px,100%); height:calc(100dvh - 20px); max-height:calc(100dvh - 20px); min-width:0; display:flex; flex-direction:column; overflow:hidden; border:1px solid var(--ui-line); border-radius:16px; box-shadow:0 24px 70px #0005; background:var(--ui-surface); color:var(--ui-text); }
.form-editor-head { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:13px 18px; border-bottom:1px solid var(--ui-line); }
.form-editor-head > div { min-width:0; }
.form-editor-head h2 { margin:0 0 4px; font-size:21px; color:var(--ui-text); }
.form-editor-head p { margin:0; font-size:12px; line-height:1.4; color:var(--ui-muted); }
.form-close { flex:0 0 44px; width:44px; height:44px; background:#ed1834; color:white; border:0; border-radius:10px; font-size:32px; cursor:pointer; }
.form-editor-toolbar,.form-navigation { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding:9px 14px; border-bottom:1px solid var(--ui-line); }
.form-editor-toolbar > button,.form-navigation button,.form-multiline {
  display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:38px;
  padding:7px 11px; border:1px solid var(--ui-line); border-radius:8px; background:var(--ui-raised);
  color:var(--ui-text); font:inherit; font-size:12px; font-weight:700; line-height:1.25; cursor:pointer;
}
.form-multiline input { width:16px; height:16px; accent-color:#aa2874; }
.form-editor-toolbar > .form-active { background:#a62670; border-color:#a62670; color:#fff; }
.form-editor-toolbar > .form-delete { color:#df2643; }
.form-editor-toolbar > .form-download { margin-inline-start:auto; color:#fff; background:#ed1834; border-color:#ed1834; }
.form-navigation { justify-content:space-between; background:var(--ui-raised); }
.form-page-navigation { display:flex; align-items:center; gap:7px; flex:1 1 250px; min-width:0; max-width:620px; }
.form-page-navigation select { min-width:0; width:100%; height:38px; border:1px solid var(--ui-line); border-radius:8px; padding:0 8px; color:var(--ui-text); background:var(--ui-surface); font-size:12px; }
.form-page-navigation button { flex:0 0 38px; }
.form-zoom { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
#formZoomValue { min-width:42px; text-align:center; font-size:12px; }
.form-viewport { flex:1 1 auto; min-height:100px; min-width:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; padding:16px; background:var(--ui-bg); }
.form-paper { position:relative; margin:0 auto; flex-shrink:0; max-width:100%; background:#fff; box-shadow:0 3px 16px #0003; }
.form-paper > canvas { width:100%; height:100%; display:block; }
.form-field-layer { position:absolute; inset:0; touch-action:none; cursor:crosshair; overflow:hidden; }
.form-field-layer:focus { outline:0; }
.form-field { position:absolute; display:flex; align-items:center; justify-content:flex-start; margin:0; padding:0 4px; border:1px solid #3b82f6; border-radius:1px; background:rgb(119 167 255 / 22%); color:#153b6c; cursor:move; box-sizing:border-box; touch-action:none; }
.form-field.selected { border:2px solid #a62670; background:rgb(238 133 201 / 25%); z-index:2; }
.form-field-label { display:block; max-width:100%; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:11px; font-weight:600; pointer-events:none; }
.form-resize { position:absolute; width:10px; height:10px; background:#fff; border:2px solid #a62670; border-radius:2px; }
.form-resize.nw { top:-2px; left:-2px; cursor:nwse-resize; }
.form-resize.ne { top:-2px; right:-2px; cursor:nesw-resize; }
.form-resize.sw { bottom:-2px; left:-2px; cursor:nesw-resize; }
.form-resize.se { bottom:-2px; right:-2px; cursor:nwse-resize; }
.form-draft { border:2px dashed #a62670; pointer-events:none; }
.form-editor-footer { display:flex; flex-wrap:wrap; justify-content:space-between; gap:6px 20px; padding:10px 16px; border-top:1px solid var(--ui-line); font-size:11px; line-height:1.4; color:var(--ui-muted); }
#formSelection { color:var(--ui-text); font-weight:700; }
.form-editor-card button:disabled { opacity:.4; cursor:default; }
.form-editor-card :is(button,input,select):focus-visible { outline:3px solid var(--ui-focus); outline-offset:2px; }
@media(max-height:520px) {
  .form-editor-card { overflow-y:auto; }
  .form-editor-head,.form-editor-toolbar,.form-navigation,.form-editor-footer { flex-shrink:0; }
  .form-viewport { flex:1 0 210px; }
}
@media(max-width:1250px) {
  .editor-topbar,.editor-toolbar { position:relative !important; top:auto !important; }
  .editor-toolbar > .commandbar { grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
  .commandbar .document-command .command-buttons { grid-template-columns:repeat(3,minmax(0,1fr)) !important; grid-template-rows:repeat(3,minmax(0,1fr)) !important; }
  .commandbar .document-command .tool-glyph { font-size:16px !important; }
  .commandbar .document-command .tool-tile { gap:1px !important; padding:2px !important; }
}
@media(max-width:800px) {
  .editor-toolbar > .commandbar { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  .editor-primary-actions { flex-basis:100% !important; }
  .editor-primary-actions .header-search-dock { flex-basis:100% !important; max-width:none !important; }
  .office-editor-card { display:flex !important; flex-direction:column !important; overflow-y:auto !important; }
  .office-editor-card > #officeEditorToolbar { flex:0 0 auto !important; }
  .office-editor-card > #officeNativeViewport { flex:1 0 200px !important; min-width:0 !important; }
  .office-editor-card > .office-editor-actions { flex:0 0 auto !important; }
}
@media(max-width:520px) {
  .editor-topbar-inner { padding:8px !important; }
  .appearance-controls { flex:1 1 100% !important; width:100%; min-width:0; }
  .editor-primary-actions .appearance-controls .editor-language { min-width:0 !important; flex:1 1 auto !important; width:auto !important; max-width:100% !important; }
  .appearance-controls .editor-language select { flex:1 1 auto !important; width:100% !important; }
  .commandbar .document-command { grid-column:1 / -1; }
  .commandbar .document-command .command-buttons { grid-template-columns:repeat(5,minmax(0,1fr)) !important; grid-template-rows:repeat(2,minmax(0,1fr)) !important; }
  .form-editor-modal { padding:4px; }
  .form-editor-card { height:calc(100dvh - 8px); max-height:calc(100dvh - 8px); border-radius:10px; }
  .form-editor-head { padding:10px; gap:8px; }
  .form-editor-head h2 { font-size:18px; }
  .form-editor-toolbar,.form-navigation { gap:6px; padding:7px; }
  .form-editor-toolbar > button,.form-multiline { flex:1 1 auto; padding:6px; font-size:11px; }
  .form-editor-toolbar > .form-download { margin-inline-start:0; }
  .form-editor-footer { padding:7px 10px; }
  .form-viewport { padding:10px; }
}
