:root {
  --background: #0d0d0d;
  --surface: rgba(26, 26, 26, 0.94);
  --surface-light: #222222;
  --border: #2a2a2a;
  --text: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #6f6f75;
  --indigo: #3b3fd8;
  --blue: #4361ee;
  --indigo-light: #5558e8;
  --gold: #d4af37;
  --gold-light: #f4d35e;
  --success: #80ed99;
  --error: #ff4d6d;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(67, 97, 238, 0.23), transparent 40%),
    linear-gradient(160deg, #0d0d0d 0%, #0c0c12 48%, #09090b 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.background-orb {
  position: fixed;
  z-index: 0;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  opacity: 0.14;
  filter: blur(75px);
  pointer-events: none;
}

.background-orb-one {
  top: -170px;
  left: -130px;
  background: var(--indigo-light);
}

.background-orb-two {
  right: -170px;
  bottom: -190px;
  background: var(--gold);
  opacity: 0.08;
}

.page-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(28px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.auth-card {
  width: min(100%, 500px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 22px 24px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, var(--indigo), var(--blue) 56%, var(--indigo-light));
  box-shadow: 0 10px 26px rgba(67, 97, 238, 0.28);
  font-size: 27px;
  font-weight: 850;
  letter-spacing: -0.05em;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-caption {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
}

.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid rgba(212, 175, 55, 0.23);
  border-radius: 999px;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.08);
  font-size: 11px;
  font-weight: 700;
}

.secure-badge svg,
.security-footer svg,
.account-chip svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 15%, var(--border) 85%, transparent);
}

.state-panel {
  padding: 34px 34px 30px;
}

.state-panel[hidden] {
  display: none;
}

.state-panel-center {
  text-align: center;
}

.state-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 20px;
}

.state-panel-center .state-icon {
  margin-right: auto;
  margin-left: auto;
}

.state-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.state-icon-key {
  color: #b4b6ff;
  background: linear-gradient(145deg, rgba(59, 63, 216, 0.35), rgba(67, 97, 238, 0.12));
  box-shadow: inset 0 0 0 1px rgba(85, 88, 232, 0.35);
}

.state-icon-success {
  color: var(--success);
  background: rgba(128, 237, 153, 0.1);
  box-shadow: inset 0 0 0 1px rgba(128, 237, 153, 0.2);
}

.state-icon-error {
  color: var(--error);
  background: rgba(255, 77, 109, 0.09);
  box-shadow: inset 0 0 0 1px rgba(255, 77, 109, 0.2);
}

.eyebrow {
  margin: 0 0 8px;
  color: #8f92ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow-success {
  color: var(--success);
}

.eyebrow-error {
  color: var(--error);
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(27px, 7vw, 34px);
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.state-panel > p:not(.eyebrow, .form-error, .helper-text),
.intro {
  margin: 13px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin: 22px 0;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--text-secondary);
  background: rgba(13, 13, 13, 0.6);
  font-size: 13px;
}

.account-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

label {
  display: block;
  margin: 18px 0 8px;
  color: #dedee3;
  font-size: 13px;
  font-weight: 700;
}

.password-field {
  position: relative;
}

.password-field input {
  width: 100%;
  height: 54px;
  padding: 0 50px 0 15px;
  border: 1px solid var(--border);
  outline: none;
  border-radius: 14px;
  color: var(--text);
  background: #101010;
  font-size: 15px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.password-field input::placeholder {
  color: #5f5f66;
}

.password-field input:focus {
  border-color: var(--blue);
  background: #111116;
  box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.13);
}

.password-field input.input-valid:not(:placeholder-shown) {
  border-color: rgba(128, 237, 153, 0.5);
}

.password-field input.input-invalid:not(:placeholder-shown) {
  border-color: rgba(255, 77, 109, 0.55);
}

.visibility-button {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  transform: translateY(-50%);
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
}

.visibility-button:hover {
  color: var(--text);
  background: var(--surface-light);
}

.visibility-button:focus-visible,
.primary-button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(244, 211, 94, 0.72);
  outline-offset: 3px;
}

.visibility-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.strength-track {
  height: 3px;
  margin: 8px 4px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #2a2a2a;
}

.strength-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--error);
  transition: width 180ms ease, background-color 180ms ease;
}

.password-rules {
  display: grid;
  gap: 8px;
  margin: 17px 0 0;
  padding: 0;
  list-style: none;
}

.password-rules li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
  font-size: 12px;
  transition: color 160ms ease;
}

.password-rules li.rule-valid {
  color: var(--success);
}

.rule-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}

.form-error {
  margin: 15px 0 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 77, 109, 0.2);
  border-radius: 12px;
  color: #ff9bad;
  background: rgba(255, 77, 109, 0.07);
  font-size: 12px;
  line-height: 1.45;
}

.primary-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 23px;
  padding: 14px 18px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(115deg, var(--indigo), var(--blue) 55%, var(--indigo-light));
  box-shadow: 0 13px 28px rgba(67, 97, 238, 0.23);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

.primary-button:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.primary-button:not(:disabled):active {
  transform: translateY(1px);
}

.primary-button:disabled {
  opacity: 0.42;
  box-shadow: none;
  cursor: not-allowed;
}

.link-button {
  max-width: 310px;
  margin-right: auto;
  margin-left: auto;
}

.button-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rotate 800ms linear infinite;
}

.helper-text {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.security-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(13, 13, 13, 0.48);
  font-size: 10px;
  text-align: center;
}

.copyright {
  margin: 18px 0 0;
  color: #55555c;
  font-size: 10px;
  text-align: center;
}

.spinner {
  width: 44px;
  height: 44px;
  margin: 8px auto 24px;
  border: 3px solid rgba(85, 88, 232, 0.2);
  border-top-color: var(--indigo-light);
  border-radius: 50%;
  animation: rotate 850ms linear infinite;
}

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

@media (max-width: 520px) {
  .page-shell {
    justify-content: flex-start;
    padding-right: 12px;
    padding-left: 12px;
  }

  .auth-card {
    border-radius: 23px;
  }

  .brand-header {
    padding: 18px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .state-panel {
    padding: 29px 22px 26px;
  }

  .secure-badge {
    padding: 6px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
