:root {
  --bg: #0c0e11;
  --panel: #12151a;
  --panel-2: #181c22;
  --line: #292e36;
  --text: #eef1f4;
  --muted: #929aa5;
  --silver: #c8cdd3;
  --silver-bright: #f2f4f6;
  --accent: #aeb5bd;
  --danger: #e38b8b;
  --success: #8fc7a5;
  --shadow: 0 20px 60px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.shell { height: 100vh; display: grid; grid-template-columns: 265px minmax(0,1fr) 0; overflow: hidden; transition: grid-template-columns .2s ease; }
.shell.audit-open { grid-template-columns: 265px minmax(0,1fr) 360px; }
.sidebar { background: #0f1216; border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; min-width: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 3px 6px 20px; }
.brand strong { display: block; letter-spacing: .14em; font-size: .93rem; }
.brand span { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.sigil, .welcome-sigil { width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; color: #0d1013; font-family: Georgia, serif; font-weight: 800; background: linear-gradient(145deg,#fafafa,#8f979f); box-shadow: inset 0 1px 1px #fff, 0 5px 18px rgba(255,255,255,.08); }
.primary, .ghost, .starter, .send, .icon-button { border: 0; cursor: pointer; }
.primary { background: var(--silver-bright); color: #101217; border-radius: 10px; padding: 11px 13px; font-weight: 700; }
.primary:hover { background: white; }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--silver); border-radius: 9px; padding: 10px 12px; }
.ghost:hover { border-color: #4c535d; background: var(--panel-2); }
.compact { padding: 8px 10px; }
.section-label { color: #6f7781; text-transform: uppercase; letter-spacing: .12em; font-size: .67rem; margin: 22px 8px 8px; }
.conversation-list { overflow: auto; flex: 1; }
.conversation { display: flex; gap: 7px; align-items: center; border-radius: 9px; padding: 3px 5px 3px 10px; margin: 2px 0; color: #b9c0c8; }
.conversation.active { background: #1d2229; color: white; }
.conversation button.title { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; border: 0; color: inherit; cursor: pointer; padding: 8px 0; }
.conversation button.delete { opacity: 0; background: transparent; border: 0; color: #737b85; cursor: pointer; padding: 6px; }
.conversation:hover button.delete { opacity: 1; }
.sidebar-bottom { display: grid; gap: 8px; padding-top: 14px; }
.main { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; position: relative; background: radial-gradient(circle at 50% -20%, #1a1e24 0, var(--bg) 42%); }
.toolbar { height: 58px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; flex: 0 0 auto; background: rgba(12,14,17,.86); backdrop-filter: blur(12px); }
.status-wrap { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #7c858f; box-shadow: 0 0 0 4px rgba(124,133,143,.08); }
.status-dot.ok { background: var(--success); box-shadow: 0 0 0 4px rgba(143,199,165,.08); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 4px rgba(227,139,139,.08); }
.toolbar-controls { display: flex; gap: 8px; align-items: center; }
select, input, textarea { color: var(--text); background: #11151a; border: 1px solid var(--line); border-radius: 9px; outline: none; }
select { padding: 8px 30px 8px 10px; }
select:focus, input:focus, textarea:focus { border-color: #626a74; box-shadow: 0 0 0 3px rgba(174,181,189,.08); }
.welcome { margin: auto; max-width: 760px; padding: 50px 28px 150px; text-align: center; }
.welcome-sigil { width: 54px; height: 54px; margin: 0 auto 22px; font-size: 1.45rem; }
.welcome h1 { font-family: Georgia, serif; font-weight: 500; font-size: clamp(2rem,5vw,3.4rem); line-height: 1.08; margin: 0 0 18px; letter-spacing: -.035em; }
.welcome p { color: var(--muted); max-width: 650px; margin: 0 auto 34px; line-height: 1.65; }
.welcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.starter { background: rgba(20,24,29,.78); border: 1px solid var(--line); border-radius: 13px; padding: 15px; color: var(--text); }
.starter:hover { border-color: #535b65; transform: translateY(-1px); }
.starter strong, .starter span { display: block; }
.starter span { color: var(--muted); font-size: .82rem; margin-top: 5px; }
.messages { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: scroll; scrollbar-gutter: stable; overscroll-behavior: contain; padding: 34px max(24px, calc((100% - 820px)/2)) 180px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: #59616b #111419; }
.messages::-webkit-scrollbar { width: 12px; }
.messages::-webkit-scrollbar-track { background: #111419; border-left: 1px solid #1f242b; }
.messages::-webkit-scrollbar-thumb { background: #59616b; border: 3px solid #111419; border-radius: 999px; }
.messages::-webkit-scrollbar-thumb:hover { background: #747d88; }
.message { margin: 0 0 30px; position: relative; }
.message .meta { font-size: .72rem; color: #707884; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.message .bubble { line-height: 1.7; font-size: 1rem; }
.message.user .bubble { background: #1a1e24; border: 1px solid var(--line); border-radius: 14px 14px 3px 14px; padding: 13px 16px; margin-left: 12%; }
.message.assistant .bubble { padding: 2px 2px 0; }
.message-actions { display: flex; gap: 7px; margin-top: 12px; }
.message-actions button { font-size: .75rem; padding: 6px 9px; color: #8e97a2; background: transparent; border: 1px solid #262b32; border-radius: 7px; cursor: pointer; }
.message-actions button:hover { color: white; border-color: #4f5761; }
.bubble h1,.bubble h2,.bubble h3 { font-family: Georgia, serif; font-weight: 500; line-height: 1.25; margin: 1.2em 0 .5em; }
.bubble p { margin: 0 0 .85em; }
.bubble ul,.bubble ol { padding-left: 1.5em; }
.bubble blockquote { border-left: 3px solid #6d747c; margin: 1em 0; padding: .1em 0 .1em 1em; color: #c3c9cf; }
.bubble code { background: #171b20; border: 1px solid #252a31; border-radius: 5px; padding: .12em .35em; }
.bubble pre { overflow: auto; background: #111419; border: 1px solid #252a31; border-radius: 10px; padding: 13px; }
.bubble pre code { border: 0; padding: 0; }
.composer-wrap { position: absolute; left: 0; right: 0; bottom: 0; padding: 34px max(24px, calc((100% - 820px)/2)) 16px; background: linear-gradient(to top,var(--bg) 58%,transparent); }
.composer { display: flex; align-items: flex-end; gap: 10px; background: #171b20; border: 1px solid #343a43; border-radius: 16px; padding: 10px 10px 10px 15px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; resize: none; max-height: 190px; min-height: 28px; border: 0; background: transparent; padding: 5px 0; line-height: 1.45; }
.composer textarea:focus { box-shadow: none; }
.send { width: 36px; height: 36px; border-radius: 10px; background: var(--silver-bright); color: #101216; font-size: 1.25rem; font-weight: 800; }
.send:disabled { opacity: .35; cursor: wait; }
.composer-note { text-align: center; color: #666e78; font-size: .7rem; margin-top: 8px; }
.retrieval-notice { color: #8f98a2; font-size: .73rem; margin: 0 8px 7px; }
.hidden { display: none !important; }
.audit-panel { border-left: 1px solid var(--line); background: #101318; min-width: 0; overflow: hidden; }
.panel-header { height: 58px; padding: 0 14px 0 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-header strong,.panel-header span { display: block; }
.panel-header span { color: var(--muted); font-size: .72rem; margin-top: 2px; }
.icon-button { background: transparent; color: #8d96a0; font-size: 1.35rem; padding: 4px 8px; border-radius: 7px; }
.icon-button:hover { background: #20252c; color: white; }
.audit-content { height: calc(100vh - 58px); overflow: auto; padding: 15px; }
.audit-card { border: 1px solid var(--line); background: #15191e; border-radius: 11px; padding: 12px; margin-bottom: 10px; }
.audit-card h3 { font-size: .68rem; color: #878f99; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 7px; }
.audit-card p,.audit-card li { font-size: .83rem; line-height: 1.5; color: #c8cdd3; }
.audit-card p { margin: 0; white-space: pre-wrap; }
.audit-card ul { margin: 0; padding-left: 18px; }
.empty-panel { color: #747c86; font-size: .84rem; line-height: 1.55; padding: 20px 8px; }
.dialog { border: 0; padding: 0; color: var(--text); background: transparent; }
.dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.dialog-card { width: min(520px,calc(100vw - 30px)); max-height: 84vh; overflow: auto; background: #15191e; border: 1px solid #323842; border-radius: 16px; box-shadow: var(--shadow); padding: 18px; }
.dialog-card.wide { width: min(720px,calc(100vw - 30px)); }
.repair-status { margin-top: 12px; min-height: 20px; color: #aeb5bd; font-size: .8rem; line-height: 1.45; }
.repair-status:before { content: '◌'; display: inline-block; margin-right: 7px; animation: repair-spin 1s linear infinite; }
.repair-status.error { color: var(--danger); }
.repair-status.error:before { content: '!'; animation: none; }
.repair-status.success { color: var(--success); }
.repair-status.success:before { content: '✓'; animation: none; }
#repairDialog[aria-busy="true"] .dialog-card { cursor: progress; }
#repairDialog[aria-busy="true"] textarea { opacity: .65; }
@keyframes repair-spin { to { transform: rotate(360deg); } }
.dialog-card header,.dialog-card footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-card h2 { margin: 0; font-family: Georgia,serif; font-weight: 500; }
.dialog-card header p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; }
.dialog-card footer { justify-content: flex-end; margin-top: 18px; }
.dialog-card label { display: grid; gap: 7px; color: #adb4bd; font-size: .82rem; margin-top: 15px; }
.dialog-card input,.dialog-card textarea { padding: 10px; width: 100%; }
.dialog-card label.check { display: flex; align-items: center; }
.dialog-card label.check input { width: auto; }
.drop-zone { border: 1px dashed #4a525c; border-radius: 13px; min-height: 120px; place-items: center; align-content: center; text-align: center; cursor: pointer; margin: 18px 0 !important; }
.drop-zone:hover { background: #1a1f25; border-color: #777f89; }
.drop-zone input { display: none; }
.drop-zone strong,.drop-zone span { display: block; }
.drop-zone span { color: var(--muted); margin-top: 4px; }
.document-list { display: grid; gap: 8px; }
.document-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.document-item strong,.document-item span { display: block; }
.document-item span { color: var(--muted); font-size: .72rem; margin-top: 3px; }
.document-item button { background: transparent; border: 0; color: #8a929c; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%,20px); background: #e9edf0; color: #111419; padding: 10px 14px; border-radius: 9px; font-size: .82rem; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.typing { color: #8c949e; }
.typing:after { content: '…'; animation: dots 1.2s infinite; }
@keyframes dots { 0%,20%{content:'·'} 40%{content:'··'} 60%,100%{content:'···'} }
.mobile-only { display: none; }
@media (max-width: 1050px) {
  .shell.audit-open { grid-template-columns: 240px minmax(0,1fr) 330px; }
  .sidebar { width: 240px; }
}
@media (max-width: 820px) {
  .shell,.shell.audit-open { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 5; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.menu-open .sidebar { transform: translateX(0); }
  .audit-panel { position: fixed; inset: 0 0 0 auto; width: min(390px,100vw); z-index: 6; transform: translateX(100%); transition: transform .2s; }
  .shell.audit-open .audit-panel { transform: translateX(0); }
  .mobile-only { display: inline-block; }
  .toolbar { padding: 0 10px; }
  .status-wrap { display: none; }
  .toolbar-controls { width: 100%; justify-content: flex-end; }
  .toolbar-controls select { max-width: 130px; }
  .welcome-grid { grid-template-columns: 1fr; }
  .messages { padding-left: 18px; padding-right: 18px; }
  .composer-wrap { padding-left: 14px; padding-right: 14px; }
}

.reticulation-list { display: grid; gap: 10px; margin-top: 18px; }
.reticulation-item { border: 1px solid var(--line); background: #13171c; border-radius: 11px; padding: 12px; display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.reticulation-item strong { display: block; font-family: Georgia, serif; font-weight: 500; color: #e1e5e8; }
.reticulation-item p { margin: 7px 0; color: #bec5cc; font-size: .82rem; line-height: 1.5; }
.reticulation-item span { color: #747d87; font-size: .7rem; line-height: 1.4; }
.reticulation-item button { background: transparent; border: 0; color: #8a929c; cursor: pointer; font-size: 1.1rem; }

.reticulation-item.inactive { opacity: .55; }
.reticulation-actions { display: flex; align-items: center; gap: 6px; }
.reticulation-actions button { border: 1px solid #30363e; border-radius: 7px; padding: 5px 8px; font-size: .72rem; }

.status-separator{color:var(--muted);margin:0 .15rem}.bedrock-status{color:var(--muted)}.bedrock-status.ok{color:#8fd6ac}.bedrock-status.bad{color:#d39a9a}
.governance-card{width:min(1180px,94vw);max-height:90vh;overflow:auto}
.governance-summary{display:flex;justify-content:space-between;gap:1rem;border:1px solid var(--line);border-radius:12px;padding:.9rem 1rem;margin:.25rem 0 1rem;background:var(--panel)}
.governance-summary span{color:var(--muted)}.governance-summary.ok{border-color:#285d43}.governance-summary.bad{border-color:#65393c}
.governance-toolbar{display:flex;gap:.65rem;flex-wrap:wrap;margin-bottom:1rem}
.governance-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}
.governance-columns>section{border:1px solid var(--line);border-radius:14px;padding:1rem;min-height:180px;background:rgba(255,255,255,.012)}
.governance-columns h3{margin:0 0 .25rem}.muted{color:var(--muted);font-size:.86rem;margin:.15rem 0 .8rem}
.governance-list{display:flex;flex-direction:column;gap:.65rem;max-height:360px;overflow:auto;padding-right:.2rem}
.governance-item{border:1px solid var(--line);border-radius:11px;padding:.75rem;background:var(--panel)}
.governance-item-head{display:flex;justify-content:space-between;gap:.8rem;align-items:flex-start}.governance-item-head span{font-size:.75rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.governance-item p{margin:.45rem 0;color:var(--text);white-space:pre-wrap}.governance-actions{display:flex;gap:.45rem;flex-wrap:wrap;margin-top:.55rem}
.governance-actions button{font-size:.78rem}
@media(max-width:900px){.governance-columns{grid-template-columns:1fr}.status-separator,.bedrock-status{display:none}}

/* Exhibits are an operator-visible manifest, not a model-controlled disclosure. */
.message-exhibits{margin:.55rem 0 .25rem;border:1px solid var(--line);border-radius:10px;background:rgba(255,255,255,.015);overflow:hidden}
.exhibit-heading{padding:.45rem .65rem;text-transform:uppercase;letter-spacing:.12em;font-size:.68rem;color:var(--muted);border-bottom:1px solid var(--line)}
.exhibit-row{padding:.2rem .65rem;border-bottom:1px solid var(--line)}
.exhibit-row:last-child{border-bottom:0}
.exhibit-row summary{display:flex;align-items:center;gap:.5rem;cursor:pointer;padding:.35rem 0;list-style:none}
.exhibit-row summary::-webkit-details-marker{display:none}
.exhibit-row summary span{flex:1;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.exhibit-row summary em{font-style:normal;font-size:.62rem;border:1px solid var(--line);border-radius:999px;padding:.08rem .35rem;color:var(--muted)}
.exhibit-row p{white-space:pre-wrap;color:var(--muted);font-size:.82rem;margin:.1rem 0 .55rem}
.exhibit-empty{padding:.55rem .65rem;color:var(--muted);font-size:.8rem}

#proButton.pro-active { border-color: #9db4d4; color: #cfe0f7; }
