/* NIAM Rewards — página del cliente y del personal. Misma paleta que el menú público (claro / oscuro del dispositivo). */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
:root {
  --orange: #FF7A00;
  --orange-dark: #E86600;
  --page: #F4F1EC;
  --bg: #FFFFFF;
  --soft: #E5E1DB;
  --muted: #77716A;
  --dark: #333333;
  --text: #111111;
  --line: rgba(0, 0, 0, .1);
  --ok: #1E9E48;
  --warn: #B27600;
  --danger: #D13B3B;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 28px rgba(0,0,0,.07);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #000000;
    --bg: #090909;
    --soft: #232323;
    --muted: #A8A29B;
    --dark: #D0D0D0;
    --text: #F2F2F2;
    --line: rgba(255, 255, 255, .12);
    --ok: #34C759;
    --warn: #FFB300;
    --danger: #FF6B6B;
    --shadow: none;
  }
  .niam-logo path[fill="#181817"] { fill: #F2F2F2; }
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--orange-dark); }
h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.4px; line-height: 1.2; }
h2 { font-size: 1.02rem; font-weight: 800; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: .92rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.error { color: var(--danger); font-size: .88rem; font-weight: 600; margin: 8px 0; }

/* Barra superior */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: block; line-height: 0; }
.niam-logo { height: 24px; width: auto; }
.tabs { display: flex; gap: 4px; margin-left: auto; background: var(--soft); border-radius: 12px; padding: 3px; }
.tab { border: 0; background: transparent; border-radius: 9px; padding: 7px 13px; font-weight: 700; font-size: .86rem; color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
#logout { margin-left: auto; }
.tabs:not([hidden]) ~ #logout { margin-left: 0; }

main { max-width: 520px; margin: 0 auto; padding: 18px 16px 48px; display: flex; flex-direction: column; gap: 14px; }
.center { min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--soft); border-top-color: var(--orange); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 18px; }
.card.narrow { display: flex; flex-direction: column; gap: 12px; }
.eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--orange-dark); }
.lead { font-size: 1rem; color: var(--dark); margin-top: 6px; }
.notice { background: rgba(255,179,0,.14); border: 1px solid rgba(178,118,0,.35); border-radius: 14px; padding: 12px 14px; font-size: .88rem; }
.notice .link-btn { display: block; margin-top: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 20px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); font-weight: 700; font-size: .96rem; cursor: pointer; text-decoration: none; color: var(--text); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.google { width: 100%; }
.big-btn { min-height: 62px; font-size: 1.08rem; border-radius: 18px; }
.link-btn { background: none; border: 0; color: var(--orange-dark); font-weight: 700; font-size: .9rem; cursor: pointer; padding: 6px 0; }
.link-btn.danger { color: var(--danger); }

.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.field > span { font-size: .8rem; font-weight: 700; color: var(--dark); }
input[type=text], input[type=email], input[type=password], input[type=search] { width: 100%; min-height: 46px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 1rem; }
input:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .84rem; color: var(--dark); margin: 4px 0 6px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--orange); flex: none; }

/* Bienvenida */
.hero { text-align: left; }
.rest-logo { width: 56px; height: 56px; border-radius: 16px; overflow: hidden; background: var(--soft); flex: none; margin-bottom: 10px; }
.rest-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.how { list-style: none; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: .92rem; }
.how li { display: flex; gap: 10px; align-items: center; }
.how span { width: 24px; height: 24px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 800; font-size: .78rem; display: grid; place-items: center; flex: none; }

/* Tarjeta de visitas */
.rest-head { display: flex; align-items: center; gap: 12px; }
.rest-head .rest-logo { margin-bottom: 0; }
.stamp { text-align: center; padding: 22px 18px; background: linear-gradient(160deg, rgba(255,122,0,.12), transparent 60%), var(--bg); }
.hello { font-weight: 700; }
.month { color: var(--muted); font-size: .9rem; }
.big { margin: 6px 0 10px; line-height: 1; }
.big b { font-size: 4.2rem; font-weight: 900; letter-spacing: -2px; color: var(--orange); }
.big span { font-size: 1.6rem; font-weight: 800; color: var(--muted); }
.big i { font-style: normal; }
.meter { margin: 8px auto 12px; }
.meter.dots { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 330px; }
.meter.dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--soft); background: transparent; transition: background .3s, border-color .3s, transform .3s; }
.meter.dots i.on { background: var(--orange); border-color: var(--orange); transform: scale(1.04); }
.meter.bar { height: 14px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.meter.bar i { display: block; height: 100%; background: var(--orange); border-radius: 999px; transition: width .4s; }
.remaining { font-weight: 700; font-size: .98rem; }
.grants { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.grants li { display: flex; align-items: center; gap: 12px; border: 1.5px dashed var(--orange); border-radius: 14px; padding: 12px 14px; background: rgba(255,122,0,.07); }
.grants li b { display: block; }
.grants li small { color: var(--muted); }
.grants .gift { font-size: 1.6rem; line-height: 1; }
.qr-card { text-align: center; }
.qr-box { background: #fff; border-radius: 18px; padding: 12px; border: 1px solid var(--line); line-height: 0; width: min(280px, 100%); margin: 12px auto 8px; }
.qr-box canvas { width: 100%; height: auto; image-rendering: pixelated; }
.who { font-weight: 700; }
.foot-links { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; padding: 0 4px; }

/* Personal */
.results, .recent { list-style: none; display: flex; flex-direction: column; margin-top: 6px; }
.results li, .recent li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.results li:last-child, .recent li:last-child { border-bottom: 0; }
.results button { all: unset; cursor: pointer; display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; }
.results small, .recent small { display: block; color: var(--muted); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--soft); color: var(--dark); white-space: nowrap; }
.pill.ok { background: rgba(30,158,72,.15); color: var(--ok); }

/* Escáner */
.scanner { position: fixed; inset: 0; z-index: 60; background: #000; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-ui { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(18px + env(safe-area-inset-top)) 18px calc(26px + env(safe-area-inset-bottom)); pointer-events: none; }
.scan-ui .btn { pointer-events: auto; align-self: flex-end; background: rgba(0,0,0,.55); color: #fff; border-color: rgba(255,255,255,.4); }
.reticle { position: relative; width: min(66vw, 280px); aspect-ratio: 1; }
.reticle i { position: absolute; width: 38px; height: 38px; border: 4px solid #fff; border-radius: 6px; }
.reticle i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.reticle i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.reticle i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.reticle i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.scan-msg { background: rgba(0,0,0,.6); color: #fff; padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: .92rem; text-align: center; max-width: 92%; }

/* Hoja de confirmación */
.sheet-bd { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(520px, 100%); background: var(--bg); border-radius: 24px 24px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { font-size: 1.25rem; font-weight: 800; }
.sheet .sub { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.sheet .prog { display: flex; align-items: baseline; gap: 6px; margin: 12px 0 4px; }
.sheet .prog b { font-size: 2.6rem; font-weight: 900; color: var(--orange); line-height: 1; }
.sheet .prog span { color: var(--muted); font-weight: 700; }
.sheet .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.sheet .blocked { background: rgba(255,179,0,.14); border: 1px solid rgba(178,118,0,.35); border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: .9rem; margin-top: 10px; }
.sheet .win { background: rgba(30,158,72,.14); border: 1px solid rgba(30,158,72,.4); border-radius: 14px; padding: 12px; font-weight: 700; margin-top: 10px; }
.sheet .success { text-align: center; padding: 10px 0 4px; }
.sheet .success .tick { width: 70px; height: 70px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 2.2rem; margin: 0 auto 10px; }
.gift-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1.5px dashed var(--orange); border-radius: 14px; padding: 10px 12px; margin-top: 10px; background: rgba(255,122,0,.07); }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #111; color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; z-index: 100; max-width: 92%; text-align: center; }
.toast.err { background: var(--danger); }

/* Íconos de línea (reemplazan a los emojis): toman el color del texto */
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.grants .gift .ico { width: 1.6rem; height: 1.6rem; color: var(--orange); }
.success .tick .ico, .verdict .mark .ico { width: 1em; height: 1em; stroke-width: 2.2; vertical-align: 0; }
