/* ==========================================================================
   SISTEMA DE DISEÑO GLOBAL - TECHFLOW ERP
   Estilos premium para la gestión empresarial de servicios tecnológicos.
   Soporte completo para Glassmorphism, Modo Oscuro y Estilos de Impresión.
   ========================================================================== */

/* 1. CONFIGURACIÓN E IMPORTACIONES */
:root {
    /* Paleta de Colores (Diseño Oscuro Premium) */
    --bg-dark: #0a0e17;
    --bg-sidebar: #101625;
    --card-bg: rgba(22, 30, 49, 0.65);
    --card-bg-hover: rgba(28, 38, 62, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-glow: rgba(0, 240, 255, 0.35);
    
    /* Colores de Acento y Estado */
    --primary: #00f0ff;          /* Cyan Eléctrico */
    --primary-hover: #00cce6;
    --primary-rgb: 0, 240, 255;
    --secondary: #8b5cf6;        /* Púrpura Eléctrico */
    --secondary-hover: #7c3aed;
    --success: #10b981;          /* Esmeralda */
    --warning: #f59e0b;          /* Ámbar */
    --danger: #ef4444;           /* Rojo Alerta */
    --info: #3b82f6;             /* Azul */

    /* Tipografía y Textos */
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    --font-primary: 'Outfit', sans-serif;
    --font-secondary: 'Plus Jakarta Sans', sans-serif;

    /* Sombras y Efectos */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 15px rgba(0, 240, 255, 0.2);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. RESET Y BASES */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-primary);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 240, 255, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 40%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-secondary);
    font-weight: 600;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Scrollbars Personalizados */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* 3. CAPAS DE INTERFAZ Y MAQUETA (SPA LAYOUT) */
.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* Barra Lateral (Sidebar) */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 10;
    overflow-y: auto;
}

/* Cabecera de Empresa en Sidebar */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.brand-logo {
    font-size: 28px;
    color: var(--primary);
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

.brand-logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
}

.brand-info h1 {
    font-size: 18px;
    color: var(--text-main);
    line-height: 1.2;
}

.brand-info span {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Perfil de Usuario en Sidebar */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10px;
    width: fit-content;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-role {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: var(--transition);
}

.btn-logout:hover {
    color: var(--danger);
    transform: scale(1.1);
}

/* Menú de Navegación Lateral */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-section {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-top: 16px;
    margin-bottom: 6px;
    padding-left: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.menu-item:hover {
    color: var(--primary) !important;
    background: rgba(0, 240, 255, 0.08) !important;
    padding-left: 18px;
}

.menu-item.active {
    color: var(--bg-dark) !important;
    background: var(--primary) !important;
    font-weight: 600;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.3) !important;
}

.menu-item.active i {
    color: var(--bg-dark) !important;
}

.menu-item.active:hover {
    color: var(--bg-dark) !important;
    background: var(--primary) !important;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.45) !important;
    padding-left: 14px;
}

/* Área de Contenido Principal */
.main-content {
    padding: 36px;
    overflow-y: auto;
    height: 100vh;
}

/* 4. ELEMENTOS GLASSMORPHISM PREMIUM */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* 5. DISEÑO DE PÁGINAS Y COMPONENTES */

/* Dashboard Contable y KPIs */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.dashboard-title h2 {
    font-size: 26px;
    color: var(--text-main);
}

.dashboard-title p {
    color: var(--text-muted);
    font-size: 14px;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

.date-selector input {
    background: none;
    border: none;
    color: var(--text-main);
    outline: none;
    font-size: 13px;
}

/* Cuadrícula de KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-content h3 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-secondary);
    color: var(--text-main);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* Colores Dinámicos de KPI */
.kpi-ingresos .kpi-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.kpi-egresos .kpi-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.kpi-cobrar .kpi-icon {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}
.kpi-pagar .kpi-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.kpi-ganancia .kpi-icon {
    background: rgba(139, 92, 246, 0.15);
    color: var(--secondary);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Cuadrículas e Inyecciones de Bloques */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.section-card {
    padding: 24px;
}

.section-card h3 {
    font-size: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.section-card h3 i {
    color: var(--primary);
}

/* Gráficos y visualizaciones CSS nativas */
.chart-container {
    height: 220px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: 20px;
    gap: 8px;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, rgba(0, 240, 255, 0.1) 100%);
    border-radius: 4px 4px 0 0;
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    min-height: 4px;
}

.chart-bar:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 10px var(--primary-glow);
}

.chart-bar-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.chart-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: var(--transition);
    margin-bottom: 4px;
    white-space: nowrap;
    z-index: 5;
}

.chart-bar:hover .chart-tooltip {
    opacity: 1;
}

/* 6. COMPONENTES DE FORMULARIOS */
.form-group {
    margin-bottom: 18px;
}

.form-group.half {
    width: 48%;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

label i {
    margin-right: 4px;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-primary);
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    background: rgba(255, 255, 255, 0.05);
}

select.form-control optgroup {
    background-color: var(--bg-sidebar);
    color: var(--primary); /* Cyan Eléctrico de alta visibilidad */
    font-weight: 700;
    font-style: normal;
    font-size: 13.5px;
}

select.form-control option {
    background-color: var(--bg-sidebar);
    color: var(--text-main);
    font-weight: 400;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-secondary);
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg-dark);
    box-shadow: 0 4px 14px rgba(0, 240, 255, 0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 240, 255, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background: #0ea5e9;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
}

/* Botones de acción rápida */
.actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

/* 7. TABLAS DE DATOS PREMIUM */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

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

.custom-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

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

.custom-table tr {
    transition: var(--transition);
}

.custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Estados y Badges */
.badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-secondary {
    background: rgba(156, 163, 175, 0.15);
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.2);
}

/* 8. PANTALLA DE INICIO DE SESIÓN DE ALTA ESTÉTICA */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background-image: 
        radial-gradient(circle at center, rgba(0, 240, 255, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 10% 10%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 36px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
    color: var(--bg-dark);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.login-header h2 {
    font-size: 24px;
    color: white;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 13.5px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.login-footer p {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* Clases Útiles */
.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

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

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

/* 9. MÓDULO DE FOTOGRAFÍA - CÁMARA WEB EN VIVO */
.camera-wrapper {
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.camera-preview-box {
    width: 100%;
    max-width: 320px;
    height: 240px;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.camera-preview-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-preview-box canvas {
    display: none;
}

.photo-preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.camera-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    gap: 8px;
}

.camera-placeholder i {
    font-size: 32px;
}

/* 10. MODALES GLASSMORPHISM */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 7, 13, 0.85);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-card {
    width: 100%;
    max-width: 750px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.input-prefix-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.input-prefix-wrapper .input-prefix-symbol {
    position: absolute;
    left: 10px;
    font-size: 13.5px;
    color: var(--text-muted);
    pointer-events: none;
}
.input-prefix-wrapper .form-control {
    padding-left: 24px !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 17px;
    color: var(--primary);
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition);
}

.btn-close-modal:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

/* 11. SISTEMA DE ALERTAS ANIMADAS (TOASTS) */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    min-width: 280px;
    max-width: 380px;
    background: rgba(16, 22, 38, 0.95);
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    padding: 14px 18px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toast-slide-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast-success {
    border-left-color: var(--success);
}
.toast-danger {
    border-left-color: var(--danger);
}
.toast-warning {
    border-left-color: var(--warning);
}
.toast-info {
    border-left-color: var(--info);
}

.toast-icon {
    font-size: 18px;
}
.toast-success .toast-icon { color: var(--success); }
.toast-danger .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

.toast-message {
    font-size: 13px;
    font-weight: 500;
}

/* 12. ANIMACIONES GENERALES */
@keyframes toast-slide-in {
    from {
        transform: translateY(20px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fade-in 0.4s ease-out forwards;
}

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

/* 13. MÓDULO EXCLUSIVO DE IMPRESIÓN (PDF & PRINT MEDIA) */
/* Por defecto, la sección de impresión está totalmente oculta en el navegador */
.print-section {
    display: none;
}

@media print {
    /* Ocultar absolutamente todos los elementos del software */
    #app-container,
    #login-overlay,
    .toast-container,
    .modal-overlay,
    .btn,
    .action-buttons,
    nav,
    aside,
    ::-webkit-scrollbar {
        display: none !important;
    }

    /* Mostrar y rediseñar la sección de impresión */
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 12px !important;
        font-family: 'Helvetica', 'Arial', sans-serif !important;
    }

    .print-section {
        display: block !important;
        padding: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
        color: #000000 !important;
    }

    /* DISEÑO DE ALTO CONTRASTE Y LEGIBILIDAD EXTREMA */
    /* Forzar que todos los elementos de texto clave sean negro puro en papel */
    h1, h2, h3, h4, h5, h6, p, td, th, span, div, b, strong, code, pre, small, i, a {
        color: #000000 !important;
        text-shadow: none !important;
        background-color: transparent !important;
    }

    /* Diseño Profesional de Comprobante / Factura en Papel */
    .print-document {
        padding: 20px;
        color: #000000 !important;
        background: #ffffff !important;
    }

    .print-header {
        display: flex;
        justify-content: space-between;
        border-bottom: 2px solid #000000 !important;
        padding-bottom: 16px;
        margin-bottom: 20px;
    }

    .print-logo-box {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .print-logo-box h2 {
        font-size: 22px;
        font-weight: 700;
        color: #000000 !important;
    }

    .print-logo-img {
        width: 60px;
        height: 60px;
        object-fit: contain;
    }

    .print-header-details {
        text-align: right;
        font-size: 11px;
        color: #000000 !important;
    }

    .print-document-title {
        font-size: 18px;
        text-transform: uppercase;
        font-weight: 800;
        margin-bottom: 4px;
        letter-spacing: 0.05em;
        color: #000000 !important;
    }

    .print-meta-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 24px;
    }

    .print-meta-card {
        border: 1.5px solid #000000 !important;
        padding: 12px;
        border-radius: 4px;
        background: #ffffff !important;
    }

    .print-meta-card h4 {
        margin-bottom: 6px;
        font-size: 12px;
        border-bottom: 1.5px solid #000000 !important;
        padding-bottom: 4px;
        text-transform: uppercase;
        font-weight: bold;
        color: #000000 !important;
    }

    .print-meta-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 4px;
        font-size: 11px;
        color: #000000 !important;
    }

    .print-meta-row span:first-child {
        font-weight: bold;
        color: #000000 !important;
    }

    /* Formato Universal de Tablas de Impresión */
    .print-items-table, 
    .print-section table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-bottom: 24px !important;
    }

    .print-items-table th,
    .print-section table th {
        background: #e6e6e6 !important;
        background-color: #e6e6e6 !important;
        border: 1.5px solid #000000 !important;
        padding: 8px 12px !important;
        font-size: 11px !important;
        text-transform: uppercase !important;
        font-weight: bold !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-items-table td,
    .print-section table td {
        border: 1px solid #000000 !important;
        padding: 8px 12px !important;
        font-size: 11px !important;
        color: #000000 !important;
        background: transparent !important;
    }

    .print-summary-box {
        width: 280px;
        margin-left: auto;
        border: 1.5px solid #000000 !important;
        border-radius: 4px;
        padding: 12px;
        margin-bottom: 30px;
        background: #ffffff !important;
    }

    .print-summary-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 6px;
        font-size: 11px;
        color: #000000 !important;
    }

    .print-summary-row.total {
        font-size: 13px;
        font-weight: 800;
        border-top: 1.5px solid #000000 !important;
        padding-top: 6px;
        margin-top: 6px;
        color: #000000 !important;
    }

    .print-terms {
        font-size: 10px;
        color: #000000 !important;
        border-top: 1.5px dashed #000000 !important;
        padding-top: 12px;
        text-align: justify;
    }

    .print-signatures {
        display: flex;
        justify-content: space-between;
        margin-top: 60px;
    }

    .print-signature-line {
        width: 220px;
        border-top: 1.5px solid #000000 !important;
        text-align: center;
        padding-top: 8px;
        font-size: 11px;
        color: #000000 !important;
    }

    /* Badges de Alto Contraste en Impresión */
    .badge,
    .badge-success, 
    .badge-warning, 
    .badge-danger, 
    .badge-info, 
    .badge-secondary {
        background: transparent !important;
        background-color: transparent !important;
        color: #000000 !important;
        border: 1px solid #000000 !important;
        padding: 2px 6px !important;
        font-size: 9px !important;
        font-weight: bold !important;
        text-transform: uppercase !important;
        border-radius: 3px !important;
    }
}

.custom-table tfoot {
    background: rgba(255, 255, 255, 0.03);
}

.custom-table tfoot td {
    font-weight: 700;
    color: var(--text-main);
    border-top: 2px solid var(--border-color);
    border-bottom: none !important;
    padding: 14px 18px;
}

/* --- ESTILOS DE SINCRONIZACIÓN EN LA NUBE (LED BARRA LATERAL) --- */
.sidebar-sync-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px 0 12px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: var(--font-secondary);
}

.sync-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.sync-status-synced {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.sync-status-pending {
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.sync-status-error {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

/* ==========================================================================
   ESTILOS EXCLUSIVOS PARA DISPOSITIVOS MÓVILES (PWA)
   Totalmente aislado del ERP de escritorio mediante media queries.
   ========================================================================== */

/* Reglas por defecto para ocultar elementos móviles en el ERP de Escritorio */
.mobile-header,
.mobile-bottom-nav {
    display: none !important;
}

@media (max-width: 767px) {
    /* Ocultar elementos de escritorio */
    .sidebar {
        display: none !important;
    }

    .mobile-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: rgba(16, 22, 37, 0.85);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-bottom: 1px solid var(--border-color);
        padding: 0 16px;
        z-index: 900;
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-logo {
        font-size: 20px;
        color: var(--primary);
        filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.4));
    }

    #mobile-brand-title {
        font-family: var(--font-secondary);
        font-size: 15px;
        font-weight: 700;
        color: var(--text-main);
    }

    .mobile-sync-badge {
        display: flex;
        align-items: center;
        gap: 6px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-color);
        padding: 4px 10px;
        border-radius: 20px;
    }

    .mobile-sync-text {
        font-size: 10px;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .mobile-sync-now-btn {
        background: none;
        border: none;
        color: var(--primary);
        cursor: pointer;
        font-size: 11px;
        padding: 2px;
        margin-left: 4px;
        transition: var(--transition);
        display: flex;
        align-items: center;
    }

    .mobile-sync-now-btn:active {
        transform: rotate(180deg);
    }

    /* Modificar estructura de la página */
    .app-layout {
        display: flex !important;
        flex-direction: column !important;
        min-height: 100vh;
    }

    .main-content {
        padding: 76px 12px 90px 12px !important; /* Margen superior para header y inferior para nav bar */
        height: auto !important;
        min-height: 100vh;
        overflow-y: visible !important;
    }

    /* Barra de Navegación Inferior */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background: rgba(16, 22, 37, 0.9);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-color);
        justify-content: space-around;
        align-items: center;
        z-index: 900;
        padding-bottom: env(safe-area-inset-bottom); /* Manejo de barra en iPhones modernos */
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        text-decoration: none;
        flex: 1;
        height: 100%;
        transition: var(--transition);
        gap: 4px;
    }

    .mobile-nav-item i {
        font-size: 18px;
        transition: var(--transition);
    }

    .mobile-nav-item span {
        font-size: 10px;
        font-weight: 500;
    }

    .mobile-nav-item:active {
        color: var(--primary);
    }

    .mobile-nav-item.active {
        color: var(--primary);
        font-weight: 600;
        position: relative;
    }

    .mobile-nav-item.active i {
        transform: translateY(-2px);
        filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.6));
    }

    /* Optimización de Formularios para Celular */
    .form-row {
        flex-direction: column !important;
        gap: 0 !important;
    }

    .form-row .form-group {
        flex: 1 1 100% !important;
        width: 100% !important;
    }

    .form-group.half {
        width: 100% !important;
    }

    /* Modal adaptado a móvil */
    .modal-card {
        margin: auto 10px !important;
        width: calc(100% - 20px) !important;
        max-height: 90vh !important;
        border-radius: var(--radius-md) !important;
    }

    /* Cabeceras de Acción y Dashboard */
    .actions-header,
    .dashboard-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 20px !important;
    }

    .actions-header button,
    .actions-header .btn {
        width: 100% !important;
        padding: 12px !important;
    }

    /* Grid y KPIs */
    .kpi-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* Tablas responsivas en Celular */
    .table-container {
        border: none !important;
    }

    /* Estilos del Canvas para Firma Digital */
    .signature-canvas-wrapper {
        border-color: var(--primary) !important;
    }

    /* Estilo de Tarjetas Móviles para listados (Reparaciones, Trabajos, Traslados) */
    .mobile-card-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-item-card {
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        padding: 14px;
        position: relative;
        transition: var(--transition);
    }

    .mobile-item-card:active {
        background: var(--card-bg-hover);
        border-color: rgba(255, 255, 255, 0.15);
    }

    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 10px;
        border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
        padding-bottom: 8px;
    }

    .mobile-card-id {
        font-weight: 700;
        color: var(--primary);
    }

    .mobile-card-date {
        font-size: 11px;
        color: var(--text-muted);
    }

    .mobile-card-body {
        font-size: 12.5px;
        line-height: 1.5;
        margin-bottom: 12px;
    }

    .mobile-card-row {
        margin-bottom: 6px;
    }

    .mobile-card-row strong {
        color: var(--text-muted);
        font-size: 11px;
        text-transform: uppercase;
    }

    .mobile-card-actions {
        display: flex;
        gap: 8px;
        margin-top: 10px;
        border-top: 1px solid var(--border-color);
        padding-top: 10px;
    }

    .mobile-card-actions .btn {
        flex: 1;
        padding: 8px !important;
        font-size: 11.5px !important;
    }

    /* PWA Installation Card inside Mobile Dashboard */
    .mobile-install-card {
        background: linear-gradient(135deg, rgba(0, 240, 255, 0.08) 0%, rgba(10, 14, 23, 0.6) 100%);
        border: 1px solid rgba(0, 240, 255, 0.2);
        border-radius: var(--radius-md);
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        box-shadow: 0 0 15px rgba(0, 240, 255, 0.05);
        margin-bottom: 8px;
        position: relative;
        overflow: hidden;
    }

    .mobile-install-card::before {
        content: '';
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(0, 240, 255, 0.05) 0%, transparent 70%);
        pointer-events: none;
    }

    .mobile-install-card h3 {
        font-size: 14px;
        color: var(--primary);
        margin: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-install-card p {
        font-size: 12px;
        color: var(--text-muted);
        margin: 0;
        line-height: 1.4;
    }
}

/* Tab button styles for PWA Modal */
.tab-btn {
    transition: var(--transition);
}
.tab-btn:hover {
    color: var(--primary) !important;
    background: rgba(0, 240, 255, 0.03) !important;
}
.tab-btn.active {
    border-bottom: 2px solid var(--primary) !important;
    color: var(--primary) !important;
}

@media (max-width: 400px) {
    .qr-install-section {
        display: none !important;
    }
}

/* Utilitario para ocultar la vista previa en vivo en pantallas grandes, forzando 1 columna */
.no-preview-grid {
    grid-template-columns: 1fr !important;
}
