/* Login v2 — базируемся на `cheese_cabinet_v2/styles.css`,
   но адаптируем под наш новый кабинет (токены/тумблер/анимации). */

:root {
  --bg: #f7f5f2;
  --bg-soft: #faf9f7;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --line: rgba(31, 36, 48, 0.10);
  --accent: #7c5cff;
  --accent-hover: #6e50f0;
  --accent-soft: #efeaff;
  --cheese: #f6bd3d;
  --cheese-soft: rgba(246, 189, 61, 0.18);
  --shadow: 0 24px 60px rgba(17, 24, 39, 0.10);
  --shadow-soft: 0 12px 30px rgba(17, 24, 39, 0.08);

  /* Типографика как в кабинете v2 */
  --h1-size: clamp(26px, 3.2vw, 40px);
  --body-size: 15px;
  --muted-size: 13px;
}

html[data-theme="dark"] {
  --bg: #121212;
  --bg-soft: #191919;
  --card: #1E1E1E;
  --text: #EDEDED;
  --muted: #B8B8B8;
  --line: #2F2F2F;
  --accent: #8B85FF;
  --accent-hover: #9a94ff;
  --accent-soft: rgba(139, 133, 255, 0.16);
  --cheese-soft: rgba(246, 189, 61, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  font-size: var(--body-size);
  /* Фон синхронизирован с кабинетом: базовый цвет тот же,
     сверху — очень мягкие акцентные пятна (без сильного градиента). */
  background:
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--cheese) 16%, transparent 84%), transparent 28%),
    radial-gradient(circle at 82% 22%, color-mix(in srgb, var(--accent) 12%, transparent 88%), transparent 26%),
    var(--bg);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 22% 18%, rgba(246,189,61,.06), transparent 26%),
    radial-gradient(circle at 76% 20%, rgba(139,133,255,.08), transparent 28%),
    var(--bg);
}

/* На случай, если логин будет подключён через legacy base:
   theme.css рисует фон через body::before/after — отключаем. */
body::before,
body::after {
  content: none !important;
  display: none !important;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
}

/* Контейнер: тумблер над блоком, без наложений */
.login-shell-wrap {
  width: min(1080px, 100%);
}
.login-shell-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.login-page .theme-toggle {
  width: 66px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(31, 36, 48, 0.10);
  background: color-mix(in srgb, var(--card) 92%, white 8%);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--text);
}
.login-page .theme-toggle .sun,
.login-page .theme-toggle .moon { display: none; }
.login-page .theme-toggle::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 10px 18px rgba(17, 24, 39, 0.14);
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
html[data-theme="dark"] .login-page .theme-toggle::before {
  transform: translateX(30px);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.38);
}
.login-page .theme-toggle::after {
  content: "☀️";
  position: absolute;
  top: 50%;
  left: 4px;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-size: 14px;
  transition: transform 180ms ease;
}
html[data-theme="dark"] .login-page .theme-toggle::after {
  content: "🌙";
  transform: translate(30px, -50%);
}

.login-shell {
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.brand-panel,
.login-card {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(16px);
  border-radius: 34px;
  box-shadow: var(--shadow);
}

.brand-panel {
  min-height: 520px;
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

.brand-panel::before {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: var(--accent-soft);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  line-height: 1.05;
  font-size: 20px;
  letter-spacing: -0.03em;
  position: relative;
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: inline-grid;
  place-items: center;
  background: var(--cheese-soft);
  border: 1px solid rgba(246, 189, 61, 0.28);
}

.mascot {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
}

.login-mascot-img {
  width: min(340px, 100%);
  height: auto;
  display: block;
  filter: drop-shadow(0 18px 25px rgba(0,0,0,.12));
  transform: translateY(8px);
}

.brand-copy { max-width: 520px; position: relative; }

.brand-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 4vw, 54px);
  line-height: .98;
  letter-spacing: -0.065em;
}

.brand-copy p {
  margin: 0;
  color: var(--muted);
  font-size: var(--body-size);
  line-height: 1.55;
}

.login-card {
  padding: 44px;
  align-self: center;
}

.login-header { margin-bottom: 24px; }

.login-header h2 {
  margin: 0 0 10px;
  font-size: var(--h1-size);
  line-height: 1;
  letter-spacing: -0.055em;
}

.login-header p {
  margin: 0;
  color: var(--muted);
  font-size: var(--body-size);
}

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  margin: 0 0 14px;
  font-weight: 650;
  border: 1px solid transparent;
}
.alert-error {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.24);
}
html[data-theme="dark"] .alert-error {
  background: rgba(220, 38, 38, 0.18);
  color: #ff9f9f;
  border-color: rgba(255, 159, 159, 0.22);
}
.alert-success {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.22);
}
html[data-theme="dark"] .alert-success {
  background: rgba(22, 163, 74, 0.18);
  color: #95f1b3;
  border-color: rgba(149, 241, 179, 0.18);
}

.field {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.field span {
  color: var(--muted);
  font-size: var(--muted-size);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.field input {
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 18px;
  font: inherit;
  font-size: var(--body-size);
  color: var(--text);
  background: var(--bg-soft);
  outline: none;
  transition: .18s ease;
}

.field input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: var(--card);
}

.submit-btn {
  width: 100%;
  height: 60px;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-size: var(--body-size);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 26px color-mix(in srgb, var(--accent) 28%, transparent);
  transition: transform .14s ease, opacity .14s ease, background-color .14s ease;
}

.submit-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
  opacity: 0.94;
}
.submit-btn:active {
  transform: scale(0.99);
  opacity: 0.92;
}

.helper-text {
  margin: 20px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--muted-size);
  line-height: 1.45;
}

.submit-btn:focus-visible,
.login-page .theme-toggle:focus-visible,
.field input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent 55%);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: 360px; }
  .mascot { min-height: 190px; }
  .login-mascot-img { width: min(260px, 100%); }
}

@media (max-width: 560px) {
  .login-page { padding: 18px; }
  .brand-panel, .login-card { border-radius: 26px; padding: 26px; }
  .brand-copy h1 { font-size: 36px; }
  .login-header h2 { font-size: 34px; }
  .login-shell-top { margin-bottom: 10px; }
}

