/* fonts loaded via <link> in <head> — @import is render-blocking */

:root {
  --bg: #02040f;
  --bg-elevated: #060b1a;
  --surface: rgba(12, 20, 48, 0.65);
  --surface-solid: #0a1230;
  --surface-hover: rgba(20, 30, 64, 0.85);
  --border: rgba(80, 120, 240, 0.15);
  --border-bright: rgba(100, 160, 255, 0.35);
  --text: #edf2ff;
  --text-secondary: #a0b4d8;
  --muted: #7084b0;
  --accent: #6366f1;
  --accent-2: #06b6d4;
  --accent-3: #a855f7;
  --accent-4: #f59e0b;
  --accent-hover: #818cf8;
  --glow: rgba(99, 102, 241, 0.4);
  --glow-2: rgba(6, 182, 212, 0.35);
  --danger: #ff6b8a;
  --success: #34d399;
  --warning: #fbbf24;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --surface-hover: rgba(240, 242, 248, 0.95);
  --border: rgba(99, 102, 241, 0.12);
  --border-bright: rgba(99, 102, 241, 0.25);
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-2: #06b6d4;
  --accent-3: #a855f7;
  --accent-4: #f59e0b;
  --accent-hover: #818cf8;
  --glow: rgba(99, 102, 241, 0.15);
  --glow-2: rgba(6, 182, 212, 0.12);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #eab308;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.08);
}

html {
  scroll-behavior: smooth;
  transition: background 0.3s ease, color 0.3s ease;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
  overflow-x: hidden;
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}

.hidden {
  display: none !important;
}

::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 3px;
}

/* ── Ambient background ── */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 80% 80%, rgba(168, 85, 247, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 30% 30% at 20% 70%, rgba(6, 182, 212, 0.03) 0%, transparent 50%);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 25%, transparent 75%);
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  animation: orbFloat 18s ease-in-out infinite;
}

.bg-orb--1 {
  width: 600px;
  height: 600px;
  top: -15%;
  left: -10%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
}

.bg-orb--2 {
  width: 480px;
  height: 480px;
  top: 15%;
  right: -12%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, transparent 70%);
  animation-delay: -6s;
}

.bg-orb--3 {
  width: 400px;
  height: 400px;
  bottom: -8%;
  left: 30%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.25) 0%, transparent 70%);
  animation-delay: -12s;
}

.bg-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ── Animations ── */
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(40px, 30px) scale(1.02); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.15); }
  50% { box-shadow: 0 0 45px rgba(99, 102, 241, 0.35); }
}

@keyframes shimmer {
  from { background-position: -200% center; }
  to { background-position: 200% center; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes floatBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

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

@keyframes borderRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes dataFlow {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ── Layout ── */
.page {
  position: relative;
  z-index: 1;
}

.container {
  width: min(1140px, 92vw);
  margin: 0 auto;
  padding: 1rem 0 4rem;
}

a {
  color: var(--accent-2);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0.75rem;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 auto 2rem;
  padding: 0.65rem 0.75rem;
  background: rgba(5, 8, 20, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.5s ease;
}

.nav::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), transparent 40%, transparent 60%, var(--accent-2));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.nav:hover::before {
  opacity: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition);
}

.brand:hover {
  color: var(--accent);
}

#brand-mark {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-menu {
  display: flex;
  align-items: center;
}

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  flex-shrink: 0;
}

.nav-toggle:hover {
  color: var(--text);
  border-color: var(--border-bright);
}

.nav-toggle svg {
  width: 100%;
  height: 100%;
}

.nav-toggle .icon-close {
  display: none;
}

.nav-open .nav-toggle .icon-menu {
  display: none;
}

.nav-open .nav-toggle .icon-close {
  display: block;
}

.nav-link-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-link--active {
  background: rgba(99, 102, 241, 0.1) !important;
  color: var(--accent) !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
}

@media (max-width: 820px) {
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 80vw);
    z-index: 99;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 5rem 1.25rem 2rem;
    background: var(--surface-solid);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.3);
  }

  .nav-open .nav-menu {
    transform: translateX(0);
  }

  .nav-menu::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }

  .nav-open .nav-menu::before {
    opacity: 1;
    pointer-events: auto;
  }

  .nav-menu .nav-actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .nav-menu .btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .nav-menu .btn-danger {
    margin-top: 0.5rem;
  }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.2s var(--transition),
    box-shadow 0.2s var(--transition),
    background 0.2s var(--transition),
    border-color 0.2s var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  background-size: 200% 200%;
  color: #fff;
  box-shadow: 0 4px 20px var(--glow);
  transition: all 0.3s var(--transition);
  animation: gradientShift 4s ease infinite;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-bright);
  color: var(--text);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(255, 107, 138, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 138, 0.2);
}

.btn-danger:hover {
  background: rgba(255, 107, 138, 0.2);
  border-color: var(--danger);
  box-shadow: 0 0 20px rgba(255, 107, 138, 0.2);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.78rem;
}

.btn-primary:hover {
  background-position: 100% 0;
  box-shadow: 0 12px 40px rgba(109, 124, 255, 0.5);
  transform: translateY(-2px);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* ── Nav Link Icons ── */
.nav-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Cards & forms ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2rem;
  width: 100%;
  backdrop-filter: blur(20px);
}

.card-glow {
  position: relative;
}

.card-glow::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3), var(--accent-2));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.35;
  pointer-events: none;
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.card p.subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-wrap {
  position: relative;
}

.input-wrap svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 18, 0.85);
  color: var(--text);
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:not(.input-wrap input) {
  padding-left: 0.95rem;
}

.input-wrap input {
  padding-left: 2.6rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.message {
  min-height: 1.25rem;
  font-size: 0.88rem;
}

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

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

.footer-note {
  margin-top: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-align: center;
}

/* ── Site Footer ── */
.site-footer {
  margin-top: 3rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.site-footer a {
  color: var(--accent);
}

/* ── Section headings ── */
.section-heading {
  margin: 2rem 0 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-heading:first-child {
  margin-top: 0;
}

/* ── Responsive utilities ── */
@media (max-width: 640px) {
  .hide-mobile {
    display: none !important;
  }
}

/* ── Dashboard ── */
.dashboard-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

@media (max-width: 640px) {
  .dashboard-hero {
    flex-wrap: wrap;
    text-align: center;
    justify-content: center;
  }
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.2),
    0 8px 30px var(--glow);
  flex-shrink: 0;
  position: relative;
}

.avatar::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3)) border-box;
  -webkit-mask:
    linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin 8s linear infinite;
}

.dashboard-greeting {
  flex: 1;
  min-width: 0;
}

.dashboard-greeting h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.dashboard-greeting p {
  margin: 0;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2s ease-in-out infinite;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.stat {
  display: grid;
  gap: 0.65rem;
  padding: 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(12px);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.stat:hover {
  border-color: var(--border-bright);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.08);
}

.stat-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.stat-icon {
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(109, 124, 255, 0.15), rgba(34, 211, 238, 0.1));
  border: 1px solid var(--border);
  color: var(--accent-2);
}

.stat strong {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat span {
  font-size: 1.05rem;
  font-weight: 600;
  word-break: break-all;
}

.stat span.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent-2);
}

.dash-quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin: 1.5rem 0;
}

@media (max-width: 768px) {
  .dash-quick {
    grid-template-columns: 1fr;
  }
}

.dash-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.dash-card:hover {
  border-color: var(--border-bright);
  color: var(--text);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.08);
}

.dash-card-icon {
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.1));
  border: 1px solid var(--border);
  color: var(--accent);
  flex-shrink: 0;
}

.dash-card-body {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.dash-card-body strong {
  font-size: 0.88rem;
  font-weight: 700;
}

.dash-card-body span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-glow);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast--fade {
  animation: toastOut 0.3s ease forwards;
}

.toast--success {
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.1);
}

.toast--error {
  border-color: var(--danger);
  background: rgba(255, 107, 138, 0.1);
}

.toast--warn {
  border-color: var(--warning);
  background: rgba(251, 191, 36, 0.1);
}

.toast-icon {
  font-weight: bold;
  font-size: 1.2rem;
  line-height: 1;
}

.toast--success .toast-icon {
  color: var(--success);
}

.toast--error .toast-icon {
  color: var(--danger);
}

.toast--warn .toast-icon {
  color: var(--warning);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

.spinner--large {
  width: 40px;
  height: 40px;
  border-width: 3px;
  margin: 0;
}

/* ── Loading Overlay ── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 48, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius);
}

/* ── Theme Toggle Button ── */
#theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
}

.theme-toggle-auth {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  z-index: 10;
}

.theme-toggle-auth:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

/* ── Copy Button ── */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.copy-btn-small {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.copy-btn-small:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* ── Button Spinner State ── */
.btn .spinner {
  margin-right: 0.5rem;
}

/* ── Error Boundary ── */
.error-boundary {
  padding: 3rem;
  text-align: center;
}

.error-boundary h1 {
  margin-bottom: 1rem;
  color: var(--danger);
}

/* ── Health Indicator ── */
.health-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

.health-dot--offline {
  background: var(--danger);
  animation: none;
}

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  width: 100%;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-heading {
  height: 1.5em;
  width: 40%;
  margin-bottom: 1rem;
}

.skeleton-card {
  height: 120px;
  margin-bottom: 1rem;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-table-row {
  height: 3rem;
  margin-bottom: 0.25rem;
}

/* ── Password Strength Meter ── */
.password-strength {
  display: flex;
  gap: 4px;
  margin-top: 0.5rem;
  height: 4px;
}

.password-strength .bar {
  flex: 1;
  height: 100%;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s ease;
}

.password-strength .bar.active.weak {
  background: var(--danger);
}

.password-strength .bar.active.medium {
  background: var(--warning);
}

.password-strength .bar.active.strong {
  background: var(--success);
}

.password-strength-label {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  min-height: 1.2em;
}

.password-strength-label.weak {
  color: var(--danger);
}

.password-strength-label.medium {
  color: var(--warning);
}

.password-strength-label.strong {
  color: var(--success);
}

/* ── Form Loading Spinner ── */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn-loading::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Animated Page Transition ── */
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-enter {
  animation: pageEnter 0.35s ease forwards;
}

/* ── Light theme overrides for specific elements ── */
[data-theme="light"] .nav-menu {
  background: var(--surface-solid);
}

[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .card {
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

[data-theme="light"] .hero-shape {
  opacity: 0.4;
}

[data-theme="light"] .feature-icon {
  background: rgba(99, 102, 241, 0.08);
}

[data-theme="light"] code, [data-theme="light"] pre {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] input, [data-theme="light"] textarea, [data-theme="light"] select {
  background: #fff;
  border-color: rgba(99, 102, 241, 0.15);
}

/* ── Accessibility ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 0.5rem;
  z-index: 999;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .bg-orb {
    animation: none !important;
  }
}

/* Shared visual system: neutral surfaces, clear hierarchy, accessible controls. */
:root {
  --bg: #0d1218;
  --bg-elevated: #141b23;
  --surface: #151d26;
  --surface-solid: #151d26;
  --surface-hover: #1d2833;
  --border: #293440;
  --border-bright: #435969;
  --text: #f0f4f7;
  --text-secondary: #acb9c6;
  --muted: #93a3b3;
  --accent: #5ee0bc;
  --accent-2: #5ee0bc;
  --accent-hover: #93efd4;
  --glow: rgba(94, 224, 188, .12);
  --font: 'Inter', system-ui, sans-serif;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 16px 48px #0003;
  --shadow-glow: none;
}
[data-theme="light"] {
  --bg: #f7f9fa;
  --bg-elevated: #fff;
  --surface: #fff;
  --surface-solid: #fff;
  --surface-hover: #edf3f2;
  --border: #dbe3e6;
  --border-bright: #9aafb1;
  --text: #14252b;
  --text-secondary: #4d626b;
  --muted: #586d76;
  --accent: #087b61;
  --accent-2: #087b61;
  --accent-hover: #065d4a;
  --shadow: 0 16px 48px #14252b0a;
}
.bg-scene { display: none; }
.container { width: min(1200px, calc(100% - 64px)); padding-top: 0; }
.nav, [data-theme="light"] .nav { background: var(--bg); box-shadow: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 20px 0; margin-bottom: 32px; animation: none; backdrop-filter: none; }
.nav::before { display: none; }
.brand { font-size: 20px; letter-spacing: -.7px; }
.nav-actions { gap: 8px; }
.nav .btn { font-size: 12px; padding: 10px 12px; }
.nav .btn-secondary { background: transparent; border-color: transparent; color: var(--text-secondary); box-shadow: none; }
.nav .btn-secondary:hover { background: var(--surface-hover); color: var(--text); }
.btn { min-height: 44px; border-radius: 8px; font-weight: 600; letter-spacing: 0; }
.btn-primary, [data-theme="light"] .btn-primary { background: var(--accent); color: var(--bg); box-shadow: none; border: 1px solid transparent; }
.btn-primary:hover, [data-theme="light"] .btn-primary:hover { background: var(--accent-hover); color: var(--bg); box-shadow: none; transform: none; }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
button, input, select, textarea { font: inherit; }
input, select, textarea { max-width: 100%; }
input:not([type="checkbox"]):not([type="radio"]), select { min-height: 44px; }
pre { max-width: 100%; overflow-x: auto; }
.card { box-shadow: none; }
.nav-toggle { width: 44px; height: 44px; }
@media (max-width: 1100px) {
  .nav { flex-wrap: wrap; }
  .nav-menu { max-width: 100%; }
}
@media (max-width: 820px) {
  .container { width: calc(100% - 32px); }
  .nav { position: relative; top: 0; padding: 16px 0; }
  .nav-menu { display: none; position: absolute; top: calc(100% + 8px); right: 0; bottom: auto; width: 100%; max-height: 75dvh; padding: 12px; border: 1px solid var(--border); border-radius: 12px; transform: none; background: var(--surface-solid); box-shadow: var(--shadow); }
  .nav-open .nav-menu { display: flex; }
  .nav-menu::before { display: none; }
  .nav-menu .btn { min-height: 44px; justify-content: flex-start; }
  .nav-menu .nav-actions { align-items: stretch; }
}
