/* =========================================================
   RratSoft POS (demo) — estilos
   ========================================================= */
:root {
  --bg: #f2f2ee;
  --panel: #ffffff;
  --soft: #f7f7f4;
  --ink: #121417;
  --ink-2: #2b2f35;
  --muted: #6b7179;
  --line: #e5e4de;
  --line-2: #d6d5ce;
  --lime: #9dff3a;          /* acento RratSoft */
  --ok: #1f7a3a;
  --warn: #a8660b;
  --warn-bg: #fdf3e1;
  --bad: #c43d55;
  --bad-bg: #fcebee;
  --yape: #6c2c91;
  --plin: #0f8fb3;
  --card: #2f3b4c;
  --radius: 14px;
  --radius-sm: 10px;
  --bar-h: 64px;
  --demo-h: 40px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .88em; }

kbd {
  padding: 1px 6px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: .7rem;
  opacity: .55;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn .ti { font-size: 1.1rem; }
.btn--block { width: 100%; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--ink-2); }
.btn--light { background: var(--panel); border-color: var(--line-2); }
.btn--light:hover { border-color: var(--ink); }
.btn--pay {
  justify-content: space-between;
  height: 54px;
  padding: 0 20px;
  background: var(--ink);
  color: var(--lime);
  font-size: 1.05rem;
}
.btn--pay:hover { background: var(--ink-2); }
.btn--pay[disabled] { background: var(--line); color: var(--muted); cursor: default; }
#pay-confirm { justify-content: center; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  cursor: pointer;
}
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn--sm { width: 32px; height: 32px; font-size: 1rem; }

.link-btn { padding: 4px 6px; border: 0; background: none; color: var(--muted); font-size: .88rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--ink); }

/* ---------- Aviso de demo ---------- */
.demo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--demo-h);
  padding: 0 16px;
  background: #0a0b0d;
  color: #c9cdc8;
  font-size: .84rem;
}
.demo-bar b { color: var(--lime); font-weight: 600; }
.demo-bar p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.demo-bar__actions { display: flex; gap: 14px; flex: none; }
.demo-bar button, .demo-bar a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: #c9cdc8;
  font-size: .84rem;
  text-decoration: none;
  cursor: pointer;
}
.demo-bar a { color: var(--lime); font-weight: 600; }
.demo-bar button:hover, .demo-bar a:hover { text-decoration: underline; }

/* ---------- Estructura ---------- */
.app {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - var(--demo-h));
  height: calc(100dvh - var(--demo-h));
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--ink);
}
.rail__logo { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; }
.rail__btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 68px;
  padding: 10px 0 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #8d939b;
  font-size: .72rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.rail__btn .ti { font-size: 1.45rem; }
.rail__btn:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.rail__btn.is-on { color: #fff; background: rgba(255, 255, 255, .08); }
.rail__btn.is-on::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--lime);
}
.rail__btn.is-on .ti { color: var(--lime); }

.main { display: grid; grid-template-rows: var(--bar-h) minmax(0, 1fr); min-width: 0; min-height: 0; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.bar__name { font-weight: 700; }
.bar__addr { color: var(--muted); font-size: .8rem; }
.bar__meta { display: flex; align-items: center; gap: 18px; font-size: .86rem; }
.bar__clock { color: var(--muted); font-family: var(--mono); font-size: .8rem; text-transform: capitalize; }
.bar__user { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.bar__user .ti { font-size: 1.3rem; color: var(--muted); }

.status { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.is-open { background: #e7f5ea; color: var(--ok); }
.status.is-closed { background: var(--bad-bg); color: var(--bad); }

.view { overflow-y: auto; padding: 28px; }
.view__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.view__head h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
.view__head .muted { margin-top: 2px; font-size: .9rem; }
.subhead { margin: 28px 0 12px; font-size: 1rem; }

/* ---------- Venta ---------- */
/* La fila debe quedar fija al alto de la pantalla para que el catálogo
   y la lista del ticket hagan scroll y el botón Cobrar siempre se vea */
.view--venta { display: grid; grid-template-columns: minmax(0, 1fr) 390px; grid-template-rows: minmax(0, 1fr); padding: 0; overflow: hidden; }
.catalog { overflow-y: auto; padding: 22px 24px 32px; }
.catalog__top { display: flex; gap: 8px; margin-bottom: 8px; }
.catalog__top .search { flex: 1; min-width: 0; }
.btn--scan, .btn--sim { flex: none; height: 48px; padding: 0 16px; border-radius: 12px; }
.btn--scan { background: var(--ink); color: #fff; }
.btn--scan .ti { color: var(--lime); font-size: 1.25rem; }
.btn--scan:hover { background: var(--ink-2); }
.btn--sim .ti { font-size: 1.2rem; }
.scan-hint { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 14px; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.scan-hint .ti { flex: none; margin-top: 1px; font-size: 1rem; }

/* Lector con cámara */
.modal--scan { width: min(440px, calc(100% - 24px)); }
.scanbox { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #0b0c0e; }
.scanbox video { width: 100%; height: 100%; object-fit: cover; }
.scanbox__frame { position: absolute; inset: 22% 12%; border: 2px solid var(--lime); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scanbox__laser { position: absolute; left: 6px; right: 6px; top: 50%; height: 2px; background: #ff3b3b; box-shadow: 0 0 10px #ff3b3b; animation: laser 1.6s ease-in-out infinite alternate; }
@keyframes laser { from { top: 12%; } to { top: 88%; } }
.scanbox.is-off video, .scanbox.is-off .scanbox__laser { display: none; }
.scanbox.is-off .scanbox__frame { border-style: dashed; border-color: #555; }
.scan-status { color: var(--ink-2); font-size: .9rem; line-height: 1.45; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(18, 20, 23, .08); }
.search .ti { font-size: 1.3rem; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; }
.search--sm { height: 42px; width: min(320px, 100%); }

.chips { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel);
  font-size: .86rem;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }

.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.pcard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 122px;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s var(--ease);
}
.pcard:hover { border-color: var(--ink); box-shadow: 0 8px 20px -14px rgba(18, 20, 23, .45); }
.pcard:active { transform: scale(.98); }
.pcard.is-out { opacity: .5; cursor: not-allowed; }
.pcard__img {
  display: grid;
  place-items: center;
  width: 100%;
  height: 92px;
  margin-bottom: 6px;
  border-radius: 9px;
  background: var(--soft);
  overflow: hidden;
}
.pcard__img img { width: 82px; height: 82px; object-fit: contain; }
.pcard__img .ti { font-size: 2rem; color: var(--muted); }
.pcard__cat { color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.pcard__name { font-weight: 600; line-height: 1.3; }
.pcard__foot { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; width: 100%; margin-top: auto; padding-top: 8px; }
.pcard__foot b { font-family: var(--mono); font-size: 1rem; font-weight: 600; }
.pcard__foot em { font-style: normal; font-size: .74rem; color: var(--muted); }
.pcard__foot em.is-low { color: var(--warn); font-weight: 600; }
.pcard__foot em.is-out { color: var(--bad); font-weight: 600; }
.pcard__qty {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--lime);
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 600;
}
.muted-empty { padding: 40px 0; text-align: center; color: var(--muted); }

/* Ticket */
.ticket {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.ticket__head { display: flex; align-items: center; gap: 8px; padding: 18px 20px 12px; }
.ticket__head h2 { flex: 1; font-size: 1.1rem; }
.ticket__close { display: none; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0 20px; padding: 4px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg input:checked + span { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(18, 20, 23, .12); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); }
.seg em { font-style: normal; padding: 0 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: .72rem; }
.seg--inline { display: inline-grid; grid-template-columns: auto auto; margin: 0; }

.client { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); }

.field { display: grid; gap: 5px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.field input, .field select {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: .92rem;
  font-weight: 400;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(18, 20, 23, .08); }
.field input[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-bg); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row--3 { grid-template-columns: 1fr 1fr 1fr; }

.lines { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 20px; }
.line {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto 70px 24px;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.line__img { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: var(--soft); overflow: hidden; }
.line__img img { width: 34px; height: 34px; object-fit: contain; }
.line__img .ti { color: var(--muted); }
.line.is-flash { animation: flash .6s var(--ease); }
@keyframes flash { from { background: rgba(157, 255, 58, .35); } }
.line__name { font-weight: 600; font-size: .9rem; line-height: 1.3; }
.line__unit { color: var(--muted); font-size: .76rem; font-family: var(--mono); }
.line__total { text-align: right; font-family: var(--mono); font-weight: 600; font-size: .9rem; }
.line__del { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.line__del:hover { background: var(--bad-bg); color: var(--bad); }

.qty { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.qty button { display: grid; place-items: center; width: 28px; height: 30px; border: 0; background: var(--soft); cursor: pointer; }
.qty button:hover { background: var(--line); }
.qty input { width: 34px; height: 30px; border: 0; text-align: center; font-family: var(--mono); font-weight: 600; outline: none; }

.ticket__empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px 40px; text-align: center; color: var(--muted); font-size: .9rem; }
.ticket__empty .ti { font-size: 2.4rem; color: var(--line-2); }

.ticket__foot { padding: 14px 20px 20px; border-top: 1px solid var(--line); background: var(--soft); }
.sums { display: grid; gap: 4px; margin: 0 0 14px; font-size: .88rem; }
.sums div { display: flex; justify-content: space-between; color: var(--muted); }
.sums dd { margin: 0; font-family: var(--mono); }
.sums__total { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--line-2); color: var(--ink) !important; font-size: 1.3rem; font-weight: 700; }

.ticket-fab { display: none; }

/* ---------- Tablas ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfbf9; }
.table .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.table .act { width: 1%; text-align: right; }
.cell-name { font-weight: 600; margin-right: 8px; }
.empty-row { padding: 32px !important; text-align: center; color: var(--muted); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 600; vertical-align: 1px; }
.tag.is-low { background: var(--warn-bg); color: var(--warn); }
.tag.is-out { background: var(--bad-bg); color: var(--bad); }
.stock { font-weight: 600; }
.stock.is-low { color: var(--warn); }
.stock.is-out { color: var(--bad); }

.method { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 500; }
.method::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.method--efectivo::before, .hbars__fill.method--efectivo { background: var(--ok); }
.method--yape::before, .hbars__fill.method--yape { background: var(--yape); }
.method--plin::before, .hbars__fill.method--plin { background: var(--plin); }
.method--tarjeta::before, .hbars__fill.method--tarjeta { background: var(--card); }

/* ---------- Tarjetas de cifras ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.stat__label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat__value { margin-top: 6px; font-family: var(--mono); font-size: 1.45rem; font-weight: 600; letter-spacing: -0.02em; }
.stat__sub { margin-top: 2px; color: var(--muted); font-size: .76rem; }
.stat--accent { background: var(--ink); border-color: var(--ink); color: #fff; }
.stat--accent .stat__label, .stat--accent .stat__sub { color: #9aa0a7; }
.stat--accent .stat__value { color: var(--lime); }

/* ---------- Reportes ---------- */
.rep-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.panel { padding: 18px 20px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.panel h2 { margin-bottom: 16px; font-size: .95rem; }
.panel--wide { grid-column: 1 / -1; }

.bars { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); align-items: end; gap: 8px; height: 200px; }
.bars__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bars__val { font-family: var(--mono); font-size: .66rem; color: var(--muted); }
.bars__bar { width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: var(--ink); transition: height .5s var(--ease); }
.bars__col.is-now .bars__bar { background: var(--lime); box-shadow: inset 0 0 0 1px rgba(18, 20, 23, .15); }
.bars__label { font-family: var(--mono); font-size: .7rem; color: var(--muted); }

.hbars { display: grid; gap: 14px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 6px 10px; align-items: center; }
.hbars__row { display: flex; justify-content: space-between; grid-column: 1 / -1; font-size: .88rem; }
.hbars__row b { font-family: var(--mono); font-weight: 600; }
.hbars__track { height: 8px; border-radius: 8px; background: var(--soft); overflow: hidden; }
.hbars__fill { display: block; height: 100%; border-radius: inherit; }
.hbars__pct { font-family: var(--mono); font-size: .76rem; color: var(--muted); text-align: right; }

.rank { counter-reset: rank; display: grid; gap: 2px; }
.rank li { counter-increment: rank; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 0 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank li::before { content: counter(rank); grid-row: 1 / 3; align-self: center; color: var(--muted); font-family: var(--mono); font-size: .8rem; }
.rank__name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank__qty { grid-column: 2; color: var(--muted); font-size: .78rem; }
.rank__amt { grid-column: 3; grid-row: 1 / 3; align-self: center; font-family: var(--mono); font-size: .86rem; font-weight: 600; }

.low { display: grid; gap: 2px; }
.low li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.low li:last-child { border-bottom: 0; }
.low .stock { font-family: var(--mono); font-size: .8rem; white-space: nowrap; }

/* ---------- Ventanas ---------- */
.modal {
  width: min(440px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 40px 80px -30px rgba(18, 20, 23, .55);
}
.modal::backdrop { background: rgba(18, 20, 23, .45); }
.modal[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal__inner { display: grid; gap: 14px; padding: 20px 22px 22px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; }
.modal__head h2 { font-size: 1.15rem; }
.modal__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.form-error { min-height: 1.2em; color: var(--bad); font-size: .85rem; font-weight: 500; }
.form-error:empty { display: none; }

/* Cobro */
.pay__total { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 18px; border-radius: 12px; background: var(--ink); color: #fff; }
.pay__total span { color: #9aa0a7; font-size: .86rem; }
.pay__total b { font-family: var(--mono); font-size: 1.7rem; color: var(--lime); }

.methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.methods input { position: absolute; opacity: 0; pointer-events: none; }
.methods span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.methods .ti { font-size: 1.4rem; color: var(--muted); }
.methods input:checked + span { border-color: var(--ink); background: var(--soft); box-shadow: inset 0 0 0 1px var(--ink); }
.methods input:checked + span .ti { color: var(--ink); }
.methods input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.cash, .digital { display: grid; gap: 10px; }
.cash .field input { height: 48px; font-family: var(--mono); font-size: 1.2rem; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); font-family: var(--mono); font-size: .86rem; cursor: pointer; }
.quick button:hover { border-color: var(--ink); }
.change { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-radius: 10px; background: #e7f5ea; color: var(--ok); }
.change b { font-family: var(--mono); font-size: 1.3rem; }
.change b.is-neg { color: var(--bad); }
.digital p { padding: 12px 14px; border-radius: 10px; background: var(--soft); color: var(--ink-2); font-size: .88rem; }

/* Comprobante */
.modal--receipt { width: min(380px, calc(100% - 24px)); background: var(--bg); }
.receipt-ok { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 600; }
.receipt-ok .ti { font-size: 1.4rem; }
.paper {
  max-height: 60vh;
  overflow-y: auto;
  padding: 20px 18px 16px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(18, 20, 23, .12), 0 12px 24px -16px rgba(18, 20, 23, .4);
  font-family: var(--mono);
  font-size: .76rem;
  line-height: 1.5;
  color: #1b1d20;
}
.paper p { margin: 0; }
.paper__head, .paper__doc, .paper__foot, .paper__demo { text-align: center; }
.paper__brand { font-family: var(--sans); font-size: 1rem; font-weight: 700; }
.paper__doc { margin: 12px 0; padding: 8px 0; border-top: 1px dashed #b9b9b2; border-bottom: 1px dashed #b9b9b2; font-weight: 600; }
.paper__num { font-size: .9rem; }
.paper__meta { margin-bottom: 10px; }
.paper__items { width: 100%; border-collapse: collapse; }
.paper__items th { padding: 4px 0; border-bottom: 1px dashed #b9b9b2; font-weight: 600; text-align: left; }
.paper__items th:last-child, .paper__items td:last-child { text-align: right; }
.paper__items td { padding: 4px 4px 4px 0; vertical-align: top; }
.paper__items td:first-child { width: 34px; }
.paper__items small { display: block; color: #6b7179; font-size: .92em; }
.paper__sums { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed #b9b9b2; }
.paper__sums div { display: flex; justify-content: space-between; }
.paper__sums dd { margin: 0; }
.paper__total { margin-top: 4px; font-size: .95rem; font-weight: 700; }
.paper__words { margin-top: 8px !important; font-size: .92em; }
.paper__pay { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #b9b9b2; }
.paper__qr { display: block; width: 96px; height: 96px; margin: 14px auto 6px; fill: #1b1d20; shape-rendering: crispEdges; }
.paper__foot { margin-top: 8px !important; color: #4a4f55; }
.paper__demo { margin-top: 10px !important; padding: 4px; border: 1px solid #1b1d20; font-weight: 600; letter-spacing: .1em; }

/* Caja */
.arqueo { display: grid; gap: 6px; margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--soft); font-size: .9rem; }
.arqueo div { display: flex; justify-content: space-between; color: var(--muted); }
.arqueo dd { margin: 0; font-family: var(--mono); }
.arqueo__total { margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--line-2); color: var(--ink) !important; font-weight: 700; }
.arqueo__diff { font-size: .88rem; font-weight: 600; }
.arqueo__diff.is-ok { color: var(--ok); }
.arqueo__diff.is-neg { color: var(--bad); }

/* Aviso flotante */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: .88rem;
  font-weight: 500;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   Tablet y celular
   ========================================================= */
@media (max-width: 1180px) {
  .btn--sim span { display: none; }
  .btn--sim { width: 48px; padding: 0; justify-content: center; }
  .view--venta { grid-template-columns: minmax(0, 1fr) 340px; }
  .client { grid-template-columns: 1fr; }
  .rep-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 899px) {
  :root { --bar-h: 56px; }
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 62px; }
  .main { grid-row: 1; }

  /* Menú abajo, como app */
  .rail { grid-row: 2; flex-direction: row; justify-content: space-around; gap: 0; padding: 4px 6px; }
  .rail__logo { display: none; }
  .rail__btn { width: auto; flex: 1; padding: 6px 0; }
  .rail__btn.is-on::before { left: 30%; right: 30%; top: -4px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }

  .bar { padding: 0 16px; }
  .bar__addr, .bar__user, .bar__clock { display: none; }

  .view { padding: 18px 16px 24px; }
  .view--venta { grid-template-columns: 1fr; padding: 0; }
  .catalog { padding: 14px 16px 96px; }

  /* Ticket como hoja que sube */
  .ticket {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    max-height: 88dvh;
    border-left: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 50px -20px rgba(18, 20, 23, .5);
    transform: translateY(105%);
    transition: transform .3s var(--ease);
  }
  .ticket.is-open { transform: none; }
  .ticket__close { display: inline-grid; }
  .client { grid-template-columns: 116px minmax(0, 1fr); }
  .lines { min-height: 80px; }

  .ticket-fab {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 74px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 54px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background: var(--ink);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 14px 30px -14px rgba(18, 20, 23, .7);
    cursor: pointer;
  }
  .ticket-fab .ti { font-size: 1.3rem; color: var(--lime); }
  .ticket-fab span { flex: 1; text-align: left; }
  .ticket-fab b { font-family: var(--mono); color: var(--lime); }

  .pgrid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .pcard { min-height: 112px; padding: 8px 10px 10px; }
  .pcard__img { height: 76px; }
  .pcard__img img { width: 66px; height: 66px; }
  .btn--scan span, .btn--sim span { display: none; }
  .btn--scan, .btn--sim { width: 48px; padding: 0; justify-content: center; }
  .search kbd, .btn--pay kbd { display: none; }
  .btn--pay { justify-content: center; }

  .view__head { flex-wrap: wrap; align-items: flex-start; }
  .rep-grid { grid-template-columns: 1fr; }
  .bars { gap: 3px; height: 160px; }
  .bars__val { display: none; }
  .hide-sm { display: none; }
  .toast { bottom: 140px; }
}

@media (max-width: 520px) {
  .demo-bar p { display: none; }
  .demo-bar { justify-content: center; }
  .field-row, .field-row--3 { grid-template-columns: 1fr 1fr; }
  .methods { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat__value { font-size: 1.15rem; }
  .seg span { padding: 0 6px; font-size: .78rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Impresión: solo el comprobante ---------- */
@media print {
  body { background: #fff; overflow: visible; }
  .demo-bar, .app, .toast, .receipt-ok, .modal--receipt .modal__actions { display: none !important; }
  .modal--receipt { position: static; width: 80mm; max-height: none; box-shadow: none; background: #fff; }
  .modal--receipt::backdrop { background: none; }
  .paper { max-height: none; overflow: visible; box-shadow: none; padding: 0; }
}
