:root {
    /* Carrosio brand skin — editorial Roman desk, not SaaS blue */
    --font-serif: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
    --font-sans: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --ink: #141210;
    --ink-light: #3f3a34;
    --ink-muted: #6b645c;
    --ink-faint: #978e84;

    --paper: #fffcf7;
    --paper-warm: #f4efe6;
    --paper-cool: #ebe4d8;

    /* Imperial red from brand mark */
    --accent: #9e1b24;
    --accent-light: #c43c3c;
    --accent-soft: rgba(158, 27, 36, 0.10);
    --success: #2f6b4f;
    --success-light: #e3efe8;
    --warning: #a65d12;
    --warning-light: #f8ead7;
    --danger: #9e1b24;
    --danger-light: #f6e4e5;

    --border: #ddd4c6;
    --border-light: #ebe3d6;

    --shadow-sm: 0 1px 0 rgba(20, 18, 16, 0.04);
    --shadow-md: 0 8px 24px rgba(20, 18, 16, 0.06);
    --shadow-lg: 0 18px 40px rgba(20, 18, 16, 0.08);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.hidden-section {
    display: none !important;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    font-family: var(--font-sans);
    background: var(--paper-warm);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
}

::selection {
    background: var(--accent);
    color: white;
}

.header {
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0 32px;
    height: 68px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: inset 0 -2px 0 var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    line-height: 0;
    transition: opacity 0.2s var(--ease-out);
}

.logo:hover {
    opacity: 0.78;
}

.logo-img {
    height: 28px;
    width: auto;
    max-width: min(168px, 42vw);
    display: block;
    object-fit: contain;
}

.logo-img-dark {
    display: none;
}

body.dark .logo-img-light {
    display: none;
}

body.dark .logo-img-dark {
    display: block;
}

.footer-brand {
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-logo {
    height: 30px;
    width: auto;
    max-width: 180px;
    display: block;
    object-fit: contain;
    opacity: 0.95;
}

.logo-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.logo-tagline {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    color: var(--ink-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 8px 4px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    transition: color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}

.nav-link:hover {
    color: var(--ink);
    background: transparent;
    border-bottom-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.nav-link.active {
    color: var(--ink);
    background: transparent;
    font-weight: 700;
    border-bottom-color: var(--accent);
}

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

.nav-link.scraper-nav-btn {
    padding: 8px 11px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.nav-link.scraper-nav-btn:hover {
    border-color: color-mix(in srgb, var(--accent) 88%, #000);
    background: color-mix(in srgb, var(--accent) 88%, #000);
    color: #fff;
}

.nav-link.scraper-nav-btn:focus-visible {
    outline-offset: 3px;
}

.cache-control {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--paper);
}

.cache-control[hidden] {
    display: none;
}

.cache-status {
    max-width: 210px;
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cache-refresh-btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    background: var(--paper-cool);
    color: var(--ink-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
}

.cache-refresh-btn:hover:not(:disabled) {
    color: var(--ink);
    background: var(--border-light);
}

.cache-refresh-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.cache-refresh-btn.is-loading svg {
    animation: cache-spin 1s linear infinite;
}

.cache-all-btn {
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--paper-cool);
    color: var(--ink-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font: 700 10px var(--font-mono, monospace);
    white-space: nowrap;
    transition: all 0.2s var(--ease-out);
}

.cache-all-btn:hover:not(:disabled) {
    color: var(--ink);
    background: var(--border-light);
}

.cache-all-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.cache-all-btn.is-loading svg {
    animation: cache-spin 1s linear infinite;
}

.cache-cancel-btn {
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid var(--danger, #b42318);
    border-radius: 6px;
    background: transparent;
    color: var(--danger, #b42318);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.cache-cancel-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--danger, #b42318) 10%, var(--paper));
}

.cache-cancel-btn:disabled {
    cursor: wait;
    opacity: .65;
}

.cache-log-toggle {
    min-height: 28px;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--paper-cool);
    color: var(--ink-muted);
    cursor: pointer;
    font: 600 10px var(--font-mono, monospace);
}

.cache-log-toggle:hover,
.cache-log-toggle[aria-expanded="true"] {
    color: var(--ink);
    background: var(--border-light);
}

.cache-log-panel {
    right: 0;
    width: min(430px, calc(100vw - 28px));
}

@keyframes cache-spin {
    to { transform: rotate(360deg); }
}

.dev-live-control {
    position: relative;
}

.dev-live-control[hidden],
.dev-live-panel[hidden] {
    display: none;
}

.dev-live-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 8%, var(--paper));
    color: var(--accent);
    cursor: pointer;
    font: 600 11px var(--font-mono, monospace);
    letter-spacing: .03em;
}

.dev-live-toggle:hover,
.dev-live-toggle[aria-expanded="true"] {
    background: color-mix(in srgb, var(--accent) 15%, var(--paper));
}

.dev-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.dev-live-panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 10px);
    right: 0;
    width: min(390px, calc(100vw - 28px));
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--paper-warm, var(--paper));
    box-shadow: 0 16px 38px rgba(20, 18, 16, .16);
}

.dev-live-head,
.dev-live-target,
.dev-live-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dev-live-head strong {
    color: var(--ink);
    font: 600 14px var(--font-serif, Georgia, serif);
}

.dev-live-badge {
    color: var(--accent);
    font: 600 10px var(--font-mono, monospace);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.dev-live-hint {
    margin: 8px 0 12px;
    color: var(--ink-muted);
    font-size: 11px;
    line-height: 1.45;
}

.dev-live-target {
    margin-bottom: 8px;
    color: var(--ink-light);
    font-size: 12px;
    font-weight: 600;
}

.dev-live-progress {
    height: 6px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--border-light);
}

.dev-live-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width .2s ease;
}

.dev-live-progress-text {
    min-height: 28px;
    color: var(--ink-muted);
    font: 11px var(--font-mono, monospace);
}

.dev-live-start {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--accent);
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.dev-live-start:hover:not(:disabled) { filter: brightness(1.08); }
.dev-live-start:disabled { cursor: wait; opacity: .65; }

.dev-live-steps {
    display: grid;
    gap: 4px;
    max-height: 120px;
    margin-top: 12px;
    overflow: auto;
}

.dev-live-step {
    display: flex;
    align-items: baseline;
    gap: 7px;
    color: var(--ink-muted);
    font-size: 10px;
}

.dev-live-step.is-running { color: var(--accent); font-weight: 700; }
.dev-live-step.is-done { color: var(--ink-light); }
.dev-live-step.is-error { color: #b42318; }
.dev-live-step-mark { width: 12px; text-align: center; font-family: var(--font-mono, monospace); }

.dev-live-logs {
    max-height: 150px;
    margin: 10px 0 0;
    padding: 9px;
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: color-mix(in srgb, var(--ink) 4%, var(--paper));
    color: var(--ink-muted);
    font: 10px/1.45 var(--font-mono, monospace);
    white-space: pre-wrap;
}

body.dark .dev-live-panel { box-shadow: 0 16px 38px rgba(0, 0, 0, .4); }

.nav-date {
    font-size: 13px;
    color: var(--ink-muted);
    font-weight: 500;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--paper);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-light);
    transition: all 0.2s var(--ease-out);
}

.theme-toggle:hover {
    border-color: var(--ink-muted);
    color: var(--ink);
}

.theme-toggle:active {
    transform: scale(0.9);
}

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

.theme-icon { display: none; }
.theme-icon.sun { display: block; }

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
}

.selector {
    background: var(--paper);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.selector-title {
    font-size: 11px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 16px;
}

.politicians {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.politicians::-webkit-scrollbar { height: 4px; }
.politicians::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Full roster grouped by country */
.politicians-by-country {
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow: visible;
    padding-bottom: 0;
}

.country-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.country-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-light);
    letter-spacing: 0.02em;
}

.country-section-flag {
    font-size: 16px;
    line-height: 1;
}

.country-section-count {
    margin-left: 2px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--paper-cool);
    border: 1px solid var(--border-light);
    color: var(--ink-muted);
    font-size: 10px;
    font-weight: 700;
}

.country-politicians {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.country-politicians::-webkit-scrollbar { height: 4px; }
.country-politicians::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.politician {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    min-width: 100px;
    padding: 16px 12px;
    border-radius: 12px;
    transition: all 0.25s var(--ease-out);
    border: 2px solid transparent;
    background: transparent;
}

.politician:hover {
    background: var(--paper-cool);
}

.politician.active {
    background: var(--paper-cool);
    border-color: var(--accent);
}

.politician:active {
    transform: scale(0.98);
}

.politician .avatar-wrapper {
    position: relative;
}

.politician .avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    color: white;
    object-fit: cover;
    border: 2px solid var(--paper);
    box-shadow: var(--shadow-md);
    transition: transform 0.25s var(--ease-spring);
}

.politician:hover .avatar {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.politician img.avatar {
    border: 2px solid var(--paper);
}

.politician .avatar-flag {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 20px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.politician .name {
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
    text-align: center;
    color: var(--ink);
}

.politician .country {
    font-size: 11px;
    color: var(--ink-muted);
    margin-top: 2px;
}

.window-toggle-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.window-toggle {
    display: inline-flex;
    gap: 4px;
    background: var(--paper);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--border);
}

.window-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: var(--ink-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s var(--ease-out);
}

.window-btn.active {
    background: var(--ink);
    color: var(--paper);
}

.window-btn:hover:not(.active) {
    background: var(--paper-cool);
    color: var(--ink);
}

.window-btn:active {
    transform: scale(0.95);
}

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

.hero-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.hero-profile {
    background: var(--paper);
    border-radius: 16px;
    padding: 32px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: var(--shadow-sm);
}

.main-avatar {
    width: 100px;
    height: 100px;
    min-width: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 600;
    color: white;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.main-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-info {
    flex: 1;
}

.main-name {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 4px;
}

.name-flag {
    font-size: 24px;
    vertical-align: middle;
}

.main-subtitle {
    font-size: 14px;
    color: var(--ink-muted);
    margin-bottom: 16px;
}

.share-buttons {
    display: flex;
    gap: 8px;
}

.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: var(--paper-cool);
    color: var(--ink-light);
    border: 1px solid var(--border);
    transition: all 0.2s var(--ease-out);
}

.share-btn:hover {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

.share-btn:active {
    transform: scale(0.9);
}

.hero-sentiment {
    display: flex;
}

.sentiment-card {
    flex: 1;
    background: var(--paper);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.sentiment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sentiment-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
    font-weight: 600;
}

.sentiment-display {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

.sentiment-value {
    font-family: var(--font-sans);
    font-size: 52px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.sentiment-value.positive { color: var(--success); }
.sentiment-value.negative { color: var(--danger); }
.sentiment-value.neutral { color: var(--warning); }

.sentiment-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sentiment-changes {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.change-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--paper-cool);
    border: 1px solid var(--border-light);
    min-width: 70px;
}

.change-badge .change-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.change-badge .change-value {
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-sans);
    letter-spacing: -0.02em;
}

.change-badge.up {
    background: var(--success-light);
    border-color: rgba(5, 150, 105, 0.2);
}

.change-badge.up .change-value {
    color: var(--success);
}

.change-badge.up .change-value::before {
    content: '↑ ';
    font-size: 12px;
}

.change-badge.down {
    background: var(--danger-light);
    border-color: rgba(220, 38, 38, 0.2);
}

.change-badge.down .change-value {
    color: var(--danger);
}

.change-badge.down .change-value::before {
    content: '↓ ';
    font-size: 12px;
}

.change-badge.neutral {
    background: var(--paper-cool);
}

.change-badge.neutral .change-value {
    color: var(--ink-muted);
}

.sentiment-spark {
    flex: 1;
    min-height: 60px;
    border-radius: 8px;
    overflow: hidden;
}

.desktop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
    align-items: start;
}

.desktop-grid > .card {
    min-width: 0;
}

.card {
    background: var(--paper);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease-out);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 11px;
    color: var(--ink-muted);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.title-icon {
    font-size: 14px;
}

.info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--paper-cool);
    color: var(--ink-faint);
    font-size: 11px;
    font-weight: 600;
    cursor: help;
    border: 1px solid var(--border);
    transition: all 0.2s var(--ease-out);
    margin-left: auto;
    position: relative;
}

.info-btn:hover,
.info-btn.info-btn-open {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.info-btn { cursor: pointer; }

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

/* Single shared methodology popover. Fixed so a card's overflow cannot clip it;
   positioned from JS, which also clamps it inside narrow viewports. */
.info-popover {
    position: fixed;
    z-index: 3000;
    max-width: 320px;
    padding: 12px 14px;
    background: var(--paper);
    color: var(--ink-light);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
    font-size: 13px;
    line-height: 1.55;
    text-align: left;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}

.info-popover[hidden] { display: none; }

.info-btn::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: var(--ink);
    color: var(--paper);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 220px;
    white-space: normal;
    text-align: center;
    opacity: 0;
    display: none;
    transition: all 0.2s var(--ease-out);
    pointer-events: none;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.info-btn:hover::after,
.info-btn:focus-visible::after,
.info-btn.info-btn-open::after {
    opacity: 1;
    display: block;
    transform: translateX(-50%) scale(1);
}

.info-btn::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--ink);
    opacity: 0;
    display: none;
    transition: all 0.2s var(--ease-out);
    z-index: 101;
}

.info-btn:hover::before,
.info-btn:focus-visible::before,
.info-btn.info-btn-open::before {
    opacity: 1;
    display: block;
}

.metric-card {}

.metric-row {
    display: flex;
    gap: 32px;
    margin-bottom: 16px;
}

.metric-col { flex: 1; }

.metric-label {
    font-size: 11px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    font-weight: 500;
}

.hate-value {
    font-family: var(--font-sans);
    font-size: 32px;
    font-weight: 700;
    color: var(--danger);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.metric-change {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}

.metric-change.up { color: var(--success); }
.metric-change.down { color: var(--danger); }
.metric-change.neutral { color: var(--ink-muted); }

.metric-sparkline {
    height: 60px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.chart-container {
    height: 280px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.gender-ratio-panel {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--paper-cool);
    border-radius: 10px;
}

.gender-ratio-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gender-ratio-spark {
    width: 100%;
    height: 52px;
    margin-top: 6px;
}

.chart-container.chart-loading {
    opacity: 0.55;
}

.chart-mode-meta {
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 600;
}

.chart-toggle {
    display: flex;
    gap: 4px;
    background: var(--paper-cool);
    border-radius: 6px;
    padding: 3px;
    margin-left: auto;
}

.history-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.history-range-toggle {
    display: flex;
    gap: 3px;
    padding: 3px;
    border-radius: 6px;
    background: var(--paper-cool);
}

.history-range-toggle[hidden] { display: none; }

.history-trend-delta {
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: none;
    white-space: nowrap;
}

.history-trend-delta.positive { color: var(--success); }
.history-trend-delta.negative { color: var(--danger); }

.chart-range-btn {
    border: 0;
    border-radius: 4px;
    padding: 6px 8px;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    font: 600 11px var(--font-sans);
}

.chart-range-btn.active {
    background: var(--paper);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.chart-range-btn:hover:not(.active) {
    color: var(--ink);
}

.history-card.is-expanded .chart-container {
    height: 560px;
}

.chart-toggle-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s var(--ease-out);
    position: relative;
}

.chart-toggle-btn.active {
    background: var(--paper);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.chart-toggle-btn:hover:not(.active) {
    color: var(--ink);
    background: rgba(0, 0, 0, 0.03);
}

.chart-toggle-btn:active {
    transform: scale(0.95);
}

.chart-toggle-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.chart-expand-btn {
    width: 34px;
    height: 34px;
    margin-left: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--paper);
    color: var(--ink-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
}

.chart-expand-btn:hover,
.chart-expand-btn.active {
    color: var(--ink);
    border-color: var(--ink-muted);
    background: var(--paper-cool);
}

.gender-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.gender-grid > .gender-card { min-width: 0; }

.gender-card {
    padding: 20px;
    border-radius: 12px;
    border-left: 3px solid;
    transition: all 0.2s var(--ease-out);
}

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

.gender-card.female {
    border-color: #ec4899;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.06) 0%, transparent 100%);
}

.gender-card.male {
    border-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, transparent 100%);
}

.gender-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gender-icon { font-size: 16px; }

.gender-card.female .gender-title { color: #be185d; }
.gender-card.male .gender-title { color: #1d4ed8; }

.gender-value {
    font-family: var(--font-sans);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.gender-card.female .gender-value { color: #ec4899; }
.gender-card.male .gender-value { color: #3b82f6; }

.gender-spark {
    height: 50px;
    width: 100%;
    margin-top: 12px;
    border-radius: 6px;
    overflow: hidden;
}

.gender-gap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--paper-cool);
    border-radius: 10px;
    margin-top: 16px;
    border: 1px solid var(--border-light);
}

.gender-gap-label {
    font-size: 13px;
    color: var(--ink-muted);
    font-weight: 500;
}

.gender-gap-value {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.gender-expanded-panel {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.gender-expanded-panel.is-open {
    display: block;
}

.gender-expanded-chart {
    height: 360px;
}

.donut-container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.donut-chart {
    width: 160px;
    height: 160px;
    flex-shrink: 0;
}

.donut-legend { min-width: 0; }

.topic-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topic-view-toggle {
    display: flex;
    gap: 4px;
    margin-left: auto;
    padding: 3px;
    border-radius: 7px;
    background: var(--paper-cool);
}

.topic-view-btn {
    border: 0;
    border-radius: 5px;
    padding: 6px 9px;
    background: transparent;
    color: var(--ink-muted);
    font: 600 11px var(--font-sans);
    cursor: pointer;
}

.topic-view-btn.active {
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.topic-sentiment-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 1.2fr) auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.topic-delta-track {
    position: relative;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--paper-cool);
}

.topic-delta-axis {
    position: absolute;
    inset: -2px auto -2px 50%;
    width: 1px;
    background: var(--ink-muted);
    opacity: 0.5;
    z-index: 1;
}

.topic-delta-fill {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 999px;
}

.topic-delta-fill.positive {
    left: 50%;
    background: var(--success);
}

.topic-delta-fill.negative {
    right: 50%;
    background: var(--danger);
}

.topic-delta-value {
    min-width: 58px;
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.topic-delta-value.positive { color: var(--success); }
.topic-delta-value.negative { color: var(--danger); }

.topic-weekly-chart {
    height: 360px;
}

.topic-trend-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--paper-cool);
}

.topic-trend-btn {
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 650;
    line-height: 1;
    padding: 7px 9px;
    white-space: nowrap;
}

.topic-trend-btn.active {
    background: var(--accent);
    color: #fff;
}

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

@media (max-width: 640px) {
    .topics-card .card-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .topic-view-toggle {
        width: 100%;
        margin-left: 0;
    }

    .topic-head-right {
        width: 100%;
        gap: 8px;
    }

    .topic-period-toggle,
    .topic-level-toggle {
        flex: 1 1 auto;
        margin-left: 0;
    }

    .topic-period-toggle .chart-range-btn,
    .topic-level-toggle .chart-toggle-btn {
        flex: 1;
    }

    .topic-view-btn {
        flex: 1;
    }

    .topic-sentiment-row {
        grid-template-columns: minmax(120px, 1fr) minmax(72px, 0.9fr) auto;
        gap: 8px;
    }

    .topic-weekly-chart {
        height: 320px;
    }

    .topic-trends-card .card-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .topic-trend-toggle {
        width: 100%;
    }

    .topic-trend-btn {
        flex: 1;
        text-align: center;
    }

    .gender-expanded-chart {
        height: 300px;
    }
}

.topics-card .donut-container {
    display: block;
    align-items: stretch;
    min-width: 0;
}

.topics-card .donut-chart {
    width: 100%;
    height: auto;
    flex: none;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.topic-bar-row {
    display: grid;
    grid-template-columns: minmax(135px, 1fr) minmax(80px, 1.1fr) auto auto;
    gap: 10px;
    align-items: center;
}

.topic-bar-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-light);
    font-size: 12px;
    font-weight: 600;
    min-width: 0;
}

.topic-row-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.topic-row-copy strong {
    overflow: hidden;
    color: var(--ink);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-row-copy small {
    color: var(--ink-muted);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
}

.topic-bar-track {
    height: 10px;
    border-radius: 999px;
    background: var(--paper-cool);
    overflow: hidden;
}

.topic-bar-fill {
    height: 100%;
    border-radius: inherit;
}

.topic-bar-value {
    min-width: 42px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.topic-row-change {
    min-width: 58px;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.topic-row-change.positive { color: var(--success); }
.topic-row-change.negative { color: var(--danger); }

/* Crítica excedente por tema */
.crx {
    --crx-high: #dc2626;
    --crx-low: #1a56db;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.crx-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 18px;
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--crx-high);
    border-radius: 10px;
    background: var(--paper-cool);
}

.crx-hero.is-low { border-left-color: var(--crx-low); }
.crx-hero.is-weak { border-left-style: dashed; }

.crx-hero-main { min-width: 0; }

.crx-eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.crx-hero-topic {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crx-hero-topic strong {
    color: var(--ink);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
}

.crx-hero-story {
    margin-top: 6px;
    max-width: 46ch;
    color: var(--ink-light);
    font-size: 12.5px;
    line-height: 1.45;
}

.crx-hero-caution {
    margin-top: 6px;
    color: #8a5106;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
}

.crx-hero-figure {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    text-align: right;
}

.crx-hero-value {
    color: var(--ink);
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.crx-hero-unit {
    margin-top: 5px;
    max-width: 24ch;
    color: var(--ink-light);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.crx-hero-range {
    margin-top: 3px;
    color: var(--ink-muted);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
}

.crx-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crx-section {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}

.crx-section-title {
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.crx-section-hint {
    color: var(--ink-muted);
    font-size: 11px;
}

.crx-row {
    display: grid;
    grid-template-columns: minmax(190px, 1.25fr) minmax(110px, 0.85fr) 58px;
    gap: 14px;
    align-items: center;
    padding: 7px 6px;
    border-radius: 8px;
    transition: background 0.15s var(--ease-out);
}

.crx-row:hover { background: var(--paper-cool); }
.crx-row.evidence-insufficient { opacity: 0.66; }

.crx-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.crx-row-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.crx-row-copy strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.crx-chip {
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--ink-muted);
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.crx-chip.is-up {
    border-color: #f3c3c3;
    background: #fdf3f2;
    color: #a51f1f;
}

.crx-chip.is-down {
    border-color: #c6d4f5;
    background: #f2f6fd;
    color: #17408f;
}

.crx-chip--evidence {
    border-color: var(--warning-light);
    background: var(--warning-light);
    color: #8a5106;
}

.crx-track {
    position: relative;
    height: 14px;
    min-width: 0;
}

.crx-axis {
    position: absolute;
    top: -11px;
    bottom: -11px;
    left: 50%;
    width: 1px;
    background: #d8d8d8;
}

.crx-fill {
    position: absolute;
    top: 2px;
    height: 10px;
    background: var(--crx-high);
}

.crx-row.is-high .crx-fill { border-radius: 0 4px 4px 0; }

.crx-row.is-low .crx-fill {
    border-radius: 4px 0 0 4px;
    background: var(--crx-low);
}

.crx-value {
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.crx-callout {
    padding: 9px 12px;
    border: 1px solid var(--warning-light);
    border-radius: 8px;
    background: #fffaf0;
    color: var(--ink-light);
    font-size: 11.5px;
    line-height: 1.45;
}

.crx-method {
    border-top: 1px solid var(--border-light);
    padding-top: 10px;
}

.crx-method > summary {
    color: var(--ink-muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    list-style: none;
    text-transform: uppercase;
    user-select: none;
}

.crx-method > summary::-webkit-details-marker { display: none; }

.crx-method > summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 6px;
}

.crx-method[open] > summary::before { content: '▾'; }
.crx-method > summary:hover { color: var(--ink); }

.crx-method-body {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--ink-muted);
    font-size: 11px;
    line-height: 1.5;
}

.crx-table-wrap { overflow-x: auto; }

.crx-table {
    width: 100%;
    min-width: 460px;
    border-collapse: collapse;
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.crx-table th {
    padding: 5px 6px 5px 0;
    border-bottom: 1px solid var(--border);
    color: var(--ink-muted);
    font-weight: 600;
    text-align: right;
    white-space: normal;
}

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

.crx-table td {
    padding: 5px 6px 5px 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--ink-light);
    text-align: right;
}

.crx-note {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.crx-note span { display: inline-flex; }

.chart-mode-meta.critique-mode-insufficient { color: var(--warning, #d97706); }
.chart-mode-meta.critique-mode-probable { color: var(--ink-muted); }
.chart-mode-meta.critique-mode-high_evidence { color: var(--success, #059669); }
.chart-mode-meta.critique-mode-exploratory { color: var(--warning, #d97706); }
.chart-mode-meta.critique-mode-fragile { color: var(--ink-muted); }
.chart-mode-meta.critique-mode-robust { color: var(--ink-muted); }

.topic-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    align-items: center;
    justify-content: center;
}

.topic-icon svg {
    width: 17px;
    height: 17px;
}

.topic-data-note {
    margin: 14px 0 0;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--paper-cool);
    color: var(--ink-muted);
    font-size: 11px;
    line-height: 1.45;
}

.topic-data-note strong { color: var(--ink-light); }

@media (max-width: 640px) {
    .topic-bar-row {
        grid-template-columns: minmax(120px, 1fr) minmax(68px, 0.9fr) auto;
        gap: 8px;
    }

    .topic-bar-value { grid-column: 3; grid-row: 1; }
    .topic-row-change { grid-column: 3; grid-row: 2; }
    .topic-bar-track { grid-row: 1 / span 2; }
    .topic-data-note { font-size: 10px; }

    .crx-hero {
        flex-direction: column;
        gap: 12px;
    }

    .crx-hero-figure {
        align-items: flex-start;
        text-align: left;
    }

    .crx-hero-value { font-size: 28px; }
    .crx-hero-unit { max-width: none; }

    .crx-row {
        grid-template-columns: 1fr 56px;
        gap: 6px 10px;
    }

    .crx-row-label { grid-column: 1; }
    .crx-value { grid-column: 2; grid-row: 1; }

    .crx-track {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .crx-axis {
        top: -2px;
        bottom: -2px;
    }
}

.wordcloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 10px;
    padding: 20px 10px;
    min-height: 120px;
}

.word {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    background: transparent;
    border: none;
    transition: all 0.2s var(--ease-out);
    cursor: default;
    line-height: 1.2;
}

.word:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.word.size-1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.word.size-2 {
    font-size: 22px;
    font-weight: 600;
    color: #7c3aed;
}

.word.size-3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--success);
}

.word.size-4 {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
}

.word.size-5 {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-muted);
}

.word.size-6 {
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-faint);
}

.word-list { margin-top: 20px; }

.word-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.2s var(--ease-out);
}

.word-item:hover {
    background: var(--paper-cool);
    margin: 0 -12px;
    padding: 14px 12px;
    border-radius: 8px;
}

.word-item:last-child { border: none; }

.word-rank {
    width: 28px;
    height: 28px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin-right: 14px;
    flex-shrink: 0;
}

.word-info { flex: 1; }

.word-text {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
}

.word-count {
    font-size: 12px;
    color: var(--ink-muted);
    margin-top: 2px;
}

.word-trend {
    font-size: 14px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    flex-shrink: 0;
}

.update-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 24px 0;
}

.update-label {
    font-size: 11px;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.update-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-light);
}

/* Dark theme */
body.dark {
    --ink: #f3ece3;
    --ink-light: #cbbfaf;
    --ink-muted: #9a8f82;
    --ink-faint: #746a60;

    --paper: #171411;
    --paper-warm: #100e0c;
    --paper-cool: #221e1a;

    --border: #3a332c;
    --border-light: #2a251f;

    --accent: #d45a5a;
    --accent-light: #e07a7a;
    --accent-soft: rgba(212, 90, 90, 0.14);
    --success-light: rgba(47, 107, 79, 0.22);
    --warning-light: rgba(166, 93, 18, 0.22);
    --danger-light: rgba(212, 90, 90, 0.18);
}

body.dark .theme-icon.sun { display: none; }
body.dark .theme-icon.moon { display: block; }

body.dark .word-rank {
    background: var(--paper-cool);
}

body.dark .chart-toggle-btn.active {
    background: var(--paper-cool);
}

body.dark .cache-control {
    background: var(--paper);
}

/* Responsive */
@media (max-width: 1024px) {
    .hero-section { grid-template-columns: 1fr; }
    .desktop-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .header { padding: 0 16px; height: 56px; }
    .logo-img { height: 24px; max-width: min(140px, 46vw); }
    .logo-divider, .logo-tagline { display: none; }
    .container { padding: 16px; }

    .nav { gap: 8px; }
    .nav-link { padding: 10px 12px; }
    .cache-status { display: none; }
    .cache-control { padding: 4px; }
    .dev-live-panel { position: fixed; top: 58px; right: 12px; }
    .dev-live-toggle { padding: 0 8px; }
    .dev-live-toggle span:last-child { display: none; }
    .theme-toggle { width: 44px; height: 44px; }

    .history-card-title {
        flex-wrap: wrap;
        gap: 10px;
    }

    .history-trend-delta {
        font-size: 11px;
    }

    .history-controls {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .chart-toggle { margin-left: 0; }

    .history-card.is-expanded .chart-container { height: 460px; }

    .hero-profile {
        flex-direction: column;
        text-align: center;
        padding: 24px;
    }

    .main-avatar { width: 80px; height: 80px; min-width: 80px; }
    .main-name { font-size: 24px; }
    .share-buttons { justify-content: center; }

    .sentiment-card { padding: 20px; }
    .sentiment-value { font-size: 40px; }

    .sentiment-changes { justify-content: center; }
    .change-badge { min-width: 60px; padding: 6px 10px; }
    .change-badge .change-value { font-size: 13px; }

    .gender-grid { grid-template-columns: minmax(0, 1fr); }
    .donut-container { flex-direction: column; }
    .donut-chart { margin: 0 auto; }

    .metric-row { gap: 20px; }
    .hate-value { font-size: 26px; }
    .climate-value { font-size: 32px; }
    .gender-value { font-size: 24px; }
}

@media (max-width: 480px) {
    .container { padding: 12px; }
    .selector { padding: 16px; }
    .politician { min-width: 80px; padding: 12px 8px; }
    .politician .avatar { width: 52px; height: 52px; }
    .politician .name { font-size: 11px; }

    .card { padding: 16px; border-radius: 12px; }
    .sentiment-value { font-size: 34px; }
    .climate-value { font-size: 30px; }
    .chart-container { height: 220px; }

    .history-card.is-expanded .chart-container { height: 380px; }
    .chart-range-btn { padding: 6px 7px; }

    .sentiment-changes { gap: 6px; }
    .change-badge { min-width: 55px; padding: 5px 8px; }
    .change-badge .change-label { font-size: 9px; }
    .change-badge .change-value { font-size: 12px; }

    .window-btn { padding: 10px 16px; min-height: 44px; }
    .share-btn { width: 44px; height: 44px; }
    .filters { flex-direction: column; }
    .filter-select { min-width: 100%; }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton {
    background: linear-gradient(90deg, var(--paper-cool) 25%, var(--border-light) 50%, var(--paper-cool) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 6px;
}

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

.skeleton-row {
    display: grid;
    grid-template-columns: 50px 1fr 100px 70px 70px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
    gap: 16px;
}

.skeleton-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-text {
    height: 16px;
    border-radius: 4px;
}

.skeleton-text-sm {
    height: 12px;
    border-radius: 3px;
}

.card {
    animation: fadeIn 0.4s var(--ease-out) backwards;
}

.desktop-grid .card:nth-child(1) { animation-delay: 0.05s; }
.desktop-grid .card:nth-child(2) { animation-delay: 0.1s; }
.desktop-grid .card:nth-child(3) { animation-delay: 0.15s; }
.desktop-grid .card:nth-child(4) { animation-delay: 0.2s; }

.hero-section {
    animation: fadeIn 0.5s var(--ease-out);
}

.hero-profile {
    animation: fadeIn 0.4s var(--ease-out) 0.1s backwards;
}

.hero-sentiment {
    animation: fadeIn 0.4s var(--ease-out) 0.2s backwards;
}

.selector {
    animation: fadeIn 0.3s var(--ease-out) backwards;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-faint);
}

/* Ranking Page */
.page-header {
    text-align: center;
    padding: 40px 0 32px;
}

.page-title {
    font-family: var(--font-serif);
    font-size: 36px;
    font-weight: 400;
    color: var(--ink);
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--ink-muted);
    max-width: 400px;
    margin: 0 auto;
}

.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 180px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--paper);
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23717171' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    transition: all 0.2s var(--ease-out);
}

.filter-select:hover {
    border-color: var(--ink-muted);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.sync-btn {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s var(--ease-out);
}

.sync-btn:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.sync-btn:active {
    transform: translateY(0) scale(0.98);
}

.sync-btn:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.ranking-table {
    background: var(--paper);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}

/* Sample-quality disclosure under the podium, and the divider that separates
   ranked politicians from those with too little data to be ranked. */
.ranking-method {
    margin: 18px auto 24px;
    max-width: 70ch;
    text-align: center;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-muted);
}

.ranking-method > summary {
    cursor: pointer;
    display: inline-block;
    font-weight: 600;
    color: var(--ink);
}

.ranking-method > summary::marker {
    color: var(--accent);
}

.ranking-method[open] > #rankingMethod {
    margin-top: 10px;
}

#rankingMethod span {
    display: inline;
}

.ranking-split {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px 14px;
    background: var(--paper-cool);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.ranking-split-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
}

.ranking-split-note {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--ink-muted);
    max-width: 80ch;
}

.ranking-row.is-provisional {
    opacity: 0.72;
}

.ranking-row.is-provisional:hover {
    opacity: 1;
}

.ranking-header {
    display: grid;
    grid-template-columns: 50px 1fr 120px 100px;
    padding: 16px 20px;
    background: var(--paper-cool);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 64px;
    z-index: 10;
}

.ranking-header-ext {
    grid-template-columns: 50px 1fr 100px 70px 70px;
}

.ranking-row {
    display: grid;
    grid-template-columns: 50px 1fr 120px 100px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
    cursor: pointer;
    transition: background 0.2s var(--ease-out);
}

.ranking-row:hover {
    background: var(--paper-cool);
}

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

.ranking-row-ext {
    grid-template-columns: 50px 1fr 100px 70px 70px;
}

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

.rank-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.rank-badge.gold { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); color: #78350f; }
.rank-badge.silver { background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 100%); color: #374151; }
.rank-badge.bronze { background: linear-gradient(135deg, #fcd9bd 0%, #f97316 100%); color: #7c2d12; }
.rank-badge.default { background: var(--paper-cool); color: var(--ink-muted); }

.ranking-politician {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ranking-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.ranking-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
}

.ranking-country {
    font-size: 12px;
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.ranking-sentiment {
    font-family: var(--font-sans);
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ranking-sentiment.high { color: var(--success); }
.ranking-sentiment.medium { color: var(--warning); }
.ranking-sentiment.low { color: var(--danger); }

.ranking-change {
    font-size: 14px;
    font-weight: 600;
}

.ranking-change.up { color: var(--success); }
.ranking-change.down { color: var(--danger); }
.ranking-change.neutral { color: var(--ink-muted); }

/* About Page */
.about-hero {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(180deg, var(--paper-cool) 0%, var(--paper-warm) 100%);
}

.about-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.about-title {
    font-family: var(--font-serif);
    font-size: 42px;
    font-weight: 400;
    color: var(--ink);
    margin-bottom: 16px;
}

.about-title span {
    color: var(--accent);
}

.about-tagline {
    font-size: 18px;
    color: var(--ink-muted);
    max-width: 500px;
    margin: 0 auto;
}

.about-section {
    padding: 48px 0;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 28px;
    text-align: center;
    margin-bottom: 24px;
    color: var(--ink);
}

.about-card {
    background: var(--paper);
    border-radius: 16px;
    padding: 32px;
    border: 1px solid var(--border);
    max-width: 600px;
    margin: 0 auto;
}

.about-text {
    font-size: 16px;
    line-height: 1.7;
    color: var(--ink-light);
    margin-bottom: 16px;
}

.about-text strong {
    color: var(--ink);
}

.about-highlight {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(26, 86, 219, 0.3);
    text-underline-offset: 3px;
}

.cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 320px;
    margin: 40px auto 0;
}

.cta-btn {
    padding: 16px 24px;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.cta-btn.primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: white;
    border: none;
}

.cta-btn.secondary {
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--border);
}

/* Contact Section */
.contact-section {
    padding: 60px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    text-align: center;
}

.contact-emoji {
    font-size: 48px;
    margin-bottom: 16px;
}

.contact-title {
    font-family: var(--font-serif);
    font-size: 32px;
    color: white;
    margin-bottom: 12px;
}

.contact-subtitle {
    font-size: 16px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 32px;
}

.contact-form {
    max-width: 400px;
    margin: 0 auto;
}

.contact-input {
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 15px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.95);
}

.contact-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

.contact-textarea {
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 15px;
    margin-bottom: 16px;
    min-height: 100px;
    resize: vertical;
    background: rgba(255,255,255,0.95);
}

.contact-submit {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 10px;
    background: white;
    color: #764ba2;
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.contact-email {
    margin-top: 24px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.contact-email a {
    color: white;
    text-decoration: none;
    font-weight: 600;
}

/* Footer */
.site-footer {
    margin-top: 64px;
}

.footer {
    background: var(--ink);
    color: var(--paper);
    padding: 40px 20px;
    text-align: center;
}

.footer-brand {
    margin-bottom: 12px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 20px 0;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s var(--ease-out);
}

.footer-links a:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.footer-copy {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-top: 20px;
}

/* En oscuro --ink es claro: el footer se invertía y quedaba texto negro sobre bloque blanco. */
body.dark .footer {
    background: var(--paper-warm);
    color: #ffffff;
    border-top: 1px solid var(--border);
}

body.dark .footer-brand {
    color: #ffffff;
}

body.dark .footer-links a {
    color: rgba(255,255,255,0.72);
}

body.dark .footer-links a:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
}

body.dark .footer-copy {
    color: rgba(255,255,255,0.55);
}

/* Highlights */
.highlights {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.highlight-card {
    background: var(--paper);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    border: 1px solid var(--border);
}

.highlight-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 12px;
    border: 3px solid var(--border);
}

.highlight-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--ink);
    margin-bottom: 4px;
}

.highlight-value {
    font-family: var(--font-sans);
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.highlight-value.positive { color: var(--success); }
.highlight-value.negative { color: var(--danger); }

.highlight-label {
    font-size: 12px;
    color: var(--ink-muted);
}

@media (max-width: 768px) {
    .ranking-header,
    .ranking-row {
        grid-template-columns: 40px 1fr 80px 70px;
        padding: 12px 16px;
    }
    .ranking-header-ext,
    .ranking-row-ext {
        grid-template-columns: 36px 1fr 70px 50px 50px;
    }
    .ranking-avatar { width: 40px; height: 40px; }
    .ranking-name { font-size: 14px; }
    .ranking-sentiment { font-size: 18px; }
    .ranking-change { font-size: 12px; }
    .highlights { grid-template-columns: 1fr; }
    .about-title { font-size: 32px; }
    .contact-title { font-size: 26px; }
}

/* Insights Advanced Section */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.insight-box {
    padding: 20px;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.2s var(--ease-out);
}

.insight-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.insight-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.insight-value {
    font-family: var(--font-sans);
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.insight-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

@media (max-width: 900px) {
    .insights-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
    .insights-grid { grid-template-columns: 1fr; }
}

/* Highlight Insights Section */
.free-insights-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.section-title-inline {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    color: var(--ink);
    margin: 0;
}

.free-insights-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 900px) {
    .free-insights-grid { grid-template-columns: 1fr; }
}

/* Viral Card */
.viral-comparison {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.viral-metric {
    display: grid;
    grid-template-columns: 100px 1fr 60px;
    gap: 12px;
    align-items: center;
}

.viral-bar-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-muted);
}

.viral-bar-container {
    height: 24px;
    background: var(--paper-cool);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.viral-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s var(--ease-out);
}

.viral-bar.normal {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.viral-bar.viral {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.viral-bar-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.viral-highlight {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(251, 191, 36, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.viral-multiplier {
    font-family: var(--font-sans);
    font-size: 28px;
    font-weight: 700;
    color: #d97706;
    line-height: 1;
}

.viral-multiplier-label {
    font-size: 12px;
    color: var(--ink-muted);
    margin-top: 4px;
}

/* Timing Card */
.timing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.timing-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 10px;
    transition: all 0.2s var(--ease-out);
}

.timing-item:hover {
    transform: translateY(-2px);
}

.timing-item.best {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.timing-item.worst {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.timing-icon {
    font-size: 20px;
}

.timing-info {
    flex: 1;
}

.timing-label {
    font-size: 11px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timing-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 2px;
}

.timing-item.best .timing-value { color: var(--success); }
.timing-item.worst .timing-value { color: var(--danger); }

/* Patterns Card */
.patterns-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pattern-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--paper-cool);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    transition: all 0.2s var(--ease-out);
}

.pattern-item:hover {
    border-color: var(--border);
    transform: translateX(4px);
}

.pattern-icon {
    font-size: 18px;
}

.pattern-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

.pattern-value {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pattern-value.positive { color: var(--success); }
.pattern-value.negative { color: var(--danger); }

/* Funnel Card */
.funnel-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.funnel-segment {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.funnel-bar {
    height: 20px;
    border-radius: 4px;
    transition: width 0.8s var(--ease-out);
}

.funnel-segment.lurkers .funnel-bar {
    background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}

.funnel-segment.regulars .funnel-bar {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.funnel-segment.power .funnel-bar {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.funnel-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.funnel-label {
    font-size: 12px;
    color: var(--ink-muted);
}

.funnel-pct {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
}

.funnel-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--paper-cool);
    border-radius: 10px;
    margin-top: 8px;
    border: 1px solid var(--border-light);
}

.funnel-total-label {
    font-size: 13px;
    color: var(--ink-muted);
}

.funnel-total-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

/* Dark mode for new cards */
body.dark .viral-highlight {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 191, 36, 0.08));
    border-color: rgba(245, 158, 11, 0.3);
}

body.dark .timing-item.best {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.08));
    border-color: rgba(16, 185, 129, 0.3);
}

body.dark .timing-item.worst {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.08));
    border-color: rgba(239, 68, 68, 0.3);
}

/* Wordcloud Card */
.wordcloud-card .wordcloud {
    min-height: 120px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 10px;
    padding: 10px 6px 14px;
    text-align: center;
}

.wordcloud .word-loading {
    color: var(--ink-muted);
    font-size: 13px;
}

.wordcloud .word {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s var(--ease-out);
    cursor: default;
    line-height: 1.3;
}

.wordcloud .word:hover {
    transform: scale(1.15);
    opacity: 0.85;
}

.wordcloud .word.size-1 {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.wordcloud .word.size-2 {
    font-size: 24px;
    font-weight: 700;
}

.wordcloud .word.size-3 {
    font-size: 17px;
    font-weight: 600;
}

.wordcloud .word.size-4 {
    font-size: 13px;
    font-weight: 500;
}

.wordcloud .word.size-5 {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.72;
}

.wordcloud-trending {
    margin-top: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(251, 146, 60, 0.05));
    border-radius: 10px;
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.trending-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.trending-icon {
    font-size: 14px;
}

.trending-label {
    font-size: 11px;
    font-weight: 600;
    color: #ea580c;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.trending-words {
    font-size: 13px;
    color: var(--ink);
    line-height: 1.6;
}

.trending-words .trend-word {
    display: inline-block;
    background: rgba(249, 115, 22, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
    margin: 2px 4px 2px 0;
    font-weight: 500;
    color: #c2410c;
}

body.dark .wordcloud-trending {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(251, 146, 60, 0.08));
    border-color: rgba(249, 115, 22, 0.3);
}

body.dark .trending-words .trend-word {
    background: rgba(249, 115, 22, 0.25);
    color: #fb923c;
}

/* Single Metric Row - Full width card */
.single-metric-row {
    margin-bottom: 24px;
}

.metric-card-wide {
    max-width: 600px;
}

.metric-card-wide .metric-row {
    display: flex;
    align-items: center;
    gap: 32px;
}

.metric-card-wide .metric-sparkline-col {
    flex: 2;
    min-width: 200px;
}

.metric-card-wide .metric-sparkline {
    height: 50px;
    margin-top: 0;
}

@media (max-width: 600px) {
    .metric-card-wide .metric-row {
        flex-wrap: wrap;
    }
    .metric-card-wide .metric-sparkline-col {
        width: 100%;
        min-width: 100%;
    }
}

/* Improved funnel bars - min height */
.funnel-bar {
    min-height: 8px;
    height: 20px;
}

.funnel-segment.power .funnel-bar {
    min-width: 20px;
}

/* Mobile hamburger menu */
.mobile-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 8px;
    color: var(--ink);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

.mobile-menu-toggle.active {
    color: var(--accent);
}

@media (max-width: 600px) {
    .nav {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--paper);
        flex-direction: column;
        padding: 16px;
        gap: 8px;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s var(--ease-out);
        z-index: 99;
    }

    .nav.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav .nav-link {
        width: 100%;
        text-align: center;
        padding: 14px;
    }

    .nav .nav-link.scraper-nav-btn {
        padding: 14px;
    }

    .nav .theme-toggle {
        margin: 8px auto 0;
    }

    .nav .cache-control {
        justify-content: center;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header {
        padding: 0 12px;
    }
}

/* Dev toolbar - hide on very small screens */
@media (max-width: 480px) {
    .dev-toolbar {
        bottom: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 10px;
    }

    .dev-toolbar-label {
        font-size: 10px;
    }

    .dev-toggle {
        width: 40px;
        height: 22px;
    }

    .dev-toggle::after {
        width: 16px;
        height: 16px;
    }

    .dev-toggle.active::after {
        transform: translateX(18px);
    }

    .dev-status {
        min-width: 50px;
        font-size: 9px;
    }
}

/* Improved change badges on mobile */
@media (max-width: 480px) {
    .sentiment-changes {
        flex-wrap: wrap;
        justify-content: center;
    }

    .change-badge {
        min-width: 65px;
        padding: 8px 10px;
    }

    .change-badge .change-label {
        font-size: 10px;
    }

    .change-badge .change-value {
        font-size: 14px;
    }
}

/* Loading skeleton improvements */
.skeleton-value {
    display: inline-block;
    min-width: 60px;
    height: 1.2em;
    background: linear-gradient(90deg, var(--paper-cool) 25%, var(--border-light) 50%, var(--paper-cool) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    vertical-align: middle;
}

/* Footer for dashboard */
.dashboard-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.dashboard-footer .footer {
    border-radius: 16px 16px 0 0;
}

/* Top loading bar */
.app-load-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #16a34a);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.app-load-bar.active {
    opacity: 1;
    animation: app-load-grow 1s ease-in-out infinite;
}
.app-load-bar.done {
    opacity: 1;
    width: 100%;
    transition: width 0.25s ease, opacity 0.35s ease 0.15s;
}
@keyframes app-load-grow {
    0% { width: 0; }
    50% { width: 65%; }
    100% { width: 92%; }
}

/* Empty / no-data card state */
.card.is-empty {
    position: relative;
}
.card.is-empty > *:not(.card-empty-msg) {
    opacity: 0.35;
    filter: grayscale(0.4);
    transition: opacity 0.25s ease;
}
.card-empty-msg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-muted);
    pointer-events: none;
}
.card-empty-msg::before {
    content: '📭';
    display: block;
    position: absolute;
    top: 18px;
    font-size: 22px;
    opacity: 0.7;
}

/* Keyboard focus visibility */
a:focus-visible,
button:focus-visible,
.nav-link:focus-visible,
.politician:focus-visible,
.window-btn:focus-visible,
.chart-toggle-btn:focus-visible,
.chart-expand-btn:focus-visible,
.cache-refresh-btn:focus-visible,
.cache-all-btn:focus-visible,
.cache-cancel-btn:focus-visible,
.cache-log-toggle:focus-visible,
.info-btn:focus-visible,
.change-badge:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ============ Politician identity (merged into the hero card) ============ */
.pol-avatar-fallback {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--ink-muted);
}

.pol-current-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--ink-muted);
    flex-wrap: wrap;
}

.pol-current-party {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--paper-cool);
    border: 1px solid var(--border-light);
    font-size: 11px;
    font-weight: 600;
}

.pol-change-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--paper-cool);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.pol-change-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ============ Overlays (picker + modals) ============ */
body.has-open-overlay { overflow: hidden; }

/* `display: flex` below would otherwise beat the hidden attribute and let the
   invisible panels swallow clicks on the page underneath. */
.pol-picker[hidden],
.modal-panel[hidden],
.pol-picker-backdrop[hidden],
.modal-backdrop[hidden] { display: none !important; }

.pol-picker-backdrop,
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.16s var(--ease-out);
    z-index: 200;
}

.pol-picker-backdrop.is-open,
.modal-backdrop.is-open { opacity: 1; }

.pol-picker {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -48%);
    width: min(560px, calc(100vw - 32px));
    max-height: min(78vh, 640px);
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 201;
    opacity: 0;
    transition: opacity 0.16s var(--ease-out), transform 0.16s var(--ease-out);
    overflow: hidden;
}

.pol-picker.is-open { opacity: 1; transform: translate(-50%, -50%); }

.pol-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 10px;
}

.pol-picker-title { font-size: 15px; font-weight: 700; color: var(--ink); }

.pol-picker-close,
.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.pol-picker-close:hover,
.modal-close:hover { color: var(--ink); background: var(--paper-cool); }

.pol-picker-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 18px 12px;
    border-bottom: 1px solid var(--border-light);
}

.pol-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--paper-cool);
    color: var(--ink-muted);
}

.pol-search-wrap:focus-within { border-color: var(--accent); }

.pol-search {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    outline: none;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--ink);
}

.pol-country-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.pol-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--ink-light);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
}

.pol-chip:hover { background: var(--paper-cool); }

.pol-chip.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.pol-chip-count { opacity: 0.6; font-size: 11px; }

.pol-results {
    flex: 1;
    min-height: 0;
    max-height: 52vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px 16px;
    outline: none;
}

.pol-group + .pol-group { margin-top: 12px; }

.pol-group-title {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 6px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    position: sticky;
    top: -10px;
    background: var(--paper);
    z-index: 1;
}

.pol-group-count {
    padding: 0 6px;
    border-radius: 999px;
    background: var(--paper-cool);
    font-size: 10px;
}

.pol-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    text-align: left;
    font-family: var(--font-sans);
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s var(--ease-out);
}

.pol-option:hover { background: var(--paper-cool); }
.pol-option.is-active { border-color: var(--accent); background: var(--paper-cool); }

.pol-option-avatar {
    position: relative;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--paper-cool);
}

.pol-option-avatar img { width: 100%; height: 100%; object-fit: cover; }

.pol-option-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.pol-option-name {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pol-option-sub {
    font-size: 11.5px;
    color: var(--ink-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pol-option-check { color: var(--accent); font-weight: 700; }

.pol-empty {
    padding: 24px 10px;
    text-align: center;
    color: var(--ink-muted);
    font-size: 13px;
}

/* ============ Generic modal panel ============ */
.modal-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -48%);
    width: min(880px, calc(100vw - 32px));
    max-height: min(86vh, 720px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 201;
    opacity: 0;
    transition: opacity 0.16s var(--ease-out), transform 0.16s var(--ease-out);
    overflow-y: auto;
}

.modal-panel.is-open { opacity: 1; transform: translate(-50%, -50%); }

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.modal-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.modal-subtitle { font-size: 12px; color: var(--ink-muted); }

.modal-stats,
.gender-expanded-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gx-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 12px;
    border-radius: 10px;
    background: var(--paper-cool);
    border: 1px solid var(--border-light);
    min-width: 84px;
}

.gx-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--ink-faint);
}

.gx-stat-value { font-size: 15px; font-weight: 700; color: var(--ink); }
.gx-stat-value.up { color: var(--success); }
.gx-stat-value.down { color: var(--danger); }

.modal-chart { width: 100%; height: 340px; min-height: 260px; }

/* ============ Hate + approval card tweaks ============ */
.hate-expand-btn, .sentiment-expand-btn { margin-left: auto; }

.metric-spark-caption {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    color: var(--ink-faint);
    text-align: right;
}

.history-card.is-highlighted {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============ Gender expanded (female participation) ============ */
.gender-expanded-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
}

.gender-expanded-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.gender-expanded-hint { font-size: 11.5px; color: var(--ink-muted); }
.gender-expanded-stats { margin-bottom: 12px; }

/* ============ Topics: easy mode ============ */
.topic-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topic-period-toggle {
    margin-left: 0;
}

.topic-period-toggle .chart-range-btn {
    white-space: nowrap;
}

.tez { display: flex; flex-direction: column; gap: 16px; }

.tez-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-radius: 14px;
    background: var(--paper-cool);
    border: 1px solid var(--border-light);
}

.tez-hero-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.tez-eyebrow {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--ink-faint);
}

.tez-hero-topic { display: flex; align-items: center; gap: 8px; font-size: 19px; }
.tez-hero-topic .topic-icon svg { width: 20px; height: 20px; }
.tez-hero-story { font-size: 13px; color: var(--ink-light); line-height: 1.45; }

.tez-hero-score {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 0 0 auto;
}

.tez-score-value {
    font-family: var(--font-serif);
    font-size: 46px;
    line-height: 1;
    color: var(--ink);
}

.tez-score-scale { font-size: 11px; color: var(--ink-faint); }

.tez-score-tag {
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.tez-score-tag.severity-baja { background: var(--success-light); color: var(--success); }
.tez-score-tag.severity-moderada { background: var(--warning-light); color: var(--warning); }
.tez-score-tag.severity-alta { background: var(--danger-light); color: var(--danger); }
.tez-score-tag.severity-critica { background: var(--danger); color: #fff; }

.tez-list { display: flex; flex-direction: column; gap: 12px; }
.tez-row { display: flex; flex-direction: column; gap: 5px; }

.tez-row-head { display: flex; align-items: center; gap: 8px; }
.tez-row-head .topic-icon svg { width: 15px; height: 15px; }
.tez-row-name { font-size: 13.5px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; }
.tez-row-score { font-size: 14px; font-weight: 700; }

.tez-row-score.severity-baja { color: var(--success); }
.tez-row-score.severity-moderada { color: var(--warning); }
.tez-row-score.severity-alta,
.tez-row-score.severity-critica { color: var(--danger); }

.tez-track {
    height: 8px;
    border-radius: 999px;
    background: var(--paper-cool);
    overflow: hidden;
}

.tez-fill { display: block; height: 100%; border-radius: 999px; background: var(--ink-faint); }
.tez-fill.severity-baja { background: var(--success); }
.tez-fill.severity-moderada { background: var(--warning); }
.tez-fill.severity-alta { background: #ef4444; }
.tez-fill.severity-critica { background: var(--danger); }

.tez-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 11.5px;
    color: var(--ink-muted);
}

.tez-evidence { font-weight: 600; }
.tez-evidence.evidence-insufficient { color: var(--warning); }

@media (max-width: 768px) {
    .pol-change-btn { padding: 8px 12px; }

    .pol-picker {
        top: auto;
        bottom: 0;
        left: 0;
        transform: translate(0, 100%);
        width: 100%;
        max-width: 100%;
        max-height: 88vh;
        border-radius: 18px 18px 0 0;
        border-bottom: none;
    }

    .pol-picker.is-open { transform: translate(0, 0); }
    .pol-results { max-height: none; }

    .modal-panel {
        top: auto;
        bottom: 0;
        left: 0;
        transform: translate(0, 100%);
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
    }

    .modal-panel.is-open { transform: translate(0, 0); }
    .modal-chart { height: 260px; }

    .tez-hero { flex-direction: column; align-items: flex-start; }
    .tez-hero-score { align-items: flex-start; flex-direction: row; gap: 8px; align-items: baseline; }
    .tez-score-value { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
    .pol-picker, .modal-panel, .pol-picker-backdrop, .modal-backdrop { transition: none; }
}

/* ============ History focus: full-tab takeover, not native fullscreen ============ */
.history-card-holder { width: 100%; }

.history-card.is-focused {
    position: fixed;
    inset: 16px;
    z-index: 201;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column;
    max-height: none;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.history-card.is-focused .chart-container {
    flex: 1;
    height: auto;
    min-height: 0;
}

.history-focus-close { display: none; }
.history-card.is-focused .history-focus-close { display: inline-flex; }
.history-card.is-focused #historyExpandBtn { display: none; }

/* ============ Hate modal controls ============ */
.modal-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.twin-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--ink-light);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
}

.twin-toggle:hover { background: var(--paper-cool); }

.twin-toggle.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

/* ============ Gender expanded views ============ */
.gender-view-toggle { margin-bottom: 14px; width: fit-content; }

.gender-topic-subtoggle {
    display: flex;
    gap: 3px;
    padding: 3px;
    margin-bottom: 12px;
    width: fit-content;
    background: var(--paper-cool);
    border-radius: 6px;
}

.gender-topic-subtoggle[hidden] { display: none; }

.gender-topic-list[hidden] { display: none; }

.gtx-headline {
    font-size: 13px;
    color: var(--ink-light);
    line-height: 1.5;
    margin-bottom: 14px;
}

.gtx-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 0;
    border-top: 1px solid var(--border-light);
}

.gtx-head { display: flex; align-items: center; gap: 8px; }
.gtx-head .topic-icon svg { width: 16px; height: 16px; }
.gtx-name { font-size: 13.5px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; }

.gtx-gap { font-size: 12px; font-weight: 700; }
.gtx-gap.lead-f { color: #ec4899; }
.gtx-gap.lead-m { color: #3b82f6; }

.gtx-bars { display: flex; flex-direction: column; gap: 4px; }

.gtx-bar-line { display: flex; align-items: center; gap: 8px; }

.gtx-bar-tag {
    width: 14px;
    flex: 0 0 14px;
    text-align: center;
    font-size: 13px;
    color: var(--ink-muted);
}

.gtx-track {
    flex: 1;
    height: 8px;
    min-width: 0;
    border-radius: 999px;
    background: var(--paper-cool);
    overflow: hidden;
}

.gtx-fill { display: block; height: 100%; border-radius: 999px; }
.gtx-fill.female { background: #ec4899; }
.gtx-fill.male { background: #3b82f6; }

.gtx-val {
    width: 52px;
    flex: 0 0 52px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-light);
}

.gtx-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    color: var(--ink-muted);
}

/* ===== Eventos: chip de zoom, checkbox de descripciones, modal de detalle ===== */

.focus-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: 3px 10px;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font: 700 11px var(--font-sans);
    white-space: nowrap;
}

.focus-chip[hidden] { display: none; }
.focus-chip:hover { background: var(--paper-cool); }

.event-desc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ink-muted);
    cursor: pointer;
    font: 600 11px var(--font-sans);
    white-space: nowrap;
}

.event-desc-toggle input { accent-color: var(--accent); cursor: pointer; }

.event-modal { max-width: 520px; }

.event-modal-body {
    margin-top: 6px;
    color: var(--ink-light);
    font-size: 14px;
    line-height: 1.6;
}

.event-severity-badge {
    display: inline-block;
    margin-left: 8px;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
}

.event-severity-badge.negative { background: var(--danger-light); color: var(--danger); }
.event-severity-badge.positive { background: var(--success-light); color: var(--success); }
.event-severity-badge.neutral { background: var(--paper-cool); color: var(--ink-muted); }

/* ===== Índice de Divergencia ===== */

.card-note {
    margin: 2px 0 14px;
    color: var(--ink-muted);
    font-size: 12.5px;
    line-height: 1.55;
    max-width: 80ch;
}

.card-note strong { color: var(--ink-light); }

/* Sample size printed under a card, so a rate is never shown without the n it
   was computed from. Deliberately quieter than .card-note. */
.card-sample {
    margin: -8px 0 12px;
    color: var(--ink-muted);
    font-size: 11.5px;
    letter-spacing: 0.02em;
    opacity: 0.85;
}

.card-sample:empty { display: none; }

.divergence-stats,
.event-impact-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.divergence-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--paper-warm);
}

.divergence-stat.negative { border-left-color: var(--danger); }
.divergence-stat.positive { border-left-color: var(--success); }
.divergence-stat.neutral { border-left-color: var(--ink-faint); }
.divergence-stat.female { border-left-color: #ec4899; }
.divergence-stat.male { border-left-color: #3b82f6; }

.divergence-stat-label {
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.divergence-stat-value {
    color: var(--ink);
    font: 700 22px var(--font-sans);
    font-variant-numeric: tabular-nums;
}

.divergence-stat-note { color: var(--ink-muted); font-size: 11.5px; }

.regime-chip {
    display: inline-block;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
}

.regime-chip.negative { background: var(--danger-light); color: var(--danger); }
.regime-chip.positive { background: var(--success-light); color: var(--success); }
.regime-chip.neutral { background: var(--paper-cool); color: var(--ink-muted); }

.divergence-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.divergence-chart-block { min-width: 0; }

.divergence-chart-label {
    display: block;
    margin-bottom: 4px;
    color: var(--ink-muted);
    font-size: 11.5px;
    font-weight: 600;
}

.divergence-episodes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.divergence-episodes-title {
    width: 100%;
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.divergence-episode {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid var(--border);
    border-top: 2px solid var(--ink-faint);
    border-radius: 8px;
    padding: 8px 12px;
    background: var(--paper);
    cursor: pointer;
    text-align: left;
    font-family: var(--font-sans);
    transition: box-shadow 0.16s var(--ease-out);
}

.divergence-episode:hover { box-shadow: var(--shadow-md); }
.divergence-episode.negative { border-top-color: var(--danger); }
.divergence-episode.positive { border-top-color: var(--success); }

.divergence-episode-range { color: var(--ink); font-size: 12px; font-weight: 700; }

.divergence-episode-peak {
    color: var(--ink-light);
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.divergence-episode-note { color: var(--ink-muted); font-size: 11px; }
.divergence-empty { color: var(--ink-muted); font-size: 12px; }

/* ===== Qué cambió (período vs período) ===== */

.period-headline {
    border-left: 3px solid var(--border);
    padding: 2px 0 2px 14px;
    margin-bottom: 16px;
}

.period-headline-text {
    margin: 0;
    color: var(--ink);
    font-size: 19px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.period-headline-text.positive { color: var(--success); }
.period-headline-text.negative { color: var(--danger); }
.period-headline-text.quiet { color: var(--ink-muted); font-weight: 500; }

.period-headline-sub {
    margin: 4px 0 0;
    color: var(--ink-muted);
    font-size: 12.5px;
}

.period-contrast {
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    color: var(--ink-muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.period-contrast strong { color: var(--ink-light); font-variant-numeric: tabular-nums; }

.period-metrics {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 18px;
}

.period-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) 132px 78px 68px 52px;
    align-items: center;
    gap: 10px;
    padding: 8px 2px;
    border-bottom: 1px solid var(--border-light);
}

.period-row:last-child { border-bottom: 0; }
.period-row.is-noise { opacity: 0.62; }
.period-row.is-empty { grid-template-columns: minmax(0, 1fr) auto; }

.period-row-label { color: var(--ink-light); font-size: 13px; font-weight: 600; }
.period-row-note { color: var(--ink-faint); font-size: 11.5px; }

.period-row-values {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}

.period-prev { color: var(--ink-faint); font-size: 13px; }
.period-arrow { color: var(--ink-faint); font-size: 12px; }
.period-curr { color: var(--ink); font-size: 16px; font-weight: 700; }

.period-delta {
    font-size: 15px;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.period-delta.positive { color: var(--success); }
.period-delta.negative { color: var(--danger); }
.period-delta.neutral { color: var(--ink-light); }

.period-margin {
    color: var(--ink-faint);
    font-size: 11px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.period-flag {
    justify-self: end;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.period-flag.real { background: var(--paper-cool); color: var(--ink-light); }
.period-flag.noise { background: transparent; color: var(--ink-faint); border: 1px dashed var(--border); }

.period-extras {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.period-block { min-width: 0; }

.period-block-title {
    display: block;
    margin-bottom: 10px;
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.period-vol-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 56px;
    align-items: baseline;
    gap: 10px;
    padding: 5px 0;
}

.period-vol-label { color: var(--ink-muted); font-size: 12px; }
.period-vol-values { color: var(--ink-light); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.period-vol-values strong { color: var(--ink); }

.period-vol-change {
    text-align: right;
    font-size: 12.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.period-vol-change.up { color: var(--success); }
.period-vol-change.down { color: var(--danger); }

.period-volume-note {
    margin: 8px 0 0;
    color: var(--ink-muted);
    font-size: 11.5px;
    line-height: 1.5;
}

.period-topic-row {
    display: grid;
    grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 62px;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.period-topic-name {
    color: var(--ink-light);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.period-topic-track { position: relative; height: 12px; }

.period-topic-axis {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
}

/* Neutral pair on purpose: a topic gaining or losing share is not good or bad in
   itself, and red/green would read as a verdict the data does not support. */
.period-topic-bar { position: absolute; top: 3px; height: 6px; border-radius: 3px; }
.period-topic-bar.up { background: #7c3aed; }
.period-topic-bar.down { background: #0891b2; }

.period-topic-delta {
    color: var(--ink-light);
    font-size: 11.5px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
    .period-extras { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .period-row {
        grid-template-columns: minmax(0, 1fr) 72px 48px;
        grid-template-areas:
            'label label label'
            'values delta flag';
        row-gap: 4px;
    }
    .period-row-label { grid-area: label; }
    .period-row-values { grid-area: values; }
    .period-delta { grid-area: delta; }
    .period-flag { grid-area: flag; }
    .period-margin { display: none; }
    .period-headline-text { font-size: 16px; }
}

/* ===== Brecha de género semanal ===== */

.gender-gap-moves {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.gender-gap-move {
    display: flex;
    flex-direction: column;
    gap: 3px;
    border: 1px solid var(--border);
    border-top: 2px solid var(--ink-faint);
    border-radius: 8px;
    padding: 9px 12px;
    background: var(--paper);
}

.gender-gap-move.female { border-top-color: #ec4899; }
.gender-gap-move.male { border-top-color: #3b82f6; }

.gender-gap-move-week { color: var(--ink); font-size: 12px; font-weight: 700; }

.gender-gap-move-change {
    color: var(--ink-light);
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.gender-gap-move-event {
    color: var(--ink-muted);
    font-size: 11px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Posts que costaron caro ===== */

.owngoals-list { display: flex; flex-direction: column; gap: 8px; }

.owngoal-row {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(70px, 1fr) 84px;
    align-items: center;
    gap: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--border-light);
}

.owngoal-row:last-child { border-bottom: 0; padding-bottom: 0; }

.owngoal-main { display: flex; align-items: center; gap: 7px; min-width: 0; }
.owngoal-date { color: var(--ink-light); font-size: 12px; font-weight: 600; white-space: nowrap; }

.owngoal-topic {
    border-radius: 999px;
    padding: 1px 8px;
    background: var(--paper-cool);
    color: var(--ink-muted);
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.owngoal-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 4px 2px;
    color: var(--accent);
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
}
.owngoal-link:hover { text-decoration: underline; }

.owngoal-track { height: 7px; border-radius: 4px; background: var(--paper-cool); overflow: hidden; }

.owngoal-bar {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #f87171, #dc2626);
    transition: width 0.8s var(--ease-out);
}

.owngoal-drop {
    color: var(--ink-light);
    font-size: 11.5px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.thermo-days, .thermo-weeks { height: 56px; margin-top: 4px; }
.thermo-days[hidden], .thermo-weeks[hidden], .thermo-years[hidden] { display: none; }

/* ===== Índice de Clima ===== */

.climate-value {
    font: 700 32px var(--font-sans);
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.climate-value.positive { color: var(--success); }
.climate-value.negative { color: var(--danger); }

.climate-card.is-highlighted, .history-card.is-highlighted {
    box-shadow: 0 0 0 2px var(--accent);
}

@media (max-width: 1024px) {
    .divergence-charts { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .history-card.is-focused {
        inset: 0;
        padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
        border-radius: 0;
    }
    .chart-expand-btn,
    .history-focus-close {
        width: 44px;
        height: 44px;
    }
    .modal-controls { gap: 8px; }
    .twin-toggle { width: 100%; justify-content: center; }
    .gender-view-toggle { width: 100%; }
    .gender-view-toggle .chart-toggle-btn { flex: 1; }
    .gtx-val { width: 46px; flex: 0 0 46px; }
    .event-desc-toggle span { display: none; }
    .owngoal-row {
        grid-template-columns: minmax(0, 1fr) 78px;
        grid-template-areas:
            'main drop'
            'track track';
        row-gap: 6px;
    }
    .owngoal-main { grid-area: main; flex-wrap: wrap; }
    .owngoal-drop { grid-area: drop; }
    .owngoal-track { grid-area: track; }
}

/* ── Audience & content insight cards ─────────────────────────────────── */

.approval-mode-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    margin-bottom: 10px;
    background: var(--paper-cool);
    border: 1px solid var(--border-light);
    border-radius: 10px;
}
.approval-mode-toggle .chart-toggle-btn { font-size: 11px; padding: 5px 12px; }
.approval-mode-toggle .chart-toggle-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.approval-gap {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}
.approval-gap[hidden] { display: none; }
.approval-gap-value { font-size: 13px; font-weight: 600; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.approval-gap-value.wide { color: var(--warning); }
.approval-gap-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); }

.card-note {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--ink-faint);
}

/* Narrativas Emergentes */
.breakout-list { display: flex; flex-direction: column; gap: 6px; }
.breakout-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--paper-cool);
    border: 1px solid transparent;
    border-radius: 10px;
    transition: all 0.2s var(--ease-out);
}
.breakout-item:hover { border-color: var(--border); transform: translateX(4px); }
.breakout-term {
    font-size: 13px; font-weight: 600; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.breakout-term.negative { color: var(--danger); }
.breakout-term.positive { color: var(--success); }
.breakout-authors { font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.breakout-growth { padding: 3px 8px; flex-direction: row; }
.breakout-growth .change-value::before { content: none; }
.breakout-growth .change-value { font-size: 12px; font-weight: 700; }

/* Oposición Direccionable */
.opposition-split { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.opposition-value { font-size: 36px; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.opposition-total { font-size: 20px; font-weight: 600; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.opposition-side { text-align: right; }
.bloc-list { display: flex; flex-direction: column; gap: 8px; }
.bloc-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 52px; align-items: center; gap: 10px; }
.bloc-name { font-size: 12px; font-weight: 500; color: var(--ink-light); }
.bloc-track { height: 8px; background: var(--paper-cool); border-radius: 4px; overflow: hidden; }
.bloc-bar { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #1a56db, #3b82f6); transition: width 0.8s var(--ease-out); }
.bloc-count { font-size: 12px; font-weight: 600; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Indignación Manufacturada */
.outrage-value { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.outrage-card .metric-sparkline { margin-top: 12px; }

/* Termómetro Silencioso */
.thermo-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.thermo-value.negative { color: var(--danger); }
.thermo-value.positive { color: var(--success); }
.thermo-years { display: flex; align-items: flex-end; gap: 12px; height: 92px; margin-top: 16px; }
.thermo-year { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.thermo-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.thermo-bar {
    width: 100%; border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #94a3b8, #64748b);
    transition: height 0.8s var(--ease-out);
}
.thermo-year-value { font-size: 11px; font-weight: 600; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.thermo-year-label { font-size: 10px; color: var(--ink-faint); }

/* Retención Asimétrica */
.retention-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.retention-item { padding: 12px 14px; border-radius: 10px; border-left: 3px solid; }
.retention-item.critics { border-color: var(--danger); background: linear-gradient(135deg, rgba(220, 38, 38, 0.07), transparent); }
.retention-item.supporters { border-color: var(--success); background: linear-gradient(135deg, rgba(5, 150, 105, 0.07), transparent); }
.retention-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); margin-bottom: 4px; }
.retention-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.retention-item.critics .retention-value { color: var(--danger); }
.retention-item.supporters .retention-value { color: var(--success); }
.retention-chart { height: 190px; margin-top: 12px; }

/* Curva de Decaimiento */
.decay-chart { height: 200px; }
.decay-highlight { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.decay-total { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.decay-total.negative { color: var(--danger); }
.decay-total.positive { color: var(--success); }
.decay-total-label { font-size: 12px; color: var(--ink-muted); }

/* Disparadores de Defección */
.defection-value { font-size: 28px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.trigger-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.trigger-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.trigger-name { font-size: 12px; font-weight: 500; color: var(--ink-light); }
.trigger-track { height: 8px; background: var(--paper-cool); border-radius: 4px; overflow: hidden; }
.trigger-bar { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #dc2626, #f87171); transition: width 0.8s var(--ease-out); }
.trigger-count { font-size: 12px; font-weight: 600; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }

body.dark .breakout-item { background: var(--paper-cool); }
body.dark .thermo-bar { background: linear-gradient(180deg, #64748b, #475569); }

@media (max-width: 900px) {
    .bloc-row, .trigger-row { grid-template-columns: 92px minmax(0, 1fr) 46px; }
    .thermo-years { gap: 8px; }
}

@media (max-width: 480px) {
    .opposition-value { font-size: 30px; }
    .retention-pair { grid-template-columns: 1fr; }
    .retention-chart { height: 170px; }
    .decay-chart { height: 175px; }
    .bloc-row, .trigger-row { grid-template-columns: 78px minmax(0, 1fr) 42px; }
    .breakout-item { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
    .breakout-authors { grid-column: 1; }
}

/* Grid items default to min-width:auto, so a wide child (chart canvas,
   bloc rows) can push the track past the container. Let the tracks shrink. */
.free-insights-section:not(.hidden-section) .free-insights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.free-insights-section:not(.hidden-section) .free-insights-grid > .card { min-width: 0; }

@media (max-width: 900px) {
    .free-insights-section:not(.hidden-section) .free-insights-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ── Capítulos ────────────────────────────────────────────────────────── */

/* Barra de progreso del relato: pulso → señales → personas → decisiones →
   evidencia. Se pega bajo el header (68px) para que el lector sepa siempre
   en qué parte de la historia está parado. A la derecha viaja el estado de
   frescura de los datos: es metadato, no debe ocupar una banda propia. */
.chapter-nav {
    position: sticky;
    top: 68px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 20px;
    padding: 6px 0;
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
/* El scroll horizontal vive en el carril interno para que el panel de
   frescura pueda desplegarse por fuera de la barra. */
.chapter-nav-scroll {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.chapter-nav-scroll::-webkit-scrollbar { display: none; }
.chapter-nav-list {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.chapter-nav-list > li + li::before {
    content: "→";
    color: var(--ink-faint);
    font-size: 12px;
    margin-right: 6px;
}
.chapter-nav-list > li { display: flex; align-items: center; }
.chapter-nav-link {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--ink-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.chapter-nav-link:hover { background: var(--surface-alt, rgba(127,127,127,0.10)); color: var(--ink); }
.chapter-nav-num {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}
.chapter-nav-link.is-active {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--ink);
}
.chapter-nav-link.is-active .chapter-nav-num { color: var(--accent); }

/* Frescura dentro de la barra: una línea, sin caja propia; el detalle baja
   como popover anclado a la derecha. */
.chapter-nav .freshness {
    flex: 0 0 auto;
    position: relative;
    margin: 0;
    border: 0;
    background: none;
    overflow: visible;
}
.chapter-nav .freshness-summary { padding: 4px 8px; gap: 8px; border-radius: 999px; }
.chapter-nav .freshness-metrics { flex-wrap: nowrap; gap: 14px; }
.chapter-nav .freshness-metric { flex-direction: row; align-items: baseline; gap: 5px; }
.chapter-nav .freshness-metric-value { font-size: 11.5px; }
.chapter-nav .freshness-metric-label { font-size: 9px; letter-spacing: 0.06em; }
/* En la barra sólo sobrevive "cuán viejo es el último comentario": el resto
   del diagnóstico vive en el panel y no compite con los capítulos. */
.chapter-nav .freshness-metric:not(:first-child) { display: none; }
.chapter-nav .freshness-detail {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(680px, 88vw);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg, 0 18px 40px rgba(0, 0, 0, 0.16));
    z-index: 30;
}
@media (max-width: 1100px) {
    .chapter-nav .freshness-metric-label { display: none; }
}
@media (max-width: 700px) {
    .chapter-nav .freshness-metrics { display: none; }
}

.chapter { margin-bottom: 48px; scroll-margin-top: 130px; }
.chapter:last-of-type { margin-bottom: 24px; }

/* Encabezado en una sola línea: número, título y pregunta comparten baseline.
   Apilarlos sumaba una banda de altura por capítulo sin agregar información. */
.chapter-head {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.chapter-num {
    font-family: var(--font-serif);
    font-size: 30px;
    line-height: 1;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
}
.chapter-titles {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
    min-width: 0;
}
.chapter-title {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 400;
    line-height: 1.1;
    color: var(--ink);
    margin: 0;
}
.chapter-sub {
    font-size: 13px;
    color: var(--ink-muted);
    margin: 0;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}
.chapter-grid > .card { min-width: 0; margin-bottom: 0; }

/* Full-width blocks sitting directly in a chapter keep their own spacing. */
.chapter > .card { margin-bottom: 20px; }
.chapter > .hero-section { margin-bottom: 20px; }
.chapter > .single-metric-row { margin-bottom: 20px; }

@media (max-width: 900px) {
    .chapter { margin-bottom: 36px; }
    .chapter-grid { grid-template-columns: minmax(0, 1fr); }
    .chapter-num { font-size: 24px; }
    .chapter-title { font-size: 22px; }
}

@media (max-width: 480px) {
    .chapter-head { gap: 10px; margin-bottom: 14px; }
    .chapter-num { font-size: 20px; }
    .chapter-title { font-size: 19px; }
    .chapter-sub { font-size: 12px; }
    .chapter-nav-link { font-size: 12px; padding: 5px 8px; }
    .chapter-nav-num { display: none; }
}

/* ── Proporciones: tarjetas de igual altura por fila ──────────────────── */

/* Paired cards must share a baseline, otherwise rows read as ragged.
   The card becomes a column, its filler element absorbs slack, and the
   note pins to the bottom so every card in a row ends on the same line. */
.chapter-grid { align-items: stretch; }
.chapter-grid > .card {
    display: flex;
    flex-direction: column;
}
.chapter-grid > .card > .card-note { margin-top: auto; padding-top: 12px; }

.breakout-card .breakout-list,
.opposition-card .bloc-list,
.mobility-card .trigger-list { flex: 1 1 auto; }

.mobility-card .retention-chart,
.decay-card .decay-chart { flex: 1 1 auto; min-height: 190px; }

.rejection-card .thermo-years { flex: 1 1 auto; min-height: 92px; }
.owngoals-card .owngoals-list { flex: 1 1 auto; }
.funnel-card .funnel-container { flex: 1 1 auto; }

/* Subtítulo siempre visible: la explicación no puede vivir sólo en un tooltip,
   que en mobile no se puede abrir. */
.card-sub {
    margin: -4px 0 16px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink-muted);
    max-width: 52ch;
}

.scale-hint {
    display: inline-block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
}

.funnel-share {
    display: block;
    font-size: 11px;
    color: var(--ink-faint);
    margin-top: 1px;
}

/* El valor de decaimiento ahora muestra dos extremos: necesita menos tamaño. */
.decay-total { font-size: 22px; letter-spacing: -0.01em; }
.decay-highlight { align-items: baseline; gap: 10px; flex-wrap: wrap; }
.decay-total-label { line-height: 1.4; }

@media (max-width: 900px) {
    /* En una sola columna ya no hay fila que emparejar: que cada tarjeta
       ocupe lo que necesita en lugar de estirarse. */
    .chapter-grid > .card > .card-note { margin-top: 12px; }
    .mobility-card .retention-chart,
    .decay-card .decay-chart { flex: 0 0 auto; min-height: 0; }
    .card-sub { font-size: 12px; margin-bottom: 14px; }
}

@media (max-width: 480px) {
    .decay-total { font-size: 19px; }
    .outrage-value { font-size: 22px; }
    .thermo-value { font-size: 27px; }
    .defection-value { font-size: 24px; }
    .opposition-value { font-size: 28px; }
    .retention-value { font-size: 21px; }
    .thermo-years { height: 78px; gap: 6px; }
}

/* 8 frases ocupan casi una pantalla entera en mobile: mostrar 6. */
@media (max-width: 480px) {
    .breakout-item:nth-child(n+7),
    .breakout-list .nb-row:nth-child(n+7) { display: none; }
}

/* ── Hero unificado: identidad + los dos índices en una sola caja ─────── */

.hero-card { padding: 0; overflow: hidden; margin-bottom: 20px; }

.hero-card-profile {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 22px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--paper-warm);
}
.hero-card-profile .main-avatar {
    width: 64px; height: 64px; min-width: 64px;
    font-size: 24px;
}
.hero-card-profile .hero-info { flex: 1; min-width: 0; }
.hero-card-profile .main-name { font-size: 30px; line-height: 1.1; margin: 0; }
.hero-card-profile .pol-current-meta { margin-top: 4px; }
.hero-card-profile .share-buttons { margin: 0; flex: 0 0 auto; }

.hero-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

/* Hero: Aprobación y Odio como dos señales hermanas a la misma altura. */
/* Con el Índice de Odio fuera del hero queda un solo índice: la grilla de dos
   columnas dejaba media card vacía y el sparkline cortado a la mitad. */
.hero-indices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.hero-indices:has(> .hero-index:only-child) { grid-template-columns: minmax(0, 1fr); }
.hero-index {
    display: flex;
    flex-direction: column;
    padding: 24px 28px;
    min-width: 0;
}
.hero-index--support + .hero-index--support { border-left: 1px solid var(--border); }

/* Señales de apoyo: mismo esqueleto, un escalón menos de peso visual. */
.hero-index--support { padding: 18px 28px 20px; }
.hero-index--support .hero-index-sub { margin-bottom: 10px; }
.hero-index--support .sentiment-display { margin-bottom: 10px; }
.hero-index--support .sentiment-changes { margin-bottom: 10px; }
.hero-index--support .sentiment-value,
.hero-index--support .hate-value { font-size: 40px; }
.hero-index--support .hero-index-spark { height: 58px; }
.hero-index--support .hero-index-foot { height: 30px; margin-top: 10px; }

.hero-index-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.hero-index-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-muted);
    font-weight: 600;
}
.hero-index-head .chart-expand-btn { margin-left: auto; }

.hero-index-sub {
    margin: 0 0 14px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--ink-muted);
}

.hero-index .approval-mode-toggle { align-self: flex-start; margin-bottom: 12px; }
.hero-index .sentiment-display { margin-bottom: 14px; }
.hero-index .sentiment-changes { margin-bottom: 14px; }

/* El índice de odio hereda el tamaño del valor de aprobación para que los dos
   números pesen igual: son las dos caras del mismo titular. */
.hero-index .hate-value {
    font-family: var(--font-sans);
    font-size: 52px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--danger);
}

/* Los dos sparklines miden igual: la diferencia de alto (Aprobación tiene toggle)
   se absorbe ARRIBA del gráfico, no dentro, para que ambos se lean a la misma escala. */
.hero-index-spark {
    flex: 0 0 auto;
    height: 84px;
    margin-top: auto;
    border-radius: 8px;
    overflow: hidden;
}

/* Alto fijo: el pie de Aprobación lleva dos líneas y el de Odio una sola.
   Sin esto los dos sparklines quedan desfasados unos pocos píxeles. */
.hero-index-foot {
    margin-top: 12px;
    height: 38px;
    display: flex;
    align-items: flex-end;
}
.hero-index-foot .approval-gap {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.hero-index-caption {
    font-size: 11px;
    color: var(--ink-faint);
}

/* Badge invertido: la flecha sigue al número, el color sigue a "es bueno o malo".
   Más odio apunta hacia arriba pero se pinta en rojo. */
.change-badge.inverted.up { background: var(--danger-light); border-color: rgba(220, 38, 38, 0.2); }
.change-badge.inverted.up .change-value { color: var(--danger); }
.change-badge.inverted.down { background: var(--success-light); border-color: rgba(5, 150, 105, 0.2); }
.change-badge.inverted.down .change-value { color: var(--success); }

/* En pantallas angostas las dos señales pasan a una sola columna. */
@media (max-width: 900px) {
    .hero-indices { grid-template-columns: minmax(0, 1fr); }
    .hero-index--support + .hero-index--support { border-left: none; border-top: 1px solid var(--border); }
    .hero-index-spark { height: 68px; margin-top: 14px; }
    .hero-index-foot { height: auto; min-height: 0; }
    /* En columna única todo se alinea a la izquierda: el número manda y los
       badges lo siguen. */
    .hero-index .sentiment-changes { justify-content: flex-start; }
}

@media (max-width: 480px) {
    .hero-card-profile { padding: 18px 16px; gap: 14px; flex-wrap: wrap; }
    .hero-card-profile .main-avatar { width: 52px; height: 52px; min-width: 52px; font-size: 20px; }
    .hero-card-profile .main-name { font-size: 23px; }
    /* Avatar + nombre ocupan la fila; acciones caen debajo a lo ancho. */
    .hero-card-profile .hero-info { flex: 1 1 60%; }
    .hero-card-actions { flex: 1 0 100%; justify-content: space-between; }
    .hero-index { padding: 20px 16px; }
    .hero-index--support .sentiment-value,
    .hero-index--support .hate-value { font-size: 34px; }
}

/* ============================================================
   Ranking v2 — podio, tabla enriquecida y tableros internos
   ============================================================ */

.demo-badge {
    display: inline-block;
    margin-left: 7px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(217, 119, 6, 0.28);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.09em;
    vertical-align: middle;
}

.muted { color: var(--ink-faint); }

/* ── Podio ─────────────────────────────────────────────────── */

.podium {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
    align-items: end;
}

.podium-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--paper);
    text-decoration: none;
    color: inherit;
    position: relative;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.podium-slot:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* El primer puesto se eleva y se ensancha para leerse como podio real. */
.podium-slot.is-first {
    padding-top: 30px;
    padding-bottom: 24px;
    border-color: rgba(217, 119, 6, 0.4);
    background: linear-gradient(180deg, rgba(254, 243, 199, 0.5), var(--paper) 60%);
}

.podium-medal {
    position: absolute;
    top: -12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    border: 2px solid var(--paper);
}

.podium-slot.gold .podium-medal   { background: linear-gradient(135deg, #f0b429, #d97706); }
.podium-slot.silver .podium-medal { background: linear-gradient(135deg, #b8bfc8, #8a939c); }
.podium-slot.bronze .podium-medal { background: linear-gradient(135deg, #cd8c52, #a1663a); }

.podium-name {
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    line-height: 1.25;
}

.podium-country { font-size: 12px; color: var(--ink-muted); }

.podium-value {
    font-family: var(--font-serif);
    font-size: 40px;
    line-height: 1;
    margin-top: 4px;
}

.podium-value span { font-size: 18px; color: var(--ink-muted); }
.podium-slot.is-first .podium-value { font-size: 50px; }

.podium-change { font-size: 12px; font-weight: 600; }
.podium-change.up { color: var(--success); }
.podium-change.down { color: var(--danger); }
.podium-change.neutral { color: var(--ink-faint); }

/* ── Tabla ─────────────────────────────────────────────────── */

.ranking-header-v2,
.ranking-row-v2 {
    grid-template-columns: 46px minmax(0, 1fr) 96px 78px 58px 58px 58px 68px;
    gap: 8px;
    align-items: center;
}

/* .ranking-table usa overflow:hidden, así que el sticky se ancla a la tarjeta y no
   al viewport: el top:64px heredado empujaba la cabecera encima de la primera fila. */
.ranking-header-v2 { position: static; top: auto; }

.ranking-row-v2.is-demo { box-shadow: inset 3px 0 0 var(--warning); }

.rank-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    background: var(--paper-cool);
    border: 1px solid var(--border);
    font-weight: 700;
    color: var(--ink-muted);
}

.rank-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rank-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ranking-id { min-width: 0; }
.ranking-spark { display: flex; align-items: center; }
.spark { display: block; }

.ranking-hate {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-light);
    text-align: right;
}

/* ── Tableros internos ─────────────────────────────────────── */

.board-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.board-switcher-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--ink-faint);
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.board-card { padding: 20px 22px; }
.board-card-wide { grid-column: 1 / -1; }

.board-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.board-title { font-size: 15px; font-weight: 700; margin: 0; }
.board-body { min-height: 60px; }
.board-loading { display: flex; justify-content: center; padding: 24px 0; }
.board-empty { color: var(--ink-faint); font-size: 13px; margin: 0; padding: 12px 0; }

/* Barras divergentes: el centro es cero, izquierda resta y derecha suma. */
.dv-row {
    display: grid;
    grid-template-columns: 20px minmax(70px, 108px) minmax(0, 1fr) 46px 56px;
    gap: 10px;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.dv-rank { font-size: 11px; font-weight: 700; color: var(--ink-faint); }
.dv-label { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dv-track { position: relative; height: 16px; background: var(--paper-cool); border-radius: 4px; overflow: hidden; }
.dv-fill { position: absolute; top: 0; height: 100%; border-radius: 3px; }
.dv-fill.pos { background: var(--success); }
.dv-fill.neg { background: var(--danger); }
.dv-axis { position: absolute; left: 50%; top: 0; width: 1px; height: 100%; background: var(--border); }

.dv-value { font-size: 13px; font-weight: 700; text-align: right; }
.dv-value.pos { color: var(--success); }
.dv-value.neg { color: var(--danger); }
.dv-meta { font-size: 11px; color: var(--ink-faint); text-align: right; }

/* Narrativas */
.nb-row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) 76px 48px;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.nb-row:last-child { border-bottom: none; }
.nb-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nb-term { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-meta { font-size: 11px; color: var(--ink-faint); }

.nb-spark { display: flex; align-items: flex-end; gap: 2px; height: 24px; }
.nb-spark i { flex: 1; background: var(--accent-light); border-radius: 1px; opacity: 0.75; }

.nb-growth { font-size: 13px; font-weight: 700; color: var(--accent); text-align: right; }

/* Modo avanzado dentro de la tarjeta del monitor: el toggle vive en el título. */
.breakout-level-toggle { margin-left: auto; }
.breakout-level-toggle .chart-toggle-btn { font-size: 11px; padding: 5px 10px; }
.breakout-list .nb-row { padding: 9px 0; }
.breakout-list .nb-row:first-child { padding-top: 2px; }

@media (max-width: 600px) {
    .breakout-list .nb-row { grid-template-columns: 18px minmax(0, 1fr) 44px; }
    .breakout-list .nb-spark { display: none; }
}

/* Virales */
.viral-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.viral-summary > div { display: flex; flex-direction: column; gap: 2px; }
.vs-num { font-family: var(--font-serif); font-size: 26px; line-height: 1; }
.vs-num.pos { color: var(--success); }
.vs-num.neg { color: var(--danger); }
.vs-lab { font-size: 11px; color: var(--ink-muted); }

.viral-row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) 90px 72px 72px;
    gap: 10px;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 12px;
}

.viral-row:last-child { border-bottom: none; }
.viral-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viral-date { color: var(--ink-muted); }
.viral-likes, .viral-comments { text-align: right; font-weight: 600; }

@media (max-width: 900px) {
    .ranking-header-v2,
    .ranking-row-v2 { grid-template-columns: 34px minmax(0, 1fr) 62px 52px 50px 56px; }
    /* En pantallas medias se ocultan 1d y 30d: 7d y hostilidad cuentan la historia. */
    .ranking-header-v2 > :nth-child(5),
    .ranking-row-v2 > :nth-child(5),
    .ranking-header-v2 > :nth-child(7),
    .ranking-row-v2 > :nth-child(7) { display: none; }
}

@media (max-width: 560px) {
    .ranking-header-v2,
    .ranking-row-v2 { grid-template-columns: 28px minmax(0, 1fr) 56px 52px; padding: 12px 14px; }
    .ranking-header-v2 > :nth-child(3),
    .ranking-row-v2 > :nth-child(3),
    .ranking-header-v2 > :nth-child(8),
    .ranking-row-v2 > :nth-child(8) { display: none; }
    .podium { grid-template-columns: 1fr; align-items: stretch; }
    .podium-slot.is-first { order: -1; }
    .podium-value, .podium-slot.is-first .podium-value { font-size: 34px; }
    .dv-row { grid-template-columns: 18px minmax(64px, 90px) minmax(0, 1fr) 42px; }
    .dv-meta { display: none; }
    .viral-row { grid-template-columns: 18px minmax(0, 1fr) 60px 60px; }
    .viral-date { display: none; }
}

/* ============================================================
   Comparar — selector, cara a cara y filas enfrentadas
   ============================================================ */

/* Los dos lados mantienen el mismo color en toda la página: A azul, B ámbar. */
:root { --cmp-a: #1a56db; --cmp-b: #b45309; }
body.dark { --cmp-a: #60a5fa; --cmp-b: #fbbf24; }

.cmp-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.cmp-picker .filter-select { flex: 1 1 200px; min-width: 0; }
.cmp-period-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: -10px 0 28px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--paper-warm) 55%, transparent);
}
.cmp-period-label {
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.cmp-period-picker .history-range-toggle { margin-left: auto; }
.cmp-period-note { color: var(--ink-faint); font-size: 12px; }
.cmp-side-a { border-left: 3px solid var(--cmp-a); }
.cmp-side-b { border-left: 3px solid var(--cmp-b); }

.cmp-vs {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 18px;
    color: var(--ink-muted);
    flex: 0 0 auto;
}

.cmp-loading { display: flex; justify-content: center; padding: 70px 0; }

/* Esqueleto de carga de la comparación: replica la forma real del contenido. */
.cmp-skeleton { animation: fadeIn 0.3s var(--ease-out); }

.cmp-skel-hero {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    padding: 28px 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--paper);
    margin-bottom: 28px;
}

.cmp-skel-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cmp-skel-vs {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 18px;
    color: var(--ink-subtle, var(--ink-muted));
}

.cmp-skel-avatar { width: 62px; height: 62px; border-radius: 50%; }
.cmp-skel-spark { width: 120px; height: 28px; border-radius: 6px; }

.cmp-skel-card { margin-bottom: 20px; }
.cmp-skel-title { height: 14px; width: 160px; margin-bottom: 18px; }

.cmp-skel-row {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
}

.cmp-skel-row .cmp-skel-bars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.cmp-skel-bar { height: 10px; border-radius: 5px; }
.cmp-skel-bar.left { justify-self: end; }
.cmp-skel-val { height: 12px; }

.cmp-skel-label {
    height: 10px;
    width: 120px;
    margin: 0 auto 6px;
}

@media (max-width: 600px) {
    .cmp-skel-hero { padding: 20px 12px; gap: 10px; }
    .cmp-skel-avatar { width: 48px; height: 48px; }
    .cmp-skel-spark { width: 80px; }
}

.cmp-notice {
    padding: 32px 28px;
    text-align: center;
}
.cmp-notice h3 { margin: 0 0 8px; font-size: 18px; }
.cmp-notice p { margin: 0; color: var(--ink-muted); font-size: 14px; }

/* ── Cara a cara ───────────────────────────────────────────── */

.cmp-hero {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 40px;
}

/* Shown only when the two sides are measured on different frames (author cap
   on vs off), so it must read as a caveat and not as decoration. */
.cmp-caveat {
    margin: -24px auto 36px;
    max-width: 78ch;
    padding: 12px 16px;
    border-left: 3px solid var(--accent, #b3282d);
    background: var(--paper-cool);
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-muted);
}

.cmp-caveat strong {
    color: var(--ink);
    font-weight: 600;
}

.cmp-hero-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 24px 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--paper);
    text-align: center;
}

.cmp-hero-side.a { border-top: 3px solid var(--cmp-a); }
.cmp-hero-side.b { border-top: 3px solid var(--cmp-b); }
/* El que va arriba en aprobación se despega levemente del otro. */
.cmp-hero-side.leads { box-shadow: var(--shadow-md); }

.cmp-hero-name { font-weight: 700; font-size: 16px; line-height: 1.25; }
.cmp-hero-country { font-size: 12px; color: var(--ink-muted); }

.cmp-hero-value { font-family: var(--font-serif); font-size: 46px; line-height: 1.05; margin-top: 4px; }
.cmp-hero-value span { font-size: 20px; color: var(--ink-muted); }

.cmp-hero-change { font-size: 12px; font-weight: 600; }
.cmp-hero-change.up { color: var(--success); }
.cmp-hero-change.down { color: var(--danger); }

.cmp-hero-vs {
    display: flex;
    align-items: center;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 26px;
    color: var(--ink-faint);
    padding: 0 4px;
}

/* ── Filas enfrentadas ─────────────────────────────────────── */

.cmp-card { padding: 22px 24px; margin-bottom: 14px; }
.cmp-card:last-child { margin-bottom: 0; }
.cmp-card-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; }

.vs-legend {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.vs-legend .a { color: var(--cmp-a); }
.vs-legend .b { color: var(--cmp-b); }

.vs-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) 82px;
    grid-template-areas: "aval bars bval" "label label label";
    gap: 4px 10px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.vs-val { font-size: 14px; font-weight: 600; color: var(--ink-light); }
.vs-val.a { grid-area: aval; text-align: right; }
.vs-val.b { grid-area: bval; text-align: left; }
.vs-val.a.win { color: var(--cmp-a); font-weight: 700; }
.vs-val.b.win { color: var(--cmp-b); font-weight: 700; }

.vs-bars { grid-area: bars; display: flex; align-items: center; gap: 3px; }
.vs-bar-side { flex: 1; height: 14px; background: var(--paper-cool); border-radius: 3px; display: flex; }
.vs-bar-side.left { justify-content: flex-end; }
.vs-bar-side.right { justify-content: flex-start; }

.vs-bar { height: 100%; border-radius: 3px; opacity: 0.45; transition: opacity 0.2s var(--ease-out); }
.vs-bar.a { background: var(--cmp-a); }
.vs-bar.b { background: var(--cmp-b); }
.vs-bar.win { opacity: 1; }

/* Magnitud negativa: mismo color de lado, pero rayada para que no se lea como logro. */
.vs-bar.a.is-neg {
    background: repeating-linear-gradient(-45deg, var(--cmp-a) 0 3px, transparent 3px 6px);
    box-shadow: inset 0 0 0 1px var(--cmp-a);
}
.vs-bar.b.is-neg {
    background: repeating-linear-gradient(-45deg, var(--cmp-b) 0 3px, transparent 3px 6px);
    box-shadow: inset 0 0 0 1px var(--cmp-b);
}

.vs-label {
    grid-area: label;
    font-size: 12px;
    color: var(--ink-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* .info-btn trae margin-left:auto para las cabeceras de tarjeta; acá empujaría
   el icono contra el borde y descentraría la etiqueta. */
.vs-label .info-btn,
.cmp-card-title .info-btn { margin-left: 0; }

.cmp-nodata { font-size: 11px; color: var(--ink-faint); font-weight: 400; }

/* ── Listas por lado ───────────────────────────────────────── */

.cmp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

.cmp-col-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.cmp-col-title.a { color: var(--cmp-a); }
.cmp-col-title.b { color: var(--cmp-b); }

.cmp-li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px 44px;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
}

.cmp-li-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-li-bar { height: 6px; background: var(--paper-cool); border-radius: 3px; overflow: hidden; }
.cmp-li-bar i { display: block; height: 100%; border-radius: 3px; }
.cmp-li-bar i.a { background: var(--cmp-a); }
.cmp-li-bar i.b { background: var(--cmp-b); }
.cmp-li-val { text-align: right; font-weight: 600; color: var(--ink-light); }

/* ── Twin mode: same axes, two profiles ───────────────────── */
.cmp-twin-panel { padding: 24px; margin-bottom: 14px; }
.cmp-twin-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}
.cmp-twin-kicker {
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
}
.cmp-twin-title { margin: 4px 0 4px; font-size: 18px; }
.cmp-twin-subtitle { margin: 0; color: var(--ink-muted); font-size: 12px; }
.cmp-twin-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; font-weight: 700; }
.cmp-twin-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cmp-twin-legend span::before { width: 8px; height: 8px; border-radius: 50%; content: ''; }
.cmp-twin-legend .a { color: var(--cmp-a); }
.cmp-twin-legend .a::before { background: var(--cmp-a); }
.cmp-twin-legend .b { color: var(--cmp-b); }
.cmp-twin-legend .b::before { background: var(--cmp-b); }
.cmp-twin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cmp-twin-chart {
    position: relative;
    min-width: 0;
    padding: 14px 14px 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--paper-cool);
}
.cmp-twin-chart-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cmp-twin-chart h3 { margin: 0; font-size: 14px; }
.cmp-twin-chart-heading span { color: var(--ink-faint); font-size: 11px; text-align: right; }
.cmp-twin-svg { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.cmp-chart-hit { fill: transparent; cursor: crosshair; pointer-events: all; touch-action: none; }
.cmp-chart-hover-line { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.cmp-chart-hover-dot { stroke: var(--paper); stroke-width: 2; pointer-events: none; }
.cmp-chart-hover-dot.a { fill: var(--cmp-a); }
.cmp-chart-hover-dot.b { fill: var(--cmp-b); }
.cmp-chart-tooltip {
    position: absolute;
    top: 46px;
    z-index: 2;
    display: grid;
    gap: 3px;
    min-width: 132px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: var(--shadow-md);
    font-size: 11px;
    pointer-events: none;
}
.cmp-chart-tooltip strong { font-size: 11px; }
.cmp-chart-tooltip .a { color: var(--cmp-a); }
.cmp-chart-tooltip .b { color: var(--cmp-b); }
.cmp-chart-gridline { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.cmp-chart-axis-line { stroke: var(--border); stroke-width: 1; }
.cmp-chart-axis, .cmp-chart-date { fill: var(--ink-faint); font-family: var(--font-mono); font-size: 10px; }
.cmp-chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.cmp-chart-line.a { stroke: var(--cmp-a); }
.cmp-chart-line.b { stroke: var(--cmp-b); }
.cmp-chart-empty { min-height: 180px; display: grid; place-items: center; margin: 0; color: var(--ink-faint); font-size: 12px; }

@media (max-width: 640px) {
    .cmp-hero { grid-template-columns: 1fr; }
    .cmp-hero-vs { justify-content: center; padding: 2px 0; }
    .cmp-hero-value { font-size: 38px; }
    .cmp-picker .filter-select { flex-basis: 100%; }
    .cmp-period-picker .history-range-toggle { margin-left: 0; }
    .cmp-period-picker .chart-range-btn { flex: 1 1 0; }
    .cmp-vs { width: 100%; text-align: center; }
    .vs-row { grid-template-columns: 68px minmax(0, 1fr) 68px; }
    .vs-val { font-size: 13px; }
    .cmp-cols { grid-template-columns: 1fr; gap: 18px; }
    .cmp-card { padding: 18px 16px; }
    .cmp-twin-panel { padding: 18px 16px; }
    .cmp-twin-head { flex-direction: column; }
    .cmp-twin-grid { grid-template-columns: 1fr; }
}

/* Tailscale/LAN-only public share panel (never shown to public visitors) */
.share-local {
    position: relative;
}
.share-local-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.share-local-toggle:hover {
    color: var(--ink);
    background: var(--paper-cool);
}
.share-local-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 2px var(--success-light);
}
.share-local-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(420px, calc(100vw - 24px));
    max-height: min(80vh, 640px);
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}
.share-local-config {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.share-local-config summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-muted);
    list-style: none;
    user-select: none;
}
.share-local-config summary::-webkit-details-marker { display: none; }
.share-local-config summary::before {
    content: "▸ ";
    color: var(--ink-faint);
}
.share-local-config[open] summary::before { content: "▾ "; }
.share-local-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}
.share-local-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
}
.share-local-field input[type="number"] {
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    background: var(--paper-warm);
}
.share-local-field.share-local-check {
    justify-content: flex-end;
}
.share-local-field.share-local-check input {
    width: 18px;
    height: 18px;
    margin-top: 6px;
}
.share-local-check-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--ink-muted);
    line-height: 1.35;
}
.share-local-check-row input {
    margin-top: 2px;
}
.share-ban-count {
    font-weight: 700;
    color: var(--danger);
    margin-left: 4px;
}
.share-ban-list {
    margin-top: 8px;
    max-height: 160px;
    overflow: auto;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--paper-warm);
}
.share-ban-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-light);
}
.share-ban-row:last-child { border-bottom: 0; }
.share-ban-meta {
    min-width: 0;
    flex: 1;
}
.share-ban-ip {
    font-weight: 700;
    color: var(--ink);
    word-break: break-all;
}
.share-ban-reason {
    color: var(--ink-muted);
    margin-top: 2px;
}
.share-ban-empty {
    padding: 10px 8px;
    color: var(--ink-muted);
    text-align: center;
}
.share-ban-events {
    margin-top: 8px;
    max-height: 100px;
    overflow: auto;
    font-size: 10px;
    color: var(--ink-muted);
    font-family: ui-monospace, monospace;
    padding: 6px 8px;
    background: var(--paper-cool);
    border-radius: 8px;
}
.share-local-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.share-local-head strong {
    font-size: 13px;
}
.share-local-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--paper-cool);
    color: var(--ink-muted);
}
.share-local-badge.on {
    background: var(--success-light);
    color: var(--success);
}
.share-local-hint {
    font-size: 11px;
    color: var(--ink-muted);
    line-height: 1.4;
    margin-bottom: 10px;
}
.share-local-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    margin: 8px 0 4px;
}
.share-local-row {
    display: flex;
    gap: 6px;
}
.share-local-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 12px;
    background: var(--paper-warm);
    color: var(--ink);
}
.share-local-btn {
    flex-shrink: 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.share-local-btn:hover { background: var(--paper-cool); }
.share-local-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.share-local-btn.primary:hover { filter: brightness(1.05); }
.share-local-btn.danger {
    color: var(--danger);
    border-color: #fecaca;
}
.share-local-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.share-local-status {
    min-height: 1.2em;
    margin-top: 8px;
    font-size: 11px;
    color: var(--ink-muted);
}


/* =========================================================
   Carrosio brand refinement layer (2026-07-30)
   Editorial desk aesthetic — less SaaS, more newspaper + data
   ========================================================= */

body {
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4,
.page-title,
.section-title,
.hero-name,
.politician-name,
.metric-value,
.big-number,
.lp-hero-title,
.lp-section-title {
    font-family: var(--font-serif);
    letter-spacing: -0.02em;
    font-weight: 600;
}

.metric-value,
.big-number,
.hero-score,
.approval-value,
.rank-score {
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Sharper cards: keep structure, lose balloon UI */
.card,
.insight-card,
.highlight-card,
.alpha-card,
.ranking-card,
.compare-panel,
.dashboard-card {
    border-radius: var(--radius-lg) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
    background: var(--paper);
}

.card:hover,
.insight-card:hover,
.alpha-card:hover {
    box-shadow: var(--shadow-md) !important;
}

/* Controls */
button,
.cache-control,
.cache-refresh-btn,
.cache-cancel-btn,
.cache-log-toggle,
.theme-toggle,
select,
.chart-toggle-btn,
.period-btn,
.filter-btn {
    border-radius: var(--radius-sm) !important;
}

.theme-toggle {
    border-radius: var(--radius-sm) !important;
}

/* Section labels like a print desk */
.section-label,
.card-label,
.lp-section-tag,
.metric-label {
    font-family: var(--font-sans);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-muted);
}

/* Primary interactive fill */
.btn-primary,
button.primary,
.lp-cta-primary,
a.lp-cta-primary {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 12px;
}

.btn-primary:hover,
button.primary:hover,
.lp-cta-primary:hover,
a.lp-cta-primary:hover {
    background: color-mix(in srgb, var(--accent) 88%, #000) !important;
}

/* Soft accent chips */
.badge-positive,
.tag-accent,
.pill-accent {
    background: var(--accent-soft) !important;
    color: var(--accent) !important;
}

/* Footer stays ink block but warmer */
.footer {
    background: #141210;
}

body.dark .footer {
    background: #0b0a09;
}

/* Hero/about paper texture via subtle gradient only */
.lp-hero {
    background:
        radial-gradient(1200px 480px at 50% -10%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%),
        linear-gradient(180deg, var(--paper-warm) 0%, var(--paper) 72%) !important;
}

/* Ranking podium / tables denser, less toy-like */
.ranking-table th {
    font-family: var(--font-sans);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-muted);
}

/* Avoid pure startup blue leftovers if hardcoded elsewhere */
a {
    color: var(--accent);
}
a:hover {
    color: color-mix(in srgb, var(--accent) 80%, #000);
}
.nav-link,
.footer-links a,
.logo {
    /* nav/footer restore local colors */
}
.nav-link { color: var(--ink-muted); }
.nav-link:hover,
.nav-link.active { color: var(--ink); }
.footer-links a { color: rgba(255,255,255,0.72); }
.footer-links a:hover { color: #fff; }

/* Mobile nav keeps tap size but loses rounded candy */
@media (max-width: 768px) {
    .header {
        height: 58px;
        box-shadow: inset 0 -2px 0 var(--accent);
    }
    .nav-link {
        letter-spacing: 0.08em;
        font-size: 12px;
        padding: 10px 6px;
    }
}


/* ============================================================
   Data freshness bar — how old the comments and the cache are
   ============================================================ */

.freshness {
    margin: 0 0 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--paper-warm);
    overflow: hidden;
}

.freshness-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: 0;
    cursor: pointer;
    text-align: left;
    color: inherit;
    font-family: inherit;
    transition: background 0.18s var(--ease-out);
}

.freshness-summary:hover { background: var(--paper-cool); }

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

.freshness-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ink-faint);
}

.freshness-dot[data-state="ok"]      { background: var(--success); }
.freshness-dot[data-state="warn"]    { background: var(--warning); }
.freshness-dot[data-state="stale"]   { background: var(--danger); }
.freshness-dot[data-state="loading"] { background: var(--accent); animation: freshnessPulse 1.4s ease-in-out infinite; }

body.dark .freshness-dot[data-state="ok"]    { background: #55b487; }
body.dark .freshness-dot[data-state="warn"]  { background: #d99a3f; }
body.dark .freshness-dot[data-state="stale"] { background: var(--accent-light); }

@keyframes freshnessPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.35; }
}

.freshness-metrics {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 8px 30px;
    min-width: 0;
}

.freshness-metric {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.freshness-metric-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.freshness-metric-label {
    font-size: 10px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-muted);
    white-space: nowrap;
}

.freshness-chevron {
    flex: 0 0 auto;
    display: flex;
    color: var(--ink-muted);
    transition: transform 0.2s var(--ease-out);
}

.freshness-summary[aria-expanded="true"] .freshness-chevron { transform: rotate(180deg); }

.freshness-detail {
    border-top: 1px solid var(--border-light);
    padding: 16px;
    background: var(--paper);
}

.freshness-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px 28px;
}

.freshness-block-title {
    margin: 0 0 8px;
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.freshness-rows {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px 14px;
    align-items: baseline;
}

.freshness-rows dt {
    font-size: 12.5px;
    color: var(--ink-light);
    min-width: 0;
}

.freshness-rows dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    text-align: right;
    white-space: nowrap;
}

.freshness-rows dd small {
    display: block;
    font-family: var(--font-sans);
    font-size: 10.5px;
    color: var(--ink-faint);
}

.freshness-rows dd.is-warn  { color: var(--warning); }
.freshness-rows dd.is-alert { color: var(--danger); }
body.dark .freshness-rows dd.is-warn  { color: #d99a3f; }
body.dark .freshness-rows dd.is-alert { color: var(--accent-light); }

.freshness-foot {
    margin: 14px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--ink-faint);
}

@media (max-width: 640px) {
    .freshness-summary { gap: 10px; padding: 11px 13px; align-items: flex-start; }
    .freshness-dot { margin-top: 5px; }
    .freshness-metrics { gap: 9px 18px; }
    .freshness-metric-value { font-size: 12.5px; }
    .freshness-chevron { margin-top: 3px; }
    .freshness-detail { padding: 14px 13px; }
}

/* ---- Language switch -----------------------------------------------------
   Injected into the shared nav by nav.js rather than duplicated across the five
   page templates. Marked data-no-i18n so the translator leaves PT/ES alone. */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: var(--paper-cool);
}

.lang-opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 100px;
    font-family: var(--font-mono, monospace);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    text-decoration: none;
    transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.lang-opt:hover { color: var(--ink); }

.lang-opt.active {
    background: var(--ink);
    color: var(--paper);
}

@media (max-width: 600px) {
    .lang-switch { align-self: flex-start; margin: 8px 0; }
}

/* ============================================================================
   Modo admin — capa de edición en vivo (frontend/admin.js)
   Solo se activa con ?admin=1 o Ctrl+Shift+A. Fuera de admin, lo único que
   queda es `.admin-hidden` sobre las cards que el operador apagó.
   ========================================================================= */

/* Tiene que ganarle a reglas de layout más específicas (`.cards-grid
   .insight-card { display: flex }`), y no hay una forma de hacerlo por
   especificidad que no se rompa cuando cambie el grid. */
.admin-hidden { display: none !important; }

/* Sólo dentro del modo admin: la card sigue en su lugar, apagada, para poder
   volver a prenderla desde su propia toolbar. */
.admin-dimmed {
    opacity: 0.34;
    filter: grayscale(1);
    outline: 1px dashed var(--border);
}

body.admin-mode .card,
body.admin-mode .hero-index { outline: 1px dashed transparent; transition: outline-color .15s; }
body.admin-mode .card:hover,
body.admin-mode .hero-index:hover { outline-color: var(--accent-light); }

.admin-card-tools {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 40;
    display: none;
    align-items: center;
    gap: 2px;
    padding: 3px 4px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 7px;
    box-shadow: var(--shadow-md);
}
body.admin-mode .card:hover > .admin-card-tools,
body.admin-mode .hero-index:hover > .admin-card-tools,
body.admin-mode .admin-editable > .admin-card-tools { display: flex; }

.admin-card-tools button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 4px 5px;
    border-radius: 5px;
    color: var(--ink-light);
}
.admin-card-tools button:hover { background: var(--paper-warm); }
.admin-card-id {
    font-family: var(--font-mono);
    font-size: 9.5px;
    color: var(--ink-faint);
    padding-left: 4px;
    border-left: 1px solid var(--border-light);
    margin-left: 2px;
}

.admin-editing {
    outline: 1px solid var(--accent-light);
    outline-offset: 2px;
    border-radius: 3px;
    background: rgba(196, 60, 60, 0.05);
    cursor: text;
}

/* ---- panel ---- */
.admin-panel {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9000;
    width: 268px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    font-family: var(--font-sans);
    font-size: 12px;
}
.admin-panel header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light);
}
.admin-panel header strong { flex: 1; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
.admin-panel header button {
    border: 0; background: transparent; cursor: pointer;
    color: var(--ink-muted); font-size: 13px; line-height: 1; padding: 2px 5px; border-radius: 4px;
}
.admin-panel header button:hover { background: var(--paper-warm); color: var(--ink); }
.admin-panel.collapsed .admin-panel-body { display: none; }

.admin-panel-body { overflow: auto; padding: 6px 4px 8px; }
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list li {
    display: flex; align-items: center; gap: 4px;
    padding: 2px 6px; border-radius: 5px;
}
.admin-list li:hover { background: var(--paper-warm); }
.admin-list label { display: flex; align-items: center; gap: 7px; flex: 1; cursor: pointer; min-width: 0; }
.admin-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-list span.off { color: var(--ink-faint); text-decoration: line-through; }
.admin-list em { font-style: normal; font-size: 10px; opacity: .7; }

.admin-panel-actions { display: flex; gap: 6px; padding: 8px 6px 4px; }
.admin-panel-actions button {
    flex: 1; cursor: pointer; font-size: 11px; padding: 5px 6px;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--paper-warm); color: var(--ink-light);
}
.admin-panel-actions button:hover { background: var(--paper-cool); }
.admin-hint { margin: 4px 6px 0; font-size: 10px; line-height: 1.4; color: var(--ink-faint); }

.admin-toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    z-index: 9500; padding: 8px 14px; border-radius: 8px;
    background: var(--ink); color: var(--paper);
    font-family: var(--font-sans); font-size: 12px;
    box-shadow: var(--shadow-md);
    animation: adminToastIn .18s ease-out;
}
@keyframes adminToastIn { from { opacity: 0; transform: translate(-50%, 6px); } }

@media (max-width: 600px) {
    .admin-panel { right: 8px; left: 8px; width: auto; }
}

/* ============================================================================
   Card "Qué cambió" — versión condensada
   Reemplaza el titular en prosa por un número grande, y el "± x pp" en texto
   por una barra con bigote de error. Va después de las reglas originales para
   ganar por orden sin subir especificidad.
   ========================================================================= */

.period-headline { border-left: 0; padding: 0; margin-bottom: 14px; }

.period-lead {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.period-lead-label {
    width: 100%;
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.period-lead-value {
    font-family: var(--font-serif);
    font-size: 46px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.period-lead-delta {
    font-size: 17px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 3px 9px;
    border-radius: 999px;
    animation: periodPop .32s cubic-bezier(.2, 1.5, .4, 1) both;
    animation-delay: .38s;
}
.period-lead.positive .period-lead-delta { color: var(--success); background: var(--success-light); }
.period-lead.negative .period-lead-delta { color: var(--danger);  background: var(--danger-light); }
.period-lead.neutral  .period-lead-delta { color: var(--ink-light); background: var(--paper-warm); }

@keyframes periodPop { from { opacity: 0; transform: scale(.82) translateY(3px); } }

.period-lead-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.period-chip,
.period-scope {
    font-size: 11.5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--paper-warm);
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
}
.period-scope { border: 1px dashed var(--border); background: transparent; cursor: help; }
.period-scope { font-variant-numeric: tabular-nums; }

/* ---- filas: label · valores · barra · delta ---- */

.period-row { grid-template-columns: minmax(0, 1.1fr) 118px minmax(170px, 1.4fr) 82px; }

.period-row-label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.period-row-icon {
    flex: none;
    width: 22px;
    text-align: center;
    font-size: 14px;
    line-height: 1;
    filter: saturate(0.9);
}
.period-row.is-noise { opacity: 1; }
.period-row.is-noise .period-row-label,
.period-row.is-noise .period-curr { color: var(--ink-muted); font-weight: 600; }
.period-row.is-noise .period-delta { color: var(--ink-faint); }

.period-track {
    position: relative;
    height: 26px;
    min-width: 150px;
    overflow: hidden;   /* los bigotes que exceden la escala se recortan */
    background: var(--paper-warm);
    border-radius: 5px;
}

.period-track-axis {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: var(--ink-faint);
    z-index: 2;
}

/* El bigote es el intervalo de confianza: cuando pisa el eje, el movimiento
   no se distingue del cero — que es exactamente lo que "ruido" significa. */
.period-track-ci {
    position: absolute;
    top: 50%;
    height: 22px;
    transform: translateY(-50%);
    border-radius: 4px;
    background: rgba(20, 18, 16, 0.07);
    border-left: 1px solid var(--ink-faint);
    border-right: 1px solid var(--ink-faint);
}

.period-track-bar {
    position: absolute;
    top: 50%;
    height: 16px;
    transform: translateY(-50%);
    border-radius: 2px;
    animation: periodGrow .5s cubic-bezier(.2, .8, .3, 1) both;
}
/* Verde = bueno para el político, rojo = malo, sin importar el signo del
   delta: que baje el rechazo es una buena noticia con delta negativo. */
.period-track-bar.positive { background: var(--success); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.period-track-bar.negative { background: var(--danger);  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.period-track-bar.neutral  { background: var(--ink-muted); }

@keyframes periodGrow { from { transform: translateY(-50%) scaleX(0); } }
/* La barra crece desde el eje hacia afuera, así que el origen lo fija el lado
   del eje al que cae — no el tono, que ahora dice lo mismo que el lado. */
.period-track-bar.to-right { transform-origin: left center; }
.period-track-bar.to-left  { transform-origin: right center; }

/* +1: la primera fila de la grilla es la leyenda del eje. */
.period-row:nth-child(2) .period-track-bar { animation-delay: .04s; }
.period-row:nth-child(3) .period-track-bar { animation-delay: .10s; }
.period-row:nth-child(4) .period-track-bar { animation-delay: .16s; }
.period-row:nth-child(5) .period-track-bar { animation-delay: .22s; }
.period-row:nth-child(6) .period-track-bar { animation-delay: .28s; }

/* ---- leyenda del eje: se dice una vez, no una por fila ---- */

.period-axis-legend {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) 118px minmax(170px, 1.4fr) 82px;
    align-items: center;
    gap: 10px;
    padding: 0 2px 4px;
}

.period-axis-scale {
    display: flex;
    justify-content: space-between;
    color: var(--ink-faint);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.period-topic-legend {
    display: grid;
    grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 62px;
    align-items: center;
    gap: 10px;
    padding-bottom: 2px;
}

/* La fila que ya está en el titular: se marca en vez de repetirse muda. */
/* Acento al margen y no fondo: el fondo del riel es paper-warm y un relleno
   del mismo tono se lo comía. */
.period-row.is-lead { box-shadow: inset 3px 0 0 var(--ink-faint); padding-left: 8px; }
.period-row.is-lead .period-row-label { color: var(--ink); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
    .period-lead-delta,
    .period-track-bar { animation: none; }
}

@media (max-width: 900px) {
    /* Sin columna de barras la leyenda no señala nada. */
    .period-axis-legend { display: none; }
}

@media (max-width: 720px) {
    .period-lead-value { font-size: 38px; }
    .period-row { grid-template-columns: minmax(0, 1fr) 110px 64px; }
    .period-track { display: none; }
}

/* ============================================================================
   "Intensidad del rechazo" — fusión de Índice de Odio + Termómetro Silencioso
   Dos lecturas del mismo rechazo, lado a lado. El Termómetro solo ocupaba una
   card entera con un sparkline flotando en el vacío; acá comparte el ancho.
   ========================================================================= */

.rejection-split {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 28px;
    margin-top: 4px;
}

.rejection-pane { min-width: 0; display: flex; flex-direction: column; }
.rejection-pane + .rejection-pane {
    padding-left: 28px;
    border-left: 1px solid var(--border-light);
}

.rejection-pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.rejection-card .hate-value {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.05;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
    margin: 2px 0 10px;
}

.rejection-card .sentiment-changes { margin-bottom: 12px; }
.rejection-spark { height: 64px; margin-top: auto; }
.rejection-caption {
    margin-top: 6px;
    color: var(--ink-faint);
    font-size: 11px;
}

.rejection-thermo-figures {
    display: flex;
    align-items: baseline;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.rejection-card .thermo-value {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
.rejection-thermo-change { display: flex; flex-direction: column; gap: 2px; }
.rejection-card .thermo-days { min-height: 78px; margin-top: auto; }

@media (max-width: 860px) {
    .rejection-split { grid-template-columns: minmax(0, 1fr); gap: 22px; }
    .rejection-pane + .rejection-pane {
        padding-left: 0;
        padding-top: 22px;
        border-left: 0;
        border-top: 1px solid var(--border-light);
    }
}

/* ============================================================================
   "Movilidad de la audiencia" — fusión de Retención Asimétrica + Defección
   Dos movimientos de la misma gente: quién vuelve y quién se da vuelta.
   ========================================================================= */

.mobility-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    margin-top: 4px;
}

.mobility-pane { min-width: 0; display: flex; flex-direction: column; }
.mobility-pane + .mobility-pane {
    padding-left: 28px;
    border-left: 1px solid var(--border-light);
}

.mobility-pane-title {
    display: block;
    margin-bottom: 12px;
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mobility-sub {
    display: block;
    margin: 14px 0 8px;
    color: var(--ink-faint);
    font-size: 11.5px;
}

.mobility-card .retention-chart { min-height: 150px; }
.mobility-card .trigger-list { margin-top: 2px; }

@media (max-width: 860px) {
    .mobility-split { grid-template-columns: minmax(0, 1fr); gap: 22px; }
    .mobility-pane + .mobility-pane {
        padding-left: 0;
        padding-top: 22px;
        border-left: 0;
        border-top: 1px solid var(--border-light);
    }
}

/* ---- Cards de metodología (plegadas por defecto) ---- */
.method-card { padding-top: 14px; padding-bottom: 14px; }
.method-card[open] { padding-bottom: 22px; }

.method-card-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    cursor: pointer;
    list-style: none;
    color: var(--ink-light);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.method-card-summary::-webkit-details-marker { display: none; }
.method-card-summary::after {
    content: '▸';
    margin-left: auto;
    color: var(--ink-faint);
    font-size: 11px;
}
.method-card[open] .method-card-summary::after { content: '▾'; }
.method-card-summary:hover { color: var(--ink); }

.method-card-hint {
    padding: 2px 8px;
    border: 1px dashed var(--border);
    border-radius: 999px;
    color: var(--ink-faint);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
}
.method-card .card-note { margin-top: 14px; }

/* ---- Card unificada de Género (Brecha semanal + Análisis por Género) ---- */
.gender-inferred-note {
    margin: -4px 0 16px;
    padding: 7px 11px;
    border-left: 2px solid var(--warning);
    background: var(--warning-light);
    border-radius: 0 5px 5px 0;
    color: var(--ink-light);
    font-size: 11.5px;
    line-height: 1.45;
}

.gender-week-section {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}
.gender-week-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.gender-week-title {
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---- Selector de político en el hero ---- */
.pol-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pol-switcher-label {
    color: var(--ink-faint);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.pol-switcher-strip { display: flex; align-items: center; gap: 4px; }

.pol-peer {
    position: relative;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--paper-warm);
    cursor: pointer;
    overflow: visible;
    transition: transform .12s ease, border-color .12s ease;
}
.pol-peer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.pol-peer-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--ink-muted);
    font-family: var(--font-serif);
    font-size: 15px;
}
.pol-peer-flag {
    position: absolute;
    right: -2px;
    bottom: -2px;
    font-size: 10px;
    line-height: 1;
    background: var(--paper);
    border-radius: 50%;
    padding: 1px;
}
.pol-peer:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    z-index: 2;
}

.pol-change-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 600;
}
.pol-change-btn:hover { background: var(--accent); border-color: var(--accent); }

@media (max-width: 720px) {
    .pol-switcher { width: 100%; }
    .pol-switcher-label { display: none; }
    .pol-switcher-strip { flex-wrap: wrap; }
}

/* El índice solitario recupera peso de titular: dejó de ser una de dos
   "señales de apoyo" para ser el número del que trata la página. */
.hero-indices:has(> .hero-index:only-child) .hero-index--support {
    padding: 24px 28px 26px;
}
.hero-indices:has(> .hero-index:only-child) .sentiment-value { font-size: 52px; }
.hero-indices:has(> .hero-index:only-child) .hero-index-spark { height: 74px; }
/* El pie vuelve a tener contenido (la ventana del sparkline), así que ya no
   se oculta cuando la aprobación queda sola en el hero. */
.hero-indices:has(> .hero-index:only-child) .hero-index-foot {
    display: block;
    height: auto;
    margin-top: 8px;
}

/* En desktop el índice solitario ocupaba todo el ancho con un sparkline de 74px:
   una franja de ~20:1 en la que la serie queda aplastada contra el eje, mientras
   el espacio a la derecha del número quedaba vacío. Partimos la card en dos: el
   titular a la izquierda, el gráfico a la derecha con altura real. */
@media (min-width: 1024px) {
    .hero-indices:has(> .hero-index:only-child) .hero-index--support {
        display: grid;
        grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
        grid-template-rows: auto auto auto 1fr auto;
        column-gap: 36px;
        align-items: start;
    }
    .hero-indices:has(> .hero-index:only-child) .hero-index-head { grid-area: 1 / 1; }
    .hero-indices:has(> .hero-index:only-child) .hero-index-sub { grid-area: 2 / 1; }
    .hero-indices:has(> .hero-index:only-child) .sentiment-display { grid-area: 3 / 1; }
    .hero-indices:has(> .hero-index:only-child) .sentiment-changes { grid-area: 4 / 1; }
    /* El sparkline abarca las cuatro filas del titular y se estira con ellas. */
    .hero-indices:has(> .hero-index:only-child) .hero-index-spark {
        grid-area: 1 / 2 / 5 / 3;
        /* stretch fills the four spanned rows; min-height is the floor that
           keeps ECharts from initialising against a zero-height container. */
        align-self: stretch;
        height: auto;
        min-height: 210px;
        margin-top: 0;
    }
    .hero-indices:has(> .hero-index:only-child) .hero-index-foot {
        grid-area: 5 / 2;
        text-align: right;
    }
}

/* ---- Narrativas Emergentes · modo fácil: nube de frases ---- */
.breakout-cloud {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    align-content: center;   /* la card la estira el grid; la nube se centra */
    justify-content: center;
    flex: 1 1 auto;
    gap: 6px 16px;
    padding: 18px 8px 12px;
    line-height: 1.25;
}

.cloud-term {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 6px;
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: default;
    transition: background .12s ease, transform .12s ease;
}
.cloud-term:hover { background: var(--paper-warm); transform: translateY(-1px); }

.cloud-term.negative { color: var(--danger); }
.cloud-term.positive { color: var(--success); }
.cloud-term.neutral  { color: var(--ink-light); }

.cloud-term small {
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 400;
    color: var(--ink-faint);
    letter-spacing: 0;
}

@media (prefers-reduced-motion: reduce) {
    .cloud-term:hover { transform: none; }
}

/* ---- Posts que costaron caro: contexto + nota curada ---- */
.owngoal-account {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-muted);
}
.owngoal-count { font-size: 10.5px; color: var(--ink-faint); }

.owngoal-row.has-note { padding-bottom: 2px; }

.owngoal-note {
    grid-column: 1 / -1;
    margin: 4px 0 8px;
    font-size: 12px;
}
.owngoal-note > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    color: var(--ink-light);
    font-weight: 600;
}
.owngoal-note > summary::-webkit-details-marker { display: none; }
.owngoal-note > summary::before { content: '▸'; color: var(--ink-faint); font-size: 10px; }
.owngoal-note[open] > summary::before { content: '▾'; }
.owngoal-note > summary:hover { color: var(--ink); }

.owngoal-note-kind {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--paper-cool);
    color: var(--ink-muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.owngoal-note p {
    margin: 8px 0 0 16px;
    color: var(--ink-muted);
    font-size: 12px;
    line-height: 1.55;
}
.owngoal-note-read strong { color: var(--ink-light); }

.owngoal-note-src {
    display: block;
    margin: 8px 0 0 16px;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
    color: var(--ink-faint);
    font-size: 10px;
    font-style: italic;
}

/* La fila ganó cuenta, volumen y link: la meta necesita envolver en vez de
   comprimir el chip de tema hasta dejarlo en una letra. */
.owngoal-row { grid-template-columns: minmax(0, 1.6fr) minmax(70px, 0.9fr) 84px; }
.owngoal-main { flex-wrap: wrap; row-gap: 3px; }
.owngoal-topic { flex: 0 1 auto; max-width: 100%; text-overflow: ellipsis; }
.owngoal-count { white-space: nowrap; }

/* ============================================================================
   Comparador — banda de veredicto e iconos
   La página tenía 30 filas comparadas y ninguna conclusión: había que leerlas
   todas para saber quién está mejor y en qué.
   ========================================================================= */

.cmp-verdict {
    margin: 26px 0 8px;
    padding: 20px 22px 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--paper-warm);
}

.cmp-verdict-head { margin-bottom: 16px; }

.cmp-verdict-title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.cmp-verdict-sub {
    display: block;
    margin-top: 4px;
    color: var(--ink-faint);
    font-size: 11.5px;
}

.cmp-verdict-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 10px;
}

.cmp-verdict-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    background: var(--paper);
}
.cmp-verdict-tile.is-empty { opacity: 0.6; }

.cmp-verdict-icon { font-size: 18px; line-height: 1.2; }

.cmp-verdict-name {
    color: var(--ink-muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.cmp-verdict-winner {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.25;
}
.cmp-verdict-winner.a { color: var(--cmp-a); }
.cmp-verdict-winner.b { color: var(--cmp-b); }

.cmp-verdict-gap {
    color: var(--ink-light);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.cmp-verdict-read {
    margin-top: 4px;
    color: var(--ink-faint);
    font-size: 10.5px;
    line-height: 1.4;
}

/* ---- iconos de sección y de fila ---- */
.chapter-icon { margin-right: 10px; font-size: 0.85em; }

/* Algunos "iconos" son glifos de texto (\u2640 \u2642 \u26A5), no emoji: a 0.95em
   quedaban casi invisibles al lado de los emoji a color. */
.vs-label-icon {
    display: inline-block;
    min-width: 1.1em;
    margin-right: 7px;
    font-size: 1.05em;
    text-align: center;
}

@media (max-width: 600px) {
    .cmp-verdict { padding: 16px 14px 18px; }
    .cmp-verdict-title { font-size: 18px; }
    .cmp-verdict-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* Nube de palabras: positivas vs negativas */
.wc-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 4px;
}
@media (max-width: 720px) {
    .wc-columns { grid-template-columns: 1fr; }
}
.wc-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 8px 4px 2px;
}
.wc-pos-title { color: var(--success); }
.wc-neg-title { color: var(--danger); }
.wordcloud .word.pos { color: var(--success); }
.wordcloud .word.neg { color: var(--danger); }
.wordcloud .word.pos.size-1 { color: var(--success); }
.wordcloud .word.neg.size-1 { color: var(--danger); }

.wc-skin-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}
.wc-skin-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--paper);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    user-select: none;
}
.wc-skin-box input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.wc-skin-sq {
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--ink-light);
    border-radius: 3px;
    background: var(--paper);
    flex: 0 0 14px;
}
.wc-skin-box:has(input:checked) {
    border-color: var(--ink);
    background: var(--paper-warm);
}
.wc-skin-box:has(input:checked) .wc-skin-sq {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 2px var(--paper);
}

.wordcloud-card.wc-skin-grok .word.size-1 { font-size: 40px; }
.wordcloud-card.wc-skin-grok .word.size-3 { font-size: 18px; }
.wordcloud-card.wc-skin-grok .word.size-5 { font-size: 12px; opacity: 0.7; }

.wordcloud-card.wc-skin-sol .wc-columns { grid-template-columns: 1fr; }
.wordcloud-card.wc-skin-sol .wc-neg-title,
.wordcloud-card.wc-skin-sol .wc-group:last-child { display: none; }
.wordcloud-card.wc-skin-sol .wc-pos-title { display: none; }
.wordcloud-card.wc-skin-sol #wcPositive {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0.2em 0.65em;
    padding: 18px 8px 22px;
}
.wordcloud-card.wc-skin-sol .wordcloud__word {
    font-family: var(--font-serif);
    font-size: var(--size);
    font-weight: var(--weight);
    line-height: 1.05;
    color: var(--ink);
}
.wordcloud-card.wc-skin-sol .wordcloud__word[data-sentiment="positive"] { color: var(--success); }
.wordcloud-card.wc-skin-sol .wordcloud__word[data-sentiment="negative"] { color: var(--danger); }

.ranking-header-v2 > :nth-child(2) { padding-left: 50px; }

.ranking-table .muted {
    color: var(--ink-muted);
    font-weight: 600;
}

.coverage-fold { cursor: default; }
.coverage-fold > summary {
    list-style: none;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    cursor: pointer;
}
.coverage-fold > summary::-webkit-details-marker { display: none; }
.coverage-fold > summary::before {
    content: '▸';
    color: var(--accent);
    font-size: 12px;
}
.coverage-fold[open] > summary::before { content: '▾'; }
.coverage-count {
    font-size: 12.5px;
    color: var(--ink-light);
    font-weight: 600;
}
.coverage-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.coverage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--paper);
    color: inherit;
    text-decoration: none;
}
.coverage-item:hover { border-color: var(--border); background: var(--paper-warm); }
.coverage-name {
    font-weight: 600;
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.coverage-meta {
    margin-left: auto;
    font-size: 11px;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

.cloud-term { gap: 7px; }
.cloud-term .cloud-count {
    font-size: 0.55em;
    font-weight: 500;
    color: var(--ink-muted);
    vertical-align: super;
}

/* Ocultar cards */
.card-hide-btn {
    background: none; border: none; cursor: pointer; opacity: .45;
    font-size: 16px; padding: 6px 8px; border-radius: 8px; margin-left: auto;
    min-width: 36px; min-height: 36px;
    transition: opacity .15s, background .15s; line-height: 1; color: inherit;
    flex: 0 0 auto;
}
.card-hide-btn:hover { opacity: 1; background: rgba(255,255,255,.08); }
#hiddenCardsPill {
    position: fixed; bottom: 16px; right: 16px; z-index: 999;
    display: none; align-items: center; gap: 10px;
    background: rgba(10,14,28,.94); border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px; padding: 9px 10px 9px 16px; font-size: 12.5px; color: #94a3b8;
    backdrop-filter: blur(10px); box-shadow: 0 8px 28px rgba(0,0,0,.45);
    max-width: calc(100vw - 32px);
}
#hiddenCardsPill button {
    background: #f97316; color: #fff; border: none; border-radius: 999px;
    padding: 6px 14px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
#hiddenCardsPill button:hover { background: #ea580c; }

/* Barra de plantillas (Todo / Sol / Grok / Personalizado) */
#templateBar {
    position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
    z-index: 999; display: flex; align-items: center; gap: 6px;
    background: rgba(10,14,28,.94); border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px; padding: 8px 14px; font-size: 12.5px; color: #94a3b8;
    backdrop-filter: blur(10px); box-shadow: 0 8px 28px rgba(0,0,0,.45);
    max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center;
}
#templateBar .tpl-label { font-weight: 700; color: #cbd5e1; white-space: nowrap; }
#templateBar .tpl-btn {
    background: rgba(255,255,255,.06); color: #cbd5e1; border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
    white-space: nowrap; transition: background .15s, border-color .15s;
}
#templateBar .tpl-btn:hover { background: rgba(255,255,255,.12); }
#templateBar .tpl-btn.active { background: #f97316; border-color: #f97316; color: #fff; }
#templateBar .tpl-status { font-size: 11.5px; color: #64748b; white-space: nowrap; }

.rank-meta {
    margin: 8px 0 0;
    color: var(--ink-muted);
    font-size: 13px;
}
.rank-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}
.rank-filter {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--paper);
    color: var(--ink-muted);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
}
.rank-filter:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.rank-filter.is-on {
    color: var(--ink);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--paper));
}
.cmp-pending {
    margin: 8px 0 28px;
    color: var(--ink-muted);
    font-size: 13px;
}


/* --- Modo publico (2026-09-11) -----------------------------------------
   Solo se muestran: sentimiento (hero), estadisticas de genero y temas.
   El resto de las tarjetas y los capitulos 03/04 siguen en el HTML y en la
   API, pero no se renderizan. Para volver al dashboard completo: quite la
   clase `publico-min` del <body> de frontend/index.html (o borre este bloque).
   ---------------------------------------------------------------------- */
body.publico-min #periodCard,
body.publico-min #historyCard,
body.publico-min #card-concentration,
body.publico-min #card-rejection,
body.publico-min #card-breakout,
body.publico-min #card-wordcloud,
body.publico-min #card-opposition,
body.publico-min #card-mobility,
body.publico-min #card-owngoals,
body.publico-min #card-decay,
body.publico-min #climateCard,
body.publico-min #cap03,
body.publico-min #cap04 {
    display: none !important;
}
