/* ===========================
   VARIABLES & RESET
   =========================== */
:root {
    --red-600: #EF4444;
    --red-400: #F87171;
    --gray-900: #1F2937;
    --red-100: #FEE2E2;
    --red-50: #FFF5F5;
    --red-700: #B91C1C;
    --red-800: #991B1B;
    --gray-700: #374151;
    --gray-500: #6B7280;
    --gray-400: #9CA3AF;
    --gray-300: #D1D5DB;
    --gray-200: #E5E7EB;
    --gray-100: #F3F4F6;
    --white: #FFFFFF;
    --font-title: 'Montserrat', sans-serif;
    --font-body: 'Roboto', sans-serif;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--red-600);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--red-800);
    text-decoration: underline;
}

/* Skip link (#9) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--red-600);
    color: var(--white);
    padding: 0.5rem 1rem;
    z-index: 200;
    font-family: var(--font-title);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
    top: 0;
    color: var(--white);
}

/* ===========================
   HEADER
   =========================== */
.dashboard-header {
    background: var(--gray-900);
    color: var(--white);
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
}

.dashboard-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1.25;
    margin-bottom: 0.5rem;
}

.title-accent {
    color: var(--red-400);
}

/* Header nav — visually separate bar */
.header-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    background: var(--red-600);
    margin-top: 0.75rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    margin-bottom: -1.5rem;
    padding: 0.4rem 1rem;
}

.nav-link {
    font-family: var(--font-title);
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 0.4rem 1.15rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    letter-spacing: 0.03em;
}

.nav-link:hover {
    color: var(--white);
    background: rgba(255,255,255,0.15);
    text-decoration: none;
}

.nav-link--active {
    color: var(--white);
    background: rgba(0,0,0,0.25);
}

.nav-link--active:hover {
    background: rgba(0,0,0,0.25);
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--white);
    z-index: 10;
}

.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.25s, opacity 0.25s;
}

.nav-toggle-bar + .nav-toggle-bar {
    margin-top: 5px;
}

/* Open state */
.nav-toggle.open .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Nav links container for mobile collapse */
.nav-links {
    display: contents;
}

.dashboard-credits {
    font-size: 0.8rem;
    color: var(--gray-300);
}

.dashboard-credits a {
    color: var(--red-400);
    font-weight: 500;
}

.dashboard-credits a:hover {
    color: var(--white);
}

/* ===========================
   CONTEXT BANNER
   =========================== */
.context-banner {
    background: var(--red-100);
    padding: 1rem 1.5rem;
}

.context-content {
    max-width: 1200px;
    margin: 0 auto;
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.7;
}

.context-content strong {
    color: var(--red-700);
}

/* ===========================
   SUMMARY CARDS
   =========================== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
}

@keyframes card-enter {
    0% { opacity: 0; transform: translateY(20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
    50% { box-shadow: 0 8px 25px rgba(239,68,68,0.2); }
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    border-top: 4px solid var(--gray-300);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
    animation: card-enter 0.6s ease-out both;
    position: relative;
    overflow: hidden;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.25s; }
.card:nth-child(3) { animation-delay: 0.4s; }

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,0.4) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out 1s 1;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.card-subtotal {
    border-top-color: var(--gray-900);
}

.card-iva {
    border-top-color: var(--red-400);
}

.card-total {
    border-top-color: var(--red-600);
    background: var(--red-600);
    color: var(--white);
    animation: card-enter 0.6s ease-out 0.4s both, pulse-glow 3s ease-in-out 2s 2;
}

.card-total::after {
    background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out 1s 1;
}

.card-label {
    display: block;
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.card-value {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 2rem;
    line-height: 1;
}

.card-value small {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.7;
}

/* ===========================
   FILTERS
   =========================== */
.filters-section {
    max-width: 1200px;
    margin: 0 auto 1.5rem;
    padding: 0 1.5rem;
}

.filters-heading {
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.filter-group--btn {
    display: flex;
    align-items: flex-end;
    padding-bottom: 0.15rem;
}

.filters-section--catalog {
    margin-top: 1.5rem;
}

.btn-reset {
    background: none;
    border: 1px solid var(--gray-300);
    color: var(--gray-500);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    border-color: var(--red-600);
    color: var(--red-600);
}

.filters-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr auto;
    gap: 1rem;
    align-items: end;
    background: var(--white);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.filter-group label {
    display: block;
    font-family: var(--font-title);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    margin-bottom: 0.35rem;
}

.filter-group select,
.filter-group input[type="text"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.825rem;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color 0.2s;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: var(--red-600);
    box-shadow: 0 0 0 2px rgba(239,68,68,0.15);
}

/* Range slider */
.range-slider {
    position: relative;
    height: 30px;
    margin-top: 0.25rem;
}

.range-slider::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    z-index: 0;
}

.range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 4px;
    top: 12px;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    z-index: 1;
}

.range-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--red-600);
    cursor: pointer;
    pointer-events: all;
    border: 2px solid var(--white);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--red-600);
    cursor: pointer;
    pointer-events: all;
    border: 2px solid var(--white);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.range-slider input[type="range"]:first-child {
    z-index: 2;
}

.range-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 0.15rem;
}

/* ===========================
   MAIN CONTENT LAYOUT
   =========================== */
.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
    align-items: stretch;
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
    position: sticky;
    top: 8rem;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* TOOLTIP CARD */
.tooltip-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--red-600);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tooltip-card .tooltip-data {
    flex: 1;
}

.tooltip-card .download-group--inline {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-200);
    flex-direction: row;
    gap: 0.5rem;
}

.tooltip-card .download-group--inline .btn-download {
    flex: 1;
}

.tooltip-title {
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.tooltip-hint {
    font-size: 0.8rem;
    color: var(--gray-400);
    font-style: italic;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--gray-100);
    gap: 0.75rem;
}

.tooltip-row:last-child {
    border-bottom: none;
}

.tooltip-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-500);
    white-space: nowrap;
    flex-shrink: 0;
}

.tooltip-value {
    font-size: 0.8rem;
    color: var(--gray-900);
    text-align: right;
    word-break: break-word;
}

.tooltip-concepto-row {
    flex: 1;
    align-items: flex-start;
}

.tooltip-concepto-row .tooltip-value {
    font-size: 0.72rem;
    line-height: 1.4;
    overflow-y: auto;
}

.tooltip-pct-row .tooltip-value {
    font-family: var(--font-title);
    font-weight: 700;
    color: var(--gray-900);
}

.tooltip-total-row {
    background: var(--red-100);
    margin: 0.25rem -0.5rem 0;
    padding: 0.5rem 0.5rem;
    border-radius: var(--radius);
    border-bottom: none;
}

.tooltip-total-row .tooltip-value {
    font-family: var(--font-title);
    font-weight: 800;
    color: var(--red-700);
    font-size: 1rem;
}

/* CONTRACTOR CARD */
.contractor-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
}

.contractor-title {
    font-family: var(--font-title);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.contractor-name {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--red-100);
}

.contractor-row {
    padding: 0.3rem 0;
}

.contractor-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-400);
}

.contractor-value {
    font-size: 0.8rem;
    color: var(--gray-700);
}

.contractor-value small {
    color: var(--gray-400);
    font-size: 0.7rem;
}

.contractor-source {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--red-600);
    padding: 0.35rem 0.6rem;
    background: var(--red-100);
    border-radius: var(--radius);
    transition: background 0.2s;
}

.contractor-source:hover {
    background: var(--red-600);
    color: var(--white);
    text-decoration: none;
}

/* DOWNLOAD BUTTON */
.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: var(--gray-900);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-title);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-download:hover {
    background: var(--red-600);
}

.btn-download--pdf {
    background: var(--red-600);
    text-decoration: none;
    color: var(--white);
}

.btn-download--pdf:hover {
    background: var(--gray-900);
    color: var(--white);
    text-decoration: none;
}

.download-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.download-group-label {
    font-family: var(--font-title);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}

.download-note {
    font-size: 0.65rem;
    color: var(--gray-400);
    text-align: center;
    font-style: italic;
}

/* ===========================
   TREEMAP
   =========================== */
.treemap-container {
    min-width: 0;
}

.treemap-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.treemap-header h2 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
}

.treemap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.65rem;
    color: var(--gray-500);
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.treemap-stats {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.treemap-chart {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    position: relative;
}

.treemap-chart svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Treemap cells */
.treemap-cell {
    cursor: pointer;
    transition: opacity 0.15s;
}

.treemap-cell:hover {
    opacity: 0.85;
}

.treemap-cell.selected rect {
    stroke: var(--gray-900);
    stroke-width: 3;
}

.treemap-label {
    font-family: var(--font-body);
    font-weight: 400;
    fill: rgba(255,255,255,0.9);
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.treemap-label-amount {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.7em;
    fill: var(--white);
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.treemap-partida-label {
    font-family: var(--font-title);
    font-weight: 900;
    fill: rgba(255,255,255,0.95);
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    paint-order: stroke;
    stroke: rgba(0,0,0,0.4);
    stroke-width: 3px;
    stroke-linejoin: round;
}

/* Treemap empty state (#29) */
.treemap-empty {
    padding: 2rem;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.9rem;
}

/* Treemap cell focus (#5) */
.treemap-cell:focus {
    outline: 2px solid var(--white);
    outline-offset: -2px;
}

/* Treemap hint — inside the white card */
.treemap-hint {
    font-size: 0.72rem;
    color: var(--gray-400);
    font-style: italic;
    margin: 0;
    padding: 0.5rem 0.75rem 0;
}

/* SVG chart text classes (#4.1) */
.chart-label-text {
    font-family: var(--font-body);
    fill: var(--gray-700);
}

.chart-value-text {
    font-family: var(--font-title);
    font-weight: 600;
    fill: var(--gray-700);
}

/* ===========================
   CONTRACTOR SECTION — horizontal
   =========================== */
.contractor-section-title {
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.contractor-section {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
}

.contractor-card--horizontal {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contractor-card--horizontal .contractor-card-main {
    flex-shrink: 0;
}

.contractor-card--horizontal .contractor-card-main .contractor-name {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.contractor-card--horizontal .contractor-card-details {
    flex: 1;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.contractor-card--horizontal .contractor-card-details .contractor-row {
    flex: 1;
    min-width: 150px;
}

.contractor-card--horizontal .contractor-card-action {
    flex-shrink: 0;
}

/* ===========================
   CHART SECTIONS
   =========================== */
.chart-section {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
}

.chart-section h2,
.chart-col h2 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.chart-description {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.bar-chart {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    overflow-x: auto;
}

.bar-chart svg {
    display: block;
}

/* Two-column bar charts */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
}

.chart-col {
    min-width: 0;
}

/* Floating tooltip for bar charts */
.chart-tooltip {
    position: fixed;
    z-index: 1000;
    background: var(--gray-900);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    max-width: 320px;
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.chart-tooltip.visible {
    opacity: 1;
}

.chart-tooltip .ct-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    color: var(--red-400);
}

.chart-tooltip .ct-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.chart-tooltip .ct-label {
    color: var(--gray-400);
}

.chart-tooltip .ct-value {
    font-weight: 600;
    white-space: nowrap;
}

/* ===========================
   IMPACT CARDS
   =========================== */
.impact-section {
    max-width: 1200px;
    margin: 1.5rem auto 1.5rem;
    padding: 0 1.5rem;
}

.impact-heading {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--gray-900);
}

.impact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.impact-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border-bottom: 3px solid var(--red-400);
    transition: transform 0.2s, box-shadow 0.2s;
}

.impact-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.impact-number {
    display: block;
    font-family: var(--font-title);
    font-weight: 900;
    font-size: 1.6rem;
    color: var(--red-600);
    line-height: 1.1;
    margin-bottom: 0.4rem;
}

.impact-desc {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-500);
    line-height: 1.4;
}

/* ===========================
   TIMELINE
   =========================== */
.timeline-section {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
}

.timeline-heading {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--gray-900);
}

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline-line {
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-300);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--white);
    border: 3px solid var(--gray-400);
    z-index: 1;
}

.timeline-item--alert .timeline-dot {
    border-color: var(--red-600);
    background: var(--red-100);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.timeline-date {
    font-family: var(--font-title);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--red-600);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.15rem;
}

.timeline-text {
    font-size: 0.82rem;
    color: var(--gray-700);
    line-height: 1.5;
}

.timeline-text strong {
    color: var(--red-700);
}

.timeline-text em {
    color: var(--gray-900);
    font-style: italic;
}

/* ===========================
   DATA TABLE
   =========================== */
.table-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 800px;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table th {
    background: var(--gray-900);
    color: var(--white);
    font-family: var(--font-title);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 0.6rem;
    text-align: left;
    white-space: nowrap;
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
    transition: background 0.15s;
}

.data-table th.sortable:hover {
    background: var(--red-600);
}

.data-table th.sort-asc .sort-arrow::after {
    content: ' ▲';
}

.data-table th.sort-desc .sort-arrow::after {
    content: ' ▼';
}

.data-table td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: top;
}

.data-table tbody tr:hover {
    background: var(--red-50);
}

.data-table tbody tr:nth-child(even) {
    background: var(--gray-100);
}

.data-table tbody tr:nth-child(even):hover {
    background: var(--red-100);
}

.data-table td.col-concepto {
    font-size: 0.72rem;
    max-width: 320px;
    line-height: 1.35;
}

.data-table td.col-total {
    font-family: var(--font-title);
    font-weight: 700;
    color: var(--red-700);
    white-space: nowrap;
}

.data-table td.col-numeric {
    text-align: right;
    white-space: nowrap;
}

/* Catalogo page */
.catalogo-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.catalogo-downloads {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-download--sm {
    padding: 0.45rem 0.75rem;
    font-size: 0.72rem;
}

.table-wrapper--full {
    max-height: calc(100vh - 280px);
}

/* ===========================
   FOOTER
   =========================== */
.dashboard-footer {
    background: var(--gray-900);
    color: var(--gray-400);
    text-align: center;
    padding: 1.5rem 1.5rem 1rem;
    font-size: 0.75rem;
}

.footer-note {
    margin-top: 0.35rem;
    font-size: 0.7rem;
    color: var(--gray-300);
}

.footer-date {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-family: var(--font-title);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-300);
    letter-spacing: 0.04em;
}

.footer-site {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--gray-300);
}

.footer-site a {
    color: var(--red-400);
    font-weight: 500;
}

.footer-site a:hover {
    color: var(--white);
}

/* ===========================
   RESPONSIVE
   =========================== */

/* Ultra-wide (#7.1) */
@media (min-width: 1600px) {
    .main-content,
    .charts-row,
    .contractor-section,
    .chart-section {
        max-width: 1440px;
    }
}

/* Table scroll affordance (#7.5) */
.table-wrapper {
    position: relative;
}

.table-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.table-wrapper.has-scroll::after {
    opacity: 1;
}

/* Tablet */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 280px 1fr;
        gap: 1rem;
    }

    .filters-row {
        grid-template-columns: 1fr 1fr;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }
}

/* Small tablet / large phone */
@media (max-width: 768px) {
    .dashboard-title {
        font-size: 1.35rem;
    }

    .nav-toggle {
        display: block;
    }

    .header-nav {
        flex-wrap: wrap;
        position: relative;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0.15rem;
        padding-top: 0.35rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-link {
        padding: 0.5rem 1rem;
        text-align: center;
    }

    .summary-cards {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.25rem;
    }

    .card-label { margin-bottom: 0; }
    .card-value { font-size: 1.5rem; }

    .filters-row {
        grid-template-columns: 1fr;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    /* Sidebar below treemap on mobile (#12) */
    .sidebar {
        position: static;
        display: block;
        order: 2;
    }

    .treemap-container {
        order: 1;
    }

    .tooltip-card {
        height: auto;
    }

    .contractor-card--horizontal {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .contractor-card--horizontal .contractor-card-details {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Phone */
@media (max-width: 480px) {
    html { font-size: 14px; }

    .dashboard-header {
        padding: 1.25rem 1rem 1rem;
    }

    .dashboard-title { font-size: 1.2rem; }

    .summary-cards,
    .filters-section,
    .main-content,
    .chart-section,
    .charts-row,
    .contractor-section {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .card-value { font-size: 1.3rem; }
    .bar-chart { padding: 0.75rem; }

    .impact-card {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        text-align: left;
        padding: 0.75rem 1rem;
    }

    .impact-number {
        font-size: 1.3rem;
        margin-bottom: 0;
        white-space: nowrap;
    }

    .impact-section,
    .timeline-section {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}
