:root{
  --auth-navy:#17396f;
  --auth-text:#153568;
  --auth-muted:#63749a;
  --auth-blue:#3987ff;
  --auth-purple:#8667f3;
  --auth-pink:#ff65ad;
  --auth-white:rgba(255,255,255,.86);
  --auth-line:rgba(255,255,255,.78);
  --auth-shadow:0 28px 80px rgba(77,101,160,.25);
}
*{box-sizing:border-box}
html,body{min-height:100%}
body.auth-page{
  margin:0;
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  overflow-x:hidden;
  color:var(--auth-text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  background:
    linear-gradient(rgba(248,251,255,.10),rgba(251,244,252,.16)),
    url('../images/admin-login-campus-bg.webp') center/cover fixed no-repeat;
  position:relative;
}
body.auth-page::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(700px 420px at 12% 8%,rgba(75,155,255,.18),transparent 65%),
    radial-gradient(650px 390px at 92% 12%,rgba(255,111,180,.20),transparent 62%),
    linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,243,250,.16));
}
.auth-petal{
  position:fixed;
  width:16px;
  height:10px;
  border-radius:100% 0 100% 0;
  background:linear-gradient(135deg,#ff9ccc,#ffd6e9);
  opacity:.62;
  pointer-events:none;
  animation:authFloat 8s ease-in-out infinite;
  z-index:0;
}
.auth-petal.p1{left:8%;top:15%;animation-delay:-1s}
.auth-petal.p2{right:11%;top:22%;animation-delay:-4s;transform:rotate(30deg)}
.auth-petal.p3{left:15%;bottom:13%;animation-delay:-6s;transform:rotate(70deg)}
.auth-petal.p4{right:17%;bottom:10%;animation-delay:-2s;transform:rotate(110deg)}
@keyframes authFloat{
  0%,100%{translate:0 0;rotate:0deg}
  50%{translate:8px -16px;rotate:18deg}
}
.auth-card{
  width:min(620px,100%);
  position:relative;
  z-index:1;
  overflow:hidden;
  border:1px solid var(--auth-line);
  border-radius:34px;
  background:
    linear-gradient(180deg,rgba(255,255,255,.82),rgba(255,248,253,.68)),
    rgba(255,255,255,.64);
  box-shadow:var(--auth-shadow);
  backdrop-filter:blur(24px) saturate(130%);
  -webkit-backdrop-filter:blur(24px) saturate(130%);
  padding:34px 38px 30px;
  animation:authEnter .55s cubic-bezier(.2,.8,.2,1) both;
}
.auth-card::before{
  content:"";
  position:absolute;
  inset:0 0 auto 0;
  height:180px;
  pointer-events:none;
  background:linear-gradient(180deg,rgba(206,231,255,.50),transparent);
}
.auth-card > *{position:relative;z-index:2}
@keyframes authEnter{
  from{opacity:0;transform:translateY(18px) scale(.985)}
  to{opacity:1;transform:none}
}
.auth-brand{
  display:flex;
  justify-content:center;
  margin-bottom:14px;
}
.auth-logo{
  width:92px;
  height:92px;
  border-radius:50%;
  display:grid;
  place-items:center;
  overflow:hidden;
  background:rgba(255,255,255,.88);
  border:1px solid rgba(255,255,255,.95);
  box-shadow:0 14px 30px rgba(75,109,177,.16);
  color:var(--auth-navy);
  font-size:30px;
  font-weight:900;
}
.auth-logo img{width:100%;height:100%;object-fit:contain;padding:8px}
.auth-title{
  margin:0;
  text-align:center;
  font-size:clamp(30px,4vw,43px);
  line-height:1.12;
  letter-spacing:-.035em;
  color:var(--auth-navy);
}
.auth-title::after{
  content:"";
  display:block;
  width:38px;
  height:5px;
  margin:13px auto 0;
  border-radius:999px;
  background:linear-gradient(90deg,var(--auth-pink),#ff8bc3);
}
.auth-subtitle{
  margin:14px auto 0;
  max-width:360px;
  text-align:center;
  color:#455d8c;
  font-size:15px;
  line-height:1.65;
}
.auth-message{
  margin:18px 0 0;
  padding:13px 15px;
  border-radius:16px;
  font-size:13px;
  line-height:1.55;
  border:1px solid rgba(80,132,221,.20);
  background:rgba(234,244,255,.80);
  color:#274d83;
}
.auth-message.error,.auth-message.danger{border-color:rgba(232,76,114,.23);background:rgba(255,235,242,.88);color:#9b2f52}
.auth-message.success{border-color:rgba(46,166,119,.23);background:rgba(234,250,244,.88);color:#236c55}
.auth-message.warning{border-color:rgba(232,162,55,.25);background:rgba(255,247,228,.90);color:#89601d}
.auth-form{display:grid;gap:16px;margin-top:24px}
.auth-field{
  min-height:66px;
  display:flex;
  align-items:center;
  gap:14px;
  padding:0 18px;
  border-radius:17px;
  border:1px solid rgba(255,255,255,.95);
  background:rgba(255,255,255,.86);
  box-shadow:0 11px 24px rgba(79,104,165,.10);
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease;
}
.auth-field:focus-within{
  border-color:rgba(63,134,255,.48);
  box-shadow:0 0 0 4px rgba(63,134,255,.12),0 14px 28px rgba(79,104,165,.13);
  transform:translateY(-1px);
}
.auth-field svg{width:25px;height:25px;flex:0 0 auto;stroke-width:2;color:var(--auth-blue)}
.auth-field.password svg{color:var(--auth-pink)}
.auth-field input{
  width:100%;
  min-width:0;
  border:0;
  outline:0;
  background:transparent;
  color:#294774;
  font:inherit;
  font-size:16px;
  font-weight:650;
}
.auth-field input::placeholder{color:#7b89a8;font-weight:550}
.auth-toggle{
  border:0;
  background:transparent;
  color:#7182a7;
  padding:8px;
  cursor:pointer;
  line-height:0;
  border-radius:10px;
}
.auth-toggle:hover{background:#eef4ff;color:#3a6fc0}
.auth-toggle svg{width:23px;height:23px;color:currentColor}
.auth-link-row{display:flex;justify-content:flex-end;margin-top:-4px}
.auth-link{color:#2875e8;text-decoration:none;font-size:14px;font-weight:800}
.auth-link:hover{text-decoration:underline}
.auth-primary{
  min-height:62px;
  border:0;
  border-radius:17px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  color:#fff;
  background:linear-gradient(100deg,var(--auth-blue),var(--auth-purple) 50%,var(--auth-pink));
  box-shadow:0 15px 30px rgba(103,107,226,.24);
  font:inherit;
  font-size:16px;
  font-weight:900;
  cursor:pointer;
  transition:transform .16s ease,box-shadow .16s ease,filter .16s ease;
}
.auth-primary:hover{transform:translateY(-2px);box-shadow:0 19px 36px rgba(103,107,226,.30);filter:saturate(1.06)}
.auth-primary svg{width:22px;height:22px}
.auth-divider{display:flex;align-items:center;gap:16px;color:#66799f;font-size:14px;margin:2px 0}
.auth-divider::before,.auth-divider::after{content:"";height:1px;flex:1;background:linear-gradient(90deg,transparent,rgba(93,116,163,.22),transparent)}
.auth-secondary,.auth-back{
  min-height:55px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.95);
  background:rgba(255,255,255,.72);
  color:#365681;
  text-decoration:none;
  font-size:15px;
  font-weight:850;
  box-shadow:0 10px 24px rgba(82,104,156,.08);
  transition:transform .16s ease,background .16s ease;
}
.auth-secondary:hover,.auth-back:hover{transform:translateY(-1px);background:#fff}
.auth-secondary svg,.auth-back svg{width:21px;height:21px}
.auth-top-actions{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:18px}
.auth-back{min-height:43px;padding:0 15px;width:auto;font-size:13px}
.auth-home-mini{margin-left:auto;width:43px;height:43px;padding:0;border-radius:14px}
.auth-note{
  margin-top:17px;
  padding:13px 14px;
  border-radius:15px;
  color:#66799c;
  background:rgba(255,255,255,.48);
  border:1px solid rgba(255,255,255,.76);
  font-size:12px;
  line-height:1.6;
  text-align:center;
}
.auth-label{display:block;margin-bottom:7px;color:#365582;font-size:13px;font-weight:800}
.auth-field-wrap{display:block}
.auth-decor{
  position:absolute;
  z-index:1;
  bottom:-5px;
  width:200px;
  pointer-events:none;
  user-select:none;
  opacity:.94;
  filter:saturate(.96);
  -webkit-mask-image:radial-gradient(ellipse at center,#000 48%,transparent 78%);
  mask-image:radial-gradient(ellipse at center,#000 48%,transparent 78%);
}
.auth-decor.books{left:-18px}
.auth-decor.backpack{right:-18px;width:205px}
.login-card{padding-bottom:120px}
.login-card .auth-form{position:relative;z-index:3}
.compact-card{width:min(540px,100%)}
.compact-card .auth-title{font-size:clamp(28px,4vw,37px)}
.compact-card .auth-logo{width:80px;height:80px}
@media(max-width:680px){
  body.auth-page{padding:16px;background-attachment:scroll}
  .auth-card{border-radius:28px;padding:27px 22px 25px}
  .login-card{padding-bottom:28px}
  .auth-decor{display:none}
  .auth-logo{width:78px;height:78px}
  .auth-field{min-height:59px;padding:0 14px}
  .auth-primary{min-height:58px}
}
@media(max-width:420px){
  body.auth-page{padding:10px}
  .auth-card{border-radius:24px;padding:22px 16px}
  .auth-title{font-size:29px}
  .auth-subtitle{font-size:14px}
  .auth-field input{font-size:15px}
  .auth-top-actions{align-items:stretch}
}
@media(prefers-reduced-motion:reduce){
  .auth-card,.auth-petal{animation:none}
  .auth-primary,.auth-field,.auth-secondary,.auth-back{transition:none}
}

/* ================================================================
   ADMIN LOGIN VIEWPORT FIT
   Keeps the complete sign-in interface visible without page scrolling.
   ================================================================ */
html.admin-login-root,
html:has(body.auth-page){
  width:100%;
  height:100%;
  min-height:100%;
  overflow:hidden !important;
  overscroll-behavior:none;
}
body.auth-page{
  width:100%;
  height:100vh;
  height:100svh;
  height:100dvh;
  min-height:100vh;
  min-height:100svh;
  min-height:100dvh;
  max-height:100vh;
  max-height:100svh;
  max-height:100dvh;
  overflow:hidden !important;
  overscroll-behavior:none;
  padding:clamp(8px,1.5vh,18px);
  display:flex;
  align-items:center;
  justify-content:center;
}

/* Background Studio injects a general sibling rule. Keep decorative petals
   fixed so they never become layout items or increase the page height. */
body.auth-page .auth-petal{
  position:fixed !important;
}

body.auth-page .auth-card{
  --auth-fit-scale:1;
  width:min(460px,calc(100vw - 20px));
  max-width:460px;
  max-height:none;
  flex:0 0 auto;
  transform-origin:center center;
  animation:authEnterFit .42s cubic-bezier(.2,.8,.2,1) both;
  padding:clamp(14px,2vh,22px) clamp(16px,2.4vw,26px) clamp(14px,2vh,20px);
  border-radius:clamp(20px,2.6vh,26px);
}

@keyframes authEnterFit{
  from{opacity:0;transform:scale(var(--auth-fit-scale)) translateY(10px)}
  to{opacity:1;transform:scale(var(--auth-fit-scale)) translateY(0)}
}

body.auth-page .auth-brand{margin-bottom:clamp(7px,1.4vh,12px)}
body.auth-page .auth-logo{
  width:clamp(52px,8.5vh,68px);
  height:clamp(52px,8.5vh,68px);
}
body.auth-page .auth-title{
  font-size:clamp(25px,4vh,32px);
  line-height:1.08;
}
body.auth-page .auth-title::after{
  height:4px;
  margin:clamp(7px,1.2vh,11px) auto 0;
}
body.auth-page .auth-subtitle{
  margin:clamp(7px,1.2vh,12px) auto 0;
  font-size:clamp(13px,1.9vh,15px);
  line-height:1.45;
}
body.auth-page .auth-message{
  margin:clamp(8px,1.3vh,14px) 0 0;
  padding:clamp(9px,1.3vh,12px) 13px;
  line-height:1.4;
}
body.auth-page .auth-form{
  gap:clamp(8px,1.25vh,13px);
  margin-top:clamp(11px,1.8vh,18px);
}
body.auth-page .auth-field{
  min-height:clamp(44px,6.3vh,52px);
  padding:0 clamp(14px,2vw,18px);
  border-radius:15px;
}
body.auth-page .auth-field svg{width:22px;height:22px}
body.auth-page .auth-field input{font-size:clamp(14px,2vh,16px)}
body.auth-page .auth-link-row{margin-top:-2px}
body.auth-page .auth-link{font-size:13px}
body.auth-page .auth-primary{
  min-height:clamp(44px,6.3vh,50px);
  border-radius:15px;
}
body.auth-page .auth-divider{margin:0}
body.auth-page .auth-secondary{
  min-height:clamp(42px,5.9vh,48px);
  border-radius:15px;
}

/* Decorative images stay inside the card without adding extra card height. */
body.auth-page .login-card{padding-bottom:clamp(16px,2.2vh,24px)}
body.auth-page .auth-decor{
  width:108px;
  bottom:-25px;
  opacity:.28;
  z-index:1;
}
body.auth-page .auth-decor.books{left:-20px}
body.auth-page .auth-decor.backpack{right:-20px;width:112px}
body.auth-page .login-card .auth-form{position:relative;z-index:3}

@media(max-height:720px){
  body.auth-page .auth-card{padding-top:14px;padding-bottom:14px}
  body.auth-page .auth-logo{width:58px;height:58px}
  body.auth-page .auth-title{font-size:29px}
  body.auth-page .auth-subtitle{margin-top:6px;font-size:13px}
  body.auth-page .auth-form{margin-top:10px;gap:8px}
  body.auth-page .auth-field{min-height:48px}
  body.auth-page .auth-primary{min-height:47px}
  body.auth-page .auth-secondary{min-height:44px}
  body.auth-page .auth-decor{display:none}
}

@media(max-height:560px){
  body.auth-page{padding:6px}
  body.auth-page .auth-card{width:min(450px,calc(100vw - 12px));padding:9px 16px;border-radius:18px}
  body.auth-page .auth-brand{margin-bottom:4px}
  body.auth-page .auth-logo{width:46px;height:46px}
  body.auth-page .auth-logo img{padding:5px}
  body.auth-page .auth-title{font-size:25px}
  body.auth-page .auth-title::after{width:30px;height:3px;margin-top:5px}
  body.auth-page .auth-subtitle{margin-top:5px;font-size:12px;line-height:1.3}
  body.auth-page .auth-message{margin-top:6px;padding:7px 10px;font-size:12px}
  body.auth-page .auth-form{margin-top:7px;gap:6px}
  body.auth-page .auth-field{min-height:42px;border-radius:12px;padding:0 12px}
  body.auth-page .auth-field svg{width:19px;height:19px}
  body.auth-page .auth-field input{font-size:13px}
  body.auth-page .auth-link{font-size:12px}
  body.auth-page .auth-primary{min-height:41px;border-radius:12px;font-size:14px}
  body.auth-page .auth-secondary{min-height:39px;border-radius:12px;font-size:13px}
  body.auth-page .auth-divider{font-size:12px;gap:10px}
}

@media(max-width:680px){
  body.auth-page{padding:8px}
  body.auth-page .auth-card{width:min(450px,calc(100vw - 16px));padding-left:16px;padding-right:16px}
}

@media(max-width:420px){
  body.auth-page{padding:6px}
  body.auth-page .auth-card{width:calc(100vw - 12px);padding-left:14px;padding-right:14px}
}
