:root {
  --bg: #ffffff;
  --panel: #f8f5ff;
  --text: #2e0b57;
  --line: #2f0d62;
  --accent: #5f1fc6;
  --muted: #6e5b90;
  --error: #dc2323;
  --success: #1fa44a;
  --brand-logo-size: 34px;
  --logo-glow-core: rgba(134, 44, 255, 0.56);
  --logo-glow-soft: rgba(134, 44, 255, 0.24);
}

body.dark {
  --bg: #000000;
  --panel: #12001f;
  --text: #d86bff;
  --line: #7f00ff;
  --accent: #c43cff;
  --muted: #b985d6;
  --logo-glow-core: rgba(196, 94, 255, 0.78);
  --logo-glow-soft: rgba(196, 94, 255, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login-wrap {
  width: min(460px, 94vw);
}

.login-card {
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 18px;
  box-shadow: 0 0 0 4px rgba(220, 35, 35, 0.42), 0 0 36px 2px rgba(220, 35, 35, 0.62);
  transition: box-shadow 0.25s ease;
}

.login-card.success {
  box-shadow: 0 0 0 4px rgba(31, 164, 74, 0.56), 0 0 40px 2px rgba(31, 164, 74, 0.78);
}

.login-head h1 {
  margin: 0;
  letter-spacing: 0.14em;
  font-size: clamp(1.1rem, 2.6vw, 1.6rem);
}

.login-head .brand-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
  isolation: isolate;
  padding-left: 3px;
}

.login-head .brand-title::before {
  content: "";
  position: absolute;
  left: calc(-1 * (var(--brand-logo-size) * 0.12));
  top: 50%;
  width: calc(var(--brand-logo-size) * 1.4);
  height: calc(var(--brand-logo-size) * 1.4);
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--logo-glow-core) 0%, var(--logo-glow-soft) 46%, transparent 72%);
  filter: blur(5px);
  z-index: -1;
  pointer-events: none;
}

.login-head .brand-logo {
  width: var(--brand-logo-size);
  height: var(--brand-logo-size);
  object-fit: contain;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}

.login-head .brand-copy {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.login-head .brand-line {
  display: block;
}

.login-head .brand-line-primary {
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.login-head .brand-line-secondary {
  font-size: 0.64em;
  letter-spacing: 0.18em;
}

.login-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.login-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.field-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.toggle-row {
  margin-top: 4px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.toggle-copy {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-title {
  font-size: 0.84rem;
  font-weight: 800;
}

.toggle-subtitle {
  font-size: 0.74rem;
  color: var(--muted);
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-slider {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: rgba(0, 0, 0, 0.08);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--line);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(95, 31, 198, 0.22);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

input,
button {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
}

button {
  cursor: pointer;
}

.login-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.login-actions button {
  flex: 1;
}

.login-message {
  margin: 12px 0 0;
  min-height: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

.login-message.error {
  color: var(--error);
}

.login-message.success {
  color: var(--success);
}
