/* =====================================================
   ROOT THEME (FINANCE)
   ===================================================== */
:root {
    --bg: #0f172a;        /* slate-900 */
    --card: #020617;      /* near-black */
    --border: #1e293b;    /* slate-800 */
    --text: #e5e7eb;      /* gray-200 */
    --muted: #94a3b8;     /* slate-400 */
    --surface: #111827;   /* navbar / cards */
}


* {
    box-sizing: border-box;
}

/* =====================================================
   BASE
   ===================================================== */
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16.5px; /* 👈 clave */
    line-height: 1.55;
}

h1, h2 {
    margin: 0 0 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;   /* space between h1 and p */
    line-height: 1.0; 
}

.page {
    width: 100%;
    padding: 1rem 2rem;
    margin: 0 auto;
}

/* =====================================================
   GRID & CARDS
   ===================================================== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.75rem;
}

.card1 {
    justify-self: stretch;
    width: 100%;
}

.card2 {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}


/* =====================================================
   CHART CONTAINERS
   ===================================================== */

.chart-box {
    position: relative;
    width: 100%;
    height: 87dvh; 
}

@media (max-width: 1000000px) {
    .chart-box {
        position: relative;
        width: 100%;
        height: 110dvh; 
    }
}

.chart-box1 {
    position: relative;
    width: 100%;
}

.chart-rect-box {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
}

.chart-box canvas,
.chart-rect-box canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    cursor: grab;          /* 👈 hand open */
    user-select: none;     /* 👈 avoid text selection */
}

.chart-box canvas:active,
.chart-rect-box canvas:active {
    cursor: grabbing;     /* 👈 hand closed */
}

/* =====================================================
   TABLE
   ===================================================== */
.table-box {
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 10px;
}

table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: right;
}

th {
    color: var(--muted);
    font-weight: 500;
}

th:first-child,
td:first-child {
    text-align: left;
}

/* =====================================================
   SMALL TEXT
   ===================================================== */
.muted {
    color: var(--muted);
    font-size: 1rem;   /* antes 0.85 */
    line-height: 1.2;
    text-align: justify; /* o left */
}

.muted a {
  color: inherit;
  text-decoration: underline;
}
/* =====================================================
   INSTITUTIONS NAVBAR (NO BOOTSTRAP JS)
   ===================================================== */
.inst-navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.inst-navbar-inner {
  width: 100%;
  max-width: none;     /* ← kill centering */
  margin: 0;           /* ← kill auto-centering */
  padding: 0 1rem;
  padding-left: 2rem;     /* optional spacing */
  display: flex;
  align-items: center;
  justify-content: space-between
}


.brand {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.menu {
    list-style: none;
    display: flex;
    gap: 1.2rem;
    margin: 0;
    padding: 0;
}

.menu a {
    color: #adb5bd;
    text-decoration: none;
    font-size: 0.85rem;
}

.menu a:hover {
    color: white;
}

.menu a.active {
    color: white;
    font-weight: 700;
    border-bottom: 2px solid var(--accent);
}

/* =====================================================
   MOBILE NAVBAR
   ===================================================== */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
}

.inst-navbar {
    position: relative;
}



@media (max-width: 768px) {
    .menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;          /* ⬅ directly below navbar */
        left: 0;
        width: 100%;
        background: #212529;
        padding: 0.5rem 0;
        border-top: 1px solid rgba(255,255,255,0.08);
        z-index: 1000;
    }

    .menu.show {
        display: flex;
    }

    .menu li {
        padding: 0.6rem 1.25rem;
    }

    .menu-toggle {
        display: block;
    }
}

.chart-container {
  height: 400px;
  width: 100%;
}
.data-table th,
.data-table td {
    white-space: nowrap;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 2rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 12px 0 30px;
}

.legend-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s, filter 0.2s;
}



.legend-item.inactive {
    opacity: 0.35;
    filter: grayscale(1);
}

.legend-item.inactive .legend-label {
    text-decoration: line-through;
}


.legend-color {
    width: 12px;
    height: 12px;
    margin-right: 6px;
    border-radius: 2px;
}

.chart-section {
    position: relative;
    margin-bottom: 40px;   /* 👈 critical */
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 12px;
}

.chart-section {
    margin-bottom: 40px;
}

/* height control lives HERE */
.chart-canvas {
    position: relative;
    width: 100%;
    height: 420px;   /* 👈 adjust freely */
}

/* canvas fills container, no distortion */
.chart-canvas canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 12px;
}

.legend-card {
    width: fit-content;
    min-width: 0;
}

.legend-card {
    width: fit-content;
    min-width: 0;
}



/* override ONLY this grid */
.legend-layout {
    grid-template-columns: auto 1fr;
}

/* legend stays tight */
.legend-card {
    justify-self: start;
    width: fit-content;
}

.legend-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.legend-actions button {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 6px;
    background: #111827;
    border: 1px solid #1e293b;
    color: #e5e7eb;
    cursor: pointer;
}
