:root {
  --cream: #f8f4ea;
  --olive: #7f9941;
  --olive-dark: #667d33;
  --brown: #4b3329;
  --muted: #746d67;
  --line: #dedbd5;
  --danger: #a4493d;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  color: var(--brown);
  background-color: var(--cream);
  background-image:
    linear-gradient(rgba(250, 247, 240, .38), rgba(250, 247, 240, .38)),
    url("assets/background.png");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }
button, .remember-option { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-page {
  min-height: calc(100vh - 60px);
  display: grid;
  place-items: center;
  padding: 30px 18px 18px;
}

.login-card {
  width: min(100%, 382px);
  padding: 27px 34px 28px;
  border: 1px solid rgba(122, 104, 84, .16);
  border-radius: 17px;
  background: rgba(255, 255, 255, .94);
  box-shadow:
    0 18px 38px rgba(81, 64, 46, .17),
    0 3px 8px rgba(81, 64, 46, .08);
  backdrop-filter: blur(10px);
  animation: card-in .5s ease-out both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 23px;
  text-align: center;
}

.brand-logo {
  width: 126px;
  height: 126px;
  margin-bottom: 4px;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(71, 70, 38, .08));
}

.brand h1 {
  margin: 0;
  color: var(--brown);
  font-size: 2.05rem;
  line-height: 1.2;
}

.brand p {
  margin: 5px 0 0;
  color: var(--brown);
  font-size: .88rem;
}

.field-group { margin-bottom: 12px; }

.input-shell {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .9);
  transition: border-color .2s, box-shadow .2s;
}

.input-shell:focus-within {
  border-color: var(--olive);
  box-shadow: 0 0 0 3px rgba(127, 153, 65, .12);
}

.field-icon,
.password-toggle svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: #aaa8a4;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-shell input {
  min-width: 0;
  height: 42px;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--brown);
  background: transparent;
  font-size: .88rem;
}

.input-shell input::placeholder { color: #aaa8a4; }

.password-shell { padding-left: 6px; }

.password-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.password-toggle:hover { background: #f4f2ec; }
.eye-closed { display: none; }
.password-toggle[aria-pressed="true"] .eye-open { display: none; }
.password-toggle[aria-pressed="true"] .eye-closed { display: block; }

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 1px 7px;
}

.remember-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #57514c;
  font-size: .82rem;
  user-select: none;
}

.remember-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.custom-check {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid #bbb9b4;
  border-radius: 2px;
  background: #fff;
}

.remember-option input:checked + .custom-check {
  border-color: var(--olive);
  background: var(--olive);
}

.remember-option input:checked + .custom-check::after {
  content: "";
  width: 7px;
  height: 4px;
  border: solid #fff;
  border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg);
}

.text-button {
  padding: 3px 0;
  border: 0;
  color: var(--olive-dark);
  background: transparent;
  font-size: .8rem;
}

.text-button:hover { text-decoration: underline; }

.form-error {
  min-height: 16px;
  margin: 0 2px 5px;
  color: var(--danger);
  font-size: .78rem;
}

.login-button {
  width: 100%;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 10px 16px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(90deg, #77923c, #8aa347);
  box-shadow: 0 7px 15px rgba(103, 126, 52, .2);
  font-size: 1rem;
  font-weight: 700;
  transition: transform .2s, box-shadow .2s, filter .2s;
}

.login-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 18px rgba(103, 126, 52, .26);
  filter: saturate(1.08);
}

.login-button[disabled] { cursor: wait; opacity: .78; transform: none; }

.remember-option input:focus-visible + .custom-check,
.password-toggle:focus-visible,
.text-button:focus-visible,
.login-button:focus-visible {
  outline: 3px solid rgba(127, 153, 65, .24);
  outline-offset: 2px;
}

.site-footer {
  min-height: 60px;
  display: grid;
  place-items: center;
  padding: 8px 20px 15px;
  color: #655e57;
  text-align: center;
  font-size: .76rem;
}

.site-footer p {
  max-width: 700px;
  margin: 0;
  line-height: 1.65;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 50%;
  bottom: 22px;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 9px;
  color: #fff;
  background: #392a22;
  box-shadow: 0 10px 28px rgba(36, 28, 22, .22);
  font-size: .76rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 12px);
  transition: .24s;
}

.toast.show { opacity: 1; transform: translate(50%, 0); }

@media (max-width: 470px) {
  .login-page { min-height: calc(100vh - 70px); padding: 18px 14px 10px; }
  .login-card { width: min(100%, 354px); padding: 23px 24px 25px; border-radius: 14px; }
  .brand { margin-bottom: 19px; }
  .brand-logo { width: 110px; height: 110px; }
  .brand h1 { font-size: 1.8rem; }
  .brand p { font-size: .8rem; }
  .site-footer { min-height: 70px; padding-inline: 28px; }
}

@media (max-height: 700px) and (min-width: 471px) {
  .login-page { place-items: start center; padding-top: 18px; }
  .login-card { padding-block: 20px; }
  .brand-logo { width: 95px; height: 95px; }
  .brand { margin-bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
