:root {
  --auth-navy: #173047;
  --auth-navy-deep: #0f2233;
  --auth-line: #8da4b5;
  --auth-shadow: 0 22px 54px rgba(20, 35, 49, 0.16);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(118deg, rgba(36, 101, 109, 0.08), transparent 42%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
::selection { background: var(--action); color: var(--action-text); }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(360px, 1.25fr);
  align-items: stretch;
}

.identity {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: clamp(30px, 5vw, 72px);
  color: #edf6fb;
  background: var(--auth-navy);
  box-shadow: 18px 0 42px rgba(15, 34, 51, 0.12);
}
.identity strong { display: block; margin-top: 6px; font-size: 18px; letter-spacing: 0.11em; }
.identity span { display: block; margin-top: 8px; color: #b8cbd8; font-size: 12px; letter-spacing: 0.08em; }
.identity b { margin-inline-start: 8px; padding: 2px 5px; border: 1px solid #7794a8; color: #dff3f1; font-size: 10px; }
.brandmark {
  flex: 0 0 auto;
  font-size: 42px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.03em;
}
.brandmark span { display: inline; margin-inline-start: -8px; color: #9cdbd9; font-size: 22px; }

.auth-panel {
  position: relative;
  width: min(520px, calc(100% - 48px));
  margin: auto;
  padding: clamp(30px, 5vw, 56px);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--auth-shadow);
}
.theme-toggle {
  position: absolute;
  inset-block-start: 18px;
  inset-inline-end: 18px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}
.theme-toggle:hover { background: var(--raised); color: var(--text); }
.auth-copy { margin: 30px 0 34px; max-width: 68ch; }
.auth-copy h1 { margin: 0 0 12px; font-size: clamp(27px, 4vw, 38px); line-height: 1.16; letter-spacing: -0.025em; }
.auth-copy p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }

form { display: grid; gap: 10px; }
label { font-size: 13px; font-weight: 650; }
input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  caret-color: var(--action);
}
input:hover { border-color: var(--auth-line); }
input:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--red); }
#code { font-variant-numeric: tabular-nums; letter-spacing: 0.22em; }

.primary {
  min-height: 48px;
  margin-top: 8px;
  padding: 11px 16px;
  border: 1px solid var(--action);
  border-radius: 8px;
  background: var(--action);
  color: var(--action-text);
  font-weight: 700;
}
.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.primary:disabled { cursor: wait; opacity: 0.62; }
.field-hint, .field-error, .status, .delivery-message { margin: 0; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.field-hint, .delivery-message, .status { color: var(--muted); }
.field-error { min-height: 21px; color: var(--red); }
.delivery-message { margin-bottom: 8px; }
.secondary-actions { display: flex; justify-content: space-between; gap: 14px; margin-top: 4px; }
.text-action {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--action);
  text-underline-offset: 3px;
}
.text-action:hover:not(:disabled) { text-decoration: underline; }
.text-action:disabled { cursor: default; color: var(--muted); opacity: 0.7; }
.status { min-height: 22px; margin-top: 20px; }
[hidden] { display: none !important; }

:root[data-theme="dark"] {
  --auth-shadow: 0 24px 58px rgba(4, 12, 20, 0.42);
}
:root[data-theme="dark"] body { background: var(--bg); }
:root[data-theme="dark"] .identity { background: var(--auth-navy-deep); }

@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; align-content: start; }
  .identity { min-height: auto; padding: 24px; box-shadow: 0 12px 34px rgba(15, 34, 51, 0.12); }
  .brandmark { font-size: 34px; }
  .auth-panel { width: min(520px, calc(100% - 28px)); margin: 24px auto; padding: 30px 22px; }
  .theme-toggle { position: static; justify-self: end; margin-bottom: 6px; }
  .auth-copy { margin-top: 12px; }
}

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