:root {
  --bg: #0b1220;
  --bg-elev: #111a2e;
  --panel: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok: #16a34a;
  --shadow: 0 20px 50px rgba(2, 8, 23, 0.35);
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1e3a8a 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #0e7490 0%, transparent 50%),
    var(--bg);
  min-height: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  color: #e2e8f0;
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 0.95rem; letter-spacing: 0.01em; }
.brand-text span { font-size: 0.75rem; opacity: 0.75; }

.top-links { display: flex; gap: 1rem; font-size: 0.875rem; }
.top-links a { color: #cbd5e1; }

.shell {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: center;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
}

.hero-card {
  color: #e2e8f0;
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.55));
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem;
  backdrop-filter: blur(8px);
}
.hero-card h2 { margin: 0 0 0.75rem; font-size: 1.75rem; font-weight: 650; }
.hero-card p { margin: 0 0 1rem; color: #cbd5e1; line-height: 1.55; max-width: 36ch; }
.hero-card ul { margin: 0 0 1.25rem; padding-left: 1.1rem; color: #94a3b8; line-height: 1.7; }
.status-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: #bbf7d0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.2); }

.auth-panel { display: flex; flex-direction: column; gap: 0.75rem; }
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.6rem 1.5rem;
  border: 1px solid rgba(255,255,255,0.5);
}
.card-header h1 { margin: 0; font-size: 1.45rem; font-weight: 650; }
.muted { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.92rem; }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1rem; font-size: 0.875rem; font-weight: 600; }
.field input {
  font: inherit; font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
}
.field input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.password-wrap { display: flex; gap: 0.4rem; }
.password-wrap input { flex: 1; }

.row-between {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0.9rem 0 1.1rem; font-size: 0.875rem; font-weight: 400;
}
.check { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); cursor: pointer; }
.link { font-weight: 500; }

.primary, .secondary, .ghost {
  font: inherit; cursor: pointer; border-radius: 10px;
}
.primary {
  width: 100%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s, transform 0.05s;
}
.primary:hover { background: var(--primary-hover); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: 0.7; cursor: wait; }

.secondary {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 600;
  padding: 0.7rem 1rem;
}
.secondary:hover { background: #f1f5f9; }

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-spinner {
  width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.divider {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1rem 0; color: var(--muted); font-size: 0.8rem;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.fineprint {
  margin: 1rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}

.alert {
  margin-top: 1rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  font-size: 0.875rem;
}

.footnote {
  text-align: center;
  color: #94a3b8;
  font-size: 0.75rem;
  margin: 0;
}
.footnote code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: #cbd5e1;
}

.footer {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap;
  gap: 0.35rem;
  padding: 1rem;
  color: #94a3b8;
  font-size: 0.78rem;
}
.footer a { color: #cbd5e1; }
.sep { opacity: 0.5; }

dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow);
  max-width: 420px;
  width: calc(100% - 2rem);
}
dialog::backdrop { background: rgba(2, 8, 23, 0.55); }
.modal-body { padding: 1.25rem 1.35rem 1.15rem; }
.modal-body h3 { margin: 0 0 0.5rem; }
.modal-body p { margin: 0 0 1rem; color: var(--muted); line-height: 1.5; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; max-width: 440px; }
  .hero { display: none; }
  .top-links { display: none; }
}
