* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: Arial, sans-serif;
    background: #f0f2f5;
    color: #222;
    min-height: 100vh;
}

/* ========================
   NAVBAR
======================== */
.navbar {
    background: #c0392b;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.navbar-brand {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
}
.navbar-brand span { margin-left: 6px; }
.navbar-links { display: flex; gap: 4px; }
.navbar-links a {
    color: #f5b7b1;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.2s;
}
.navbar-links a:hover { background: rgba(255,255,255,0.15); color: #fff; }
.navbar-links a.activo { background: rgba(255,255,255,0.25); color: #fff; }

/* Menú hamburguesa móvil */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}
@media (max-width: 600px) {
    .navbar-toggle { display: block; }
    .navbar-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: #c0392b;
        flex-direction: column;
        padding: 10px;
        gap: 4px;
    }
    .navbar-links.abierto { display: flex; }
    .navbar-links a { padding: 12px 16px; font-size: 16px; }
}

/* ========================
   PANTALLA DE VENTAS
======================== */
.main {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* Panel productos */
.panel-productos {
    width: 60%;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
}
.panel-productos h2 {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.grid-productos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.btn-producto {
    border: none;
    border-radius: 10px;
    padding: 14px 8px;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s, opacity 0.2s;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    width: 100%;
}
.btn-producto:hover { opacity: 0.9; transform: translateY(-2px); }
.btn-producto .precio { display: block; font-size: 12px; margin-top: 5px; font-weight: normal; opacity: 0.9; }

/* Panel venta */
.panel-venta {
    width: 40%;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-width: 300px;
}
.detalle { flex: 1; padding: 15px; overflow-y: auto; }
.detalle h2 { font-size: 12px; color: #888; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.item-venta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.item-venta .info { flex: 1; color: #333; }
.item-venta .info small { color: #999; font-size: 11px; display: block; }
.item-venta .subtotal { font-weight: bold; color: #27ae60; margin: 0 8px; white-space: nowrap; }
.btn-eliminar { background: #e74c3c; border: none; color: #fff; border-radius: 4px; padding: 3px 7px; cursor: pointer; font-size: 12px; }
.vacio { color: #bbb; font-size: 13px; text-align: center; margin-top: 20px; }

/* Totales */
.totales { background: #f8f9fa; padding: 15px; border-top: 2px solid #dee2e6; }
.fila-total { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; color: #555; align-items: center; }
.fila-total.grande { font-size: 18px; font-weight: bold; color: #c0392b; margin-top: 8px; }
.input-descuento {
    width: 90px;
    padding: 4px 6px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-align: right;
    font-size: 14px;
    background: #fff;
}

/* Pago */
.pago { background: #fff; padding: 12px 15px; border-top: 1px solid #dee2e6; }
.pago label { font-size: 12px; color: #888; display: block; margin-bottom: 4px; }
.pago input[type=number] {
    width: 100%;
    padding: 8px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    text-align: right;
    margin-bottom: 8px;
    background: #f8f9fa;
}
.btns-rapidos { display: flex; gap: 5px; margin-bottom: 8px; flex-wrap: wrap; }
.btn-rapido {
    flex: 1;
    min-width: 50px;
    padding: 6px 4px;
    background: #2980b9;
    border: none;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}
.btn-rapido:hover { background: #2471a3; }
.vuelto {
    background: #2980b9;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

/* Acciones */
.acciones { display: flex; gap: 8px; padding: 12px 15px; background: #f8f9fa; border-top: 1px solid #dee2e6; }
.btn-accion { flex: 1; padding: 12px; border: none; border-radius: 8px; color: #fff; font-size: 13px; font-weight: bold; cursor: pointer; }
.btn-finalizar { background: #27ae60; }
.btn-finalizar:hover { background: #219a52; }
.btn-borrar { background: #95a5a6; }
.btn-borrar:hover { background: #7f8c8d; }

/* Responsive ventas */
@media (max-width: 768px) {
    .main { flex-direction: column; height: auto; overflow: auto; }
    .panel-productos { width: 100%; border-right: none; border-bottom: 2px solid #dee2e6; }
    .panel-venta { width: 100%; min-width: unset; }
}

/* ========================
   MODAL CALCULADORA
======================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    justify-content: center;
    align-items: center;
    padding: 10px;
}
.modal-overlay.activo { display: flex; }
.modal {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    text-align: center;
}
.modal h3 { font-size: 18px; color: #c0392b; margin-bottom: 2px; }
.modal-precio-actual { font-size: 13px; color: #888; margin-bottom: 12px; }
.modal-display {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 28px;
    font-weight: bold;
    color: #222;
    margin-bottom: 8px;
    text-align: right;
    min-height: 54px;
}
.modal-display .unidad { font-size: 13px; color: #888; font-weight: normal; }
.modal-modo {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.btn-modo {
    flex: 1;
    padding: 7px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    color: #555;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-modo.activo { background: #c0392b; border-color: #c0392b; color: #fff; }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 10px; }
.tecla {
    padding: 14px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: #f0f2f5;
    color: #222;
    transition: background 0.1s;
}
.tecla:hover { background: #dde1e7; }
.tecla:active { background: #c8cdd5; }
.tecla.cero { grid-column: span 2; }
.tecla.borrar { background: #fde8e8; color: #e74c3c; }
.tecla.borrar:hover { background: #f5c6c6; }
.modal-btns { display: flex; gap: 10px; }
.btn-cancelar { flex: 1; padding: 12px; border: none; border-radius: 10px; background: #95a5a6; color: #fff; font-size: 15px; font-weight: bold; cursor: pointer; }
.btn-cancelar:hover { background: #7f8c8d; }
.btn-aceptar { flex: 2; padding: 12px; border: none; border-radius: 10px; background: #27ae60; color: #fff; font-size: 15px; font-weight: bold; cursor: pointer; }
.btn-aceptar:hover { background: #219a52; }

/* ========================
   PÁGINA PRODUCTOS
======================== */
.page-content { max-width: 900px; margin: 30px auto; padding: 0 15px; }
.page-content h1 { font-size: 22px; color: #c0392b; margin-bottom: 20px; }
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin-bottom: 20px; }
.card h2 { font-size: 16px; color: #555; margin-bottom: 16px; border-bottom: 2px solid #f0f0f0; padding-bottom: 8px; }
.tabla-productos { width: 100%; border-collapse: collapse; }
.tabla-productos th { background: #f8f9fa; padding: 10px 12px; text-align: left; font-size: 13px; color: #888; border-bottom: 2px solid #dee2e6; }
.tabla-productos td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.tabla-productos tr:hover td { background: #fafafa; }
.input-tabla { width: 100%; padding: 6px 8px; border: 1px solid #dee2e6; border-radius: 6px; font-size: 14px; }
.input-tabla:focus { outline: none; border-color: #c0392b; }
.btn-guardar { background: #27ae60; color: #fff; border: none; border-radius: 8px; padding: 12px 24px; font-size: 15px; font-weight: bold; cursor: pointer; margin-top: 16px; }
.btn-guardar:hover { background: #219a52; }
.alerta { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; font-weight: bold; }
.alerta.exito { background: #d4edda; color: #155724; }
.color-picker { width: 50px; height: 34px; border: 1px solid #dee2e6; border-radius: 6px; cursor: pointer; padding: 2px; }

/* ========================
   PÁGINA REPORTES
======================== */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.filtros label { font-size: 13px; color: #888; display: block; margin-bottom: 4px; }
.filtros input, .filtros select {
    padding: 8px 10px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}
.btn-filtrar { background: #2980b9; color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px; font-weight: bold; cursor: pointer; }
.btn-filtrar:hover { background: #2471a3; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); text-align: center; }
.stat-card .valor { font-size: 26px; font-weight: bold; color: #c0392b; }
.stat-card .etiqueta { font-size: 12px; color: #888; margin-top: 4px; }
.tabla-ventas { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla-ventas th { background: #f8f9fa; padding: 10px 12px; text-align: left; font-size: 12px; color: #888; border-bottom: 2px solid #dee2e6; }
.tabla-ventas td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; }
.tabla-ventas tr:hover td { background: #fafafa; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: bold; background: #d4edda; color: #155724; }
.btn-detalle { background: #2980b9; color: #fff; border: none; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.btn-detalle:hover { background: #2471a3; }

/* Modal detalle venta */
.modal-detalle { max-width: 500px; text-align: left; }
.modal-detalle h3 { color: #c0392b; margin-bottom: 12px; }
.tabla-detalle { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.tabla-detalle th { background: #f8f9fa; padding: 8px; border-bottom: 2px solid #dee2e6; }
.tabla-detalle td { padding: 8px; border-bottom: 1px solid #f0f0f0; }
.resumen-venta { background: #f8f9fa; border-radius: 8px; padding: 12px; font-size: 14px; }
.resumen-venta div { display: flex; justify-content: space-between; margin-bottom: 4px; }
.resumen-venta .total-final { font-weight: bold; color: #c0392b; font-size: 16px; border-top: 2px solid #dee2e6; padding-top: 8px; margin-top: 4px; }

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filtros { flex-direction: column; }
    .filtros input, .filtros select { width: 100%; }
}
/* FORMAS DE PAGO */
.btn-forma-pago {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    background: #f8f9fa;
    color: #555;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-forma-pago:hover { border-color: #2980b9; color: #2980b9; }
.btn-forma-pago.activo { background: #2980b9; border-color: #2980b9; color: #fff; }

/* FORM GRID */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.form-grid label { font-size: 13px; color: #888; display: block; margin-bottom: 4px; }

/* ALERTA ERROR */
.alerta.error { background: #f8d7da; color: #721c24; }

/* ========================
   SCROLLBAR TABLA VENTAS
======================== */
#tabla-ventas-wrapper {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #c0392b #f0f2f5;
}

#tabla-ventas-wrapper::-webkit-scrollbar {
    height: 8px;
}
#tabla-ventas-wrapper::-webkit-scrollbar-track {
    background: #f0f2f5;
    border-radius: 4px;
}
#tabla-ventas-wrapper::-webkit-scrollbar-thumb {
    background: #c0392b;
    border-radius: 4px;
}

/* Header fijo al hacer scroll vertical */
#tabla-ventas thead th {
    position: sticky;
    top: 56px;
    background: #f8f9fa;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}