/* ============================================================================
 * EduPresence UI — shared stylesheet (2026-11-18)
 *
 * Tokens + core components from EduPresence_Design_System_Spec.md.
 * Classes are prefixed `.eui-*` so they coexist with the legacy navy/gold
 * styles during the screen-by-screen rollout. Adding this file to a page does
 * NOT change any existing screen; each screen opts in by using .eui-* classes.
 *
 * Light theme only. Mobile-first, works at 400px wide without horizontal scroll.
 * Visual only — no logic, routing, RLS, or grade values change here.
 * ========================================================================== */

/* ---------- Google Font (Hanken Grotesk) ---------- */
@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700;800;900&display=swap');

/* ---------- Design tokens — spec §2, verbatim ----------
 * Scoped to .eui-page (not :root) so they don't collide with the legacy
 * token names on :root during the screen-by-screen rollout. Every screen
 * that opts in to the design system wraps its content in `.eui-page`, which
 * is where these tokens start resolving. Values are verbatim from §2. */
.eui-page,
.eui-modal-scrim {
  color-scheme: light;

  /* surfaces — calmer, green-tinted paper so nothing glares */
  --page: #e3ebe4;
  --page-2: #d8e2da;
  --card: #eff5f0;
  --ink: #182019;
  --ink-2: #48504a;
  --muted: #8c8f85;
  --line: #dae5dc;
  --line-2: #e6eee8;

  /* brand greens (primary) */
  --green: #15543a;
  --green-2: #0f4430;
  --green-3: #1c6b47;
  --green-4: #239a5e;

  /* presence mint (signature accent) */
  --accent: #2bbf6a;
  --accent-2: #7fe0a9;

  /* tints */
  --soft: #dbebe1;
  --soft-line: #bbd7c8;
  --soft-ink: #176445;

  --amber: #fbf3df;
  --amber-line: #ecd9a6;
  --amber-ink: #8a6a22;
  --amber-ic: #c08a2a;

  /* status */
  --danger: #c0392b;
  --danger-soft: #fbeceb;
  --danger-line: #f0c7c2;

  /* depth — softened so cards sit flat on the calmer paper */
  --sh-s: 0 1px 2px rgba(20, 30, 24, .025), 0 8px 20px -14px rgba(20, 30, 24, .18);
  --sh-m: 0 1px 3px rgba(20, 30, 24, .03), 0 2px 8px rgba(20, 30, 24, .025), 0 22px 42px -26px rgba(20, 30, 24, .28);
  --sh-green: 0 14px 34px -16px rgba(15, 68, 48, .55);
  --hl: inset 0 1px 0 rgba(255, 255, 255, .55);

  /* type */
  --ui: "Hanken Grotesk", -apple-system, system-ui, sans-serif;
}

/* ---------- Page shell ---------- */
.eui-page {
  background: var(--page);
  color: var(--ink);
  font-family: var(--ui);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
}
/* When an eui-page is mounted, the body (which legacy CSS paints navy) must
   not peek through below the scroll. Keep it cream so over-scroll and the
   strip behind the fixed tabbar stay on-brand. */
html:has(.eui-page),
body:has(.eui-page) { background: #e3ebe4; }
/* The legacy global #hdr duplicates the EduPresence brand when an eui-page is
   already rendering its own header band. Hide it on any eui screen. */
body:has(.eui-page) > #hdr { display: none; }

/* Sign-out pill in the brand row of every task portal — matches the legacy
   #hdr button we had to hide. Tap-friendly, 44 px high. */
.eui-signout {
  margin-left: auto;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .28);
  padding: 7px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 11.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s;
}
.eui-signout:hover,
.eui-signout:focus-visible { background: rgba(255, 255, 255, .22); outline: none; }
/* When the Live chip is also present, drop the margin-left so they sit
   together on the right side of the brand row. */
.eui-brandrow .eui-live-chip + .eui-signout { margin-left: 8px; }

/* Switch-view control (dual-role users). Lives in the brand row, next to
   Sign out. Only rendered for users who hold more than one role. */
.eui-switch-view {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .28);
  padding: 4px 6px 4px 12px;
  border-radius: 999px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.eui-switch-view:hover,
.eui-switch-view:focus-within { background: rgba(255, 255, 255, .22); }
.eui-switch-view-lbl {
  font-weight: 800;
  font-size: 11.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
}
.eui-switch-view-sel {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: #fff;
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 12.5px;
  padding: 3px 22px 3px 4px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 4px center;
}
.eui-switch-view-sel option { color: #163a28; background: #fff; }
/* With Switch-view present, the signout button no longer owns the auto
   margin — it just sits 8 px after the control on the right. */
.eui-brandrow .eui-switch-view + .eui-signout { margin-left: 8px; }

/* ---------- Matte task-portal overrides (polish pass) ----------
 * Login stays pixel-identical. The four task portals (Student / Lecturer /
 * HOD / Admin) take a matte look: softer top-highlight, flat gpa-hero + card
 * fills, less glassy button sheen, and darker secondary text for readability. */
#euiStudent, #euiLecturer, #euiHOD, #euiAdmin {
  --muted: #5a6159;
  --ink-2: #3b443d;
  --hl: inset 0 1px 0 rgba(255, 255, 255, .22);
}
/* Flat matte fills in place of glossy gradients. */
:is(#euiStudent, #euiLecturer, #euiHOD, #euiAdmin) .eui-gpa-hero {
  background: var(--card);
}
/* Button sheen toned down on the task portals — matte, not glassy. */
:is(#euiStudent, #euiLecturer, #euiHOD, #euiAdmin) .eui-btn-primary {
  box-shadow: var(--sh-s), inset 0 1px 0 rgba(255, 255, 255, .08);
}
:is(#euiStudent, #euiLecturer, #euiHOD, #euiAdmin) .eui-btn-accent {
  box-shadow: var(--sh-s), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.eui-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.eui-page *, .eui-page *::before, .eui-page *::after { box-sizing: border-box; }
.eui-page input, .eui-page button, .eui-page select, .eui-page textarea { font-family: inherit; color: inherit; }

/* ---------- Brand header band (spec §3.1) ---------- */
.eui-header-band {
  background: linear-gradient(170deg, var(--green) 0%, var(--green-2) 100%);
  color: #fff;
  padding: 28px 24px 32px;
  border-radius: 0 0 32px 32px;
  box-shadow: var(--sh-green);
  flex: none;
  overflow: hidden;
  position: relative;
}
.eui-header-band::after {
  /* a faint presence ring behind the header title — reinforces the brand */
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 1px solid rgba(127, 224, 169, 0.15);
  box-shadow: 0 0 0 24px rgba(127, 224, 169, 0.04);
  pointer-events: none;
}
.eui-brandrow {
  display: flex;
  align-items: center;
  gap: 10px;
}
.eui-wordmark {
  font-weight: 900;
  letter-spacing: -0.3px;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.eui-wordmark .eui-mint-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-2);
  border-radius: 50%;
  margin-left: 6px;
  box-shadow: 0 0 10px var(--accent-2);
  animation: eui-pulse 1.8s ease-in-out infinite;
}
.eui-live-chip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.eui-live-chip::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(127, 224, 169, 0.9);
  animation: eui-ping 1.6s ease-out infinite;
}
.eui-header-title {
  margin-top: 22px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.eui-header-sub {
  margin-top: 6px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
  line-height: 1.45;
  max-width: 34ch;
}

/* ---------- Logo mark (inline SVG lives in the markup) ---------- */
.eui-logo {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-block;
}
.eui-logo .eui-ring-outer { animation: eui-ring-ping 2.6s ease-out infinite; transform-origin: 24px 24px; }
.eui-logo .eui-ring-mid   { animation: eui-ring-ping 2.6s ease-out 1.3s infinite; transform-origin: 24px 24px; }
@keyframes eui-ring-ping {
  0%   { transform: scale(0.95); opacity: 0.55; }
  70%  { transform: scale(1.18); opacity: 0;    }
  100% { transform: scale(1.18); opacity: 0;    }
}
@keyframes eui-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 10px var(--accent-2); }
  50%      { opacity: .5; box-shadow: 0 0 0  var(--accent-2); }
}
@keyframes eui-ping {
  0%   { box-shadow: 0 0 0 0   rgba(127, 224, 169, 0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(127, 224, 169, 0);  }
  100% { box-shadow: 0 0 0 0   rgba(127, 224, 169, 0);   }
}
@media (prefers-reduced-motion: reduce) {
  .eui-logo .eui-ring-outer, .eui-logo .eui-ring-mid, .eui-wordmark .eui-mint-dot, .eui-live-chip::before {
    animation: none;
  }
}

/* ---------- Stepper (spec §3.1 — for the check-in wizard; harmless elsewhere) ---------- */
.eui-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}
.eui-stepper-dot {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-weight: 800; font-size: 11px;
  flex: none;
}
.eui-stepper-dot.is-done, .eui-stepper-dot.is-active {
  background: #fff; color: var(--green-2);
}
.eui-stepper-bar {
  flex: 1 1 auto;
  height: 3px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.eui-stepper-bar.is-filled::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--accent-2), #fff);
}

/* ---------- Card (spec §3.2) ---------- */
.eui-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--sh-m), var(--hl);
}
.eui-card + .eui-card { margin-top: 15px; }
.eui-card h2, .eui-card h3 {
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.3px;
}
.eui-card h2 { font-size: 22px; margin: 0 0 6px; }
.eui-card h3 { font-size: 16px; margin: 0 0 4px; }
.eui-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}
.eui-help {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.55;
}

/* ---------- Tabs (used on the login card for Matric / Email) ---------- */
.eui-tabs {
  display: flex;
  background: var(--page-2);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 18px;
  gap: 4px;
}
.eui-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 11px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.eui-tab[aria-selected="true"] {
  background: var(--card);
  color: var(--green);
  box-shadow: 0 2px 8px rgba(15, 68, 48, .06);
}

/* ---------- Labels + inputs (spec §3.5) ---------- */
.eui-label {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 10px 2px 8px;
}
.eui-input {
  width: 100%;
  background: var(--soft);
  border: 2px solid var(--soft-line);
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 15px;
  font-size: 15.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
.eui-input::placeholder { color: var(--muted); font-weight: 500; }
.eui-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(43, 191, 106, 0.18);
}

/* ---------- Buttons (spec §3.3) ---------- */
.eui-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: 15px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: transform .06s, box-shadow .15s, opacity .15s;
  min-height: 48px;
}
.eui-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.eui-btn:active:not(:disabled) { transform: translateY(1px); }
.eui-btn-primary {
  background: linear-gradient(170deg, var(--green-3), var(--green-2));
  color: #fff;
  box-shadow: var(--sh-s), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.eui-btn-accent {
  background: linear-gradient(170deg, var(--accent), var(--green-4));
  color: #04230f;
  box-shadow: var(--sh-s), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.eui-btn-ghost {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--sh-s);
}
.eui-btn-link {
  width: auto;
  background: transparent;
  color: var(--green);
  font-weight: 700;
  border: none;
  padding: 6px 2px;
  min-height: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Chips / status badges (spec §3.4, §3.7) ---------- */
.eui-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.eui-badge-success { background: var(--soft);       color: var(--soft-ink);   border-color: var(--soft-line); }
.eui-badge-amber   { background: var(--amber);      color: var(--amber-ink);  border-color: var(--amber-line); }
.eui-badge-danger  { background: var(--danger-soft); color: var(--danger);    border-color: var(--danger-line); }
.eui-badge-neutral { background: var(--card);       color: var(--ink-2);      border-color: var(--line); }

/* ---------- Detail / data row (spec §3.6) ---------- */
.eui-dr {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.eui-dr:last-child { border-bottom: none; }
.eui-dr-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; flex: 1 1 auto; }
.eui-dr-value { font-weight: 800; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Live-location pill (spec §3.8 — used by the check-in wizard) ---------- */
.eui-loc {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--soft);
  border: 1px solid var(--soft-line);
  color: var(--soft-ink);
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
}
.eui-signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.eui-signal span { width: 3px; background: var(--accent); border-radius: 1px; opacity: 0.25; }
.eui-signal span:nth-child(1) { height: 4px; }
.eui-signal span:nth-child(2) { height: 7px; }
.eui-signal span:nth-child(3) { height: 10px; }
.eui-signal span:nth-child(4) { height: 14px; }
.eui-signal.lv-1 span:nth-child(1), .eui-signal.lv-2 span:nth-child(-n+2), .eui-signal.lv-3 span:nth-child(-n+3), .eui-signal.lv-4 span { opacity: 1; }

/* ---------- Empty state (spec §3.9) ---------- */
.eui-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.eui-empty .eui-logo { opacity: .35; width: 48px; height: 48px; }
.eui-empty p { margin: 0; font-size: 14px; color: var(--ink-2); }

/* ---------- Footer signature (spec §3.10) ---------- */
.eui-footer {
  flex: none;
  padding: 18px 20px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.eui-footer .eui-logo { width: 18px; height: 18px; }
.eui-footer b { color: var(--green); font-weight: 800; letter-spacing: 0.2px; }

/* ---------- Toast (spec §3.11; the SPA already has a #toast, we only harmonise colors) ---------- */
.eui-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(80px);
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--sh-m);
  font-size: 13.5px;
  padding: 11px 16px;
  border-radius: 14px;
  max-width: 88vw;
  opacity: 0;
  transition: all .22s;
  z-index: 90;
}
.eui-toast.on { transform: translateX(-50%) translateY(0); opacity: 1; }
.eui-toast.err { border-color: var(--danger-line); color: var(--danger); }

/* ---------- Student portal components (spec §5B) ---------- */

/* Tab view switcher — only the active tab is painted. */
.eui-tab-view.is-hidden { display: none; }

/* Bottom tab bar (mobile-first) */
.eui-tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(20, 30, 24, .045);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0));
  z-index: 70;
}
.eui-tabbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  border-top: 2px solid transparent;
}
.eui-tabbar-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.eui-tabbar-btn.is-active { color: var(--green); border-top-color: var(--accent); }

/* Main area needs bottom padding so the tab bar never covers content. */
.eui-main-with-tabbar { padding-bottom: 96px; }

/* Dashboard hero (greeting + presence-ring avatar). */
.eui-dash-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}
.eui-presence-avatar { flex: none; width: 64px; height: 64px; }
.eui-dash-hero h2 { margin: 0; font-size: 22px; letter-spacing: -0.4px; }

/* Grid of large tap cards (spec §5B — My Results · My Attendance · My Courses) */
.eui-grid-2 {
  display: grid;
  gap: 15px;
  grid-template-columns: 1fr 1fr;
}
.eui-grid-2 .eui-tap-card:first-child:nth-last-child(odd):not(:only-child) { grid-column: span 2; }
.eui-tap-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px 18px;
  box-shadow: var(--sh-s), var(--hl);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  transition: transform .06s, box-shadow .2s;
}
.eui-tap-card:hover { box-shadow: var(--sh-m), var(--hl); }
.eui-tap-card:active { transform: translateY(1px); }
.eui-tap-card .eui-tap-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--soft-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.eui-tap-card .eui-tap-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.eui-tap-card .eui-tap-title { font-weight: 900; font-size: 17px; letter-spacing: -0.2px; }
.eui-tap-card .eui-tap-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* Live-session CTA — drawn when there's an active anti-proxy window to check into. */
.eui-live-cta {
  background: linear-gradient(170deg, var(--green-4), var(--green));
  color: #fff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--sh-green);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.eui-live-cta .eui-eyebrow { color: rgba(255,255,255,.72); }
.eui-live-cta h2 { color: #fff; margin: 0; font-size: 20px; }
.eui-live-cta .eui-help { color: rgba(255,255,255,.85); }
.eui-live-cta .eui-btn { background: #fff; color: var(--green); border: none; }

/* GPA hero (My Results) */
.eui-gpa-hero {
  background: linear-gradient(165deg, var(--card), var(--soft));
  border: 1px solid var(--soft-line);
  border-radius: 24px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--sh-s), var(--hl);
}
.eui-gpa-num {
  font-size: 56px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--green);
  margin: 6px 0 4px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(165deg, var(--green), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* A compact course row inside a semester card (for My Results). */
.eui-course-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.eui-course-row:last-child { border-bottom: none; }
.eui-course-row-main { flex: 1 1 auto; min-width: 0; }
.eui-course-row-id { font-weight: 800; font-size: 13.5px; color: var(--ink); }
.eui-course-row-title { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.eui-course-row-stats { font-size: 11.5px; color: var(--ink-2); margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }
.eui-course-row-badge { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* Grade badge — larger, used in the results list. */
.eui-grade {
  font-weight: 900;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 42px;
  justify-content: center;
}
.eui-grade.lvl-pass { background: var(--soft); color: var(--soft-ink); border: 1px solid var(--soft-line); }
.eui-grade.lvl-mid  { background: var(--amber); color: var(--amber-ink); border: 1px solid var(--amber-line); }
.eui-grade.lvl-fail { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-line); }
.eui-grade-pt { font-size: 11px; font-weight: 700; opacity: .85; }

/* Semester block header. */
.eui-sem-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.eui-sem-head .eui-sem-title { font-weight: 900; font-size: 15.5px; color: var(--ink); }
.eui-sem-head .eui-sem-meta  { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* Active-session card on the Live tab. */
.eui-live-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--sh-m), var(--hl);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.eui-live-card .eui-live-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.eui-live-card .eui-live-title { font-weight: 900; font-size: 16px; color: var(--ink); letter-spacing: -0.2px; }
.eui-live-card .eui-live-sub   { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.eui-windowchip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--soft); color: var(--soft-ink);
  border: 1px solid var(--soft-line);
  padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.eui-windowchip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(43,191,106,.6); animation: eui-ping 1.6s infinite; }
.eui-windowchip.is-closing { background: var(--amber); color: var(--amber-ink); border-color: var(--amber-line); }
.eui-windowchip.is-closing::before { background: var(--amber-ic); animation: none; }

/* Attendance record list item. */
.eui-att-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--sh-s);
  display: flex;
  align-items: center;
  gap: 12px;
}
.eui-att-row-main { flex: 1 1 auto; min-width: 0; }
.eui-att-row-id  { font-weight: 800; font-size: 14px; color: var(--ink); }
.eui-att-row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.eui-att-pct {
  flex: none; font-weight: 900; font-size: 15px; padding: 6px 12px; border-radius: 10px;
  font-variant-numeric: tabular-nums;
  background: var(--soft); color: var(--soft-ink); border: 1px solid var(--soft-line);
}
.eui-att-pct.is-flagged { background: var(--amber); color: var(--amber-ink); border-color: var(--amber-line); }

/* Course chip list (My Courses). */
.eui-chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.eui-chip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.eui-chip.is-override { border-color: var(--soft-line); background: var(--soft); color: var(--soft-ink); }

/* GPS + selfie wizard modal — light theme, uses the EduPresence palette. */
.eui-modal-scrim {
  position: fixed; inset: 0;
  background: rgba(20, 30, 24, 0.55);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.eui-modal-sheet {
  color-scheme: light;
  background: var(--card, #eff5f0);
  color: var(--ink, #182019);
  border-radius: 24px;
  padding: 22px 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 80px rgba(20, 30, 24, .45);
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: "Hanken Grotesk", -apple-system, system-ui, sans-serif;
}
.eui-modal-sheet h3 { margin: 0; font-weight: 900; font-size: 18px; letter-spacing: -0.3px; }

/* Small step-tracker used in the check-in wizard — purely visual. */
.eui-wiz-steps { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; }
.eui-wiz-step {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #e7e3d7; color: #8c8f85; font-weight: 800; font-size: 11px;
  border: 1px solid #ece8dd;
}
.eui-wiz-step.is-done { background: var(--accent, #2bbf6a); color: #04230f; border-color: var(--accent, #2bbf6a); }
.eui-wiz-step.is-active { background: var(--green, #15543a); color: #fff; border-color: var(--green, #15543a); }
.eui-wiz-line { flex: 1 1 auto; height: 3px; background: #ece8dd; border-radius: 2px; }
.eui-wiz-line.is-done { background: var(--accent, #2bbf6a); }

/* ---------- Lecturer / staff portal components (spec §5C) ---------- *
 * Data-first density: scrollable filter chips, sticky-header dense table,
 * selfie thumbnails that tap a full-photo modal, EduPresence-branded printable
 * attendance sheet. Each attendance sheet header shows ITS OWN session's
 * course · level · date · lecturer — never a shared header. */

/* Horizontally scrollable filter chip row (status filters above the table). */
.eui-filter-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.eui-filter-chips::-webkit-scrollbar { display: none; }
.eui-filter-chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  padding: 7px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.eui-filter-chip .eui-filter-count {
  background: var(--page-2);
  color: var(--muted);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.eui-filter-chip.is-active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.eui-filter-chip.is-active .eui-filter-count { background: rgba(255,255,255,.18); color: #fff; }

/* Dense data table — the attendance review's working surface. Scrolls
   horizontally inside its own container so the page never scrolls sideways. */
.eui-dtable-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--sh-s), var(--hl);
}
.eui-dtable-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.eui-dtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 620px;
}
.eui-dtable thead tr {
  background: var(--soft);
  color: var(--soft-ink);
  position: sticky;
  top: 0;
}
.eui-dtable th {
  text-align: left;
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--soft-line);
  white-space: nowrap;
}
.eui-dtable td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.eui-dtable tbody tr:last-child td { border-bottom: none; }
.eui-dtable tbody tr:hover { background: var(--page); }
.eui-dtable tr.is-filtered-out { display: none; }
.eui-dtable .eui-dt-name { font-weight: 800; color: var(--ink); }
.eui-dtable .eui-dt-sub  { font-size: 11.5px; color: var(--muted); margin-top: 1px; font-variant-numeric: tabular-nums; }
.eui-dtable .eui-dt-actions { white-space: nowrap; }
.eui-dtable .eui-dt-actions .eui-btn { margin-left: 6px; }

/* Selfie thumbnail in the table — tap opens the full-photo modal. Shows the
   image loaded via authenticated fetch (never a public URL). */
.eui-thumb {
  display: inline-block;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--page-2);
  cursor: pointer;
  vertical-align: middle;
  position: relative;
  padding: 0;
}
.eui-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.eui-thumb.is-loading::before {
  content: '…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 15px;
}
.eui-thumb.is-empty { cursor: default; background: var(--page); }
.eui-thumb.is-empty::after {
  content: 'none';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* Detail row for compact fact lists (session header, summaries). */
.eui-dr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.eui-dr:last-child { border-bottom: none; }
.eui-dr-label { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.eui-dr-value { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; text-align: right; }

/* Printable attendance sheet — each sheet brands its own session, no shared
   header. On screen it reads as a document card; in print it fills the page. */
.eui-sheet {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--sh-m);
  margin-top: 14px;
}
.eui-sheet-head {
  background: linear-gradient(170deg, var(--green) 0%, var(--green-2) 100%);
  color: #fff;
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.eui-sheet-brandrow { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.eui-sheet-inst { font-weight: 900; font-size: 15px; letter-spacing: -0.2px; }
.eui-sheet-dept { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 800; opacity: 0.85; }
.eui-sheet-title { font-weight: 900; font-size: 18px; letter-spacing: -0.3px; margin-top: 6px; }
.eui-sheet-meta {
  padding: 18px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.eui-sheet-meta > div { display: flex; flex-direction: column; gap: 2px; }
.eui-sheet-meta .lab { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.eui-sheet-meta .val { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.eui-sheet-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.eui-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 560px;
}
@media print { .eui-sheet-table { min-width: 0; } .eui-sheet-table-wrap { overflow: visible; } }
.eui-sheet-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 12px 14px;
  background: var(--soft);
  color: var(--soft-ink);
  border-bottom: 1px solid var(--soft-line);
  font-weight: 800;
}
.eui-sheet-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.eui-sheet-table tbody tr:last-child td { border-bottom: none; }
.eui-sheet-table .num { font-variant-numeric: tabular-nums; }
.eui-sheet-foot {
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.eui-sheet-sign {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 0 24px 24px;
}
.eui-sheet-sign-line {
  border-top: 1px solid var(--ink);
  padding-top: 6px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

/* Hide the on-screen app shell when printing an attendance sheet, show only
   the sheet itself. */
@media print {
  html:has(.eui-page), body:has(.eui-page) { background: #fff !important; }
  .eui-page .eui-header-band,
  .eui-page .eui-tabbar,
  .eui-page .eui-footer,
  .eui-page [data-eui-tab]:not(.eui-print-active),
  .eui-page .no-print { display: none !important; }
  .eui-page [data-eui-tab].eui-print-active .eui-no-print { display: none !important; }
  .eui-page .eui-sheet { box-shadow: none; border: none; border-radius: 0; margin: 0; page-break-inside: avoid; }
}

/* ---------- HOD / oversight portal components (spec §5D) ---------- *
 * Serious, table-heavy. KPI tiles for the overview, grouped broadsheet
 * bands for the official roster, audit-trail detail rows for amendments. */

/* KPI tile grid (overview stats). */
.eui-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) {
  .eui-kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
.eui-kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: var(--sh-s), var(--hl);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.eui-kpi-v {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.8px;
  line-height: 1;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.eui-kpi-l {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

/* Band that heads each broadsheet group (REGULAR / DIRECT ENTRY / SANDWICH). */
.eui-sheet-group {
  background: var(--soft);
  color: var(--soft-ink);
  border-top: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
  padding: 10px 24px;
  font-weight: 900;
  font-size: 11.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.eui-sheet-group .count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  text-transform: none;
  font-size: 12px;
  color: var(--soft-ink);
  opacity: 0.85;
}

/* Grade-scale card at the broadsheet foot. */
.eui-sheet-scale {
  background: var(--page-2);
  border-radius: 14px;
  padding: 12px 14px;
}
.eui-sheet-scale-title {
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.eui-sheet-scale table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.eui-sheet-scale th {
  text-align: left;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}
.eui-sheet-scale td { padding: 4px 6px; border-bottom: 1px solid var(--line-2); }
.eui-sheet-scale tr:last-child td { border-bottom: none; }

/* Audit-trail row — one past-version of a result with old → new values. */
.eui-audit-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--sh-s);
  margin-bottom: 10px;
}
.eui-audit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.3px;
}
.eui-audit-head .eui-audit-when { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 800; }
.eui-audit-body { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.eui-audit-body .eui-dr { padding: 6px 0; }
.eui-audit-body .eui-dr .arrow { color: var(--muted); font-weight: 700; margin: 0 6px; }
.eui-audit-body .eui-dr .new { color: var(--ink); font-weight: 900; }
.eui-audit-reason {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--soft);
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--soft-ink);
}
.eui-audit-reason b { font-weight: 800; letter-spacing: 0.3px; }

/* Form wrapper for the amend editor — sits inside the Amend tab card. */
.eui-amend-form {
  background: var(--soft);
  border: 1px solid var(--soft-line);
  border-radius: 20px;
  padding: 18px;
  margin-top: 12px;
}
.eui-amend-form .eui-input,
.eui-amend-form textarea.eui-input { background: var(--card); }
.eui-amend-form .eui-amend-current {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}

/* ---------- Mobile (≤ 400px safeguard) ---------- */
@media (max-width: 400px) {
  .eui-main { padding: 0 16px 20px; }
  .eui-main-with-tabbar { padding-bottom: 92px; }
  .eui-card { padding: 20px; border-radius: 22px; }
  .eui-header-band { padding: 22px 20px 26px; border-radius: 0 0 28px 28px; }
  .eui-header-title { font-size: 22px; }
  .eui-tap-card { padding: 18px 16px; border-radius: 22px; }
  .eui-tap-card .eui-tap-title { font-size: 16px; }
  .eui-gpa-num { font-size: 50px; }
  .eui-sheet-meta { grid-template-columns: 1fr; gap: 10px; }
  .eui-sheet-sign { grid-template-columns: 1fr; gap: 14px; }
}
