:root {
  --cream-50: #fffdf9;
  --cream-100: #f6efe3;
  --cream-200: #eadcc6;
  --cream-300: #d9c6a8;
  --clay-600: #b25a38;
  --clay-700: #8b3f28;
  --clay-800: #6b2f1e;
  --olive-100: #e4ead8;
  --olive-600: #4f5d40;
  --olive-700: #3a452f;
  --gold-100: #f7ecd0;
  --gold-500: #c4a35a;
  --ink-500: #6f6254;
  --ink-700: #43382f;
  --ink-900: #231c16;
  --rose-50: #fbecec;
  --rose-700: #8a2f2f;
  --shadow: 0 18px 40px -24px rgba(35, 28, 22, 0.45);
  --radius: 1.15rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  color: var(--ink-900);
  background: var(--cream-100);
  background-image:
    radial-gradient(1100px 480px at 8% -12%, rgba(196, 163, 90, 0.18), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(139, 63, 40, 0.1), transparent 48%);
  line-height: 1.45;
}
a { color: var(--clay-700); }
*:focus-visible { outline: 2px solid var(--clay-700); outline-offset: 3px; }
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1rem 3.5rem; }
.wrap-wide { max-width: 72rem; }
.site { min-height: 100vh; display: flex; flex-direction: column; }
header, footer { padding: 1rem 0; }
header .bar, footer .bar {
  max-width: 44rem; margin: 0 auto; padding: 0 1rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.admin-bar { max-width: 72rem; }
.eyebrow { font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--clay-600); margin: 0 0 0.35rem; }
.brand { font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; margin: 0; color: var(--clay-700); text-decoration: none; }
.staff-link { font-size: 0.78rem; color: var(--ink-500); text-decoration: none; }
.staff-access { margin-top: 2rem; text-align: center; }
h1, h2, .display { font-family: Georgia, "Times New Roman", serif; line-height: 1.15; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0.2rem 0 0.7rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.6rem; }
.lead { color: var(--ink-700); font-size: 1.05rem; }
.card {
  background: var(--cream-50);
  border: 1px solid var(--cream-200);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  margin: 1rem 0;
}
.btn, button.btn {
  display: inline-flex; justify-content: center; align-items: center;
  border: 0; border-radius: 999px; padding: 0.85rem 1.25rem;
  font-weight: 700; text-decoration: none; cursor: pointer; min-height: 2.8rem;
}
.btn-lg { min-height: 3.15rem; font-size: 1.05rem; padding: 1rem 1.4rem; }
.btn-primary { background: var(--clay-700); color: var(--cream-50); }
.btn-primary:hover { background: var(--clay-800); }
.btn-olive { background: var(--olive-600); color: var(--cream-50); }
.btn-danger { background: var(--cream-50); color: var(--rose-700); border: 1px solid var(--rose-700); }
.btn-ghost { background: transparent; color: var(--clay-700); border: 1px solid var(--clay-700); }
.btn-full { width: 100%; }
.field { margin-bottom: 1rem; }
.field label, legend { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.hint { font-size: 0.82rem; color: var(--ink-500); }
.stat-expense b { color: var(--rose-700); }
.stat-balance b { color: var(--olive-700); }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], textarea, select, input[type=datetime-local], input[type=date] {
  width: 100%; padding: 0.8rem 0.85rem; border-radius: 0.9rem; border: 1px solid var(--cream-300);
  background: var(--cream-50); font-size: 1rem; color: var(--ink-900);
}
.alert { border-radius: 1rem; padding: 0.85rem 1rem; margin: 0.8rem 0; }
.alert-danger { background: var(--rose-50); color: var(--rose-700); border: 1px solid var(--rose-700); }
.alert-success { background: var(--olive-100); color: var(--olive-700); }
.alert-warn { background: var(--gold-100); color: var(--ink-700); border: 1px solid var(--gold-500); }
.badge { display: inline-flex; border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.02em; }
.badge-pending { background: var(--gold-100); color: var(--ink-700); }
.badge-success { background: var(--olive-100); color: var(--olive-700); }
.badge-danger { background: var(--rose-50); color: var(--rose-700); }
.badge-muted { background: var(--cream-200); color: var(--ink-500); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin: 1.1rem 0; }
@media (min-width: 800px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--cream-50); border: 1px solid var(--cream-200); border-radius: 1rem; padding: 0.95rem; box-shadow: var(--shadow); }
.stat span { color: var(--ink-500); font-size: 0.8rem; }
.stat b { display: block; font-family: Georgia, serif; font-size: 1.55rem; color: var(--clay-700); margin-top: 0.2rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.list { list-style: none; padding: 0; margin: 1rem 0; }
.list li { background: var(--cream-50); border: 1px solid var(--cream-200); border-radius: 1rem; padding: 1rem; margin-bottom: 0.7rem; }
.ticket { overflow: hidden; border-radius: 1.4rem; border: 1px solid var(--cream-300); background: var(--cream-50); box-shadow: var(--shadow); }
.ticket-head { background: var(--clay-700); color: var(--cream-50); padding: 1rem 1.2rem; }
.ticket-head small { color: var(--gold-500); letter-spacing: 0.22em; text-transform: uppercase; }
.ticket-body { display: grid; gap: 1rem; padding: 1.2rem; }
@media (min-width: 640px) { .ticket-body { grid-template-columns: 1fr auto; align-items: center; } }
.ticket-number { font-size: 1.7rem; margin: 0 0 0.6rem; }
.qrcode {
  width: 192px; min-height: 192px; max-width: 100%;
  background: #fff; padding: 0.35rem; border: 1px solid var(--cream-300);
}
.qrcode img, .qrcode canvas, .qrcode table, .qrcode svg {
  display: block; width: 192px; height: 192px; max-width: 100%; background: #fff;
}
.qrcode canvas.qr-canvas-hidden,
.qrcode canvas[hidden] {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
.qrcode .qr-status, .qrcode .error { width: auto !important; height: auto !important; margin: 0.4rem 0; }
@media print {
  @page { margin: 10mm; }
  html, body, .site {
    min-height: 0 !important;
    height: auto !important;
    display: block !important;
    background: white !important;
  }
  body { background: white !important; }
  .no-print { display: none !important; }
  main.wrap { padding: 0; }
  .ticket, .print-ticket {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .ticket-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ticket-photo, .ticket .product-photo { max-width: 120px; margin-bottom: 0.4rem; }
  .ticket-body { padding: 0.7rem 0.9rem; gap: 0.6rem; }
  .ticket-number { font-size: 1.35rem; margin-bottom: 0.35rem; }
  .pickup-notice {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 0.65rem 0.9rem 0.75rem;
  }
  .pickup-notice .pickup-when { font-size: 1rem; margin-bottom: 0.3rem; }
  .pickup-notice p { margin-bottom: 0.4rem; font-size: 0.88rem; }
  .pickup-notice .btn { display: none; }
  .pickup-notice-ticket::after {
    content: "Mapa: https://maps.app.goo.gl/EjRs2Yfd3ftAkSou6";
    display: block;
    font-size: 0.78rem;
    color: var(--ink-700);
    word-break: break-all;
  }
  .qrcode, .qrcode img, .qrcode table, .qrcode svg {
    display: block !important; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .qrcode canvas.qr-canvas-hidden,
  .qrcode canvas[hidden] {
    display: none !important;
  }
  body.print-one-ticket header,
  body.print-one-ticket footer,
  body.print-one-ticket .no-print {
    display: none !important;
  }
  body.print-one-ticket .ticket {
    break-inside: auto;
    page-break-inside: auto;
    page-break-before: avoid;
  }
}
.qr-reader { min-height: 240px; width: 100%; overflow: hidden; border-radius: 1rem; background: rgba(42, 36, 28, 0.05); }
.qr-reader video { width: 100%; border-radius: 1rem; display: block; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.admin-nav a, .admin-nav button {
  background: var(--cream-50); border: 1px solid var(--cream-200); border-radius: 999px;
  padding: 0.45rem 0.85rem; text-decoration: none; color: var(--ink-700); font-size: 0.9rem;
}
.admin-menu { position: relative; }
.admin-menu > summary { list-style: none; cursor: pointer; }
.admin-menu > summary::-webkit-details-marker { display: none; }
@media (max-width: 860px) {
  .admin-menu .admin-nav {
    position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 20;
    flex-direction: column; align-items: stretch; min-width: 16rem;
    background: var(--cream-50); border: 1px solid var(--cream-200); border-radius: 1rem;
    padding: 0.7rem; box-shadow: var(--shadow);
  }
}
@media (min-width: 861px) {
  .admin-menu { display: block; }
  .admin-menu > summary { display: none; }
  .admin-menu .admin-nav { display: flex !important; position: static; min-width: 0; background: transparent; border: 0; padding: 0; box-shadow: none; flex-direction: row; }
}
.session-line { max-width: 72rem; margin: 0 auto; padding: 0 1rem 0.8rem; color: var(--ink-500); font-size: 0.8rem; }
footer { margin-top: auto; border-top: 1px solid var(--cream-200); color: var(--ink-500); font-size: 0.9rem; }
footer .credit { display: block; margin-top: 0.25rem; font-size: 0.78rem; color: var(--ink-500); }
.error { color: var(--rose-700); font-size: 0.9rem; margin-top: 0.3rem; }
.filters { display: grid; gap: 0.6rem; }
@media (min-width: 700px) { .filters { grid-template-columns: 1fr auto auto auto; align-items: end; } }
.product-photo {
  display: block; width: 100%; max-width: 300px; height: auto;
  object-fit: contain; object-position: center; background: var(--cream-100); border-radius: 1rem; margin: 0 auto;
}
.home-photo { margin: 0.8rem auto 1.2rem; max-width: 300px; text-align: center; }
.home-hero { text-align: center; margin-bottom: 0.5rem; }
.pickup-notice {
  margin: 0.35rem 0 1.25rem;
  padding: 1.15rem 1.15rem 1.3rem;
  text-align: center;
  background: linear-gradient(180deg, #fff8de, var(--gold-100));
  border: 2px solid var(--clay-700);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pickup-notice .pickup-when {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 3.6vw, 1.7rem);
  color: var(--clay-800);
  margin: 0.1rem 0 0.55rem;
  line-height: 1.2;
}
.pickup-notice p { margin: 0 0 0.75rem; }
.pickup-notice .btn { margin-top: 0.15rem; }
.pickup-notice-ticket {
  margin: 0;
  border-radius: 0;
  border-width: 2px 0 0;
  text-align: left;
  padding: 0.9rem 1rem 1.05rem;
  box-shadow: none;
}
.pickup-notice-ticket .pickup-when { font-size: 1.08rem; }
.pickup-notice-ticket .btn { min-height: 2.35rem; }
.price-tag { font-family: Georgia, serif; font-size: 2rem; color: var(--clay-700); margin: 0.2rem 0 0.8rem; font-weight: 700; }
.ticket-photo, .ticket .product-photo { max-width: 180px; margin: 0 0 0.8rem; }
@media (max-width: 640px) {
  .product-photo { max-width: 220px; }
  .home-photo, .home-photo .product-photo { max-width: 200px; }
  .ticket-photo, .ticket .product-photo { max-width: 160px; }
}
.table-simple { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 0.8rem 0; }
.table-simple th, .table-simple td { text-align: left; padding: 0.55rem 0.35rem; border-bottom: 1px solid var(--cream-200); vertical-align: top; }
.pay-card { background: var(--cream-50); border: 1px solid var(--cream-200); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); margin: 1.2rem 0; }
.home-delivery { text-align: center; }
.home-delivery .row { justify-content: center; margin-top: 1.2rem; }
.home-delivery .pickup-when { font-weight: 700; color: var(--clay-700); }
.pay-grid { display: grid; gap: 1rem; align-items: center; }
@media (min-width: 700px) { .pay-grid { grid-template-columns: minmax(180px, 240px) 1fr; } }
.pay-qr img { display: block; width: 100%; max-width: 240px; height: auto; border-radius: 1rem; background: #fff; margin: 0 auto; }
.pay-details { margin: 0; display: grid; gap: 0.65rem; }
.pay-details dt { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-500); }
.pay-details dd { margin: 0.1rem 0 0; font-weight: 700; }
.product-grid { display: grid; gap: 0.9rem; }
@media (min-width: 700px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }
.product-tile { margin: 0; }
.product-tile.is-empty { opacity: 0.72; }
.stock-line { margin: 0.2rem 0; }
.qty-stepper { display: flex; gap: 0.45rem; align-items: center; margin-top: 0.8rem; }
.qty-input { max-width: 5.5rem; text-align: center; font-size: 1.2rem; font-weight: 700; }
.qty-btn { min-width: 2.8rem; padding: 0.5rem; }
.pay-methods { display: grid; gap: 0.6rem; }
.choice { display: flex; gap: 0.6rem; align-items: center; padding: 0.75rem 0.85rem; border: 1px solid var(--cream-300); border-radius: 0.9rem; font-weight: 700; }
.confirm-card { border: 2px solid var(--clay-700); }
.card-stack { display: grid; gap: 0.8rem; }
.sale-card { margin: 0; }
.home-register { text-align: left; }
.home-register .btn-whatsapp { margin: 0.35rem 0 1rem; }
.btn-whatsapp { background: #128C7E; color: #fff; }
.btn-whatsapp:hover { background: #0e6f63; }
.ticket-bring {
  margin: 0.85rem 0 0;
  padding: 0.8rem 0.95rem;
  background: var(--olive-100);
  color: var(--olive-700);
  border-radius: 0.9rem;
  font-weight: 600;
}
.ticket-bring-compact {
  margin: 0;
  border-radius: 0;
  padding: 0.75rem 1rem 0.95rem;
}

.admin-brand { text-decoration: none; color: inherit; }
.admin-bar {
  align-items: flex-start;
  gap: 0.8rem;
}
@media (min-width: 900px) {
  .admin-bar { align-items: center; }
}
.admin-nav-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}
.admin-nav-primary { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--cream-50);
  border: 1px solid var(--cream-200);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  text-decoration: none;
  color: var(--ink-700);
  font-size: 0.9rem;
  font-weight: 700;
  min-height: 2.4rem;
  cursor: pointer;
}
.nav-chip.is-active, .admin-nav-more-panel a.is-active {
  background: var(--clay-700);
  border-color: var(--clay-700);
  color: var(--cream-50);
}
.nav-badge {
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--gold-500);
  color: var(--ink-900);
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-chip.is-active .nav-badge { background: var(--gold-100); }
.nav-exit { background: transparent; font-weight: 600; color: var(--ink-500); }
.admin-nav-more { position: relative; }
.admin-nav-more > summary { list-style: none; }
.admin-nav-more > summary::-webkit-details-marker { display: none; }
.admin-nav-more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 30;
  min-width: 16rem;
  background: var(--cream-50);
  border: 1px solid var(--cream-200);
  border-radius: 1rem;
  padding: 0.55rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.15rem;
}
.admin-nav-more-panel a {
  text-decoration: none;
  color: var(--ink-700);
  padding: 0.45rem 0.65rem;
  border-radius: 0.7rem;
  font-weight: 600;
}
.admin-nav-more-panel a:hover { background: var(--cream-100); }
.nav-group-label {
  margin: 0.45rem 0 0.1rem;
  padding: 0 0.65rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.btn-sm { min-height: 2.2rem; padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.goal-card {
  background: var(--cream-50);
  border: 1px solid var(--cream-200);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  margin: 1rem 0;
  text-align: center;
}
.goal-number {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--clay-700);
  margin: 0.15rem 0 0.4rem;
  font-weight: 700;
}
.meter {
  height: 0.7rem;
  background: var(--cream-200);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.8rem;
}
.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--clay-700), var(--gold-500));
  min-width: 0;
}
.stats-money { grid-template-columns: 1fr; }
@media (min-width: 800px) { .stats-money { grid-template-columns: repeat(3, 1fr); } }
.stat-warn { border-color: var(--gold-500); background: var(--gold-100); }
.seller-chips { display: grid; gap: 0.55rem; margin: 0.8rem 0; }
.seller-chip-form {
  display: grid;
  gap: 0.45rem;
  background: var(--cream-100);
  border-radius: 0.9rem;
  padding: 0.65rem 0.75rem;
}
.seller-chip-form p { margin: 0; }
.seller-chip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.seller-chip-partial {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.seller-chip-partial input[name="amount_usd"] {
  width: 7.2rem;
  min-height: 2.4rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.pay-choice { border: 0; padding: 0; margin: 0 0 1rem; }
.pay-choice legend { margin-bottom: 0.55rem; }
.choice-card {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem;
  border: 1px solid var(--cream-300);
  border-radius: 1rem;
  margin-bottom: 0.55rem;
  cursor: pointer;
}
.choice-card:has(input:checked) {
  border-color: var(--clay-700);
  background: rgba(139, 63, 40, 0.06);
}
.choice-card small { display: block; font-weight: 500; color: var(--ink-500); margin-top: 0.2rem; }
.choice-card.is-full { opacity: 0.55; cursor: not-allowed; }
.seller-box {
  border: 1px dashed var(--gold-500);
  background: var(--gold-100);
  border-radius: 1rem;
  padding: 0.9rem;
  margin: 0 0 1rem;
}
.seller-box h2 { margin-top: 0; }
.issue-form .hint { margin-top: 0.2rem; }
.mode-grid {
  display: grid;
  gap: 0.9rem;
  margin: 1.1rem 0 1.6rem;
}
@media (min-width: 700px) {
  .mode-grid { grid-template-columns: 1fr 1fr; }
}
.mode-card {
  display: block;
  background: var(--cream-50);
  border: 1px solid var(--cream-200);
  border-radius: 1.2rem;
  padding: 1.1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}
.mode-card strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 1.55rem;
  margin: 0.2rem 0 0.45rem;
  color: var(--clay-700);
}
.mode-card-sale { border-color: var(--olive-600); }
.receipt-preview {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #111;
  border-radius: 0.8rem;
  margin: 0.5rem 0;
}
.list li.is-delivered { opacity: 0.72; }
