/* Operational forms only: auth, header, appearance and dashboard retain their owners.
   No display overrides: hidden/inline/permission and disabled states remain authoritative. */
body > .modal {
    padding: 12px;
    box-sizing: border-box;
    overflow-y: auto;
}
body > .modal .modal-content {
    box-sizing: border-box;
    width: min(100%, 760px);
    min-width: 0;
    max-width: 100%;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
}
body > .modal .modal-content-wide { width: min(100%, 1100px); }
body > .modal :is(.modal-header, .modal-body, .modal-footer, .modal-actions) {
    min-width: 0;
    box-sizing: border-box;
}
body > .modal :is(.modal-footer, .modal-actions) {
    flex-wrap: wrap;
    gap: 8px;
}
body > .modal .modal-header > :first-child { min-width: 0; }
body > .modal .modal-close { flex-shrink: 0; }
body > .modal .form-group { margin-bottom: 16px; }
body > .modal label { line-height: 1.5; }
body > .modal :is(input:not([type="checkbox"]):not([type="hidden"]), select, textarea) {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    width: 100%;
}
body > .modal .form-inline { gap: 8px; flex-wrap: wrap; }
body > .modal .form-inline input { flex: 1 1 100px; }
body > .modal :is(pre, #detalleLog) {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    overflow: auto;
    max-height: 45dvh;
    white-space: pre;
}
/* Existing containers provide grouping without moving or rebinding controls. */
main > .section:not(#dashboardSection) :is(.form-group, .form-inline, .card,
    .informes-pro-block, .informes-pro-fields, .auditoria-detail-card,
    .logs-filter-panel, .ausencias-filtros) { min-width: 0; }
main > .section:not(#dashboardSection) :is(input:not([type="checkbox"]), select, textarea) {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}
main > .section:not(#dashboardSection) :is(.config-rrhh-actions, .auditoria-inline-actions,
    .logs-filtros, .form-inline, .toolbar-filtros) { flex-wrap: wrap; gap: 8px; }
main > .section:not(#dashboardSection) :is(.form-group, .auditoria-detail-card) label {
    line-height: 1.5;
}
:is(body > .modal, main > .section:not(#dashboardSection)) :is(button, input, select, textarea):focus-visible {
    outline: 3px solid var(--appearance-focus);
    outline-offset: 2px;
}
:is(body > .modal, main > .section:not(#dashboardSection)) .form-error {
    color: var(--appearance-danger);
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
}
:is(body > .modal, main > .section:not(#dashboardSection)) :is(.field-help, .modal-subtitle) {
    color: var(--appearance-muted);
    overflow-wrap: anywhere;
}
body > .modal :is(.pausa-version-warning, .ausencia-preview-card.warning) {
    color: var(--appearance-warning);
    overflow-wrap: anywhere;
}
#configRrhhSection #configRrhhMensaje { color: var(--appearance-info); }
@media (max-width: 900px) {
    body > .modal :is(.ausencia-modal-grid, .ausencia-form-row) {
        grid-template-columns: minmax(0, 1fr);
    }
    main > .section:not(#dashboardSection) :is(.config-rrhh-layout, .informes-pro-grid,
        .informes-pro-two-columns, .informes-pro-fields, .auditoria-detail-grid) {
        grid-template-columns: minmax(0, 1fr);
    }
    main > .section:not(#dashboardSection) .auditoria-detail-card-wide { grid-column: auto; }
}
@media (max-width: 480px) {
    body > .modal :is(.modal-header, .modal-body, .modal-footer, .modal-actions) { padding: 16px; }
    body > .modal :is(.modal-footer, .modal-actions) button { flex: 1 1 120px; white-space: normal; }
    main > .section:not(#dashboardSection) :is(.card, .informes-pro-block) { padding: 16px; }
}
