/* ============================================
   Ruflo — Premium typography-first design.
   Light + Dark, set via [data-theme="..."] on <html>.
   ============================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-elev: #ffffff;
  --text: #0a0a0a;
  --text-soft: #5a5a5a;
  --text-muted: #8a8a8a;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --accent: #0a0a0a;
  --accent-text: #ffffff;
  --accent-hover: #2a2a2a;
  --link: #0a0a0a;
  --code-bg: #f5f5f5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --max-w: 1180px;
  --nav-h: 64px;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-soft: #141414;
  --bg-elev: #1a1a1a;
  --text: #f0f0f0;
  --text-soft: #a8a8a8;
  --text-muted: #6e6e6e;
  --border: #262626;
  --border-strong: #333333;
  --accent: #ffffff;
  --accent-text: #0a0a0a;
  --accent-hover: #e5e5e5;
  --link: #ffffff;
  --code-bg: #161616;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  transition: background-color 0.15s ease, color 0.15s ease;
}

a { color: var(--link); text-decoration: none; }
a:hover { opacity: 0.7; }

code, pre, .mono {
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-variant-ligatures: none;
}

/* ===== Nav ===== */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

[data-theme="dark"] .nav { background: rgba(10, 10, 10, 0.75); }

.nav-inner {
  width: 100%; max-width: var(--max-w);
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}

.brand {
  font-weight: 600; font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--text);
  display: inline-block;
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--bg);
}

.nav-links {
  display: flex; align-items: center; gap: 4px;
}
.nav-links a {
  color: var(--text-soft);
  font-size: 14px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background-color 0.12s ease, color 0.12s ease;
}
.nav-links a:hover { background: var(--bg-soft); color: var(--text); opacity: 1; }
.nav-links a.active { color: var(--text); background: var(--bg-soft); }

.nav-actions {
  display: flex; align-items: center; gap: 8px;
}

.theme-toggle {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: none;
  background: transparent; cursor: pointer;
  color: var(--text-soft);
  transition: background-color 0.12s ease, color 0.12s ease;
}
.theme-toggle:hover { background: var(--bg-soft); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font: inherit; font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn.primary {
  background: var(--accent); color: var(--accent-text);
  border-color: var(--accent);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); opacity: 1; }
.btn.ghost {
  background: transparent; color: var(--text);
  border-color: var(--border-strong);
}
.btn.ghost:hover { background: var(--bg-soft); opacity: 1; }
.btn.large { padding: 14px 28px; font-size: 15px; }
.btn.small { padding: 6px 14px; font-size: 13px; }

/* ===== Page wrapper ===== */
main { min-height: calc(100vh - var(--nav-h)); }
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
}
.section { padding: 96px 0; }
.section.tight { padding: 64px 0; }
.section-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 56px;
}
.eyebrow {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 14px;
}
h1, h2, h3, h4 {
  letter-spacing: -0.022em;
  font-weight: 600;
  margin: 0 0 0.4em;
  color: var(--text);
}
h1 { font-size: clamp(40px, 5.5vw, 68px); line-height: 1.05; font-weight: 600; letter-spacing: -0.03em; }
h2 { font-size: clamp(28px, 3vw, 38px); line-height: 1.15; }
h3 { font-size: 19px; line-height: 1.3; }
p { margin: 0 0 1em; color: var(--text-soft); }
.lede { font-size: 19px; line-height: 1.5; color: var(--text-soft); max-width: 640px; margin: 0 auto 36px; }

/* ===== Hero ===== */
.hero {
  padding: 96px 0 80px;
  text-align: center;
}
.hero h1 { color: var(--text); margin-bottom: 20px; }
.hero-cta { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Subtle hero ornament — concentric arcs (replaces the old purple gradient). */
.hero-orb {
  width: 220px; height: 220px;
  margin: 0 auto 40px;
  position: relative;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--text) 0%, transparent 65%);
  opacity: 0.08;
  filter: blur(8px);
  animation: orb 8s ease-in-out infinite alternate;
}
@keyframes orb {
  0%   { transform: scale(1) translateY(0); }
  100% { transform: scale(1.05) translateY(-6px); }
}

/* ===== Card grids ===== */
.grid {
  display: grid;
  gap: 16px;
}
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.card h3 { margin-bottom: 8px; color: var(--text); }
.card p { font-size: 14.5px; line-height: 1.55; margin: 0; color: var(--text-soft); }
.card .icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  color: var(--text);
}
.card .icon svg { width: 18px; height: 18px; }

a.card { color: var(--text); display: block; }
a.card:hover { opacity: 1; }

/* ===== Tier cards (model tiers) ===== */
.tier-card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex; flex-direction: column; gap: 12px;
}
.tier-card.featured { border-color: var(--text); }
.tier-card .tier-badge {
  position: absolute; top: -10px; right: 20px;
  background: var(--accent); color: var(--accent-text);
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.tier-card h3 { margin: 0; font-size: 17px; }
.tier-card .tier-price {
  font-size: 26px; font-weight: 600; color: var(--text);
  letter-spacing: -0.02em;
}
.tier-card .tier-price small { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.tier-card ul {
  list-style: none; padding: 0; margin: 8px 0 0;
  font-size: 14px; color: var(--text-soft);
  display: flex; flex-direction: column; gap: 8px;
}
.tier-card li::before {
  content: '✓'; color: var(--text); margin-right: 8px; font-weight: 600;
}

/* ===== Code blocks ===== */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  margin: 12px 0;
  color: var(--text);
}
code { font-size: 0.92em; }
:not(pre) > code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ===== Playground ===== */
.playground {
  max-width: 980px; margin: 0 auto;
  padding: 56px 28px 96px;
}
.playground-head { text-align: center; margin-bottom: 32px; }
.playground-head h1 { font-size: clamp(32px, 4vw, 44px); margin-bottom: 12px; }
.playground-head p { color: var(--text-soft); margin: 0; }

.chat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
  height: min(680px, calc(100vh - var(--nav-h) - 200px));
  min-height: 480px;
}
.chat-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.chat-toolbar label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-soft);
}
.chat-toolbar select {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 28px 7px 12px; font-size: 13.5px; font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23999'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  cursor: pointer;
}
.chat-toolbar select:hover { border-color: var(--border-strong); }

.toolbar-spacer { flex: 1; }
.toolbar-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 6px 12px; border-radius: var(--radius-sm);
  font: inherit; font-size: 13px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.toolbar-btn:hover { color: var(--text); border-color: var(--border-strong); }

.messages {
  flex: 1; overflow-y: auto;
  padding: 24px;
  display: flex; flex-direction: column; gap: 18px;
}
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg .bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14.5px; line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg.assistant .bubble {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
}
.msg.user .bubble {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
}
.msg .bubble strong {
  display: block; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600;
  opacity: 0.55;
  margin-bottom: 4px;
}
.msg.user .bubble strong { opacity: 0.6; }
.msg .bubble p { margin: 0; color: inherit; }
.msg .bubble code {
  background: rgba(127,127,127,0.15);
  padding: 1px 5px; border-radius: 4px; border: none;
  font-size: 0.9em;
}
.msg.error .bubble {
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
}

.composer {
  display: flex; gap: 10px; padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.composer textarea {
  flex: 1; resize: none;
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit; font-size: 14.5px; line-height: 1.5;
  max-height: 160px;
  transition: border-color 0.12s ease;
}
.composer textarea::placeholder { color: var(--text-muted); }
.composer textarea:focus { outline: none; border-color: var(--text); }
.composer button:disabled { opacity: 0.4; cursor: not-allowed; }

.typing::after {
  content: '▍';
  display: inline-block;
  animation: blink 1s steps(1) infinite;
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 28px;
  margin-top: 60px;
  background: var(--bg-soft);
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-muted);
}
.footer a { color: var(--text-soft); margin-left: 16px; }
.footer a:first-of-type { margin-left: 0; }

/* ===== Docs ===== */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 64px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 28px;
}
.docs-side {
  position: sticky; top: calc(var(--nav-h) + 32px);
  align-self: start;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 14px;
}
.docs-side h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 600;
  margin: 16px 0 6px;
}
.docs-side h4:first-child { margin-top: 0; }
.docs-side a {
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--text-soft);
  transition: background-color 0.12s ease, color 0.12s ease;
}
.docs-side a:hover { background: var(--bg-soft); color: var(--text); opacity: 1; }
.docs-content { max-width: 720px; }
.docs-content h2 { margin-top: 48px; padding-top: 16px; }
.docs-content h2:first-child { margin-top: 0; padding-top: 0; }
.docs-content h3 { margin-top: 32px; }
.docs-content p, .docs-content li { color: var(--text-soft); }
.docs-content ul, .docs-content ol { padding-left: 22px; }

/* ===== Misc ===== */
.kicker {
  display: inline-block;
  font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
  margin-bottom: 16px;
}
.divider {
  height: 1px; background: var(--border); border: 0;
  max-width: var(--max-w); margin: 0 auto;
}

/* ===== Waitlist form ===== */
.waitlist-wrap {
  max-width: 480px;
  margin: 0 auto;
}
.waitlist-form {
  display: flex;
  gap: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 5px 5px 22px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.waitlist-form:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}
[data-theme="dark"] .waitlist-form:focus-within {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}
.waitlist-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 11px 0;
}
.waitlist-form input::placeholder { color: var(--text-muted); }
.waitlist-form button {
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
}
.waitlist-success {
  text-align: center;
  padding: 14px 22px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
}
.waitlist-note {
  font-size: 13px;
  text-align: center;
  margin: 14px 0 0;
  color: var(--text-muted);
}
.waitlist-error {
  font-size: 13px;
  text-align: center;
  margin: 10px 0 0;
  color: var(--text-soft);
  min-height: 1em;
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .nav { padding: 0 18px; }
  .nav-links { display: none; }
  .container, .playground, .docs-layout { padding-left: 20px; padding-right: 20px; }
  .section { padding: 64px 0; }
  .docs-layout { grid-template-columns: 1fr; gap: 24px; }
  .docs-side { position: static; }
}

/* ===== Admin tag in nav ===== */
.admin-tag {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

/* ===== Admin login ===== */
.login-wrap {
  min-height: calc(100vh - var(--nav-h) - 80px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
}
.login-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.login-icon {
  width: 48px; height: 48px;
  margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
}
.login-icon svg { width: 22px; height: 22px; }
.login-card h1 {
  font-size: 22px; margin: 0 0 6px; letter-spacing: -0.01em;
}
.login-card p.muted { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.login-card form {
  display: flex; flex-direction: column; gap: 10px;
}
.login-card input[type=password] {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit; font-size: 15px;
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.login-card input[type=password]:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
[data-theme="dark"] .login-card input[type=password]:focus {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.10);
}
.login-card button[type=submit] {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14.5px;
}
.login-error {
  font-size: 13px;
  color: #c33;
  margin: 14px 0 0;
  min-height: 1em;
}
[data-theme="dark"] .login-error { color: #ff7a7a; }

/* ===== Admin dashboard ===== */
.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}
.dash-head {
  display: flex; align-items: end; justify-content: space-between;
  flex-wrap: wrap; gap: 18px;
  margin-bottom: 28px;
}
.dash-head h1 { font-size: 30px; margin: 4px 0 0; letter-spacing: -0.02em; }
.dash-head .eyebrow { margin: 0; }
.dash-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.dash-actions input[type=search] {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font: inherit; font-size: 14px;
  color: var(--text);
  width: 220px;
  transition: border-color 0.12s ease;
}
.dash-actions input[type=search]:focus { outline: none; border-color: var(--text); }
.dash-actions input[type=search]::placeholder { color: var(--text-muted); }

.table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--bg-soft); }
.data-table .cell-email { font-weight: 500; }
.data-table .cell-ip { color: var(--text-muted); font-size: 12.5px; }
.data-table .row-actions { width: 50px; text-align: right; }
.data-table .empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 18px;
  font-size: 14px;
}
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}
.icon-btn:hover { background: var(--bg); border-color: var(--border-strong); color: #c33; }
[data-theme="dark"] .icon-btn:hover { color: #ff7a7a; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:disabled { opacity: 0.3; cursor: wait; }

.dash-foot {
  margin-top: 14px;
  text-align: right;
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .dash-actions input[type=search] { width: 100%; }
  .data-table .cell-ip { display: none; }
  .data-table th:nth-child(3) { display: none; }
}

/* ===== Admin tabs ===== */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin: 0 0 36px;
}
.tab {
  background: transparent; border: 0;
  padding: 12px 18px;
  font: inherit; font-size: 14.5px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadein 0.2s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ===== Editor forms ===== */
.editor-stack { display: flex; flex-direction: column; gap: 18px; }
.editor-form {
  display: flex; flex-direction: column; gap: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text); }
.field > span:first-child { font-weight: 500; color: var(--text); font-size: 13.5px; }
.field input[type=text],
.field input[type=number],
.field input[type=password],
.field input[type=email],
.field textarea,
.field select {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit; font-size: 14px;
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
[data-theme="dark"] .field input:focus, [data-theme="dark"] .field textarea:focus, [data-theme="dark"] .field select:focus {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.10);
}
.field input.mono, .field textarea.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.field-hint { font-size: 12.5px; color: var(--text-muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.small > span:first-child { font-size: 13px; }

.tier-edit {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.tier-edit-head { display: flex; align-items: center; gap: 12px; }
.tier-id {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; color: var(--text-muted);
}
.tier-label { flex: 1; font-weight: 600; font-size: 16px !important; }

.save-status {
  font-size: 13px;
  margin: 0 0 14px;
  min-height: 1em;
  color: var(--text-muted);
}
.save-status.ok { color: #1a8744; }
.save-status.err { color: #c33; }
[data-theme="dark"] .save-status.ok { color: #5acf85; }
[data-theme="dark"] .save-status.err { color: #ff7a7a; }

.upstream-models {
  margin-top: 24px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
}
.upstream-models summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-soft);
}
.upstream-models pre {
  margin: 0; padding: 16px;
  border-top: 1px solid var(--border);
  background: transparent;
  max-height: 320px; overflow-y: auto;
  font-size: 12.5px;
}

/* ===== Theme editor ===== */
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] {
  width: 44px; height: 44px;
  padding: 0; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer; background: transparent;
}
.color-row input[type=text] {
  flex: 1; max-width: 160px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}
.theme-preview {
  margin-top: 18px;
  padding: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 14px;
}

/* ===== Playground sidebar ===== */
.pg-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}
.pg-settings {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: calc(var(--nav-h) + 20px);
}
.pg-settings-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.pg-settings-head h3 { margin: 0; font-size: 15px; }
.pg-settings .field { font-size: 13px; }
.pg-settings input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--border-strong);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.pg-settings input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--