/* Atomic Feline — brand stylesheet (dark charcoal + atomic orange) */
:root {
  --bg: #121212;
  --bg-2: #1a1a1a;
  --bg-3: #202020;
  --card: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f5f7;
  --muted: #a1a1a8;
  --faint: #6e6e75;
  --orange: #ff7a00;
  --amber: #ffb000;
  --orange-soft: rgba(255, 122, 0, 0.14);
  --green: #34d167;
  --red: #f0524d;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--amber); text-decoration: none; }
button { font-family: var(--font); }

/* ---- orange radial blooms ---- */
.glow-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
}
.glow.g1 {
  width: 720px; height: 720px; top: -280px; left: -240px;
  background: radial-gradient(circle, rgba(255, 122, 0, 0.16) 0%, rgba(255, 122, 0, 0.05) 45%, transparent 70%);
}
.glow.g2 {
  width: 900px; height: 900px; top: 22%; right: -420px;
  background: radial-gradient(circle, rgba(255, 176, 0, 0.10) 0%, rgba(255, 122, 0, 0.04) 45%, transparent 70%);
}
.glow.g3 {
  width: 640px; height: 640px; bottom: -260px; left: 18%;
  background: radial-gradient(circle, rgba(255, 122, 0, 0.09) 0%, transparent 65%);
}

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-orange {
  background: linear-gradient(180deg, var(--amber) -40%, var(--orange) 60%);
  color: #1c0e00;
  box-shadow: 0 4px 24px rgba(255, 122, 0, 0.35);
}
.btn-orange:hover { box-shadow: 0 6px 32px rgba(255, 122, 0, 0.5); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.06); }
.btn-sm { padding: 8px 18px; font-size: 13.5px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---- header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--orange);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.brand img { width: 34px; height: 34px; object-fit: contain; }
.header-actions { display: flex; align-items: center; gap: 12px; }

/* ---- landing ---- */
.landing-main { position: relative; z-index: 1; }
.hero {
  text-align: center;
  padding: 72px 24px 84px;
  max-width: 860px;
  margin: 0 auto;
}
.hero-logo {
  width: 300px;
  max-width: 72vw;
  height: auto;
  filter: drop-shadow(0 0 48px rgba(255, 122, 0, 0.35));
  margin-bottom: 8px;
}
.hero h1 {
  font-size: 56px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 12px 0 20px;
  color: var(--text);
}
.hero h1 .hl { color: var(--orange); }
.hero .subhead {
  color: var(--muted);
  font-size: 18px;
  max-width: 620px;
  margin: 0 auto 34px;
}
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-note {
  margin-top: 26px;
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-green { background: var(--green); box-shadow: 0 0 8px rgba(52, 209, 103, 0.8); }
.dot-red { background: var(--red); box-shadow: 0 0 8px rgba(240, 82, 77, 0.8); }
.dot-gray { background: var(--faint); }
.dot-orange { background: var(--orange); box-shadow: 0 0 8px rgba(255, 122, 0, 0.8); }

.section { max-width: 1080px; margin: 0 auto; padding: 56px 24px; position: relative; z-index: 1; }
.section h2 { font-size: 34px; font-weight: 800; letter-spacing: -0.01em; text-align: center; margin: 0 0 10px; }
.section h2 .hl { color: var(--orange); }
.section .section-sub { text-align: center; color: var(--muted); margin: 0 auto 40px; max-width: 560px; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  background: linear-gradient(180deg, #1d1d1d 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: rgba(255, 122, 0, 0.35); transform: translateY(-2px); }
.card .card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--orange-soft);
  border: 1px solid rgba(255, 122, 0, 0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 8px; font-size: 19px; font-weight: 700; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* early access */
.early-access {
  background: linear-gradient(180deg, #1c1c1c 0%, #171717 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 52px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.early-access::before {
  content: "";
  position: absolute;
  width: 520px; height: 520px; top: -320px; left: 50%; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 122, 0, 0.18) 0%, transparent 65%);
  pointer-events: none;
}
.ea-form { display: flex; gap: 12px; justify-content: center; max-width: 480px; margin: 28px auto 0; }
.ea-form input {
  flex: 1;
  min-width: 0;
  background: #121212;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 12px 22px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
}
.ea-form input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.18); }
.ea-msg { margin-top: 16px; font-size: 14px; min-height: 20px; }
.ea-msg.ok { color: var(--green); }
.ea-msg.err { color: var(--red); }

/* footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 30px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  position: relative;
  z-index: 1;
}
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand img { width: 26px; height: 26px; }
.footer-brand .fb-name { color: var(--orange); font-weight: 700; font-size: 14px; }
.footer-brand .fb-tag { color: var(--faint); font-size: 12px; }

/* ---- auth (login) ---- */
.auth-wrap {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #1d1d1d 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 40px 36px;
  text-align: center;
}
.auth-card .auth-logo { width: 130px; filter: drop-shadow(0 0 24px rgba(255, 122, 0, 0.35)); }
.auth-card h1 { font-size: 26px; font-weight: 800; margin: 12px 0 4px; }
.auth-card .auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.field { text-align: left; margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.field input, .field textarea, .field select {
  width: 100%;
  background: #121212;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
}
.field textarea { resize: vertical; min-height: 110px; border-radius: 14px; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.18);
}
.auth-error { color: var(--red); font-size: 14px; min-height: 20px; margin: 4px 0 12px; }
.auth-foot { margin-top: 22px; font-size: 13px; color: var(--faint); }

/* ================= APP CONSOLE ================= */
.app-body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: rgba(24, 24, 24, 0.92);
  border-bottom: 1px solid var(--border);
  z-index: 30;
  flex: none;
}
.topbar .brand { font-size: 15px; }
.topbar .brand img { width: 28px; height: 28px; }
.topbar-agent { font-weight: 600; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar-agent::before { content: "/"; color: var(--faint); font-weight: 400; }
.topbar-spacer { flex: 1; }
.health { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.icon-btn {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 10px;
  width: 36px; height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
}
.topbar a.logout { color: var(--muted); font-size: 13px; white-space: nowrap; flex: none; }
.topbar a.logout:hover { color: var(--text); }

.topbar-agentic {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  max-width: 290px;
  flex: none;
  min-width: 0;
  position: relative;
}
.topbar-agentic #topbarAgentic {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- agentic switcher (multi-box dropdown) ---- */
.agentic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 4px 8px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-width: 0;
  max-width: 250px;
}
.agentic-btn:hover, .agentic-btn[aria-expanded="true"] {
  color: var(--text);
  border-color: rgba(255, 122, 0, 0.35);
  background: rgba(255, 122, 0, 0.07);
}
.agentic-btn .caret { font-size: 10px; color: var(--faint); flex: none; }
.agentic-btn:hover .caret, .agentic-btn[aria-expanded="true"] .caret { color: var(--orange); }

.agentic-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: -6px;
  min-width: 250px;
  max-width: 320px;
  background: linear-gradient(180deg, #212121 0%, #1a1a1a 100%);
  border: 1px solid rgba(255, 122, 0, 0.28);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 0, 0, 0.4);
  padding: 6px;
  display: none;
  z-index: 70;
}
.agentic-menu.open { display: block; }
.am-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
.am-item:hover { background: rgba(255, 255, 255, 0.05); }
.am-item.active { background: var(--orange-soft); border-color: rgba(255, 122, 0, 0.35); }
.am-item .am-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.am-item.am-add {
  color: var(--amber);
  font-weight: 600;
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  margin-top: 4px;
  padding-top: 10px;
}
.am-item.am-add:hover { background: var(--orange-soft); }

.btn-danger { color: var(--red); border-color: rgba(240, 82, 77, 0.4); }
.btn-danger:hover { border-color: var(--red); background: rgba(240, 82, 77, 0.08); }
.modal-actions-spacer { flex: 1; }
.lock-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--amber);
  background: var(--orange-soft);
  border: 1px solid rgba(255, 122, 0, 0.4);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  flex: none;
}
.icon-btn.gear-btn { display: inline-flex; font-size: 16px; color: var(--muted); }
.icon-btn.gear-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.28); }

.modal-sub { color: var(--muted); font-size: 13.5px; margin: -10px 0 18px; }
.field-help { color: var(--faint); font-size: 12px; margin-top: 6px; }

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: #232323;
  border: 1px solid rgba(255, 122, 0, 0.5);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 80;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { border-color: var(--amber); color: var(--amber); }

/* ---- Agentic Brain figure ---- */
.brain-fig {
  display: flex;
  justify-content: center;
  margin: 4px 0 10px;
}
.bf-brain, .bf-glowbg {
  transform-box: fill-box;
  transform-origin: center;
  animation: brainPulse 3s ease-in-out infinite;
}
.bf-glowbg { animation-name: glowPulse; }
.bf-orbit { transform-box: fill-box; transform-origin: center; }
.bf-orbit1 { animation: orbitSpin 8s linear infinite; }
.bf-orbit2 { animation: orbitSpin 12s linear infinite reverse; }
.brain-fig.thinking .bf-brain,
.brain-fig.thinking .bf-glowbg { animation-duration: 1.1s; }
.brain-fig.flash .bf-brain {
  animation: brainFlash 0.6s ease-out, brainPulse 3s ease-in-out infinite;
}
@keyframes brainPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes glowPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}
@keyframes orbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes brainFlash {
  0% { filter: brightness(1); }
  25% { filter: brightness(2.4) drop-shadow(0 0 20px rgba(255, 176, 0, 0.95)); }
  100% { filter: brightness(1); }
}

/* topbar mini-brain — the box's "alive" indicator */
.mini-brain { flex: none; overflow: visible; }
.mini-brain .mb-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: brainPulse 3s ease-in-out infinite;
}
.mini-brain .mb-orbit {
  transform-box: fill-box;
  transform-origin: center;
  animation: orbitSpin 8s linear infinite;
}
.mini-brain.dead .mb-dot, .mini-brain.dead .mb-orbit { animation-play-state: paused; }
.mini-brain.dead .mb-dot { fill: #6e6e75; }
.mini-brain.dead .mb-orbit ellipse { stroke: rgba(255, 255, 255, 0.18); }
.mini-brain.dead .mb-electron { fill: #6e6e75; }

@media (prefers-reduced-motion: reduce) {
  .bf-brain, .bf-glowbg, .bf-orbit1, .bf-orbit2,
  .mini-brain .mb-dot, .mini-brain .mb-orbit { animation: none !important; }
}

/* ---- Wiki (auto-updating skills directory) ---- */
.icon-btn.wiki-btn { display: inline-flex; font-size: 15px; color: var(--muted); }
.icon-btn.wiki-btn:hover, .icon-btn.wiki-btn.active { color: var(--text); border-color: rgba(255, 122, 0, 0.5); }

.wiki-view { flex: 1; display: none; min-height: 0; }
.wiki-view.visible { display: flex; }
.panes.hidden { display: none; }

.wiki-list-pane {
  width: 320px;
  flex: none;
  border-right: 1px solid var(--border);
  background: #161616;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.wiki-list-pane .pane-title { display: flex; align-items: center; justify-content: space-between; }
.wiki-search { padding: 6px 12px 10px; }
.wiki-search input {
  width: 100%;
  background: #121212;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 13.5px;
  font-family: var(--font);
  outline: none;
}
.wiki-search input:focus { border-color: var(--orange); }
.wiki-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.wiki-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  margin-bottom: 2px;
  color: var(--text);
}
.wiki-item:hover { background: rgba(255, 255, 255, 0.04); }
.wiki-item.active { background: var(--orange-soft); border-color: rgba(255, 122, 0, 0.35); }
.wiki-item .wi-name { color: var(--orange); font-weight: 600; font-size: 14px; }
.wiki-item .wi-desc {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wiki-item .wi-updated { color: var(--faint); font-size: 10.5px; margin-top: 3px; }

.wiki-page-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wiki-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 122, 0, 0.05);
}
.wiki-back { display: none; }
.wiki-page { flex: 1; overflow-y: auto; padding: 26px 34px 50px; max-width: 860px; }
.wiki-page h1.wp-title { font-size: 28px; font-weight: 800; margin: 0 0 4px; }
.wiki-page .wp-sub { color: var(--muted); font-size: 14.5px; margin: 0 0 24px; }

/* rendered markdown */
.md { font-size: 14.5px; line-height: 1.65; color: var(--text); }
.md h1, .md h2, .md h3, .md h4 { color: var(--text); line-height: 1.25; margin: 26px 0 10px; }
.md h1 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 15.5px; color: var(--amber); }
.md h4 { font-size: 14px; }
.md p { margin: 10px 0; }
.md a { color: var(--amber); text-decoration: underline; text-decoration-color: rgba(255, 176, 0, 0.35); }
.md code {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--amber);
}
.md pre {
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 14px 0;
}
.md pre code { background: none; border: none; padding: 0; color: #e8e8ec; font-size: 12.5px; line-height: 1.55; }
.md ul, .md ol { margin: 10px 0; padding-left: 26px; }
.md li { margin: 4px 0; }
.md table { border-collapse: collapse; margin: 14px 0; width: 100%; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--border-strong); padding: 7px 12px; text-align: left; }
.md th { background: rgba(255, 122, 0, 0.08); color: var(--amber); font-weight: 700; }
.md tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
.md blockquote { border-left: 3px solid var(--orange); margin: 12px 0; padding: 2px 16px; color: var(--muted); }
.md hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.wiki-files { margin-top: 34px; border-top: 1px solid var(--border); padding-top: 14px; }
.wiki-files summary { cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.wiki-files summary:hover { color: var(--text); }
.wiki-files pre {
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--faint);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.6;
  margin-top: 10px;
  overflow-x: auto;
}

.auth-banner {
  display: none;
  background: linear-gradient(90deg, rgba(255, 122, 0, 0.22), rgba(255, 122, 0, 0.1));
  border-bottom: 1px solid rgba(255, 122, 0, 0.45);
  padding: 10px 18px;
  font-size: 14px;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  z-index: 25;
  flex: none;
}
.auth-banner.visible { display: flex; }
.auth-banner .ab-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth-banner input {
  background: #121212;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--text);
  font-size: 13px;
  width: 150px;
  outline: none;
}
.auth-banner a { font-weight: 600; word-break: break-all; }

.panes { flex: 1; display: flex; min-height: 0; }

/* left: agents */
.pane-agents {
  width: 240px;
  flex: none;
  border-right: 1px solid var(--border);
  background: #161616;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.pane-title {
  padding: 14px 16px 8px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.agent-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.agent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 2px;
}
.agent-item:hover { background: rgba(255, 255, 255, 0.04); }
.agent-item.active { background: var(--orange-soft); border-color: rgba(255, 122, 0, 0.35); }
.agent-swatch { width: 10px; height: 10px; border-radius: 4px; background: var(--orange); flex: none; }
.pane-foot { padding: 12px; border-top: 1px solid var(--border); }
.pane-foot .btn { width: 100%; }

/* center: conversations / chat */
.pane-center { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.center-list { flex: 1; overflow-y: auto; padding: 22px; max-width: 760px; width: 100%; margin: 0 auto; }
.center-list h2 { font-size: 20px; margin: 0 0 4px; }
.center-list .cl-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.convo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 18px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 10px;
  font-size: 14.5px;
}
.convo-item:hover { border-color: rgba(255, 122, 0, 0.4); }
.convo-item .ci-title { font-weight: 600; }
.convo-item .ci-meta { color: var(--faint); font-size: 12px; flex: none; }
.empty-note { color: var(--faint); font-size: 14px; text-align: center; padding: 40px 10px; }

/* chat view */
.chat-view { flex: 1; display: none; flex-direction: column; min-height: 0; }
.chat-view.visible { display: flex; }
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #161616;
  flex: none;
}
.chat-header .ch-title { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-btn { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.back-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.model-select {
  background: #121212;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}
.model-select:focus { border-color: var(--orange); }

.messages { flex: 1; overflow-y: auto; padding: 22px 18px; }
.messages-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 16px; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user {
  align-self: flex-end;
  background: #262626;
  border: 1px solid var(--border);
  border-bottom-right-radius: 6px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  border-bottom-left-radius: 6px;
}
.tool-chip {
  align-self: flex-start;
  font-size: 12px;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: default;
  max-width: 82%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-chip .tc-name { color: var(--muted); font-weight: 600; }

.composer { padding: 14px 18px 18px; border-top: 1px solid var(--border); flex: none; background: var(--bg); }
.composer-inner { max-width: 760px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 12px 18px;
  color: var(--text);
  font-size: 14.5px;
  font-family: var(--font);
  resize: none;
  outline: none;
  max-height: 160px;
  line-height: 1.45;
}
.composer textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.15); }

/* ---- console view (the "I miss tmux" toggle) ---- */
.icon-btn.console-toggle {
  display: inline-flex;
  width: 30px; height: 28px;
  flex: none;
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--muted);
}
.icon-btn.console-toggle:hover { color: var(--text); border-color: rgba(255, 122, 0, 0.5); }
.icon-btn.console-toggle.active {
  color: var(--orange);
  border-color: rgba(255, 122, 0, 0.6);
  background: rgba(255, 122, 0, 0.1);
}

.console-pane {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none; /* we manage scroll ourselves — keep the user's spot */
  background: #0a0a0a;
  padding: 14px 18px 20px;
}
.chat-view.console-mode .messages { display: none; }
.chat-view.console-mode .console-pane { display: block; }
.console-pane pre {
  margin: 0;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #cfe0cf; /* subtle green-tinted terminal text */
  white-space: pre-wrap;
  word-break: break-word;
}
.console-pane pre::after {
  content: "\258A"; /* ▊ blinking block caret */
  color: var(--orange);
  margin-left: 2px;
  animation: caretBlink 1.1s steps(1) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }
.console-dead {
  display: none;
  margin-top: 12px;
  padding: 6px 12px;
  border: 1px solid rgba(240, 82, 77, 0.4);
  border-radius: 8px;
  color: var(--red);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.console-dead.visible { display: inline-block; }

/* ---- the Viewer (agent-driven canvas) ---- */
.icon-btn.viewer-btn { display: inline-flex; font-size: 15px; color: var(--muted); position: relative; }
.icon-btn.viewer-btn:hover, .icon-btn.viewer-btn.active { color: var(--text); border-color: rgba(255, 122, 0, 0.5); }
.icon-btn.viewer-btn.active { color: var(--orange); }
.viewer-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--orange);
  display: none;
}
.viewer-btn.has-new .viewer-badge { display: block; animation: badgePulse 1.2s ease-in-out infinite; }
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.65); }
  50% { box-shadow: 0 0 0 6px rgba(255, 122, 0, 0); }
}

.pane-viewer {
  width: 380px;
  flex: none;
  border-left: 1px solid var(--border);
  background: #161616;
  display: none;
  flex-direction: column;
  min-height: 0;
}
.panes.viewer-open .pane-viewer { display: flex; }
.viewer-titlebar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.vt-text { flex: 1; min-width: 0; }
.vt-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-note { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.4; }
.viewer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.viewer-media-link { display: block; }
.viewer-img { width: 100%; display: block; border: 1px solid var(--border); border-radius: 12px; }
.viewer-video { width: 100%; border-radius: 12px; background: #000; }
.viewer-frame-wrap {
  position: relative;
  flex: 1;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0e0e0e;
}
.viewer-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: none; background: #fff; }
.viewer-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  background: #141414;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.viewer-fallback.visible { display: flex; }
.viewer-openrow { display: flex; align-items: center; gap: 10px; font-size: 13px; flex: none; }
.viewer-openrow a { font-weight: 600; white-space: nowrap; }
.viewer-openrow .vo-url { color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.viewer-file { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px 10px; text-align: center; }
.vf-icon { font-size: 34px; }
.vf-name { font-weight: 600; font-size: 14.5px; word-break: break-all; }
.viewer-audio { width: 100%; }

/* right: automations — slide-over popout at every width (topbar ⚡ opens it) */
.pane-autos {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(320px, 88vw);
  border-left: 1px solid var(--border);
  background: #161616;
  display: flex;
  flex-direction: column;
  min-height: 0;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 50;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
  padding-top: 8px;
}
.pane-autos.open { transform: translateX(0); }
.icon-btn.autos-toggle { display: inline-flex; font-size: 15px; color: var(--muted); }
.icon-btn.autos-toggle:hover, .icon-btn.autos-toggle.active { color: var(--text); border-color: rgba(255, 122, 0, 0.5); }
.autos-list { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.auto-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.auto-top { display: flex; align-items: center; gap: 8px; }
.auto-name { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2.5px 8px;
  border-radius: 999px;
  flex: none;
}
.badge-flavor { background: var(--orange-soft); color: var(--amber); border: 1px solid rgba(255, 122, 0, 0.3); }
.badge-legacy { background: rgba(255, 255, 255, 0.06); color: var(--faint); border: 1px solid var(--border); }
.auto-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 11.5px; color: var(--faint); }
.auto-meta .next { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 5px; background: rgba(255, 255, 255, 0.07); border-radius: 999px; margin-top: 9px; overflow: hidden; }
.progress .bar { height: 100%; background: linear-gradient(90deg, var(--orange), var(--amber)); border-radius: 999px; }
.progress-label { font-size: 10.5px; color: var(--faint); margin-top: 4px; }

.toggle { position: relative; width: 34px; height: 20px; flex: none; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle .track {
  position: absolute; inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: background 0.18s ease;
}
.toggle .track::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform 0.18s ease;
}
.toggle input:checked + .track { background: var(--orange); }
.toggle input:checked + .track::after { transform: translateX(14px); }
.toggle.disabled { opacity: 0.35; cursor: not-allowed; }

/* modals */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.modal-overlay.visible { display: flex; }
.modal {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, #1f1f1f 0%, var(--card) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 28px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 18px; font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal .m-error { color: var(--red); font-size: 13.5px; min-height: 18px; margin-bottom: 6px; }

.pane-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 49; display: none; }
.pane-scrim.visible { display: block; }

/* desktop: automations is an in-flow right pane — hidden until the ⚡ toggle */
@media (min-width: 761px) {
  .pane-autos {
    position: static;
    width: 300px;
    display: none;
    transform: none;
    transition: none;
    box-shadow: none;
    padding-top: 0;
  }
  .pane-autos.open { display: flex; transform: none; }
  .pane-scrim { display: none !important; } /* scrim is a mobile-only affordance */
}

/* ---- responsive ---- */
@media (max-width: 760px) {
  .hero h1 { font-size: 36px; }
  .hero { padding: 44px 20px 60px; }
  .hero-logo { width: 220px; }
  .cards { grid-template-columns: 1fr; }
  .section h2 { font-size: 26px; }
  .ea-form { flex-direction: column; }
  .ea-form .btn { width: 100%; }
  .site-footer { flex-direction: column; text-align: center; justify-content: center; }
  .header-actions .btn-ghost { display: none; }

  .pane-agents {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(280px, 84vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 50;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.5);
    padding-top: 8px;
  }
  .pane-agents.open { transform: translateX(0); }
  .icon-btn.agents-toggle { display: inline-flex; }
  .topbar { gap: 10px; padding: 10px 12px; }
  .topbar .brand span { display: none; }
  .topbar-agentic { max-width: 130px; }
  .topbar-agentic #topbarAgentic { display: none; }
  .lock-chip #lockChipModel { display: none; }
  .health span { display: none; }

  /* viewer: full-screen overlay on mobile */
  .pane-viewer {
    position: fixed;
    inset: 0;
    width: 100%;
    z-index: 56;
    border-left: none;
  }
  .icon-btn { width: 32px; height: 32px; font-size: 15px; }

  /* wiki: list -> detail navigation */
  .wiki-list-pane { width: 100%; border-right: none; }
  .wiki-page-pane { display: none; }
  .wiki-view.detail .wiki-list-pane { display: none; }
  .wiki-view.detail .wiki-page-pane { display: flex; }
  .wiki-view.detail .wiki-back { display: inline-block; }
  .wiki-page { padding: 20px 16px 40px; }
  .msg { max-width: 92%; }
}
