/* ============ Tokens ============ */
:root {
    --ink: #004A86;
    --ink-soft: #62666A;
    --bg: #F5F7F6;
    --surface: #FFFFFF;
    --line: #D8DED9;
    --gold: #B7891E;
    --gold-soft: #F1E4C3;
    --good: #2F7A55;
    --good-bg: #E4F1E9;
    --warn: #B7791F;
    --warn-bg: #F7EEDC;
    --bad: #9B3B34;
    --bad-bg: #F6E6E4;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 50, 43, 0.06), 0 4px 14px rgba(20, 50, 43, 0.05);
     --azul-oscuro: #004a86;
     --azul-claro: #69b3e7;
     --fondo: #f2f5f8;
     --texto: #1c2b3a;
     --texto-suave: #5b7186;
     --borde: #e4eaf1;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    line-height: 1.5;
}

h1,
h2,
h3 {
    font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
    font-weight: 600;
    margin: 0;
}

.num {
    font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
    font-variant-numeric: tabular-nums;
}

a {
    color: var(--ink);
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.container {
      width: min(1180px, calc(100% - 32px));
      margin: 0 auto;
    }

 /* Encabezado */
    .site-header {
      background: #fff;
      border-bottom: 1px solid var(--borde);
    }

    .brand-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
      padding: 18px 0;
    }

    .brand-main {
      width: min(500px, 70vw);
    }

    .brand-main img {
      max-height: 115px;
      object-fit: contain;
      object-position: left center;
    }

    .site-nav {
      background: var(--azul-oscuro);
    }

    .site-nav ul {
      list-style: none;
      margin: 0;
      padding: 0;
      display: flex;
      flex-wrap: wrap;
    }

    .site-nav a {
      display: block;
      padding: 14px 18px;
      color: #fff;
      text-decoration: none;
      font-weight: 700;
    }

    .site-nav a:hover,
    .site-nav a:focus {
      background: var(--azul-claro);
      outline: none;
    }

/* ============ Layout shell ============ */
.page {
    max-width: 1200px;
    margin: 0 auto;
}

.masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1rem;
    border-bottom: 3px solid var(--ink);
    margin-bottom: 1.5rem;
}

.masthead h1 {
    font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.15rem);
    font-family: Arial, Helvetica, sans-serif;
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    padding: 1rem;
    white-space: nowrap;
}

.download-link:hover {
    background: var(--ink);
    color: var(--surface);
}


/* ============ Summary strip (signature: sello motif) ============ */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.25rem;
    margin-bottom: 28px;
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.summary-card .label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.summary-card .value {
    font-size: 1.7rem;
    font-weight: 600;
}

/* the "sello" — a stamp-style badge used for the overall/annual figure */
.sello {
    --tone: var(--good);
    --tone-bg: var(--good-bg);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px dashed var(--tone);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--tone-bg);
    color: var(--tone);
    font-family: "IBM Plex Mono", monospace;
    line-height: 1;
    flex-shrink: 0;
}

.sello strong {
    font-size: 1rem;
}

.sello span {
    font-size: .55rem;
    letter-spacing: .03em;
    text-transform: uppercase;
    margin-top: 2px;
}

.sello.warn {
    --tone: var(--warn);
    --tone-bg: var(--warn-bg);
}

.sello.bad {
    --tone: var(--bad);
    --tone-bg: var(--bad-bg);
}

/* ============ Toolbar ============ */
.toolbar {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 18px;
    position: sticky;
    top: 12px;
    z-index: 5;
    box-shadow: var(--shadow);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: .78rem;
    color: var(--ink-soft);
}

.field label {
    font-weight: 600;
}

.field select,
.field input[type="search"] {
    font: inherit;
    padding: 8px 10px;
    border: 1.5px solid var(--line);
    border-radius: 7px;
    background: var(--bg);
    color: var(--ink);
    min-width: 180px;
}

.field.search {
    flex: 1;
    min-width: 200px;
}

.field.search input {
    width: 100%;
}

.result-count {
    margin-left: auto;
    font-size: .8rem;
    color: var(--ink-soft);
}

/* ============ Table ============ */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

caption {
    text-align: left;
    padding: 1rem;
    color: var(--ink-soft);
}

thead th {
    text-align: center;
    background: var(--ink);
    color: var(--surface);
    font-weight: 600;
    font-size: .75rem;
    letter-spacing: .04em;
    padding: 1rem;
    white-space: nowrap;
}

thead th button {
    all: unset;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
}

thead th button:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
    border-radius: 4px;
}

thead th .arrow {
    font-size: .7em;
    opacity: .6;
}

thead th[aria-sort="ascending"] .arrow,
thead th[aria-sort="descending"] .arrow {
    opacity: 1;
    color: var(--gold);
}

tbody tr {
    border-top: 1px solid var(--line);
}

tbody tr:hover {
    background: #FAFBF9;
}

td {
    padding: 1rem;
    vertical-align: middle;
    text-align: center;
}

td.tipo {
    color: var(--ink-soft);
    font-size: .82rem;
}

td.nombre {
    font-weight: 600;
}

.pct-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.pct-bar {
    width: 52px;
    height: 6px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
    flex-shrink: 0;
}

.pct-bar span {
    display: block;
    height: 100%;
    background: var(--good);
}

.pct-cell.warn .pct-bar span {
    background: var(--warn);
}

.pct-cell.bad .pct-bar span {
    background: var(--bad);
}

.badge-anual {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--good-bg);
    color: var(--good);
}

.badge-anual.warn {
    background: var(--warn-bg);
    color: var(--warn);
}

.badge-anual.bad {
    background: var(--bad-bg);
    color: var(--bad);
}

.badge-anual .mark {
    font-size: .85em;
}

tfoot td {
    padding: 12px 16px;
    font-size: .78rem;
    color: var(--ink-soft);
    border-top: 1px solid var(--line);
}

/* ============ Responsive: stacked cards below 720px ============ */
@media (max-width: 720px) {
    .toolbar {
        position: static;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    table,
    tbody,
    tr,
    td {
        display: block;
        width: 100%;
    }

    tbody tr {
        border: 1px solid var(--line);
        border-radius: var(--radius);
        margin: 12px;
        padding: 6px 4px;
        box-shadow: var(--shadow);
    }

    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 9px 12px;
        border-top: none;
    }

    td::before {
        content: attr(data-label);
        font-size: .72rem;
        letter-spacing: .04em;
        color: var(--ink-soft);
        font-weight: 600;
    }

    td.nombre {
        background: var(--bg);
        border-radius: 8px 8px 0 0;
        font-size: 1rem;
    }

    td.nombre::before {
        content: none;
    }

    td.tipo {
        font-size: .75rem;
    }
}

@media (prefers-reduced-motion: no-preference) {

    tbody tr,
    .badge-anual {
        transition: background .15s ease;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}