:root {
  color-scheme: light;
  --primary: #145c36;
  --primary-strong: #0d4427;
  --primary-soft: #e7f2eb;
  --gold: #b87912;
  --gold-soft: #fff3d4;
  --danger: #a9362f;
  --danger-soft: #faecea;
  --ink: #18201d;
  --muted: #5d6964;
  --line: #dce2df;
  --surface: #f4f7f5;
  --white: #fff;
  --shadow: 0 22px 60px rgb(17 54 35 / 13%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--surface); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--surface); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
[hidden] { display: none !important; }

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 42%) minmax(400px, 1fr);
  background: var(--white);
}

.brand-panel {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: clamp(38px, 7vw, 90px);
  color: var(--white);
  background: linear-gradient(155deg, #0d4427 0%, #145c36 56%, #1d7447 100%);
}

.brand-lockup { position: relative; z-index: 2; display: flex; align-items: center; gap: 18px; }
.brand-lockup > div { display: grid; gap: 5px; }
.brand-lockup strong { font-size: clamp(27px, 3.7vw, 48px); line-height: 1; letter-spacing: -.025em; }
.brand-lockup > div > span { max-width: 300px; color: #d2e7da; font-size: 14px; line-height: 1.45; }
.brand-decoration {
  position: absolute;
  z-index: 1;
  width: min(52vw, 620px);
  aspect-ratio: 1;
  top: -25%;
  right: -42%;
  border: clamp(45px, 7vw, 95px) solid rgb(255 255 255 / 5%);
  border-radius: 50%;
  box-shadow: 0 0 0 clamp(45px, 7vw, 95px) rgb(255 255 255 / 3%);
}

.brand-mark {
  width: 76px;
  height: 76px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgb(255 255 255 / 38%);
  border-radius: 22px;
  color: var(--primary-strong);
  background: #f4ead2;
  box-shadow: 0 10px 28px rgb(0 0 0 / 18%);
  transform: rotate(-4deg);
}
.brand-mark::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 36px;
  border-radius: 5px;
  background: var(--primary);
  opacity: .2;
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 8px;
  border-radius: 5px;
  background: var(--primary);
  opacity: .2;
}
.brand-mark span { position: relative; z-index: 1; font-size: 18px; font-weight: 900; letter-spacing: -.08em; transform: rotate(4deg); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; box-shadow: none; }
.brand-mark.small::before { width: 4px; height: 20px; }
.brand-mark.small::after { width: 16px; height: 4px; }
.brand-mark.small span { font-size: 10px; }

.action-region { display: grid; place-items: center; padding: clamp(24px, 6vw, 72px); background: var(--surface); }
.action-card {
  width: min(540px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.card-toolbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
}
.compact-brand { display: none; align-items: center; gap: 10px; margin-right: auto; }
.compact-brand strong { font-size: 14px; }
.language-field { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 750; }
.language-field select {
  min-width: 165px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 30px 6px 9px;
  color: var(--ink);
  background: var(--white);
}
.language-field select:focus-visible,
input:focus-visible,
.button:focus-visible {
  outline: 3px solid rgb(20 92 54 / 20%);
  outline-offset: 2px;
}

.action-panel { display: grid; justify-items: center; padding: clamp(30px, 6vw, 48px); text-align: center; }
.action-panel h1 { margin: 20px 0 10px; font-size: clamp(24px, 4vw, 31px); line-height: 1.15; letter-spacing: -.02em; }
.action-panel > p { max-width: 420px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.62; }

.status-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--primary);
  background: var(--primary-soft);
}
.status-icon::before { font-size: 31px; font-weight: 850; line-height: 1; }
.status-icon.loading span {
  width: 28px;
  height: 28px;
  border: 3px solid rgb(20 92 54 / 20%);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.status-icon.ready::before { content: "✓"; }
.status-icon.success::before { content: "✓"; }
.status-icon.warning { color: var(--gold); background: var(--gold-soft); }
.status-icon.warning::before { content: "!"; }
.status-icon.error { color: var(--danger); background: var(--danger-soft); }
.status-icon.error::before { content: "×"; }

.reset-form { width: 100%; display: grid; gap: 15px; margin-top: 26px; text-align: left; }
.reset-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.reset-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--white);
}
.password-hint { margin: -3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-error { margin: -2px 0 0; color: var(--danger); font-size: 13px; line-height: 1.45; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 16px;
  font-weight: 780;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}
.button:not(:disabled):hover { transform: translateY(-1px); }
.button.primary { color: var(--white); background: var(--primary); }
.button.primary:not(:disabled):hover { background: var(--primary-strong); }
.button.secondary { color: var(--primary-strong); border-color: #cddbd3; background: var(--white); }
.button.secondary:hover { background: var(--primary-soft); }
.button.wide { width: 100%; }
.primary-actions { width: 100%; margin-top: 26px; }
.destination-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }

.security-note { display: flex; align-items: flex-start; gap: 9px; padding: 16px 20px; border-top: 1px solid var(--line); color: var(--muted); background: #fafbfa; }
.security-note p { margin: 0; font-size: 11px; line-height: 1.5; }
.shield { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 900; }

.noscript-message { position: fixed; inset: auto 16px 16px; z-index: 10; padding: 13px 16px; border-radius: 9px; color: var(--white); background: var(--danger); box-shadow: var(--shadow); font-size: 13px; text-align: center; }
.standalone-message { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface); }
.compact-card { display: grid; justify-items: center; gap: 16px; padding: 42px; text-align: center; }
.compact-card .brand-mark { box-shadow: 0 10px 25px rgb(20 92 54 / 16%); }
.compact-card h1, .compact-card p { margin: 0; }
.compact-card p { max-width: 390px; color: var(--muted); line-height: 1.6; }

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

@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .action-region { min-height: 100vh; padding: 22px; }
  .compact-brand { display: flex; }
}

@media (max-width: 520px) {
  .action-region { align-items: stretch; padding: 0; background: var(--white); }
  .action-card { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .card-toolbar { align-items: center; padding: 12px 16px; }
  .compact-brand strong { display: none; }
  .language-field span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .language-field select { min-width: 150px; }
  .action-panel { padding: 38px 22px; }
  .destination-actions { grid-template-columns: 1fr; }
  .security-note { margin-top: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .status-icon.loading span { animation-duration: 1.5s; }
}
