/* Bar Pura Vida · estilos tomados de las demos del proyecto:
   claro = demo de rifas (papel, verde profundo, dorado);
   oscuro = demo «Pura Vida» de menú y pedidos (verde noche, dorado, títulos con remate).
   El tema sigue al celular y se puede fijar con el botón de la barra superior. */
@font-face { font-family: 'DM Sans'; src: url(/fonts/DMSans.ttf) format('truetype'); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: 'Gelasio'; src: url(/fonts/Gelasio.ttf) format('truetype'); font-weight: 400 700; font-display: swap; }

:root {
  --serif: Georgia, Gelasio, 'Times New Roman', serif;
  --paper: #f6f4ec; --card: #fffef8; --card2: #f0f3e9; --ink: #17372e; --muted: #566a60; --line: #d5dbcf;
  --deep: #11392d; --deep2: #1c5142; --deep-ink: #fffced; --deep-sub: #dce6d9;
  --accent: #1c5142; --accent-soft: #dce8dc; --gold: #ffcd66; --gold-edge: #d3a348; --gold-ink: #17372e; --gold-text: #8a5a12;
  --red: #984234; --red-soft: #f8e1d9; --blue: #314a73; --blue-soft: #e2eafa; --ok: #23523f; --ok-soft: #d9eadd; --warn: #754706; --warn-soft: #fff0c9;
  --bar: linear-gradient(90deg, #39705a, #5f9a78); --bar-hour: linear-gradient(90deg, #ac702b, #d9a24f); --col: linear-gradient(#e2b45a, #b07a32); --track: #e2e6d9;
  --kpi: #17372e; --shadow: 0 1px 0 #17372e0d; --focus: #bb7312;
  --bg-extra: linear-gradient(transparent, transparent);
  color-scheme: light;
  font: 16px/1.45 'DM Sans', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131815; --card: #1b231e; --card2: #222e23; --ink: #fff1df; --muted: #c3baaa; --line: #3e473d;
    --deep: #203e2d; --deep2: #17261d; --deep-ink: #fff1df; --deep-sub: #dfd7c9;
    --accent: #ebbd6f; --accent-soft: #313f31; --gold: #ebbd6f; --gold-edge: #ebbd6f; --gold-ink: #20180f; --gold-text: #f6ce89;
    --red: #ffc1b2; --red-soft: #422a25; --blue: #cbe5fb; --blue-soft: #304757; --ok: #d3efe3; --ok-soft: #285144; --warn: #ffdfa3; --warn-soft: #544225;
    --bar: linear-gradient(90deg, #578d66, #97c17e); --bar-hour: linear-gradient(90deg, #a86f40, #ecc272); --col: linear-gradient(#f4ca83, #9c673b); --track: #101712;
    --kpi: #f6ce89; --shadow: 0 6px 25px #080a0838; --focus: #f6ce89;
    --bg-extra: radial-gradient(ellipse at top right, #34251a 0, transparent 44rem);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131815; --card: #1b231e; --card2: #222e23; --ink: #fff1df; --muted: #c3baaa; --line: #3e473d;
  --deep: #203e2d; --deep2: #17261d; --deep-ink: #fff1df; --deep-sub: #dfd7c9;
  --accent: #ebbd6f; --accent-soft: #313f31; --gold: #ebbd6f; --gold-edge: #ebbd6f; --gold-ink: #20180f; --gold-text: #f6ce89;
  --red: #ffc1b2; --red-soft: #422a25; --blue: #cbe5fb; --blue-soft: #304757; --ok: #d3efe3; --ok-soft: #285144; --warn: #ffdfa3; --warn-soft: #544225;
  --bar: linear-gradient(90deg, #578d66, #97c17e); --bar-hour: linear-gradient(90deg, #a86f40, #ecc272); --col: linear-gradient(#f4ca83, #9c673b); --track: #101712;
  --kpi: #f6ce89; --shadow: 0 6px 25px #080a0838; --focus: #f6ce89;
  --bg-extra: radial-gradient(ellipse at top right, #34251a 0, transparent 44rem);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--bg-extra), var(--paper); background-attachment: fixed; color: var(--ink); }
h1, h2, h3, p { margin: 0; }
h1 { font: 400 clamp(2.1rem, 6vw, 3.4rem)/1.02 var(--serif); letter-spacing: -.045em; }
h2 { font: 600 1.32rem/1.2 var(--serif); letter-spacing: -.015em; }
h3 { font-size: 1rem; font-weight: 700; }
small, .muted { color: var(--muted); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  min-height: 44px; padding: .58rem .9rem; border-radius: 10px; cursor: pointer;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold-edge); }
button.solid { background: var(--deep); color: var(--deep-ink); border-color: var(--deep); }
button.ghost { background: transparent; }
button.link { background: none; border: 0; min-height: 0; padding: 0; color: var(--gold-text); text-decoration: underline; text-underline-offset: 3px; font-weight: 700; display: inline; }
button.danger { color: var(--red); }
button.sm { min-height: 36px; padding: .3rem .65rem; font-size: .88rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input, select, textarea { width: 100%; min-height: 46px; padding: .55rem .75rem; border-radius: 9px; background: var(--card); border: 1px solid var(--line); }
textarea { min-height: 72px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--deep2); }
input[type="date"], input[type="time"] { width: auto; }
.ui-icon { width: 1.15rem; height: 1.15rem; flex: none; vertical-align: -.2em; }

/* Estructura */
.app { max-width: 600px; margin: 0 auto; padding: 0 1rem 7rem; }
.app.wide { max-width: 1180px; padding-inline: clamp(1rem, 3vw, 2rem); }
.stack { display: grid; gap: 1rem; }
.stack.tight { gap: .5rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row > .grow, .grow { flex: 1; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: clamp(.9rem, 2.8vw, 1.25rem); display: grid; gap: .75rem; box-shadow: var(--shadow); min-width: 0; }
.card > h2, .card > .row > h2 { display: flex; align-items: center; gap: .55rem; }
.card h2 .ui-icon { color: var(--gold-text); }
.empty { padding: 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
.small { font-size: .85rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Barra superior */
.top { display: flex; align-items: center; gap: .55rem; padding: .9rem 0; }
.brand { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; background: none; border: 0; padding: 0; min-height: 0; font-weight: 800; font-size: 1.05rem; color: var(--ink); justify-content: flex-start; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brandmark { flex: none; display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 10px; background: var(--deep); color: var(--gold); font: 700 1rem var(--serif); border: 1px solid #665536; }
.top .icon-btn { min-height: 40px; min-width: 40px; padding: .35rem; border-radius: 99px; }
.top .ghost { min-height: 40px; padding: .35rem .8rem; }
.demo-flag { font-size: .78rem; padding: .18rem .6rem; border-radius: 99px; border: 1px dashed var(--muted); color: var(--muted); white-space: nowrap; }
.who { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18rem; }
@media (max-width: 460px) { .top .demo-flag, .top .who { display: none; } }

/* Portada: titular verde con anillos dorados */
.headline {
  position: relative; isolation: isolate; overflow: hidden; display: grid; gap: .55rem;
  padding: clamp(1.4rem, 5vw, 2.6rem); border-radius: 20px; color: #fff1df;
  background: linear-gradient(126deg, #204a3b, #17332a 65%, #3b2b1b); border: 1px solid #665536;
}
.headline::after { content: ""; position: absolute; z-index: -1; right: -40px; top: -100px; width: 330px; height: 330px; border-radius: 50%;
  background: repeating-radial-gradient(circle, #edba5e48 0 1px, transparent 2px 14px); }
.headline h1 { color: #fff8e6; }
.headline p { color: #dfd7c9; }
.headline .kicker { color: #f7cf7d; font-weight: 800; letter-spacing: .04em; }
.headline .row { margin-top: .5rem; }
.headline button.primary { background: #f7cf7d; color: #20180f; border-color: #f7cf7d; }
.headline button:not(.primary) { background: #ffffff12; color: #fff8e6; border-color: #ffffff40; }
.spotlight { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; }
.spotlight figure { margin: 0; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--card); }
.spotlight img { display: block; width: 100%; aspect-ratio: 1.45; object-fit: cover; background: var(--card2); }
.spotlight figcaption { padding: .5rem .65rem; display: grid; }
.spotlight strong { font-family: var(--serif); font-size: 1.02rem; font-weight: 600; }
.spotlight small { color: var(--gold-text); font-weight: 700; }
@media (max-width: 560px) { .spotlight { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.steps li { display: flex; gap: .85rem; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: .8rem .95rem; }
.steps .num { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 700 1rem var(--serif); }
.credits { font-size: .78rem; color: var(--muted); }
.credits a { color: var(--gold-text); }

/* Formularios */
.field { display: grid; gap: .3rem; font-weight: 650; }
.field > span { font-size: .95rem; }
.field .hint { font-size: .84rem; color: var(--muted); font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.grid3 { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.switch { display: flex; gap: .8rem; align-items: center; padding: .75rem .95rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; }
.switch:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.switch input { width: 1.25rem; height: 1.25rem; }
.switch div { display: grid; }
.switch small { font-size: .85rem; }
.error { color: var(--red); background: var(--red-soft); padding: .55rem .75rem; border-radius: 9px; font-weight: 650; font-size: .92rem; }
.big-btn { min-height: 54px; font-size: 1.05rem; width: 100%; }
.days { display: flex; flex-wrap: wrap; gap: .35rem; }
.days label { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .65rem; border: 1px solid var(--line); border-radius: 99px; font-weight: 650; font-size: .9rem; cursor: pointer; }
.days label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }

/* Avisos y estados */
.notice { border-radius: 10px; padding: .7rem .95rem; display: grid; gap: .15rem; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.notice.warn { border-left-color: #c6922c; background: var(--warn-soft); }
.notice.bad { border-left-color: var(--red); background: var(--red-soft); }
.notice p, .notice span { color: var(--muted); font-size: .93rem; }
.pill { display: inline-flex; align-items: center; gap: .3rem; border-radius: 20px; background: var(--card2); color: var(--muted); padding: .18rem .58rem; font-size: .79rem; font-weight: 750; white-space: nowrap; border: 0; }
.pill.nuevo { color: var(--warn); background: var(--warn-soft); }
.pill.en_preparacion { color: var(--blue); background: var(--blue-soft); }
.pill.entregado { color: var(--ok); background: var(--ok-soft); }
.pill.rechazado, .pill.agotado { color: var(--red); background: var(--red-soft); }
.pill.cancelado, .pill.deshabilitado { color: var(--muted); }
.pill.gold { color: var(--gold-ink); background: var(--gold); }
.tag { display: inline-block; font-size: .74rem; font-weight: 750; padding: .06rem .5rem; border-radius: 99px; background: var(--card2); color: var(--muted); margin: 0 .12rem; white-space: nowrap; }
.tag.ok { color: var(--ok); background: var(--ok-soft); }
.tag.bad { color: var(--red); background: var(--red-soft); }
.tag.gold { color: var(--warn); background: var(--warn-soft); }
.live { display: inline-flex; align-items: center; gap: .4rem; color: var(--accent); font-weight: 750; font-size: .9rem; }
.live::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: #4a8067; animation: latido 1.8s infinite; }
@keyframes latido { 50% { opacity: .3; } }
.toast { position: fixed; left: 50%; bottom: 6rem; transform: translateX(-50%); background: var(--deep); color: var(--deep-ink); padding: .7rem 1.1rem; border-radius: 12px; z-index: 40; font-weight: 650; max-width: 90vw; box-shadow: 0 8px 30px #0005; }

/* Panel del cliente */
.welcome h2 { font-size: 1.6rem; }
.points-card { position: relative; overflow: hidden; border-radius: 18px; padding: 1.2rem 1.25rem; color: #fff1df;
  background: linear-gradient(126deg, #204a3b, #17332a 70%, #3b2b1b); border: 1px solid #665536; display: grid; gap: .25rem; }
.points-card::after { content: ""; position: absolute; right: -60px; bottom: -110px; width: 260px; height: 260px; border-radius: 50%; background: repeating-radial-gradient(circle, #edba5e40 0 1px, transparent 2px 13px); }
.points-card > * { position: relative; }
.points-card .metric { font: 400 3.6rem/1 var(--serif); letter-spacing: -.04em; color: #f7cf7d; }
.points-card small, .points-card span { color: #dfd7c9; }
.wifi { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.wifi code { font: 800 1.2rem 'DM Sans', sans-serif; letter-spacing: .04em; display: block; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.tile { display: grid; justify-items: start; text-align: left; gap: .15rem; padding: 1rem; border-radius: 14px; min-height: 96px; font-weight: 400; }
.tile .ui-icon { width: 1.5rem; height: 1.5rem; color: var(--gold-text); margin-bottom: .2rem; }
.tile b { font-size: 1.05rem; }
.tile.hot { background: var(--gold); color: var(--gold-ink); border-color: var(--gold-edge); }
.tile.hot .ui-icon, .tile.hot small { color: var(--gold-ink); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; align-items: center; gap: .8rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline li > div { flex: 1; display: grid; min-width: 0; }
.timeline li > .ui-icon { color: var(--gold-text); }
.timeline em { font-style: normal; font-weight: 800; color: var(--accent); white-space: nowrap; }
.timeline em.neg { color: var(--red); }

/* Tarjeta de sellos y premios */
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: .5rem; }
.stamp { aspect-ratio: 1; border-radius: 50%; border: 2px dashed var(--line); display: grid; place-items: center; color: var(--muted); font: 700 .9rem var(--serif); position: relative; }
.stamp.on { border: 2px solid var(--gold-edge); background: var(--gold); color: var(--gold-ink); }
.stamp.goal { border-style: solid; border-color: var(--gold-edge); }
.stamp.goal::after { content: attr(data-icon); position: absolute; right: -7px; top: -9px; font-size: 1rem; }
.goals { display: grid; gap: .35rem; }
.goal-row { display: flex; align-items: center; gap: .6rem; font-size: .93rem; }
.goal-row .ico { font-size: 1.3rem; }
.goal-row.done { color: var(--muted); }
.goal-row.done b { text-decoration: line-through; }
.prize { display: flex; gap: .8rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--line); }
.prize:first-child { border-top: 0; }
.prize .ico { flex: none; width: 2.8rem; height: 2.8rem; border-radius: 12px; background: var(--card2); display: grid; place-items: center; font-size: 1.5rem; }
.prize > div { flex: 1; min-width: 0; display: grid; gap: .15rem; }
.meter { height: 8px; border-radius: 9px; background: var(--track); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--bar); border-radius: 9px; }
.lock { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .85rem; font-weight: 650; }

/* Carta */
.chips { display: flex; gap: .45rem; overflow-x: auto; position: sticky; top: 0; z-index: 3; background: var(--paper); padding: .55rem 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 40px; border-radius: 10px; padding: .35rem .9rem; font-weight: 700; }
.chips button[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.chips.wrap { flex-wrap: wrap; position: static; padding: 0; background: none; }
.chips button b { margin-left: .3rem; color: var(--muted); }
.cat { scroll-margin-top: 4rem; background: var(--card); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; box-shadow: var(--shadow); }
.cat > h2 { padding: .75rem 1rem; background: var(--card2); border-bottom: 1px solid var(--line); }
.dish { display: grid; grid-template-columns: 1fr auto; gap: .45rem .8rem; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.dish:last-child { border-bottom: 0; }
.dish.off { opacity: .6; }
.dish h3 { font-weight: 650; }
.price { font-weight: 790; white-space: nowrap; color: var(--gold-text); }
.promo-badge { display: inline-block; margin-left: .35rem; font-size: .74rem; font-weight: 800; padding: .05rem .45rem; border-radius: 99px; background: var(--gold); color: var(--gold-ink); vertical-align: .1em; }
.variants { grid-column: 1 / -1; display: flex; gap: .45rem; flex-wrap: wrap; }
.variants button, .add { min-height: 40px; padding: .35rem .8rem; }
.qty { display: inline-flex; align-items: center; gap: .35rem; }
.qty button { min-height: 36px; min-width: 36px; padding: 0; border-radius: 50%; }
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); background: #17332a; color: #fff1df; display: flex; justify-content: center; box-shadow: 0 -3px 20px #0005; }
.cartbar > div { max-width: 600px; width: 100%; display: flex; align-items: center; gap: .8rem; }
.cartbar small { color: #dfd7c9; }
.cartbar button.primary { background: #f7cf7d; color: #20180f; border-color: #f7cf7d; }
.sheet-bg { position: fixed; inset: 0; background: #0008; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 600px; max-height: 90vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 1.2rem 1rem calc(1.2rem + env(safe-area-inset-bottom)); display: grid; gap: .9rem; border: 1px solid var(--line); }
@media (min-width: 900px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; max-width: 660px; } }
.sheet section { display: grid; gap: .4rem; }
.line { display: grid; grid-template-columns: 1fr auto; gap: .4rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.line input { min-height: 40px; grid-column: 1 / -1; font-size: .92rem; }
.line.reward b { color: var(--gold-text); }
.reward-pick { display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left; justify-content: flex-start; font-weight: 400; }
.reward-pick[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.reward-pick .ico { font-size: 1.4rem; }
.reward-pick > span:nth-child(2) { flex: 1; display: grid; }

/* Pedidos (barra) */
.board { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); align-items: start; }
.col { display: grid; gap: .65rem; }
.col > h2 { display: flex; justify-content: space-between; align-items: center; }
.order { background: var(--card); border: 1px solid var(--line); border-top: 4px solid #97b09e; border-radius: 13px; padding: .9rem; display: grid; gap: .5rem; box-shadow: var(--shadow); }
.order.is-new { border-top-color: #d79938; }
.order.o-en_preparacion { border-top-color: #84b7d3; }
.order.o-entregado { border-top-color: #6fb59e; }
.order.o-rechazado { border-top-color: #d8907d; }
.order .ttl { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; }
.order ul { margin: 0; padding-left: 1.1rem; }
.order .note { font-size: .88rem; background: var(--warn-soft); color: var(--warn); padding: .35rem .55rem; border-radius: 7px; }
.order .reward { color: var(--gold-text); font-weight: 700; }
.old { color: var(--red); font-weight: 650; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .45rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 650; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg button { min-height: 36px; border: 0; border-radius: 0; padding: .3rem .7rem; background: transparent; font-size: .86rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.seg.big button { min-height: 40px; padding: .35rem .85rem; }

/* Panel del personal */
.login { max-width: 440px; margin: 2rem auto; }
.staff { display: grid; gap: 1rem; align-items: start; }
.side { display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none; position: sticky; top: 0; z-index: 4; padding: .35rem; background: var(--card); border: 1px solid var(--line); border-radius: 13px; }
.side::-webkit-scrollbar { display: none; }
.side > button { flex: none; justify-content: flex-start; background: transparent; border-color: transparent; min-height: 42px; }
.side > button .ui-icon { color: var(--gold-text); }
.side > button:hover:not([aria-current="true"]) { background: var(--card2); border-color: var(--line); }
.side > button[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.side .badge { margin-left: auto; background: var(--gold); color: var(--gold-ink); border-radius: 99px; padding: 0 .5rem; font-size: .8rem; }
.demo-tools { display: none; }
.demo-tools summary { cursor: pointer; color: var(--muted); font-size: .88rem; padding: .4rem .5rem; }
.demo-tools button { width: 100%; margin-top: .35rem; font-size: .88rem; }
@media (min-width: 900px) {
  .staff { grid-template-columns: 240px 1fr; }
  .side { flex-direction: column; top: 1rem; }
  .side > button { width: 100%; }
  .demo-tools { display: block; margin-top: .5rem; border-top: 1px solid var(--line); }
}
#vista { min-width: 0; }
#vista > .row:first-child { align-items: flex-end; }
#vista h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); align-items: start; }
.filters { display: grid; gap: .6rem; grid-template-columns: 2fr 1fr; }
@media (max-width: 520px) { .filters { grid-template-columns: 1fr; } }
.subtabs { display: flex; gap: .3rem; flex-wrap: wrap; padding: .3rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; width: fit-content; max-width: 100%; }
.subtabs button { border-color: transparent; background: transparent; min-height: 40px; }
.subtabs button[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }

/* Indicadores */
.kpis { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.kpi { display: grid; gap: .15rem; align-content: start; justify-items: start; text-align: left; padding: .85rem 1rem; border-radius: 13px; background: var(--card); border: 1px solid var(--line); border-top: 2px solid var(--gold-edge); font-weight: 400; min-height: 0; box-shadow: var(--shadow); }
.kpi .ui-icon { color: var(--gold-text); }
.kpi > small:first-of-type { font-size: .82rem; font-weight: 650; }
.kpi > b { font: 400 1.9rem/1.08 var(--serif); letter-spacing: -.03em; color: var(--kpi); }
.kpis.small .kpi > b { font-size: 1.55rem; }
.kpi small.up { color: var(--accent); font-weight: 750; }
.kpi small.down { color: var(--red); font-weight: 750; }

/* Gráficos */
.dist { display: flex; height: 12px; gap: 2px; border-radius: 9px; overflow: hidden; background: var(--track); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .86rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: .8rem; height: .8rem; border-radius: 3px; display: inline-block; }
.st-nuevo { background: #e5b768; }
.st-en_preparacion { background: #84b7d3; }
.st-entregado { background: #6fb59e; }
.st-rechazado { background: #d28574; }
.st-cancelado { background: #8b958c; }
.legend i.alt, .track.alt span { background: var(--bar-hour); }
.cols { display: flex; gap: .4rem; align-items: stretch; overflow-x: auto; padding: .3rem .1rem .2rem; }
.colx { flex: 1 0 46px; display: grid; grid-template-rows: auto 140px auto auto; gap: .25rem; text-align: center; }
.cols.dense .colx { flex-basis: 24px; }
.colx em { font-style: normal; font-size: .72rem; font-weight: 750; color: var(--muted); min-height: 1em; }
.colx .bar { display: flex; justify-content: center; align-items: flex-end; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0 27px, color-mix(in srgb, var(--line) 60%, transparent) 27px 28px); }
.colx .bar span { display: block; width: min(78%, 40px); background: var(--col); border-radius: 6px 6px 0 0; min-height: 2px; }
.colx.fin small:first-of-type { color: var(--gold-text); font-weight: 800; }
.colx small { font-size: .72rem; line-height: 1.2; }
.colx small.v { color: var(--accent); font-weight: 700; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.bars li { display: grid; gap: .25rem; }
.track { height: 9px; border-radius: 9px; background: var(--track); overflow: hidden; }
.track span { display: block; height: 100%; background: var(--bar); border-radius: 9px; min-width: 3px; }
.hours { display: grid; gap: .45rem; }
.hr { display: grid; grid-template-columns: 4.6rem 1fr 6.6rem; gap: .6rem; align-items: center; }
.hr .pair { display: grid; gap: 3px; }
.hr .track { height: 7px; }
.hr small:last-child { text-align: right; }

/* Historial, clientes y actividad */
.hist { display: grid; }
.hist details { border-top: 1px solid var(--line); }
.hist summary { display: flex; gap: .7rem; align-items: center; padding: .65rem 0; cursor: pointer; list-style: none; }
.hist summary::-webkit-details-marker { display: none; }
.hist ul { margin: 0 0 .7rem; padding-left: 1.2rem; font-size: .92rem; }
.people { display: grid; gap: .45rem; }
.person { display: flex; align-items: center; gap: .8rem; justify-content: flex-start; text-align: left; border-radius: 13px; padding: .7rem .9rem; font-weight: 400; width: 100%; }
.person b { font-weight: 750; }
.avatar { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--deep); color: #f7cf7d; font: 700 1.05rem var(--serif); }
.avatar.big { width: 3.2rem; height: 3.2rem; font-size: 1.4rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: .5rem; }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: .55rem .7rem; display: grid; }
.facts b { font-size: 1.02rem; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .88rem; min-width: 4.6rem; }
.link.strong { color: var(--ink); text-decoration-color: var(--line); }

/* Carta del dueño y listas de configuración */
.menu-rows { display: grid; }
.menu-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.menu-row:first-child { border-top: 0; }
.menu-row.deshabilitado > .grow, .menu-row.pausado > .grow { opacity: .55; }
.menu-row .ico { font-size: 1.5rem; }
.var-row { display: grid; grid-template-columns: 1fr 8.5rem auto; gap: .5rem; align-items: center; }
.var-row input, .var-row select { min-height: 44px; }
code { font-size: .85rem; word-break: break-all; }
.preview { background: var(--card2); border-radius: 10px; padding: .65rem .8rem; font-size: .93rem; }
.preview b { color: var(--gold-text); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Stickers (como los de WhatsApp: borde blanco grueso, sombra y un poco de giro) */
.sticker { display: inline-grid; place-items: center; font-size: 2.2rem; line-height: 1; transform: rotate(-6deg);
  filter: drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff) drop-shadow(0 3px 4px #0005); }
.sticker:nth-child(even) { transform: rotate(5deg); }
.sticker.sm { font-size: 1.5rem; }
.sticker.lg { font-size: 3rem; }
.stamp.goal::after { filter: drop-shadow(1px 0 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 1px 0 #fff) drop-shadow(0 -1px 0 #fff); font-size: 1.15rem; }
.stamp.on.goal { font-size: 1.5rem; }
.stickers-won { display: flex; flex-wrap: wrap; gap: .7rem 1rem; align-items: center; }
.stickers-won figure { margin: 0; display: grid; justify-items: center; gap: .2rem; }
.stickers-won figcaption { font-size: .72rem; color: var(--muted); max-width: 5.5rem; text-align: center; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: .5rem; }
.sticker-grid button { min-height: 72px; background: var(--card2); }
.sticker-grid button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.pick-sticker { min-width: 3.2rem; padding: .2rem .4rem; }
.pick-sticker .sticker { font-size: 1.5rem; }
.var-row.meta { grid-template-columns: auto 1fr 7rem auto; }
.dish.con-foto { grid-template-columns: 64px 1fr auto; }
.dish.con-foto > img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; grid-row: span 2; }
.dish.con-foto .variants { grid-column: 2 / -1; }
.order li .link { font-size: .78rem; color: var(--muted); margin-left: .35rem; text-decoration-color: var(--line); }

/* ===== Vista del cliente: hecha para usarse de noche y con tragos (letras y botones grandes, todo a un dedo) ===== */
.app.cli { font-size: 17px; padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
.app.cli.con-carrito { padding-bottom: calc(11rem + env(safe-area-inset-bottom)); }
.cli h1 { font-size: clamp(2rem, 8vw, 2.8rem); }
.cli h2 { font-size: 1.4rem; }
.cli small, .cli .muted { font-size: .95rem; }
.cli button { min-height: 52px; font-size: 1.02rem; border-radius: 13px; }
.cli button.link { min-height: 44px; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; }
.cli button.xl, .cli .xl { min-height: 60px; font-size: 1.15rem; width: 100%; border-radius: 15px; }
.cli button.huge { min-height: 72px; font-size: 1.35rem; box-shadow: 0 6px 0 var(--gold-edge); }
.cli button.huge .ui-icon { width: 1.6rem; height: 1.6rem; }
.cli button.huge:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--gold-edge); }
.cli input, .cli select { min-height: 56px; font-size: 1.1rem; border-radius: 12px; }
.cli .switch { padding: .95rem 1rem; }
.cli .switch input { width: 1.6rem; height: 1.6rem; flex: none; }
.cli .switch b { font-size: 1.05rem; }
.big-form { gap: .9rem; }
.code { font: 800 2rem/1 'DM Sans', sans-serif; letter-spacing: .4em; text-align: center; }
.center { text-align: center; }
.warn-text { color: var(--red) !important; font-weight: 750; }
.count { font: 600 1.4rem var(--serif); color: var(--gold-text); }

/* Barra de pestañas fija abajo */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; display: grid; grid-template-columns: repeat(4, 1fr); max-width: 600px; margin: 0 auto;
  background: var(--card); border-top: 1px solid var(--line); padding: .35rem .35rem calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -4px 22px #0002; }
@media (min-width: 620px) { .tabbar { border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; } }
.cli .tabbar button { position: relative; flex-direction: column; gap: .15rem; min-height: 62px; padding: .3rem .2rem; border: 0; background: none; color: var(--muted); font-size: .82rem; font-weight: 750; border-radius: 12px; }
.tabbar .ui-icon { width: 1.6rem; height: 1.6rem; }
.cli .tabbar button[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.tabbar button[aria-current="page"] .ui-icon { color: var(--gold-text); }
.tabbar .badge { position: absolute; top: .25rem; left: calc(50% + .45rem); min-width: 1.35rem; height: 1.35rem; border-radius: 99px; background: var(--red); color: #fff; font-size: .78rem; display: grid; place-items: center; padding: 0 .3rem; }
[data-theme="dark"] .tabbar .badge, :root:not([data-theme="light"]) .tabbar .badge { color: #2a120c; }
.cli .cartbar { bottom: calc(70px + env(safe-area-inset-bottom)); max-width: 600px; margin: 0 auto; border-radius: 16px 16px 0 0; padding-bottom: .7rem; }
.cli .cartbar b { font-size: 1.15rem; }
.cli .cartbar button.xl { width: auto; flex: none; padding-inline: 1.3rem; }

/* Inicio */
.hola { display: grid; gap: .35rem; padding-top: .3rem; }
.hola p { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; color: var(--muted); font-size: 1.05rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: 99px; font-weight: 750; font-size: .95rem; background: var(--card2); border: 1px solid var(--line); color: var(--ink); min-height: 0; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.cli button.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; min-height: 40px; font-size: .95rem; }
.headline.aviso { text-align: center; justify-items: center; }
.headline.aviso .grande { font-size: 1.2rem; color: #fff8e6; }
.points-card { display: grid; gap: .3rem; }
.points-card .next { font-size: 1.05rem; color: #fff1df; }
.points-card .next b { color: #f7cf7d; }
.cli .order-now { text-align: left; justify-content: stretch; font-weight: 400; border: 2px solid var(--gold-edge); }
.track-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.track-steps li { display: grid; justify-items: center; gap: .3rem; font-size: .9rem; color: var(--muted); font-weight: 700; text-align: center; position: relative; }
.track-steps li span { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); background: var(--card); font: 700 1.05rem var(--serif); z-index: 1; }
.track-steps li + li::before { content: ""; position: absolute; top: 1.2rem; right: 50%; width: 100%; height: 3px; background: var(--line); }
.track-steps li.done, .track-steps li.now { color: var(--ink); }
.track-steps li.done span { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.track-steps li.done + li::before, .track-steps li.now::before { background: var(--ok); }
.track-steps li.now span { background: var(--gold); color: var(--gold-ink); border-color: var(--gold-edge); animation: latido 1.8s infinite; }
@media (prefers-reduced-motion: reduce) { .track-steps li.now span { animation: none; } }
.card.gift { border: 2px dashed var(--gold-edge); background: var(--card2); }
.prize.big { padding: .85rem 0; }
.prize.big b { font-size: 1.1rem; }
.cli .prize button { min-height: 48px; padding-inline: 1.1rem; }
.stamps.big { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: .6rem; }
.stamps.big .stamp { font-size: 1.15rem; }
.stamps.big .stamp.on.goal { font-size: 1.6rem; }
.numeros { display: flex; flex-wrap: wrap; gap: .4rem; }
.numeros span { font: 700 1.15rem var(--serif); padding: .3rem .7rem; border-radius: 10px; background: var(--gold); color: var(--gold-ink); }
.campaign .choices { display: grid; gap: .5rem; }
.campaign .choices button { justify-content: flex-start; text-align: left; }
.stars { display: flex; gap: .3rem; }
.cli .stars button { flex: 1; font-size: 1.8rem; color: var(--gold-text); padding: 0; }
.prize-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; text-align: center; }
.prize-strip div { display: grid; justify-items: center; gap: .35rem; font-size: .92rem; }
.steps.big li { padding: .95rem 1rem; }
.steps.big li div { display: grid; }
.steps.big b { font-size: 1.08rem; }
.steps.big .num { width: 2.4rem; height: 2.4rem; font-size: 1.15rem; }
.cli details.card > summary { cursor: pointer; font-weight: 750; font-size: 1.1rem; display: flex; align-items: center; gap: .55rem; min-height: 44px; list-style: none; }
.cli details.card > summary::-webkit-details-marker { display: none; }
.cli details.card > summary::after { content: "+"; margin-left: auto; font-size: 1.5rem; color: var(--muted); }
.cli details[open].card > summary::after { content: "−"; }
.demo-box { border-style: dashed; }
.rules { margin: 0; padding-left: 1.3rem; display: grid; gap: .7rem; font-size: 1.05rem; }
.stickers-won { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .7rem; }
.stickers-won figure { margin: 0; display: grid; justify-items: center; gap: .3rem; text-align: center; font-size: .85rem; color: var(--muted); }
.cli .feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.cli .feed li { display: grid; }

/* Carta grande */
.cli .chips { top: 0; padding: .65rem 0; }
.cli .chips button { min-height: 48px; font-size: 1.02rem; padding-inline: 1.1rem; }
.dish.big { padding: .95rem 1rem; gap: .55rem .9rem; }
.dish.big h3 { font-size: 1.12rem; }
.dish.big .price { font-size: 1.1rem; }
.dish.big > div { display: grid; gap: .2rem; }
.cli .add { min-height: 50px; padding-inline: 1rem; background: var(--gold); color: var(--gold-ink); border-color: var(--gold-edge); }
.qty.big { gap: .5rem; }
.qty.big b { min-width: 1.6rem; text-align: center; font-size: 1.25rem; }
.cli .qty.big button { min-height: 48px; min-width: 48px; font-size: 1.5rem; }
.var-on { display: inline-flex; align-items: center; gap: .5rem; padding: .25rem .4rem .25rem .8rem; border-radius: 14px; background: var(--accent-soft); }
.var-on small { font-weight: 750; color: var(--ink); }
.line.big { padding: .8rem 0; align-items: center; }
.line.big b { font-size: 1.08rem; }
.cli .reward-pick { min-height: 64px; }
.reward-pick .tap { font-weight: 800; color: var(--gold-text); }
.cli .reward-pick[aria-pressed="true"] .ui-icon { color: var(--ok); width: 1.5rem; height: 1.5rem; }
.cli .cartbar .grow, .line.big > div { display: grid; }
.order .row button.primary { min-height: 54px; font-size: 1.1rem; }

/* Tarjeta de sellos con stickers (cada visita pega uno; se ve el sticker, no el número) */
.sellos-card { display: grid; gap: .7rem; padding: .9rem; border-radius: 18px; background: var(--card2); border: 1px solid var(--line); }
.sellos-card + .sellos-card { margin-top: .7rem; }
.sellos-head { display: grid; gap: .1rem; }
.sellos-head small { color: var(--gold-text); font-weight: 750; }
.sellos-head b { font: 600 1.3rem/1.2 var(--serif); }
.sellos-head .falta { font-weight: 750; color: var(--ink); font-size: 1.02rem; }
.sellos { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: .55rem; }
.sello { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; font-size: 2rem; line-height: 1;
  border: 2px dashed var(--line); }
.sello em { font-style: normal; filter: grayscale(1); opacity: .25; }
.sello.on em { filter: none; opacity: 1; }
.sello.on { border: 0; background: var(--accent-soft);
  text-shadow: 0 0 0 #fff; box-shadow: inset 0 0 0 3px #fff8, 0 3px 8px #0002; transform: rotate(-8deg); }
.sello.on:nth-child(even) { transform: rotate(7deg); }
.sello.on:nth-child(3n) { transform: rotate(-3deg) scale(1.04); }
.sello.meta { border-color: var(--gold-edge); }
.sello i { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-size: 1.05rem; width: 1.7rem; height: 1.7rem; display: grid; place-items: center;
  border-radius: 50%; background: var(--gold); box-shadow: 0 2px 5px #0003; }
.sellos-card.despues { padding: .7rem .9rem; opacity: .85; }
.sellos-card.despues .sellos-head b { font-size: 1.05rem; font-family: inherit; font-weight: 750; color: var(--muted); }
.sellos-card.despues .sellos { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: .35rem; }
.sellos-card.despues .sello { font-size: 1.25rem; }
.sellos-card.despues .sello i { width: 1.2rem; height: 1.2rem; font-size: .75rem; }
.sellos-card.hecha { border: 2px solid var(--gold-edge); }
@media (prefers-reduced-motion: reduce) { .sello.on { transform: none !important; } }

/* Editor de series del dueño */
.serie-box { display: grid; gap: .6rem; padding: .9rem; border: 1px solid var(--line); border-radius: 16px; background: var(--card2); }
.serie-box .row input[name=serie_nombre] { font-weight: 750; }
.tarjeta-row { display: grid; grid-template-columns: auto 1fr 5.5rem auto; gap: .5rem; align-items: center; }
