:root {
  --bg: #0b0c0e;
  --s1: #141619;
  --s2: #1c1f24;
  --s3: #262a31;
  --line: #2b3038;
  --text: #f2f3f5;
  --muted: #9aa2ad;
  --dim: #6b737e;
  --lime: #c8f53c;
  --lime-ink: #11140a;
  --red: #ff5a5f;
  --amber: #ffb547;
  --green: #3ddc84;
  --blue: #6aa8ff;
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --head: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
a { color: var(--lime); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--head); letter-spacing: .3px; margin: 0; font-weight: 700; }
h1 { font-size: 30px; line-height: 1.05; text-transform: uppercase; }
h2 { font-size: 21px; text-transform: uppercase; }
h3 { font-size: 17px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* layout */
.top { position: sticky; top: 0; z-index: 10; background: rgba(11,12,14,.92); backdrop-filter: blur(10px);
  padding: calc(var(--safe-t) + 12px) 16px 10px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.top .title { flex: 1; min-width: 0; }
.top .title small { display: block; color: var(--muted); font-size: 12px; font-family: var(--body); text-transform: none; letter-spacing: 0; }
.top h1 { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--s1);
  display: grid; place-items: center; cursor: pointer; flex: none; }
main { padding: 14px 16px calc(96px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.section-h { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 8px; }
.section-h h2 { font-size: 18px; color: var(--muted); }

/* cards */
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card.hero { background: linear-gradient(160deg, #1b2110 0%, var(--s1) 55%); border-color: #34401a; }
.card.alert { border-color: #5a2a2c; background: linear-gradient(160deg, #2a1416, var(--s1) 70%); }
.card.warn { border-color: #5a4520; background: linear-gradient(160deg, #2a2112, var(--s1) 70%); }
.stat { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stat .v { font-family: var(--head); font-size: 30px; font-weight: 700; line-height: 1; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat.lime .v { color: var(--lime); }
.stat.red .v { color: var(--red); }

/* list rows */
.list { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item.tap { cursor: pointer; }
.item.tap:active { background: var(--s2); }
.item .t { font-weight: 600; }
.item .s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--s3); display: grid; place-items: center;
  font-family: var(--head); font-weight: 700; color: var(--muted); flex: none; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* chips & badges */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--s1); border-radius: 999px; padding: 7px 13px;
  font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); font-weight: 600; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--s3); color: var(--muted); white-space: nowrap; }
.badge.red { background: #3a1719; color: #ff8b8f; }
.badge.amber { background: #3a2c13; color: var(--amber); }
.badge.green { background: #12301f; color: var(--green); }
.badge.lime { background: #2a3510; color: var(--lime); }
.badge.blue { background: #142640; color: var(--blue); }
.absent { font-family: var(--head); font-size: 22px; font-weight: 700; color: var(--red); text-align: right; line-height: 1; }
.absent small { display: block; font-size: 11px; color: var(--muted); font-family: var(--body); font-weight: 500; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--s2); border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
.btn.danger { background: #3a1719; border-color: #5a2a2c; color: #ffb3b5; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 6px 11px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* forms */
label.f { display: block; margin-top: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.in { width: 100%; background: var(--s2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; min-height: 46px; }
.in:focus { outline: 2px solid var(--lime); outline-offset: -1px; border-color: transparent; }
textarea.in { min-height: 80px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--lime); margin-top: 2px; flex: none; }
.seg { display: flex; background: var(--s2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--s3); color: var(--text); }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  background: rgba(16,17,20,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-b)); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--dim);
  font-size: 11.5px; font-weight: 600; padding: 4px 0; position: relative; }
.tabbar a.on { color: var(--lime); }
.tabbar svg { width: 24px; height: 24px; }
.tabbar .scan { margin-top: -26px; }
.tabbar .scan span.ring { width: 58px; height: 58px; border-radius: 18px; background: var(--lime); color: var(--lime-ink);
  display: grid; place-items: center; box-shadow: 0 6px 24px rgba(200,245,60,.25); }
.tabbar .dot { position: absolute; top: 0; right: calc(50% - 20px); background: var(--red); color: #fff; font-size: 10px;
  min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* sheet (bottom modal) */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--s1); border: 1px solid var(--line); border-bottom: 0; width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0; padding: 8px 16px calc(18px + var(--safe-b)); max-height: 92dvh; overflow-y: auto; animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 4px; background: var(--s3); border-radius: 2px; margin: 4px auto 12px; }
.sheet h2 { margin-bottom: 4px; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-weight: 600; z-index: 60;
  transition: .2s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--red); color: #fff; }

/* member home */
.mcard { position: relative; overflow: hidden; }
.mcard .plan { font-family: var(--head); font-size: 15px; text-transform: uppercase; color: var(--lime); letter-spacing: .8px; }
.mcard .exp { font-family: var(--head); font-size: 34px; font-weight: 800; line-height: 1.05; margin-top: 2px; }
.goal { display: flex; gap: 6px; margin-top: 10px; }
.goal i { flex: 1; height: 10px; border-radius: 5px; background: var(--s3); }
.goal i.on { background: var(--lime); }
.streak { display: flex; align-items: center; gap: 14px; }
.streak .flame { font-family: var(--head); font-size: 48px; font-weight: 800; line-height: 1; color: var(--amber); }
.bigcheck { width: 100%; min-height: 64px; font-size: 20px; font-family: var(--head); text-transform: uppercase; letter-spacing: .8px; }

/* plans */
.plan-opt { display: block; border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px; background: var(--s1); cursor: pointer; }
.plan-opt.on { border-color: var(--lime); background: #171c0d; }
.plan-opt .price { font-family: var(--head); font-size: 26px; font-weight: 700; }
.strike { text-decoration: line-through; color: var(--dim); font-size: 14px; }

/* scanner */
.scanner { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 3/4; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid var(--lime); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.45); }
.result { text-align: center; padding: 26px 10px; }
.result .icon { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; font-size: 42px; }
.result.ok .icon { background: #12301f; color: var(--green); }
.result.no .icon { background: #3a1719; color: var(--red); }

.progress { height: 8px; background: var(--s3); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--lime); }

/* login */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px calc(24px + var(--safe-b)); max-width: 440px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand img { width: 52px; height: 52px; border-radius: 14px; }
.brand h1 { font-size: 34px; }
.brand h1 em { font-style: normal; color: var(--lime); }

.receipt { background: #fff; color: #111; border-radius: 12px; padding: 20px; }
.receipt .muted { color: #666; }
.receipt table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.receipt td { padding: 7px 0; border-bottom: 1px solid #eee; }
.receipt td:last-child { text-align: right; font-weight: 600; }

table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
table.kv td:last-child { text-align: right; }

.fab { position: fixed; right: 18px; bottom: calc(86px + var(--safe-b)); z-index: 15; width: 56px; height: 56px; border-radius: 18px;
  background: var(--lime); color: var(--lime-ink); border: 0; display: grid; place-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.5); cursor: pointer; }

@media (min-width: 760px) {
  main { padding-top: 22px; }
  .grid4 { grid-template-columns: repeat(4, 1fr) !important; }
}
.grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media print {
  .top, .tabbar, .no-print, .fab { display: none !important; }
  body, main { background: #fff; padding: 0; }
}
.btn svg { width: 20px; height: 20px; flex: none; }
.bigcheck svg { width: 28px; height: 28px; }

/* plans */
.exrow { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; display: grid; gap: 6px; }
.exnums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.exnums label span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.exnums .in { padding: 9px 8px; min-height: 40px; text-align: center; }
.tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; font-weight: 800; }
.tick.on { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }

/* leaderboard */
.rank { width: 30px; text-align: center; font-size: 20px; flex: none; color: var(--muted); font-family: var(--head); font-weight: 700; }
.lbval { text-align: right; line-height: 1; }
.lbval b { font-family: var(--head); font-size: 26px; display: block; }
.lbval small { color: var(--muted); font-size: 11px; }
.meRow { background: #171c0d; }
