:root {
    --bg-primary: #0f172a;
    --bg-secondary: rgba(30, 41, 59, 0.7);
    --bg-glass: rgba(15, 23, 42, 0.65);
    --text-primary: #f8fafc;
    --text-body: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --border-color: rgba(255, 255, 255, 0.1);
    --color-izq: #ef4444;
    --color-der: #3b82f6;
    --color-cen: #10b981;
    --font-sans: 'Google Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: 'Google Sans', sans-serif;
    --glass-blur: blur(12px);
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --text-primary: #0f172a;
    --text-body: #1a1a1a;
    --text-secondary: #475569;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

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

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

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .slide-up, .slide-up.visible { opacity: 1; transform: none; transition: none; }
}

body {
    background-color: var(--bg-primary);
    color: var(--text-body);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a, button, select, input, .mini-tab, .tab-btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

p {
    font-size: 1rem;
    line-height: 1.7;
    color: #4b5563;
    margin-bottom: 1rem;
    max-width: 100%;
}

[data-theme="dark"] p { color: #94a3b8; }

.ambient-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.12;
}
.bg-left { top: -10%; left: -10%; background: var(--color-der); }
.bg-right { bottom: -10%; right: -10%; background: var(--color-izq); }
[data-theme="light"] .ambient-glow { opacity: 0.06; }

@media (max-width: 1200px) {
    .ambient-glow { width: 300px; height: 300px; }
}
@media (max-width: 768px) {
    .ambient-glow { width: 200px; height: 200px; opacity: 0.1; }
}
@media (max-width: 480px) {
    .ambient-glow { width: 150px; height: 150px; opacity: 0.08; }
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (max-width: 768px) {
    .app-container { padding: 0 1rem; }
}
@media (max-width: 480px) {
    .app-container { padding: 0 0.75rem; }
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}

.btn-icon {
    position: fixed;
    top: 1.5rem;
    right: 1rem;
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
}
.btn-icon:hover { background: var(--bg-secondary); color: var(--accent); }

[data-theme="light"] .icon-light { display: none; }
[data-theme="dark"] .icon-dark { display: none; }

@media (max-width: 768px) {
    .btn-icon { top: 1rem; right: 0.75rem; width: 40px; height: 40px; }
}
@media (max-width: 480px) {
    .btn-icon { top: 0.75rem; right: 0.5rem; width: 38px; height: 38px; border-radius: 10px; }
}

.hero {
    padding: 0.5rem 0 1.5rem;
    text-align: center;
    position: relative;
}

.hero-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 1rem;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

[data-theme="dark"] .hero h1 { color: #cbd5e1; }

@media (max-width: 1024px) {
    .hero h1 { font-size: 2rem; }
}
@media (max-width: 768px) {
    .hero h1 { font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.2; }
}
@media (max-width: 480px) {
    .hero h1 { font-size: 1.25rem; letter-spacing: -0.01em; line-height: 1.25; }
}

.hero-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    text-align: left;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

@media (max-width: 1024px) {
    .hero-details { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}
@media (max-width: 768px) {
    .hero-details { grid-template-columns: 1fr; gap: 1.25rem; }
}

.detail-section {
    padding: 1rem 0;
}

.detail-section h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    flex-wrap: wrap;
}

.detail-section h3 i { color: var(--accent); width: 20px; height: 20px; }

.detail-section p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .detail-section h3 { font-size: 1.1rem; }
    .detail-section p { font-size: 0.9rem; }
}
@media (max-width: 480px) {
    .detail-section h3 { font-size: 1rem; }
    .detail-section p { font-size: 0.85rem; }
}

.support-section {
    grid-column: 1 / -1;
    background: var(--bg-glass);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid var(--accent);
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.1);
    margin-top: 2rem;
}

.support-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-donation {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.btn-donation i { width: 20px; height: 20px; }
.btn-donation.bmc { background: #FFDD00; color: #000000; }
.btn-donation.paypal { background: #0070BA; color: #ffffff; }

@media (max-width: 768px) {
    .support-section { padding: 1.5rem; }
    .btn-donation { padding: 0.6rem 1.25rem; font-size: 0.95rem; }
}
@media (max-width: 480px) {
    .support-section { padding: 1rem; border-radius: 1rem; }
    .support-actions { flex-direction: column; gap: 0.75rem; }
    .btn-donation { width: 100%; justify-content: center; }
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.social-links a {
    text-decoration: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem;
}
.social-links a i { width: 18px; height: 18px; transition: var(--transition); }
.social-links a:hover { color: var(--accent); transform: translateY(-2px); }

@media (max-width: 480px) {
    .social-links { gap: 0.5rem; }
    .social-links a { font-size: 0.85rem; padding: 0.35rem; }
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}
.tech-badge i { width: 14px; height: 14px; color: var(--accent); }
.tech-badge:hover { border-color: var(--accent); transform: translateY(-2px); }

@media (max-width: 480px) {
    .tech-badge { font-size: 0.75rem; padding: 0.35rem 0.6rem; }
    .tech-badge i { width: 12px; height: 12px; }
}

.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-soft);
}

@media (max-width: 1024px) {
    .glass-panel { border-radius: 1.25rem; padding: 1.25rem; }
}
@media (max-width: 768px) {
    .glass-panel { border-radius: 1rem; padding: 1rem; margin-bottom: 1.5rem; }
}
@media (max-width: 480px) {
    .glass-panel { border-radius: 0.75rem; padding: 0.875rem; margin-bottom: 1rem; }
}

.section-header {
    margin-bottom: 1rem;
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .section-header h2 { font-size: 1.35rem; gap: 0.5rem; }
    .section-desc { font-size: 0.9rem; }
}
@media (max-width: 480px) {
    .section-header h2 { font-size: 1.15rem; }
    .section-desc { font-size: 0.85rem; }
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}
@media (max-width: 600px) {
    .kpi-grid { grid-template-columns: 1fr; gap: 0.75rem; }
}

.kpi-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--color-cen));
    opacity: 0;
    transition: opacity 0.3s;
}
.kpi-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-soft); }
.kpi-card:hover::before { opacity: 1; }

@media (max-width: 768px) {
    .kpi-card { padding: 1rem; min-height: 180px; border-radius: 0.875rem; }
}
@media (max-width: 480px) {
    .kpi-card { padding: 0.875rem; min-height: 160px; }
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.kpi-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.kpi-year-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: rgba(56, 189, 248, 0.15);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

@media (max-width: 480px) {
    .kpi-label { font-size: 0.7rem; }
}

.kpi-trend-badge {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kpi-trend-badge.trend-up { background: rgba(16, 185, 129, 0.15); color: var(--color-cen); }
.kpi-trend-badge.trend-down { background: rgba(239, 68, 68, 0.15); color: var(--color-izq); }
.kpi-trend-badge.trend-neutral { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }
.kpi-trend-badge .trend-icon { width: 16px; height: 16px; }

.kpi-main-value {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.kpi-value-large {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

@media (max-width: 768px) {
    .kpi-value-large { font-size: 1.9rem; }
}
@media (max-width: 480px) {
    .kpi-value-large { font-size: 1.6rem; }
}

.kpi-variation-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-align: right;
    flex-shrink: 0;
}

.kpi-comp-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-comp-value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: var(--font-display);
}
.kpi-comp-value.trend-up { color: var(--color-cen); }
.kpi-comp-value.trend-down { color: var(--color-izq); }
.kpi-comp-value.trend-neutral { color: var(--text-secondary); }

.kpi-comp-pct { font-size: 0.75rem; font-weight: 600; }
.kpi-comp-pct.trend-up { color: var(--color-cen); }
.kpi-comp-pct.trend-down { color: var(--color-izq); }

@media (max-width: 480px) {
    .kpi-comp-value { font-size: 0.9rem; }
    .kpi-comp-pct { font-size: 0.7rem; }
}

.kpi-past .kpi-comp-value-skin {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.1));
    border: 1px solid rgba(249, 115, 22, 0.3);
    color: #fb923c;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    font-family: var(--font-display);
}

.kpi-insight {
    margin-top: auto;
    padding-top: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border-top: 1px dashed var(--border-color);
    width: 100%;
}
.kpi-insight .insight-icon { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; margin-top: 0.15rem; }
.kpi-insight span { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; width: 100%; }

@media (max-width: 480px) {
    .kpi-insight span { font-size: 0.75rem; }
}

.kpi-trend {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}
.kpi-trend.up { color: var(--color-cen); }
.kpi-trend.down { color: var(--color-izq); }
.kpi-trend.neutral { color: var(--text-secondary); }

.analysis-section {
    margin-top: 1.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
}

.analysis-section h3 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.analysis-section h3 i { color: var(--accent); width: 20px; height: 20px; }

.analysis-section h4 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}

.analysis-section p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    max-width: 100%;
}

@media (max-width: 768px) {
    .analysis-section { margin-top: 1rem; padding: 1rem 0; }
    .analysis-section h3 { font-size: 1.15rem; }
    .analysis-section h4 { font-size: 1rem; }
    .analysis-section p { font-size: 0.95rem; line-height: 1.7; }
}
@media (max-width: 480px) {
    .analysis-section h3 { font-size: 1.05rem; }
    .analysis-section h4 { font-size: 0.95rem; }
    .analysis-section p { font-size: 0.9rem; line-height: 1.6; }
}

.corp-switcher {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tab-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: 3rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}
.tab-btn.active, .tab-btn:hover { background: var(--text-primary); color: var(--bg-primary); border-color: var(--text-primary); }

@media (max-width: 480px) {
    .tab-btn { padding: 0.5rem 1.25rem; font-size: 0.9rem; }
}

.view-container { display: none; animation: fadeIn 0.4s ease; }
.view-container.active { display: block; }

.votes-charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
    width: 100%;
}

@media (max-width: 1024px) {
    .votes-charts-container { grid-template-columns: 1fr; gap: 1.5rem; }
}
@media (max-width: 480px) {
    .votes-charts-container { gap: 1rem; margin-top: 1rem; }
}

.votes-chart-wrapper {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    height: auto;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.votes-chart-wrapper h3 {
    margin-bottom: 0.75rem;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1rem;
    flex-shrink: 0;
    text-align: center;
}

.votes-chart-wrapper canvas {
    flex: 1;
    min-height: 0;
    width: 100% !important;
    max-height: 350px;
}

.votes-chart-wrapper.variation-chart {
    min-height: 350px;
    max-height: 600px;
}

@media (max-width: 768px) {
    .votes-chart-wrapper { min-height: 280px; max-height: 400px; padding: 0.875rem; }
    .votes-chart-wrapper h3 { font-size: 0.9rem; }
    .votes-chart-wrapper canvas { max-height: 280px; }
    .votes-chart-wrapper.variation-chart { min-height: 300px; max-height: 500px; }
}
@media (max-width: 480px) {
    .votes-chart-wrapper { min-height: 250px; max-height: 350px; padding: 0.75rem; }
    .votes-chart-wrapper h3 { font-size: 0.85rem; }
    .votes-chart-wrapper canvas { max-height: 250px; }
}

.pie-charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
    width: 100%;
}

@media (max-width: 768px) {
    .pie-charts-container { grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem; }
}

.pie-chart-wrapper {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    height: 420px;
    overflow: hidden;
}

.pie-chart-wrapper h3 {
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.pie-chart-wrapper canvas {
    flex: 1;
    min-height: 0;
    width: 100% !important;
    aspect-ratio: 1;
    object-fit: contain;
}

@media (max-width: 768px) {
    .pie-chart-wrapper { height: 360px; padding: 0.75rem; }
    .pie-chart-wrapper h3 { font-size: 0.9rem; margin-bottom: 0.35rem; }
}
@media (max-width: 480px) {
    .pie-chart-wrapper { height: 320px; padding: 0.5rem; }
    .pie-chart-wrapper h3 { font-size: 0.85rem; }
}

.ideology-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .ideology-charts { grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }
}

.chart-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    height: 340px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.chart-box canvas {
    flex: 1;
    min-height: 0;
    width: 100% !important;
    aspect-ratio: 1;
    object-fit: contain;
}

@media (max-width: 768px) {
    .chart-box { height: 300px; padding: 0.75rem; }
}
@media (max-width: 480px) {
    .chart-box { height: 280px; padding: 0.5rem; }
}

.congress-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .congress-layout { grid-template-columns: 1fr; gap: 1.25rem; }
}
@media (max-width: 480px) {
    .congress-layout { gap: 1rem; margin-bottom: 1rem; }
}

.hemiciclo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    width: 100%;
}

.hemiciclo-wrapper h3 {
    margin-bottom: 1rem;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .hemiciclo-wrapper { padding: 1rem; }
    .hemiciclo-wrapper h3 { font-size: 1rem; margin-bottom: 0.75rem; }
}

.ideology-shift-wrapper h3 {
    margin-bottom: 1.5rem;
    font-family: var(--font-display);
    text-align: center;
}

@media (max-width: 768px) {
    .ideology-shift-wrapper h3 { font-size: 1.1rem; margin-bottom: 1rem; }
}

.congress-table-container {
    width: 100%;
    margin-top: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.congress-comp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 300px;
}

.congress-comp-table thead th,
.congress-comp-table tbody td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: center;
    vertical-align: middle;
}
.congress-comp-table thead th:last-child,
.congress-comp-table tbody td:last-child { border-right: none; }
.congress-comp-table thead th:first-child,
.congress-comp-table tbody td:first-child { text-align: left; width: 46%; }
.congress-comp-table thead th:nth-child(2),
.congress-comp-table tbody td:nth-child(2) { width: 17%; }
.congress-comp-table thead th:nth-child(3),
.congress-comp-table tbody td:nth-child(3) { width: 17%; }
.congress-comp-table thead th:nth-child(4),
.congress-comp-table tbody td:nth-child(4) { width: 20%; }

.congress-comp-table thead th {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
}
.congress-comp-table tbody td { color: var(--text-secondary); }
.congress-comp-table tbody td:first-child { padding-left: 0.5rem; }

.congress-comp-table .party-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.5);
    vertical-align: middle;
    margin-right: 0.4rem;
}

.diff-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.8rem;
}
.diff-up { color: #16a34a; background: rgba(22, 163, 74, 0.12); }
.diff-up::before { content: "▲"; font-size: 0.7rem; }
.diff-down { color: #dc2626; background: rgba(220, 38, 38, 0.12); }
.diff-down::before { content: "▼"; font-size: 0.7rem; }

@media (max-width: 768px) {
    .congress-comp-table { font-size: 0.8rem; min-width: 280px; }
    .congress-comp-table thead th,
    .congress-comp-table tbody td { padding: 0.4rem 0.3rem; }
    .congress-table-container { margin-top: 1rem; }
}
@media (max-width: 480px) {
    .congress-comp-table { font-size: 0.75rem; min-width: 250px; }
    .congress-comp-table thead th:first-child,
    .congress-comp-table tbody td:first-child { width: 40%; }
    .party-dot { width: 8px; height: 8px; }
}

.advanced-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .advanced-metrics-grid { grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem; }
}

.adv-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 1.5rem;
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
.adv-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--accent);
    opacity: 0.3;
}
.adv-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow-soft); }

@media (max-width: 768px) {
    .adv-card { padding: 1.25rem; border-radius: 1rem; }
}

.adv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.adv-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.adv-value {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .adv-value { font-size: 1.8rem; }
}
@media (max-width: 480px) {
    .adv-value { font-size: 1.5rem; }
}

.adv-interpretation {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 0.4rem;
    text-transform: uppercase;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}
.adv-interpretation.good { color: var(--color-cen); border-color: var(--color-cen); }
.adv-interpretation.warning { color: #f59e0b; border-color: #f59e0b; }
.adv-interpretation.danger { color: var(--color-izq); border-color: var(--color-izq); }

.adv-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    line-height: 1.5;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

@media (max-width: 768px) {
    .adv-desc { font-size: 0.8rem; }
}

.adv-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-primary);
    padding: 0.25rem 0.6rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    color: var(--accent);
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.party-grid.active {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .party-grid.active { grid-template-columns: 1fr; gap: 1rem; }
}

.party-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
}

.pc-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.pc-color { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.pc-name { font-family: var(--font-display); font-weight: 600; font-size: 1rem; flex: 1; }
.pc-tag { font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 1rem; background: var(--border-color); text-transform: uppercase; font-weight: 600; }

.pc-body { padding: 1rem 1.25rem; }
.pc-stat-row { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.9rem; }
.pc-stat-val { font-weight: 600; font-family: var(--font-display); }
.pc-stat-val.gain { color: var(--color-cen); }
.pc-stat-val.loss { color: var(--color-izq); }

@media (max-width: 768px) {
    .pc-header { padding: 0.875rem 1rem; }
    .pc-body { padding: 0.875rem 1rem; }
    .pc-name { font-size: 0.95rem; }
    .pc-stat-row { font-size: 0.85rem; }
}

.map-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .map-container { gap: 1.5rem; margin-top: 1rem; }
}
@media (max-width: 480px) {
    .map-container { gap: 1rem; }
}

.map-row {
    display: flex;
    gap: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    transition: var(--transition);
}

.map-row:hover { border-color: var(--accent); box-shadow: var(--shadow-soft); }

@media (max-width: 1024px) {
    .map-row { flex-direction: column; gap: 1.5rem; padding: 1.5rem; }
}
@media (max-width: 768px) {
    .map-row { padding: 1rem; gap: 1rem; border-radius: 1rem; }
}

.map-visual {
    flex: 0 0 70%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    padding-right: 2rem;
}

@media (max-width: 1024px) {
    .map-visual { flex: none; border-right: none; border-bottom: 1px solid var(--border-color); padding-right: 0; padding-bottom: 1.5rem; }
}

.map-header-mini { margin-bottom: 1rem; }

.map-header-mini h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.map-header-mini p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .map-header-mini h3 { font-size: 1.1rem; }
    .map-header-mini p { font-size: 0.85rem; }
}

.corp-switcher-mini {
    display: flex;
    background: var(--bg-secondary);
    padding: 0.25rem;
    border-radius: 0.75rem;
    gap: 0.25rem;
    width: fit-content;
    margin-top: 0.75rem;
}

.mini-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    min-width: 44px;
}
.mini-tab.active { background: var(--bg-primary); color: var(--accent); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
[data-theme="light"] .mini-tab.active { background: white; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

@media (max-width: 480px) {
    .mini-tab { padding: 0.4rem 0.75rem; font-size: 0.8rem; min-width: auto; }
}

.d3-map {
    width: 100%;
    flex: 1;
    min-height: 350px;
    position: relative;
}

@media (max-width: 768px) {
    .d3-map { min-height: 280px; }
}
@media (max-width: 480px) {
    .d3-map { min-height: 220px; }
}

.map-analysis {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem;
    font-size: 0.95rem;
}

.stats-card {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.stats-card h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
}
.stat-item:last-child { border-bottom: none; margin-bottom: 0; }

.stat-label { color: var(--text-secondary); }
.stat-value { font-weight: 700; color: var(--text-primary); }

.analysis-text {
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.stats-card .analysis-text { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.05); }
.analysis-text b { color: var(--text-primary); }

@media (max-width: 768px) {
    .map-analysis { font-size: 0.9rem; }
    .stats-card { padding: 1rem; }
    .stat-item { font-size: 0.85rem; }
    .analysis-text { font-size: 0.85rem; }
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.02);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-color, .legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}
.legend-dot { border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); }

@media (max-width: 768px) {
    .map-legend { gap: 0.5rem; padding: 0.5rem; }
    .legend-item { font-size: 0.7rem; gap: 0.3rem; }
    .legend-color, .legend-dot { width: 10px; height: 10px; }
}

.ranking-chart-container {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ranking-item { display: flex; flex-direction: column; gap: 0.15rem; }

.ranking-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ranking-bar-wrapper {
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}
.ranking-bar { height: 100%; border-radius: 3px; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); }
.ranking-party-name { font-weight: 600; color: var(--text-primary); }

@media (max-width: 768px) {
    .ranking-header { font-size: 0.75rem; }
}

.d3-tooltip {
    position: absolute;
    text-align: center;
    padding: 0.5rem 1rem;
    background: var(--text-primary);
    color: var(--bg-primary);
    border-radius: 0.5rem;
    pointer-events: none;
    opacity: 0;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-soft);
    z-index: 100;
    transition: opacity 0.2s;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
}

canvas { width: 100%; }

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    footer { padding: 1.5rem 0; font-size: 0.85rem; }
}
@media (max-width: 480px) {
    footer { padding: 1rem 0.5rem; font-size: 0.8rem; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.slide-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.slide-up.visible { opacity: 1; transform: translateY(0); }

svg { overflow: visible; }
.seat { cursor: pointer; }
.d3-map path { stroke: var(--bg-primary); stroke-width: 0.5px; transition: opacity 0.3s; }
.d3-map path:hover { opacity: 0.8; }

.lucide {
    width: 1em;
    height: 1em;
    stroke-width: 2px;
    stroke: currentColor;
    fill: none;
    display: inline-block;
    vertical-align: middle;
}

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

.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;
}

.analyst-note {
    background: rgba(56, 189, 248, 0.03);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
    max-width: 100%;
    transition: var(--transition);
}

.analyst-note:hover { border-color: var(--accent); box-shadow: var(--shadow-soft); background: rgba(56, 189, 248, 0.05); }

.note-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--accent);
}
.note-header h3, .note-header span { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; margin: 0; }
.note-header i { width: 18px; height: 18px; }

.analyst-note p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.analyst-note ul { list-style: none; padding: 0; margin: 0 0 1rem 0; }
.analyst-note li { position: relative; padding-left: 1.5rem; margin-bottom: 0.75rem; color: var(--text-secondary); line-height: 1.5; }
.analyst-note li::before { content: '→'; position: absolute; left: 0; color: var(--accent); font-weight: bold; }
.analyst-note li strong { color: var(--text-primary); }

@media (max-width: 768px) {
    .analyst-note { padding: 1.25rem; margin-top: 1rem; }
    .note-header { flex-direction: column; align-items: flex-start; }
    .note-header h3, .note-header span { font-size: 1.05rem; }
    .analyst-note p { font-size: 0.9rem; }
}
@media (max-width: 480px) {
    .analyst-note { padding: 1rem; border-radius: 0.75rem; }
    .analyst-note li { font-size: 0.85rem; padding-left: 1.25rem; }
}

.methodology-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
}
.methodology-content h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-top: 1.5rem; margin-bottom: 0.75rem; }
.methodology-content h3:first-child { margin-top: 0; }
.methodology-content p { margin-bottom: 0.75rem; }
.methodology-content ul, .methodology-content ol { margin-left: 1.5rem; margin-bottom: 1rem; }
.methodology-content li { margin-bottom: 0.5rem; }
.methodology-content a { color: var(--accent); text-decoration: none; word-break: break-all; }
.methodology-content a:hover { text-decoration: underline; }
.methodology-content code { background: var(--bg-secondary); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85em; color: var(--accent); }
.methodology-content strong { color: var(--text-primary); font-weight: 600; }

@media (max-width: 768px) {
    .methodology-content { font-size: 0.9rem; }
    .methodology-content h3 { font-size: 1rem; }
}
@media (max-width: 480px) {
    .methodology-content { font-size: 0.85rem; line-height: 1.6; }
    .methodology-content h3 { font-size: 0.95rem; }
}

.legal-disclaimer {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
}
.legal-disclaimer h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; }
.legal-disclaimer h4 { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin-top: 1.25rem; margin-bottom: 0.5rem; }
.legal-disclaimer h4:first-of-type { margin-top: 0; }
.legal-disclaimer p { margin-bottom: 1rem; font-size: 0.9rem; }
.legal-disclaimer ul { margin-left: 1.25rem; margin-top: 0.5rem; margin-bottom: 0.75rem; }
.legal-disclaimer li { margin-bottom: 0.35rem; font-size: 0.9rem; }

@media (max-width: 768px) {
    .legal-disclaimer { padding: 1.25rem; }
    .legal-disclaimer h3 { font-size: 1.05rem; }
    .legal-disclaimer p, .legal-disclaimer li { font-size: 0.85rem; }
}

.section-analytical-note {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: rgba(56, 189, 248, 0.05);
    border-left: 3px solid var(--accent);
    border-radius: 0 0.75rem 0.75rem 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}
.section-analytical-note strong { color: var(--text-primary); font-weight: 700; }

@media (max-width: 768px) {
    .section-analytical-note { font-size: 0.9rem; padding: 0.875rem 1rem; }
}

.data-number { font-feature-settings: "tnum"; }
