@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #16213e;
  --ink-2: #4a5470;
  --muted: #7a8299;
  --paper: #f6f1e7;
  --card: #ffffff;
  --line: #e6dfd0;
  --sun: #ffc83d;
  --sun-deep: #f0a500;
  --yape: #742284;
  --yape-soft: #f3e8f6;
  --ok: #1f9d55;
  --ok-soft: #e3f6ea;
  --warn: #c77700;
  --warn-soft: #fff3d6;
  --bad: #d64545;
  --bad-soft: #fde8e8;
  --info: #2b6cb0;
  --info-soft: #e5f0fb;
  --radius: 16px;
  --display: 'Bricolage Grotesque', Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(22,33,62,.06), 0 6px 18px rgba(22,33,62,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink); background: var(--paper); font-size: 15px; line-height: 1.45;
}
h1, h2, h3, .display { font-family: var(--display); letter-spacing: -.01em; margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Encabezado */
.top { background: var(--ink); color: #fff; padding: 22px 0 0; position: relative; overflow: hidden; }
.top::after {
  content: ''; position: absolute; right: -70px; top: -90px; width: 170px; height: 170px; border-radius: 50%;
  background: var(--sun); opacity: .9;
}
.top .wrap { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 12px; padding-right: 70px; }
.brand-badge {
  width: 46px; height: 56px; border-radius: 9px; background: var(--sun); color: var(--ink);
  display: grid; place-items: center; font: 800 22px var(--display); transform: rotate(-6deg);
  box-shadow: 3px 3px 0 rgba(0,0,0,.25); border: 2px solid #fff;
}
.brand h1 { font-size: 26px; font-weight: 800; line-height: 1.1; }
.brand p { margin: 2px 0 0; color: #c9cfdf; font-size: 14px; }
.albums { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 14px; scrollbar-width: none; }
.albums::-webkit-scrollbar { display: none; }
.pill {
  border: 1.5px solid rgba(255,255,255,.35); background: transparent; color: #fff; border-radius: 999px;
  padding: 7px 14px; white-space: nowrap; cursor: pointer; font-weight: 600; font-size: 14px;
}
.pill.on { background: #fff; color: var(--ink); border-color: #fff; }
.tabs { display: flex; gap: 4px; }
.tab {
  border: 0; background: transparent; color: #c9cfdf; padding: 12px 16px; border-radius: 12px 12px 0 0;
  cursor: pointer; font-weight: 700; font-size: 15px; position: relative;
}
.tab.on { background: var(--paper); color: var(--ink); }
.tab .count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: var(--sun); color: var(--ink); font-size: 12px;
}

main.wrap { padding-top: 18px; padding-bottom: 120px; }

/* Barra de herramientas */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search], .toolbar select, .input {
  border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 12px; min-width: 0;
}
.toolbar input[type=search] { flex: 1 1 220px; }
.input:focus, .toolbar input:focus, .toolbar select:focus, textarea:focus { outline: 2px solid var(--sun); outline-offset: 0; border-color: var(--sun-deep); }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { color: var(--ink); background: var(--card); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); min-width: 120px; }
.stat b { display: block; font: 800 22px var(--display); }
.stat span { color: var(--muted); font-size: 13px; }

/* Figuritas */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sticker {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px;
  display: flex; flex-direction: column; gap: 6px; position: relative; border: 2px solid transparent; transition: transform .12s, border-color .12s;
}
.sticker:hover { transform: translateY(-2px); }
.sticker.sel { border-color: var(--sun-deep); background: #fffaf0; }
.sticker .num {
  font: 800 28px var(--display); line-height: 1; padding: 10px 0 8px; text-align: center; border-radius: 10px;
  background: repeating-linear-gradient(135deg, #fff6dc 0 10px, #ffefc2 10px 20px); color: var(--ink);
}
.sticker .nm { font-weight: 600; font-size: 14px; min-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sticker .cat { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sticker .row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.price { font-weight: 800; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.yape { background: var(--yape-soft); color: var(--yape); }
.chip.gray { background: #eef0f4; color: var(--ink-2); }
.sticker.off { opacity: .55; }
.sticker.off .num { background: #eceae4; }
.check-dot {
  position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sun); color: var(--ink); font-weight: 800; font-size: 13px; box-shadow: 0 0 0 2px #fff;
}

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 11px 16px; font-weight: 700; font-size: 15px;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sun { background: var(--sun); color: var(--ink); }
.btn.yape { background: var(--yape); }
.btn.ok { background: var(--ok); }
.btn.bad { background: var(--bad); }
.btn.wa { background: #25d366; color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--ink); color: #fff; cursor: pointer;
  font-size: 18px; font-weight: 700; display: grid; place-items: center; flex: none;
}
.icon-btn.light { background: #eef0f4; color: var(--ink); }

/* Carrito flotante */
.cartbar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(560px, calc(100% - 24px));
  background: var(--ink); color: #fff; border-radius: 18px; padding: 10px 10px 10px 18px; display: flex; align-items: center;
  gap: 12px; box-shadow: 0 10px 30px rgba(22,33,62,.35); z-index: 20;
}
.cartbar .sum { flex: 1; line-height: 1.2; }
.cartbar .sum b { font: 800 18px var(--display); }

/* Hoja / modal */
.sheet-bg { position: fixed; inset: 0; background: rgba(22,33,62,.55); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--paper); width: min(620px, 100%); max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 20px 18px 28px;
  animation: up .2s ease-out;
}
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { font-size: 22px; }
.close { border: 0; background: #e8e2d5; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; }

.line-item { display: flex; align-items: center; gap: 10px; background: var(--card); padding: 10px 12px; border-radius: 12px; margin-bottom: 8px; }
.line-item .code { font: 800 18px var(--display); min-width: 52px; }
.line-item .grow { flex: 1; min-width: 0; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty span { min-width: 20px; text-align: center; font-weight: 700; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 2px; font-weight: 700; }
.total-row b { font: 800 26px var(--display); }

.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form input, .form select, .form textarea {
  border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 12px; font-size: 15px; width: 100%;
}
.form textarea { min-height: 80px; resize: vertical; }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.form legend { font: 700 16px var(--display); margin-bottom: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label {
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; display: block;
  font-size: 14px; color: var(--ink); font-weight: 500;
}
.choice label b { display: block; font-size: 15px; margin-bottom: 2px; }
.choice input { display: none; }
.choice label:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
.choice label.yape-opt:has(input:checked) { border-color: var(--yape); box-shadow: 0 0 0 2px var(--yape) inset; background: var(--yape-soft); }

.paybox { background: var(--card); border-radius: 16px; padding: 14px; display: flex; gap: 14px; align-items: center; border: 2px dashed var(--yape); }
.paybox img { width: 150px; height: 150px; object-fit: contain; border-radius: 10px; background: #fff; flex: none; }
.paybox .big { font: 800 24px var(--display); color: var(--yape); }
@media (max-width: 460px) { .paybox { flex-direction: column; text-align: center; } }

.note { padding: 10px 14px; border-radius: 12px; font-size: 14px; margin: 0 0 12px; }
.note.ok { background: var(--ok-soft); color: #145c34; }
.note.err { background: var(--bad-soft); color: #8a2222; }
.note.warn { background: var(--warn-soft); color: #7a4a00; }
.note.info { background: var(--info-soft); color: #1d4b7a; }

.done { text-align: center; padding: 10px 0; }
.done .code-big { font: 800 40px var(--display); letter-spacing: .04em; margin: 6px 0; }

/* Intercambio */
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .trade-cols { grid-template-columns: 1fr; } }
.panel { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.panel h2 { font-size: 19px; margin-bottom: 2px; }
.panel .sub { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.mini-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 360px; overflow: auto; padding: 2px; }
.mini {
  border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; cursor: pointer; font-weight: 700; font-size: 14px;
  min-width: 48px; text-align: center;
}
.mini small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini.on { background: var(--sun); border-color: var(--sun-deep); }
.mini.give.on { background: var(--ok); color: #fff; border-color: var(--ok); }
.mini.give.on small { color: #dff5e7; }
.summary-box { margin-top: 16px; }

/* Pedidos */
.order { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-head .code { font: 800 20px var(--display); }
.order .items { color: var(--ink-2); font-size: 14px; margin: 8px 0; }
.order .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .display { font-size: 20px; color: var(--ink); margin-bottom: 6px; }

.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 12px; z-index: 60; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 24px);
}
.toast.err { background: var(--bad); }

/* Panel admin */
.admin .top::after { background: var(--yape); opacity: .9; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid #f0ebe0; text-align: left; font-size: 14px; vertical-align: middle; }
.admin-table th { background: #faf7f0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.admin-table tr.miss td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.admin-table tr.got td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
.admin-table input[type=number], .admin-table input[type=text] { width: 76px; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 8px; }
.admin-table input.wide { width: 140px; }
.table-wrap { overflow-x: auto; border-radius: 14px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 28px; height: 28px; border: 0; border-radius: 8px; background: #eef0f4; cursor: pointer; font-weight: 800; }
.stepper input { width: 50px !important; text-align: center; }
.progress { height: 10px; background: #e9e3d6; border-radius: 99px; overflow: hidden; margin: 6px 0 2px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--ok), #4cc77f); }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; align-items: start; }
@media (max-width: 760px) { .tools { grid-template-columns: 1fr; } }
details.panel summary { cursor: pointer; font: 700 17px var(--display); list-style: none; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary::before { content: '＋ '; color: var(--sun-deep); }
details.panel[open] summary::before { content: '－ '; }
details.panel[open] summary { margin-bottom: 12px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.fchip { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; font-size: 13px; }
.fchip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 14px; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.login-box { max-width: 380px; margin: 60px auto; }
.install { padding: 24px 12px; }
.card.narrow { max-width: 560px; margin: 0 auto; background: var(--card); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.card.narrow h1 { font-size: 24px; margin-bottom: 12px; }
.qr-prev { width: 160px; height: 160px; object-fit: contain; background: #fff; border-radius: 12px; border: 1.5px solid var(--line); }
footer.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 0 30px; }
footer.foot a { color: var(--muted); }
