/* DARIS · estilos compartidos (cliente y panel) */
:root {
  --pizarra: #211d1b;
  --pizarra-2: #2b2624;
  --pizarra-3: #37302d;
  --linea: rgba(246, 233, 207, 0.13);
  --masa: #f6e9cf;
  --masa-2: #cdbfa6;
  --masa-3: #9d917d;
  --horno: #8c0000;
  --tomate: #b3121b;
  --tomate-2: #d3232c;
  --oro: #c9973a;
  --oro-2: #e9c46a;
  --albahaca: #72c266;
  --alerta: #f2b33d;
  --display: 'Bodoni Moda', 'Didot', 'Bodoni 72', Georgia, serif;
  --text: 'Familjen Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--pizarra);
  color: var(--masa);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--oro-2); }
:focus-visible { outline: 3px solid var(--oro-2); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* Pizarra: textura de tiza muy suave */
.chalk {
  background-color: var(--pizarra);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1.2px),
    radial-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1.2px);
  background-size: 7px 7px, 11px 11px;
  background-position: 0 0, 3px 5px;
}

/* Ladrillo rojo (pared del local) */
.brick {
  background-color: #7d0d0e;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.28) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.28) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.28) 2px, transparent 2px);
  background-size: 100% 22px, 44px 22px, 44px 22px;
  background-position: 0 0, 0 0, 22px 11px;
}

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border: 0; border-radius: 999px;
  font-weight: 700; font-size: 16px; text-decoration: none; line-height: 1.1;
  transition: transform 0.12s ease, background-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--tomate); color: #fff; box-shadow: 0 6px 18px rgba(179, 18, 27, 0.35); }
.btn-primary:hover { background: var(--tomate-2); }
.btn-gold { background: linear-gradient(180deg, var(--oro-2), var(--oro)); color: #2a1a05; }
.btn-ghost { background: var(--pizarra-3); color: var(--masa); }
.btn-ghost:hover { background: #423a36; }
.btn-line { background: transparent; color: var(--masa); box-shadow: inset 0 0 0 1.5px var(--linea); }
.btn-wa { background: #1f9d55; color: #fff; }
.btn-wa:hover { background: #22b05f; }
.btn-danger { background: transparent; color: #ff8a80; box-shadow: inset 0 0 0 1.5px rgba(255, 138, 128, 0.45); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14.5px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* Formularios */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 14px; color: var(--masa-2); font-weight: 600; }
.input {
  width: 100%; min-height: 48px; padding: 12px 14px;
  background: var(--pizarra); color: var(--masa);
  border: 1.5px solid var(--linea); border-radius: var(--r-sm);
  font-size: 16px;
}
.input::placeholder { color: var(--masa-3); }
.input:focus { outline: none; border-color: var(--oro-2); }
textarea.input { min-height: 74px; resize: vertical; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 14px;
  border-radius: 999px; background: var(--pizarra); border: 1.5px solid var(--linea);
  font-weight: 600; font-size: 15px; color: var(--masa-2);
}
.seg input:checked + span { background: var(--masa); color: var(--pizarra); border-color: var(--masa); }
.seg input:focus-visible + span { outline: 3px solid var(--oro-2); outline-offset: 2px; }
.form-error { color: #ff9d94; font-size: 14px; margin: -4px 0 12px; }

/* Hoja inferior (bottom sheet) y diálogo */
.backdrop {
  position: fixed; inset: 0; background: rgba(10, 6, 5, 0.62); z-index: 80;
  opacity: 0; transition: opacity 0.2s ease;
}
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--pizarra-2); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(22px + var(--safe-b));
  transform: translateY(105%); transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-width: 560px; margin: 0 auto;
}
.sheet.show { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 9px; background: var(--pizarra-3); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1; }
.icon-btn {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 0; background: var(--pizarra-3); color: var(--masa);
}
.icon-btn svg { width: 20px; height: 20px; }
.dialog {
  position: fixed; z-index: 100; left: 50%; top: 50%; width: min(92vw, 400px);
  transform: translate(-50%, -46%) scale(0.98); opacity: 0;
  background: var(--pizarra-2); border-radius: var(--r-lg); padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); transition: opacity 0.16s ease, transform 0.16s ease;
}
.dialog.show { opacity: 1; transform: translate(-50%, -50%); }
.dialog h2 { margin: 0 0 6px; font-size: 21px; line-height: 1.25; }
.dialog p { margin: 0 0 18px; color: var(--masa-2); }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; }

/* Avisos */
.toast-wrap { position: fixed; left: 0; right: 0; top: 12px; z-index: 120; display: grid; justify-items: center; pointer-events: none; padding: 0 12px; }
.toast {
  max-width: 460px; background: var(--masa); color: var(--pizarra); font-weight: 600;
  padding: 12px 16px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  margin-bottom: 8px; animation: toast-in 0.25s ease both; pointer-events: none;
}
.toast.ok { background: #d9f5d3; }
.toast.err { background: #ffd9d4; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* Tarjeta de sellos */
.lcard {
  position: relative; aspect-ratio: 1.586; width: 100%; max-width: 420px;
  perspective: 1200px; margin: 0 auto;
}
.lcard-inner {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.lcard.flipped .lcard-inner { transform: rotateY(180deg); }
.lcard-face {
  position: absolute; inset: 0; border-radius: 20px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  padding: 18px 18px 16px; display: flex; flex-direction: column;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), inset 0 0 0 1.5px rgba(233, 196, 106, 0.55);
}
.lcard-front {
  color: #fff3dc;
  background:
    radial-gradient(120% 90% at 85% 0%, rgba(255, 210, 120, 0.22), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, rgba(0, 0, 0, 0.35), transparent 60%),
    linear-gradient(140deg, #a3080d 0%, #8c0000 45%, #5e0306 100%);
}
.lcard-front::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.12;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.9) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.9) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.9) 1.5px, transparent 1.5px);
  background-size: 100% 18px, 36px 18px, 36px 18px;
  background-position: 0 0, 0 0, 18px 9px;
  -webkit-mask-image: linear-gradient(200deg, transparent 30%, #000 100%);
  mask-image: linear-gradient(200deg, transparent 30%, #000 100%);
}
.lcard-back {
  transform: rotateY(180deg);
  background: #fbf3e2; color: #2a1a10; align-items: center; justify-content: center; text-align: center; gap: 8px;
}
.lcard-back .qr { width: 52%; max-width: 190px; }
.lcard-back small { font-size: 13px; color: #6b5a48; }
.lcard-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.lcard-top img { width: 42px; height: 42px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(233, 196, 106, 0.6); }
.lcard-brand { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 0.5px; color: var(--oro-2); line-height: 1; }
.lcard-brand small { display: block; font-family: var(--text); font-weight: 500; font-size: 11.5px; letter-spacing: 3px; color: #f0d9a8; margin-top: 3px; }
.lcard-kind { margin-left: auto; font-size: 12.5px; text-align: right; color: #f2d7a6; line-height: 1.25; }
.stamps {
  position: relative; z-index: 1; margin: auto 0; display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 8px 10px; padding: 10px 2px;
}
.stamp {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px dashed rgba(240, 217, 168, 0.45); max-height: 44px; margin: 0 auto; width: 100%; max-width: 44px;
}
.stamp svg { width: 62%; height: 62%; }
.stamp.on { border: 0; background: radial-gradient(circle at 35% 30%, #ffe7a3, var(--oro) 70%, #8f6a22); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), inset 0 -2px 3px rgba(0, 0, 0, 0.2); }
.stamp.on svg { color: #7a0606; }
.stamp.prize { border-style: solid; border-color: var(--oro-2); }
.stamp.prize svg { color: var(--oro-2); width: 58%; }
.stamp.pop { animation: stamp-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes stamp-pop { from { transform: scale(0.2) rotate(-40deg); opacity: 0; } }
.lcard-foot { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.lcard-name { font-weight: 700; font-size: 18px; line-height: 1.15; }
.lcard-name small { display: block; font-weight: 500; font-size: 12.5px; color: #f2d7a6; }
.lcard-count { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; color: var(--oro-2); white-space: nowrap; }
.lcard-count small { font-family: var(--text); font-size: 13px; font-weight: 600; color: #f2d7a6; }

/* Estados de pedido */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; background: var(--pizarra-3); color: var(--masa-2); white-space: nowrap;
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.s-nuevo { background: rgba(242, 179, 61, 0.16); color: var(--alerta); }
.pill.s-pagado, .pill.s-horno { background: rgba(255, 128, 74, 0.16); color: #ff9a62; }
.pill.s-camino { background: rgba(116, 176, 255, 0.16); color: #8ec0ff; }
.pill.s-entregado { background: rgba(114, 194, 102, 0.16); color: var(--albahaca); }
.pill.s-anulado { background: rgba(255, 255, 255, 0.07); color: var(--masa-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
