/* 
 * Los Aranceles - Hoja de Estilo Global (Google Material Design 3)
 * Ampliada con Soporte para Tema Oscuro, Tabuladores, Calculadora y Explorador FTP.
 */

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

:root {
    /* M3 Color Tokens (LIGHT SCHEME - Cobalt / Teal Baseline) */
    --md-sys-color-primary: #1e3a8a; /* Deep Cobalt Blue */
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #dbeafe;
    --md-sys-color-on-primary-container: #1e40af;
    
    --md-sys-color-secondary: #0d9488; /* Teal */
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #ccfbf1;
    --md-sys-color-on-secondary-container: #115e59;
    
    --md-sys-color-tertiary: #b45309; /* Warm Amber */
    --md-sys-color-on-tertiary: #ffffff;
    --md-sys-color-tertiary-container: #fef3c7;
    --md-sys-color-on-tertiary-container: #78350f;
    
    --md-sys-color-error: #ba1a1a;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-error-container: #ffdad6;
    --md-sys-color-on-error-container: #410002;
    
    --md-sys-color-background: #f8fafc; /* Soft Slate Gray */
    --md-sys-color-on-background: #0f172a;
    --md-sys-color-surface: #ffffff;
    --md-sys-color-on-surface: #1e293b;
    --md-sys-color-surface-variant: #e2e8f0;
    --md-sys-color-on-surface-variant: #475569;
    --md-sys-color-outline: #cbd5e1;
    --md-sys-color-outline-variant: #cbd5e1;
    --md-sys-color-surface-hover: rgba(15, 23, 42, 0.04);
    
    /* M3 Elevation Shadow Tokens */
    --md-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.1), 0px 1px 2px 0px rgba(0, 0, 0, 0.15);
    --md-elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.1), 0px 1px 2px 0px rgba(0, 0, 0, 0.15);
    --md-elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.1), 0px 1px 3px 0px rgba(0, 0, 0, 0.15);
    
    /* M3 Shape / Border Radius Tokens */
    --md-shape-corner-extra-small: 4px;
    --md-shape-corner-small: 8px;
    --md-shape-corner-medium: 12px;
    --md-shape-corner-large: 16px;
    --md-shape-corner-extra-large: 28px; /* Standard M3 Drawer & Large Cards */
    
    /* Transiciones */
    --md-transition-duration-short: 150ms;
    --md-transition-duration-medium: 250ms;
    --md-transition-duration-long: 400ms;
    --md-transition-easing-standard: cubic-bezier(0.2, 0, 0, 1);
    
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* M3 Color Tokens (DARK SCHEME - Cobalt / Amber / Slate Dark) */
body.dark-mode {
    --md-sys-color-primary: #93c5fd; /* Soft Indigo */
    --md-sys-color-on-primary: #1e3a8a;
    --md-sys-color-primary-container: #1e40af;
    --md-sys-color-on-primary-container: #dbeafe;
    
    --md-sys-color-secondary: #2dd4bf; /* Mint/Teal */
    --md-sys-color-on-secondary: #0f172a;
    --md-sys-color-secondary-container: #115e59;
    --md-sys-color-on-secondary-container: #ccfbf1;
    
    --md-sys-color-tertiary: #fbbf24; /* Warm Gold */
    --md-sys-color-on-tertiary: #451a03;
    --md-sys-color-tertiary-container: #78350f;
    --md-sys-color-on-tertiary-container: #fef3c7;
    
    --md-sys-color-background: #0b0f19; /* Dark Slate Navy */
    --md-sys-color-on-background: #f1f5f9;
    --md-sys-color-surface: #111827; /* Dark Navy Surface */
    --md-sys-color-on-surface: #f9fafb;
    --md-sys-color-surface-variant: #1f2937;
    --md-sys-color-on-surface-variant: #9ca3af;
    --md-sys-color-outline: #374151;
    --md-sys-color-outline-variant: #374151;
    --md-sys-color-surface-hover: rgba(255, 255, 255, 0.06);
    
    --md-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.3), 0px 1px 2px 0px rgba(0, 0, 0, 0.4);
    --md-elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.3), 0px 1px 2px 0px rgba(0, 0, 0, 0.4);
    --md-elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.3), 0px 1px 3px 0px rgba(0, 0, 0, 0.4);
}

/* Estilos de Reset & Básicos */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--md-transition-duration-short) ease,
                color var(--md-transition-duration-short) ease,
                border-color var(--md-transition-duration-short) ease;
}

body {
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.5;
    overflow-x: clip;
}

/* --- PANTALLA DE LOGIN --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    position: relative;
    background: radial-gradient(circle at 10% 20%, rgba(30, 58, 138, 0.05) 0%, rgba(248, 250, 252, 1) 90%);
}

body.dark-mode .login-container {
    background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.8) 0%, rgba(11, 15, 25, 1) 90%);
}

.login-card {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-shape-corner-extra-large);
    box-shadow: var(--md-elevation-3);
    width: 100%;
    max-width: 440px;
    padding: 40px 32px;
    text-align: center;
    border: 1px solid var(--md-sys-color-outline);
    backdrop-filter: blur(10px);
    transform: translateY(0);
    transition: transform var(--md-transition-duration-medium) var(--md-transition-easing-standard),
                box-shadow var(--md-transition-duration-medium) var(--md-transition-easing-standard);
}

.login-card:hover {
    transform: translateY(-4px);
    box-shadow: 0px 12px 24px rgba(0, 0, 0, 0.2);
}

.brand-header {
    margin-bottom: 32px;
}

.brand-logo {
    width: 110px;
    height: 110px;
    margin: 0 auto 16px auto;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
}

.brand-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
    font-weight: 500;
}

.login-message {
    font-size: 15px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 32px;
    line-height: 1.6;
}

/* Botón de Google OAuth SSO */
.oauth-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

/* Alertas estilo M3 */
.m3-alert {
    padding: 16px;
    border-radius: var(--md-shape-corner-large);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInDown 300ms var(--md-transition-easing-standard);
}

.m3-alert-error {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    border: 1px solid rgba(186, 26, 26, 0.2);
}

.m3-alert-success {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border: 1px solid rgba(13, 148, 136, 0.2);
}

/* --- ESTRUCTURA DEL PANEL PRINCIPAL (DASHBOARD) --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Header / App Bar superior */
.app-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 64px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 24px;
    z-index: 99;
    border-bottom: 1px solid var(--md-sys-color-outline);
    transition: left var(--md-transition-duration-long) var(--md-transition-easing-standard);
}

body.dark-mode .app-header {
    background-color: rgba(17, 24, 39, 0.8);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Botón Hamburguesa de Material 3 */
.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-surface);
}

.menu-btn:hover {
    background-color: var(--md-sys-color-surface-hover);
}

.menu-btn:active {
    background-color: rgba(15, 23, 42, 0.12);
}

.menu-icon {
    font-size: 24px;
}

.app-title-header {
    font-size: 18px;
    font-weight: 600;
    color: var(--md-sys-color-primary);
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 12px 4px 4px;
    background-color: var(--md-sys-color-surface-hover);
    border-radius: 24px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

/* --- NAVIGATION DRAWER (MENÚ LATERAL M3) --- */
.nav-drawer {
    position: fixed;
    top: 0;
    left: -360px; /* Oculto por defecto en móvil */
    width: 320px;
    height: 100vh;
    background-color: var(--md-sys-color-surface);
    border-radius: 0 var(--md-shape-corner-extra-large) var(--md-shape-corner-extra-large) 0;
    box-shadow: var(--md-elevation-3);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 0 12px 24px 12px;
    transition: left var(--md-transition-duration-long) var(--md-transition-easing-standard);
    border-right: 1px solid var(--md-sys-color-outline);
}

.nav-drawer.open {
    left: 0;
}

.drawer-header {
    height: 120px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    margin-top: 24px;
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.drawer-logo {
    width: 60px;
    height: 60px;
}

.drawer-brand-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
}

.drawer-brand-sub {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

/* Lista de navegación de Material 3 */
.drawer-list {
    list-style: none;
    margin-top: 24px;
    flex-grow: 1;
}

.drawer-item {
    margin-bottom: 4px;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 28px; /* M3 Pill Shape */
    cursor: pointer;
}

.drawer-link:hover {
    background-color: var(--md-sys-color-surface-hover);
    color: var(--md-sys-color-primary);
}

.drawer-link.active {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-weight: 600;
}

.drawer-icon {
    font-size: 22px;
    width: 24px;
    text-align: center;
}

.drawer-footer {
    padding-top: 16px;
    border-top: 1px solid var(--md-sys-color-outline);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px 24px;
    background: none;
    border: none;
    border-radius: 28px;
    color: var(--md-sys-color-error);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.logout-btn:hover {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

/* Overlay/Sombra translúcida para móvil */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--md-transition-duration-medium) var(--md-transition-easing-standard),
                visibility var(--md-transition-duration-medium) var(--md-transition-easing-standard);
}

.drawer-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* --- SUB-MENÚS COLAPSABLES (ACORDEÓN) EN NAVIGATION DRAWER --- */
.group-item {
    margin-bottom: 4px;
}

.drawer-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    color: var(--md-sys-color-on-surface-variant);
    border-radius: 28px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color var(--md-transition-duration-short) var(--md-transition-easing-standard),
                color var(--md-transition-duration-short) var(--md-transition-easing-standard);
    user-select: none;
}

.drawer-group-header:hover {
    background-color: var(--md-sys-color-surface-hover);
    color: var(--md-sys-color-primary);
}

.drawer-group-header.open {
    color: var(--md-sys-color-primary);
}

.group-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.group-arrow {
    transition: transform var(--md-transition-duration-medium) var(--md-transition-easing-standard);
    font-size: 20px;
}

.drawer-group-header.open .group-arrow {
    transform: rotate(180deg);
}

.drawer-sublist {
    list-style: none;
    padding-left: 20px; /* Desplazamiento para sub-elementos */
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--md-transition-duration-medium) cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-sublist.open {
    max-height: 250px; /* Espacio para expandir los sub-elementos */
}

.drawer-subitem {
    margin-top: 4px;
    margin-bottom: 4px;
}

.drawer-subitem .drawer-link {
    padding: 12px 20px;
    font-size: 13.5px;
}

/* --- CONTENIDO PRINCIPAL Y PESTAÑAS (SECCIONES) --- */
.main-content {
    flex-grow: 1;
    padding: 88px 24px 24px 24px; /* Superior compensando el header */
    transition: padding-left var(--md-transition-duration-long) var(--md-transition-easing-standard);
    max-width: 1600px; /* Expandido para aprovechar mucho más el ancho de pantalla, estilo ALE Cabin */
    margin: 0 auto;
    width: 100%;
}

/* Manejo de secciones visibles/ocultas */
.app-section {
    display: none;
    animation: fadeIn var(--md-transition-duration-medium) var(--md-transition-easing-standard);
}

.app-section.active {
    display: block;
}

.welcome-section {
    margin-bottom: 32px;
}

.welcome-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--md-sys-color-on-background);
    letter-spacing: -0.5px;
}

.welcome-desc {
    font-size: 15px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
}

/* Grid de Tarjetas M3 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.m3-card {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-shape-corner-large);
    box-shadow: var(--md-elevation-1);
    padding: 24px;
    border: 1px solid var(--md-sys-color-outline);
    position: relative;
    overflow: hidden;
}

.m3-card:hover {
    box-shadow: var(--md-elevation-2);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--md-sys-color-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-icon {
    font-size: 22px;
    color: var(--md-sys-color-secondary);
}

/* Elementos de Información en la Tarjeta */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}

.info-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    text-align: right;
    max-width: 60%;
    word-break: break-all;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.badge-success {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.badge-warning {
    background-color: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.badge-encrypted {
    background-color: var(--md-sys-color-surface-hover);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px dashed var(--md-sys-color-outline);
    font-family: monospace;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
}

/* --- CALCULADORA ARANCELARIA (DISEÑO M3) --- */
.calculator-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 768px) {
    .calculator-container {
        grid-template-columns: 1fr 1fr;
    }
}

/* Formulario M3 */
.m3-form-group {
    margin-bottom: 20px;
    position: relative;
}

.m3-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 6px;
}

.m3-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-corner-medium);
    color: var(--md-sys-color-on-surface);
    outline: none;
}

.m3-input:focus {
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 11px 15px; /* Compensa el ancho de borde para evitar brincos */
}

/* Botón M3 */
.m3-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--md-shape-corner-large);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.m3-btn-primary {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.m3-btn-primary:hover {
    opacity: 0.9;
    box-shadow: var(--md-elevation-1);
}

.m3-btn-primary:active {
    box-shadow: none;
}

/* Gráfico de Desglose de Impuestos */
.chart-bar-container {
    height: 18px;
    background-color: var(--md-sys-color-surface-variant);
    border-radius: 9px;
    overflow: hidden;
    display: flex;
    margin-top: 16px;
    margin-bottom: 8px;
}

.chart-segment {
    height: 100%;
    transition: width var(--md-transition-duration-medium) ease;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* --- EXPLORADOR DE ARCHIVOS FTP --- */
.explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.file-card {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-corner-medium);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transform: translateY(0);
    position: relative;
    overflow: hidden;
}

.file-card:hover {
    background-color: var(--md-sys-color-surface-hover);
    border-color: var(--md-sys-color-primary);
    box-shadow: var(--md-elevation-1);
}

.file-icon {
    font-size: 40px;
    transition: transform var(--md-transition-duration-short);
}

.file-card:hover .file-icon {
    transform: scale(1.1);
}

/* Mapeo de colores de iconos por tipo en M3 */
.icon-directory { color: #f59e0b; } /* Carpeta Amber */
.icon-code { color: #3b82f6; } /* PHP/JS Azul */
.icon-image { color: #10b981; } /* SVG/PNG Verde */
.icon-config { color: #6b7280; } /* .env/.htaccess Gris */
.icon-file { color: #8b5cf6; } /* Otro */

.file-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    width: 100%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.file-meta {
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: -8px;
}

/* Skeleton Loading para archivos */
.skeleton-card {
    border: 1px solid var(--md-sys-color-outline);
    background-color: var(--md-sys-color-surface);
    height: 120px;
    border-radius: var(--md-shape-corner-medium);
    animation: skeletonPulse 1.5s infinite ease-in-out;
}

@keyframes skeletonPulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsividad para pantallas medianas y grandes */
@media (min-width: 992px) {
    /* Drawer estático por defecto, con transiciones fluidas de colapsado */
    .nav-drawer {
        left: 0;
        border-radius: 0;
        box-shadow: none;
        transition: left var(--md-transition-duration-long) var(--md-transition-easing-standard);
    }
    
    .app-header {
        left: 320px;
        transition: left var(--md-transition-duration-long) var(--md-transition-easing-standard);
    }
    
    .main-content {
        padding-left: 344px;
        transition: padding-left var(--md-transition-duration-long) var(--md-transition-easing-standard);
    }
    
    .drawer-overlay {
        display: none;
    }
    
    /* El botón de hamburguesa se mantiene visible en desktop para colapsar */
    .menu-btn#menuBtn {
        display: flex !important;
    }
    
    /* Estilos aplicados cuando el drawer está contraído/colapsado */
    body.drawer-collapsed .nav-drawer {
        left: -320px;
    }
    
    body.drawer-collapsed .app-header {
        left: 0;
    }
    
    body.drawer-collapsed .main-content {
        padding-left: 24px;
    }
}

/* ================= COMPONENTES AVANZADOS (FASE 2) ================= */

/* --- BREADCRUMBS Y BARRA DE HERRAMIENTAS --- */
.explorer-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.breadcrumbs-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}

.breadcrumb-item {
    cursor: pointer;
    color: var(--md-sys-color-primary);
    padding: 6px 12px;
    border-radius: var(--md-shape-corner-medium);
    transition: background-color var(--md-transition-duration-short) ease,
                color var(--md-transition-duration-short) ease;
}

.breadcrumb-item:hover {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.breadcrumb-item.active {
    color: var(--md-sys-color-on-surface);
    font-weight: 700;
    cursor: default;
    background: none;
}

.breadcrumb-separator {
    color: var(--md-sys-color-outline);
    font-size: 14px;
    user-select: none;
    display: inline-block;
    padding: 0 4px;
}

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

.m3-btn-outlined {
    background: none;
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--md-shape-corner-medium);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color var(--md-transition-duration-short),
                border-color var(--md-transition-duration-short);
}

.m3-btn-outlined:hover {
    background-color: var(--md-sys-color-surface-hover);
    border-color: var(--md-sys-color-primary);
}

/* --- DIÁLOGOS NATIVOS M3 --- */
dialog.m3-dialog {
    border: 1px solid var(--md-sys-color-outline);
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    border-radius: var(--md-shape-corner-extra-large); /* 28px */
    box-shadow: var(--md-elevation-3);
    padding: 28px;
    max-width: 480px;
    width: calc(100% - 32px);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    outline: none;
    z-index: 1000;
    animation: dialogScaleIn 250ms var(--md-transition-easing-standard);
}

@keyframes dialogScaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

dialog::backdrop {
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    animation: backdropFadeIn 250ms var(--md-transition-easing-standard);
}

@keyframes backdropFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.m3-dialog-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.m3-dialog-header-icon {
    font-size: 28px;
    color: var(--md-sys-color-primary);
}

.m3-dialog-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    letter-spacing: -0.5px;
}

.m3-dialog-body {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 24px;
}

.dialog-info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--md-sys-color-outline);
}

.dialog-info-row:last-child {
    border-bottom: none;
}

.dialog-info-label {
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
}

.dialog-info-value {
    color: var(--md-sys-color-on-surface);
    word-break: break-all;
    max-width: 70%;
    text-align: right;
}

.m3-dialog-footer {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

/* Botones de Texto y Tonales M3 */
.m3-btn-text {
    background: none;
    border: none;
    color: var(--md-sys-color-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color var(--md-transition-duration-short);
}

.m3-btn-text:hover {
    background-color: var(--md-sys-color-surface-hover);
}

.m3-btn-text.text-error {
    color: var(--md-sys-color-error);
}

.m3-btn-text.text-error:hover {
    background-color: var(--md-sys-color-error-container);
}

.m3-btn-tonal {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color var(--md-transition-duration-short);
}

.m3-btn-tonal:hover {
    background-color: var(--md-sys-color-outline);
    color: var(--md-sys-color-on-surface);
}

/* --- ELEMENTOS DE FORMULARIO CON ICONO --- */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-with-icon .m3-input {
    padding-left: 44px;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 14px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 20px;
    pointer-events: none;
    user-select: none;
}

/* Inputs de tipo select con estilo M3 */
.select-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23475569'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 24px;
    padding-right: 40px;
    cursor: pointer;
}

body.dark-mode .select-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239ca3af'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

/* --- FILTROS Y CONTROLES DE BÚSQUEDA --- */
.filter-card {
    margin-bottom: 24px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.filter-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    height: 40px;
    border-radius: var(--md-shape-corner-medium);
}

/* --- TABLAS RESPONSIVAS M3 --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.m3-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.m3-table th {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 600;
    padding: 16px 20px;
    border-bottom: 1px solid var(--md-sys-color-outline);
    white-space: nowrap;
    user-select: none;
}

.m3-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-on-surface);
    vertical-align: middle;
    line-height: 1.5;
}

#table-guias-detalle td {
    border-bottom: none;
}

.m3-table tbody tr {
    transition: background-color var(--md-transition-duration-short) ease;
}

.m3-table tbody tr:hover {
    background-color: var(--md-sys-color-surface-hover);
}

.m3-table tbody tr:last-child td {
    border-bottom: none;
}

/* Estilo para las acciones en la tabla */
.table-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* --- BARRA DE PAGINACIÓN --- */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background-color: var(--md-sys-color-surface);
    border-top: 1px solid var(--md-sys-color-outline);
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-btn {
    background: none;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--md-sys-color-on-surface);
    transition: background-color var(--md-transition-duration-short) ease,
                border-color var(--md-transition-duration-short) ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--md-sys-color-surface-hover);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-primary);
}

.pagination-btn:active:not(:disabled) {
    background-color: rgba(15, 23, 42, 0.1);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.limit-select {
    width: auto;
    padding: 6px 32px 6px 12px;
    font-size: 13px;
    border-radius: var(--md-shape-corner-small);
    height: 36px;
    cursor: pointer;
}

/* --- COLORES PARA BOTONES ESPECÍFICOS --- */
.text-tertiary {
    color: var(--md-sys-color-tertiary) !important;
    border-color: var(--md-sys-color-outline) !important;
}

.text-tertiary:hover {
    background-color: var(--md-sys-color-tertiary-container) !important;
    border-color: var(--md-sys-color-tertiary) !important;
}

.text-success {
    color: var(--md-sys-color-secondary) !important;
    border-color: var(--md-sys-color-outline) !important;
}

.text-success:hover {
    background-color: var(--md-sys-color-secondary-container) !important;
    border-color: var(--md-sys-color-secondary) !important;
}

/* --- ASISTENTE INTELIGENTE GEMINI (DIÁLOGO GRANDE) --- */
dialog.m3-dialog.dialog-large {
    max-width: 720px;
    width: calc(100% - 32px);
    height: 600px;
    display: none;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

dialog.m3-dialog.dialog-large[open] {
    display: flex;
}

/* --- DIÁLOGO DE VISTA PREVIA DE DOCUMENTOS --- */
dialog.m3-dialog.dialog-preview {
    max-width: 900px;
    width: calc(100% - 32px);
    height: 85vh;
    max-height: 800px;
    display: none;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 28px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

dialog.m3-dialog.dialog-preview[open] {
    display: flex;
}

dialog.m3-dialog.dialog-large .m3-dialog-form,
dialog.m3-dialog.dialog-preview .m3-dialog-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.gemini-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--md-sys-color-outline);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--md-sys-color-surface);
}

.gemini-chat-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    background-color: var(--md-sys-color-background);
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 0 !important;
}

.gemini-chat-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--md-sys-color-outline);
    background-color: var(--md-sys-color-surface);
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input {
    flex-grow: 1;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-shape-corner-medium);
    padding: 12px 16px;
    font-size: 14px;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    outline: none;
    transition: border-color var(--md-transition-duration-short),
                box-shadow var(--md-transition-duration-short);
}

.chat-input:focus {
    border-color: #6c5ce7;
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.15);
}

.send-chat-btn {
    background-color: #6c5ce7;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--md-shape-corner-medium);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--md-transition-duration-short) ease,
                transform var(--md-transition-duration-short) ease;
}

.send-chat-btn:hover {
    background-color: #5b4bc4;
}

.send-chat-btn:active {
    transform: scale(0.95);
}

/* --- BURBUJAS DE CHAT CONVERSACIONAL --- */
.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: chatBubbleIn 300ms var(--md-transition-easing-standard);
}

@keyframes chatBubbleIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.chat-bubble {
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 14.5px;
    line-height: 1.6;
    word-break: break-word;
}

.bot-message .chat-bubble {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-top-left-radius: 4px;
    box-shadow: var(--md-elevation-1);
}

.user-message .chat-bubble {
    background: linear-gradient(135deg, #6c5ce7 0%, #4f42b5 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0px 4px 12px rgba(108, 92, 231, 0.25);
}

.chat-bubble p {
    margin-bottom: 12px;
}

.chat-bubble p:last-child {
    margin-bottom: 0;
}

.chat-bubble strong {
    font-weight: 700;
}

.chat-bubble ul, .chat-bubble ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.chat-bubble li {
    margin-bottom: 4px;
}

/* --- SECCIÓN DE API KEY GEMINI (CONEXIÓN SEGURA) --- */
.gemini-key-section {
    padding: 16px 24px;
    background-color: var(--md-sys-color-error-container);
    border-top: 1px solid var(--md-sys-color-outline);
    border-bottom: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-on-error-container);
}

.key-warning-text {
    font-size: 12.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.key-warning-text span {
    font-size: 18px;
}

.key-input-row {
    display: flex;
    gap: 12px;
}

.key-input-row .m3-input {
    flex-grow: 1;
}

/* --- BOTÓN FLOTANTE (FAB) GEMINI CON ICONO DE DIAMANTE --- */
.gemini-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    padding: 0 !important;
    transition: transform var(--md-transition-duration-medium) var(--md-transition-easing-standard);
}

.gemini-fab:hover {
    transform: scale(1.15) rotate(5deg);
}

.gemini-fab:active {
    transform: scale(0.92);
}

.gemini-fab .diamond-icon, .gemini-fab .gemini-sparkle-svg {
    width: 48px;
    height: 48px;
}

.gemini-fab-text {
    letter-spacing: 0.15px;
}

/* --- BOTÓN DE ICONO PLANO DE GEMINI (SIN FONDO, SOLO EL DIAMANTE) --- */
.gemini-flat-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 28px !important;
    height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: transform 0.2s ease-in-out;
}

.gemini-flat-btn:hover {
    transform: scale(1.22);
}

.gemini-flat-btn:active {
    transform: scale(0.9);
}

/* --- ANIMACIÓN MICRO-ANIMACIÓN GLOW DE DIAMANTE --- */
.animated-diamond {
    animation: diamondGlow 3s infinite ease-in-out;
}

@keyframes diamondGlow {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(108, 92, 231, 0.4));
    }
    50% {
        transform: scale(1.18);
        filter: drop-shadow(0 0 12px rgba(108, 92, 231, 0.85));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(108, 92, 231, 0.4));
    }
}

/* ==========================================================================
   FASE 4: ESTILOS MATERIAL 3 EXPRESSIVE, PROXY BANNER Y CATALOGO USUARIOS
   ========================================================================== */

/* 1. Ajustes M3 Expressive a Elementos Existentes */
:root {
    --md-shape-corner-large: 24px;         /* Tarjetas, botones y campos */
    --md-shape-corner-extra-large: 32px;   /* Diálogos y Navigation Drawer */
}

/* Redondear diálogos más expresivamente */
dialog.m3-dialog {
    border-radius: 32px !important;
    padding: 32px !important;
    border: none !important;
    box-shadow: 0px 16px 40px rgba(0, 0, 0, 0.15) !important;
    transition: transform var(--md-transition-duration-medium) var(--md-transition-easing-standard),
                opacity var(--md-transition-duration-medium) var(--md-transition-easing-standard);
}

.m3-card {
    border-radius: 24px !important;
    transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1),
                box-shadow 0.25s cubic-bezier(0.2, 0, 0, 1),
                border-color 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.m3-card:hover {
    box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--md-sys-color-primary);
}

/* Botones con bordes más redondeados y efectos interactivos */
.m3-btn {
    border-radius: 28px !important;
    padding: 12px 28px !important;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1),
                box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1),
                filter 0.2s ease;
}

.m3-btn:hover {
    transform: scale(1.03) translateY(-1px);
    box-shadow: 0px 4px 12px rgba(30, 58, 138, 0.25);
    filter: brightness(1.05);
}

.m3-btn:active {
    transform: scale(0.97);
    box-shadow: none;
}

/* Enfatizar Títulos e Identidad Visual */
.welcome-title, .app-title-header {
    font-weight: 800 !important;
    letter-spacing: -0.3px;
}

/* 2. Banner de Representación Proxy */
.proxy-banner {
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
    color: #ffffff;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px;
    margin: 0 0 24px 0; /* Alineación perfecta con el resto de la interfaz aduanera sin márgenes laterales redundantes */
    box-shadow: 0px 6px 20px rgba(225, 29, 72, 0.35);
    gap: 16px;
    position: relative;
    z-index: 5; /* Asegura un orden de apilado limpio */
    animation: slideDownBanner 350ms cubic-bezier(0.2, 0, 0, 1);
}

/* Estilo para los diálogos flotantes de alerta y confirmación personalizados */
dialog.m3-dialog.dialog-alert-confirm {
    max-width: 440px;
    z-index: 10001; /* Asegurar que flote sobre cualquier otra interfaz o modal */
}

.proxy-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
}

.proxy-banner-icon {
    font-size: 24px;
}

.animated-proxy-icon {
    animation: rotateProxyIcon 4s infinite linear;
}

@keyframes rotateProxyIcon {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideDownBanner {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-proxy-restore {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 20px !important;
    padding: 8px 16px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.btn-proxy-restore:hover {
    background-color: #ffffff !important;
    color: #be123c !important;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15) !important;
    transform: scale(1.03) !important;
}

/* 3. Estilos para Control de Usuarios */
.filter-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.user-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.user-status-dot.active {
    background-color: var(--md-sys-color-secondary);
    box-shadow: 0 0 8px var(--md-sys-color-secondary);
}

.user-status-dot.inactive {
    background-color: var(--md-sys-color-error);
    box-shadow: 0 0 8px var(--md-sys-color-error);
}

/* Pequeñas insignias para representar permisos en la tabla */
.module-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin: 0 2px;
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 16px;
    cursor: default;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.module-badge.granted {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
}

.module-badge.granted:hover {
    transform: scale(1.15);
    background-color: var(--md-sys-color-primary);
    color: #ffffff;
}

/* 4. Panel de Permisos Modulares en Diálogo */
.permissions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
}

@media (min-width: 480px) {
    .permissions-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.permission-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--md-sys-color-background);
    padding: 14px 18px;
    border-radius: 16px;
    border: 1px solid var(--md-sys-color-outline);
    transition: border-color 0.2s, background-color 0.2s;
}

.permission-item-card:hover {
    border-color: var(--md-sys-color-secondary);
    background-color: var(--md-sys-color-surface-hover);
}

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

.permission-item-icon {
    font-size: 20px;
    color: var(--md-sys-color-secondary);
}

.permission-item-info {
    display: flex;
    flex-direction: column;
}

.permission-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.permission-item-desc {
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
}

/* 5. Switch Slider de Material Design 3 */
.m3-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    cursor: pointer;
}

.m3-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.m3-switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--md-sys-color-outline);
    transition: 0.2s;
    border-radius: 24px;
}

.m3-switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: #ffffff;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
}

.m3-switch input:checked + .m3-switch-slider {
    background-color: var(--md-sys-color-secondary);
}

.m3-switch input:checked + .m3-switch-slider:before {
    transform: translateX(24px);
}

/* Deshabilitado / Sólo lectura */
.permission-item-card.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* ==========================================================================
   FASE 6: FILAS EXPANDIBLES Y PANELES LATERALES (SIDE SHEETS) RESIZABLE
   ========================================================================== */

/* --- Estilos para Filas Expandibles --- */
tr.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s var(--md-transition-easing-standard);
}

tr.clickable-row:hover {
    background-color: var(--md-sys-color-surface-container-high) !important;
}

tr.clickable-row.expanded {
    background-color: var(--md-sys-color-secondary-container) !important;
}

tr.clickable-row.expanded td {
    border-bottom-color: transparent !important;
}

/* Fila de Contenedor de Detalles */
tr.expanded-details-row {
    background-color: var(--md-sys-color-surface-container-lowest) !important;
}

tr.expanded-details-row td {
    padding: 0 !important;
    border-bottom: 1px solid var(--md-sys-color-outline-variant) !important;
}

/* Contenedor Animado de Detalles */
.expanded-details-container {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 350ms cubic-bezier(0.2, 0, 0, 1), 
                opacity 350ms cubic-bezier(0.2, 0, 0, 1), 
                padding 350ms cubic-bezier(0.2, 0, 0, 1);
    box-sizing: border-box;
    padding: 0 24px;
}

.expanded-details-container.open {
    max-height: 700px; /* Suficientemente grande para todo el contenido */
    opacity: 1;
    padding: 16px 24px 24px 24px;
}

/* Tarjeta M3 para Detalle */
.m3-detail-card {
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--md-elevation-1);
    animation: detailFadeIn 300ms cubic-bezier(0.2, 0, 0, 1);
}

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

.m3-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding-bottom: 12px;
}

.m3-detail-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.m3-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.m3-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.m3-detail-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.m3-detail-value {
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
}

.m3-detail-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding-top: 12px;
    margin-top: 4px;
}

/* --- Estilos para Ventanas Laterales (Side Sheets) --- */
dialog.m3-dialog.side-sheet {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    left: auto;
    transform: none;
    margin: 0;
    border: none;
    border-left: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 28px 0 0 28px; /* Redondear sólo el lado izquierdo */
    box-shadow: var(--md-elevation-3);
    background-color: var(--md-sys-color-surface-container);
    padding: 28px;
    box-sizing: border-box;
    width: var(--side-sheet-width, 480px);
    max-width: 95vw;
    min-width: 320px;
    display: none; /* Ocultar por defecto cuando está cerrado */
    flex-direction: column;
    overflow: visible; /* Permitir que el tirador flote */
    animation: sideSheetSlideIn 320ms cubic-bezier(0.2, 0, 0, 1);
}

dialog.m3-dialog.side-sheet[open] {
    display: flex; /* Mostrar como flex sólo cuando el diálogo está abierto */
}

@keyframes sideSheetSlideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

dialog.m3-dialog.side-sheet .m3-dialog-form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

dialog.m3-dialog.side-sheet .m3-dialog-body {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 6px;
}

/* Personalización del Scroll en Formularios de Side Sheet */
dialog.m3-dialog.side-sheet .m3-dialog-body::-webkit-scrollbar {
    width: 6px;
}

dialog.m3-dialog.side-sheet .m3-dialog-body::-webkit-scrollbar-track {
    background: transparent;
}

dialog.m3-dialog.side-sheet .m3-dialog-body::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline-variant);
    border-radius: 3px;
}

dialog.m3-dialog.side-sheet .m3-dialog-body::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline);
}

/* Tirador de Redimensionamiento (Split/Resize Handle) */
.side-sheet-resize-handle {
    position: absolute;
    top: 0;
    left: -6px; /* Centrado en el borde izquierdo del diálogo */
    width: 12px;
    height: 100%;
    cursor: ew-resize;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.side-sheet-resize-bar {
    width: 4px;
    height: 50px;
    border-radius: 2px;
    background-color: var(--md-sys-color-outline-variant);
    transition: background-color 0.2s, height 0.2s, width 0.2s;
}

.side-sheet-resize-handle:hover .side-sheet-resize-bar,
dialog.side-sheet.resizing .side-sheet-resize-bar {
    background-color: var(--md-sys-color-primary);
    height: 100px;
    width: 6px;
}

/* Deshabilitación de selección de texto y puntero global durante resize */
body.is-resizing-sheet {
    cursor: ew-resize !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

body.is-resizing-sheet iframe,
body.is-resizing-sheet button,
body.is-resizing-sheet input {
    pointer-events: none !important;
}

/* --- BUSCADOR INTELIGENTE EN DASHBOARD (FASE 7) --- */
.dashboard-search-box {
    margin-bottom: 28px;
}

.dashboard-search-container {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 28px;
    padding: 4px 20px;
    box-shadow: var(--md-elevation-1);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.dashboard-search-container:focus-within {
    border-color: var(--md-sys-color-primary);
    box-shadow: var(--md-elevation-2);
}

.dashboard-search-icon {
    color: var(--md-sys-color-primary);
    margin-right: 12px;
}

.dashboard-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 0;
    font-size: 16px;
    font-family: inherit;
    color: var(--md-sys-color-on-surface);
    outline: none;
}

.dashboard-search-input::placeholder {
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.85;
}

.dashboard-search-clear {
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: none; /* Se mostrará por JS sólo cuando haya texto */
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
}

.dashboard-search-clear:hover {
    background-color: var(--md-sys-color-surface-variant);
    transform: scale(1.1);
}

.dashboard-search-image-btn {
    border: none;
    background: transparent;
    color: var(--md-sys-color-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s, color 0.2s;
}

.dashboard-search-image-btn:hover {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    transform: scale(1.1);
}

.dashboard-search-image-btn:active {
    transform: scale(0.95);
}

/* Ayuda Pedagógica de Clave */
.dashboard-pedagogic-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 16px 20px;
    border-radius: var(--md-shape-corner-medium);
    margin-bottom: 24px;
    font-size: 13px;
    line-height: 1.5;
}

.pedagogic-title {
    font-weight: 700;
    width: 100%;
    margin-bottom: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pedagogic-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    width: 100%;
}

.pedagogic-step {
    background: rgba(255, 255, 255, 0.4);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pedagogic-step.active-result {
    background: var(--md-sys-color-primary-container, #d1e4ff);
    border-color: var(--md-sys-color-primary, #005FAF);
    box-shadow: 0 4px 12px rgba(0, 95, 175, 0.15);
    transform: translateY(-2px);
}

.pedagogic-step.active-result .pedagogic-step-num {
    color: var(--md-sys-color-on-primary-container, #001d36);
}

.pedagogic-step-num {
    font-weight: 700;
    color: var(--md-sys-color-primary);
    transition: color 0.3s ease;
}

/* Detalle dinámico de la clave completa seleccionada */
.wizard-full-desc-container {
    width: 100%;
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.45);
    border-radius: var(--md-shape-corner-medium);
    border: 1px dashed rgba(30, 58, 138, 0.25);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-sizing: border-box;
}

body.dark-mode .wizard-full-desc-container {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.15);
}

.full-desc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 12px;
    width: 100%;
}

body.dark-mode .full-desc-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.full-desc-badge-constructed {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    font-size: 15px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: var(--md-elevation-1);
    letter-spacing: 0.5px;
}

.full-desc-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.full-desc-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 16px;
    background: var(--md-sys-color-surface);
    border-radius: 8px;
    border: 1px solid var(--md-sys-color-outline);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.full-desc-item:hover {
    transform: translateX(4px);
    box-shadow: var(--md-elevation-1);
}

.full-desc-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    text-align: center;
}

.full-desc-level {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--md-sys-color-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.full-desc-code {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-variant);
    padding: 2px 8px;
    border-radius: 4px;
}

.full-desc-separator {
    width: 1px;
    align-self: stretch;
    background-color: var(--md-sys-color-outline);
}

.full-desc-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface);
    flex: 1;
    word-break: break-word;
}

@media (max-width: 600px) {
    .full-desc-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .full-desc-meta {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        min-width: auto;
    }
    .full-desc-separator {
        display: none;
    }
}

/* Resultados de Búsqueda */
.search-results-wrapper {
    max-height: 520px;
    overflow-y: auto;
    margin-top: 16px;
    border-radius: var(--md-shape-corner-medium);
    padding: 4px;
    border: 1px dashed var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-hover);
    display: none; /* Oculto por defecto, se muestra al buscar */
}

/* Personalizar scroll del buscador */
.search-results-wrapper::-webkit-scrollbar {
    width: 8px;
}
.search-results-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
.search-results-wrapper::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline-variant);
    border-radius: 4px;
}
.search-results-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline);
}

.search-result-item {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-shape-corner-medium);
    padding: 20px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.search-result-item:hover {
    box-shadow: var(--md-elevation-1);
    border-color: var(--md-sys-color-primary);
}

.search-result-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* Badge del Código Unificado de 10 Dígitos */
.unified-code-badge {
    font-family: 'Roboto Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--md-sys-color-on-tertiary-container);
    background-color: var(--md-sys-color-tertiary-container);
    padding: 6px 14px;
    border-radius: 12px;
    letter-spacing: 1.2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Desglose de Código Visual */
.code-breakdown {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
}

.code-segment-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 6px;
    padding: 3px 8px;
    min-width: 32px;
}

.code-segment-label {
    font-size: 8px;
    color: var(--md-sys-color-primary);
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 1px;
}

.search-result-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nico-desc-row {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.fraccion-desc-row {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding-left: 2px;
}

.search-highlight {
    background-color: rgba(255, 215, 0, 0.35);
    color: var(--md-sys-color-on-surface);
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

.search-result-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding-top: 14px;
    gap: 12px;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
}

.search-result-actions {
    display: flex;
    gap: 8px;
}

/* Animación de Realce en Simulador */
@keyframes cardFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(103, 80, 164, 0.7);
        border-color: var(--md-sys-color-primary);
        background-color: var(--md-sys-color-primary-container);
    }
    50% {
        box-shadow: 0 0 0 14px rgba(103, 80, 164, 0);
        border-color: var(--md-sys-color-primary);
        background-color: var(--md-sys-color-primary-container);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(103, 80, 164, 0);
    }
}

.flash-highlight-animation {
    animation: cardFlash 1.6s ease-out 1;
}

/* --- BOTONES DE ACCIÓN TIPO CÁPSULA (ESTILO ALE CABIN) --- */
.action-capsule {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.action-capsule span.material-symbols-outlined {
    font-size: 16px !important;
}

/* Edit capsule: color neutro / gris */
.action-capsule.edit-capsule {
    border-color: var(--md-sys-color-outline-variant, #c4c6d0);
    color: var(--md-sys-color-on-surface, #1a1c1e);
}
.action-capsule.edit-capsule:hover {
    background-color: var(--md-sys-color-surface-variant, #e1e2ec);
    border-color: var(--md-sys-color-outline, #74777f);
    transform: translateY(-1px);
}

/* Proxy capsule: color azul */
.action-capsule.proxy-capsule {
    border-color: rgba(0, 102, 204, 0.4);
    color: #0066cc;
}
.action-capsule.proxy-capsule:hover {
    background-color: rgba(0, 102, 204, 0.08);
    border-color: #0066cc;
    transform: translateY(-1px);
}

/* Delete capsule: color rojo de error */
.action-capsule.delete-capsule {
    border-color: var(--md-sys-color-error-container, #ffdad6);
    color: var(--md-sys-color-error, #ba1a1a);
}
.action-capsule.delete-capsule:hover {
    background-color: var(--md-sys-color-error-container, #ffdad6);
    border-color: var(--md-sys-color-error, #ba1a1a);
    color: var(--md-sys-color-on-error-container, #410002);
    transform: translateY(-1px);
}

/* ================= BOTÓN INTERACTIVO DE MODO IA ================= */
.dashboard-search-ia-btn {
    border: none;
    background: var(--md-sys-color-surface-container-highest, #e1e2ec);
    color: var(--md-sys-color-primary, #005FAF);
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: 1px solid var(--md-sys-color-outline-variant, #c4c6d0);
    margin-left: 8px;
}

.dashboard-search-ia-btn:hover {
    background-color: var(--md-sys-color-primary-container, #d1e4ff);
    color: var(--md-sys-color-on-primary-container, #001d36);
    transform: scale(1.05);
}

.dashboard-search-ia-btn:active {
    transform: scale(0.95);
}

.dashboard-search-ia-btn.active {
    background: linear-gradient(135deg, var(--md-sys-color-primary, #005FAF), #673ab7);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(103, 58, 183, 0.3);
    transform: scale(1.02);
}

.dashboard-search-ia-btn.active .gemini-sparkle-svg {
    animation: diamondGlow 1.5s infinite ease-in-out;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
}

@media (max-width: 650px) {
    .dashboard-search-ia-btn span {
        display: none;
    }
    .dashboard-search-ia-btn {
        padding: 8px;
        border-radius: 50%;
        margin-left: 4px;
    }
}

/* ==========================================================================
   Asistente Interactivo de Clasificación (Wizard) - Material 3 Expressive
   ========================================================================== */

.pedagogic-step.interactive-step {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.pedagogic-step.interactive-step:hover {
    background: rgba(255, 255, 255, 0.7) !important;
    border-color: var(--md-sys-color-primary) !important;
    box-shadow: 0 4px 14px rgba(0, 95, 175, 0.12) !important;
    transform: translateY(-2px);
}

.pedagogic-step.interactive-step:active {
    transform: translateY(0) scale(0.98);
}

/* Animación de pulso para guiar de la mano al usuario */
.pedagogic-step.pulse-highlight {
    border-color: var(--md-sys-color-primary) !important;
    box-shadow: 0 0 16px rgba(0, 95, 175, 0.5) !important;
    animation: stepPulseHighlight 1.8s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes stepPulseHighlight {
    0% {
        box-shadow: 0 0 2px rgba(0, 95, 175, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 16px rgba(0, 95, 175, 0.6);
        transform: scale(1.03);
        background: rgba(255, 255, 255, 0.6);
    }
    100% {
        box-shadow: 0 0 2px rgba(0, 95, 175, 0.2);
        transform: scale(1);
    }
}

/* Indicadores de deshabilitación */
.pedagogic-step.step-disabled {
    opacity: 0.55;
    cursor: not-allowed !important;
}
.pedagogic-step.step-disabled:hover {
    background: rgba(255, 255, 255, 0.4) !important;
    border-color: rgba(0, 0, 0, 0.05) !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Elementos del listado de opciones del Wizard (dentro del diálogo) */
.wizard-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 24px 24px 24px;
}

.wizard-option-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wizard-option-item:hover {
    background-color: var(--md-sys-color-surface-container-high);
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateX(4px);
}

.wizard-option-item:active {
    transform: scale(0.99) translateX(2px);
}

.wizard-option-code {
    font-family: 'Outfit', 'Roboto', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-primary-container);
    padding: 6px 12px;
    border-radius: 10px;
    min-width: 90px;
    text-align: center;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.wizard-option-desc {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    line-height: 1.4;
    flex: 1;
}

.wizard-option-meta {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.wizard-meta-badge {
    background-color: var(--md-sys-color-surface-container-highest);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

/* Spinner de carga del wizard */
.wizard-loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 16px;
    color: var(--md-sys-color-primary);
}

.wizard-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3.5px solid var(--md-sys-color-primary-container);
    border-top: 3.5px solid var(--md-sys-color-primary);
    border-radius: 50%;
    animation: wizardSpin 0.8s linear infinite;
}

@keyframes wizardSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wizard-loader-text {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.8;
}

/* Estado vacío en búsqueda */
.wizard-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    gap: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

/* ==========================================================================
   NUEVO MÓDULO: LOGÍSTICA Y RECEPCIÓN FEDEX
   ========================================================================== */

/* Conectividad Live Banner */
.fedex-conn-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.25px;
    border: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fedex-conn-banner.status-connecting {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}

.fedex-conn-banner.status-connected {
    background-color: rgba(46, 125, 50, 0.08);
    color: #2e7d32;
    border-color: rgba(46, 125, 50, 0.25);
}

.fedex-conn-banner.status-error {
    background-color: rgba(198, 40, 40, 0.08);
    color: #c62828;
    border-color: rgba(198, 40, 40, 0.25);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.status-connecting .pulse-dot {
    background-color: var(--md-sys-color-outline);
}

.status-connected .pulse-dot {
    background-color: #2e7d32;
    box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.7);
    animation: pulseGreen 1.6s infinite;
}

.status-error .pulse-dot {
    background-color: #c62828;
    box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.7);
    animation: pulseRed 1.6s infinite;
}

@keyframes pulseGreen {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(46, 125, 50, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(46, 125, 50, 0);
    }
}

@keyframes pulseRed {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(198, 40, 40, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(198, 40, 40, 0);
    }
}

/* Badges de FedEx */
.fedex-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.fedex-badge.status-delivered {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid rgba(46, 125, 50, 0.15);
}

.fedex-badge.status-delivering {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid rgba(21, 101, 192, 0.15);
}

.fedex-badge.status-transit {
    background-color: #fff8e1;
    color: #f57f17;
    border: 1px solid rgba(245, 127, 23, 0.15);
}

.fedex-badge.status-exception {
    background-color: #fbe9e7;
    color: #d84315;
    border: 1px solid rgba(216, 67, 21, 0.15);
}

.fedex-badge.status-error {
    background-color: #efebe9;
    color: #4e342e;
    border: 1px solid rgba(78, 52, 46, 0.15);
}

.fedex-badge.status-default {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline-variant);
}

/* Indicadores de carga pequeños */
.m3-icon-btn-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    transition: all 0.2s ease;
}

.m3-icon-btn-small:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-primary);
}

.m3-icon-btn-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Contador rápido */
.live-counter-badge {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

/* Métricas del Lote */
.metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    font-size: 13px;
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.metric-label {
    flex-grow: 1;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
}

.metric-value {
    font-size: 14px;
    font-weight: 600;
}

/* Tabla de resultados */
.m3-table tr.row-warning {
    background-color: rgba(245, 127, 23, 0.02);
}

.m3-table tr.row-warning:hover {
    background-color: rgba(245, 127, 23, 0.05);
}

.m3-table tr.row-error {
    background-color: rgba(198, 40, 40, 0.02);
}

.m3-table tr.row-error:hover {
    background-color: rgba(198, 40, 40, 0.05);
}

.table-text-truncated {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    display: inline-block;
}

/* DRAWER LATERAL: LÍNEA DE TIEMPO DEL EMBARQUE */
.m3-drawer-right {
    position: fixed;
    top: 64px; /* Debajo de la barra superior */
    right: -420px; /* Escondido */
    width: 400px;
    height: calc(100vh - 64px);
    background-color: var(--md-sys-color-surface);
    border-left: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: -4px 0 24px rgba(0,0,0,0.08);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.m3-drawer-right.open {
    right: 0;
}

.drawer-right-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--md-sys-color-surface-container-low);
}

.drawer-right-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

/* Vertical Timeline Stepper */
.fedex-timeline-stepper {
    display: flex;
    flex-direction: column;
    position: relative;
    padding-left: 16px;
    margin-top: 10px;
}

.fedex-timeline-stepper::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 21px; /* Centrado con el círculo */
    width: 2px;
    background-color: var(--md-sys-color-outline-variant);
}

.timeline-step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    position: relative;
}

.timeline-step:last-child {
    margin-bottom: 0;
}

.step-indicator {
    position: relative;
    display: flex;
    justify-content: center;
    width: 12px;
    z-index: 1;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--md-sys-color-outline);
    border: 2px solid var(--md-sys-color-surface);
    transition: all 0.2s ease;
    margin-top: 4px;
}

.timeline-step.latest-step .step-dot {
    background-color: var(--md-sys-color-primary);
    transform: scale(1.3);
    box-shadow: 0 0 0 4px var(--md-sys-color-primary-container);
}

.step-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.step-title {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.timeline-step.latest-step .step-title {
    color: var(--md-sys-color-primary);
}

.step-meta {
    margin: 0;
    font-size: 11.5px;
    color: var(--md-sys-color-on-surface-variant);
}

.step-timestamp {
    font-size: 11px;
    color: var(--md-sys-color-outline);
    font-weight: 500;
    font-family: monospace;
    margin-top: 2px;
}

/* Animaciones */
.animated-spin {
    animation: wizardSpin 1.2s infinite linear;
}


/* ==========================================================================
   ESTILOS PREMIUM: MÓDULO DE MANIFIESTOS DE CARGA (M3 SPLIT-LAYOUT)
   ========================================================================== */

/* Layout Completo de Manifiestos sin Barra Lateral */
.manifiestos-full-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* Chips de Filtrado Temporal Premium */
.filter-chip {
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline-variant);
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-chip:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    border-color: var(--md-sys-color-outline);
    transform: translateY(-1px);
}

.filter-chip:active {
    transform: translateY(0);
}

.filter-chip.active {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.manifiestos-split-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    height: calc(100vh - 220px);
    min-height: 550px;
    align-items: stretch;
}

@media (max-width: 991px) {
    .manifiestos-split-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Panel Izquierdo: Lista de Manifiestos */
.manifiestos-list-panel {
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-section-title {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--md-sys-color-on-surface-variant);
    padding-left: 4px;
}

.manifiestos-scroll-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

/* Tarjeta de Manifiesto */
.manifiesto-card {
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.manifiesto-card:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.manifiesto-card.active {
    background-color: var(--md-sys-color-primary-container) !important;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.manifiesto-card.active .manifiesto-id {
    color: var(--md-sys-color-on-primary-container);
}

.manifiesto-card.active .manifiesto-meta {
    color: var(--md-sys-color-on-primary-container);
    opacity: 0.8;
}

.manifiesto-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.manifiesto-id {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    gap: 6px;
}

.manifiesto-badge-count {
    font-size: 11px;
    font-weight: 700;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 2px 8px;
    border-radius: 12px;
}

.manifiesto-card.active .manifiesto-badge-count {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.manifiesto-meta-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.manifiesto-meta {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    align-items: center;
    gap: 6px;
}

.manifiesto-meta .material-symbols-outlined {
    font-size: 14px;
}

/* Panel Derecho: Detalle de Guías */
.manifiestos-details-panel {
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 20px;
    padding: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Badges de Estatus de Guías (HSL Armoniosos) */
.guia-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    border-width: 1px;
    border-style: solid;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: fit-content;
}

.status-revision-embarque {
    background-color: hsl(210, 80%, 95%);
    color: hsl(210, 80%, 30%);
    border-color: hsl(210, 80%, 85%);
}

.status-revision {
    background-color: hsl(260, 60%, 95%);
    color: hsl(260, 60%, 35%);
    border-color: hsl(260, 60%, 85%);
}

.status-proforma {
    background-color: hsl(28, 90%, 94%);
    color: hsl(28, 90%, 35%);
    border-color: hsl(28, 90%, 85%);
}

.status-revision-interna {
    background-color: hsl(190, 70%, 93%);
    color: hsl(190, 70%, 30%);
    border-color: hsl(190, 70%, 83%);
}

.status-revision-cliente {
    background-color: hsl(40, 80%, 93%);
    color: hsl(40, 80%, 30%);
    border-color: hsl(40, 80%, 80%);
}

.status-aprobacion-cliente {
    background-color: hsl(160, 70%, 93%);
    color: hsl(160, 70%, 30%);
    border-color: hsl(160, 70%, 80%);
}

.status-facturacion {
    background-color: hsl(340, 70%, 94%);
    color: hsl(340, 70%, 35%);
    border-color: hsl(340, 70%, 85%);
}

.status-pago {
    background-color: hsl(45, 90%, 92%);
    color: hsl(45, 90%, 30%);
    border-color: hsl(45, 90%, 75%);
}

.status-finalizado {
    background-color: hsl(120, 60%, 92%);
    color: hsl(120, 60%, 28%);
    border-color: hsl(120, 60%, 80%);
}

/* Interactores de Estatus dentro de la tabla (Estilo Status-Badge Pill Interactivo) */
.guia-status-select {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    border-width: 1px;
    border-style: solid;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: fit-content;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Flecha estilizada de dropdown en SVG (stroke='currentColor' hereda el color de texto del estatus) */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    background-size: 12px;
    line-height: 1.2;
}

.guia-status-select:hover {
    filter: brightness(0.96);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.m3-dialog-guide code {
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    color: var(--md-sys-color-primary);
}

/* ================= COMPLEMENTOS: DISEÑO DE PROFORMAS Y ALTA DENSIDAD ================= */
.compact-input {
    height: 46px !important; /* Optimizado para tacto en iPads (mínimo 44px) */
    padding: 10px 16px !important;
    font-size: 14px !important;
    border-radius: 12px !important;
    font-family: inherit !important;
}

.m3-label-compact {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--md-sys-color-on-surface-variant) !important;
    text-transform: none !important; /* Estilo Sentence Case para mejor lectura rápida */
    letter-spacing: 0.2px;
    margin-bottom: 4px !important;
    display: inline-block;
}

.sticky-proforma-header {
    position: sticky;
    top: 64px; /* Flota exactamente debajo del header de la app fixed (64px) */
    background-color: var(--md-sys-color-surface) !important;
    z-index: 90;
    margin: 0;
    padding: 16px 24px;
    border-bottom: 1.5px solid var(--md-sys-color-outline-variant);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.dark-mode .sticky-proforma-header {
    background-color: var(--md-sys-color-surface) !important;
    border-bottom-color: var(--md-sys-color-outline-variant);
}

/* Alturas táctiles de botones principales */
.btn-touch-large {
    height: 48px !important;
    border-radius: 12px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    padding: 0 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer;
}

.btn-touch-medium {
    height: 44px !important;
    border-radius: 10px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    padding: 0 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer;
}

.btn-touch-icon-only {
    width: 44px !important;
    padding: 0 !important;
    justify-content: center !important;
    gap: 0 !important;
}

/* MEDIA QUERY PARA TABLETAS / IPADS: Ajuste ergonómico automático */
@media (max-width: 1024px) {
    /* Por defecto, colapsar el panel izquierdo en tabletas para maximizar el espacio de trabajo */
    .reception-split-layout {
        grid-template-columns: 60px 1fr;
    }
    .reception-split-layout .hide-on-collapse {
        display: none;
    }
    .reception-split-layout .show-on-collapse {
        display: flex;
    }
    .reception-left-panel {
        padding: 16px 8px !important;
        gap: 0 !important;
        align-items: center;
    }
    
    /* Si el usuario hace clic para EXPANDIR el listado (remueve la clase .guides-collapsed) */
    .reception-split-layout:not(.guides-collapsed) {
        grid-template-columns: 280px 1fr !important;
    }
    .reception-split-layout:not(.guides-collapsed) .hide-on-collapse {
        display: flex !important;
    }
    .reception-split-layout:not(.guides-collapsed) .show-on-collapse {
        display: none !important;
    }
    .reception-split-layout:not(.guides-collapsed) .reception-left-panel {
        padding: 16px !important;
        gap: 16px !important;
        align-items: stretch !important;
    }
    
    /* Re-distribución de grids en dos columnas estables en lugar de cuatro apretadas */
    .proforma-header-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .proforma-partida-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .proforma-header-grid .m3-form-group {
        grid-column: span 1 !important;
    }
}

.reception-guia-card {
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    padding: 12px 16px;
    background-color: var(--md-sys-color-surface-container-low);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
    user-select: none;
}

.reception-guia-card:hover {
    background-color: var(--md-sys-color-surface-container-high);
    border-color: var(--md-sys-color-primary);
}

.reception-guia-card.active {
    background-color: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary-container);
}

.reception-guia-card.active .guia-card-awb {
    color: var(--md-sys-color-primary) !important;
    font-weight: 700;
}

.proforma-partida-card {
    transition: all 0.2s ease-in-out;
}

.proforma-partida-card:hover {
    border-color: var(--md-sys-color-primary) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}


/* ==========================================================================
   ESTILOS PREMIUM: RECEPCIÓN FEDEX CON COLAPSO INTERACTIVO DE PANEL
   ========================================================================== */

.reception-split-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 24px;
    min-height: 700px;
    align-items: start;
    transition: grid-template-columns 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reception-left-panel {
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}

/* Colapso a 60px */
.reception-split-layout.guides-collapsed {
    grid-template-columns: 60px 1fr;
}

.reception-split-layout.guides-collapsed .reception-left-panel {
    padding: 16px 8px !important;
    gap: 0 !important;
    align-items: center;
}

/* Alternancia de visibilidad */
.reception-split-layout.guides-collapsed .hide-on-collapse {
    display: none !important;
}

.reception-split-layout.guides-collapsed .show-on-collapse {
    display: flex !important;
}

.reception-left-panel .show-on-collapse {
    display: none !important;
}

.guia-doc-thumbnail {
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    max-width: 150px;
    flex-grow: 0;
    position: relative;
    transition: all 0.2s ease;
}

.guia-doc-thumbnail:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    border-color: var(--md-sys-color-primary);
}

.doc-list-row:hover {
    background-color: var(--md-sys-color-surface-container-highest) !important;
}

.guia-doc-thumbnail-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
}

.guia-doc-thumbnail-delete:hover {
    transform: scale(1.15);
}

.guia-doc-thumbnail-delete span {
    font-size: 12px !important;
}

/* Efecto Brillo / Resaltado por IA de Gemini */
.ia-glow-input {
    animation: iaGlowAnimation 2.5s infinite ease-in-out;
    background-color: rgba(103, 80, 164, 0.05) !important;
}

@keyframes iaGlowAnimation {
    0% {
        border-color: var(--md-sys-color-outline-variant);
        box-shadow: 0 0 0 rgba(103, 80, 164, 0);
    }
    50% {
        border-color: var(--md-sys-color-primary);
        box-shadow: 0 0 8px rgba(103, 80, 164, 0.4);
    }
    100% {
        border-color: var(--md-sys-color-outline-variant);
        box-shadow: 0 0 0 rgba(103, 80, 164, 0);
    }
}

/* Sparkle animation */
.animated-sparkle {
    animation: sparkleSlow 2s infinite ease-in-out;
}

@keyframes sparkleSlow {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0px var(--md-sys-color-primary)); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 4px var(--md-sys-color-primary)); }
}

/* RESPONSIVE DESIGN: PROFORMAS DE ALTA DENSIDAD */
.proforma-header-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    background-color: var(--md-sys-color-surface-container-lowest);
    padding: 16px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
}

.proforma-partida-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (max-width: 1300px) {
    .proforma-header-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .proforma-partida-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .proforma-header-grid {
        grid-template-columns: 1fr !important;
    }
    .proforma-partida-grid {
        grid-template-columns: 1fr !important;
    }
    .proforma-header-grid .m3-form-group {
        grid-column: span 1 !important;
    }
}

/* MATERIAL DESIGN 3 SPINNING LOADER */
.material-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--md-sys-color-primary-container);
    border-top: 2px solid var(--md-sys-color-primary);
    border-radius: 50%;
    animation: materialSpin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes materialSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ESTILO IPHONE: SLIDE-TO-CONFIRM PARA CAMBIO DE GUÍA */
.ios-slider-track {
    position: relative;
    width: 100%;
    height: 64px;
    background-color: #354a2e !important; /* iPhone dark-olive power-off green background */
    border: none !important;
    border-radius: 32px !important;
    overflow: hidden;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.35) !important;
}

.ios-slider-handle {
    position: absolute;
    left: 4px;
    width: 56px;
    height: 56px;
    background-color: #ffffff !important; /* White circular knob, just like iOS */
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4) !important;
    transition: transform 0.15s ease-out;
}

.ios-slider-handle:active {
    cursor: grabbing;
    transform: scale(1.03);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5) !important;
}

.ios-slider-text {
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    color: rgba(255, 255, 255, 0.8) !important;
    opacity: 0.8;
    pointer-events: none;
    z-index: 1;
    animation: shimmerText 2.5s infinite linear;
    background: linear-gradient(90deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.95) 50%, rgba(255,255,255,0.4) 100%) !important;
    background-size: 200% 100% !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    transition: opacity 0.1s ease-out;
}

@keyframes shimmerText {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}


/* ==========================================================================
   TABLERO MONITOR FLIGHT INFORMATION DISPLAY SYSTEM (FIDS) - ESTILO AEROPUERTO
   ========================================================================== */
/* ==========================================================================
   TABLERO MONITOR FLIGHT INFORMATION DISPLAY SYSTEM (FIDS) - ESTILO INTEGRADO M3
   ========================================================================== */
.fids-board-card {
    background-color: var(--md-sys-color-surface) !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    border-radius: 24px !important;
    padding: 24px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
    color: var(--md-sys-color-on-surface) !important;
    font-family: 'Inter', -apple-system, sans-serif !important;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Removido el filtro analógico CRT para mantener la nitidez y limpieza de Material Design 3 */
.fids-board-card::before {
    display: none;
}

.fids-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.fids-logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fids-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
    color: var(--md-sys-color-primary) !important;
    margin: 0;
    text-transform: uppercase;
}

.fids-subtitle {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    margin: 2px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fids-clock {
    background-color: var(--md-sys-color-primary-container);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 16px;
    padding: 10px 22px;
    font-family: 'Roboto Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    color: var(--md-sys-color-on-primary-container);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.fids-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.fids-kpi-card {
    background-color: var(--md-sys-color-surface-variant);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: none;
    transition: transform 0.2s ease, background-color 0.3s ease;
}

.fids-kpi-card:hover {
    transform: translateY(-2px);
    background-color: var(--md-sys-color-surface-hover);
}

.fids-kpi-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.fids-kpi-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.fids-kpi-value.cyan {
    color: var(--md-sys-color-primary);
}
.fids-kpi-value.red {
    color: #d32f2f;
}
.fids-kpi-value.orange {
    color: #ef6c00;
}
.fids-kpi-value.amber {
    color: #f57c00;
}
.fids-kpi-value.blue {
    color: #1976d2;
}
.fids-kpi-value.purple {
    color: #7b1fa2;
}
.fids-kpi-value.green {
    color: #2e7d32;
}

/* --- TABLA FIDS ESTILO MODERN TRACKING --- */
.fids-table-wrapper {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 16px;
    overflow-x: auto;
}

.fids-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.fids-table th {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    white-space: nowrap;
}

.fids-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
    vertical-align: middle;
}

.fids-table tbody tr {
    transition: background-color 0.2s ease;
}

.fids-table tbody tr:hover {
    background-color: var(--md-sys-color-surface-hover);
}

.fids-cell-awb {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    color: var(--md-sys-color-primary) !important;
}

.fids-cell-flight {
    font-family: 'Roboto Mono', monospace;
    font-weight: 700;
    color: var(--md-sys-color-tertiary) !important;
}

.fids-cell-company {
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    text-transform: uppercase;
    font-size: 12px;
}

.fids-cell-progress {
    width: 160px;
}

/* Material rounded progress bar style */
.fids-progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--md-sys-color-surface-variant);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}

.fids-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
}

.fids-progress-fill.color-pending {
    background-color: #d32f2f !important;
}
.fids-progress-fill.color-embarque {
    background-color: #ef6c00 !important;
}
.fids-progress-fill.color-validacion {
    background-color: #f57c00 !important;
}
.fids-progress-fill.color-aprobacion {
    background-color: #1976d2 !important;
}
.fids-progress-fill.color-facturacion {
    background-color: #7b1fa2 !important;
}
.fids-progress-fill.color-pagado {
    background-color: #2e7d32 !important;
}

.fids-progress-text {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* FIDS Status Indicator Badges */
.fids-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: none;
}

.fids-status-badge.fids-pending {
    background-color: rgba(211, 47, 47, 0.12) !important;
    color: #d32f2f !important;
    border: 1px solid rgba(211, 47, 47, 0.25) !important;
}

.fids-status-badge.fids-embarque {
    background-color: rgba(239, 108, 0, 0.12) !important;
    color: #ef6c00 !important;
    border: 1px solid rgba(239, 108, 0, 0.25) !important;
}

.fids-status-badge.fids-validacion {
    background-color: rgba(245, 124, 0, 0.12) !important;
    color: #f57c00 !important;
    border: 1px solid rgba(245, 124, 0, 0.25) !important;
}

.fids-status-badge.fids-aprobacion {
    background-color: rgba(25, 118, 210, 0.12) !important;
    color: #1976d2 !important;
    border: 1px solid rgba(25, 118, 210, 0.25) !important;
}

.fids-status-badge.fids-facturacion {
    background-color: rgba(123, 31, 162, 0.12) !important;
    color: #7b1fa2 !important;
    border: 1px solid rgba(123, 31, 162, 0.25) !important;
}

.fids-status-badge.fids-pagado {
    background-color: rgba(46, 125, 50, 0.12) !important;
    color: #2e7d32 !important;
    border: 1px solid rgba(46, 125, 50, 0.25) !important;
}

.fids-cell-operator {
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
}

/* ==========================================================================
   ESTILOS PREMIUM: TARJETAS DE GUÍAS EN VALIDACIÓN Y APROBACIÓN
   ========================================================================== */
.guia-item-card {
    position: relative;
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant) !important;
    overflow: hidden;
}

.guia-item-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: transparent;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    transition: background-color 0.2s ease;
}

.guia-item-card:hover {
    background-color: var(--md-sys-color-surface-container-high) !important;
    border-color: var(--md-sys-color-primary) !important;
}

.guia-item-card.active {
    background-color: var(--md-sys-color-primary-container) !important;
    border-color: var(--md-sys-color-primary) !important;
    border-width: 1.5px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.guia-item-card.active::before {
    background-color: var(--md-sys-color-primary);
}

.guia-item-card.active div {
    color: var(--md-sys-color-on-primary-container) !important;
}

.guia-item-card.active span:not(.fedex-badge) {
    color: var(--md-sys-color-primary) !important;
}


/* ==========================================================================
   ESTILOS PREMIUM: TOOLTIPS MD3 DE ALTO CONTRASTE
   ========================================================================== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background-color: #212121; /* Alto contraste para legibilidad */
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    letter-spacing: 0.2px;
}

[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    border-width: 5px;
    border-style: solid;
    border-color: #212121 transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    bottom: 130%;
}

[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    bottom: 120%;
}

/* Tooltips posicionados abajo y alineados hacia la izquierda para elementos en esquinas superiores derechas */
[data-tooltip-pos="bottom-left"]::after {
    left: auto;
    right: 0;
    bottom: auto;
    top: 120%;
    transform: scale(0.9);
}

[data-tooltip-pos="bottom-left"]::before {
    left: auto;
    right: 14px;
    bottom: auto;
    top: 110%;
    transform: scale(0.9);
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #212121 transparent; /* Flecha hacia arriba */
}

[data-tooltip-pos="bottom-left"]:hover::after {
    opacity: 1;
    transform: scale(1);
    left: auto;
    right: 0;
    bottom: auto;
    top: 130%;
}

[data-tooltip-pos="bottom-left"]:hover::before {
    opacity: 1;
    transform: scale(1);
    left: auto;
    right: 14px;
    bottom: auto;
    top: 120%;
}


/* ==========================================================================
   OPTIMIZACIONES DE RENDIMIENTO PARA TABLETAS E IPADS (DESACTIVACIÓN DE ANIMACIONES PESADAS)
   ========================================================================== */
@media (max-width: 1024px), (hover: none) {
    /* 1. Desactivar bucles infinitos que sobrecargan CPU/GPU en navegadores de tableta (Safari WebKit) */
    .animated-diamond,
    .dashboard-search-ia-btn.active .gemini-sparkle-svg,
    .ia-glow-input,
    .sparkle-slow,
    .shimmer-text,
    .pulse-green,
    .pulse-red,
    .wizard-spin,
    .step-pulse-highlight,
    .skeleton-loading,
    .loading-pulse,
    .skeleton-pulse {
        animation: none !important;
        background-image: none !important; /* Quita los gradientes dinámicos móviles */
        filter: none !important;
    }

    /* 2. Suprimir transformaciones pesadas de escala (zoom) y sombras dinámicas en hovers (que se quedan pegadas al tocar en tablets) */
    .m3-card:hover,
    .reception-guia-card:hover,
    .guia-doc-thumbnail:hover,
    .dashboard-search-ia-btn:hover,
    .sidebar-menu-item:hover,
    .fids-row:hover,
    .guia-doc-thumbnail-delete:hover {
        transform: none !important;
        box-shadow: none !important;
    }

    /* 3. Acelerar de manera global las transiciones para que el teclado virtual y los toques táctiles respondan de forma instantánea */
    *, *::before, *::after {
        transition-duration: 0.1s !important;
    }

    /* 4. Asegurar que los diálogos e interfaces colapsables aparezcan inmediatamente sin transiciones de escala complejas */
    .m3-dialog,
    .side-sheet,
    .custom-dialog {
        animation-duration: 0.1s !important;
    }
}

/* Animación de parpadeo para el ícono de alertas en el FIDS header */
@keyframes alertBlink {
    0% { opacity: 0.25; transform: scale(0.9); }
    50% { opacity: 1.0; transform: scale(1.1); }
    100% { opacity: 0.25; transform: scale(0.9); }
}
.alert-blink-icon {
    animation: alertBlink 1.4s infinite ease-in-out;
}

/* =========================================================================
   ESTILOS PREMIUM PARA EL PORTAL DE APP CLIENTE
   ========================================================================= */

.app-cliente-list-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.app-cliente-list-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--md-shape-corner-medium), var(--md-elevation-2) !important;
    border-color: var(--md-sys-color-primary) !important;
}

.app-cliente-list-card.active {
    background-color: var(--md-sys-color-primary-container, #e0f2fe) !important;
}

/* Animación de pulso para indicar el paso de seguimiento activo */
@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(1.3); opacity: 1; }
}

/* Responsive para split-portal-cliente */
@media (max-width: 991px) {
    .split-portal-cliente {
        grid-template-columns: 1fr !important;
    }
}

/* Estilo para las etapas del stepper */
.step-completed h5 {
    color: var(--md-sys-color-on-surface) !important;
}

.step-active h5 {
    color: var(--md-sys-color-primary) !important;
}

.step-pending h5 {
    color: var(--md-sys-color-on-surface-variant) !important;
    opacity: 0.6;
}

.step-pending p {
    opacity: 0.6;
}




