/* NexaAI design system. Light, neutral gray/black/white -- plain developer-
   platform register, no color accent beyond black/white states. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #FFFFFF;
  --surface: #F6F6F7;
  --surface-hover: #EFEFF1;
  --elevated: #FFFFFF;
  --border: #E1E1E4;
  --border-strong: #CCCCD1;

  --text: #17171A;
  --text-dim: #6B6B72;
  --text-faint: #9C9CA3;

  --accent: #17171A;
  --accent-dim: #000000;
  --accent-bg: #F0F0F1;
  --accent-fg: #FFFFFF;

  --success: #1A7F4B;
  --success-bg: #E9F6EF;
  --warning: #92660C;
  --warning-bg: #FBF1DD;
  --danger: #B3261E;
  --danger-bg: #FBEAE9;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

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

code.inline {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
}

pre.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  position: relative;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

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

/* --- Top nav, shared across all pages --- */

.topnav {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-dim);
}

.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--text); }

.topnav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}

.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent-dim); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }

.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-strong); }

.btn-ghost { background: none; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }

.btn-danger { background: none; border-color: var(--border); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* --- Forms --- */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent-dim);
}
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 5px; }

/* --- Cards / panels --- */

.panel {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-body { padding: 18px; }

/* --- Tables --- */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 11.5px;
  text-transform: none;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface); }
.table-wrap { overflow-x: auto; }

/* --- Pills / status badges --- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; }

.pill.success { background: var(--success-bg); color: var(--success); }
.pill.success .pill-dot { background: var(--success); }
.pill.warning { background: var(--warning-bg); color: var(--warning); }
.pill.warning .pill-dot { background: var(--warning); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.danger .pill-dot { background: var(--danger); }
.pill.neutral { background: var(--elevated); color: var(--text-dim); }
.pill.neutral .pill-dot { background: var(--text-faint); }

/* --- Toasts --- */

#toastRoot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: var(--elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  animation: toast-in 0.15s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Empty / loading / error states --- */

.state-block {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 13.5px;
}
.state-block .state-title { color: var(--text); font-size: 14.5px; font-weight: 500; margin-bottom: 5px; }

/* --- Copy button on code blocks --- */

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  cursor: pointer;
  font-family: var(--font-sans);
}
.copy-btn:hover { color: var(--text); }

/* --- Utility --- */

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--font-mono); }

@media (max-width: 720px) {
  .nav-links { display: none; }
}
