/* DVeMesh Authentication v2 — unified composition */

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: #07090d;
  color: var(--text);
  overflow-x: hidden;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(720px 380px at 18% 12%, rgba(79, 209, 197, 0.055), transparent 58%),
    radial-gradient(560px 320px at 88% 88%, rgba(110, 168, 255, 0.04), transparent 55%),
    linear-gradient(#07090d, #0a0e14);
}

.auth-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 42%, #000 22%, transparent 72%);
}

.auth-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 28px;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.auth-back:hover {
  color: var(--text);
  text-decoration: none;
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.auth-layout {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 56px;
  align-items: center;
  animation: auth-enter 360ms ease-out;
}

@keyframes auth-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

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

@keyframes auth-mesh-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.auth-visual {
  min-width: 0;
  padding: 8px 8px 8px 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.auth-identity-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text);
}

.auth-identity-copy {
  margin: 0 0 16px;
  color: var(--text-dim);
  font-size: 15px;
}

.auth-identity-meta {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  line-height: 1.6;
}

.auth-mesh {
  display: block;
  width: 132px;
  height: auto;
  margin: 0 0 20px;
}

.auth-node {
  fill: #0d141c;
  stroke: #4fd1c5;
  stroke-width: 1.3;
}

.auth-link {
  stroke: rgba(110, 168, 255, 0.32);
  stroke-width: 1;
  fill: none;
}

.auth-node-core {
  fill: #4fd1c5;
  animation: auth-mesh-pulse 4.8s ease-in-out infinite;
}

.auth-panel {
  min-width: 0;
  width: 100%;
  padding: 32px 32px 28px;
  border: 1px solid rgba(55, 71, 90, 0.65);
  border-radius: 16px;
  background: rgba(12, 16, 22, 0.92);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.auth-panel h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.auth-lede {
  margin: 0 0 22px;
  color: var(--text-dim);
  font-size: 14px;
}

.auth-alert {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.4;
}

.auth-alert[hidden] { display: none; }

.auth-alert-error {
  border-color: rgba(232, 93, 106, 0.4);
  background: rgba(232, 93, 106, 0.07);
  color: #ffc2c8;
}

.auth-alert-ok {
  border-color: rgba(61, 207, 122, 0.32);
  background: rgba(61, 207, 122, 0.07);
  color: #b7f0cc;
}

.auth-field {
  margin-bottom: 14px;
}

.auth-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.auth-input-wrap {
  position: relative;
}

.auth-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #2a3646;
  background: #0b1016;
  color: var(--text);
  font: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

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

.auth-input:hover { border-color: #3d4d62; }

.auth-input:focus,
.auth-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.16);
}

.auth-field.is-error .auth-input {
  border-color: rgba(232, 93, 106, 0.7);
  box-shadow: 0 0 0 3px rgba(232, 93, 106, 0.1);
}

.auth-field.is-ok .auth-input {
  border-color: rgba(61, 207, 122, 0.45);
}

.auth-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-field-error {
  margin: 6px 0 0;
  min-height: 0;
  font-size: 13px;
  color: #ffb4bb;
}

.auth-field-error[hidden] { display: none; }

.auth-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-mute);
}

.auth-hint .is-met,
.auth-hint.is-met {
  color: #9ee0b8;
}

.auth-hint .is-met::before,
.auth-hint.is-met::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: 1px;
}

.auth-eye {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-mute);
  border-radius: 8px;
  cursor: pointer;
}

.auth-eye:hover,
.auth-eye:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.auth-eye:focus-visible {
  box-shadow: 0 0 0 2px rgba(79, 209, 197, 0.35);
}

.auth-eye svg {
  width: 18px;
  height: 18px;
  display: block;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 2px 0 16px;
  font-size: 13px;
}

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text-dim);
  cursor: pointer;
  margin: 0;
}

.auth-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.auth-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  text-decoration: none;
}

.auth-link:hover { text-decoration: underline; }

.auth-submit {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #06221f;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter 140ms ease;
}

.auth-submit:hover:not(:disabled) { filter: brightness(1.06); }
.auth-submit:disabled { opacity: 0.65; cursor: not-allowed; }

.auth-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.28);
}

.auth-submit.is-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid #06221f;
  border-right-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

.auth-foot {
  margin: 16px 0 0;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

.auth-foot .auth-link { min-height: 0; padding: 8px 0; }

.auth-strength {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin: -2px 0 14px;
}

.auth-strength-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.auth-strength-bars span {
  height: 3px;
  border-radius: 99px;
  background: #243040;
}

.auth-strength[data-level="weak"] .auth-strength-bars span:nth-child(-n+1) { background: #e85d6a; }
.auth-strength[data-level="fair"] .auth-strength-bars span:nth-child(-n+2) { background: #e6b84d; }
.auth-strength[data-level="good"] .auth-strength-bars span:nth-child(-n+3) { background: #6ea8ff; }
.auth-strength[data-level="strong"] .auth-strength-bars span { background: #3dcf7a; }

.auth-strength-label {
  font-size: 12px;
  color: var(--text-mute);
}

.auth-strength[hidden] { display: none; }

/* Desktop wide */
@media (min-width: 1280px) {
  .auth-layout {
    width: min(980px, calc(100% - 64px));
    gap: 72px;
    padding-top: 40px;
  }
}

/* Tablet landscape / small desktop: keep split if space allows */
@media (max-width: 1023px) {
  .auth-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    width: min(460px, calc(100% - 40px));
    gap: 28px;
    padding-top: 12px;
  }

  .auth-panel { order: 1; }
  .auth-visual {
    order: 2;
    text-align: center;
    padding: 0;
  }
  .auth-mesh {
    margin: 0 auto 12px;
    width: 96px;
  }
}

/* Phone / small tablet */
@media (max-width: 767px) {
  .auth-top { padding: 10px 16px; }
  .auth-layout {
    width: min(420px, calc(100% - 32px));
    gap: 20px;
    padding: 8px 0 32px;
  }
  .auth-panel { padding: 24px 20px 20px; }
  .auth-panel h1 { font-size: 24px; }
  .auth-mesh { width: 84px; }
  .auth-identity-title { font-size: 16px; }
}

/* Small phone */
@media (max-width: 479px) {
  .auth-top { padding: 8px 12px; }
  .auth-back { padding-left: 8px; padding-right: 8px; font-size: 13px; }
  .auth-layout {
    width: min(100%, calc(100% - 24px));
    gap: 18px;
  }
  .auth-panel { padding: 22px 16px 18px; }
  .auth-row { gap: 4px 12px; }
  .auth-identity-copy { margin-bottom: 8px; }
}

/* Short / landscape viewports: keep the form, shrink identity */
@media (max-height: 640px) {
  .auth-layout { padding-top: 4px; padding-bottom: 16px; gap: 12px; }
  .auth-mesh { display: none; }
  .auth-visual { padding: 0; }
  .auth-panel { padding-top: 18px; padding-bottom: 16px; }
  .auth-lede { margin-bottom: 14px; }
}

@media (max-height: 500px) {
  .auth-visual { display: none; }
  .auth-top { padding-top: 4px; padding-bottom: 4px; }
  .auth-panel { padding: 14px 20px 12px; }
  .auth-panel h1 { font-size: 22px; }
  .auth-field { margin-bottom: 10px; }
  .auth-lede { margin-bottom: 10px; font-size: 13px; }
  .auth-input,
  .auth-submit { min-height: 44px; }
  .auth-foot { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-layout { animation: none; }
  .auth-node-core { animation: none; }
  .auth-submit.is-loading::before { animation: none; border-right-color: #06221f; opacity: 0.45; }
  .auth-input,
  .auth-submit,
  .auth-eye { transition: none; }
}
