/* ==========================================================================
   SISTEMA DE DISEÑO Y CONFIGURACIÓN GENERAL
   ========================================================================== */
:root {
    --bg-primary: #0f172a;     /* Slate 900 */
    --bg-secondary: #1e293b;   /* Slate 800 */
    --bg-tertiary: #020617;    /* Slate 950 */
    --border-color: #334155;   /* Slate 700 */
    --border-light: #475569;   /* Slate 600 */
    --text-main: #f8fafc;      /* Slate 50 */
    --text-secondary: #cbd5e1; /* Slate 300 */
    --text-muted: #94a3b8;     /* Slate 400 */
    
    /* Acentos */
    --accent: #fbbf24;         /* Amber 400 (Amarillo Taller) */
    --accent-hover: #f59e0b;   /* Amber 500 */
    --accent-glow: rgba(251, 191, 36, 0.15);
    
    /* Estados */
    --success: #10b981;        /* Emerald 500 */
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f97316;        /* Orange 500 */
    --warning-bg: rgba(249, 115, 22, 0.15);
    --info: #0ea5e9;           /* Sky 500 */
    --info-bg: rgba(14, 165, 233, 0.15);
    --danger: #ef4444;         /* Red 500 */
    --danger-bg: rgba(239, 68, 68, 0.12);

    /* Fuentes y Sombras */
    --font-primary: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --shadow-accent: 0 0 15px rgba(251, 191, 36, 0.2);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar Personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ==========================================================================
   ESTRUCTURA DE CONTENEDORES (SPA & NAVIGATION)
   ========================================================================== */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Barra Lateral (Sidebar) */
.sidebar {
    width: 260px;
    background-color: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background-color: var(--accent);
    color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-accent);
}

.brand-icon svg {
    width: 24px;
    height: 24px;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

/* Menú de Navegación */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition-normal);
    border: 1px solid transparent;
}

.nav-item:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--bg-tertiary);
    background-color: var(--accent);
    font-weight: 600;
    box-shadow: var(--shadow-accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    transition: var(--transition-fast);
}

/* Indicador de Taller al fondo */
.workshop-indicator {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
}

.indicator-logo {
    width: 32px;
    height: 32px;
    background-color: var(--border-color);
    color: var(--text-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.indicator-details {
    overflow: hidden;
}

.indicator-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.indicator-status {
    font-size: 0.7rem;
    color: var(--success);
    font-weight: 500;
}

/* Contenedor del Contenido */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 40px;
    max-width: calc(100vw - 260px);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* Pestañas de Vista (SPA Sections) */
.content-section {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.content-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   COMPONENTES DE LA INTERFAZ (CARDS, BUTTONS, TABLES)
   ========================================================================== */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.card-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.card-header-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}
.card-header-link:hover {
    text-decoration: underline;
}

.card-body {
    padding: 24px;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-primary {
    background-color: var(--accent);
    color: var(--bg-tertiary);
    box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-main);
    border: 1px solid transparent;
}
.btn-secondary:hover {
    background-color: var(--border-light);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.02);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-icon {
    width: 18px;
    height: 18px;
}

.w-full {
    width: 100%;
}

/* ==========================================================================
   ESTADÍSTICAS (STATS GRID)
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.income { background-color: var(--accent-glow); color: var(--accent); }
.stat-icon.collected { background-color: var(--success-bg); color: var(--success); }
.stat-icon.pending { background-color: var(--warning-bg); color: var(--warning); }
.stat-icon.jobs { background-color: var(--info-bg); color: var(--info); }

.stat-content h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 4px;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-danger { color: var(--danger); }

/* ==========================================================================
   TABLAS Y LISTADOS
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th, .table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.table th {
    background-color: rgba(0, 0, 0, 0.15);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

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

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-paid {
    background-color: var(--success-bg);
    color: var(--success);
}

.badge-pending {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.badge-quote {
    background-color: var(--info-bg);
    color: var(--info);
}

/* ==========================================================================
   GRID DEL DASHBOARD
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.col-span-2 {
    grid-column: span 2;
}

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

.quick-action-btn {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: var(--transition-normal);
}

.quick-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: var(--accent);
    transform: translateX(2px);
}

.qa-icon {
    width: 36px;
    height: 36px;
    background-color: var(--bg-tertiary);
    color: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.qa-icon svg {
    width: 20px;
    height: 20px;
}

.qa-info h5 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.qa-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.taller-card-info {
    margin-top: 20px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 0.85rem;
    line-height: 1.6;
}

.info-label {
    color: var(--text-muted);
}
.info-val {
    font-weight: 600;
    color: var(--accent);
}

/* ==========================================================================
   FORMULARIOS (INVOICE CREATION/EDITION)
   ========================================================================== */
.form-grid {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.form-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 450px;
    flex-shrink: 0;
}

.flex-grow {
    flex-grow: 1;
}

.flex-grow-card {
    min-height: 300px;
}

.form-row-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-row-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input, .form-group select, .form-group textarea {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: var(--transition-fast);
    width: 100%;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

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

.col-span-2 {
    grid-column: span 2;
}

.form-separator {
    grid-column: span 2;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Desglose de Factura */
.desglose-quick-adds {
    display: flex;
    gap: 8px;
}

/* Elementos de la lista de desglose */
.item-row select, .item-row input {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    padding: 6px 10px !important;
    font-size: 0.85rem !important;
    border-radius: var(--radius-sm) !important;
}

.item-row select:focus, .item-row input:focus {
    border-color: var(--accent) !important;
    outline: none;
}

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

.item-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.item-delete-btn:hover {
    color: var(--danger);
    background-color: var(--danger-bg);
}

.item-delete-btn svg {
    width: 18px;
    height: 18px;
}

/* Totales y Observaciones */
.totals-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
}

.totals-observations {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.totals-observations label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.totals-observations textarea {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 12px;
    font-size: 0.85rem;
    min-height: 120px;
    font-family: var(--font-primary);
    resize: none;
}

.totals-summary-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--bg-tertiary);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.input-inline-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-sm {
    width: 60px;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    padding: 4px 6px !important;
    font-size: 0.85rem !important;
    border-radius: var(--radius-sm) !important;
    text-align: center;
}

.total-row {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: 4px;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.15rem;
}
.total-row span:last-child {
    color: var(--accent);
}

.form-actions-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ==========================================================================
   AUTOCOMPLETADO Y FILTROS
   ========================================================================== */
.relative {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: var(--border-color);
}

.suggestion-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.suggestion-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Filtros */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.search-box {
    position: relative;
    width: 320px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.search-box input {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 10px 14px 10px 42px;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    width: 100%;
}
.search-box input:focus {
    border-color: var(--accent);
    outline: none;
}

.filter-groups {
    display: flex;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: var(--radius-md);
}

.filter-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.filter-tab:hover {
    color: var(--text-main);
}

.filter-tab.active {
    background-color: var(--bg-secondary);
    color: var(--accent);
    font-weight: 600;
}

/* ==========================================================================
   AJUSTES Y COPIA SEGURIDAD
   ========================================================================== */
.backup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-import-container {
    width: 100%;
}

.mb-3 { margin-bottom: 12px; }

/* MODALES */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(2, 6, 17, 0.8);
    display: none; /* JS lo muestra */
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal.open {
    display: flex;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}
.close-modal:hover { color: var(--text-main); }

.modal-body {
    padding: 20px;
}

.modal-body input {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 10px 14px;
    font-family: var(--font-primary);
    width: 100%;
}

.modal-list {
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.modal-client-item {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-client-item:hover {
    border-color: var(--accent);
    background-color: rgba(255,255,255,0.02);
}

/* ==========================================================================
   RESPONSIVIDAD MÓVIL (MENOS DE 768px)
   ========================================================================== */
@media (max-width: 992px) {
    .form-grid {
        flex-direction: column;
    }
    .form-column {
        width: 100%;
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 80px; /* Espacio para barra navegación inferior */
    }

    /* Ocultar barra lateral en móvil y transformar en barra inferior */
    .sidebar {
        width: 100%;
        height: 64px;
        flex-direction: row;
        padding: 0 10px;
        top: auto;
        bottom: 0;
        border-right: none;
        border-top: 1px solid var(--border-color);
        justify-content: space-between;
        align-items: center;
    }

    .brand, .workshop-indicator {
        display: none; /* Ocultar en barra inferior */
    }

    .nav-menu {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        gap: 0;
    }

    .nav-item {
        flex-direction: column;
        gap: 4px;
        padding: 6px 12px;
        font-size: 0.7rem;
        flex-grow: 1;
        align-items: center;
        border-radius: var(--radius-sm);
        border: none;
        background: transparent !important;
        color: var(--text-muted);
        box-shadow: none !important;
    }

    .nav-item.active {
        color: var(--accent);
    }
    
    .nav-item.active .nav-icon {
        color: var(--accent);
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
        max-width: 100vw;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions button {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
        gap: 12px;
    }
    
    .stat-number {
        font-size: 1.2rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .col-span-2 {
        grid-column: span 1;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-box {
        width: 100%;
    }

    .filter-groups {
        width: 100%;
        overflow-x: auto;
    }
    .filter-tab {
        flex-grow: 1;
        text-align: center;
        padding: 8px 10px;
    }
    
    .totals-layout {
        grid-template-columns: 1fr;
    }
    
    .form-actions-footer {
        flex-direction: column-reverse;
    }
    .form-actions-footer button {
        width: 100%;
    }
    
    .desglose-quick-adds {
        margin-top: 8px;
        width: 100%;
        justify-content: space-between;
    }
    .desglose-quick-adds button {
        flex-grow: 1;
        font-size: 0.75rem;
        padding: 6px 4px;
    }
}

/* ==========================================================================
   ESTILOS DE IMPRESIÓN (A4 LIMPIO - DESENCADENADO POR @media print)
   ========================================================================== */
@media print {
    /* Ocultar la app completa */
    body * {
        visibility: hidden;
    }
    
    /* Mostrar SOLO la plantilla de impresión */
    #print-invoice-template, #print-invoice-template * {
        visibility: visible;
    }
    
    #print-invoice-template {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background-color: white;
        color: #1e293b;
        font-family: 'Inter', system-ui, sans-serif;
        font-size: 12px;
        line-height: 1.5;
        padding: 0;
        margin: 0;
    }
    
    /* Maquetación del PDF A4 */
    .print-header {
        display: flex;
        justify-content: space-between;
        border-bottom: 2px solid #e2e8f0;
        padding-bottom: 20px;
        margin-bottom: 24px;
    }
    
    .print-logo-container {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .print-logo {
        width: 50px;
        height: 50px;
        background-color: #fbbf24;
        color: #0f172a;
        font-weight: 700;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.4rem;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .print-company-details h2 {
        font-size: 1.5rem;
        font-weight: 700;
        color: #0f172a;
    }
    .print-company-details p {
        color: #64748b;
        margin-top: 4px;
        font-size: 0.85rem;
    }
    
    .print-meta-details {
        text-align: right;
    }
    
    .print-meta-details h3 {
        font-size: 1.6rem;
        font-weight: 700;
        color: #0f172a;
        margin-bottom: 6px;
    }
    .print-meta-details p {
        margin-top: 2px;
        font-size: 0.85rem;
        color: #475569;
    }
    
    /* Bloque de Información de Cliente y Vehículo */
    .print-info-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 24px;
    }
    
    .print-info-box {
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        padding: 16px;
    }
    
    .print-info-box h4 {
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 6px;
        margin-bottom: 10px;
        font-size: 0.9rem;
        font-weight: 700;
        color: #0f172a;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .print-info-box p {
        font-size: 0.85rem;
        margin-bottom: 6px;
        color: #334155;
    }
    
    .print-info-box strong {
        color: #0f172a;
    }
    
    /* Tabla de Conceptos */
    .print-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 30px;
    }
    
    .print-table th {
        background-color: #f1f5f9;
        color: #0f172a;
        text-transform: uppercase;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.5px;
        padding: 10px 14px;
        border-bottom: 2px solid #cbd5e1;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .print-table td {
        padding: 12px 14px;
        border-bottom: 1px solid #e2e8f0;
        font-size: 0.85rem;
        color: #334155;
    }
    
    .print-table-type {
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        color: #64748b;
    }
    
    .print-text-right {
        text-align: right;
    }
    
    /* Observaciones y Totales */
    .print-footer-grid {
        display: grid;
        grid-template-columns: 1.2fr 0.8fr;
        gap: 30px;
        page-break-inside: avoid;
    }
    
    .print-notes {
        font-size: 0.8rem;
        color: #475569;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 14px;
        white-space: pre-wrap;
    }
    
    .print-notes h5 {
        font-weight: 700;
        color: #0f172a;
        margin-bottom: 6px;
        font-size: 0.85rem;
    }
    
    .print-totals {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .print-totals-row {
        display: flex;
        justify-content: space-between;
        font-size: 0.85rem;
        color: #475569;
    }
    
    .print-totals-row.grand-total {
        border-top: 2px solid #0f172a;
        padding-top: 8px;
        margin-top: 4px;
        font-size: 1.15rem;
        font-weight: 700;
        color: #0f172a;
    }
    
    /* Método de Pago / Cierre */
    .print-payment-info {
        margin-top: 40px;
        border-top: 1px solid #cbd5e1;
        padding-top: 16px;
        text-align: center;
        font-size: 0.8rem;
        color: #64748b;
        page-break-inside: avoid;
    }
    
    .print-payment-info strong {
        color: #0f172a;
    }
}

/* ==========================================================================
   PANTALLA DE ACCESO (LOGIN VIEW)
   ========================================================================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
    background-color: var(--bg-primary);
    padding: 20px;
    z-index: 1000;
}

.login-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    box-shadow: var(--shadow-lg), var(--shadow-accent);
}

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

.login-logo {
    font-size: 2.2rem;
    margin-bottom: 12px;
    background-color: var(--accent);
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    box-shadow: var(--shadow-accent);
}

.login-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.login-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.mt-3 {
    margin-top: 12px;
}

/* ==========================================================================
   ASISTENTE DE VOZ (VOICE ASSISTANT STYLES)
   ========================================================================== */
.voice-assistant-bar {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(30, 41, 59, 0.7) 100%);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.voice-assistant-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.voice-assistant-icon {
    font-size: 1.6rem;
    animation: floating-icon 2.5s ease-in-out infinite;
}

@keyframes floating-icon {
    0% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
    100% { transform: translateY(0); }
}

.voice-assistant-text h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.voice-assistant-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Modal de voz */
.voice-mic-glow {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    font-size: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px auto 20px;
    transition: var(--transition-normal);
    position: relative;
    border: 2px solid rgba(239, 68, 68, 0.2);
}

.voice-mic-glow.listening {
    background-color: var(--danger-bg);
    color: var(--danger);
    animation: voice-pulse 1.5s infinite;
    border-color: var(--danger);
}

@keyframes voice-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5), 0 0 0 0 rgba(239, 68, 68, 0.2);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0), 0 0 0 30px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.voice-visualizer {
    text-align: center;
    margin-bottom: 24px;
}

.voice-status {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 10px;
}

.voice-transcription-container {
    margin-bottom: 20px;
}

.voice-transcription-container label, .voice-parsed-container label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.voice-transcription-box {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    min-height: 70px;
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.voice-parsed-container {
    margin-bottom: 20px;
    background-color: rgba(0, 0, 0, 0.15);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.voice-parsed-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.parsed-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    background-color: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.parsed-item.col-span-2 {
    grid-column: span 2;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.parsed-status {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.parsed-label {
    color: var(--text-muted);
    font-weight: 500;
}

.parsed-value {
    color: var(--text-main);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.parsed-item.filled {
    border-color: var(--success);
    background-color: var(--success-bg);
}

.parsed-parts-list {
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 4px;
    border-left: 2px solid var(--border-color);
}

.parsed-part-entry {
    display: flex;
    justify-content: space-between;
    background-color: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
}

.voice-guide {
    background-color: rgba(251, 191, 36, 0.05);
    border: 1px dashed rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.8rem;
    line-height: 1.5;
}

.voice-guide h6 {
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.voice-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Animación de destello amarillo para campos rellenados por voz */
@keyframes highlight-fade {
    0% { background-color: rgba(251, 191, 36, 0.5); border-color: var(--accent); }
    100% { background-color: var(--bg-tertiary); }
}
.highlight-field {
    animation: highlight-fade 2.5s ease-out forwards;
}

/* Soporte móvil */
@media (max-width: 768px) {
    .voice-assistant-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 14px;
        gap: 10px;
    }
    .voice-assistant-bar button {
        width: 100%;
    }
    .voice-parsed-grid {
        grid-template-columns: 1fr;
    }
    .parsed-item.col-span-2 {
        grid-column: span 1;
    }
}

/* Animación de spin para iconos de carga */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.animate-spin {
    animation: spin 1s linear infinite;
}

