@font-face { font-family: Figtree; src: url(/figtree.woff2) format('woff2'); font-weight: 300 900; font-display: swap; }

:root {
  --bg: #eef2f7; --panel: #ffffff; --line: #d9e0ea; --ink: #142033; --muted: #5d6b80; --soft: #f5f8fc;
  --nav: #0b1a33; --nav-ink: #e8eef8; --accent: #1f6fe5; --accent-ink: #ffffff; --accent-soft: #e3eeff;
  --ok: #15803d; --ok-soft: #e3f6e9; --warn: #b45309; --warn-soft: #fff3df; --bad: #c2410c; --bad-soft: #ffe9df;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.4 Figtree, 'Segoe UI', system-ui, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: .5em .9em; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.danger { color: var(--bad); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: .5em .7em; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
label { display: block; font-size: .85rem; color: var(--muted); margin: .6em 0 .25em; }
kbd { font: 600 .72rem var(--mono); background: var(--soft); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: .05em .4em; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.pill { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15em .6em; border-radius: 99px; background: var(--soft); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.practice { background: #ffe9a8; color: #6b4a00; }
.msg { padding: .6em .8em; border-radius: 8px; background: var(--soft); margin: .5em 0; }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- Barra ---------- */
.bar { display: flex; align-items: center; gap: 1rem; background: var(--nav); color: var(--nav-ink); padding: .55rem 1rem; }
.bar img { height: 26px; }
.bar .brand { font-weight: 700; letter-spacing: .01em; }
.bar .sep { opacity: .35; }
.bar .spacer { flex: 1; }
.bar a { color: var(--nav-ink); opacity: .8; text-decoration: none; }
.bar a:hover { opacity: 1; }
.bar .clock { font-variant-numeric: tabular-nums; opacity: .85; }

/* ---------- Caja ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; padding: 1rem; height: calc(100vh - 46px); }
.pos-main { display: flex; flex-direction: column; min-height: 0; gap: .75rem; }
.scan { display: flex; gap: .6rem; align-items: center; background: var(--panel); border: 2px solid var(--accent); border-radius: var(--radius); padding: .4rem .6rem; }
.scan input { border: 0; font-size: 1.6rem; font-weight: 600; padding: .25em .3em; outline: none; }
.scan .mult { font: 700 1.3rem var(--mono); color: var(--accent); white-space: nowrap; }
.last { background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); padding: .7rem 1rem; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; min-height: 4.2rem; }
.last .desc { font-size: 1.35rem; font-weight: 700; }
.last .detail { color: var(--muted); }
.last .amount { font-size: 1.8rem; font-weight: 700; }
.last.error { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.items { flex: 1; min-height: 0; overflow: auto; background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; background: var(--soft); text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: .55em .8em; border-bottom: 1px solid var(--line); }
td { padding: .5em .8em; border-bottom: 1px solid var(--line); }
.items tr.sel td { background: var(--accent-soft); }
.items td.n { color: var(--muted); width: 2.5em; }
.items .empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.side { display: flex; flex-direction: column; gap: .75rem; min-height: 0; }
.totalbox { background: var(--nav); color: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; }
.totalbox .label { opacity: .7; font-size: .9rem; }
.totalbox .total { font-size: 3.2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.totalbox .count { opacity: .8; }
.docbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; }
.docbox strong { display: block; font-size: 1.05rem; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.keys button { display: flex; justify-content: space-between; align-items: center; gap: .4rem; padding: .65em .8em; text-align: left; }
.keys button.wide { grid-column: span 2; font-size: 1.25rem; padding: .8em 1em; }
.keys button.primary kbd { background: rgba(255, 255, 255, .2); color: #fff; border-color: rgba(255, 255, 255, .35); }
.recent { flex: 1; min-height: 0; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: .85rem; }
.recent td { padding: .35em .6em; }

/* ---------- Diálogos ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(11, 26, 51, .35); color: var(--ink); }
dialog.wide { width: min(860px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(11, 26, 51, .55); }
dialog header { padding: 1rem 1.2rem .4rem; font-size: 1.25rem; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
dialog .body { padding: .2rem 1.2rem 1rem; max-height: 72vh; overflow: auto; }
dialog footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.2rem 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.choices button { text-align: left; padding: .8em; }
.choices button.on { border: 2px solid var(--accent); background: var(--accent-soft); }
.pay-total { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pay-list td { padding: .35em .5em; }
.change { font-size: 2rem; font-weight: 800; color: var(--ok); }
.big-amount { font-size: 1.8rem; font-weight: 700; text-align: right; }
.results { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: .6rem; }
.results tr { cursor: pointer; }
.results tr.sel td { background: var(--accent-soft); }

/* Vista previa del ticket */
.receipt { font: 12px/1.35 var(--mono); background: #fffef8; border: 1px solid var(--line); border-radius: 6px; padding: .8rem; white-space: pre; overflow: auto; max-height: 46vh; color: #1b1b1b; }
.receipt .b { font-weight: 700; }
.receipt .h { font-size: 15px; font-weight: 700; }
.receipt .qr { display: block; text-align: center; padding: .4rem; color: var(--accent); }

/* ---------- Ingreso ---------- */
.login { min-height: calc(100vh - 46px); display: grid; place-items: center; padding: 1rem; }
.login .card { background: var(--panel); border-radius: 16px; padding: 1.6rem; width: min(440px, 100%); box-shadow: 0 10px 40px rgba(11, 26, 51, .12); }
.login h1 { margin: 0 0 .3rem; font-size: 1.5rem; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .6rem; }
.pinpad button { font-size: 1.3rem; padding: .7em; }

/* ---------- Administración ---------- */
.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 46px); }
.admin nav { background: var(--panel); border-right: 1px solid var(--line); padding: .8rem; display: flex; flex-direction: column; gap: .2rem; }
.admin nav button { border: 0; text-align: left; background: none; padding: .6em .8em; }
.admin nav button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.admin main { padding: 1.2rem 1.4rem; overflow: auto; }
.admin h2 { margin: .2rem 0 1rem; font-size: 1.35rem; }
.admin h3 { margin: 1.4rem 0 .5rem; font-size: 1.05rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.card .big { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.tablewrap tr.click { cursor: pointer; }
.tablewrap tr.click:hover td { background: var(--soft); }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--nav); color: #fff; padding: .7em 1.2em; border-radius: 10px; z-index: 50; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.toast.bad { background: var(--bad); }

@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; height: auto; }
  .items { min-height: 40vh; }
  .admin { grid-template-columns: 1fr; }
  .admin nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ---------- Marca del comercio (los colores vienen de /tema.css) ---------- */
:root { --brand: var(--accent); --brand-dark: #0b1a33; --go: #15803d; --go-dark: #116b33; --go-soft: #e3f6e9; --accent2: #f59e0b; }
button.primary { background: var(--go); border-color: var(--go); }
button.primary:hover { background: var(--go-dark); border-color: var(--go-dark); }
.bar { background: var(--brand); }
.bar .clientlogo { height: 34px; width: auto; display: block; }
.bar .poweredby { font-size: .72rem; opacity: .85; display: flex; align-items: center; gap: .35rem; white-space: nowrap; }
.bar .poweredby img { height: 14px; }
.scan { border-color: var(--brand); }
.scan .mult { color: var(--brand); }
.totalbox { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.keys button.wide.primary { background: var(--go); border-color: var(--go); }
.pill.practice { background: var(--accent2); color: #3b2f00; }
.last { gap: .9rem; }
.last .photo, .thumb { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.thumb { width: 40px; height: 40px; }
.last .info { flex: 1; min-width: 0; }
.results td.ph { width: 52px; }

/* Cobro con terminal */
.terminal { margin-top: .8rem; border: 2px dashed var(--line); border-radius: 12px; padding: .9rem 1rem; display: grid; gap: .5rem; }
.terminal.waiting { border-color: var(--accent2); background: #fffaf0; }
.terminal.ok { border-color: var(--go); background: var(--go-soft); }
.terminal.bad { border-color: var(--bad); background: var(--bad-soft); }
.terminal .head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-weight: 700; }
.terminal .qrbox { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.terminal .qrbox img { width: 190px; height: 190px; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.terminal .wallets { font-size: .8rem; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.receipt img.qrimg { width: 132px; height: 132px; display: block; margin: .3rem auto; }
.cuotas { display: flex; gap: .4rem; flex-wrap: wrap; }
.cuotas button.on { border: 2px solid var(--brand); background: var(--brand-soft, var(--accent-soft)); }
.bar { flex-wrap: nowrap; min-height: 50px; }
.bar > * { flex: none; }
@media (max-width: 1000px) { .bar .clock, .bar .poweredby, .bar .sep { display: none; } .bar { gap: .6rem; } }
.bar .muted { color: rgba(255, 255, 255, .82); }
#arows td:not(:nth-child(2)) { white-space: nowrap; }

.items tr.promo td { color: var(--go); font-weight: 600; padding-top: 0; font-size: .9rem; border-bottom-style: dashed; }
.items tr.promo td:nth-child(2)::before { content: '↳ '; }

#dcanvas .el { cursor: move; }
#dcanvas .el.sel { outline: 1.5px solid #1f6fe5; z-index: 2; }
#dcanvas .el.sel::after { content: ''; position: absolute; right: 0; bottom: 0; width: 8px; height: 8px; background: #1f6fe5; cursor: nwse-resize; }
#dcanvas .el:hover { outline: 1px dashed #1f6fe5; }
#dcanvas .el.ghost { outline: 1px dotted #bbb; }

/* QR en la caja */
.terminal.qrmode { border: 0; padding: 0; background: none; }
.qrcard { border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); border: 1px solid var(--line); background: #fff; }
.qrhead { background: var(--brand); color: #fff; display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; font-size: 1.1rem; }
.qrhead strong { font-size: 1.6rem; }
.qrbody { display: flex; gap: 1.2rem; padding: 1rem; align-items: center; flex-wrap: wrap; }
.qrbody img { width: 230px; height: 230px; }
.qrside { flex: 1; min-width: 220px; }
.qrside .big { font-weight: 700; font-size: 1.05rem; margin-top: 0; }
.qrside .apps { display: flex; flex-wrap: wrap; gap: .35rem; }
.qrside .apps span { background: var(--soft); border-radius: 99px; padding: .2em .7em; font-size: .78rem; font-weight: 600; }
.waitline { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--warn); }
#dpay.waiting #pmedios, #dpay.waiting #pamount, #dpay.waiting #pamountlabel { display: none; }

/* ---------- Modo táctil ---------- */
.numpad { display: none; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin-top: .6rem; }
body.touchmode .numpad { display: grid; }
.numpad button { font-size: 1.5rem; font-weight: 700; padding: .55em; }
body.touchmode .pos { grid-template-columns: minmax(0, 1fr) 400px; }
body.touchmode .pos-main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 2.4fr) auto auto minmax(0, 1fr); }
.touch, .ttabs, .tgrid { min-width: 0; }
body.touchmode .scan input { font-size: 1.2rem; }
body.touchmode .last { min-height: 0; padding: .5rem .8rem; }
body.touchmode .last .photo { width: 44px; height: 44px; }
.touch { display: flex; flex-direction: column; gap: .5rem; min-height: 0; background: var(--panel); border-radius: var(--radius); border: 1px solid var(--line); padding: .6rem; }
.ttabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; }
.ttabs button { white-space: nowrap; border-radius: 99px; padding: .5em 1em; font-weight: 600; }
.ttabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tgrid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: .55rem; align-content: start; }
.tile { position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: left; padding: .45rem; border-radius: 12px; min-height: 168px; gap: .25rem; touch-action: manipulation; user-select: none; }
.tile .ph { height: 84px; display: grid; place-items: center; background: #fff; border-radius: 8px; overflow: hidden; }
.tile .ph img { max-width: 100%; max-height: 84px; object-fit: contain; }
.tile .ini { font-size: 1.8rem; font-weight: 800; color: var(--brand); text-transform: uppercase; }
.tile .nm { font-size: .8rem; line-height: 1.15; max-height: 2.3em; overflow: hidden; }
.tile .pr { font-weight: 800; font-size: 1.05rem; margin-top: auto; }
.tile .pr small { font-weight: 600; color: var(--muted); }
.tile .of { position: absolute; top: .4rem; left: .4rem; right: .4rem; background: var(--go); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 6px; padding: .1em .4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .star { position: absolute; top: .3rem; right: .45rem; color: #f5b400; font-size: 1.1rem; }
.tile.hit { transform: scale(.96); background: var(--brand-soft, var(--accent-soft)); }
body.touchmode .keys button { padding: .9em .8em; font-size: 1.05rem; }
body.touchmode #dpay .choices button { padding: 1.1em .8em; font-size: 1.05rem; }

.bar2 { position: relative; height: 18px; background: var(--soft); border-radius: 5px; overflow: hidden; }
.bar2 span { position: absolute; inset: 0 auto 0 0; background: var(--brand); opacity: .75; border-radius: 5px; }
.bar2 em { position: relative; font-style: normal; font-size: .75rem; padding-left: .4rem; font-weight: 600; }
.card .big small { font-size: .9rem; font-weight: 500; }

/* Administración: ingreso y tablero */
.admlogin { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: grid; place-items: center; padding: 1rem; }
.admlogin .card { width: min(420px, 100%); padding: 1.6rem; border-radius: 16px; box-shadow: 0 10px 40px rgba(11, 26, 51, .12); }
.admlogin h1 { font-size: 1.4rem; margin: .8rem 0 .3rem; }
#admuser { font-size: .85rem; display: flex; gap: .4rem; align-items: center; }
.alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem; }
.alert { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .9rem; border-radius: 10px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-left: 5px solid #3b82f6; background: var(--panel); }
.alert.urgente { border-left-color: #ea580c; background: #fff4ec; }
.alert.revisar { border-left-color: #d97706; background: #fffaf0; }
.alert span { color: var(--muted); font-size: .85rem; }
.hours { display: flex; align-items: flex-end; gap: 4px; height: 150px; margin-top: .6rem; }
.hours div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.hours span { width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.hours em { font-style: normal; font-size: .7rem; color: var(--muted); }
