@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: rgba(59,130,246,0.12);
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --white: #ffffff;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
    --primary: #1e293b;
    --primary-light: #334155;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-light: rgba(96,165,250,0.15);
    --danger: #f87171;
    --danger-light: #451a1a;
    --success: #4ade80;
    --success-light: #14532d;
    --warning: #fbbf24;
    --warning-light: #451a03;
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
    --shadow: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --white: #1e293b;
}

[data-theme="dark"] body {
    background: #0f172a;
}

[data-theme="dark"] .topbar {
    background: #1e293b;
    border-bottom-color: #334155;
}

[data-theme="dark"] .panel,
[data-theme="dark"] .stat,
[data-theme="dark"] .r-card,
[data-theme="dark"] .dash-grid .card {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .modal-content {
    background: #1e293b;
}

[data-theme="dark"] .modal .form-group input,
[data-theme="dark"] select,
[data-theme="dark"] .form-select {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .modal .form-group input:focus,
[data-theme="dark"] select:focus {
    background: #1e293b;
}

[data-theme="dark"] .modal-backdrop {
    background: rgba(0,0,0,0.7);
}

[data-theme="dark"] .user-dropdown,
[data-theme="dark"] .user-badge {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .user-dropdown a {
    color: #e2e8f0;
}

[data-theme="dark"] .user-dropdown a:hover {
    background: #0f172a;
}

[data-theme="dark"] .btn-secondary {
    background: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .btn-secondary:hover {
    background: #475569;
}

[data-theme="dark"] .donut::before {
    background: #1e293b;
}

[data-theme="dark"] .donut .donut-label {
    color: #f1f5f9;
}

[data-theme="dark"] .timeline::before {
    background: #334155;
}

[data-theme="dark"] .timeline li::before {
    box-shadow: 0 0 0 3px #1e293b;
}

[data-theme="dark"] .pos-card {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .pos-card-name {
    color: #f1f5f9;
}

[data-theme="dark"] .pos-card-btn-unidad {
    background: #0f172a;
    color: #e2e8f0;
}

[data-theme="dark"] .pos-card-btn-unidad:hover {
    background: #334155;
}

[data-theme="dark"] .pos-cart-header {
    background: #0f172a;
}

[data-theme="dark"] .pos-ci-nombre {
    color: #f1f5f9;
}

[data-theme="dark"] .pos-ci-precio,
[data-theme="dark"] .pos-ci-recarga,
[data-theme="dark"] .pos-ci-total {
    color: #e2e8f0;
}

[data-theme="dark"] .pos-pay-select,
[data-theme="dark"] .pos-add-client,
[data-theme="dark"] .pos-monto-input,
[data-theme="dark"] .pos-ci-cantidad input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .pos-monto-input:focus,
[data-theme="dark"] .pos-ci-cantidad input:focus {
    background: #1e293b;
}

[data-theme="dark"] .pos-action-btn {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

[data-theme="dark"] #posVuelto {
    color: #e2e8f0 !important;
}

body {
    font-family: var(--font);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== LOGIN ===== */
.login-page {
    display: flex;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(59,130,246,0.1), transparent 70%);
    top: -150px; right: -150px;
    border-radius: 50%;
}

.login-hero {
    position: relative;
    z-index: 1;
    max-width: 420px;
    color: white;
}

.login-hero .brand-icon {
    width: 64px; height: 64px;
    background: var(--accent);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    box-shadow: 0 8px 24px rgba(59,130,246,0.3);
}

.login-hero h1 {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.login-hero p {
    font-size: 15px;
    color: rgba(255,255,255,0.6);
    line-height: 1.7;
    margin-bottom: 32px;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-features .feature {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: rgba(255,255,255,0.65);
}

.login-features .feature svg {
    color: var(--accent);
    flex-shrink: 0;
}

.login-right {
    width: 440px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: white;
}

.login-card {
    width: 100%;
    max-width: 360px;
}

.login-card-header {
    margin-bottom: 28px;
}

.login-card-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.login-card-header p {
    font-size: 14px;
    color: var(--gray-500);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.input-group {
    position: relative;
}

.input-group .input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.input-group input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    transition: 0.2s;
    outline: none;
    background: var(--gray-50);
    color: var(--gray-800);
}

.input-group input:focus {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ===== SELECT ===== */
select,
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding: 10px 36px 10px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    background-color: var(--gray-50);
    color: var(--gray-800);
    outline: none;
    transition: 0.2s;
    cursor: pointer;
}

select:hover {
    border-color: var(--gray-300);
}

select:focus {
    border-color: var(--accent);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

select option {
    background: white;
    color: var(--gray-800);
    padding: 8px;
}

select[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--gray-100);
}

.form-group select,
.inline-form-group select {
    width: 100%;
}

.modal .form-group select {
    padding: 10px 36px 10px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    background-color: var(--gray-50);
    transition: 0.2s;
    outline: none;
}

.modal .form-group select:focus {
    border-color: var(--accent);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.input-group .toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 6px;
    display: flex;
    border-radius: 4px;
    transition: 0.2s;
}

.input-group .toggle-password:hover {
    color: var(--gray-600);
    background: var(--gray-100);
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

.btn-success:hover {
    background: #16a34a;
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--success-light);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

[data-theme="dark"] .alert-info {
    background: #172554;
    color: #bfdbfe;
    border-color: #1e3a8a;
}

/* Estructura interna: icono + texto + boton de cierre */
.alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.alert-text {
    flex: 1;
    line-height: 1.4;
}

.alert-close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    border-radius: 4px;
}

.alert-close:hover {
    opacity: 1;
}

/* La alerta flash se oculta inline; el JS la reubica como toast flotante */
.main .alert {
    display: none;
}

/* Contenedor de toasts (mensajes flash flotantes arriba a la derecha) */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    pointer-events: none;
}

#toast-container .alert {
    margin-bottom: 0;
    min-width: 260px;
    align-items: flex-start;
    box-shadow: 0 8px 24px rgba(0,0,0,0.16);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#toast-container .alert.show {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 480px) {
    #toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

/* ===== LAYOUT ===== */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 240px;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

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

.brand-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.brand-sub {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    font-weight: 500;
}

.sidebar-nav {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
}

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

.nav-item .nav-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}

.nav-item.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-sub {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding-left: 12px;
}

.nav-sub.open {
    display: flex;
}

.nav-sub .nav-item {
    font-size: 13px;
    padding: 8px 14px;
}

.nav-sub .nav-item.active {
    background: rgba(59,130,246,0.2);
    color: var(--accent);
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ===== TOPBAR ===== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 80px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.topbar-left h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-btn {
    width: 36px; height: 36px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: white;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: 0.2s;
}

.topbar-btn:hover {
    border-color: var(--gray-300);
    color: var(--gray-700);
    background: var(--gray-50);
}

/* ===== ACCESOS RÁPIDOS DEL TOPBAR ===== */
:root {
    --info: #0ea5e9;
    --c-green: #22c55e;
    --c-purple: #8b5cf6;
    --pink: #ec4899;
}

.topbar-shortcuts {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 2px;
}
.tb-shortcut {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 42px;
    padding: 0;
    border: none;
    background: transparent;
    text-decoration: none;
    transition: .15s;
}
.tb-sc-ico { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: .15s; }
.tb-sc-ico svg { width: 20px; height: 20px; }
.tb-shortcut:hover .tb-sc-ico { transform: translateY(-1px); filter: brightness(.96); }
.tb-sc-lbl { font-size: 10px; font-weight: 700; color: var(--gray-500); letter-spacing: .4px; line-height: 1; max-width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-sc-x {
    position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--danger); color: #fff; font-size: 12px; line-height: 15px; text-align: center;
    opacity: 0; transition: .15s; cursor: pointer;
}
.tb-shortcut:hover .tb-sc-x { opacity: 1; }

.topbar-quick { position: relative; flex-shrink: 0; }
/* Botón + con la misma estructura que los chips (icono + etiqueta) para alinear */
.btn-quick {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    width: 42px; border: none; background: transparent; cursor: pointer; padding: 0;
}
.btn-quick-ico {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #7c3aed); color: #fff;
    display: flex; align-items: center; justify-content: center; transition: .15s;
}
.btn-quick:hover .btn-quick-ico { transform: translateY(-1px); filter: brightness(1.06); }

.quick-menu {
    position: absolute; top: 52px; right: 0; width: 300px; z-index: 200;
    background: var(--white); border: 1px solid var(--gray-200); border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,.16); padding: 14px; display: none;
}
.quick-menu.open { display: block; }
.quick-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.quick-head span { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.quick-edit { border: none; background: transparent; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; }
.quick-hint { font-size: 11px; color: var(--gray-400); margin-bottom: 12px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick-item {
    position: relative; border: 1px solid var(--gray-200); border-radius: 10px; background: var(--white);
    padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: .15s;
}
.quick-item:hover { border-color: var(--gray-300); background: var(--gray-50); }
.quick-item.pinned { border-color: var(--accent); background: var(--accent-light); }
.quick-ico { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.quick-ico svg { width: 20px; height: 20px; }
.quick-label { font-size: 11px; font-weight: 600; color: var(--gray-700); text-align: center; line-height: 1.2; }
.quick-check {
    position: absolute; top: 6px; right: 6px; width: 15px; height: 15px; border-radius: 50%;
    border: 1.5px solid var(--gray-300); background: var(--white);
}
.quick-item.pinned .quick-check { background: var(--accent); border-color: var(--accent); }
.quick-item.pinned .quick-check::after {
    content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
    border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

[data-theme="dark"] .tb-shortcut,
[data-theme="dark"] .quick-menu,
[data-theme="dark"] .quick-item { background: #1e293b; border-color: #334155; }

@media (max-width: 768px) {
    .topbar-shortcuts { display: none; }
}

.user-menu {
    position: relative;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 50px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: 0.2s;
}

.user-badge:hover {
    border-color: var(--gray-300);
}

.user-badge svg {
    color: var(--gray-400);
    transition: 0.2s;
}

.user-menu:hover .user-badge svg {
    transform: rotate(180deg);
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: 0.2s;
    z-index: 100;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: 0.1s;
}

.user-dropdown a:hover {
    background: var(--gray-50);
    color: var(--danger);
}

.user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

/* ===== CONTENT ===== */
.content {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
}

/* ===== WELCOME ===== */
.welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius);
    padding: 24px 28px;
    color: white;
    margin-bottom: 24px;
}

.welcome-text h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.welcome-text p {
    font-size: 13px;
    color: rgba(255,255,255,0.55);
}

.welcome-date {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}

/* ===== STATS ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--gray-200);
}

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon--blue {
    background: var(--accent-light);
    color: var(--accent);
}

.stat-icon--green {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon--yellow {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon--purple {
    background: #f3e8ff;
    color: #9333ea;
}

.stat-body {
    min-width: 0;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 2px;
}

.stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.3px;
}

/* ===== GRID ===== */
.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

/* ===== PANEL ===== */
.panel {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.panel-head h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
}

.panel-head a {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.panel-head a:hover {
    text-decoration: underline;
}

.panel-body {
    padding: 0;
}

/* ===== TABLE ===== */
table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 10px 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-100);
}

table td {
    padding: 12px 20px;
    font-size: 13px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

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

.empty {
    text-align: center !important;
    color: var(--gray-400) !important;
    padding: 40px 20px !important;
    font-size: 13px !important;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}

.modal.open .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-400);
    cursor: pointer;
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: 0.15s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 24px 20px;
}

.modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 0;
}

.modal .form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 0;
}

.modal .form-group input {
    padding: 10px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    background: var(--gray-50);
    transition: 0.2s;
    outline: none;
}

.modal .form-group input:focus {
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ===== ACTIONS ===== */
.actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: center;
}

.actions form {
    margin: 0;
}

.actions .btn-sm {
    white-space: nowrap;
}

/* Botón de solo icono (columna Acciones) */
.btn-icon {
    padding: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-icon svg {
    width: 16px;
    height: 16px;
}

/* ===== BADGE ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ===== FILTROS DE VENTAS ===== */
.vfiltros {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
    padding: 16px;
    margin-bottom: 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}
.vf-field { display: flex; flex-direction: column; gap: 6px; }
.vf-field.vf-grow { flex: 1 1 220px; min-width: 200px; }
.vf-field > label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.vf-field select,
.vf-field input[type="date"] {
    height: 38px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: #111827;
    font-family: inherit;
}
.vf-field select { min-width: 140px; }
.vf-field input[type="date"] { width: 150px; }
.vf-field select:focus,
.vf-field input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.vf-chips { display: flex; gap: 6px; }
.vf-chip {
    height: 38px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.vf-chip:hover { background: #f1f5f9; }
.vf-chip.is-active { background: #0f172a; border-color: #0f172a; color: #fff; }
.vf-search {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #94a3b8;
}
.vf-search:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.vf-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    background: transparent;
    color: #111827;
    font-family: inherit;
}
.vf-clear {
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.vf-clear:hover { color: #ef4444; }
.vf-info { font-size: 12px; color: #64748b; margin-bottom: 10px; text-align: right; font-weight: 500; }

/* ===== PANEL DE SOPORTE ===== */
.sop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 14px; }
.sop-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 8px; background: #f8fafc; }
.sop-row input[type="text"], .sop-row input[type="password"] { flex: 1; min-width: 120px; height: 36px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; font-family: inherit; }
.sop-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #475569; white-space: nowrap; }
.sop-switch input { width: 16px; height: 16px; }
.form-control { height: 36px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; font-family: inherit; background:#fff; color:#1e293b; }
.form-control:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-light); }
select.form-control { cursor:pointer; }
[data-theme="dark"] .form-control { background:#0f172a; border-color:#334155; color:#e2e8f0; }
[data-theme="dark"] .form-control:focus { background:#1e293b; }
[data-theme="dark"] #docResultado { background:#1e293b; border-color:#334155; }
[data-theme="dark"] #docResultado td, [data-theme="dark"] #docResultado th { border-bottom-color:#334155; }

/* Cliente modal – estilo MUI */
.cli-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px }
.cli-field { display:flex; flex-direction:column; gap:4px }
.cli-field.cli-full { grid-column:1/-1 }
.cli-field label { font-size:13px; font-weight:600; color:var(--gray-600); letter-spacing:.2px }
.cli-field input, .cli-field select { height:38px; padding:0 12px; border:1px solid #d1d5db; border-radius:8px; font-size:14px; font-family:inherit; background:#fff; color:#1e293b; transition:border-color .15s,box-shadow .15s }
.cli-field input:focus, .cli-field select:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-light) }
.cli-input-group { display:flex; gap:0 }
.cli-input-group input { flex:1; border-radius:8px 0 0 8px; border-right:none }
.cli-input-group input:focus { border-right:none }
.cli-search-btn { display:flex; align-items:center; gap:4px; height:38px; padding:0 14px; background:var(--accent); color:#fff; border:none; border-radius:0 8px 8px 0; cursor:pointer; font-size:13px; font-weight:500; font-family:inherit; white-space:nowrap; transition:background .15s }
.cli-search-btn:hover { background:var(--accent-hover) }
.cli-search-btn:disabled { opacity:.5; cursor:default }
[data-theme="dark"] .cli-field input, [data-theme="dark"] .cli-field select { background:#0f172a; border-color:#334155; color:#e2e8f0 }
[data-theme="dark"] .cli-field input:focus, [data-theme="dark"] .cli-field select:focus { background:#1e293b }
[data-theme="dark"] .cli-search-btn { background:var(--accent); color:#fff }

/* ===== ACTIVITY ===== */
.activity {
    padding: 16px 20px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.activity-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-item p {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
}

.activity-time {
    font-size: 11px;
    color: var(--gray-400);
}

/* ===== DASHBOARD GRID ===== */
/* ===== KPIs ===== */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
    margin-bottom: 1.2rem;
}
.kpi {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.2rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    transition: box-shadow .2s, transform .2s;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-icon {
    width: 40px; height: 40px; border-radius: 11px;
    display: grid; place-items: center; color: #fff; margin-bottom: .3rem;
}
.kpi-icon.blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.kpi-icon.green  { background: linear-gradient(135deg, #22c55e, #16a34a); }
.kpi-icon.amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.kpi-icon.violet { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.kpi-label { font-size: .72rem; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.55rem; font-weight: 700; color: var(--gray-900); line-height: 1.1; }
.kpi-trend { font-size: .74rem; font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; }
.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend.muted { color: var(--gray-500); font-weight: 500; }

[data-theme="dark"] .kpi { background: #1e293b; border-color: #334155; }

.dash-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    align-items: start;
}
.dash-grid .span-2 { grid-column: 1 / -1; }

.dash-grid .card {
    background: white;
    border-radius: var(--radius);
    padding: 1.3rem;
    border: 1px solid var(--gray-200);
    transition: box-shadow .2s;
}
.dash-grid .card:hover { box-shadow: var(--shadow-md); }
.dash-grid .card-title { font-size: .95rem; font-weight: 600; margin-bottom: .3rem; color: var(--gray-900); }
.dash-grid .card-sub { color: var(--gray-500); font-size: .78rem; margin-bottom: 1rem; }

.chart-xaxis { display: flex; justify-content: space-between; margin-top: .5rem; }
.chart-xaxis span { font-size: .68rem; color: var(--gray-400); font-weight: 600; }
.dash-grid .muted { color: var(--gray-500); font-size: .82rem; }

.dash-grid .gstat {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-radius: var(--radius);
    padding: 1.3rem 1.4rem;
}
.dash-grid .gstat + .gstat { margin-top: 1.2rem; }
.dash-grid .gstat .g-title { font-size: .82rem; opacity: .9; }
.dash-grid .gstat .g-sub { font-size: .72rem; opacity: .7; margin-bottom: .8rem; }
.dash-grid .gstat .g-value { font-size: 2rem; font-weight: 700; text-align: right; }

.donut-wrap { display: flex; justify-content: center; padding: .5rem 0; }
.donut {
    --pct: 0;
    width: 150px; height: 150px; border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--gray-200) 0);
    display: grid; place-items: center; position: relative;
}
.donut::before {
    content: ""; position: absolute;
    width: 108px; height: 108px; border-radius: 50%; background: white;
}
.donut .donut-label { position: relative; font-size: 1.6rem; font-weight: 700; color: var(--gray-900); z-index: 1; }

.barchart { display: flex; align-items: flex-end; gap: .6rem; height: 140px; margin-top: 1rem; }
.barchart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .4rem; height: 100%; }
.barchart .bar { width: 100%; border-radius: 5px 5px 0 0; min-height: 6px; background: linear-gradient(180deg, var(--accent), #60a5fa); transition: opacity .15s; }
.barchart .bar:hover { opacity: .8; }
.barchart .bar-lbl { font-size: .68rem; color: var(--gray-400); font-weight: 600; }

.linechart { width: 100%; height: 150px; }

.timeline { list-style: none; position: relative; padding-left: 1.2rem; }
.timeline::before {
    content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
    width: 2px; background: var(--gray-200);
}
.timeline li { position: relative; padding: 0 0 1rem .8rem; }
.timeline li::before {
    content: ""; position: absolute; left: -1.2rem; top: 4px;
    width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
    box-shadow: 0 0 0 3px white;
}
.timeline .t-title { font-weight: 600; font-size: .88rem; }
.timeline .t-desc { color: var(--gray-500); font-size: .78rem; }

.progress-row { margin-bottom: 1rem; }
.progress-row .p-head { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: .35rem; }
.progress-row .p-head .p-val { color: var(--gray-500); }
.progress { height: 9px; background: var(--gray-100); border-radius: 20px; overflow: hidden; }
.progress .bar { height: 100%; border-radius: 20px; background: var(--accent); }

/* ===== RANKING ===== */
.ranking { list-style: none; margin: 0; padding: 0; }
.ranking-row { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1.1rem; }
.ranking-row:last-child { margin-bottom: 0; }
.rank-pos {
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px;
    display: grid; place-items: center; font-size: .8rem; font-weight: 700;
    background: var(--gray-100); color: var(--gray-500);
}
.rank-pos.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.rank-pos.rank-2 { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #fff; }
.rank-pos.rank-3 { background: linear-gradient(135deg, #d6a06a, #b87333); color: #fff; }
.rank-body { flex: 1; min-width: 0; }
.rank-head { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }
.rank-name { font-size: .85rem; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-val { font-size: .85rem; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.rank-meta { display: block; font-size: .72rem; color: var(--gray-400); margin-top: .3rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .login-left { display: none; }
    .login-right { width: 100%; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
    .dash-grid .span-2 { grid-column: auto; }
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .brand-text,
    .sidebar .nav-item span,
    .sidebar .brand-sub { display: none; }
    .sidebar-header { padding: 16px; display: flex; justify-content: center; }
    .sidebar-nav { padding: 8px; align-items: center; }
    .nav-item { padding: 10px; justify-content: center; }
    .topbar { padding: 0 16px; }
    .content { padding: 16px; }
    .stats { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
    .kpi-row { grid-template-columns: 1fr; }
}

.sidebar-overlay { display: none; }
@media (max-width: 768px) {
    .sidebar-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,0.4);
        z-index: 98; display: none;
    }
    .sidebar-overlay.show { display: block; }
}

.sidebar { transition: width 0.25s ease; white-space: nowrap; }
.sidebar.collapsed { width: 60px !important; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-chevron,
.sidebar.collapsed .nav-sub { display: none; }
.sidebar.collapsed .sidebar-header { padding: 16px; display: flex; justify-content: center; }
.sidebar.collapsed .sidebar-nav { padding: 8px; align-items: center; }
.sidebar.collapsed .nav-item { padding: 10px; justify-content: center; }
.sidebar.collapsed .nav-item.active { border-radius: var(--radius-sm); }

.main { transition: flex 0.25s ease; }

.hamburger {
    background: none; border: none; color: var(--gray-600);
    cursor: pointer; padding: 6px; margin-right: 4px; border-radius: 6px;
    transition: 0.15s; display: inline-flex; align-items: center; justify-content: center;
}
.hamburger:hover { background: var(--gray-100); color: var(--gray-900); }
.topbar-left { display: flex; align-items: center; }

@media (max-width: 768px) {
    .sidebar-overlay { display: none; }
    .sidebar-overlay.show { display: block; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 99;
        transform: translateX(-100%); transition: transform 0.25s ease;
        width: 260px !important;
    }
    .sidebar:not(.collapsed) { transform: translateX(0); }
    .sidebar.collapsed { transform: translateX(-100%); width: 260px !important; }
    .sidebar .brand-text,
    .sidebar .brand-sub,
    .sidebar .nav-item span { display: revert; }
    .sidebar-header { padding: 20px; justify-content: flex-start; opacity: 1; }
    .sidebar-nav { padding: 12px; align-items: stretch; opacity: 1; }
    .nav-item { padding: 10px 14px; justify-content: flex-start; }
    .main { margin-left: 0 !important; }
}

/* ===== RESUMEN CARDS ===== */
.resumen-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.r-card {
    background: white;
    border-radius: 10px;
    padding: 0;
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.r-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.r-card-top {
    height: 4px;
    flex-shrink: 0;
}

.r-card--primary .r-card-top { background: var(--accent); }
.r-card--blue .r-card-top { background: #2563eb; }
.r-card--green .r-card-top { background: #059669; }
.r-card--red .r-card-top { background: #dc2626; }
.r-card--amber .r-card-top { background: #d97706; }

.r-card-body {
    padding: 16px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.r-card-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.r-card--primary .r-card-icon { background: var(--accent-light); color: var(--accent); }
.r-card--blue .r-card-icon { background: #dbeafe; color: #2563eb; }
.r-card--green .r-card-icon { background: #d1fae5; color: #059669; }
.r-card--red .r-card-icon { background: #fee2e2; color: #dc2626; }
.r-card--amber .r-card-icon { background: #fef3c7; color: #d97706; }

.r-card-label {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.r-card-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.3px;
    line-height: 1.1;
}

.r-card-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--gray-100);
    color: var(--gray-600);
    white-space: nowrap;
}
