* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --text-color: #333;
    --border-color: #ddd;
    --mesa-libre: #2ecc71;
    --mesa-ocupada: #e74c3c;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
}

.app-container {
    width: 100%;
    max-width: none;
    margin: 0;
    background: white;
    min-height: 100vh;
    box-shadow: none;
}

/* ========== HEADER ========== */
.header {
    background: var(--dark-color);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle, .toggle-sidebar-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
}

.menu-toggle { display: none; }
.toggle-sidebar-btn { display: flex; align-items: center; justify-content: center; }

.header h1 { font-size: 1.5rem; }
.user-info { margin-right: 1rem; }
.logout-btn { background: none; border: none; color: white; font-size: 1.2rem; cursor: pointer; padding: 0.5rem; border-radius: 5px; }

/* ========== LOGIN ========== */
.login-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 2rem;
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--dark-color);
}

/* ========== LAYOUT ========== */
.content-wrapper {
    display: flex;
    min-height: calc(100vh - 60px);
}

.side-menu {
    width: var(--sidebar-width);
    background: var(--light-color);
    padding: 1rem 0;
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
    overflow: hidden;
    flex-shrink: 0;
}

.side-menu.collapsed { width: var(--sidebar-collapsed-width); }
.side-menu.collapsed .menu-item span { display: none; }
.side-menu.collapsed .menu-item i { margin: 0; font-size: 1.4rem; }

.side-menu .menu-item {
    width: 100%;
    padding: 1rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    transition: background 0.3s;
    white-space: nowrap;
}

.side-menu .menu-item i { width: 25px; font-size: 1.2rem; flex-shrink: 0; }
.side-menu .menu-item:hover { background: rgba(52,152,219,0.1); }
.side-menu .menu-item.active { background: var(--primary-color); color: white; }

.main-content {
    flex: 1;
    padding: 1rem;
    overflow-x: auto;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Edición directa de categorías */
#categoriasTable .categoria-inline {
    width: 100%;
    min-width: 70px;
    padding: 0.35rem 0.45rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    font: inherit;
    color: inherit;
}

#categoriasTable .categoria-inline:hover,
#categoriasTable .categoria-inline:focus {
    border-color: var(--primary-color);
    background: white;
    outline: none;
}

#categoriasTable .categoria-color {
    width: 38px;
    min-width: 38px;
    height: 28px;
    padding: 1px;
    vertical-align: middle;
    cursor: pointer;
}

#categoriasTable .categoria-color-text {
    margin-left: 0.25rem;
    vertical-align: middle;
}

/* ========== VENTAS ========== */
.ventas-container {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1rem;
    height: calc(100vh - 80px);
}

.productos-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.categorias-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.categoria-tab {
    padding: 0.5rem 1rem;
    background: var(--light-color);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    font-size: 0.85rem;
}

.categoria-tab.active {
    background: var(--primary-color);
    color: white;
}

.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    overflow-y: auto;
    padding: 0.5rem;
    max-height: calc(100vh - 180px);
}

.producto-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.producto-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.producto-card .nombre {
    font-weight: bold;
    font-size: 0.8rem;
}

.producto-card .precio {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: bold;
    margin-top: 0.2rem;
}

/* ========== TICKET PANEL ========== */
.ticket-panel {
    background: var(--light-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-height: calc(100vh - 80px);
    overflow: hidden;
}

.ticket-info-bar {
    padding: 0.5rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}

/* Mesa y vendedor quedan en la misma fila; el cliente ocupa la siguiente. */
.ticket-info-bar .info-group:nth-child(3) {
    grid-column: 1 / -1;
}

.ticket-info-bar .info-group {
    min-width: 0;
}

.ticket-info-bar .info-group:nth-child(1) select {
    width: 92px;
    min-width: 0;
    flex: 0 1 92px;
}

.ticket-info-bar .info-group:nth-child(2) .vendedor-nombre {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

.info-group label {
    font-size: 0.7rem;
    font-weight: bold;
    color: #666;
    white-space: nowrap;
}

.mesa-select-small, .cliente-input {
    padding: 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    flex: 1;
}

.ticket-header {
    padding: 0.5rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ticket-header h3 {
    font-size: 0.85rem;
    margin: 0;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
}

.ticket-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    max-height: none;
    min-height: 0;
}

.ticket-item {
    background: white;
    border-radius: 6px;
    padding: 0.4rem;
    margin-bottom: 0.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.ticket-item-info { flex: 1; }
.ticket-item-nombre { font-weight: bold; font-size: 0.8rem; }
.ticket-item-precio { font-size: 0.65rem; color: #666; }

.ticket-item-cantidad {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ticket-item-cantidad button {
    width: 22px;
    height: 22px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
}

.ticket-item-total {
    font-weight: bold;
    min-width: 65px;
    text-align: right;
    font-size: 0.75rem;
}

.ticket-footer {
    padding: 0.5rem;
    background: white;
    border-top: 2px solid var(--border-color);
    flex-shrink: 0;
}

.total-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
}

.total-line.total {
    font-size: 1rem;
    font-weight: bold;
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    border-top: 1px solid var(--border-color);
}

.payment-buttons {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.btn-payment {
    flex: 1;
    padding: 0.4rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.btn-payment:active { transform: scale(0.98); }
.btn-payment.efectivo { background: var(--secondary-color); color: white; }
.btn-payment.tarjeta { background: var(--primary-color); color: white; }
.btn-payment.imprimir { background: #95a5a6; color: white; }
.btn-payment.imprimir:hover { background: #7f8c8d; }

/* ========== MESAS ========== */
.mesas-grid-full {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.mesa-full-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.mesa-full-card.libre {
    border: 2px solid var(--mesa-libre);
    background: #f0fff0;
}

.mesa-full-card.ocupada {
    border: 2px solid var(--mesa-ocupada);
    background: #fff0f0;
}

.mesa-full-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.mesa-full-card .mesa-numero {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.mesa-full-card .mesa-estado {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.mesa-full-card .mesa-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.mesa-full-card .mesa-total {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--warning-color);
}

/* ========== TABLAS ========== */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.8rem;
}

th, td {
    padding: 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--light-color);
    font-weight: bold;
}

tr:hover {
    background: rgba(52,152,219,0.05);
}

/* Tabla de productos */
#productosTable th, #productosTable td { padding: 0.5rem; font-size: 0.8rem; }
#productosTable td:nth-child(3), #productosTable td:nth-child(4), #productosTable td:nth-child(5) { text-align: right; }
#productosTable td:nth-child(4) { color: #27ae60; font-weight: bold; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.badge.cobrado { background: var(--secondary-color); color: white; }
.badge.pendiente { background: var(--warning-color); color: white; }

/* ========== BOTONES ========== */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.btn-primary:hover { background: #2980b9; }

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-edit {
    background: var(--warning-color);
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
}

.btn-warning {
    background: #f39c12;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
}

.btn-warning:hover { background: #e67e22; }

/* ========== MODALES ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 1rem;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 10px;
    position: relative;
}

.modal-large .modal-content { max-width: 450px; }
.modal-small .modal-content { max-width: 350px; }

.close {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    font-size: 1.3rem;
    cursor: pointer;
    color: #999;
}

.close:hover { color: var(--danger-color); }

.modal h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-right: 1.5rem;
}

.modal .form-group {
    margin-bottom: 0.75rem;
}

.modal .form-group label {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
}

.modal .form-group input,
.modal .form-group select {
    padding: 0.4rem;
    font-size: 0.85rem;
}

.modal .btn-primary {
    padding: 0.5rem;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* ========== MODAL TICKET TÉRMICO ========== */
.modal-ticket {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-ticket .modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    width: 300px;
    max-width: 300px;
    border-radius: 0;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.modal-ticket .preview-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.75rem;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
}

.modal-ticket .preview-buttons button {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.8rem;
}

/* ========== TICKET PREVIEW ========== */
.ticket-preview {
    background: white;
    padding: 0.75rem;
    font-family: monospace;
    font-size: 10px;
    border: 1px solid #ddd;
    margin: 0.5rem 0;
    max-height: 60vh;
    overflow-y: auto;
}

.ticket-preview .ticket-header {
    text-align: center;
    border-bottom: 1px dashed #000;
    margin-bottom: 0.5rem;
    padding: 0;
}

.ticket-items-preview {
    width: 100%;
    border-collapse: collapse;
}

.ticket-items-preview th, .ticket-items-preview td {
    border-bottom: 1px dotted #ddd;
    padding: 0.25rem;
    text-align: left;
}

.ticket-items-preview td:last-child, .ticket-items-preview th:last-child {
    text-align: right;
}

.totales {
    text-align: right;
    margin-top: 0.5rem;
    border-top: 1px dashed #000;
    padding-top: 0.5rem;
}

.preview-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}

.preview-buttons .btn-primary,
.preview-buttons .btn-secondary {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Estilo térmico */
.ticket-thermal {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    font-family: 'Courier New', monospace;
    font-size: 10px;
}

.ticket-thermal .header {
    text-align: center;
    border-bottom: 1px dashed #000;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

.ticket-thermal .header h3 { font-size: 12px; margin: 0; }
.ticket-thermal .header p { margin: 2px 0; font-size: 9px; }

.ticket-thermal table {
    width: 100%;
    border-collapse: collapse;
}

.ticket-thermal th, .ticket-thermal td {
    padding: 3px 2px;
    text-align: left;
    border-bottom: 1px dotted #ccc;
}

.ticket-thermal td:last-child, .ticket-thermal th:last-child { text-align: right; }

.ticket-thermal .totales {
    text-align: right;
    margin-top: 5px;
    border-top: 1px dashed #000;
    padding-top: 5px;
}

.ticket-thermal .footer {
    text-align: center;
    margin-top: 8px;
    border-top: 1px dashed #000;
    padding-top: 5px;
    font-size: 8px;
}

/* ========== FORMULARIOS ========== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: bold;
    font-size: 0.85rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9rem;
}

/* ========== FICHAJES ========== */
.fichaje-container {
    max-width: 600px;
    margin: 0 auto;
}

.fichaje-card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.fichaje-status {
    font-size: 1.2rem;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 5px;
}

.fichaje-status.entrada { background: var(--secondary-color); color: white; }
.fichaje-status.salida { background: var(--warning-color); color: white; }

.btn-fichar {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 5px;
    font-size: 1.2rem;
    cursor: pointer;
    margin: 1rem 0;
}

.fichajes-list {
    margin-top: 2rem;
    text-align: left;
}

.fichaje-item {
    padding: 0.5rem;
    border-bottom: 1px solid #ddd;
    font-size: 0.85rem;
}

/* ========== INFORMES Y CIERRE ========== */
.informes-container, .cierre-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

.informe-card, .cierre-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.informe-content, .cierre-resumen {
    background: var(--light-color);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    max-height: 400px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.8rem;
}

.cierre-resultado {
    background: #f0fff0;
    border: 1px solid var(--secondary-color);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

/* ========== NOTIFICACIONES ========== */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 0.75rem 1rem;
    border-radius: 5px;
    z-index: 3000;
    animation: slideIn 0.3s ease;
    font-size: 0.85rem;
}

.notification.success { background: var(--secondary-color); color: white; }
.notification.error { background: var(--danger-color); color: white; }
.notification.info { background: var(--primary-color); color: white; }

/* ========== FILTROS ========== */
.filter-group {
    display: flex;
    gap: 0.5rem;
}

.filter-group input, .filter-group select {
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.85rem;
}

/* ========== ANIMACIONES ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .toggle-sidebar-btn { display: none; }
    
    .side-menu {
        position: fixed;
        left: -250px;
        top: 60px;
        height: calc(100% - 60px);
        z-index: 999;
        transition: left 0.3s ease;
        width: 250px !important;
    }
    
    .side-menu.open { left: 0; }
    .side-menu.collapsed { width: 250px !important; }
    
    .ventas-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .productos-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        max-height: 350px;
    }
    
    .ticket-panel {
        margin-top: 1rem;
        max-height: 500px;
    }

    .ticket-info-bar {
        grid-template-columns: 1fr;
    }

    .ticket-info-bar .info-group:nth-child(3) {
        grid-column: auto;
    }
    
    .ticket-items { max-height: 300px; }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 0.75rem;
        max-height: 85vh;
    }
    
    .modal-large .modal-content { max-width: 95%; max-height: 85vh; }
    .modal-ticket .modal-content { width: 95%; max-width: 95%; margin: 10% auto; }
    
    .modal .form-group { margin-bottom: 0.5rem; }
    .modal .form-group label { font-size: 0.75rem; }
    .modal .form-group input, .modal .form-group select { padding: 0.35rem; font-size: 0.8rem; }
    .modal .btn-primary { padding: 0.4rem; font-size: 0.85rem; }
    .modal h3 { font-size: 1rem; margin-bottom: 0.75rem; }
    
    .view-header { flex-direction: column; align-items: stretch; }
    .filter-group { display: flex; gap: 0.5rem; }
    .filter-group input, .filter-group select { flex: 1; }
    
    table { font-size: 0.75rem; }
    th, td { padding: 0.4rem; }
    
    .categorias-tabs { flex-wrap: nowrap; }
    .mesas-grid-full { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .informes-container, .cierre-container { grid-template-columns: 1fr; }
    
    .ticket-preview { font-size: 9px; max-height: 50vh; }
    .preview-buttons { flex-direction: column; gap: 0.5rem; }
    .preview-buttons button { width: 100%; }
}

@media (min-width: 769px) {
    .menu-toggle { display: none; }
    .toggle-sidebar-btn { display: flex; }
}

@media (max-width: 400px) {
    .modal-ticket .modal-content { width: 95%; max-width: 95%; margin: 10% auto; }
}

/* ========== DEVOLUCIONES ========== */
.devolucion {
    color: #e74c3c;
    font-weight: bold;
}

#productosTable th {
    cursor: pointer;
    user-select: none;
}

#productosTable th:hover {
    background: #d5dbdb;
}

.sort-icon {
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

/* Asegurar que las celdas editables tengan la alineación correcta */
.editable-cell {
    text-align: left !important;
}

/* Solo las celdas de números deben ir a la derecha */
.editable-cell.precio-cell,
.editable-cell.iva-cell,
.editable-cell.stock-cell {
    text-align: right !important;
}

/* Asegurar alineación izquierda para código y nombre */
.editable-cell[data-field="codigo_barras"],
.editable-cell[data-field="nombre"] {
    text-align: left !important;
}

/* Asegurar alineación derecha para números */
.editable-cell[data-field="precio_venta"],
.editable-cell[data-field="iva_porcentaje"],
.editable-cell[data-field="stock_actual"] {
    text-align: right !important;
}

/* Forzar alineación izquierda para la columna Nombre */
table td:nth-child(2),
table th:nth-child(2) {
    text-align: left !important;
}

/* ========== PESTAÑAS DE CONFIGURACIÓN ========== */
.config-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 2rem;
}

.config-tab {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s ease;
    position: relative;
}

.config-tab:hover {
    background: #f5f5f5;
    color: #333;
}

.config-tab.active {
    color: #3498db;
    background: #f8f9fa;
}

.config-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #3498db;
}

.config-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.config-tab-content.active {
    display: block;
}

.configuracion-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Estilo para el vendedor en ticket panel */
.info-group .vendedor-nombre {
    display: inline-block;
    background: #f39c12;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}
.vendedor-nombre {
    display: inline-block;
    background: #f39c12 !important;
    color: #000000 !important;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
}

/* Modal detalle ticket más ancho */
.modal-ticket-detail .modal-content {
    max-width: 550px !important;
    width: 90% !important;
    border-radius: 12px;
}

.modal-ticket-detail .ticket-preview {
    max-height: 65vh;
    overflow-y: auto;
    font-size: 11px;
    padding: 1rem;
}

/* Mejorar tablas dentro del ticket */
.modal-ticket-detail .ticket-items-preview {
    width: 100%;
    border-collapse: collapse;
}

.modal-ticket-detail .ticket-items-preview th,
.modal-ticket-detail .ticket-items-preview td {
    padding: 6px 4px;
    border-bottom: 1px dotted #ccc;
}

.modal-ticket-detail .ticket-items-preview th {
    background: #f5f5f5;
    font-weight: bold;
}

.modal-ticket-detail .totales {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #000;
    text-align: right;
}

.modal-ticket-detail .ticket-header {
    text-align: center;
    border-bottom: 1px dashed #000;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.modal-ticket-detail .ticket-header h3 {
    margin: 0 0 5px 0;
    font-size: 14px;
}

.modal-ticket-detail .ticket-header p {
    margin: 3px 0;
    font-size: 10px;
}

/* Modal detalle ticket */
#detalleTicketModal .modal-content {
    max-width: 600px !important;
    width: 90% !important;
    border-radius: 12px;
    padding: 1.25rem;
}

#detalleTicketModal .ticket-preview {
    max-height: 55vh;
    overflow-y: auto;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    background: white;
    padding: 0.75rem;
    border: 1px solid #eee;
    border-radius: 8px;
}

#detalleTicketModal .close {
    top: 0.5rem;
    right: 0.75rem;
    font-size: 1.3rem;
}

#detalleTicketModal h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Tabla dentro del ticket */
.ticket-items-preview {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.ticket-items-preview th,
.ticket-items-preview td {
    padding: 5px 3px;
    border-bottom: 1px dotted #ccc;
    text-align: left;
}

.ticket-items-preview th {
    background: #f5f5f5;
    font-weight: bold;
}

.ticket-items-preview td:last-child,
.ticket-items-preview th:last-child {
    text-align: right;
}

.ticket-items-preview td:nth-child(3),
.ticket-items-preview th:nth-child(3) {
    text-align: right;
}

/* Separador */
.separator {
    text-align: center;
    font-size: 10px;
    letter-spacing: 1px;
}

/* Totales */
.totales {
    text-align: right;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #000;
}

.totales p {
    margin: 3px 0;
}

/* Footer ticket */
.ticket-footer {
    text-align: center;
    margin-top: 10px;
    font-size: 9px;
}

.ticket-footer p {
    margin: 5px 0;
}
.total {
    text-align: right;
    width: 100%; /* Asegúrate de que el div ocupe todo el ancho disponible */
}

.ticket-history-tools { display:flex; gap:.5rem; align-items:center; margin:.75rem 0; }
.ticket-history-tools input { flex:1; min-width:240px; }
.filter-group label { display:inline-flex; align-items:center; gap:.25rem; margin-right:.5rem; }

/* La vista previa necesita espacio para las cuatro columnas del ticket. */
#ticketPreviewModal .modal-content { width: min(900px, 94vw); max-width: 900px; }
#ticketPreviewContent { overflow-x: auto; }
