:root {
  --bg: #0a0b0d;
  --panel: #111317;
  --panel-2: #16191e;
  --line: #282d35;
  --text: #f2f0e9;
  --muted: #969da8;
  --accent: #b9f45d;
  --accent-dark: #17220b;
  --danger: #ff7167;
  --panel-inset: #0c0e11;
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input, textarea { font: inherit; }
button {
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 8px 13px;
  color: #0b0e08;
  background: var(--accent);
  cursor: pointer;
  font-weight: 700;
}
button:hover { filter: brightness(1.08); }
button.secondary, a.secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--line);
}
a.secondary {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
button.danger { color: var(--danger); background: transparent; border-color: #5c302f; }
.hidden { display: none !important; }
.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
header {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--line);
}
h1 { margin: 5px 0 0; font-family: Georgia, serif; font-size: clamp(22px, 3vw, 35px); font-weight: 500; }
h2 { margin: 0; font-size: 16px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.header-actions, .document-actions { display: flex; align-items: center; gap: 10px; }
.status { color: var(--muted); font-size: 13px; }
.status.connected::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--accent); }
main { min-height: 0; display: grid; grid-template-columns: var(--sidebar-w, 280px) 1fr; }
aside { position: relative; display: flex; flex-direction: column; min-height: 0; padding: 20px 14px; border-right: 1px solid var(--line); background: #0d0f12; }
.sidebar-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 5;
}
.sidebar-resizer:hover, .sidebar-resizer.dragging { background: linear-gradient(90deg, transparent 3px, var(--accent) 3px, var(--accent) 5px, transparent 5px); opacity: .55; }
.aside-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 5px 14px; }
.aside-heading button { width: 31px; height: 31px; padding: 0; font-size: 21px; line-height: 1; }
.search { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--panel); }
.search input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
.search button { padding: 5px 7px; font-size: 11px; }
.view-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-top: 10px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.view-toggle button { padding: 6px; border-color: transparent; color: var(--muted); background: transparent; font-size: 11px; }
.view-toggle button.active { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.search-meta { margin: 9px 8px 0; color: var(--muted); font-size: 11px; }
.file-list { min-height: 100px; overflow: auto; flex: 1; padding: 10px 0 14px; font-size: 13px; }
.file {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 24px;
  overflow: hidden;
  padding: 2px 8px 2px calc(24px + var(--indent, 0px));
  border: 0;
  border-radius: 5px;
  color: #b9bfc8;
  background: transparent;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
}
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file:hover { color: var(--text); background: var(--panel-2); }
.file.active { color: var(--text); background: var(--accent-dark); }
.file.active .file-name { color: #d8f7a6; }
.file.deleted { color: #7a7f87; text-decoration: line-through; }
.recent-file { display: grid; gap: 2px; min-height: 0; padding: 6px 10px; }
.recent-file small { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.folder { color: #cdd2d9; }
.folder summary {
  display: flex;
  align-items: center;
  min-height: 24px;
  overflow: hidden;
  padding: 2px 8px 2px calc(6px + var(--indent, 0px));
  border-radius: 5px;
  cursor: pointer;
  color: #aab1bb;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  list-style: none;
  white-space: nowrap;
}
.folder summary::-webkit-details-marker { display: none; }
.folder summary::before {
  content: "▸";
  flex: 0 0 14px;
  display: inline-block;
  width: 14px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  transition: transform .12s ease;
}
.folder[open] > summary::before { transform: rotate(90deg); }
.folder summary .folder-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.folder summary:hover { color: var(--text); background: var(--panel-2); }
.folder-children { position: relative; }
.folder-children::before {
  content: "";
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: calc(12px + var(--indent, 0px));
  width: 1px;
  background: var(--line);
}
.search-result {
  display: grid;
  width: 100%;
  gap: 4px;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  text-align: left;
}
.search-result:hover { background: var(--panel-2); }
.search-result strong {
  overflow: hidden;
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result span { color: var(--accent); font-size: 12px; }
.search-result small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.empty { margin: 12px 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.trash-toggle { padding: 12px 6px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.workspace { min-width: 0; min-height: 0; position: relative; }
/* The workspace column stretches to the sidebar's full file-list height,
   so centering against it put the hero (and now the brief) thousands of
   pixels below the fold. Pin the welcome view to the viewport instead:
   it scrolls internally and reads top-down like a dashboard. */
.welcome { position: sticky; top: 0; min-height: 0; max-height: 100vh; overflow-y: auto; display: grid; place-content: start center; padding: 7vh 40px 40px; text-align: center; }
.welcome h2 { margin: 15px 0 8px; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.welcome p { max-width: 520px; margin: 0; color: var(--muted); line-height: 1.6; }

.brief { width: min(680px, 100%); margin: 28px auto 0; text-align: left; }
.brief-section { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 8px; }
.brief-section h3 { margin: 0; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.brief-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.brief-row:last-child { border-bottom: 0; }
.brief-row strong { display: block; font-size: 13px; }
.brief-row small { color: var(--muted); }
.brief-row .brief-actions { display: flex; gap: 8px; }
.brief-meta { margin: 6px 2px 0; color: var(--muted); font-size: 12px; text-align: right; }

.memory-policy { display: flex; align-items: center; gap: 8px; margin: 10px 2px 0; color: var(--muted); font-size: 13px; }
.document-glyph { color: var(--accent); font-family: Georgia, serif; font-size: 58px; }
.editor-panel { height: 100%; min-height: 520px; display: grid; grid-template-rows: auto auto 1fr; }
.document-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.path { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.revision { margin-left: 9px; color: var(--muted); font-size: 12px; }
.tabs { display: flex; align-items: center; gap: 2px; padding: 7px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.tab { padding: 6px 9px; color: var(--muted); background: transparent; border-color: transparent; font-size: 12px; }
.tab.active { color: var(--text); border-color: var(--line); }
#save-state { margin-left: auto; color: var(--muted); font-size: 12px; }
.document { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; }
.document.edit { grid-template-columns: 1fr; }
.document.preview-only { grid-template-columns: 1fr; }
.document.edit .preview, .document.preview-only textarea { display: none; }
textarea {
  width: 100%;
  min-height: 100%;
  resize: none;
  border: 0;
  border-right: 1px solid var(--line);
  outline: 0;
  padding: 28px;
  color: #dfe4e8;
  background: #0e1013;
  font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
  tab-size: 2;
}
.preview { min-width: 0; overflow: auto; padding: 28px 36px 80px; color: #d9dde2; line-height: 1.7; }
.preview h1, .preview h2, .preview h3 { margin: 1.5em 0 .45em; color: var(--text); font-family: Georgia, serif; font-weight: 500; }
.preview h1 { font-size: 32px; }
.preview h2 { font-size: 24px; }
.preview h3 { font-size: 19px; }
.preview code { padding: 2px 5px; border-radius: 4px; background: var(--panel-2); color: #d8f7a6; }
.preview pre { overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: #08090b; }
.preview pre code { padding: 0; background: transparent; }
.preview blockquote { margin-left: 0; padding-left: 18px; border-left: 2px solid var(--accent); color: var(--muted); }
.preview a { color: var(--accent); }
dialog { width: min(440px, calc(100vw - 30px)); max-height: calc(100dvh - 48px); overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--panel); box-shadow: 0 24px 80px #000c; }
dialog::backdrop { background: #000b; backdrop-filter: blur(4px); }
dialog h2 { margin: 10px 0; font-family: Georgia, serif; font-size: 26px; }
dialog p { color: var(--muted); line-height: 1.5; }
dialog label { display: grid; gap: 7px; color: #cbd0d5; font-size: 13px; }
dialog input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; outline: 0; color: var(--text); background: var(--panel-inset); }
dialog select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel-inset); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
#auth-status:empty { display: none; }
#auth-status.error { color: var(--danger); }
#connect-dialog input { font-size: 16px; }
.auth-screen { position: fixed; inset: 0; z-index: 100; overflow-y: auto; padding: 24px 15px; background: var(--bg); }
.auth-screen:not([hidden]) { display: grid; }
.shell[hidden] { display: none; }
.auth-card { width: min(440px, 100%); min-width: 0; margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.auth-card h2 { margin: 10px 0; font-family: Georgia, serif; font-size: 26px; }
.auth-card p { color: var(--muted); line-height: 1.5; }
.auth-card label { display: grid; gap: 7px; color: #cbd0d5; font-size: 13px; }
.auth-card input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel-inset); }
.markdown-issues { display: grid; gap: 8px; max-height: 340px; overflow: auto; margin-top: 16px; }
.markdown-issue { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-inset); }
.markdown-issue strong { text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }
.markdown-issue span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.markdown-issue.error strong { color: #ff7676; }
.markdown-issue.warning strong { color: var(--accent); }
.agents-dialog { width: min(820px, calc(100vw - 30px)); }
.agents-dialog .history-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.memories-dialog { width: min(860px, calc(100vw - 30px)); }
.memories-dialog .history-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.memory-tabs, .dialog-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.memory-list { display: grid; gap: 10px; max-height: 560px; overflow: auto; }
.memory-card { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-inset); }
.memory-card > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.memory-card p { margin: 12px 0 8px; color: var(--text); }
.memory-card small { color: var(--muted); }
.memory-provenance { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.memory-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.memory-history-dialog { width: min(720px, calc(100vw - 30px)); }
.memory-history-dialog h3 { margin: 20px 0 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.memory-history-content { padding: 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel-inset); }
.memory-source-list, .memory-event-list { display: grid; gap: 7px; max-height: 220px; overflow: auto; }
.memory-history-row { display: grid; gap: 3px; padding: 9px 11px; border-left: 2px solid var(--line); background: var(--panel-inset); }
.memory-history-row strong { font-size: 12px; }
.memory-history-row small { color: var(--muted); font-size: 11px; }
.advanced-create { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-inset); }
.advanced-create summary { padding: 11px 14px; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.advanced-create summary:hover { color: var(--text); }
.advanced-create[open] summary { border-bottom: 1px solid var(--line); }
.advanced-create .advanced-help { margin: 12px 14px 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.advanced-create .advanced-help code { color: var(--text); background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.advanced-create .agent-create, .advanced-create .new-token { margin: 12px 14px 14px; }
.agent-create { display: grid; grid-template-columns: 1fr 130px 1fr auto; align-items: end; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-inset); }
.agent-create.compact { grid-template-columns: 1fr auto; }
.publish-create { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 10px; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-inset); }
.publish-create .full { grid-column: 1 / -1; }
.publish-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.publish-review { margin-top: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-inset); font-size: 13px; }
.publish-review ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.5; }
.publish-review .dialog-actions { margin-top: 12px; }
.directory-search { display: flex; gap: 8px; margin-bottom: 12px; }
.directory-search input { flex: 1; }
.directory-files { padding: 4px 8px 8px; border-top: 1px solid var(--line); background: var(--panel-inset); }
.agent-create label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
/* Inline feedback for the username strip: toasts sit below the modal
   dialog's top layer, so save results must render inside the dialog. */
.handle-status { grid-column: 1 / -1; font-size: 12px; line-height: 1.4; }
.handle-status.ok { color: var(--accent); }
.handle-status.error { color: var(--danger); }
#profile-handle.saved { border-color: var(--accent); }
.new-token { margin-top: 12px; padding: 13px; border: 1px solid #527728; border-radius: 8px; background: var(--accent-dark); color: #dfffb8; font-size: 13px; }
.new-token > div { display: flex; gap: 8px; margin-top: 9px; }
.new-token input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.agent-list { max-height: 350px; overflow: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; }
.agent-list h3 { margin: 0; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.agent-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.agent-row:last-child { border-bottom: 0; }
.agent-row strong { display: block; font-size: 13px; }
.agent-row small { color: var(--muted); }
.role-badge { padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.revoked { opacity: .5; }
.history-dialog { width: min(980px, calc(100vw - 30px)); }
.history-heading { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 16px; }
.history-heading h2 { margin: 0; }
.history-layout { min-height: 440px; display: grid; grid-template-columns: 220px 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.history-list { overflow: auto; padding: 8px; border-right: 1px solid var(--line); background: var(--panel-inset); }
.revision-item { width: 100%; display: grid; gap: 3px; padding: 10px; border: 0; color: var(--text); background: transparent; text-align: left; }
.revision-item:hover, .revision-item.active { background: var(--panel-2); }
.revision-item small { color: var(--muted); font-weight: 500; }
.history-detail { min-width: 0; display: grid; grid-template-rows: auto 1fr; }
.history-detail-bar { display: flex; align-items: center; justify-content: space-between; min-height: 50px; gap: 14px; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.diff { min-height: 0; max-height: 520px; overflow: auto; margin: 0; padding: 18px; border: 0; border-radius: 0; color: #d6dbe0; background: #08090b; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.diff-add { display: block; color: #bdf58a; background: #13230f; }
.diff-remove { display: block; color: #ffaaa4; background: #2a1212; }
.diff-context { display: block; color: #a9afb7; }
#toast { position: fixed; right: 20px; bottom: 20px; max-width: 380px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel-2); box-shadow: 0 12px 36px #0009; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; }
#toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  header { min-height: 82px; padding: 17px; }
  header h1 { font-size: 20px; }
  .status { display: none; }
  main { grid-template-columns: 1fr; grid-template-rows: 210px 1fr; }
  aside { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-resizer { display: none; }
  .document { grid-template-columns: 1fr; }
  .document.split .preview { display: none; }
  .document-bar { align-items: flex-start; flex-direction: column; }
  .history-layout { grid-template-columns: 1fr; grid-template-rows: 150px 1fr; }
  .history-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .agent-create { grid-template-columns: 1fr; }
  .publish-create { grid-template-columns: 1fr; }
  .artifacts-panel { padding: 20px 16px 40px; }
  .artifact-upload { grid-template-columns: 1fr; }
}

.backlinks {
  border-top: 1px solid var(--border, #2a2f3a);
  margin-top: 12px;
  padding-top: 10px;
}
.backlinks h3 {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  margin: 0 0 6px;
}
.backlinks ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
button.backlink {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
}

/* Profile page (full pane, not a modal) */
.profile-panel { position: sticky; top: 0; min-height: 0; max-height: 100vh; overflow-y: auto; padding: 32px 40px 48px; }
.profile-panel h2 { margin: 12px 0 4px; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.profile-section { max-width: 640px; margin-top: 26px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; }
.profile-section h3 { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.profile-section label { display: block; margin-top: 12px; font-size: 13px; }
.profile-section input { display: block; width: 100%; margin-top: 6px; }
.profile-section .hint { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.profile-section button { margin-top: 14px; }
.profile-account { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.profile-account dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.profile-account dd { margin: 0; font-size: 13px; }
.billing-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.profile-user-md { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.profile-user-md .hint { margin: 0; }
.publish-identity { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.publish-identity.gated { border-color: var(--danger); }

/* Artifacts pane (routed like the profile) */
.artifacts-panel { position: sticky; top: 0; min-height: 0; max-height: 100vh; overflow-y: auto; padding: 32px 40px 48px; }
.artifacts-panel h2 { margin: 12px 0 4px; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.artifacts-panel > .hint { max-width: 640px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.artifact-section { max-width: 820px; margin-top: 26px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; }
.artifact-section h3 { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.artifact-upload { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.artifact-upload label { display: grid; gap: 6px; font-size: 13px; }
.artifact-upload label span, .artifact-upload label small { color: var(--muted); font-weight: 400; }
.artifact-upload .wide, .artifact-file-drop, .artifact-upload-actions { grid-column: 1 / -1; }
.artifact-upload input, .artifact-upload textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; outline: 0; color: var(--text); background: var(--panel-inset); }
.artifact-upload textarea { resize: vertical; }
.artifact-file-drop { display: grid; place-items: center; gap: 4px; min-height: 110px; padding: 18px; border: 1.5px dashed var(--line); border-radius: 8px; background: var(--panel-inset); cursor: pointer; text-align: center; }
.artifact-file-drop span { font-weight: 700; }
.artifact-upload .artifact-file-drop input { width: auto; margin-top: 8px; border: 0; background: transparent; }
.artifact-upload-actions { display: flex; align-items: center; gap: 12px; }
.artifact-status { color: var(--muted); font-size: 13px; }
.artifact-status.error { color: var(--danger); }
.artifact-status.warning { color: #e8c66b; }
.artifact-status.success { color: var(--accent); }
.artifact-library-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.artifact-library-heading h3 { margin: 0; }
.artifacts-panel .agent-list { max-height: none; margin-top: 0; }
.artifacts-panel .empty { margin: 4px 0; }
.artifact-copy { display: flex; align-items: center; gap: 12px; min-width: 0; }
.artifact-type { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 8px; background: var(--accent-dark); color: var(--accent); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.artifact-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.artifact-row-actions a.secondary, .artifact-row-actions button { font-size: 12px; padding: 6px 10px; }
.artifact-replace { position: relative; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; font-weight: 700; cursor: pointer; }
.artifact-replace input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }

.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.danger-zone h4 { margin: 0 0 6px; font-size: 13px; color: var(--text); }
.erasure-plan ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.5; }
.erasure-plan .destroy strong { color: #ff8a80; }

.data-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.import-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.import-block input[type="file"] { display: block; margin-top: 6px; color: var(--muted); }
.import-block select { width: 100%; margin-top: 6px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: var(--panel-inset); }
.import-result { margin-top: 10px; font-size: 13px; color: var(--muted); }
.import-result .summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; color: var(--text); }
.import-result ul { max-height: 220px; overflow-y: auto; margin: 0; padding-left: 18px; line-height: 1.5; }
.import-result .error { color: #ff8a80; }
/* Cohesive workspace shell. Shared interaction tokens apply to every destination. */
:root { --bg:#101311; --panel:#171c18; --panel-2:#202720; --panel-inset:#111612; --line:#343e35; --muted:#a5afa6; --text:#eef1e8; --accent:#c6e99d; --accent-dark:#293922; }
body { height:100dvh; overflow:hidden; }
button,input,textarea,select { font:inherit; }
button { font-size:13px; font-weight:600; min-height:36px; transition:background .12s,color .12s; }
button:disabled { opacity:.5; cursor:not-allowed; }
a { color:var(--accent); }
:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
input:focus-visible,textarea:focus-visible,select:focus-visible { outline-offset:-2px; }
input,select { min-width:0; max-width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:7px; background:var(--panel-inset); color:var(--text); }
input::placeholder, textarea::placeholder { color:var(--muted); opacity:1; }
input[type=checkbox] { width:18px; height:18px; min-height:18px; flex:0 0 18px; margin:0; accent-color:var(--accent); }
.shell { height:100dvh; min-height:0; display:grid; grid-template-columns:200px minmax(0,1fr); grid-template-rows:88px minmax(0,1fr); }
.primary-nav { grid-column:1; grid-row:1/-1; display:flex; flex-direction:column; padding:30px 16px 20px; border-right:1px solid var(--line); background:#141a15; gap:6px; min-height:0; }
.wordmark { display:flex; align-items:center; gap:8px; margin:0 8px 38px; color:var(--text); font-size:24px; letter-spacing:-1px; font-weight:650; text-decoration:none; }
.brand-mark { display:grid; place-items:center; width:27px; height:29px; border-radius:7px; background:var(--accent); color:#152310; font-family:Georgia,serif; font-style:italic; font-size:25px; }
.beta-label { color:var(--muted); letter-spacing:1px; font-size:8px; margin-left:auto; }
.nav-label { margin:0 12px 10px; color:var(--muted); font-size:9px; font-weight:650; letter-spacing:1.7px; }
.nav-item { display:flex; align-items:center; gap:12px; border:1px solid transparent; color:#acb7ad; background:transparent; text-align:left; min-height:44px; width:100%; padding:10px 12px; font-size:14px; }
.nav-item span { font-size:18px; width:18px; text-align:center; }
.nav-item.active { background:#293329; color:var(--text); border-color:#394735; }
.nav-item.active span { color:var(--accent); }
.nav-item:hover { background:#202820; }
.nav-bottom { margin-top:auto; padding-top:24px; }
.nav-caption { padding:0 12px; font-size:11px; color:var(--muted); line-height:1.7; }
.nav-help { display:block; margin:14px 12px 0; color:var(--muted); font-size:12px; text-decoration:none; }
.workspace-header { grid-column:2; grid-row:1; min-height:0; padding:18px 30px; background:var(--bg); gap:20px; }
.workspace-header h1 { margin:5px 0 0; font-weight:600; font-size:23px; line-height:1.15; font-family:inherit; letter-spacing:-.6px; font-size:23px; }
.workspace-header .eyebrow { color:var(--muted); font-size:9px; letter-spacing:1.6px; }
.workspace-header .header-actions { flex-wrap:wrap; justify-content:flex-end; }
.workspace-header #credentials { font-size:12px; }
.shell > main { grid-column:2; grid-row:2; min-width:0; min-height:0; grid-template-columns:var(--sidebar-w,248px) minmax(0,1fr); grid-template-rows:minmax(0,1fr); }
.knowledge-sidebar { padding:16px 12px 12px; min-height:0; overflow:hidden; background:#141815; }
.knowledge-tabs { display:flex; gap:3px; border-bottom:1px solid var(--line); padding-bottom:16px; margin-bottom:20px; }
.knowledge-tabs button { padding:6px 9px; border:0; background:transparent; color:var(--muted); font-size:12px; }
.knowledge-tabs button.active { color:var(--accent); background:var(--accent-dark); }
.aside-heading h2 { font-size:12px; font-weight:650; color:var(--muted); }
.aside-heading button { width:30px; height:30px; min-height:30px; color:var(--text); background:transparent; border-color:var(--line); }
.search { padding:6px 8px; }
.search input { min-width:0; padding:3px 0; font-size:12px; }
.search button { min-height:28px; }
.file-list { min-height:0; padding-top:16px; }
.file,.folder summary { min-height:31px; }
.recent-file { margin-bottom:3px; padding:8px; }
.recent-file small { font-size:10px; }
.workspace { overflow:auto; height:100%; min-height:0; }
body[data-view=projects] .knowledge-sidebar,body[data-view=agents] .knowledge-sidebar,body[data-view=profile] .knowledge-sidebar { display:none; }
body[data-view=projects] main,body[data-view=agents] main,body[data-view=profile] main { grid-template-columns:minmax(0,1fr); }
.welcome { position:static; max-height:none; min-height:100%; display:block; padding:44px clamp(24px,4vw,58px); text-align:left; }
.welcome-heading { max-width:660px; }
.welcome h2 { font:500 clamp(25px,2.4vw,35px)/1.2 Georgia,serif; letter-spacing:-.7px; margin:12px 0; }
.welcome p { max-width:none; font-size:13px; line-height:1.7; }
.welcome-actions { display:flex; flex-wrap:wrap; gap:10px; margin:23px 0 34px; }
.onboarding { border:1px solid var(--line); border-radius:12px; background:var(--panel); overflow:hidden; max-width:830px; }
.section-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:20px; border-bottom:1px solid var(--line); }
.section-heading h3 { margin:0; font-size:14px; }
.section-heading p { margin:6px 0 0; color:var(--muted); font-size:12px; }
.section-heading button { flex-shrink:0; font-size:11px; }
.onboarding-steps { list-style:none; padding:0 20px; margin:0; }
.onboarding-steps li { display:grid; grid-template-columns:28px 1fr auto; gap:12px; align-items:center; padding:19px 0; border-bottom:1px solid var(--line); }
.onboarding-steps li:last-child { border-bottom:0; }
.onboarding-steps strong { font-size:13px; }
.onboarding-steps p { color:var(--muted); font-size:12px; margin:4px 0 0; }
.onboarding-steps button { font-size:11px; }
.step-number { width:26px; height:26px; display:grid; place-items:center; border:1px solid var(--line); border-radius:50%; color:var(--muted); font-size:11px; }
.complete .step-number { color:var(--accent); background:var(--accent-dark); border-color:#526540; }
.onboarding > .hint { margin:0; padding:14px 20px; border-top:1px solid var(--line); font-size:11px; background:#141a14; }
.team-start { max-width:830px; display:flex; align-items:center; justify-content:space-between; gap:20px; padding:24px 0; }
.team-start h3 { font-size:14px; margin:0 0 5px; }
.brief { max-width:830px; width:100%; margin:14px 0 0; }
.brief-row { min-width:0; }
.brief-row strong,.brief-row small { overflow-wrap:anywhere; }
.brief-row .brief-actions { flex-wrap:wrap; }
.destination { padding:32px clamp(22px,4vw,54px) 60px; max-width:1200px; margin:0 auto; }
.destination-content { min-width:0; }
.destination h2,.profile-panel h2,.artifacts-panel h2 { font:500 29px/1.25 Georgia,serif; letter-spacing:-.4px; }
.destination h3 { font-size:15px; margin:16px 0 10px; }
.destination p { color:var(--muted); font-size:13px; line-height:1.65; }
.destination .history-heading { align-items:flex-start; }
.destination .history-heading p { margin:8px 0 0; max-width:620px; }
.destination .agent-list { max-height:none; }
.destination .agent-create { padding:18px; border:1px solid var(--line); border-radius:9px; background:var(--panel); margin:12px 0 24px; }
.destination label { color:var(--muted); font-size:12px; }
.destination .agent-create input,.destination .agent-create select { min-height:40px; }
.destination .agent-row { min-width:0; gap:14px; }
.destination .agent-row strong,.destination .agent-row small { overflow-wrap:anywhere; }
.destination .agent-row button { font-size:12px; }
.dialog-tabs { display:flex; flex-wrap:wrap; gap:6px; margin:25px 0; border-bottom:1px solid var(--line); padding-bottom:15px; }
.dialog-tabs button { font-size:12px; }
.journey-strip { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin:26px 0; }
.journey-strip span { color:var(--muted); font-size:12px; display:flex; gap:8px; align-items:center; }
.journey-strip b { color:var(--accent); border:1px solid var(--line); border-radius:50%; padding:5px 8px; font-size:10px; }
.audience-notice { padding:13px 16px; border-left:2px solid #7a9562; background:#1b231b; border-radius:0 7px 7px 0; }
.create-project-card,.project-step { margin-top:24px; }
details > summary { cursor:pointer; color:var(--text); font-size:13px; padding:12px 0; }
.create-project-card > summary { font-size:16px; font-weight:600; }
.project-step h3 { margin-bottom:5px; }
/* Slice 1d: the invite and link buttons name the project they act on, and a status line says what happened. */
.project-step .agent-create button { max-width:min(280px,100%); white-space:normal; overflow-wrap:anywhere; }
.project-step > .hint { margin:8px 0 0; color:var(--muted); font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
.project-step > .hint:empty { display:none; }
.text-button { border:0; padding:0; min-height:0; color:var(--accent); background:transparent; font-size:inherit; text-decoration:underline; text-underline-offset:3px; }
.project-details { padding:22px; border:1px solid #536545; border-radius:10px; background:var(--panel); margin:24px 0; }
.project-details h3 { margin-top:16px; scroll-margin-top:100px; }
.project-details .agent-row { grid-template-columns:minmax(0,1fr) auto; }
.project-details .resource-actions { display:flex; flex-wrap:wrap; gap:6px; }
.project-details { min-width:0; overflow-wrap:anywhere; }
.destination .project-row { display:flex; flex-wrap:wrap; }
.project-row > div { flex:1 1 240px; min-width:0; }
.project-row .project-name { display:block; min-height:0; max-width:100%; padding:0; border:0; background:transparent; color:var(--accent); font-weight:600; text-align:left; white-space:normal; overflow-wrap:anywhere; text-decoration:underline; text-underline-offset:3px; }
.project-row .project-key { display:block; margin:5px 0; }
.project-checkpoints { margin:24px 0; min-width:0; }
.checkpoint-list { display:grid; gap:14px; margin:16px 0; }
.checkpoint-card { padding:18px; border:1px solid var(--line); border-radius:9px; min-width:0; }
.checkpoint-card h5 { font-size:14px; line-height:1.65; font-weight:500; margin:8px 0 12px; white-space:pre-wrap; }
.checkpoint-card .checkpoint-byline { margin:0; font-size:12px; }
.checkpoint-badge { display:inline-block; margin:0 6px 6px 0; padding:4px 8px; border-radius:5px; color:var(--accent); background:var(--accent-dark); font-size:11px; }
.checkpoint-card h6 { margin:16px 0 6px; font-size:12px; }
.checkpoint-card ul { padding-left:20px; margin:6px 0; font-size:13px; line-height:1.65; }
.checkpoint-card li { margin-bottom:6px; white-space:pre-wrap; }
.checkpoint-provenance { padding-top:12px; border-top:1px solid var(--line); font-size:11px; line-height:1.6; color:var(--muted); }
.checkpoint-provenance dt { margin-top:8px; font-weight:600; }
.checkpoint-provenance dd { margin:2px 0 0; }
.project-checkpoints > button { max-width:100%; white-space:normal; }
.checkpoint-section + .checkpoint-section { border-top:1px solid var(--line); margin-top:28px; padding-top:24px; }
.checkpoint-actions { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.project-checkpoints button { max-width:100%; white-space:normal; }
@media(max-width:480px) { .project-details { padding:14px; }.checkpoint-card { padding:12px; }.project-details .agent-row { grid-template-columns:minmax(0,1fr); } }
.setup-card { padding:24px; background:linear-gradient(110deg,#263220,#192019); border:1px solid #495c3b; border-radius:12px; margin:28px 0; }
.setup-card h3 { margin:10px 0 8px; font-size:19px; font-weight:500; }
.connect-options { display:flex; flex-wrap:wrap; gap:10px; margin:20px 0 12px; }
.connect-options a { font-size:12px; }
.health-section { margin:20px 0 30px; }
.health-section .section-heading { padding:18px 0; }
#agent-health-status { font-size:12px; }
.health-card { padding:20px; margin:14px 0; border:1px solid var(--line); border-radius:9px; background:var(--panel); }
.skill-installations { margin-top:24px; padding-top:20px; border-top:1px solid var(--line); min-width:0; }
.skill-installations[hidden] { display:none; }
.skill-installation-heading { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.skill-installation-heading h4 { margin:0; font-size:15px; }
.skill-installation-card { margin:16px 0; padding:16px; border:1px solid var(--line); border-radius:9px; min-width:0; }
.skill-installation-card h5 { margin:0 0 10px; font-size:15px; overflow-wrap:anywhere; }
.skill-installation-card p { margin:8px 0; line-height:1.5; overflow-wrap:anywhere; }
.skill-installation-card details { margin-top:14px; }
.skill-installation-card summary { cursor:pointer; }
.skill-installation-card pre { max-width:100%; white-space:pre-wrap; overflow-wrap:anywhere; font-size:11px; }
.skill-installation-pins { display:grid; grid-template-columns:minmax(95px,auto) minmax(0,1fr); gap:10px 16px; margin:16px 0; font-size:12px; }
.skill-installation-pins dt { color:var(--muted); }
.skill-installation-pins dd { margin:0; min-width:0; }
.skill-installation-version { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; line-height:1.5; }
.skill-installation-access { display:block; margin-top:4px; color:var(--muted); overflow-wrap:anywhere; }
.skill-installation-access[data-remote-state=revoked],.skill-installation-access[data-remote-state=denied],.skill-installation-access.previously-revoked { color:#ffaaa0; }
.skill-installation-local[data-local-state=local_changes],.skill-installation-local[data-local-state=incomplete] { color:#ffd89c; }
.skill-installation-verify textarea { width:100%; min-height:120px; margin:12px 0; resize:vertical; background:var(--panel); color:var(--text); border:1px solid var(--line); border-radius:7px; padding:10px; font:inherit; line-height:1.5; }
.skill-installations button { white-space:normal; overflow-wrap:anywhere; max-width:100%; }
.skill-installations :focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.agent-installation-reports { grid-column:1/-1; min-width:0; width:100%; }
@media(max-width:420px) { .skill-installation-pins { grid-template-columns:minmax(0,1fr); gap:5px; } .skill-installation-pins dd { margin-bottom:10px; } .skill-installation-card { padding:12px; } }
.health-card h3 { display:inline-block; margin:0 15px 10px 0; }
.health-badge { display:inline-block; font-size:11px; color:var(--muted); border:1px solid var(--line); border-radius:5px; padding:4px 7px; }
.health-badge[data-state=verified] { color:var(--accent); border-color:#526a40; }
.health-badge[data-state=permission_denied],.health-badge[data-state=revoked] { color:#ffaaa0; }
.health-times { display:grid; grid-template-columns:auto 1fr; gap:8px 20px; margin:15px 0; font-size:12px; }
.health-times dt { color:var(--muted); }.health-times dd { margin:0; }
.health-card details li { overflow-wrap:anywhere; font-size:12px; color:var(--muted); padding:4px 0; }
.verification-guide { padding:5px 18px 18px; border:1px solid var(--line); border-radius:9px; }
.verification-guide label { display:grid; gap:8px; margin:15px 0; }
.verification-guide select { width:100%; }
.text-link { display:inline-block; margin-top:18px; font-size:12px; }
.access-management,.advanced-create { margin-top:16px; border-top:1px solid var(--line); padding-top:6px; }
.memory-policy { padding:16px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
.memory-policy input { display:inline-block; margin:0; }
.memory-tabs { display:flex; gap:8px; margin:24px 0 15px; }
.editor-panel { height:100%; min-height:0; grid-template-rows:auto auto minmax(250px,1fr) auto; }
.document { overflow:hidden; min-height:0; }
.document textarea { height:100%; min-height:0; overflow:auto; }
.document-bar { gap:12px; padding:17px 20px; }
.document-actions { flex-wrap:wrap; justify-content:flex-end; gap:6px; }
.document-actions button { padding:6px 9px; font-size:11px; }
.path { overflow-wrap:anywhere; }
.audience-label { color:var(--muted); font-size:11px; margin:7px 0 0; max-width:600px; line-height:1.5; }
.backlinks { margin:0; padding:12px 20px; }
.profile-panel,.artifacts-panel { position:static; max-height:none; min-height:100%; padding:32px clamp(22px,4vw,54px) 60px; max-width:1200px; margin:0 auto; }
.profile-section,.artifact-section { max-width:900px; background:var(--panel); }
.profile-panel .profile-section h3 { font-size:13px; color:var(--text); text-transform:none; letter-spacing:0; }
.profile-panel .profile-section button { margin-top:12px; }
.skip-link { position:fixed; top:-100px; left:12px; z-index:100; padding:12px; background:var(--accent); color:#11200b; }
.skip-link:focus { top:12px; }
#toast { z-index:100; max-width:min(440px,calc(100vw - 32px)); }
dialog { max-height:85dvh; overflow:auto; }
#new-note-error { color:var(--danger); }
#new-note-dialog input { width:100%; margin-top:8px; }
#new-note-dialog p { color:var(--muted); font-size:13px; line-height:1.6; }
@media(max-width:1100px) { .shell { grid-template-columns:164px minmax(0,1fr); }.primary-nav { padding-left:10px;padding-right:10px; }.wordmark { font-size:21px;gap:6px; }.shell > main { grid-template-columns:215px minmax(0,1fr); }.onboarding-steps li { grid-template-columns:25px 1fr; }.onboarding-steps li > button { grid-column:2;justify-self:start; }.document-bar { align-items:flex-start;flex-direction:column; }.document-actions { justify-content:flex-start; } }
@media(max-width:760px) {
 body { overflow:auto; height:auto; }
 .shell { min-height:100dvh;height:auto;grid-template-columns:1fr;grid-template-rows:auto auto 1fr; }
 .primary-nav { grid-column:1;grid-row:1;position:sticky;top:0;z-index:15;flex-direction:row;align-items:center;padding:10px 12px;border-right:0;border-bottom:1px solid var(--line);gap:4px;overflow-x:auto; }
 .wordmark { margin:0 12px 0 0;font-size:0;flex-shrink:0; }.brand-mark { font-size:24px; }.beta-label,.nav-label,.nav-caption,.nav-help,.nav-item span { display:none; }
 .nav-item { width:auto;min-height:38px;padding:8px;font-size:12px;white-space:nowrap; }.nav-bottom { padding:0;margin:0 0 0 auto; }
 .workspace-header { grid-row:2;grid-column:1;padding:18px 20px; }.workspace-header h1 { font-size:21px; }.workspace-header .status { display:none; }
 .shell > main { grid-row:3;grid-column:1;display:flex;flex-direction:column;min-height:calc(100dvh - 144px); }
 .knowledge-sidebar { padding:10px 16px;height:230px;flex-shrink:0;border-right:0; }.knowledge-tabs { padding-bottom:8px;margin-bottom:8px; }.aside-heading { padding-bottom:6px; }.file-list { padding-top:6px; }.view-toggle { display:none; }.trash-toggle { padding-top:6px; }
 body[data-view=artifacts] .knowledge-sidebar,body[data-view=memory] .knowledge-sidebar { height:58px; }
 body[data-view=artifacts] .knowledge-sidebar > :not(.knowledge-tabs),body[data-view=memory] .knowledge-sidebar > :not(.knowledge-tabs) { display:none; }
 .workspace { height:auto;overflow:visible; }.welcome { padding:28px 20px; }.welcome h2 { font-size:27px; }.team-start { align-items:flex-start;flex-direction:column;gap:12px; }
 .onboarding-steps { padding:0 15px; }.section-heading { padding:16px; }.section-heading h3 { font-size:13px; }.onboarding-steps li { padding:16px 0; }
 .destination { padding:24px 20px 45px; }.destination h2 { font-size:26px; }.journey-strip { grid-template-columns:1fr 1fr; }.destination .agent-create { grid-template-columns:1fr; }.destination .agent-create .full { grid-column:auto; }
 .agent-row { grid-template-columns:minmax(0,1fr) auto; }.agent-row > :first-child { min-width:0; }.agent-row > button { justify-self:start; }.agent-row .role-badge { max-width:100%;white-space:normal; }
 .brief-row { grid-template-columns:1fr; }.brief-row .brief-actions { justify-content:flex-start; }.document textarea { height:450px; }.editor-panel { min-height:550px; }.document-bar { padding:16px; }
 .setup-card { padding:18px; }.health-times { grid-template-columns:1fr;gap:5px; }.health-times dd { margin-bottom:7px; }.health-card { padding:16px; }.profile-panel,.artifacts-panel { padding:24px 20px 40px; }
 .history-layout { min-height:0; }.artifact-upload { grid-template-columns:1fr; }.artifact-upload-actions,.artifact-row-actions { flex-wrap:wrap; }.artifact-replace { max-width:100%; }.profile-user-md { flex-wrap:wrap; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none!important;scroll-behavior:auto!important; } }

.preview { overflow-wrap:anywhere; }

/* Skills are a contextual Knowledge library, sharing the existing shell. */
.knowledge-tabs { flex-wrap: wrap; }
body[data-view=library] .knowledge-sidebar > :not(.knowledge-tabs) { display:none; }
/* Views without a note tree share a compact horizontal Knowledge navigation.
   Keep the resizable note sidebar only where it is useful. */
body:is([data-view=library],[data-view=artifacts],[data-view=memory]) .shell > main {
  display:flex; flex-direction:column;
}
body:is([data-view=library],[data-view=artifacts],[data-view=memory]) .knowledge-sidebar {
  height:auto; flex-shrink:0; padding:10px 24px; border-right:0; border-bottom:1px solid var(--line);
}
body:is([data-view=library],[data-view=artifacts],[data-view=memory]) .knowledge-sidebar > :not(.knowledge-tabs) { display:none; }
body:is([data-view=library],[data-view=artifacts],[data-view=memory]) .knowledge-tabs { margin:0; padding:0; border:0; }
body:is([data-view=library],[data-view=artifacts],[data-view=memory]) .workspace { flex:1; height:auto; }
.skill-library-panel { padding: 30px 36px 60px; max-width: 1080px; width: 100%; margin: 0 auto; min-width: 0; }
.skill-library-panel h2 { font-size: 24px; margin-top: 8px; }
.skill-library-panel h3 { font-size: 18px; margin: 0 0 8px; overflow-wrap: anywhere; }
.skill-library-panel h4 { margin: 24px 0 12px; }
.skill-list-tools,.skill-detail-actions { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 24px 0 16px; }
.skill-list-tools label { display: flex; align-items: center; gap: 8px; }
.skill-list { display: grid; gap: 12px; }
.skill-card { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:20px; border:1px solid var(--line); border-radius:10px; background:var(--panel); }
.skill-card > div { min-width:0; }.skill-card p { overflow-wrap:anywhere; }.skill-card button { flex-shrink:0; }
.skill-library-panel details { margin-top:18px; border:1px solid var(--line); border-radius:10px; padding:12px 16px; }
.skill-library-panel summary { cursor:pointer; padding:6px 0; font-weight:650; }
.skill-detail { margin-top:24px; }.skill-detail #skill-title { margin-top:24px; font-size:24px; }
.skill-detail-actions { justify-content:flex-start; }.skill-detail-actions > .danger { margin-left:auto; }
.skill-library-panel code { overflow-wrap:anywhere; }.skill-library-panel pre { overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; }
.skill-findings { padding-left:22px; line-height:1.6; }.skill-findings li { margin:8px 0; overflow-wrap:anywhere; }
.skill-revision-files,.skill-history-list,.skill-file-review { list-style:none; padding:0; }
.skill-revision-files li,.skill-history-row,.skill-file-review li { display:flex; justify-content:space-between; align-items:center; gap:14px; padding:10px 0; border-bottom:1px solid var(--line); }
.skill-revision-files li span,.skill-history-row span { overflow-wrap:anywhere; min-width:0; }.skill-revision-files small { flex-shrink:0; color:var(--muted); }
.skill-history-row button { flex-shrink:0; }
.skill-import-dialog { width:min(760px,calc(100vw - 32px)); max-height:90dvh; overflow:auto; }
.skill-directory-picker { display:grid; gap:8px; padding:16px; border:1px dashed var(--line); border-radius:10px; }
.skill-directory-picker input { max-width:100%; }
.skill-import-confirm { display:flex; align-items:flex-start; gap:10px; margin:20px 0; line-height:1.5; }.skill-import-confirm input { margin-top:5px; flex-shrink:0; }
.skill-file-review { max-height:300px; overflow:auto; border:1px solid var(--line); padding:0 12px; border-radius:8px; }
.skill-file-review label { display:flex; gap:10px; align-items:center; min-width:0; }.skill-file-review span { overflow-wrap:anywhere; }.skill-file-review input { flex-shrink:0; }.skill-file-review small { white-space:nowrap; color:var(--muted); }
#skill-import-review code { display:block; overflow-wrap:anywhere; }#skill-import-review pre { white-space:pre-wrap; overflow-wrap:anywhere; }
.error-text { color:var(--danger)!important; }
@media(max-width:760px){
  .skill-library-panel { padding:20px 16px 40px; }
  body[data-view=library] .knowledge-sidebar { height:auto; }
  .skill-card { padding:16px; }.skill-history-row { flex-wrap:wrap; }
  .skill-detail-actions > .danger { margin-left:0; }
  .skill-import-dialog .dialog-actions { flex-wrap:wrap; }
  .skill-revision-files li { flex-wrap:wrap; }
}

/* Publication remains inside the existing Knowledge Library detail. */
.skill-releases-section { border-top:1px solid var(--line); margin-top:32px; padding-top:8px; }
.skill-releases-section h4 { margin:0; }
.skill-release-item { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 0; border-bottom:1px solid var(--line); }
.skill-release-item > div { min-width:0; overflow-wrap:anywhere; }
.skill-release-item p { margin:6px 0 0; }.skill-release-item button { flex-shrink:0; }
.skill-publication-dialog { width:min(720px,calc(100vw - 32px)); max-height:90dvh; overflow:auto; }
.skill-publication-dialog h2 { font-family:inherit; overflow-wrap:anywhere; }
.skill-publication-dialog label { display:grid; gap:8px; margin:18px 0 8px; }
.skill-publication-dialog input,.skill-publication-dialog textarea { width:100%; min-width:0; }
.skill-publication-dialog details { padding:12px 0; }.skill-publication-dialog summary { cursor:pointer; }
.skill-publication-dialog pre { white-space:pre-wrap; overflow-wrap:anywhere; }.skill-publication-dialog code { overflow-wrap:anywhere; }
.skill-publication-dialog .dialog-actions { flex-wrap:wrap; }.skill-publication-dialog .skill-findings { max-height:280px; overflow:auto; }
.skill-use-dialog h2:focus { outline:2px solid var(--accent); outline-offset:4px; }
.skill-use-dialog p,.skill-use-dialog li { overflow-wrap:anywhere; }
#skill-use-version { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; line-clamp:2; overflow:hidden; font-size:13px; line-height:1.5; }
#skill-release-title { overflow-wrap:anywhere; }
#skill-release-view .skill-detail-actions button,.skill-release-item button { max-width:100%; white-space:normal; overflow-wrap:anywhere; }
.skill-use-dialog ol { padding-left:22px; line-height:1.6; }.skill-use-dialog li { margin:10px 0; }
.skill-use-dialog textarea { padding:12px; border:1px solid var(--line); border-radius:8px; background:var(--panel-inset); color:var(--text); font:12px/1.5 monospace; resize:vertical; }
.skill-use-dialog summary { padding:8px 0; }.skill-use-dialog .dialog-actions button { white-space:normal; }
/* The actions stay in view however the text above wraps (fonts differ by platform). */
.skill-use-dialog .dialog-actions { position:sticky; bottom:0; z-index:1; margin-top:12px; padding:12px 0 2px; background:var(--panel); box-shadow:0 -10px 12px var(--panel); }
.skill-use-app { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; margin:10px 0 0; padding:0; border:0; font-size:14px; }
.skill-use-app legend { float:left; margin:0; padding:0; color:#cbd0d5; font-size:13px; line-height:20px; }
.skill-use-app label { display:inline-flex; align-items:center; gap:5px; color:var(--text); font-size:14px; line-height:20px; white-space:nowrap; }
.skill-use-app input { width:auto; margin:0; padding:0; accent-color:var(--accent); }
.skill-use-app label:has(input:disabled) { color:var(--muted); }
@media(max-width:760px){.skill-release-item { flex-wrap:wrap; }.skill-publication-dialog { padding:20px 16px; }}

/* Searchable notes stay beside their original file in Knowledge. */
.artifact-row { grid-template-columns:minmax(0,1fr) auto; }
.artifact-copy > div { min-width:0; }
.artifact-note-state { color:var(--accent); }
.artifact-note-details { grid-column:1 / -1; min-width:0; border-top:1px solid var(--line); padding-top:10px; font-size:13px; }
.artifact-note-details summary { cursor:pointer; font-weight:600; }
.artifact-note-details p,.artifact-copy strong,.artifact-copy small { overflow-wrap:anywhere; }
.artifact-note-details p { color:var(--muted); line-height:1.5; }
.artifact-note-form { display:grid; gap:12px; margin-top:16px; }
.artifact-note-form label { display:grid; gap:6px; }
.artifact-note-form input,.artifact-note-form textarea { width:100%; min-width:0; padding:10px; border:1px solid var(--line); border-radius:7px; background:var(--panel-inset); color:var(--text); }
.artifact-note-form :focus-visible,.artifact-note-details summary:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.artifact-note-actions { display:flex; flex-wrap:wrap; gap:8px; }
.artifact-link-review pre { white-space:pre-wrap; overflow-wrap:anywhere; max-height:200px; overflow:auto; }
@media(max-width:600px) { .artifact-row { grid-template-columns:minmax(0,1fr); }.artifact-row > .artifact-copy,.artifact-row > .artifact-row-actions { width:100%; }.artifact-row-actions { justify-content:flex-start; }.artifact-file-drop input { max-width:100%; }.artifact-note-actions button { width:100%; } }

/* Platform registration review */
body[data-view=admin] .knowledge-sidebar { display:none; }
body[data-view=admin] main { grid-template-columns:minmax(0,1fr); }
.registration-admin-panel { width:100%; max-width:1100px; margin:0 auto; padding:32px clamp(20px,4vw,54px) 60px; }
.registration-admin-panel h2 { font:500 29px/1.25 Georgia,serif; margin:10px 0; }
.registration-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:28px 0; }
.registration-stat { border:1px solid var(--line); border-radius:10px; padding:18px; display:flex; flex-direction:column; gap:8px; }
.registration-stat strong { font-size:28px; font-weight:500; }
.registration-stat span { color:var(--muted); font-size:12px; }
.registration-filters { display:flex; align-items:end; gap:12px; margin:24px 0 12px; flex-wrap:wrap; }
.registration-filters label { display:flex; flex-direction:column; gap:8px; font-size:12px; min-width:0; }
.registration-filters select,.registration-filters input { width:100%; min-height:40px; }
.registration-search-label { flex:1; }
.registration-list { display:grid; gap:12px; margin:18px 0; }
.registration-card { border:1px solid var(--line); border-radius:10px; padding:20px; overflow-wrap:anywhere; }
.registration-card-heading { display:flex; align-items:start; justify-content:space-between; gap:16px; }
.registration-card h3 { font-size:15px; margin:0; }
.registration-card .hint { margin:6px 0 0; }
.registration-badge { border:1px solid var(--line); border-radius:20px; padding:5px 10px; font-size:11px; white-space:nowrap; }
.registration-badge.pending { color:var(--accent); }
.registration-badge.approved { color:#8cd5b4; }
.registration-badge.denied { color:#e0a9a9; }
.registration-details { display:grid; grid-template-columns:100px minmax(0,1fr); gap:8px 14px; margin:18px 0 0; font-size:12px; }
.registration-details dt { color:var(--muted); }
.registration-details dd { margin:0; }
.registration-actions { display:flex; gap:10px; margin-top:18px; }
.billing-admin { border-top:1px solid var(--line); margin-top:18px; padding-top:4px; }
.billing-admin h4 { font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin:18px 0 8px; }
.billing-admin-warning { color:var(--danger); font-size:12px; margin:12px 0 0; }
.billing-admin-list { list-style:none; margin:0; padding:0; display:grid; gap:8px; font-size:12px; }
.billing-admin-override { display:grid; gap:6px; justify-items:start; border:1px solid var(--line); border-radius:8px; padding:10px 12px; }
.billing-admin-override .hint { margin:0; }
.billing-admin-override-heading { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; }
.registration-badge.billing-active { color:#8cd5b4; }
.registration-badge.billing-revoked,.registration-badge.billing-expired { color:var(--muted); }
.billing-admin-form { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; align-items:end; font-size:12px; }
.billing-admin-form label { display:grid; gap:6px; }
.billing-admin-form select,.billing-admin-form input,.billing-admin-form textarea { width:100%; min-height:40px; }
.billing-admin-form textarea { padding:10px 12px; border:1px solid var(--line); border-radius:7px; background:var(--panel-inset); color:var(--text); resize:vertical; }
.billing-admin-form .billing-admin-note { grid-column:1/-1; }
.billing-admin-form button { justify-self:start; }
.billing-admin-status { font-size:12px; margin:12px 0 0; }
.billing-admin .hint { font-size:12px; }
.billing-admin .inline-confirm { font-size:12px; }
@media(max-width:600px) {
  .registration-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .registration-card-heading { flex-direction:column; gap:10px; }
  .registration-search-label { flex-basis:100%; }
  .registration-details { grid-template-columns:80px minmax(0,1fr); }
}

/* Wave 0 home: inbox first, a Needs you count on the home nav item, a
   collapsible setup checklist, a welcoming empty workspace, a sign-in prompt
   for signed-out visitors on protected pages, and error toasts that stay
   until dismissed. */
.nav-item span.nav-badge { display:inline-block; width:auto; min-width:20px; height:20px; margin-left:auto; padding:0 6px; border-radius:10px; background:var(--accent); color:#152310; font-size:11px; font-weight:800; line-height:20px; text-align:center; }
.welcome > .brief { margin:0 0 28px; }
.section-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.onboarding.collapsed .section-heading { padding:12px 20px; border-bottom:0; }
.onboarding.collapsed #onboarding-title { display:none; }
.onboarding.collapsed .onboarding-progress { margin:0; color:var(--text); font-size:13px; }
.signed-out-panel { max-width:660px; padding:44px clamp(24px,4vw,58px); }
.signed-out-panel h2 { font:500 clamp(25px,2.4vw,35px)/1.2 Georgia,serif; letter-spacing:-.7px; margin:12px 0; }
.signed-out-panel p { margin:0; color:var(--muted); font-size:13px; line-height:1.7; }
.auth-context { margin:0 0 12px; padding:10px 12px; border-left:2px solid var(--accent); border-radius:0 7px 7px 0; background:var(--accent-dark); }
.auth-card p.auth-context { color:var(--text); }
.visually-hidden { position:absolute!important; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; border:0; }
.files-empty { display:grid; gap:8px; margin:12px 8px; }
.files-empty strong { font-size:14px; }
.files-empty p { margin:0; color:var(--muted); font-size:13px; line-height:1.5; }
.files-empty-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:4px; }
.files-empty-actions button { min-height:32px; padding:6px 10px; font-size:12px; }
#toast { display:flex; align-items:flex-start; gap:12px; }
#toast-message { min-width:0; margin:0; line-height:1.45; overflow-wrap:anywhere; }
#toast.error { border-color:#6e3632; border-left:3px solid var(--danger); pointer-events:auto; }
.toast-close { flex:none; width:32px; height:32px; min-height:32px; margin:-6px -8px -6px 0; padding:0; border-color:transparent; color:var(--text); background:transparent; font-size:20px; font-weight:400; line-height:1; }
.toast-close:hover { border-color:var(--line); }
@media(max-width:760px) {
  .nav-item span.nav-badge { margin-left:-6px; }
  .onboarding .section-heading { flex-direction:column; align-items:flex-start; gap:10px; }
  .section-actions { justify-content:flex-start; }
  .onboarding.collapsed .section-heading { flex-direction:row; flex-wrap:wrap; align-items:center; padding:12px 16px; }
  .signed-out-panel { padding:28px 20px; }
  body[data-view=workspace] .knowledge-sidebar.workspace-empty { height:auto; }
  #toast { right:16px; bottom:16px; }
}
/* Project knowledge (slice 1b): home folder, project paths, review dialog */
.project-tabs { margin:18px 0 6px; }
.project-knowledge { min-width:0; margin:12px 0 0; }
.project-knowledge h4 { margin:6px 0 8px; }
.project-knowledge h4:focus,.project-knowledge h5:focus,.project-file-viewer h5:focus,#project-preview-title:focus { outline:2px solid var(--accent); outline-offset:3px; }
.knowledge-storage { color:var(--text)!important; font-weight:600; }
.knowledge-block { min-width:0; margin:22px 0 0; padding-top:16px; border-top:1px solid var(--line); }
.knowledge-block h5 { margin:0 0 8px; font-size:14px; }
.knowledge-current { color:var(--text)!important; }
.knowledge-row > div:first-child small { display:block; margin-top:3px; }
.knowledge-badge { display:inline-block; margin:6px 0 2px; padding:3px 8px; border-radius:5px; color:var(--accent); background:var(--accent-dark); font-size:11px; font-weight:600; }
.knowledge-form { display:grid; gap:8px; max-width:560px; margin:14px 0 4px; min-width:0; }
.knowledge-form label { display:grid; gap:6px; }
.knowledge-form input { width:100%; min-width:0; min-height:40px; padding:9px 11px; border:1px solid var(--line); border-radius:7px; color:var(--text); background:var(--panel-inset); }
.knowledge-form small { color:var(--muted); line-height:1.5; }
.knowledge-form button { justify-self:start; max-width:100%; white-space:normal; }
.knowledge-form select,.knowledge-form textarea { width:100%; min-width:0; padding:9px 11px; border:1px solid var(--line); border-radius:7px; color:var(--text); background:var(--panel-inset); font:inherit; }
.project-tasks { margin-top:18px; }
.project-task-answer { display:flex; flex-wrap:wrap; gap:6px; min-width:0; }
.project-task-answer input { flex:1 1 180px; min-width:0; min-height:36px; padding:7px 10px; border:1px solid var(--line); border-radius:7px; color:var(--text); background:var(--panel-inset); }
.inline-check { display:inline-flex; align-items:center; gap:6px; margin:4px 0 8px; color:var(--muted); font-size:13px; }
.knowledge-error { margin:4px 0; color:var(--danger)!important; }
.knowledge-error:empty { display:none; }
.knowledge-block .resource-actions button,.knowledge-block > button { max-width:100%; white-space:normal; }
.project-file-list { display:grid; gap:6px; margin:10px 0; min-width:0; }
.project-file { display:grid; gap:3px; width:100%; min-width:0; text-align:left; font-weight:600; white-space:normal; overflow-wrap:anywhere; }
.project-file small { color:var(--muted); font-weight:400; }
.project-file-viewer { min-width:0; margin:16px 0 0; padding:16px; border:1px solid var(--line); border-radius:9px; background:var(--panel-inset); }
.project-file-viewer h5 { margin:0 0 6px; font-size:14px; overflow-wrap:anywhere; }
.project-file-viewer label { display:grid; gap:6px; }
.project-file-viewer textarea { min-height:240px; padding:14px; border:1px solid var(--line); border-radius:7px; resize:vertical; }
.project-file-preview { max-height:480px; padding:6px 2px 12px; }
.project-preview-dialog { width:min(560px,calc(100vw - 30px)); }
.project-preview-dialog h2 { overflow-wrap:anywhere; }
.project-preview-dialog h3 { margin:18px 0 8px; font-size:13px; }
.project-preview-dialog p { overflow-wrap:anywhere; }
#project-preview-summary { color:var(--text); }
.preview-stale { margin:10px 0; padding:9px 12px; border-left:3px solid var(--accent); border-radius:0 7px 7px 0; color:var(--text)!important; background:var(--accent-dark); }
.preview-members { display:grid; gap:6px; margin:0; padding:0; list-style:none; }
.preview-members li { min-width:0; padding:8px 10px; border:1px solid var(--line); border-radius:7px; overflow-wrap:anywhere; font-size:13px; }
.preview-members li span { color:var(--muted); }
.preview-members li.new-member { border-color:var(--accent); }
.project-preview-dialog .dialog-actions { flex-wrap:wrap; }
/* Slice 4c: the Share sheet */
.share-sheet > label, .share-audience-fields { margin-top:12px; }
.share-audience-fields { display:grid; gap:12px; }
.share-audience { display:flex; flex-wrap:wrap; gap:6px 16px; margin:14px 0 0; padding:0; border:0; }
.share-audience legend { margin-bottom:8px; padding:0; color:#cbd0d5; font-size:13px; }
.share-audience label { display:inline-flex; align-items:center; gap:6px; color:var(--text); font-size:14px; }
.share-audience input { width:auto; margin:0; }
#share-sheet-mode-label { margin-top:12px; }
.share-access li { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; }
.share-access li > div { min-width:0; flex:1 1 220px; }
.share-access li button { flex:0 0 auto; }
.folder-share { flex:0 0 auto; margin-left:auto; padding:0 7px; min-height:20px; border-radius:5px; font-size:11px; opacity:0; }
.folder summary:hover .folder-share, .folder summary:focus-within .folder-share, .folder-share:focus-visible { opacity:1; }
@media (hover:none) { .folder-share { opacity:1; } }
@media(max-width:480px) { .project-file-viewer { padding:12px; }.knowledge-form button { width:100%; } }

/* In-page confirmation (public/inline-confirm.js). The question takes a full
   row in a grid or wrapping flex layout; the rows that do not wrap on their
   own wrap while one is open. In the fixed-height header it opens below the
   button instead. */
.inline-confirm { display:grid; gap:10px; justify-items:start; grid-column:1/-1; flex:1 1 100%; min-width:0; border:1px solid var(--line); border-radius:8px; padding:12px; background:var(--panel-inset); color:var(--text); font-size:13px; text-align:left; }
.inline-confirm p { margin:0; overflow-wrap:anywhere; }
.inline-confirm-actions { display:flex; flex-wrap:wrap; gap:10px; }
.document-bar:has(> .inline-confirm),.history-detail-bar:has(> .inline-confirm),.memory-actions:has(> .inline-confirm) { flex-wrap:wrap; }
.document-bar > .inline-confirm { align-self:stretch; }
.header-actions:has(> .inline-confirm) { position:relative; }
.header-actions > .inline-confirm { position:absolute; top:calc(100% + 8px); right:0; z-index:30; width:max-content; max-width:min(360px,calc(100vw - 32px)); box-shadow:0 12px 32px rgba(0,0,0,.45); }
