/* ============================================================
   Sistema de ventas - Tienda KemaMada
   ============================================================ */

/* Base */
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 15px; color: #243746; background: #f2f5f8; }
h1, h2, h3, p { margin: 0; }
a { color: #1d4e7c; }

/* Estructura */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #14375c; color: #ffffff; display: flex; flex-direction: column; flex-shrink: 0; }
.marca { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid #2b5075; }
.marca-icono { width: 38px; height: 38px; background: #4c8c3f; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.marca strong { display: block; font-size: 14px; }
.marca small { font-size: 11px; color: #c9d6e2; }
.menu { padding: 12px; display: flex; flex-direction: column; gap: 3px; }
.menu a { color: #dbe6f0; text-decoration: none; padding: 9px 12px; border-radius: 4px; font-size: 14px; }
.menu a.activo { background: #4c8c3f; color: #ffffff; font-weight: bold; }
.menu-titulo { margin-top: 12px; padding: 0 12px 4px; font-size: 11px; color: #9db2c8; }
.sidebar-pie { margin-top: auto; padding: 14px 16px; border-top: 1px solid #2b5075; }
.sidebar-pie a { color: #ffd7d2; font-size: 14px; }
.contenido { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #ffffff; border-bottom: 1px solid #dde5ec; padding: 14px 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.topbar h1 { font-size: 20px; color: #14375c; }
.topbar p { color: #6b7c8c; font-size: 13px; margin-top: 2px; }
.usuario-caja { display: flex; align-items: center; gap: 8px; }
.usuario-caja strong { display: block; font-size: 13px; }
.usuario-caja small { font-size: 12px; color: #6b7c8c; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #4c8c3f; color: #ffffff; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.principal { flex: 1; padding: 22px; }
.pie { text-align: center; color: #6b7c8c; font-size: 12px; padding: 14px; }

/* Tarjetas y cajas */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tarjeta { background: #ffffff; border: 1px solid #dde5ec; border-radius: 6px; padding: 16px; }
.tarjeta .etiqueta { color: #6b7c8c; font-size: 12px; }
.tarjeta .valor { font-size: 24px; font-weight: bold; color: #14375c; margin-top: 5px; }
.tarjeta .nota { font-size: 12px; color: #6b7c8c; margin-top: 3px; }
.tarjeta.verde .valor { color: #3f7a34; }
.tarjeta.roja .valor { color: #b03a2e; }
.caja { background: #ffffff; border: 1px solid #dde5ec; border-radius: 6px; padding: 18px; margin-bottom: 18px; }
.caja-cabecera { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.caja-cabecera h2 { font-size: 16px; color: #14375c; }
.caja-cabecera p { color: #6b7c8c; font-size: 13px; margin-top: 3px; }
.dos-columnas { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Botones */
.btn { display: inline-block; border: none; border-radius: 4px; padding: 8px 14px; background: #1d4e7c; color: #ffffff; font-family: inherit; font-size: 14px; text-decoration: none; cursor: pointer; }
.btn-verde { background: #4c8c3f; }
.btn-gris { background: #eef2f6; color: #243746; }
.btn-rojo { background: #b03a2e; }
.btn-pequeno { padding: 4px 9px; font-size: 12px; }
.acciones { display: flex; gap: 5px; flex-wrap: wrap; }

/* Tablas */
.tabla-caja { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { background: #eef3f8; color: #14375c; text-align: left; padding: 9px; border-bottom: 2px solid #dde5ec; font-size: 12px; white-space: nowrap; }
.tabla td { padding: 9px; border-bottom: 1px solid #e5ebf0; }
.derecha { text-align: right !important; }
.centro { text-align: center !important; }
.sin-datos { text-align: center; color: #6b7c8c; padding: 22px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: bold; background: #e8f3e2; color: #3f7a34; }
.badge.rojo { background: #fdecea; color: #b03a2e; }
.badge.gris { background: #eceff2; color: #6b7c8c; }
.badge.amarillo { background: #fff6e0; color: #9a6b12; }

/* Formularios */
.formulario { max-width: 720px; }
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo-completo { grid-column: 1 / -1; }
.campo label { font-size: 13px; font-weight: bold; color: #3d5062; }
.campo input, .campo select, .campo textarea { padding: 8px 10px; border: 1px solid #cfd9e2; border-radius: 4px; font-family: inherit; font-size: 14px; background: #ffffff; color: #243746; }
.campo small { color: #6b7c8c; font-size: 12px; }
.campo p { margin-top: 2px; }
.form-acciones { margin-top: 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filtros .campo { min-width: 140px; }

/* Avisos */
.aviso { padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; font-size: 14px; }
.aviso.exito { background: #e8f4e3; color: #2e5f21; }
.aviso.error { background: #fdecea; color: #922b21; }
.aviso.info { background: #eaf1f8; color: #14375c; }

/* Login */
.login-fondo { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #14375c; padding: 20px; }
.login-caja { background: #ffffff; border-radius: 8px; width: 100%; max-width: 360px; padding: 28px; }
.login-caja h1 { font-size: 20px; color: #14375c; text-align: center; }
.login-caja .subtitulo { text-align: center; color: #6b7c8c; font-size: 13px; margin: 5px 0 20px; }
.login-caja .campo { margin-bottom: 12px; }
.login-caja .btn { width: 100%; margin-top: 4px; }
.login-demo { margin-top: 18px; padding: 10px; background: #f5f8fa; border: 1px dashed #cfd9e2; border-radius: 4px; font-size: 12px; line-height: 1.6; color: #6b7c8c; }

/* Punto de venta */
.venta-grid { display: grid; grid-template-columns: 1fr 290px; gap: 18px; align-items: start; }
.resumen-venta { background: #ffffff; border: 1px solid #dde5ec; border-radius: 6px; padding: 18px; }
.resumen-venta h2 { font-size: 15px; color: #14375c; margin-bottom: 12px; }
.resumen-linea { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.resumen-total { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 2px solid #14375c; font-size: 16px; font-weight: bold; color: #14375c; }
.resumen-venta .campo { margin: 12px 0; }
.resumen-venta .btn { width: 100%; }
.tabla-venta select, .tabla-venta input { padding: 6px; border: 1px solid #cfd9e2; border-radius: 4px; font-family: inherit; font-size: 13px; width: 100%; }
.tabla-venta input.cantidad { width: 70px; text-align: center; }

/* Barras y paginación */
.barra-fondo { background: #e7edf2; border-radius: 3px; height: 8px; min-width: 50px; overflow: hidden; }
.barra { height: 8px; background: #4c8c3f; }
.paginacion { display: flex; gap: 5px; margin-top: 14px; flex-wrap: wrap; }
.paginacion a, .paginacion span { padding: 5px 10px; border: 1px solid #dde5ec; border-radius: 4px; text-decoration: none; font-size: 13px; background: #ffffff; color: #243746; }
.paginacion span.actual { background: #14375c; color: #ffffff; border-color: #14375c; }

/* Comprobante */
.comprobante-wrapper { display: flex; justify-content: center; }
.comprobante { background: #ffffff; width: 100%; max-width: 520px; border: 1px solid #dde5ec; padding: 24px; font-size: 13px; }
.comprobante h2 { text-align: center; font-size: 17px; }
.comprobante .negocio { text-align: center; font-size: 12px; color: #666666; margin-bottom: 12px; }
.comprobante .linea { border-top: 1px dashed #999999; margin: 10px 0; }
.comprobante table { width: 100%; border-collapse: collapse; font-size: 12px; }
.comprobante th { text-align: left; border-bottom: 1px solid #999999; padding: 4px 3px; }
.comprobante td { padding: 4px 3px; border-bottom: 1px solid #eeeeee; }
.comprobante .totales { margin-top: 10px; margin-left: auto; width: 65%; }
.comprobante .totales div { display: flex; justify-content: space-between; padding: 3px 0; }
.comprobante .total-final { border-top: 1px solid #333333; margin-top: 4px; padding-top: 5px; font-weight: bold; font-size: 15px; }
.comprobante .gracias { text-align: center; margin-top: 16px; font-size: 12px; }
.comprobante .anulada { color: #b03a2e; border: 2px solid #b03a2e; text-align: center; padding: 5px; margin-bottom: 12px; font-weight: bold; }

/* Impresión */
@media print {
    body { background: #ffffff; }
    .sidebar, .topbar, .pie, .no-imprimir { display: none !important; }
    .principal { padding: 0; }
    .comprobante { border: none; max-width: 100%; padding: 0; }
    .comprobante-wrapper { display: block; }
}

/* Pantallas pequeñas */
@media (max-width: 800px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .menu { flex-direction: row; flex-wrap: wrap; }
    .menu-titulo { display: none; }
    .sidebar-pie { padding: 10px 14px; }
    .venta-grid, .dos-columnas, .campos { grid-template-columns: 1fr; }
    .topbar { padding: 12px 14px; }
    .principal { padding: 14px; }
    .usuario-caja div { display: none; }
}
