/* =========================================================
   POS Elotes & Snacks v1.1.0 - Tema morado / rosa / blanco
   ========================================================= */
:root {
  --morado: #6d28d9; --morado-2: #7c3aed; --morado-osc: #4c1d95; --morado-txt: #3b0764;
  --rosa: #ec4899; --rosa-2: #db2777; --rosa-claro: #fce7f3;
  --lila: #f5f3ff; --lila-2: #ede9fe; --blanco: #ffffff; --gris: #6b7280; --borde: #e9d5ff;
  --ok: #059669; --warn: #d97706; --err: #dc2626;
  --grad: linear-gradient(135deg, #6d28d9 0%, #a21caf 55%, #ec4899 100%);
  --sombra: 0 6px 20px rgba(109, 40, 217, .12); --radio: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Segoe UI", Roboto, Arial, sans-serif; background: var(--lila); color: var(--morado-txt); font-size: 14px; }
a { color: var(--morado); }
h1, h2, h3 { color: var(--morado-osc); margin: 0 0 12px; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--gris); font-size: 12px; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }
code { background: var(--lila-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; word-break: break-all; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--morado); color: #fff; transition: transform .05s, filter .15s; font-family: inherit; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 3px solid rgba(236, 72, 153, .45); outline-offset: 1px; }
.btn-rosa { background: var(--rosa); } .btn-grad { background: var(--grad); }
.btn-blanco { background: #fff; color: var(--morado); border: 2px solid var(--borde); }
.btn-ok { background: var(--ok); } .btn-err { background: var(--err); } .btn-warn { background: var(--warn); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 14px 20px; font-size: 17px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 4px; color: var(--morado-osc); }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], input[type=tel], input[type=color], select, textarea {
  width: 100%; padding: 9px 11px; border: 2px solid var(--borde); border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff; color: var(--morado-txt);
}
input[type=color] { padding: 2px; height: 40px; }
textarea { min-height: 70px; resize: vertical; }
.chk { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--rosa); flex: none; }
.grid { display: grid; gap: 14px; }
.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)); }
.span2 { grid-column: span 2; }
.g-side { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.card { background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 18px; margin-bottom: 18px; border: 1px solid var(--borde); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-h h2 { margin: 0; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { background: var(--morado); color: #fff; text-align: left; padding: 9px 10px; font-weight: 600; white-space: nowrap; }
.tbl th:first-child { border-top-left-radius: 10px; } .tbl th:last-child { border-top-right-radius: 10px; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--lila-2); vertical-align: middle; }
.tbl tr:nth-child(even) td { background: #fdfbff; }
.tbl tfoot td { font-weight: 700; background: var(--rosa-claro) !important; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; background: var(--lila-2); color: var(--morado); }
.badge-ok { background: #d1fae5; color: #065f46; } .badge-err { background: #fee2e2; color: #991b1b; } .badge-rosa { background: var(--rosa-claro); color: var(--rosa-2); } .badge-warn { background: #fef3c7; color: #92400e; }
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.alert-ok { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--lila-2); color: var(--morado-osc); border: 1px solid var(--borde); }
.alert-warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); border-left: 6px solid var(--rosa); }
.kpi:nth-child(2n) { border-left-color: var(--morado); }
.kpi .v { font-size: 24px; font-weight: 800; color: var(--morado-osc); }
.kpi .l { font-size: 12px; color: var(--gris); text-transform: uppercase; letter-spacing: .5px; }

.adm { display: flex; min-height: 100vh; }
.side { width: 240px; background: var(--grad); color: #fff; flex: none; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 18px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.2); }
.side .brand img { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 12px; padding: 4px; flex: none; }
.side .brand b { display: block; font-size: 15px; line-height: 1.2; }
.side .brand small { opacity: .85; font-size: 11px; }
.side nav { padding: 10px 8px; flex: 1; }
.side nav .sec { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; opacity: .7; padding: 12px 10px 4px; }
.side nav a { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 2px; }
.side nav a:hover { background: rgba(255,255,255,.15); }
.side nav a.act { background: #fff; color: var(--morado); font-weight: 700; }
.side .user { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.2); font-size: 12px; line-height: 1.7; }
.main { flex: 1; min-width: 0; padding: 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.menu-btn { display: none; }
.simple-top { background: var(--grad); color: #fff; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.simple-top a { color: #fff; }
@media (max-width: 900px) {
  .side { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .side.open { left: 0; }
  .menu-btn { display: inline-flex; }
  .main { padding: 14px; }
  .g2, .g3, .g4, .g-side { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
}

.login-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--grad); padding: 20px; }
.login { background: #fff; border-radius: 22px; padding: 30px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login .logo { text-align: center; margin-bottom: 10px; }
.login .logo img { max-width: 120px; max-height: 110px; object-fit: contain; }
.login h1 { text-align: center; font-size: 20px; }
.tabs { display: flex; gap: 6px; background: var(--lila); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; font-weight: 600; color: var(--morado); cursor: pointer; font-family: inherit; }
.tabs button.act { background: #fff; box-shadow: var(--sombra); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.pinpad button { padding: 14px; font-size: 20px; font-weight: 700; border-radius: 12px; border: 2px solid var(--borde); background: #fff; color: var(--morado); cursor: pointer; }
.pin-display { text-align: center; font-size: 28px; letter-spacing: 10px; height: 40px; color: var(--morado); }
.cajas-sel { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.cajas-sel a { display: block; text-align: center; padding: 22px 10px; border-radius: 16px; border: 3px solid var(--borde); background: #fff; text-decoration: none; font-weight: 800; font-size: 18px; }
.cajas-sel a:hover { border-color: var(--rosa); }

.modal-bg { position: fixed; inset: 0; background: rgba(59, 7, 100, .55); display: none; align-items: center; justify-content: center; z-index: 100; padding: 12px; }
.modal-bg.show { display: flex; }
.modal-bg.top { z-index: 150; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: 94vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.lg { max-width: 820px; }
.modal-h { background: var(--grad); color: #fff; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; border-radius: 18px 18px 0 0; position: sticky; top: 0; z-index: 2; }
.modal-h h3 { color: #fff; margin: 0; font-size: 17px; }
.modal-h .x { background: rgba(255,255,255,.2); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.modal-b { padding: 18px; }
.modal-f { padding: 12px 18px 18px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.opt-grupo { margin-bottom: 14px; }
.opt-grupo h4 { margin: 0 0 6px; color: var(--morado-osc); font-size: 14px; display: flex; gap: 8px; align-items: center; }
.opt-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opt-item { display: flex; align-items: center; gap: 8px; border: 2px solid var(--borde); border-radius: 12px; padding: 10px; cursor: pointer; background: #fff; font-weight: 600; }
.opt-item input { width: 18px; height: 18px; accent-color: var(--rosa); flex: none; }
.opt-item.sel { border-color: var(--rosa); background: var(--rosa-claro); }
.opt-item small { margin-left: auto; color: var(--rosa-2); font-weight: 800; }
.opt-total { font-size: 20px; font-weight: 900; color: var(--morado-osc); }

.toast-wrap { position: fixed; right: 14px; bottom: 14px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--morado-osc); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--sombra); font-weight: 600; max-width: 360px; }
.toast.err { background: var(--err); } .toast.ok { background: var(--ok); } .toast.aviso { background: var(--rosa-2); }

.pos { display: flex; flex-direction: column; height: 100vh; }
.pos-top { background: var(--grad); color: #fff; padding: 8px 12px; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
.pos-top .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; margin-right: auto; min-width: 0; flex: 0 1 auto; }
.pos-top .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.pos-top .brand img { flex: none; width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.pos-top .tb { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; padding: 6px 9px; font-weight: 600; cursor: pointer; font-size: 12.5px; display: inline-flex; gap: 5px; align-items: center; text-decoration: none; font-family: inherit; position: relative; white-space: nowrap; flex: none; }
.pos-top .tb:hover { background: rgba(255,255,255,.3); }
.pos-top .tb .cnt { background: #fff; color: var(--rosa-2); border-radius: 20px; padding: 0 7px; font-size: 12px; font-weight: 800; }
.pos-top .tb.alerta { animation: pulso 1.2s infinite; background: #fff; color: var(--rosa-2); }
.pos-top .tc { font-size: 12px; background: rgba(0,0,0,.15); padding: 6px 9px; border-radius: 10px; white-space: nowrap; flex: none; }
.pos-top .imp { font-size: 12px; padding: 6px 9px; border-radius: 10px; white-space: nowrap; flex: none; background: rgba(0,0,0,.15); }
.pos-top .imp.on::before { content: '● '; color: #6ee7b7; }
.pos-top .imp.off::before { content: '● '; color: #fca5a5; }
.pos-body { flex: 1; display: flex; min-height: 0; }
.pos-left { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 12px; gap: 10px; }
.pos-right { width: 400px; background: #fff; border-left: 2px solid var(--borde); display: flex; flex-direction: column; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 5px 5px 6px; flex: none; }
.cats button { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; color: #fff; cursor: pointer; white-space: nowrap; font-size: 14px; opacity: .75; font-family: inherit; }
.cats button.act { opacity: 1; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--rosa); }
.prods { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-content: start; }
.prod { background: #fff; border: 2px solid var(--borde); border-radius: 14px; padding: 12px 10px; cursor: pointer; text-align: left; min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; font-family: inherit; color: var(--morado-txt); border-top: 6px solid var(--rosa); position: relative; }
.prod:hover { border-color: var(--rosa); }
.prod:active { transform: scale(.97); }
.prod .n { font-weight: 700; font-size: 14px; line-height: 1.2; }
.prod .p { font-weight: 800; font-size: 16px; color: var(--rosa-2); margin-top: 6px; }
.prod .op { position: absolute; top: 6px; right: 8px; font-size: 12px; }
.cart-h { padding: 12px 14px; border-bottom: 2px solid var(--lila-2); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cart-h .ttl { font-weight: 800; color: var(--morado-osc); }
.cart-h .sub { font-size: 12px; color: var(--rosa-2); font-weight: 700; }
.cart { flex: 1; overflow-y: auto; padding: 6px 10px; }
.cart-empty { text-align: center; color: var(--gris); padding: 40px 10px; }
.ci { display: flex; gap: 8px; align-items: center; padding: 8px 4px; border-bottom: 1px dashed var(--borde); }
.ci .info { flex: 1; min-width: 0; }
.ci .info .n { font-weight: 700; font-size: 13px; }
.ci .info .ops { font-size: 11px; color: var(--morado); }
.ci .info .nt { font-size: 11px; color: var(--rosa-2); font-style: italic; }
.ci .info .pu { font-size: 11px; color: var(--gris); }
.ci .qty { display: flex; align-items: center; gap: 4px; }
.ci .qty button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--borde); background: #fff; color: var(--morado); font-weight: 800; cursor: pointer; }
.ci .qty span { min-width: 24px; text-align: center; font-weight: 700; }
.ci .imp { width: 76px; text-align: right; font-weight: 800; }
.ci .del { background: none; border: 0; color: var(--err); cursor: pointer; font-size: 16px; }
.ci .nbtn { background: none; border: 0; cursor: pointer; font-size: 14px; color: var(--morado); }
.totals { padding: 10px 14px; border-top: 2px solid var(--lila-2); background: var(--lila); }
.totals .r { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.totals .big { font-size: 26px; font-weight: 900; color: var(--morado-osc); }
.totals .usd { font-size: 13px; color: var(--rosa-2); font-weight: 700; }
.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 14px 14px; }
.acts .btn { padding: 11px 6px; font-size: 13px; }
.acts .cobrar { grid-column: span 3; font-size: 20px; padding: 16px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pay-total { text-align: center; background: var(--grad); color: #fff; border-radius: 14px; padding: 12px; margin-bottom: 14px; }
.pay-total .v { font-size: 32px; font-weight: 900; }
.pay-total .u { font-size: 13px; opacity: .9; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quick button { flex: 1; min-width: 54px; }
.pay-res { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--lila); display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; }
.pay-res.ok { background: #d1fae5; color: #065f46; }
.pay-res.falta { background: #fee2e2; color: #991b1b; }
.cuentas { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.cta { border: 2px solid var(--borde); border-radius: 14px; padding: 12px; cursor: pointer; background: #fff; text-align: left; font-family: inherit; color: var(--morado-txt); }
.cta:hover { border-color: var(--rosa); }
.cta .t { font-weight: 800; font-size: 15px; }
.cta .m { font-size: 12px; color: var(--gris); }
.cta .v { font-weight: 900; color: var(--rosa-2); font-size: 18px; margin-top: 4px; }
.cta.pide { border-color: var(--rosa); background: var(--rosa-claro); animation: pulso 1.4s infinite; }
@keyframes pulso { 50% { box-shadow: 0 0 0 4px rgba(236,72,153,.35); } }
.den { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.den .d { display: flex; align-items: center; gap: 6px; background: var(--lila); padding: 6px 8px; border-radius: 10px; }
.den .d b { width: 62px; font-size: 13px; }
.den .d input { padding: 6px; }
.resumen-corte .r { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--borde); }
.resumen-corte .r.b { font-weight: 800; color: var(--morado-osc); }
.qr-box { text-align: center; padding: 10px; }
.qr-box svg { width: 240px; height: 240px; border: 6px solid #fff; box-shadow: var(--sombra); border-radius: 10px; }
.print-frame { position: absolute; width: 0; height: 0; border: 0; left: -9999px; }
@media (max-width: 980px) {
  .pos { height: auto; min-height: 100vh; }
  .pos-body { flex-direction: column; }
  .pos-right { width: 100%; border-left: 0; border-top: 2px solid var(--borde); }
  .prods { max-height: 50vh; }
  .pay-grid { grid-template-columns: 1fr; }
}

.ped { max-width: 900px; margin: 0 auto; min-height: 100vh; background: var(--lila); }
.ped-top { background: var(--grad); color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 10; }
.ped-top .t { font-weight: 800; font-size: 17px; flex: 1; }
.ped-top button, .ped-top a { background: rgba(255,255,255,.2); border: 0; color: #fff; padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; font-family: inherit; }
.mesas { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding: 14px; }
.mesa { background: #fff; border: 3px solid var(--borde); border-radius: 18px; padding: 18px 10px; text-align: center; cursor: pointer; font-family: inherit; color: var(--morado-txt); }
.mesa .n { font-size: 18px; font-weight: 800; }
.mesa .s { font-size: 12px; color: var(--gris); margin-top: 4px; }
.mesa .v { font-size: 16px; font-weight: 800; color: var(--rosa-2); margin-top: 4px; }
.mesa.ocupada { border-color: var(--morado); background: var(--lila-2); }
.mesa.pide { border-color: var(--rosa); background: var(--rosa-claro); }
.ped-sec { padding: 0 14px 14px; }
.ped-list { background: #fff; border-radius: 14px; padding: 6px 12px; box-shadow: var(--sombra); }
.ped-list .ci:last-child { border-bottom: 0; }
.ped-bottom { position: sticky; bottom: 0; background: #fff; padding: 12px 14px; border-top: 2px solid var(--borde); display: flex; gap: 8px; z-index: 10; }
.ped-bottom .btn { flex: 1; padding: 14px 8px; font-size: 15px; }
.ped .cats { padding: 12px 14px 4px; }
.ped .prods { padding: 6px 14px 14px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); max-height: none; overflow: visible; }

.tk-prev { background: #e5e7eb; padding: 16px; border-radius: 12px; display: flex; justify-content: center; }
.tk-prev .tk { box-shadow: 0 4px 14px rgba(0,0,0,.15); padding: 10px; }
