:root,
[data-theme="light"] {
  --bg: #f6f7f4;
  --surface: rgba(255,255,255,0.72);
  --surface-strong: #ffffff;
  --text: #1a1f1c;
  --muted: #6b756e;
  --border: rgba(26,31,28,0.10);
  --primary: #0f766e;
  --primary-hover: #0b5d57;
  --primary-soft: rgba(15,118,110,0.12);
  --accent: #34d399;
  --danger: #dc2626;
  --danger-soft: rgba(220,38,38,0.10);
  --shadow: 0 24px 70px rgba(15,40,30,0.10);
  --hero-1: rgba(15,118,110,0.16);
  --hero-2: rgba(52,211,153,0.10);
}

[data-theme="dark"] {
  --bg: #0d1410;
  --surface: rgba(20,28,24,0.74);
  --surface-strong: #141c18;
  --text: #eef2ee;
  --muted: #95a59b;
  --border: rgba(255,255,255,0.09);
  --primary: #34d399;
  --primary-hover: #6ee7b7;
  --primary-soft: rgba(52,211,153,0.14);
  --accent: #4fd1c5;
  --danger: #f87171;
  --danger-soft: rgba(248,113,113,0.12);
  --shadow: 0 24px 70px rgba(0,0,0,0.40);
  --hero-1: rgba(52,211,153,0.15);
  --hero-2: rgba(79,209,197,0.10);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0d1410;
    --surface: rgba(20,28,24,0.74);
    --surface-strong: #141c18;
    --text: #eef2ee;
    --muted: #95a59b;
    --border: rgba(255,255,255,0.09);
    --primary: #34d399;
    --primary-hover: #6ee7b7;
    --primary-soft: rgba(52,211,153,0.14);
    --accent: #4fd1c5;
    --danger: #f87171;
    --danger-soft: rgba(248,113,113,0.12);
    --shadow: 0 24px 70px rgba(0,0,0,0.40);
    --hero-1: rgba(52,211,153,0.15);
    --hero-2: rgba(79,209,197,0.10);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse 70% 50% at 15% 0%, var(--hero-1), transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 100%, var(--hero-2), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a,
button,
input {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--primary), var(--accent));
  color: white;
  flex-shrink: 0;
}

.brand-sub {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s, border-color 0.2s;
}
.theme-toggle:hover {
  background: var(--surface);
  border-color: var(--border);
}

/* ---------- Центральная секция ---------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.login {
  display: flex;
  justify-content: center;
  padding: 72px 0 48px;
}

.container {
  width: 100%;
  max-width: 380px;
  padding: 32px 30px 30px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.container h2 {
  text-align: center;
  font-size: clamp(24px, 4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.container .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap svg {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Ошибка сразу под логином */
.error {
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: none;
  line-height: 1.45;
}

.error .error-ico {
  flex-shrink: 0;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
  user-select: none;
  cursor: pointer;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--surface-strong);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

input[type="checkbox"]::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s;
}

input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
  transform: rotate(45deg) scale(1);
}

.checkbox-container label {
  cursor: pointer;
  display: inline;
}

.btn {
  width: 100%;
  height: 48px;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 12px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

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

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

.footer-links {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  margin: 0 6px;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

/* ---------- Подвал ---------- */
.site-footer {
  margin-top: auto;
  padding: 24px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.footer-brand svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

/* ---------- Доступность ---------- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (max-width: 520px) {
  .login {
    padding: 40px 0 24px;
  }
  .container {
    padding: 26px 20px 24px;
  }
  .brand-sub {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}