/* ═══════════════════════════════════════════════════════════════
   MetaPro Academy — App CSS
   Paleta: Dorado #D4A017 / #EAB308, Negro #0A0A0A, Carbón #111111
   Mobile-first, texto grande para accesibilidad
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
    --gold:         #FFC233;
    --gold-bright:  #FFD95A;
    --gold-dim:     rgba(255,194,51,0.20);
    --gold-border:  rgba(255,194,51,0.55);
    --black:        #0A0E1F;
    --dark:         #060811;
    --card:         #151B36;
    --card2:        #1F2648;
    --border:       #2D3563;
    --border2:      #3E4782;
    --text:         #FFFFFF;
    --text-2:       #CDD1EE;
    --text-3:       #FFFFFF;
    --bull:         #2ED573;
    --bear:         #FF4757;
    --accum:        #22D3EE;
    --dist:         #FACC15;
    --range:        #94A3B8;
    --radius:       16px;
    --radius-sm:    10px;
    --nav-height:   52px;
    --safe-bottom:  env(safe-area-inset-bottom, 0px);
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--dark);  /* iguala color del nav — cubre cualquier gap iOS */
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    font-size: 16px;
}

button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
a      { color: inherit; text-decoration: none; }

/* ── Splash / Loading screen ───────────────────────────────────────────── */
#splash {
    position: fixed; inset: 0; z-index: 1000;
    background: var(--black);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 24px;
    transition: opacity 0.5s ease;
}
#splash.hidden { opacity: 0; pointer-events: none; }

.splash-logo {
    width: 160px; height: 160px;
    object-fit: contain;
    animation: splashReveal 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
}

@keyframes splashReveal {
    0%   { opacity: 0; transform: scale(0.7); }
    60%  { opacity: 1; transform: scale(1.04); }
    100% { opacity: 1; transform: scale(1); }
}

.splash-bar {
    width: 180px; height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}
.splash-bar__fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
    border-radius: 2px;
    animation: splashLoad 1.8s ease-out forwards;
}
@keyframes splashLoad { to { width: 100%; } }

/* ── Layout principal ──────────────────────────────────────────────────── */
#app {
    display: flex; flex-direction: column;
    height: -webkit-fill-available;  /* fallback iOS Safari */
    height: 100dvh;
    overflow: hidden;
    background: var(--black);
}

/* ── Header ────────────────────────────────────────────────────────────── */
.app-header {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(12px + env(safe-area-inset-top)) 20px 12px 16px;
    background: var(--dark);
    border-bottom: 1px solid var(--border);
    min-height: calc(60px + env(safe-area-inset-top));
}

.header-logo {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;  /* permite que header-logo se comprima y el marquee respire */
    flex-shrink: 1;
}
.header-logo img {
    height: 36px; width: auto; object-fit: contain;
    flex-shrink: 0;
}

/* ── Marquee de anuncios ─────────────────────────────────────────────── */
.app-marquee {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    margin: 0 10px 0 14px;
    position: relative;
    /* Fundido en píxeles (no %) — garantiza separación clara del avatar en la
       izquierda aunque el marquee sea estrecho. 16px invisibles + 34px de
       fundido = zona segura de 50px antes de que el texto sea 100% visible. */
    mask-image: linear-gradient(90deg,
        transparent 0,
        transparent 16px,
        #000 50px,
        #000 calc(100% - 18px),
        transparent 100%);
    -webkit-mask-image: linear-gradient(90deg,
        transparent 0,
        transparent 16px,
        #000 50px,
        #000 calc(100% - 18px),
        transparent 100%);
}
.app-marquee__inner {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: app-marquee-scroll 24s linear infinite;
    will-change: transform;
}
.app-marquee__text {
    color: var(--gold);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}
.app-marquee__text a {
    color: var(--gold);
    text-decoration: underline;
    text-underline-offset: 2px;
}
@keyframes app-marquee-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-100%); }
}
@media (prefers-reduced-motion: reduce) {
    .app-marquee__inner { animation: none; padding-left: 0; }
}
.header-logo__name {
    font-size: 1rem; font-weight: 900;
    color: var(--gold); letter-spacing: 0.05em;
    text-transform: uppercase;
}

.header-actions { display: flex; align-items: center; gap: 12px; }

.header-push-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border2);
    background: var(--card);
    transition: all 0.2s;
    position: relative;
}
.header-push-btn:active { transform: scale(0.92); }
.header-push-btn.push-active {
    border-color: var(--gold-border);
    background: var(--gold-dim);
    color: var(--gold);
}

/* ── Contenido scrollable ──────────────────────────────────────────────── */
.page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* nav está en el flujo normal — no necesita compensar su altura */
    padding: 16px 16px 24px;
}

/* ── Bottom nav ────────────────────────────────────────────────────────── */
/*
 * SIN position:fixed. El nav es el último hijo flex de #app (flex-column).
 * #app tiene height:100dvh que ya incluye el área física completa.
 * El nav se pega al fondo naturalmente sin ningún env() en posicionamiento.
 */
.bottom-nav {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--dark);
    border-top: 1px solid var(--border);
    /* Sin position:fixed, sin bottom, sin z-index */
}

.bottom-nav__items {
    display: flex;
    align-items: stretch;
    height: var(--nav-height);
}

/* Rellena el home indicator debajo de los items */
.bottom-nav__safe {
    height: env(safe-area-inset-bottom, 0px);
}

.nav-safe-fill { display: none; }

.nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    color: var(--text-3);
    font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.2s;
    position: relative;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active {
    color: var(--gold);
}
.nav-item.active::before {
    content: '';
    position: absolute; top: 0; left: 20%; right: 20%;
    height: 2px;
    background: var(--gold);
    border-radius: 0 0 2px 2px;
}

/* ══════════════════════════════════════════════════════════════
   SECCIÓN: RANGOS
   ══════════════════════════════════════════════════════════════ */

/* ── Selector de pares ─────────────────────────────────────────────────── */
.pair-scroller {
    display: flex; gap: 8px;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px;
    padding: 4px 16px 12px;
}
.pair-scroller::-webkit-scrollbar { display: none; }

.pair-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 99px;
    border: 1px solid var(--border2);
    background: var(--card);
    color: var(--text-2);
    font-size: 0.9rem; font-weight: 700;
    transition: all 0.18s;
    white-space: nowrap;
}
.pair-tab:active       { transform: scale(0.94); }
.pair-tab--active {
    border-color: var(--gold-border);
    background: var(--gold-dim);
    color: var(--gold);
}

/* ── Hero precio ───────────────────────────────────────────────────────── */
.price-hero {
    text-align: center;
    padding: 20px 0 16px;
}
.price-hero__symbol {
    font-size: 2rem; color: var(--gold); line-height: 1;
}
.price-hero__pair {
    font-size: 0.85rem; font-weight: 700; color: var(--text-2);
    letter-spacing: 0.08em; text-transform: uppercase;
    margin: 4px 0 6px;
}
.price-hero__price {
    font-size: 2.6rem; font-weight: 900;
    letter-spacing: -0.02em; color: var(--text);
    line-height: 1.1;
}
.price-hero__meta {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 8px;
}

.trend-badge {
    padding: 4px 12px; border-radius: 99px;
    font-size: 0.8rem; font-weight: 800; letter-spacing: 0.06em;
    border: 1px solid transparent;
}
.trend-badge--bull    { color: var(--bull); background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.3); }
.trend-badge--bear    { color: var(--bear); background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); }
.trend-badge--neutral { color: var(--text-2); background: var(--card); border-color: var(--border2); }

.vol-badge {
    font-size: 0.75rem; color: var(--text-3); font-weight: 600;
}

/* ── Barra posición semanal ─────────────────────────────────────────────── */
.pos-bar-wrap {
    margin: 4px 0 20px;
}
.pos-bar-label {
    display: block;
    font-size: 0.75rem; color: var(--text-3); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 8px;
}
.pos-bar-track {
    position: relative; height: 8px;
    background: var(--border2); border-radius: 99px;
    overflow: visible;
}
.pos-bar-fill {
    height: 100%; border-radius: 99px;
    background: linear-gradient(90deg, var(--bear), var(--gold), var(--bull));
    transition: width 0.5s ease;
}
.pos-bar-dot {
    position: absolute; top: 50%; transform: translate(-50%, -50%);
    width: 16px; height: 16px;
    background: white; border: 3px solid var(--gold);
    border-radius: 50%;
    transition: left 0.5s ease;
    box-shadow: 0 0 10px rgba(240,180,41,0.75);
}
.pos-bar-ends {
    display: flex; justify-content: space-between;
    font-size: 0.72rem; color: var(--text-3); margin-top: 6px;
    font-weight: 600;
}

/* ── Grid de tarjetas ──────────────────────────────────────────────────── */
.ranges-grid {
    display: flex; flex-direction: column; gap: 14px;
    transition: opacity 0.2s;
}

.range-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.range-card__header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.range-card__tf {
    font-size: 1rem; font-weight: 800;
    color: var(--gold); text-transform: uppercase;
    letter-spacing: 0.05em;
}
.range-card__width {
    font-size: 0.8rem; color: var(--text-3); font-weight: 600;
}

/* ── Barra visual del rango ─────────────────────────────────────────────── */
.range-bar {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 4px; margin-bottom: 14px;
}
.range-bar__res, .range-bar__sup {
    font-size: 0.78rem; font-weight: 700;
    text-align: right; color: var(--text-2);
}
.range-bar__res { color: rgba(239,68,68,0.8); }
.range-bar__sup { color: rgba(34,197,94,0.8); }

.range-bar__track {
    position: relative; height: 80px;
    background: var(--black); border-radius: var(--radius-sm);
    overflow: hidden; border: 1px solid var(--border2);
}
.range-bar__zone {
    position: absolute; left: 0; right: 0; height: 50%;
    transition: opacity 0.4s;
}
.range-bar__zone--top {
    top: 0;
    background: linear-gradient(180deg,
        rgba(255,71,87,0.85) 0%,
        rgba(255,71,87,0.55) 60%,
        rgba(255,71,87,0.15) 100%);
}
.range-bar__zone--bot {
    bottom: 0;
    background: linear-gradient(0deg,
        rgba(46,213,115,0.85) 0%,
        rgba(46,213,115,0.55) 60%,
        rgba(46,213,115,0.15) 100%);
}
.range-bar__mid-line {
    position: absolute; top: 50%; left: 0; right: 0;
    transform: translateY(-50%);
    display: flex; align-items: center; justify-content: center;
    border-top: 1px dashed var(--border2);
    gap: 8px;
}
.range-bar__mid-label {
    font-size: 0.65rem; font-weight: 700; color: var(--text-3);
    background: var(--card2); padding: 0 4px;
    letter-spacing: 0.06em;
}
.range-bar__mid-val {
    font-size: 0.7rem; color: var(--text-2); font-weight: 600;
    background: var(--card2); padding: 0 4px;
}
.range-bar__price-dot {
    position: absolute; left: 50%;
    transform: translate(-50%, -50%);
    width: 12px; height: 12px;
    background: var(--gold);
    border-radius: 50%;
    border: 2px solid var(--black);
    box-shadow: 0 0 12px rgba(240,180,41,0.85);
    transition: top 0.4s ease;
    z-index: 2;
}

/* ── Valores numéricos ──────────────────────────────────────────────────── */
.range-vals {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.range-val {
    background: var(--card2); border-radius: var(--radius-sm);
    padding: 10px 8px; text-align: center;
    border: 1px solid var(--border2);
}
.range-val__label {
    display: block;
    font-size: 0.65rem; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--text-3);
    margin-bottom: 4px;
}
.range-val__num {
    font-size: 0.95rem; font-weight: 800;
}
.range-val--res .range-val__num { color: rgba(239,68,68,0.9); }
.range-val--mid .range-val__num { color: var(--gold); }
.range-val--sup .range-val__num { color: rgba(34,197,94,0.9); }

/* ── Loading rangos ─────────────────────────────────────────────────────── */
.range-loading {
    display: none; flex-direction: column; align-items: center;
    justify-content: center; gap: 12px;
    padding: 40px; color: var(--text-2);
    font-size: 0.9rem;
}

/* ══════════════════════════════════════════════════════════════
   SECCIÓN: ANALYST
   ══════════════════════════════════════════════════════════════ */

.analyst-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px;
}
.analyst-title {
    font-size: 1.2rem; font-weight: 900; color: var(--text);
}
.refresh-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border2);
    background: var(--card);
    color: var(--text-2);
    transition: all 0.2s;
}
.refresh-btn:active { transform: scale(0.9); }
.refresh-btn.spinning svg { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.analyst-updated {
    font-size: 0.72rem; color: var(--text-3); margin-bottom: 12px;
}

.analyst-legend {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 14px;
}
.legend-item {
    font-size: 0.72rem; font-weight: 700;
    padding: 3px 10px; border-radius: 99px;
    border: 1px solid;
}
.legend-bull   { color: var(--bull);  border-color: rgba(34,197,94,0.3);  background: rgba(34,197,94,0.1); }
.legend-accum  { color: var(--accum); border-color: rgba(6,182,212,0.3);  background: rgba(6,182,212,0.1); }
.legend-dist   { color: var(--dist);  border-color: rgba(234,179,8,0.3);  background: rgba(234,179,8,0.1); }
.legend-bear   { color: var(--bear);  border-color: rgba(239,68,68,0.3);  background: rgba(239,68,68,0.1); }
.legend-range  { color: var(--range); border-color: rgba(107,114,128,0.3); background: rgba(107,114,128,0.1); }

/* ── Tabla ──────────────────────────────────────────────────────────────── */
.analyst-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
}
.analyst-table {
    width: 100%; border-collapse: collapse;
    table-layout: fixed;
}
.analyst-table thead {
    background: var(--card2);
}
.analyst-table th {
    padding: 10px 4px;
    font-size: 0.68rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: center;
}
.analyst-table th.col-coin { text-align: left; padding-left: 12px; width: 72px; }

.analyst-table tbody tr {
    border-bottom: 1px solid var(--border);
}
.analyst-table tbody tr:last-child { border-bottom: none; }

.col-coin {
    padding: 10px 4px 10px 12px;
    font-size: 0.9rem; font-weight: 800;
    white-space: nowrap; width: 72px;
}
.coin-name { display: flex; align-items: center; gap: 4px; }

.phase-cell {
    padding: 8px 2px;
    text-align: center;
    cursor: pointer;
    transition: filter 0.15s;
    border-left: 1px solid rgba(255,255,255,0.04);
}
.phase-cell:active { filter: brightness(1.3); }

.phase-icon  { display: block; font-size: 1rem; line-height: 1.2; }
.phase-label {
    display: block;
    font-size: 0.6rem; font-weight: 800;
    letter-spacing: 0.01em;
    margin-top: 2px;
    white-space: nowrap;
}
.stale-dot {
    display: inline-block;
    font-size: 0.6rem; margin-left: 2px;
    opacity: 0.7;
}
.cell-empty { text-align: center; color: var(--text-3); font-size: 0.85rem; }
.analyst-placeholder {
    text-align: center; padding: 32px; color: var(--text-2);
    display: flex; align-items: center; gap: 10px;
    justify-content: center;
}
.analyst-error { color: var(--bear); }

/* ── Panel de detalle (modal centrado) ──────────────────────────────────── */
.detail-panel {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.75);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    padding: 16px;
}
.detail-panel__inner {
    width: 100%; max-width: 480px; background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    transform: scale(0.92) translateY(12px);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1),
                opacity   0.22s ease;
    position: relative;
    max-height: 82vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.detail-panel--open .detail-panel__inner {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.detail-panel__close {
    position: absolute; top: 16px; right: 20px;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--card2);
    font-size: 0.9rem; color: var(--text-2);
}
.detail-coin  { font-size: 1.4rem; font-weight: 900; margin-bottom: 2px; }
.detail-tf    { font-size: 0.8rem; color: var(--text-2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px; }
.detail-phase { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; }
.detail-reason { font-size: 0.9rem; color: var(--text-2); line-height: 1.5; margin-bottom: 14px; min-height: 40px; }
.detail-price { font-size: 0.9rem; color: var(--text-2); }
.detail-price strong { color: var(--text); font-size: 1rem; }
.detail-stale { font-size: 0.8rem; color: #f97316; margin-top: 10px; }

/* ══════════════════════════════════════════════════════════════
   SECCIÓN: AJUSTES / ALERTAS
   ══════════════════════════════════════════════════════════════ */

.settings-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}
.settings-section__title {
    padding: 14px 16px 10px;
    font-size: 0.8rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
}
.settings-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row__label { font-size: 1rem; font-weight: 600; }
.settings-row__sub   { font-size: 0.8rem; color: var(--text-2); margin-top: 2px; }

/* Toggle */
.toggle {
    position: relative; width: 50px; height: 28px; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--border2); border-radius: 99px;
    transition: background 0.25s;
}
.toggle-slider::before {
    content: ''; position: absolute;
    width: 22px; height: 22px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%;
    transition: transform 0.25s;
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* Alert prefs grid */
.alert-prefs-grid {
    display: grid;
    grid-template-columns: auto 1fr 1fr 1fr 1fr;
    gap: 1px;
    background: var(--border);
    overflow: hidden;
}
.alert-prefs-grid > div {
    background: var(--card); padding: 10px 8px;
    font-size: 0.8rem; display: flex; align-items: center; justify-content: center;
}
.alert-prefs-grid .grid-header {
    font-weight: 800; font-size: 0.7rem;
    color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em;
}
.alert-prefs-grid .grid-coin {
    font-weight: 800; justify-content: flex-start; padding-left: 14px;
}
.alert-pref-toggle {
    width: 28px; height: 28px;
    border-radius: 6px; border: 2px solid var(--border2);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; transition: all 0.15s; cursor: pointer;
}
.alert-pref-toggle.active {
    border-color: var(--gold); background: var(--gold-dim);
    color: var(--gold);
}

.push-status-msg {
    font-size: 0.85rem; padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--card2); border: 1px solid var(--border2);
    color: var(--text-2); margin-bottom: 16px;
    line-height: 1.5;
}
.push-status-msg.success { border-color: rgba(34,197,94,0.3); color: var(--bull); }
.push-status-msg.error   { border-color: rgba(239,68,68,0.3);  color: var(--bear); }

.btn-primary {
    width: 100%; padding: 14px;
    background: var(--gold); color: var(--black);
    font-size: 1rem; font-weight: 900;
    border-radius: var(--radius-sm);
    letter-spacing: 0.04em; text-transform: uppercase;
    transition: all 0.18s;
}
.btn-primary:active { transform: scale(0.97); opacity: 0.9; }
.btn-primary:disabled { background: var(--border2); color: var(--text-3); }

/* ── Alarmas de precio ───────────────────────────────────────────────── */
.alarms-list { display: flex; flex-direction: column; }
.alarms-empty,
.alarms-loading {
    padding: 18px 16px; font-size: 0.85rem; color: var(--text-3); text-align: center;
}
.alarm-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "main action"
        "sub  action";
    column-gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.alarm-item--done { opacity: 0.55; }
.alarm-item__main { grid-area: main; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.alarm-item__sub  { grid-area: sub;  font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }
.alarm-item__action { grid-area: action; display: flex; align-items: center; gap: 8px; }
.alarm-coin   { font-weight: 800; letter-spacing: 0.04em; }
.alarm-target { font-variant-numeric: tabular-nums; }
.alarm-arrow--above { color: var(--bull); }
.alarm-arrow--below { color: var(--bear); }
.alarm-status {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
    padding: 4px 8px; border-radius: 6px;
    background: var(--card2); color: var(--text-3);
}
.alarm-status--done { color: var(--gold); }
.alarm-delete {
    width: 28px; height: 28px; border-radius: 50%;
    border: 1px solid var(--border2); background: transparent;
    color: var(--text-3); font-size: 0.85rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.alarm-delete:hover { color: var(--bear); border-color: var(--bear); }

.alarms-clear-btn {
    width: calc(100% - 32px);
    margin: 10px 16px 4px;
    padding: 8px 12px;
    background: transparent;
    border: 1px dashed var(--border2);
    color: var(--text-3);
    font-size: 0.78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.alarms-clear-btn:hover {
    color: var(--bear); border-color: var(--bear);
}

.alarms-form { padding: 12px 16px; border-top: 1px solid var(--border); }
.alarms-form__row { display: grid; grid-template-columns: 100px 1fr; gap: 8px; }
.alarms-input {
    background: var(--card2); border: 1px solid var(--border2);
    color: var(--text-1); padding: 12px 12px;
    border-radius: var(--radius-sm); font-size: 0.95rem;
    font-family: inherit; width: 100%;
}
.alarms-input:focus { border-color: var(--gold); outline: none; }
.alarms-counter { font-size: 0.75rem; }

/* ══════════════════════════════════════════════════════════════
   UTILIDADES GLOBALES
   ══════════════════════════════════════════════════════════════ */

.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.spinner--sm { width: 18px; height: 18px; border-width: 2px; }

/* ══════════════════════════════════════════════════════════════
   NOTIFICACIONES IN-APP (Inbox)
   ══════════════════════════════════════════════════════════════ */

/* ── Badge rojo en campanita ──────────────────────────────────────────── */
.notif-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem; font-weight: 800;
    border-radius: 99px;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--dark);
}

/* ── Página de notificaciones ─────────────────────────────────────────── */
.notif-page__header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.notif-page__title {
    font-size: 1.2rem; font-weight: 900; color: var(--text);
}

.notif-mark-all-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border-radius: 99px;
    border: 1px solid var(--border2);
    background: var(--card);
    color: var(--text-2);
    font-size: 0.75rem; font-weight: 700;
    transition: all 0.15s;
}
.notif-mark-all-btn:active { transform: scale(0.95); }

/* ── Lista de notificaciones ──────────────────────────────────────────── */
.notif-list {
    display: flex; flex-direction: column; gap: 8px;
}

.notif-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-left: 3px solid var(--border2);
    transition: all 0.2s;
    position: relative;
}
.notif-item--unread {
    background: var(--card2);
    border-left-color: var(--gold);
}
.notif-item--unread::after {
    content: '';
    position: absolute; top: 14px; right: 44px;
    width: 8px; height: 8px;
    background: var(--gold);
    border-radius: 50%;
}

/* Colores del borde izquierdo según fase */
.notif-item--bull            { border-left-color: var(--bull); }
.notif-item--bear            { border-left-color: var(--bear); }
.notif-item--distribution    { border-left-color: var(--dist); }
.notif-item--accumulation    { border-left-color: var(--accum); }
.notif-item--range           { border-left-color: var(--range); }

/* ── Icono moneda ─────────────────────────────────────────────────────── */
.notif-item__icon {
    flex-shrink: 0;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--card2);
    border: 1px solid var(--border2);
    font-size: 0.85rem; font-weight: 900;
    color: var(--gold);
}

/* ── Contenido ────────────────────────────────────────────────────────── */
.notif-item__content {
    flex: 1; min-width: 0;
}
.notif-item__title {
    font-size: 0.85rem; font-weight: 700; color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
}
.notif-item__body {
    font-size: 0.78rem; color: var(--text-2);
    line-height: 1.45;
    white-space: pre-line;
    margin-bottom: 6px;
}
.notif-item__time {
    font-size: 0.68rem; color: var(--text-3); font-weight: 600;
}

/* ── Botón eliminar ───────────────────────────────────────────────────── */
.notif-item__delete {
    flex-shrink: 0;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: var(--text-3);
    transition: all 0.15s;
}
.notif-item__delete:active {
    background: rgba(239,68,68,0.15);
    color: var(--bear);
}

/* ── Estado vacío ─────────────────────────────────────────────────────── */
.notif-empty {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px; padding: 48px 16px;
    color: var(--text-3);
    font-size: 0.9rem;
}

/* ── Loading notificaciones ───────────────────────────────────────────── */
.notif-loading {
    display: flex; align-items: center; justify-content: center;
    padding: 32px; gap: 10px;
    color: var(--text-2); font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   SENALES DE TRADING
   ═══════════════════════════════════════════════════════════════════════ */
.signals-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 16px 4px;
}
.signals-title { font-size: 1.3rem; font-weight: 800; color: var(--gold); margin: 0; }
.signals-updated {
    padding: 0 16px 8px; font-size: 0.7rem; color: var(--text-3);
}
.signals-legend {
    display: flex; flex-wrap: wrap; gap: 8px 14px;
    padding: 4px 16px 12px; font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.02em;
}
.signals-placeholder, .signals-error {
    text-align: center; padding: 32px 16px;
    color: var(--text-2); font-size: 0.85rem;
}
.signals-error { color: var(--bear); }

.signals-list { padding: 0 12px 20px; }

.signals-empty {
    text-align: center; padding: 48px 24px;
    color: var(--text-3);
}
.signals-empty__icon { font-size: 2.5rem; margin-bottom: 12px; }
.signals-empty__text { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--text-2); }
.signals-empty__sub { font-size: 0.75rem; }

/* ── Signal Card ──────────────────────────────────────────────────────── */
.signal-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.12s;
}
.signal-card:active { transform: scale(0.98); }

.signal-card__top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.signal-card__coin {
    display: flex; align-items: center; gap: 6px;
    font-size: 1rem; color: var(--text);
}
.signal-card__tf {
    font-size: 0.7rem; color: var(--text-3);
    background: var(--card2); padding: 2px 6px;
    border-radius: 4px; margin-left: 4px;
}
.signal-card__badge {
    font-size: 0.7rem; font-weight: 800;
    padding: 3px 10px; border-radius: 12px;
    white-space: nowrap;
}

.signal-card__score-wrap {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px;
}
.signal-card__score-bar {
    flex: 1; height: 6px;
    background: var(--border); border-radius: 3px;
    overflow: hidden;
}
.signal-card__score-fill {
    height: 100%; border-radius: 3px;
    transition: width 0.3s;
}
.signal-card__score-num {
    font-size: 0.8rem; font-weight: 800; color: var(--text-2);
    min-width: 24px; text-align: right;
}

.signal-card__bottom {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.75rem; color: var(--text-2);
}
.signal-card__price { font-weight: 700; }
.signal-card__time { color: var(--text-3); }

.signal-card__reason {
    margin-top: 6px; font-size: 0.7rem;
    color: var(--text-3); font-style: italic;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Signal Detail Panel ──────────────────────────────────────────────── */
.signal-detail {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(0,0,0,0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0; transition: opacity 0.25s;
}
.signal-detail--open { opacity: 1; }
.signal-detail__inner {
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 24px 20px calc(20px + var(--safe-bottom));
    width: 100%; max-width: 460px;
    max-height: 80vh; overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.25s ease-out;
}
.signal-detail--open .signal-detail__inner { transform: translateY(0); }

.signal-detail__header {
    display: flex; align-items: center; gap: 8px;
    font-size: 1.2rem; margin-bottom: 12px;
}
.signal-detail__score {
    font-size: 0.95rem; margin-bottom: 10px;
}
.signal-detail__phase,
.signal-detail__price,
.signal-detail__sma,
.signal-detail__levels {
    font-size: 0.85rem; color: var(--text-2); margin-bottom: 6px;
}
.signal-detail__wyckoff {
    font-size: 0.85rem; color: var(--gold); margin-bottom: 6px;
    padding: 6px 10px; background: var(--gold-dim); border-radius: 6px;
}
.signal-detail__reasons { margin-top: 12px; }
.signal-detail__reasons-title {
    font-size: 0.75rem; font-weight: 800; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;
}
.signal-detail__reason-item {
    font-size: 0.8rem; color: var(--text-2); margin-bottom: 4px;
}
.signal-detail__time {
    margin-top: 12px; font-size: 0.7rem; color: var(--text-3); text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════════
   AAVE POSITION MANAGEMENT
   ═══════════════════════════════════════════════════════════════════════ */
.aave-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 16px 4px;
}
.aave-title { font-size: 1.3rem; font-weight: 800; color: var(--gold); margin: 0; }

/* ── Position Card ────────────────────────────────────────────────────── */
.aave-no-position {
    text-align: center; padding: 48px 24px;
}
.aave-no-position__icon { font-size: 2.5rem; margin-bottom: 12px; }
.aave-no-position__text { font-size: 1rem; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.aave-no-position__sub { font-size: 0.75rem; color: var(--text-3); margin-bottom: 16px; }

.aave-section {
    padding: 0 12px 16px;
}
.aave-section__title {
    font-size: 0.75rem; font-weight: 800; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 10px; padding-left: 4px;
}

.aave-pos-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.aave-pos-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.aave-pos-label { font-size: 0.75rem; color: var(--text-3); }
.aave-pos-value { font-size: 1rem; font-weight: 800; color: var(--text); }
.aave-pos-value--positive { color: var(--bull); }
.aave-pos-value--negative { color: var(--bear); }

.aave-progress-bar {
    height: 8px; background: var(--border);
    border-radius: 4px; overflow: hidden; margin: 8px 0;
}
.aave-progress-fill {
    height: 100%; border-radius: 4px;
    transition: width 0.5s;
}

.aave-hf {
    display: flex; align-items: center; gap: 8px;
    margin-top: 10px;
}
.aave-hf__label { font-size: 0.75rem; color: var(--text-3); }
.aave-hf__value { font-size: 1.1rem; font-weight: 900; }
.aave-hf--safe { color: var(--bull); }
.aave-hf--warning { color: var(--dist); }
.aave-hf--danger { color: var(--bear); }

/* ── HF Hero Display ──────────────────────────────────────────────────── */
.aave-hf-hero {
    text-align: center;
    padding: 28px 20px 24px;
    margin: 12px 0 16px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.aave-hf-hero__label {
    font-size: 0.75rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-3); margin-bottom: 8px;
}
.aave-hf-hero__display {
    display: flex; align-items: baseline;
    justify-content: center; gap: 8px;
    margin-bottom: 16px;
}
.aave-hf-hero__current {
    font-size: 3.2rem; font-weight: 900;
    letter-spacing: -0.02em; line-height: 1;
}
.aave-hf-hero__separator {
    font-size: 2rem; font-weight: 300;
    color: var(--text-3);
}
.aave-hf-hero__threshold {
    font-size: 1.8rem; font-weight: 700;
    color: var(--text-3);
}
.aave-hf-hero__bar {
    position: relative; height: 8px;
    background: var(--border2); border-radius: 99px;
    overflow: visible; margin-bottom: 12px;
}
.aave-hf-hero__bar-fill {
    height: 100%; border-radius: 99px;
    transition: width 0.5s ease;
}
.aave-hf-hero__bar-marker {
    position: absolute; top: -4px;
    width: 3px; height: 16px;
    background: var(--text-3);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: left 0.5s ease;
}
.aave-hf-hero__status {
    font-size: 0.8rem; font-weight: 700;
    letter-spacing: 0.02em;
}

/* ── Alert Config ────────────────────────────────────────────────────── */
.aave-alert-config__row {
    display: flex; align-items: center;
    justify-content: space-between; gap: 10px;
    flex-wrap: wrap;
}
.aave-alert-config__label {
    font-size: 0.85rem; font-weight: 600; color: var(--text-2);
}
.aave-alert-config__input-wrap {
    display: flex; gap: 6px; align-items: center;
}
.aave-alert-config__input {
    width: 80px; text-align: center;
    padding: 8px; font-size: 1rem; font-weight: 800;
}
.aave-alert-config__save {
    padding: 8px 14px; border-radius: 8px;
    font-size: 0.8rem; font-weight: 700;
    background: var(--gold-dim); border: 1px solid var(--gold-border);
    color: var(--gold); cursor: pointer;
    transition: all 0.2s;
}
.aave-alert-config__save:active { opacity: 0.8; }

/* ── Recommendation Cards ─────────────────────────────────────────────── */
.aave-rec-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 8px;
    border-left: 4px solid var(--border);
}
.aave-rec-card--urgent { border-left-color: var(--bear); }
.aave-rec-card--advice { border-left-color: var(--dist); }
.aave-rec-card--info   { border-left-color: var(--accum); }

.aave-rec__title {
    font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 4px;
}
.aave-rec__body {
    font-size: 0.8rem; color: var(--text-2); margin-bottom: 8px;
}
.aave-rec__trigger {
    font-size: 0.65rem; color: var(--text-3); font-style: italic; margin-bottom: 8px;
}
.aave-rec__actions {
    display: flex; gap: 8px;
}
.aave-rec__btn {
    padding: 5px 14px; border-radius: 6px;
    font-size: 0.75rem; font-weight: 700;
    cursor: pointer; border: none;
}
.aave-rec__btn--accept {
    background: rgba(34,197,94,0.2); color: var(--bull);
}
.aave-rec__btn--dismiss {
    background: var(--card2); color: var(--text-3);
}

/* ── Aave Form ────────────────────────────────────────────────────────── */
.aave-form {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 16px;
}
.aave-form__group {
    margin-bottom: 14px;
}
.aave-form__label {
    display: block; font-size: 0.75rem; font-weight: 700;
    color: var(--text-3); margin-bottom: 4px;
}
.aave-form__row {
    display: flex; gap: 8px;
}
.aave-form__input {
    flex: 1; padding: 10px 12px;
    background: var(--card2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text);
    font-size: 0.9rem; font-weight: 600;
}
.aave-form__input:focus {
    outline: none; border-color: var(--gold-border);
}
.aave-form__select {
    width: 90px; padding: 10px 8px;
    background: var(--card2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text);
    font-size: 0.85rem; font-weight: 700;
}
.aave-form__btn {
    width: 100%; padding: 12px;
    background: var(--gold-dim); border: 1px solid var(--gold-border);
    border-radius: 8px; color: var(--gold);
    font-size: 0.9rem; font-weight: 800;
    cursor: pointer; margin-top: 4px;
}
.aave-form__btn:active { opacity: 0.8; }

/* ── Mode Toggle (Manual / Auto-detect) ──────────────────────────────── */
.aave-mode-toggle {
    display: flex; gap: 4px;
    background: var(--card2); border-radius: 10px;
    padding: 3px; margin-bottom: 12px;
}
.aave-mode-toggle__btn {
    flex: 1; padding: 8px 12px;
    background: transparent; border: none;
    border-radius: 8px; color: var(--text-3);
    font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s;
}
.aave-mode-toggle__btn--active {
    background: var(--gold-dim); color: var(--gold);
    border: 1px solid var(--gold-border);
}

/* ── Multi-asset rows ────────────────────────────────────────────────── */
.aave-form__asset-row {
    display: flex; gap: 5px; margin-bottom: 6px; align-items: center;
}
.aave-form__asset-row .aave-form__asset-qty {
    flex: 1; min-width: 0; padding: 10px 8px;
    background: var(--card2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text);
    font-size: 0.85rem; font-weight: 600;
}
.aave-form__asset-row .aave-form__asset-qty:focus {
    outline: none; border-color: var(--gold-border);
}
.aave-form__asset-row .aave-form__asset-coin {
    width: 72px; flex-shrink: 0; padding: 10px 4px;
    background: var(--card2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text);
    font-size: 0.8rem; font-weight: 700;
}
.aave-form__remove-row {
    width: 32px; height: 32px; flex-shrink: 0;
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
    border-radius: 8px; color: #f87171;
    font-size: 1.1rem; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
.aave-form__remove-row:active { opacity: 0.7; }
.aave-form__not-coll {
    font-size: 0.6rem; font-weight: 700; color: var(--text-3);
    background: rgba(255,255,255,0.08); border-radius: 3px;
    padding: 1px 4px; flex-shrink: 0; opacity: 0.7;
    line-height: 1.2;
}

.aave-form__add-row {
    display: block; width: 100%; padding: 8px;
    background: transparent;
    border: 1.5px dashed var(--border2);
    border-radius: 8px; color: var(--text-3);
    font-size: 0.78rem; font-weight: 700;
    cursor: pointer; text-align: center;
    margin-top: 4px;
}
.aave-form__add-row:active { border-color: var(--gold-border); color: var(--gold); }

/* ── Wallet preview card ─────────────────────────────────────────────── */
.aave-wallet-preview {
    background: var(--card); border: 1px solid var(--gold-border);
    border-radius: var(--radius-sm); padding: 14px; margin: 12px 0;
}
.aave-wallet-preview__title {
    font-size: 0.78rem; font-weight: 800; color: var(--gold);
    margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em;
}
.aave-wallet-preview__row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 0; font-size: 0.85rem; color: var(--text);
}

/* ── Action Timeline ──────────────────────────────────────────────────── */
.aave-timeline { padding: 0; list-style: none; }
.aave-timeline__item {
    display: flex; gap: 10px; padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.aave-timeline__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--gold); margin-top: 5px; flex-shrink: 0;
}
.aave-timeline__content { flex: 1; }
.aave-timeline__text { font-size: 0.8rem; color: var(--text-2); }
.aave-timeline__time { font-size: 0.65rem; color: var(--text-3); margin-top: 2px; }
.aave-timeline__empty {
    text-align: center; padding: 24px;
    font-size: 0.8rem; color: var(--text-3);
}

/* ── Recommendation % badge ──────────────────────────────────────────── */
.aave-rec__pct {
    display: inline-block;
    background: var(--gold-dim); color: var(--gold);
    font-size: 0.65rem; font-weight: 800;
    padding: 2px 7px; border-radius: 8px;
    margin-left: 6px; vertical-align: middle;
}

/* ── Execution Modal ─────────────────────────────────────────────────── */
.aave-modal {
    position: fixed; inset: 0; z-index: 250;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.6);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0; transition: opacity 0.2s;
}
.aave-modal--open { opacity: 1; }
.aave-modal__inner {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px 20px;
    width: calc(100% - 32px); max-width: 400px;
    max-height: 85vh; overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s ease-out;
}
.aave-modal--open .aave-modal__inner { transform: scale(1); }
.aave-modal__title {
    font-size: 1rem; font-weight: 800; color: var(--gold);
    margin-bottom: 8px;
}
.aave-modal__desc {
    font-size: 0.8rem; color: var(--text-2); margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH — Avatar circular del alumno en header
   ═══════════════════════════════════════════════════════════════════════════ */
.user-avatar {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.12);
    background: #1E3A8A;        /* default navy — XPro */
    color: #FFF;
    font-weight: 900; font-size: 0.82rem;
    letter-spacing: 0.02em;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    padding: 0; margin: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.user-avatar:active { transform: scale(0.92); }
.user-avatar:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.user-avatar--xpro {
    background: linear-gradient(135deg, #1E3A8A 0%, #2E4FB5 100%);
    color: #FFF;
    border-color: rgba(255,255,255,0.14);
}
.user-avatar--xpro_gold {
    background: linear-gradient(135deg, #B8892E 0%, #FFD95A 55%, #DFA93A 100%);
    color: #2A1F00;
    border-color: rgba(255,255,255,0.55);
    text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}
.user-avatar--xpro_platinum {
    background: linear-gradient(135deg, #B8C0D0 0%, #F4F6FB 50%, #A9B3C6 100%);
    color: #0F162A;
    border-color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

/* ── Popover con ficha del alumno ──────────────────────────────────── */
.user-popover {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top));
    left: 14px;
    z-index: 120;
    min-width: 230px; max-width: 300px;
    background: var(--card2);
    border: 1px solid var(--border2);
    border-radius: 12px;
    padding: 14px 14px 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.55);
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.user-popover--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.user-popover__arrow {
    position: absolute;
    top: -6px; left: 28px;
    width: 10px; height: 10px;
    background: var(--card2);
    border-left: 1px solid var(--border2);
    border-top:  1px solid var(--border2);
    transform: rotate(45deg);
}
.user-popover__row {
    display: flex; flex-direction: column;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.user-popover__row:last-child { border-bottom: none; }
.user-popover__label {
    font-size: 0.64rem; font-weight: 800;
    color: var(--text-3);
    letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: 3px;
}
.user-popover__val {
    font-size: 0.92rem; font-weight: 700;
    color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH — Pantalla Login
   ═══════════════════════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 48px;
    gap: 24px;
    background: var(--black);
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.login-logo__name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: -0.3px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.login-card__title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}
.login-card__sub {
    font-size: 0.82rem;
    color: var(--text-2);
    margin: -8px 0 0;
    line-height: 1.5;
}

.login-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.login-field { display: flex; flex-direction: column; }
.login-input {
    background: var(--card2);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 13px 16px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--gold); }

.login-btn {
    background: var(--gold);
    color: #191E39;
    font-size: 0.9rem;
    font-weight: 800;
    font-family: inherit;
    border: none;
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.15s;
}
.login-btn:disabled { opacity: 0.5; cursor: default; }
.login-btn:active:not(:disabled) { opacity: 0.85; }

.login-btn-ghost {
    background: transparent;
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    padding: 8px 0;
    text-align: center;
}
.login-btn-ghost:active { color: var(--text); }

.login-error {
    font-size: 0.8rem;
    color: #f87171;
    background: rgba(248,113,113,0.08);
    border: 1px solid rgba(248,113,113,0.2);
    border-radius: 8px;
    padding: 10px 12px;
}
.login-note {
    font-size: 0.73rem;
    color: var(--text-2);
    text-align: center;
    line-height: 1.4;
    margin: 0;
    opacity: 0.7;
}

/* OTP inputs */
.otp-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.otp-digit {
    width: 44px;
    height: 54px;
    background: var(--card2);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1.4rem;
    font-weight: 800;
    font-family: monospace;
    text-align: center;
    outline: none;
    caret-color: var(--gold);
    transition: border-color 0.15s;
}
.otp-digit:focus { border-color: var(--gold); }

.otp-timer {
    font-size: 0.75rem;
    color: var(--text-2);
    text-align: center;
}

/* Spinner */
.login-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(25,30,57,0.3);
    border-top-color: #191E39;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH — Pantalla Paywall
   ═══════════════════════════════════════════════════════════════════════════ */
.paywall-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px 48px;
    gap: 20px;
    background: var(--black);
    overflow-y: auto;
}

.paywall-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.paywall-header__name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--gold);
}

.paywall-expired-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
}
.paywall-expired-icon { font-size: 2.5rem; margin-bottom: 12px; }
.paywall-expired-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 10px;
}
.paywall-expired-sub {
    font-size: 0.83rem;
    color: var(--text-2);
    line-height: 1.5;
    margin: 0;
}

.paywall-plans {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 380px;
}
.paywall-plan {
    flex: 1;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 18px 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}
.paywall-plan--best {
    border-color: var(--gold);
}
.paywall-plan--selected {
    border-color: var(--gold);
    background: rgba(218,164,102,0.08);
}
.paywall-plan__best-label {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gold);
    color: #191E39;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.paywall-plan__badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.paywall-plan__price {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
}
.paywall-plan__currency {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gold);
}
.paywall-plan__period {
    font-size: 0.75rem;
    color: var(--text-2);
    margin: 4px 0 8px;
}
.paywall-plan__detail {
    font-size: 0.7rem;
    color: var(--text-2);
    line-height: 1.3;
}

.paywall-payment {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
}
.paywall-payment__title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 16px;
}
.paywall-payment__steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}
.paywall-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.paywall-step__num {
    min-width: 24px;
    height: 24px;
    background: var(--gold);
    color: #191E39;
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.paywall-step__text {
    font-size: 0.82rem;
    color: var(--text-2);
    line-height: 1.45;
    padding-top: 3px;
}

.paywall-wallet-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}
.paywall-wallet-addr {
    font-family: monospace;
    font-size: 0.72rem;
    color: var(--text);
    flex: 1;
    word-break: break-all;
}
.paywall-copy-btn {
    background: var(--border);
    color: var(--text-2);
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
}
.paywall-copy-btn:active { opacity: 0.7; }

.paywall-success {
    font-size: 0.82rem;
    color: #4ade80;
    background: rgba(74,222,128,0.08);
    border: 1px solid rgba(74,222,128,0.2);
    border-radius: 8px;
    padding: 10px 12px;
}
.paywall-note {
    font-size: 0.73rem;
    color: var(--text-2);
    text-align: center;
    line-height: 1.4;
    margin: 8px 0 0;
    opacity: 0.7;
}
.paywall-logout-btn {
    background: transparent;
    color: var(--text-2);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    padding: 8px 0;
    opacity: 0.6;
}
.paywall-logout-btn:active { opacity: 1; }

