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

:root {
  --bg: #0a0e14;
  --panel: #12171f;
  --panel2: #1a212b;
  --border: #2a3340;
  --border2: #3d4a5c;
  --text: #e8edf4;
  --muted: #7d8b9a;
  --accent: #4d9fff;
  --accent2: #3fb950;
  --warn: #d29922;
  --hot: #f85149;
  --radius: 6px;
  --btn-h: 36px;
}

html,
body {
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at top, rgba(77, 159, 255, 0.08) 0%, transparent 55%),
    var(--bg);
}

.auth-back {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.auth-back:hover {
  color: var(--text);
  background: var(--panel2);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 24px 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.auth-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel2);
  flex-shrink: 0;
}

.lang-switch button {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  min-height: 24px;
}

.lang-switch button:hover {
  color: var(--text);
}

.lang-switch button.active {
  background: rgba(77, 159, 255, 0.15);
  color: var(--accent);
}

.lang-switch .lang-sep {
  color: var(--border2);
  font-size: 10px;
  user-select: none;
  padding: 0 1px;
}

.auth-logo-img {
  height: 120px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.auth-brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.auth-brand small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  background: var(--accent);
  color: #fff;
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: block;
}

.auth-field {
  margin-bottom: 14px;
}

.auth-field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.auth-field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  min-height: 40px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(77, 159, 255, 0.2);
}

.auth-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  min-height: var(--btn-h);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s, box-shadow 0.15s;
  margin-top: 4px;
}

.auth-btn:hover:not(:disabled) {
  opacity: 0.92;
  box-shadow: 0 0 0 1px rgba(77, 159, 255, 0.25);
}

.auth-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.auth-btn.secondary {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  margin-top: 10px;
}

.auth-btn.secondary:hover:not(:disabled) {
  border-color: var(--border2);
}

.auth-link-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 10px 0 0;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-link-btn:hover {
  opacity: 0.85;
}

.auth-message {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.45;
  display: none;
}

.auth-message.show {
  display: block;
}

.auth-message.error {
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.35);
  color: #ff8a84;
}

.auth-message.success {
  background: rgba(63, 185, 80, 0.12);
  border: 1px solid rgba(63, 185, 80, 0.35);
  color: #7ee787;
}

.auth-message.info {
  background: rgba(77, 159, 255, 0.1);
  border: 1px solid rgba(77, 159, 255, 0.3);
  color: #79c0ff;
}

.auth-message.warn {
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.35);
  color: #e3b341;
}

.auth-config-banner {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.35);
  color: #e3b341;
  font-size: 12px;
  line-height: 1.45;
}

.auth-config-banner.hidden {
  display: none;
}

.auth-logged {
  text-align: center;
}

.auth-logged .auth-user-email {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  word-break: break-all;
}

.auth-logged .auth-user-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.auth-logged .auth-user-plan {
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.auth-plan-label {
  color: var(--muted);
  font-size: 12px;
}

.auth-plan-status {
  font-size: 11px;
  color: var(--muted);
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  line-height: 1;
}

.plan-badge.plan-pro {
  color: #7ee787;
  border-color: rgba(63, 185, 80, 0.45);
  background: rgba(63, 185, 80, 0.12);
}

.plan-badge.plan-demo {
  color: #79c0ff;
  border-color: rgba(77, 159, 255, 0.45);
  background: rgba(77, 159, 255, 0.12);
}

.plan-badge.plan-free {
  color: var(--muted);
  border-color: var(--border);
  background: var(--panel2);
}

.plan-badge.plan-unconfigured {
  color: var(--warn);
  border-color: rgba(210, 153, 34, 0.45);
  background: rgba(210, 153, 34, 0.1);
}

.plan-badge.plan-none {
  color: var(--muted);
  opacity: 0.7;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.75;
}

.auth-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

@media (max-width: 480px) {
  .auth-card {
    padding: 22px 18px 18px;
  }

  .auth-back {
    position: static;
    align-self: flex-start;
    margin-bottom: 12px;
  }

  .auth-page {
    justify-content: flex-start;
    padding-top: 16px;
  }
}
