:root {
  --bg: #0b1220;
  --bg-elevated: #111827;
  --card: #151f32;
  --border: #243044;
  --text: #e8eef9;
  --muted: #94a3b8;
  --primary: #0ea5e9;
  --primary-hover: #38bdf8;
  --danger: #f43f5e;
  --success: #10b981;
  --warn: #f59e0b;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

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

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

.wrap { width: min(1100px, calc(100% - 2rem)); margin: 0 auto; }
.main { padding: 1.75rem 0 3rem; }

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}
.brand-mark {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  letter-spacing: 0.04em;
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.nav a {
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}
.nav a:hover, .nav a.active { color: var(--text); }
.nav-user { color: var(--text); font-size: 0.9rem; }

.footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

h1 { font-size: 1.75rem; margin: 0 0 0.35rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.tiny { font-size: 0.75rem; }
.mt { margin-top: 1.25rem; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-actions { display: flex; gap: 0.5rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

.auth-shell {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
}
.auth-card { width: min(420px, 100%); }
.auth-header { margin-bottom: 1.25rem; }
.auth-foot { margin-top: 1.25rem; font-size: 0.875rem; }

.form { display: flex; flex-direction: column; gap: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
.field span, .field-inline span { font-weight: 600; color: #cbd5e1; }
.hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.field input, .field select, .field-inline select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font: inherit;
}
.field input:focus, .field select:focus {
  outline: 2px solid rgba(14, 165, 233, 0.45);
  border-color: var(--primary);
}
.form-inline, .field-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.inline-form { display: inline; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--bg-elevated);
  color: var(--text);
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-primary { background: var(--primary); color: #041016; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: rgba(244, 63, 94, 0.15); color: #fda4af; border-color: rgba(244, 63, 94, 0.35); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

.alert {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.925rem;
}
.alert-error { background: rgba(244, 63, 94, 0.12); border: 1px solid rgba(244, 63, 94, 0.35); color: #fecdd3; }
.alert-success { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.35); color: #a7f3d0; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  vertical-align: middle;
}
.badge-admin { background: rgba(99, 102, 241, 0.25); color: #c7d2fe; margin-left: 0.35rem; }
.badge-ok { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge-danger { background: rgba(244, 63, 94, 0.2); color: #fda4af; }
.badge-warn { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
}
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.steps { margin: 0 0 1rem 1.1rem; padding: 0; color: var(--muted); }
.steps li { margin-bottom: 0.35rem; }

.code-sample, pre.code-sample {
  background: #0a0f1a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-all;
}

.token-reveal { border-color: rgba(14, 165, 233, 0.45); margin-bottom: 1.25rem; }
.token-copy-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin: 0.75rem 0;
  flex-wrap: wrap;
}
.token-value {
  flex: 1;
  background: #0a0f1a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  word-break: break-all;
  min-width: 0;
}

.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.table th, .table td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table code { font-family: var(--mono); font-size: 0.8rem; }
.row-muted { opacity: 0.65; }
.actions { white-space: nowrap; }
.empty { padding: 0.5rem 0 0.25rem; }

.docs-header { margin-bottom: 1rem; }
.docs-intro { margin-bottom: 1.25rem; }
.swagger-host {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 400px;
}
/* Soften swagger top bar against our chrome */
.swagger-ui .topbar { display: none; }
.swagger-ui .info { margin: 20px 0; }
