/* --- ANALYTICS CARDS FOR REPORTS --- */
.analytics-cards-grid {
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}
.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--config-border);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: background 0.2s, border 0.2s;
}
.analytics-card h4 {
    margin: 0 0 10px 0;
    color: var(--primary);
    font-size: 1.08em;
}
.analytics-card ol, .analytics-card ul {
    margin: 0;
    padding-left: 18px;
    font-size: 0.98em;
}
.analytics-card .big {
    font-size: 2em;
    font-weight: bold;
    color: var(--primary);
}
body.dark-theme .analytics-card {
    background: var(--bg-card);
    border-color: var(--config-border);
}
body.dark-theme .analytics-card h4 {
    color: var(--primary);
}
.modal-box::-webkit-scrollbar {
    width: 8px;
}
.modal-box::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 6px;
}
.modal-box::-webkit-scrollbar-track {
    background: #232526;
    border-radius: 6px;
}

.modal-box {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #232526;
}
/* === RESPONSIVE UNIVERSAL === */
@media (max-width: 480px) {
    html {
        font-size: 15px;
    }
    .workspace {
        padding: 4px 0.5vw;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .card, .category-card, .product-card {
        padding: 10px 6px;
        min-width: 0;
        font-size: 0.98rem;
    }
    .product-card img, .category-card .icon-wrapper {
        height: 120px;
    }
    .modal-box {
        padding: 18px;
        width: 98vw;
        max-width: 100vw;
    }
    .form-group input, .form-group select {
        padding: 8px;
        font-size: 0.95rem;
    }
    .btn-primary, .lang-btn, .theme-btn {
        padding: 10px 10px;
        font-size: 0.98rem;
    }
    .category-bar {
        flex-direction: column;
        gap: 4px;
    }
    .search-box {
        width: 98vw;
    }
    table, thead th, td {
        font-size: 0.95rem;
        padding: 8px 4px;
    }
}

@media (max-width: 350px) {
    html {
        font-size: 13px;
    }
    .modal-box {
        padding: 6px;
    }
}

/* Mejorar imágenes y tarjetas para pantallas grandes */
@media (min-width: 1600px) {
    .product-card img, .category-card .icon-wrapper {
        height: 500px;
    }
    .modal-box {
        width: 700px;
    }
}
main,
.workspace,
.view {
    max-width: 100%;
    overflow-x: hidden;
    /* Prohibir el scroll horizontal en todo el panel principal */
}

/* --- LOGIN RESPONSIVO --- */
@media (max-width: 900px) {
    .login-container {
        min-height: 100vh;
        padding: 0 10px;
    }

    .login-form {
        max-width: 95vw;
        padding: 2rem 1rem 1.5rem 1rem;
        border-radius: 12px;
    }
}

@media (max-width: 600px) {
    .login-container {
        flex-direction: column;
        width: 100%;
        margin: 20px;
    }

    .login-info {
        padding: 30px;
        min-height: auto;
    }

    .login-form-section {
        padding: 40px 30px;
    }

    .login-form {
        max-width: 100vw;
        padding: 1.2rem 0.5rem 1rem 0.5rem;
        border-radius: 8px;
        font-size: 0.98rem;
        gap: 0.8rem;
    }

    .login-form h2 {
        font-size: 1.3rem;
    }

    .login-form button[type="submit"] {
        font-size: 1rem;
        padding: 0.7rem 0;
    }
}

/* --- LAYOUT PRINCIPAL RESPONSIVO --- */
@media (max-width: 900px) {
    aside {
        width: 70px;
        min-width: 70px;
        padding: 10px 4px;
        font-size: 0.9rem;
    }

    main {
        margin-left: 70px;
        padding: 10px 4px;
    }

    .workspace {
        padding: 10px 2vw;
    }

    /* header { Removed } */
}

@media (max-width: 600px) {
    aside {
        display: none;
    }

    main {
        margin-left: 0;
        padding: 6px 2vw;
    }

    .workspace {
        padding: 6px 1vw;
    }

    /* header { Removed } */
}

/* Fondo animado con gradiente oscuro para login */
.login-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: linear-gradient(120deg, #232526, #414345, #232526, #232526);
    background-size: 400% 400%;
    animation: gradientMove 12s ease-in-out infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Estilo profesional para el formulario de login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-form {
    background: rgba(34, 34, 40, 0.95);
    border-radius: 18px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    padding: 2.5rem 2.5rem 2rem 2.5rem;
    width: 100%;
    max-width: 370px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(4px);
}

.login-form h2 {
    color: #fff;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.login-form label {
    color: #bdbdbd;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    padding: 0.7rem 1rem;
    border-radius: 8px;
    border: none;
    background: #232526;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    outline: none;
    transition: box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    box-shadow: 0 0 0 2px #4e54c8;
}

.login-form button[type="submit"] {
    background: linear-gradient(90deg, #232526 0%, #4e54c8 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(78, 84, 200, 0.12);
}

.login-form button[type="submit"]:hover {
    background: linear-gradient(90deg, #4e54c8 0%, #232526 100%);
    transform: translateY(-2px) scale(1.03);
}

#login-error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    margin-bottom: 0.2rem;
    font-size: 0.98rem;
    text-align: center;
    min-height: 1.2em;
}

:root {
    /* Paleta Premium */
    --bg-body: #f8fafc;
    /* Gris muy claro */
    --bg-sidebar: #0f172a;
    /* Azul oscuro profundo */
    --bg-card: #ffffff;

    --primary: #4f46e5;
    /* Índigo elegante */
    --primary-dark: #4338ca;
    --accent: #0ea5e9;
    /* Azul cielo para detalles */

    --text-main: #1e293b;
    --text-muted: #64748b;

    --success: #10b981;
    --danger: #ef4444;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Variables específicas para el tema claro en Configuración */
    --config-bg-sub: #f8fafc;
    /* Fondo para elementos internos como el perfil de usuario */
    --config-border: #e2e8f0;
    /* Borde para elementos internos */

    --sidebar-width: 280px;
}

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

body {
    font-family: 'Poppins', 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* --- SIDEBAR DE LUJO --- */
aside {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    z-index: 50;
    max-height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #232526;
}

/* Scrollbar personalizado para aside (Webkit) */
aside::-webkit-scrollbar {
    width: 8px;
}
aside::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 6px;
}
aside::-webkit-scrollbar-track {
    background: #232526;
    border-radius: 6px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px 40px 15px;
    font-family: 'Poppins', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: rgb(255, 255, 255);
}

.brand i {
    color: var(--primary);
    font-size: 1.6rem;
}

.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #475569;
    margin-bottom: 15px;
    padding-left: 15px;
    font-weight: 600;
}

.menu ul {
    list-style: none;
}

.menu li {
    padding: 14px 15px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #94a3b8;
    transition: all 0.3s ease;
    font-weight: 500;
}

.menu li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(5px);
}

.menu li.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

/* --- CONTENIDO PRINCIPAL --- */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(255, 255, 255);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Área de trabajo */
.workspace {
    flex: 1;
    padding: 10px 40px 40px 40px;
    overflow-y: auto;
}

/* --- CARDS & KPIS --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 35px;
}

.card {
    background: rgb(255, 255, 255);
    border-radius: 16px;
    padding: 15px;
    box-shadow: var(--shadow-md);
    border: 1px solid #f1f5f9;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 140px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Buttons - 3D premium */
.btn-primary {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: rgb(255, 255, 255);
    padding: 10px 14px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.18), 0 2px 6px rgba(0, 0, 0, 0.06);
    font-weight: 600;
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.btn-primary:active {
    transform: translateY(2px) scale(.998);
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.12);
}

.btn-primary:hover {
    filter: brightness(1.03);
}

.action-btn {
    background: linear-gradient(180deg, #fff, #f8fafc);
    border: 1px solid #e6eef9;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer
}

/* 
   ======================================================================
   APARIENCIA DE TARJETA POS (Estilo Referencia)
   ======================================================================
*/
.product-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

/* Contenedor de la imagen/icono */
.product-card img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.product-image-placeholder {
    width: 100%;
    height: 100px;
    background-color: #f1f5f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 3rem;
    color: #cbd5e1;
}

/* Título en mayúsculas y negrita */
.product-card h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    margin-bottom: 5px;
    line-height: 1.2;
}

/* PRECIO EN VERDE */
.product-card .price {
    color: #10b981;
    /* Verde */
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.product-card .stock {
    font-size: 0.75rem;
    color: #64748b;
}

.product-card.no-stock {
    opacity: 0.6;
    filter: grayscale(1);
    cursor: not-allowed;
}

/* NEW: Category Card Styles for POS */
.category-card {
    background: linear-gradient(135deg, #f0f4ff, #e0e7ff);
    /* Light blue gradient */
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    /* Mantener bordes redondeados de la card en general */
    cursor: pointer;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px;
    /* Ajustar padding para más espacio */
    height: 100%;
    /* Permitir que se ajuste al contenido */
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
}

.category-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
}

.category-card .icon-wrapper {
    width: 100%;
    /* Ocupa todo el ancho de la tarjeta */
    height: 200px;
    /* Altura fija para la imagen, similar a los productos */
    background-color: #f1f5f9;
    /* Fondo para el placeholder si no hay imagen */
    border-radius: 8px;
    /* Bordes cuadrados para la imagen/icono */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    /* Tamaño del icono si no hay imagen */
    color: #cbd5e1;
    /* Color del icono si no hay imagen */
    margin-bottom: 12px;
    /* Margen inferior para separar del nombre */
    overflow: hidden;
    /* Asegurar que la imagen no se desborde */
}

.category-card .icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    /* Bordes cuadrados para la imagen */
}

.category-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 0;
    /* Asegurar que no hay margen extra */
}

/* ====================================================================== */


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

.card-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.icon-blue {
    background: #e0e7ff;
    color: var(--primary);
}

.icon-green {
    background: #dcfce7;
    color: var(--success);
}

.icon-red {
    background: #fee2e2;
    color: var(--danger);
}

.card h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 15px;
}

.card .value {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

/* --- SECCIONES Y CONTENEDORES --- */
.section-container {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    border: 1px solid #f1f5f9;
}

/* --- ESTILOS PUNTO DE VENTA --- */
.pos-layout {
    display: flex;
    gap: 5px;
    height: calc(100vh - 3px);
}

.pos-products {
    flex: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pos-cart {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-left: 4px solid var(--primary);
}

/* Ajuste del POS header para el nuevo layout */
.pos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Alinea verticalmente los items */
    margin-bottom: 15px;
    flex-wrap: wrap;
    /* Permite que los elementos se envuelvan si no hay espacio */
    gap: 15px;
    /* Espacio entre los elementos del header */
}

/* Grid de Productos */
.product-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    /* Adjusted for 3 columns visually */
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
    flex: 1;
}

/* Ticket / Carrito */
.cart-items-container {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid #f1f5f9;
    margin-top: 1px;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th {
    text-align: left;
    padding: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cart-table td {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.cart-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 2px dashed #e2e8f0;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 25px;
}

/* --- GRÁFICOS Y TABLAS GENERALES --- */
.charts-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

.chart-box {
    height: 320px;
    position: relative;
}

/* Estilo de Tabla Premium */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* Alinea al inicio cuando hay flex-wrap */
    flex-wrap: wrap;
    /* Permite que los elementos se envuelvan a la siguiente línea */
    gap: 15px;
    /* Espacio entre los elementos de control */
    margin-bottom: 20px;
}

.table-controls>div,
.table-controls>button {
    margin-bottom: 15px;
    /* Añade un margen inferior para cuando los elementos se envuelven */
}


.search-box {
    position: relative;
    width: 300px;
    flex-shrink: 0;
    /* Evita que el search-box se encoja demasiado */
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    transition: all 0.2s;
}

.search-box input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 25px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.25);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

thead th {
    text-align: left;
    padding: 15px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s;
}

tbody tr:hover {
    transform: scale(1.005);
    box-shadow: var(--shadow-md);
    z-index: 10;
    position: relative;
}

td {
    padding: 16px 20px;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

td:first-child {
    border-left: 1px solid #f1f5f9;
    border-radius: 10px 0 0 10px;
}

td:last-child {
    border-right: 1px solid #f1f5f9;
    border-radius: 0 10px 10px 0;
}

.sku-tag {
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85rem;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

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

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

/* --- MODAL (GLASSMORPHISM) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    /* Efecto vidrio */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}


.modal-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    width: 550px;
    max-width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    transition: 0.2s;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-bold {
    font-weight: 600;
}

.row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.col {
    flex: 1;
}

/* Botones de acción tabla */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    transition: 0.2s;
}

.btn-edit {
    background: #eff6ff;
    color: var(--primary);
}

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

.btn-del {
    background: #fef2f2;
    color: var(--danger);
}

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

/* --- CONFIGURACIÓN: BOTONES DE IDIOMA Y TEMA --- */
.lang-btn,
.theme-btn {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    color: var(--text-main);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.lang-btn:hover,
.theme-btn:hover {
    border-color: var(--primary);
    background: #f0f4ff;
}

.lang-btn.active,
.theme-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* --- TEMA OSCURO --- */
body.dark-theme {
    /* Ajustes para igualar la imagen de ejemplo */
    --bg-body: #15192C;
    /* Fondo principal oscuro */
    --bg-sidebar: #15192C;
    /* Sidebar igual al fondo para un look integrado */
    --bg-card: #212844;
    /* Fondo de tarjetas ligeramente más claro que el body */
    --primary: #4f46e5;
    /* Mantenemos el índigo primario */
    --primary-dark: #4338ca;
    --accent: #0ea5e9;
    --text-main: #f1f5f9;
    /* Texto claro */
    --text-muted: #94a3b8;
    /* Texto secundario grisáceo */
    --success: #10b981;
    /* Verde brillante */
    --danger: #ef4444;
    /* Rojo brillante */
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.12);
    /* Sombras más pronunciadas */
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);

    /* Variables específicas para el tema oscuro en Configuración */
    --config-bg-sub: rgba(255, 255, 255, 0.08);
    /* Fondo para elementos internos como el perfil de usuario */
    --config-border: #334155;
    /* Borde para elementos internos */
}

body.dark-theme aside {
    background: var(--bg-sidebar);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

body.dark-theme .menu-label {
    color: #475569;
    /* Mantener un gris oscuro para los labels de menú */
}

body.dark-theme .menu li {
    color: #8c9bb7;
}

body.dark-theme .menu li:hover {
    background: rgba(255, 255, 255, 0.08);
    /* Fondo de hover más sutil */
    color: white;
}

body.dark-theme .menu li.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

body.dark-theme main {
    background: var(--bg-body);
}

body.dark-theme .section-container {
    background: var(--bg-card);
    border-color: #334155;
}

body.dark-theme .card {
    background: var(--bg-card);
    border-color: #334155;
}

body.dark-theme table {
    background: var(--bg-card);
}

body.dark-theme tbody tr {
    background: var(--bg-card);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-theme .search-box input {
    background: #1e293b;
    border-color: #334155;
    color: var(--text-main);
}

body.dark-theme .search-box input:focus {
    background: #1e293b;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

body.dark-theme .product-card {
    background: #1e293b;
    border-color: #334155;
}

/* Dark theme for product image placeholder */
body.dark-theme .product-image-placeholder {
    background-color: #334155;
    color: #475569;
}

/* Corrección para que el título se vea en modo oscuro */
body.dark-theme .product-card h4 {
    color: #ffffff;
}

body.dark-theme .product-card:hover {
    background: #334155;
    border-color: var(--primary);
}

/* Dark theme for category cards */
body.dark-theme .category-card {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-color: #475569;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-theme .category-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

body.dark-theme .category-card .icon-wrapper {
    background: #334155;
    /* Darker placeholder background */
    color: #475569;
    /* Darker icon color */
}

body.dark-theme .category-card h4 {
    color: var(--text-main);
}


body.dark-theme .form-group input,
body.dark-theme .form-group select {
    background: #1e293b;
    border-color: #334155;
    color: var(--text-main);
}

body.dark-theme .form-group input:focus,
body.dark-theme .form-group select:focus {
    background: #1e293b;
    border-color: var(--primary);
}

body.dark-theme .modal-overlay {
    background: rgba(0, 0, 0, 0.8);
}

body.dark-theme .modal-box {
    background: var(--bg-card);
}

body.dark-theme .lang-btn,
body.dark-theme .theme-btn {
    background: #1e293b;
    border-color: #334155;
    color: var(--text-main);
}

body.dark-theme .lang-btn:hover,
body.dark-theme .theme-btn:hover {
    background: #334155;
    border-color: var(--primary);
}

body.dark-theme .lang-btn.active,
body.dark-theme .theme-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Reglas de impresión: ocultar elementos de navegación y optimizar para imprimir */
@media print {

    aside,
    /*header,*/
    .menu,
    .user-profile,
    .search-box,
    .table-controls,
    .btn-primary,
    .action-btn,
    #pos-back-button {
        display: none !important;
    }

    main {
        margin-left: 0 !important;
    }

    .workspace {
        width: 100%;
    }
}

/* Appear animation for product cards */
.product-card,
.category-card {
    opacity: 0;
    transform: translateY(8px) scale(.995);
    transition: transform .28s cubic-bezier(.2, .9, .2, 1), opacity .25s ease;
}

.product-card.visible,
.category-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Category bar + buttons */
.category-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    /* AÑADIDO: Permite que los botones de categoría bajen de línea */
}

.cat-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .18s ease;
    font-size: 0.85rem
}

.cat-btn:hover {
    transform: translateY(-2px);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

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

/* Client avatar */
.client-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    margin-right: 10px;
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.12);
}

.clients-table td.name-cell {
    display: flex;
    align-items: center;
}

/* User avatar in header refined */
.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

/* --- ESTILOS MEJORADOS PARA LA SECCIÓN DE CONFIGURACIÓN --- */
.config-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
    /* Más tenue para ser un título de sección */
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--config-border);
    /* Usar variable de borde */
    display: flex;
    align-items: center;
    gap: 10px;
}

body.dark-theme .config-section-title {
    color: var(--text-muted);
    /* En dark theme, también tenue */
}


.config-section-title i {
    color: var(--primary);
    font-size: 1.1rem;
}

/* Estilo para los grupos de formulario en la sección de configuración */
.config-form-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.config-form-item label {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
    min-width: 90px;
    /* Ancho fijo para las etiquetas */
}

.config-input {
    flex: 1;
    /* Ocupa el espacio restante */
    padding: 10px 12px;
    border: 1px solid var(--config-border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: var(--config-bg-sub);
    color: var(--text-main);
    /* Asegurar color de texto */
}

.config-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: var(--bg-card);
    /* Fondo blanco al enfocar en tema claro */
}

body.dark-theme .config-input:focus {
    background: var(--bg-card);
    /* Mantener el color de la tarjeta al enfocar en tema oscuro */
}


.config-input-file {
    flex: 1;
    padding: 8px 0;
    /* Padding diferente para inputs de tipo file */
    border: none;
    /* Eliminar borde para inputs de tipo file */
    font-size: 0.9rem;
    color: var(--text-main);
}

.biz-logo-preview {
    height: 60px;
    /* Tamaño un poco más grande para la preview */
    max-width: 150px;
    display: none;
    margin-top: 10px;
    border-radius: 6px;
    border: 1px solid var(--config-border);
    object-fit: contain;
    /* Asegura que el logo se ajuste sin distorsionarse */
}


/* Estilos para la forma de añadir impuestos */
.tax-add-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.tax-add-form .config-input {
    flex: 1;
}

.tax-add-form .tax-rate-input {
    width: 100px;
    /* Ancho específico para el input de tasa */
    flex: none;
    /* Desactivar flex para que width funcione */
}

.tax-add-form .btn-primary {
    padding: 10px 15px;
    min-width: 45px;
    /* Para que el botón + no sea demasiado pequeño */
}

/* Contenedor de la lista de impuestos */
.tax-list-container {
    padding: 15px;
    border: 1px solid var(--config-border);
    border-radius: 12px;
    background: var(--config-bg-sub);
    /* Un fondo ligeramente diferente */
    min-height: 80px;
    /* Para que siempre tenga un tamaño */
}

.tax-list-container>div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--config-border);
    /* Separador sutil */
    font-size: 0.95rem;
    color: var(--text-main);
}

body.dark-theme .tax-list-container>div {
    border-color: #334155;
    /* Borde más oscuro en tema dark */
}


.tax-list-container>div:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    /* No hay borde en el último elemento */
}

.tax-list-container .btn-del {
    margin-left: 15px;
    /* Espacio entre el nombre y el botón */
}

.tax-list-empty-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 20px;
}

/* Dark Theme specific adjustments for new config styles */
body.dark-theme .config-section-title {
    color: var(--text-muted);
    border-color: #334155;
}

body.dark-theme .config-form-item label {
    color: var(--text-main);
}

body.dark-theme .config-input {
    background: var(--bg-card);
    /* Usar el fondo de tarjeta para inputs en tema oscuro */
    border-color: #334155;
    color: var(--text-main);
}


body.dark-theme .config-input-file {
    color: var(--text-main);
}

body.dark-theme .biz-logo-preview {
    border-color: #334155;
}

body.dark-theme .tax-list-container {
    background: var(--bg-card);
    /* Usar el fondo de tarjeta para la lista en tema oscuro */
    border-color: #334155;
}

body.dark-theme .tax-list-empty-msg {
    color: var(--text-muted);
}

/* === NUEVOS ESTILOS PARA EL DASHBOARD === */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Espacio entre secciones principales */
}

.dash-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 10px;
    box-shadow: var(--shadow-md);
    border: 1px solid #334155;
    /* Borde más oscuro para tema dark */
    color: var(--text-main);
}

.card-title-lg {
    font-size: 1rem;
    /* Más pequeño para el título */
    font-weight: 600;
    color: var(--text-muted);
    /* Color tenue para el título */
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title-lg i {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Kpi Grid New - Top 5 cards */
.kpi-grid-new {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 7px;
    /* Espacio entre las tarjetas KPI */
}

.kpi-card {
    display: flex;
    flex-direction: row; /* HORIZONTAL - Alineación a la izquierda */
    align-items: center; /* Alineación vertical */
    justify-content: flex-start; /* Alineación horizontal */
    gap: 15px; /* Espacio entre icono y texto */
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.kpi-card .card-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 10px;
    /* Espacio entre icono y texto */
    background: rgba(255, 255, 255, 0.08);
    /* Fondo del icono más sutil */
    color: var(--text-main);
    /* Color del icono */
}

/* Colores específicos para iconos de KPI */
.kpi-card .card-icon.blue-icon {
    color: #818cf8;
}

/* Primary light */
.kpi-card .card-icon.green-icon {
    color: #4ade80;
}

/* Success light */
.kpi-card .card-icon.red-icon {
    color: #f87171;
}

/* Danger light */
.kpi-card .card-icon.primary-icon {
    color: #a78bfa;
}

/* Custom light purple for Sales Hoy */

.kpi-card .card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-card .card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-card .card-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kpi-card .card-value-danger {
    /* For Stock Bajo value */
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--danger);
}

.kpi-card .change-tag {
    font-size: 0.7rem;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kpi-card .change-tag.up {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.kpi-card .change-tag.down {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.kpi-card .card-change {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

.kpi-card .card-change.up {
    color: var(--success);
}

.kpi-card .card-change.down {
    color: var(--danger);
}

/* Alert card specific */
.kpi-card.alert-card .card-icon.alert-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Section 2: Alerts, Recent Activity, Quick Actions */
.dashboard-section-grid {
    display: grid;
    /* Alertas (1.2), Actividad (1.2), Acciones (0.6) */
    grid-template-columns: 2fr 2fr 1.3fr; /*ajuste de ancho de columnas de alerta, actividad y acciones */
    gap: 8px;
}

.system-alerts ul,
.recent-activity ul,
.quick-actions ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.system-alerts .alert-item,
.recent-activity .activity-item,
.quick-actions .action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 8px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    /* Separador sutil */
    transition: color 0.2s ease;
}

.system-alerts .alert-item:last-child,
.recent-activity .activity-item:last-child,
.quick-actions .action-item:last-child {
    border-bottom: none;
}

.system-alerts .alert-item:hover,
.recent-activity .activity-item:hover,
.quick-actions .action-item:hover {
    color: var(--text-main);
    cursor: pointer;
}

.system-alerts .alert-item i {
    color: var(--danger);
    font-size: 1rem;
}

.recent-activity .activity-item i:not(.fa-angle-right) {
    color: var(--accent);
    font-size: 1rem;
}

.recent-activity .activity-amount {
    font-weight: 600;
    color: var(--success);
    margin-left: auto;
    /* Empujar el monto a la derecha */
}

.recent-activity .activity-item .fa-angle-right {
    color: #64748b;
    font-size: 0.8rem;
}

.quick-actions .action-item i {
    color: var(--success);
    font-size: 0.9rem;
}

.quick-actions .action-item {
    padding: 8px !important;
    font-size: 0.85rem !important;
}


/* Section 3: Ventas y Gastos, Resumen, Top Clientes */
.dashboard-section-grid-bottom {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* 2/3 para el gráfico, 1/3 para el resumen/clientes */
    gap: 15px;
}

.dash-card-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sales-expenses-chart {
    min-height: 350px;
    /* Altura del contenedor del gráfico */
    display: flex;
    flex-direction: column;
}

.sales-expenses-chart .chart-header-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    /* Permitir que los elementos se envuelvan */
    gap: 10px 15px;
    /* Espacio vertical y horizontal */
    margin-bottom: 15px;
    justify-content: space-between;
    /* Distribuir elementos */
}

.sales-expenses-chart .card-title-lg {
    margin-bottom: 0;
    /* Quitar el margen inferior extra */
}

.sales-expenses-chart .chart-filters {
    display: flex;
    gap: 8px;
}

.sales-expenses-chart .filter-btn {
    background: #334155;
    /* Fondo oscuro para botones inactivos */
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.sales-expenses-chart .filter-btn:hover {
    background: #475569;
    color: var(--text-main);
}

.sales-expenses-chart .filter-btn.active {
    background: var(--primary);
    color: white;
}

.sales-expenses-chart .gatonee-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 5px;
}

.sales-expenses-chart .gatonee-value #gatonee-amount {
    color: var(--success);
    /* Valor en verde */
}

.sales-expenses-chart .gatonee-value i {
    color: var(--success);
    font-size: 0.8rem;
}

.sales-expenses-chart .chart-area {
    position: relative;
    height: 250px;
    /* Altura fija para que el gráfico sea estable */
    width: 100%;
}

.sales-expenses-chart .chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sales-expenses-chart .legend-item i {
    margin-right: 5px;
    font-size: 0.7rem;
}

.sales-expenses-chart .legend-item.ingresos i {
    color: #4ade80;
}

/* Color para ingresos */
.sales-expenses-chart .legend-item.gastos i {
    color: #f87171;
}

/* Color para gastos */

.business-summary p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.5;
}

.top-clients ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-clients ul li {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.top-clients ul li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.top-clients .client-amount {
    margin-left: auto;
    font-weight: 600;
    color: var(--success);
    /* Color para los montos */
    min-width: 70px;
    /* Para alinear los montos */
    text-align: right;
}

.top-clients .progress-bar-wrap {
    width: 60px;
    /* Ancho fijo para la barra de progreso */
    height: 6px;
    background: #334155;
    /* Fondo de la barra de progreso */
    border-radius: 3px;
    margin-left: 10px;
    overflow: hidden;
}

.progress-bar-wrap div {
    height: 100%;
    background: var(--success);
    /* Color del progreso */
    border-radius: 3px;
    transition: width 0.5s ease;
}
/* Section 4: Top Products */
.top-products-section {
    padding-top: 25px;
    /* Más padding superior para la sección */
    padding-bottom: 15px;
}

.top-products-section .card-title-lg {
    color: var(--text-main);
    /* Título de sección más visible */
}

.product-grid-bottom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    /* Más pequeñas, se ajustan */
    gap: 15px;
    margin-top: 20px;
}

.prod-card-small {
    background: #2D3748;
    /* Fondo un poco más oscuro para diferenciarlas */
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    min-height: 180px;
    /* Altura mínima para que sean uniformes */
}

.prod-card-small:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.prod-card-small img {
    width: 80px;
    /* Tamaño más pequeño para la imagen */
    height: 140px;
    object-fit: contain;
    /* Para que la imagen se ajuste */
    border-radius: 6px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    /* Fondo sutil para la imagen */
    padding: 5px;
    /* Pequeño padding para la imagen */
}

.prod-card-small h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 5px;
}

.prod-card-small .sold-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.add-product-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(79, 70, 229, 0.1);
    /* Fondo claro para el botón "Ver más" */
    border: 1px dashed var(--primary);
    /* Borde punteado primario */
    color: var(--primary);
}

.add-product-card i {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.add-product-card h4 {
    color: var(--primary);
}

/* Responsive adjustments for dashboard */
@media (max-width: 1200px) {
    .dashboard-section-grid-bottom {
        grid-template-columns: 1fr;
        /* Una columna para el gráfico y otra para resumen/clientes */
    }
}

@media (max-width: 768px) {
    .workspace {
        padding: 10px 15px;
    }

    .kpi-grid-new,
    .dashboard-section-grid,
    .dashboard-section-grid-bottom,
    .product-grid-bottom {
        grid-template-columns: 1fr;
        /* Pila en dispositivos pequeños */
    }

    .sales-expenses-chart .chart-header-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .sales-expenses-chart .chart-filters {
        width: 100%;
        justify-content: space-around;
    }

    .sales-expenses-chart .filter-btn {
        flex: 1;
        text-align: center;
    }

    .pos-layout {
        flex-direction: column;
    }

    .pos-products,
    .pos-cart {
        flex: none;
        /* Desactivar flex para permitir ancho completo */
        width: 100%;
    }
}

/* NEW: Styles for the User Account section in Config */
.config-user-account-section {
    margin-bottom: 25px;
    /* Espacio debajo de esta sección */
    padding: 20px;
}

/* Ensure user-profile-header and btn-logout look good in config view */
#view-config #user-profile-header {
    background: var(--config-bg-sub);
    border: 1px solid var(--config-border);
    color: var(--text-main);
    padding: 8px 15px;
    /* Ajustado para que se vea bien */
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#view-config #user-name {
    color: var(--text-main);
}

body.dark-theme #view-config #user-profile-header {
    background: var(--config-bg-sub);
    /* Re-aplicar para dark theme */
    border-color: var(--config-border);
    /* Re-aplicar para dark theme */
}

body.dark-theme #view-config #user-name {
    color: var(--text-main);
    /* Re-aplicar para dark theme */
}

/* --- ESTILOS DEL CARRUSEL DINÁMICO --- */
/* --- CARRUSEL PROTEGIDO CONTRA DESBORDAMIENTO --- */
.top-products-section {
    width: 66%;
    /* Obliga a la tarjeta a no medir más que su padre */
    max-width: 100%;
    overflow: hidden;
    /* Evita que cualquier hijo empuje la tarjeta hacia afuera */
    box-sizing: border-box;
}

.carousel-container {
    width: 100%;
    overflow: hidden;
    /* Esta es la 'ventana' que recorta los productos */
    position: relative;
    padding: 10px 0;
}

.carousel-track {
    display: flex;
    gap: 5px;
    width: max-content;
    /* El track sí puede ser ancho, pero el container lo recortará */
    animation: scroll-left 30s linear infinite;
    will-change: transform;
    /* Optimización de rendimiento */
}

.carousel-track:hover {
    animation-play-state: paused;
}

@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }

    /* Se mueve exactamente la mitad */
}

/* Forzar que las imágenes no rompan el layout */
.prod-card-small {
    flex: 0 0 140px;
    /* Ancho fijo y NO ajustable */
    width: 150px;
    max-width: 150px;
    box-sizing: border-box;
}

/* --- MEJORA DE ACCIONES RÁPIDAS --- */
.quick-actions .action-item {
    transition: all 0.2s ease;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 5px;
}

.quick-actions .action-item:hover {
    background: rgba(80, 73, 224, 0.075);
    /* Color primario muy suave */
    transform: translateX(5px);
    color: var(--primary);
    /* El texto cambia al color índigo */
}

.quick-actions .action-item i {
    transition: transform 0.2s ease;
}

.quick-actions .action-item:hover i {
    transform: scale(1.1);
}
/* --- ESTILOS DE ALERTAS DINÁMICAS --- */

/* Estilo general para items de alerta clickeables */
.alert-item {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 10px 10px !important;
    border-radius: 8px;
    margin-bottom: 5px;
    border: 1px solid transparent;
}

.alert-item:hover {
    transform: translateX(5px);
    filter: brightness(0.9);
}

/* Alerta Peligro (Stock Bajo / Vencido) */
.alert-item.danger {
    background: rgba(239, 68, 68, 0.1) !important; /* Rojo transparente */
    border-left: 4px solid #ef4444 !important;
    color: #ef4444 !important;
}

/* Alerta Advertencia (Próximo a vencer - AMARILLO TRANSPARENTE) */
.alert-item.warning {
    background: rgba(251, 191, 36, 0.15) !important; /* Amarillo transparente */
    border-left: 4px solid #fbbf24 !important;
    color: #d97706 !important; /* Texto un poco más oscuro para legibilidad */
}

/* Ajuste de iconos en alertas */
.alert-item i {
    font-size: 1.1rem;
    min-width: 20px;
}

body.dark-theme .alert-item.warning {
    background: rgba(251, 191, 36, 0.1) !important;
}
/* --- AJUSTE PARA SCROLL EN ALERTAS DEL SISTEMA --- */

/* Limitamos el alto de la tarjeta de alertas */
.dash-card.system-alerts {
    display: flex;
    flex-direction: column;
    max-height:400px; /* Altura máxima aproximada para 4-5 alertas */
    overflow: hidden; /* Evita que la tarjeta misma crezca */
}
/* altura para las seccione de alerta, actividad reciente y acciones rapidas. */
.dashboard-section-grid{
    max-height: 390px;
    overflow: hidden;
}
/* El título se queda fijo arriba */
.dash-card.system-alerts .card-title-lg {
    flex-shrink: 0; 
    margin-bottom: 10px;
}

/* La lista es la que recibe el scroll */
#system-alerts-list {
    overflow-y: auto; /* Activa el scroll vertical */
    padding-right: 8px; /* Espacio para que el scroll no tape el texto */
    flex-grow: 1; /* Ocupa el espacio restante de la tarjeta */
}

/* --- Personalización del Scrollbar para que se vea Premium --- */
#system-alerts-list::-webkit-scrollbar {
    width: 5px; /* Scrollbar delgadito */
}

#system-alerts-list::-webkit-scrollbar-track {
    background: transparent; 
}

#system-alerts-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3); /* Color gris azulado suave */
    border-radius: 10px;
}

#system-alerts-list::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5); 
}

/* Aseguramos que las alertas mantengan su estilo de color */
.alert-item.danger {
    background: rgba(239, 68, 68, 0.1) !important;
    border-left: 4px solid #ef4444 !important;
    color: #ef4444 !important;
}

.alert-item.warning {
    background: rgba(251, 191, 36, 0.15) !important; /* Amarillo transparente */
    border-left: 4px solid #fbbf24 !important;
    color: #d97706 !important;
}
