* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

/* ── GeaIQ design tokens ─────────────────────────────── */
:root {
    --gea-ink: #05070B;
    --gea-surface: #0A0E14;
    --gea-panel: #0F141C;
    --gea-panel-2: #131923;
    --gea-line: rgba(255, 255, 255, .06);
    --gea-line-2: rgba(255, 255, 255, .04);
    --gea-celeste: #4FC3F7;
    --gea-turquesa: #14E0C4;
    --gea-naranja: #FF7A29;
    --kpi-cyan: #00BFFF;
    --kpi-yellow: #FFD83D;
    --kpi-green: #21D959;
    --kpi-red: #E84855;
    --kpi-orange: #FF9A3C;
    --kpi-violet: #8B5CF6;
    --t-primary: #E6EAF1;
    --t-secondary: #C6CBD4;
    --t-muted: #98A2B3;
    --t-faint: #6B7280;
    /* Categoría por defecto (cards de series). Se sobrescribe por .cat-* */
    --cat: #14E0C4;
    --cat-soft: rgba(20, 224, 196, .25);
}

/* Categorías semánticas · cambian el color de valores, íconos y blob */
.apple-widget.cat-demo {
    --cat: #8B5CF6;
    --cat-soft: rgba(139, 92, 246, .28);
}

.apple-widget.cat-economia {
    --cat: #21D959;
    --cat-soft: rgba(33, 217, 89, .28);
}

.apple-widget.cat-educacion {
    --cat: #4FC3F7;
    --cat-soft: rgba(79, 195, 247, .28);
}

.apple-widget.cat-infra {
    --cat: #14E0C4;
    --cat-soft: rgba(20, 224, 196, .28);
}

.apple-widget.cat-temporal {
    --cat: #14E0C4;
    --cat-soft: rgba(20, 224, 196, .28);
}

body {
    background: var(--gea-ink);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    gap: 20px;
    padding: 32px 20px 20px;
    color: var(--t-primary);
    -webkit-font-smoothing: antialiased;
}

/* ── Modal backdrop ─────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* ── Widget container ──────────────────────────────── */
.apple-widget {
    background: linear-gradient(180deg, #141d29 0%, #131f33 100%);
    border: 1px solid var(--gea-line);
    width: 280px;
    height: 280px;
    border-radius: 18px;
    display: flex;
    flex-direction: row;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), border 0.4s ease;
    flex-shrink: 0;
    container-type: inline-size;
    container-name: widget;
}

.apple-widget:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.apple-widget.expanded {
    width: 560px;
}

/* ── Card gradient blob ─────────────────────────────── */
.apple-widget .card-gradient {
    position: absolute;
    bottom: 0;
    right: 0;
    transform: translate(50%, 50%);
    width: 500px;
    height: 500px;
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    filter: blur(50px);
}

.apple-widget .card-gradient.up {
    background: radial-gradient(circle, rgba(33, 217, 89, 0.30) 0%, rgba(33, 217, 89, 0) 70%);
}

.apple-widget .card-gradient.down {
    background: radial-gradient(circle, rgba(232, 72, 85, 0.30) 0%, rgba(232, 72, 85, 0) 70%);
    animation: pulse-opacity 1s infinite ease-in-out;
}

.apple-widget .card-gradient.neutral {
    background: radial-gradient(circle, rgba(79, 195, 247, 0.30) 0%, rgba(79, 195, 247, 0) 70%);
}

.apple-widget .card-gradient.cat {
    background: radial-gradient(circle, var(--cat-soft) 0%, rgba(0, 0, 0, 0) 70%);
    width: 260px;
    height: 260px;
    opacity: 0.55;
}

@keyframes pulse-opacity {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ── Content column ─────────────────────────────────── */
.content-col {
    width: 280px;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 16px;
    gap: 8px;
    padding: 10px 16px 6px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ── Map column (expanded panel) ────────────────────── */
.map-col {
    flex: 1;
    min-width: 0;
    height: 100%;
    border-left: 1px dashed rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    padding: 10px 16px 6px;
    gap: 6px;
    position: relative;
    overflow: hidden;
    font-size: 16px;
}

.map-col .map-label {
    font-size: 0.64em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.map-zones {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-zones svg {
    width: 100%;
    flex: 1;
    min-height: 0;
}

.map-zones .province-bg {
    fill: rgba(10, 14, 20, 0.65);
    stroke: rgba(79, 195, 247, 0.18);
    stroke-width: 1.5;
}

.map-zones .zone {
    fill: rgba(255, 255, 255, 0.05);
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 1;
    transition: fill 0.2s ease;
}

.map-zones .zone:hover {
    fill: rgba(255, 255, 255, 0.12);
}

.map-zones .zone.highlighted {
    fill: rgba(20, 224, 196, 0.28);
    stroke: var(--gea-turquesa);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 4px rgba(20, 224, 196, 0.45));
}

.zone-legend {
    display: flex;
    gap: 10px;
    font-size: 0.64em;
    color: rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}

.zone-legend span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.zone-legend .dot {
    width: 6px;
    height: 6px;
    border-radius: 1px;
    flex-shrink: 0;
}

.zone-legend .dot.highlighted {
    background: var(--gea-turquesa);
    box-shadow: 0 0 3px rgba(20, 224, 196, 0.5);
}

.zone-legend .dot.normal {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

/* ── Toggle map ↔ selection list ────────────────────── */
.apple-widget.sel-active .map-zones {
    display: none;
}

.apple-widget.sel-active .sel-list {
    display: flex;
    justify-content: space-evenly;
}

/* ── Selection list ─────────────────────────────────── */
.sel-list {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 8px;
}

.sel-item:last-child {
    border-bottom: none;
}

.sel-info {
    flex: 1;
    min-width: 0;
}

.sel-name {
    display: block;
    font-size: 0.86em;
    font-weight: 600;
    color: var(--t-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sel-prov {
    display: block;
    font-size: 0.71em;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 1px;
}

.sel-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sel-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    min-width: 46px;
}

.chip {
    font-size: 0.5em;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

.chip-alto {
    background: rgba(33, 217, 89, 0.14);
    color: var(--kpi-green);
    border: 1px solid rgba(33, 217, 89, 0.3);
}

.chip-medio {
    background: rgba(255, 154, 60, 0.14);
    color: var(--kpi-orange);
    border: 1px solid rgba(255, 154, 60, 0.3);
}

.chip-bajo {
    background: rgba(232, 72, 85, 0.14);
    color: var(--kpi-red);
    border: 1px solid rgba(232, 72, 85, 0.3);
}

.sel-rank {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.57em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.28);
}

.sel-vals {
    font-family: 'Space Grotesk', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.sel-val {
    font-size: 1em;
    font-weight: 500;
    color: var(--t-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.sel-pct {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.71em;
    font-weight: 600;
    line-height: 1;
}

.sel-pct.pos {
    color: var(--kpi-green);
}

.sel-pct.neg {
    color: var(--kpi-red);
}

.fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s;
}

.fullscreen-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.fullscreen-btn .material-symbols-outlined {
    font-size: 20px;
}

/* ── Expand arrow ───────────────────────────────────── */
.expand-arrow {
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 20;
    cursor: pointer;
}

.expand-arrow .material-symbols-outlined {
    font-size: 20px;
    transition: transform 0.35s ease;
}

.apple-widget:hover .expand-arrow {
    opacity: 0.5;
}

.apple-widget .expand-arrow:hover {
    opacity: 1 !important;
}

.apple-widget.expanded .expand-arrow {
    opacity: 1;
}

.apple-widget.expanded .expand-arrow .material-symbols-outlined {
    transform: rotate(180deg);
}

.apple-widget.fullscreen .expand-arrow {
    display: none;
}

/* ── Rich chart (solo en fullscreen en mini-cards) ─────────── */
.rich-chart {
    position: absolute;
    inset: 0;
    display: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.rich-chart svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.apple-widget.fullscreen.mini-card .mini-chart-svg,
.apple-widget.fullscreen.mini-card .mini-chart-labels {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.apple-widget.fullscreen.mini-card .rich-chart {
    display: block;
}

.apple-widget.fullscreen.mini-card .rich-chart.visible {
    opacity: 1;
}

.rich-grid-line {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.rich-axis-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    fill: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.rich-axis-label.month {
    fill: rgba(255, 255, 255, 0.7);
}

.rich-y-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 500;
    fill: rgba(255, 255, 255, 0.5);
    text-anchor: end;
}

.apple-widget.fullscreen .content-col {
    width: 50%;
    height: 100%;
}

.apple-widget.fullscreen .map-col {
    flex: 1;
    height: 100%;
}

/* ── Container queries (wide widget ≥ 520px) ───────── */
@container widget (min-width: 570px) {

    /* Medida madre: bump del root — todo lo interno escala solo via em */
    .content-col,
    .map-col,
    .menu-btn,
    .fullscreen-btn,
    .card-icon-btn {
        font-size: 18px;
        padding: 20px 32px;
    }

    .footer-left {
        height: 24px !important;
    }

    /* chart con aspect-ratio fijo para no explotar en vista wide */
    .card-body {
        max-height: 80%;
    }

    .chart-wrap {
        flex: none;
        aspect-ratio: 3 / 1;
    }

    .cmp-btn {
        padding: 10px 14px !important;
    }

    /* sel-list: más aire entre items */
    .sel-item {
        padding: 11px 0;
    }

    .cluster-badge {
        bottom: 22px !important;
        right: 36px !important;
    }

    .cs-dot.active {
        padding: 8px !important;
        font-size: 0.45em !important;
    }
}

/* ── Card Header ───────────────────────────────────── */
.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.card-header>.material-symbols-outlined {
    font-size: 2em;
    color: rgba(255, 255, 255, 0.80);
    flex-shrink: 0;
}

.card-header .title-wrapper {
    flex: 1;
    overflow: hidden;
    margin-right: 16px;
}

.card-header .text-line {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    line-height: 1rem;
}

.card-header .text-line .text-content {
    display: inline-block;
    white-space: nowrap;
    will-change: transform;
    transition: transform 0.4s ease-out;
    transform: translateX(0);
}

.card-header .title {
    font-size: 1em;
    font-weight: 600;
    color: #f3f4f6;
}

.card-header .subtitle {
    font-size: 0.79em;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 1px;
}

.menu-btn {
    position: absolute;
    top: -4px;
    right: -8px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.menu-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.menu-btn .material-symbols-outlined {
    font-size: 1.29em;
}

.dropdown-menu {
    position: absolute;
    top: 22px;
    right: -8px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 0;
    min-width: 160px;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu button {
    width: 100%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 6px 10px;
    font-size: 0.79em;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.dropdown-menu button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f3f4f6;
}

/* ── Card Body ──────────────────────────────────────── */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
}

.card-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cmp-display {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
}

.cmp-pct {
    display: flex;
    align-items: baseline;
    gap: 3px;
    line-height: 1;
    justify-content: center;
}

.v-primary {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2em;
    font-weight: 700;
    color: rgb(0 194 255);
    letter-spacing: -0.02em;
}

.v-op {
    font-size: 0.93em;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
}

.v-secondary {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.29em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: -0.02em;
}

.cmp-abs {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
    justify-content: center;
}

.v-abs-primary {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.79em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
}

.v-abs-sep {
    font-size: 0.79em;
    color: rgba(255, 255, 255, 0.25);
}

.v-abs-secondary {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.79em;
    color: rgba(255, 255, 255, 0.40);
}

.chart-wrap {
    flex: 1;
    min-height: 0;
}

#chart {
    width: 100%;
    height: 100%;
    touch-action: none;
    overflow: visible;
}

/* Transitions activas solo al cambiar comparador (no durante drag) */
#chart.anim path {
    transition: d 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

#chart.anim line {
    transition: x1 0.45s cubic-bezier(0.4, 0, 0.2, 1),
        x2 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

#chart.anim circle {
    transition: cx 0.45s cubic-bezier(0.4, 0, 0.2, 1),
        cy 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

#chart.anim text {
    transition: x 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.drag-handle {
    cursor: ew-resize;
}

/* ── Comparison buttons ─────────────────────────────── */
.card-right {
    display: flex;
    flex-direction: row;
    gap: 5px;
    flex-shrink: 0;
}

.cmp-btn {
    flex: 1;
    font-size: inherit;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
}

.cmp-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.cmp-btn.active {
    background: rgb(50 160 215 / 10%);
    border-color: rgb(50 159 215 / 40%);
}

.cmp-btn-label {
    font-size: 0.57em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.35);
    line-height: 1;
}

.cmp-btn-val {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.86em;
    font-weight: 700;
    color: #9ca3af;
    line-height: 1;
    margin-top: 2px;
    display: flex;
    align-items: baseline;
    gap: 1px;
}

.cmp-btn-val .rk-a {
    font-weight: 700;
    font-size: 1em;
    font-family: 'Space Grotesk', sans-serif;
}

.cmp-btn-val .rk-sep {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.75em;
    opacity: 0.6;
}

.cmp-btn-val .rk-b {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.75em;
    opacity: 0.7;
}

.cmp-btn.active .cmp-btn-label {
    color: rgb(50 168 215 / 75%);
}

.cmp-btn.active .cmp-btn-val {
    color: #32a8d7;
}

/* ── Cluster badge en map-col ──────────────────────── */
.cluster-badge {
    position: absolute;
    bottom: 11px;
    right: 10px;
    border-radius: 8px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}

.apple-widget.pais-active .cluster-badge {
    opacity: 1;
    transform: translateY(0);
}

.cluster-badge-label {
    font-size: 0.5em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1;
}

.cluster-badge-name {
    font-size: 0.79em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1;
}

/* ── Cluster semaforo ───────────────────────────────── */
.cluster-semaforo {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    flex-direction: column;
}

.cs-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.38;
    transition: all 0.3s ease;
}

.cs-dot.active {
    border-radius: 16px;
    white-space: nowrap;
    padding: 3px;
    width: min-content;
    height: 16px;
    opacity: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65em;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    color: rgb(32 42 60);
    letter-spacing: -0.03em;
    line-height: 1;
}

/* ── Period + footer ────────────────────────────────── */
.period-range {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.71em;
    font-style: italic;
    color: rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
    align-self: flex-start;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    height: 18px;
}

.footer-left {
    display: flex;
    align-items: center;
    height: 13px;
    cursor: pointer;
    transition: filter 0.2s;
}

.footer-left:hover {
    filter: brightness(1.4);
}

.footer-left img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.gea-logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--t-secondary);
    line-height: 1;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.gea-logo b {
    font-weight: 600;
    color: var(--gea-celeste);
    margin-left: 1px;
}

.card-icon-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.card-icon-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

.card-icon-btn .material-symbols-outlined {
    font-size: 1.14em;
}

/* ── Alert badges ──────────────────────────────────── */
.alert-badge {
    position: absolute;
    left: 16px;
    top: 0px;
    width: 14px;
    border-radius: 0 0 2px 2px;
    height: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: pulse-opacity .7s infinite ease-in-out;
    transition: height .4s ease;
}

.alert-badge:hover {
    height: 10px;
}

.alert-badge+.alert-badge {
    left: 36px;
    animation-delay: 0.5s;
}

.alert-badge.alert-red {
    background: #FF453A;
    box-shadow: 0 0 10px 2px #FF453Aff;
}

.alert-badge.alert-yellow {
    background: #FFD60A;
    box-shadow: 0 0 10px 2px #FFD60Aff;
}

/* ── Single-time-data display ──────────────────────── */
.sd-val-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    justify-content: center;
}

.sd-pos-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    justify-content: center;
}

.sd-abs-val {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.36em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: -0.01em;
    line-height: 1;
}

.sd-rank {
    display: flex;
    align-items: baseline;
    gap: 1px;
    line-height: 1;
}

.sd-rank-a {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.57em;
    font-weight: 700;
    color: rgb(0 194 255);
    letter-spacing: -0.04em;
    line-height: 0.9;
}

.sd-rank-sep {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.71em;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.25);
    margin: 0 3px;
    align-self: end;
}

.sd-rank-b {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.43em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: -0.02em;
    align-self: flex-end;
    margin-bottom: 3px;
}

.sd-section-label {
    font-size: 0.64em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.25);
    line-height: 1;
}

.sd-pct-val {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.86em;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.01em;
}

.sd-bars {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: visible;
}

/* ── Card menu: navigation path ────────────────────── */
.dm-path {
    display: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.22);
}

.dm-path-item {
    padding: 6px 10px;
    font-size: 0.72em;
    color: rgb(50 168 215 / 80%);
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.dm-path-item:hover {
    background: rgba(255, 255, 255, 0.05);
    text-decoration: underline;
}

.dm-path-item:last-child {
    color: rgba(255, 255, 255, 0.25);
    pointer-events: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: none;
    font-size: 0.65em;
}

/* ── Card menu: list ────────────────────────────────── */
.dm-list {
    padding: 4px 0;
}

.dm-item {
    width: 100%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 6px 10px;
    font-size: 0.79em;
    font-family: 'Inter', sans-serif;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
    box-sizing: border-box;
}

.dm-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f3f4f6;
}

.dm-item.dm-filter {
    color: rgb(50 168 215 / 90%);
    font-weight: 600;
}

.dm-item.dm-filter:hover {
    background: rgba(50, 168, 215, 0.08);
}

.dm-item.dm-danger {
    color: rgba(255, 69, 58, 0.75);
    margin-top: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0 0 4px 4px;
}

.dm-item.dm-danger:hover {
    background: rgba(255, 70, 58, 0.1);
    color: #FF453A;
}

.dm-arrow {
    width: 5px;
    height: 5px;
    border-top: 1.5px solid rgba(255, 255, 255, 0.25);
    border-right: 1.5px solid rgba(255, 255, 255, 0.25);
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-left: 8px;
}

.dm-item.dm-filter .dm-arrow {
    border-color: rgb(50 168 215 / 55%);
}

.dm-item.dm-back {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.75em;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    margin-bottom: 2px;
}

.dm-item.dm-back:hover {
    color: rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.06);
}

.dm-item.dm-back span::before {
    content: '← ';
}

/* ── Info Popup ─────────────────────────────────────── */
.info-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 9000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.info-popup-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.info-popup {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    padding: 18px 22px;
    width: 100%;
    max-width: 420px;
    position: relative;
    color: #333;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.info-popup-overlay.visible .info-popup {
    transform: translateY(0);
    opacity: 1;
}

.info-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.info-popup-title {
    font-size: 1rem;
    font-weight: 800;
    color: #111;
    line-height: 1.3;
    padding-right: 12px;
}

.info-popup-subtitle {
    font-size: 0.78rem;
    color: #888;
    margin-top: 3px;
    padding-right: 12px;
}

.info-popup-close {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #111;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.25s ease, background 0.2s ease;
}

.info-popup-close .material-symbols-outlined {
    color: #fff;
    font-size: 16px;
}

.info-popup-close:hover {
    transform: rotate(180deg);
    background: #333;
}

.info-popup-divider {
    border: none;
    border-top: 1px solid #ebebeb;
    margin: 12px 0;
}

.info-popup-body {
    font-size: 0.85rem;
    line-height: 1.65;
    color: #555;
}

/* ── Page header / view selector ──────────────────────── */
.page-header {
    width: 100%;
    display: flex;
    justify-content: center;
}

.view-selector {
    position: relative;
}

.vs-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px 12px 8px 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: 'Inter', sans-serif;
    min-width: 250px;
}

.vs-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.vs-trigger-icon {
    font-size: 18px !important;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.vs-trigger-label {
    flex: 1;
    text-align: left;
}

.vs-chevron {
    font-size: 18px !important;
    color: rgba(255, 255, 255, 0.35);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.view-selector.open .vs-chevron {
    transform: rotate(180deg);
}

.vs-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    overflow: hidden;
    min-width: 292px;
    z-index: 200;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-6px);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    padding-bottom: 6px;
}

.vs-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.vs-group-label {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(255, 255, 255, 0.23);
    padding: 10px 12px 3px;
}

.vs-item {
    width: 100%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.84rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.12s;
    text-align: left;
}

.vs-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #f3f4f6;
}

.vs-item.active {
    background: rgba(79, 195, 247, 0.1);
    color: var(--gea-celeste);
}

.vs-item .material-symbols-outlined {
    font-size: 17px !important;
    opacity: 0.65;
    flex-shrink: 0;
    font-variation-settings: 'FILL' 1;
}

.vs-item.active .material-symbols-outlined {
    opacity: 1;
}

.vs-item-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
}

.vs-item-sub {
    font-size: 0.78em;
    opacity: 0.5;
}

.vs-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    margin: 4px 10px;
}

/* ── Gradient variants ─────────────────────────────────── */
.apple-widget .card-gradient.demo {
    background: radial-gradient(circle, rgba(14, 165, 233, 0.5) 0%, rgba(14, 165, 233, 0) 70%);
}

.apple-widget .card-gradient.edu {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.55) 0%, rgba(139, 92, 246, 0) 70%);
}

.apple-widget .card-gradient.inf {
    background: radial-gradient(circle, rgba(245, 158, 11, 0.5) 0%, rgba(245, 158, 11, 0) 70%);
}

/* ── Stat card ─────────────────────────────────────────── */
.apple-widget.stat-card .content-col {
    width: 100%;
}

.apple-widget.stat-card .card-gradient {
    opacity: 0.45;
}

.stat-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    min-height: 0;
    text-align: center;
}

.stat-icon {
    display: none;
}

.stat-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 3.5em;
    font-weight: 500;
    color: var(--cat);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-top: 0;
}

.stat-label {
    font-size: 0.75em;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.02em;
    margin-top: 6px;
}

/* ── Mini-widget (barras / líneas / dona) ─────────────────────────── */
.apple-widget.mini-card .content-col {
    width: 100%;
}

.apple-widget .card-gradient.donut {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, rgba(139, 92, 246, 0) 70%);
}

.mini-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    min-height: 0;
}

/* KPI: arrow + big number */
.mini-kpi {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

.mini-kpi-arrow {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.2em;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.04em;
}

.mini-kpi-arrow.up {
    color: #21D959;
}

.mini-kpi-arrow.down {
    color: #E84855;
}

.mini-kpi-arrow.flat {
    color: #9ca3af;
}

.mini-kpi-val {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.6em;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.04em;
    line-height: 1;
}

.mini-kpi-delta {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
    align-self: flex-end;
    padding-bottom: 0.12em;
    color: #9ca3af;
}

.mini-kpi-delta.up {
    color: #21D959;
}

.mini-kpi-delta.down {
    color: #E84855;
}

.mini-chart-wrap {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.mini-chart-svg {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.mini-chart-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.58em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
}

.mini-chart-labels span {
    flex: 1;
    text-align: center;
}

.mini-chart-labels.absolute {
    position: relative;
    display: block;
    height: 10px;
}

.mini-chart-labels.absolute span {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    white-space: nowrap;
    flex: none;
    text-align: center;
}

.mini-chart-labels.absolute span.edge-start {
    transform: translateX(0);
}

.mini-chart-labels.absolute span.edge-end {
    transform: translateX(-100%);
}

.mini-chart-labels.absolute span.month {
    color: rgba(255, 255, 255, 0.55);
}

/* Bars: hover sutil */
.mini-bar {
    transition: opacity 0.2s ease;
}

.mini-bar:hover {
    opacity: 0.8;
}

/* Donut layout */
.mini-donut-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.mini-donut-svg {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mini-donut-center {
    text-anchor: middle;
    dominant-baseline: central;
}

.mini-donut-center-val {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    fill: #fff;
    letter-spacing: -0.03em;
}

.mini-donut-center-lbl {
    font-family: 'Inter', sans-serif;
    font-size: 8px;
    font-weight: 600;
    fill: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.mini-donut-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.mini-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78em;
    transition: opacity 0.2s ease;
}

.mini-legend-item:hover {
    opacity: 0.75;
}

.mini-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.mini-legend-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mini-legend-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.82em;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-legend-val {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.86em;
    font-weight: 600;
    color: #fff;
}

/* ── Mini-card fullscreen: 2 columnas (KPI | chart) ───────
           Activa en:
           · Landscape con altura limitada (celular apaisado, ventana corta)
           · Portrait mobile (pantalla angosta)                            */
@media (orientation: landscape) and (max-height: 500px),
(orientation: portrait) and (max-width: 640px) {

    .apple-widget.fullscreen.mini-card .mini-body {
        /*flex-direction: row;*/
        align-items: center;
        gap: 24px;
        max-height: 70%;
    }

    /* Columna izquierda: KPI en vertical */
    .apple-widget.fullscreen.mini-card .mini-kpi {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        flex-shrink: 0;
        width: min(30%, 180px);
    }

    .apple-widget.fullscreen.mini-card .mini-kpi-arrow {
        font-size: 1.8em;
    }

    .apple-widget.fullscreen.mini-card .mini-kpi-val {
        font-size: 2.4em;
    }

    .apple-widget.fullscreen.mini-card .mini-kpi-delta {
        align-self: center;
        padding-bottom: 0;
        font-size: 0.95em;
        text-align: center;
    }

    /* Columna derecha: chart ocupa todo el alto disponible */
    .apple-widget.fullscreen.mini-card .mini-chart-wrap {
        flex: 1;
        min-width: 0;
    }

    /* En landscape corto, reducir padding del content-col
               para darle más espacio al chart */
    @media (max-height: 500px) {
        .apple-widget.fullscreen.mini-card .content-col {
            padding: 10px 16px 6px !important;
            font-size: 16px !important;
        }
    }
}

/* ── Donut fullscreen · landscape ──────────────────────── */
.apple-widget.fullscreen .mini-donut-wrap {
    gap: 40px;
    justify-content: center;
}

.apple-widget.fullscreen .mini-donut-svg {
    width: min(50vh, 44vw);
    height: min(50vh, 44vw);
}

.apple-widget.fullscreen .mini-donut-legend {
    gap: 18px;
    max-width: 260px;
}

.apple-widget.fullscreen .mini-legend-item {
    font-size: 1em;
    gap: 12px;
}

.apple-widget.fullscreen .mini-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.apple-widget.fullscreen .mini-legend-val {
    font-size: 1.15em;
}

/* ── Donut fullscreen · portrait / mobile ──────────────── */
@media (orientation: portrait) {
    .apple-widget.fullscreen .mini-donut-wrap {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }

    .apple-widget.fullscreen .mini-donut-svg {
        width: min(72vw, 42vh);
        height: min(72vw, 42vh);
    }

    .apple-widget.fullscreen .mini-donut-legend {
        max-width: 300px;
        width: 100%;
        gap: 14px;
    }
}

/* ── Tooltip global ─────────────────────────────────────────────── */
.chart-tooltip {
    position: fixed;
    background: rgba(10, 14, 20, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 9px;
    padding: 9px 13px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, visibility 0.12s ease;
    z-index: 9999;
    min-width: 110px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
}

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

.tt-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 5px;
}

.tt-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    line-height: 1.1;
}

.tt-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tt-name {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    flex: 1;
}

.tt-val {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: #e6eaf1;
}

.tt-unit {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 2px;
}

/* ── Bullet chart ─────────────────────────────────────────── */
.bullet-chart-svg {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.apple-widget.fullscreen .bullet-chart-svg {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* ── Heatmap chart ────────────────────────────────────────────── */
.heatmap-chart-svg {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.apple-widget.fullscreen .heatmap-chart-svg {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* ── Gauge chart ──────────────────────────────────────────────── */
.gauge-chart-svg {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.apple-widget.fullscreen .gauge-chart-svg {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* ── Scatter chart ────────────────────────────────────────────── */
.scatter-chart-svg {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.apple-widget.fullscreen .scatter-chart-svg {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* ── Treemap chart ────────────────────────────────────────────── */
.treemap-chart-svg {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.apple-widget.fullscreen .treemap-chart-svg {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* ── Beeswarm chart ───────────────────────────────────────────── */
.beeswarm-chart-svg {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.apple-widget.fullscreen .beeswarm-chart-svg {
    opacity: 0;
    transition: opacity 0.25s ease;
}

/* ── Pyramid chart ────────────────────────────────────────────── */
.pyramid-chart-svg {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.apple-widget.fullscreen .pyramid-chart-svg {
    opacity: 0;
    transition: opacity 0.25s ease;
}