/**
 * Estilos para el módulo de Informes - Diseño moderno con filtros superiores
 */

/* Variables locales */
:root {
    --color-primary: #6366f1;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

/* Contenedor principal nuevo */
.informes-container-nuevo {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
    background: var(--bg-primary);
    overflow: hidden;
}

@media (max-width: 768px) {
    .informes-container-nuevo {
        height: calc(100vh - 60px);
    }
}

/* Contenedor principal dividido (mantener para compatibilidad) */
.informes-container-split {
    display: flex;
    height: calc(100vh - 100px);
    gap: 0;
    background: var(--bg-primary);
}

/* ========================================
   SIDEBAR IZQUIERDO (30%)
   ======================================== */
.informes-sidebar {
    width: 30%;
    min-width: 320px;
    max-width: 400px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header del sidebar */
#informes .sidebar-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-header p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Filtros del sidebar */
.sidebar-filtros {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-primary);
}

.sidebar-filtros label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.sidebar-filtros .input-field {
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.sidebar-filtros .input-field:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Árbol de informes */
.informes-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Scrollbar personalizado para el árbol */
.informes-tree::-webkit-scrollbar {
    width: 6px;
}

.informes-tree::-webkit-scrollbar-track {
    background: transparent;
}

.informes-tree::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.informes-tree::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Categoría del árbol */
.tree-categoria {
    margin-bottom: 0.25rem;
}

.tree-categoria-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
    user-select: none;
}

.tree-categoria-header:hover {
    background: var(--bg-primary);
}

.tree-categoria-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.tree-categoria.expanded .tree-categoria-icon {
    transform: rotate(90deg);
}

.tree-categoria-header .tree-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.tree-categoria-header span {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

/* Items de la categoría */
.tree-categoria-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-left: 0.5rem;
}

.tree-categoria.expanded .tree-categoria-items {
    max-height: 1000px;
}

/* Item individual del árbol */
.tree-informe-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    margin: 0.125rem 0;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    position: relative;
}

.tree-informe-item:hover {
    background: var(--bg-primary);
}

.tree-informe-item.selected {
    background: rgba(99, 102, 241, 0.1);
}

.tree-informe-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: var(--color-primary);
    border-radius: 0 2px 2px 0;
}

.tree-item-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.tree-informe-item:hover .tree-item-dot {
    background: var(--color-primary);
    transform: scale(1.3);
}

.tree-informe-item.selected .tree-item-dot {
    background: var(--color-primary);
}

.tree-item-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
    transition: color 0.15s ease;
}

.tree-informe-item:hover .tree-item-text {
    color: var(--text-primary);
}

.tree-informe-item.selected .tree-item-text {
    color: var(--color-primary);
    font-weight: 500;
}

/* ========================================
   NUEVO DISEÑO - BARRA DE FILTROS SUPERIOR
   ======================================== */
.informes-filtros-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.filtros-bar-header {
    padding: 1.25rem 2rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filtros-bar-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Botón toggle para móvil */
.btn-toggle-filtros-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.btn-toggle-filtros-mobile:hover {
    background: var(--bg-secondary);
    border-color: var(--color-primary);
}

.btn-toggle-filtros-mobile svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.filtros-bar-title svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.filtros-bar-title h2 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filtros-bar-content {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    padding: 1.25rem 2rem;
    flex-wrap: wrap;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

/* Grupo de filtro */
.filtro-grupo {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 180px;
}

.filtro-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filtro-label svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Grupo de fechas */
.filtro-fechas {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filtro-separator {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Inputs de filtros */
.filtro-input,
.filtro-select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s ease;
    min-width: 140px;
}

.filtro-input:focus,
.filtro-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filtro-input:disabled,
.filtro-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

.filtro-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

.filtro-select:disabled {
    cursor: not-allowed;
}

/* Botón generar informe */
.btn-generar-informe {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    background: var(--color-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: auto;
}

.btn-generar-informe:hover:not(:disabled) {
    background: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-generar-informe:active:not(:disabled) {
    transform: translateY(0);
}

.btn-generar-informe:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-generar-informe svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* Área de resultados */
.informes-resultados-area {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
}

/* Scrollbar para área de resultados */
.informes-resultados-area::-webkit-scrollbar {
    width: 8px;
}

.informes-resultados-area::-webkit-scrollbar-track {
    background: transparent;
}

.informes-resultados-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.informes-resultados-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========================================
   CONTENIDO DERECHO (70%) - DISEÑO ANTIGUO
   ======================================== */
.informes-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
}

/* Scrollbar para el contenido */
.informes-content::-webkit-scrollbar {
    width: 8px;
}

.informes-content::-webkit-scrollbar-track {
    background: transparent;
}

.informes-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.informes-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Empty state */
.informe-content-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 3rem;
    text-align: center;
}

.empty-state-icon {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    opacity: 0.3;
}

.informe-content-empty h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.informe-content-empty p {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    max-width: 400px;
}

/* Resultado del informe */
#informe-resultado {
    padding: 2rem;
    animation: fadeInContent 0.3s ease;
}

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

/* Header del informe */
.informe-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.informe-titulo {
    flex: 1;
}

.informe-titulo h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.informe-titulo p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Botones de exportación */
.informe-acciones {
    display: flex;
    gap: 0.75rem;
}

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-export:hover {
    background: var(--bg-primary);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-export svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Gráficos */
.informe-graficos {
    margin-bottom: 2rem;
}

.graficos-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.graficos-wrapper-single {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.grafico-col {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.grafico-col h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Filtro búsqueda (Ventas por cliente) — justo encima de la tabla */
.informe-filtro-busqueda {
    margin-bottom: 0;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}

.informe-buscar-cliente-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.informe-buscar-cliente-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.informe-buscar-cliente-input {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    padding: 0.5rem 0.875rem 0.5rem 2.25rem;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.informe-buscar-cliente-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}

.informe-buscar-cliente-input:hover {
    border-color: #c4c8cc;
}

.informe-buscar-cliente-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.informe-buscar-cliente-bar {
    position: relative;
}

.informe-buscar-cliente-bar .informe-buscar-cliente-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.informe-buscar-cliente-bar .informe-buscar-cliente-input {
    padding-left: 15px;
}

.informe-buscar-cliente-btn {
    padding: 0.5rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-primary);
    border: none;
    border-radius: 8px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.05s ease;
}

.informe-buscar-cliente-btn:hover {
    background: #4f46e5;
}

.informe-buscar-cliente-btn:active {
    transform: scale(0.98);
}

/* Cuando hay filtro visible, la tabla une su borde superior con el bloque de búsqueda */
.informe-filtro-busqueda:not(.d-none) + .informe-tabla {
    border-radius: 0 0 12px 12px;
}

/* Tabla de informe */
.informe-tabla {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Wrapper: scroll horizontal y min-width 0 para que no se solapen columnas (estilo clientes/proveedores) */
.informe-tabla .table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

.informe-tabla .table-wrapper table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    table-layout: fixed;
}

.informe-tabla th,
.informe-tabla td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.informe-tabla thead th {
    background: var(--bg-primary);
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

.informe-tabla tbody tr {
    transition: background 0.15s ease;
}

.informe-tabla tbody tr:hover {
    background: var(--bg-primary);
}

.informe-tabla tbody tr:last-child td {
    border-bottom: none;
}

.informe-tabla td {
    color: var(--text-primary);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Contenido de celdas: no solapar columnas (ellipsis si es largo) */
.informe-tabla td span,
.informe-tabla td > div {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Informe Productos y Stock: sin ellipsis, columnas al contenido, scroll horizontal (estilo clientes/proveedores) */
.informe-tabla.informe-productos-stock .table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    min-width: 0;
}
.informe-tabla.informe-productos-stock .table-wrapper table {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}
.informe-tabla.informe-productos-stock td {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}
.informe-tabla.informe-productos-stock td span,
.informe-tabla.informe-productos-stock td > div {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

/* Estados de carga */
.informe-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-secondary);
}

.informe-loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty state dentro de gráficos/tablas */
.informe-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.informe-empty h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.informe-empty p {
    margin: 0;
    font-size: 0.875rem;
}

/* Utilidades */
.d-none {
    display: none !important;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.text-center {
    text-align: center;
}

.p-4 {
    padding: 1.5rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
    /* Diseño antiguo */
    .informes-sidebar {
        width: 35%;
        min-width: 280px;
    }

    /* Diseño nuevo */
    .filtros-bar-content {
        gap: 1rem;
    }

    .filtro-grupo {
        min-width: 150px;
    }

    .graficos-wrapper {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 968px) {
    /* Diseño antiguo */
    .informes-container-split {
        flex-direction: column;
        height: auto;
    }

    .informes-sidebar {
        width: 100%;
        max-width: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 400px;
    }

    .informes-content {
        min-height: 600px;
    }

    /* Diseño nuevo */
    .filtros-bar-header {
        padding: 1rem 1.5rem 0.75rem;
    }

    .filtros-bar-title h2 {
        font-size: 1.25rem;
    }

    .filtros-bar-content {
        padding: 1rem 1.5rem;
        flex-direction: column;
        align-items: stretch;
    }

    .filtro-grupo {
        width: 100%;
        min-width: 100%;
    }

    .btn-generar-informe {
        margin-left: 0;
        width: 100%;
    }

    /* Resultados */
    .informe-header {
        flex-direction: column;
        gap: 1rem;
    }

    .informe-acciones {
        width: 100%;
    }

    .btn-export {
        flex: 1;
        justify-content: center;
    }

    #informe-resultado {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* Diseño nuevo - Móvil */
    .informes-filtros-bar {
        position: relative;
        border-bottom: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .filtros-bar-header {
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .btn-toggle-filtros-mobile {
        display: flex;
    }

    .filtros-bar-title h2 {
        font-size: 1.125rem;
    }

    .filtros-bar-content {
        max-height: 0;
        padding: 0 1rem;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    }

    .informes-filtros-bar.filtros-expanded .filtros-bar-content {
        max-height: 1000px;
        padding: 1rem;
        opacity: 1;
        border-top: 1px solid var(--border-color);
    }

    .filtro-grupo {
        width: 100%;
        min-width: 100%;
    }

    .filtro-fechas {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .filtro-separator {
        transform: rotate(90deg);
    }

    .filtro-input,
    .filtro-select {
        width: 100%;
    }

    .btn-generar-informe {
        margin-left: 0;
        width: 100%;
    }

    /* Área de resultados ocupa todo el espacio disponible */
    .informes-resultados-area {
        flex: 1;
        min-height: 0;
        transition: flex 0.3s ease;
    }

    /* Cuando los filtros están expandidos, el área de resultados se ajusta automáticamente */
    .informes-filtros-bar.filtros-expanded {
        flex-shrink: 0;
    }

    /* Resultados */
    .informe-titulo h2 {
        font-size: 1.5rem;
    }

    .informe-acciones {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    /* Diseño antiguo */
    .sidebar-header {
        padding: 1rem;
    }

    .sidebar-filtros {
        padding: 1rem;
    }

    .tree-categoria-header span {
        font-size: 0.8125rem;
    }

    .tree-item-text {
        font-size: 0.75rem;
    }

    /* Diseño nuevo */
    .filtros-bar-header {
        padding: 0.875rem;
    }

    .filtros-bar-title h2 {
        font-size: 1rem;
    }

    .informes-filtros-bar.filtros-expanded .filtros-bar-content {
        padding: 0.875rem;
    }
}

/* Animaciones suaves */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   INFORME DE VENTAS - ESTILOS MEJORADOS
   ======================================== */

.informe-ventas-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Tabla de ventas mejorada */
.table-ventas-informe {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-ventas-informe th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    padding: 1rem 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
    border: none;
}

.table-ventas-informe th:first-child {
    border-radius: 8px 0 0 0;
}

.table-ventas-informe th:last-child {
    border-radius: 0 8px 0 0;
}

.table-ventas-informe td {
    padding: 0.875rem 0.875rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-ventas-informe tbody tr {
    transition: all 0.2s ease;
}

.table-ventas-informe tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
    transform: translateX(2px);
}

.table-ventas-informe tbody tr:nth-child(even) {
    background: rgba(249, 250, 251, 0.5);
}

.table-ventas-informe tbody tr:nth-child(even):hover {
    background: rgba(99, 102, 241, 0.08);
}

/* Columnas específicas */
.table-ventas-informe .col-fecha {
    font-weight: 500;
    color: var(--text-primary);
}

.table-ventas-informe .text-right {
    text-align: right;
}

.table-ventas-informe .text-center {
    text-align: center;
}

/* Badges para tickets y comensales */
.badge-tickets,
.badge-comensales {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 1.75rem;
    padding: 0 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.8125rem;
}

.badge-tickets {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.badge-comensales {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge-tickets-total,
.badge-comensales-total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2rem;
    padding: 0 0.625rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.875rem;
}

.badge-tickets-total {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.badge-comensales-total {
    background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    color: white;
}

/* Fila de totales */
.table-ventas-informe tfoot .table-total-row {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 2px solid #667eea;
}

.table-ventas-informe tfoot .table-total-row td {
    padding: 1rem 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: none;
}

.table-ventas-informe tfoot .table-total-row td:first-child {
    border-radius: 0 0 0 8px;
}

.table-ventas-informe tfoot .table-total-row td:last-child {
    border-radius: 0 0 8px 0;
}

.total-highlight {
    font-size: 1.125rem;
    color: #667eea !important;
    text-shadow: 0 1px 2px rgba(102, 126, 234, 0.2);
}

/* Tarjetas de resumen */
.ventas-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.summary-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.summary-card.summary-card-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

.summary-card.summary-card-primary .summary-label {
    color: rgba(255, 255, 255, 0.85);
}

.summary-card.summary-card-primary .summary-value {
    color: white;
}

.summary-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    flex-shrink: 0;
}

.summary-card.summary-card-primary .summary-icon {
    background: rgba(255, 255, 255, 0.2);
}

.summary-content {
    flex: 1;
    min-width: 0;
}

.summary-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Responsive para tabla de ventas */
@media (max-width: 1024px) {
    .table-ventas-informe th,
    .table-ventas-informe td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }

    .table-ventas-informe th {
        font-size: 0.6875rem;
    }
}

@media (max-width: 768px) {
    .informe-ventas-container .table-wrapper {
        overflow-x: auto;
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }

    .table-ventas-informe {
        min-width: 700px;
    }

    .ventas-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-card {
        padding: 1rem;
    }

    .summary-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .summary-value {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .ventas-summary-cards {
        grid-template-columns: 1fr;
    }
    
    .summary-card.summary-card-primary {
        grid-column: 1 / -1;
    }
}

/* Fila total para tablas generales */
.table-total-row {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    font-weight: 600;
}

.table-total-row td {
    border-top: 2px solid var(--color-primary) !important;
}

/* ========================================
   DESGLOSE DE VENTAS - ESTILOS MEJORADOS
   ======================================== */

.desglose-ventas-visual {
    margin-bottom: 1.5rem;
}

.desglose-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Columna del gráfico */
.desglose-grafico-col {
    min-width: 0;
}

.desglose-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.desglose-card h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.desglose-subtitle {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Columna de resumen */
.desglose-resumen-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Tarjeta de ventas totales */
.desglose-total-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-radius: 12px;
    color: white;
}

.desglose-total-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    font-size: 1.75rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    flex-shrink: 0;
}

.desglose-total-content {
    flex: 1;
}

.desglose-total-label {
    display: block;
    font-size: 0.8125rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.desglose-total-valor {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

/* ========================================
   Informe de Promociones
   ======================================== */
.informe-promociones-vista {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.promociones-resumen {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.promociones-total-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 12px;
    color: white;
    min-width: 200px;
}

.promociones-total-label {
    display: block;
    font-size: 0.8125rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.promociones-total-valor {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.promociones-top-clientes {
    flex: 1;
    min-width: 260px;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.promociones-top-clientes h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.promociones-top-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.promociones-top-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.promociones-top-list li:last-child {
    border-bottom: none;
}

.promociones-top-list .cliente-nombre {
    font-weight: 500;
    color: var(--text-primary);
}

.promociones-top-list .cliente-beneficio {
    color: #059669;
    font-weight: 600;
}

.promociones-top-list .cliente-num {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.promociones-grafico-wrap {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.promociones-grafico-wrap h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cascada de desglose */
.desglose-cascada {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.cascada-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.cascada-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.cascada-item.negativo .cascada-valor {
    color: #dc2626;
}

.cascada-item.resultado {
    margin-top: 0.5rem;
}

.cascada-item.positivo {
    background: rgba(0, 200, 83, 0.1);
}

.cascada-item.positivo .cascada-valor {
    color: #00C853;
}

.cascada-item.negativo-result {
    background: rgba(211, 47, 47, 0.1);
}

.cascada-item.negativo-result .cascada-valor {
    color: #D32F2F;
}

.cascada-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.125rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    flex-shrink: 0;
}

.cascada-content {
    flex: 1;
    min-width: 0;
}

.cascada-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.125rem;
}

.cascada-valor {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cascada-porcentaje {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.25rem 0.625rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    flex-shrink: 0;
}

.cascada-porcentaje.highlight {
    background: var(--color-primary);
    color: white;
}

.cascada-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* Tabla de desglose */
.desglose-tabla-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.table-desglose th {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    font-weight: 600;
    padding: 1rem 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
    border: none;
}

.table-desglose th:first-child {
    border-radius: 8px 0 0 0;
}

.table-desglose th:last-child {
    border-radius: 0 8px 0 0;
}

.table-desglose td {
    padding: 1rem 0.875rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-desglose tbody tr {
    transition: all 0.2s ease;
}

.table-desglose tbody tr:hover {
    background: rgba(76, 175, 80, 0.05);
}

/* Filas especiales */
.table-desglose .fila-ventas-total {
    background: linear-gradient(135deg, #4CAF5010 0%, #4CAF5020 100%);
}

.table-desglose .fila-ventas-total td {
    font-weight: 600;
    border-top: 2px solid #4CAF50;
}

.table-desglose .fila-beneficio-positivo {
    background: linear-gradient(135deg, #00C85310 0%, #00C85320 100%);
}

.table-desglose .fila-beneficio-positivo td {
    font-weight: 600;
    color: #00C853;
}

.table-desglose .fila-beneficio-negativo {
    background: linear-gradient(135deg, #D32F2F10 0%, #D32F2F20 100%);
}

.table-desglose .fila-beneficio-negativo td {
    font-weight: 600;
    color: #D32F2F;
}

/* Columnas */
.table-desglose .col-concepto {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.concepto-icon {
    font-size: 1.125rem;
}

.concepto-nombre {
    font-weight: 500;
}

.badge-porcentaje {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.8125rem;
}

/* Barra de distribución */
.barra-container {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.barra-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Métricas de desglose */
.desglose-metricas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.metrica-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.metrica-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.metrica-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
    border-radius: 10px;
    flex-shrink: 0;
}

.metrica-content {
    flex: 1;
    min-width: 0;
}

.metrica-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.125rem;
}

.metrica-valor {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Responsive para desglose */
@media (max-width: 1024px) {
    .desglose-grid {
        grid-template-columns: 1fr;
    }

    .desglose-metricas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .desglose-total-valor {
        font-size: 1.5rem;
    }

    .desglose-metricas-grid {
        grid-template-columns: 1fr 1fr;
    }

    .metrica-card {
        padding: 0.875rem;
    }

    .metrica-valor {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .desglose-metricas-grid {
        grid-template-columns: 1fr;
    }

    .cascada-item {
        flex-wrap: wrap;
    }

    .cascada-porcentaje {
        margin-left: auto;
    }
}

/* ========================================
   ESTILOS PARA VENTAS POR PRODUCTO
   ======================================== */
.ventas-producto-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Tabla de ventas por producto */
.table-ventas-producto {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-ventas-producto thead th {
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 0.875rem 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8125rem;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

.table-ventas-producto thead th:first-child {
    border-radius: 8px 0 0 0;
}

.table-ventas-producto thead th:last-child {
    border-radius: 0 8px 0 0;
}

.table-ventas-producto tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

.table-ventas-producto tbody tr:hover {
    background-color: #f8fafc;
}

.table-ventas-producto tbody tr.fila-top {
    background: var(--bg-secondary);
}

.table-ventas-producto tbody tr.fila-top:hover {
    background: #f1f5f9;
}

.table-ventas-producto tbody tr.fila-sin-ventas {
    opacity: 0.6;
    background-color: #fafafa;
}

.table-ventas-producto tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table-ventas-producto .col-producto {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-ventas-producto .producto-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #6366f1;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.table-ventas-producto tbody tr.fila-top .producto-rank {
    background: var(--color-primary);
    color: white;
}

.table-ventas-producto .producto-nombre {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.table-ventas-producto .badge-cantidad {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 0.25rem 0.625rem;
    background: #ecfdf5;
    color: #059669;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8125rem;
}

.table-ventas-producto .badge-tickets-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 0.2rem 0.5rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.75rem;
}

.table-ventas-producto .sin-ventas {
    color: #9ca3af;
}

/* Fila de totales */
.table-ventas-producto tfoot tr.table-total-row {
    background: var(--bg-primary);
    border-top: 2px solid var(--border-color);
    color: var(--text-primary);
}

.table-ventas-producto tfoot tr.table-total-row td {
    padding: 1rem;
    font-weight: 600;
}

.table-ventas-producto tfoot tr.table-total-row td:first-child {
    border-radius: 0 0 0 8px;
}

.table-ventas-producto tfoot tr.table-total-row td:last-child {
    border-radius: 0 0 8px 0;
}

.table-ventas-producto .badge-cantidad-total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.875rem;
}

.table-ventas-producto .total-highlight {
    font-size: 1.125rem;
    color: var(--text-primary);
    font-weight: 700;
}

/* Tarjetas de resumen para ventas por producto */
.ventas-producto-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.ventas-producto-summary .summary-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.ventas-producto-summary .summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ventas-producto-summary .summary-card.summary-card-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    color: white;
}

.ventas-producto-summary .summary-card.summary-card-primary .summary-icon {
    background: rgba(255, 255, 255, 0.2);
}

.ventas-producto-summary .summary-card.summary-card-primary .summary-label {
    color: rgba(255, 255, 255, 0.85);
}

.ventas-producto-summary .summary-card.summary-card-primary .summary-value {
    color: white;
}

.ventas-producto-summary .summary-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #f1f5f9;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.ventas-producto-summary .summary-content {
    flex: 1;
    min-width: 0;
}

.ventas-producto-summary .summary-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.125rem;
}

.ventas-producto-summary .summary-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Responsive para ventas por producto */
@media (max-width: 1200px) {
    .ventas-producto-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .table-ventas-producto .producto-nombre {
        max-width: 150px;
    }

    .ventas-producto-summary {
        grid-template-columns: 1fr 1fr;
    }

    .ventas-producto-summary .summary-card {
        padding: 0.875rem;
    }

    .ventas-producto-summary .summary-value {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .ventas-producto-summary {
        grid-template-columns: 1fr;
    }

    .table-ventas-producto thead th,
    .table-ventas-producto tbody td {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    .table-ventas-producto .producto-nombre {
        max-width: 100px;
        font-size: 0.8125rem;
    }
}

/* ========================================
   ESTILOS PARA VENTAS POR CATEGORÍA
   ======================================== */
.ventas-categoria-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Tabla de ventas por categoría */
.table-ventas-categoria {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-ventas-categoria thead th {
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 0.875rem 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8125rem;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

.table-ventas-categoria thead th:first-child {
    border-radius: 8px 0 0 0;
}

.table-ventas-categoria thead th:last-child {
    border-radius: 0 8px 0 0;
}

.table-ventas-categoria tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

.table-ventas-categoria tbody tr:hover {
    background-color: #f8fafc;
}

.table-ventas-categoria tbody tr.fila-top {
    background: var(--bg-secondary);
}

.table-ventas-categoria tbody tr.fila-top:hover {
    background: #f1f5f9;
}

.table-ventas-categoria tbody tr.fila-sin-ventas {
    opacity: 0.6;
    background-color: #fafafa;
}

.table-ventas-categoria tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table-ventas-categoria .col-categoria {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-ventas-categoria .categoria-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #d1fae5;
    color: #059669;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.table-ventas-categoria tbody tr.fila-top .categoria-rank {
    background: var(--color-primary);
    color: white;
}

.table-ventas-categoria .categoria-nombre {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.table-ventas-categoria .badge-cantidad,
.table-ventas-categoria .badge-productos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 0.25rem 0.625rem;
    background: #ecfdf5;
    color: #059669;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8125rem;
}

.table-ventas-categoria .badge-productos {
    background: #f0fdf4;
    color: #16a34a;
}

.table-ventas-categoria .badge-tickets-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 0.2rem 0.5rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.75rem;
}

.table-ventas-categoria .sin-ventas {
    color: #9ca3af;
}

/* Barra de porcentaje */
.table-ventas-categoria .porcentaje-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
}

.table-ventas-categoria .porcentaje-bar {
    height: 8px;
    background: linear-gradient(90deg, #059669 0%, #10b981 100%);
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.3s ease;
}

.table-ventas-categoria .porcentaje-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #059669;
    white-space: nowrap;
}

/* Fila de totales */
.table-ventas-categoria tfoot tr.table-total-row {
    background: var(--bg-primary);
    border-top: 2px solid var(--border-color);
    color: var(--text-primary);
}

.table-ventas-categoria tfoot tr.table-total-row td {
    padding: 1rem;
    font-weight: 600;
}

.table-ventas-categoria tfoot tr.table-total-row td:first-child {
    border-radius: 0 0 0 8px;
}

.table-ventas-categoria tfoot tr.table-total-row td:last-child {
    border-radius: 0 0 8px 0;
}

.table-ventas-categoria .badge-cantidad-total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.875rem;
}

.table-ventas-categoria .badge-total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.625rem;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.75rem;
}

.table-ventas-categoria .total-highlight {
    font-size: 1.125rem;
    color: #6ee7b7;
}

/* Tarjetas de resumen para ventas por categoría */
.ventas-categoria-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.ventas-categoria-summary .summary-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.ventas-categoria-summary .summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ventas-categoria-summary .summary-card.summary-card-primary {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: none;
    color: white;
}

.ventas-categoria-summary .summary-card.summary-card-primary .summary-icon {
    background: rgba(255, 255, 255, 0.2);
}

.ventas-categoria-summary .summary-card.summary-card-primary .summary-label {
    color: rgba(255, 255, 255, 0.85);
}

.ventas-categoria-summary .summary-card.summary-card-primary .summary-value {
    color: white;
}

.ventas-categoria-summary .summary-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #ecfdf5;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.ventas-categoria-summary .summary-content {
    flex: 1;
    min-width: 0;
}

.ventas-categoria-summary .summary-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.125rem;
}

.ventas-categoria-summary .summary-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Responsive para ventas por categoría */
@media (max-width: 1200px) {
    .ventas-categoria-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .table-ventas-categoria .categoria-nombre {
        max-width: 120px;
    }

    .table-ventas-categoria .porcentaje-bar-container {
        min-width: 80px;
    }

    .ventas-categoria-summary {
        grid-template-columns: 1fr 1fr;
    }

    .ventas-categoria-summary .summary-card {
        padding: 0.875rem;
    }

    .ventas-categoria-summary .summary-value {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .ventas-categoria-summary {
        grid-template-columns: 1fr;
    }

    .table-ventas-categoria thead th,
    .table-ventas-categoria tbody td {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    .table-ventas-categoria .categoria-nombre {
        max-width: 80px;
        font-size: 0.8125rem;
    }

    .table-ventas-categoria .porcentaje-bar-container {
        min-width: 60px;
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* ========================================
   ESTILOS PARA CIERRES DE CAJA
   ======================================== */
.cierres-caja-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Grid de tarjetas de resumen superiores */
.cierres-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.cierre-summary-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.cierre-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cierre-summary-card.primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
    border: none;
    color: white;
}

.cierre-summary-card.primary .cierre-icon {
    background: rgba(255, 255, 255, 0.2);
}

.cierre-summary-card.primary .cierre-summary-label {
    color: rgba(255, 255, 255, 0.85);
}

.cierre-summary-card.primary .cierre-summary-value {
    color: white;
}

.cierre-summary-card.positive {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: none;
    color: white;
}

.cierre-summary-card.positive .cierre-icon {
    background: rgba(255, 255, 255, 0.2);
}

.cierre-summary-card.positive .cierre-summary-label,
.cierre-summary-card.positive .cierre-summary-value {
    color: white;
}

.cierre-summary-card.negative {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    border: none;
    color: white;
}

.cierre-summary-card.negative .cierre-icon {
    background: rgba(255, 255, 255, 0.2);
}

.cierre-summary-card.negative .cierre-summary-label,
.cierre-summary-card.negative .cierre-summary-value {
    color: white;
}

.cierre-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #f1f5f9;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.cierre-summary-content {
    flex: 1;
    min-width: 0;
}

.cierre-summary-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.125rem;
}

.cierre-summary-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Desglose por método de pago */
.cierres-metodos-pago {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.metodo-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.metodo-card.efectivo {
    border-left: 4px solid #22c55e;
}

.metodo-card.tarjeta {
    border-left: 4px solid #3b82f6;
}

.metodo-card.otros {
    border-left: 4px solid #8b5cf6;
}

.metodo-icon {
    font-size: 1.5rem;
}

.metodo-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.metodo-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metodo-valor {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metodo-porcentaje {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: #f1f5f9;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
}

/* Tabla de cierres de caja */
.table-cierres-caja {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table-cierres-caja thead th {
    background: #333;
    color: white;
    padding: 0.875rem 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.table-cierres-caja thead th:first-child {
    border-radius: 8px 0 0 0;
}

.table-cierres-caja thead th:last-child {
    border-radius: 0 8px 0 0;
}

.table-cierres-caja tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

.table-cierres-caja tbody tr:hover {
    background-color: #f8fafc;
}

.table-cierres-caja tbody td {
    padding: 0.625rem 0.75rem;
    vertical-align: middle;
}

.table-cierres-caja .fecha-cell {
    display: flex;
    flex-direction: column;
}

.table-cierres-caja .fecha-fecha {
    font-size: 0.8125rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.table-cierres-caja .badge-tickets,
.table-cierres-caja .badge-comensales {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.8125rem;
}

.table-cierres-caja .badge-tickets {
    background: #dbeafe;
    color: #1d4ed8;
}

.table-cierres-caja .badge-comensales {
    background: #fef3c7;
    color: #b45309;
}

.table-cierres-caja .descuadre-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.75rem;
    white-space: nowrap;
}

.table-cierres-caja .descuadre-badge.neutral {
    background: #f1f5f9;
    color: #64748b;
}

.table-cierres-caja .descuadre-badge.positive {
    background: #dcfce7;
    color: #15803d;
}

.table-cierres-caja .descuadre-badge.negative {
    background: #fee2e2;
    color: #b91c1c;
}

.table-cierres-caja .usuario-nombre {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    display: block;
}

/* Fila de totales para cierres */
.table-cierres-caja tfoot tr.table-total-row {
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 100%);
    color: white;
}

.table-cierres-caja tfoot tr.table-total-row td {
    padding: 0.875rem 0.75rem;
    font-weight: 600;
}

.table-cierres-caja tfoot tr.table-total-row td:first-child {
    border-radius: 0 0 0 8px;
}

.table-cierres-caja tfoot tr.table-total-row td:last-child {
    border-radius: 0 0 8px 0;
}

.table-cierres-caja .badge-total {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8125rem;
}

.table-cierres-caja .total-highlight {
    font-size: 1.0625rem;
    color: #7dd3fc;
}

/* Responsive para cierres de caja */
@media (max-width: 1400px) {
    .cierres-summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .cierres-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cierres-metodos-pago {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cierres-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cierre-summary-card {
        padding: 0.875rem;
    }

    .cierre-summary-value {
        font-size: 1.125rem;
    }

    .table-cierres-caja thead th,
    .table-cierres-caja tbody td {
        padding: 0.5rem 0.5rem;
        font-size: 0.75rem;
    }

    .table-cierres-caja .fecha-fecha {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .cierres-summary-grid {
        grid-template-columns: 1fr;
    }

    .table-cierres-caja {
        font-size: 0.6875rem;
    }

    .table-cierres-caja thead th {
        font-size: 0.625rem;
        padding: 0.5rem 0.375rem;
    }

    .table-cierres-caja tbody td {
        padding: 0.375rem;
    }
}

/* Hint para tabla clickable */
.table-hint {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

/* Filas clickables en cierres de caja */
.cierre-row-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.cierre-row-clickable:hover {
    background-color: #e0f2fe !important;
    transform: scale(1.005);
}

.cierre-row-clickable:active {
    transform: scale(0.995);
}

/* ========================================
   MODAL DE DETALLE DE CIERRE DE CAJA
   ======================================== */
.cierre-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-cierre-detalle {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
}

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

.modal-cierre-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
    color: white;
}

.modal-cierre-title h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-cierre-subtitle {
    margin: 0.25rem 0 0 0;
    opacity: 0.9;
    font-size: 0.875rem;
}

.modal-cierre-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-cierre-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-cierre-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
}

.cierre-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cierre-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.cierre-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Información del turno */
.turno-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
}

.turno-info-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 10px;
}

.turno-info-item.highlight {
    background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
    color: white;
}

.turno-info-item.highlight .turno-label {
    color: rgba(255, 255, 255, 0.8);
}

.turno-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.turno-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.turno-info-item.highlight .turno-value {
    color: white;
    font-size: 1.125rem;
}

.turno-user {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.turno-info-item.highlight .turno-user {
    color: rgba(255, 255, 255, 0.8);
}

/* Resumen de ventas */
.ventas-resumen-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.venta-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 10px;
}

.venta-stat.primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
    color: white;
}

.venta-stat.highlight {
    background: #fef3c7;
    border: 1px solid #fbbf24;
}

.venta-stat.full-width {
    grid-column: 1 / -1;
    flex-direction: row;
    gap: 1rem;
    justify-content: center;
}

.venta-stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.venta-stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.venta-stat.primary .venta-stat-label {
    color: rgba(255, 255, 255, 0.8);
}

.venta-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.venta-stat.primary .venta-stat-value {
    color: white;
}

/* Desglose fiscal */
.fiscal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fiscal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.fiscal-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.fiscal-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.desglose-iva-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.iva-item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    background: #f1f5f9;
    border-radius: 8px;
    border-left: 3px solid #0ea5e9;
}

.iva-tipo {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.iva-base, .iva-cuota {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Métodos de pago detalle */
.metodos-pago-detalle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.metodo-detalle {
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
}

.metodo-detalle.efectivo {
    border-top: 3px solid #22c55e;
}

.metodo-detalle.tarjeta {
    border-top: 3px solid #3b82f6;
}

.metodo-detalle.otros {
    border-top: 3px solid #8b5cf6;
}

.metodo-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.metodo-icono {
    font-size: 1.25rem;
}

.metodo-nombre {
    font-weight: 600;
    color: var(--text-primary);
}

.metodo-datos {
    padding: 0.75rem 1rem;
}

.metodo-row {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.metodo-row.total {
    font-weight: 600;
    color: var(--text-primary);
    border-top: 1px dashed var(--border-color);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}

.metodo-row.descuadre {
    font-weight: 700;
    padding: 0.5rem;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.metodo-row.descuadre.neutral {
    background: #f1f5f9;
    color: #64748b;
}

.metodo-row.descuadre.positive {
    background: #dcfce7;
    color: #15803d;
}

.metodo-row.descuadre.negative {
    background: #fee2e2;
    color: #b91c1c;
}

/* Ajustes y descuentos */
.ajustes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.ajuste-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 10px;
}

.ajuste-item.warning {
    background: #fef3c7;
    border: 1px solid #fbbf24;
}

.ajuste-item.info {
    background: #dbeafe;
    border: 1px solid #3b82f6;
}

.ajuste-icon {
    font-size: 1.5rem;
}

.ajuste-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.ajuste-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Descuadre total section */
.descuadre-section {
    border-radius: 12px;
    padding: 1rem !important;
    margin-top: 1rem;
}

.descuadre-section.neutral {
    background: #f1f5f9;
}

.descuadre-section.positive {
    background: #dcfce7;
}

.descuadre-section.negative {
    background: #fee2e2;
}

.descuadre-total-box {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.descuadre-icon {
    font-size: 2.5rem;
}

.descuadre-info {
    flex: 1;
}

.descuadre-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.8;
}

.descuadre-value {
    font-size: 2rem;
    font-weight: 700;
}

.descuadre-section.neutral .descuadre-value { color: #64748b; }
.descuadre-section.positive .descuadre-value { color: #15803d; }
.descuadre-section.negative .descuadre-value { color: #b91c1c; }

.descuadre-status {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
}

/* Desglose de monedas */
.desglose-monedas {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.desglose-monedas h5 {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.monedas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.moneda-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 8px;
    text-align: center;
}

.moneda-valor {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.moneda-cantidad {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.moneda-total {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0ea5e9;
}

/* Responsive para modal de cierre */
@media (max-width: 768px) {
    .modal-cierre-detalle {
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
    }

    .modal-cierre-header {
        padding: 1rem 1.25rem;
    }

    .modal-cierre-title h2 {
        font-size: 1.25rem;
    }

    .modal-cierre-body {
        padding: 1rem 1.25rem;
    }

    .turno-info-grid {
        grid-template-columns: 1fr;
    }

    .ventas-resumen-grid {
        grid-template-columns: 1fr 1fr;
    }

    .fiscal-grid {
        grid-template-columns: 1fr;
    }

    .metodos-pago-detalle {
        grid-template-columns: 1fr;
    }

    .ajustes-grid {
        grid-template-columns: 1fr;
    }

    .descuadre-total-box {
        flex-wrap: wrap;
    }

    .descuadre-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .cierre-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-cierre-detalle {
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
    }

    .ventas-resumen-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   ESTILOS PARA INFORME DE GASTOS
   ========================================== */

.gastos-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Tarjetas de resumen de gastos */
.gastos-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.gasto-summary-card {
    background: var(--bg-card, #ffffff);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color, #e5e7eb);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gasto-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gasto-summary-card.primary {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
}

.gasto-summary-card.primary .gasto-summary-label {
    color: rgba(255, 255, 255, 0.85);
}

.gasto-summary-card.retiro {
    border-left: 4px solid #f97316;
}

.gasto-summary-card.gasto {
    border-left: 4px solid #8b5cf6;
}

.gasto-icon {
    font-size: 2rem;
    line-height: 1;
}

.gasto-summary-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gasto-summary-label {
    font-size: 0.8rem;
    color: var(--text-muted, #6b7280);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.gasto-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
}

.gasto-summary-card.primary .gasto-summary-value {
    color: white;
}

/* Tabla de gastos: table-layout fixed y anchos por columna para no solapar (estilo clientes/proveedores) */
.gastos-container .table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

.table-gastos {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
    table-layout: fixed;
}

.table-gastos th {
    background: var(--bg-muted, #f9fafb);
    color: var(--text-secondary, #374151);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
    white-space: nowrap;
}

.table-gastos td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Anchos por columna en informe de gastos (table-layout:fixed reparte a las celdas) */
.table-gastos th[data-sort="fecha"] { width: 90px; min-width: 90px; }
.table-gastos th[data-sort="descripcion"] { width: 160px; min-width: 160px; }
.table-gastos th[data-sort="tipo"] { width: 100px; min-width: 100px; }
.table-gastos th[data-sort="establecimiento"] { width: 120px; min-width: 120px; }
.table-gastos th[data-sort="usuario"] { width: 110px; min-width: 110px; }
.table-gastos th[data-sort="proveedor"] { width: 130px; min-width: 130px; }
.table-gastos th[data-sort="proveedor_nif"] { width: 110px; min-width: 110px; }
.table-gastos th[data-sort="categoria_gasto"] { width: 120px; min-width: 120px; }
.table-gastos th[data-sort="num_factura"] { width: 100px; min-width: 100px; }
.table-gastos th[data-sort="estado"] { width: 95px; min-width: 95px; }
.table-gastos th[data-sort="tiene_documento"] { width: 85px; min-width: 85px; }
.table-gastos th[data-sort="importe"] { width: 100px; min-width: 100px; }

.table-gastos .descripcion-gasto,
.table-gastos .proveedor-gasto,
.table-gastos .usuario-gasto,
.table-gastos .establecimiento-gasto,
.table-gastos .proveedor-nif-gasto,
.table-gastos .categoria-gasto,
.table-gastos .num-factura-gasto,
.table-gastos .estado-gasto,
.table-gastos .documento-gasto,
.table-gastos .importe-gasto {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.table-gastos tbody tr:hover {
    background: var(--bg-hover, #f9fafb);
}

/* Estilos de celdas */
.fecha-gasto {
    font-weight: 500;
    color: var(--text-primary, #111827);
}

.hora-gasto {
    color: var(--text-muted, #6b7280);
    font-size: 0.9rem;
}

.descripcion-gasto {
    font-weight: 500;
    color: var(--text-primary, #111827);
}

.usuario-gasto {
    color: var(--text-secondary, #374151);
    font-size: 0.9rem;
}

.establecimiento-gasto {
    color: var(--text-secondary, #374151);
    font-size: 0.85rem;
    background: var(--bg-muted, #f3f4f6);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.importe-gasto {
    font-weight: 600;
    color: #dc2626;
    font-size: 1rem;
}

/* Badges de tipo */
.badge-tipo {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-tipo.tipo-retiro {
    background: #fff7ed;
    color: #c2410c;
}

.badge-tipo.tipo-gasto {
    background: #f5f3ff;
    color: #6d28d9;
}

.badge-tipo.tipo-ingreso {
    background: #ecfdf5;
    color: #059669;
}

/* Fila de subtotal por día */
.subtotal-dia-row {
    background: var(--bg-muted, #f9fafb) !important;
}

.subtotal-dia-row td {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #374151);
    border-bottom: none;
}

/* Separador entre días */
.separador-fecha {
    height: 8px;
}

.separador-fecha td {
    background: transparent;
    border: none;
    padding: 0;
}

/* Fila de total general */
.table-gastos tfoot .table-total-row {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.table-gastos tfoot .table-total-row td {
    padding: 1rem;
    border-top: 2px solid #fca5a5;
    border-bottom: none;
}

.table-gastos .total-highlight {
    color: #dc2626;
    font-size: 1.25rem;
}

/* Responsive */
@media (max-width: 768px) {
    .gastos-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .gasto-summary-value {
        font-size: 1.25rem;
    }

    .table-gastos th,
    .table-gastos td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .badge-tipo {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .gastos-summary-grid {
        grid-template-columns: 1fr;
    }

    .gasto-summary-card {
        padding: 1rem;
    }
}

/* Barra de herramientas de gastos */
.gastos-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Caja de búsqueda */
.gastos-search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.gastos-search-input {
    width: 100%;
    padding: 0.75rem 2.5rem;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    font-size: 0.95rem;
    background: var(--bg-card, #ffffff);
    color: var(--text-primary, #111827);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gastos-search-input:focus {
    outline: none;
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.gastos-search-input::placeholder {
    color: var(--text-muted, #9ca3af);
}

.gastos-search-box .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
    opacity: 0.6;
}

.search-clear-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-muted, #e5e7eb);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
    transition: background 0.2s ease, color 0.2s ease;
}

.search-clear-btn:hover {
    background: #ef4444;
    color: white;
}

/* Contador de resultados */
.gastos-contador-resultados {
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    padding: 0.5rem 0;
}

/* Tabla ordenable */
.table-sortable th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.75rem;
    transition: background 0.2s ease;
}

.table-sortable th.sortable:hover {
    background: var(--bg-hover, #f3f4f6);
}

/* Indicador de ordenación */
.table-sortable th .sort-indicator {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    font-size: 0.7rem;
}

.table-sortable th .sort-indicator::after {
    content: '⇅';
}

.table-sortable th.sort-asc .sort-indicator {
    opacity: 1;
}

.table-sortable th.sort-asc .sort-indicator::after {
    content: '↑';
    color: #ef4444;
}

.table-sortable th.sort-desc .sort-indicator {
    opacity: 1;
}

.table-sortable th.sort-desc .sort-indicator::after {
    content: '↓';
    color: #ef4444;
}

/* Highlight en hover para filas */
.table-gastos tbody tr {
    transition: background 0.15s ease;
}

.table-gastos tbody tr:hover {
    background: rgba(239, 68, 68, 0.04);
}

/* Responsive para toolbar */
@media (max-width: 768px) {
    .gastos-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .gastos-search-box {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .gastos-search-input {
        padding: 0.625rem 2.25rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   Informe Histórico de Tickets: tachar sustituidos por rectificativa
   ======================================== */
#tabla-informe tr.ticket-sustituido-por-rectificativa td {
    text-decoration: line-through;
    color: var(--text-secondary);
}

#tabla-informe tr.ticket-sustituido-por-rectificativa td .sustituido-por-rectificativa {
    text-decoration: none;
    color: #b45309;
}

.sustituido-por-rectificativa {
    display: inline-block;
    margin-right: 0.35rem;
    padding: 0.15rem 0.4rem;
    background: #fef3c7;
    color: #b45309;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}
