@font-face {
  font-family: "BBB Serif";
  src: url("/assets/fonts/playfair.ttf") format("truetype");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "BBB Sans";
  src: url("/assets/fonts/sans.ttf") format("truetype");
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --bg: #f6efe6;
  --card: #fffdf9;
  --text: #1a1216;
  --muted: #6c5560;
  --primary: #4a182a;
  --primary-ink: #fff8f4;
  --accent: #c9a360;
  --line: #eadfd4;
  --danger: #a11e3a;
  --ok: #1c6b4a;
  --ok-bg: #e7f6ee;
  --warn: #9a5b12;
  --warn-bg: #fff1d8;
  --info-bg: #f3e8ef;
  --pink: #ff3d8c;
  --shadow: 0 10px 30px rgba(40, 16, 24, 0.08);
  --radius: 18px;
  --nav: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  font-family: "BBB Sans", ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }

h1, h2, h3, .serif { font-family: "BBB Serif", Georgia, serif; font-weight: 650; letter-spacing: 0.01em; }
h1 { font-size: 1.85rem; margin: 0 0 0.35rem; }
h2 { font-size: 1.35rem; margin: 0 0 0.4rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.3rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.tiny { font-size: 0.75rem; letter-spacing: 0.02em; }

.page {
  width: min(520px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-t)) 16px calc(24px + var(--safe-b));
}
.page.has-nav { padding-bottom: calc(var(--nav) + 20px + var(--safe-b)); }
.page.wide { width: min(720px, 100%); }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.topbar img.logo { width: 48px; height: 48px; border-radius: 50%; background: #fff; }
.topbar .titles { flex: 1; min-width: 0; }
.topbar .titles h1, .topbar .titles h2 { margin: 0; font-size: 1.15rem; }
.demo-note {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.6);
  border-radius: 999px;
  padding: 3px 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(0.99); }

.row { display: flex; align-items: center; gap: 10px; }
.row.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid transparent; min-height: 44px; width: auto; padding: 0 8px; }
.btn.warn { background: #7a2a1c; color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.whatsapp { background: #128c4a; color: #fff; }
.btn.lg { min-height: 56px; font-size: 1.05rem; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row .btn { width: 100%; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--text);
}
.chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.chip .count {
  display: inline-block;
  margin-left: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 99px;
  padding: 0 6px;
  font-size: 0.8rem;
}
.chip.on .count { background: rgba(255,255,255,0.2); }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--info-bg);
  color: var(--primary);
  white-space: nowrap;
}
.badge.paid, .badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.unpaid, .badge.danger { background: #fde8ec; color: var(--danger); }
.badge.part_paid, .badge.warn, .badge.bimpay_claimed { background: var(--warn-bg); color: var(--warn); }
.badge.ready { background: #e8f0ff; color: #204a93; }
.badge.packed { background: #f3e8ff; color: #5b2d86; }
.badge.new { background: var(--info-bg); color: var(--primary); }
.badge.handed_over { background: #ececec; color: #333; }

label.field { display: block; margin: 0 0 10px; }
label.field > span, .label {
  display: block;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 4px;
}
input[type="text"], input[type="tel"], input[type="email"], input[type="number"],
input[type="date"], input[type="password"], input[type="search"], input[type="url"],
input[type="color"], select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  appearance: none;
}
textarea { min-height: 90px; resize: vertical; }
input[type="color"] { padding: 4px; height: 48px; }
.pin-input {
  font-size: 1.8rem;
  letter-spacing: 0.4em;
  text-align: center;
  font-weight: 700;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  padding: 0;
  width: 100%;
  color: inherit;
}
.product-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: #f3e6ea; }
.product-card .meta { padding: 8px 10px 12px; }
.product-card .meta strong { display: block; font-size: 0.95rem; }
.product-card .price { color: var(--primary); font-weight: 700; }

.code-xl {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 12px 8px;
}

.log { list-style: none; margin: 0; padding: 0; }
.log li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}
.log li:first-child { border-top: 0; }

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255,253,249,0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 4px 4px calc(4px + var(--safe-b));
  z-index: 20;
}
.bottom-nav button {
  background: none;
  border: 0;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
}
.bottom-nav button.on { color: var(--primary); }
.bottom-nav button .ico { font-size: 1.2rem; line-height: 1; }

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(20, 8, 12, 0.45);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet .panel {
  width: min(520px, 100%);
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(18px + var(--safe-b));
  max-height: 92dvh;
  overflow: auto;
}
.sheet .grab { width: 44px; height: 4px; background: #ddd; border-radius: 4px; margin: 0 auto 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + var(--safe-b));
  transform: translateX(-50%);
  background: #1a1216;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  z-index: 50;
  width: min(420px, calc(100% - 24px));
  text-align: center;
  font-weight: 600;
}
.hero {
  text-align: center;
  padding: 18px 8px 8px;
}
.hero img.brand { width: 112px; height: 112px; margin: 0 auto 12px; }
.hero .kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}
.shop-card {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.shop-card img { width: 64px; height: 64px; border-radius: 50%; }
.order-card .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; }
.who-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}
.label-sheet { text-align: center; }
.label-sheet .items { text-align: left; margin: 12px auto; max-width: 320px; }

.money-stat { text-align: center; padding: 8px; }
.money-stat .n { font-family: "BBB Serif", Georgia, serif; font-size: 1.6rem; font-weight: 700; }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.search-box input { min-height: 52px; }

.sister-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sister-pick button {
  min-height: 64px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}
.sister-pick button.on { border-color: var(--primary); background: var(--info-bg); }

.hidden { display: none !important; }
.center { text-align: center; }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

@media print {
  body * { visibility: hidden; }
  .print-only, .print-only * { visibility: visible; }
  .print-only { position: absolute; inset: 0; background: #fff; padding: 24px; }
}

.cart-bar {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow);
  margin-top: 12px;
}
