/* ========== Industria Page ========== */

/* --- Filter Card --- */
.industria-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.industria-card-header {
    background: var(--primary-gradient);
    color: white;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 12px 12px 0 0;
}

.industria-card-body {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* --- Toolbar: Search + Top --- */
.industria-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.industria-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 25%;
    min-width: 180px;
}

.industria-search-wrapper svg {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    pointer-events: none;
    opacity: 0.6;
    transition: color 0.2s, opacity 0.2s;
}

.industria-search-wrapper:focus-within svg {
    color: var(--primary-color);
    opacity: 1;
}

.industria-search {
    width: 100%;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 9px 14px 9px 36px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.industria-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(240, 116, 0, 0.2);
}

.industria-search::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* --- Button States (active/inactive) --- */
.btn-execute.btn-active {
    box-shadow: 0 0 0 2px rgba(240, 116, 0, 0.5), 0 4px 12px rgba(240, 116, 0, 0.3);
}

.btn-execute.btn-inactive {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    box-shadow: none;
}

.btn-execute.btn-inactive:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(240, 116, 0, 0.3);
}

/* --- Dropdown Buttons --- */
.dd-wrapper {
    position: relative;
    align-self: flex-end;
}

.dd-wrapper .btn-execute {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dd-wrapper .btn-execute svg {
    transition: transform 0.2s ease;
}

.dd-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    z-index: 50;
    animation: ddSlideIn 0.15s ease;
}

.dd-item {
    padding: 10px 18px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.dd-item:hover {
    background: var(--primary-gradient);
    color: white;
}

.dd-item + .dd-item {
    border-top: 1px solid var(--border-color);
}

/* ============ Table Design ============ */

/* --- Container --- */
.industria-page .camara-body {
    overflow-y: hidden;
}

.industria-page .ranking-scrollable {
    flex: 1;
    min-height: 0;
    max-height: none;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: auto;
}

/* Scrollbar */
.industria-page .ranking-scrollable::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.industria-page .ranking-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.industria-page .ranking-scrollable::-webkit-scrollbar-thumb {
    background: rgba(240, 116, 0, 0.25);
    border-radius: 3px;
}

.industria-page .ranking-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(240, 116, 0, 0.5);
}

.industria-page .ranking-scrollable::-webkit-scrollbar-corner {
    background: transparent;
}

/* --- Table --- */
.industria-page .ranking-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
}

/* --- Sticky Gradient Header --- */
.industria-page .ranking-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--primary-gradient);
}

.industria-page .ranking-table thead th {
    text-align: center;
    color: white;
    background: transparent;
    border-bottom: none;
    font-weight: 600;
    padding: 11px 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Header corners */
.industria-page .ranking-table thead th:first-child {
    border-top-left-radius: 12px;
}

.industria-page .ranking-table thead th:last-child {
    border-top-right-radius: 12px;
}

/* --- Rows --- */
.industria-page .ranking-table tbody tr {
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.industria-page .ranking-table tbody tr:nth-child(even) {
    background: rgba(240, 116, 0, 0.015);
}

.industria-page .ranking-table tbody tr:hover {
    background: rgba(240, 116, 0, 0.06);
    box-shadow: inset 3px 0 0 0 #f07400;
}

.industria-page .ranking-table tbody tr:hover td {
    background: transparent;
}

/* --- Cells --- */
.industria-page .ranking-table td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.08);
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--text-primary);
}

/* Rank column (#) */
.industria-page .ranking-table .th-rank,
.industria-page .ranking-table .td-rank {
    width: 38px;
    min-width: 38px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    padding-left: 8px;
    padding-right: 4px;
}

/* Name column (badge) */
.industria-page .ranking-table td:nth-child(2) {
    text-align: left;
    cursor: pointer;
}

/* Last row – clean edge */
.industria-page .ranking-table tbody tr:last-child td {
    border-bottom: none;
}

.industria-page .ranking-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.industria-page .ranking-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

/* --- Badge (first column) --- */
.badge-cell {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    background: rgba(240, 116, 0, 0.15);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 12px;
    white-space: nowrap;
}

/* --- TOTAL Row --- */
.industria-page .ranking-table tbody tr.tr-total {
    background: rgba(240, 116, 0, 0.06);
    box-shadow: inset 4px 0 0 0 #f07400;
}

.industria-page .ranking-table tbody tr.tr-total:hover {
    background: rgba(240, 116, 0, 0.1);
}

.industria-page .ranking-table tbody tr.tr-total td {
    font-weight: 700;
    font-size: 13px;
    padding-top: 11px;
    padding-bottom: 11px;
    border-bottom: 2px solid rgba(240, 116, 0, 0.15);
    color: var(--text-primary);
}

.industria-page .ranking-table tbody tr.tr-total td:first-child {
    cursor: default;
}

.industria-page .ranking-table tbody tr.tr-total .badge-cell {
    background: rgba(240, 116, 0, 0.15);
    font-weight: 700;
    font-size: 12.5px;
}

.industria-page .ranking-table tbody tr.tr-total:hover .badge-cell {
    transform: none;
}

/* --- Agencia table: text columns left-aligned --- */
.industria-page .tbl-agencia td:nth-child(-n+3) {
    text-align: left;
}

/* ============ Back to Top ============ */
.btn-back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 16px rgba(240, 116, 0, 0.4),
        0 0 0 0 rgba(240, 116, 0, 0);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease,
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease;
}

.btn-back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.btn-back-to-top:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow:
        0 8px 28px rgba(240, 116, 0, 0.5),
        0 0 0 6px rgba(240, 116, 0, 0.12);
}

.btn-back-to-top:active {
    transform: translateY(0) scale(0.95);
    box-shadow:
        0 2px 8px rgba(240, 116, 0, 0.4),
        0 0 0 3px rgba(240, 116, 0, 0.15);
}

.btn-back-to-top svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* Pulse ring animation */
.btn-back-to-top.visible::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(240, 116, 0, 0.4);
    animation: bttPulse 2s ease-in-out infinite;
}

@keyframes bttPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50%      { transform: scale(1.15); opacity: 0; }
}

/* ============ Responsive ============ */

/* --- Tablet (≤ 992px) --- */
@media (max-width: 992px) {
    .industria-card-body {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .industria-card-body .custom-dropdown-container {
        width: 100%;
    }

    .industria-card-body .dd-wrapper,
    .industria-card-body .btn-execute {
        width: 100%;
    }

    .industria-card-body .dd-wrapper .btn-execute {
        justify-content: center;
    }

    .industria-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .industria-search-wrapper {
        width: 100%;
        min-width: unset;
    }

    .industria-toolbar .custom-dropdown-container {
        width: 100%;
    }
}

/* --- Mobile (≤ 768px) --- */
@media (max-width: 768px) {
    .btn-back-to-top {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 42px;
        height: 42px;
    }

    .btn-back-to-top svg {
        width: 18px;
        height: 18px;
    }
    .industria-page .ranking-table {
        font-size: 11px;
    }

    .industria-page .ranking-table thead th {
        padding: 9px 8px;
        font-size: 10px;
        letter-spacing: 0.3px;
    }

    .industria-page .ranking-table td {
        padding: 7px 8px;
    }

    .badge-cell {
        padding: 2px 7px;
        font-size: 11px;
    }

    .industria-page .ranking-table tbody tr.tr-total td {
        font-size: 12px;
        padding-top: 9px;
        padding-bottom: 9px;
    }

    .industria-page .ranking-table tbody tr.tr-total .badge-cell {
        font-size: 11.5px;
    }

    .industria-page .ranking-scrollable {
        border-radius: 8px;
    }

    .industria-page .ranking-table thead th:first-child {
        border-top-left-radius: 8px;
    }

    .industria-page .ranking-table thead th:last-child {
        border-top-right-radius: 8px;
    }

    .industria-page .ranking-table tbody tr:last-child td:first-child {
        border-bottom-left-radius: 8px;
    }

    .industria-page .ranking-table tbody tr:last-child td:last-child {
        border-bottom-right-radius: 8px;
    }

    .industria-card {
        border-radius: 8px;
    }

    .industria-card-header {
        border-radius: 8px 8px 0 0;
        padding: 8px 12px;
        font-size: 12px;
    }

    .industria-card-body {
        padding: 10px 12px;
    }
}

/* --- Small Mobile (≤ 480px) --- */
@media (max-width: 480px) {
    .industria-page .ranking-table {
        font-size: 10px;
    }

    .industria-page .ranking-table thead th {
        padding: 8px 6px;
        font-size: 9px;
    }

    .industria-page .ranking-table td {
        padding: 6px 6px;
    }

    .badge-cell {
        padding: 2px 6px;
        font-size: 10px;
        border-radius: 4px;
    }

    .industria-page .ranking-table tbody tr.tr-total td {
        font-size: 11px;
    }

    .industria-page .ranking-table tbody tr.tr-total .badge-cell {
        font-size: 10.5px;
    }

    .industria-card-header {
        font-size: 11px;
        gap: 6px;
    }
}

/* ============ Sub-Ranking Modal ============ */

/* Overlay — no cierra al dar click */
.subranking-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    animation: srModalFadeIn 0.25s ease-out;
    padding: 24px;
}

@keyframes srModalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Container */
.subranking-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 780px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(240, 116, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    animation: srModalSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes srModalSlideIn {
    from { transform: translateY(-40px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Header */
.subranking-modal-header {
    background: var(--primary-gradient);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.subranking-modal-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.subranking-modal-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.subranking-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: white;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subranking-modal-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 400;
}

/* Close button */
.subranking-modal-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.subranking-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.subranking-modal-close:active {
    transform: scale(0.95);
}

/* Body */
.subranking-modal-body {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: 14px;
}

.subranking-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
}

.subranking-modal-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 48px 24px;
    font-size: 14px;
    margin: 0;
}

/* Scrollable table wrapper */
.subranking-modal-scrollable {
    flex: 1;
    min-height: 0;
    overflow: auto;
    margin: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

/* Scrollbar inside modal */
.subranking-modal-scrollable::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.subranking-modal-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.subranking-modal-scrollable::-webkit-scrollbar-thumb {
    background: rgba(240, 116, 0, 0.25);
    border-radius: 3px;
}

.subranking-modal-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(240, 116, 0, 0.5);
}

.subranking-modal-scrollable::-webkit-scrollbar-corner {
    background: transparent;
}

/* Table inside modal */
.subranking-modal-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
}

/* Gradient header — same as main Industria table */
.subranking-modal-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--primary-gradient);
}

.subranking-modal-table thead th {
    text-align: center;
    color: white;
    background: transparent;
    border-bottom: none;
    font-weight: 600;
    padding: 11px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.subranking-modal-table thead th:first-child {
    border-top-left-radius: 10px;
}

.subranking-modal-table thead th:last-child {
    border-top-right-radius: 10px;
}

.subranking-modal-table tbody tr {
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.subranking-modal-table tbody tr:nth-child(even) {
    background: rgba(240, 116, 0, 0.015);
}

.subranking-modal-table tbody tr:hover {
    background: rgba(240, 116, 0, 0.06);
    box-shadow: inset 3px 0 0 0 #f07400;
}

.subranking-modal-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.08);
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--text-primary);
}

.subranking-modal-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.subranking-modal-table tbody tr:last-child td {
    border-bottom: none;
}

.subranking-modal-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 10px;
}

.subranking-modal-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 10px;
}

/* TOTAL row inside modal */
.subranking-modal-table tbody tr.tr-total {
    background: rgba(240, 116, 0, 0.06);
    box-shadow: inset 4px 0 0 0 #f07400;
}

.subranking-modal-table tbody tr.tr-total:hover {
    background: rgba(240, 116, 0, 0.1);
}

.subranking-modal-table tbody tr.tr-total td {
    font-weight: 700;
    font-size: 13px;
    padding-top: 11px;
    padding-bottom: 11px;
    border-bottom: 2px solid rgba(240, 116, 0, 0.15);
}

/* Modal Back to Top */
.btn-modal-back-to-top {
    position: absolute;
    bottom: 60px;
    right: 24px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 3px 12px rgba(240, 116, 0, 0.4),
        0 0 0 0 rgba(240, 116, 0, 0);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.8);
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease,
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease;
}

.btn-modal-back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.btn-modal-back-to-top:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow:
        0 6px 20px rgba(240, 116, 0, 0.5),
        0 0 0 4px rgba(240, 116, 0, 0.12);
}

.btn-modal-back-to-top:active {
    transform: translateY(0) scale(0.95);
    box-shadow:
        0 2px 6px rgba(240, 116, 0, 0.4),
        0 0 0 2px rgba(240, 116, 0, 0.15);
}

.btn-modal-back-to-top svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.btn-modal-back-to-top.visible::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(240, 116, 0, 0.4);
    animation: bttPulse 2s ease-in-out infinite;
}

/* Footer */
.subranking-modal-footer {
    flex-shrink: 0;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* ============ Export Button (shared) ============ */
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #217346 0%, #1d9e4f 100%);
    color: white;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(33, 115, 70, 0.35);
}

.btn-export:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(33, 115, 70, 0.45);
    background: linear-gradient(135deg, #1d9e4f 0%, #217346 100%);
}

.btn-export:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(33, 115, 70, 0.3);
}

.btn-export svg {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.btn-export-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

/* ============ Sub-Ranking Modal Responsive ============ */

@media (max-width: 768px) {
    .subranking-modal-overlay {
        padding: 12px;
    }

    .subranking-modal {
        max-height: 85vh;
        border-radius: 12px;
    }

    .subranking-modal-header {
        padding: 14px 16px;
    }

    .subranking-modal-header h3 {
        font-size: 14px;
    }

    .subranking-modal-subtitle {
        font-size: 11px;
    }

    .subranking-modal-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .subranking-modal-icon svg {
        width: 16px;
        height: 16px;
    }

    .subranking-modal-body {
        padding-top: 10px;
    }

    .subranking-modal-scrollable {
        margin: 0 10px;
        border-radius: 8px;
    }

    .subranking-modal-table {
        font-size: 11px;
    }

    .subranking-modal-table thead th {
        padding: 10px 10px;
        font-size: 10px;
    }

    .subranking-modal-table thead th:first-child {
        border-top-left-radius: 8px;
    }

    .subranking-modal-table thead th:last-child {
        border-top-right-radius: 8px;
    }

    .subranking-modal-table td {
        padding: 8px 10px;
    }

    .subranking-modal-footer {
        padding: 12px 16px;
    }

    .btn-export {
        font-size: 12px;
        padding: 7px 14px;
    }

    .btn-modal-back-to-top {
        width: 32px;
        height: 32px;
        bottom: 56px;
        right: 18px;
    }

    .btn-modal-back-to-top svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .subranking-modal-overlay {
        padding: 8px;
    }

    .subranking-modal {
        max-height: 90vh;
        border-radius: 10px;
    }

    .subranking-modal-header {
        padding: 12px 14px;
    }

    .subranking-modal-header h3 {
        font-size: 13px;
    }

    .subranking-modal-body {
        padding-top: 8px;
    }

    .subranking-modal-scrollable {
        margin: 0 8px;
    }

    .subranking-modal-table {
        font-size: 10px;
    }

    .subranking-modal-table thead th {
        padding: 8px 8px;
        font-size: 9px;
    }

    .subranking-modal-table td {
        padding: 7px 8px;
    }

    .subranking-modal-footer {
        padding: 10px 14px;
    }

    .btn-export {
        font-size: 11px;
        padding: 7px 12px;
    }

    .btn-modal-back-to-top {
        width: 30px;
        height: 30px;
        bottom: 52px;
        right: 14px;
    }

    .btn-modal-back-to-top svg {
        width: 13px;
        height: 13px;
    }
}

/* --- Animations --- */
@keyframes ddSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ====================================================================
   INDUSTRIA DETALLE — Collapsible grouped view (.ind-*)
   ==================================================================== */

.ind-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 6px;
}

.ind-btn-expand-all {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(240, 116, 0, 0.12);
    color: #f07400;
    border: 1px solid rgba(240, 116, 0, 0.25);
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.ind-btn-expand-all:hover {
    background: rgba(240, 116, 0, 0.22);
    border-color: rgba(240, 116, 0, 0.45);
}

/* --- Header row (column names) --- */
.ind-header-row {
    display: flex;
    align-items: center;
    padding: 9px 14px;
    background: var(--primary-gradient);
    border-radius: 12px 12px 0 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.ind-header-row span {
    font-size: 11.5px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* --- TOTAL row --- */
.ind-total-row {
    display: flex;
    align-items: center;
    padding: 9px 14px;
    background: rgba(240, 116, 0, 0.07);
    border-left: 3px solid #f07400;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ind-total-row span {
    font-size: 12.5px;
    font-weight: 700;
    color: #ffe0c0;
}

/* --- Group header (clickable) --- */
.ind-group-header {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.ind-group-header:hover {
    background: rgba(240, 116, 0, 0.08);
}

.ind-group-rank {
    width: 28px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(240, 116, 0, 0.7);
    flex-shrink: 0;
}

.ind-group-badge {
    display: inline-block;
    background: rgba(240, 116, 0, 0.12);
    color: #ffb870;
    border: 1px solid rgba(240, 116, 0, 0.2);
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ind-group-totals {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 600;
}

.ind-group-totals .lbl {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    margin-right: 3px;
}

/* --- Chevron icon --- */
.ind-chevron {
    flex-shrink: 0;
    margin-left: 10px;
    transition: transform 0.25s ease;
    color: rgba(255, 255, 255, 0.35);
}

.ind-chevron.expanded {
    transform: rotate(90deg);
    color: #f07400;
}

/* --- Group body (expandable detail rows) --- */
.ind-group-body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

.ind-group-body.open {
    max-height: 5000px;
    opacity: 1;
}

/* --- Detail row --- */
.ind-detail-row {
    display: flex;
    align-items: center;
    padding: 6px 14px 6px 42px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    transition: background 0.15s;
}

.ind-detail-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.ind-detail-row:hover {
    background: rgba(240, 116, 0, 0.06);
}

/* --- Flex sizing for columns --- */
.ind-col-field {
    flex: 2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ind-col-field-sm {
    flex: 1.5;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ind-col-num {
    width: 100px;
    flex-shrink: 0;
    text-align: right;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .ind-col-d, .ind-col-e {
        display: none;
    }

    .ind-header-row, .ind-total-row,
    .ind-group-header, .ind-detail-row {
        padding-left: 8px;
        padding-right: 8px;
    }

    .ind-detail-row {
        padding-left: 28px;
    }

    .ind-col-num {
        width: 80px;
    }

    .ind-group-badge {
        max-width: 140px;
    }
}

@media (max-width: 600px) {
    .ind-col-c {
        display: none;
    }

    .ind-col-num {
        width: 65px;
        font-size: 11px;
    }

    .ind-group-badge {
        max-width: 100px;
        font-size: 11px;
    }

    .ind-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ── Empty State ── */
.ind-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    padding: 20px;
    text-align: center;
    animation: indEmptyFadeIn 0.6s ease;
}

.ind-empty-state svg {
    width: 140px;
    height: 120px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 16px;
}

.light-mode .ind-empty-state svg {
    color: rgba(0,0,0,0.4);
}

.ind-empty-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    opacity: 0.8;
}

.ind-empty-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 380px;
    line-height: 1.5;
    opacity: 0.7;
}

@keyframes indEmptyFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .ind-empty-state {
        padding: 40px 16px 60px;
    }

    .ind-empty-state svg {
        width: 110px;
        height: 95px;
    }

    .ind-empty-title {
        font-size: 1rem;
    }

    .ind-empty-subtitle {
        font-size: 0.8rem;
    }
}

/* --- Toggle Desglose Agencia --- */
.ind-toggle-desglose {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
}

.ind-toggle-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    user-select: none;
}

.ind-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

.ind-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ind-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--primary-gradient);
    border: 1px solid rgba(240, 116, 0, 0.4);
    border-radius: 20px;
    transition: border-color 0.25s;
}

.ind-slider::before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}

.ind-switch input:checked + .ind-slider::before {
    transform: translateX(18px);
}
