:root {
  --bg: #0b1220;
  --bg-elev: #121a2b;
  --bg-soft: #182338;
  --border: #243049;
  --text: #e8eef9;
  --muted: #93a0b8;
  --primary: #0ea5e9;
  --primary-hover: #38bdf8;
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, 0.12);
  --ok: #34d399;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #13233f 0%, transparent 55%),
              radial-gradient(900px 500px at 100% 0%, #0c2a3d 0%, transparent 50%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}
a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}
.container { width: min(1100px, calc(100% - 2rem)); margin: 0 auto; }
.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.65rem; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  display: grid; place-items: center; font-weight: 700;
}
.brand-name { font-weight: 700; letter-spacing: 0.02em; }
.nav { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.btn { color: inherit; font-weight: 600; }
.nav a.btn-primary { color: #041018; }
.nav a.btn-primary:hover { color: #041018; text-decoration: none; }
.nav-user { color: var(--muted); font-size: 0.9rem; }
.main { flex: 1; padding: 2rem 0 3rem; }
.footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 0.75rem; color: var(--primary); font-weight: 700; margin: 0 0 0.5rem;
}
.hero { padding: 2.5rem 0 1rem; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; margin: 0 0 1rem; max-width: 16ch; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 52ch; margin: 0 0 1.5rem; }
.hero-actions { margin-bottom: 2.5rem; }
.feature-grid, .stat-grid, .quick-links {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}
.feature h3 { margin: 0 0 0.4rem; }
.feature p { margin: 0; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; border-radius: 9px; border: 1px solid transparent;
  padding: 0.55rem 1rem; font-weight: 600; cursor: pointer;
  font: inherit; text-decoration: none; background: var(--bg-soft); color: var(--text);
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-primary { background: var(--primary); color: #041018; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-danger { background: var(--danger-soft); color: #fecdd3; border-color: rgba(244,63,94,0.35); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.auth-wrap { display: grid; place-items: center; min-height: 55vh; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { margin: 0 0 0.35rem; }
.form { display: grid; gap: 0.9rem; margin-top: 1rem; }
.form label { display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
.form label.checkbox { display: flex; align-items: center; gap: 0.5rem; }
.form input, .form select, .form textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); padding: 0.65rem 0.75rem; font: inherit;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: 2px solid rgba(14,165,233,0.35); border-color: var(--primary);
}
.alert {
  padding: 0.75rem 0.9rem; border-radius: 9px; margin: 0.75rem 0 0;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); border-color: rgba(244,63,94,0.35); color: #fecdd3; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin: 0 0 0.25rem; }
.split {
  display: grid; gap: 1rem;
  grid-template-columns: 1.4fr 1fr;
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 0.65rem 0.4rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table .right { text-align: right; white-space: nowrap; }
.inline { display: inline; }
.inline-form { margin-bottom: 1rem; max-width: 420px; }
.stat-n { font-size: 2rem; font-weight: 700; }
.stat-l { color: var(--muted); }
.link-card { display: grid; gap: 0.25rem; color: inherit; }
.link-card:hover { text-decoration: none; border-color: var(--primary); }
.link-card span { color: var(--muted); font-size: 0.9rem; }
.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border); font-size: 0.8rem;
}
.portal-layout {
  display: grid; gap: 1rem;
  grid-template-columns: 240px 1fr;
}
@media (max-width: 800px) { .portal-layout { grid-template-columns: 1fr; } }
.side-nav { list-style: none; padding: 0; margin: 1rem 0 0; }
.side-nav a {
  display: block; padding: 0.55rem 0.7rem; border-radius: 8px; color: var(--muted);
}
.side-nav a:hover, .side-nav a.active {
  background: var(--bg-soft); color: var(--text); text-decoration: none;
}
.prose h1, .prose h2, .prose h3 { margin-top: 1.25rem; }
.prose p { color: #c7d2e5; }
.grow { flex: 1; }
