@font-face { font-family: Barlow; font-weight: 400; font-display: swap; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 500; font-display: swap; src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }

:root {
  --cobalt: #1537a8;
  --cobalt-deep: #0e2778;
  --marigold: #ffc720;
  --marigold-deep: #f0b400;
  --wall: #e6ecf7;
  --paper: #ffffff;
  --ink: #101a33;
  --muted: #55607a;
  --line: #cbd5e8;
  --red: #b3201f;
  --green: #116a3c;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: Barlow, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--wall); color: var(--ink); font: 400 16px/1.45 var(--body); margin: 0; min-height: 100vh; }
h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0 0 .5em; }
h1 { font-size: 34px; }
h2 { font-size: 24px; }
a { color: var(--cobalt); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

input, select, button { font: inherit; }
input, select {
  background: var(--paper); border: 1px solid #93a1be; border-radius: 4px; color: var(--ink);
  min-height: 44px; padding: 8px 10px; width: 100%;
}

.btn {
  background: var(--paper); border: 1px solid var(--cobalt); border-radius: 4px; color: var(--cobalt);
  cursor: pointer; display: inline-block; font-weight: 600; min-height: 44px; padding: 9px 16px; text-decoration: none;
}
.btn:hover { background: var(--wall); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-deep); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #8e1716; }
.link-btn { background: none; border: 0; color: inherit; cursor: pointer; padding: 6px; text-decoration: underline; }

.top { align-items: center; background: var(--cobalt); color: #fff; display: flex; gap: 24px; padding: 0 16px; }
.brand { color: var(--marigold); font: 700 24px/1 var(--display); padding: 12px 0; text-decoration: none; white-space: nowrap; }
.top nav { display: flex; flex: 1; gap: 4px; min-width: 0; overflow-x: auto; }
.top nav a { border-bottom: 4px solid transparent; color: #fff; font-weight: 500; padding: 14px 10px 10px; text-decoration: none; white-space: nowrap; }
.top nav a:hover { border-bottom-color: #7f97e0; }
.top nav a[aria-current] { border-bottom-color: var(--marigold); }
.top :focus-visible { outline-color: var(--marigold); }

.flash { border-left: 5px solid var(--green); background: #e3f3ea; margin: 12px 0; padding: 10px 14px; }
body > .flash { margin: 12px 16px 0; }
.flash-error { background: #fbe6e5; border-left-color: var(--red); }
.flash-warn { background: #fff4cf; border-left-color: var(--marigold-deep); }
.empty { color: var(--muted); padding: 24px 0; }

/* Caja */
.register { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - 52px); }
.shelf { display: flex; flex-direction: column; min-height: 0; padding: 16px; }
.scan input { border: 2px solid var(--cobalt); font-size: 22px; font-weight: 500; min-height: 58px; padding: 10px 14px; }
.notice { background: var(--ink); border-radius: 4px; color: #fff; margin: 10px 0 0; padding: 10px 14px; }
.notice a { color: var(--marigold); }
.tags { align-content: start; display: grid; flex: 1; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); margin-top: 14px; min-height: 0; overflow-y: auto; padding: 2px; }
.tag {
  background: var(--paper); border: 1px solid var(--line); border-radius: 3px; color: var(--ink); cursor: pointer;
  display: grid; gap: 2px 8px; grid-template-columns: 1fr auto; min-height: 104px; padding: 0; text-align: left;
}
.tag:hover { border-color: var(--cobalt); }
.tag:active { background: #f4f7fd; }
.tag-name { font-weight: 500; grid-column: 1 / -1; line-height: 1.25; padding: 10px 10px 4px; }
.tag-price { align-self: end; background: var(--marigold); font: 700 22px/1 var(--display); justify-self: start; padding: 6px 10px; }
.tag-stock { align-self: end; color: var(--muted); font-size: 13px; padding: 0 10px 6px 0; text-align: right; }
.tag-stock.is-low { color: #8a5a00; font-weight: 600; }
.tag-stock.is-out { color: var(--red); font-weight: 600; }

.ticket { background: var(--cobalt-deep); display: flex; flex-direction: column; min-height: 0; padding: 14px 14px 0; }
.ticket-body {
  background: var(--paper); box-shadow: 0 2px 0 #00000030; display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 14px 16px 8px;
}
.ticket-head { align-items: baseline; border-bottom: 2px dashed var(--line); display: flex; justify-content: space-between; margin-bottom: 4px; padding-bottom: 8px; }
.ticket-head h1 { font-size: 24px; margin: 0; }
.ticket-head .link-btn { color: var(--red); }
.lines { flex: 1; list-style: none; margin: 0; min-height: 0; overflow-y: auto; padding: 0; }
.line { border-bottom: 1px dashed var(--line); display: grid; gap: 4px 12px; grid-template-columns: 1fr auto; padding: 8px 0; }
.line-name { font-weight: 500; line-height: 1.25; }
.line-total { font-family: var(--display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.line-qty { align-items: center; display: flex; gap: 4px; grid-column: 1 / -1; }
.line-each { color: var(--muted); font-size: 14px; margin-left: 6px; }
.step { background: var(--wall); border: 0; border-radius: 3px; color: var(--cobalt); cursor: pointer; font-size: 20px; font-weight: 600; height: 36px; line-height: 1; width: 36px; }
.step:hover { background: var(--line); }
.qty { min-height: 36px; padding: 4px; text-align: center; width: 64px; }
.ticket-empty { color: var(--muted); margin: 0; padding: 20px 0; }

.ticket-foot { color: #fff; padding: 12px 2px 14px; }
.sum { align-items: center; display: flex; font-variant-numeric: tabular-nums; justify-content: space-between; min-height: 34px; }
.sum input { background: #ffffff1a; border-color: #ffffff66; color: #fff; min-height: 34px; padding: 3px 8px; text-align: right; width: 120px; }
.sum input::placeholder { color: #c7d2ef; }
.ticket-foot :focus-visible { outline-color: var(--marigold); }
.grand { align-items: baseline; margin: 2px 0 10px; }
.grand span { font: 600 26px/1 var(--display); }
.grand output { color: var(--marigold); font: 700 52px/1.05 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.btn-charge {
  background: var(--marigold); border: 0; border-radius: 4px; color: var(--ink); cursor: pointer;
  font: 700 28px/1 var(--display); min-height: 64px; padding: 12px; width: 100%;
}
.btn-charge:hover:not(:disabled) { background: var(--marigold-deep); }
.btn-charge:disabled { cursor: not-allowed; opacity: .45; }
.btn-charge kbd { border: 1px solid #101a3380; border-radius: 3px; font: 600 15px/1 var(--body); margin-left: 8px; padding: 2px 5px; vertical-align: 3px; }

.pay { border: 0; border-radius: 6px; color: var(--ink); max-width: calc(100vw - 32px); padding: 22px; width: 460px; }
.pay::backdrop { background: #0e2778b3; }
.pay h2 { font-size: 26px; margin: 0; }
.pay-total { color: var(--cobalt); font: 700 56px/1.1 var(--display); font-variant-numeric: tabular-nums; margin: 0 0 12px; }
.methods { border: 0; display: flex; gap: 6px; margin: 0 0 14px; padding: 0; }
.methods legend { font-weight: 500; margin-bottom: 4px; padding: 0; }
.methods label { flex: 1; }
.methods input { height: 0; min-height: 0; opacity: 0; padding: 0; position: absolute; width: 0; }
.methods span { border: 1px solid var(--cobalt); border-radius: 4px; color: var(--cobalt); cursor: pointer; display: block; font-weight: 600; padding: 10px 2px; text-align: center; }
.methods input:checked + span { background: var(--cobalt); color: #fff; }
.methods input:focus-visible + span { outline: 3px solid var(--marigold-deep); outline-offset: 2px; }
#cash > label { display: block; font-weight: 500; margin-bottom: 4px; }
#received { font: 600 26px/1 var(--display); min-height: 52px; text-align: right; }
.bills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bills button { background: var(--wall); border: 0; border-radius: 3px; color: var(--ink); cursor: pointer; flex: 1; font-weight: 500; min-height: 42px; padding: 6px 8px; white-space: nowrap; }
.bills button:hover { background: var(--line); }
.pay-change { align-items: baseline; display: flex; justify-content: space-between; margin: 14px 0 0; }
.pay-change strong { font: 700 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.pay-change strong.is-short { color: var(--red); }
.pay-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.pay-actions .btn-primary { flex: 1; min-height: 52px; }
.done-label { font-weight: 500; margin: 16px 0 0; }
.done-change { color: var(--green); font: 700 72px/1.05 var(--display); font-variant-numeric: tabular-nums; margin: 0; overflow-wrap: anywhere; }
.printer { border: 0; height: 1px; left: -9999px; position: absolute; top: 0; width: 1px; }

/* Páginas */
.page { margin: 0 auto; max-width: 1100px; padding: 24px 16px 48px; }
.page-narrow { max-width: 760px; }
.page-split { display: grid; gap: 40px; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
.page-head { align-items: center; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.crumb { margin: 0 0 6px; }
.filters { align-items: flex-end; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters input[type="search"] { flex: 1; min-width: 200px; width: auto; }
.filters select, .filters label input { width: auto; }
.filters label { display: grid; font-size: 14px; font-weight: 500; gap: 2px; }
.table-wrap { background: var(--paper); border: 1px solid var(--line); overflow-x: auto; }
.data { border-collapse: collapse; width: 100%; }
.data th, .data td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.data .num { text-align: right; white-space: nowrap; }
.data thead th { background: var(--wall); color: var(--muted); font-size: 14px; font-weight: 600; }
.data tbody tr:last-child td { border-bottom: 0; }
.data tfoot th, .data tfoot td { border-bottom: 0; border-top: 2px solid var(--ink); }
.is-low { color: var(--red); font-weight: 600; }
.is-void td { color: var(--muted); text-decoration: line-through; }
.is-void td:nth-child(4) { text-decoration: none; }
.pager { align-items: center; display: flex; gap: 16px; justify-content: center; margin-top: 16px; }
.stack { display: grid; gap: 12px; margin-bottom: 24px; }
.stack label, .auth label { display: grid; font-weight: 500; gap: 3px; }
.stack label.check { align-items: center; display: flex; font-weight: 400; gap: 8px; }
.check input { height: 20px; min-height: 0; width: 20px; }
.stack p { margin: 0; }
.stack .btn { justify-self: start; }
.two { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.danger-zone .link-btn { color: var(--red); }
.void-box { margin-top: 24px; }
.void-box summary { color: var(--red); cursor: pointer; font-weight: 600; margin-bottom: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.presets a { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; color: var(--ink); padding: 7px 12px; text-decoration: none; }
.presets a[aria-current] { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.figures { background: var(--cobalt-deep); color: #fff; display: grid; gap: 1px; grid-template-columns: repeat(4, 1fr); margin: 0 0 10px; padding: 18px 8px; }
.figures div { padding: 0 14px; }
.figures dt { color: #d3dcf5; font-size: 15px; }
.figures dd { color: var(--marigold); font: 700 34px/1.15 var(--display); font-variant-numeric: tabular-nums; margin: 0; overflow-wrap: anywhere; }
.report-note { color: var(--muted); margin: 0 0 22px; }
.report-grid { display: grid; gap: 28px; grid-template-columns: 1fr 1fr; }
.report-grid section { min-width: 0; }
.report-grid section:last-child { grid-column: 1 / -1; }

/* Entrada */
.centered { background: var(--cobalt); display: grid; min-height: 100vh; padding: 16px; place-items: center; }
.auth { background: var(--paper); border-top: 8px solid var(--marigold); max-width: 400px; padding: 26px; width: 100%; }
.auth-wide { max-width: 520px; }
.auth form { display: grid; gap: 12px; }
.auth h2 { margin: 12px 0 0; }
.auth small { color: var(--muted); font-weight: 400; }

@media (max-width: 900px) {
  .register { display: block; height: auto; padding-bottom: 150px; }
  .tags { max-height: 44vh; }
  .ticket { padding: 0; }
  .ticket-body { min-height: 140px; }
  .ticket-foot { background: var(--cobalt-deep); bottom: 0; left: 0; padding: 8px 16px 12px; position: fixed; right: 0; z-index: 5; }
  .ticket-foot .sum:not(.grand) { display: none; }
  .grand { margin: 0 0 6px; }
  .grand output { font-size: 36px; }
  .btn-charge { font-size: 24px; min-height: 52px; }
  .btn-charge kbd { display: none; }
  .page-split, .report-grid { grid-template-columns: minmax(0, 1fr); }
  .figures { gap: 14px 1px; grid-template-columns: 1fr 1fr; }
  .top { flex-wrap: wrap; gap: 0 12px; }
  .top nav { flex-basis: 100%; order: 3; }
  .top form { margin-left: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .pay[open] { animation: rise .14s ease-out; }
  @keyframes rise { from { transform: translateY(8px); } }
}
