/* Sweet Fantasy RestoBar — "noche dulce": fondo de mora oscura, acentos de fresa,
   menta y caramelo. Layout: app móvil para clientes (barra inferior de iconos)
   y panel con barra lateral para el administrador. */
:root {
  --bg: #170f1f;
  --surface: #221729;
  --surface-2: #2e2038;
  --line: #3d2c49;
  --fg: #fbf0fa;
  --muted: #b8a3c4;
  --pink: #ff6f9f;
  --pink-deep: #e2477d;
  --mint: #6fe3c6;
  --caramel: #ffc46b;
  --danger: #ff7a6b;
  --font-display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --r: 18px;
  --r-sm: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(255, 111, 159, .16), transparent 40%),
    radial-gradient(circle at 110% 20%, rgba(111, 227, 198, .10), transparent 35%);
  background-attachment: fixed;
  color: var(--fg);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 2rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.12rem; }
p { margin: 0; }
a { color: var(--mint); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 800; }
svg.lucide { width: 1.15em; height: 1.15em; stroke-width: 2.2; vertical-align: -0.2em; }

/* ---------- controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 0; border-radius: 999px; padding: .75em 1.3em; cursor: pointer;
  font: 700 .95rem var(--font-body); color: #2a0f1d; background: var(--pink);
  text-decoration: none; transition: transform .12s, background .12s;
}
.btn:hover { background: #ff86ad; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface-2); color: var(--fg); }
.btn.ghost:hover { background: var(--line); }
.btn.mint { background: var(--mint); color: #08261f; }
.btn.caramel { background: var(--caramel); color: #2d1a00; }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.btn.sm { padding: .45em .9em; font-size: .85rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tile:focus-visible, .nav a:focus-visible {
  outline: 3px solid var(--caramel); outline-offset: 2px;
}
.icon-btn { border: 0; background: var(--surface-2); color: var(--fg); width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--line); }

label.field { display: grid; gap: .35rem; font-weight: 700; font-size: .88rem; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea {
  width: 100%; font: 600 1rem var(--font-body); color: var(--fg); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: .7em .9em;
}
input:read-only { color: var(--muted); border-style: dashed; }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"] { width: 1.2rem; height: 1.2rem; accent-color: var(--pink); }
.check { display: flex; gap: .6rem; align-items: center; font-weight: 600; cursor: pointer; }
.err { color: var(--danger); font-size: .8rem; font-weight: 700; min-height: 0; }
.err:empty { display: none; }
input.bad, select.bad { border-color: var(--danger); background: rgba(255, 122, 107, .06); }
.link-btn { all: unset; cursor: pointer; text-decoration: underline; color: var(--caramel); font-weight: 800; }
.field > label { display: flex; gap: .35rem; flex-wrap: wrap; align-items: baseline; }
div.field { display: grid; gap: .35rem; font-weight: 700; font-size: .88rem; }
.phone-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.phone-row select { flex: 1 1 9.5rem; min-width: 0; }
.phone-row input { flex: 2 1 10rem; min-width: 0; }
/* Botón "Agregar a Google Wallet". Reemplázalo por la insignia oficial de Google al publicar. */
.gwallet { display: inline-flex; align-items: center; gap: .6rem; background: #000; color: #fff; border: 1px solid #5f6368; border-radius: 999px; padding: .5rem 1.2rem .5rem .7rem; cursor: pointer; font: 700 .95rem/1.1 var(--font-body); text-align: left; }
.gwallet small { display: block; font-size: .7rem; font-weight: 600; opacity: .8; }
.gwallet .g-logo { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#4285f4 0 25%, #34a853 0 50%, #fbbc04 0 75%, #ea4335 0); color: #fff; }
.gwallet:hover { background: #202124; }
.gw-fallback { display: inline-flex; align-items: center; gap: .6rem; }
/* Con la insignia oficial (frontend/img/agregar-a-google-wallet.svg) el botón no lleva fondo propio */
.gwallet.official { background: none; border: 0; padding: 0; }
.gwallet .gw-badge { height: 48px; width: auto; display: block; }
.gwallet:disabled { opacity: .6; cursor: progress; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 1rem; }
.stack.lg { gap: 1.5rem; }

.chip { display: inline-flex; align-items: center; gap: .35em; padding: .2em .7em; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.pink { background: rgba(255, 111, 159, .18); color: var(--pink); }
.chip.mint { background: rgba(111, 227, 198, .16); color: var(--mint); }
.chip.caramel { background: rgba(255, 196, 107, .16); color: var(--caramel); }
.chip.danger { background: rgba(255, 122, 107, .16); color: var(--danger); }
.chip.live::before { content: ""; width: .5em; height: .5em; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem; min-width: 0; }
.panel h3 { margin-bottom: .2rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding-block: 2rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login-card { width: min(440px, 100%); display: grid; gap: 1.4rem; }
.brand { display: grid; gap: .2rem; text-align: center; }
.brand-mark { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.6rem, 9vw, 3.4rem); line-height: .95; letter-spacing: -.01em;
  background: linear-gradient(100deg, var(--pink) 10%, var(--caramel) 55%, var(--mint) 95%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-family: var(--font-display); letter-spacing: .5em; font-size: .85rem; color: var(--muted); text-transform: uppercase; padding-left: .5em; }
.perks { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.perk { display: grid; justify-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; color: var(--muted); text-align: center; }
.perk span.ic { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; font-size: 1.2rem; background: var(--surface-2); }
.perk:nth-child(1) .ic { color: var(--pink); } .perk:nth-child(2) .ic { color: var(--caramel); } .perk:nth-child(3) .ic { color: var(--mint); } .perk:nth-child(4) .ic { color: #c9a6ff; }
.demo-box { border: 1.5px dashed var(--caramel); border-radius: var(--r-sm); padding: .8rem 1rem; font-size: .85rem; color: var(--caramel); display: grid; gap: .3rem; }
.demo-box button { all: unset; cursor: pointer; text-decoration: underline; font-weight: 800; }
.otp { letter-spacing: .5em; text-align: center; font-size: 1.4rem; font-family: var(--font-display); }

/* ---------- shell de la app ---------- */
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 1.2rem .8rem; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
.side .brand { text-align: left; padding: 0 .5rem; }
.side .brand-mark { font-size: 1.7rem; }
.side .brand-sub { font-size: .65rem; padding-left: 0; letter-spacing: .4em; }
.nav { display: grid; gap: .2rem; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 700; position: relative; }
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a.on { background: rgba(255, 111, 159, .14); color: var(--pink); }
.nav .badge { margin-left: auto; background: var(--pink); color: #2a0f1d; border-radius: 999px; font-size: .7rem; padding: 0 .45em; font-weight: 800; }
.main { padding-block: 1.5rem 6rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; }
.main-inner { max-width: 1160px; margin: 0 auto; display: grid; gap: 1.4rem; }
.view { display: grid; gap: 1.4rem; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.whoami { display: flex; align-items: center; gap: .6rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: #2a0f1d; background: linear-gradient(135deg, var(--pink), var(--caramel)); flex: none; }

/* app de cliente: una columna, barra inferior */
.client .shell { grid-template-columns: minmax(0, 1fr); }
.client .side { display: none; }
.client .main-inner { max-width: 620px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: .1rem;
  background: rgba(34, 23, 41, .94); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding: .4rem max(8px, env(safe-area-inset-right, 0px)) calc(.4rem + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); overflow-x: auto; }
.tabbar a { flex: 1 0 auto; max-width: 96px; display: grid; justify-items: center; gap: .15rem; padding: .35rem .4rem; font-size: .7rem; font-weight: 800; color: var(--muted); text-decoration: none; border-radius: 12px; }
.tabbar a svg.lucide { width: 1.45em; height: 1.45em; }
.tabbar a.on { color: var(--pink); }
.tabbar a.on svg { transform: translateY(-2px); transition: transform .2s; }
.admin .tabbar { display: none; }

@media (max-width: 860px) {
  .admin .shell { grid-template-columns: minmax(0, 1fr); }
  .admin .side { display: none; }
  .admin .tabbar { display: flex; justify-content: flex-start; }
}

/* ---------- tarjeta wallet ---------- */
.wallet { position: relative; border-radius: 24px; padding: 1.3rem; color: #2a0f1d; overflow: hidden; min-height: 210px; display: grid; gap: 1rem;
  background: linear-gradient(135deg, #ff8fb4 0%, #ff6f9f 38%, #ffb36b 100%); box-shadow: 0 18px 40px -18px rgba(255, 111, 159, .6); }
.wallet::before { /* chispas de azúcar */
  content: ""; position: absolute; inset: 0; opacity: .35; pointer-events: none;
  background-image: radial-gradient(circle, #fff 1.4px, transparent 1.6px), radial-gradient(circle, #6fe3c6 1.6px, transparent 1.8px);
  background-size: 26px 26px, 38px 38px; background-position: 0 0, 13px 19px; }
.wallet > * { position: relative; }
.wallet .w-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.wallet .w-brand { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; line-height: 1; }
.wallet .w-brand small { display: block; font-size: .62rem; letter-spacing: .4em; font-weight: 600; margin-top: .25rem; }
.wallet .w-bal { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; line-height: 1; }
.wallet .w-label { font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.wallet .w-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.wallet .w-stats { display: flex; gap: 1.2rem; }
.wallet .w-stats b { font-family: var(--font-display); font-size: 1.25rem; display: block; line-height: 1.1; }
.wallet .qr-mini { background: #fff; padding: 6px; border-radius: 12px; width: 92px; height: 92px; flex: none; }
.wallet .qr-mini img, .wallet .qr-mini canvas { width: 100% !important; height: 100% !important; }
.wallet .w-code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; font-size: .8rem; letter-spacing: .1em; }

/* sellos */
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: .55rem; }
.stamp { aspect-ratio: 1; max-width: 100%; border-radius: 50%; display: grid; place-items: center; border: 2px dashed var(--line); color: var(--line); font-size: 1.15rem; }
.stamp.on { border: 0; background: var(--mint); color: #08261f; animation: pop .4s backwards; }
.stamp.goal { border-color: var(--caramel); color: var(--caramel); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--pink), var(--caramel)); border-radius: 99px; transition: width .5s; }

/* tiles con iconos */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: .8rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; display: grid; gap: .4rem; text-align: left; color: var(--fg); font: inherit; cursor: pointer; text-decoration: none; transition: transform .15s, border-color .15s; min-width: 0; }
button.tile:hover, a.tile:hover { transform: translateY(-2px); border-color: var(--pink); }
.tile .t-ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 1.15rem; }
.t-pink { background: rgba(255, 111, 159, .16); color: var(--pink); }
.t-mint { background: rgba(111, 227, 198, .14); color: var(--mint); }
.t-caramel { background: rgba(255, 196, 107, .15); color: var(--caramel); }
.t-grape { background: rgba(201, 166, 255, .15); color: #c9a6ff; }
.tile .t-val { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .t-lab { font-size: .8rem; color: var(--muted); font-weight: 700; }

.banner { border-radius: var(--r); padding: 1rem 1.2rem; display: flex; gap: 1rem; align-items: center; background: linear-gradient(120deg, rgba(255, 196, 107, .22), rgba(255, 111, 159, .18)); border: 1px solid rgba(255, 196, 107, .35); }
.banner .b-ic { font-size: 1.6rem; color: var(--caramel); flex: none; }

/* promos */
.promo { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .9rem; align-items: start; padding: 1rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.promo.now { border-color: var(--mint); box-shadow: 0 0 0 1px var(--mint) inset; }
.promo .t-ic { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 1.3rem; }

/* listas y tablas */
.table-wrap { overflow-x: auto; border-radius: var(--r-sm); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.list { display: grid; gap: .6rem; align-content: start; }
.stack { align-content: start; }
.item { display: flex; gap: .8rem; align-items: center; padding: .8rem; border-radius: var(--r-sm); background: var(--surface-2); min-width: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .grow p { overflow-wrap: anywhere; }

.grid-2 { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.chart-box { position: relative; height: 240px; }

/* posts */
.post { border-radius: var(--r); overflow: hidden; background: var(--surface); border: 1px solid var(--line); display: grid; }
.post img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface-2); }
.post .p-body { padding: .8rem; display: grid; gap: .5rem; }
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 1.5rem; text-align: center; display: grid; gap: .5rem; justify-items: center; cursor: pointer; color: var(--muted); }
.drop:hover { border-color: var(--pink); color: var(--fg); }
.drop img { max-height: 260px; border-radius: var(--r-sm); }

/* QR */
.qr-card { display: grid; gap: .7rem; justify-items: center; text-align: center; }
.qr-box { background: #fff; padding: 12px; border-radius: 16px; width: 180px; height: 180px; }
.qr-box img, .qr-box canvas { width: 100% !important; height: 100% !important; }

/* filtros */
.seg { display: flex; gap: .4rem; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface-2); color: var(--muted); padding: .45em 1em; border-radius: 999px; font: 700 .85rem var(--font-body); cursor: pointer; }
.seg button.on { background: var(--fg); color: var(--bg); }

.quote { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; }
.quote div { background: var(--bg); border-radius: var(--r-sm); padding: .7rem; }
.quote b { display: block; font-family: var(--font-display); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.quote span { font-size: .75rem; color: var(--muted); font-weight: 700; }

/* toast + modal */
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: .7rem 1.2rem; border-radius: 999px; font-weight: 800; z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); max-width: calc(100% - 32px); text-align: center; }
#toast.bad { background: var(--danger); color: #2b0703; }
.modal { position: fixed; inset: 0; background: rgba(10, 5, 14, .7); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 1.5rem; }
.modal-close { position: absolute; top: .8rem; right: .8rem; }

.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; display: grid; gap: .5rem; justify-items: center; }
.empty svg.lucide { width: 2.2em; height: 2.2em; color: var(--line); }
.confetti { position: fixed; top: -10px; width: 9px; height: 14px; z-index: 70; pointer-events: none; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .6; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 480px) {
  h1 { font-size: 1.6rem; }
  .wallet .w-bal { font-size: 2.1rem; }
  .perks { grid-template-columns: repeat(2, 1fr); }
}
