/* =====================================================================
   EcoScan — design system (pure CSS)
   ===================================================================== */

:root {
  --ink: #0E2A1E;
  --forest: #1F5F3F;
  --forest-2: #174A31;
  --forest-3: #113826;
  --leaf: #4CAF50;
  --lime: #B6E388;
  --mint: #E4F1E3;
  --cream: #F6F4EC;
  --cream-2: #EEEADC;
  --paper: #FFFFFF;
  --gold: #D9B26A;

  --text: #13261C;
  --muted: #5D6B62;
  --muted-2: #8C978F;
  --line: rgba(14, 42, 30, .10);
  --line-2: rgba(14, 42, 30, .06);
  --line-dark: rgba(246, 244, 236, .12);

  --ok: #2B7A4B;     --ok-bg: #E5F2E8;
  --warn: #9A6412;   --warn-bg: #FAF0DC;
  --error: #B9402F;  --error-bg: #FBEAE6;

  --r-xs: 10px; --r-sm: 14px; --r: 22px; --r-lg: 30px; --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(14, 42, 30, .06);
  --shadow-sm: 0 1px 2px rgba(14, 42, 30, .05), 0 4px 12px -4px rgba(14, 42, 30, .08);
  --shadow: 0 1px 2px rgba(14, 42, 30, .04), 0 12px 28px -10px rgba(14, 42, 30, .14), 0 32px 64px -32px rgba(14, 42, 30, .18);
  --shadow-lg: 0 2px 6px rgba(14, 42, 30, .05), 0 30px 80px -20px rgba(14, 42, 30, .35);
  --inner-hi: inset 0 1px 0 rgba(255, 255, 255, .7);

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}
/* ambient light + film grain */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 85% -10%, rgba(182, 227, 136, .28), transparent 60%),
    radial-gradient(50vw 50vh at -10% 30%, rgba(31, 95, 63, .10), transparent 60%),
    radial-gradient(40vw 40vh at 60% 110%, rgba(217, 178, 106, .14), transparent 60%),
    var(--cream);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background-image: var(--grain);
  opacity: .055;
  mix-blend-mode: multiply;
}
img, svg, canvas, video { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88em; }
:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--lime); color: var(--ink); }
[hidden] { display: none !important; }

.icon { width: 20px; height: 20px; flex: none; }
.container { width: min(1200px, 100% - 48px); margin-inline: auto; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Type ---------- */
.display {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 400;
  font-variation-settings: "opsz" 48;
  letter-spacing: -.035em;
  line-height: .98;
  margin: 0;
}
.display em { font-style: italic; font-weight: 300; color: var(--forest); }
.h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 3vw, 40px);
  letter-spacing: -.025em;
  line-height: 1.05;
  margin: 0;
}
.h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; letter-spacing: -.015em; line-height: 1.15; margin: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--forest);
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 4px rgba(76, 175, 80, .18); }
.lead { font-size: clamp(16px, 1.4vw, 18px); color: var(--muted); line-height: 1.6; max-width: 34em; margin: 0; }
.num {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -.03em;
  font-weight: 400;
}

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.02em; font-size: 17px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  color: var(--lime);
  background: linear-gradient(155deg, var(--forest) 0%, var(--ink) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 6px 14px -6px rgba(14, 42, 30, .6);
}
.brand-mark .icon { width: 19px; height: 19px; stroke-width: 2; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .02em; margin-top: -2px; }
.on-dark .brand small, .brand.on-dark small { color: rgba(246, 244, 236, .55); }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--paper); --fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 46px; padding: 0 20px;
  border-radius: var(--r-pill);
  background: var(--bg); color: var(--fg);
  font-weight: 600; font-size: 14.5px; letter-spacing: -.005em;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs), var(--inner-hi);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .2s, opacity .2s;
  white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm), var(--inner-hi); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary {
  --fg: var(--cream);
  background: linear-gradient(180deg, #24704A 0%, var(--forest) 45%, var(--forest-2) 100%);
  border-color: rgba(14, 42, 30, .6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -1px 0 rgba(0, 0, 0, .2), 0 8px 20px -8px rgba(31, 95, 63, .7);
}
.btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -1px 0 rgba(0, 0, 0, .2), 0 14px 28px -10px rgba(31, 95, 63, .75); }
.btn-lime {
  --fg: var(--ink);
  background: linear-gradient(180deg, #CBEFA4, var(--lime));
  border-color: rgba(14, 42, 30, .2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 10px 24px -10px rgba(182, 227, 136, .9);
}
.btn-ghost { --bg: transparent; box-shadow: none; }
.btn-ghost:hover { --bg: rgba(14, 42, 30, .05); box-shadow: none; }
.btn-glass {
  --fg: var(--cream);
  background: rgba(246, 244, 236, .08);
  border-color: var(--line-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
}
.btn-glass:hover { background: rgba(246, 244, 236, .14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-lg { height: 56px; padding: 0 26px; font-size: 16px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-grid; place-items: center;
  color: var(--muted); border: 1px solid var(--line); background: var(--paper);
  box-shadow: var(--shadow-xs);
  transition: color .2s, transform .2s var(--ease), background .2s;
}
.icon-btn:hover { color: var(--ink); transform: translateY(-1px); }
.icon-btn .icon { width: 18px; height: 18px; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading > * { opacity: 0; }
.btn.is-loading { position: relative; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}

/* ---------- Surfaces ---------- */
.card {
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  position: relative;
}
.card-pad { padding: clamp(20px, 2.4vw, 30px); }
.card-dark, .on-dark, .role-card.on-dark, .kpi.on-dark {
  color: var(--cream);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(182, 227, 136, .16), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(76, 175, 80, .14), transparent 60%),
    linear-gradient(160deg, var(--forest-2) 0%, var(--ink) 75%);
  border: 1px solid rgba(14, 42, 30, .8);
  position: relative; isolation: isolate; overflow: hidden;
}
.card-dark::after, .on-dark::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--grain); opacity: .12; mix-blend-mode: overlay;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.card-title { font-weight: 650; font-size: 15px; letter-spacing: -.01em; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-title .icon { width: 18px; height: 18px; color: var(--forest); }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600;
  background: var(--mint); color: var(--forest);
  border: 1px solid rgba(31, 95, 63, .12);
}
.chip .icon { width: 14px; height: 14px; }
.chip-dark { background: rgba(246, 244, 236, .08); color: var(--cream); border-color: var(--line-dark); }
.chip-lime { background: var(--lime); color: var(--ink); border-color: transparent; }

.status {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 14px 8px 12px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 600;
  background: rgba(246, 244, 236, .08); border: 1px solid var(--line-dark);
}
.status .pulse-dot { background: var(--gold); }
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); flex: none;
  box-shadow: 0 0 0 0 currentColor; position: relative;
}
.pulse-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: inherit; animation: ping 1.8s var(--ease) infinite;
}

/* ---------- Form fields ---------- */
.field { display: grid; gap: 7px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.input {
  height: 52px; width: 100%; padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--paper);
  box-shadow: var(--shadow-xs), inset 0 1px 2px rgba(14, 42, 30, .04);
  font-size: 16px; transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.input::placeholder { color: var(--muted-2); }
.input:focus { outline: 0; border-color: var(--forest); box-shadow: 0 0 0 4px rgba(76, 175, 80, .16); }
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235D6B62' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
  padding-right: 42px;
}

/* =====================================================================
   LANDING
   ===================================================================== */
.nav { display: flex; align-items: center; justify-content: space-between; height: 84px; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a:not(.btn) { padding: 8px 14px; border-radius: var(--r-pill); font-size: 14px; font-weight: 500; color: var(--muted); transition: color .2s, background .2s; }
.nav-links a:not(.btn):hover { color: var(--ink); background: rgba(14, 42, 30, .05); }

.hero {
  display: grid; grid-template-columns: 1.05fr .95fr; align-items: center;
  gap: clamp(32px, 5vw, 80px);
  padding: clamp(24px, 5vw, 64px) 0 clamp(56px, 8vw, 112px);
}
.hero .display { font-size: clamp(52px, 8.2vw, 116px); margin: 22px 0 24px; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 38px; max-width: 580px; }
.role-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px; border-radius: var(--r);
  background: rgba(255, 255, 255, .8); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  position: relative; overflow: hidden; isolation: isolate;
}
.role-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.role-card .role-icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--mint); color: var(--forest);
}
.role-card .role-icon .icon { width: 22px; height: 22px; }
.role-card b { font-size: 17px; letter-spacing: -.015em; font-weight: 650; display: block; }
.role-card span.desc { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.role-card .role-arrow {
  position: absolute; top: 22px; right: 22px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--line);
  transition: transform .35s var(--ease), background .3s, color .3s;
}
.role-card .role-arrow .icon { width: 16px; height: 16px; }
.role-card:hover .role-arrow { transform: rotate(-45deg); background: var(--ink); color: var(--cream); border-color: transparent; }
.role-card.on-dark { box-shadow: var(--shadow); }
.role-card.on-dark .role-icon { background: rgba(182, 227, 136, .14); color: var(--lime); }
.role-card.on-dark span.desc { color: rgba(246, 244, 236, .65); }
.role-card.on-dark .role-arrow { border-color: var(--line-dark); }
.role-card.on-dark:hover .role-arrow { background: var(--lime); color: var(--ink); }

.hero-stats { display: flex; gap: clamp(20px, 4vw, 44px); margin: 40px 0 0; padding: 0; list-style: none; }
.hero-stats li { display: grid; gap: 2px; }
.hero-stats .num { font-size: 32px; line-height: 1; color: var(--ink); }
.hero-stats span { font-size: 12.5px; color: var(--muted); }

/* hero art: device + floating cards */
.hero-art { position: relative; min-height: 600px; display: grid; place-items: center; }
.hero-art .orb {
  position: absolute; width: 78%; aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(182, 227, 136, .9), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(31, 95, 63, .55), transparent 60%);
  filter: blur(40px); opacity: .55;
  animation: float 12s ease-in-out infinite;
}
.hero-art .rings {
  position: absolute; width: 92%; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgba(14, 42, 30, .08);
  box-shadow: 0 0 0 60px rgba(255, 255, 255, .0), inset 0 0 0 60px rgba(255, 255, 255, .12);
}
.hero-art .rings::before, .hero-art .rings::after {
  content: ""; position: absolute; inset: 13%; border-radius: 50%; border: 1px dashed rgba(14, 42, 30, .1);
}
.hero-art .rings::after { inset: 28%; border-style: solid; }
.device {
  position: relative; z-index: 2;
  width: 290px; aspect-ratio: 9 / 18.6;
  border-radius: 46px; padding: 11px;
  background: linear-gradient(150deg, #2A3A31, #0B1A12 60%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, .12),
    inset 0 2px 1px rgba(255, 255, 255, .18),
    0 50px 100px -30px rgba(14, 42, 30, .55),
    0 30px 60px -30px rgba(14, 42, 30, .5);
  transform: rotate(-4deg);
  animation: device-in 1.1s var(--ease) both;
}
.device-screen {
  height: 100%; border-radius: 36px; overflow: hidden;
  background: var(--cream); position: relative;
  display: flex; flex-direction: column;
}
.device-notch { position: absolute; top: 10px; left: 50%; translate: -50% 0; width: 88px; height: 26px; border-radius: 20px; background: #0B1A12; z-index: 3; }
.mini-top { padding: 48px 18px 0; }
.mini-top small { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.mini-top .num { font-size: 40px; line-height: 1; margin-top: 4px; }
.mini-top .num sup { font-family: var(--sans); font-size: 12px; color: var(--muted); letter-spacing: 0; margin-left: 4px; vertical-align: 18px; }
.mini-card {
  margin: 16px 14px 0; border-radius: 20px; padding: 16px;
  display: grid; justify-items: center; gap: 10px;
}
.mini-card .mini-qr { width: 150px; height: 150px; padding: 10px; background: #fff; border-radius: 14px; }
.mini-card .mini-qr img, .mini-card .mini-qr canvas { width: 100% !important; height: 100% !important; }
.mini-card .mini-row { display: flex; justify-content: space-between; width: 100%; font-size: 11px; color: rgba(246, 244, 236, .7); }
.mini-card .mini-row b { color: var(--lime); font-variant-numeric: tabular-nums; }
.mini-tabs { margin-top: auto; display: flex; justify-content: space-around; padding: 12px 10px 18px; border-top: 1px solid var(--line); color: var(--muted-2); }
.mini-tabs .icon { width: 18px; height: 18px; }
.mini-tabs .on { color: var(--forest); }

.float-card {
  position: absolute; z-index: 3;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 12px 12px; border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  font-size: 13px;
}
.float-card b { display: block; font-size: 14px; letter-spacing: -.01em; }
.float-card span { color: var(--muted); font-size: 12px; }
.float-card .fc-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--mint); color: var(--forest); font-size: 18px; }
.float-card .fc-icon.dark { background: var(--ink); color: var(--lime); }
.fc-1 { top: 16%; left: -2%; animation: float 7s ease-in-out infinite, pop-in .8s .5s var(--spring) both; }
.fc-2 { bottom: 18%; right: -4%; animation: float 8s ease-in-out -2s infinite, pop-in .8s .7s var(--spring) both; }
.fc-3 { bottom: 6%; left: 6%; animation: float 9s ease-in-out -4s infinite, pop-in .8s .9s var(--spring) both; }

.section { padding: clamp(56px, 8vw, 110px) 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 40px; flex-wrap: wrap; }
.section-head .h2 { margin-top: 12px; font-size: clamp(32px, 4.4vw, 56px); max-width: 14em; }
.section-head p { max-width: 26em; margin: 0; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; list-style: none; padding: 0; margin: 0; }
.step { padding: 28px; border-radius: var(--r); background: rgba(255, 255, 255, .7); border: 1px solid var(--line); box-shadow: var(--shadow-sm); min-height: 240px; display: flex; flex-direction: column; }
.step .step-num { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--muted-2); }
.step .step-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--ink); color: var(--lime); margin: 26px 0 20px; }
.step .step-icon .icon { width: 24px; height: 24px; }
.step h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.015em; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; }

.security { border-radius: var(--r-lg); padding: clamp(32px, 5vw, 64px); display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(32px, 5vw, 72px); box-shadow: var(--shadow-lg); }
.security .eyebrow { color: var(--lime); }
.security .h2 { margin: 14px 0 16px; font-size: clamp(32px, 4vw, 52px); }
.security .h2 em { color: var(--lime); font-style: italic; font-weight: 300; }
.security p { color: rgba(246, 244, 236, .7); margin: 0; }
.payload { margin-top: 28px; padding: 16px 18px; border-radius: var(--r-sm); background: rgba(0, 0, 0, .22); border: 1px solid var(--line-dark); font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: rgba(246, 244, 236, .8); overflow-wrap: anywhere; }
.payload b { color: var(--lime); font-weight: 600; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-dark); border-radius: var(--r); overflow: hidden; border: 1px solid var(--line-dark); }
.feature { padding: 24px; background: rgba(14, 42, 30, .55); }
.feature .icon { width: 22px; height: 22px; color: var(--lime); }
.feature h4 { margin: 16px 0 6px; font-size: 15.5px; letter-spacing: -.01em; }
.feature p { font-size: 13.5px; line-height: 1.5; }

.footer { padding: 32px 0 48px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

/* =====================================================================
   ADMIN
   ===================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  height: 76px; padding: 0 clamp(16px, 3vw, 32px);
  background: rgba(246, 244, 236, .72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.topbar-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 12px; height: 34px; border-radius: var(--r-pill); border: 1px solid var(--line); background: rgba(255, 255, 255, .6); }
.live .pulse-dot { color: var(--leaf); }

.seg {
  display: inline-flex; padding: 4px; gap: 2px;
  border-radius: var(--r-pill);
  background: rgba(14, 42, 30, .06);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 2px rgba(14, 42, 30, .06);
}
.seg button {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 18px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 600; color: var(--muted);
  transition: color .2s, background .25s var(--ease), box-shadow .25s var(--ease);
}
.seg button .icon { width: 17px; height: 17px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm), var(--inner-hi); }

.admin-main { padding: clamp(20px, 3vw, 36px) clamp(16px, 3vw, 32px) 64px; max-width: 1360px; margin: 0 auto; }
.tab-panel { animation: rise .5s var(--ease) both; }
.page-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title .h2 { margin-top: 8px; }
.page-title p { margin: 6px 0 0; color: var(--muted); }

.claim-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: stretch; }

/* material rows */
.materials { display: grid; gap: 10px; }
.mat {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 12px 12px 12px 14px; border-radius: var(--r-sm);
  background: var(--paper); border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  transition: border-color .25s, box-shadow .25s, transform .25s var(--ease);
}
.mat.has-qty { border-color: rgba(31, 95, 63, .35); box-shadow: 0 0 0 3px rgba(76, 175, 80, .10), var(--shadow-xs); }
.mat-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--cream); color: var(--forest); border: 1px solid var(--line-2); }
.mat.has-qty .mat-icon { background: var(--ink); color: var(--lime); border-color: transparent; }
.mat-icon .icon { width: 23px; height: 23px; }
.mat-name { font-weight: 600; letter-spacing: -.01em; font-size: 15px; line-height: 1.25; }
.mat-meta { font-size: 12.5px; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--cream); border: 1px solid var(--line-2); }
.stepper button {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
  transition: transform .15s var(--ease), background .2s, color .2s;
}
.stepper button:hover { background: var(--ink); color: var(--cream); }
.stepper button:active { transform: scale(.9); }
.stepper button .icon { width: 16px; height: 16px; stroke-width: 2.2; }
.stepper input {
  width: 46px; text-align: center; border: 0; background: transparent;
  font-family: var(--serif); font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: 0; }

.claim-summary {
  display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1px;
  margin: 20px 0; border-radius: var(--r-sm); overflow: hidden;
  background: var(--line); border: 1px solid var(--line);
}
.claim-summary > div { background: rgba(255, 255, 255, .9); padding: 14px 16px; }
.claim-summary small { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); }
.claim-summary .num { font-size: 34px; line-height: 1.1; color: var(--ink); }
.claim-summary .num.sm { font-size: 26px; }
.claim-summary .num small { display: inline; font-family: var(--sans); font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 500; margin-left: 4px; }

/* station display */
.station { border-radius: var(--r-lg); min-height: 620px; padding: clamp(22px, 3vw, 34px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.station > .state { display: none; flex: 1; flex-direction: column; }
.station[data-state="idle"] .state-idle,
.station:not([data-state="idle"]) .state-active { display: flex; animation: rise .5s var(--ease) both; }
.station-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.station-head .eyebrow { color: var(--lime); }
.state-idle { align-items: center; justify-content: center; text-align: center; gap: 18px; }
.ghost-qr {
  width: 200px; height: 200px; border-radius: 28px; position: relative;
  display: grid; place-items: center; color: rgba(246, 244, 236, .25);
  border: 1.5px dashed rgba(246, 244, 236, .2);
  background: repeating-linear-gradient(135deg, rgba(246, 244, 236, .03) 0 10px, transparent 10px 20px);
}
.ghost-qr .icon { width: 72px; height: 72px; stroke-width: 1.1; }
.state-idle h3 { font-family: var(--serif); font-weight: 400; font-size: 32px; letter-spacing: -.02em; margin: 8px 0 0; }
.state-idle p { color: rgba(246, 244, 236, .6); margin: 0; max-width: 26em; }

.qr-stage { flex: 1; display: grid; place-items: center; padding: 22px 0; }
.qr-frame {
  position: relative; padding: 18px; border-radius: 28px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .5), 0 0 0 10px rgba(246, 244, 236, .06), 0 30px 70px -20px rgba(0, 0, 0, .6);
  animation: qr-in .7s var(--spring) both;
}
.qr-frame .qr { width: clamp(240px, 26vw, 320px); aspect-ratio: 1; }
.qr-frame .qr img, .qr-frame .qr canvas { width: 100% !important; height: 100% !important; image-rendering: pixelated; }
.qr-frame::before, .qr-frame::after { /* corner ticks */
  content: ""; position: absolute; width: 34px; height: 34px; border: 3px solid var(--lime);
}
.qr-frame::before { top: -10px; left: -10px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.qr-frame::after { bottom: -10px; right: -10px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.qr-overlay {
  position: absolute; inset: 0; border-radius: 28px;
  display: grid; place-items: center; align-content: center; gap: 10px; text-align: center;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(6px);
  color: var(--ink); opacity: 0; visibility: hidden; transition: opacity .4s var(--ease);
}
.qr-overlay .seal { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--forest); box-shadow: 0 0 0 10px rgba(76, 175, 80, .18); }
.qr-overlay .seal .icon { width: 42px; height: 42px; stroke-width: 2.4; }
.qr-overlay b { font-size: 18px; letter-spacing: -.01em; }
.station[data-state="claimed"] .qr-overlay.ov-claimed,
.station[data-state="expired"] .qr-overlay.ov-expired { opacity: 1; visibility: visible; }
.station[data-state="claimed"] .seal { animation: seal .7s var(--spring) both; }
.qr-overlay.ov-expired .seal { background: var(--muted); box-shadow: 0 0 0 10px rgba(93, 107, 98, .15); }

.station-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.countdown { display: flex; align-items: center; gap: 14px; }
.ring {
  --p: 1;
  width: 54px; height: 54px; border-radius: 50%;
  background: conic-gradient(var(--lime) calc(var(--p) * 360deg), rgba(246, 244, 236, .1) 0);
  -webkit-mask: radial-gradient(circle, transparent 21px, #000 22px);
          mask: radial-gradient(circle, transparent 21px, #000 22px);
  transition: --p 1s linear;
}
.countdown.low .ring { background: conic-gradient(#F2A65A calc(var(--p) * 360deg), rgba(246, 244, 236, .1) 0); }
.countdown .num { font-size: 34px; line-height: 1; }
.countdown small { display: block; font-size: 11.5px; color: rgba(246, 244, 236, .55); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; margin-top: 4px; }
.station[data-state="claimed"] .countdown, .station[data-state="expired"] .countdown { opacity: .35; }
.status-claimed { color: var(--lime); }
.station[data-state="claimed"] .status { background: rgba(182, 227, 136, .14); border-color: rgba(182, 227, 136, .4); color: var(--lime); }
.station[data-state="claimed"] .status .pulse-dot { background: var(--lime); }
.station[data-state="claimed"] .status .pulse-dot::after,
.station[data-state="expired"] .status .pulse-dot::after { display: none; }
.station[data-state="expired"] .status .pulse-dot { background: #F2A65A; }
.code-line { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-dark); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: rgba(246, 244, 236, .5); }
.code-line code { color: rgba(246, 244, 236, .8); letter-spacing: .02em; }
.station-actions { display: flex; gap: 8px; }

/* scanner */
.scan-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 20px; align-items: start; }
.viewport {
  position: relative; overflow: hidden; isolation: isolate;
  aspect-ratio: 4 / 3; border-radius: var(--r);
  background: radial-gradient(circle at 50% 40%, #1D3B2B, #07150E 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), var(--shadow);
}
.viewport.square { aspect-ratio: 1; }
.viewport > div[id] { position: absolute !important; inset: 0; border: 0 !important; }
.viewport video { width: 100% !important; height: 100% !important; object-fit: cover; }
.viewport #qr-shaded-region { display: none; }
.viewport-frame { position: absolute; inset: 14%; z-index: 2; pointer-events: none; }
.viewport.square .viewport-frame { inset: 16%; }
.viewport-frame i { position: absolute; width: 38px; height: 38px; border: 3px solid var(--lime); filter: drop-shadow(0 0 10px rgba(182, 227, 136, .5)); }
.viewport-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 16px 0 0 0; }
.viewport-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 16px 0 0; }
.viewport-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 16px; }
.viewport-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 16px 0; }
.viewport-frame .beam {
  position: absolute; left: 6%; right: 6%; height: 2px; top: 0;
  background: linear-gradient(90deg, transparent, var(--lime), transparent);
  box-shadow: 0 0 18px 2px rgba(182, 227, 136, .6);
  opacity: 0;
}
.viewport.is-live .beam { opacity: 1; animation: beam 2.4s ease-in-out infinite; }
.viewport-idle {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-items: center; align-content: center; gap: 14px; text-align: center; padding: 24px;
  color: rgba(246, 244, 236, .75);
}
.viewport-idle .icon { width: 44px; height: 44px; color: var(--lime); stroke-width: 1.4; }
.viewport-idle p { margin: 0; font-size: 14px; max-width: 24em; }
.viewport.is-live .viewport-idle { display: none; }
.viewport-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.viewport-actions .btn { flex: 1; }
.file-btn input { display: none; }

.result {
  border-radius: var(--r); padding: 26px; min-height: 240px;
  display: grid; align-content: center; justify-items: start; gap: 10px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .78); box-shadow: var(--shadow);
  transition: background .3s, border-color .3s;
}
.result .result-icon { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--cream); color: var(--muted); }
.result .result-icon .icon { width: 28px; height: 28px; stroke-width: 2; }
.result h3 { margin: 6px 0 0; font-family: var(--serif); font-weight: 400; font-size: 30px; letter-spacing: -.02em; line-height: 1.1; }
.result p { margin: 0; color: var(--muted); }
.result[data-tone="ok"] { background: linear-gradient(160deg, #EFF8F0, #fff 70%); border-color: rgba(43, 122, 75, .3); }
.result[data-tone="ok"] .result-icon { background: var(--ok); color: #fff; box-shadow: 0 0 0 8px rgba(43, 122, 75, .12); animation: seal .6s var(--spring) both; }
.result[data-tone="error"] { background: linear-gradient(160deg, #FDF1EE, #fff 70%); border-color: rgba(185, 64, 47, .3); }
.result[data-tone="error"] .result-icon { background: var(--error); color: #fff; box-shadow: 0 0 0 8px rgba(185, 64, 47, .1); animation: shake .5s var(--ease) both; }
.result[data-tone="warn"] { background: linear-gradient(160deg, #FCF5E6, #fff 70%); border-color: rgba(154, 100, 18, .3); }
.result[data-tone="warn"] .result-icon { background: var(--warn); color: #fff; box-shadow: 0 0 0 8px rgba(154, 100, 18, .1); animation: shake .5s var(--ease) both; }
.result .release { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ok); }

/* lists */
.list { display: grid; }
.list-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--cream); color: var(--forest); border: 1px solid var(--line-2); }
.list-item .li-icon .icon { width: 18px; height: 18px; }
.list-item .li-icon.ok { background: var(--ok-bg); color: var(--ok); }
.list-item .li-icon.error { background: var(--error-bg); color: var(--error); }
.list-item .li-icon.warn { background: var(--warn-bg); color: var(--warn); }
.list-item b { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; display: block; line-height: 1.3; }
.list-item span { font-size: 12.5px; color: var(--muted); }
.list-item .li-end { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.list-item .li-end small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.empty .icon { width: 30px; height: 30px; margin: 0 auto 10px; color: var(--muted-2); stroke-width: 1.4; }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 22px; border-radius: var(--r); display: grid; gap: 14px; }
.kpi .kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi .kpi-top span { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .kpi-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--mint); color: var(--forest); }
.kpi .kpi-icon .icon { width: 18px; height: 18px; }
.kpi .num { font-size: clamp(36px, 3.4vw, 48px); line-height: 1; }
.kpi .num small { font-family: var(--sans); font-size: 14px; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.kpi.on-dark .kpi-top span { color: rgba(246, 244, 236, .65); }
.kpi.on-dark .kpi-icon { background: rgba(182, 227, 136, .14); color: var(--lime); }
.kpi.on-dark .num small { color: rgba(246, 244, 236, .55); }
.kpi .kpi-foot { font-size: 12.5px; color: var(--muted); }
.kpi.on-dark .kpi-foot { color: rgba(246, 244, 236, .55); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-col { display: grid; gap: 20px; }

.leader { display: grid; grid-template-columns: 34px auto 1fr auto; align-items: center; gap: 14px; padding: 11px 12px; border-radius: var(--r-sm); transition: background .2s; }
.leader:hover { background: rgba(14, 42, 30, .03); }
.leader + .leader { border-top: 1px solid var(--line-2); }
.leader .rank { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--muted-2); text-align: center; }
.leader:nth-child(-n+3) .rank { color: var(--forest); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13.5px; font-weight: 650; letter-spacing: .02em;
  background: linear-gradient(150deg, var(--mint), #CFE6CF); color: var(--forest);
  border: 1px solid rgba(31, 95, 63, .12);
}
.leader:nth-child(1) .avatar { background: linear-gradient(150deg, #F3DFAF, var(--gold)); color: #5C4512; border-color: rgba(92, 69, 18, .2); }
.leader b { display: block; font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.leader span { font-size: 12.5px; color: var(--muted); }
.leader .pts { text-align: right; }
.leader .pts .num { font-size: 22px; line-height: 1; }
.leader .pts small { display: block; font-size: 11.5px; color: var(--muted); }
.leader.flash { animation: flash 1.6s var(--ease); }

.bars { display: grid; gap: 16px; }
.bar-row { display: grid; gap: 8px; }
.bar-label { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
.bar-label span { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.bar-label .icon { width: 17px; height: 17px; color: var(--forest); }
.bar-label b { font-variant-numeric: tabular-nums; font-weight: 650; }
.bar-track { height: 10px; border-radius: var(--r-pill); background: rgba(14, 42, 30, .06); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--forest), var(--leaf) 70%, var(--lime)); transition: width 1.1s var(--ease); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }

/* PIN gate */
.pin-gate {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(70vw 60vh at 80% 0%, rgba(182, 227, 136, .18), transparent 60%),
    radial-gradient(60vw 60vh at 0% 100%, rgba(76, 175, 80, .16), transparent 60%),
    linear-gradient(160deg, var(--forest-2), var(--ink) 70%);
  color: var(--cream);
  transition: opacity .5s var(--ease), visibility .5s;
}
.pin-gate::after { content: ""; position: absolute; inset: 0; background-image: var(--grain); opacity: .12; mix-blend-mode: overlay; pointer-events: none; }
.pin-gate.unlocked { opacity: 0; visibility: hidden; }
.pin-card { position: relative; z-index: 1; width: min(380px, 100%); text-align: center; display: grid; justify-items: center; gap: 8px; }
.pin-card .brand-mark { width: 56px; height: 56px; border-radius: 18px; background: rgba(246, 244, 236, .08); border: 1px solid var(--line-dark); }
.pin-card .brand-mark .icon { width: 28px; height: 28px; }
.pin-card h1 { font-family: var(--serif); font-weight: 400; font-size: 38px; letter-spacing: -.03em; margin: 18px 0 0; line-height: 1.05; }
.pin-card p { margin: 0; color: rgba(246, 244, 236, .6); font-size: 14.5px; }
.pin-dots { display: flex; gap: 16px; margin: 30px 0 6px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(246, 244, 236, .35); transition: background .2s, border-color .2s, transform .2s var(--spring); }
.pin-dots span.on { background: var(--lime); border-color: var(--lime); transform: scale(1.15); }
.pin-dots.shake { animation: shake .5s var(--ease); }
.pin-dots.shake span { border-color: #F28B7A; }
.pin-error { height: 20px; font-size: 13px; color: #F7A99B; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; margin-top: 8px; }
.keypad button {
  width: 76px; height: 76px; border-radius: 50%;
  font-family: var(--serif); font-size: 30px; font-weight: 300;
  background: rgba(246, 244, 236, .06); border: 1px solid var(--line-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: background .15s, transform .15s var(--ease);
  display: grid; place-items: center; color: var(--cream);
}
.keypad button:hover { background: rgba(246, 244, 236, .12); }
.keypad button:active { transform: scale(.92); background: rgba(182, 227, 136, .25); }
.keypad button.k-fn { background: transparent; border-color: transparent; font-family: var(--sans); font-size: 13px; font-weight: 600; color: rgba(246, 244, 236, .6); box-shadow: none; }
.keypad button .icon { width: 24px; height: 24px; }
.pin-hint { margin-top: 22px; font-size: 12.5px; color: rgba(246, 244, 236, .45); }
.pin-hint code { color: var(--lime); }

/* =====================================================================
   STUDENT (mobile-first app)
   ===================================================================== */
.page-student { background: var(--cream); }
.app { width: 100%; max-width: 460px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }
.app[data-screen="onboard"] .screen-main,
.app[data-screen="main"] .screen-onboard { display: none; }

/* onboarding */
.screen-onboard { display: flex; flex-direction: column; min-height: 100dvh; }
.onboard-hero { padding: 26px 22px 110px; border-radius: 0 0 36px 36px; }
.onboard-hero .display { font-size: clamp(46px, 13vw, 60px); margin: 56px 0 14px; }
.onboard-hero .display em { color: var(--lime); }
.onboard-hero p { color: rgba(246, 244, 236, .7); margin: 0; font-size: 15.5px; max-width: 22em; }
.onboard-hero .badges-row { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.onboard-form { margin: -78px 16px 24px; padding: 22px; background: var(--paper); display: grid; gap: 14px; animation: rise .7s .1s var(--ease) both; }
.onboard-form h2 { font-size: 17px; margin: 0; letter-spacing: -.015em; }
.onboard-form .note { font-size: 12px; color: var(--muted); text-align: center; margin: 2px 0 0; }

/* app header */
.screen-main { padding-bottom: 120px; }
.app-head { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: rgba(246, 244, 236, .78); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border-bottom: 1px solid transparent; }
.app-head .who { flex: 1; min-width: 0; }
.app-head .who small { display: block; font-size: 12px; color: var(--muted); }
.app-head .who b { display: block; font-size: 15.5px; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.views { padding: 6px 16px 0; }
.view { display: none; }
.view.active { display: grid; gap: 16px; animation: rise .45s var(--ease) both; }
.view-title { padding: 10px 4px 2px; }
.view-title .h2 { font-size: 34px; }
.view-title p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* balance */
.balance { border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-lg); }
.balance-top { display: flex; justify-content: space-between; align-items: center; }
.balance-top small { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: rgba(246, 244, 236, .6); }
.balance .num { font-size: 76px; line-height: .95; margin: 22px 0 4px; letter-spacing: -.045em; }
.balance .num + span { font-size: 14px; color: rgba(246, 244, 236, .6); }
.progress { margin-top: 24px; }
.progress-track { height: 8px; border-radius: var(--r-pill); background: rgba(246, 244, 236, .1); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--leaf), var(--lime)); transition: width 1.2s var(--ease); box-shadow: 0 0 14px rgba(182, 227, 136, .5); }
.progress-label { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12.5px; color: rgba(246, 244, 236, .6); }
.progress-label b { color: var(--cream); font-weight: 600; }
.balance .leaf-art { position: absolute; right: -40px; top: -40px; width: 200px; height: 200px; color: rgba(182, 227, 136, .07); z-index: -1; transform: rotate(-18deg); }
.balance .leaf-art .icon { width: 100%; height: 100%; stroke-width: .7; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 16px 14px; border-radius: var(--r); }
.stat small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat .num { font-size: 28px; line-height: 1.1; margin-top: 6px; }
.stat .num small { display: inline; font-family: var(--sans); font-size: 12px; letter-spacing: 0; margin-left: 2px; }

.cta-card { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--r); cursor: pointer; transition: transform .3s var(--ease); width: 100%; text-align: left; }
.cta-card:hover { transform: translateY(-2px); }
.cta-card .cta-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--lime); color: var(--ink); flex: none; }
.cta-card .cta-icon .icon { width: 26px; height: 26px; stroke-width: 2; }
.cta-card b { display: block; font-size: 16px; letter-spacing: -.01em; }
.cta-card span { font-size: 13px; color: rgba(246, 244, 236, .6); }
.cta-card > .icon { margin-left: auto; color: var(--lime); }

.section-label { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 0; }
.section-label h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.section-label button { font-size: 13px; font-weight: 600; color: var(--forest); }
.list-card { padding: 4px 18px; border-radius: var(--r); }

/* rewards */
.reward { display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 16px; border-radius: var(--r); align-items: center; }
.reward-art { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; font-size: 34px; background: linear-gradient(150deg, var(--mint), #D7EBD6); border: 1px solid rgba(31, 95, 63, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8); }
.reward h4 { margin: 0; font-size: 16px; letter-spacing: -.015em; line-height: 1.25; }
.reward .reward-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.reward .cost { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 650; color: var(--ink); }
.reward .cost .num { font-size: 20px; }
.reward-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.reward-foot .need { font-size: 12.5px; color: var(--muted); }
.meter { flex: 1; max-width: 140px; height: 6px; border-radius: 6px; background: rgba(14, 42, 30, .07); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--forest); border-radius: inherit; }
.mini-balance { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; }

/* scan view */
.scan-hint { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0; }

/* vouchers */
.voucher {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--r); cursor: pointer; text-align: left; width: 100%;
  transition: transform .25s var(--ease), box-shadow .25s;
  position: relative;
}
.voucher:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.voucher::before, .voucher::after { /* ticket notches */
  content: ""; position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--cream); translate: 0 -50%;
}
.voucher::before { left: -9px; box-shadow: inset -1px 0 0 var(--line); }
.voucher::after { right: -9px; box-shadow: inset 1px 0 0 var(--line); }
.voucher .v-qr { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--ink); color: var(--lime); }
.voucher .v-qr .icon { width: 24px; height: 24px; }
.voucher b { display: block; font-size: 15px; letter-spacing: -.01em; }
.voucher span { font-size: 12.5px; color: var(--muted); }
.voucher.used { opacity: .6; box-shadow: var(--shadow-xs); }
.voucher.used .v-qr { background: var(--cream-2); color: var(--muted); }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 5px 9px; border-radius: var(--r-pill); }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-muted { background: var(--cream-2); color: var(--muted); }

/* tab bar */
.tabbar {
  position: fixed; z-index: 60; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(460px, 100%);
  padding: 0 14px calc(12px + env(safe-area-inset-bottom));
}
.tabbar-inner {
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: 70px; padding: 0 6px; border-radius: 26px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line);
  box-shadow: 0 20px 40px -16px rgba(14, 42, 30, .3), var(--inner-hi);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
}
.tabbar button { display: grid; justify-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--muted-2); padding: 8px 0; transition: color .2s; position: relative; }
.tabbar button .icon { width: 22px; height: 22px; transition: transform .3s var(--spring); }
.tabbar button[aria-selected="true"] { color: var(--forest); }
.tabbar button[aria-selected="true"] .icon { transform: translateY(-1px) scale(1.08); }
.tabbar button[aria-selected="true"]:not(.tab-scan)::after { content: ""; position: absolute; bottom: -2px; width: 4px; height: 4px; border-radius: 50%; background: var(--forest); }
.tabbar .tab-scan { padding: 0; }
.tabbar .tab-scan .fab {
  width: 62px; height: 62px; border-radius: 22px; margin-top: -34px;
  display: grid; place-items: center; color: var(--lime);
  background: linear-gradient(160deg, var(--forest), var(--ink));
  box-shadow: 0 0 0 6px var(--cream), 0 14px 28px -8px rgba(14, 42, 30, .6), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .3s var(--spring);
}
.tabbar .tab-scan:hover .fab { transform: translateY(-2px) rotate(-4deg); }
.tabbar .tab-scan .fab .icon { width: 28px; height: 28px; stroke-width: 2; }
.tabbar .tab-scan[aria-selected="true"] .fab { background: linear-gradient(160deg, #CBEFA4, var(--lime)); color: var(--ink); }

/* bottom sheet */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(8, 22, 15, .45);
  backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .35s var(--ease), visibility .35s;
}
.sheet-backdrop.open { opacity: 1; visibility: visible; }
.sheet {
  width: min(460px, 100%); max-height: 92dvh; overflow: auto;
  background: var(--cream); border-radius: 32px 32px 0 0;
  padding: 10px 22px calc(26px + env(safe-area-inset-bottom));
  box-shadow: 0 -30px 60px -20px rgba(0, 0, 0, .35);
  transform: translateY(100%); transition: transform .5s var(--ease);
}
.sheet-backdrop.open .sheet { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 5px; background: rgba(14, 42, 30, .15); margin: 0 auto 16px; }
.sheet-body { display: grid; gap: 14px; justify-items: center; text-align: center; }
.sheet-body h3 { font-family: var(--serif); font-weight: 400; font-size: 32px; letter-spacing: -.025em; line-height: 1.05; margin: 4px 0 0; }
.sheet-body p { margin: 0; color: var(--muted); max-width: 26em; }
.sheet-body .btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 6px; }
.sheet-body .btn-row.one { grid-template-columns: 1fr; }
.sheet-qr { padding: 16px; background: #fff; border-radius: 26px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.sheet-qr .qr { width: min(260px, 70vw); aspect-ratio: 1; }
.sheet-qr .qr img, .sheet-qr .qr canvas { width: 100% !important; height: 100% !important; }
.sheet-qr.used { position: relative; }
.sheet-qr.used .qr { opacity: .15; filter: grayscale(1); }
.sheet-qr.used::after { content: "USED"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; letter-spacing: .3em; font-size: 28px; color: var(--muted); transform: rotate(-12deg); }
.sheet-icon { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; color: #fff; margin-top: 8px; }
.sheet-icon .icon { width: 36px; height: 36px; stroke-width: 2.2; }
.sheet-icon.ok { background: var(--ok); box-shadow: 0 0 0 10px rgba(43, 122, 75, .12); animation: seal .6s var(--spring) both; }
.sheet-icon.error { background: var(--error); box-shadow: 0 0 0 10px rgba(185, 64, 47, .1); animation: shake .5s var(--ease) both; }
.sheet-icon.warn { background: var(--warn); box-shadow: 0 0 0 10px rgba(154, 100, 18, .1); animation: shake .5s var(--ease) both; }
.sheet-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* success burst */
.burst { position: relative; width: 180px; height: 180px; display: grid; place-items: center; margin-top: 6px; }
.burst .core {
  width: 150px; height: 150px; border-radius: 50%;
  display: grid; place-items: center; align-content: center;
  background: radial-gradient(circle at 30% 25%, #2C7A52, var(--ink) 75%);
  color: var(--cream); box-shadow: 0 0 0 10px rgba(182, 227, 136, .25), 0 24px 50px -16px rgba(14, 42, 30, .6);
  animation: seal .8s var(--spring) both;
}
.burst .core .num { font-size: 56px; line-height: 1; color: var(--lime); }
.burst .core small { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: rgba(246, 244, 236, .7); }
.burst i {
  position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; border-radius: 3px;
  background: var(--c, var(--lime)); opacity: 0;
  animation: confetti 1.1s var(--ease) forwards;
  animation-delay: .15s;
  transform: translate(-50%, -50%) rotate(var(--r, 0deg)) translateY(0);
}
.burst i:nth-child(1)  { --r: 0deg; }
.burst i:nth-child(2)  { --r: 30deg;  --c: var(--leaf); }
.burst i:nth-child(3)  { --r: 60deg;  --c: var(--gold); border-radius: 50%; }
.burst i:nth-child(4)  { --r: 90deg; }
.burst i:nth-child(5)  { --r: 120deg; --c: var(--forest); }
.burst i:nth-child(6)  { --r: 150deg; --c: var(--gold); border-radius: 50%; }
.burst i:nth-child(7)  { --r: 180deg; --c: var(--leaf); }
.burst i:nth-child(8)  { --r: 210deg; }
.burst i:nth-child(9)  { --r: 240deg; --c: var(--gold); border-radius: 50%; }
.burst i:nth-child(10) { --r: 270deg; --c: var(--forest); }
.burst i:nth-child(11) { --r: 300deg; --c: var(--leaf); }
.burst i:nth-child(12) { --r: 330deg; --c: var(--gold); border-radius: 50%; }

/* ---------- Toasts & banner ---------- */
.toasts { position: fixed; z-index: 300; top: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 16px;
  background: rgba(14, 42, 30, .94); color: var(--cream);
  font-size: 14px; font-weight: 500;
  box-shadow: 0 20px 40px -14px rgba(0, 0, 0, .45);
  backdrop-filter: blur(10px);
  animation: toast-in .45s var(--spring) both;
}
.toast .icon { width: 18px; height: 18px; color: var(--lime); stroke-width: 2.2; }
.toast-error .icon, .toast-warn .icon { color: #F7A99B; }
.toast.out { animation: toast-out .4s var(--ease) forwards; }
.demo-banner {
  position: fixed; z-index: 90; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 24px);
  padding: 9px 16px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .9); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: 12.5px; color: var(--muted); backdrop-filter: blur(10px);
}
.demo-banner .pulse-dot { background: var(--gold); }
.page-student .demo-banner { bottom: 104px; font-size: 11px; padding: 5px 11px; }
.page-student .demo-more { display: none; }

/* skeleton */
.skeleton { border-radius: var(--r); min-height: 90px; background: linear-gradient(90deg, rgba(14, 42, 30, .04), rgba(14, 42, 30, .08), rgba(14, 42, 30, .04)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ---------- Animations ---------- */
@property --p { syntax: "<number>"; inherits: false; initial-value: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { transform: scale(1); opacity: .6; } 80%, 100% { transform: scale(2.8); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
@keyframes pop-in { from { opacity: 0; scale: .85; } to { opacity: 1; scale: 1; } }
@keyframes device-in { from { opacity: 0; transform: translateY(40px) rotate(-8deg); } to { opacity: 1; transform: rotate(-4deg); } }
@keyframes qr-in { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: none; } }
@keyframes seal { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes beam { 0% { top: 4%; } 50% { top: 94%; } 100% { top: 4%; } }
@keyframes flash { 0% { background: rgba(182, 227, 136, .45); } 100% { background: transparent; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.97); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes confetti {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--r)) translateY(0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--r)) translateY(-118px) scale(.6) rotate(180deg); }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 540px; }
  .claim-grid, .scan-grid { grid-template-columns: 1fr; }
  .station { min-height: 560px; }
  .security { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: auto 1fr; height: auto; padding-top: 12px; padding-bottom: 12px; row-gap: 12px; }
  .topbar .seg { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; display: grid; grid-template-columns: repeat(3, 1fr); }
  .topbar .seg button { justify-content: center; }
}
@media (max-width: 720px) {
  .container { width: calc(100% - 32px); }
  .nav-links a:not(.btn) { display: none; }
  .role-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .step { min-height: 0; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero-art { min-height: 480px; }
  .device { width: 232px; border-radius: 38px; }
  .device-screen { border-radius: 30px; }
  .mini-card .mini-qr { width: 120px; height: 120px; }
  .fc-1 { left: 0; top: 10%; } .fc-2 { right: 0; } .fc-3 { display: none; }
  .hero-stats .num { font-size: 26px; }
  .claim-summary { grid-template-columns: 1fr 1fr; }
  .claim-summary > div:first-child { grid-column: 1 / -1; }
  .live .live-text { display: none; }
  .seg button .icon, .hide-sm { display: none; }
  .demo-more { display: none; }
}
@media (max-width: 420px) {
  .mat { grid-template-columns: auto 1fr; }
  .mat .stepper { grid-column: 1 / -1; justify-self: stretch; justify-content: space-between; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 16px; }
  .keypad { grid-template-columns: repeat(3, 68px); }
  .keypad button { width: 68px; height: 68px; }
  .balance .num { font-size: 64px; }
}

/* Student app on larger screens: present as a framed phone app */
@media (min-width: 560px) {
  .page-student .app {
    margin: 28px auto; min-height: calc(100dvh - 56px);
    border-radius: 40px; overflow: clip;
    background: var(--cream);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
  }
  .page-student .tabbar { bottom: 28px; }
  .page-student .onboard-hero { border-radius: 0 0 36px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
