:root {
  --ink: #0c241c;
  --forest: #0f3d32;
  --moss: #1a7a5e;
  --moss-deep: #145a48;
  --leaf: #2f9b76;
  --mist: #e7f2ec;
  --paper: #f7fbf8;
  --line: rgba(15, 61, 50, 0.14);
  --danger: #b42318;
  --display: 'Fraunces', Georgia, serif;
  --sans: 'Manrope', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--forest);
}

.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
}

/* ── Brand plane ── */
.brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: clamp(32px, 6vw, 72px);
  background:
    radial-gradient(90% 70% at 12% 18%, rgba(47, 155, 118, 0.35), transparent 55%),
    radial-gradient(70% 55% at 88% 82%, rgba(8, 28, 22, 0.55), transparent 50%),
    linear-gradient(155deg, #145a48 0%, #0f3d32 48%, #0a2a22 100%);
  color: #f2faf6;
}

.brand-atmos {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  animation: drift 14s ease-in-out infinite alternate;
}

.orb-a {
  width: min(42vw, 420px);
  height: min(42vw, 420px);
  top: -8%;
  right: -6%;
  background: radial-gradient(circle, rgba(79, 190, 148, 0.45), transparent 68%);
}

.orb-b {
  width: min(36vw, 320px);
  height: min(36vw, 320px);
  bottom: 8%;
  left: -10%;
  background: radial-gradient(circle, rgba(20, 90, 72, 0.7), transparent 70%);
  animation-delay: -4s;
  animation-duration: 18s;
}

.grid-fade {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 40% 60%, black 20%, transparent 75%);
  opacity: 0.7;
}

.brand-copy {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  animation: rise 0.8s ease-out both;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: clamp(1.75rem, 3.5vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.paw {
  width: 1.15em;
  height: 1.15em;
  color: #9fe0c4;
}

.brand-copy h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.4rem, 5.5vw, 4.1rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin-bottom: 1rem;
}

.brand-lead {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.55;
  color: rgba(232, 245, 240, 0.82);
  max-width: 28rem;
}

/* ── Form plane ── */
.form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 4vw, 48px);
  background:
    linear-gradient(180deg, #fbfffd 0%, var(--paper) 100%);
  animation: fade-in 0.7s ease 0.12s both;
}

.login-form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-head {
  margin-bottom: 10px;
}

.form-head h2 {
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.form-head p {
  margin-top: 6px;
  color: #5c736b;
  font-size: 0.95rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span,
.field > label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5c736b;
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input::placeholder {
  color: #9bb0a6;
}

.field input:focus {
  outline: none;
  border-color: var(--moss);
  box-shadow: 0 0 0 4px rgba(26, 122, 94, 0.14);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #6a8579;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}

.password-toggle svg {
  grid-area: 1 / 1;
  display: block;
}

.password-toggle .eye-closed { display: none; }
.password-toggle.is-visible .eye-open { display: none; }
.password-toggle.is-visible .eye-closed { display: block; }

.password-toggle:hover {
  background: rgba(26, 122, 94, 0.08);
  color: var(--moss);
}

.password-toggle.is-visible {
  color: var(--moss);
}

#btn-login {
  margin-top: 8px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  background: var(--moss);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

#btn-login:hover:not(:disabled) {
  background: var(--moss-deep);
  transform: translateY(-1px);
}

#btn-login:active:not(:disabled) {
  transform: translateY(0);
}

#btn-login:disabled {
  opacity: 0.72;
  cursor: wait;
}

#btn-login.is-loading .btn-label {
  opacity: 0;
}

#btn-login.is-loading .btn-spinner {
  opacity: 1;
}

.btn-spinner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.7s linear infinite;
}

.login-error {
  color: var(--danger);
  font-size: 0.9rem;
  line-height: 1.4;
  min-height: 1.2em;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-18px, 22px, 0) scale(1.06); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .stage {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 42vh;
    align-items: flex-end;
    padding: 28px 24px 36px;
  }

  .brand-copy h1 {
    font-size: clamp(2rem, 9vw, 2.8rem);
  }

  .form-panel {
    align-items: flex-start;
    padding-top: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .brand-copy,
  .form-panel,
  #btn-login {
    animation: none !important;
    transition: none !important;
  }
}
