/* --- LOGIN OVERLAY --- */
#login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 9999;
}
.login-box {
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.95) 0%, rgba(10, 10, 10, 0.98) 100%);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 45px 35px; border-radius: 24px; width: 100%; max-width: 400px;
    text-align: center; box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.9);
}
.login-logo { max-width: 170px; margin-bottom: 25px; }
.login-title { color: var(--text-light); font-size: 16px; font-weight: 900; text-transform: uppercase; margin-bottom: 25px; letter-spacing: 1px; }

/* --- SIDEBAR HOMOLOGADO (MVP) --- */
.sidebar, #sidebar {
    width: 270px !important;
    background: var(--sidebar-grad);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 0;
    z-index: 10;
}
.sidebar .logo {
    display: block;
    width: 160px;
    margin: 30px auto 40px auto; /* Centrado perfecto y espaciado */
}
.nav-links {
    list-style: none;
    padding: 0 15px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.nav-links a svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}
.nav-links a:hover, .nav-links a.active {
    background: var(--brand-main);
    color: white;
}

/* --- LIGHT MODE COMPONENTES (Cards y Tablas) --- */
.main-content, #main-content {
    background: var(--bg-main);
    flex-grow: 1;
    padding: 40px 50px;
    overflow-y: auto;
    position: relative;
}
.view-section h1 {
    color: var(--text-dark) !important;
    font-weight: 900;
}

/* --- DASHBOARD KPIs --- */
.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 30px;
}
.kpi-card {
    background: var(--card-bg);
    border: none;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* Sombra elegante, no cristal */
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex; flex-direction: column; gap: 10px;
}
.kpi-card:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); 
}
.kpi-label { color: var(--text-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.kpi-value { 
    color: var(--text-dark); 
    font-size: 32px; font-weight: 900; display: flex; align-items: baseline; gap: 5px;
}
.kpi-value.green { color: var(--brand-accent); }
.kpi-value span { font-size: 14px; color: var(--text-muted); font-weight: 600; }

/* --- FORMULARIOS BASE --- */
.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.form-control, .mgmt-input {
    width: 100%; padding: 12px 16px; border-radius: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    color: var(--text-dark); font-size: 13px; font-weight: 500; outline: none; transition: 0.3s;
}
.form-control:focus, .mgmt-input:focus {
    border-color: var(--brand-main); background: #ffffff; box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}
#login-overlay .form-control {
    background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.12); color: white;
}
#login-overlay .form-control:focus {
    background: rgba(0, 0, 0, 0.8); border-color: var(--brand-main);
}

/* --- BOTONES BASE --- */
.btn-main, .btn-action {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 20px; background: var(--brand-main); color: white;
    border: none; border-radius: 12px; font-size: 12px; font-weight: 800;
    cursor: pointer; text-transform: uppercase; letter-spacing: 1px; transition: 0.3s;
}
.btn-main:hover, .btn-action:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(211, 47, 47, 0.4); }
.btn-action.primary { background: var(--brand-main); box-shadow: 0 6px 15px rgba(211, 47, 47, 0.3); }
.btn-mgmt {
    width: 100%; padding: 14px; background: var(--text-dark); color: white;
    border: none; border-radius: 10px; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: 0.3s; text-transform: uppercase; letter-spacing: 0.5px;
}
.btn-mgmt:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2); }
.btn-icon { border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-icon:hover { transform: scale(1.05); }
.error-msg { color: #ff6b6b; font-size: 12px; font-weight: 700; margin-top: 15px; }

/* --- ACTION BAR & TABLES --- */
.action-bar {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--card-bg); padding: 15px 20px; border-radius: 16px;
    border: none; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); margin-bottom: 25px; flex-wrap: wrap; gap: 15px;
}
.search-group {
    display: flex; align-items: center; flex-grow: 1; max-width: 400px;
    background: var(--bg-main); border-radius: 10px; padding: 8px 15px;
    border: 1px solid rgba(0,0,0,0.05); transition: border 0.3s;
}
.search-group:focus-within { border-color: var(--brand-main); background: white; }
.search-group svg { color: var(--text-muted); width: 18px; height: 18px; margin-right: 10px; flex-shrink: 0; }
.search-group input {
    border: none; background: transparent; width: 100%;
    outline: none; font-size: 13px; font-weight: 500; color: var(--text-dark);
}
.search-group input::placeholder { color: var(--text-muted); }

.filter-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-select { padding: 10px 15px; border: 1px solid rgba(0,0,0,0.08); border-radius: 10px; font-size: 12px; font-weight: 700; color: var(--text-muted); background: white; cursor: pointer; outline: none; transition: 0.2s; }
.filter-select:focus { border-color: var(--brand-main); color: var(--text-dark); }

.data-table-container {
    background: var(--card-bg);
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}
table { width: 100%; border-collapse: collapse; text-align: left; }
table th {
    padding: 15px 20px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
    border-bottom: 2px solid #e2e8f0;
}
table td {
    padding: 15px 20px;
    color: var(--text-dark);
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
}
tr:hover td { background: #f8fafc; }

/* --- BADGES --- */
.badge { padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.badge.active { background: rgba(16, 185, 129, 0.15); color: var(--brand-accent); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.expired { background: rgba(211, 47, 47, 0.15); color: var(--brand-main); border: 1px solid rgba(211, 47, 47, 0.3); }

/* --- MODALS --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center; z-index: 10000;
}
.modal-overlay.active { display: flex; }
.modal-content {
    background: var(--card-bg); border: 1px solid #e2e8f0;
    padding: 30px; border-radius: 20px; width: 100%; max-width: 500px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 18px; color: var(--text-dark); font-weight: 800; }
.close-btn { cursor: pointer; color: var(--text-muted); font-size: 24px; font-weight: bold; }
.close-btn:hover { color: var(--text-dark); }

/* --- POS SPLIT SCREEN --- */
.pos-layout {
    display: flex; gap: 20px; height: calc(100vh - 150px);
}
.pos-catalog-area {
    flex: 2; display: flex; flex-direction: column; gap: 15px;
    background: var(--card-bg); border: none; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-radius: 16px; padding: 20px; overflow-y: auto;
}
.pos-cart-area {
    flex: 1; min-width: 320px; background: var(--card-bg);
    border: none; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-radius: 16px; padding: 20px;
    display: flex; flex-direction: column;
}

/* Tabs */
.pos-tabs { display: flex; gap: 10px; border-bottom: 2px solid #e2e8f0; padding-bottom: 10px; }
.pos-tab {
    background: transparent; color: var(--text-muted); border: none; font-weight: 800;
    font-size: 13px; text-transform: uppercase; cursor: pointer; padding: 10px 15px; transition: 0.3s;
}
.pos-tab.active { color: var(--text-dark); border-bottom: 2px solid var(--brand-main); margin-bottom: -12px; }

/* Grid de Catálogo */
.pos-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px;
}
.pos-card {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 12px; padding: 15px; text-align: center; cursor: pointer; transition: 0.2s;
}
.pos-card:hover { border-color: var(--brand-accent); background: rgba(16, 185, 129, 0.05); transform: translateY(-3px); }
.pos-card-title { color: var(--text-dark); font-size: 13px; font-weight: 800; margin-bottom: 5px; }
.pos-card-price { color: var(--brand-accent); font-size: 15px; font-weight: 900; }

/* Carrito */
.cart-items { flex-grow: 1; overflow-y: auto; margin: 15px 0; border-top: 1px dashed #e2e8f0; padding-top: 15px;}
.cart-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--text-dark); font-size: 12px;}
.cart-item-remove { color: var(--brand-main); cursor: pointer; font-weight: bold; padding: 0 5px; }
.cart-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 900; color: var(--text-dark); margin-bottom: 20px; border-top: 2px solid #e2e8f0; padding-top: 15px; }

/* --- FINANCE UTILS --- */
.finance-summary { margin: 20px 0; background: #f8fafc; padding: 15px; border-radius: 12px; border: 1px solid #e2e8f0; }
.finance-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 13px; color: var(--text-dark); }
.finance-row.total { border-top: 2px solid #e2e8f0; padding-top: 15px; font-size: 18px; font-weight: 900; color: var(--text-dark); margin-bottom: 0; margin-top: 10px; }
.finance-row.negative { color: #ef4444; font-weight: bold; }
.finance-row.positive { color: #10b981; font-weight: bold; }

/* --- CARD GRID & CLIENT CARDS (CRM) --- */
.directory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

/* --- UI CINÉTICA: TARJETAS DE CLIENTE --- */
.client-card {
    position: relative;
    padding: 25px 20px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 2px solid transparent !important; /* Borde base invisible para evitar saltos */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03), 0 1px 3px rgba(0,0,0,0.02);
}

/* Efecto de anillo rojo y levitación al pasar el cursor */
.client-card:hover {
    transform: translateY(-6px) !important;
    border-color: var(--brand-main) !important;
    box-shadow: 0 20px 40px -10px rgba(211, 47, 47, 0.15), 0 0 15px rgba(211, 47, 47, 0.1) !important;
}

/* Efecto visual para clientes pausados o inactivos */
.client-card.paused { opacity: 0.7; filter: grayscale(80%); border-color: transparent !important; }

.avatar-initials { width: 65px; height: 65px; background: var(--text-dark); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; margin-bottom: 15px; letter-spacing: 1px; box-shadow: 0 8px 20px -5px rgba(0,0,0,0.3); }
.client-name { font-size: 15px; font-weight: 800; color: var(--text-dark); margin-bottom: 5px; line-height: 1.2; }
.client-zkid { font-size: 11px; font-weight: 800; color: var(--text-muted); margin-bottom: 12px; font-family: monospace; letter-spacing: 0.5px; }

.card-badges { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: auto; align-items: center; }
.badge-plan { font-size: 10px; font-weight: 800; padding: 5px 12px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.05); background: var(--bg-main); color: var(--text-muted); text-transform: uppercase; }
.badge-status { font-size: 10px; font-weight: 900; padding: 5px 12px; border-radius: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-status.active { background: rgba(16, 185, 129, 0.1); color: var(--brand-accent); }
.badge-status.expired { background: rgba(211, 47, 47, 0.1); color: var(--brand-main); }
.badge-status.paused { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

/* HOVER ACTIONS (Acciones Rápidas) */
.card-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 5px; opacity: 0; transition: opacity 0.2s, transform 0.2s; transform: translateY(-10px); z-index: 10; }
.client-card:hover .card-actions { opacity: 1; transform: translateY(0); }
.btn-card-action { 
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.05); 
    background: white; color: var(--text-muted); 
    display: flex !important; align-items: center !important; justify-content: center !important; 
    padding: 0; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.05); 
}
.btn-card-action svg { width: 14px; height: 14px; display: block; }
.btn-card-action:hover { transform: scale(1.1); color: white; border-color: transparent; }
.btn-card-action.edit:hover { background: var(--text-dark); }
.btn-card-action.pause:hover { background: #f59e0b; }
.btn-card-action.delete:hover { background: var(--brand-main); }

/* Separador de Sección Pausados */
.section-divider {
    grid-column: 1 / -1;
    font-size: 13px; font-weight: 900; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px;
    border-bottom: 2px solid rgba(0,0,0,0.05);
    padding-bottom: 10px; margin-top: 20px; margin-bottom: 10px;
}

/* --- COLOR BLOCKING & DENSE GRID (Para Modales Sin Scroll) --- */
.dense-form-container { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-block { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 15px; margin-bottom: 12px; }
.form-block-title { font-size: 10px; font-weight: 900; color: var(--brand-main); text-transform: uppercase; margin-bottom: 10px; letter-spacing: 0.5px; }

/* Hacer los inputs más compactos en modales densos */
.dense-form-container .form-group { margin-bottom: 0; }
.dense-form-container .mgmt-input { padding: 8px 12px; font-size: 12px; }
.dense-form-container label { font-size: 9px; margin-bottom: 4px; }

/* --- REFINAMIENTO POS --- */
/* Forzar negro corporativo en las pestañas */
.pos-tab.active { background: var(--text-dark) !important; color: white !important; }
/* Escenario contenedor para los productos */
.pos-catalog-stage { background: #f1f5f9; border-radius: 16px; padding: 15px; flex-grow: 1; overflow-y: auto; border: 1px solid rgba(0,0,0,0.03); }

/* --- BOTONES MODALES FINANCIEROS (Ley de Fitts) --- */
.modal-sm { max-width: 380px !important; }
.btn-full { width: 100%; display: block; margin-top: 20px; font-size: 14px; padding: 14px; }

/* Estilos para la lista de Auditoría */
.audit-list { max-height: 300px; overflow-y: auto; padding-right: 5px; margin-bottom: 15px; }
.audit-list::-webkit-scrollbar { width: 5px; }
.audit-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.audit-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; background: white; border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 8px; transition: 0.2s; }
.audit-item:hover { border-color: #cbd5e1; }
.audit-item.voided { background: #f8fafc; opacity: 0.6; }
.audit-item.voided .audit-amount { text-decoration: line-through; color: var(--text-muted) !important; }
.audit-info { display: flex; flex-direction: column; gap: 4px; }
.audit-title { font-size: 12px; font-weight: 800; color: var(--text-dark); text-transform: uppercase; }
.audit-meta { font-size: 10px; font-weight: 700; color: var(--text-muted); }
.audit-amount { font-size: 14px; font-weight: 900; }
.amount-in { color: var(--brand-accent); }
.amount-out { color: var(--brand-main); }

