:root {
  --bg: #0e0b1a;
  --bg-2: #0b0818;
  --panel: #15112a;
  --panel-2: #1c1738;
  --panel-3: #221b42;
  --line: #2b2350;
  --line-2: #383066;
  --violet: #7c5cff;
  --violet-dim: #6a4ef0;
  --violet-deep: #5a3fd6;
  --cyan: #45e0ff;
  --text: #e8e6f5;
  --muted: #9b95c4;
  --green: #46d39a;
  --red: #ff6b8a;
  --amber: #ffc24b;
  --radius: 9px;
  --radius-sm: 6px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --glow: 0 0 18px rgba(124, 92, 255, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(124, 92, 255, .14), transparent 60%),
    radial-gradient(800px 480px at 100% 0%, rgba(69, 224, 255, .08), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

/* Faint tech grid overlay */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(124, 92, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 92, 255, .035) 1px, transparent 1px);
  background-size: 38px 38px;
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 30%, transparent 85%);
  mask-image: radial-gradient(circle at 50% 30%, #000 30%, transparent 85%);
}
.topbar, .tabs, main { position: relative; z-index: 1; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 11px 18px;
  background: linear-gradient(180deg, rgba(28, 22, 52, .92) 0%, rgba(21, 17, 42, .92) 100%);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.brandwrap { display: flex; align-items: center; gap: 12px; }
.logobox {
  display: grid; place-items: center;
  background: none; border: none; box-shadow: none; padding: 0;
}
.logobox::after { content: none; }
.brandlogo {
  width: 60px; height: 60px; display: block;
  filter: drop-shadow(0 0 14px rgba(124, 92, 255, .5));
}
.brandtext { display: flex; flex-direction: column; line-height: 1.15; }
.brand { font-weight: 800; letter-spacing: 2px; color: var(--text); font-size: 15px; }
.brand::first-letter { color: var(--violet); }
.tagline { font-size: 10.5px; color: var(--muted); letter-spacing: .3px; }
.status { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-on { background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 2.4s ease-in-out infinite; }
.dot-off { background: #4a4466; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.pill {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 11px; font-size: 12px;
}
.controls { margin-left: auto; display: flex; gap: 8px; }

/* Buttons — crisp, gradient, tech */
button {
  background: linear-gradient(180deg, var(--violet) 0%, var(--violet-deep) 100%);
  color: white; border: 1px solid rgba(124, 92, 255, .6);
  border-radius: var(--radius-sm); padding: 7px 15px; cursor: pointer;
  font-weight: 600; letter-spacing: .2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 2px 8px rgba(90, 63, 214, .35);
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
button:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--glow); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
button.ghost {
  background: linear-gradient(180deg, rgba(34, 27, 66, .6), rgba(28, 23, 56, .6));
  border: 1px solid var(--line-2); color: var(--text); box-shadow: none;
}
button.ghost:hover { background: var(--panel-3); border-color: var(--violet); box-shadow: none; }
button.danger { background: linear-gradient(180deg, #ff7d97 0%, #e8517a 100%); border-color: rgba(255, 107, 138, .6); }
button.danger:hover { box-shadow: 0 0 16px rgba(255, 107, 138, .4); }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 9px 14px 0; border-bottom: 1px solid var(--line); }
.tab {
  background: transparent; color: var(--muted); border: 0; box-shadow: none;
  border-bottom: 2px solid transparent; border-radius: 7px 7px 0 0;
  padding: 8px 15px; font-weight: 600; letter-spacing: .3px;
  transition: color .12s ease, background .12s ease;
}
.tab:hover { background: var(--panel-2); color: var(--text); transform: none; }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--cyan);
  background: linear-gradient(180deg, rgba(69, 224, 255, .08), transparent);
  text-shadow: 0 0 12px rgba(69, 224, 255, .4);
}

main { flex: 1; overflow: auto; padding: 18px; }
.panel { display: none; max-width: 980px; margin: 0 auto; animation: rise .2s ease; }
.panel.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
h2 { margin: 4px 0 14px; letter-spacing: .3px; }

/* Chat */
.feed {
  background: linear-gradient(180deg, rgba(21, 17, 42, .9), rgba(17, 13, 34, .9));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; min-height: 360px; max-height: 58vh; overflow: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}
.feed .line, .feed .working, .feed .sys {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px;
}
.welcome { padding: 18px 6px; }
.spine {
  color: var(--cyan); font-weight: 700; letter-spacing: .5px;
  padding: 11px 13px; margin-bottom: 12px; border-radius: var(--radius-sm);
  background: rgba(69, 224, 255, .06); border: 1px solid rgba(69, 224, 255, .25);
}
.hint, .note { color: var(--muted); }
.note { font-size: 12.5px; margin-top: 10px; }
.line { padding: 2px 4px; white-space: pre-wrap; }
.line .g { font-weight: 700; }
.you { color: var(--cyan); }
.intent { color: var(--text); }
.permit { color: var(--green); }
.commit { color: var(--green); font-weight: 600; }
.deny { color: var(--red); }
.suspend { color: var(--amber); }
.sys { color: var(--muted); font-style: italic; }
.approval-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; padding: 8px 10px; border: 1px solid rgba(255, 194, 75, .35); border-radius: var(--radius-sm); background: rgba(255, 194, 75, .06); }
.approval-row .q { color: var(--amber); }

/* User message bubble */
.bubble { display: flex; flex-direction: column; align-items: flex-end; margin: 12px 2px 6px; }
.you-bubble .bubble-body {
  background: linear-gradient(180deg, rgba(124, 92, 255, .9), rgba(90, 63, 214, .9));
  color: #fff; padding: 9px 13px; border-radius: 13px 13px 4px 13px;
  max-width: 78%; white-space: pre-wrap; box-shadow: 0 4px 14px rgba(90, 63, 214, .3);
}
.bubble-meta { font-size: 11px; color: var(--muted); margin-top: 4px; letter-spacing: .2px; }

/* Working indicator */
.working { display: flex; align-items: center; gap: 9px; color: var(--muted); padding: 6px 4px; }
.working .dots { display: inline-flex; gap: 4px; }
.working .dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--violet);
  animation: blink 1.2s infinite ease-in-out;
}
.working .dots i:nth-child(2) { animation-delay: .2s; }
.working .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

.composer { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.composer #taskInput {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line-2);
  color: var(--text); border-radius: var(--radius); padding: 11px 13px; font-size: 14px;
  font-family: inherit; line-height: 1.45; resize: none; min-height: 44px; max-height: 160px;
}
.composer #taskInput:focus { outline: none; border-color: var(--violet); box-shadow: var(--glow); }
.inline-form input, #mindRunId, #auditRunId {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px;
}
.inline-form { display: flex; gap: 8px; margin-bottom: 12px; }
.composer #sendBtn { padding: 10px 20px; }

/* Provider settings form */
.provider-form { margin-top: 12px; display: flex; flex-direction: column; gap: 11px; }
.provider-form h3 { margin: 0; color: var(--cyan); font-weight: 700; letter-spacing: .4px; font-size: 14px; }
.provider-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.provider-form input, .provider-form textarea, .provider-form select {
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 14px;
  font-family: inherit; resize: vertical;
}
.provider-form input:focus, .provider-form textarea:focus, .provider-form select:focus { outline: none; border-color: var(--violet); box-shadow: var(--glow); }
.provider-actions { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.dim { color: var(--muted); font-weight: 400; }
.ceiling-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.ceiling-row .ck { flex-direction: row; align-items: center; gap: 5px; color: var(--text); }
.composer select {
  background: var(--panel-2); border: 1px solid var(--line-2);
  color: var(--text); border-radius: var(--radius-sm); padding: 0 8px; font-size: 13px; max-width: 140px;
}

/* Lists / cards */
.list { display: flex; flex-direction: column; gap: 8px; }
.card, .item {
  background: linear-gradient(180deg, var(--panel), rgba(17, 13, 34, .85));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.item { display: flex; align-items: center; gap: 10px; transition: border-color .12s ease, transform .08s ease; }
.item:hover { border-color: var(--line-2); }
.item[style*="cursor: pointer"]:hover, .item.tool-item:hover { border-color: var(--violet); transform: translateX(2px); }
.item .meta { color: var(--muted); font-size: 12.5px; margin-left: auto; }
code {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; font-size: 12.5px;
}
.badge { border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.badge.ok { background: rgba(70,211,154,.15); color: var(--green); border: 1px solid var(--green); }
.badge.bad { background: rgba(255,107,138,.15); color: var(--red); border: 1px solid var(--red); }
.badge.warn { background: rgba(255,196,87,.15); color: var(--amber, #ffc457); border: 1px solid var(--amber, #ffc457); }
.glyph { width: 1.4em; display: inline-block; text-align: center; }

/* Tool effect-class badges (the governed ceiling) */
.effect {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor;
}
.eff-pure { color: var(--muted); }
.eff-read { color: var(--cyan); }
.eff-write { color: var(--violet); }
.eff-external { color: var(--amber); }
.eff-irreversible { color: var(--red); }
.risk { font-size: 11px; color: var(--muted); }
.risk-high, .risk-critical { color: var(--amber); }
.effect-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* Chat toolbar */
.chatbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grants { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.grant-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.chip {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; box-shadow: none;
}
.chip:hover { color: var(--text); transform: none; }
.chip.on {
  background: rgba(124, 92, 255, .16); color: var(--text);
  border-color: var(--violet); box-shadow: 0 0 10px rgba(124, 92, 255, .3);
}
.chatbar #regenBtn { margin-left: auto; }

/* Model answer block with copy */
.answer {
  margin: 12px 2px 2px; border: 1px solid rgba(70, 211, 154, .35); border-radius: var(--radius);
  background: rgba(70, 211, 154, .05); overflow: hidden; box-shadow: var(--shadow);
}
.answer-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 13px; border-bottom: 1px solid var(--line);
  color: var(--green); font-weight: 700; font-size: 12.5px;
}
.answer-head .copy { margin-left: auto; padding: 3px 11px; font-size: 12px; }
.answer-body { padding: 13px; white-space: pre-wrap; line-height: 1.55; }

/* Backups */
.ledger-path-row { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.path { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--cyan); }

/* Mind — 3D reasoning view */
.mind-controls { display: flex; gap: 8px; }
.mind-controls input {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 11px; min-width: 220px;
}
.mind-canvas {
  position: relative; width: 100%; height: 60vh; min-height: 380px;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at center, #170f37 0%, #0b0818 72%);
  cursor: grab; box-shadow: var(--shadow);
}
.mind-canvas:active { cursor: grabbing; }
.mind-canvas canvas { display: block; width: 100%; height: 100%; }
.mind-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 12.5px; }
/* Legend entries double as type filters — click to hide/show that node type. */
.mind-legend button.lg {
  background: none; border: 1px solid transparent; border-radius: 999px;
  padding: 3px 10px; cursor: pointer; font: inherit;
}
.mind-legend button.lg:hover { border-color: var(--line); }
.mind-legend button.lg.off { opacity: 0.35; text-decoration: line-through; }
/* Live run-state strip above the Mind canvas — real runtime data, not décor. */
.mind-state {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  margin: 0 0 10px; padding: 8px 12px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--muted);
}
.mind-state .ms-label { color: var(--muted); margin-right: 4px; }
.mind-state .ms-val { color: var(--text); font-weight: 600; }
.mind-state code { font-size: 11.5px; }
.lg { font-weight: 600; color: var(--muted); }
.lg.cyan { color: var(--cyan); }
.lg.violet { color: var(--violet); }
.lg.green { color: var(--green); }
.lg.red { color: var(--red); }
.lg.amber { color: var(--amber); }
.lg.blue { color: #6ab0ff; }
.lg.orange { color: #ff9d5c; }
.lg.dim { color: var(--muted); }

/* Provider catalog + status badges */
.badge:not(.ok):not(.bad) {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.catalog-h {
  margin: 16px 0 8px; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; font-weight: 700;
}
.tag {
  font-size: 11px; padding: 1px 8px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.item.active { border-color: var(--violet); box-shadow: inset 0 0 0 1px var(--violet); }

/* Chat shell — history sidebar + conversation (ChatGPT-style, governed) */
.chat-shell { display: grid; grid-template-columns: 244px 1fr; gap: 14px; height: 72vh; }
.chat-sidebar {
  display: flex; flex-direction: column; gap: 10px; min-height: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; background: rgba(21, 17, 42, .6);
}
button.full { width: 100%; }
.chat-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.chat-empty { padding: 8px; font-size: 12px; }
.chat-item {
  display: flex; align-items: center; gap: 6px; padding: 7px 9px;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--muted);
}
.chat-item:hover { background: var(--panel-2); color: var(--text); }
.chat-item.on { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.ci-title { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-del { background: none; border: none; box-shadow: none; color: var(--muted); padding: 0 4px; font-size: 16px; opacity: 0; }
.chat-item:hover .ci-del { opacity: 1; }
.ci-del:hover { color: var(--red); transform: none; box-shadow: none; }
.chat-defaults { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 9px; }
.def-title { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.def { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.def select { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm); padding: 6px 8px; }
.chat-defaults .grants { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-main .feed { flex: 1; max-height: none; }

/* Add-custom-tool form */
.addtool { margin-top: 14px; }
.addtool summary { cursor: pointer; color: var(--cyan); padding: 6px 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.addtool-actions { display: flex; align-items: center; gap: 12px; }
#toolForm label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
#toolForm input, #toolForm select, #toolForm textarea {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 7px 9px; font-size: 13px;
}
#toolForm textarea { font-family: ui-monospace, Menlo, monospace; }

/* One-click starter templates for skill/tool forms */
.starter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.starter-label { font-size: 12px; color: var(--muted); }
.starter-row .chip {
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; box-shadow: none;
}
.starter-row .chip:hover { border-color: var(--violet); background: var(--panel-3); transform: none; }

/* Multi-select skill chips (active skills combine) */
.skill-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-chips .chip {
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer; box-shadow: none;
}
.skill-chips .chip:hover { border-color: var(--violet); color: var(--text); transform: none; }
.skill-chips .chip.on {
  background: linear-gradient(180deg, rgba(124,92,255,.9), rgba(90,63,214,.9));
  border-color: var(--violet); color: #fff;
}
.sk-empty { font-size: 12px; }

/* Mind — inspectable node panel + hover tooltip */
.mind-stage { position: relative; }
.mind-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: rgba(21, 17, 42, .96); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 9px; font-size: 12px; color: var(--text); white-space: nowrap;
}
.mind-inspector {
  position: absolute; top: 12px; right: 12px; width: 300px; max-height: 82%; overflow: auto;
  z-index: 6; background: rgba(17, 13, 34, .97); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 34px rgba(0, 0, 0, .5);
}
.mi-head { display: flex; align-items: center; justify-content: space-between; }
.mi-kind { font-weight: 700; color: var(--cyan); text-transform: capitalize; }
.mi-close { background: none; border: none; box-shadow: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
.mi-close:hover { color: var(--red); transform: none; box-shadow: none; }
.mi-title { font-weight: 700; font-size: 13px; margin-top: 6px; }
.mi-sum { color: var(--muted); font-size: 12.5px; margin: 6px 0 10px; }
.mi-fields { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: 12.5px; }
.mi-fields dt { color: var(--muted); }
.mi-fields dd { margin: 0; color: var(--text); }
.mi-fields .mono { font-family: ui-monospace, Menlo, monospace; }
.mi-detail {
  margin-top: 10px; font-size: 11.5px; color: var(--muted); white-space: pre-wrap;
  word-break: break-word; max-height: 220px; overflow: auto; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px;
}
.mind-hint { font-size: 12px; margin: 8px 0; }

/* Advanced Mode — developer internals hidden unless toggled (UX philosophy) */
.adv-only { display: none; }
body.advanced .adv-only { display: revert; }
.adv-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--muted); cursor: pointer; -webkit-user-select: none; user-select: none;
  padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line);
}
.adv-toggle:hover { border-color: var(--violet); color: var(--text); }
.adv-toggle input { accent-color: var(--violet); margin: 0; }

/* Per-tab framework context intro */
.tab-intro {
  color: var(--muted); font-size: 13px; line-height: 1.6;
  margin: 0 0 14px; max-width: 70ch;
  padding: 10px 14px; border-left: 2px solid var(--violet);
  background: rgba(124, 92, 255, .05); border-radius: 0 8px 8px 0;
}

/* Backups — live state snapshot */
.state-card { padding: 14px 16px; }
.state-grid { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 13px; align-items: center; }
.state-grid .dim { color: var(--muted); }
.state-asof { margin-top: 10px; font-size: 11.5px; color: var(--muted); }

/* ---------- Audit: narrative + ledger chain in one trail ---------- */
.audit-subhead {
  margin: 18px 0 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.audit-subhead:first-child { margin-top: 4px; }
.audit-narrative { display: block; }
.audit-detail {
  margin: 4px 0 0 1.6em; color: var(--muted); font-size: 12px;
  font-family: ui-monospace, Menlo, monospace; word-break: break-word;
}
.audit-hint { margin: 4px 0 0 1.6em; color: var(--green); font-size: 12.5px; }

/* ---------- Advanced tab: runtime inspection cards ---------- */
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.adv-grid .card h3 { margin: 0 0 10px; font-size: 15px; }
.adv-grid .state-card { margin-bottom: 12px; }
.adv-label { display: block; margin: 10px 0 6px; font-size: 12.5px; color: var(--muted); }
#tab-advanced .adv-toggle { margin-top: 12px; display: inline-flex; }
@media (max-width: 900px) { .adv-grid { grid-template-columns: 1fr; } }

/* Mind inspector → Audit cross-link */
.mi-audit {
  margin-top: 10px; width: 100%;
  background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--violet); padding: 7px 0; cursor: pointer; font: inherit; font-size: 12.5px;
}
.mi-audit:hover { border-color: var(--violet); }
.lg.lavender { color: #d9bcff; }

/* Authority mode selector — the standard AI-tool posture (Auto/Edit/Plan/Custom) */
.mode-row { display: flex; gap: 6px; margin-bottom: 8px; }
.mode-chip {
  flex: 1; padding: 6px 0; font: inherit; font-size: 12.5px; font-weight: 600;
  background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--muted); cursor: pointer;
}
.mode-chip:hover { border-color: var(--violet); color: var(--text); }
.mode-chip.on {
  background: rgba(124,92,255,.16); border-color: var(--violet); color: var(--text);
}
.approval-why {
  flex-basis: 100%; margin: 6px 0 2px; padding: 8px 10px;
  background: var(--bg-2, rgba(0,0,0,.25)); border: 1px solid var(--line);
  border-radius: 8px; color: var(--muted); font-size: 12px;
  font-family: ui-monospace, Menlo, monospace; word-break: break-word;
}
.kind-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.lg.msg { color: #9aa6ff; }

/* Mind live-activity panel — always-on stream of the current turn's events */
.mind-activity {
  position: absolute; top: 12px; left: 12px; width: 268px; max-height: 82%;
  display: flex; flex-direction: column; z-index: 6;
  background: rgba(17, 13, 34, .92); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 34px rgba(0, 0, 0, .45);
}
.ma-head {
  padding: 9px 13px; font-size: 12px; font-weight: 700; letter-spacing: .03em;
  color: var(--muted); border-bottom: 1px solid var(--line); text-transform: uppercase;
}
.ma-list { overflow-y: auto; padding: 6px; }
.ma-row {
  display: flex; gap: 9px; padding: 7px 8px; border-radius: 8px; cursor: pointer;
}
.ma-row:hover { background: rgba(255, 255, 255, .04); }
.ma-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.ma-body { min-width: 0; }
.ma-title { font-size: 12.5px; color: var(--text); font-weight: 600; }
.ma-tool { color: var(--cyan); font-family: ui-monospace, Menlo, monospace; font-weight: 500; }
.ma-detail { font-size: 11.5px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.ma-working .ma-title { color: var(--muted); }
.ma-pulse { background: var(--violet); animation: ma-blink 1.1s ease-in-out infinite; }
@keyframes ma-blink { 0%,100% { opacity: .3; } 50% { opacity: 1; } }
@media (max-width: 760px) { .mind-activity { display: none; } }
.ws-actions { display: flex; gap: 8px; margin-top: 10px; }
.answer.streaming { opacity: 0.92; border-left: 2px solid var(--violet); }
.answer.streaming::after { content: "▍"; animation: ma-blink 1s steps(1) infinite; color: var(--violet); }

/* Claude-style composer: + button, slash palette, attachments, mode pill */
.mode-row { display: none; } /* superseded by the composer mode pill + slash commands */
.composer { position: relative; }
.composer-plus {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px;
  font-size: 20px; line-height: 1; background: var(--surface-2, #1b1230);
  border: 1px solid var(--line); color: var(--muted); cursor: pointer;
}
.composer-plus:hover { color: var(--text); border-color: var(--violet); }
.mode-pill {
  flex: 0 0 auto; align-self: center; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; text-transform: lowercase;
  background: rgba(124,92,255,.16); color: var(--violet-soft, #b998ff);
  border: 1px solid var(--violet); cursor: default;
}
.mode-pill.mode-plan { background: rgba(69,224,255,.14); color: var(--cyan); border-color: var(--cyan); }
.mode-pill.mode-edit { background: rgba(106,176,255,.14); color: #6ab0ff; border-color: #6ab0ff; }
.attach-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  padding: 4px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line);
}
.attach-chip button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0; }
.slash-menu, .plus-menu {
  position: absolute; bottom: 100%; left: 0; margin-bottom: 8px; z-index: 20;
  background: rgba(17,13,34,.98); border: 1px solid var(--line-2, var(--line));
  border-radius: 10px; box-shadow: 0 10px 34px rgba(0,0,0,.5); overflow: hidden; min-width: 280px;
}
.slash-menu button, .plus-menu button {
  display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left;
  background: none; border: none; color: var(--text); padding: 9px 13px; cursor: pointer; font: inherit;
}
.slash-menu button:hover, .plus-menu button:hover { background: rgba(255,255,255,.05); }
.slash-menu b { color: var(--violet-soft, #b998ff); font-family: ui-monospace, Menlo, monospace; }
.slash-menu span { color: var(--muted); font-size: 12px; }
