/* Capa responsive global. Se carga después de los estilos históricos. */
html { -webkit-text-size-adjust: 100%; }
body { min-width: 0; overflow-x: hidden; }
img, svg, video, canvas { max-width: 100%; height: auto; }
.pc-content, #wrapper, #page-wrapper { min-width: 0; }
.table-responsive { -webkit-overflow-scrolling: touch; }
.form-control, .form-select, input, select, textarea { max-width: 100%; }
.auth-page { min-height: 100dvh; background: linear-gradient(145deg, #f4f8fd 0%, #eaf1f9 100%); }
.auth-page .pc-sidebar, .auth-page .pc-header, .auth-page footer { display: none !important; }
.auth-page .pc-container { margin: 0 !important; min-height: 100dvh; }
.auth-page .pc-content { display: grid; min-height: 100dvh; place-items: center; padding: 1rem !important; }
.auth-page #wrapper, .auth-page #page-wrapper, .auth-page #page-wrapper > .row { width: 100%; margin: 0; }
.auth-page #page-wrapper > .row > [class*="col-"] { padding: 0; }
.auth-page .form-signin { width: min(100%, 460px); margin: auto; }

@media (max-width: 991.98px) {
    .pc-header .header-wrapper { padding-inline: .75rem; }
    .pc-container .pc-content { padding: 76px .9rem 1.5rem; }
    .pc-menu-toggle { display: inline-grid; min-width: 44px; min-height: 44px; place-items: center; border: 0; border-radius: 10px; color: #17365d; background: #eef4fb; }
    .pc-header .header-user-profile .user-name, .pc-header .header-user-profile .ml-2 { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .list-page-header, .app-page-heading, .app-header { align-items: flex-start !important; flex-direction: column; gap: .85rem; }
    .list-page-actions, .app-page-heading > div:last-child { width: 100%; flex-wrap: wrap; }
    .list-toolbar { align-items: stretch; flex-direction: column; }
    .list-toolbar-actions, .list-filter-tabs { width: 100%; overflow-x: auto; }
    .list-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 767.98px) {
    body { font-size: 15px; }
    .pc-container .pc-content { padding-inline: .65rem; }
    #page-wrapper > .row { margin-inline: 0; }
    #page-wrapper > .row > [class*="col-"] { padding-inline: 0; }
    h1, .list-title { font-size: clamp(1.45rem, 7vw, 1.9rem) !important; line-height: 1.15; }
    h2 { font-size: 1.15rem; }
    .card-body, .panel-body, .app-table-card-header { padding: 1rem !important; }
    .btn, .app-btn, .list-action-btn { min-height: 44px; }
    .form-control, .form-select { min-height: 44px; font-size: 16px; }
    textarea.form-control { min-height: 110px; }

    .mobile-page-heading { align-items: stretch !important; flex-direction: column; gap: .85rem; }
    .mobile-page-actions, .mobile-form-actions { width: 100%; flex-direction: column; }
    .mobile-page-actions .btn, .mobile-form-actions .btn { width: 100%; }
    .mobile-progress-form { align-items: stretch !important; flex-direction: column; }

    .form-horizontal .form-group { display: block !important; margin: 0 0 1rem !important; }
    .form-horizontal .control-label { display: block; width: 100% !important; margin-bottom: .4rem; padding: 0 !important; text-align: left !important; }
    .form-horizontal .col-sm-10, .form-horizontal .col-sm-2, .form-horizontal [class*="col-sm-"] { width: 100%; padding-inline: 0; }
    .contract-create-page, .contract-create-form-row { margin-inline: 0 !important; padding-inline: 0 !important; }
    .contract-create-page .container-arrow { display: none; }
    .contract-create-form-row .panel-footer { display: grid; gap: .55rem; padding: 1rem; }
    .contract-create-form-row .panel-footer .btn { width: 100%; margin: 0 !important; }
    .radio-inline { display: inline-flex; align-items: center; min-height: 44px; margin-right: .8rem; }
    input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }

    .mobile-auth-form { width: min(100%, 430px); margin: 1rem auto; border: 1px solid #dce5f0; border-radius: 14px; padding: 1.1rem; background: #fff; box-shadow: 0 14px 35px rgba(17,35,63,.09); }
    .mobile-auth-form .login-brand { display: flex !important; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1rem !important; }
    .mobile-auth-form .login-brand img:first-child { width: min(55vw, 190px); padding-right: 0 !important; }
    .mobile-auth-form .login-brand img:last-child { width: 64px; height: 64px !important; object-fit: contain; padding-left: 0 !important; }
    .mobile-auth-form .separator-gradient { height: 48px; width: 3px; }
    .mobile-auth-form .col-10 { width: 100%; }
    .mobile-auth-form button[type="submit"] { width: 100%; margin-bottom: .75rem; }

    .mobile-card-table, .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td { display: block; width: 100%; }
    .mobile-card-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .mobile-card-table tbody { padding: .65rem; }
    .mobile-card-table tbody tr { margin-bottom: .75rem; border: 1px solid #dbe4ef; border-radius: 10px; padding: .45rem .8rem; background: #fff; box-shadow: 0 4px 12px rgba(17,35,63,.05); }
    .mobile-card-table tbody td { display: grid; grid-template-columns: minmax(92px, 35%) 1fr; gap: .65rem; min-width: 0 !important; border: 0; border-bottom: 1px solid #edf1f6; padding: .65rem 0; text-align: left !important; overflow-wrap: anywhere; }
    .mobile-card-table tbody td:last-child { border-bottom: 0; }
    .mobile-card-table tbody td::before { content: attr(data-label); color: #6e8198; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
    .mobile-card-table .progress { min-width: 0; }

    .ui-jqgrid, .ui-jqgrid-view, .ui-jqgrid-hdiv, .ui-jqgrid-bdiv, .ui-jqgrid-pager { max-width: 100% !important; }
    .ui-jqgrid-bdiv { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .ui-jqgrid .ui-pg-table { width: 100%; }
}

@media (max-width: 575.98px) {
    .list-stat-grid, .dashboard-metrics, .payments-index-kpis { grid-template-columns: 1fr !important; }
    .dashboard-hero, .dashboard-card, .list-table-card, .app-table-card { border-radius: 10px !important; }
    .dashboard-actions { display: grid !important; width: 100%; grid-template-columns: 1fr; }
    .dashboard-actions a { width: 100%; justify-content: center; }
    .dashboard-split { grid-template-columns: 1fr !important; }
    .list-page-actions { display: grid !important; grid-template-columns: 1fr !important; }
    .list-page-actions .btn { width: 100%; }
    .alert { overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
