:root {
  --auth-deep: #0c1713;
  --auth-green: #15803d;
  --auth-green-dark: #116532;
  --auth-line-dark: rgb(255 255 255 / 0.15);
}

body.auth-page {
  min-height: 100dvh;
  color: var(--color-ink);
  background: var(--color-canvas);
}

.auth-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 4vw, 64px);
  color: #fff;
}

.auth-brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.auth-header p {
  margin: 0;
  color: #cbd5d1;
  font-size: 13px;
}

.auth-header p a {
  margin-left: 6px;
  color: #fff;
  font-weight: 700;
  text-underline-offset: 4px;
}

.auth-layout {
  min-height: calc(100dvh - 72px);
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(480px, 1.1fr);
}

.auth-intro {
  min-height: calc(100dvh - 72px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(136px, 18vh, 190px) clamp(36px, 6vw, 96px) clamp(48px, 7vh, 76px);
  color: #f8fafc;
  background:
    linear-gradient(rgb(255 255 255 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.035) 1px, transparent 1px),
    var(--auth-deep);
  background-size: 40px 40px;
}

.auth-context {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 30px;
  color: #b9c7c1;
  font: 600 12px var(--font-code);
}

.auth-context span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5ee48a;
  box-shadow: 0 0 0 4px rgb(94 228 138 / 0.12);
}

.auth-intro h1 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(38px, 4.2vw, 66px);
  line-height: 1.03;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.auth-intro > div > p:last-child {
  max-width: 46ch;
  margin: 28px 0 0;
  color: #b9c7c1;
  font-size: 16px;
  line-height: 1.7;
  text-wrap: pretty;
}

.auth-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 64px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--auth-line-dark);
}

.auth-facts div { display: grid; gap: 7px; }
.auth-facts dt { color: #8fa29a; font-size: 12px; }
.auth-facts dd { margin: 0; font-size: 13px; font-weight: 650; }

.auth-steps {
  display: flex;
  gap: 0;
  margin: 64px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--auth-line-dark);
  list-style: none;
}

.auth-steps li {
  flex: 1;
  display: grid;
  gap: 7px;
  color: #dbe5e1;
  font-size: 12px;
}

.auth-steps span { color: #70d493; font: 600 11px var(--font-code); }

.auth-form-region {
  width: min(100%, 560px);
  align-self: center;
  justify-self: center;
  padding: 104px 56px 48px;
}

.auth-form-heading h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.auth-form-heading p {
  margin: 10px 0 0;
  color: var(--color-muted);
  font-size: 14px;
}

.auth-form {
  display: grid;
  gap: 19px;
  margin-top: 34px;
}

.auth-field { display: grid; gap: 8px; }
.auth-field label { font-size: 13px; font-weight: 700; }

.auth-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-control);
  color: var(--color-ink);
  background: var(--color-canvas);
  font: 500 14px var(--font-ui);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-field input::placeholder { color: #68768a; }
.auth-field input:hover { border-color: #94a3b8; }
.auth-field input:focus {
  border-color: var(--auth-green);
  outline: 0;
  box-shadow: 0 0 0 3px rgb(21 128 61 / 0.13);
}
.auth-field input[aria-invalid="true"] { border-color: var(--color-error); }

.password-control { position: relative; }
.password-control input { padding-right: 68px; }
.password-toggle {
  position: absolute;
  inset: 4px 4px 4px auto;
  min-width: 56px;
  border: 0;
  border-radius: 6px;
  color: #475569;
  background: transparent;
  font: 700 12px var(--font-ui);
  cursor: pointer;
}
.password-toggle:hover { color: var(--color-ink); background: var(--color-surface); }

.field-help,
.field-error {
  margin: -1px 0 0;
  font-size: 11px;
  line-height: 1.45;
}
.field-help { color: #5f6d7f; }
.field-error { color: var(--color-error); }
.field-error:empty { display: none; }

.password-strength { display: flex; gap: 5px; }
.password-strength span { width: 100%; height: 3px; border-radius: 2px; background: #e2e8f0; }
.password-strength[data-level="1"] span:first-child,
.password-strength[data-level="2"] span:nth-child(-n+2),
.password-strength[data-level="3"] span { background: var(--auth-green); }

.auth-error {
  padding: 11px 13px;
  border: 1px solid #fecaca;
  border-radius: var(--radius-control);
  color: #991b1b;
  background: #fef2f2;
  font-size: 13px;
  line-height: 1.5;
}

.auth-submit {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border: 1px solid var(--auth-green);
  border-radius: var(--radius-control);
  color: #fff;
  background: var(--auth-green);
  font: 750 14px var(--font-ui);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.auth-submit:hover { border-color: var(--auth-green-dark); background: var(--auth-green-dark); }
.auth-submit:disabled { cursor: wait; opacity: 0.68; }
.auth-submit__arrow { font-size: 18px; }

.auth-terms {
  max-width: 54ch;
  margin: -4px 0 0;
  color: #69778a;
  font-size: 11px;
  line-height: 1.55;
}

.auth-switch {
  margin: 28px 0 0;
  color: var(--color-muted);
  font-size: 13px;
  text-align: center;
}
.auth-switch a { color: var(--auth-green-dark); font-weight: 700; text-underline-offset: 3px; }

.master-key-dialog {
  width: min(calc(100% - 32px), 560px);
  padding: 32px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-ink);
  box-shadow: 0 24px 80px rgb(15 23 42 / 0.22);
}
.master-key-dialog::backdrop { background: rgb(12 23 19 / 0.72); }
.master-key-dialog__status {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--auth-green);
  font-weight: 800;
}
.master-key-dialog h2 { margin: 20px 0 8px; font-size: 24px; letter-spacing: -0.025em; }
.master-key-dialog > p { color: var(--color-muted); font-size: 13px; line-height: 1.6; }
.master-key-value {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 22px 0 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  overflow: hidden;
}
.master-key-value code { overflow-x: auto; padding: 13px; font: 12px var(--font-code); white-space: nowrap; }
.master-key-value button {
  border: 0;
  border-left: 1px solid var(--color-border);
  padding: 0 14px;
  color: var(--color-ink);
  background: #fff;
  font: 700 12px var(--font-ui);
  cursor: pointer;
}
.copy-status { min-height: 20px; margin: 0 0 16px; color: var(--auth-green-dark) !important; }

@media (max-width: 800px) {
  .auth-header { position: relative; min-height: 64px; color: var(--color-ink); border-bottom: 1px solid var(--color-border); }
  .auth-header p { color: var(--color-muted); }
  .auth-header p a { color: var(--auth-green-dark); }
  .auth-layout { min-height: auto; display: block; }
  .auth-intro { min-height: auto; padding: 54px 24px 48px; }
  .auth-intro h1 { font-size: 38px; }
  .auth-intro > div > p:last-child { margin-top: 20px; }
  .auth-facts, .auth-steps { margin-top: 40px; }
  .auth-form-region { width: min(100%, 560px); padding: 48px 24px 64px; }
}

@media (max-width: 430px) {
  .auth-header p { font-size: 0; }
  .auth-header p a { font-size: 13px; }
  .auth-intro h1 { font-size: 34px; }
  .auth-steps { display: grid; gap: 14px; }
  .auth-steps li { grid-template-columns: 32px 1fr; }
  .master-key-dialog { padding: 24px; }
  .master-key-value { grid-template-columns: 1fr; }
  .master-key-value button { min-height: 40px; border-top: 1px solid var(--color-border); border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-field input, .auth-submit { transition: none; }
}
