/* Tú Comics · colores de la marca: rojo "TÚ", amarillo del círculo, tinta de las siluetas */
:root {
  --red: #E3173E;
  --red-dark: #B80F2F;
  --yellow: #FFD200;
  --yellow-soft: #FFF4BF;
  --ink: #1B1530;
  --ink-2: #4A4560;
  --muted: #8A869A;
  --line: #E7E4EC;
  --bg: #F6F5F2;
  --card: #FFFFFF;
  --ok: #138A4B;
  --radius: 14px;
  --nav-h: 64px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100dvh; font-size: 15px; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
.brand-font { font-family: Bangers, Inter, sans-serif; letter-spacing: .04em; font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── layout ─────────────────────────────── */
.shell { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ink); color: #fff;
}
.topbar img { width: 36px; height: 36px; border-radius: 50%; background: #fff; object-fit: cover; }
.topbar .title { font-size: 22px; line-height: 1; }
.topbar .title span { color: var(--yellow); }
.topbar .who { margin-left: auto; text-align: right; font-size: 12px; line-height: 1.2; opacity: .85; }
.topbar .who b { display: block; font-size: 13px; opacity: 1; }
.icon-btn { background: none; border: 0; color: inherit; padding: 8px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
.icon-btn svg { width: 22px; height: 22px; }

main { padding: 16px; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--nav-h); text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600;
}
nav.tabs a svg { width: 22px; height: 22px; }
nav.tabs a.on { color: var(--red); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  nav.tabs {
    position: sticky; top: 56px; align-self: start; flex-direction: column; gap: 4px;
    height: calc(100dvh - 56px); border-top: 0; border-right: 1px solid var(--line); padding: 16px 10px;
  }
  nav.tabs a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; height: 44px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
  nav.tabs a:hover { background: var(--bg); }
  nav.tabs a.on { background: var(--yellow-soft); color: var(--ink); }
  main { padding: 24px 28px 40px; width: 100%; }
}

/* ── componentes ────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin-right: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 16px; /* evita zoom en iPhone */
}
.input:focus { outline: 2px solid var(--yellow); outline-offset: 0; border-color: var(--ink-2); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search .input { padding-left: 38px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.pay.on { background: var(--yellow); color: var(--ink); border-color: var(--ink); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--bg); color: var(--ink-2); }
.badge.red { background: #FDE4E9; color: var(--red-dark); }
.badge.yellow { background: var(--yellow-soft); color: #6B5600; }
.badge.green { background: #DDF3E6; color: var(--ok); }

.list > .item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.list > .item:last-child { border-bottom: 0; }
.list > .item.tap { cursor: pointer; }
.list > .item.tap:hover { background: #FBFAF7; }
.item .name { font-weight: 600; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat.accent { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat.accent .label { color: var(--yellow); }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.alert { padding: 12px 14px; border-radius: 12px; background: var(--yellow-soft); border: 1px solid #F0DB7A; font-size: 14px; }

/* ── punto de venta ─────────────────────── */
.pos { display: grid; gap: 16px; }
@media (min-width: 900px) { .pos { grid-template-columns: 1fr 360px; align-items: start; } .cart-panel { position: sticky; top: 80px; } }
.prod-row .price { font-weight: 700; }
.add-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; flex: none; font-weight: 700; font-size: 20px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 34px; height: 34px; border: 0; background: #fff; font-size: 18px; cursor: pointer; }
.qty span { min-width: 28px; text-align: center; font-weight: 700; }
.price-in { width: 92px; min-height: 34px; padding: 4px 8px; font-size: 15px; }
.total-big { font-size: 28px; font-weight: 700; }

.cart-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); z-index: 25;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 16px;
  background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(27,21,48,.25);
}
@media (min-width: 900px) { .cart-bar { display: none; } }
@media (max-width: 899px) {
  .cart-panel { display: none; }
  .cart-panel.open {
    display: block; position: fixed; inset: auto 0 0 0; z-index: 50; max-height: 88dvh; overflow-y: auto;
    border-radius: 20px 20px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* ── modal ──────────────────────────────── */
.backdrop { position: fixed; inset: 0; background: rgba(27,21,48,.45); z-index: 40; }
.modal {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto;
  background: #fff; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) {
  .modal { left: 50%; top: 50%; bottom: auto; width: min(480px, 92vw); transform: translate(-50%, -50%); border-radius: 20px; }
}
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal .actions .btn { flex: 1; }
@media (min-width: 640px) { .modal .actions .btn { flex: none; } }

/* ── login ──────────────────────────────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); }
.login .card { width: min(380px, 100%); padding: 28px 22px; border: 0; }
.login .logo { width: 120px; height: 120px; border-radius: 50%; display: block; margin: -88px auto 8px; border: 6px solid var(--ink); background: #fff; object-fit: cover; }
.login h1 { text-align: center; font-size: 30px; }
.login h1 span { color: var(--red); }
.error { color: var(--red-dark); font-size: 14px; font-weight: 600; }

#toast {
  position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%) translateY(-12px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--red); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
.voided { opacity: .5; text-decoration: line-through; }
details.sale summary { list-style: none; cursor: pointer; }
details.sale summary::-webkit-details-marker { display: none; }
details.sale[open] { background: #FBFAF7; }

/* evita que las filas de chips ensanchen la página */
main, .pos > *, .stack > * { min-width: 0; }
body { overflow-x: clip; }
