/* ==========================================================================
   STYLE.CSS — Sistema de Diseño Glassmorphism Ultra-Moderno 2026 (Studio Pro)
   Proyecto: QuickDrop Códigos
   Tablas BD afectadas: Ninguna
   Última actualización: 2026-09-20
   ========================================================================== */

/* --- 1. TOKENS Y PALETA DE COLOR DE ALTA FIDELIDAD --- */
:root {
    /* Modo Oscuro Sysdentist / Slate Navy Moderno (Ni claro ni oscuro profundo) */
    --bg-base: #202436;           /* Slate Navy elegante, suave y descansado */
    --bg-surface: #272d43;        /* Superficie ligeramente más clara */
    --bg-card: #2c324c;           /* Cards sólidas con tono pizarra azulado */
    --bg-card-hover: #353c5c;     /* Hover suave con contraste */
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-active: rgba(115, 103, 240, 0.18);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-card: rgba(255, 255, 255, 0.11);
    --border-active: #7367f0;
    --border-glow: rgba(115, 103, 240, 0.35);

    --text-primary: #f1f4f9;      /* Blanco suave de alto contraste y cero fatiga */
    --text-secondary: #a3adc2;    /* Slate legible no apagado */
    --text-tertiary: #7e8b9f;
    --text-inverse: #202436;

    --brand-indigo: #7367f0;      /* Sysdentist / Vuexy Violeta Índigo vibrante */
    --brand-indigo-light: #8f85f3;
    --brand-cyan: #0ea5e9;
    --brand-purple: #a855f7;
    --brand-pink: #ec4899;

    --status-success: #10b981;
    --status-success-bg: rgba(16, 185, 129, 0.14);
    --status-danger: #f43f5e;
    --status-danger-bg: rgba(244, 63, 94, 0.14);
    --status-warning: #f59e0b;
    --status-warning-bg: rgba(245, 158, 11, 0.14);

    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-card: 0 12px 32px -4px rgba(0, 0, 0, 0.32);
    --shadow-glow: 0 0 28px -4px rgba(115, 103, 240, 0.3);

    --blur-glass: blur(16px);
    --grid-dot-color: rgba(255, 255, 255, 0.06);

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="light"] {
    /* Modo Platino Confort / Descanso Visual (CERO Blanco Quirúrgico) */
    --bg-base: #dde3eb;
    --bg-surface: #edf1f6;
    --bg-card: #f3f6f9;
    --bg-card-hover: #ffffff;
    --bg-glass: rgba(15, 23, 42, 0.04);
    --bg-glass-active: rgba(79, 70, 229, 0.1);

    --border-subtle: rgba(15, 23, 42, 0.12);
    --border-card: #cbd5e1;
    --border-active: #6366f1;
    --border-glow: rgba(99, 102, 241, 0.25);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-inverse: #ffffff;

    --brand-indigo: #4f46e5;
    --brand-indigo-light: #6366f1;
    --brand-cyan: #0284c7;

    --shadow-subtle: 0 2px 8px rgba(15, 23, 42, 0.05);
    --shadow-card: 0 10px 25px -4px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 4px 18px rgba(79, 70, 229, 0.15);

    --grid-dot-color: rgba(15, 23, 42, 0.08);
}

/* --- 2. RESET Y ESTILOS BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: var(--font-body);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
    padding-bottom: env(safe-area-inset-bottom, 24px);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Patrón sutil de puntos geométricos de fondo */
body {
    background-image: 
        radial-gradient(var(--grid-dot-color) 1px, transparent 1px),
        radial-gradient(circle at 50% 0%, rgba(115, 103, 240, 0.12), transparent 55%),
        radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.08), transparent 45%);
    background-size: 28px 28px, 100% 100%, 100% 100%;
    background-attachment: fixed;
}

[data-theme="light"] body {
    background-image: 
        radial-gradient(var(--grid-dot-color) 1px, transparent 1px),
        radial-gradient(circle at 50% 0%, rgba(79, 70, 229, 0.05), transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(2, 132, 199, 0.04), transparent 40%);
}

[data-theme="light"] .pin-digit-box {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .key-btn {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .key-btn:hover {
    background: #f1f5f9;
    border-color: var(--brand-indigo);
}

[data-theme="light"] .dropzone-studio {
    background: #e8edf4;
    border-color: #cbd5e1;
}

[data-theme="light"] .smart-input-container {
    background: #ffffff;
    border-color: #cbd5e1;
}

[data-theme="light"] .pin-hero-card {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.06), rgba(2, 132, 199, 0.04));
    border-color: rgba(79, 70, 229, 0.3);
}

[data-theme="light"] .pin-giant-code {
    background: linear-gradient(135deg, #1d4ed8, #4338ca, #6d28d9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

/* --- 3. LAYOUT RESPONSIVE FLUIDO (ESTUDIO EN DESKTOP) --- */
.app-container {
    max-width: min(1380px, 95vw);
    margin: 0 auto;
    padding: 18px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.lobby-container {
    max-width: min(1080px, 94vw);
}

/* Barra de navegación superior */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-full);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    margin-bottom: 24px;
    box-shadow: var(--shadow-subtle);
    box-sizing: border-box;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
    user-select: none;
}

.logo-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand-indigo), var(--brand-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-logo:hover .logo-badge {
    transform: rotate(8deg) scale(1.08);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-text span {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

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

.icon-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
    border-color: var(--border-active);
    transform: translateY(-1px);
}

/* --- 4. GRID ESTUDIO Y LOBBY DE 2 COLUMNAS (DESKTOP / LAPTOP) --- */
.studio-grid {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.lobby-grid {
    width: 100%;
    margin: auto 0;
}

.lobby-card {
    display: flex;
    flex-direction: column;
    height: auto;
}

.lobby-features-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: clamp(8px, 1.2vh, 14px);
    padding-top: clamp(8px, 1.2vh, 12px);
    border-top: 1px solid var(--border-subtle);
}

.feature-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-card);
}

.feature-tag span {
    font-size: 0.85rem;
}

.app-footer {
    padding: 8px 0 4px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

@media (max-width: 767px) {
    html, body {
        min-height: 100%;
        overflow-y: auto !important;
    }
    .studio-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .app-container {
        padding: 10px 14px 24px;
        min-height: 100vh;
        height: auto;
        max-height: none;
    }
}

/* --- 5. TARJETAS GLASSMORPHISM ELEVADAS --- */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    position: relative;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.glass-card:hover {
    border-color: var(--border-active);
}

/* Resplandor decorativo sutil en esquina superior */
.glass-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.4;
}

/* --- 6. HERO PIN Y ESTADÍSTICAS --- */
.pin-hero-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(6, 182, 212, 0.04));
    border: 1px solid var(--border-active);
    box-shadow: var(--shadow-glow);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.pin-display-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.pin-giant-code {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 2.2vw + 0.5rem, 2.6rem);
    font-weight: 800;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(56, 189, 248, 0.3);
    line-height: 1.1;
    min-width: 0;
    word-break: break-word;
}

.pin-giant-code.pin-code-long {
    font-size: clamp(1.2rem, 1.4vw + 0.4rem, 1.65rem);
    letter-spacing: 1px;
}

.pin-action-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pin-stats-bar {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.stat-pill {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    padding: 5px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.stat-pill strong {
    color: var(--text-primary);
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--status-success);
    box-shadow: 0 0 10px var(--status-success);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* --- 7. ZONA DE SUBIDA DRAG & DROP MODERNA --- */
.dropzone-studio {
    border: 2px dashed var(--border-card);
    border-radius: var(--radius-md);
    padding: 36px 20px;
    text-align: center;
    background: var(--bg-glass);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.dropzone-studio:hover, .dropzone-studio.dragover {
    border-color: var(--brand-indigo);
    background: var(--bg-glass-active);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -5px rgba(99, 102, 241, 0.25);
}

.dropzone-icon-box {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.15));
    border: 1px solid var(--border-active);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-cyan);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dropzone-studio:hover .dropzone-icon-box {
    transform: scale(1.1) translateY(-4px);
}

.kbd-badge {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- 8. BARRA DE ENTRADA INTELIGENTE (TEXTO / ENLACE) --- */
.smart-input-container {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 5px 6px 5px 14px;
    gap: 8px;
    margin-top: 14px;
    box-shadow: var(--shadow-subtle);
    transition: all 0.2s ease;
}

.smart-input-container:focus-within {
    border-color: var(--brand-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.smart-input-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
}

.smart-input-field::placeholder {
    color: var(--text-tertiary);
}

/* --- 9. BOTONES DE ACCIÓN PRINCIPALES --- */
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.6);
    filter: brightness(1.08);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--bg-surface);
    border-color: var(--border-active);
    transform: translateY(-1px);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: var(--status-danger);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-danger-outline:hover {
    background: var(--status-danger-bg);
    border-color: var(--status-danger);
    color: #ffffff;
}

/* --- 10. LISTA DE ELEMENTOS Y FEED EN VIVO --- */
.items-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.badge-counter {
    background: var(--bg-glass-active);
    color: var(--brand-cyan);
    border: 1px solid var(--border-active);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Tarjeta individual de elemento */
.item-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-subtle);
    transition: all 0.2s ease;
}

.item-card:hover {
    border-color: var(--border-card);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

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

.item-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
}

.item-icon-box.icon-image { background: rgba(99, 102, 241, 0.12); color: #818cf8; border-color: rgba(99, 102, 241, 0.3); }
.item-icon-box.icon-pdf { background: rgba(244, 63, 94, 0.12); color: #fb7185; border-color: rgba(244, 63, 94, 0.3); }
.item-icon-box.icon-link { background: rgba(6, 182, 212, 0.12); color: #22d3ee; border-color: rgba(6, 182, 212, 0.3); }
.item-icon-box.icon-text { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }

.item-details {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

/* Caja de previsualización de notas */
.text-preview-box {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--brand-cyan);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
}

/* Fila de botones de acción rápida */
.item-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.action-chip {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.action-chip:hover {
    background: var(--brand-indigo);
    color: #ffffff;
    border-color: var(--brand-indigo);
    transform: translateY(-1px);
}

.action-chip.danger {
    color: var(--status-danger);
}

.action-chip.danger:hover {
    background: var(--status-danger);
    color: #ffffff;
    border-color: var(--status-danger);
}

/* --- 11. KEYPAD DE 4 DÍGITOS (INDEX) --- */
.pin-display-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0 14px;
}

.pin-digit-box {
    width: 46px;
    height: 52px;
    background: var(--bg-surface);
    border: 2px solid var(--border-card);
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-subtle);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pin-digit-box.filled {
    border-color: var(--brand-cyan);
    background: rgba(6, 182, 212, 0.08);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.35);
    transform: translateY(-2px);
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-width: 260px;
    margin: 0 auto;
}

.key-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-subtle);
    transition: all 0.15s ease;
    user-select: none;
}

.key-btn:hover {
    border-color: var(--border-active);
    transform: translateY(-1px);
}

.key-btn:active {
    transform: scale(0.94);
    background: var(--brand-indigo);
    color: #ffffff;
}

.key-btn.action-key {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- 12. PESTAÑAS Y TOGGLES --- */
.mode-tabs {
    display: flex;
    background: var(--bg-glass);
    border: 1px solid var(--border-card);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.mode-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-tab-btn.active {
    background: var(--brand-indigo);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* --- 13. SELECTOR PRO: 24H VS PERMANENTE --- */
.duration-toggle-group {
    display: flex;
    gap: 12px;
    margin: 16px 0 20px;
}

.duration-pill {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.duration-pill.active {
    border-color: var(--brand-cyan);
    background: rgba(6, 182, 212, 0.06);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
}

.duration-pill.pro-pill {
    border-color: rgba(245, 158, 11, 0.4);
}

.duration-pill.pro-pill:hover {
    border-color: var(--status-warning);
    background: rgba(245, 158, 11, 0.08);
}

.pro-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.duration-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.duration-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* --- 14. SISTEMA DE TOASTS (REGLA 3) --- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100vw - 48px);
}

.toast-msg {
    pointer-events: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: var(--text-primary);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateX(120%);
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
}

.toast-msg.toast-success { border-left: 4px solid var(--status-success); }
.toast-msg.toast-error { border-left: 4px solid var(--status-danger); }
.toast-msg.toast-warning { border-left: 4px solid var(--status-warning); }
.toast-msg.toast-info { border-left: 4px solid var(--brand-cyan); }

.toast-msg.hide {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn { to { transform: translateX(0); } }
@keyframes toastSlideOut { to { transform: translateX(120%); opacity: 0; } }

/* --- 15. MODALES (DESTRUCTIVOS A LA IZQUIERDA - REGLA 3) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-card);
    padding: 28px;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 24px;
}

/* --- 16. HAZ NEÓN DE TRANSFERENCIA --- */
.beam-pulse {
    animation: beamWave 1.4s ease-out;
}

@keyframes beamWave {
    0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.8); }
    70% { box-shadow: 0 0 0 35px rgba(6, 182, 212, 0); }
    100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

/* ==========================================================================
   --- 17. CATCHER GLOBAL DE DRAG & DROP (TODA LA PANTALLA ES ZONA DE SOLTADO) ---
   ========================================================================== */
.global-drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(7, 9, 14, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

[data-theme="light"] .global-drop-overlay {
    background: rgba(221, 227, 235, 0.88);
}

.global-drop-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.drop-modal-box {
    background: var(--bg-card);
    border: 2px dashed var(--brand-cyan);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    text-align: center;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 0 50px rgba(6, 182, 212, 0.35);
    transform: scale(0.95);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.global-drop-overlay.active .drop-modal-box {
    transform: scale(1);
}

.drop-icon-anim {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(6, 182, 212, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: dropPulse 1.8s infinite;
}

@keyframes dropPulse {
    0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.6); transform: scale(1); }
    50% { box-shadow: 0 0 0 20px rgba(6, 182, 212, 0); transform: scale(1.06); }
    100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); transform: scale(1); }
}

.drop-modal-box h3 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.drop-modal-box p {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 18px;
}

.drop-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.drop-badges span {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

/* ==========================================================================
   --- 18. BARRA DE BUZONES RECIENTES "SUGERIDOS PARA TI" (ESTILO DROPBOX) ---
   ========================================================================== */
.recents-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    margin-bottom: clamp(8px, 1.2vh, 14px);
    width: 100%;
    box-sizing: border-box;
}

.recents-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.recents-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.recents-clear-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.recents-clear-btn:hover {
    color: var(--status-danger);
}

.recents-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    padding: 2px 0;
}

.recents-scroll::-webkit-scrollbar {
    display: none;
}

.recent-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.recent-chip:hover {
    border-color: var(--brand-cyan);
    background: var(--bg-glass-active);
    color: var(--brand-cyan);
    transform: translateY(-1px);
}

.recent-chip-icon {
    font-size: 0.85rem;
}

.recent-chip-pin {
    font-family: var(--font-code);
    font-weight: 700;
}

/* ==========================================================================
   --- 19. HOME QUICK DROPZONE (SOLTADO RÁPIDO EN HOME) ---
   ========================================================================== */
.home-quick-dropzone {
    border: 1.5px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 9px 12px;
    background: var(--bg-glass);
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.home-quick-dropzone:hover {
    border-color: var(--brand-cyan);
    background: var(--bg-surface);
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.12);
}

.dropzone-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropzone-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.dropzone-text strong {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.dropzone-text span {
    font-size: 0.68rem;
    color: var(--text-tertiary);
}

/* ==========================================================================
   --- 20. CUADRÍCULA DE TELEMETRÍA Y BENEFICIOS (SAAS STYLE) ---
   ========================================================================== */
.telemetry-section {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: clamp(8px, 1.2vh, 16px);
    margin-bottom: clamp(4px, 0.8vh, 10px);
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 1024px) and (min-height: 620px) {
    .telemetry-section {
        display: grid;
    }
}

.telemetry-card {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    box-shadow: var(--shadow-subtle);
    transition: border-color 0.2s ease;
}

.telemetry-card:hover {
    border-color: var(--border-active);
}

.telemetry-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.telemetry-info h4 {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 2px;
}

.telemetry-info p {
    font-size: 0.66rem;
    color: var(--text-secondary);
    line-height: 1.3;
    margin: 0;
}

/* ==========================================================================
   --- 21. ARQUITECTURA RESPONSIVE INTRÍNSECA (ESTÁNDAR PANTALLAS-ESTILOS) ---
   Implementación estricta de las 5 Leyes y Primitivas de PANTALLAS-ESTILOS:
   - The Cover (.l-cover / .l-cover-center)
   - The Switcher (.l-switcher con cálculo matemático flex-basis)
   - The Cluster (.l-cluster con gap elástico)
   - The Reel (.l-reel para scroll táctil de recientes)
   - Container Queries (@container) para adaptación basada en contenedor
   ========================================================================== */



/* Reglas Globales Base (Reset Resiliente) */
html, body {
    min-height: 100dvh;
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
}

.app-container {
    min-height: 100dvh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.lobby-container {
    width: 100%;
    max-width: var(--container-max, min(94vw, 1360px));
    margin-inline: auto;
    padding: clamp(6px, 1.2vh, 18px) clamp(12px, 2vw, 28px);
    box-sizing: border-box;
}

/* ==========================================================================
   SISTEMA DE ADAPTABILIDAD UNIVERSAL (PANTALLAS-ESTILOS + 5 REPOSITORIOS)
   Utopia.fyi + Awesome-CQ + Open-Props + Modern-CSS-Reset + ModernCSS.dev
   ========================================================================== */

/* --- 1. THE SWITCHER INTRÍNSECO (Andy Bell / Every Layout) --- */
.lobby-grid.l-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: var(--switcher-gap, clamp(10px, 1.5vw, 24px));
    width: 100%;
    margin: auto 0;
    align-items: flex-start;
    align-content: flex-start;
    box-sizing: border-box;
}

.lobby-grid.l-switcher > .lobby-card {
    flex-grow: 1;
    flex-shrink: 0;
    /* Umbral 52rem (~832px): En Desktop side-by-side (50%), en Tablet/Móvil stack (100%) */
    flex-basis: calc((var(--switcher-threshold, 52rem) - 100%) * 999);
    max-width: 100%;
    min-width: 0;
    height: auto;
    align-self: flex-start;
    box-sizing: border-box;
    container-type: inline-size;
    container-name: card;
}

.lobby-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: clamp(10px, 1.4vw, 18px);
    padding: clamp(10px, 1.4vh, 18px) clamp(12px, 1.6vw, 20px);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: clamp(6px, 1vh, 12px);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

/* Disposición base de las columnas internas */
.pin-mode-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.card-create-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* --- 2. CONTAINER QUERIES REACTIVAS (Awesome-Container-Queries) --- */
/* Cuando la tarjeta tiene más de 480px de ancho (modo stack en tablet o monitor amplio) */
@container card (min-width: 480px) {
    .card-title h2 {
        font-size: var(--font-h2);
    }
    
    /* Layout horizontal dentro de Card 1 (PIN a la izquierda, Teclado a la derecha) */
    .pin-mode-wrapper {
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        gap: 20px;
    }
    .pin-mode-wrapper > * {
        flex: 1;
        min-width: 0;
    }

    /* Layout horizontal dentro de Card 2 (Formulario a la izquierda, Dropzone a la derecha) */
    .card-create-body {
        flex-direction: row;
        align-items: stretch;
        gap: 18px;
    }
    .create-fields-col {
        flex: 1.1;
        min-width: 0;
    }
    .create-dropzone-col {
        flex: 0.9;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .home-quick-dropzone {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 80px;
    }

    .keypad-grid {
        max-width: 250px;
        gap: 6px;
    }
    .key-btn {
        height: 36px;
        font-size: 1.1rem;
    }
    .pin-digit-box {
        width: 44px;
        height: 44px;
        font-size: 1.35rem;
    }
    .lobby-features-strip {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Cuando la tarjeta se encuentra en un contenedor muy angosto (< 340px) */
@container card (max-width: 340px) {
    .card-title h2 {
        font-size: 0.98rem;
    }
    .card-subtitle {
        display: none !important;
    }
    .key-btn {
        height: 38px;
        font-size: 1.12rem;
    }
    .pin-digit-box {
        width: 38px;
        height: 42px;
        font-size: 1.25rem;
    }
    .lobby-features-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    .feature-tag {
        font-size: 0.64rem;
        padding: 2px 4px;
    }
}

/* --- 3. UTILIDADES DE FORMULARIO FLUIDO --- */
.card-qr-btn-group {
    margin-top: clamp(4px, 0.8vh, 10px);
}

.btn-fullwidth {
    width: 100%;
}

.form-group-compact {
    margin-bottom: clamp(4px, 0.8vh, 8px);
}

.form-field-label {
    font-size: clamp(0.68rem, 0.65rem + 0.1vw, 0.76rem);
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 2px;
}

.input-styled {
    width: 100%;
    padding: clamp(5px, 0.8vh, 9px) 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    font-size: clamp(0.76rem, 0.72rem + 0.15vw, 0.86rem);
    color: var(--text-primary);
    box-sizing: border-box;
}

/* --- 4. CONCIENCIA DE ALTURA REDUCIDA (Ventanas Split Screen, 252px - 520px, Laptops) --- */
@media (max-height: 520px) {
    /* En alturas reducidas, ocultar telemetría y footer para que la app quepa al 100% sin scroll */
    #telemetrySection,
    .app-footer {
        display: none !important;
    }

    html, body {
        overflow-y: auto;
    }

    .l-cover {
        min-height: 100dvh;
        padding: 4px clamp(6px, 1.5vw, 14px) !important;
        justify-content: space-between;
    }

    .header-bar {
        padding: 2px 8px !important;
        margin-bottom: 3px !important;
        min-height: 30px !important;
    }

    .logo-badge {
        width: 22px !important;
        height: 22px !important;
    }
    .logo-badge svg {
        width: 12px !important;
        height: 12px !important;
    }

    .brand-text h1 {
        font-size: 0.84rem !important;
    }
    .brand-text span {
        display: none !important;
    }

    .icon-btn {
        width: 26px !important;
        height: 26px !important;
    }

    .lobby-grid.l-switcher {
        margin: 0 auto !important;
        gap: 6px !important;
    }

    .lobby-card {
        padding: 5px 10px !important;
        border-radius: 10px !important;
    }

    .card-title {
        font-size: 0.84rem !important;
        margin-bottom: 2px !important;
    }
    .card-title svg {
        width: 14px !important;
        height: 14px !important;
    }

    .card-subtitle {
        display: none !important; /* Ocultar subtítulos en altura reducida */
    }

    .mode-tabs {
        margin-bottom: 3px !important;
        padding: 2px !important;
    }
    .mode-tab-btn {
        padding: 2px 6px !important;
        font-size: 0.68rem !important;
    }

    .pin-display-group {
        margin: 1px 0 3px !important;
        gap: 4px !important;
    }

    .pin-digit-box {
        width: 28px !important;
        height: 28px !important;
        font-size: 1.05rem !important;
    }

    /* Keypad en 2 filas de 6 botones para ahorrar 80px verticales */
    .keypad-grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 3px !important;
        max-width: 260px !important;
        margin: 0 auto !important;
    }

    .key-btn {
        height: 22px !important;
        font-size: 0.82rem !important;
        border-radius: 4px !important;
    }

    .card-qr-btn-group {
        margin-top: 2px !important;
    }
    .card-qr-btn-group .btn-secondary {
        padding: 3px 6px !important;
        font-size: 0.66rem !important;
    }

    .form-field-label {
        display: none !important;
    }

    .form-group-compact {
        margin-bottom: 2px !important;
    }

    .input-styled {
        padding: 3px 8px !important;
        font-size: 0.74rem !important;
        height: 26px !important;
    }

    .duration-toggle-group {
        margin: 0 0 3px !important;
        gap: 3px !important;
    }
    .duration-pill {
        padding: 2px 6px !important;
    }
    .duration-name {
        font-size: 0.68rem !important;
    }
    .duration-desc {
        display: none !important;
    }

    .btn-primary {
        padding: 4px 8px !important;
        font-size: 0.72rem !important;
        margin-bottom: 2px !important;
    }

    .home-quick-dropzone {
        padding: 3px 6px !important;
        margin-bottom: 0 !important;
    }
    .dropzone-icon {
        width: 18px !important;
        height: 18px !important;
    }
    .dropzone-icon svg {
        width: 12px !important;
        height: 12px !important;
    }
    .dropzone-text strong {
        font-size: 0.68rem !important;
    }
    .dropzone-text span {
        display: none !important;
    }

    .lobby-features-strip {
        display: none !important;
    }

    .recents-bar-wrapper {
        padding: 1px 6px !important;
        margin-bottom: 2px !important;
    }
}

/* Fallback extremo para ventanas < 240px de altura */
@media (max-height: 240px) {
    html, body {
        height: auto !important;
        overflow-y: auto !important;
    }
    .l-cover {
        height: auto !important;
        min-height: auto !important;
    }
}

/* --- SEGURIDAD PRO: CONTRASEÑA ADICIONAL DENTRO DEL BUZÓN --- */
.pin-security-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
    gap: 8px;
    flex-wrap: wrap;
}

.pin-security-label {
    font-size: 0.74rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.btn-lock-box-trigger {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #f59e0b;
    border-radius: var(--radius-sm);
    padding: 5px 11px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-lock-box-trigger:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
    transform: translateY(-1px);
}

.pro-tag-mini {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 2px;
    letter-spacing: 0.5px;
}

.badge-locked-status {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #10b981;
    border-radius: var(--radius-sm);
    padding: 5px 11px;
    font-size: 0.74rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.badge-locked-status:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.shake-anim {
    animation: shakeEffect 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeEffect {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Blindaje contra Auto-completado y Llenado Automático de Contraseñas del Navegador */
.input-masked-secret {
    -webkit-text-security: disc !important;
    text-security: disc !important;
}

.input-masked-secret.is-revealed {
    -webkit-text-security: none !important;
    text-security: none !important;
}

/* ==========================================================================
   --- 22. ESTÁNDAR ARQUITECTÓNICO MÓVIL Y TABLET (< 768px) ---
   Cero espacios muertos, cero scrolls forzados, conmutador táctil inteligente
   ========================================================================== */
.mobile-lobby-switcher {
    display: none;
}

@media (max-width: 767px) {
    html, body {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .app-container.lobby-container {
        padding: 8px 10px 18px !important;
        max-width: 100vw !important;
        min-height: 100dvh !important;
        justify-content: flex-start !important;
        box-sizing: border-box !important;
    }

    .l-cover > .l-cover-center {
        margin-block: 0 !important;
    }

    /* 1. Cabecera Ultra-Compacta: Barra slim de 46px en una sola fila (CERO envoltorio/huevo) */
    .header-bar {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        height: 46px !important;
        min-height: 46px !important;
        max-height: 46px !important;
        padding: 6px 12px !important;
        margin-bottom: 8px !important;
        border-radius: 14px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15) !important;
    }

    .brand-logo {
        gap: 8px !important;
        flex-shrink: 0 !important;
    }

    .logo-badge {
        width: 30px !important;
        height: 30px !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
    }

    .logo-badge svg {
        width: 16px !important;
        height: 16px !important;
    }

    .brand-text h1 {
        font-size: 1.05rem !important;
        line-height: 1.1 !important;
        margin: 0 !important;
    }

    /* Ocultar subtítulo en móvil para que el header sea slim y no ocupe espacio vertical */
    .brand-text span {
        display: none !important;
    }

    .header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
        flex-wrap: nowrap !important;
    }

    .icon-btn {
        width: 32px !important;
        height: 32px !important;
        padding: 4px !important;
        border-radius: 8px !important;
        flex-shrink: 0 !important;
    }

    .icon-btn svg {
        width: 15px !important;
        height: 15px !important;
    }

    .header-actions .btn-secondary {
        padding: 5px 8px !important;
        height: 32px !important;
        font-size: 0.74rem !important;
        border-radius: 8px !important;
    }

    .header-actions .btn-secondary span {
        display: none !important;
    }

    /* 2. Barra de Recientes Compacta */
    .recents-bar-wrapper {
        padding: 4px 10px !important;
        margin-bottom: 8px !important;
        border-radius: 10px !important;
        font-size: 0.74rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .recents-title {
        font-size: 0.72rem !important;
    }

    .recents-scroll {
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .recents-chip {
        padding: 3px 8px !important;
        font-size: 0.72rem !important;
        flex-shrink: 0 !important;
    }

    /* 3. Conmutador Táctil de Pestañas Móvil (Abrir vs Crear) */
    .mobile-lobby-switcher {
        display: flex !important;
        align-items: center !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border-card) !important;
        padding: 3px !important;
        border-radius: 12px !important;
        margin-bottom: 8px !important;
        gap: 4px !important;
        box-shadow: var(--shadow-subtle) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .mobile-switcher-tab {
        flex: 1 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        height: 38px !important;
        border: none !important;
        background: transparent !important;
        color: var(--text-secondary) !important;
        font-size: 0.84rem !important;
        font-weight: 700 !important;
        border-radius: 9px !important;
        cursor: pointer !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
        user-select: none !important;
        font-family: inherit !important;
    }

    .mobile-switcher-tab.active {
        background: linear-gradient(135deg, var(--brand-indigo), #4f46e5) !important;
        color: #ffffff !important;
        box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4) !important;
    }

    .mobile-switcher-tab:active {
        transform: scale(0.97) !important;
    }

    /* Ocultar tarjeta inactiva en móvil */
    .lobby-card.mobile-card-hidden {
        display: none !important;
    }

    /* 4. Tarjetas del Lobby en Móvil */
    .lobby-grid.l-switcher {
        gap: 8px !important;
        margin: 0 !important;
        width: 100% !important;
    }

    .lobby-card {
        padding: 12px 14px !important;
        border-radius: 16px !important;
        gap: 6px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .card-title {
        margin-bottom: 2px !important;
    }

    .card-title h2 {
        font-size: 1.05rem !important;
    }

    .card-subtitle {
        display: none !important;
    }

    /* 5. Pestañas de modo PIN / Alias */
    .mode-tabs {
        margin-bottom: 6px !important;
        padding: 2px !important;
        border-radius: 9px !important;
    }

    .mode-tab-btn {
        padding: 4px 6px !important;
        font-size: 0.74rem !important;
        border-radius: 7px !important;
    }

    /* 6. Burbujas PIN y Keypad Táctil Cómodo */
    .pin-display-group {
        margin: 2px auto 6px !important;
        gap: 8px !important;
    }

    .pin-digit-box {
        width: 40px !important;
        height: 44px !important;
        font-size: 1.3rem !important;
        border-radius: 10px !important;
    }

    .keypad-grid {
        gap: 5px !important;
        max-width: 280px !important;
        width: 100% !important;
        margin: 0 auto !important;
    }

    .key-btn {
        height: 40px !important;
        font-size: 1.15rem !important;
        border-radius: 8px !important;
    }

    .key-btn.action-key {
        font-size: 0.8rem !important;
    }

    .card-qr-btn-group {
        margin-top: 6px !important;
    }

    .card-qr-btn-group .btn-secondary {
        height: 38px !important;
        padding: 6px 12px !important;
        font-size: 0.78rem !important;
        border-radius: 9px !important;
    }

    /* 7. Card 2 Crear Nuevo Buzón */
    .form-group-compact {
        margin-bottom: 6px !important;
    }

    .form-field-label {
        font-size: 0.72rem !important;
        margin-bottom: 2px !important;
    }

    .input-styled {
        height: 38px !important;
        padding: 6px 10px !important;
        font-size: 0.82rem !important;
    }

    .duration-toggle-group {
        gap: 6px !important;
        margin: 2px 0 6px !important;
    }

    .duration-pill {
        padding: 5px 8px !important;
        border-radius: 8px !important;
    }

    .duration-name {
        font-size: 0.74rem !important;
    }

    .duration-desc {
        font-size: 0.64rem !important;
    }

    .btn-primary.btn-fullwidth {
        height: 42px !important;
        font-size: 0.84rem !important;
        border-radius: 10px !important;
        margin-top: 4px !important;
    }

    .home-quick-dropzone {
        padding: 8px 10px !important;
        margin-top: 6px !important;
        border-radius: 10px !important;
    }

    .dropzone-icon {
        width: 26px !important;
        height: 26px !important;
    }

    .dropzone-text strong {
        font-size: 0.76rem !important;
    }

    .dropzone-text span {
        font-size: 0.66rem !important;
    }

    .lobby-features-strip {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 4px !important;
        margin-top: 6px !important;
        padding-top: 6px !important;
    }

    .feature-tag {
        font-size: 0.65rem !important;
        padding: 3px 6px !important;
    }

    /* 8. Ocultar telemetría pesada en móvil para evitar overflow horizontal (555px -> 375px) */
    .telemetry-section {
        display: none !important;
    }
}

/* ==========================================================================
   ESTILOS DE AUTENTICACIÓN, CUENTA PRO Y DROPDOWN (SLATE NAVY SYSDENTIST)
   ========================================================================== */
.btn-auth-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.btn-auth-trigger:hover {
    border-color: var(--brand-indigo);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}
.btn-auth-trigger.auth-logged-in {
    background: rgba(115, 103, 240, 0.12);
    border-color: rgba(115, 103, 240, 0.4);
    color: var(--text-primary);
}
.auth-avatar-badge {
    font-size: 1rem;
    line-height: 1;
}
.auth-user-name {
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--border-card);
    background: rgba(255, 255, 255, 0.02);
}
.user-dropdown-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(115, 103, 240, 0.15);
    border: 1px solid rgba(115, 103, 240, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.badge-plan-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(115, 103, 240, 0.15);
    color: #a39cf7;
    margin-top: 4px;
    border: 1px solid rgba(115, 103, 240, 0.3);
}
.user-dropdown-menu {
    padding: 6px;
}
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.15s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.user-dropdown-item:hover {
    background: var(--bg-card-hover);
}
.user-dropdown-item.text-danger {
    color: #ef4444;
}
.user-dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Modal Auth Tabs */
.auth-nav-tabs {
    display: flex;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--border-card);
}
.auth-nav-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: calc(var(--radius-md) - 2px);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.auth-nav-btn.active {
    background: var(--brand-indigo);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(115, 103, 240, 0.35);
}

/* ==========================================================================
   DROPDOWN DE PERFIL DE USUARIO / CERRAR SESIÓN
   ========================================================================== */
.user-auth-dropdown {
    position: fixed;
    z-index: 999999;
    min-width: 280px;
    max-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 1px rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    overflow: hidden;
    animation: dropdownFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
}

.user-dropdown-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(115, 103, 240, 0.15);
    border: 1px solid rgba(115, 103, 240, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.user-dropdown-info {
    overflow: hidden;
    flex: 1;
}

.user-dropdown-menu {
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 500;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.user-dropdown-item:hover {
    background: rgba(115, 103, 240, 0.12);
    color: var(--brand-indigo);
}

.user-dropdown-item svg {
    flex-shrink: 0;
}

.user-dropdown-item.text-danger {
    color: var(--status-danger, #ef4444);
    border-top: 1px solid var(--border-subtle);
    margin-top: 4px;
    padding-top: 10px;
    font-weight: 600;
}

.user-dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

/* ==========================================================================
   FOOTER UNIFICADO Y MODAL LEGAL HUB
   ========================================================================== */
.app-footer {
    margin-top: auto;
    padding: 24px 16px 18px;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.legal-footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 12px;
    font-size: 0.78rem;
}

.legal-link-btn {
    color: var(--text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
    font-family: inherit;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.legal-link-btn:hover {
    color: var(--brand-indigo);
    background: rgba(115, 103, 240, 0.08);
}

.legal-link-btn.highlight {
    color: var(--brand-indigo);
    font-weight: 600;
}

.legal-separator {
    color: var(--border-card);
    font-size: 0.7rem;
}

.modal-legal-box {
    max-width: 820px;
    width: 95%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.modal-legal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
}

.modal-legal-tabs-bar {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-card);
    overflow-x: auto;
    scrollbar-width: none;
}

.modal-legal-tabs-bar::-webkit-scrollbar {
    display: none;
}

.modal-tab-pill {
    padding: 7px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.modal-tab-pill:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.modal-tab-pill.active {
    background: var(--brand-indigo);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(115, 103, 240, 0.35);
}

.modal-legal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 30px;
    line-height: 1.65;
    font-size: 0.88rem;
}

/* ==========================================================================
   PIE DE PÁGINA LEGAL UNIFICADO (MODERNO Y MINIMALISTA)
   ========================================================================== */
.app-footer {
    padding: 24px 16px 28px;
    text-align: center;
    border-top: 1px solid var(--border-card);
    margin-top: auto;
    width: 100%;
}

.legal-footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 10px;
    margin-bottom: 8px;
}

.legal-link-btn {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    padding: 5px 9px !important;
    font-family: var(--font-body) !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
    cursor: pointer !important;
    border-radius: var(--radius-sm) !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    box-shadow: none !important;
}

.legal-link-btn:hover {
    color: var(--brand-indigo) !important;
    background: rgba(115, 103, 240, 0.08) !important;
    transform: translateY(-1px);
}

.legal-link-btn.highlight {
    color: var(--brand-indigo) !important;
    font-weight: 600 !important;
}

.legal-separator {
    color: var(--border-card);
    font-size: 0.65rem;
    user-select: none;
    opacity: 0.6;
}




