/* Controles comunes para ventanas operativas. No altera la lógica interna de cada módulo. */
body.wm-modal-open { overflow: hidden !important; }

.wm-surface {
  --wm-x: 0px;
  --wm-y: 0px;
  translate: var(--wm-x) var(--wm-y);
  transition: width .16s ease, height .16s ease, max-width .16s ease, max-height .16s ease;
}

.wm-drag-handle { cursor: grab; user-select: none; touch-action: none; }
.wm-drag-handle.wm-dragging { cursor: grabbing; }
.wm-drag-handle button,
.wm-drag-handle a,
.wm-drag-handle input,
.wm-drag-handle select,
.wm-drag-handle textarea { cursor: pointer; touch-action: auto; }

.wm-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; flex: 0 0 auto; }
.checkout-head:has(> .wm-actions) { grid-template-columns: minmax(0,1fr) auto auto !important; }
.wm-expand {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0 !important;
  border: 1px solid rgba(255,255,255,.38) !important;
  border-radius: 8px !important;
  background: rgba(255,255,255,.13) !important;
  color: inherit !important;
  font: 800 20px/1 system-ui, sans-serif !important;
  display: grid !important;
  place-items: center;
  cursor: pointer !important;
}
.wm-expand:hover,.wm-expand:focus-visible { background: rgba(255,255,255,.25) !important; outline: none; }

.wm-floating-actions { position: absolute; z-index: 6; top: 10px; right: 10px; }
.wm-floating-actions .wm-expand { color: #173653 !important; border-color: #b8c9d8 !important; background: #f3f7fa !important; }

.wm-expanded {
  --wm-x: 0px !important;
  --wm-y: 0px !important;
  width: calc(100vw - 24px) !important;
  height: calc(100vh - 24px) !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 12px !important;
}
dialog.wm-expanded { inset: 12px !important; }
dialog#checkoutDialog.wm-expanded { --checkout-x: 0px !important; --checkout-y: 0px !important; }
.wm-expanded > .wm-surface,
dialog > .wm-surface.wm-expanded {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 0 !important;
  max-height: none !important;
  border-radius: 0 !important;
}

@media (max-width: 700px) {
  .wm-expand { display: none !important; }
  .wm-drag-handle { cursor: default; touch-action: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .wm-surface { transition: none; }
}
/* El contenido hace scroll dentro de la ventana; el encabezado conserva los controles. */
html.wm-page-locked{overflow:hidden!important;overscroll-behavior:none}
.wm-bounded{box-sizing:border-box;min-width:0!important;max-width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px)!important;overscroll-behavior:contain}
dialog.wm-shell{padding:0!important;overflow:hidden!important;min-width:0!important;max-width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px)!important}
dialog.wm-shell>.wm-bounded{margin:0!important;overflow-y:auto;overscroll-behavior:contain;max-width:100%!important}
.wm-bounded>.modal-head,.wm-bounded>.checkout-head,.wm-bounded>.head,.wm-bounded>.dialog-head,.wm-bounded>.modal-title,.wm-bounded>.p66-window-head,.wm-bounded>.cons-window-head,.wm-bounded>header{flex-shrink:0;position:sticky;top:0;z-index:8}
.wm-bounded>.body,.wm-bounded>.dialog-body,.wm-bounded>#detailBody,.wm-bounded>.db-import-body{min-height:0;overflow:auto;overscroll-behavior:contain;flex:1}
dialog.wm-bounded[open]:has(>.body),dialog.wm-bounded[open]:has(>.dialog-body),dialog.wm-bounded[open]:has(>#detailBody){display:flex;flex-direction:column;overflow:hidden}
.wm-bounded>footer,.wm-bounded>.dialog-actions,.wm-bounded>.modal-actions{flex-shrink:0;flex-wrap:wrap}
.wm-actions{align-self:center}.wm-actions button{flex-shrink:0}
.wm-bounded.wm-expanded{max-width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px)!important}
.modal.wm-expanded:not(dialog),.modal-overlay.wm-expanded,.db-import-overlay.wm-expanded{width:100vw!important;height:100dvh!important;inset:0!important;padding:12px!important;border-radius:0!important}
.wm-bounded:focus{outline:none}
@media(max-width:700px){.wm-bounded{max-width:calc(100vw - 16px)!important;max-height:calc(100dvh - 16px)!important}.wm-bounded>header,.wm-bounded>.head,.wm-bounded>.dialog-head{gap:8px}.wm-bounded>header h2,.wm-bounded>.head h2,.wm-bounded>.dialog-head h2{font-size:19px}.wm-bounded footer button{white-space:normal}.wm-actions{gap:4px}}
@media print{html.wm-page-locked,body.wm-modal-open{overflow:visible!important}.wm-bounded{max-height:none!important}.wm-actions{display:none!important}}
/* El ajuste al viewport es inmediato para evitar recortes durante un cambio de monitor. */
.wm-surface{transition:none}
.wm-managed.wm-expanded{left:12px!important;top:12px!important}
.p66-modal.wm-expanded{inset:0!important;width:100vw!important;height:100dvh!important;padding:12px!important}
.wm-taskbar{position:fixed;z-index:9000;bottom:12px;left:12px;right:12px;display:flex;gap:8px;flex-wrap:wrap;pointer-events:none}
.wm-taskbar .wm-task{pointer-events:auto;max-width:100%;padding:11px 16px;border:1px solid #4682ad;border-radius:9px;background:#173e60;color:#fff;font:650 13px 'Segoe UI',Arial,sans-serif;box-shadow:0 4px 15px #12334c30;cursor:pointer}
.wm-taskbar{transform:none}
