:root {
  --bg: #0a0d12;
  --panel: rgba(15, 18, 24, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f2f5f7;
  --muted: #a8b1bb;
  --accent: #6cc12f;
  --accent-2: #6c2d78;
  --accent-3: #3f9c25;
  --danger: #ff6b6b;
  --shadow: 0 26px 72px rgba(0, 0, 0, 0.42);
}

body.theme-light {
  --panel: rgba(255, 255, 255, 0.95);
  --panel-soft: rgba(255, 255, 255, 0.72);
  --line: rgba(21, 32, 43, 0.10);
  --text: #111827;
  --muted: #5f6d79;
  --shadow: 0 22px 56px rgba(16, 24, 40, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(108, 193, 47, 0.08), transparent 18%),
    radial-gradient(circle at 86% 14%, rgba(108, 45, 120, 0.14), transparent 18%),
    linear-gradient(180deg, #0b0f14 0%, #0a0d12 100%);
  overflow-x: hidden;
}

body.theme-light .backdrop-grid {
  opacity: 0.14;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.58), transparent 92%);
}

body.theme-light,
body.theme-dark {
  background:
    radial-gradient(circle at 18% 14%, rgba(108, 193, 47, 0.10), transparent 18%),
    radial-gradient(circle at 82% 16%, rgba(108, 45, 120, 0.10), transparent 18%),
    linear-gradient(180deg, #0b0f14 0%, #0a0d12 100%);
}

body.theme-light {
  background:
    radial-gradient(circle at 18% 14%, rgba(108, 193, 47, 0.12), transparent 18%),
    radial-gradient(circle at 82% 16%, rgba(108, 45, 120, 0.08), transparent 18%),
    linear-gradient(180deg, #f3f5f7 0%, #e9edf2 100%);
}

body.theme-light .panel::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.72), transparent 24%);
}

body.theme-light .panel::after {
  opacity: 0.92;
}

body.theme-light .btn-secondary {
  color: #1f2937;
  border-color: rgba(21,32,43,0.12);
  background: rgba(255,255,255,0.55);
}

body.theme-light .message {
  background: rgba(255, 107, 107, 0.08);
  color: #8b1f2d;
  border-color: rgba(255, 107, 107, 0.16);
}

body.theme-light input {
  background: rgba(255,255,255,0.75);
  border-color: rgba(21,32,43,0.12);
}

body.theme-light input::placeholder {
  color: rgba(31,41,55,0.38);
}

body.theme-light label {
  color: #1f2937;
}

body.theme-dark label {
  color: #dde4ea;
}

body.theme-light .theme-toggle {
  background: rgba(255,255,255,0.88);
  border-color: rgba(21,32,43,0.10);
  color: #111827;
}

.backdrop-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 86px 86px;
  opacity: 0.22;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.68), transparent 92%);
}

.panel-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.panel {
  width: min(100%, 470px);
  padding: 26px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  position: relative;
  overflow: hidden;
}

.panel::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent 24%);
  pointer-events: none;
}

.panel h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.04em;
  text-align: center;
}

.panel p.sub {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
  position: relative;
  z-index: 1;
  text-align: center;
}

.message {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 107, 107, 0.22);
  background: rgba(255, 107, 107, 0.06);
  color: #ffd4d4;
  font-size: 14px;
}

form {
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.field {
  margin-bottom: 12px;
}

.input-shell {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #8b95a1;
  pointer-events: none;
}

body.theme-light .input-icon {
  color: #5f6d79;
}

body.theme-dark .input-icon {
  color: #94a3b8;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: #8b95a1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}

body.theme-light .password-toggle {
  color: #5f6d79;
}

body.theme-dark .password-toggle {
  color: #94a3b8;
}

.password-toggle:hover {
  opacity: 0.9;
}

.password-toggle-icon {
  width: 18px;
  height: 18px;
  display: block;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #dde4ea;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 13px 14px 13px 42px;
  border-radius: 11px;
  outline: none;
  font-size: 14px;
  transition: border-color .2s ease, background .2s ease;
}

input.password-input {
  padding-right: 42px;
}

input::placeholder { color: rgba(232, 238, 245, 0.34); }

input:focus {
  border-color: rgba(108, 193, 47, 0.75);
  background: rgba(255,255,255,0.06);
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 11px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s ease, background .2s ease, border-color .2s ease;
}

.btn-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.btn-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex: 0 0 auto;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: rgba(255,255,255,0.95);
  display: none;
  animation: spin 0.9s linear infinite;
}

body.theme-light .spinner {
  border: 2px solid rgba(31,41,55,0.25);
  border-top-color: #111827;
}

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

.btn-primary {
  color: #071209;
  background: linear-gradient(135deg, #85d83a, #6cc12f 65%, #5ab529);
  box-shadow: none;
  width: 100%;
}

.btn-secondary {
  color: #dbe2e8;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
}

.btn:hover { opacity: 0.94; }

.logo-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.logo-image {
  width: min(100%, 180px);
  height: auto;
  display: block;
  object-fit: contain;
}

.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 3;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(15, 18, 24, 0.78);
  color: #f2f5f7;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
  backdrop-filter: blur(14px);
  transition: transform .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

@media (max-width: 560px) {
  .panel-wrap { padding: 16px; }
  .panel { padding: 20px 16px; border-radius: 18px; }
  .panel h2 { font-size: 24px; }
  .logo-image { width: min(100%, 150px); }
  .actions { flex-direction: column; align-items: stretch; }
  .btn-primary, .btn-secondary { width: 100%; }
}
