/* elMini Club — estilos compartidos (panel + app). Colores de marca vienen de --brand y --accent */
:root {
  --brand: #1E3A34;
  --accent: #9BE3B4;
  --bg: #F5F7F6;
  --surface: #FFFFFF;
  --surface-2: #EEF3F1;
  --line: #DCE4E1;
  --ink: #15201D;
  --ink-2: #4E5C58;
  --ink-3: #85928E;
  --pos: #23744F;
  --neg: #B03A2E;
  --warn: #9A6A00;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 35, 30, .05), 0 8px 24px rgba(20, 35, 30, .06);
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
.ic { flex: none; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--pos); margin-bottom: 6px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.hide { display: none !important; }

/* Tarjetas y métricas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.pad-0 { padding: 0; overflow: hidden; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; }
.stat .k { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.stat::after { content: ""; position: absolute; right: -24px; bottom: -24px; width: 70px; height: 70px; border-radius: 50%; background: var(--surface-2); }

/* Botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 14.5px; border-radius: 12px; padding: 11px 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .06s, background .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--brand); }
.btn.danger { color: var(--neg); }
.btn.block { width: 100%; }
.btn.lg { padding: 15px 20px; font-size: 16px; border-radius: 14px; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
label.lbl { display: block; font-weight: 700; font-size: 13px; margin: 0 0 6px; }
.field + .field { margin-top: 14px; }
.input, select.input, textarea.input { width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); outline: none; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
textarea.input { min-height: 90px; resize: vertical; }
.input.code { font-family: var(--mono); letter-spacing: .3em; text-align: center; font-size: 26px; font-weight: 700; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* Chips y etiquetas */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 13.5px; text-decoration: none; color: var(--ink-2); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: 7px; background: var(--surface-2); color: var(--ink-2); }
.tag.credit { background: #E3F4EA; color: var(--pos); }
.tag.redeem { background: #FBE9E6; color: var(--neg); }
.tag.adjust, .tag.reversal { background: #FFF4D6; color: var(--warn); }
.tag.role { background: #E6EEF9; color: #2B5597; }

/* Avisos */
.flash { padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: #E8F6EE; border-color: #BFE5CF; color: #1D5E40; }
.flash.error { background: #FDECEA; border-color: #F5C6C0; color: #8E2A1F; }
.empty { text-align: center; padding: 34px 20px; color: var(--ink-2); }

/* Tablas */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 800; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t a.rowlink { text-decoration: none; font-weight: 700; }
.who { display: flex; gap: 10px; align-items: center; }
.avatar { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--surface-2); color: var(--brand); flex: none; }
.avatar.lg { width: 56px; height: 56px; border-radius: 15px; font-size: 18px; background: var(--brand); color: var(--accent); }
.pager { display: flex; gap: 6px; justify-content: center; padding: 14px; }

/* ===== Panel ===== */
.panel { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--brand); color: #fff; padding: 22px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brandmark { display: flex; gap: 12px; align-items: center; padding: 4px 8px 22px; text-decoration: none; }
.brandmark img { width: 40px; height: 40px; border-radius: 11px; }
.brandmark b { display: block; font-size: 17px; color: var(--accent); letter-spacing: .02em; }
.brandmark span { font-size: 12px; opacity: .7; }
.nav a { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border-radius: 12px; text-decoration: none; font-weight: 600; color: rgba(255,255,255,.82); margin-bottom: 3px; }
.nav a:hover { background: rgba(255,255,255,.07); }
.nav a.on { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.side .me { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 16px 8px 0; font-size: 13px; }
.side .me b { display: block; font-size: 14px; }
.side .me span { opacity: .7; }
.main { padding: 22px 34px 60px; min-width: 0; }
.topbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 26px; flex-wrap: wrap; }
.crumbs { color: var(--ink-2); font-size: 14px; }
.storepick { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 14px; font-weight: 700; font-size: 14px; }
.storepick select { border: 0; font: inherit; font-weight: 700; background: transparent; padding: 6px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.pagehead p { margin-top: 6px; color: var(--ink-2); max-width: 720px; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 18px 0; }
.filters .input, .filters select { width: auto; min-width: 150px; font-size: 14px; padding: 9px 12px; }
.filters .grow .input { width: 100%; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 13px; }
.tabs a, .tabs button { flex: 1; white-space: nowrap; text-align: center; padding: 10px 14px; border-radius: 10px; font-weight: 700; text-decoration: none; color: var(--ink-2); border: 0; background: transparent; font: inherit; font-weight: 700; cursor: pointer; }
.tabs .on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tabs.brand .on { background: var(--brand); color: #fff; }
.cols { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; gap: 20px; align-items: start; }
.cols.even { grid-template-columns: 1fr 1fr; }
.scanner { background: #0F1A17; border-radius: var(--radius); min-height: 300px; color: #fff; display: grid; place-items: center; text-align: center; padding: 20px; position: relative; overflow: hidden; }
.scanner #reader { width: 100%; }
.scanner #reader video { border-radius: 12px; }
.balance-big { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.mini-list li:last-child { border-bottom: 0; }
.reward-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.reward-opt + .reward-opt { margin-top: 8px; }
.reward-opt.off { opacity: .45; cursor: not-allowed; }
.reward-opt input { accent-color: var(--brand); width: 18px; height: 18px; }
.chart { width: 100%; height: 180px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
details.box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
details.box summary { cursor: pointer; font-weight: 700; }
.mobile-nav-toggle { display: none; }

@media (max-width: 960px) {
  .panel { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .main { padding: 16px 16px 60px; }
  .mobile-nav-toggle { display: inline-flex; }
  .cols, .cols.even { grid-template-columns: 1fr; }
  .topbar .crumbs { display: none; }
}

/* ===== App del cliente ===== */
.app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding-bottom: 96px; }
.apphead { background: var(--brand); color: #fff; padding: 16px 18px; border-radius: 0 0 22px 22px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; padding-top: max(16px, env(safe-area-inset-top)); }
.apphead .brandmark { padding: 0; }
.apphead .brandmark img { width: 36px; height: 36px; }
.apphead .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.appbody { padding: 22px 18px; }
.appbody > * + * { margin-top: 16px; }
.memcard { background: var(--brand); color: #fff; border-radius: 22px; padding: 22px; position: relative; overflow: hidden; }
.memcard::before { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; border: 36px solid color-mix(in srgb, var(--accent) 12%, transparent); right: -110px; top: -120px; }
.memcard .lbl2 { font-size: 11.5px; letter-spacing: .16em; font-weight: 800; text-transform: uppercase; opacity: .75; }
.memcard .pts { font-size: 56px; font-weight: 800; color: var(--accent); letter-spacing: -.03em; line-height: 1; margin: 6px 0 4px; }
.progress { height: 8px; background: rgba(255,255,255,.14); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.progress.light { background: var(--surface-2); }
.progress.light > i { background: var(--brand); }
.qrcard { display: flex; gap: 16px; align-items: center; background: linear-gradient(135deg, #fff, var(--surface-2)); border: 1px solid var(--line); border-radius: 20px; padding: 14px; text-decoration: none; }
.qrbox { width: 112px; height: 112px; background: #fff; border-radius: 14px; padding: 8px; border: 1px solid var(--line); flex: none; }
.qrbox svg, .qrbox img { width: 100%; height: 100%; display: block; }
.wallet-btns { display: grid; gap: 10px; }
.wallet-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #000; color: #fff; border-radius: 12px; padding: 13px; font-weight: 700; text-decoration: none; font-size: 15px; }
.mov { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); gap: 12px; }
.mov:last-child { border-bottom: 0; }
.mov .amt { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.reward { display: flex; gap: 14px; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.reward:last-child { border-bottom: 0; }
.reward .cost { min-width: 64px; text-align: center; background: var(--surface-2); border-radius: 12px; padding: 8px 6px; font-weight: 800; }
.reward .cost small { display: block; font-size: 10px; letter-spacing: .1em; color: var(--ink-3); }
.reward.ok .cost { background: var(--accent); color: var(--brand); }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.tabbar nav { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 520px; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 12px; text-decoration: none; color: var(--ink-3); font-size: 12px; font-weight: 700; }
.tabbar a.on { color: var(--brand); }
.banner { display: flex; gap: 12px; align-items: center; background: color-mix(in srgb, var(--accent) 28%, #fff); border-radius: 16px; padding: 14px 16px; }

/* ===== Auth ===== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 30%, transparent), transparent), var(--bg); }
.authbox { width: 100%; max-width: 420px; }
.authbox .brandmark { justify-content: center; padding-bottom: 22px; }
.authbox .brandmark b { color: var(--brand); font-size: 20px; }
.authbox .brandmark span { color: var(--ink-2); opacity: 1; }

/* QR pantalla completa */
.qrfull { min-height: 100vh; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.qrfull .qrbig { width: min(80vw, 360px); aspect-ratio: 1; }
.qrfull .qrbig svg { width: 100%; height: 100%; }

@media print { .side, .topbar, .tabbar { display: none; } }
