:root {
    /* Paleta Premium SaaS */
    --bg-color: #020617;
    --bg-gradient: radial-gradient(circle at top right, #0f172a, #020617);
    --card-bg: rgba(15, 23, 42, 0.6);
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(148, 163, 184, 0.12);
    
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --accent-hover: #60a5fa;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --title-gradient: linear-gradient(135deg, #fff 0%, #94a3b8 100%);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Ocultar botones de aumentar/disminuir en inputs numéricos */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* 💡 Animación de pulso para el TEXTO (letras) interactivo */
@keyframes pulseInteractiveText {
    0% { text-shadow: 0 0 0 rgba(59, 130, 246, 0); color: var(--text-muted); }
    50% { text-shadow: 0 0 5px rgba(59, 130, 246, 0.5); color: var(--accent-color); }
    100% { text-shadow: 0 0 0 rgba(59, 130, 246, 0); color: var(--text-muted); }
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    transition: all 0.4s ease;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
    background: rgba(148, 163, 184, 0.2); 
    border-radius: 10px; 
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.4); }

/* =====================================================================
   HEADER & LAYOUT
   ===================================================================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

header h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* =====================================================================
   NOTIFICACIONES — Diseño Monocromático Minimalista
   ===================================================================== */
.notif-trigger {
    position: relative;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.45);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.notif-trigger:hover {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.04);
}

.notif-badge {
    display: none;
    position: absolute;
    top: 3px;
    right: 3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    font-size: 0;      /* Ocultar número, solo punto */
    line-height: 1;
}
.notif-badge.visible { display: block; }

.notif-panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: -8px;
    width: 310px;
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    z-index: 999;
    flex-direction: column;
    overflow: hidden;
}
.notif-panel.open { display: flex; }

.notif-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.notif-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.2s;
}
.notif-close:hover { color: rgba(255,255,255,0.6); }

.notif-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.07) transparent;
}
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.notif-empty {
    text-align: center;
    padding: 24px 16px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.2);
    font-style: italic;
}

.notif-item {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    border: 1px solid rgba(255,255,255,0.04);
    transition: opacity 0.2s, transform 0.2s;
}
.notif-item:hover { background: rgba(255,255,255,0.02); }
.notif-item--urgent {
    border-left: 2px solid rgba(255,255,255,0.25);
    padding-left: 10px;
}

.notif-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}
.notif-item-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: rgba(255,255,255,0.25);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.notif-item--urgent .notif-item-label {
    color: rgba(255,255,255,0.5);
}
.notif-item-time {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.15);
}
.notif-item-msg {
    margin: 0 0 8px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.55);
    line-height: 1.45;
}
.notif-item-actions {
    display: flex;
    justify-content: flex-end;
}
.notif-btn-read {
    background: none;
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.25);
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.notif-btn-read:hover {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.5);
}
.notif-btn-read:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* En móvil el h1 un poco más pequeño */
@media (max-width: 480px) {
    h1 { font-size: 1.2rem; }
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Pastillas del header - Look Premium */
.control-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}
.control-pill:hover {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(30, 41, 59, 0.6);
}
.control-pill label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.control-pill input {
    width: 70px;
    background: transparent; border: none;
    color: var(--accent-color);
    font-weight: 800; font-size: 1.1rem;
    outline: none; text-align: center;
}
.control-pill input.warning-text { color: var(--warning); }
.eco-pill input { width: 75px; font-size: 1.1rem; font-weight: 800; color: var(--accent-color);
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px; padding: 0.3rem; text-align: center; outline: none; }
.eco-sep { font-size: 1rem; font-weight: 800; color: var(--text-muted); }

/* Botones SaaS Premium */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    white-space: nowrap;
    outline: none;
}

.btn-accent {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 14px 0 var(--accent-glow);
}
.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 var(--accent-glow);
}
.btn-accent:active { transform: translateY(0); }

.btn-ghost {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Contenedor del buscador en el Header */
.vin-search-container {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    padding: 2px 2px 2px 15px;
    transition: all 0.3s ease;
    height: 42px;
}
.vin-search-container:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.vin-search-container #vinInput {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-size: 0.95rem;
    font-weight: 700;
    outline: none;
    width: 300px;
    text-transform: uppercase;
}
.vin-search-container #btnDecodeVin {
    background: var(--accent-color);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: transform 0.2s;
}

/* Cuadrícula de detalles técnicos */
.vin-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    animation: slideDown 0.3s ease-out;
    grid-column: 1 / -1; /* Ensure it spans full width in main-layout */
}
.vin-item {
    display: flex;
    flex-direction: column;
    padding: 4px;
}
.vin-item label {
    font-size: 0.55rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 800;
    margin-bottom: 1px;
}
.vin-item span {
    font-size: 0.8rem;
    color: var(--accent-color);
    font-weight: 600;
}

/* Estado Minimizado */
.vin-details-grid.is-minimized {
    grid-template-columns: 1fr !important;
    padding: 0.5rem 0.8rem;
}
.vin-details-grid.is-minimized .vin-item {
    display: none;
}

/* VIN Toggle Button Wrapper */
.vin-toggle-wrapper {
    grid-column: 1 / -1; /* Span across all columns */
    text-align: center;
    padding-top: 0.5rem;
}
.vin-toggle-wrapper #btnToggleVin {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.vin-toggle-wrapper #btnToggleVin:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* VIN Error Message */
.vin-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    text-align: center;
    animation: adxFadeIn 0.4s ease-out;
}

.btn-block { width: 100%; padding: 0.85rem; border-radius: var(--radius-lg); }

.loading {
    text-align: center; color: var(--accent-color);
    font-size: 0.85rem; font-weight: bold;
}

/* =====================================================================
   BANNER ESTADO DB (mínimo discreto — nuevo, no existía en el original)
   ===================================================================== */
#dbStatusBanner {
    display: none;
    padding: 0.4rem 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(16,185,129,0.06);
    border-bottom: 1px solid rgba(16,185,129,0.12);
    margin-bottom: 0.5rem;
    border-radius: 0;
}
#dbStatusBanner.empty-db {
    background: rgba(245,158,11,0.05);
    border-bottom-color: rgba(245,158,11,0.1);
}
.db-status-inner {
    display: flex; align-items: center;
    justify-content: space-between; gap: 0.5rem;
}
.db-status-info { display: flex; align-items: center; gap: 0.5rem; overflow: hidden; }
.db-status-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    background: var(--success); box-shadow: 0 0 5px var(--success);
    animation: blink 2.5s infinite;
}
.db-dot.off { background: var(--warning); box-shadow: 0 0 5px var(--warning); animation: none; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
.btn-clear-db {
    background: none; border: none; color: #f87171; cursor: pointer;
    font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.4rem;
    border-radius: 4px; flex-shrink: 0; transition: background 0.2s;
}
.btn-clear-db:hover { background: rgba(239,68,68,0.1); }

/* =====================================================================
   CONFIG COLAPSABLE (Rediseño Minimalista)
   ===================================================================== */
#configWrapper {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-bottom: 0;
    transition: all 0.3s ease;
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    cursor: pointer;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    gap: 1rem;
}

.config-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.config-preview {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
}
.config-preview::-webkit-scrollbar { display: none; }

.cfg-preview-chip {
    background: transparent;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
    color: var(--text-main);
}
.cfg-preview-chip:not(:last-child) {
    border-right: 1px solid rgba(255,255,255,0.1);
    border-radius: 0;
}

.cfg-lbl {
    color: var(--text-dim);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.config-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.icon-btn svg {
    width: 1.2em;
    height: 1.2em;
    transition: transform 0.3s ease;
}
.icon-btn:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.icon-btn.locked { color: var(--accent-color); }
.icon-btn.unlocked { color: var(--text-dim); opacity: 0.6; }

#configToggleBtn.open .toggle-icon { transform: rotate(180deg); }

/* Config bar */
.config-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
}

@media (max-width: 768px) {
    .config-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
        padding: 1rem;
    }
}

.config-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 90px;
    position: relative;
}

.config-item label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 600;
    user-select: none;
    transition: color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.config-item[data-convertible="true"] label {
    cursor: pointer;
    animation: pulseInteractiveText 2.5s infinite ease-in-out;
}
.config-item[data-convertible="true"] label:hover {
    color: var(--accent-color);
}

.config-item input {
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.3s ease;
    width: 100%;
}
.config-item input:focus {
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.4);
}
.config-item input[readonly] {
    opacity: 0.7;
    cursor: not-allowed;
}

.mirror-value {
    position: absolute;
    right: 8px;
    bottom: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
    pointer-events: none;
}

/* =====================================================================
   MODAL (idéntico al original)
   ===================================================================== */
/* ===================== PÁGINA DE LOGIN (FULL SCREEN) ===================== */
.login-page-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1.5rem;
    transition: opacity 0.5s, visibility 0.5s;
}

.login-page-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
}

.login-header h1 {
    font-size: 1.8rem;
    margin: 1rem 0 0.5rem 0;
    color: var(--accent-color);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 3.5rem;
    background: rgba(255,255,255,0.05);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    margin: 0 auto;
}

.login-divider {
    margin: 1.5rem 0;
    position: relative;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.login-divider span {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-color);
    padding: 0 0.8rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.login-footer {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 1.2rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.login-form input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-size: 1rem;
    outline: none;
}

.login-form input:focus {
    border-color: var(--accent-color);
    background: rgba(255,255,255,0.08);
}

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(15px) saturate(160%);
    -webkit-backdrop-filter: blur(15px) saturate(160%);
    display: flex; align-items: center; justify-content: center;
    z-index: 3000; opacity: 0; visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-content {
    background: linear-gradient(135deg, rgba(15,23,42,0.95), rgba(30,41,59,0.95));
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 28px;
    padding: 2.5rem;
    width: 95%; max-width: 550px;
    position: relative;
    transform: scale(0.85) translateY(40px);
    transition: all 0.5s cubic-bezier(0.34,1.56,0.64,1);
    box-shadow: 0 30px 60px -12px rgba(0,0,0,0.6);
    max-height: 90vh; overflow-y: auto;
}
.modal-overlay.active .modal-content { transform: scale(1) translateY(0); }

/* En móvil: bottom sheet */
@media (max-width: 600px) {
    .modal-overlay { align-items: flex-end; }
    .modal-content {
        border-radius: 20px 20px 0 0; padding: 1.5rem;
        max-width: 100%; width: 100%;
        transform: translateY(100%);
        max-height: 85vh;
    }
    .modal-overlay.active .modal-content { transform: translateY(0); }
}

.close-modal {
    position: absolute; top: 1.5rem; right: 1.5rem;
    cursor: pointer; font-size: 1.5rem; color: var(--text-muted);
    transition: color 0.3s; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05); border-radius: 50%;
}
.close-modal:hover { color: var(--accent-color); background: rgba(255,255,255,0.1); }

.dynamic-item-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease-out;
}
.dynamic-item-card:hover {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(59, 130, 246, 0.3);
}

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

.dynamic-item-card input[type="text"] {
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.1rem;
    width: 100%;
    outline: none;
    padding: 0.2rem 0;
    transition: border-color 0.3s;
}
.dynamic-item-card input[type="text"]:focus {
    border-bottom-color: var(--accent-color);
}

.dynamic-item-card .item-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.dynamic-item-card .op-select {
    width: 60px;
    height: 42px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 800;
    font-size: 1.1rem;
    outline: none;
    cursor: pointer;
}

.dynamic-item-card .val-input-wrapper {
    position: relative;
    flex: 1;
}
.dynamic-item-card .val-input {
    width: 100%;
    height: 42px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--accent-color);
    border-radius: var(--radius-sm);
    padding: 0 2.5rem 0 1rem;
    font-weight: 800;
    font-size: 1.15rem;
    outline: none;
}
.dynamic-item-card .val-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.dynamic-item-card .val-currency {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-dim);
    pointer-events: none;
}

.btn-remove-item {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-remove-item:hover {
    background: var(--danger);
    color: white;
}
.dynamic-item-card:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(59,130,246,0.3);
    transform: translateX(5px);
}

/* =====================================================================
   LAYOUT PRINCIPAL (idéntico al original + breakpoint móvil)
   ===================================================================== */
.main-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* En tablet/móvil: una columna (breakpoint original era 1024px) */
@media (max-width: 1024px) {
    .main-layout { grid-template-columns: 1fr; }
}

/* Panel de cristal SaaS Premium */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    margin-bottom: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* =====================================================================
   BÚSQUEDA Y TABLA (idéntico al original)
   ===================================================================== */
.search-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.search-group input {
    flex: 1;
    min-width: 140px;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-md);
    background: rgba(15,23,42,0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}
.search-group input:focus { 
    border-color: var(--accent-color); 
    background: rgba(15,23,42,0.4);
    box-shadow: 0 0 0 4px var(--accent-glow);
}
.search-group input::placeholder { color: var(--text-dim); }

.table-wrapper {
    overflow-x: auto;
    max-height: 600px; overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    -webkit-overflow-scrolling: touch;
}
.table-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrapper::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 4px; }

table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--glass-border); }
th {
    background: rgba(0,0,0,0.2); color: var(--text-muted);
    font-weight: 600; font-size: 0.85rem;
    position: sticky; top: 0; z-index: 10;
}
tbody tr { transition: background 0.2s; cursor: pointer; }
tbody tr:hover  { background: rgba(255,255,255,0.05); }
tbody tr.active { background: rgba(59,130,246,0.2); border-left: 3px solid var(--accent-color); }

/* =====================================================================
   CALCULADORA (idéntico al original)
   ===================================================================== */
.calc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}
.calc-header h3 {
    color: var(--accent-color);
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}
.calc-details {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}
.calc-left { flex: 1; min-width: 200px; }

.year-row {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.year-row label {
    font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; margin: 0;
}
#yearSelect {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-appearance: none;
}
#yearSelect:hover {
    background: rgba(15, 23, 42, 0.4);
}
#yearSelect.generic-selected {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #f59e0b; /* Naranja Ámbar elegante */
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
}

/* El resaltado se maneja con la clase generic-selected en JS */
select option { background-color: var(--bg-color); color: var(--text-main); }
#cfgRegimen {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    outline: none;
    transition: all 0.3s ease;
    -webkit-appearance: none;
}
#cfgRegimen:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-color);
}

/* Valor en aduana (idéntico al original) */
.aduana-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
    align-items: center;
    gap: 1rem;
    margin-top: 0.8rem;
    border-bottom: 1px solid var(--glass-border);
}
.aduana-label { font-weight: bold; color: var(--text-main); }
.aduana-right { text-align: right; }
.aduana-input-wrap {
    display: flex; align-items: center; justify-content: flex-end; gap: 0.2rem;
}
.aduana-input-wrap .sym { font-weight: 600; color: var(--text-main); }
.aduana-input-wrap .sym.small { font-size: 0.9rem; }
#customPrice {
    background: rgba(15, 23, 42, 0.4); 
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm); 
    color: var(--warning);
    width: 100px; 
    padding: 0.3rem 0.6rem;
    text-align: right; 
    font-weight: 800; 
    font-size: 1.1rem; 
    outline: none;
    transition: all 0.3s ease;
}
#customPrice:focus {
    border-color: var(--warning);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}
#customPriceMXN { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Filas de impuestos - Mejoradas */
.tax-row {
    display: flex;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    align-items: center;
    gap: 1.5rem;
    transition: background 0.2s ease;
}
.tax-row:last-child { border-bottom: none; }

.tax-row span:first-child {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tax-val-container { 
    text-align: right; 
    min-width: 120px; 
}
.tax-usd { font-weight: 700; color: var(--text-main); display: block; font-size: 0.95rem; letter-spacing: -0.01em; }
.tax-mxn { font-size: 0.72rem; color: var(--text-dim); display: block; margin-top: 1px; }

.tax-row.total {
    margin-top: 0.5rem; padding: 0.8rem; font-weight: 700;
    background: rgba(59,130,246,0.15); border-radius: 6px;
    border: 1px solid rgba(59,130,246,0.3);
}
.tax-row.total .tax-usd { font-size: 1.05rem; color: var(--warning); }

.tax-row.extras { opacity: 0.8; font-size: 0.88rem; }

/* Grand Total (idéntico al original) */
.tax-row.grand-total {
    margin-top: 1rem; padding: 1.5rem;
    background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(16,185,129,0.05));
    border-radius: 12px; color: var(--success);
    box-shadow: 0 4px 15px rgba(16,185,129,0.15);
    display: flex; flex-direction: column; align-items: center;
    border-bottom: none;
}
.grand-total-label {
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--success); opacity: 0.8; margin-bottom: 0.4rem;
}
.grand-total-usd {
    font-size: 2.8rem; font-weight: 700; color: var(--success);
    line-height: 1; letter-spacing: -1.5px;
}
.grand-total-usd span { font-size: 1rem; font-weight: 600; opacity: 0.7; }
.grand-total-mxn {
    font-size: 1.1rem; font-weight: 600; color: var(--text-muted); margin-top: 0.25rem;
}

/* =====================================================================
   ESTADOS Y UTILIDADES (idéntico al original)
   ===================================================================== */
.hidden { display: none !important; }
.empty-state {
    text-align: center; padding: 2rem;
    color: var(--text-muted); font-size: 0.9rem;
}

/* =====================================================================
   GENÉRICOS / BADGES (idéntico al original)
   ===================================================================== */
@keyframes pulseGeneric {
    0%   { background-color: rgba(245,158,11,0.6); box-shadow: 0 0 12px rgba(245,158,11,0.8); }
    50%  { background-color: rgba(245,158,11,0.15); box-shadow: none; }
    100% { background-color: rgba(245,158,11,0.6); box-shadow: 0 0 12px rgba(245,158,11,0.8); }
}
.generic-row-highlighted {
    animation: pulseGeneric 2.5s ease infinite;
    outline: 2px solid #fbbf24; outline-offset: -2px;
}
.generic-year-badge {
    display: inline-flex; flex-direction: column; align-items: center;
    background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.2);
    padding: 3px 6px; border-radius: 6px; font-size: 0.65rem; color: #fbbf24;
    white-space: nowrap; cursor: default; transition: all 0.2s ease; min-width: 42px;
}
.generic-year-badge .badge-year  { font-weight: 800; font-size: 0.7rem; line-height: 1.3; }
.generic-year-badge .badge-price { font-size: 0.6rem; opacity: 0.8; line-height: 1.2; }
.generic-year-badge.active-year {
    background: rgba(245,158,11,0.7) !important; border-color: #fff !important;
    color: #fff !important; box-shadow: 0 0 10px rgba(245,158,11,0.8);
    transform: scale(1.15); z-index: 1; position: relative;
}
.generic-year-badge.active-year .badge-price { opacity: 1; }

.generic-year-badge.ghost {
    border: 1px dashed var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    opacity: 0.25;
    cursor: default;
}
.generic-year-badge.ghost .badge-price {
    color: transparent;
}
.generic-year-badge.ghost .badge-year {
    color: var(--text-muted);
}

/* =====================================================================
   MÓDULO CRM (Gestión de Clientes y Cotizaciones)
   ===================================================================== */
.crm-panel {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.crm-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.crm-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.crm-group input,
.crm-group select,
.crm-group textarea {
    padding: 0.6rem;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.crm-group textarea {
    resize: none;
    height: 38px;
}

/* Toast Notification (Diseño Monocromático) */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: #0f172a;
    color: rgba(255,255,255,0.85);
    padding: 0.9rem 1.4rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 4000;
    transform: translateY(-200%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.toast.toast-warning {
    border-left: 2px solid rgba(255,255,255,0.3);
}
.toast.show { transform: translateY(0); }

/* Badges de Estado */
.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-block;
}
.badge-new { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-follow { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-done { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }

/* Lista de Cotizaciones (Acordeón) */
.client-row {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 0.8rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.client-row-header {
    padding: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}
.client-row-header:hover { background: rgba(255, 255, 255, 0.04); }

.client-quotes-area {
    padding: 1rem;
    display: none;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.client-quotes-area.active { display: block; }

.quote-entry {
    font-size: 0.85rem;
    padding: 1.2rem;
    border-left: 4px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 1rem;
    border-radius: 0 10px 10px 0;
    transition: all 0.3s ease;
}
.quote-entry:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.06);
}

.date-filter {
    padding: 0.5rem;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
}

.recent-list {
    margin-top: 1rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
    display: none;
}
.recent-item {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

/* Scrollbar Global */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 4px; }
/* ===================== CONTROL DE ACCESO (ELIMINADO) ===================== */
/* El acceso ahora es universal para empleados */

/* Estilo para items que cambian apariencia según rol */
.card-breakdown {
    position: relative;
}
/* Desglose de Impuestos Colapsable con Difuminado */
.tax-expandable-container {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    max-height: 48px; /* Ajustado para mostrar la primera fila con aire */
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.2);
    border: 1px solid var(--glass-border);
    margin: 0.5rem 0;
}
.tax-expandable-container:hover {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(59, 130, 246, 0.3);
}
.tax-expandable-container.expanded {
    max-height: 400px;
    background: rgba(15, 23, 42, 0.3);
    border-color: var(--glass-border);
}

/* Efecto de difuminado (Máscara) */
.tax-expandable-container:not(.expanded)::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 35px;
    background: linear-gradient(to bottom, transparent, var(--bg-color));
    pointer-events: none;
    z-index: 2;
}

.tax-rows-inner {
    padding: 0; /* Ya tiene padding interno la fila */
}

.expand-indicator {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--accent-color);
    opacity: 0.8;
    transition: transform 0.3s;
}
.tax-expandable-container.expanded .expand-indicator {
    transform: translateX(-50%) rotate(180deg);
    bottom: 5px;
}

/* Resalte para Gastos Dinámicos dentro de la lista */
.dynamic-extra-row {
    background: rgba(59, 130, 246, 0.05);
    border-left: 3px solid var(--accent-color);
    margin: 2px 0;
}
.dynamic-extra-row span:first-child {
    color: var(--accent-color) !important;
    font-weight: 700 !important;
}

#crmPanelArea {
    grid-column: 1 / -1;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.crm-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--warning);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.crm-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    color: var(--text-main);
    font-size: 0.8rem;
    min-width: 90px;
    outline: none;
    transition: all 0.2s ease;
}

.crm-input:focus {
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* =====================================================================
   USER BADGE (visible siempre en header)
   ===================================================================== */
.a2d-user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
}
.a2d-user-icon {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.a2d-user-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

/* =====================================================================
   HAMBURGER MENU
   ===================================================================== */
.a2d-hamburger-wrap {
    position: relative;
}

/* Botón hamburguesa animado */
.a2d-hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}
.a2d-hamburger-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--accent-color);
}
.a2d-hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Animación a X cuando está abierto */
.a2d-hamburger-btn.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.a2d-hamburger-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.a2d-hamburger-btn.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Menú dropdown */
.a2d-hamburger-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: linear-gradient(135deg, rgba(15,23,42,0.97), rgba(30,41,59,0.97));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top right;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
}
.a2d-hamburger-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Items del menú */
.a2d-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.a2d-menu-item:hover {
    background: rgba(59,130,246,0.12);
    color: var(--accent-hover);
}
.a2d-menu-icon {
    font-size: 1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Divider */
.a2d-menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 0.4rem 0.5rem;
}

/* Item de peligro (Cerrar sesión) */
.a2d-menu-danger {
    color: #f87171;
}
.a2d-menu-danger:hover {
    background: rgba(239,68,68,0.12);
    color: #ef4444;
}
