:root {
    --mhe-blue-900: #ffffff;
    --mhe-blue-800: #123a5a;
    --mhe-blue-700: #eaf0f5;
    --mhe-blue-500: #2e6f9e;
    --mhe-black-800: #000000;
    --mhe-red-800: #7e0202;
    --mhe-green-800: #004d0d;
    --mhe-gold: #d7a22a;
    --mhe-gold-soft: #efd28a;
    --bg-main: #f4f7fb;
    --card-bg: #ffffff;
    --text-main: #1e2b37;
    --text-soft: #5b6570;
    --border-soft: rgba(18, 58, 90, 0.10);
    --shadow-soft: 0 10px 30px rgba(13, 39, 64, 0.10);
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(215, 162, 42, 0.10), transparent 20%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg-main) 100%);
    color: var(--text-main);
}

.page-shell {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg, var(--mhe-blue-900), var(--mhe-blue-700));
    color: #000000;
    padding: 28px 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
}

.hero-left {
    flex: 1;
}

.hero-right {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.brand-badge {
    display: inline-block;
    background: rgba(18, 58, 90, 0.08);
    border: 1px solid rgba(18, 58, 90, 0.12);
    color: #123a5a;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.4px;
    margin-bottom: 10px;
    font-weight: 700;
}

.hero h1 {
    margin: 0 0 8px 0;
    font-size: 32px;
    line-height: 1.15;
    color: var(--mhe-blue-800);
}

.hero p {
    margin: 0;
    color: #4b5563;
    max-width: 900px;
    font-size: 0.98rem;
}

.hero-logo {
    height: 88px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.hero-logo:hover {
    transform: scale(1.03);
}

.dashboard-section {
    margin-top: 1.8rem;
    margin-bottom: 1.8rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.section-kicker {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #0d6efd;
    margin-bottom: 0.3rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    color: #1f2937;
}

.section-header p {
    margin: 0.35rem 0 0 0;
    color: #6b7280;
    font-size: 0.95rem;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-dashboard-action {
    height: 44px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--mhe-gold), #c18c1c);
    color: #fff;
    font-weight: 700;
    padding: 0 18px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(193, 140, 28, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-dashboard-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(193, 140, 28, 0.30);
}

.gestiones-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-soft);
}

.nav-tabs-custom {
    border-bottom: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-tabs-custom .nav-item {
    margin-bottom: 0;
}

.nav-tabs-custom .nav-link {
    color: #666;
    border: 1px solid rgba(18, 58, 90, 0.10);
    background: #fff;
    border-radius: 12px;
    padding: 10px 16px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.nav-tabs-custom .nav-link:hover {
    color: #007bff;
    background-color: #f8fbff;
    border-color: #cfe2ff;
}

.nav-tabs-custom .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--mhe-blue-500), var(--mhe-blue-800));
    border-color: transparent;
    font-weight: 700;
}

.indicators-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.indicator-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
    min-height: 150px;
    isolation: isolate;
}

.indicator-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    z-index: 3;
}

.indicator-card--wti::before {
    background: var(--mhe-blue-500);
}

.indicator-card--brent::before {
    background: var(--mhe-gold);
}

.indicator-card--gas::before {
    background: var(--mhe-green-800);
}

.indicator-sparkline-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.20;
    pointer-events: none;
    padding: 10px 12px 10px 24px;
}

.indicator-sparkline-bg canvas {
    width: 100% !important;
    height: 100% !important;
}

.indicator-card > *:not(.indicator-sparkline-bg) {
    position: relative;
    z-index: 4;
}


.indicator-label {
    display: block;
    color: #4b5563;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 700;
}

.indicator-card strong {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--mhe-blue-800);
    line-height: 1.15;
}

.indicator-card small {
    display: block;
    margin-top: 0.35rem;
    color: #6b7280;
    font-size: 0.82rem;
}

.chart-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.chart-card--table {
    padding: 1.2rem;
}

.table-title-row {
    text-align: center;
    background-color: #f8f9fa !important;
    font-size: 1.05rem;
}

.group-head {
    text-align: center;
    font-weight: 700;
}

.group-head-wti {
    background-color: #e3f2fd !important;
}

.group-head-brent {
    background-color: #fff3e0 !important;
}

.group-head-gas {
    background-color: #e8f5e9 !important;
}

.group-head-pdf {
    background-color: #fce4ec !important;
}

#table_precios {
    font-size: 0.9rem;
}

#table_precios thead th {
    font-weight: 600;
    font-size: 0.85rem;
    padding: 12px 8px;
    white-space: nowrap;
    vertical-align: middle;
}

#table_precios tbody td {
    padding: 10px 8px;
    vertical-align: middle;
}

#table_precios tbody tr {
    transition: background-color 0.2s ease;
}

#table_precios tbody tr:hover {
    background-color: #f0f8ff !important;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid rgba(18, 58, 90, 0.15);
    border-radius: 10px;
    padding: 0.35rem 0.65rem;
    background: #fff;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--mhe-blue-500);
    box-shadow: 0 0 0 4px rgba(46, 111, 158, 0.10);
    outline: none;
}

.table-loading {
    text-align: center;
    padding: 1rem 0 1.2rem 0;
}

.btn-descargar-pdf {
    width: 24px;
    height: 28px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-descargar-pdf:hover {
    transform: scale(1.15);
    filter: brightness(1.2);
}

.variacion-positiva {
    color: #198754;
    font-weight: 700;
}

.variacion-negativa {
    color: #dc3545;
    font-weight: 700;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.summary-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 18px;
    align-items: stretch;
}

.indicators-grid--stacked {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 39, 64, 0.25);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 52px;
    height: 52px;
    border: 5px solid rgba(255,255,255,0.28);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1200px) {
    .indicators-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .page-shell {
        padding: 16px;
    }

    .hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 22px 20px;
    }

    .hero h1 {
        font-size: 26px;
    }

    .hero-logo {
        height: 72px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .indicators-grid {
        grid-template-columns: 1fr;
    }

    .nav-tabs-custom {
        gap: 6px;
    }

    .nav-tabs-custom .nav-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 992px) {
    .summary-layout {
        grid-template-columns: 1fr;
    }
}