:root {
  --bg: #f5f6f8; --panel: #ffffff; --line: #e4e7ec; --text: #1d2433; --muted: #667085;
  --brand: #1f6feb; --brand-dark: #1557c0; --brand-soft: #e8f0fe;
  --ok: #12805c; --ok-soft: #e3f5ee; --warn: #b54708; --warn-soft: #fef0e1;
  --err: #c0362c; --err-soft: #fdecea; --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg);
  color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; background: linear-gradient(90deg, #101828 232px, transparent 232px); }
.side { background: #101828; color: #cfd4dc; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem; padding: 4px 8px 16px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; font-size: .95rem; }
.negocio-nombre { font-size: .8rem; color: #98a2b3; padding: 0 8px 14px; border-bottom: 1px solid #1f2a3d; margin-bottom: 10px; }
.side nav a { display: flex; align-items: center; gap: 10px; color: #cfd4dc; padding: 8px 10px; border-radius: 8px; margin-bottom: 2px; font-size: .93rem; }
.side nav a:hover { background: #1d2939; text-decoration: none; color: #fff; }
.side nav a.activo { background: var(--brand); color: #fff; }
.side nav .sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #667085; padding: 14px 10px 4px; }
.badge { margin-left: auto; background: var(--err); color: #fff; font-size: .72rem; border-radius: 99px; padding: 1px 7px; font-weight: 600; }
.main { padding: 22px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.caja-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; padding: 4px 10px; border-radius: 99px; font-weight: 600; }
.caja-pill.abierta { background: var(--ok-soft); color: var(--ok); }
.caja-pill.cerrada { background: var(--warn-soft); color: var(--warn); }
.menu-btn { display: none; }

/* Cards & grid */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi .v { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* Tables */
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
tr.inactivo td { color: #98a2b3; }
tr.anulada td { color: #98a2b3; text-decoration: line-through; }

/* Forms */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; color: #344054; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 11px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; }
.campo { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.ayuda { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .92rem;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.sec { background: #fff; color: #344054; border-color: #d0d5dd; }
.btn.sec:hover { background: #f9fafb; }
.btn.peligro { background: var(--err); border-color: var(--err); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.chico { padding: 5px 10px; font-size: .82rem; }
.btn.grande { padding: 14px 22px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.inline { display: inline; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; font-size: .92rem; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--err-soft); color: var(--err); }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: #f2f4f7; color: #344054; font-weight: 600; }
.tag.rojo { background: var(--err-soft); color: var(--err); }
.tag.verde { background: var(--ok-soft); color: var(--ok); }
.tag.naranja { background: var(--warn-soft); color: var(--warn); }

/* Bars chart */
.barras { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 8px; }
.barras .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.barras .b span { width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.barras .b:hover span { background: var(--brand-dark); }
.barras .b small { font-size: .68rem; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.hbar { height: 8px; background: #eef1f5; border-radius: 99px; overflow: hidden; }
.hbar span { display: block; height: 100%; background: var(--brand); }

/* POS */
.pos { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.pos-scan { font-size: 1.15rem; padding: 14px 16px; }
.resultados { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.12); z-index: 20; max-height: 340px; overflow-y: auto; }
.resultados div { padding: 10px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.resultados div:hover, .resultados div.sel { background: var(--brand-soft); }
.carrito td input { width: 80px; padding: 5px 8px; text-align: right; }
.total-grande { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.medios { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.medios label { margin: 0; }
.medios input { display: none; }
.medios span { display: block; text-align: center; padding: 9px 6px; border: 1px solid #d0d5dd; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.medios input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.vacio { text-align: center; color: var(--muted); padding: 40px 10px; }
.modal-fondo { position: fixed; inset: 0; background: rgba(16,24,40,.5); display: none; place-items: center; z-index: 50; padding: 16px; }
.modal-fondo.visible { display: grid; }
.modal { background: #fff; border-radius: 14px; padding: 28px; width: min(420px, 100%); text-align: center; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(460px, 100%); padding: 30px; }
.auth .brand { color: var(--text); justify-content: center; padding-bottom: 6px; }

/* Ticket */
.ticket { max-width: 380px; margin: 0 auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.ticket table td, .ticket table th { padding: 3px 0; border: 0; background: none; }
.ticket hr { border: 0; border-top: 1px dashed #999; }
@media print {
  .side, .topbar, .no-print, .flash { display: none !important; }
  .shell { display: block; } .main { padding: 0; } .card { border: 0; box-shadow: none; }
  body { background: #fff; }
}

@media (max-width: 1000px) {
  .pos { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; left: 0; top: 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.abierto { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: inline-flex; }
  .main { padding: 14px 16px 60px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .g4.kpis { grid-template-columns: 1fr 1fr; }
  .kpi .v { font-size: 1.25rem; }
}

/* Espera de pago Mercado Pago */
.mp-caja { text-align: center; padding: 16px 10px; border-radius: 12px; margin-top: 12px; }
.mp-caja.mp-esperando { background: #eff6ff; border: 1px solid #bfdbfe; }
.mp-caja.mp-ok { background: var(--ok-soft); border: 1px solid #a6e3c4; }
.mp-icono { font-size: 2.4rem; line-height: 1.1; }
.mp-titulo { font-size: 1.25rem; font-weight: 700; margin: 4px 0; }
.mp-caja.mp-ok .mp-titulo { color: var(--ok); }
.mp-detalle { color: #344054; }
.mp-gira { display: inline-block; animation: mpgira 2s linear infinite; }
@keyframes mpgira { to { transform: rotate(360deg); } }

/* Barra de arriba: reloj, efectivo en caja */
.caja-pill.reloj { background: #f2f4f7; color: #344054; }
.caja-pill.efectivo { background: var(--ok-soft); color: var(--ok); text-decoration: none; }
.caja-pill.efectivo strong { font-variant-numeric: tabular-nums; }
.caja-pill .turno-de { font-weight: 500; opacity: .8; }
