/* Ubicación: public_html/asesoria.virtualex.ec/css/style.css */

:root {
    /* Paleta de Colores */
    --color-primary-dark: #0B1F3A;
    --color-primary: #1E3A8A;
    --color-accent: #3B82F6;
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;
    
    /* Superficies */
    --bg-body: #F3F4F6;
    --bg-card: #FFFFFF;
    --bg-input: #F9FAFB;
    
    /* Tipografía */
    --text-main: #111827;
    --text-secondary: #6B7280;
    
    /* Dimensiones y Efectos */
    --radius-sm: 8px;
    --radius-md: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --nav-height: 70px;
    --sidebar-width: 280px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px; /* Base legible para móviles */
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: color 0.3s; }
button, input, textarea, select { font-family: inherit; border: none; outline: none; font-size: 1rem; }

/* --- UTILIDADES UI --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; gap: 0.5rem;
    user-select: none;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background-color: var(--color-primary); color: white; }
.btn-primary:hover { background-color: var(--color-primary-dark); box-shadow: var(--shadow-md); }

.btn-outline {
    background-color: transparent; border: 2px solid var(--color-primary); color: var(--color-primary);
}
.btn-outline:hover { background-color: var(--color-primary); color: white; }

.btn-ghost { color: var(--text-secondary); background: transparent; }
.btn-ghost:hover { color: var(--color-primary); background: rgba(59, 130, 246, 0.1); }

/* Inputs Adaptables */
.input-group { margin-bottom: 1.25rem; }
.input-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; color: var(--text-main); }
.form-control {
    width: 100%; padding: 0.875rem 1rem;
    background: var(--bg-input);
    border: 1px solid #E5E7EB; border-radius: var(--radius-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: white;
}

/* Tarjetas Responsivas */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem; /* Padding reducido en móvil */
    border: 1px solid rgba(0,0,0,0.05);
    height: 100%; /* Para grids */
}
@media (min-width: 768px) {
    .card { padding: 2.5rem; }
}

/* --- NAVEGACIÓN --- */
.navbar {
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #E5E7EB;
    position: fixed; top: 0; width: 100%; z-index: 1000;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem;
}

.logo {
    font-size: 1.25rem; font-weight: 800; color: var(--color-primary-dark);
    display: flex; gap: 0.5rem; align-items: center;
}

/* Menú Escritorio */
.nav-links { display: none; gap: 2rem; align-items: center; }
.nav-item { font-weight: 500; color: var(--text-secondary); cursor: pointer; font-size: 0.95rem; }
.nav-item:hover { color: var(--color-primary); }

@media (min-width: 992px) {
    .nav-links { display: flex; }
    .mobile-menu-btn { display: none; }
}

/* Botón Móvil */
.mobile-menu-btn {
    display: none !important;
    font-size: 1.5rem; color: var(--text-main);
    cursor: pointer; padding: 0.5rem;
    border-radius: var(--radius-sm);
}
.mobile-menu-btn:active { background: #f3f4f6; }

/* El menú hamburguesa pertenece únicamente a la navegación móvil. */
@media (max-width: 768px) {
    .mobile-menu-btn { display: inline-flex !important; align-items: center; justify-content: center; }
}

/* Menú Móvil (Overlay) */
.mobile-nav-overlay {
    position: fixed; top: var(--nav-height); left: 0; width: 100%; height: calc(100vh - var(--nav-height));
    background: white; z-index: 999;
    display: flex; flex-direction: column;
    padding: 2rem; gap: 1.5rem;
    transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid #E5E7EB;
}
.mobile-nav-overlay.active { transform: translateX(0); }
.mobile-nav-overlay .nav-item {
    font-size: 1.2rem; border-bottom: 1px solid #f3f4f6; padding-bottom: 1rem; display: block;
}
.mobile-nav-overlay .btn { width: 100%; justify-content: center; margin-top: 0.5rem; }

/* --- SIDEBAR (DASHBOARD) --- */
.app-container { display: flex; min-height: 100vh; padding-top: var(--nav-height); }

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary-dark);
    color: white;
    position: fixed; top: var(--nav-height); bottom: 0; left: 0;
    padding: 2rem 1rem;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1100;
    overflow-y: auto;
}
/* Overlay oscuro para sidebar en móvil */
.sidebar-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1090;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}
.sidebar.active { transform: translateX(0); }
.sidebar.active + .sidebar-backdrop { opacity: 1; pointer-events: auto; }

.sidebar-item {
    padding: 1rem; border-radius: var(--radius-sm);
    cursor: pointer; display: flex; gap: 1rem; align-items: center;
    color: #9CA3AF; transition: 0.2s; margin-bottom: 0.25rem;
}
.sidebar-item:hover, .sidebar-item.active { background: rgba(255,255,255,0.1); color: white; }

.main-content {
    flex: 1; padding: 1.5rem; width: 100%;
    transition: margin-left 0.3s;
    margin-left: 0;
}

/* Escritorio Sidebar */
@media (min-width: 992px) {
    body.logged-in .sidebar { transform: translateX(0); box-shadow: none; z-index: 900; }
    body.logged-in .main-content { margin-left: var(--sidebar-width); padding: 3rem; }
    body.logged-in .sidebar-backdrop { display: none; }
}

/* --- VISTAS --- */
.view-section { display: none; animation: fadeIn 0.4s ease; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Hero Section */
.hero {
    text-align: center; padding: 4rem 1rem; max-width: 900px; margin: 0 auto;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem); /* Tipografía fluida */
    color: var(--color-primary-dark); margin-bottom: 1.5rem; line-height: 1.1; letter-spacing: -0.02em;
}
.hero p { font-size: clamp(1rem, 2vw, 1.25rem); color: var(--text-secondary); margin-bottom: 2rem; }

/* Grids Adaptables */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Minimo 280px por tarjeta */
    gap: 2rem;
    margin-top: 2rem;
}

/* Beneficios */
.benefits-section {
    background: var(--color-primary-dark); color: white;
    padding: 4rem 1.5rem; margin-top: 4rem;
    border-radius: var(--radius-md);
    position: relative; overflow: hidden;
}
.benefits-container {
    display: grid; grid-template-columns: 1fr; gap: 3rem;
    max-width: 1100px; margin: 0 auto; position: relative; z-index: 2;
}
@media (min-width: 992px) {
    .benefits-container { grid-template-columns: 1fr 1fr; align-items: center; }
}

/* Tablas Responsivas */
.table-container {
    overflow-x: auto; background: white; border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
    -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
}
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid #F3F4F6; }
th { background: #F9FAFB; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }

/* Auth */
.auth-container { max-width: 400px; margin: 2rem auto; width: 100%; }

/* --- COMPONENTES ESPECÍFICOS --- */
.badge {
    padding: 0.25rem 0.75rem; border-radius: 99px;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-tributario { background: #DBEAFE; color: #1E40AF; }

.price-card {
    background: white; border-radius: var(--radius-md); padding: 2rem; text-align: center;
    border: 1px solid #E5E7EB; display: flex; flex-direction: column;
}
.price-card h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.price-amount { font-size: 3rem; font-weight: 800; color: var(--color-primary-dark); margin: 1rem 0; }

/* --- COOKIES --- */
.cookie-overlay {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 9999;
    display: none; align-items: flex-end; justify-content: center;
}
.cookie-modal {
    pointer-events: auto; background: white; width: 100%; max-width: 400px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-radius: 16px 16px 0 0;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0,0,0,0.05);
}
@media (min-width: 768px) {
    .cookie-overlay { justify-content: flex-end; padding: 0; }
    .cookie-modal { border-radius: 12px; margin: 2rem; animation: slideInRight 0.4s; }
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Markdown Styles */
.prose ul { list-style-type: disc; padding-left: 1.5rem; margin: 1rem 0; }
.prose p { margin-bottom: 0.75rem; }
.prose strong { color: var(--color-primary); }

/* Loader */
.loader-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(255,255,255,0.9); z-index: 2000;
    display: none; justify-content: center; align-items: center; flex-direction: column;
}
.spinner {
    width: 50px; height: 50px; border: 4px solid #E5E7EB;
    border-top: 4px solid var(--color-primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin-bottom: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Ubicación: public_html/asesoria.virtualex.ec/css/style.css */

/* ... (TODO EL CÓDIGO ANTERIOR SE MANTIENE) ... */

/* --- CART ICON --- */
.cart-icon-container {
    position: relative;
    padding: 0.5rem;
    margin-right: 1rem;
    cursor: pointer;
}
.cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--color-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* --- CART ITEMS LIST --- */
.cart-items-list {
    text-align: left;
}
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}
.cart-item:last-child {
    border-bottom: none;
}
.cart-item-info div:first-child {
    font-weight: 600;
    color: var(--color-primary-dark);
}
.cart-item-info div:last-child {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.cart-item-remove {
    color: var(--color-danger);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem;
}
.cart-item-remove:hover {
    opacity: 0.7;
}

/* ... (RESTO DEL CÓDIGO PAYPAL MODAL) ... */
.payment-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 2000;
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.payment-modal {
    background: white; padding: 2rem; border-radius: var(--radius-md);
    width: 90%; max-width: 450px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s;
}
.payment-summary {
    background: #F3F4F6; padding: 1rem; border-radius: 8px; margin: 1.5rem 0;
}
.payment-close { margin-top: 1rem; cursor: pointer; color: var(--text-secondary); font-size: 0.9rem; text-decoration: underline; }
/* Ubicación: public_html/asesoria.virtualex.ec/css/style.css */

/* ... (MANTENER TODO EL CÓDIGO ANTERIOR INTACTO) ... */

/* --- CUSTOM ALERT MODAL --- */
.alert-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 3000; /* Encima de todo */
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
    opacity: 0; transition: opacity 0.2s;
}
.alert-overlay.active {
    display: flex; opacity: 1;
}

.alert-modal {
    background: white; width: 90%; max-width: 400px;
    padding: 2rem; border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9); transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.alert-overlay.active .alert-modal {
    transform: scale(1);
}

.alert-icon {
    font-size: 3rem; margin-bottom: 1rem;
    display: inline-block;
}
.alert-icon.success { color: var(--color-success); }
.alert-icon.error { color: var(--color-danger); }
.alert-icon.warning { color: var(--color-warning); }
.alert-icon.info { color: var(--color-accent); }

.alert-title {
    font-size: 1.5rem; font-weight: 700; color: var(--color-primary-dark); margin-bottom: 0.5rem;
}
.alert-message {
    color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 1rem; line-height: 1.5;
}

/* Animación de entrada suave */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
/* Ubicación: public_html/asesoria.virtualex.ec/css/style.css */

/* ... (MANTENER TODO EL CÓDIGO ANTERIOR INTACTO) ... */

/* --- CUSTOM ALERT MODAL --- */
.alert-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 3000; /* Encima de todo */
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
    opacity: 0; transition: opacity 0.2s;
}
.alert-overlay.active {
    display: flex; opacity: 1;
}

.alert-modal {
    background: white; width: 90%; max-width: 400px;
    padding: 2rem; border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9); transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.alert-overlay.active .alert-modal {
    transform: scale(1);
}

.alert-icon {
    font-size: 3rem; margin-bottom: 1rem;
    display: inline-block;
}
.alert-icon.success { color: var(--color-success); }
.alert-icon.error { color: var(--color-danger); }
.alert-icon.warning { color: var(--color-warning); }
.alert-icon.info { color: var(--color-accent); }

.alert-title {
    font-size: 1.5rem; font-weight: 700; color: var(--color-primary-dark); margin-bottom: 0.5rem;
}
.alert-message {
    color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 1rem; line-height: 1.5;
}

/* Animación de entrada suave */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- ESTILOS NUEVOS PARA HISTORIAL Y MODAL --- */
.history-row {
    cursor: pointer;
    transition: all 0.2s ease;
}
.history-row:hover {
    background-color: #F8FAFC !important;
    transform: translateX(4px);
}
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}
/* Ubicación: public_html/asesoria.virtualex.ec/css/style.css */

/* ... (MANTENER TODO EL CÓDIGO ANTERIOR INTACTO) ... */

/* --- CUSTOM ALERT MODAL --- */
.alert-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 3000; /* Encima de todo */
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(2px);
    opacity: 0; transition: opacity 0.2s;
}
.alert-overlay.active {
    display: flex; opacity: 1;
}

.alert-modal {
    background: white; width: 90%; max-width: 400px;
    padding: 2rem; border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9); transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.alert-overlay.active .alert-modal {
    transform: scale(1);
}

.alert-icon {
    font-size: 3rem; margin-bottom: 1rem;
    display: inline-block;
}
.alert-icon.success { color: var(--color-success); }
.alert-icon.error { color: var(--color-danger); }
.alert-icon.warning { color: var(--color-warning); }
.alert-icon.info { color: var(--color-accent); }

.alert-title {
    font-size: 1.5rem; font-weight: 700; color: var(--color-primary-dark); margin-bottom: 0.5rem;
}
.alert-message {
    color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 1rem; line-height: 1.5;
}

/* Animación de entrada suave */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- ESTILOS NUEVOS PARA HISTORIAL Y MODAL --- */
#dash-history-table tbody tr,
#full-history-table tbody tr,
.history-row {
    cursor: pointer !important; /* ESTO FUERZA EL CURSOR DE MANO */
    transition: all 0.2s ease;
}

#dash-history-table tbody tr:hover,
#full-history-table tbody tr:hover,
.history-row:hover {
    background-color: #F8FAFC !important;
    transform: translateX(4px);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}
/* AÑADIR AL FINAL DEL ARCHIVO style.css */

/* ==========================================================================
   MEJORAS MÓVILES EXCLUSIVAS (iOS Zoom Fix & Tappable Areas)
   ========================================================================== */

/* Prevenir el zoom automático en Safari/iOS al enfocar un input */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
    }
    
    /* Evitar desbordamiento en textos muy largos dentro de tarjetas */
    .prose, .card p, .card div {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Áreas táctiles garantizadas (Min 44px según guías de accesibilidad) */
button, select, .form-control {
    min-height: 44px;
}

/* Fix para el z-index de los modales y overlays oscuros con Tailwind */
.alert-overlay {
    z-index: 9999 !important;
}

/* Ajuste del scroll horizontal dentro de tablas en móvil */
table {
    white-space: nowrap;
}
td, th {
    min-width: max-content;
}
/* ... existing code ... */
/* Ajuste del scroll horizontal dentro de tablas en móvil */
table {
    white-space: nowrap;
}
td, th {
    min-width: max-content;
}

/* ==========================================================================
   FIX MENÚ MÒBIL (Animació de calaix lateral fluid)
   ========================================================================== */
#mobile-nav-content {
    display: flex !important;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease;
}

#mobile-nav-content.active {
    transform: translateX(0) !important;
    visibility: visible !important;
}

/* Prevenir scroll del cos quan el menú està obert */
body:has(#mobile-nav-content.active) {
    overflow: hidden;
}
/* ... existing code ... */
/* Ajuste del scroll horizontal dentro de tablas en móvil */
table {
    white-space: nowrap;
}
td, th {
    min-width: max-content;
}

/* ==========================================================================
   FIX MENÚ MÓVIL (Animación de cajón lateral fluido y Scroll)
   ========================================================================== */
#mobile-nav-content {
    display: flex !important;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease;
    
    /* HABILITAR SCROLL VERTICAL */
    overflow-y: auto !important; 
    max-height: 100vh !important;
    -webkit-overflow-scrolling: touch; /* Scroll suave en dispositivos iOS */
}

/* Prevenir que los elementos internos se aplasten, forzando la aparición del scroll */
#mobile-nav-content > * {
    flex-shrink: 0 !important;
}

#mobile-nav-content.active {
    transform: translateX(0) !important;
    visibility: visible !important;
}

/* Prevenir scroll del cuerpo (fondo de la página) cuando el menú está abierto */
body:has(#mobile-nav-content.active) {
    overflow: hidden;
}
/* Fase 13: accesibilidad, foco visible y objetivos táctiles. */
.skip-link {
    position: fixed;
    left: 1rem;
    top: 1rem;
    z-index: 1000000;
    padding: .75rem 1rem;
    border-radius: .5rem;
    background: #ffffff;
    color: #0b1f3a;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    transform: translateY(-180%);
    transition: transform .15s ease;
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.link-button { background: transparent; border: 0; padding: .5rem; cursor: pointer; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid #2563eb !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 2px #ffffff !important;
}
.sidebar-item {
    width: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
    min-height: 44px;
}
button, [role="button"], input, select, textarea { touch-action: manipulation; }
button:not(.otp-box-digit), [role="button"] { min-height: 44px; }

@media (max-width: 640px) {
    input, select, textarea { font-size: 16px !important; }
    #support-chat-widget { right: 12px !important; bottom: 12px !important; }
    #support-chat-window { width: min(350px, calc(100vw - 24px)) !important; height: min(500px, calc(100vh - 100px)) !important; }
    .alert-modal { max-height: calc(100vh - 24px) !important; overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Formularios de gestión jurídica */
.legal-help-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #2563eb;
    border-radius: 1rem;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    color: #334155;
}
.legal-help-card > i { color: #2563eb; font-size: 1.15rem; margin-top: .2rem; }
.legal-help-card strong { display: block; color: #0f172a; font-weight: 900; margin-bottom: .2rem; }
.legal-help-card p { margin: 0; font-size: .92rem; line-height: 1.55; }
.legal-help-card small { display: block; margin-top: .45rem; color: #475569; line-height: 1.45; }

.alert-modal.legal-form-modal {
    width: min(920px, calc(100vw - 2rem));
    max-width: 920px;
    max-height: min(92vh, 900px);
    padding: 0;
    overflow-y: auto;
    text-align: left;
    border-radius: 1.5rem;
}
.legal-form-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.35rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(248, 250, 252, .97);
    backdrop-filter: blur(8px);
}
.legal-form-header h3 { display: flex; align-items: center; gap: .65rem; margin: .2rem 0 .3rem; color: #0f172a; font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 900; }
.legal-form-header h3 i { color: #2563eb; }
.legal-form-header p { margin: 0; color: #64748b; font-size: .92rem; line-height: 1.5; }
.legal-form-kicker { color: #2563eb; font-size: .72rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.legal-modal-close { flex: 0 0 auto; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; min-height: 2.75rem; border: 0; border-radius: 999px; background: #e2e8f0; color: #475569; cursor: pointer; font-size: 1.8rem; line-height: 1; }
.legal-modal-close:hover { background: #cbd5e1; color: #0f172a; }
.legal-form-body { padding: 1.5rem; }
.legal-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.legal-field { display: flex; flex-direction: column; min-width: 0; color: #334155; font-size: .87rem; font-weight: 800; }
.legal-field > span { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .42rem; }
.legal-field em { color: #64748b; font-size: .68rem; font-style: normal; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.legal-field > span > b { padding: .15rem .45rem; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: .66rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.legal-field .form-control { width: 100%; min-height: 3rem; padding: .75rem .9rem; border-radius: .75rem; background: #fff; }
.legal-field .form-control:disabled { background: #f1f5f9; color: #64748b; cursor: not-allowed; }
.legal-field textarea.form-control { min-height: 5.5rem; resize: vertical; }
.legal-field small { margin-top: .38rem; color: #64748b; font-size: .75rem; font-weight: 500; line-height: 1.4; }
.legal-field-wide { grid-column: 1 / -1; }
.legal-example { display: flex; align-items: flex-start; gap: .65rem; padding: .8rem .9rem; border-radius: .75rem; background: #f0fdf4; color: #166534; font-size: .84rem; line-height: 1.45; }
.legal-example i { margin-top: .15rem; }
.legal-optional-note { display: flex; align-items: flex-start; gap: .55rem; margin: .85rem 0 0; color: #475569; font-size: .82rem; line-height: 1.45; }
.legal-optional-note i { color: #0f766e; margin-top: .13rem; }
.legal-form-error { margin-top: 1rem; padding: .8rem .9rem; border: 1px solid #fecaca; border-radius: .75rem; background: #fef2f2; color: #b91c1c; font-size: .86rem; font-weight: 700; }
.legal-form-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid #e2e8f0; }
.legal-form-actions button { min-width: 9.5rem; padding: .75rem 1.1rem; border-radius: .75rem; }

.case-form-progress { display: flex; align-items: center; max-width: 34rem; margin: 0 auto 1.6rem; }
.case-progress-item { display: flex; align-items: center; gap: .6rem; color: #94a3b8; }
.case-progress-item > span { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; border: 2px solid #cbd5e1; border-radius: 999px; background: #fff; font-weight: 900; }
.case-progress-item div { display: flex; flex-direction: column; }
.case-progress-item b { color: inherit; font-size: .85rem; }
.case-progress-item small { color: inherit; font-size: .68rem; }
.case-progress-item.is-active { color: #1d4ed8; }
.case-progress-item.is-active > span { border-color: #2563eb; background: #2563eb; color: #fff; box-shadow: 0 0 0 4px #dbeafe; }
.case-progress-item.is-complete { color: #0f766e; }
.case-progress-item.is-complete > span { border-color: #0f766e; background: #ccfbf1; color: #0f766e; }
.case-progress-line { flex: 1; height: 2px; margin: 0 .8rem; background: #e2e8f0; }
.case-step-heading { margin-bottom: 1.25rem; }
.case-step-heading > span { color: #2563eb; font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.case-step-heading h4 { margin: .2rem 0 .25rem; color: #0f172a; font-size: 1.25rem; font-weight: 900; }
.case-step-heading p { margin: 0; color: #64748b; font-size: .88rem; }
.case-client-choice { margin: 1.25rem 0; padding: 0; border: 0; }
.case-client-choice legend { color: #334155; font-size: .9rem; font-weight: 900; }
.case-client-choice legend em { color: #64748b; font-size: .68rem; font-style: normal; letter-spacing: .05em; text-transform: uppercase; }
.case-client-choice > p { margin: .25rem 0 .8rem; color: #64748b; font-size: .78rem; }
.case-choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.case-choice-card { position: relative; cursor: pointer; }
.case-choice-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.case-choice-card > span { display: flex; flex-direction: column; min-height: 7.4rem; padding: 1rem; border: 2px solid #e2e8f0; border-radius: .9rem; background: #fff; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.case-choice-card i { align-self: flex-start; margin-bottom: .65rem; color: #64748b; font-size: 1.1rem; }
.case-choice-card b { color: #0f172a; font-size: .9rem; }
.case-choice-card small { margin-top: .2rem; color: #64748b; font-size: .74rem; line-height: 1.4; }
.case-choice-card:hover > span { border-color: #93c5fd; background: #f8fbff; }
.case-choice-card input:checked + span { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 3px #dbeafe; }
.case-choice-card input:checked + span i, .case-choice-card input:checked + span b { color: #1d4ed8; }
.case-choice-card input:focus-visible + span { outline: 3px solid #2563eb; outline-offset: 3px; }
.case-client-guidance { display: flex; align-items: flex-start; gap: .55rem; margin-top: .75rem; padding: .75rem .85rem; border-radius: .7rem; background: #f8fafc; color: #475569; font-size: .78rem; line-height: 1.45; }
.case-client-guidance i { margin-top: .1rem; color: #2563eb; }
.case-form-summary { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.2rem; padding: .85rem 1rem; border: 1px solid #bfdbfe; border-radius: .8rem; background: #eff6ff; }
.case-form-summary > i { color: #2563eb; font-size: 1.2rem; }
.case-form-summary div { display: flex; flex-direction: column; min-width: 0; }
.case-form-summary small { color: #64748b; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.case-form-summary b { overflow: hidden; color: #0f172a; font-size: .94rem; text-overflow: ellipsis; white-space: nowrap; }
.case-form-summary span { color: #475569; font-size: .76rem; }
.legal-form-modal-compact { max-width: 680px !important; }
.case-list-tabs { display: inline-flex; gap: .35rem; margin-bottom: 1.25rem; padding: .3rem; border: 1px solid #e2e8f0; border-radius: .85rem; background: #f8fafc; }
.case-list-tabs button { display: flex; align-items: center; gap: .5rem; min-height: 2.6rem; padding: .55rem .85rem; border: 0; border-radius: .65rem; background: transparent; color: #64748b; font-size: .83rem; font-weight: 800; cursor: pointer; }
.case-list-tabs button span { display: grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .3rem; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: .68rem; }
.case-list-tabs button.is-active { background: #fff; color: #1d4ed8; box-shadow: 0 2px 8px rgba(15,23,42,.08); }
.case-list-tabs button.is-active span { background: #dbeafe; color: #1d4ed8; }
.case-action-bar { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; padding: .8rem; border: 1px solid #e2e8f0; border-radius: .9rem; background: #f8fafc; }
.case-action-bar button { margin: 0 !important; }
.case-archive-banner { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: .9rem 1rem; border: 1px solid #fed7aa; border-radius: .8rem; background: #fff7ed; color: #9a3412; font-size: .84rem; }
.archive-explanation { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem; border: 1px solid #fed7aa; border-radius: .9rem; background: #fff7ed; }
.archive-explanation > i { color: #ea580c; font-size: 1.4rem; margin-top: .15rem; }
.archive-explanation b { color: #7c2d12; }
.archive-explanation p { margin: .25rem 0 0; color: #9a3412; font-size: .84rem; line-height: 1.5; }
.portal-status-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; padding: 1rem; border: 1px solid #bfdbfe; border-radius: .9rem; background: #eff6ff; }
.portal-status-card b { display: block; color: #0f172a; }
.portal-status-card p { margin: .2rem 0 0; color: #64748b; font-size: .8rem; }
.portal-status-badge { padding: .35rem .65rem; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: .72rem; font-weight: 900; }
.portal-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .7rem; margin: 1rem 0; }
.portal-metrics div { padding: .8rem; border-radius: .75rem; background: #f8fafc; text-align: center; }
.portal-metrics b { display: block; color: #0f172a; font-size: 1.1rem; }
.portal-metrics small { color: #64748b; }
.portal-action-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .7rem; }
.portal-action-card { display: flex; align-items: flex-start; gap: .7rem; min-height: 4.7rem; padding: .9rem; border: 1px solid #e2e8f0; border-radius: .8rem; background: #fff; color: #334155; text-align: left; cursor: pointer; }
.portal-action-card:hover { border-color: #93c5fd; background: #f8fbff; }
.portal-action-card i { color: #2563eb; margin-top: .15rem; }
.portal-action-card b { display: block; color: #0f172a; font-size: .85rem; }
.portal-action-card small { display: block; margin-top: .15rem; color: #64748b; line-height: 1.35; }
.portal-action-panel { margin-top: 1rem; padding: 1rem; border: 1px solid #e2e8f0; border-radius: .9rem; background: #f8fafc; }
.portal-invitation-link { padding: .8rem; border-radius: .7rem; background: #f1f5f9; color: #334155; font-size: .78rem; overflow-wrap: anywhere; }

@media (max-width: 640px) {
    .alert-modal.legal-form-modal { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem) !important; border-radius: 1rem; }
    .legal-form-header, .legal-form-body { padding: 1rem; }
    .legal-form-header { gap: .75rem; }
    .legal-form-grid { grid-template-columns: 1fr; }
    .legal-field-wide { grid-column: auto; }
    .legal-form-actions { position: sticky; bottom: 0; z-index: 1; margin: 1rem -1rem -1rem; padding: .85rem 1rem; background: rgba(255,255,255,.97); }
    .legal-form-actions button { flex: 1; min-width: 0; }
    .case-form-progress { margin-bottom: 1.15rem; }
    .case-progress-item div { display: none; }
    .case-progress-line { margin: 0 .5rem; }
    .case-choice-grid { grid-template-columns: 1fr; }
    .case-choice-card > span { min-height: auto; padding: .85rem; }
    .case-choice-card i { margin-bottom: .4rem; }
    .case-list-tabs { display: flex; width: 100%; }
    .case-list-tabs button { flex: 1; justify-content: center; }
    .portal-metrics, .portal-action-grid { grid-template-columns: 1fr; }
    .case-archive-banner { flex-direction: column; }
}
