/* UG-EDIS sign-in page (templates/portal/login.html).
   Loaded after portal.css and reuses its tokens (--ink, --muted, --bg,
   --font-body, --font-display) plus the per-school --brand-primary*
   variables the template sets inline. Mobile first: one column with a
   coloured band and the card lifted over it; two columns from 900px.
   Self-contained, no CDN. Contrast checked against WCAG AA. */

body.auth-page {
  min-height: 100dvh;
  margin: 0;
  font-family: var(--font-body, Inter, system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.auth-skip {
  position: absolute; left: -9999px; top: 0; z-index: 10;
  background: #fff; color: var(--brand-primary-dark, #065f46);
  padding: 12px 16px; border-radius: 10px; font-weight: 600;
}
.auth-skip:focus { left: 12px; top: 12px; }

.auth-page :focus-visible {
  outline: 3px solid var(--brand-primary, #047857);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */
.auth-layout { min-height: 100dvh; display: flex; flex-direction: column; }

.auth-aside {
  padding: 24px 20px 76px;
  color: #fff;
  background: linear-gradient(165deg, var(--brand-primary-deeper, #064e3b) 0%, var(--brand-primary-dark, #065f46) 55%, var(--brand-primary, #047857) 100%);
}
.auth-brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: inherit; text-decoration: none; }
.auth-brand:hover { text-decoration: none; }
.auth-aside .mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .3);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff;
}
.auth-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #fff; }
.auth-brand-name { font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.auth-aside h1 {
  margin: 14px 0 0; font-family: var(--font-display, inherit);
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25;
}
.auth-lede { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: rgba(255, 255, 255, .92); max-width: 40ch; }
.auth-points, .auth-who, .auth-aside .foot { display: none; }

.auth-main { flex: 1; display: flex; justify-content: center; padding: 0 16px 32px; margin-top: -52px; }

.auth-card {
  width: 100%; max-width: 440px; align-self: flex-start;
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 12px 32px -12px rgba(17, 22, 20, .22);
  padding: 24px 20px;
}

/* ---------- Card content ---------- */
.auth-card-badge { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0 0 18px; }
.auth-card-badge .mark { width: 72px; height: 72px; border-radius: 18px; background: var(--brand-primary, #047857); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 26px; }
.auth-card-logo { width: 72px; height: 72px; border-radius: 18px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.auth-card-badge-name { font-family: var(--font-display, inherit); font-weight: 700; font-size: 15px; letter-spacing: .02em; color: var(--ink); }
.auth-card-head h2 {
  margin: 0; font-family: var(--font-display, inherit);
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
}
.auth-card-head .sub { margin: 6px 0 0; font-size: 14px; color: var(--muted); line-height: 1.45; }

.auth-field { margin-top: 18px; }
.auth-card label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.auth-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-label-row label { margin: 0; }
.auth-forgot {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px;
  font-size: 14px; font-weight: 600; color: var(--brand-primary-dark, #065f46);
  text-decoration: underline; text-underline-offset: 3px;
}
.auth-field-help { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

.auth-card input[type="text"],
.auth-card input[type="password"] {
  display: block; width: 100%; box-sizing: border-box;
  min-height: 48px; padding: 0 14px;
  border: 1px solid #748297; border-radius: 10px;   /* 3.9:1 on white */
  font: inherit; font-size: 16px;                    /* 16px stops iOS zooming on focus */
  color: var(--ink); background: #fff;
}
.auth-card input::placeholder { color: var(--text-3); }
.auth-card input:focus {
  outline: 3px solid var(--brand-primary-soft, #ecfdf5);
  outline-offset: 0;
  border-color: var(--brand-primary, #047857);
  box-shadow: 0 0 0 1px var(--brand-primary, #047857);
}

.auth-password { position: relative; }
.auth-password input[type="password"],
.auth-password input[type="text"] { padding-right: 76px; }
.auth-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  min-width: 64px; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--brand-primary-dark, #065f46);
}
.auth-toggle:hover { background: var(--brand-primary-soft, #ecfdf5); }
.auth-toggle[hidden] { display: none; }

.auth-card .btn-primary {
  width: 100%; margin-top: 22px; min-height: 48px; font-size: 16px;
  background: var(--brand-primary, #047857); border-color: var(--brand-primary, #047857);
  border-radius: 10px; font-weight: 600; color: #fff;
}
.auth-card .btn-primary:hover { background: var(--brand-primary-deeper, #064e3b); }
.auth-card .btn-primary:disabled { opacity: 0.75; cursor: progress; }
.auth-card .btn-ghost { width: 100%; margin-top: 12px; min-height: 44px; border-radius: 10px; justify-content: center; }

.auth-school-chip { display: flex; align-items: center; gap: 12px;
  margin-top: 18px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--brand-primary-soft, #ecfdf5);
}
.auth-school-chip .mark { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-primary, #047857); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.auth-school-chip img.mark { object-fit: cover; background: #fff; }
.auth-school-chip-text { min-width: 0; }
.auth-school-chip .k { font-size: 13px; color: var(--text-2); margin: 0; }
.auth-school-chip .v { font-size: 16px; font-weight: 600; margin: 4px 0 0; }
.auth-school-switch { margin: 4px 0 0; }
.auth-school-chip a, .auth-school-switch a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: 14px; font-weight: 600; color: var(--brand-primary-dark, #065f46);
  text-decoration: underline; text-underline-offset: 3px;
}

.auth-alert {
  margin-top: 16px; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
}
.auth-alert.ok { background: #ecfdf5; color: #065f46; border-color: #d1fae5; }

.auth-help {
  display: none;                       /* shown when "Forgot password?" is followed (#forgot-password) */
  margin-top: 20px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); scroll-margin-top: 16px;
}
.auth-help:target, .auth-help:focus { display: block; border-color: var(--brand-primary, #047857); background: var(--brand-primary-soft, #ecfdf5); outline: none; }
.auth-help-title { margin: 0; font-size: 14px; font-weight: 600; }
.auth-help .auth-hint { margin: 4px 0 0; text-align: left; }

.auth-hint { margin: 16px 0 0; text-align: center; font-size: 14px; color: var(--text-2); line-height: 1.45; }

.auth-trust {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 13px; line-height: 1.45; color: var(--text-2);
}
.auth-trust svg { flex: none; margin-top: 1px; color: var(--brand-primary-dark, #065f46); }

/* ---------- Two columns from 900px ---------- */
@media (min-width: 900px) {
  .auth-layout { display: grid; grid-template-columns: minmax(320px, 42%) 1fr; }
  .auth-aside {
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 40px 40px 36px;
  }
  .auth-aside h1 { margin-top: 32px; font-size: 30px; max-width: 18ch; line-height: 1.2; }
  .auth-lede { margin-top: 12px; font-size: 16px; }
  .auth-points {
    display: grid; gap: 10px; list-style: none; padding: 0; margin: 22px 0 0; max-width: 340px;
  }
  .auth-points li { position: relative; padding-left: 28px; font-size: 15px; line-height: 1.4; }
  .auth-points li::before {
    content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%;
    display: grid; place-items: center; font-size: 11px; font-weight: 700; background: rgba(255, 255, 255, .18);
  }
  .auth-who { display: flex; gap: 8px; flex-wrap: wrap; list-style: none; padding: 0; margin: 22px 0 0; }
  .auth-who li { font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .6); }
  .auth-aside .foot { display: block; font-size: 13px; color: rgba(255, 255, 255, .88); }
  .auth-aside .foot p { margin: 4px 0 0; }
  .auth-aside .foot strong { color: #fff; }
  .auth-motto { font-style: italic; margin: 0 0 10px; }

  .auth-main {
    margin: 0; padding: 40px 32px; align-items: center;
    background:
      radial-gradient(ellipse at top, color-mix(in srgb, var(--brand-primary-soft, #ecfdf5) 80%, transparent), transparent 55%),
      var(--bg);
  }
  .auth-card { align-self: center; padding: 32px 32px 28px; box-shadow: 0 16px 40px -20px rgba(17, 22, 20, .25); }
  .auth-card-head h2 { font-size: 28px; }
}

/* ---------- Per-school theme styles (moved from the template) ---------- */
body.theme-vivid .auth-aside { background: linear-gradient(150deg, var(--brand-primary-deeper), var(--brand-primary) 60%, var(--brand-accent)); }
body.theme-vivid .auth-card { border-top: 5px solid var(--brand-accent); }
body.theme-elegant { background: #fbf8f2; }
body.theme-elegant .auth-aside { background: #fffdf8; color: var(--brand-primary-deeper); border-bottom: 4px solid var(--brand-accent); }
body.theme-elegant .auth-aside h1 { font-family: Georgia, "Times New Roman", serif; }
body.theme-elegant .auth-lede, body.theme-elegant .auth-aside .foot { color: #57534e; }
body.theme-elegant .auth-aside .foot strong { color: var(--brand-primary-deeper); }
body.theme-elegant .auth-points li::before { background: var(--brand-primary-soft); color: var(--brand-primary); }
body.theme-elegant .auth-points li { color: #44403c; }
body.theme-elegant .auth-who li { border-color: currentColor; }
body.theme-elegant .auth-aside .mark { background: var(--brand-primary); color: #fff; border-color: transparent; }
@media (min-width: 900px) {
  body.theme-elegant .auth-aside { border-bottom: 0; border-right: 4px solid var(--brand-accent); }
}

@media (prefers-reduced-motion: reduce) { .auth-page * { transition: none !important; } }

/* ---------- Continue with Google ---------- */
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: #78716c; font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: #e7e5e4; }
.auth-google-holder { min-height: 40px; display: flex; justify-content: center; }
.auth-google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.auth-google-holder > div[id^="g_id"] { display: flex; justify-content: center; }
