.reporte-interconexion {
    --pde-ink: #17333a;
    --pde-muted: #66757a;
    --pde-primary: #004f59;
    --pde-accent: #007c89;
    --pde-gold: #c49a42;
    --pde-green: #178f67;
    --pde-yellow: #d99a25;
    --pde-red: #c84c4c;
    --pde-line: #dfe7ea;
    --pde-soft: #f5f8f9;
    --pde-card: #ffffff;
    --pde-shadow: 0 16px 40px rgba(17, 51, 58, 0.08);
    background: #f3f7f8;
    color: var(--pde-ink);
    padding: 1rem clamp(1rem, 2vw, 2rem) 2.5rem;
}

.reporte-interconexion * {
    letter-spacing: 0;
}

.report-hero {
    align-items: center;
    background: linear-gradient(135deg, #004f59 0%, #17333a 72%);
    border-radius: 8px;
    box-shadow: var(--pde-shadow);
    color: #fff;
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    margin: 0 auto 1.25rem;
    max-width: 1760px;
    min-height: 190px;
    overflow: hidden;
    padding: clamp(1.35rem, 3vw, 2.5rem);
    position: relative;
    margin-bottom: 25px;
}

.report-hero::after {
    background: repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 28px);
    bottom: 0;
    content: "";
    opacity: 0.55;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    width: min(42%, 520px);
}

.report-hero__content,
.report-hero__brand {
    position: relative;
    z-index: 1;
}

.report-hero__content {
    align-items: flex-start;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    text-align: left;
}

.report-eyebrow {
    color: var(--pde-gold);
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.report-hero h1 {
    color: #fff;
    font-size: clamp(1.8rem, 3vw, 3.2rem);
    font-weight: 800;
    line-height: 1.05;
    margin: 0;
}

.report-hero p {
    color: rgba(255,255,255,0.82);
    font-size: 1rem;
    margin: 0.75rem 0 0;
    max-width: 680px;
}

.report-hero__brand {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    min-width: 180px;
}

.report-hero__brand img {
    height: auto;
    max-height: 72px;
    max-width: 220px;
}

.report-hero__brand span {
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 999px;
    color: rgba(255,255,255,0.82);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.28rem 0.75rem;
}

.kpi-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 auto 1.25rem;
    max-width: 1760px;
}

.metric-card {
    align-items: center;
    background: var(--pde-card);
    border: 1px solid var(--pde-line);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(17, 51, 58, 0.05);
    display: flex;
    gap: 0.9rem;
    min-height: 104px;
    padding: 1rem;
}

.metric-card strong {
    color: var(--pde-ink);
    display: block;
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
}

.metric-card span {
    color: var(--pde-muted);
    display: block;
    font-size: 0.78rem;
    font-weight: 800;
    margin-top: 0.35rem;
    text-transform: uppercase;
}

.metric-icon {
    align-items: center;
    border-radius: 8px;
    color: #fff;
    display: flex;
    flex: 0 0 52px;
    font-size: 1.45rem;
    height: 52px;
    justify-content: center;
}

.metric-icon--primary { background: var(--pde-primary); }
.metric-icon--gold { background: var(--pde-gold); }
.metric-icon--success { background: var(--pde-green); }
.metric-icon--warning { background: var(--pde-yellow); }

.workspace-panel,
.analytics-panel {
    background: var(--pde-card);
    border: 1px solid var(--pde-line);
    border-radius: 8px;
    box-shadow: var(--pde-shadow);
    margin: 0 auto 1.25rem;
    max-width: 1760px;
    padding: clamp(1rem, 2vw, 1.5rem);
}

.section-heading {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-heading h2 {
    color: var(--pde-ink);
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0;
}

.section-heading p {
    color: var(--pde-muted);
    margin: 0.35rem 0 0;
}

.view-switch {
    background: var(--pde-soft);
    border: 1px solid var(--pde-line);
    border-radius: 8px;
    display: flex;
    gap: 0.3rem;
    padding: 0.3rem;
}

.view-button,
.action-button {
    align-items: center;
    border-radius: 6px;
    display: inline-flex;
    font-weight: 800;
    gap: 0.45rem;
    justify-content: center;
    min-height: 40px;
    text-decoration: none;
    white-space: nowrap;
}

.view-button {
    background: transparent;
    border: 0;
    color: var(--pde-muted);
    padding: 0.45rem 0.8rem;
}

.view-button.active {
    background: var(--pde-primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(0, 79, 89, 0.18);
}

.report-toolbar {
    align-items: center;
    border-bottom: 1px solid var(--pde-line);
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
}

.search-control,
.select-control,
.analytics-filters select {
    align-items: center;
    background: #fff;
    border: 1px solid var(--pde-line);
    border-radius: 8px;
    color: var(--pde-muted);
    display: flex;
    gap: 0.5rem;
    min-height: 44px;
}

.search-control {
    flex: 1 1 360px;
    padding: 0 0.85rem;
}

.search-control input {
    border: 0;
    color: var(--pde-ink);
    flex: 1;
    min-width: 120px;
    outline: 0;
}

.search-control:focus-within,
.select-control:focus-within,
.analytics-filters select:focus {
    border-color: var(--pde-accent);
    box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.12);
}

.select-control {
    flex: 0 0 auto;
    padding: 0 0.7rem;
}

.select-control span {
    font-size: 0.84rem;
    font-weight: 800;
}

.select-control select,
.analytics-filters select {
    background: transparent;
    border: 0;
    color: var(--pde-ink);
    font-weight: 700;
    outline: 0;
}

.toolbar-actions {
    display: flex;
    gap: 0.55rem;
}

.action-button {
    background: #fff;
    border: 1px solid var(--pde-line);
    color: var(--pde-ink);
    padding: 0.5rem 0.85rem;
}

.action-button:hover {
    color: var(--pde-primary);
    border-color: var(--pde-accent);
    text-decoration: none;
}

.action-button--success {
    background: var(--pde-green);
    border-color: var(--pde-green);
    color: #fff;
}

.action-button--success:hover {
    color: #fff;
    filter: brightness(0.96);
}

.cards-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.institution-card {
    background: #fff;
    border: 1px solid var(--pde-line);
    border-left: 5px solid var(--pde-yellow);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(17, 51, 58, 0.06);
    display: flex;
    flex-direction: column;
    min-height: 320px;
    overflow: hidden;
    transition: box-shadow 180ms ease, transform 180ms ease;
}

.institution-card:hover {
    box-shadow: 0 16px 34px rgba(17, 51, 58, 0.11);
    transform: translateY(-2px);
}

.institution-card.is-complete { border-left-color: var(--pde-green); }
.institution-card.is-empty { border-left-color: var(--pde-red); }

.institution-card__header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 1rem 0.7rem;
}

.institution-card h3 {
    color: var(--pde-ink);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.35;
    margin: 0.45rem 0 0;
}

.region-chip {
    align-items: center;
    background: var(--pde-soft);
    border: 1px solid var(--pde-line);
    border-radius: 999px;
    color: var(--pde-muted);
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 800;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
}

.score-ring {
    align-items: center;
    background: var(--pde-soft);
    border: 1px solid var(--pde-line);
    border-radius: 8px;
    display: flex;
    flex: 0 0 82px;
    flex-direction: column;
    min-height: 64px;
    justify-content: center;
}

.score-ring strong {
    color: var(--pde-primary);
    font-size: 1.1rem;
    font-weight: 900;
}

.score-ring span {
    color: var(--pde-muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.connection-progress {
    background: #edf2f4;
    height: 8px;
    margin: 0 1rem;
    overflow: hidden;
    border-radius: 999px;
}

.connection-progress span {
    background: linear-gradient(90deg, var(--pde-accent), var(--pde-green));
    display: block;
    height: 100%;
}

.connection-summary {
    color: var(--pde-muted);
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0.75rem 1rem 0;
}

.systems-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.9rem 1rem 1rem;
}

.system-row {
    align-items: center;
    border-top: 1px solid #edf2f4;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    min-height: 42px;
    padding-top: 0.45rem;
}

.system-row > span:first-child {
    color: var(--pde-ink);
    font-size: 0.86rem;
    font-weight: 700;
}

.status-pill {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 800;
    gap: 0.3rem;
    justify-content: center;
    min-height: 28px;
    padding: 0.25rem 0.62rem;
    white-space: nowrap;
}

.status-pill--ok {
    background: #e4f6ef;
    color: #0d6d4e;
}

.status-pill--pending {
    background: #fff3dc;
    color: #9d6415;
}

.status-pill--neutral {
    background: #e9f4f6;
    color: var(--pde-primary);
}

.table-shell {
    border: 1px solid var(--pde-line);
    border-radius: 8px;
    overflow: hidden;
}

.report-table {
    margin: 0;
    min-width: 900px;
}

.report-table thead th {
    background: #eef5f6;
    border-bottom: 1px solid var(--pde-line);
    color: var(--pde-ink);
    font-size: 0.82rem;
    font-weight: 900;
    position: sticky;
    top: 0;
    vertical-align: middle;
    z-index: 1;
}

.report-table td {
    color: var(--pde-ink);
    font-size: 0.86rem;
    vertical-align: middle;
}

.pager-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
    max-width: 100%;
    overflow-x: auto;
}

.pager-wrap .page-link {
    color: var(--pde-primary);
}

.pager-wrap .page-item.active .page-link {
    background: var(--pde-primary);
    border-color: var(--pde-primary);
}

.empty-state {
    background: var(--pde-soft);
    border: 1px dashed var(--pde-line);
    border-radius: 8px;
    color: var(--pde-muted);
    grid-column: 1 / -1;
    padding: 2rem;
    text-align: center;
}

.empty-state i {
    color: var(--pde-accent);
    font-size: 2rem;
}

.empty-state h3 {
    color: var(--pde-ink);
    font-size: 1rem;
    font-weight: 800;
    margin: 0.6rem 0 0.25rem;
}

.empty-state p {
    margin: 0;
}

.empty-state--search {
    margin-top: 1rem;
}

.analytics-panel {
    background: #fbfcfc;
}

.section-heading--analytics {
    align-items: center;
}

.analytics-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-end;
}

.analytics-filters select {
    min-width: 170px;
    padding: 0 0.8rem;
}

.search-control--compact {
    flex: 0 1 260px;
}

.chart-grid,
.top-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-grid--uneven {
    grid-template-columns: 5fr 7fr;
}

.top-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chart-card {
    background: #fff;
    border: 1px solid var(--pde-line);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(17, 51, 58, 0.05);
    padding: 1rem;
    margin-bottom: 25px;
}

.chart-card h3 {
    align-items: center;
    color: var(--pde-ink);
    display: flex;
    font-size: 1rem;
    font-weight: 800;
    gap: 0.5rem;
    margin: 0 0 0.8rem;
}

.chart-card h3 i {
    color: var(--pde-gold);
}

.api-freshness {
    align-items: center;
    border-radius: 999px;
    display: flex;
    font-size: 0.86rem;
    font-weight: 800;
    gap: 0.45rem;
    margin-top: 1rem;
    max-width: 100%;
    padding: 0.45rem 0.8rem;
    width: fit-content;
}

.api-freshness--ok {
    background: rgba(23, 143, 103, 0.16);
    border: 1px solid rgba(255,255,255,0.24);
    color: #eafff6;
}

.api-freshness--warning {
    background: rgba(217, 154, 37, 0.18);
    border: 1px solid rgba(255,255,255,0.24);
    color: #fff7e8;
}

.chart-container {
    height: 360px;
    width: 100%;
}

.network-container {
    height: 420px;
    width: 100%;
}

#networkGraph {
    background: linear-gradient(180deg, #fbfcfc, #f2f6f7);
    border: 1px dashed var(--pde-line);
    border-radius: 8px;
    height: 100%;
    width: 100%;
}

.top-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.top-list li {
    align-items: center;
    border-bottom: 1px solid #edf2f4;
    color: var(--pde-ink);
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    min-height: 42px;
    padding: 0.5rem 0;
}

.top-list li:last-child {
    border-bottom: 0;
}

.top-list span {
    font-size: 0.86rem;
    font-weight: 700;
}

.top-list strong {
    background: var(--pde-soft);
    border-radius: 999px;
    color: var(--pde-primary);
    font-size: 0.82rem;
    padding: 0.18rem 0.6rem;
    white-space: nowrap;
}

.top-list .top-empty {
    color: var(--pde-muted);
    justify-content: center;
}

.heatmap-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 900px;
    width: 100%;
}

.matrix-toolbar {
    align-items: center;
    background: var(--pde-soft);
    border: 1px solid var(--pde-line);
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.85rem;
}

.matrix-search {
    align-items: center;
    background: #fff;
    border: 1px solid var(--pde-line);
    border-radius: 8px;
    color: var(--pde-muted);
    display: flex;
    flex: 1 1 320px;
    gap: 0.5rem;
    min-height: 42px;
    padding: 0 0.75rem;
}

.matrix-search:focus-within {
    border-color: var(--pde-accent);
    box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.12);
}

.matrix-search input {
    background: transparent;
    border: 0;
    color: var(--pde-ink);
    flex: 1;
    min-width: 150px;
    outline: 0;
}

.matrix-counter {
    color: var(--pde-muted);
    flex: 0 0 auto;
    font-size: 0.84rem;
    font-weight: 800;
}

.matrix-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.matrix-action {
    align-items: center;
    background: #fff;
    border: 1px solid var(--pde-line);
    border-radius: 6px;
    color: var(--pde-ink);
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: 800;
    gap: 0.4rem;
    min-height: 38px;
    padding: 0.45rem 0.75rem;
}

.matrix-action:hover {
    border-color: var(--pde-accent);
    color: var(--pde-primary);
}

.matrix-action--excel {
    background: var(--pde-green);
    border-color: var(--pde-green);
    color: #fff;
}

.matrix-action--excel:hover {
    color: #fff;
    filter: brightness(0.96);
}

.heatmap-table th,
.heatmap-table td {
    border-bottom: 1px solid #edf2f4;
    padding: 0.75rem 0.9rem;
    text-align: center;
    vertical-align: middle;
}

.heatmap-table th {
    background: #eef5f6;
    color: var(--pde-ink);
    font-size: 0.82rem;
    font-weight: 900;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sortable-th {
    align-items: center;
    background: transparent;
    border: 0;
    color: inherit;
    display: inline-flex;
    font: inherit;
    font-weight: 900;
    gap: 0.45rem;
    justify-content: center;
    min-height: 32px;
    padding: 0;
    width: 100%;
}

.sortable-th:hover,
.sortable-th.is-active {
    color: var(--pde-primary);
}

.sort-indicator {
    color: var(--pde-accent);
    font-size: 0.75rem;
    min-width: 14px;
}

.heatmap-table th:first-child,
.heatmap-table td:first-child {
    text-align: left;
}

.heatmap-cell {
    border-radius: 999px;
    display: inline-block;
    height: 20px;
    width: 20px;
}

.heatmap-ok {
    background: var(--pde-green);
}

.heatmap-pending {
    background: var(--pde-red);
}

.matrix-empty-row {
    color: var(--pde-muted);
    font-weight: 800;
    padding: 1.5rem !important;
    text-align: center !important;
}

@media (max-width: 1200px) {
    .kpi-grid,
    .top-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-grid,
    .chart-grid--uneven {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .reporte-interconexion {
        padding: 0.75rem 0.75rem 2rem;
    }

    .report-hero,
    .section-heading,
    .report-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .report-hero__brand {
        align-items: flex-start;
    }

    .kpi-grid,
    .top-grid {
        grid-template-columns: 1fr;
    }

    .cards-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .view-switch,
    .toolbar-actions,
    .matrix-toolbar,
    .matrix-actions,
    .analytics-filters {
        width: 100%;
    }

    .view-button,
    .action-button,
    .matrix-action,
    .analytics-filters select,
    .search-control--compact {
        flex: 1 1 auto;
        width: 100%;
    }

    .matrix-counter {
        width: 100%;
    }

    .institution-card__header {
        flex-direction: column;
    }

    .institution-card {
        min-width: 0;
    }

    .pager-wrap {
        justify-content: flex-start;
    }

    .pager-wrap .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .score-ring {
        align-items: flex-start;
        flex: 0 0 auto;
        min-height: 0;
        padding: 0.6rem 0.75rem;
        width: 100%;
    }

    .system-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .chart-container {
        height: 320px;
    }

    .network-container {
        height: 360px;
    }
}
