/* POS El Secreto de Mamá – estilos compartidos. Colores tomados del logo. */
:root {
  --rojo: #d71920;
  --rojo-osc: #a50f15;
  --rojo-suave: #fde8e8;
  --cafe: #4a1209;
  --cafe-2: #6b2a1c;
  --amarillo: #f7c600;
  --amarillo-suave: #fff6cc;
  --crema: #fff8ef;
  --papel: #ffffff;
  --linea: #ecdcca;
  --linea-2: #e1cdb6;
  --tinta: #2b1a14;
  --tinta-2: #6d5a50;
  --tinta-3: #9a8a80;
  --verde: #0b7a3b;
  --verde-suave: #e3f5ea;
  --naranja: #b45309;
  /* Gráficos (paleta validada) */
  --serie-1: #2a78d6;
  --serie-2: #eb6834;
  --serie-comp: #b9b6ad;
  --grid: #ece6dc;
  --eje: #c3c2b7;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(74, 18, 9, .06), 0 4px 14px rgba(74, 18, 9, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tinta);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--crema); font-size: 15px; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { color: var(--cafe); margin: 0; line-height: 1.2; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--tinta-2); }
.small { font-size: 13px; }
.oculto { display: none !important; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--linea-2); background: var(--papel); color: var(--cafe);
  padding: 10px 16px; border-radius: 10px; font-weight: 600; min-height: 44px;
  transition: background .12s, transform .05s; text-decoration: none;
}
.btn:hover { background: #fdf3e7; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.btn.primario:hover { background: var(--rojo-osc); }
.btn.oscuro { background: var(--cafe); border-color: var(--cafe); color: #fff; }
.btn.oscuro:hover { background: var(--cafe-2); }
.btn.amarillo { background: var(--amarillo); border-color: #e0b400; color: var(--cafe); }
.btn.peligro { color: var(--rojo); border-color: #f1b9b9; }
.btn.peligro:hover { background: var(--rojo-suave); }
.btn.chico { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.btn.grande { min-height: 60px; font-size: 19px; padding: 14px 22px; }
.btn.bloque { width: 100%; }
.btn-icono { border: 0; background: transparent; padding: 6px; border-radius: 8px; color: var(--tinta-2); }
.btn-icono:hover { background: #f5ebdf; color: var(--cafe); }

/* Formularios */
label { display: block; font-size: 13px; font-weight: 600; color: var(--tinta-2); margin-bottom: 4px; }
.campo { margin-bottom: 12px; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--linea-2); background: #fff; border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid rgba(215, 25, 32, .25); outline-offset: 1px; border-color: var(--rojo); }
.fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fila > * { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* Segmentado */
.seg { display: inline-flex; background: #f3e7d9; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 600; color: var(--tinta-2); min-height: 36px; }
.seg button.activo { background: #fff; color: var(--cafe); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Tarjetas */
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; }
.tarjeta > h3 { font-size: 15px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Tablas */
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--tinta-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--linea); }
.tabla td { padding: 9px 10px; border-bottom: 1px solid #f4ebe0; vertical-align: top; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .der, .tabla th.der { text-align: right; font-variant-numeric: tabular-nums; }
.tabla tr.anulada td { color: var(--tinta-3); text-decoration: line-through; }
.tabla tr.anulada td.sin-tachar { text-decoration: none; }
.tabla-wrap { overflow-x: auto; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f3e7d9; color: var(--cafe); white-space: nowrap; }
.chip.rojo { background: var(--rojo-suave); color: var(--rojo-osc); }
.chip.verde { background: var(--verde-suave); color: var(--verde); }
.chip.amarillo { background: var(--amarillo-suave); color: #7a5b00; }

/* Modal */
.modal-fondo { position: fixed; inset: 0; background: rgba(43, 26, 20, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 18px; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.ancho { width: min(760px, 100%); }
.modal-cab { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--linea); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-cab h2 { font-size: 18px; }
.modal-cuerpo { padding: 18px 20px; }
.modal-pie { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--linea); position: sticky; bottom: 0; background: #fff; }

/* Avisos */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--cafe); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-weight: 600; max-width: 90vw; }
.toast.error { background: var(--rojo); }
.toast.ok { background: var(--verde); }

/* Marca */
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca img { height: 46px; width: auto; }
.marca .marca-txt { font-weight: 800; color: var(--cafe); line-height: 1.05; }
.marca .marca-txt b { color: var(--rojo); display: block; font-size: 12px; font-weight: 700; letter-spacing: .02em; }

.vacio { text-align: center; color: var(--tinta-3); padding: 28px 10px; font-size: 14px; }

/* Ticket imprimible (80 mm) */
.ticket { font-family: "Courier New", ui-monospace, monospace; font-size: 13px; width: 300px; margin: 0 auto; color: #000; }
.ticket .c { text-align: center; }
.ticket img { display: block; margin: 0 auto 6px; width: 120px; filter: grayscale(1) contrast(1.3); }
.ticket hr { border: 0; border-top: 1px dashed #000; margin: 8px 0; }
.ticket table { width: 100%; border-collapse: collapse; }
.ticket td { padding: 1px 0; vertical-align: top; }
.ticket td.der { text-align: right; white-space: nowrap; }
.ticket .tot td { font-weight: 700; font-size: 15px; }
#zona-impresion { display: none; }
@media print {
  body * { visibility: hidden !important; }
  #zona-impresion, #zona-impresion * { visibility: visible !important; }
  #zona-impresion { display: block; position: absolute; left: 0; top: 0; width: 100%; }
  @page { margin: 4mm; }
}

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
