/* Chelmsford Academy school-code login - navy/yellow */
.auth-code-page{min-height:100vh;background:#f4f7fa;font-family:Poppins,Arial,sans-serif;color:#17324d}.auth-code-page *{box-sizing:border-box}.auth-top{height:72px;background:#1a536e;color:#fff;display:flex;align-items:center;padding:0 7%;gap:28px}.auth-tabs{height:100%;display:flex;align-items:stretch;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none;flex:1 1 auto;min-width:0}.auth-tabs::-webkit-scrollbar{display:none}.auth-tabs a{color:#fff;text-decoration:none;padding:25px 22px;font-weight:700;white-space:nowrap;flex:0 0 auto;display:flex;align-items:center;gap:9px}.auth-tabs a i{font-size:14px}.auth-tabs a.active{background:#f4c400;color:#1a536e}.auth-tabs a.auth-tab-soon{opacity:.55;cursor:not-allowed}.auth-main{min-height:calc(100vh - 72px);display:grid;grid-template-columns:1fr 1fr;background-size:cover;background-position:center;position:relative}.auth-main:before{content:"";position:absolute;inset:0;background:rgba(255,255,255,.86)}.auth-panel,.auth-photo{position:relative;z-index:1}.auth-panel{display:flex;align-items:center;justify-content:center;padding:45px 7%}.auth-card{width:min(560px,100%);background:#fff;padding:42px 48px;border-radius:10px;box-shadow:0 12px 35px rgba(0,59,99,.12)}.auth-school-logo{width:82px;height:82px;object-fit:contain;border-radius:8px;display:block;margin:0 auto 15px}.auth-card h1{text-align:center;color:#1a536e;margin:0;font-size:30px}.auth-motto{text-align:center;color:#64778a;margin:7px 0 28px}.auth-card h2{color:#1a536e;font-size:23px;margin:0 0 8px}.auth-help{color:#687b8d;font-size:14px;margin:0 0 20px}.auth-field{margin-bottom:17px}.auth-field label{display:block;font-weight:700;margin-bottom:7px;color:#294761}.auth-field input,.auth-field select{width:100%;height:48px;border:1px solid #d4dee6;border-radius:6px;padding:0 14px;font-size:15px;outline:none}.auth-field input:focus,.auth-field select:focus{border-color:#1a536e;box-shadow:0 0 0 3px rgba(244,196,0,.2)}.auth-btn{width:100%;height:50px;border:0;border-radius:6px;background:#1a536e;color:#fff;font-weight:800;font-size:16px;cursor:pointer}.auth-btn:hover{background:#f4c400;color:#1a536e}.auth-secondary{background:#f4c400;color:#1a536e}.auth-code-row{display:flex;gap:10px}.auth-code-row input{flex:1;text-transform:uppercase;font-weight:700;letter-spacing:1px}.auth-code-row button{width:125px;border:0;border-radius:6px;background:#1a536e;color:#fff;font-weight:700}.auth-status{font-size:13px;margin-top:8px;min-height:20px}.auth-status.ok{color:#16733a}.auth-status.bad{color:#b42318}.auth-hidden{display:none!important}.auth-photo{min-height:650px;background:#dce8ef center/cover no-repeat;display:flex;align-items:center;justify-content:center}.auth-photo img{width:100%;height:100%;object-fit:cover}.auth-links{text-align:center;margin-top:20px;font-size:14px}.auth-links a{color:#1a536e;font-weight:700;text-decoration:none}.auth-footer{text-align:center;color:#718397;font-size:13px;padding:18px}.auth-back{display:inline-block;margin-bottom:20px;color:#1a536e;text-decoration:none;font-weight:700}.auth-error{background:#fff0ef;color:#b42318;padding:11px 13px;border-radius:6px;margin-bottom:18px;font-size:14px}.auth-success{background:#edf9f1;color:#16733a;padding:11px 13px;border-radius:6px;margin-bottom:18px;font-size:14px}@media(max-width:850px){.auth-top{padding:0 16px}.auth-main{grid-template-columns:1fr}.auth-photo{display:none}.auth-panel{padding:30px 18px}.auth-card{padding:30px 22px}.auth-tabs a{padding:25px 14px;font-size:12.5px}.auth-tabs a i{font-size:14px}}
@media(max-width:600px){.auth-tabs{overflow-x:visible;justify-content:space-between}.auth-tabs a{padding:0;flex:1 1 0;justify-content:center;gap:0}.auth-tabs a .tab-label{display:none}.auth-tabs a i{font-size:19px}}

/* =======================================================================
   Login page layout (school-code entry + staff login form)
   Single source of truth — replaces the stacked v7-v13 override history.
   The code-entry step and the login form share the SAME .auth-card, so
   they always render at the same width by construction.
   ======================================================================= */

html.auth-code-html,body.auth-code-page{height:100%}
body.auth-code-page{margin:0;overflow-x:hidden;background:#000}

/* Use the real (address-bar-aware) viewport height so mobile browser
   chrome never leaves a sliver of the page below the fold — that
   mismatch between 100vh and the actual visible area was the source
   of the phantom scroll. dvh falls back harmlessly to vh support. */
body.auth-code-page .auth-main{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  height:calc(100vh - 72px);
  height:calc(100dvh - 72px);
  padding:0 clamp(16px,5vw,60px);
  box-sizing:border-box;
  background:none;
  overflow:hidden;
}

body.auth-code-page .auth-full-bg{
  position:absolute;
  inset:0;
  z-index:0;
  width:100%;
  height:100%;
  background:#dce8ef;
  overflow:hidden;
}
body.auth-code-page .auth-full-bg img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
}

/* Floating card — sized to its own content instead of a guessed vh cap.
   A fixed max-height clipped real fields off-screen on ordinary
   viewports; here every dimension below (logo, headings, spacing,
   field height) scales with viewport height via clamp(), so the whole
   card reliably fits without cutting anything off or needing to
   scroll. overflow is a safety net only — it should never engage. */
body.auth-code-page .auth-panel{
  position:relative;
  z-index:2;
  width:100%;
  max-width:400px;
  max-height:100%;
  margin:0;
  padding:clamp(12px,3vh,28px) clamp(20px,4vw,40px);
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow-y:auto;
  background:#fff;
  border:0;
  border-radius:16px;
  box-shadow:0 18px 48px rgba(0,0,0,.20);
}

body.auth-code-page .auth-card{
  width:100%;
  max-width:100%;
  margin:auto;
  padding:0;
  background:transparent;
  border:0;
  border-radius:0;
  box-shadow:none;
  text-align:center;
}

body.auth-code-page .auth-school-logo.chelmsford-big-logo{
  display:block;
  width:clamp(126px,22vh,280px);
  max-width:72%;
  height:auto;
  margin:0 auto clamp(6px,1.2vh,12px);
  object-fit:contain;
}
body.auth-code-page .form-school-crest{
  display:block;
  width:clamp(60px,11vh,112px);
  height:clamp(60px,11vh,112px);
  margin:0 auto clamp(6px,1.2vh,12px);
  object-fit:contain;
  background:#fff;
  padding:6px;
  border:1px solid #e4eaf0;
  border-radius:10px;
}

body.auth-code-page .auth-card h1{font-size:clamp(15px,2.4vh,20px);line-height:1.2;margin:0 0 clamp(3px,0.6vh,6px);color:#1a536e}
body.auth-code-page .auth-card h2{font-size:clamp(14px,2.1vh,17px);line-height:1.2;margin:0 0 5px;color:#1a536e}
body.auth-code-page .auth-motto{font-size:clamp(11px,1.6vh,13px);margin:clamp(2px,0.4vh,3px) 0 clamp(8px,1.8vh,14px)}
body.auth-code-page .auth-help{font-size:clamp(11px,1.6vh,13px);margin:0 0 clamp(6px,1.4vh,12px)}

/* Form fields — identical box model whether this is the code-entry step
   or the email/password step, so both stay the same width as the card.
   Heights and gaps scale down on shorter viewports instead of clipping. */
body.auth-code-page .auth-field{width:100%;text-align:left;margin-bottom:clamp(6px,1.4vh,11px);box-sizing:border-box}
body.auth-code-page .auth-field label{display:block;margin-bottom:3px;font-size:12px;color:#36536b}
body.auth-code-page .auth-field input,
body.auth-code-page .auth-field select{width:100%;height:clamp(36px,6vh,44px);font-size:14px;box-sizing:border-box}

body.auth-code-page .auth-code-row{display:flex;width:100%;gap:10px;box-sizing:border-box}
body.auth-code-page .auth-code-row input{flex:1 1 auto;min-width:0;height:clamp(36px,6vh,44px);font-size:14px;box-sizing:border-box}
body.auth-code-page .auth-code-row button{flex:0 0 auto;width:110px;height:clamp(36px,6vh,44px);font-size:14px}

body.auth-code-page .auth-btn,
body.auth-code-page .auth-code-row button{
  border:0;
  border-radius:6px;
  background:#1a536e;
  color:#fff;
  font-weight:700;
  cursor:pointer;
}
body.auth-code-page .auth-btn{height:clamp(38px,6vh,50px)}
body.auth-code-page .auth-btn:hover,
body.auth-code-page .auth-code-row button:hover{background:#f4c400;color:#1a536e}

body.auth-code-page .auth-links{margin-top:clamp(6px,1.4vh,12px);font-size:12px}
body.auth-code-page .auth-links a{color:#1a536e}
body.auth-code-page .auth-footer{display:none}
body.auth-code-page.school-code-verified .auth-links a[href="super_admin_login.php"]{display:none}

/* Responsive — width breakpoints only affect side padding; the card's
   own height rules above already adapt to any viewport height. */
@media(max-width:850px){
  body.auth-code-page .auth-main{
    justify-content:center;
    align-items:center;
    padding:16px;
  }
  body.auth-code-page .auth-panel{
    width:100%;
    max-width:400px;
  }
}

@media(max-width:480px){
  body.auth-code-page .auth-main{padding:12px}
  body.auth-code-page .auth-panel{
    border-radius:12px;
  }
}

/* Extra-short viewports (landscape phones, small browser windows):
   trim the parts that aren't essential to logging in rather than
   ever letting the card scroll or clip. */
@media(max-height:640px){
  body.auth-code-page .auth-school-logo.chelmsford-big-logo{width:clamp(90px,15vh,150px);margin-bottom:4px}
  body.auth-code-page .form-school-crest{width:clamp(48px,9vh,68px);height:clamp(48px,9vh,68px);margin-bottom:4px}
  body.auth-code-page .auth-motto{margin:2px 0 6px}
}

/* School without its own login image: use the school's dashboard colour instead of the platform default photo. */
body.auth-code-page.auth-themed-bg{background:var(--school-primary,#1a536e)}
body.auth-code-page.auth-themed-bg .auth-full-bg{background:linear-gradient(135deg,var(--school-primary-dark,var(--school-primary,#1a536e)),var(--school-primary,#1a536e))!important}
