/* Страницы входа и регистрации. Токены — как в styles.css панели. */

:root {
  --bg: #f2f5f8;
  --panel: #ffffff;
  --line: #e1e7ee;
  --text: #1a2433;
  --muted: #667788;
  --accent: #1b7a8c;
  --accent-hover: #156575;
  --accent-soft: #e4f3f6;
  --ok: #1f9a66;
  --warn: #c9891a;
  --err: #d14354;
  --err-soft: #fceced;
  --radius: 14px;
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.auth {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px);
  min-height: 100vh;
}

/* --- левая брендовая панель --- */

.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  padding: 3rem 3.5rem;
  color: #fff;
  background:
    radial-gradient(700px 420px at 110% -10%, rgba(255, 255, 255, 0.16), transparent 60%),
    radial-gradient(600px 500px at -20% 120%, rgba(10, 40, 48, 0.55), transparent 60%),
    linear-gradient(150deg, #1f8597 0%, #176b7b 45%, #0f4f5b 100%);
}

.auth-brand::after {
  /* лёгкая «сетка графика» на фоне */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, transparent, #000 40%, #000 70%, transparent);
  pointer-events: none;
}

.auth-brand > * {
  position: relative;
  z-index: 1;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.auth-logo-mark {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

.auth-pitch h2 {
  margin: 0 0 1rem;
  max-width: 26rem;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  line-height: 1.2;
  font-weight: 700;
}

.auth-pitch p {
  margin: 0;
  max-width: 28rem;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
}

.auth-features {
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-features li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.95rem;
  line-height: 1.45;
}

.auth-features svg {
  flex: none;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.05rem;
  padding: 0.2rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
}

.auth-foot {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
}

/* Автор панели и контакт для приглашения. */
.auth-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.auth-author-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 700;
  font-size: 0.85rem;
}

.auth-author strong {
  display: block;
  font-size: 0.95rem;
}

.auth-author span {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
}

.auth-author a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- правая часть с формой --- */

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background:
    radial-gradient(600px 300px at 100% 0%, #e3f0f3 0%, transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2.25rem 2rem 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(26, 36, 51, 0.04), 0 12px 40px rgba(26, 36, 51, 0.08);
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.auth-sub {
  margin: 0 0 1.6rem;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1.05rem;
}

.field label {
  font-size: 0.86rem;
  font-weight: 600;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.input-wrap {
  position: relative;
}

.auth input[type="email"],
.auth input[type="text"],
.auth input[type="password"] {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
  color: var(--text);
  font: inherit;
  font-size: 0.97rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.input-wrap input {
  padding-right: 2.9rem !important;
}

.auth input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth input[readonly] {
  color: var(--muted);
  background: #f2f5f8;
}

.auth input[aria-invalid="true"] {
  border-color: var(--err);
}

.toggle-pass {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.toggle-pass:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.toggle-pass svg {
  width: 1.15rem;
  height: 1.15rem;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.2rem 0 1.4rem;
  font-size: 0.88rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.auth-card a.muted-link {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.auth-card a.muted-link:hover {
  color: var(--accent);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: progress;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.alert {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0 0 1.2rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.alert[hidden] {
  display: none;
}

.alert-error {
  border: 1px solid color-mix(in srgb, var(--err) 30%, transparent);
  background: var(--err-soft);
  color: #a3303f;
}

.alert-info {
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  background: var(--accent-soft);
  color: #145f6d;
}

.strength {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
  margin-top: 0.15rem;
}

.strength span {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.2s;
}

.strength[data-level="1"] span:nth-child(-n + 1) {
  background: var(--err);
}

.strength[data-level="2"] span:nth-child(-n + 2) {
  background: var(--warn);
}

.strength[data-level="3"] span:nth-child(-n + 3) {
  background: #5aa6b4;
}

.strength[data-level="4"] span:nth-child(-n + 4) {
  background: var(--ok);
}

.auth-note {
  margin: 1.5rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
}

.auth-note a,
.auth-card a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-note a:hover,
.auth-card a:hover {
  text-decoration: underline;
}

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

.state-icon {
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--err-soft);
  color: var(--err);
}

.state-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

[hidden] {
  display: none !important;
}

/* --- телефон / узкий экран --- */

@media (max-width: 860px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    gap: 1.25rem;
    padding: 1.5rem 1.25rem 1.6rem;
  }

  .auth-pitch h2 {
    margin-bottom: 0.4rem;
    font-size: 1.3rem;
  }

  .auth-pitch p {
    font-size: 0.9rem;
  }

  .auth-features,
  .auth-foot {
    display: none;
  }

  .auth-main {
    align-items: flex-start;
    padding: 1.25rem 1rem 2rem;
  }

  .auth-card {
    padding: 1.6rem 1.25rem 1.4rem;
  }
}
