.loading {
    position: fixed;
    top: 30%;
    left: 50%;                                  /* default: centro viewport */
    transform: translate(-50%, -50%);
    z-index: 99999999;
    text-align: center;
}

/* Desktop con sidebar visible (no collapsed) — desplaza por mitad del sidebar
   (260px / 2 = 130px) para centrar en el area de contenido. */
@media (min-width: 992px) {
    body:has(.sidebar:not(.collapsed)) .loading {
        left: calc(50% + 130px);
    }
}

.form-switch {
    padding-left: 0 !important;
    display: table-cell;
}

.form-switch>input[type="checkbox"] {
    margin: 5px 0 0 20px;
    float: none !important;
}

/*
.form-switch>input[type="checkbox"].editing {
    margin-top: 10px;
}
*/
/*#ffc107
#f5b800*/
.td-icon {
    width: 24px;
    cursor: pointer;
}

.ii-options-div {
    min-width: 80px;
}

.iii-options-div {
    min-width: 110px
}

.margin-left-5 {
    margin-left: 5px !important;
}

.bold {
    font-weight: bold;
}

.text-1 {
    font-size: 20px;
}

.text-2 {
    font-size: 18px;
}

.text-3 {
    font-size: 16px;
}

.text-4 {
    font-size: 14px;
}

.text-5 {
    font-size: 12px;
}

.inline-block {
    display: inline-block;
}

.block {
    display: block;
}

/*
.custom-table thead tr {
    background-color: #7c97b7;
}

.custom-table th, .custom-table td {
    text-align: center;
    padding: 3px 10px;
}

.list-results .result-item:nth-child(even) {
    background-color: #d9dee9;
}

.list-results .result-item:nth-child(odd) {
    background-color: #bebede;
}

.list-results .result-item:hover {
    background-color: #9c9cca;
}
*/
.table {
    width: unset;
}

.custom-table td>button {
    margin-left: 5px;
}

.custom-table thead tr {
    background-color: #344860 !important;
    color: white !important;
}

.custom-table th, .custom-table td {
    padding: 8px 12px !important;
}

.list-results .result-item:nth-child(even) {
    background-color: #eef1f7 !important;
}

.list-results .result-item:nth-child(odd) {
    background-color: #d8d8ee !important;
}

.list-results .result-item:hover {
    background-color: #c5c5e7 !important;
}

.row-sub-header {
    background-color: #d8d8ee !important;
}

.row-info {
    background-color: #eef1f7 !important;
}

.row-total {
    background-color: #b9b9df !important;
}


.span-combo {
    margin-top: 4px;
    display: block;
}

.space-2 {
    margin-top: 20px;
}

.space-3 {
    margin-top: 40px;
}

.mainmod {
    overflow: unset !important;
    overflow-y: hidden !important;
}

.row-disabled {
    background-color: #888 !important;
}

.txt-money {
    max-width: 90px !important;
    min-width: 80px !important;
    margin: 0 auto;
}

.upper-table-header {
    background-color: #89b77c !important;
}

.red-header-text {
    color: #d91010;
}

.green-text {
    color: #1a8a2e;
}

.blue-text {
    color: #1a6fb5;
}

.cell-error {
    background-color: #f8d7da !important;
    border-left: 3px solid #d91010 !important;
}

.cell-error input {
    border-color: #d91010 !important;
}

.stage3-row {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.stage3-row > [class*="col-"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Stage 3 table */
.stage3-table-container {
    overflow-x: auto;
    padding-top: 0 !important;
}

.stage3-table-container .stage3-table {
    margin-top: 0 !important;
}

.stage3-options {
    margin-bottom: 10px;
}

.stage3-option-label {
    margin-right: 20px;
    font-size: 13px;
    cursor: pointer;
}

.stage3-option-label input {
    margin-right: 5px;
}

/* Sticky rows (top headers) - only when enabled */
.sticky-rows-enabled {
    max-height: 80vh;
    overflow: auto;
    /* Eliminar cualquier padding-top del contenedor: con sticky thead a top:0,
       cualquier gap superior deja ver las filas del body al hacer scroll. */
    padding-top: 0 !important;
}

.sticky-rows-enabled .stage3-table {
    /* No margen superior — la primera fila del thead debe quedar pegada al borde
       del contenedor para que sticky:top:0 cubra desde el primer pixel. */
    margin-top: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
}

.sticky-rows-enabled .stage3-table thead th,
.sticky-rows-enabled .stage3-table thead td {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #344860 !important;
    color: white !important;
}

/* Sticky cols (left unit column) - only when enabled */
.sticky-cols-enabled .sticky-col-left {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: #fff !important;
    border-right: 2px solid #dee2e6;
}

.sticky-cols-enabled .stage3-table thead .sticky-col-left {
    background-color: #344860 !important;
    color: white !important;
}

.sticky-cols-enabled .stage3-table tbody tr:nth-child(even) .sticky-col-left {
    background-color: #f8f9fa !important;
}

/* Both enabled: corner cell needs highest z-index */
.sticky-rows-enabled.sticky-cols-enabled .stage3-table thead .sticky-col-left {
    z-index: 3 !important;
}

/* Row highlight on hover */
.stage3-table tbody tr:hover td {
    background-color: #e8f4fd !important;
}

.sticky-cols-enabled .stage3-table tbody tr:hover .sticky-col-left {
    background-color: #e8f4fd !important;
}

.btn-header {
    margin: 5px;
}

@media (max-width: 575.98px) {
    .sidebar:not(.collapsed) .navbar {
        position: fixed;
    }

    /*
    .content {
        margin-top: 60px;
    }*/
}

.top-tags {
    list-style-type: none;
    padding: 0;
}

.top-tags li {
    display: inline-block;
    background-color: #dde5f0;
    border-color: #2b2b41;
    border-width: 2px;
    border-style: solid;
    padding: 2px 5px;
    cursor: pointer;
}

.top-tags li.tag-selected {
    color: #fff;
    background-color: #415777;
    border-color: #2b2b41;
}

.top-tags li:hover {
    display: inline-block;
    color: #fff;
    background-color: #2b2b41;
    border-color: #dde5f0;
}

.tipo-gasto-help-table td {
    padding-left: 15px;
}

.text-green {
    color: #1a8a2e;
}

.text-red {
    color: #d91010;
}

.text-blue {
    color: #1a6fb5;
}

.green-row {
    background-color: #c4e9cc !important;
}

.red-row {
    background-color: #e9c4c4 !important;
}

.stat-cell-data {
    position: relative;
}

.stat-cell-comment {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -3px;
    width: 20px;
}

.stat-cell-comment-no4>icon-menu {
    top: 4px;
    position: relative;
}

.stat-cell-comment-si4>icon-menu {
    top: 36%;
    position: relative;
}

.stat-cell-data-no4>input, .stat-cell-data-si4>input {
    margin-left: 23px;
}

.btn-input-file {
    padding: 0 !important;
}

.btn-input-file::file-selector-button {
    padding: 0.2em !important;
    border-radius: 3px;
}

.imagemodal-img {
    max-width: 100%;
}

.imagemodal-mini {
    transition: all 0.3s ease-in-out;
}

.imagemodal-mini:hover {
    /* Scale up the size of the icon on hover */
    transform: scale(1.2);
    cursor: zoom-in;
}

.input-container {
    display: flex;
    align-items: center;
    /* Center the elements vertically */
}

.input-container input {
    flex: 1;
    /* Make the input take up all remaining space */
    margin-left: 10px;
    /* Add some spacing between the input and the span */
}

.im-wrapper {
    position: relative;
    display: inline-block;
}

.im-icon {
    width: 25px;
    height: 25px;
    cursor: pointer;
}

.im-menu {
    position: absolute;
    top: -10px;
    left: 29px;
    width: 25px;
    height: 46px;
    background-color: #fff;
    border: 1px solid #b8b8b8;
    border-radius: 3px;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.im-option {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.im-option:hover {
    background-color: #ddd;
}

[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
    display: none !important;
}

.lecturas-table tbody tr:nth-child(odd) {
    background-color: #f0f0f0 !important;
}

.lecturas-table tbody tr:nth-child(even) {
    background-color: #f8d7da !important;
}

.lecturas-table tbody tr:hover td {
    background-color: #e8f4fd !important;
}

/* ========== Impersonate Banner ========== */
.impersonate-banner {
    background: #ff6b35;
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: impersonate-pulse 2s ease-in-out infinite;
}

.impersonate-exit {
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    padding: 0 4px;
    border-radius: 3px;
}

.impersonate-exit:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
}

@keyframes impersonate-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* ========== Estado Stepper ========== */
.estado-stepper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    gap: 0;
}

.estado-step {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #999;
}

.estado-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #dee2e6;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 6px;
}

.estado-step-label {
    margin-right: 12px;
}

.estado-step.active .estado-step-number {
    background: #344860;
    color: #fff;
}

.estado-step.active .estado-step-label {
    color: #344860;
    font-weight: 600;
}

.estado-step.completed .estado-step-number {
    background: #1a8a2e;
    color: #fff;
}

.estado-step.completed .estado-step-label {
    color: #1a8a2e;
}

.estado-step-connector {
    width: 30px;
    height: 2px;
    background: #dee2e6;
    margin: 0 5px;
    align-self: center;
}

.estado-step.completed + .estado-step-connector,
.estado-step.active + .estado-step-connector {
    background: #344860;
}

/* ========== Pagination ========== */

.pg-list {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.pg-link {
    display: block;
    padding: 6px 10px;
    text-decoration: none !important;
    border: 1px solid gray;
    color: black;
    margin: 2px;
    border-radius: 5px;
    font-size: 13px;
}

.pg-link:hover {
    background-color: #e9ecef;
}

.pg-active {
    background-color: #0d6efd !important;
    color: #fff !important;
    border-color: #0d6efd !important;
}

.pg-disabled {
    color: #999 !important;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

/* ========== Mobile Responsiveness ========== */

/* All data tables scroll horizontally on small screens */
.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    /* General content padding */
    .content .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Tables: smaller text, tighter padding */
    .custom-table .table th,
    .custom-table .table td {
        font-size: 12px;
        padding: 6px 8px;
    }

    /* Hide less important columns on mobile */
    .d-hide-mobile {
        display: none !important;
    }

    /* Modals: full width on mobile */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    /* Pagination: stack vertically */
    .pagination-wrapper {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .pagination-wrapper nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Stage 3 specific */
    .stage3-table-container {
        max-height: 60vh;
    }

    .stage3-options {
        margin-bottom: 5px;
    }

    .stage3-option-label {
        font-size: 11px;
        margin-right: 10px;
    }

    /* Buttons: full width on mobile */
    .btn-mobile-full {
        width: 100%;
        margin-bottom: 5px;
    }

    /* Stats page: stack columns */
    .col-md-4, .col-md-6, .col-md-7 {
        margin-bottom: 15px;
    }

    /* Icon menu: easier to tap (44px effective touch area) */
    .td-icon {
        width: 28px;
        height: 28px;
        padding: 8px;
        box-sizing: content-box;
    }

    /* Ensure icon cells meet minimum touch target height */
    td:has(.td-icon) {
        min-height: 44px;
    }

    /* More spacing between adjacent icons on mobile */
    .margin-left-5 {
        margin-left: 8px;
    }

    /* Form inputs: full width */
    .txt-money {
        min-width: 70px !important;
        max-width: 90px !important;
    }

    /* Header: smaller title */
    h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .custom-table .table th,
    .custom-table .table td {
        font-size: 11px;
        padding: 4px 6px;
    }

    .modal-dialog {
        margin: 5px;
    }

    .btn {
        font-size: 12px;
        padding: 5px 10px;
    }
}