/* ==========================================================================
   ACADEMIAQR - CARNET VIRTUAL MOBILE (SINGLE PAGE APP)
   Credencial Escolar Inteligente de Alta Seguridad · Ecosistema Educativo
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Share+Tech+Mono&display=swap');

:root {
    /* Variables de Color Dinámicas por Colegio (Configurables) */
    --school-primary: #003f6d;
    --school-secondary: #005a9c;
    --school-accent: #d97706;
    --school-light: #e0f2fe;
    --school-text-contrast: #ffffff;
    
    /* Estados de Solvencia */
    --status-solvente: #10b981;
    --status-solvente-bg: #dcfce7;
    --status-moroso: #ef4444;
    --status-moroso-bg: #fee2e2;

    /* Neutros Mobile */
    --phone-bg: #0b1320;
    --card-surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-card: #e2e8f0;

    /* Personalización Social del Estudiante (Aro & Glow) */
    --avatar-ring-color: #10b981;
    --avatar-ring-shadow: rgba(16, 185, 129, 0.4);

    /* Geometría y Viewport Responsivo Centralizado (Estándar 2026) */
    --carnet-w-max: 440px;
    --carnet-radius: clamp(16px, 2.5vh, 22px);
    --carnet-avatar-sz: clamp(72px, 10.5vh, 90px);
    --carnet-avatar-overlap: calc(-1 * clamp(36px, 5.2vh, 44px));
    --carnet-qr-sz: clamp(84px, 14.5vh, 115px);
    --carnet-bottom-nav-h: 62px;
}

/* Temas Prediseñados para Demostración */
[data-theme="san-lucas"] {
    --school-primary: #003f6d;
    --school-secondary: #005a9c;
    --school-accent: #d97706;
    --school-light: #e0f2fe;
}

[data-theme="roble"] {
    --school-primary: #064e3b;
    --school-secondary: #047857;
    --school-accent: #10b981;
    --school-light: #d1fae5;
}

[data-theme="minerva"] {
    --school-primary: #701a75;
    --school-secondary: #86198f;
    --school-accent: #d946ef;
    --school-light: #fae8ff;
}

[data-theme="moderna"] {
    --school-primary: #1e3a8a;
    --school-secondary: #2563eb;
    --school-accent: #06b6d4;
    --school-light: #dbeafe;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    background: radial-gradient(135% 120% at 50% 0%, #1e293b 0%, #0f172a 45%, #020617 100%) !important;
    background-attachment: fixed !important;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: stretch;
    overflow: hidden;
}

/* Mobile Frame Wrapper */
.mobile-viewport {
    width: 100%;
    max-width: var(--carnet-w-max, 440px);
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: clamp(0.2rem, 0.8vh, 0.45rem) clamp(0.35rem, 1.5vw, 0.6rem) calc(var(--carnet-bottom-nav-h, 62px) + env(safe-area-inset-bottom, 0px) + clamp(0.2rem, 0.6vh, 0.4rem)) clamp(0.35rem, 1.5vw, 0.6rem);
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

/* Top App Bar */
.carnet-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.5rem;
    color: white;
    flex-shrink: 0;
}

.carnet-brand-pill {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.theme-dropdown-select {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.theme-dropdown-select option {
    background: #0f172a;
    color: white;
}

/* 3D Flip Card Container */
.carnet-flip-container {
    perspective: 1200px;
    -webkit-perspective: 1200px;
    width: 100%;
    height: 100%;
    flex: 1 1 0;
    min-height: 0;
    margin: 0 auto;
    position: relative;
}

@media (min-width: 540px) and (min-height: 860px) {
    body {
        align-items: center;
    }
    .mobile-viewport {
        height: auto;
        min-height: 0;
        max-height: 100dvh;
        padding-bottom: calc(var(--carnet-bottom-nav-h, 62px) + env(safe-area-inset-bottom, 0px));
    }
    .carnet-flip-container {
        height: min(720px, calc(100dvh - 84px));
        flex: none;
    }
}

.carnet-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.carnet-card-inner.is-flipped {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

.start-flipped .carnet-card-inner {
    transform: rotateY(180deg) !important;
    -webkit-transform: rotateY(180deg) !important;
    transition: none !important;
}

/* Base Card Style (PVC Physical Feel) */
.carnet-face {
    background: var(--card-surface);
    border-radius: var(--carnet-radius, clamp(16px, 2.5vh, 22px));
    box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    overflow: hidden;
}

.carnet-face-front {
    transform: rotateY(0deg);
    -webkit-transform: rotateY(0deg);
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.carnet-face-back {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(0.45rem, 1vh, 0.75rem);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    overflow-y: auto;
    scrollbar-width: thin;
    gap: clamp(0.25rem, 0.6vh, 0.45rem);
}

.carnet-card-inner.is-flipped .carnet-face-front {
    pointer-events: none;
    z-index: 1;
}

.carnet-card-inner.is-flipped .carnet-face-back {
    pointer-events: auto;
    z-index: 2;
}

/* Card Header (Branded) - Prominent School Brand & Cover */
.card-header-branded {
    background: linear-gradient(135deg, var(--school-primary), var(--school-secondary));
    color: var(--school-text-contrast);
    padding: clamp(0.45rem, 1.2vh, 0.75rem) 0.8rem clamp(1.15rem, 2.2vh, 1.55rem) 0.8rem;
    position: relative;
    text-align: center;
    flex-shrink: 0;
}

.card-header-branded::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: clamp(12px, 2vh, 16px);
    background: var(--card-surface);
    border-radius: 16px 16px 0 0;
}

.school-crest-badge {
    width: clamp(38px, 5.2vh, 48px);
    height: clamp(38px, 5.2vh, 48px);
    background: #ffffff;
    color: var(--school-primary);
    border-radius: clamp(10px, 1.5vh, 14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(3px, 0.5vh, 5px);
    font-size: clamp(1.1rem, 2vh, 1.35rem);
    margin: 0 auto clamp(0.08rem, 0.35vh, 0.2rem) auto;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.9);
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.school-name-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(0.85rem, 1.8vh, 1.02rem);
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin-top: 0.05rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.school-cycle-sub {
    display: inline-block;
    font-size: clamp(0.55rem, 1.05vh, 0.64rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
    padding: 2px clamp(6px, 1.2vw, 8px);
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Fila Social del Avatar (Seguidores + Foto Central + Aura Cromática) */
.student-avatar-social-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.4rem, 1.8vw, 0.85rem);
    margin: var(--carnet-avatar-overlap, calc(-1 * clamp(36px, 5.2vh, 44px))) auto 0 auto !important;
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 0 0.4rem;
    flex-shrink: 0;
}

/* Badge de Seguidores de Logros Académicos */
.social-followers-pill {
    display: flex;
    align-items: center;
    gap: 0.32rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px solid #e2e8f0;
    border-radius: 9999px;
    padding: clamp(0.18rem, 0.45vh, 0.28rem) clamp(0.42rem, 1.1vw, 0.6rem);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #334155;
    backdrop-filter: blur(8px);
    outline: none;
    font-family: inherit;
}

.social-followers-pill:hover, .social-followers-pill:active {
    transform: translateY(-2px) scale(1.02);
    border-color: #0284c7;
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.2);
    background: #ffffff;
}

.social-followers-pill.is-following {
    border-color: #10b981;
    background: #ecfdf5;
    color: #047857;
}

.social-followers-pill i {
    font-size: clamp(0.68rem, 1.15vh, 0.8rem);
    color: #0284c7;
    transition: color 0.2s;
}

.social-followers-pill.is-following i {
    color: #10b981;
}

/* Badge de Aura / Personalización Rápida */
.social-aura-badge {
    display: flex;
    align-items: center;
    gap: 0.32rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px solid #e2e8f0;
    border-radius: 9999px;
    padding: clamp(0.18rem, 0.45vh, 0.28rem) clamp(0.42rem, 1.1vw, 0.6rem);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #334155;
    backdrop-filter: blur(8px);
    outline: none;
    font-family: inherit;
}

.social-aura-badge:hover, .social-aura-badge:active {
    transform: translateY(-2px) scale(1.02);
    border-color: var(--avatar-ring-color, #10b981);
    box-shadow: 0 6px 16px var(--avatar-ring-shadow, rgba(16, 185, 129, 0.25));
    background: #ffffff;
}

.social-aura-badge i {
    font-size: clamp(0.68rem, 1.15vh, 0.8rem);
    color: var(--avatar-ring-color, #10b981);
}

.followers-text-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.05;
}

.followers-count {
    font-size: clamp(0.66rem, 1.15vh, 0.76rem);
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: #0f172a;
}

.followers-label {
    font-size: clamp(0.46rem, 0.8vh, 0.52rem);
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Student Photo & Social Avatar Ring */
.student-photo-wrapper {
    margin: 0 !important;
    position: relative;
    width: var(--carnet-avatar-sz, clamp(72px, 10.5vh, 90px));
    height: var(--carnet-avatar-sz, clamp(72px, 10.5vh, 90px));
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.student-photo-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto;
    border: clamp(3px, 0.5vh, 4px) solid var(--avatar-ring-color, #10b981);
    box-shadow: 0 8px 24px var(--avatar-ring-shadow, rgba(16, 185, 129, 0.35));
    background: #e2e8f0;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.avatar-ring-picker-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    width: clamp(22px, 3vh, 26px);
    height: clamp(22px, 3vh, 26px);
    border-radius: 50%;
    background: #ffffff;
    color: #475569;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.58rem, 1vh, 0.70rem);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, color 0.2s;
    z-index: 11;
}

.avatar-ring-picker-btn:hover, .avatar-ring-picker-btn:active {
    transform: scale(1.1);
    background: var(--avatar-ring-color, #10b981);
    color: #ffffff;
}

.departure-indicator-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #ef4444;
    color: white;
    width: clamp(22px, 3vh, 26px);
    height: clamp(22px, 3vh, 26px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.58rem, 1vh, 0.70rem);
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    z-index: 11;
}

/* Student Info Area */
.card-body-content {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    padding: 0.1rem 0.75rem clamp(0.25rem, 0.8vh, 0.55rem) 0.75rem;
    text-align: center;
    gap: clamp(0.12rem, 0.45vh, 0.25rem);
}

.student-full-name {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(0.96rem, 1.95vh, 1.18rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    margin: 0;
}

/* Grupo Grado y Sección */
.student-grade-section-group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.1rem 0.55rem;
    border-radius: 9999px;
    margin: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.pill-grade-item {
    font-size: clamp(0.60rem, 1.15vh, 0.70rem);
    font-weight: 800;
    color: var(--school-primary);
}

.pill-section-divider {
    color: #cbd5e1;
    font-weight: 700;
    font-size: 0.68rem;
}

.pill-section-item {
    font-size: clamp(0.58rem, 1.1vh, 0.66rem);
    font-weight: 700;
    color: #047857;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

/* Frase Motivacional / Bio Estilo Red Social */
.student-quote-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 9999px;
    padding: clamp(0.10rem, 0.35vh, 0.18rem) 0.55rem;
    margin: 0;
    max-width: 96%;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: clamp(0.58rem, 1.05vh, 0.66rem);
    font-weight: 600;
    color: #334155;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.student-quote-box:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

/* Sección de Etiquetas de Liderazgo (Materias, Proyectos, Clubes) */
.leadership-section-wrap {
    width: 100%;
    max-width: 98%;
    margin: 0 auto;
    overflow: hidden;
}

.leadership-chips-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 1px 2px;
    flex-wrap: wrap;
}

.leadership-chips-track::-webkit-scrollbar {
    display: none;
}

.lead-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    font-size: clamp(0.54rem, 0.95vh, 0.62rem);
    font-weight: 700;
    padding: clamp(0.10rem, 0.3vh, 0.18rem) 0.42rem;
    border-radius: 9999px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.lead-chip:hover, .lead-chip:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.lead-chip-subject {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.lead-chip-project {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

.lead-chip-club {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.lead-chip-sport {
    background: #fff7ed;
    color: #c2410c;
    border-color: #ffedd5;
}

/* Barra de Publicaciones en SUTZ */
.sutz-badge-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 94%;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    border: 1.5px solid #bae6fd;
    border-radius: 9999px;
    padding: clamp(0.14rem, 0.38vh, 0.24rem) clamp(0.42rem, 1vw, 0.65rem);
    margin: 0 auto;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.sutz-badge-trigger:hover, .sutz-badge-trigger:active {
    background: #e0f2fe;
    border-color: #38bdf8;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.15);
}

.sutz-badge-left {
    display: flex;
    align-items: center;
    gap: 0.32rem;
}

.sutz-brand-mini {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #0284c7;
    color: #ffffff;
    font-size: 0.56rem;
    font-weight: 800;
    padding: 0.08rem 0.38rem;
    border-radius: 9999px;
    letter-spacing: 0.04em;
}

.sutz-articles-label {
    font-size: clamp(0.58rem, 1.05vh, 0.66rem);
    font-weight: 700;
    color: #334155;
}

.sutz-badge-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    font-size: clamp(0.54rem, 0.95vh, 0.62rem);
    font-weight: 700;
    color: #0284c7;
}

.student-quote-box .quote-icon-decor {
    font-size: 0.64rem;
    color: var(--school-primary);
    opacity: 0.7;
}

.student-quote-box .edit-icon-decor {
    font-size: 0.64rem;
    color: #94a3b8;
    margin-left: 0.2rem;
    transition: color 0.2s;
}

.student-quote-box:hover .edit-icon-decor {
    color: var(--school-primary);
}

/* Dynamic QR Box with High Density */
.qr-code-display-box {
    background: #ffffff;
    border: 1.5px dashed #cbd5e1;
    border-radius: clamp(10px, 1.8vh, 14px);
    padding: clamp(0.25rem, 0.7vh, 0.45rem) clamp(0.45rem, 1.2vh, 0.7rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.02);
    margin: 0 auto;
}

#unifiedQrCanvas, #unifiedQrImage {
    width: var(--carnet-qr-sz, clamp(84px, 14.5vh, 115px)) !important;
    height: var(--carnet-qr-sz, clamp(84px, 14.5vh, 115px)) !important;
    min-height: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

#unifiedQrCanvas canvas, #unifiedQrCanvas img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

.qr-image {
    width: var(--carnet-qr-sz, clamp(84px, 14.5vh, 115px));
    height: var(--carnet-qr-sz, clamp(84px, 14.5vh, 115px));
    display: block;
    border-radius: 8px;
}

.qr-caption-dual {
    margin-top: clamp(0.12rem, 0.35vh, 0.22rem);
    font-size: clamp(0.56rem, 1vh, 0.65rem);
    color: var(--text-secondary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.qr-caption-dual i {
    color: var(--school-primary);
}

/* Departure Protocol Banner (Códigos de Color: Verde, Amarillo, Rojo) */
.departure-verified-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: clamp(0.22rem, 0.55vh, 0.35rem) 0.65rem;
    border-radius: 9999px;
    font-size: clamp(0.60rem, 1.1vh, 0.70rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    margin: 0;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

/* Verde: Se va solo */
.departure-banner-green {
    background: #ecfdf5 !important;
    color: #047857 !important;
    border-color: #a7f3d0 !important;
}

/* Amarillo: Bus Escolar */
.departure-banner-yellow {
    background: #fffbeb !important;
    color: #b45309 !important;
    border-color: #fde68a !important;
}

/* Rojo: Solo con persona autorizada */
.departure-banner-red {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border-color: #fecaca !important;
}

/* ==========================================================================
   REVERSO DEL CARNET: PORTAL DE VERIFICACIÓN 360° (COMPACTO Y RESPONSIVO)
   ========================================================================== */
.back-portal-header {
    text-align: center;
    padding-bottom: clamp(0.12rem, 0.4vh, 0.25rem);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.back-portal-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: clamp(0.55rem, 0.95vh, 0.62rem);
    font-weight: 800;
    color: var(--school-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(2, 132, 199, 0.08);
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    margin-bottom: 0.08rem;
}
.back-school-name {
    font-size: clamp(0.78rem, 1.4vh, 0.88rem);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.15;
}
.back-student-sub {
    font-size: clamp(0.60rem, 1.1vh, 0.68rem);
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 0.04rem;
}

/* Solvencia Strip */
.back-solvencia-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ecfdf5;
    border: 1.5px solid #a7f3d0;
    border-radius: 10px;
    padding: clamp(0.25rem, 0.6vh, 0.42rem) 0.6rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}
.back-solvencia-strip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.18);
}
.back-solvencia-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.back-solvencia-icon {
    width: clamp(20px, 3vh, 24px);
    height: clamp(20px, 3vh, 24px);
    border-radius: 50%;
    background: #10b981;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.64rem, 1vh, 0.72rem);
    flex-shrink: 0;
}
.back-solvencia-title {
    font-size: clamp(0.62rem, 1.1vh, 0.68rem);
    font-weight: 800;
    color: #065f46;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.1;
}
.back-solvencia-desc {
    font-size: clamp(0.56rem, 1vh, 0.64rem);
    color: #047857;
    font-weight: 600;
    margin-top: 0.04rem;
}
.back-solvencia-badge {
    font-size: clamp(0.56rem, 1vh, 0.62rem);
    font-weight: 800;
    background: #ffffff;
    color: #059669;
    padding: 0.12rem 0.45rem;
    border-radius: 9999px;
    border: 1px solid #a7f3d0;
    white-space: nowrap;
}

/* 2x2 Grid of Student Verification Cards */
.back-access-grid {
    flex: 1 1 0;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: clamp(0.25rem, 0.6vh, 0.45rem);
}

.back-access-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    padding: clamp(0.35rem, 0.8vh, 0.55rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    text-align: left;
}
.back-access-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.back-access-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
}
.card-asistencia::before { background: #0284c7; }
.card-conducta::before { background: #10b981; }
.card-tareas::before { background: #6366f1; }
.card-ranking::before { background: #f59e0b; }

.back-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.back-card-icon {
    width: clamp(22px, 3.2vh, 28px);
    height: clamp(22px, 3.2vh, 28px);
    border-radius: clamp(6px, 1vh, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.70rem, 1.2vh, 0.88rem);
    flex-shrink: 0;
}
.card-asistencia .back-card-icon { background: #f0f9ff; color: #0284c7; }
.card-conducta .back-card-icon { background: #ecfdf5; color: #059669; }
.card-tareas .back-card-icon { background: #eef2ff; color: #4f46e5; }
.card-ranking .back-card-icon { background: #fffbeb; color: #d97706; }

.back-card-action-arrow {
    font-size: clamp(0.58rem, 1vh, 0.65rem);
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.2s ease;
}
.back-access-card:hover .back-card-action-arrow {
    transform: translateX(2px);
    color: var(--text-primary);
}
.back-card-label {
    font-size: clamp(0.58rem, 1.1vh, 0.68rem);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.back-card-val {
    font-size: clamp(0.80rem, 1.7vh, 1.05rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    margin: clamp(0.02rem, 0.3vh, 0.1rem) 0;
}
.back-card-sub {
    font-size: clamp(0.58rem, 1vh, 0.68rem);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card Horario (Módulo 7) */
.card-horario {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%) !important;
    border: 1.5px solid #a5f3fc !important;
    padding: clamp(0.26rem, 0.55vh, 0.42rem) 0.65rem !important;
    border-radius: 11px !important;
    cursor: pointer;
    transition: transform 0.15s ease;
    margin: 0 !important;
    flex-shrink: 0;
}
.card-horario:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.15);
}
.card-horario .back-card-icon {
    background: #0891b2 !important;
    color: white !important;
    width: clamp(24px, 3.5vh, 30px) !important;
    height: clamp(24px, 3.5vh, 30px) !important;
    border-radius: 8px !important;
    font-size: clamp(0.75rem, 1.2vh, 0.9rem) !important;
}

/* Telegram Bot Banner */
.back-telegram-banner {
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    color: #ffffff;
    border-radius: 10px;
    padding: clamp(0.25rem, 0.55vh, 0.42rem) clamp(0.45rem, 1vh, 0.65rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 136, 204, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    width: 100%;
    text-align: left;
    flex-shrink: 0;
}
.back-telegram-banner:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 136, 204, 0.45);
}
.telegram-banner-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.telegram-icon-bubble {
    width: clamp(22px, 3.2vh, 26px);
    height: clamp(22px, 3.2vh, 26px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.8rem, 1.4vh, 1rem);
    color: #ffffff;
    flex-shrink: 0;
}
.telegram-banner-title {
    font-size: clamp(0.66rem, 1.2vh, 0.72rem);
    font-weight: 800;
    line-height: 1.15;
}
.telegram-banner-desc {
    font-size: clamp(0.56rem, 1vh, 0.64rem);
    opacity: 0.9;
    margin-top: 0.02rem;
}
.telegram-btn-pill {
    background: #ffffff;
    color: #0088cc;
    font-size: clamp(0.56rem, 1vh, 0.64rem);
    font-weight: 800;
    padding: 0.16rem 0.45rem;
    border-radius: 9999px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
}

/* Flip Back Return Button */
.back-flip-return-btn {
    width: 100%;
    padding: clamp(0.28rem, 0.65vh, 0.45rem);
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: clamp(0.66rem, 1.2vh, 0.74rem);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.back-flip-return-btn:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

/* ==========================================================================
   BARRA DE NAVEGACIÓN INFERIOR UNIFICADA (MOBILE-BOTTOM-NAV)
   Diseño idéntico a los módulos del sistema (Estilo App / Floating Circular FAB)
   ========================================================================== */
.mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    border-radius: 20px 20px 0 0;
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom, 0px)) 0.4rem;
    z-index: 9995;
    justify-content: space-around;
    align-items: flex-end;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.18rem;
    text-decoration: none;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.35rem 0.4rem;
    border-radius: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 54px;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i {
    font-size: 1.15rem;
    transition: transform 0.15s;
}

.bottom-nav-item:hover, .bottom-nav-item:active {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.04);
}

.bottom-nav-item:active i {
    transform: scale(0.92);
}

.bottom-nav-item.active {
    color: #059669;
}

/* Botón central flotante de acción rápida (Circular FAB elevado con corte blanco) */
.bottom-nav-item-highlight {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 0.2rem !important;
    margin-top: -24px !important;
    text-decoration: none;
    cursor: pointer;
    min-width: 60px;
    -webkit-tap-highlight-color: transparent;
    border: none;
}

.bottom-nav-item-highlight i {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.45);
    border: 3.5px solid #ffffff;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
}

.bottom-nav-item-highlight:hover i {
    transform: scale(1.06);
    box-shadow: 0 10px 24px rgba(5, 150, 105, 0.55);
}

.bottom-nav-item-highlight:active i {
    transform: scale(0.92);
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.4);
}

.bottom-nav-item-highlight span {
    font-size: 0.65rem;
    font-weight: 800;
    color: #047857 !important;
    margin-top: 3px;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

/* Variante azul para carnet de alumno */
.bottom-nav-item-highlight.fab-student i {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.45);
}

.bottom-nav-item-highlight.fab-student span {
    color: #0284c7 !important;
}

/* Compatibilidad retroactiva para action-bar legacy */
.mobile-action-bar {
    display: none !important;
}
.btn-perks i { color: #fbbf24; }

/* Modal for Special Actions (Retiro, SOS, Beneficios) */
.mobile-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.mobile-modal-card {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 380px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f1f5f9;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Customization: Frases Motivacionales */
.preset-quotes-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 0.8rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 2px;
}

.preset-quote-btn {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.76rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.35;
    font-family: inherit;
}

.preset-quote-btn:hover, .preset-quote-btn:active {
    background: #e0f2fe;
    border-color: #38bdf8;
    color: #0369a1;
    transform: translateX(2px);
}

.custom-quote-input {
    width: 100%;
    padding: 0.55rem 2.4rem 0.55rem 0.75rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.80rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-quote-input:focus {
    border-color: var(--school-primary);
    box-shadow: 0 0 0 3px rgba(0, 63, 109, 0.12);
}

/* Modal Customization: Aro de Fotografía */
.ring-colors-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
    margin-bottom: 0.8rem;
}

.ring-color-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.55rem 0.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.ring-color-choice:hover, .ring-color-choice.is-active {
    border-color: var(--ring-c);
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ring-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.ring-name {
    font-size: 0.63rem;
    font-weight: 700;
    color: #475569;
    text-align: center;
}

/* Premium Buttons */
.btn-premium-primary {
    background: linear-gradient(135deg, var(--school-primary), var(--school-secondary));
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-shadow: 0 4px 12px rgba(0, 63, 109, 0.25);
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-premium-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 63, 109, 0.35);
}

.btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* ==========================================================================
   MODO IMPRESIÓN FÍSICA PVC (NORMA ISO CR80: 53.98mm x 85.60mm)
   ========================================================================== */
@media print {
    @page {
        size: 53.98mm 85.60mm;
        margin: 0;
    }
    body {
        background: transparent !important;
        overflow: visible !important;
    }
    .carnet-top-bar,
    .mobile-bottom-nav,
    .avatar-ring-picker-btn,
    .student-quote-box .edit-icon-decor,
    .modal,
    .mobile-modal-overlay {
        display: none !important;
    }
    .mobile-viewport {
        max-width: 100% !important;
        height: 100% !important;
        padding: 0 !important;
    }
    .carnet-face {
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 3.18mm !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
