﻿:root {
    --primary: #0085CA;
    /* Azul Corporativo */
    --primary-light: #339DDA;
    --primary-dark: #00669B;
    --primary-bg-light: #eef7fd;
    --accent: #FFC60B;
    /* Amarillo Corporativo */
    --accent-dark: #E6B200;
    --danger: #E74C3C;
    --success: #16a34a;
    --warning: #e67e22;
    --bg-main: #F4F7F9;
    --bg-sidebar: #004A70;
    /* Azul Oscuro para contraste */
    --bg-subtle: #f8fbfe;
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    --text-on-dark: #ECF0F1;
    --card-bg: #FFFFFF;
    --border: #D1D9E0;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --article-card-width: 130px;
}

/* Modo Oscuro - Variables */
body.dark-mode {
    --bg-main: #121212;
    --bg-sidebar: #0a0a0a;
    --card-bg: #1e1e1e;
    --border: #333333;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --primary: #3498db;
    --primary-light: #5dade2;
    --primary-bg-light: #1a2a3a;
    --bg-subtle: #1a1a2e;
    --success: #22c55e;
    --warning: #f59e0b;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

body.dark-mode .nav-submenu {
    background: rgba(255, 255, 255, 0.03);
}

body.dark-mode .user-dropdown .dropdown-content {
    background: #1e1e1e;
    border-color: #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

body.dark-mode .user-dropdown .dropdown-content a {
    color: #e0e0e0;
}

body.dark-mode .user-dropdown .dropdown-content a:hover {
    background: #252525;
}

body.dark-mode .user-button {
    background: #1e1e1e;
    border-color: #333;
    color: #e0e0e0;
}

body.dark-mode .app-logo-container {
    background: #1e1e1e !important;
}

body.dark-mode input,
body.dark-mode .modal,
body.dark-mode table,
body.dark-mode .admin-card {
    background: #1e1e1e !important;
    color: #e0e0e0;
}

body.dark-mode th {
    background: #252525;
}

body.dark-mode .card-details {
    background: #252525;
}

body.dark-mode .suggestion-chip {
    background: #333;
    border-color: #444;
    color: #ccc;
}

body.dark-mode .btn-liquidar {
    background: #333 !important;
    border-color: #444 !important;
    color: #aaa !important;
}

/* Estilo para deudas antiguas */
.debt-old {
    border: 2px solid #ffcccc !important;
    background: #fff8f8 !important;
}

body.dark-mode .debt-old {
    border-color: #632a2a !important;
    background: #2a1a1a !important;
}

/* POS DARK MODE IMPROVEMENTS */
body.dark-mode .category-pill {
    background: #1e1e1e;
    border-color: #333;
    color: #aaa;
}

body.dark-mode .category-pill:hover {
    background: #252525;
}

body.dark-mode .category-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

body.dark-mode .article-item {
    background: #1e1e1e;
    border-color: #333;
}

body.dark-mode .article-img,
body.dark-mode .article-item .no-img {
    background: #121212;
}

body.dark-mode .article-name {
    color: #e0e0e0;
}

body.dark-mode .ticket-container {
    background: #1e1e1e;
    border-color: #333;
}

body.dark-mode .ticket-header {
    border-bottom-color: #333;
}

body.dark-mode .ticket-item {
    border-bottom-color: #252525;
}

body.dark-mode .item-qty-controls {
    background: #252525;
    color: #e0e0e0;
}

body.dark-mode .qty-btn {
    color: #e0e0e0;
}

body.dark-mode .qty-btn:hover {
    background: #333;
}

body.dark-mode .ticket-footer {
    background: #1a1a1a;
    border-top-color: #444;
    /* Borde punteado más visible */
}

body.dark-mode .grand-total {
    color: #fff;
}

body.dark-mode .btn-checkout:disabled {
    background: #2c2c2c;
    color: #555;
    opacity: 0.6;
}

.debt-old .amount {
    color: #e74c3c;
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

@media (min-width: 1025px) {
    body {
        height: 100vh;
        overflow: hidden;
    }

    .app-container {
        height: 100vh;
        overflow: hidden;
    }
}

h1,
h2,
h3,
.logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    flex-shrink: 0;
    overflow-y: auto;
    /* Permitir scroll en la sidebar si es necesario */
    scrollbar-width: thin;
    transition: width 0.3s ease, padding 0.3s ease;
    position: relative;
}

/* --- Sidebar Toggle Button --- */
.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* --- Collapsed Sidebar --- */
.sidebar.collapsed {
    width: 70px;
    padding: 20px 10px;
}

.sidebar.collapsed .app-logo-container {
    display: none;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed .group-arrow {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
    gap: 0;
}

.sidebar.collapsed .nav-item i {
    margin: 0;
}

.sidebar.collapsed .nav-submenu {
    padding-left: 0;
}

.sidebar.collapsed .nav-item.sub {
    padding: 10px;
}

.sidebar.collapsed .sidebar-footer .total-stats {
    display: none;
}

.sidebar.collapsed .sidebar-footer .nav-item {
    justify-content: center;
}

/* Tooltip on hover for collapsed sidebar */
.sidebar.collapsed .nav-item {
    position: relative;
}

.sidebar.collapsed .nav-item:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #1a1a2e;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 999;
    margin-left: 8px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    margin-bottom: 50px;
    color: var(--accent);
}

.logo i {
    width: 32px;
    height: 32px;
}

nav {
    flex-grow: 1;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.3s ease;
    font-size: 1rem;
    margin-bottom: 8px;
    text-decoration: none;
}

.nav-item i {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-on-dark);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.total-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.total-stats .label {
    font-size: 0.8rem;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.total-stats .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Outfit';
    margin-bottom: 10px;
}

.btn-export {
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-on-dark);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-export:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Nav Groups & Submenus */
.nav-group {
    margin-bottom: 5px;
}

.nav-submenu {
    padding-left: 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-item.sub {
    padding: 10px 16px;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.group-arrow {
    margin-left: auto;
    transition: transform 0.3s;
    transform: rotate(0deg);
}

.nav-group.open .group-arrow {
    transform: rotate(90deg);
}

/* Header User Profile */
/* Header User Profile */
.user-profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    /* Evitar que se encoja en móviles */
    z-index: 50;
    /* Asegurar que esté por encima */
    position: relative;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s;
    flex-shrink: 0;
    /* Evitar deformación */
    z-index: 51;
}


.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.user-dropdown {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 15px 6px 6px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
}

.user-button:hover {
    border-color: var(--primary);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
}

.user-name-text {
    font-size: 0.9rem;
    font-weight: 600;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    min-width: 180px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    padding: 8px 0;
    z-index: 100;
    display: none;
    animation: slideUp 0.2s ease-out;
}

.dropdown-content.show {
    display: block;
}

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-content a:hover {
    background: #f8f9fa;
}

.dropdown-content hr {
    margin: 8px 0;
    border: none;
    border-top: 1px solid var(--border);
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-search {
    flex-grow: 1;
    max-width: 500px;
    position: relative;
}

.header-search>i:first-of-type,
.header-search>svg:first-of-type {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
    z-index: 5;
}

.header-search input {
    width: 100%;
    padding: 14px 44px 14px 48px;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: white;
    outline: none;
    transition: border-color 0.3s;
    font-size: 0.95rem;
}

.header-search input:focus {
    border-color: var(--primary-light);
}

.search-clear-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 10;
}

.search-clear-btn i,
.search-clear-btn svg {
    position: static;
    transform: none;
    width: 14px;
    height: 14px;
    pointer-events: auto;
    left: auto;
    color: inherit;
}

.search-clear-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.search-clear-btn.hidden {
    display: none;
}

/* Ocultar el botón de borrar por defecto de los navegadores si existe */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
    box-shadow: 0 4px 15px rgba(111, 78, 55, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.mobile-menu-btn {
    display: none;
    background: white;
    border: 1px solid var(--border);
    color: var(--danger);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.badge {
    background: #F1EDEA;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.badge.secondary {
    background: #E8F6F0;
    color: var(--accent);
}

/* Debtors Grid */
.debtors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.debt-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.debt-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.customer-info h3 {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 4px;
}

.customer-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--danger);
}

.card-details {
    background: #FAF9F8;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.card-details p {
    color: var(--text-main);
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.card-details span {
    color: var(--text-muted);
}

.btn-cobrar {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-cobrar:hover {
    background: var(--primary);
    color: white;
}

/* History Table */
.table-container {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: #F8F9FA;
    padding: 16px 24px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.status-paid {
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* OLD MODAL - REMOVED */

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* margin-bottom: 25px; */
}

.btn-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    outline: none;
    font-size: 1rem;
}

input:focus {
    border-color: var(--primary);
}

.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #E2DDD9;
    border-radius: 10px;
}

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow-y: visible;
        /* Dejar que el scroll lo maneje el body en móvil */
    }

    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 280px !important;
        height: 100vh !important;
        z-index: 1000;
        background: var(--bg-sidebar) !important;
        transition: left 0.3s ease;
        padding: 20px;
        display: flex !important;
        flex-direction: column;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.2) !important;
    }

    .sidebar.collapsed {
        left: -280px !important;
        transform: none !important;
        box-shadow: none;
    }

    .sidebar:not(.collapsed) {
        left: 0 !important;
        transform: none !important;
    }

    .sidebar .nav-text,
    .sidebar .group-arrow {
        display: inline !important;
    }

    .sidebar .nav-item {
        justify-content: flex-start !important;
        gap: 12px !important;
    }

    .sidebar .app-logo-container {
        display: none !important;
    }

    .sidebar-toggle {
        display: flex !important;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1100;
        background: var(--primary);
        color: white;
        width: 45px;
        height: 45px;
        border-radius: 12px;
        justify-content: center;
        align-items: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .sidebar nav {
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto;
        flex-grow: 1;
    }

    .sidebar .sidebar-footer {
        display: flex !important;
        margin-top: auto;
    }

    .main-content {
        padding: 15px;
        padding-top: 20px;
        width: 100%;
        margin-left: 0 !important;
        height: auto;
        overflow: visible;
    }

    header {
        padding-left: 60px !important;
    }

    .mobile-menu-btn {
        display: flex;
        /* Mostrar botón logout en header móvil/tablet */
    }

    .btn-text {
        display: none;
        /* Ocultar texto "Nueva Deuda" en móviles muy pequeños */
    }

    @media (min-width: 480px) {
        .btn-text {
            display: inline;
        }
    }

    .header-search input {
        padding: 10px 10px 10px 40px;
    }

    nav {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 10px;
        flex-grow: 0;
    }

    .nav-item {
        flex-shrink: 0;
        width: auto;
        margin-bottom: 0;
    }

    .sidebar-footer {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        margin-top: 15px;
        padding: 5px 0 10px 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-footer .nav-item {
        margin-top: 0 !important;
        flex: 1;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        font-size: 0.85rem;
        padding: 10px;
    }

    .sidebar-footer form {
        flex: 1;
    }

    .btn-logout {
        margin-top: 0 !important;
        width: 100%;
        padding: 10px !important;
        font-size: 0.85rem;
    }

    .total-stats {
        display: none;
    }

    .main-content {
        padding: 15px;
        height: auto !important;
        overflow: visible !important;
        flex: none;
        /* Evitar que flexbox intente contener el scroll */
    }
}

/* Soporte mejorado para scroll en dispositivos touch */
.main-content,
.app-container {
    -webkit-overflow-scrolling: touch;
}

/* Efecto de Vibración y Brillo para Nuevos Elementos (DURACIÓN EXTENDIDA) */
@keyframes shake-highlight {
    0% {
        transform: scale(1);
        box-shadow: var(--shadow);
        border: 1px solid var(--border);
    }

    10% {
        transform: scale(1.08);
        box-shadow: 0 0 35px rgba(0, 133, 202, 0.7);
        border: 2px solid var(--primary);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translate3d(-6px, 0, 0) scale(1.08);
    }

    30%,
    50%,
    70%,
    90% {
        transform: translate3d(6px, 0, 0) scale(1.08);
    }

    100% {
        transform: scale(1);
        box-shadow: var(--shadow);
        border: 1px solid var(--border);
    }
}

.new-debt-animation {
    animation: shake-highlight 2.5s cubic-bezier(.36, .07, .19, .97) both;
    z-index: 10;
    will-change: transform, box-shadow;
    transform-origin: center;
}

/* POS Interface Styles */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    height: calc(100vh - 150px);
}

.articles-grid-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-right: 10px;
}

.categories-pills {
    display: flex;
    gap: 10px;
    /* overflow-x: auto; */
    padding: 5px 0;
    scrollbar-width: none;
}

.category-pill {
    padding: 8px 16px;
    border-radius: 50px;
    background: white;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.2s;
}

.category-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--article-card-width), 1fr));
    gap: 15px;
}

.article-item {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    /* overflow: hidden; */
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
}

.article-item:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.article-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    background: #f8f9fa;
}

.article-item .no-img {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    background: #f8f9fa;
}

.article-info {
    padding: 10px;
}

.article-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
    height: 2.4em;
    overflow: hidden;
}

.article-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

/* Ticket Sidebar */
.ticket-container {
    background: white;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.ticket-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ticket-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
}

.ticket-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.item-qty-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f8f9fa;
    border-radius: 50px;
    padding: 2px 8px;
}

.qty-btn {
    border: none;
    background: none;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.qty-btn:hover {
    background: #eee;
}

.item-name {
    flex-grow: 1;
    font-size: 0.9rem;
}

.item-total {
    font-weight: 600;
    min-width: 50px;
    text-align: right;
}

.ticket-footer {
    padding: 20px;
    border-top: 2px dashed var(--border);
    background: #fdfdfd;
}

.ticket-summary p {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.grand-total {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.btn-checkout {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-checkout:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Change Assistant Accessibility */
.change-assistant {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.money-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.money-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.money-visual {
    width: 60px;
    height: 35px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.bill-5 {
    background: #9bb68d;
}

.bill-10 {
    background: #da918d;
}

.bill-20 {
    background: #8da4da;
}

.bill-50 {
    background: #da9d8d;
}

.coin-visual {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    border: 2px solid #daa520;
    color: #444;
}

.coin-2,
.coin-1 {
    background: #eee;
    border-color: #ffd700;
}

.coin-05,
.coin-02,
.coin-01 {
    background: #cd7f32;
    border-color: #8b4513;
    color: white;
}

/* Responsive adjustments for POS */
@media (max-width: 1024px) {
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .ticket-container {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        z-index: 500;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.1);
        transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
        cursor: pointer;
    }

    .ticket-container.active {
        height: 80vh;
        overflow-y: auto;
    }

    .mobile-arrow {
        display: inline-block !important;
        transition: transform 0.3s ease;
    }

    .ticket-container.active .mobile-arrow {
        transform: rotate(180deg);
    }

    /* Ocultar flecha en escritorio */
    @media (min-width: 1025px) {
        .mobile-arrow {
            display: none !important;
        }
    }

    .categories-pills,
    .pos-container .articles-grid-container .header-search {
        display: none !important;
    }

    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(var(--article-card-width), 1fr));
        padding-bottom: 80px;
        /* Espacio para el ticket bar */
    }
}

/* ============================================
   MODAL STYLES
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-main);
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-modal:hover {
    background: var(--bg-main);
    color: var(--danger);
}

.modal-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-main);
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 133, 202, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn.primary {
    background: var(--primary);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 133, 202, 0.3);
}

.btn.secondary {
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background: var(--border);
}

body.dark-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.8);
}

body.dark-mode .modal-content {
    background: #1e1e1e;
}

body.dark-mode .modal-header {
    border-bottom-color: #333;
}


/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 250px;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid #ccc;
}

.toast.active {
    transform: translateX(0);
}

.toast.success {
    border-left-color: #2ecc71;
}

.toast.error {
    border-left-color: #e74c3c;
}

.toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast.success .toast-icon {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.toast.error .toast-icon {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.toast-message {
    font-weight: 500;
    color: #333;
}

body.dark-mode .toast {
    background: #2c2c2c;
    color: white;
}

body.dark-mode .toast-message {
    color: #eee;
}

.toast-container {
    visibility: visible !important;
    opacity: 1 !important;
}

.toast {
    display: flex;
}

/* Paginaci�n */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

.pagination-container .btn {
    min-width: 120px;
}

/* Botones de acci�n en tablas */
td .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    margin-left: 8px;
    /* Margen entre botones */
    transition: background 0.2s;
}

td .icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

td .icon-btn.delete:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* ===========================================
   FIX: ALINEACI�N PRODUCTOS POS
   =========================================== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    align-content: start !important;
    /* Fuerza a los elementos a ir arriba */
    justify-content: start !important;
}

.article-card {
    height: auto !important;
    /* Evitar que se estiren si el grid lo intenta */
}

/* ===========================================
   FIX DEFINITIVO: ALINEACI�N SUPERIOR POS
   =========================================== */
.articles-grid-container {
    display: flex;
    flex-direction: column !important;
    justify-content: flex-start !important;
    /* Alineaci�n VERTICAL al inicio */
}

.articles-grid {
    margin-top: 20px !important;
    /* Margen fijo peque�o, no auto */
    margin-bottom: auto !important;
    /* Si sobra espacio, que quede abajo */
    display: grid !important;
    align-content: start !important;
    /* Grid compactado arriba */
    height: auto !important;
    /* Altura autom�tica seg�n contenido */
    min-height: 0 !important;
}

/* ===========================================
   FIX: HEADER SEARCH GROWTH
   =========================================== */
.articles-grid-container .header-search {
    flex-grow: 0 !important;
    /* Evitar que crezca verticalmente */
    margin-bottom: 20px !important;
    /* Separaci�n con el grid */
    width: 100% !important;
    /* Ocupar ancho completo si es necesario */
    max-width: 100% !important;
}

/* ===========================================
   FIX: MODAL CHECKOUT VISIBILITY
   =========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    /* Centrar contenido */
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Forzar que el contenido del modal no herede display:none de .modal si est� dentro de overlay */
.modal-overlay .modal-content {
    display: block !important;
    /* O flex, dependiendo del dise�o interior */
    position: relative !important;
    /* Ya no fixed */
    top: auto !important;
    left: auto !important;
    transform: translateY(0);
    opacity: 1;
}

/* ===========================================
   FIX: BORDE DE IMAGEN ART�CULO
   =========================================== */
.article-img {
    border-top-left-radius: 12px;
    /* Mismo borde que la tarjeta */
    border-top-right-radius: 12px;
    height: 120px;
    /* Aumentar un poco la altura para que se vea mejor */
}

/* Ocultar desbordamiento en la tarjeta por si acaso */
.article-card {
    overflow: hidden;
}

/* ===========================================
   FIX: PAYMENT METHODS ACTIVE STATE
   =========================================== */
.btn-cobrar.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    /* Resaltado extra */
}

/* Color espec�fico para Deudas cuando est� activo */
#pay-debt.active {
    background: #e67e22 !important;
    border-color: #e67e22 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

/* TRANSICI�N SUAVE EN EL BOT�N FINAL */
#btn-confirm-checkout {
    transition: background-color 0.3s ease, transform 0.1s ease;
    font-size: 1.1rem;
    /* Un poco m�s grande para que se lea bien */
}

/* ===========================================
   REPORT STYLES (Sales Summary)
   =========================================== */
.report-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.report-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 4px solid var(--primary);
}

.report-card-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.report-card-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
}

.report-card-trend {
    font-size: 0.8rem;
    color: #94a3b8;
}

.report-card-trend.positive {
    color: #22c55e;
}

.report-card-trend.negative {
    color: #ef4444;
}

.chart-container-card {
    padding: 25px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.chart-options {
    display: flex;
    gap: 10px;
}

.chart-options select {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
}

.main-chart-wrapper {
    height: 350px;
    width: 100%;
}

.table-header-alt {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 15px;
}

.report-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.quick-ranges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.export-dropdown {
    position: relative;
}

.export-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
}

.export-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    min-width: 160px;
    z-index: 100;
    overflow: hidden;
}

.export-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-primary);
    text-align: left;
}

.export-dropdown-menu button:hover {
    background: var(--bg-secondary);
}

.export-dropdown.open .export-dropdown-menu {
    display: block;
}

.date-picker-range {
    background: white;
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-main);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

body.dark-mode .date-picker-range {
    background: #1e1e1e;
    border-color: #333;
}

/* Efecto de desenfoque suave para el fondo */
.blur-content {
    filter: blur(5px);
    transition: filter 0.4s ease;
    pointer-events: none;
    user-select: none;
}

.app-container {
    transition: filter 0.4s ease;
}

/* ============================================
   ESTILOS VENTAS POR ARTÍCULO (NUEVO)
   ============================================ */
.top-article-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 5px 0;
}

.top-article-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    flex-shrink: 0;
}

.top-article-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-article-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

.top-article-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

@media (max-width: 900px) {
    .report-top-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   ESTILOS MIGRADOS DESDE index.php (inline)
   ============================================ */

/* --- Botón Logout Hover --- */
.btn-logout:hover {
    background: #fecaca;
}

/* --- Suggestion Chips (Deudas) --- */
.suggestion-chip {
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* --- Mini Grid de Clientes (Modal Deudas) --- */
.customers-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.cust-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    padding: 12px 8px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.cust-card:hover {
    border-color: var(--primary);
    background: var(--card-bg);
    transform: translateY(-2px);
}

.cust-card img,
.cust-card .no-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin: 0 auto 8px;
    display: block;
    object-fit: cover;
}

.cust-card .no-img {
    background: #d6eaf8;
    color: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cust-card span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Botones de Icono --- */
.icon-btn {
    background: #f0f3f5;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    color: #7f8c8d;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #e2e6e9;
    color: var(--primary);
}

.icon-btn.highlight {
    background: var(--primary-bg-light);
    color: var(--primary);
}

.icon-btn i,
.icon-btn svg {
    pointer-events: none;
}

/* --- Lista de Resultados de Búsqueda --- */
.search-results-list {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 150px;
    overflow-y: auto;
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-item {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: var(--bg-subtle);
    color: var(--primary);
}

/* --- Foto Shimmer y Badge --- */
.photo-shimmer:hover #cust-photo-preview,
.photo-shimmer:hover #edit-cust-photo-preview {
    border-color: var(--primary) !important;
    transform: scale(1.05);
    background: #fff !important;
}

.photo-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ============================================
   SETTINGS CARD
   ============================================ */
.settings-card-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px 10px;
}

.settings-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 35px 30px;
    width: 100%;
    max-width: 550px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 30px 0;
}

.settings-pin-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* --- Shake Animation (PIN error) --- */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* ============================================
   RECEIPTS LAYOUT
   ============================================ */
.receipts-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: calc(100vh - 80px);
    gap: 0;
}

.receipts-list-panel {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-main);
}

.receipts-list-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.receipts-list-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.receipts-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

.receipts-search input {
    border: none;
    background: transparent;
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
}

.receipts-list {
    flex: 1;
    overflow-y: auto;
}

.receipt-date-group {
    padding: 10px 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--success);
    text-transform: capitalize;
    background: var(--bg-subtle, var(--bg-main));
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.receipt-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.receipt-item:hover {
    background: var(--bg-subtle, #f5f5f5);
}

.receipt-item.active {
    background: var(--primary-bg-light, #e8f4fd);
    border-left: 3px solid var(--primary);
}

.receipt-item.refunded {
    opacity: 0.55;
}

.receipt-item.refunded .receipt-item-amount {
    text-decoration: line-through;
}

.receipt-item-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.receipt-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.receipt-item-amount {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
}

.receipt-item-time {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.receipt-item-number {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

/* --- Receipt Detail Panel --- */
.receipt-detail-panel {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg-main);
}

.receipt-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
}

.receipt-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}

.receipt-detail-header h2 {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

.receipt-detail-actions {
    display: flex;
    gap: 8px;
}

.btn-refund {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.btn-refund:hover:not(:disabled) {
    background: rgba(0, 133, 202, 0.1);
}

.btn-refund.refunded {
    color: var(--text-muted);
    cursor: default;
}

/* --- Receipt Paper --- */
.receipt-paper {
    max-width: 460px;
    margin: 30px auto;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 30px 28px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.receipt-refunded-badge {
    position: absolute;
    top: 20px;
    right: -35px;
    background: var(--danger, #e74c3c);
    color: white;
    padding: 4px 40px;
    font-size: 0.7rem;
    font-weight: 700;
    transform: rotate(45deg);
    letter-spacing: 1px;
}

.receipt-total-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0 15px;
}

.receipt-total-hero.line-through .receipt-total-amount {
    text-decoration: line-through;
    opacity: 0.5;
}

.receipt-total-amount {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
}

.receipt-total-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.receipt-separator {
    height: 1px;
    background: var(--border);
    margin: 15px 0;
    border: none;
}

.receipt-meta {
    padding: 5px 0;
}

.receipt-meta p {
    margin: 4px 0;
    font-size: 0.85rem;
    color: var(--text-main);
}

.receipt-items-list {
    padding: 5px 0;
}

.receipt-line-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.receipt-line-item:last-child {
    border-bottom: none;
}

.receipt-line-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.receipt-line-qty {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.receipt-line-total {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    flex-shrink: 0;
}

.receipt-totals {
    padding: 5px 0;
}

.receipt-payment-line {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.9rem;
    color: var(--text-main);
}

.receipt-payment-line.total {
    font-weight: 700;
    font-size: 1rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .receipts-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .receipts-list-panel {
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .receipt-paper {
        margin: 15px;
    }
}

/* Estilo para iconos de información y tooltips en Informes */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    z-index: 10;
}

.info-icon {
    width: 14px;
    height: 14px;
    margin-left: 6px;
    color: var(--text-muted);
    vertical-align: middle;
    opacity: 0.6;
    transition: all 0.2s ease;
    pointer-events: none;
}

.tooltip-wrapper:hover .info-icon {
    opacity: 1;
    color: var(--primary);
    transform: scale(1.1);
}

/* Tooltip personalizado */
.tooltip-wrapper[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: normal;
    width: 220px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 999999;
    pointer-events: none;
    line-height: 1.5;
    text-align: center;
    font-weight: 500;
}

/* Triángulo del tooltip */
.tooltip-wrapper[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: rgba(30, 30, 30, 0.95) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999999;
}

.tooltip-wrapper[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.tooltip-wrapper[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* ===========================================
   DATE RANGE PICKER STYLES
   =========================================== */
.range-selector-container {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.range-nav-btn {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.range-nav-btn:hover {
    background: #f8f9fa;
    color: var(--primary);
}

.date-range-trigger {
    padding: 10px 15px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary);
    min-width: 250px;
    justify-content: center;
    transition: background 0.2s;
}

.date-range-trigger:hover {
    background: #f8f9fa;
}

.date-picker-modal-content {
    max-width: 600px !important;
    padding: 0 !important;
    overflow: hidden;
}

.picker-flex-container {
    display: flex;
    min-height: 400px;
}

.picker-calendar-column {
    flex: 1.2;
    padding: 30px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.picker-calendar-column h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-main);
}

.picker-presets-column {
    flex: 0.8;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fcfdfe;
}

.preset-btn {
    background: none;
    border: none;
    text-align: left;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #f0f4f8;
    color: var(--primary);
}

.preset-btn.active {
    background: var(--primary-bg-light);
    color: var(--primary);
    font-weight: 600;
}

.custom-date-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.date-input-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.date-input-field label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.date-input-field input {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.date-input-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg-light);
}

.picker-info-box {
    margin-top: auto;
    background: #fff9e6;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid #ffeeba;
}

.picker-info-box i {
    color: #856404;
    flex-shrink: 0;
}

.picker-info-box p {
    margin: 0;
    font-size: 0.8rem;
    color: #856404;
    line-height: 1.4;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: #f8f9fa;
}

.modal-footer .btn {
    padding: 10px 25px;
    font-weight: 600;
}

/* Switch pequeño para tablas */
.switch-small {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch-small input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-small {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider-small:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider-small {
    background-color: var(--primary);
}

input:focus+.slider-small {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider-small:before {
    transform: translateX(14px);
}

/* Modal de Selección de Variantes (Diseño Premium) */
.variant-modal-content {
    max-width: 600px;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
}

.variant-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: white;
}

.variant-header-title h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-main);
}

.variant-header-title span {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.variant-close-btn,
.variant-save-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
}

.variant-close-btn {
    color: #888;
    padding: 10px;
}

.variant-save-btn {
    color: var(--success);
    font-size: 1rem;
}

.variant-modal-body {
    padding: 20px;
    background: #fafafa;
}

.variant-section h3,
.quantity-section h3,
.comment-section h3 {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.variants-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.variant-option-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.variant-option-card:hover {
    border-color: var(--primary);
}

.variant-option-card.selected {
    background: #f1f8e9;
    border-color: #8bc34a;
}

.variant-opt-name {
    font-weight: 500;
    color: #333;
}

.variant-opt-price {
    font-weight: 600;
    color: #444;
}

.variant-qty-controls {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 8px;
    border: 1px solid #eee;
    width: fit-content;
    margin-bottom: 25px;
}

.qty-btn {
    width: 45px;
    height: 45px;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: #e9ecef;
}

#variant-qty-input {
    width: 60px;
    text-align: center;
    border: none;
    font-size: 1.2rem;
    font-weight: 600;
}

.comment-section textarea {
    width: 100%;
    height: 80px;
    border: none;
    border-bottom: 1px solid #ccc;
    background: transparent;
    padding: 10px 0;
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.comment-section textarea:focus {
    border-bottom-color: var(--primary);
}

/* Debt Summary Card */
.debt-summary-card {
    margin-top: 60px;
    padding: 25px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 6px solid var(--primary);
    transition: all 0.3s ease;
    width: 100%;
    grid-column: 1 / -1;
}

body.dark-mode .debt-summary-card {
    background: #1e1e1e !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
    color: #e0e0e0;
}

/* ============================================
   DARK MODE OVERRIDES (FINAL & SPECIFIC)
   ============================================ */
html body.dark-mode {
    --bg-main: #121212;
    --bg-sidebar: #0a0a0a;
    --card-bg: #1e1e1e;
    --border: #333333;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --primary: #3498db;
    --primary-light: #5dade2;
    --primary-bg-light: #1a2a3a;
    --bg-subtle: #1a1a2e;
    --success: #22c55e;
    --warning: #f59e0b;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

html body.dark-mode .app-container,
html body.dark-mode .main-content {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

html body.dark-mode .sidebar,
html body.dark-mode #app-sidebar {
    background-color: #0a0a0a !important;
    border-right-color: #333 !important;
}

html body.dark-mode .card,
html body.dark-mode .admin-card,
html body.dark-mode .summary-card,
html body.dark-mode .white-card,
html body.dark-mode .debt-summary-card {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

html body.dark-mode input,
html body.dark-mode select,
html body.dark-mode textarea {
    background-color: #2c2c2c !important;
    color: #fff !important;
    border-color: #444 !important;
}

html body.dark-mode .table,
html body.dark-mode table {
    color: #e0e0e0 !important;
    background-color: #1e1e1e !important;
}

html body.dark-mode th,
html body.dark-mode td {
    border-color: #333 !important;
}

html body.dark-mode .modal-content {
    background-color: #1e1e1e !important;
    color: #e0e0e0 !important;
    border: 1px solid #333 !important;
}

html body.dark-mode .nav-item {
    color: #ccc !important;
}

html body.dark-mode .nav-item.active,
html body.dark-mode .nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

html body.dark-mode .global-header {
    background-color: #1e1e1e !important;
    border-bottom: 1px solid #333 !important;
}