:root {
  --navy: #071A3D;
  --royal: #123F91;
  --blue: #087FE5;
  --cyan: #11B8E8;
  --gold: #F5C400;
  --white: #FFFFFF;
  --soft: #F4F7FB;
  --text: #10233F;
  --muted: #6B7A90;
  --card: rgba(255, 255, 255, 0.78);
  --panel: #F4F7FB;
  --line: rgba(255, 255, 255, 0.55);
  --input: rgba(255, 255, 255, 0.92);
  --login-overlay: 0.58;
}

.login-page[data-theme="dark"] {
  --soft: #0b1730;
  --panel: #081226;
  --text: #F4F7FB;
  --muted: #9db0c8;
  --card: rgba(10, 22, 46, 0.72);
  --input: rgba(12, 26, 52, 0.86);
  --line: rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }
html {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}
html, body { height: 100%; margin: 0; }
body.login-page {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--panel);
  min-height: 100%;
  min-height: 100dvh;
}

.login-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 12% 20%, rgba(17, 184, 232, 0.08), transparent 22%),
    radial-gradient(circle at 88% 80%, rgba(245, 196, 0, 0.08), transparent 18%);
}

.login-topbar {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 20;
  display: flex;
  gap: 8px;
}

.login-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  backdrop-filter: blur(16px);
  color: var(--text);
  font: 700 0.82rem Inter, sans-serif;
  cursor: pointer;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 0.45fr) minmax(0, 0.55fr);
}

.login-brand,
.login-panel,
.login-card,
.login-brand-copy,
.login-form {
  min-width: 0;
  max-width: 100%;
}

.login-brand {
  position: relative;
  overflow: hidden;
  color: #fff;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: linear-gradient(160deg, #071A3D 0%, #123F91 58%, #087FE5 100%);
}

.login-brand-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  background-size: cover;
  background-position: center;
}

.login-brand.has-photo .login-brand-photo {
  filter: saturate(1.05);
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    115deg,
    rgba(7, 26, 61, calc(var(--login-overlay) + 0.18)) 0%,
    rgba(18, 63, 145, var(--login-overlay)) 48%,
    rgba(8, 127, 229, calc(var(--login-overlay) * 0.62)) 100%
  );
}

.login-brand-deco {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(135deg, transparent 58%, rgba(245, 196, 0, 0.14) 58.4%, rgba(245, 196, 0, 0.14) 59.2%, transparent 59.6%),
    linear-gradient(160deg, transparent 36%, rgba(17, 184, 232, 0.12) 36.4%, rgba(17, 184, 232, 0.12) 38%, transparent 38.4%);
  pointer-events: none;
}

.login-brand-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: 56px 48px;
}

.login-logo {
  width: 148px;
  max-width: 42%;
  height: auto;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin-bottom: 22px;
}

.login-school {
  margin: 0;
  font-family: "Plus Jakarta Sans", Inter, sans-serif;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.login-motto {
  margin: 10px 0 0;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.login-tagline {
  margin: 18px 0 0;
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.88);
}

.login-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
}

.login-values li {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.78rem;
  font-weight: 700;
}

.login-panel {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 100%;
  padding: 72px 28px 36px;
  background:
    radial-gradient(circle at 80% 12%, rgba(17, 184, 232, 0.12), transparent 26%),
    var(--panel);
}

.login-card {
  width: min(100%, 460px);
  max-width: 100%;
  padding: 36px 34px 28px;
  border-radius: 28px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(7, 26, 61, 0.14);
  backdrop-filter: blur(20px);
  animation: loginIn 0.45s ease;
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.login-hello { margin: 0; font-size: 1.05rem; font-weight: 600; }
.login-card h1 {
  margin: 6px 0 4px;
  font-family: "Plus Jakarta Sans", Inter, sans-serif;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.92rem; }

.login-alert {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.88rem;
}
.login-alert-error { background: #fef3f2; color: #b42318; }
.login-alert-success { background: #ecfdf3; color: #067647; }
.login-alert-info { background: #eff8ff; color: #175cd3; }
.login-page[data-theme="dark"] .login-alert-error { background: rgba(180, 35, 24, 0.18); }
.login-page[data-theme="dark"] .login-alert-info { background: rgba(8, 127, 229, 0.16); }

.login-field { display: block; margin-bottom: 14px; }
.login-field > span:first-child {
  display: block;
  margin-bottom: 6px;
  font-size: 0.84rem;
  font-weight: 700;
}

.login-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  min-height: 52px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid #d7e3f2;
  background: var(--input);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-control svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: #6B7A90;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-control input {
  flex: 1;
  border: 0;
  background: transparent;
  font: 500 0.95rem Inter, sans-serif;
  color: var(--text);
  outline: none;
  min-width: 0;
}

.login-control:focus-within {
  border-color: #087FE5;
  box-shadow: 0 0 0 4px rgba(8, 127, 229, 0.16);
}

.login-eye {
  border: 0;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  color: #6B7A90;
}

.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 16px;
  font-size: 0.86rem;
}

.login-remember { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.login-link {
  border: 0;
  background: none;
  color: #123F91;
  font: 700 0.86rem Inter, sans-serif;
  cursor: pointer;
  padding: 0;
}
.login-page[data-theme="dark"] .login-link { color: #11B8E8; }

.login-submit {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  font: 800 1rem "Plus Jakarta Sans", Inter, sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: linear-gradient(90deg, #11B8E8 0%, #087FE5 42%, #123F91 78%, #071A3D 100%);
  box-shadow: 0 12px 24px rgba(8, 127, 229, 0.28);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.login-submit:hover { filter: brightness(1.06); transform: translateY(-1px); }
.login-submit:active { filter: brightness(0.92); transform: none; }
.login-submit.is-loading {
  pointer-events: none;
  filter: brightness(0.86);
}
.login-submit.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
}
.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #d7e3f2;
}

.login-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.login-sso {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid #d7e3f2;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 700 0.88rem Inter, sans-serif;
  cursor: pointer;
  color: #10233F;
}
.login-sso svg { width: 16px; height: 16px; }
.login-sso:hover { border-color: #087FE5; }

.login-roles { margin: 18px 0 8px; }
.login-roles p { margin: 0 0 8px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.login-seg {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(8, 127, 229, 0.08);
}
.login-seg button {
  border: 0;
  background: transparent;
  min-height: 36px;
  border-radius: 10px;
  font: 700 0.82rem Inter, sans-serif;
  color: var(--muted);
  cursor: pointer;
}
.login-seg button.is-active {
  color: #fff;
  background: linear-gradient(90deg, #11B8E8, #123F91);
}

.login-card blockquote {
  margin: 18px 0 8px;
  text-align: center;
  font-style: italic;
  color: var(--muted);
  font-size: 0.92rem;
}
.login-copy {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.74rem;
}

@media (max-width: 980px) {
  .login-shell { grid-template-columns: minmax(0, 0.38fr) minmax(0, 0.62fr); }
  .login-brand-copy { padding: 36px 24px; }
  .login-logo { width: 110px; max-width: 100%; }
}

@media (max-width: 767px) {
  .login-page {
    overflow-x: clip;
  }
  .login-topbar {
    top: max(10px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    left: auto;
  }
  .login-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    grid-template-columns: none;
  }
  .login-brand {
    min-height: 200px;
    max-height: 240px;
    height: 220px;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
  }
  .login-brand-copy {
    min-height: 100%;
    justify-content: flex-end;
    padding: 18px max(20px, env(safe-area-inset-left)) 16px max(20px, env(safe-area-inset-right));
  }
  .login-logo {
    width: 72px;
    max-width: 28%;
    height: auto;
    margin-bottom: 8px;
  }
  .login-school { font-size: 1.12rem; line-height: 1.2; }
  .login-motto { letter-spacing: 0.08em; font-size: 0.68rem; }
  .login-tagline { font-size: 0.9rem; margin-top: 6px; }
  .login-values { display: none; }
  .login-panel {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 16px max(20px, env(safe-area-inset-left)) 28px max(20px, env(safe-area-inset-right));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }
  .login-card {
    width: 100%;
    max-width: 100%;
    padding: 22px 0 8px;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    backdrop-filter: none;
    animation: none;
  }
  .login-card h1 { font-size: 1.28rem; }
  .login-control,
  .login-submit,
  .login-sso,
  .login-field,
  .login-form {
    width: 100%;
    max-width: 100%;
  }
  .login-alt { grid-template-columns: 1fr 1fr; }
  .login-seg { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
  .login-seg button { min-width: 0; overflow-wrap: anywhere; }
}

@media (max-width: 390px) {
  .login-brand {
    height: 180px;
    max-height: 200px;
    min-height: 180px;
  }
  .login-school { font-size: 1.02rem; }
  .login-alt { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .login-brand {
    height: 168px;
    min-height: 168px;
  }
  .login-hello { font-size: 0.95rem; }
  .login-card h1 { font-size: 1.12rem; }
}
