/* App del comercio: estilos del POS */
.appbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.side .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side a.support { background: #16a34a; color: #fff; }
.side a.support:hover { background: #15803d; }
.sync { font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; cursor: pointer; background: var(--surface); border: 1px solid var(--border); }
.sync.ok { color: var(--ok); } .sync.pend { color: var(--warn); } .sync.off, .sync.bad { color: var(--bad); }
.bad { color: var(--bad); }
.b { font-weight: 700; }
.center { text-align: center; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }

/* POS */
.pos { display: grid; grid-template-columns: 1fr 400px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .pos { grid-template-columns: 1fr; } .pos-right { order: -1; } }
.pos-search { display: flex; gap: 8px; margin-bottom: 12px; }
.pos-search input { font-size: 1.1rem; padding: 12px 14px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; max-height: calc(100vh - 170px); overflow-y: auto; padding-bottom: 6px; }
@media (max-width: 1000px) { .results { max-height: none; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.prod { display: grid; gap: 2px; text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; min-height: 96px; }
.prod:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.prod .pn { font-weight: 700; line-height: 1.2; }
.prod .pp { font-weight: 800; font-size: 1.05rem; color: var(--brand); margin-top: auto; }
.prod .ps { color: var(--muted); } .prod .ps.low { color: var(--bad); font-weight: 700; }
.pos-right { position: sticky; top: 16px; display: grid; gap: 12px; }
@media (max-width: 1000px) { .pos-right { position: static; } }
.cart { max-height: 46vh; overflow-y: auto; display: grid; gap: 6px; }
.line { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.line .ld { min-width: 0; } .line .ld > div:first-child { font-weight: 600; overflow-wrap: anywhere; }
.lq { display: flex; align-items: center; gap: 2px; }
.qb, .qv { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; min-width: 32px; height: 32px; font: inherit; font-weight: 700; cursor: pointer; }
.qv { min-width: 44px; padding: 0 6px; }
.lt { font-weight: 700; min-width: 86px; }
.totals { border-top: 2px dashed var(--border); padding-top: 10px; display: grid; gap: 4px; }
.totals .total { font-size: 1.6rem; font-weight: 800; }

.paygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.paym { padding: 14px 10px; }
.payrow { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.qrcard { display: flex; gap: 16px; align-items: center; padding: 12px; border-radius: 12px; background: var(--surface-2); margin-top: 10px; flex-wrap: wrap; }
.qrcard #qrc { width: 150px; background: #fff; border-radius: 8px; padding: 4px; }
.qrcard #qrc svg { width: 100%; height: auto; display: block; }
.alias { font-size: 1.4rem; font-weight: 800; overflow-wrap: anywhere; }
.variants { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }

/* Dashboard */
.up { color: var(--ok); font-weight: 700; } .down { color: var(--bad); font-weight: 700; }
.chart { position: relative; margin-top: 8px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid-l { stroke: var(--border); stroke-width: 1; }
.chart .base-l { stroke: var(--muted); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .col { fill: var(--brand-2); }
.chart .col.today { fill: var(--brand); }
.chart .bar.on .col { fill: var(--brand); }
.chart .bar.on .hit { fill: color-mix(in srgb, var(--brand) 8%, transparent); }
.chart .tip { position: absolute; top: 0; width: 170px; background: var(--text); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: .82rem; pointer-events: none; box-shadow: var(--shadow); }
.chart details { margin-top: 6px; }
.hbars { display: grid; gap: 10px; }
.hb-l { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; margin-bottom: 4px; }
.hb-t { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hb-f { height: 100%; background: var(--brand-2); border-radius: 99px; }

/* Barra de escaneo (Vender) */
.scanbar { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; margin-bottom: 14px; padding: 10px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.scan-big { font-size: 1.15rem; letter-spacing: .04em; padding: 14px 26px; border-radius: 12px; }
.scan-ico { font-size: 1.4em; line-height: 1; }
.usb-hint { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .9rem; }
.usb-hint strong { color: var(--text); }
.usb-hint .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); animation: pulse 2s ease-in-out infinite; }
.scanbar.flash { animation: scanok .6s ease-out; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 10%, transparent); } }
@keyframes scanok { 0% { border-color: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 35%, transparent); } 100% { box-shadow: var(--shadow); } }
/* Celular / tablet táctil: botón enorme arriba, sin el aviso del lector USB */
@media (pointer: coarse), (max-width: 700px) {
  .scanbar { grid-template-columns: 1fr; padding: 0; background: none; border: 0; box-shadow: none; position: sticky; top: 0; z-index: 5; }
  .scan-big { width: 100%; font-size: 1.35rem; padding: 20px; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent); }
  .usb-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { .usb-hint .dot, .scanbar.flash { animation: none; } }

/* Mesas (gastronomía) */
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.tbl { display: grid; gap: 3px; text-align: left; padding: 14px; min-height: 104px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; align-content: start; }
.tbl .tn { font-weight: 800; font-size: 1.15rem; }
.tbl .tt { font-weight: 800; font-size: 1.05rem; }
.tbl .tm { color: var(--muted); font-size: .8rem; }
.tbl .tp { color: var(--warn); font-size: .78rem; font-weight: 700; }
.tbl.free { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.tbl.free .tm { color: var(--ok); font-weight: 600; }
.tbl.busy { border-color: var(--warn); background: var(--warn-bg); }
.tbl.late { border-color: var(--bad); background: var(--bad-bg); }
.tbl:hover { box-shadow: var(--shadow); }
.zone { margin: 4px 0 8px; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.legend { display: flex; gap: 10px; align-items: center; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; border: 2px solid; margin-right: -4px; }
.legend i.free { border-color: var(--ok); } .legend i.busy { border-color: var(--warn); background: var(--warn-bg); } .legend i.late { border-color: var(--bad); background: var(--bad-bg); }
.ordgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .ordgrid { grid-template-columns: 1fr; } .ordgrid > :first-child { order: 2; } }
.small-res { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: 50vh; }
.small-res .prod { min-height: 70px; }
.line.sent { opacity: .75; }
.tbl .tr { color: var(--ok); font-size: .8rem; font-weight: 800; animation: pulse-txt 1.2s ease-in-out infinite; }
@keyframes pulse-txt { 50% { opacity: .45; } }

/* Cocina */
.kboard { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 900px) { .kboard { grid-template-columns: 1fr; } }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px; display: grid; gap: 10px; min-height: 160px; align-content: start; }
.kcol h3 { margin: 2px 4px; display: flex; justify-content: space-between; align-items: center; }
.k-ready { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.kcard { background: var(--surface); border: 2px solid var(--border); border-left-width: 6px; border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; box-shadow: var(--shadow); }
.k-new .kcard { border-left-color: var(--brand); }
.k-preparing .kcard { border-left-color: var(--warn); }
.k-ready .kcard { border-left-color: var(--ok); }
.kcard.warn { background: var(--warn-bg); }
.kcard.late { background: var(--bad-bg); border-color: var(--bad); }
.kcard header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kcard header strong { font-size: 1.25rem; }
.kmin { font-weight: 700; font-size: .85rem; color: var(--muted); }
.kcard.late .kmin { color: var(--bad); }
.kcard ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: 1.08rem; }
.knote { color: var(--bad); font-weight: 700; font-size: .9rem; }
.kdone { display: grid; gap: 4px; padding: 8px 4px; }
.kready-list { display: grid; gap: 6px; }
@media (prefers-reduced-motion: reduce) { .tbl .tr { animation: none; } }

/* Soporte 24/7 */
.side a.support-247 { background: var(--brand); color: var(--brand-ink); position: relative; }
.side a.support-247:hover { filter: brightness(1.08); }
.side a.support-247.active { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.support-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: .75rem; display: grid; place-items: center; }
@media (max-width: 820px) { .support-badge { position: absolute; top: 2px; right: 4px; margin: 0; } }
.support-hero { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); gap: 12px; flex-wrap: wrap; }
tr.unread td { background: color-mix(in srgb, var(--ok) 7%, transparent); }
.chat { display: grid; gap: 10px; max-height: 50vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 85%; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.msg.user { justify-self: end; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.msg.admin { justify-self: start; border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.msg .mh { font-size: .75rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.msg .mb { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { justify-self: end; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.msg.admin { justify-self: start; background: var(--surface-2); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.support-badge[hidden] { display: none; }

/* Carta QR */
.alert.info { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border)); }
.qr-list { display: grid; gap: 6px; }
.qr-req { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.tbl .tq { color: var(--brand); font-size: .78rem; font-weight: 800; }
.tbl.qrcall { outline: 3px solid var(--brand); outline-offset: 2px; animation: qrpulse 1.6s ease-in-out infinite; }
@keyframes qrpulse { 50% { outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .tbl.qrcall { animation: none; } }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.qr-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px; text-align: center; background: var(--surface); }
.qr-card .qr svg { width: 130px; height: 130px; background: #fff; border-radius: 8px; }
.menu-prod { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.menu-prod input[type=text] { grid-column: 2; }
.cfg-tables { display: grid; gap: 6px; max-height: 46vh; overflow: auto; }
.cfg-row { display: grid; grid-template-columns: auto 1fr 1fr auto auto; gap: 6px; align-items: center; }
.cfg-row [hidden] { display: none; }
@media (max-width: 520px) { .cfg-row { grid-template-columns: auto 1fr auto auto; } .cfg-row [data-zone] { display: none; } }

/* Fotos de productos y tienda online */
.photo-field { display: flex; gap: 12px; align-items: center; }
.photo-box { width: 84px; height: 84px; flex: none; border: 1px dashed var(--border); border-radius: 10px; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: .75rem; background: var(--surface-2); }
.photo-box img { width: 100%; height: 100%; object-fit: cover; }
.photo-box [hidden] { display: none; }
.thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; flex: none; }
.shop-orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; align-items: start; }
.shop-order { gap: 6px; }
.side a[data-nav="shop"] { position: relative; }
.thumb.off { opacity: .3; filter: grayscale(1); }
.img-toggle { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: .8rem; color: var(--muted); }
.img-all { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }

/* Editor del encabezado público */
.page-editor-media { display: grid; gap: 10px; }
.page-cover { aspect-ratio: 16 / 6; max-height: 220px; width: 100%; border: 1px dashed var(--border); border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: .85rem; }
.page-cover img { width: 100%; height: 100%; object-fit: cover; }
.page-logo { width: 64px; height: 64px; flex: none; border: 1px dashed var(--border); border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: #fff; color: #64748b; font-size: .75rem; }
.page-logo img { width: 100%; height: 100%; object-fit: contain; }
.page-cover [hidden], .page-logo [hidden] { display: none; }

/* Aviso para instalar la app */
.app-install { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); padding: 8px 10px 8px 14px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgb(0 0 0 / .28); font-size: .9rem; }
.app-install span { min-width: 0; }
.app-install .btn { flex: none; }
