/* ============================================================
   Sitefinity MCP Explorer — styles
   ============================================================ */
:root {
  --bg: #070b10;
  --bg-soft: #0d141c;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #e8eef5;
  --muted: #8aa0b3;
  --muted-soft: #5f7385;
  --accent: #10b981;
  --accent-2: #22d3ee;
  --accent-3: #6366f1;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
}

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

/* Animated background glow */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(16, 185, 129, 0.18), transparent 60%),
    radial-gradient(50% 45% at 90% 10%, rgba(34, 211, 238, 0.14), transparent 60%),
    radial-gradient(55% 60% at 60% 100%, rgba(99, 102, 241, 0.12), transparent 60%),
    var(--bg);
  filter: saturate(1.1);
}

code { font-family: var(--mono); font-size: 0.88em; color: var(--accent-2); }
.muted { color: var(--muted); }
em { color: var(--accent); font-style: normal; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px;
  background: rgba(7, 11, 16, 0.7);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 16px; color: #051b12;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px -8px rgba(16, 185, 129, 0.7);
}
.brand-text h1 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.brand-text h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.brand-text p { margin: 0; font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.status {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--panel);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 0 rgba(0,0,0,0); }
.status--connecting .dot { background: var(--warn); animation: pulse 1.4s infinite; }
.status--online .dot { background: var(--accent); animation: pulse 2.2s infinite; }
.status--offline .dot { background: var(--danger); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); } 70% { box-shadow: 0 0 0 7px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }

/* ---------- Buttons & inputs ---------- */
.btn {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 9px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-strong); color: var(--text);
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: transform .12s ease, border-color .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.2); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 6px 10px; font-size: 12px; }
.btn--primary {
  border: none; color: #04140d;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px -12px rgba(16,185,129,0.8);
}
.btn--primary:hover { filter: brightness(1.06); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.badge { font-size: 11px; background: rgba(255,255,255,0.12); padding: 1px 7px; border-radius: 999px; }

.input, select.input {
  width: 100%; font-family: var(--sans); font-size: 13.5px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16,185,129,0.15); }
select.input { appearance: none; cursor: pointer; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 4px; padding: 10px 24px 0; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); position: sticky; top: 73px; z-index: 20;
  background: rgba(7,11,16,0.6); backdrop-filter: blur(10px);
}
.tab {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 11px 16px; border-radius: 10px 10px 0 0; position: relative;
  transition: color .2s;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); }
.tab.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 2px;
}

/* ---------- Layout ---------- */
#main { max-width: 1180px; margin: 0 auto; padding: 30px 24px 60px; }
.view { display: none; animation: fade .35s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero h2 { font-size: 30px; margin: 0 0 6px; letter-spacing: -0.02em; }
.hero p { max-width: 720px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head .input { max-width: 240px; }
h2 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 4px; }
.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 34px 0 2px; }
.section-sub { margin-top: 0; font-size: 13.5px; }

/* ---------- Connect card ---------- */
.connect {
  margin-top: 24px; padding: 20px 22px; border-radius: var(--radius); position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(34,211,238,0.08));
  border: 1px solid rgba(16,185,129,0.35);
  box-shadow: 0 16px 40px -24px rgba(16,185,129,0.6);
}
.connect-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.connect-main { min-width: 0; }
.connect-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.connect-url { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.connect-url code {
  font-size: 15px; color: var(--text); background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  padding: 9px 14px; border-radius: 10px; user-select: all; word-break: break-all;
}
.connect-sub { font-size: 12.5px; margin-top: 8px; }
.connect-config { margin-top: 16px; }
.copied { background: var(--accent) !important; color: #04140d !important; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 26px; }
.stat {
  padding: 20px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--panel); position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(var(--accent), var(--accent-2)); opacity: .8; }
.stat--wide { grid-column: span 1; }
.stat-num { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; background: linear-gradient(135deg, #fff, var(--muted)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-num--sm { font-size: 13px; font-weight: 600; font-family: var(--mono); color: var(--accent-2); -webkit-text-fill-color: var(--accent-2); word-break: break-all; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- Tool grid ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.tool-card {
  text-align: left; cursor: pointer; padding: 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  transition: transform .14s ease, border-color .2s, background .2s; font-family: var(--sans);
}
.tool-card:hover { transform: translateY(-3px); border-color: rgba(16,185,129,0.5); background: var(--panel-strong); }
.tool-card .tc-name { font-family: var(--mono); font-size: 13px; color: var(--accent); margin-bottom: 6px; }
.tool-card .tc-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.tool-card .tc-desc { font-size: 13px; color: var(--muted); }

/* ---------- Type grid ---------- */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.type-card {
  cursor: pointer; padding: 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--panel); text-align: left; color: var(--text);
  transition: transform .14s ease, border-color .2s; font-family: var(--sans);
}
.type-card:hover { transform: translateY(-3px); border-color: rgba(34,211,238,0.5); }
.type-card .tn { font-weight: 700; font-size: 14.5px; font-family: var(--mono); }
.type-card .tmeta { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; gap: 12px; }
.type-card .tmeta b { color: var(--text); font-weight: 700; }
.type-card.is-hidden { display: none; }

/* ---------- Panels & forms ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.hint { color: var(--muted-soft); font-weight: 500; }
.actions { display: flex; align-items: center; gap: 14px; margin: 18px 0; }
.result-meta { font-size: 13px; color: var(--muted); }
.result-meta .ok { color: var(--accent); } .result-meta .err { color: var(--danger); }

/* ---------- Results ---------- */
.results { margin-top: 8px; }
.results-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.toggle-group { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.toggle-group button { background: transparent; border: none; color: var(--muted); padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.toggle-group button.is-active { background: var(--panel-strong); color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rec {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel);
  padding: 16px; overflow: hidden; transition: border-color .2s;
}
.rec:hover { border-color: rgba(255,255,255,0.18); }
.rec .rec-thumb { width: calc(100% + 32px); margin: -16px -16px 12px; height: 130px; object-fit: cover; display: block; background: #0c1219; }
.rec .rec-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.rec .rec-date { font-size: 11.5px; color: var(--accent-2); font-family: var(--mono); margin-bottom: 8px; }
.rec .rec-desc { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rec .rec-kv { margin-top: 10px; font-size: 11.5px; color: var(--muted-soft); font-family: var(--mono); word-break: break-all; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border-soft); }
table.grid th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--bg-soft); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; }
table.grid td { font-family: var(--mono); font-size: 12px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 560px; }

pre.json {
  margin: 0; padding: 16px; border-radius: var(--radius-sm); overflow: auto; max-height: 560px;
  background: #060a0e; border: 1px solid var(--border); font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
}
.json .k { color: var(--accent-2); } .json .s { color: #a5d6a7; } .json .n { color: #ffcc80; } .json .b { color: #ce93d8; } .json .nul { color: var(--muted-soft); }

.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Playground ---------- */
.playground { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.pg-tool { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.pg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; cursor: pointer; }
.pg-head:hover { background: var(--panel-strong); }
.pg-head .pg-name { font-family: var(--mono); font-size: 13.5px; color: var(--accent); }
.pg-head .pg-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; max-width: 760px; }
.pg-caret { color: var(--muted); transition: transform .2s; }
.pg-tool.is-open .pg-caret { transform: rotate(90deg); }
.pg-body { display: none; padding: 0 18px 18px; border-top: 1px solid var(--border-soft); }
.pg-tool.is-open .pg-body { display: block; }
.pg-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0; }
.pg-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.pg-fields .req::after { content: " *"; color: var(--accent); }
.pg-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.pg-split h4 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
@media (max-width: 760px) { .pg-split { grid-template-columns: 1fr; } .form-grid, .pg-fields { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Wire log drawer ---------- */
.wire {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 92vw); z-index: 60;
  background: var(--bg-soft); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  transform: translateX(100%); transition: transform .28s ease; display: flex; flex-direction: column;
}
.wire.is-open { transform: none; }
.wire-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); }
.wire-body { overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.wire-entry { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.wire-entry .we-head { display: flex; justify-content: space-between; padding: 8px 11px; font-size: 11.5px; font-family: var(--mono); background: var(--panel); }
.wire-entry .we-method { color: var(--accent); } .wire-entry .we-time { color: var(--muted); }
.wire-entry .we-err .we-method { color: var(--danger); }
.wire-entry pre { margin: 0; padding: 10px 11px; font-size: 11px; max-height: 200px; overflow: auto; background: #060a0e; }
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
.backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(0,0,0,0.6); }
.modal.is-open { display: flex; animation: fade .2s; }
.modal-card { width: min(920px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-family: var(--mono); color: var(--accent); }
.modal-body { overflow: auto; padding: 20px; }
.subhead { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 18px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; font-family: var(--mono); padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); }
.chip.nav { color: var(--accent-2); border-color: rgba(34,211,238,0.3); }

/* ---------- Assistant / chat ---------- */
.chat { display: flex; flex-direction: column; gap: 14px; }
.chat-log { display: flex; flex-direction: column; gap: 14px; min-height: 280px; padding: 4px; }
.msg { display: flex; gap: 12px; max-width: 88%; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.msg-user .msg-avatar { background: rgba(255,255,255,0.1); color: var(--text); }
.msg-ai .msg-avatar { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04140d; }
.msg-bubble { padding: 12px 15px; border-radius: 14px; border: 1px solid var(--border); font-size: 14px; line-height: 1.6; }
.msg-user .msg-bubble { background: var(--panel-strong); border-bottom-right-radius: 4px; }
.msg-ai .msg-bubble { background: var(--panel); border-bottom-left-radius: 4px; }
.msg-bubble code { color: var(--accent-2); }
.msg-trace { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.msg-trace .chip { cursor: default; }
.msg-trace .chip.err { color: var(--danger); border-color: rgba(248,113,113,0.4); }
.msg-trace .rag-chip { color: var(--accent); border-color: rgba(16,185,129,0.45); background: rgba(16,185,129,0.1); font-weight: 700; }
.msg-sources { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.msg-sources-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-soft); margin-bottom: 6px; }
.src-chip { color: var(--muted); text-decoration: none; }
a.src-chip:hover { color: var(--accent-2); border-color: rgba(34,211,238,0.4); }
.chat-empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.chat-empty .big { font-size: 26px; margin-bottom: 6px; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-suggest button { font-size: 12.5px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); cursor: pointer; transition: border-color .2s, color .2s; }
.chat-suggest button:hover { color: var(--text); border-color: rgba(16,185,129,0.5); }
.chat-mode { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.chat-mode .toggle-group button { padding: 5px 12px; }
.chat-form { display: flex; gap: 10px; }
.chat-form .input { flex: 1; }
.chat-steps { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.chat-step { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding: 5px 9px; border-radius: 7px; background: rgba(255,255,255,0.03); animation: x-rise .25s both; }
.chat-step .chat-step-i { width: 14px; text-align: center; }
.chat-step.run { color: var(--accent-2); } .chat-step.ok { color: var(--accent); } .chat-step.err { color: var(--danger); }
.msg-text { white-space: normal; }
/* markdown rendering (chat + RAG answers) */
.md-h { font-size: 14px; margin: 14px 0 6px; color: var(--text); }
.md-ul { margin: 8px 0; padding-left: 20px; } .md-ul li { margin: 3px 0; }
.md-table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.md-table th, .md-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border-soft); }
.md-table th { background: rgba(255,255,255,0.04); font-weight: 700; font-size: 12px; }
.md-table tr:last-child td { border-bottom: none; }
.md p { margin: 0 0 8px; } .md p:last-child { margin: 0; }
.md code { color: var(--accent-2); }
.cursor { display: inline-block; width: 7px; height: 14px; background: var(--accent); margin-left: 2px; vertical-align: text-bottom; animation: blink 1s step-start infinite; }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; background: var(--muted); border-radius: 50%; animation: blink 1.4s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* ============================================================
   Studio (React)
   ============================================================ */
.studio { min-height: 60vh; }
.x-shell { display: flex; flex-direction: column; gap: 18px; }
.x-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.x-head h2 { display: flex; align-items: center; gap: 10px; }
.x-badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); border: 1px solid rgba(16,185,129,0.4); padding: 3px 8px; border-radius: 999px; }
.x-modes { display: inline-flex; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; background: var(--panel); }
.x-modes button { background: none; border: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 9px 18px; cursor: pointer; transition: color .2s, background .2s; }
.x-modes button.is-active { color: var(--text); background: var(--panel-strong); }
.x-intro h3 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.01em; }
.x-intro p { max-width: 760px; margin: 0; }
.x-empty { padding: 40px; text-align: center; color: var(--muted); }
.x-empty h3 { color: var(--text); margin: 0 0 6px; }

/* ---- compose bar ---- */
.x-compose { display: flex; flex-direction: column; gap: 16px; }
.x-bar { display: flex; gap: 10px; }
.x-bar .input { flex: 1; font-size: 15px; padding: 13px 16px; }
.x-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.x-chip { font-size: 12.5px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); cursor: pointer; transition: border-color .2s, color .2s, transform .12s; }
.x-chip:hover:not([disabled]) { color: var(--text); border-color: rgba(16,185,129,0.5); transform: translateY(-1px); }
.x-chip[disabled] { opacity: .5; cursor: default; }

/* ---- build log ---- */
.x-build { display: flex; align-items: center; gap: 22px; padding: 26px; }
.x-build-orb { width: 54px; height: 54px; border-radius: 50%; flex: 0 0 auto; background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent)); animation: x-spin 1.4s linear infinite; box-shadow: 0 0 30px -6px var(--accent); }
.x-build-orb::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--bg-soft); }
.x-build { position: relative; }
.x-build-orb { position: relative; } .x-build-orb::after { position: absolute; }
@keyframes x-spin { to { transform: rotate(360deg); } }
.x-build-lines { display: flex; flex-direction: column; gap: 7px; }
.x-build-line { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted-soft); transition: color .3s; }
.x-build-line.active { color: var(--text); } .x-build-line.done { color: var(--muted); }
.x-build-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .4; }
.x-build-line.active .x-build-dot { opacity: 1; background: var(--accent); animation: blink 1.2s infinite; }
.x-build-line.done .x-build-dot { opacity: 1; background: var(--accent); }

/* ---- generated experience frame ---- */
.x-exp { margin-top: 6px; }
.x-exp-frame { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: #0a0f15; box-shadow: var(--shadow); }
.x-exp-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: rgba(255,255,255,0.03); border-bottom: 1px solid var(--border); }
.x-exp-bar span { width: 11px; height: 11px; border-radius: 50%; background: rgba(255,255,255,0.15); }
.x-exp-bar em { margin-left: 10px; font-style: normal; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.x-exp-body { padding: 0; }
.x-sec { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); }
.x-sec.in { opacity: 1; transform: none; }

/* themed primitives use --xa (accent from the spec) */
.x-exp { --xa: var(--accent); }
.xs-hero { padding: 56px 44px; text-align: center; background:
  radial-gradient(70% 120% at 50% -10%, color-mix(in srgb, var(--xa) 26%, transparent), transparent 70%), #0b1118; }
.xs-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: var(--xa); margin-bottom: 14px; }
.xs-hero h1 { font-size: clamp(28px, 5vw, 48px); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 14px; }
.xs-hero p { max-width: 640px; margin: 0 auto; color: var(--muted); font-size: 16px; }
.xs-cta { margin-top: 24px; border: none; cursor: pointer; font-weight: 700; font-size: 14px; padding: 12px 26px; border-radius: 11px; color: #06120c; background: var(--xa); box-shadow: 0 12px 30px -12px var(--xa); }
.xs-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--border); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.xs-stat { background: #0b1118; padding: 26px 18px; text-align: center; }
.xs-statv { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; color: var(--xa); }
.xs-statl { font-size: 12px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.06em; }
.xs-block { padding: 40px 44px; }
.xs-block h2, .xs-feature h2 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 6px; }
.xs-sub { color: var(--muted); margin: 0 0 22px; }
.xs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 18px; }
.xs-card { position: relative; padding: 20px; border-radius: 13px; border: 1px solid var(--border); background: rgba(255,255,255,0.025); transition: transform .18s, border-color .2s; animation: x-rise .5s both; }
.xs-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--xa) 50%, var(--border)); }
.xs-card h3 { margin: 0 0 8px; font-size: 16px; }
.xs-card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.xs-meta { margin-top: 12px; font-size: 11.5px; color: var(--muted-soft); font-family: var(--mono); }
.xs-tag { position: absolute; top: 14px; right: 14px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--xa); }
@keyframes x-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.xs-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 18px; }
.xs-tile { margin: 0; border-radius: 13px; overflow: hidden; border: 1px solid var(--border); background: #0b1118; }
.xs-tile img { width: 100%; height: 150px; object-fit: cover; display: block; }
.xs-tile-ph { height: 150px; background: linear-gradient(135deg, color-mix(in srgb, var(--xa) 40%, #0b1118), #0b1118); }
.xs-tile figcaption { padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.xs-tile figcaption strong { font-size: 14px; } .xs-tile figcaption span { font-size: 12px; color: var(--muted); }
.xs-feature { padding: 40px 44px; display: grid; gap: 12px; background: rgba(255,255,255,0.015); }
.xs-feature p { color: var(--muted); max-width: 680px; margin: 0; font-size: 15px; }
.xs-feature ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.xs-feature li { padding-left: 24px; position: relative; color: var(--muted); }
.xs-feature li::before { content: "→"; position: absolute; left: 0; color: var(--xa); font-weight: 700; }
.xs-list { margin-top: 14px; display: flex; flex-direction: column; }
.xs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--border-soft); }
.xs-rowt { font-weight: 600; font-size: 14px; } .xs-rowm { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.xs-quote { margin: 0; padding: 48px 44px; text-align: center; background: radial-gradient(60% 120% at 50% 0%, color-mix(in srgb, var(--xa) 16%, transparent), transparent); }
.xs-quote p { font-size: clamp(20px, 3vw, 28px); line-height: 1.35; letter-spacing: -0.01em; margin: 0 0 14px; }
.xs-quote cite { color: var(--xa); font-style: normal; font-size: 14px; font-weight: 600; }
.x-prov { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 14px; font-size: 12px; }

/* grounded sources */
.x-ground { margin-top: 16px; }
.x-ground-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.x-ground-toggle { background: none; border: none; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 0; }
.x-ground-toggle strong { color: var(--xa, var(--accent)); }
.x-ground-caret { color: var(--muted); font-size: 11px; }
.x-ground-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.x-src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.x-src { display: flex; flex-direction: column; gap: 7px; padding: 13px 14px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel); text-decoration: none; color: var(--text); transition: transform .14s, border-color .2s; position: relative; }
a.x-src:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--xa, var(--accent)) 55%, var(--border)); }
.x-src-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.x-src-type { font-family: var(--mono); font-size: 10.5px; color: var(--xa, var(--accent)); text-transform: lowercase; }
.x-src-date { font-size: 10.5px; color: var(--muted-soft); font-family: var(--mono); }
.x-src-title { font-size: 13px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.x-src-link { font-size: 11px; color: var(--muted); }
a.x-src:hover .x-src-link { color: var(--xa, var(--accent)); }

/* ---- Atlas ---- */
.x-atlas { display: flex; flex-direction: column; gap: 14px; }
.x-atlas-legend { display: flex; gap: 16px; flex-wrap: wrap; }
.x-leg { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.x-leg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.x-stage-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .x-stage-wrap.has-panel { grid-template-columns: 1fr 320px; } }
.x-stage { position: relative; width: 100%; border-radius: 16px; border: 1px solid var(--border); overflow: hidden;
  background: radial-gradient(80% 80% at 30% 20%, rgba(16,185,129,0.06), transparent 60%),
              radial-gradient(70% 70% at 80% 80%, rgba(167,139,250,0.06), transparent 60%), #070b10; }
.x-links { position: absolute; inset: 0; width: 100%; height: 100%; }
.x-node { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; border: 1.5px solid; cursor: pointer;
  display: grid; place-items: center; padding: 0; color: #fff; transition: box-shadow .2s, transform .2s; animation: x-float 7s ease-in-out infinite; }
.x-node:hover { transform: translate(-50%, -50%) scale(1.14); box-shadow: 0 0 26px -4px currentColor; z-index: 5; }
.x-node.active { box-shadow: 0 0 0 3px rgba(255,255,255,0.18), 0 0 30px -4px currentColor; z-index: 6; }
.x-node-label { font-size: 9.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); pointer-events: none; max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity .2s; }
.x-node:hover .x-node-label, .x-node.active .x-node-label { opacity: 1; }
@keyframes x-float { 0%,100% { margin-top: 0; } 50% { margin-top: -7px; } }
.x-panel { border: 1px solid var(--border); border-top: 3px solid var(--nc, var(--accent)); border-radius: 14px; background: var(--panel); padding: 16px; align-self: start; }
.x-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.x-panel-type { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--nc, var(--accent)); }
.x-panel-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.x-panel-items { display: flex; flex-direction: column; gap: 8px; }
.x-panel-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: rgba(0,0,0,0.2); }
.x-panel-title { font-size: 13px; font-weight: 600; }
.x-panel-date { font-size: 11px; color: var(--accent-2); font-family: var(--mono); margin-top: 3px; }
.x-panel-rel { margin-top: 12px; font-size: 11.5px; color: var(--muted); font-family: var(--mono); word-break: break-word; }

/* ---------- RAG Lab ---------- */
.x-raglab { display: flex; flex-direction: column; gap: 16px; }
.x-subtabs { display: inline-flex; gap: 4px; border: 1px solid var(--border); border-radius: 11px; padding: 4px; background: var(--panel); width: fit-content; }
.x-subtabs button { background: none; border: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 8px 16px; border-radius: 8px; cursor: pointer; }
.x-subtabs button.is-active { background: var(--panel-strong); color: var(--text); }
.x-ask, .x-compare2 { display: flex; flex-direction: column; gap: 14px; }

.x-answer { display: flex; flex-direction: column; gap: 16px; }
.x-answer-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; }
.x-ground-badge { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.x-ground-badge.ok { color: var(--accent); background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.4); }
.x-ground-badge.low { color: var(--warn); background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.35); }
.x-answer-body p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; }
.x-answer-body p:last-child { margin: 0; }
.x-rel .chips { margin-top: 4px; }
.x-answer-sources .subhead, .x-rel .subhead { margin: 0 0 8px; }

.x-cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .x-cmp-grid { grid-template-columns: 1fr; } }
.x-cmp-col { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.x-cmp-head { display: flex; align-items: baseline; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.x-cmp-head span { font-weight: 700; font-size: 13.5px; }
.x-cmp-head em { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--muted-soft); }
.x-cmp-head.keyword { border-bottom-color: rgba(248,113,113,0.3); } .x-cmp-head.keyword span { color: var(--danger); }
.x-cmp-head.semantic { border-bottom-color: rgba(16,185,129,0.3); } .x-cmp-head.semantic span { color: var(--accent); }
.x-cmp-item { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.x-cmp-type { font-family: var(--mono); font-size: 10px; color: var(--muted-soft); display: block; margin-bottom: 3px; }
.x-cmp-st { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.x-cmp-score { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.x-cmp-snip { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.x-cmp-empty { padding: 22px 16px; color: var(--muted-soft); font-size: 13px; font-style: italic; }
.x-cmp-note { font-size: 12.5px; margin: 4px 0 0; }

/* ---------- tab separator ---------- */
.tab-sep { align-self: center; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-soft); padding: 0 8px 0 16px; border-left: 1px solid var(--border); margin-left: 8px; }

/* ---------- Demo (guided narrative) ---------- */
.demo { display: flex; flex-direction: column; gap: 8px; }
.demo-hero { padding: 24px 0 8px; max-width: 860px; }
.demo-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); margin-bottom: 14px; }
.demo-hero h1 { font-size: clamp(28px, 4.5vw, 44px); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 16px; }
.demo-hero h1 em { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-style: normal; }
.demo-hero p { font-size: 16px; line-height: 1.65; color: var(--muted); }
.demo-hero strong { color: var(--text); }

.demo-act { padding: 28px 0; border-top: 1px solid var(--border); }
.demo-act-h { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.demo-step { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #04140d; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 20px -8px var(--accent); }
.demo-act-h h2 { font-size: 22px; letter-spacing: -0.02em; margin: 2px 0 4px; }
.demo-act-h p { margin: 0; font-size: 14px; }

.demo-verify { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.demo-vcard { text-align: left; cursor: pointer; padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; transition: transform .14s, border-color .2s; }
.demo-vcard:hover { transform: translateY(-3px); border-color: rgba(34,211,238,0.5); }
.demo-vt { font-weight: 700; font-size: 15px; margin-bottom: 5px; }
.demo-vd { font-size: 12.5px; }

/* narrated ask */
.na { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
@media (max-width: 820px) { .na { grid-template-columns: 1fr; } }
.na-main { display: flex; flex-direction: column; gap: 14px; }
.na-input { display: flex; gap: 10px; }
.na-input .input { flex: 1; }
.na-q { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 13px; background: var(--panel-strong); border: 1px solid var(--border); font-size: 15px; font-weight: 600; }
.na-q-avatar { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,0.1); font-weight: 700; }
.na-steps { display: flex; flex-direction: column; gap: 8px; }
.na-step { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel); opacity: .55; transition: opacity .3s, border-color .3s; }
.na-step.na-running, .na-step.na-done { opacity: 1; }
.na-step.na-running { border-color: rgba(34,211,238,0.4); }
.na-step-i { width: 20px; flex: 0 0 auto; text-align: center; color: var(--accent); font-weight: 700; }
.na-step-l { font-weight: 600; font-size: 13.5px; }
.na-step-d { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.na-bad { color: var(--danger); font-weight: 600; }
.na-good { color: var(--accent); font-weight: 600; }
.na-answer { padding: 18px; border-radius: 13px; border: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; gap: 12px; }
.na-answer .x-answer-body p { font-size: 14.5px; line-height: 1.6; margin: 0 0 8px; }
.na-actions { display: flex; gap: 8px; }
.na-wire { border: 1px solid var(--border); border-radius: 13px; background: #060a0e; overflow: hidden; position: sticky; top: 130px; }
.na-wire-h { padding: 11px 14px; font-size: 12px; font-weight: 700; color: var(--accent-2); border-bottom: 1px solid var(--border); }
.na-wire-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; min-height: 80px; }
.na-wire-row { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; padding: 6px 8px; border-radius: 7px; background: rgba(255,255,255,0.03); animation: x-rise .3s both; }
.na-wire-row.err { background: rgba(248,113,113,0.08); }
.na-wire-m { color: var(--muted); } .na-wire-t { color: var(--accent); flex: 1; } .na-wire-ms { color: var(--muted-soft); }

/* ---------- Graph Atlas ---------- */
.x-graph { display: flex; flex-direction: column; gap: 14px; }
.x-graph .x-stage { background: radial-gradient(70% 70% at 50% 40%, rgba(16,185,129,0.05), transparent 60%), #070b10; }
.g-node { transition: opacity .2s; }
.g-label { font-size: 11px; font-family: var(--sans); font-weight: 600; paint-order: stroke; stroke: #070b10; stroke-width: 3px; pointer-events: none; }

/* ---------- Investigate pipeline ---------- */
.x-inv { display: flex; flex-direction: column; gap: 14px; }
.inv-pipe { display: flex; flex-direction: column; margin-top: 8px; }
.inv-stage { display: grid; grid-template-columns: 34px 1fr; gap: 12px; opacity: .5; transition: opacity .3s; }
.inv-stage.inv-done, .inv-stage.inv-running { opacity: 1; }
.inv-rail { display: flex; flex-direction: column; align-items: center; }
.inv-dot { width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: #04140d; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.inv-running .inv-dot { background: var(--panel-strong); color: var(--accent-2); }
.inv-stage:not(:last-child) .inv-rail::after { content: ""; flex: 1; width: 2px; background: var(--border); margin: 4px 0; min-height: 14px; }
.inv-body { padding-bottom: 22px; }
.inv-title { font-weight: 700; font-size: 14.5px; }
.inv-detail { font-size: 13px; color: var(--muted); margin-top: 3px; }
.inv-items { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.inv-item { font-size: 12px; color: var(--muted); font-family: var(--mono); padding: 6px 10px; border: 1px solid var(--border-soft); border-radius: 7px; background: rgba(255,255,255,0.02); }
.inv-answer { margin-top: 10px; padding: 14px 16px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel); }
.inv-answer p { margin: 0 0 8px; font-size: 14px; line-height: 1.6; }
.inv-answer p:last-child { margin: 0; }

/* ---------- prose ---------- */
.prose h3 { margin-top: 0; } .prose code { color: var(--accent-2); }
.prose ul { padding-left: 18px; } .prose li { margin: 6px 0; color: var(--muted); }
.prose a { color: var(--accent-2); }

.footer { text-align: center; padding: 24px; color: var(--muted-soft); font-size: 12.5px; border-top: 1px solid var(--border); }
.footer code { color: var(--muted); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
