/* Zorchat — product chrome, not a landing page. */

@view-transition {
  navigation: auto;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] { display: none !important; }

:root,
html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111113;
  --bg-side: #0d0d0f;
  --bg-raised: #18181b;
  --text: #ececef;
  --text-side: #f1f1f1;
  --text-dim: #8b8b93;
  --text-strong: #ffffff;
  --text-mute: #c8c8cc;
  --primary-ink: #111111;
  --cell-on: #222226;
  --focus-line: #4a4a52;
  /* Same blues as leetzor.com — .logo-zor and --accent / --accent-2 */
  --accent: #6fa8d6;
  --accent-2: #3876a8;
  --accent-rgb: 111, 168, 214;
  --line: #2a2a30;
  --danger: #c96b6b;
  --radius: 6px;
}

html[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f4f6;
  --bg-side: #ececee;
  --bg-raised: #ffffff;
  --text: #1a1a1e;
  --text-side: #1a1a1e;
  --text-dim: #5c5c66;
  --text-strong: #111111;
  --text-mute: #5a5a62;
  --primary-ink: #f6f6f8;
  --cell-on: #e4e4ea;
  --focus-line: #b0b0b8;
  --accent: #3876a8;
  --accent-2: #2a5a84;
  --line: #d0d0d6;
  --danger: #b44c4c;
}

:root {
  --sidebar-width: 232px;
  --files-width: 240px;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.45;
}

.sidebar {
  position: relative;
  z-index: 2;
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-side);
  color: var(--text-side);
}

.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 6;
  width: 8px;
  height: 100%;
  cursor: col-resize;
}
.col-resizer:hover,
body.is-resizing .col-resizer { background: color-mix(in srgb, var(--accent) 35%, transparent); }
body.is-resizing { cursor: col-resize; user-select: none; }
body.sidebar-collapsed .sidebar > .col-resizer,
body.vault-collapsed .vault-tree > .col-resizer { display: none; }

.rail-toggle {
  position: absolute;
  top: 10px;
  right: -11px;
  z-index: 8;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.rail-toggle:hover { color: var(--text); }

body.sidebar-collapsed {
  grid-template-columns: 28px 1fr;
}
body.sidebar-collapsed .sidebar {
  padding: 36px 0 8px;
  overflow: hidden;
}
body.sidebar-collapsed .sidebar > *:not(#rail-toggle) { display: none; }
body.sidebar-collapsed #rail-toggle { right: 3px; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text-side);
  padding: 4px 8px;
}
.brand-mark { display: inline-flex; align-items: baseline; }
a.brand > .brand-ver {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  color: var(--text-dim);
  -webkit-text-fill-color: var(--text-dim);
  background: none;
}
.logo-zor {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.logo-chat { color: var(--text-mute); font-weight: 500; }

.site-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.site-link {
  color: var(--text-side);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: var(--radius);
}
.site-link:hover { color: var(--text-strong); background: var(--bg-raised); }
.site-link.is-active { color: var(--accent); background: var(--bg-raised); }
.site-link.admin-link { display: none; }
body.is-admin .site-link.admin-link { display: block; }

.new-zor {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-side);
  padding: 6px 8px;
  border-radius: var(--radius);
  text-decoration: none;
  display: block;
  text-align: left;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.new-zor:hover { background: var(--bg-raised); }

.brand,
.site-nav,
.new-zor,
.sidebar-foot {
  flex-shrink: 0;
}

.zor-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.zor-block { width: 100%; }

.zor-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-side);
  padding: 7px 8px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.zor-item:hover { background: var(--bg-raised); color: var(--text-strong); }
.zor-item.is-active { background: var(--bg-raised); color: var(--text-strong); }
.zor-item small { display: block; font-size: 11px; color: var(--text-mute); margin-top: 2px; }

.sidebar-foot { font-size: 11px; color: var(--text-dim); padding: 4px 8px; }
.credit-balance {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.core-status.ok { color: #6ea37c; }
.core-status.down { color: var(--danger); }

.stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}

.empty {
  margin: auto;
  max-width: 28rem;
  padding: 2rem;
}
.empty h1 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.empty p { color: var(--text-dim); line-height: 1.55; margin-bottom: 1.1rem; }

.primary {
  background: var(--text);
  border: none;
  color: var(--primary-ink);
  padding: 7px 12px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.primary:hover { filter: brightness(0.94); }
.primary:disabled,
.primary:disabled:hover {
  filter: none;
  opacity: 0.45;
  cursor: default;
}

.workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.workspace-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.zor-name {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: var(--radius);
  width: 12rem;
}
.zor-name:hover { border-color: var(--line); }
.zor-name:focus { outline: none; border-color: var(--accent); }

.tabs { display: flex; gap: 2px; margin-left: auto; }
.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--bg-raised); color: var(--accent); }

.subtabs { display: flex; gap: 2px; padding: 8px 20px 0; }
.panel-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
}
.panel-tab:hover { color: var(--text); }
.panel-tab.is-active { background: var(--bg-raised); color: var(--accent); }

h1.zor-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  padding: 4px 6px;
  width: auto;
}

.name-help {
  margin: 0;
  padding: 8px 20px 0;
  color: var(--danger, #c45c5c);
}

.head-actions { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.head-search {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
}
.head-search:hover { color: var(--accent); border-color: var(--accent); }
.head-search[aria-expanded='true'] { color: var(--accent); border-color: var(--accent); }
.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  padding: 5px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
}
.ghost:hover { color: var(--text); background: var(--bg-raised); }
.ghost.danger:hover { color: var(--danger); border-color: var(--danger); }

.vault-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--files-width) 1fr;
}
.vault-tree {
  position: relative;
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.vault-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.vault-rail-head .rail-toggle { position: static; }
body.vault-collapsed .vault-body { grid-template-columns: 28px 1fr; }
body.vault-collapsed .vault-tree { padding: 36px 0 8px; overflow: hidden; }
body.vault-collapsed .vault-tree > *:not(.vault-rail-head) { display: none; }
body.vault-collapsed .vault-rail-head span { display: none; }
body.vault-collapsed .vault-rail-head { justify-content: center; }
.vault-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.vault-section-head h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0;
}
body:not(.is-admin) #new-skill,
body:not(.is-admin) #skill-form {
  display: none;
}
.vault-create {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.vault-create input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  padding: 6px 8px;
}
.vault-project { margin-bottom: 10px; }
.vault-folder {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: var(--radius);
  cursor: pointer;
}
.vault-folder:hover { background: var(--bg-raised); }
.vault-twist { width: 0.9em; color: var(--text-dim); }
.vault-project-name,
.vault-file {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-side);
  font: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
}
.vault-project-name { font-weight: 600; color: var(--text); }
.vault-file:hover,
.vault-project-name:hover { background: var(--bg-raised); }
.vault-file { padding-left: 22px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.vault-file.is-active { background: var(--bg-raised); color: var(--accent); }
.vault-editor {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
}
.vault-file-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.vault-file-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
#file-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#file-status { flex-shrink: 0; }
#file-body {
  flex: 1;
  min-height: 0;
  resize: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
}
.view-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.view-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  padding: 5px 8px;
  cursor: pointer;
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--line); }
.view-toggle-btn:hover { color: var(--text); }
.view-toggle-btn.is-active {
  background: var(--bg-raised);
  color: var(--accent);
}
.vault-preview {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 22px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  line-height: 1.55;
}
.vault-preview .md-h1 { font-size: 26px; letter-spacing: -0.03em; margin: 0 0 12px; }
.vault-preview .md-h2 { font-size: 20px; letter-spacing: -0.02em; margin: 22px 0 8px; }
.vault-preview .md-h3 { font-size: 16px; margin: 18px 0 6px; }
.vault-preview .md-p { margin: 0 0 12px; }
.vault-preview .md-list { margin: 0 0 12px; }
.vault-preview .md-pre { margin: 0; }
.vault-preview .md-codeblock { margin: 0 0 14px; }
#move-to {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 5px 8px;
}

.panel { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; }
.panel[hidden] { display: none; }
.panel[data-panel="chat"] {
  overflow: hidden;
  min-height: 0;
}

.panel-note { color: var(--text-dim); font-size: 13px; line-height: 1.55; max-width: 40rem; margin-bottom: 1rem; }

.chat-find { position: relative; margin-bottom: 10px; max-width: 40rem; flex-shrink: 0; }
.chat-find input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: var(--radius);
}
.chat-find input:focus { outline: none; border-color: var(--accent); }
.chat-find-results {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px color-mix(in srgb, #000 18%, transparent);
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
.chat-find-empty { color: var(--text-dim); font-size: 13px; padding: 8px 10px; margin: 0; }
.chat-find-hit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.chat-find-hit:hover { background: var(--bg-raised); }
.chat-find-hit strong { font-size: 12px; color: var(--accent); }
.chat-find-hit span { font-size: 12px; color: var(--text-dim); }

.sources-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 40rem;
}
.sources-label { margin: 0; }
.sources-list {
  margin: 0;
  padding-left: 1.2em;
}
.sources-list li { margin: 1px 0; }
.sources-note a { color: inherit; word-break: break-all; }
.md-cite { font-size: 0.75em; margin-left: 1px; }

.remembered-note {
  align-self: flex-start;
  max-width: 40rem;
  margin: 0;
  padding: 5px 9px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 12px;
}
.transcript-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 14px;
  padding-bottom: 12px;
}
.jump-latest {
  position: absolute;
  z-index: 4;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--text);
  color: var(--primary-ink);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  opacity: 0.82;
  box-shadow: 0 4px 14px color-mix(in srgb, #000 18%, transparent);
}
.jump-latest:hover { filter: brightness(0.94); opacity: 1; }
.jump-latest[hidden] { display: none; }
.nav-collapse { display: none; }

.transcript,
.panel[data-panel="chat"],
.zor-list,
.chat-find-results {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.transcript::-webkit-scrollbar,
.panel[data-panel="chat"]::-webkit-scrollbar,
.zor-list::-webkit-scrollbar,
.chat-find-results::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.transcript::-webkit-scrollbar-track,
.panel[data-panel="chat"]::-webkit-scrollbar-track,
.zor-list::-webkit-scrollbar-track,
.chat-find-results::-webkit-scrollbar-track {
  background: transparent;
}
.transcript::-webkit-scrollbar-thumb,
.panel[data-panel="chat"]::-webkit-scrollbar-thumb,
.zor-list::-webkit-scrollbar-thumb,
.chat-find-results::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
.transcript::-webkit-scrollbar-thumb:hover,
.panel[data-panel="chat"]::-webkit-scrollbar-thumb:hover,
.zor-list::-webkit-scrollbar-thumb:hover,
.chat-find-results::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.bubble { max-width: 40rem; line-height: 1.55; font-size: 14px; white-space: pre-wrap; }
.bubble.user {
  align-self: flex-end;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 11px;
}
.bubble.user.slash-turn {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-dim);
}
.bubble.zor { align-self: flex-start; padding: 2px 0; }
.bubble.zor .who {
  color: var(--accent);
  font-size: 11px;
  display: block;
  width: fit-content;
  margin-bottom: 4px;
  padding-bottom: 1px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.bubble.error { align-self: flex-start; color: var(--danger); font-size: 13px; }
.bubble.is-pending .pending-dots {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
}
.stream-cursor,
.bubble.is-streaming .md::after {
  content: '▍';
  display: inline;
  margin-left: 1px;
  color: var(--text-dim);
  animation: stream-blink 1s step-end infinite;
}
.stream-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--text-dim);
  animation: stream-blink 1s step-end infinite;
}
@keyframes stream-blink {
  50% { opacity: 0; }
}
.md { white-space: normal; }
.md .md-h {
  font-weight: 650;
  line-height: 1.3;
  margin: 14px 0 6px;
  color: var(--text);
}
.md > .md-h:first-child { margin-top: 0; }
.md .md-h1 { font-size: 17px; }
.md .md-h2 { font-size: 16px; }
.md .md-h3 { font-size: 14px; }
.md .md-h4, .md .md-h5, .md .md-h6 { font-size: 13px; }
.md .md-p { margin: 0 0 8px; }
.md .md-p:last-child { margin-bottom: 0; }
.md .md-list {
  margin: 4px 0 10px;
  padding-left: 1.35em;
}
.md .md-list li { margin: 3px 0; }
.md .md-quote {
  margin: 8px 0;
  padding: 2px 0 2px 10px;
  border-left: 2px solid var(--accent);
  color: var(--text-dim);
}
.md .md-hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}
.md .md-link { color: var(--accent); }
.md .md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--bg-raised);
  padding: 0 4px;
  border-radius: 3px;
}
.md .md-codeblock {
  position: relative;
  margin: 8px 0;
}
.md .md-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  margin: 0;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
}
.md .md-copy:hover {
  color: var(--text);
  border-color: var(--focus-line);
}
.md .md-copy.is-copied {
  color: var(--accent);
}
.md .md-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  padding-right: 4.5rem;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
}
.cell-spoken {
  white-space: pre-wrap;
  line-height: 1.5;
  margin: 0 0 12px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.power-tools { display: inline-block; }
.power-tools summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
}
.power-tools[open] summary { margin-bottom: 6px; }
.notebook { max-width: 40rem; margin-bottom: 22px; }
.notebook-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.notebook-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}
.notebook-head .context-meter { margin-top: 0; }
.memory-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.memory-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.memory-row span { flex: 1; }
.memory-row.is-name span { font-weight: 600; }
.memory-empty { color: var(--text-dim); }
.memory-add { display: flex; gap: 8px; }
.memory-add input {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
  border-radius: var(--radius);
}
.memory-add input:focus { outline: none; border-color: var(--focus-line); }
.model-list { display: flex; flex-direction: column; gap: 6px; }
.model-option {
  text-align: left;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.model-option span { color: var(--text-dim); font-size: 12px; }
.model-option small { color: var(--text-dim); font-size: 11px; }
.model-option.is-current { border-color: var(--accent); }
.model-option.is-pending { border-color: #ff3b3b; }
.model-option.is-pending small { color: #ff3b3b; font-weight: 600; }
.context-meter {
  font-size: 12px;
  margin-top: 6px;
}
.ctx-plenty { color: #5dca7a; }
.ctx-mid { color: #e0b44c; }
.ctx-low { color: #ff3b3b; }
.model-option .context-meter { margin-top: 4px; }

.model-wrap,
.effort-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--text-dim);
  flex: 0 0 auto;
}
.model-wrap select,
.effort-wrap select {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  height: 38px;
  border-radius: var(--radius);
  padding: 0 8px;
}
.nav-toggle { display: none; }
.meta-line a { color: var(--accent); }

.composer {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--bg);
}
.composer textarea {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: var(--radius);
  resize: none;
  min-height: 38px;
  max-height: 160px;
  line-height: 1.4;
}
.composer textarea:focus { outline: none; border-color: var(--focus-line); }
.composer textarea:disabled { opacity: 0.5; }
.composer button {
  background: var(--text);
  border: none;
  color: var(--primary-ink);
  font: inherit;
  font-size: 13px;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 38px;
}
.composer button:disabled { opacity: 0.4; cursor: default; }
#stop {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--line);
}

.thread-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 2px 0 8px 10px;
  box-sizing: border-box;
}
.thread-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-side);
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-item:hover { color: var(--text-strong); background: var(--bg-raised); }
.thread-item.is-active { color: var(--accent); }

.meta-line { font-size: 11px; color: var(--text-dim); padding-top: 8px; min-height: 1rem; flex-shrink: 0; }
.panel[data-panel="chat"] .context-meter { flex-shrink: 0; }

.identity-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1100px) { .identity-layout { grid-template-columns: 1fr; } }

.matrix-wrap { display: inline-block; }

.domain-labels {
  display: grid;
  grid-template-columns: repeat(8, 3.4rem);
  gap: 3px;
  margin-bottom: 4px;
}
.domain-labels span {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
}

.matrix { display: grid; grid-template-columns: repeat(8, 3.4rem); gap: 3px; }

.cell {
  aspect-ratio: 1;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.cell:hover { border-color: #555; }
.cell.is-active { color: var(--text); border-color: #555; background: var(--cell-on); }
.cell.is-selected { outline: 1px solid var(--accent); outline-offset: 1px; }

.matrix-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
}
.matrix-foot span { margin-right: auto; }

.cell-editor {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.editor-hint { color: var(--text-dim); font-size: 13px; }
.cell-editor h3 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.cell-editor .domain-of { color: var(--accent); font-size: 11px; }
.cell-editor .facet-desc { color: var(--text-dim); font-size: 12px; line-height: 1.5; margin: 8px 0 12px; }

.variant {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  font-size: 13px;
}
.variant input { accent-color: var(--accent); cursor: pointer; }
.variant small { display: block; color: var(--text-dim); font-size: 11px; }
.variant.off { color: var(--text-dim); }

.decoded {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.decoded-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.decoded-head h3 { font-size: 13px; font-weight: 600; margin-right: auto; }
#decoded-text {
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
  white-space: pre-wrap;
}

textarea {
  flex: 1;
  min-height: 18rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--focus-line); }

.wizard-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 24px;
}
.wizard-backdrop[hidden] { display: none; }

.wizard {
  width: min(40rem, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px 22px 18px;
}

.wizard-progress { height: 1px; background: var(--line); margin-bottom: 20px; }
.wizard-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }

.wizard-step[hidden] { display: none; }
.wizard-kicker {
  color: var(--accent);
  font-size: 12px;
  margin-bottom: 6px;
}
.wizard h2 { font-size: 18px; font-weight: 600; line-height: 1.35; margin-bottom: 6px; }
.wizard-help { color: var(--text-dim); font-size: 13px; line-height: 1.5; margin-bottom: 16px; }

.wizard input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  margin-bottom: 16px;
}
.wizard input:focus { outline: none; border-color: var(--focus-line); }

.options { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.option {
  text-align: left;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  padding: 9px 11px;
  cursor: pointer;
}
.option:hover { border-color: #555; }
.option.is-chosen { border-color: var(--accent); }

.wizard-actions { display: flex; gap: 8px; justify-content: flex-end; }

.preview-traits {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  max-height: 16rem;
  overflow-y: auto;
}
.preview-trait {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.preview-trait summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.preview-trait summary::-webkit-details-marker { display: none; }
.preview-trait summary small {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 11px;
}
.preview-trait .domain-of { margin: 0; }
.preview-trait .variant { border-top-color: transparent; }
.preview-trait[open] .variant { border-top-color: var(--line); }

#preview-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
  white-space: pre-wrap;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  max-height: 22rem;
  overflow-y: auto;
  margin-bottom: 16px;
}

.home-stage {
  overflow-y: auto;
  min-height: 0;
  padding: 28px 28px 48px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.home-stage::-webkit-scrollbar { width: 8px; }
.home-stage::-webkit-scrollbar-track { background: transparent; }
.home-stage::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
.home-stage::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.home-hero { max-width: 36rem; margin-bottom: 24px; }
.home-hero h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
.home-hero p { color: var(--text-dim); line-height: 1.5; }
.home-actions { margin-top: 14px; }
.home-empty { color: var(--text-dim); }

.zor-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 10px;
}
.zor-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
}
.zor-card:hover { border-color: #444; }
.zor-card.is-current { border-color: #555; }
.zor-card h2 { font-size: 15px; font-weight: 600; cursor: pointer; margin-bottom: 4px; }
.zor-card p { color: var(--text-dim); font-size: 12px; margin-bottom: 12px; }
.card-talk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 10px;
  text-decoration: none;
}
.card-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.card-links a { color: var(--accent); text-decoration: none; font-size: 13px; }
.card-links a:hover { text-decoration: underline; }
.card-links a.card-delete {
  color: var(--danger);
  text-decoration: underline;
}

.primary.danger { background: #5a2c2c; color: #f0d0d0; }
.primary.danger:hover { filter: none; background: var(--danger); color: #fff; }
.primary.danger:disabled { opacity: 0.4; cursor: default; }
.delete-box code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}
.report-box label {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  text-align: left;
}
.report-box textarea {
  width: 100%;
  margin-top: 6px;
}
.report-consent {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.report-consent input[type="checkbox"] {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  background: none;
  border: none;
  border-radius: 0;
  appearance: auto;
  accent-color: var(--accent);
}

body.landing {
  display: flex;
  flex-direction: column;
  overflow: auto;
  grid-template-columns: none;
  min-height: 100vh;
}

.land-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
}

.land-nav nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.land-nav nav a {
  color: var(--text-mute);
  text-decoration: none;
  font-size: 14px;
}

.land-nav nav a:hover { color: var(--text-strong); }

.land-cta {
  color: var(--accent) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.land-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 40rem;
  padding: 48px 28px 80px;
}

.land-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.land-hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 16px;
}

.land-lede {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.55;
  max-width: 34rem;
  margin: 0 0 28px;
}

.land-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.land-actions .primary,
.land-actions .ghost {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  grid-template-columns: none;
}

.auth-card {
  position: relative;
  z-index: 2;
  width: min(24rem, calc(100% - 2rem));
  padding: 24px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.auth-card .brand { display: inline-flex; margin-bottom: 16px; padding: 0; }

.auth-card label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.auth-card input,
.settings-form input {
  display: block;
  width: 100%;
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

.auth-card input:focus,
.settings-form input:focus {
  outline: none;
  border-color: var(--focus-line);
}

.auth-error { color: var(--danger); font-size: 13px; margin: 6px 0 12px; }
.auth-switch { margin-top: 14px; color: var(--text-dim); font-size: 13px; }
.auth-switch a { color: var(--accent); }

.settings-block {
  max-width: 32rem;
  padding: 0 0 32px;
}

.admin-table {
  width: 100%;
  max-width: 52rem;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--line);
}
.admin-table th { color: var(--text-dim); font-weight: 600; }
.admin-table tbody tr {
  cursor: pointer;
}
.admin-table tbody tr:hover td {
  color: var(--text);
  background: var(--bg-raised);
}
.admin-table tbody tr.is-selected td {
  color: var(--accent);
  background: var(--bg-raised);
}
.accounts-block { max-width: 52rem; }
.model-lock-form { gap: 8px; }
.model-lock-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.model-lock-form label.model-lock-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}
.model-lock-form input[type="checkbox"] {
  display: inline-block;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  background: none;
  border: none;
  border-radius: 0;
  appearance: auto;
  accent-color: var(--accent);
}
.model-lock-name {
  flex: 0 0 9.5rem;
  font-weight: 600;
}
.model-lock-sep {
  flex-shrink: 0;
  color: var(--text-dim);
}
.model-lock-meta {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-dim);
}
.model-lock-line:has(input:not(:checked)) .model-lock-name,
.model-lock-line:has(input:not(:checked)) .model-lock-meta {
  opacity: 0.72;
}
.model-lock-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding-top: 4px;
}
.model-lock-help {
  margin: 0;
  font-size: 11px;
}
.model-lock-foot .primary {
  padding: 5px 12px;
  font-size: 12px;
}
.admin-search {
  display: block;
  margin: 10px 0 14px;
  max-width: 28rem;
}
.admin-search input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
}
.admin-search input:focus {
  outline: none;
  border-color: var(--focus-line);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.admin-expand-row td {
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
  cursor: default;
  background: var(--bg-raised);
}
.admin-expand {
  padding: 10px 12px 8px;
  max-width: 36rem;
}
.admin-expand h4 {
  margin: 14px 0 4px;
  font-size: 13px;
  font-weight: 600;
}
.admin-expand-meta {
  margin: 0 0 4px;
}
.admin-inline-form {
  margin: 6px 0 8px;
}
.admin-inline-form label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
}
.admin-inline-form input {
  display: block;
  width: 100%;
  max-width: 16rem;
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
}
.admin-inline-form button {
  margin-top: 8px;
}
.admin-zor-list {
  list-style: none;
  margin: 4px 0 8px;
  padding: 0;
}
.admin-zor-list li {
  margin: 0;
}
.admin-zor-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 6px 8px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.admin-zor-item:hover {
  background: var(--bg);
}
.admin-zor-item.is-selected {
  color: var(--accent);
  background: var(--bg);
}
.admin-zor-name {
  font-weight: 600;
}
.account-panel {
  max-width: 32rem;
  margin-top: 18px;
  padding: 14px 16px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.account-panel.report-panel {
  max-width: 52rem;
}
.account-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.account-panel h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.account-panel h4 {
  margin: 18px 0 4px;
  font-size: 13px;
  font-weight: 600;
}
.admin-list {
  margin: 0 0 12px;
  padding-left: 1.1rem;
  font-size: 13px;
  line-height: 1.45;
}
.admin-list li { margin: 0 0 4px; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(8, 1.6rem);
  gap: 3px;
  margin: 8px 0 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}
.admin-grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 3px;
  background: var(--bg);
  color: var(--text-dim);
}
.admin-grid-cell.is-on {
  background: var(--accent);
  color: var(--bg);
}
.report-snapshot-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 6px;
  max-width: 52rem;
}
.report-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  cursor: pointer;
}
.report-view-toggle input {
  width: auto;
  margin: 0;
}
.report-snapshot {
  margin: 0 0 8px;
  padding: 10px 12px;
  max-height: 36rem;
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.report-snapshot.is-json {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}
.report-snapshot.is-readable {
  white-space: normal;
}
.report-section {
  margin: 0 0 14px;
}
.report-section h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
}
.report-section p {
  margin: 0 0 4px;
  font-size: 13px;
}
.report-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.report-turn {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.report-turn-role {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.report-turn-body {
  margin: 0;
  font: inherit;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.text-dim { color: var(--text-dim); font-size: 11px; }

.settings-block h2 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.provider-status {
  margin: 14px 0 18px;
  color: var(--text);
  font-size: 14px;
}
.oauth-row { margin: 0 0 16px; }
.settings-form { margin: 12px 0; }
.settings-form.is-disabled { opacity: 0.45; pointer-events: none; }
.settings-form label { display: block; margin-top: 10px; }
.settings-form button { margin-top: 10px; }

.theme-toggle { width: 100%; margin-bottom: 8px; justify-content: center; }
.theme-picks {
  display: flex;
  gap: 18px;
  margin-top: 10px;
}
.theme-pick {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  padding: 4px 1px 6px;
}
.theme-pick:hover { color: var(--text); }
.theme-pick.is-selected {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.account-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.account-chip .ghost { padding: 3px 7px; font-size: 11px; }

.provider-banner {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 232px;
  right: 0;
  padding: 7px 16px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

body:has(#provider-banner) .home-stage {
  padding-top: 52px;
}
body:has(#provider-banner) .workspace-head {
  padding-top: 40px;
}

@media (max-width: 800px) {
  body {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  body.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar .rail-toggle { display: none; }
  .nav-toggle {
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 26;
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--line);
    background: var(--bg-side);
    color: var(--text);
    padding: 12px 14px;
    cursor: pointer;
  }
  .burger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 18px;
    height: 13px;
  }
  .burger span {
    display: block;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
  }
  .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 25;
    width: 80vw;
    overflow: hidden;
    border-right: 1px solid var(--line);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 50%;
    left: 80vw;
    z-index: 32;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: var(--text);
    color: var(--primary-ink);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    opacity: 0.82;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 14px color-mix(in srgb, #000 18%, transparent);
  }
  .nav-collapse:hover { filter: brightness(0.94); opacity: 1; }
  .provider-banner {
    left: 0;
  }
  body:has(#provider-banner) .sidebar {
    padding-top: 44px;
  }
  body:has(#provider-banner) .home-stage {
    padding-top: 20px;
  }
  .workspace { height: auto; min-height: 0; flex: none; }
  .vault-preview { min-height: 16rem; }

  body.chat-page {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    height: var(--app-height, 100svh);
    max-height: var(--app-height, 100svh);
  }
  body.chat-page #clear-chat {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 14px;
    font-size: 14px;
  }
  body.chat-page .nav-toggle {
    flex-shrink: 0;
    position: relative;
  }
  body.chat-page .stage,
  body.chat-page .workspace {
    flex: 1;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }
  body.chat-page .workspace-head {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .head-search { display: flex; }
  .chat-find { display: none; }
  body.search-open .chat-find { display: block; }
  .panel[data-panel="chat"] {
    padding: 10px 12px 0;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--kb-inset, 0px);
    z-index: 5;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
  }
  .composer textarea { font-size: 16px; }
  .jump-latest {
    left: auto;
    right: 10px;
    transform: none;
  }
}
