/* Mahal's existing green identity, photography and self-hosted fonts.
   Shape scale: 12px controls; 4px native checkbox. Layering: photograph,
   scrim and content follow DOM order, with a local isolation context. */
:root {
  color-scheme: light dark;
  --surface: #fcfdfa;
  --field: #f5f8f2;
  --ink: #203c28;
  --muted: #5d6b5f;
  --line: #d5ded1;
  --accent: #2f6d22;
  --accent-hover: #265a1c;
  --on-accent: #fbfdf8;
  --focus: #35762a;
  --error: #a62d29;
  --error-surface: #fff1ee;
  --shadow: #284d2520;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
button, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.13fr) minmax(440px, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.brand-panel {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  overflow: hidden;
  padding: clamp(32px, 4.3vw, 72px);
  color: #fbfff6;
  background: #153b27;
}

.brand-photo, .brand-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}
.brand-photo {
  display: block;
  object-fit: cover;
  object-position: 56% 42%;
}
.brand-shade {
  background: linear-gradient(180deg, #0d2d23c9 0%, #123e2510 38%, #123a2475 62%, #0c2b20f5 100%);
}
.brand-signature img {
  display: block;
  width: clamp(172px, 16vw, 225px);
  height: auto;
  filter: brightness(0) invert(1);
}
.brand-story { padding-top: 280px; }
.brand-story h2 {
  margin: 0;
  max-width: 9ch;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: clamp(48px, 5.1vw, 78px);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: 1.01;
  text-wrap: balance;
}
.brand-story p {
  margin: 24px 0 0;
  color: #ecf4e5;
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: .01em;
}

.entry-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 38px clamp(35px, 5.1vw, 88px) 29px;
  background: var(--surface);
}
.panel-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.entry-content {
  width: 100%;
  max-width: 390px;
  margin: 48px auto 30px;
}
.entry-logo {
  display: block;
  width: 210px;
  height: auto;
  margin-bottom: 47px;
}
.welcome { margin-bottom: 34px; }
.welcome h1 {
  margin: 0;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: clamp(36px, 3.6vw, 49px);
  font-weight: 500;
  letter-spacing: -.05em;
  line-height: 1.1;
}
.welcome p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.password-field > label {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 650;
}
.password-control {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 57px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.password-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--shadow);
}
.password-control input {
  width: 100%;
  min-width: 0;
  height: 55px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
}
.password-control input::placeholder {
  color: var(--muted);
  opacity: 1;
  font-size: 13px;
}
.password-control input:focus-visible { outline-offset: 4px; }
.password-control input::-ms-reveal { display: none; }
.password-toggle {
  flex: none;
  min-width: 64px;
  min-height: 44px;
  margin-right: 5px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.password-toggle:hover { background: var(--shadow); }
.field-notice, .form-error {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.6;
}
.field-notice { color: var(--muted); }
.form-error {
  padding: 11px 13px;
  border-radius: 8px;
  background: var(--error-surface);
  color: var(--error);
}
.remember-option {
  display: flex;
  align-items: center;
  width: fit-content;
  min-height: 44px;
  gap: 10px;
  margin-top: 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.remember-option input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.remember-help {
  max-width: 30ch;
  margin: -2px 0 25px 28px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}
.submit-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 5px 12px var(--shadow);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  transition: background .18s, transform .18s;
}
.submit-button:hover { background: var(--accent-hover); }
.submit-button:active { transform: translateY(1px); }
.submit-button:disabled { cursor: wait; opacity: .8; }
.submit-arrow { font-size: 25px; line-height: 1; font-weight: 400; }
.submit-status {
  min-height: 20px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.entry-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.7;
}
.entry-footer span { opacity: .55; }

@media (prefers-reduced-motion: no-preference) {
  .entry-content { animation: entry-in .65s cubic-bezier(.16,1,.3,1) both; }
  .brand-story { animation: entry-in .85s .1s cubic-bezier(.16,1,.3,1) both; }
  .submit-arrow { transition: transform .2s; }
  .submit-button:hover .submit-arrow { transform: translateX(3px); }
  @keyframes entry-in {
    from { opacity: 0; transform: translateY(13px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (min-width: 1600px) {
  .entry-panel { padding-right: clamp(88px, 8vw, 160px); padding-left: clamp(88px, 8vw, 160px); }
  .entry-content { max-width: 420px; }
}

@media (max-width: 900px) and (min-width: 768px) {
  .login-layout { grid-template-columns: minmax(0, .85fr) minmax(390px, 1fr); }
  .brand-panel { padding: 34px 27px; }
  .brand-story h2 { font-size: 52px; }
  .entry-panel { padding-inline: 32px; }
}

@media (max-width: 767px), (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  .login-layout {
    --mobile-hero-height: 196px;
    display: block;
  }
  .brand-panel {
    min-height: var(--mobile-hero-height);
    padding: 24px;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-right: max(24px, env(safe-area-inset-right));
    padding-left: max(24px, env(safe-area-inset-left));
  }
  .brand-photo { object-position: 54% 45%; }
  .brand-shade { background: linear-gradient(90deg, #0d2d23db, #123e2540 75%, #123a2420); }
  .brand-signature { display: none; }
  .brand-story { padding-top: 24px; }
  .brand-story h2 { max-width: 8ch; font-size: 39px; }
  .brand-story p { margin-top: 14px; font-size: 11px; }
  .entry-panel {
    min-height: calc(100vh - var(--mobile-hero-height));
    min-height: calc(100dvh - var(--mobile-hero-height));
    padding: 23px 26px 23px;
    padding-right: max(26px, env(safe-area-inset-right));
    padding-bottom: max(23px, env(safe-area-inset-bottom));
    padding-left: max(26px, env(safe-area-inset-left));
  }
  .panel-label { display: none; }
  .entry-content { max-width: 430px; margin: 12px auto 16px; }
  .entry-logo { width: 172px; margin-bottom: 27px; }
  .welcome { margin-bottom: 27px; }
  .welcome h1 { font-size: 36px; }
  .welcome p { margin-top: 11px; font-size: 13px; }
  .remember-help { max-width: none; margin-bottom: 22px; }
  .form-error, .field-notice, .submit-status { overflow-wrap: anywhere; }
  .entry-footer { max-width: 430px; width: 100%; margin-inline: auto; }
}

@media (max-width: 360px) {
  .login-layout { --mobile-hero-height: 180px; }
  .entry-panel {
    padding-right: max(20px, env(safe-area-inset-right));
    padding-left: max(20px, env(safe-area-inset-left));
  }
  .brand-story { padding-top: 22px; }
  .brand-story h2 { font-size: 34px; }
  .entry-logo { width: 154px; }
  .welcome h1 { font-size: 33px; }
}

/* Keep the form prominent on smaller phones and when a mobile keyboard
   reduces the visual viewport. No fixed heights or hidden page overflow. */
@media (max-width: 767px) and (max-height: 740px) {
  .login-layout { --mobile-hero-height: 156px; }
  .brand-panel { padding-block: 19px; padding-top: max(19px, env(safe-area-inset-top)); }
  .brand-story { padding-top: 12px; }
  .brand-story h2 { font-size: 34px; }
  .brand-story p { margin-top: 10px; }
  .entry-panel { padding-top: 18px; }
  .entry-content { margin-top: 8px; margin-bottom: 12px; }
  .entry-logo { width: 156px; margin-bottom: 20px; }
  .welcome { margin-bottom: 22px; }
  .welcome h1 { font-size: 33px; }
  .welcome p { margin-top: 9px; }
}

@media (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  .login-layout { --mobile-hero-height: 118px; }
  .brand-panel {
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: 18px;
  }
  .brand-story { padding-top: 0; }
  .brand-story h2 { max-width: none; font-size: 34px; }
  .brand-story p { margin-top: 8px; }
  .entry-panel { padding-top: 20px; }
  .entry-content { margin-top: 8px; }
  .entry-logo { width: 156px; margin-bottom: 20px; }
  .welcome { margin-bottom: 22px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #13241b;
    --field: #1c3023;
    --ink: #edf5e9;
    --muted: #b2c3b0;
    --line: #435946;
    --accent: #a6cf87;
    --accent-hover: #bbde9e;
    --on-accent: #152a18;
    --focus: #c3e7a8;
    --error: #ffc0b6;
    --error-surface: #492923;
    --shadow: #8fac8220;
  }
  .entry-logo { filter: brightness(0) invert(1); }
}

@media (forced-colors: active) {
  .password-control { border: 1px solid CanvasText; }
  .submit-button { border: 1px solid ButtonText; }
  .brand-shade { background: Canvas; opacity: .8; }
}
