/* ===== Design System: Hermes SaaS ===== */
:root {
  --bg-primary: #03030a;
  --bg-secondary: #0a0a16;
  --bg-card: rgba(12, 12, 24, 0.6);
  --bg-card-hover: rgba(20, 20, 40, 0.8);
  --border: rgba(99, 102, 241, 0.08);
  --border-hover: rgba(99, 102, 241, 0.25);
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --accent-soft: #818cf8;
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.2);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.12);
  --text: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #555570;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Background grid */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none; z-index: 0;
}

/* Glow */
body::after {
  content: '';
  position: fixed;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background:
    radial-gradient(ellipse 60% 50% at 25% 15%, rgba(99,102,241,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 75% 85%, rgba(99,102,241,0.025) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

.wrapper { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; }
.main { flex: 1; padding: 48px 0 80px; }

/* ===== Content width ===== */
.narrow  { max-width: 440px; margin: 0 auto; }
.medium  { max-width: 680px; margin: 0 auto; }
.content { max-width: 960px; margin: 0 auto; padding: 0 32px; width: 100%; }

/* ===== Typography – Golden Ratio (1.618), Basis 15px ===== */
h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 20px; }
h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; margin-bottom: 6px; }
h3 { font-size: 20px; font-weight: 500; line-height: 1.3; margin-bottom: 4px; }
p  { margin-bottom: 16px; }

.hero     { font-size: 44px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; }
.display  { font-size: 60px; font-weight: 700; letter-spacing: -0.05em; line-height: 1.05; }

.text-xs  { font-size: 13px; line-height: 1.5; }
.text-sm  { font-size: 15px; line-height: 1.6; }
.text-base { font-size: 20px; line-height: 1.4; }

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

code, .mono { font-family: var(--font-mono); }

/* ===== Nav ===== */
.nav {
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  background: rgba(3,3,10,0.65);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 960px; margin: 0 auto; padding: 16px 32px;
}
.nav-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
  font-size: 16px; font-weight: 600; letter-spacing: -0.02em;
}
.nav-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
  padding: 8px 16px; border-radius: 8px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 14px; transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--accent-soft); background: rgba(99,102,241,0.1); }
.nav-user { color: var(--text-muted); font-size: 13px; margin: 0 12px 0 8px; cursor: default; }
.nav-logout { padding: 8px 14px; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-size: 14px; transition: all 0.15s; }
.nav-logout:hover { color: var(--red); background: var(--red-glow); }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all 0.2s;
}
.card-hover:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.card-gradient {
  background: linear-gradient(145deg, rgba(10,10,20,0.6), rgba(15,15,28,0.4));
  border: 1px solid var(--border);
  border-radius: 20px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 12px;
  font-size: 14px; font-weight: 500; font-family: var(--font-sans);
  cursor: pointer; transition: all 0.15s; text-decoration: none; border: none;
}
.btn-primary {
  background: var(--accent); color: white;
  box-shadow: 0 4px 24px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-soft); transform: translateY(-1px); box-shadow: 0 6px 32px var(--accent-glow); }
.btn-secondary {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); color: var(--text); background: rgba(255,255,255,0.02); }
.btn-danger {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-danger:hover { border-color: rgba(239,68,68,0.2); color: var(--red); background: var(--red-glow); }
.btn-sm { padding: 10px 18px; border-radius: 10px; font-size: 13px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover { border-color: var(--border-hover); color: var(--text); background: rgba(255,255,255,0.03); }

/* ===== Forms ===== */
.input {
  width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  color: var(--text); font-size: 15px; font-family: var(--font-sans);
  outline: none; transition: all 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(99,102,241,0.12); }
.input::placeholder { color: var(--text-muted); }
.input-mono { font-family: var(--font-mono); font-size: 13px; }
label { display: block; font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500; }

/* ===== Status ===== */
.status-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; position: relative; flex-shrink: 0;
}
.status-dot.running { background: var(--green); box-shadow: 0 0 10px var(--green-glow); }
.status-dot.running::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  animation: pulse-ring 2s ease-out infinite;
}
.status-dot.stopped { background: var(--red); box-shadow: 0 0 10px var(--red-glow); }
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.5); opacity: 0; }
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.badge-green { background: rgba(34,197,94,0.08); color: var(--green); }
.badge-red { background: rgba(239,68,68,0.08); color: var(--red); }
.badge-muted { background: rgba(255,255,255,0.03); color: var(--text-muted); }

/* ===== Alert ===== */
.alert {
  padding: 16px 20px; border-radius: 12px; font-size: 14px; margin-bottom: 24px;
  display: flex; align-items: center; gap: 12px;
}
.alert-error { background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.15); color: #f0a0a0; }
.alert-success { background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.15); color: #86efac; }

/* ===== Spacing & Layout ===== */
.section { margin-bottom: 40px; }
.section-sm { margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 800px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.mb-0 { margin-bottom: 0; }
.mt-6 { margin-top: 32px; }
.mt-8 { margin-top: 48px; }
.mb-4 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 40px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.text-center { text-align: center; }
.shrink-0 { flex-shrink: 0; }
.icon-box {
  width: 64px; height: 64px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(99,102,241,0.04));
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.icon-box-sm {
  width: 48px; height: 48px; border-radius: 14px;
  background: rgba(99,102,241,0.08); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline { display: inline; }
.p-6 { padding: 28px; }
.p-8 { padding: 36px; }

/* ===== Token grid ===== */
.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}
.token-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 10px;
  background: rgba(0,0,0,0.15); border: 1px solid var(--border);
  gap: 8px;
}

/* ===== Icon helper ===== */
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeIn 0.35s ease-out; }
.animate-in-d1 { animation: fadeIn 0.35s ease-out 0.06s both; }
.animate-in-d2 { animation: fadeIn 0.35s ease-out 0.12s both; }

/* ===== User list in Admin ===== */
.user-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(99,102,241,0.08); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 13px; font-weight: 600; color: var(--accent-soft);
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0; margin-top: auto; text-align: center;
  font-size: 12px; color: var(--text-muted);
}
