:root {
  --primary: #5865F2;
  --primary-hover: #4752C4;
  --primary-glow: rgba(88, 101, 242, 0.25);
  --blurple: #5865F2;
  --blurple-hover: #4752C4;

  /* Surfaces & Backgrounds */
  --bg: #0f1117;
  --bg-deep: #090a0f;
  --card: #161822;
  --card-hover: #1b1e2b;
  --card-border: #232738;
  --input: #12141c;
  --border: #232738;
  --border-light: rgba(255, 255, 255, 0.08);

  /* Typography & Colors */
  --text: #f3f4f6;
  --text-heading: #ffffff;
  --muted: #9ca3af;
  --muted-2: #6b7280;

  /* Feedback Colors */
  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.12);
  --ok-border: rgba(16, 185, 129, 0.3);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.12);
  --warn-border: rgba(245, 158, 11, 0.3);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);
  --info-border: rgba(59, 130, 246, 0.3);

  /* Geometry & Layout */
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--card-border);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --max: 880px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(1000px 500px at 50% -10%, rgba(88, 101, 242, 0.15), transparent 60%),
    radial-gradient(800px 400px at 90% 10%, rgba(59, 130, 246, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #60a5fa;
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88em;
  background: var(--input);
  color: #e5e7eb;
  padding: 0.15em 0.45em;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.page {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  padding: 0.75rem 1rem;
  background: rgba(22, 24, 34, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}
.brand-link:hover {
  text-decoration: none;
}

.brand-mark {
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.2s ease;
}
.brand-link:hover .brand-mark {
  transform: scale(1.08) rotate(5deg);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.025em;
  color: #ffffff;
}

.brand-tag {
  font-size: 0.75rem;
  color: var(--muted-2);
  font-weight: 500;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.nav-user {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Typography Helpers */
.blurple { color: var(--primary); }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small { font-size: 0.9rem; }
.tiny { font-size: 0.78rem; }
.center { text-align: center; }
.mb { margin-bottom: 0.85rem; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: var(--muted-2);
}
.eyebrow.blurple { color: #818cf8; }

h1, h2, h3, h4 {
  color: var(--text-heading);
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0 0 0.6rem;
  font-weight: 700;
}
h1 { font-size: clamp(1.6rem, 3.8vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

.lede {
  margin: 0 0 1.2rem;
  font-size: 1.02rem;
  line-height: 1.6;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease;
}

.hero {
  background:
    radial-gradient(ellipse at top right, rgba(88, 101, 242, 0.15), transparent 70%),
    linear-gradient(180deg, rgba(22, 24, 34, 0.95), rgba(18, 20, 28, 0.95));
  border: 1px solid rgba(88, 101, 242, 0.3);
  position: relative;
  overflow: hidden;
}

.spec-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0;
  margin: 1.2rem 0 0;
}
.spec-row li {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
}
.spec-row li span {
  color: #ffffff;
  font-weight: 700;
  margin-right: 0.3rem;
}

/* Subnav / Tabs */
.subnav {
  display: flex;
  gap: 0.4rem;
  padding: 0.35rem;
  background: rgba(18, 20, 28, 0.85);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }

.sticky-subnav {
  position: sticky;
  top: 0.75rem;
  z-index: 25;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(18, 20, 28, 0.85);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.subnav-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex: 1 0 auto;
  transition: all 0.15s ease;
}
.subnav-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}
.subnav-btn.is-active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: tab-fade 0.2s ease; }

@keyframes tab-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Forms */
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}
.field span,
.field legend {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  font: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  background: #151824;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.field textarea {
  resize: vertical;
  min-height: 95px;
  line-height: 1.5;
}

.check-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  user-select: none;
}
.check-row input {
  margin-top: 0.2rem;
  accent-color: var(--primary);
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  cursor: pointer;
}

/* Buttons */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.15rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  color: #ffffff;
  background: #2b2f42;
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: #363b52;
  text-decoration: none;
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(1px);
}
.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  border-radius: 6px;
}
.btn-block {
  width: 100%;
}
.btn-blurple {
  background: var(--primary);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-blurple:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 18px var(--primary-glow);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  box-shadow: none;
}
.btn-ghost:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}
.btn-ok {
  background: #059669;
}
.btn-ok:hover {
  background: #10b981;
}
.btn-warn {
  background: #d97706;
  color: #ffffff;
}
.btn-warn:hover {
  background: #f59e0b;
}
.btn-danger {
  background: #dc2626;
}
.btn-danger:hover {
  background: #ef4444;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.action-row form { margin: 0; }
.action-row .btn { min-width: 5.5rem; }
.action-row.wrap { margin-top: 1rem; }

/* Flash Messages */
.flash {
  border-radius: var(--radius);
  overflow: hidden;
  animation: flash-in 0.25s ease;
  margin-bottom: 0.5rem;
}
.flash-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
}
.flash-text {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
}
.flash-icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
}
.flash-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  transition: opacity 0.15s;
}
.flash-close:hover { opacity: 1; }
.flash-success {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: #6ee7b7;
}
.flash-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #fca5a5;
}
.flash-info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: #93c5fd;
}
.flash.is-hiding {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Callouts */
.callout {
  border-radius: var(--radius-sm);
  padding: 0.95rem 1.1rem;
  margin: 1rem 0;
  text-align: left;
  line-height: 1.5;
}
.callout strong {
  display: block;
  margin-bottom: 0.3rem;
  color: #ffffff;
}
.callout-info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: #bfdbfe;
}
.callout-rules {
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.25);
  color: #c7d2fe;
}
/* Used by the AI-key "not configured" notices, the VPS password reveal page,
   and the review-queue "flag cleared" callout. Had no rule until now, so these
   rendered as invisible text on the card background. */
.callout-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: #fcd9a1;
}
.callout-warn strong { color: var(--warn); }
.callout-ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: #a7f3d0;
}
.callout-ok strong { color: var(--ok); }

.rules-list {
  margin: 0.4rem 0 0;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.rules-list li { margin: 0.3rem 0; }

/* Check-in Prose */
.checkin-prose {
  color: var(--muted);
  font-size: 0.92rem;
}
.checkin-prose p { margin: 0 0 0.75rem; }
.checkin-prose h3 {
  margin: 1.2rem 0 0.5rem;
  color: #ffffff;
  font-size: 1.05rem;
}
.checkin-policy-card .stack-form {
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.spec-list {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 1.2rem;
}
.spec-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0;
  color: var(--text);
  font-size: 0.92rem;
}
.spec-list .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* VPS Cards */
.vps-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.vps-card:hover {
  border-color: rgba(88, 101, 242, 0.35);
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.6);
}

.vps-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1.2rem;
  margin: 0 0 1.2rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.meta-grid dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-2);
  font-weight: 700;
}
.meta-grid dd {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: #ffffff;
  word-break: break-word;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-ok {
  background: var(--ok-bg);
  color: #34d399;
  border: 1px solid var(--ok-border);
}
.badge-danger {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid var(--danger-border);
}
.badge-warn {
  background: var(--warn-bg);
  color: #fbbf24;
  border: 1px solid var(--warn-border);
}
.badge-muted {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid var(--border);
}

.vps-grid {
  display: grid;
  gap: 1.25rem;
}

/* Dashboard Hero */
.dash-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.pill {
  background: rgba(88, 101, 242, 0.12);
  color: #c7d2fe;
  border: 1px solid rgba(88, 101, 242, 0.25);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}
.pill:hover {
  background: rgba(88, 101, 242, 0.25);
  color: #ffffff;
  text-decoration: none;
}
.muted-pill {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--muted);
}
.pill-active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Empty / Auth */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}
.empty-icon {
  font-size: 2.8rem;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.auth-wrap {
  display: grid;
  place-items: start center;
  min-height: calc(100vh - 220px);
}
.auth-card {
  width: 100%;
  max-width: 460px;
}
.auth-card.wide {
  max-width: 600px;
}

/* Footer */
.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.site-footer p {
  margin: 0.25rem 0;
  font-size: 0.88rem;
}

/* Data Tables */
.table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td {
  border-bottom: 0;
}
.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.data-table th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.select-sm {
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  outline: none;
}
.role-form {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.btn-danger-text {
  color: var(--danger) !important;
}

.page.wide,
body.admin-wide .page {
  --max: 1060px;
}

/* Impersonation Banner */
.impersonation-banner {
  background: linear-gradient(90deg, #d97706 0%, #b45309 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
}
.impersonation-inner {
  max-width: var(--max, 880px);
  margin: 0 auto;
  padding: 0.65rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.impersonation-text {
  margin: 0;
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
}
.impersonation-icon { font-size: 1.2rem; }

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem 1.2rem;
}
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.checkbox-field input { width: auto; }

.copy-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.copy-url {
  display: block;
  word-break: break-all;
  background: var(--input);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex: 1;
  font-size: 0.85rem;
}
.card-highlight {
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.04);
}

/* Virtualizor Panel CTA */
.btn-panel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, #4f46e5 0%, #059669 100%);
  color: #ffffff !important;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-panel:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}
.btn-panel.btn-lg {
  padding: 0.75rem 1.4rem;
  font-size: 0.98rem;
}
.btn-panel.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.card-panel-cta {
  border: 1px solid rgba(79, 70, 229, 0.35);
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.08), transparent 80%), var(--card);
  margin-bottom: 1.25rem;
}
.panel-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

/* Docs & Manuals */
.btn-docs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(88, 101, 242, 0.12);
  color: #c7d2fe;
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-docs:hover {
  background: rgba(88, 101, 242, 0.25);
  color: #ffffff;
  border-color: rgba(88, 101, 242, 0.5);
  text-decoration: none;
}
.btn-docs.is-active,
.btn-docs:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn-docs.btn-sm {
  padding: 0.32rem 0.75rem;
  font-size: 0.82rem;
}

.docs-hero {
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.1), rgba(18, 20, 28, 0.6));
  margin-bottom: 1.25rem;
}
.docs-hero-staff {
  border-color: rgba(239, 68, 68, 0.35);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(18, 20, 28, 0.6));
}
.docs-callout-card {
  border-color: var(--border);
  background: rgba(0, 0, 0, 0.2);
}
.docs-callout-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  align-items: flex-end;
}
.docs-article.docs-prose {
  max-width: 960px;
  margin: 0 auto 2.5rem;
  line-height: 1.65;
}
.docs-prose .docs-h {
  scroll-margin-top: 5rem;
  margin-top: 1.8rem;
  color: #ffffff;
}
.docs-prose h1.docs-h { font-size: 1.75rem; }
.docs-prose h2.docs-h {
  font-size: 1.35rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.docs-prose h3.docs-h { font-size: 1.15rem; color: #a5b4fc; }
.docs-prose h4.docs-h { font-size: 1rem; color: var(--muted); }
.docs-prose .docs-list { padding-left: 1.35rem; margin: 0.6rem 0 1rem; }
.docs-prose .docs-list li { margin: 0.35rem 0; }
.docs-prose .docs-hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.75rem 0;
}
.docs-prose .docs-pre {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.docs-prose .docs-table-wrap { margin: 1rem 0 1.25rem; }

/* ── Knowledge Base ─────────────────────────────────────────── */
.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.kb-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.kb-card:hover {
  border-color: rgba(88, 101, 242, 0.5);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.kb-card .kb-card-icon {
  font-size: 1.9rem;
  line-height: 1;
}
.kb-card h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-heading);
}
.kb-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.kb-card .kb-card-meta {
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--muted-2);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.kb-figure {
  margin: 1.5rem 0;
  text-align: center;
}
.kb-figure img {
  /* Never let a figure eat the page: cap BOTH axes so a tall full-page
     shot renders small and centered instead of 4 screenfuls tall. */
  max-width: 100%;
  max-height: 62vh;
  width: auto;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  background: var(--bg-deep);
}
.kb-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted-2);
}
img.kb-img {
  max-width: 100%;
  height: auto;
}
.kb-quote {
  margin: 1.1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--blurple);
  background: rgba(88, 101, 242, 0.07);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.kb-quote p {
  margin: 0;
  color: var(--text);
}
.docs-list li.kb-sub {
  margin-left: 1.2rem;
  list-style: circle;
}
.kb-article-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
/* Chat playground */
.kb-chat-log {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 55vh;
  min-height: 120px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.kb-chat-msg {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  background: rgba(0, 0, 0, 0.22);
}
.kb-chat-msg.user {
  border-color: rgba(88, 101, 242, 0.45);
  background: rgba(88, 101, 242, 0.09);
}
.kb-chat-who {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 0.25rem;
}
.kb-chat-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
}
.kb-chat-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  margin-top: 0.75rem;
}
.kb-chat-form textarea {
  width: 100%;
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font: inherit;
  resize: vertical;
}

/* Responsive */
@media (max-width: 640px) {
  .page {
    width: min(100% - 1.25rem, var(--max));
    padding: 1rem 0 3rem;
  }
  .site-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.85rem;
  }
  .top-nav {
    justify-content: flex-start;
  }
  .card {
    padding: 1.15rem 1.15rem;
  }
  .meta-grid {
    grid-template-columns: 1fr;
  }
  .action-row .btn {
    flex: 1 1 calc(50% - 0.5rem);
  }
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Docs: callouts (GitHub-style admonitions) ──────────────── */
.kb-callout {
  --co-fg: var(--info);
  --co-bg: var(--info-bg);
  --co-bd: var(--info-border);
  margin: 1.25rem 0;
  padding: 0.85rem 1.05rem 0.9rem;
  border: 1px solid var(--co-bd);
  border-left: 3px solid var(--co-fg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background:
    linear-gradient(90deg, var(--co-bg), transparent 70%),
    rgba(0, 0, 0, 0.16);
}
.kb-callout-tip      { --co-fg: var(--ok);      --co-bg: var(--ok-bg);      --co-bd: var(--ok-border); }
.kb-callout-important{ --co-fg: var(--blurple); --co-bg: rgba(88,101,242,.12); --co-bd: rgba(88,101,242,.32); }
.kb-callout-warning,
.kb-callout-caution  { --co-fg: var(--warn);    --co-bg: var(--warn-bg);    --co-bd: var(--warn-border); }
.kb-callout-danger   { --co-fg: var(--danger);  --co-bg: var(--danger-bg);  --co-bd: var(--danger-border); }

.kb-callout-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--co-fg);
}
.kb-callout-body { color: var(--text); }
.kb-callout-body p { margin: 0; }
.kb-callout-body p + p { margin-top: 0.5rem; }
.kb-callout-body code {
  background: rgba(0, 0, 0, 0.35);
  border-color: var(--co-bd);
}

/* ── Docs: two-column reading layout with sticky TOC ────────── */
.docs-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto 2.5rem;
}
/* Grid items default to min-width:auto and refuse to shrink below the widest
   table — that is what pushed .docs-article past the viewport on phones. */
.docs-layout > .docs-article { min-width: 0; }
.docs-article.docs-prose .docs-pre,
.docs-article.docs-prose .table-wrap { max-width: 100%; }
.docs-toc {
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 0.85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(88, 101, 242, 0.07), transparent 40%),
    rgba(0, 0, 0, 0.22);
  scrollbar-width: thin;
}
.docs-toc-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.docs-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}
.docs-toc-list li { margin: 0; }
.docs-toc-list a {
  display: block;
  padding: 0.3rem 0.6rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.83rem;
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.docs-toc-list a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.docs-toc-list a.is-active {
  color: var(--text-heading);
  border-left-color: var(--blurple);
  background: rgba(88, 101, 242, 0.12);
  font-weight: 600;
}
.docs-toc-l3 { padding-left: 1.4rem; font-size: 0.79rem; }

@media (max-width: 980px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .docs-toc {
    position: static;
    max-height: none;
    order: -1;
  }
  .docs-toc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-left: 0;
  }
  .docs-toc-list a {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
  }
  .docs-toc-list a.is-active {
    border-color: rgba(88, 101, 242, 0.5);
    background: rgba(88, 101, 242, 0.16);
  }
  .docs-toc-l3 { padding-left: 0.65rem; }
}

/* ── Docs: article typography polish ────────────────────────── */
.docs-article.docs-prose { line-height: 1.7; }
.docs-prose > p { color: #d7dbe6; }
.docs-prose h2.docs-h {
  position: relative;
  margin-top: 2.4rem;
  padding-bottom: 0.45rem;
  letter-spacing: -0.01em;
}
.docs-prose h2.docs-h::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 46px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--blurple), transparent);
}
.docs-prose h3.docs-h { margin-top: 1.7rem; letter-spacing: -0.005em; }

/* Hover anchor on any heading (JS adds the <a>, CSS shows it on hover only) */
.docs-anchor {
  margin-left: 0.4rem;
  font-size: 0.85em;
  color: var(--blurple);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.docs-h:hover .docs-anchor,
.docs-anchor:focus-visible { opacity: 1; }

/* Inline code */
.docs-prose code, .kb-callout-body code {
  background: rgba(88, 101, 242, 0.1);
  border: 1px solid rgba(88, 101, 242, 0.2);
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
  font-size: 0.86em;
  color: #c7d2fe;
}
.docs-prose .docs-pre code {
  background: none;
  border: 0;
  padding: 0;
  color: #d1d5db;
}

/* Code blocks get a language chip */
.docs-prose .docs-pre {
  position: relative;
  background:
    linear-gradient(180deg, rgba(88, 101, 242, 0.06), transparent 60px),
    var(--bg-deep);
}
.docs-prose .docs-pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.45rem;
  right: 0.6rem;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* Tables read like spec sheets (.docs-table-wrap IS the .table-wrap element) */
.docs-prose .docs-table { font-size: 0.88rem; }
.docs-prose .docs-table th {
  background: rgba(88, 101, 242, 0.1);
  color: var(--text-heading);
}
.docs-prose .docs-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.022); }
.docs-prose .docs-table td:first-child { color: var(--text-heading); font-weight: 500; }

/* Docs hero fact strip */
.docs-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.docs-fact {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}
.docs-fact-k {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.docs-fact-v {
  font-size: 0.82rem;
  color: var(--text);
}

/* ===== AI Tokens — usage stats ===== */
.usage-card {
  margin-top: 1rem;
}
.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
}
.usage-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
}
.usage-tile .num {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.usage-tile .label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-2);
  line-height: 1.35;
}
.usage-charts {
  display: grid;
  gap: 1rem;
  margin-top: 1.1rem;
}
.usage-chart {
  min-width: 0;
}
.usage-chart-title {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.usage-chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.usage-chart .usage-baseline {
  stroke: var(--border);
  stroke-width: 1;
}
.usage-chart .usage-axis {
  fill: var(--muted-2);
  font-size: 15px;
  font-family: var(--font);
}
.usage-chart .usage-peak {
  fill: var(--muted);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
}
.usage-table {
  margin-top: 0.25rem;
}
.usage-table td {
  font-variant-numeric: tabular-nums;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
