/* Páginas de cada local (su subdominio): página del local, ingreso, mostrador, panel del dueño, cartel y privacidad.
   Misma estética que la portada y la app (letras Bricolage Grotesque y Figtree, botones redondeados, cuadros con
   sombra suave), con los colores de cada local: los pone src/views/local.js (themeVars) en --primary, --accent, etc. */
:root {
  --primary: #9E391B;
  --dark: #44291E;
  --accent: #CAA265;
  --olive: #434726;
  --olive-light: #7F7D4D;
  --caramel: #8C5335;
  --cream: #FCF7E2;
  --beige: #DFC6A8;
  /* Base neutra, igual en todos los locales */
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #14122b;
  --muted: #6b6886;
  --line: #e7e3ee;
  --ok-bg: #e5f6ec; --ok-fg: #1f6b46;
  --err-bg: #fde7e3; --err-fg: #a3341f;
  --warn-bg: #fdf3d6; --warn-fg: #6b4e00;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(20, 18, 43, .06), 0 10px 28px -16px rgba(20, 18, 43, .3);
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-text); font-weight: 600; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-text); text-decoration: underline; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.03em; line-height: 1.08; margin: 0 0 .4em; }
h1 { font-size: 2rem; }
h3 { font-size: 1.25rem; }
.wrap { max-width: 460px; margin: 0 auto; padding: 24px 16px 48px; }
.wrap.wide { max-width: 1100px; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: .94rem; }
.small { font-size: .82rem; }
.hidden { display: none !important; }

/* Marca del local */
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 22px; }
.brand img { width: 104px; height: 104px; border-radius: 28px; box-shadow: var(--shadow); object-fit: cover; }
.brand.sm { flex-direction: row; justify-content: center; margin: 0 0 16px; }
.brand.sm img { width: 44px; height: 44px; border-radius: 14px; box-shadow: none; }
.brand.sm span { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; font-size: 1.15rem; }
/* Sin logo: iniciales en un cuadrado redondeado (mismo tamaño que el logo) o el nombre en letras */
.logo-text { display: inline-flex; align-items: center; justify-content: center; width: 104px; height: 104px; border-radius: 28px; background: var(--primary); color: var(--on-primary); font-family: var(--font-display); font-weight: 800; font-size: 2.5rem; line-height: 1; flex: none; }
.brand.sm .logo-text { width: 44px; height: 44px; border-radius: 14px; font-size: 1.05rem; }
.brand-name { font-family: var(--font-display); font-weight: 800; letter-spacing: -.03em; font-size: 1.8rem; text-align: center; color: var(--primary-text); }
.poster-logo { width: 150px; height: 150px; border-radius: 40px; border: 3px solid var(--cream); object-fit: cover; }
.poster-name { font-family: var(--font-display); font-weight: 800; letter-spacing: -.03em; font-size: 2.4rem; }

/* Cuadros y formularios */
.panel { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
/* Varios cuadros uno abajo del otro (panel del dueño → Accesos): separados y todos del mismo ancho */
.panels { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .95rem; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent); }
textarea { min-height: 110px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .94rem; margin-top: 16px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--primary); flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 20px; margin-top: 18px; border: 0; border-radius: 999px;
  background: var(--primary); color: var(--on-primary); font: 700 1.02rem var(--font-body);
  cursor: pointer; text-decoration: none; transition: transform .1s, filter .15s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn:hover { filter: brightness(1.06); box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn:focus-visible, .tabs button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.olive { background: var(--olive); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { box-shadow: none; border-color: var(--muted); }
.btn.inline { width: auto; margin-top: 0; padding: 9px 16px; font-size: .92rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.alert { padding: 12px 16px; border-radius: 16px; margin: 12px 0; font-size: .95rem; }
.alert.err { background: var(--err-bg); color: var(--err-fg); }
.alert.ok { background: var(--ok-bg); color: var(--ok-fg); }
.alert.warn { background: var(--warn-bg); color: var(--warn-fg); }
.alert.warn a { color: inherit; font-weight: 700; }

/* Página del local: los pasos para sumarse */
.panel ol { padding-left: 0; margin: 12px 0 0; list-style: none; counter-reset: paso; }
.panel ol li { position: relative; padding: 6px 0 6px 38px; counter-increment: paso; }
.panel ol li::before {
  content: counter(paso); position: absolute; left: 0; top: 5px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; font-weight: 700;
  background: color-mix(in srgb, var(--primary) 14%, #fff); color: var(--primary-text);
}

/* Mostrador */
#reader { border-radius: var(--radius); overflow: hidden; background: #000; }
#reader video { border-radius: var(--radius); }
.cust { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cust h2 { margin: 0; font-size: 1.5rem; }
.cust-who { flex: 1; min-width: 0; }
.cust-ava { flex: none; width: 56px; height: 56px; border-radius: 18px; overflow: hidden; }
.cust-ava svg { display: block; width: 100%; height: 100%; }
.mini-stamps { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 4px; }
.mini-stamps i { width: 26px; height: 26px; border-radius: 50%; border: 2px dashed var(--line); }
.mini-stamps i.on { background: var(--accent); border: 2px solid var(--primary); }
.list-item {
  display: flex; justify-content: space-between; gap: 10px; padding: 12px 10px; margin: 0 -10px;
  border-bottom: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.list-item:hover { background: var(--bg); }

/* Panel del dueño */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; padding: 6px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.tabs button {
  border: 0; background: transparent; color: var(--muted); padding: 9px 16px; border-radius: 999px;
  font: 600 .92rem var(--font-body); cursor: pointer;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--ink); color: #fff; }
/* Listas de promos: chips sueltos, sin la cápsula de las pestañas (son varios y bajan de línea) */
#segments { background: none; box-shadow: none; padding: 0; width: auto; }
#segments button { background: var(--bg); border: 1.5px solid var(--line); }
#segments button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.kpi .v { font-family: var(--font-display); font-size: 2.1rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; color: var(--primary-text); }
.kpi .l { font-size: .85rem; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars span.b { width: 100%; background: var(--primary); border-radius: 8px 8px 3px 3px; min-height: 2px; }
.bars span.d { font-size: .7rem; color: var(--muted); }
.bars span.n { font-size: .72rem; font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill.simulado { background: var(--line); color: var(--ink); }
.pill.enviado, .pill.real { background: var(--ok-bg); color: var(--ok-fg); }
.pill.error { background: var(--err-bg); color: var(--err-fg); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* Cartel para imprimir */
.poster { max-width: 560px; margin: 0 auto; padding: 40px 28px; text-align: center; background: var(--primary); color: var(--on-primary); min-height: 100vh; }
.poster h1 { font-size: 2.4rem; }
.poster .qr { background: #fff; display: inline-block; padding: 18px; border-radius: 32px; margin: 20px 0; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .45); }
.poster .qr svg { width: 260px; height: 260px; display: block; }
.poster ol { text-align: left; display: inline-block; font-size: 1.1rem; margin: 0; padding-left: 1.2em; }
.poster ol li { margin: 6px 0; }
@media print {
  .no-print { display: none !important; }
  body { background: var(--primary); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Promos por WhatsApp */
.promo-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.promo-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.promo-msg { background: var(--bg); border-radius: 14px; padding: 10px 14px; margin-top: 8px; font-size: .9rem; white-space: pre-wrap; }
