/* Cafélato Club — crema, beige, marrón y dorado. Diseño móvil primero. */
:root {
  --crema: #f7f0e4;
  --crema-2: #fffaf2;
  --beige: #e8dcc8;
  --beige-2: #d9c7a8;
  --marron: #5b3a29;
  --marron-2: #3e2723;
  --cafe: #8b5e3c;
  --dorado: #c9a227;
  --dorado-2: #a8841a;
  --ok: #2f7d4f;
  --error: #b3261e;
  --texto: #2b1a12;
  --muted: #7a6152;
  --radio: 16px;
  --sombra: 0 8px 24px rgba(62, 39, 35, 0.12);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--texto); background: var(--crema); line-height: 1.45; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--serif); color: var(--marron-2); line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; margin-top: 1.2em; }
a { color: var(--marron); }
code { background: var(--beige); padding: .1em .35em; border-radius: 6px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .break { word-break: break-all; }
.stack { display: grid; gap: 16px; }
.grid2 { display: grid; gap: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row input { flex: 1; min-width: 160px; }

/* ---- estructura */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 14px; background: var(--marron-2); color: var(--crema); box-shadow: var(--sombra); }
.topbar a { color: var(--crema); text-decoration: none; }
.topbar-brand { display: flex; }
.topbar-biz { font-family: var(--serif); color: var(--beige); font-size: .95rem; }
.topbar-nav { display: flex; gap: 4px; margin-left: auto; }
.topbar-nav a { padding: 8px 12px; border-radius: 999px; font-weight: 600; }
.topbar-nav a.on { background: var(--dorado); color: var(--marron-2); }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.topbar-user .link { color: var(--beige); }
.logo { display: flex; align-items: center; gap: 8px; }
.logo svg { background: var(--crema); border-radius: 50%; padding: 2px; }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; }
.logo-club { font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: var(--dorado); }
.demo-banner { background: var(--dorado); color: var(--marron-2); text-align: center; font-size: .8rem; padding: 6px 12px; }
.biz-switch { padding: 8px 14px; background: var(--beige); font-size: .9rem; }
.main { max-width: 1100px; margin: 0 auto; padding: 16px 14px 48px; }
.narrow { max-width: 460px; margin: 24px auto; padding: 0 14px; }

/* ---- controles */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 11px 16px; font: 600 .95rem var(--sans); cursor: pointer; text-decoration: none; min-height: 44px; transition: transform .05s, filter .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--marron); color: var(--crema-2); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn-secondary { background: var(--beige); color: var(--marron-2); }
.btn-ghost { background: transparent; color: var(--marron); border: 1.5px solid var(--beige-2); }
.btn-gold { background: linear-gradient(180deg, #d9b33a, var(--dorado)); color: var(--marron-2); }
.btn-big { width: 100%; min-height: 54px; font-size: 1.05rem; }
.link { background: none; border: 0; color: var(--marron); text-decoration: underline; cursor: pointer; font: inherit; padding: 4px; }
.link.danger { color: var(--error); }
.icon-btn { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--muted); padding: 6px; }
input, select { font: inherit; padding: 11px 12px; border: 1.5px solid var(--beige-2); border-radius: 12px; background: var(--crema-2); color: var(--texto); min-height: 44px; width: 100%; }
input:focus, select:focus, .btn:focus-visible, .result:focus-visible { outline: 3px solid rgba(201, 162, 39, .55); outline-offset: 1px; }
.field { display: grid; gap: 4px; }
.field-label { font-weight: 600; font-size: .9rem; color: var(--marron-2); }
.field-hint { font-size: .78rem; color: var(--muted); }
.form { display: grid; gap: 14px; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.switch input { width: 22px; min-height: 22px; accent-color: var(--marron); }
.card { background: var(--crema-2); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); border: 1px solid #efe3cf; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.aviso { background: #fff3cd; border-left: 4px solid var(--dorado); padding: 10px 12px; border-radius: 8px; font-size: .9rem; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--beige); color: var(--marron-2); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.badge-gold { background: var(--dorado); }
.badge-lg { font-size: 1.1rem; padding: 6px 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs a, .tabs button { padding: 9px 14px; border-radius: 999px; background: var(--beige); color: var(--marron-2); text-decoration: none; font-weight: 600; border: 0; cursor: pointer; white-space: nowrap; font: 600 .9rem var(--sans); }
.tabs .on { background: var(--marron); color: var(--crema); }
.tabs-scroll { overflow-x: auto; padding-bottom: 4px; }
.spinner { width: 16px; height: 16px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: girar .7s linear infinite; }
.loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 28px; color: var(--muted); }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---- avisos y modales */
.toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); display: grid; gap: 8px; width: min(94vw, 460px); pointer-events: none; }
.toast { padding: 12px 14px; border-radius: 12px; color: #fff; box-shadow: var(--sombra); font-weight: 600; font-size: .92rem; animation: entrar .2s ease-out; }
.toast-ok { background: var(--ok); } .toast-error { background: var(--error); } .toast-info { background: var(--marron); }
@keyframes entrar { from { opacity: 0; transform: translateY(-8px); } }
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(43, 26, 18, .55); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--crema-2); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 0 0 16px; outline: none; }
.modal-wide { max-width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; position: sticky; top: 0; background: var(--crema-2); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 4px 16px; display: grid; gap: 12px; }

/* ---- inicio */
.hero { text-align: center; padding: 18px 0 8px; }
.hero h1 { font-size: 2.2rem; margin-top: 8px; }
.hero p { max-width: 520px; margin: 0 auto; color: var(--muted); }
.modules { display: grid; gap: 14px; margin: 22px 0; }
.module-card { display: block; text-decoration: none; color: inherit; background: var(--crema-2); border-radius: var(--radio); padding: 18px; box-shadow: var(--sombra); border: 1px solid #efe3cf; transition: transform .1s; }
.module-card:hover { transform: translateY(-2px); }
.module-emoji { font-size: 1.8rem; }
.module-card h2 { margin: 6px 0 4px; }
.module-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.demo-users { display: grid; gap: 10px; }
.demo-user { text-align: left; display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--radio); border: 1.5px solid var(--beige-2); background: var(--crema-2); cursor: pointer; font: inherit; }
.demo-user:hover { border-color: var(--dorado); }
.demo-user span { color: var(--cafe); font-weight: 600; } .demo-user small { color: var(--muted); }

/* ---- sellos */
.stamps { display: grid; gap: 10px; margin: 14px auto; width: 100%; }
.stamps-md { max-width: 400px; }
.stamps-lg { max-width: 420px; }
.stamp { aspect-ratio: 1; border-radius: 50%; border: 2px dashed var(--beige-2); display: grid; place-items: center; color: var(--dorado-2); background: var(--crema); }
.stamp-num { color: var(--beige-2); font-weight: 700; font-family: var(--serif); }
.stamp-on { border: 2px solid var(--dorado); background: radial-gradient(circle at 35% 30%, #fff6d6, #f0d98a); color: var(--marron); animation: sellar .35s ease-out; }
.stamps-lg .stamp-on { box-shadow: 0 3px 8px rgba(168, 132, 26, .35); }
@keyframes sellar { from { transform: scale(.6); opacity: .3; } }
.progress { height: 10px; background: var(--beige); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--cafe), var(--dorado)); border-radius: 999px; transition: width .4s; }
.premio-linea { margin: 10px 0; }

/* ---- tarjeta del cliente */
.cliente { min-height: 100vh; background: radial-gradient(circle at top, #fff8ec, var(--crema) 45%, var(--beige) 100%); padding-bottom: 30px; }
.cliente-card { max-width: 440px; margin: 0 auto; padding: 22px 18px; }
.cliente-head { display: flex; gap: 14px; align-items: center; }
.cliente-head svg { background: var(--crema-2); border-radius: 50%; box-shadow: var(--sombra); padding: 4px; flex-shrink: 0; }
.cliente-negocio { margin: 0; font-family: var(--serif); color: var(--cafe); font-weight: 700; letter-spacing: .02em; }
.cliente-negocio span { font-family: var(--sans); font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: var(--dorado-2); }
.cliente-head h1 { margin: 2px 0 0; font-size: 1.6rem; }
.premio { margin: 18px 0 4px; padding: 14px 16px; border-radius: var(--radio); background: var(--marron-2); color: var(--crema); }
.premio p { margin: 2px 0; } .premio strong { color: #f3d77a; }
.premio-titulo { font-family: var(--serif); font-size: 1.25rem; color: #fff; }
.premio-listo { background: linear-gradient(135deg, #b8901f, var(--dorado)); color: var(--marron-2); }
.premio-listo .premio-titulo { color: var(--marron-2); }
.cliente-progreso { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-weight: 700; color: var(--marron); }
.cliente-qr { margin: 22px auto 8px; text-align: center; background: var(--crema-2); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); }
.cliente-qr p { margin: 8px 0 0; font-size: .88rem; color: var(--muted); }
.qr { display: block; margin: 0 auto; border-radius: 10px; }
.cliente-mov { margin-top: 18px; }
.cliente-mov ul, .movs { list-style: none; padding: 0; margin: 0; }
.cliente-mov li, .movs li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--beige); font-size: .92rem; }
.cliente-mov time, .movs time { color: var(--muted); white-space: nowrap; font-size: .82rem; }
.movs li span:nth-child(2) { color: var(--cafe); font-weight: 600; margin-left: auto; }
.cliente-pie { text-align: center; color: var(--muted); margin-top: 18px; }
.cliente-pie p { margin: 4px 0; }
.cliente-vacia { text-align: center; padding-top: 60px; }

/* ---- caja */
.caja { display: grid; gap: 16px; }
.caja-tarjeta { scroll-margin-top: 120px; }
.caja-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.caja-acciones .btn:last-child { grid-column: span 2; }
.search { font-size: 1.05rem; }
.results { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; max-height: 46vh; overflow: auto; }
.result { width: 100%; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n b" "m b"; text-align: left; gap: 0 10px;
  padding: 10px 12px; border-radius: 12px; border: 1.5px solid transparent; background: var(--crema-2); cursor: pointer; font: inherit; }
.result.on { border-color: var(--dorado); background: #fff7df; }
.result-name { grid-area: n; font-weight: 700; } .result-meta { grid-area: m; color: var(--muted); font-size: .85rem; } .result .badge { grid-area: b; align-self: center; }
.cardpanel { display: grid; gap: 10px; }
.cardpanel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cardpanel-head h2 { margin: 0; font-size: 1.35rem; } .cardpanel-head p { margin: 2px 0 0; font-size: .88rem; }
.compra { display: grid; gap: 10px; margin-top: 6px; }
.compra-campos { display: grid; grid-template-columns: 1fr; gap: 10px; }
.money { display: flex; align-items: center; border: 1.5px solid var(--beige-2); border-radius: 12px; background: var(--crema-2); padding-left: 12px; }
.money span { font-weight: 700; color: var(--cafe); }
.money input { border: 0; background: transparent; font-size: 1.15rem; font-weight: 700; }
.cardpanel-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.resultado { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; animation: entrar .2s ease-out; }
.resultado-sello { background: #e7f4ec; color: var(--ok); border: 1.5px solid #b9dcc7; }
.resultado-canje { background: #fff4d0; color: #6b5310; border: 1.5px solid var(--dorado); }
.resultado-error { background: #fbe9e7; color: var(--error); border: 1.5px solid #f1b8b2; }
.resultado span { color: var(--texto); font-size: .9rem; }
.compartir { display: grid; gap: 10px; justify-items: center; text-align: center; }
.scan { position: relative; border-radius: var(--radio); overflow: hidden; background: #000; aspect-ratio: 1; }
.scan video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid var(--dorado); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.nfc-wait { display: flex; align-items: center; gap: 12px; padding: 18px; background: var(--beige); border-radius: 12px; font-weight: 600; }
.pulse { width: 18px; height: 18px; border-radius: 50%; background: var(--dorado); animation: latir 1.2s ease-in-out infinite; }
@keyframes latir { 50% { transform: scale(1.5); opacity: .5; } }
.demo-box { border: 1.5px dashed var(--dorado); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }

/* ---- panel */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--crema-2); border-radius: var(--radio); padding: 14px; box-shadow: var(--sombra); display: grid; gap: 2px; border: 1px solid #efe3cf; }
.kpi-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-family: var(--serif); font-size: 1.6rem; color: var(--marron-2); }
.kpi-sub { font-size: .78rem; color: var(--cafe); }
.kpi-gold { background: linear-gradient(160deg, #fff7dc, #f3e2a8); border-color: #e8cf7d; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; height: 170px; align-items: end; }
.bar-col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; align-items: end; justify-items: center; }
.bar { width: 70%; min-height: 2px; background: linear-gradient(180deg, var(--dorado), var(--cafe)); border-radius: 6px 6px 2px 2px; align-self: end; }
.bar-n { font-size: .7rem; color: var(--cafe); font-weight: 700; }
.bar-l { font-size: .62rem; color: var(--muted); margin-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.filters select, .filters input { width: auto; flex: 1; min-width: 140px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 6px; border-bottom: 2px solid var(--beige); }
.table td { padding: 9px 6px; border-bottom: 1px solid var(--beige); vertical-align: middle; }
.table .num { text-align: right; white-space: nowrap; } .table .actions { white-space: nowrap; text-align: right; }
.team { list-style: none; padding: 0; margin: 0; }
.team li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--beige); flex-wrap: wrap; }
.team li > div:first-child { display: grid; }
.team-actions { display: flex; gap: 8px; align-items: center; }
.team-actions select { width: auto; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 10px; }
.dl dt { color: var(--muted); font-weight: 600; } .dl dd { margin: 0; }

@media (max-width: 479px) { .topbar-biz { display: none; } .topbar-user { width: 100%; justify-content: space-between; } }

/* ---- pantallas grandes */
@media (min-width: 720px) {
  .modules { grid-template-columns: repeat(3, 1fr); }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .caja { grid-template-columns: minmax(280px, 380px) 1fr; align-items: start; }
  .caja-buscar { position: sticky; top: 76px; }
  .compra-campos { grid-template-columns: 160px 1fr; }
  .modal-back { align-items: center; }
  .modal { border-radius: 20px; }
  h1 { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
