/* Adaptación de las vistas heredadas al sistema visual de Vuexy/Bootstrap 5. */
:root,
[data-bs-theme="light"] {
    --firmas-cyan: #35b8e8;
    --firmas-cyan-deep: #239bd2;
    --firmas-green: #28b482;
    --firmas-green-deep: #159966;
    --firmas-red: #df2450;
    --firmas-red-deep: #c91943;
    --firmas-yellow: #ffbb22;
    --firmas-blue-gray: #484979;
    --firmas-blue-gray-deep: #285c79;

    --bs-blue: var(--firmas-cyan);
    --bs-indigo: var(--firmas-blue-gray);
    --bs-purple: var(--firmas-blue-gray);
    --bs-red: var(--firmas-red);
    --bs-orange: var(--firmas-yellow);
    --bs-yellow: var(--firmas-yellow);
    --bs-green: var(--firmas-green);
    --bs-teal: var(--firmas-green);
    --bs-cyan: var(--firmas-cyan);
    --bs-primary: #137ca5;
    --bs-primary-rgb: 19, 124, 165;
    --bs-primary-contrast: #fff;
    --bs-primary-text-emphasis: #0d5878;
    --bs-primary-bg-subtle: #e2f6fc;
    --bs-primary-border-subtle: #9adcf0;
    --bs-secondary: var(--firmas-blue-gray);
    --bs-secondary-rgb: 72, 73, 121;
    --bs-secondary-text-emphasis: #252642;
    --bs-secondary-bg-subtle: #ededf5;
    --bs-secondary-border-subtle: #b6b8d5;
    --bs-success: #18845e;
    --bs-success-rgb: 24, 132, 94;
    --bs-success-contrast: #fff;
    --bs-success-text-emphasis: #145d43;
    --bs-success-bg-subtle: #dff5ed;
    --bs-success-border-subtle: #a5e0ca;
    --bs-info: var(--firmas-cyan-deep);
    --bs-info-rgb: 35, 155, 210;
    --bs-info-contrast: #163845;
    --bs-info-text-emphasis: #135464;
    --bs-info-bg-subtle: #e1f5fa;
    --bs-info-border-subtle: #a6dce9;
    --bs-warning: var(--firmas-yellow);
    --bs-warning-rgb: 255, 187, 34;
    --bs-warning-contrast: #3d3217;
    --bs-warning-text-emphasis: #664a0c;
    --bs-warning-bg-subtle: #fff5d9;
    --bs-warning-border-subtle: #f3d285;
    --bs-danger: var(--firmas-red);
    --bs-danger-rgb: 223, 36, 80;
    --bs-danger-contrast: #fff;
    --bs-danger-text-emphasis: #75142d;
    --bs-danger-bg-subtle: #fbe4ea;
    --bs-danger-border-subtle: #ed9eb0;
    --bs-dark: var(--firmas-blue-gray-deep);
    --bs-dark-rgb: 40, 92, 121;
    --bs-link-color: #168dbb;
    --bs-link-color-rgb: 22, 141, 187;
    --bs-link-hover-color: #0d6f99;
    --bs-link-hover-color-rgb: 13, 111, 153;
    --bs-focus-ring-color: rgba(53, 184, 232, .25);
    --bs-form-valid-color: var(--firmas-green-deep);
    --bs-form-valid-border-color: var(--firmas-green);
    --bs-form-invalid-color: var(--firmas-red-deep);
    --bs-form-invalid-border-color: var(--firmas-red);
}

body { min-height: 100vh; }
.firmas-content { max-width: 100%; }
.firmas-content .row { --bs-gutter-x: 1.25rem; --bs-gutter-y: .75rem; }
.layout-navbar { z-index: 10; }
.layout-navbar.navbar-detached.container-xxl { max-inline-size: 100%; }
.layout-navbar .dropdown-user .avatar { flex: 0 0 var(--bs-avatar-size); overflow: hidden; }
.btn > .btn-icon-wrapper { display: inline-flex; align-items: center; margin-right: .5rem; padding-right: 0 !important; }
#iconActualizarDashboard, #iconActualizarDashboardFin { margin-right: .5rem; }
.app-brand-logo img { display: block; object-fit: contain; }
.app-brand-logo .firmas-sidebar-monogram { width: 2.5rem; height: auto; }

/* Elementos de página que aún usan los nombres de clase del tema anterior. */
.app-page-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 1.5rem; padding: 0; background: transparent; box-shadow: none; }
.app-page-title .page-title-wrapper { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 1rem; }
.app-page-title .page-title-actions { display: flex; flex: 0 0 auto; justify-content: flex-end; margin-left: auto; }
.app-page-title .page-title-heading { margin: 0; color: var(--bs-heading-color); font-size: 1.25rem; font-weight: 500; }
.app-page-title .page-title-subheading { margin: .25rem 0 0; color: var(--bs-secondary-color); font-size: .875rem; }
.app-page-title .page-title-icon { display: grid; width: 3rem; height: 3rem; place-items: center; border-radius: .5rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.main-card { overflow: hidden; border: 0; border-radius: .5rem; background: var(--bs-card-bg); box-shadow: 0 .125rem .5rem rgba(47, 43, 61, .12); }
.firmas-content .main-card.mb-3, .firmas-content .widget-content.mb-3 { margin-bottom: .75rem !important; }
.firmas-content .main-card > .card-body { padding: .875rem; }
.firmas-content .main-card .card-header, .firmas-content .main-card > .card-footer { padding-top: .625rem; padding-bottom: .625rem; }
.main-card .card-header { border-bottom: 1px solid var(--bs-border-color); background: transparent; color: var(--bs-heading-color); font-weight: 600; }
.firmas-content .main-card .card-body > .card-header { margin: -.875rem -.875rem .875rem; padding-right: .875rem; padding-left: .875rem; }
.main-card .card-body > .card-title { color: var(--bs-heading-color); font-size: .9375rem; font-weight: 600; }

/* Tarjetas del dashboard legado con paleta equivalente a los colores Vuexy. */
.widget-content { min-height: 5rem; padding: 1rem; border-radius: .5rem; box-shadow: 0 .125rem .5rem rgba(47, 43, 61, .12); }
.widget-content-wrapper { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.widget-heading { font-weight: 600; }
.widget-subheading { opacity: .8; font-size: .875rem; }
.widget-numbers { font-size: 1.75rem; font-weight: 600; }
.widget-content.bg-arielle-smile { background: linear-gradient(110deg, var(--firmas-cyan), #42aaf0); }
.widget-content.bg-grow-early { background: linear-gradient(110deg, #31b98c, var(--firmas-green-deep)); }
.widget-content.bg-danger { background: linear-gradient(110deg, var(--firmas-red), var(--firmas-red-deep)) !important; }
.widget-content.bg-warning { background: linear-gradient(110deg, #ffbd22, var(--firmas-yellow)) !important; }
.widget-content.bg-midnight-bloom { background: linear-gradient(110deg, var(--firmas-blue-gray), var(--firmas-blue-gray-deep)); }
.bg-premium-dark { background: linear-gradient(135deg, #4b4b4b, #6f6f6f); }
.bg-sunny-morning { background: linear-gradient(135deg, #ff9f43, #ffb976); }
.bg-love-kiss { background: linear-gradient(135deg, var(--firmas-red), #f16c87); }
.bg-mean-fruit { background: linear-gradient(135deg, var(--firmas-green), #48daaa); }
.text-white .widget-heading, .text-white .widget-subheading, .text-white .widget-numbers { color: #fff !important; }

/* Alias de estructura y utilidades Bootstrap 4 aún presentes en formularios. */
.form-row { display: flex; flex-wrap: wrap; margin-right: -.75rem; margin-left: -.75rem; }
.form-row > [class*="col-"] { padding-right: .75rem; padding-left: .75rem; }
.custom-select { display: block; width: 100%; padding: .422rem 2rem .422rem .875rem; border: 1px solid #dbdade; border-radius: .375rem; background-color: #fff; color: #6f6b7d; font-size: .9375rem; line-height: 1.5; }
.btn-default { border: 1px solid var(--bs-border-color); background-color: var(--bs-body-bg); color: var(--bs-body-color); }
.btn-default:hover { border-color: var(--bs-secondary); background-color: var(--bs-tertiary-bg); }
.badge-pill { border-radius: 50rem; }
.form-group { margin-bottom: 1rem; }
.input-group-append { display: flex; margin-left: -.0625rem; }
.input-group-prepend { display: flex; margin-right: -.0625rem; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.float-left { float: left !important; }
.float-right { float: right !important; }
.close { float: right; border: 0; background: transparent; color: #6f6b7d; font-size: 1.5rem; line-height: 1; opacity: .65; }
.sr-only, .sr-only-focusable:not(:focus):not(:focus-within) { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }
.ml-1 { margin-left: .25rem !important; }
.ml-2 { margin-left: .5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.mr-1 { margin-right: .25rem !important; }
.mr-2 { margin-right: .5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.pl-0 { padding-left: 0 !important; }
.pr-0 { padding-right: 0 !important; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { border-radius: 4px; background: #ccc; }
*::-webkit-scrollbar-thumb:hover { background: #b3b3b3; box-shadow: 0 0 2px 1px rgba(0, 0, 0, .2); }
*::-webkit-scrollbar-thumb:active { background: #999; }
*::-webkit-scrollbar-track { border-radius: 4px; background: #e1e1e1; }
*::-webkit-scrollbar-track:hover, *::-webkit-scrollbar-track:active { background: #d4d4d4; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }

/* Conserva el diseño compacto de las tablas; los controles mantienen Bootstrap 5. */
table.dataTable { width: 100% !important; font-size: .8125rem; }
table.dataTable thead th, table.dataTable tbody td { padding: .35rem .5rem !important; vertical-align: middle; }
table.dataTable tbody tr { height: auto; }
table.dataTable th, table.dataTable td { white-space: normal; }
table.dataTable td:last-child, table.dataTable th:last-child { white-space: nowrap; }
table.dataTable, table.app-data-table { width: 100%; table-layout: auto; }
table.dataTable td:last-child .btn, table.dataTable td:last-child button,
table.app-data-table td:last-child .btn, table.app-data-table td:last-child button {
    display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center;
    margin: 0 1px; padding: 0 !important; line-height: 1;
}
table.dataTable td:last-child .btn-group, table.app-data-table td:last-child .btn-group {
    display: inline-flex; width: auto; flex: 0 0 auto; flex-wrap: nowrap; gap: 1px; vertical-align: middle;
}
table.dataTable td:last-child .btn-group > .btn, table.app-data-table td:last-child .btn-group > .btn {
    flex: 0 0 24px; margin: 0; border-radius: .375rem !important;
}
table.dataTable td:last-child .btn i, table.dataTable td:last-child .btn .fa,
table.dataTable td:last-child .btn .fas, table.dataTable td:last-child .btn .far,
table.app-data-table td:last-child .btn i, table.app-data-table td:last-child .btn .fa,
table.app-data-table td:last-child .btn .fas, table.app-data-table td:last-child .btn .far { font-size: .75rem; }
table.dataTable th.dt-content-fit, table.dataTable td.dt-content-fit,
table.app-data-table th.dt-content-fit, table.app-data-table td.dt-content-fit { width: 1%; white-space: nowrap !important; }
table.app-data-table > tbody > tr > td:first-child .btn { height: 24px; padding-top: 0; padding-bottom: 0; line-height: 22px; font-size: .875rem; }
.firmas-content .table-responsive > table { width: 100%; table-layout: auto; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter,
.dt-container .dt-length, .dt-container .dt-search { margin-bottom: .75rem; font-size: .8125rem; }
.dataTables_wrapper .dataTables_paginate, .dt-container .dt-paging { padding-top: .75rem; }
.dataTables_wrapper .dataTables_info, .dt-container .dt-info { padding-top: .9rem; font-size: .8125rem; }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select,
.dt-container .dt-search input, .dt-container .dt-length select { margin-left: .4rem; }

/* Login de FIRMAS, alineado con la identidad de la suite Ingenial IA. */
.firmas-login-page { min-width: 320px; min-height: 100vh; margin: 0; background: #f7f8fc; }
.login-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.login-brand-panel { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(2rem, 4vw, 4.25rem); color: #fff; background: #1282a4; }
.login-brand-panel::after { position: absolute; right: -12rem; bottom: -18rem; width: 42rem; height: 42rem; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; content: ""; box-shadow: 0 0 0 3rem rgba(255,255,255,.035), 0 0 0 7rem rgba(255,255,255,.025); pointer-events: none; }
.login-brand { z-index: 1; display: inline-flex; width: fit-content; align-items: flex-start; flex-direction: column; gap: .1rem; color: #fff; text-decoration: none; }
.login-brand-mark { display: block; width: clamp(14rem, 20vw, 19rem); flex: 0 0 auto; overflow: visible; padding-bottom: 0; background: transparent; line-height: 0; }
.login-brand-mark img { display: block; width: 100%; height: auto; max-height: none; overflow: visible; object-fit: contain; }
.login-brand-copy { display: flex; flex-direction: column; line-height: 1.35; }
.login-brand-copy strong { font-size: 1rem; font-weight: 700; }
.login-brand-copy small { color: rgba(255,255,255,.82); font-size: .8125rem; }
.login-welcome { z-index: 1; max-width: 36rem; margin: auto 0; padding: 4rem 0; }
.login-app-name { margin-bottom: .75rem; color: rgba(255,255,255,.78); font-size: .8125rem; font-weight: 700; letter-spacing: .16em; }
.login-welcome h1 { max-width: 33rem; margin: 0 0 1.25rem; color: #fff; font-size: clamp(2.5rem, 4vw, 3.5rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.12; }
.login-welcome > p:last-child { margin: 0; color: rgba(255,255,255,.88); font-size: 1rem; line-height: 1.65; }
.login-welcome a { color: #fff; text-decoration: none; }
.login-welcome a:hover { text-decoration: underline; }
.login-brand-footer { z-index: 1; color: rgba(255,255,255,.75); font-size: .75rem; }
.login-form-panel { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: clamp(2rem, 6vw, 6rem); background: #f7f8fc; }
.login-form-content { width: min(100%, 28rem); }
.login-form-brand { display: none; align-items: center; gap: .5rem; margin-bottom: 2.5rem; color: #343044; font-size: 1.25rem; font-weight: 700; }
.login-form-brand img { width: 2rem; height: 2rem; object-fit: contain; }
.login-form-content h2 { margin: 0 0 .5rem; color: #171a2b; font-size: 1.75rem; font-weight: 700; letter-spacing: -.025em; }
.login-form-intro { margin: 0 0 2rem; color: #777b8c; }
.login-form-content .form-label { color: #424657; font-weight: 500; }
.login-form-content .form-control { min-height: 2.875rem; border-color: #dfe2eb; background: #fff; }
.login-form-content .form-control:focus { border-color: #1282a4; box-shadow: 0 0 0 .2rem rgba(18,130,164,.14); }
.login-submit { display: flex; width: 100%; min-height: 2.875rem; align-items: center; justify-content: center; gap: .65rem; border: 0; border-radius: .5rem; background: #1282a4; box-shadow: 0 3px 7px rgba(18,130,164,.22); font-weight: 600; }
.login-submit:hover, .login-submit:focus { background: #0e708e; }
.login-submit i { font-size: 1.125rem; }
.login-form-content .alert { margin-bottom: 1.5rem; }
.login-legal { margin: 2rem 0 0; color: #8a91a5; font-size: .75rem; line-height: 1.55; text-align: center; }

@media (max-width: 767.98px) {
    .app-page-title { align-items: flex-start; flex-direction: column; }
    .app-page-title .page-title-wrapper { align-items: flex-start; flex-direction: column; }
    .app-page-title .page-title-actions { align-self: flex-end; margin-left: 0; }
    .firmas-content { padding-top: 1rem; }
    .firmas-content .row { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
    .widget-content-wrapper { align-items: flex-start; }
    table.dataTable thead th, table.dataTable tbody td, table.app-data-table thead th, table.app-data-table tbody td { padding: .25rem .375rem !important; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { min-height: 0; padding: 1.5rem; }
    .login-brand-mark { width: clamp(12rem, 54vw, 16rem); }
    .login-welcome { margin: 2.5rem 0 0; padding: 0 0 1.5rem; }
    .login-app-name { margin-bottom: .4rem; }
    .login-welcome h1 { max-width: 28rem; margin-bottom: .75rem; font-size: clamp(1.75rem, 7vw, 2.5rem); }
    .login-welcome > p:last-child { font-size: .875rem; }
    .login-brand-footer { display: none; }
    .login-form-panel { min-height: auto; padding: 2.5rem 1.5rem 3rem; }
    .login-form-brand { display: flex; }
    .login-form-content h2 { font-size: 1.5rem; }
}
