/* ==========================================================================
   PAYAO ES DOCU-PORTAL  |  Login screen  (v2: PC + Android)
   Everything is namespaced "lg-" so it never touches the other pages (app.css).
   Fonts are self-hosted (assets/fonts) so the login looks right even when the
   school's internet is slow or Google Fonts is unreachable.
   ========================================================================== */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('../fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('../fonts/figtree-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 900; font-style: normal; font-display: swap;
}
/* Local copy of the icon font, so icons never disappear if the CDN is slow */
@font-face {
  font-family: 'bootstrap-icons';
  src: url('../fonts/bootstrap-icons.woff2') format('woff2');
  font-display: block;
}

:root {
  --lg-forest-950: #0A2A25;
  --lg-forest-900: #0E3A32;
  --lg-forest-800: #134A3F;
  --lg-pine:       #1F5B49;
  --lg-pine-600:   #174A3B;
  --lg-mint:       #8FD9B6;
  --lg-gold:       #E8B84A;
  --lg-chalk:      #F7F5EE;
  --lg-paper:      #FFFEFA;
  --lg-ink:        #16342C;
  --lg-muted:      #5B6C63;
  --lg-line:       #E1E5DA;
  --lg-field:      #F5F6EF;

  --lg-display: 'Bricolage Grotesque', 'Figtree', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --lg-body:    'Figtree', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;

  --lg-ease: cubic-bezier(.2, .8, .2, 1);
  --lg-cycle: 10s;
}

/* --- Base ---------------------------------------------------------------- */
body.lg-body {
  margin: 0;
  background: var(--lg-chalk);
  color: var(--lg-ink);
  font-family: var(--lg-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}
.lg *, .lg *::before, .lg *::after { box-sizing: border-box; }
.lg a, .lg button, .lg label { -webkit-tap-highlight-color: rgba(31, 91, 73, .14); touch-action: manipulation; }

.lg {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  overflow: visible;
  overflow: clip;            /* clip (not hidden) so the brand panel can stay pinned */
}

/* ==========================================================================
   LEFT: brand panel (stays pinned while the form side scrolls on a PC)
   ========================================================================== */
.lg-aside {
  --mx: 24%;
  --my: 18%;
  position: relative;
  isolation: isolate;
  color: #fff;
  background:
    radial-gradient(640px 440px at 6% 0%, rgba(143, 217, 182, .16), transparent 70%),
    radial-gradient(520px 380px at 100% 100%, rgba(232, 184, 74, .07), transparent 70%),
    linear-gradient(150deg, var(--lg-forest-800) 0%, var(--lg-forest-900) 54%, var(--lg-forest-950) 100%);
}
.lg-aside-in {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(20px, 4vh, 48px);
  padding: clamp(28px, 4.4vw, 56px) clamp(28px, 5.2vw, 80px) clamp(22px, 2.6vw, 34px);
  overflow: hidden;
}

/* Lesson-plan sheet: faint ruled lines + a margin rule */
.lg-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: repeating-linear-gradient(to bottom,
    transparent 0, transparent 43px,
    rgba(255, 255, 255, .05) 43px, rgba(255, 255, 255, .05) 44px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 60%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0, #000 60%, transparent 100%);
}
.lg-aside::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: clamp(14px, 3.2vw, 52px);
  width: 1px;
  z-index: -2;
  background: linear-gradient(to bottom, transparent, rgba(232, 184, 74, .28) 12%, rgba(232, 184, 74, .28) 88%, transparent);
}

/* Pointer spotlight (set by login.js) */
.lg-glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity .6s ease;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(143, 217, 182, .14), transparent 65%);
}
.lg-aside.is-lit .lg-glow { opacity: 1; }

/* Brand lockup */
.lg-brand { display: flex; align-items: center; gap: 15px; }
.lg-seal {
  display: grid;
  place-items: center;
  flex: 0 0 62px;
  width: 62px; height: 62px;
  padding: 5px;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22), 0 0 0 5px rgba(255, 255, 255, .07);
  transition: transform .35s var(--lg-ease), box-shadow .35s var(--lg-ease);
}
.lg-seal img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.lg-brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.lg-brand-copy strong { font: 800 1.28rem var(--lg-display); letter-spacing: .01em; color: #fff; }
.lg-brand-copy small { margin-top: 6px; font: 700 .72rem var(--lg-body); letter-spacing: .2em; color: #C5DDD0; }

/* Pitch */
.lg-pitch { width: 100%; max-width: 760px; }
.lg-kicker {
  margin: 0 0 16px;
  font: 700 .74rem var(--lg-body);
  letter-spacing: .16em;
  color: var(--lg-gold);
}
.lg-title {
  margin: 0;
  font: 800 clamp(2.2rem, 3.6vw, 3.6rem)/1.06 var(--lg-display);
  letter-spacing: -.028em;
  color: #FFFDF6;
}
.lg-line { display: block; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; }
.lg-line > span { display: block; }
.lg-lead {
  max-width: 33em;
  margin: 18px 0 26px;
  font: 400 1.02rem/1.7 var(--lg-body);
  color: rgba(224, 238, 229, .86);
}

/* --- Hero: a lesson plan travelling Submit -> Review -> Approve ------------ */
.lg-flow {
  position: relative;
  width: min(100%, 500px);
  padding: 22px 24px 19px;
  border-radius: 18px;
  background: #FBFAF3;
  color: #24493F;
  box-shadow: 0 22px 44px -18px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .12);
}
.lg-flow-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 700 .64rem var(--lg-body); letter-spacing: .13em; color: #6F8478; }
.lg-live { position: relative; display: inline-flex; align-items: center; gap: 9px; color: #4E7766; }
.lg-live i { position: relative; display: block; width: 8px; height: 8px; border-radius: 50%; background: #3FA57A; }
.lg-live i::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid #3FA57A; opacity: 0; }
.lg-secure { display: inline-flex; align-items: center; gap: 6px; }

.lg-flow-doc { display: flex; align-items: center; gap: 14px; margin: 20px 0 18px; }
.lg-doc-icon { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; border-radius: 14px; background: #E3F0E8; color: #2F7A68; font-size: 1.35rem; }
.lg-doc-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lg-doc-text strong { font: 800 1.05rem var(--lg-display); color: #1F4A3F; }
.lg-doc-text small { font: 400 .8rem var(--lg-body); color: #6E8277; }
.lg-badge {
  position: relative;
  display: grid;
  place-items: center;
  margin-left: auto;
  flex: 0 0 30px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid #86C8A5;
  color: #2E8B5E;
  background: #DDF1E5;
}
.lg-badge i { font-size: 1rem; line-height: 1; }
.lg-badge::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid #7FC4A0; opacity: 0; }

.lg-track { height: 7px; border-radius: 99px; overflow: hidden; background: #E3E9DE; }
.lg-track-fill { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #4FA382, #86CDA8); }

.lg-stages { display: flex; align-items: center; gap: 10px; margin-top: 15px; font: 600 .74rem var(--lg-body); white-space: nowrap; }
.lg-stage { display: inline-flex; align-items: center; gap: 6px; color: #2A7A5C; }
.lg-link { position: relative; flex: 1; height: 2px; border-radius: 2px; background: #DCE5DC; overflow: hidden; }
.lg-link::after { content: ""; position: absolute; inset: 0; background: #4FA382; }

/* Feature row */
.lg-features { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 18px 0 0; padding: 0; list-style: none; font: 500 .8rem var(--lg-body); color: rgba(226, 238, 230, .9); }
.lg-features li { display: inline-flex; align-items: center; gap: 8px; }
.lg-features i { color: var(--lg-mint); font-size: .88rem; }

/* School footer */
.lg-school { display: flex; flex-direction: column; gap: 4px; margin: 0; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .12); font: 700 .8rem var(--lg-body); color: #F0F5EC; }
.lg-school span { font: 400 .78rem var(--lg-body); color: #BBD2C4; }

/* ==========================================================================
   RIGHT: sign-in (scrolls on its own, never clipped)
   ========================================================================== */
.lg-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 40px clamp(20px, 4.4vw, 72px);
  padding-bottom: max(40px, env(safe-area-inset-bottom));
  background:
    radial-gradient(520px 380px at 100% 0%, rgba(143, 217, 182, .16), transparent 70%),
    radial-gradient(460px 340px at 0% 100%, rgba(232, 184, 74, .09), transparent 70%),
    var(--lg-chalk);
}
.lg-stack { width: 100%; max-width: 480px; }

.lg-card {
  position: relative;
  width: 100%;
  padding: clamp(26px, 3vw, 38px);
  border: 1px solid #E4E7DC;
  border-radius: 24px;
  background: var(--lg-paper);
  box-shadow: 0 1px 2px rgba(22, 52, 44, .05), 0 24px 60px -24px rgba(22, 52, 44, .24);
}
.lg-card::before {
  content: "";
  position: absolute;
  top: -1px; left: 28px; right: 28px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--lg-pine), var(--lg-mint) 60%, var(--lg-gold));
  transform-origin: left center;
}
/* While the form is being sent, the top line sweeps back and forth */
.lg-card.is-submitting::before { background-size: 200% 100%; }

.lg-card h1 { margin: 0; font: 800 clamp(1.9rem, 2.8vw, 2.4rem)/1.1 var(--lg-display); letter-spacing: -.035em; color: #1B4A3E; }
.lg-card .lead { margin: 8px 0 20px; font: 400 .96rem/1.6 var(--lg-body); color: var(--lg-muted); }

/* Flash / error messages (rendered by render_flashes() and the error block) */
.lg-card .dl-alert {
  display: flex; align-items: flex-start; gap: 11px;
  margin: 0 0 18px; padding: 13px 15px;
  border-radius: 13px;
  font: 500 .86rem/1.5 var(--lg-body);
  border: 1px solid transparent;
  animation: lg-alert-in .5s var(--lg-ease) both !important;
}
.lg-card .dl-alert i { margin-top: 2px; font-size: 1.05rem; }
.lg-card .dl-alert-warning { background: #FBF1D8; border-color: #F0DDAE; color: #6B470A; }
.lg-card .dl-alert-danger  { background: #FCEBE8; border-color: #F3C9C2; color: #8A2A22; }
.lg-card .dl-alert-success { background: #E4F4EA; border-color: #BFE3CD; color: #19613F; }
.lg-card .dl-alert-info    { background: #E8F1EE; border-color: #C8DDD5; color: #1D4F43; }
.lg-card .dl-alert a { color: inherit; font-weight: 700; }

.lg-offline { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; padding: 12px 15px; border-radius: 13px; background: #FCEBE8; border: 1px solid #F3C9C2; color: #8A2A22; font: 600 .84rem/1.45 var(--lg-body); }
.lg-offline[hidden] { display: none; }

/* Labels */
.lg-label { display: block; margin: 16px 0 8px; font: 600 .84rem var(--lg-body); color: #34554A; }

/* Account type: three cards with a sliding highlight */
.lg-roles-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.lg-roles-fieldset legend { float: none; width: auto; margin: 0 0 9px; padding: 0; font: 600 .84rem var(--lg-body); color: #34554A; }
.lg-roles { --gap: 9px; position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.lg-roles-thumb {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: calc((100% - (var(--gap) * 2)) / 3);
  border-radius: 15px;
  background: linear-gradient(150deg, #EAF6EF, #DDEFE5);
  border: 1.5px solid var(--lg-pine);
  box-shadow: 0 10px 22px -12px rgba(31, 91, 73, .55);
  opacity: 0;
  transform: scale(.96);
  transition: transform .45s var(--lg-ease), opacity .25s ease;
  pointer-events: none;
}
.lg-roles[data-role="teacher"] .lg-roles-thumb       { opacity: 1; transform: translateX(0); }
.lg-roles[data-role="school_head"] .lg-roles-thumb   { opacity: 1; transform: translateX(calc(100% + var(--gap))); }
.lg-roles[data-role="admin_officer"] .lg-roles-thumb { opacity: 1; transform: translateX(calc(200% + (var(--gap) * 2))); }

.lg-role { position: relative; z-index: 1; display: block; margin: 0; cursor: pointer; }
.lg-role > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lg-role-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  row-gap: 2px;
  height: 100%;
  min-height: 118px;
  padding: 13px 10px 12px;
  border: 1.5px solid var(--lg-line);
  border-radius: 15px;
  background: rgba(255, 255, 255, .7);
  transition: border-color .25s ease, background-color .3s ease, transform .25s var(--lg-ease);
}
.lg-role-ico {
  display: grid; place-items: center;
  width: 36px; height: 36px; margin-bottom: 8px;
  border-radius: 11px;
  background: #EDF2EA;
  color: var(--lg-pine);
  font-size: 1.1rem;
  transition: background-color .3s ease, color .3s ease, transform .4s var(--lg-ease);
}
.lg-role-card strong { font: 700 .86rem/1.2 var(--lg-body); color: var(--lg-ink); overflow-wrap: anywhere; }
.lg-role-card small { margin-top: 2px; font: 400 .72rem/1.35 var(--lg-body); color: var(--lg-muted); }
.lg-role-tick {
  position: absolute; top: 8px; right: 8px;
  font-size: .95rem; color: var(--lg-pine);
  opacity: 0; transform: scale(.3) rotate(-30deg);
  transition: opacity .2s ease, transform .45s var(--lg-ease);
}
.lg-role > input:checked + .lg-role-card { background: transparent; border-color: transparent; box-shadow: inset 0 0 0 1.5px var(--lg-pine); }
.lg-role > input:checked + .lg-role-card .lg-role-ico { background: var(--lg-pine); color: #fff; transform: scale(1.06) rotate(-4deg); }
.lg-role > input:checked + .lg-role-card .lg-role-tick { opacity: 1; transform: none; }
.lg-role > input:focus-visible + .lg-role-card { outline: 3px solid rgba(31, 91, 73, .4); outline-offset: 3px; }
/* When JS has placed the sliding highlight, it draws the border instead */
.lg-roles[data-role="teacher"] .lg-role > input:checked + .lg-role-card,
.lg-roles[data-role="school_head"] .lg-role > input:checked + .lg-role-card,
.lg-roles[data-role="admin_officer"] .lg-role > input:checked + .lg-role-card { box-shadow: none; }

/* Inputs */
.lg-input {
  display: flex; align-items: center;
  min-height: 54px;
  border: 1.5px solid #DDE2D6;
  border-radius: 14px;
  background: var(--lg-field);
  transition: border-color .25s ease, box-shadow .25s ease, background-color .25s ease;
}
.lg-input:focus-within { border-color: var(--lg-pine); background: #fff; box-shadow: 0 0 0 4px rgba(31, 91, 73, .13), 0 10px 22px -14px rgba(31, 91, 73, .5); }
.lg-input > i { padding-left: 16px; color: #8A9C91; font-size: 1.05rem; transition: color .25s ease, transform .35s var(--lg-ease); }
.lg-input:focus-within > i { color: var(--lg-pine); transform: scale(1.12); }
.lg-input input {
  flex: 1; min-width: 0;
  padding: 15px 14px;
  border: 0; border-radius: 0;
  background: transparent;
  box-shadow: none; outline: none;
  font: 500 1rem var(--lg-body);          /* 16px: no zoom-on-focus on phones */
  color: var(--lg-ink);
}
.lg-input input::placeholder { color: #9AA99F; }
.lg-input input:-webkit-autofill,
.lg-input input:-webkit-autofill:hover,
.lg-input input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--lg-ink);
  -webkit-box-shadow: 0 0 0 100px var(--lg-field) inset;
  caret-color: var(--lg-ink);
  transition: background-color 9999s ease-out 0s;
}
.lg-input:focus-within input:-webkit-autofill { -webkit-box-shadow: 0 0 0 100px #fff inset; }
.lg-toggle {
  display: grid; place-items: center;
  width: 50px; height: 50px; flex: 0 0 50px;
  padding: 0; border: 0; border-radius: 12px;
  background: none; color: #7C8F84; font-size: 1.12rem; cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.lg-toggle:active { background: rgba(31, 91, 73, .1); }
.lg-toggle:focus-visible { outline: 3px solid rgba(31, 91, 73, .4); outline-offset: -3px; }

.lg-hint { display: flex; align-items: center; gap: 7px; margin: 9px 2px 0; font: 600 .78rem var(--lg-body); color: #8A5A0B; animation: lg-alert-in .3s var(--lg-ease) both !important; }
.lg-hint[hidden] { display: none; }

/* Sign in button */
.lg-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px;
  margin-top: 24px;
  padding: 0 22px;
  border: 0; border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(115deg, var(--lg-pine-600), var(--lg-pine) 55%, #24705A);
  color: #fff;
  font: 700 1rem var(--lg-body);
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 16px 28px -14px rgba(23, 74, 59, .9), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: transform .25s var(--lg-ease), box-shadow .25s ease, filter .25s ease;
}
.lg-btn::after {
  content: "";
  position: absolute; top: -60%; left: -40%;
  width: 30%; height: 220%;
  background: rgba(255, 255, 255, .22);
  filter: blur(6px);
  transform: rotate(25deg);
  transition: left .7s var(--lg-ease);
}
.lg-btn:active { transform: translateY(0) scale(.985); }
.lg-btn:focus-visible { outline: 3px solid rgba(31, 91, 73, .45); outline-offset: 3px; }
.lg-btn[disabled] { cursor: progress; }
.lg-btn.is-busy { filter: saturate(.8); }
.lg-btn.is-busy::before {
  content: "";
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: lg-spin .7s linear infinite !important;
}

.lg-note { margin: 22px 0 0; font: 400 .88rem/1.65 var(--lg-body); color: var(--lg-muted); }

/* ==========================================================================
   "New here?"  (register links)
   ========================================================================== */
.lg-join { display: grid; gap: 9px; margin-top: 22px; }
.lg-join-title { display: flex; align-items: center; gap: 14px; margin: 0 0 3px; font: 700 .78rem var(--lg-body); letter-spacing: .06em; color: #7A8B81; }
.lg-join-title::before, .lg-join-title::after { content: ""; flex: 1; height: 1px; background: #DCE2D5; }
.lg-join-cap { margin: 8px 2px 0; font: 600 .8rem var(--lg-body); color: var(--lg-muted); }
.lg-join-link {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 9px 14px 9px 10px;
  border: 1.5px solid var(--lg-line); border-radius: 14px;
  background: rgba(255, 255, 255, .75);
  color: var(--lg-pine-600); text-decoration: none;
  font: 700 .9rem/1.3 var(--lg-body);
  transition: border-color .25s ease, background-color .25s ease, transform .25s var(--lg-ease), box-shadow .25s ease;
}
.lg-join-ico { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; background: #E6F0E9; color: var(--lg-pine); font-size: 1.05rem; transition: background-color .25s ease, color .25s ease; }
.lg-join-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lg-join-go { color: #8CA497; font-size: 1rem; transition: transform .3s var(--lg-ease), color .25s ease; }
.lg-join-link:active { background: #EEF5F0; border-color: #B9CDC0; }
.lg-join-link:focus-visible { outline: 3px solid rgba(31, 91, 73, .4); outline-offset: 2px; }

/* Hover effects only on devices that can hover (no sticky hover on phones) */
@media (hover: hover) {
  .lg-seal:hover { transform: translateY(-2px) rotate(-3deg); box-shadow: 0 14px 32px rgba(0, 0, 0, .28), 0 0 0 7px rgba(255, 255, 255, .09); }
  .lg-role:hover .lg-role-card { border-color: #BCCFC4; transform: translateY(-2px); }
  .lg-input:hover { border-color: #C9D3C6; }
  .lg-toggle:hover { color: var(--lg-pine); background: rgba(31, 91, 73, .08); }
  .lg-btn:hover { transform: translateY(-2px); box-shadow: 0 22px 34px -14px rgba(23, 74, 59, .85), inset 0 1px 0 rgba(255, 255, 255, .18); }
  .lg-btn:hover::after { left: 120%; }
  .lg-join-link:hover { border-color: #A9C4B4; background: #fff; transform: translateY(-2px); box-shadow: 0 14px 24px -18px rgba(22, 52, 44, .5); }
  .lg-join-link:hover .lg-join-ico { background: var(--lg-pine); color: #fff; }
  .lg-join-link:hover .lg-join-go { transform: translateX(4px); color: var(--lg-pine); }
}

/* ==========================================================================
   Motion (only when the visitor has not asked for reduced motion)
   NOTE: app.css has a global "animation-duration:0s !important" rule, so every
   animation here is declared !important to win over it.
   ========================================================================== */
@keyframes lg-rise      { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes lg-fade      { from { opacity: 0; } to { opacity: 1; } }
@keyframes lg-drop      { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes lg-reveal    { from { transform: translateY(108%); } to { transform: none; } }
@keyframes lg-draw      { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes lg-alert-in  { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes lg-shake     { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
@keyframes lg-spin      { to { transform: rotate(360deg); } }
@keyframes lg-ping      { 0% { transform: scale(.6); opacity: .7; } 80%, 100% { transform: scale(1.9); opacity: 0; } }
@keyframes lg-sweep     { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* The hero loop: Submit -> Review -> Approve (one cycle = --lg-cycle) */
@keyframes lg-fill {
  0%   { width: 6%;   opacity: 1; }
  12%  { width: 34%; }
  36%  { width: 34%; }
  48%  { width: 67%; }
  70%  { width: 67%; }
  82%  { width: 100%; }
  95%  { width: 100%; opacity: 1; }
  98%  { width: 100%; opacity: 0; }
  98.01% { width: 6%; opacity: 0; }
  100% { width: 6%;   opacity: 1; }
}
@keyframes lg-stage-1 { 0%, 8% { color: #9AAA9F; } 14%, 96% { color: #2A7A5C; } 99%, 100% { color: #9AAA9F; } }
@keyframes lg-stage-2 { 0%, 44% { color: #9AAA9F; } 50%, 96% { color: #2A7A5C; } 99%, 100% { color: #9AAA9F; } }
@keyframes lg-stage-3 { 0%, 78% { color: #9AAA9F; } 84%, 96% { color: #2A7A5C; } 99%, 100% { color: #9AAA9F; } }
@keyframes lg-link-1  { 0%, 36% { transform: scaleX(0); } 48%, 96% { transform: scaleX(1); } 99%, 100% { transform: scaleX(0); } }
@keyframes lg-link-2  { 0%, 70% { transform: scaleX(0); } 82%, 96% { transform: scaleX(1); } 99%, 100% { transform: scaleX(0); } }
@keyframes lg-badge {
  0%, 80% { background: transparent; border-color: #CBD8CE; transform: scale(1); }
  84%     { background: #DDF1E5; border-color: #86C8A5; transform: scale(1.2); }
  89%, 96% { background: #DDF1E5; border-color: #86C8A5; transform: scale(1); }
  99%, 100% { background: transparent; border-color: #CBD8CE; transform: scale(1); }
}
@keyframes lg-badge-i {
  0%, 80% { opacity: 0; transform: scale(.3) rotate(-30deg); }
  86%     { opacity: 1; transform: scale(1) rotate(0); }
  96%     { opacity: 1; transform: scale(1); }
  99%, 100% { opacity: 0; transform: scale(.3); }
}
@keyframes lg-badge-ring { 0%, 81% { opacity: 0; transform: scale(1); } 83% { opacity: .75; } 92%, 100% { opacity: 0; transform: scale(2.3); } }
@keyframes lg-doc-nudge {
  0%, 10%, 18%, 46%, 54%, 80%, 88%, 100% { transform: none; }
  13%, 49%, 83% { transform: translateY(-3px) rotate(-4deg); }
}

@media (prefers-reduced-motion: no-preference) {
  /* One orchestrated entrance */
  .lg-brand    { animation: lg-drop .7s var(--lg-ease) .05s both !important; }
  .lg-kicker   { animation: lg-fade .6s ease .2s both !important; }
  .lg-line > span { animation: lg-reveal .9s var(--lg-ease) both !important; }
  .lg-line:nth-child(1) > span { animation-delay: .25s !important; }
  .lg-line:nth-child(2) > span { animation-delay: .38s !important; }
  .lg-lead     { animation: lg-fade .8s ease .6s both !important; }
  .lg-flow     { animation: lg-rise .9s var(--lg-ease) .7s both !important; }
  .lg-features li { animation: lg-fade .6s ease both !important; }
  .lg-features li:nth-child(1) { animation-delay: 1.15s !important; }
  .lg-features li:nth-child(2) { animation-delay: 1.27s !important; }
  .lg-features li:nth-child(3) { animation-delay: 1.39s !important; }
  .lg-school   { animation: lg-fade 1s ease 1.3s both !important; }
  .lg-card     { animation: lg-rise .9s var(--lg-ease) .3s both !important; }
  .lg-card::before { animation: lg-draw 1.1s var(--lg-ease) .9s both !important; }
  .lg-card.has-error { animation: lg-rise .9s var(--lg-ease) .3s both, lg-shake .55s ease 1.2s both !important; }
  .lg-card.is-submitting::before { animation: lg-sweep 1.1s linear infinite !important; background-image: linear-gradient(90deg, var(--lg-pine) 0, var(--lg-mint) 25%, var(--lg-gold) 50%, var(--lg-mint) 75%, var(--lg-pine) 100%); }
  .lg-join     { animation: lg-rise .8s var(--lg-ease) 1s both !important; }

  /* Hero loop starts once the card has landed */
  .lg-live i::after { animation: lg-ping 2.2s ease-out infinite !important; }
  .lg-track-fill    { animation: lg-fill var(--lg-cycle) var(--lg-ease) 1.6s infinite !important; width: 6%; }
  .lg-stage-1       { animation: lg-stage-1 var(--lg-cycle) linear 1.6s infinite !important; color: #9AAA9F; }
  .lg-stage-2       { animation: lg-stage-2 var(--lg-cycle) linear 1.6s infinite !important; color: #9AAA9F; }
  .lg-stage-3       { animation: lg-stage-3 var(--lg-cycle) linear 1.6s infinite !important; color: #9AAA9F; }
  .lg-link-1::after { transform-origin: left center; transform: scaleX(0); animation: lg-link-1 var(--lg-cycle) var(--lg-ease) 1.6s infinite !important; }
  .lg-link-2::after { transform-origin: left center; transform: scaleX(0); animation: lg-link-2 var(--lg-cycle) var(--lg-ease) 1.6s infinite !important; }
  .lg-badge         { background: transparent; border-color: #CBD8CE; animation: lg-badge var(--lg-cycle) var(--lg-ease) 1.6s infinite !important; }
  .lg-badge i       { opacity: 0; animation: lg-badge-i var(--lg-cycle) var(--lg-ease) 1.6s infinite !important; }
  .lg-badge::after  { animation: lg-badge-ring var(--lg-cycle) ease-out 1.6s infinite !important; }
  .lg-doc-icon      { animation: lg-doc-nudge var(--lg-cycle) var(--lg-ease) 1.6s infinite !important; }
}

@media (prefers-reduced-motion: reduce) {
  .lg *, .lg *::before, .lg *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* --- PC: typical full-HD browser window (about 950px tall) --- */
@media (min-width: 900px) and (max-height: 1000px) {
  .lg-main { padding-top: 26px; padding-bottom: 26px; }
  .lg-card { padding: 28px 34px 30px; }
  .lg-card .lead { margin: 6px 0 16px; }
  .lg-role-card { min-height: 110px; }
  .lg-join { margin-top: 18px; gap: 8px; }
  .lg-join-link { min-height: 48px; }
}

/* --- PC: shorter screens (laptops) shrink the brand panel so it always fits --- */
@media (min-width: 900px) and (max-height: 860px) {
  .lg-title { font-size: clamp(2rem, 3.1vw, 3rem); }
  .lg-lead { margin: 12px 0 18px; font-size: .96rem; line-height: 1.6; }
  .lg-flow { padding: 18px 22px 16px; }
  .lg-flow-doc { margin: 15px 0 14px; }
  .lg-features { margin-top: 14px; }
  .lg-card { padding: 26px 32px 28px; }
  .lg-card h1 { font-size: 2rem; }
  .lg-card .lead { margin: 6px 0 16px; }
  .lg-label { margin-top: 13px; }
  .lg-input { min-height: 50px; }
  .lg-input input { padding-top: 12px; padding-bottom: 12px; }
  .lg-btn { min-height: 52px; margin-top: 20px; }
  .lg-role-card { min-height: 108px; }
  .lg-note { margin-top: 16px; }
  .lg-join { margin-top: 18px; }
}
@media (min-width: 900px) and (max-height: 760px) {
  .lg-features { display: none; }
  .lg-lead { display: none; }
  .lg-kicker { margin-bottom: 12px; }
  .lg-flow { margin-top: 24px; }
}
@media (min-width: 900px) and (max-height: 640px) {
  .lg-flow { display: none; }
  .lg-aside-in { gap: 16px; }
}

@media (max-width: 1100px) and (min-width: 900px) {
  .lg-aside-in { padding-left: 34px; padding-right: 34px; }
  .lg-flow { width: 100%; }
}

/* --- Tablet and phone: one column, brand header on top --------------------- */
@media (max-width: 899.98px) {
  .lg { display: block; overflow: visible; }
  .lg-aside-in { position: static; height: auto; gap: 22px; padding: max(24px, env(safe-area-inset-top)) 22px 28px; overflow: visible; }
  .lg-aside::after { display: none; }
  .lg-title { font-size: clamp(1.9rem, 7vw, 2.6rem); }
  .lg-lead { margin: 14px 0 22px; font-size: .95rem; line-height: 1.65; }
  .lg-flow { width: 100%; max-width: 520px; padding: 18px 18px 16px; }
  .lg-features { display: none; }
  .lg-school { padding-top: 14px; }
  .lg-main { padding: 28px 18px max(46px, env(safe-area-inset-bottom)); }
  .lg-card { margin-top: -4px; }
}

/* --- Phone: compact brand header so the sign-in form is on screen right away --- */
@media (max-width: 599.98px) {
  .lg-aside-in { gap: 22px; padding: max(18px, env(safe-area-inset-top)) 20px 22px; }
  .lg-seal { flex-basis: 52px; width: 52px; height: 52px; border-radius: 14px; padding: 4px; }
  .lg-brand-copy strong { font-size: 1.12rem; }
  .lg-kicker { margin-bottom: 8px; font-size: .68rem; }
  .lg-title { font-size: clamp(1.7rem, 8vw, 2.1rem); }
  .lg-lead, .lg-flow { display: none; }
  .lg-school { flex-direction: row; flex-wrap: wrap; gap: 2px 10px; padding-top: 12px; font-size: .74rem; }
  .lg-school span { font-size: .72rem; }
  .lg-main { padding: 18px 14px max(40px, env(safe-area-inset-bottom)); }
  .lg-card { padding: 24px 18px 22px; border-radius: 22px; }
  .lg-card::before { left: 22px; right: 22px; }
  .lg-card h1 { font-size: 1.85rem; }
  .lg-card .lead { font-size: .93rem; }
}

/* --- Phone: account type becomes three stacked rows (nothing gets squeezed) --- */
@media (max-width: 520px) {
  .lg-roles { --gap: 8px; grid-template-columns: minmax(0, 1fr); }
  .lg-roles-thumb { bottom: auto; width: 100%; height: calc((100% - (var(--gap) * 2)) / 3); }
  .lg-roles[data-role="teacher"] .lg-roles-thumb       { transform: translateY(0); }
  .lg-roles[data-role="school_head"] .lg-roles-thumb   { transform: translateY(calc(100% + var(--gap))); }
  .lg-roles[data-role="admin_officer"] .lg-roles-thumb { transform: translateY(calc(200% + (var(--gap) * 2))); }
  .lg-role-card {
    grid-template-columns: 38px minmax(0, 1fr);
    column-gap: 12px; row-gap: 0;
    align-content: center; align-items: center;
    min-height: 64px; padding: 10px 40px 10px 12px;
  }
  .lg-role-ico { grid-row: 1 / 3; width: 38px; height: 38px; margin-bottom: 0; }
  .lg-role-card strong { align-self: end; font-size: .93rem; }
  .lg-role-card small { align-self: start; margin-top: 2px; font-size: .74rem; }
  .lg-role-tick { top: 50%; right: 14px; margin-top: -.5em; font-size: 1.1rem; }
}

/* --- Phone held sideways / very short screens: keep everything reachable --- */
@media (max-height: 520px) and (min-width: 600px) {
  .lg { display: block; }
  .lg-aside-in { position: static; height: auto; padding: 18px 28px; gap: 12px; }
  .lg-lead, .lg-flow, .lg-features { display: none; }
  .lg-main { padding: 22px 24px 36px; }
}

@media (max-width: 360px) {
  .lg-card { padding: 22px 14px 20px; }
  .lg-join-link { font-size: .86rem; }
}
