:root {
  color-scheme:dark;
  --bg:#101010;
  --surface:#171717;
  --raised:#202020;
  --hover:#262626;
  --line:#2a2a2a;
  --text:#eaeaea;
  --muted:#8c8c8c;
  --faint:#656565;
  --accent:#f2f2f2;
  --accent-text:#171717;
  --success:#87b7a1;
  --attention:#d9b87a;
  --error:#dc9992;
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-synthesis:none;
}

:root[data-theme=light] {
  color-scheme:light;
  --bg:#fff;
  --surface:#f7f7f7;
  --raised:#f0f0f0;
  --hover:#e9e9e9;
  --line:#e5e5e5;
  --text:#242424;
  --muted:#777;
  --faint:#999;
  --accent:#222;
  --accent-text:#fff;
  --success:#427b60;
  --attention:#946721;
  --error:#b34a42;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  background:var(--bg);
  color:var(--text);
}

button,input,select,textarea {
  font:inherit;
}

button {
  cursor:pointer;
  color:inherit;
}

button:disabled {
  opacity:.4;
  cursor:default;
}

button,input,select,textarea,a {
  outline-offset:4px;
}

button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible {
  outline:2px solid var(--muted);
}

[hidden] {
  display:none!important;
}

a {
  color:inherit;
  text-underline-offset:3px;
}

.workspace {
  height:100dvh;
  display:grid;
  grid-template-columns:256px minmax(350px,1fr) 296px;
  overflow:hidden;
}

.sidebar {
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:0;
  padding:25px 15px 0;
  background:var(--surface);
  border-right:1px solid var(--line);
}

.brand-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 8px 30px;
}

.brand {
  font-size:28px;
  letter-spacing:-1.3px;
  font-weight:650;
  text-decoration:none;
}

.brand-dot {
  color:var(--muted);
}

.icon-button {
  display:inline-grid;
  place-items:center;
  background:transparent;
  border:0;
  border-radius:8px;
  width:32px;
  height:32px;
  font-size:20px;
  color:var(--muted);
  flex-shrink:0;
}

.icon-button:hover {
  background:var(--hover);
  color:var(--text);
}

.project-row {
  display:flex;
  gap:5px;
  align-items:center;
  margin-bottom:22px;
}

.project-row select {
  min-width:0;
  flex:1;
  padding:10px 9px;
  border:1px solid var(--line);
  background:transparent;
  border-radius:8px;
  color:var(--text);
  font-size:13px;
}

.sidebar-tabs {
  display:flex;
  gap:20px;
  padding:0 8px;
  border-bottom:1px solid var(--line);
  margin-bottom:14px;
}

.sidebar-tabs button {
  border:0;
  border-bottom:2px solid transparent;
  background:none;
  padding:9px 0 12px;
  color:var(--muted);
  font-size:12px;
}

.sidebar-tabs button[aria-selected=true] {
  border-color:var(--text);
  color:var(--text);
}

.sidebar-tabs span {
  font-size:10px;
  color:var(--faint);
  margin-left:4px;
}

.navigation-panel {
  flex:1;
  min-height:0;
  overflow:auto;
  margin:0 -3px;
  padding:0 3px 14px;
}

.panel-empty {
  font-size:12px;
  line-height:1.7;
  color:var(--faint);
  margin:20px 8px;
  max-width:220px;
}

.panel-status {
  font-size:11px;
  line-height:1.5;
  color:var(--muted);
  padding:10px 8px;
}

.tree-group {
  margin:2px 0 10px;
}

.tree-row {
  display:flex;
  align-items:flex-start;
  gap:7px;
  width:100%;
  min-height:36px;
  border-radius:7px;
  padding:8px 7px;
  text-align:left;
  background:none;
  border:0;
  font-size:12px;
  line-height:1.5;
}

.tree-row:hover {
  background:var(--hover);
}

.tree-row .tree-label {
  min-width:0;
  flex:1;
  overflow-wrap:anywhere;
}

.tree-arrow {
  font-size:12px;
  color:var(--faint);
  width:10px;
  flex-shrink:0;
}

.tree-status {
  font-size:12px;
  line-height:18px;
  color:var(--faint);
  width:14px;
  text-align:center;
  flex-shrink:0;
}

.tree-status.active {
  color:var(--text);
}

.tree-status.done {
  color:var(--success);
}

.tree-status.blocked {
  color:var(--attention);
}

.tree-children {
  margin-left:15px;
  padding-left:6px;
  border-left:1px solid var(--line);
}

.tree-count {
  font-size:10px;
  color:var(--faint);
  line-height:18px;
  flex-shrink:0;
}

.tree-task-title {
  display:block;
}

.tree-task-state {
  display:block;
  font-size:10px;
  color:var(--muted);
  margin-top:2px;
}

.tree-group.active>.tree-row {
  color:var(--text);
}

.tree-group:not(.active)>.tree-row {
  color:var(--muted);
}

.new-conversation {
  width:100%;
  background:none;
  border:1px solid var(--line);
  border-radius:8px;
  padding:10px;
  text-align:left;
  font-size:12px;
  margin:0 0 15px;
}

.new-conversation:hover {
  background:var(--hover);
}

.conversation-item {
  width:100%;
  display:block;
  text-align:left;
  background:none;
  border:0;
  border-radius:8px;
  padding:12px 10px;
  font-size:12px;
  color:var(--muted);
}

.conversation-item:hover,.conversation-item.active {
  background:var(--hover);
  color:var(--text);
}

.conversation-item span {
  display:block;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.conversation-item small {
  font-size:10px;
  color:var(--faint);
  display:block;
  margin-top:5px;
}

.conversation-empty {
  font-size:12px;
  line-height:1.6;
  color:var(--faint);
  padding:10px;
}

.sidebar-bottom {
  display:flex;
  align-items:center;
  gap:9px;
  border-top:1px solid var(--line);
  padding:18px 4px;
  margin-top:auto;
}

.user-avatar {
  width:30px;
  height:30px;
  border:1px solid var(--line);
  background:var(--raised);
  border-radius:50%;
  display:grid;
  place-items:center;
  font-size:11px;
}

.user-details {
  min-width:0;
  flex:1;
}

.user-details strong,.user-details span {
  display:block;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.user-details strong {
  font-size:11px;
  font-weight:500;
}

.user-details span {
  font-size:10px;
  color:var(--faint);
  margin-top:4px;
}

.chat-pane {
  position:relative;
  display:flex;
  flex-direction:column;
  min-height:0;
  min-width:0;
}

.chat-header {
  display:flex;
  align-items:center;
  gap:14px;
  min-height:82px;
  padding:20px 30px;
}

.header-main {
  min-width:0;
  flex:1;
}

.project-caption {
  color:var(--faint);
  font-size:10px;
  margin-bottom:6px;
}

.chat-header h1 {
  font-size:14px;
  line-height:1.3;
  font-weight:550;
  margin:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.connection {
  display:flex;
  align-items:center;
  gap:6px;
  font-size:10px;
  color:var(--faint);
  white-space:nowrap;
}

.connection>span:first-child {
  width:5px;
  height:5px;
  border-radius:50%;
  background:var(--faint);
}

.connection.connected>span:first-child {
  background:var(--success);
}

.menu-toggle {
  display:none;
}

.feed {
  flex:1;
  min-height:0;
  overflow:auto;
  overscroll-behavior:contain;
  padding:22px max(30px,calc((100% - 730px)/2));
}

.empty-state {
  text-align:center;
  max-width:400px;
  margin:clamp(35px,12vh,130px) auto 45px;
}

.empty-mark {
  font-size:46px;
  font-weight:600;
  letter-spacing:-4px;
  margin-bottom:25px;
  color:var(--text);
}

.empty-state h2 {
  font-size:30px;
  font-weight:500;
  letter-spacing:-1px;
  margin:0 0 16px;
}

.empty-state p {
  font-size:13px;
  line-height:1.8;
  color:var(--muted);
  max-width:330px;
  margin:auto;
}

.message {
  max-width:720px;
  margin:8px auto 30px;
  display:grid;
  grid-template-columns:25px minmax(0,1fr);
  gap:11px;
}

.message-avatar {
  display:grid;
  place-items:center;
  width:24px;
  height:24px;
  font-size:12px;
  border:1px solid var(--line);
  border-radius:50%;
  color:var(--muted);
}

.message.owner {
  grid-template-columns:minmax(0,1fr);
  padding-left:45px;
}

.message.owner .message-avatar {
  display:none;
}

.message.owner>div:last-child {
  justify-self:end;
  max-width:100%;
}

.message-meta {
  display:flex;
  align-items:center;
  gap:9px;
  min-height:24px;
  margin-bottom:7px;
  font-size:10px;
  color:var(--faint);
}

.message-meta strong {
  font-size:11px;
  font-weight:500;
  color:var(--muted);
}

.message.owner .message-meta {
  justify-content:flex-end;
}

.message-body {
  font-size:14px;
  line-height:1.8;
  overflow-wrap:anywhere;
}

.message.owner .message-body {
  background:var(--raised);
  border-radius:17px;
  padding:12px 18px;
}

.message-body p {
  margin:0 0 12px;
  white-space:pre-wrap;
}

.message-body p:last-child {
  margin-bottom:0;
}

.message-body h2,.message-body h3,.message-body h4 {
  line-height:1.5;
  margin:17px 0 9px;
  font-weight:600;
}

.message-body h2 {
  font-size:19px;
}

.message-body h3 {
  font-size:17px;
}

.message-body h4 {
  font-size:15px;
}

.message-body ul,.message-body ol {
  padding-left:23px;
  margin:8px 0;
}

.message-body blockquote {
  border-left:2px solid var(--muted);
  margin:12px 0;
  padding-left:14px;
  color:var(--muted);
}

.message-body code {
  background:var(--raised);
  padding:2px 5px;
  border-radius:4px;
  font:12px ui-monospace,monospace;
}

.code-block {
  border:1px solid var(--line);
  border-radius:10px;
  overflow:hidden;
  margin:15px 0;
  background:var(--surface);
}

.code-bar {
  display:flex;
  justify-content:space-between;
  font-size:10px;
  color:var(--muted);
  padding:9px 12px;
  border-bottom:1px solid var(--line);
}

.code-bar button {
  font-size:10px;
  background:none;
  border:0;
  color:var(--muted);
}

.code-block pre {
  margin:0;
  padding:14px;
  overflow:auto;
  line-height:1.7;
}

.code-block code {
  padding:0;
  background:none;
  white-space:pre;
}

.message-actions {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:12px;
  margin-top:9px;
  min-height:17px;
}

.message.owner .message-actions {
  justify-content:flex-end;
}

.message-actions button {
  font-size:10px;
  color:var(--faint);
  border:0;
  background:none;
  padding:0;
}

.message-actions button:hover {
  color:var(--text);
}

.message-status {
  font-size:10px;
  color:var(--faint);
}

.message-status.error {
  color:var(--error);
}

.message-status.pending {
  color:var(--muted);
}

.streaming .message-body:after {
  content:"";
  display:inline-block;
  width:5px;
  height:12px;
  background:var(--muted);
  margin-left:4px;
  animation:pulse 1s infinite;
}

@keyframes pulse {
  50% {
    opacity:.25;
  }
}

.composer-area {
  padding:12px max(30px,calc((100% - 730px)/2)) 20px;
}

.composer {
  background:var(--raised);
  border:1px solid var(--line);
  border-radius:22px;
  padding:16px 17px 10px;
}

.composer:focus-within {
  border-color:var(--faint);
}

.composer textarea {
  resize:none;
  display:block;
  width:100%;
  max-height:190px;
  min-height:48px;
  border:0;
  background:none;
  color:var(--text);
  padding:0;
  outline:none;
  font-size:14px;
  line-height:1.6;
}

.composer textarea::placeholder {
  color:var(--muted);
}

.composer-tools {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-top:6px;
}

.composer-tools>div {
  display:flex;
  align-items:center;
  gap:8px;
}

.attach-button {
  background:none;
  border:0;
  font-size:24px;
  padding:2px 5px;
  color:var(--muted);
}

.composer-hint {
  font-size:10px;
  color:var(--faint);
}

.send-button {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-width:34px;
  height:34px;
  padding:0 12px;
  border:0;
  border-radius:20px;
  background:var(--accent);
  color:var(--accent-text);
  font-size:10px;
  font-weight:500;
}

.send-button>span {
  font-size:19px;
  line-height:1;
}

.storage-note {
  text-align:center;
  font-size:9px;
  color:var(--faint);
  margin-top:11px;
}

.notice,.form-error {
  font-size:12px;
  line-height:1.6;
  color:var(--error);
}

.notice {
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px 14px;
  margin-bottom:10px;
  background:var(--surface);
}

.draft-attachments,.attachments {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:10px 0;
}

.draft-file {
  background:var(--raised);
  border:1px solid var(--line);
  border-radius:8px;
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px;
  font-size:10px;
  max-width:260px;
}

.draft-file span {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.draft-file button {
  background:none;
  border:0;
  font-size:16px;
  color:var(--muted);
}

.attachment-card {
  display:flex;
  align-items:center;
  gap:10px;
  max-width:260px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  text-align:left;
}

.attachment-card>span {
  font-size:23px;
  color:var(--muted);
}

.attachment-card strong {
  display:block;
  max-width:185px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:11px;
  font-weight:500;
}

.attachment-card small {
  font-size:10px;
  display:block;
  color:var(--muted);
  margin-top:4px;
}

.load-older {
  display:block;
  margin:0 auto 25px;
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:20px;
  padding:8px 13px;
  font-size:11px;
  color:var(--muted);
}

.jump-bottom {
  position:absolute;
  bottom:183px;
  left:50%;
  transform:translateX(-50%);
  width:33px;
  height:33px;
  border:1px solid var(--line);
  background:var(--raised);
  border-radius:50%;
  font-size:17px;
}

.activity-pane {
  border-left:1px solid var(--line);
  display:flex;
  flex-direction:column;
  min-height:0;
  padding:25px 22px 12px;
  background:var(--bg);
}

.activity-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:27px;
}

.activity-header h2 {
  font-size:13px;
  font-weight:550;
  margin:0;
}

.activity-header button {
  display:none;
}

.activity-toggle {
  display:none;
}

.current-work {
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin-bottom:30px;
  min-height:55px;
}

.live-dot {
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--faint);
  margin-top:6px;
  flex-shrink:0;
}

.current-work.busy .live-dot {
  background:var(--success);
  box-shadow:0 0 0 4px color-mix(in srgb,var(--success) 9%,transparent);
  animation:pulse 2s infinite;
}

.current-work.attention .live-dot {
  background:var(--attention);
}

.current-work strong {
  display:block;
  font-size:12px;
  font-weight:500;
}

.current-work p {
  font-size:11px;
  color:var(--muted);
  line-height:1.7;
  margin:6px 0 0;
}

.activity-label {
  font-size:9px;
  letter-spacing:1.5px;
  color:var(--faint);
  margin-bottom:23px;
}

.activity-feed {
  overflow:auto;
  min-height:0;
  flex:1;
}

.activity-item {
  position:relative;
  border-left:1px solid var(--line);
  padding:0 0 24px 18px;
  margin-left:3px;
}

.activity-item:before {
  content:"";
  position:absolute;
  left:-3px;
  top:5px;
  width:5px;
  height:5px;
  border-radius:50%;
  background:var(--faint);
}

.activity-item.complete:before {
  background:var(--success);
}

.activity-item.attention:before {
  background:var(--attention);
}

.activity-item time {
  display:block;
  font-size:9px;
  color:var(--faint);
  margin:7px 0 0;
}

.activity-item p {
  font-size:12px;
  line-height:1.7;
  margin:0;
  color:var(--muted);
  overflow-wrap:anywhere;
}

.activity-item:first-child p {
  color:var(--text);
}

.activity-item button {
  display:block;
  background:none;
  border:0;
  font-size:10px;
  text-align:left;
  padding:0;
  margin-top:7px;
  color:var(--faint);
}

.activity-item button:hover {
  color:var(--text);
}

.review-strip {
  display:flex;
  gap:8px;
  overflow:auto;
  padding:0 30px 12px;
  flex-shrink:0;
}

.review-card {
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:10px;
  padding:10px 13px;
  text-align:left;
  max-width:320px;
  flex-shrink:0;
}

.review-card span:first-child {
  font-size:15px;
  color:var(--attention);
}

.review-card strong {
  font-size:11px;
  font-weight:500;
  display:block;
  max-width:235px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.review-card small {
  font-size:10px;
  color:var(--muted);
  display:block;
  margin-top:3px;
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

dialog {
  width:min(550px,calc(100vw - 30px));
  border:1px solid var(--line);
  background:var(--surface);
  color:var(--text);
  border-radius:18px;
  padding:28px;
  box-shadow:0 24px 90px #0005;
}

dialog::backdrop {
  background:#0008;
}
.project-access-button { text-align: left; padding: 0 14px 12px; font-size: 12px; }
.project-access-dialog { max-height: calc(100dvh - 48px); overflow: auto; }
.project-access-dialog h3 { font-size: 14px; margin: 24px 0 12px; }
.project-access-dialog form p { font-size: 12px; }
.project-access-dialog form button { margin: 8px 6px 8px 0; }
.access-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 10px 0; font-size: 13px; }
.access-row > span { overflow-wrap: anywhere; min-width: 0; }
.access-row button { flex-shrink: 0; font-size: 12px; padding: 6px 9px; }

dialog h2 {
  font-size:21px;
  font-weight:500;
  letter-spacing:-.4px;
  margin:0 0 14px;
}

dialog p {
  font-size:13px;
  line-height:1.7;
  color:var(--muted);
}

dialog label {
  display:block;
  font-size:12px;
  margin:16px 0;
}

dialog input,dialog textarea {
  display:block;
  width:100%;
  padding:12px;
  border:1px solid var(--line);
  background:var(--bg);
  color:var(--text);
  border-radius:9px;
  margin-top:8px;
  font-size:13px;
}

dialog textarea {
  resize:vertical;
  min-height:115px;
}

.dialog-actions {
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  margin-top:24px;
}

.primary-button,.secondary-button {
  padding:10px 15px;
  border-radius:9px;
  font-size:12px;
}

.primary-button {
  background:var(--accent);
  color:var(--accent-text);
  border:1px solid var(--accent);
}

.secondary-button {
  background:none;
  border:1px solid var(--line);
  color:var(--muted);
}

.primary-button:hover,.secondary-button:hover {
  opacity:.85;
}

.auth-dialog {
  max-width:380px;
  padding:35px;
}

.auth-brand {
  font-size:28px;
  font-weight:600;
  letter-spacing:-1px;
  margin-bottom:35px;
}

.auth-dialog .primary-button {
  width:100%;
  margin-top:18px;
}

.text-button {
  display:block;
  margin:16px auto 0;
  background:none;
  border:0;
  font-size:12px;
  color:var(--muted);
}

.preview-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  padding-bottom:20px;
  font-size:13px;
}

.preview-header strong {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:500;
}

.history-version {
  padding:15px 0;
  border-bottom:1px solid var(--line);
}

.history-version small {
  font-size:10px;
  color:var(--muted);
}

.history-version p {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.detail-dialog {
  width:min(700px,calc(100vw - 30px));
  max-height:88dvh;
  overflow:auto;
}

.detail-label {
  font-size:10px!important;
  letter-spacing:.5px;
  color:var(--faint)!important;
  margin-top:25px!important;
}

.detail-status {
  font-size:11px;
  color:var(--muted);
  display:inline-block;
  border:1px solid var(--line);
  padding:5px 9px;
  border-radius:20px;
  margin-bottom:12px;
}

.detail-fact {
  padding:12px 0;
  border-top:1px solid var(--line);
}

.detail-fact p {
  margin:0;
  white-space:pre-wrap;
}

.detail-fact small {
  display:block;
  color:var(--faint);
  font-size:10px;
  margin-top:7px;
}

.task-reference {
  overflow-wrap:anywhere;
}

.task-reference a {
  color:var(--text);
  text-underline-offset:3px;
}

.task-reference time,
.task-history time {
  display:block;
  color:var(--faint);
  font-size:10px;
  margin-top:7px;
}

.document-text {
  white-space:pre-wrap;
  font-size:13px;
  line-height:1.8;
  overflow-wrap:anywhere;
}

.drop-active .composer {
  outline:2px dashed var(--muted);
}

@media(min-width:1500px) {
  .workspace {
    grid-template-columns:280px minmax(400px,1fr) 320px;
  }
  .chat-header {
    padding:23px 38px;
  }
  .activity-pane {
    padding:28px;
  }
}

@media(max-width:1150px) {
  .workspace {
    grid-template-columns:240px minmax(350px,1fr);
  }
  .activity-pane {
    display:none;
    position:fixed;
    z-index:30;
    right:0;
    top:0;
    bottom:0;
    width:300px;
    box-shadow:-20px 0 60px #0003;
  }
  .activity-open .activity-pane {
    display:flex;
  }
  .activity-toggle,.activity-header button {
    display:inline-grid;
  }
  .composer-hint {
    display:none;
  }
}

@media(max-width:720px) {
  .workspace {
    display:flex;
  }
  .chat-pane {
    flex:1;
  }
  .sidebar {
    display:none;
    position:fixed;
    z-index:40;
    left:0;
    top:0;
    bottom:0;
    width:min(290px,85vw);
    box-shadow:20px 0 80px #0007;
  }
  .menu-open .sidebar {
    display:flex;
  }
  .menu-toggle {
    display:inline-grid;
  }
  .chat-header {
    padding:16px;
    min-height:74px;
    gap:10px;
  }
  .connection {
    font-size:9px;
  }
  .feed {
    padding:14px 18px;
  }
  .composer-area {
    padding:10px 13px max(12px,env(safe-area-inset-bottom));
  }
  .composer {
    padding:14px 15px 10px;
    border-radius:20px;
  }
  .composer textarea {
    font-size:16px;
  }
  .message-body {
    font-size:14px;
  }
  .message {
    grid-template-columns:22px minmax(0,1fr);
    gap:8px;
  }
  .message.owner {
    grid-template-columns:minmax(0,1fr);
    padding-left:24px;
  }
  .empty-state {
    margin:11vh auto 30px;
  }
  .empty-state h2 {
    font-size:28px;
  }
  .empty-state p {
    font-size:12px;
    max-width:270px;
  }
  .review-strip {
    padding:0 17px 8px;
  }
  .activity-pane {
    width:min(320px,92vw);
  }
  .detail-dialog {
    padding:22px;
  }
  .send-button {
    font-size:0;
    width:34px;
    padding:0;
  }
  .send-button span {
    font-size:20px;
  }
  .storage-note {
    font-size:8px;
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    animation:none!important;
    transition:none!important;
  }
}

.tree-arrow {
  padding:0;
  border:0;
  background:none;
  min-width:10px;
  line-height:18px;
}

.tree-task {
  min-width:0;
  display:flex;
  align-items:flex-start;
  gap:8px;
  text-align:left;
  flex:1;
  border:0;
  padding:0;
  background:none;
  font-size:12px;
  line-height:18px;
  color:inherit;
}

.tree-title {
  min-width:0;
  flex:1;
  overflow-wrap:anywhere;
}

.task-status {
  display:inline-block;
  flex-shrink:0;
  width:10px;
  height:10px;
  border:1px solid var(--faint);
  border-radius:50%;
  margin-top:4px;
  font-size:9px;
  line-height:9px;
  text-align:center;
}

.task-status.active {
  background:var(--text);
  border-color:var(--text);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--text) 8%,transparent);
}

.task-status.done {
  border:0;
  color:var(--success);
}

.task-status.blocked {
  border-color:var(--attention);
}

.review-card>div {
  min-width:0;
}

.review-card small {
  max-width:235px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.detail-dialog h3 {
  font-size:14px;
  margin:24px 0 12px;
}

.detail-dialog .attachment-card {
  margin:10px 0;
}

.detail-dialog pre {
  overflow:auto;
  white-space:pre-wrap;
  font-size:12px;
  line-height:1.7;
}

.revision-item {
  padding:15px 0;
  border-bottom:1px solid var(--line);
}

.revision-item small {
  font-size:10px;
  color:var(--muted);
}

.revision-item pre {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  font-size:12px;
  line-height:1.7;
}

/* The preview stays beside the manager; a narrow screen uses a dismissible full-page view. */
.workspace.preview-open {
  grid-template-columns:212px minmax(320px,1fr) clamp(340px,var(--preview-width,48vw),calc(100vw - 540px));
}
.preview-open .activity-pane { display:none; }
.preview-open .activity-toggle,.preview-open .activity-header button { display:inline-grid; }
.preview-open.activity-open .activity-pane {
  display:flex; position:fixed; z-index:55; right:0; top:0; bottom:0;
  width:min(320px,92vw); box-shadow:-20px 0 60px #0003;
}
.preview-pane {
  position:relative; display:flex; flex-direction:column; min-width:0; min-height:0;
  height:100%; border-left:1px solid var(--line); background:var(--surface); overflow:hidden;
}
.preview-toolbar {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  min-height:64px; padding:12px 16px; border-bottom:1px solid var(--line);
}
.preview-toolbar>strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; font-weight:500; }
.preview-actions { display:flex; gap:2px; flex-shrink:0; align-items:center; }
.preview-actions .icon-button { width:30px; height:30px; text-decoration:none; }
.preview-tabs { display:flex; gap:4px; padding:8px 12px; overflow-x:auto; flex-shrink:0; border-bottom:1px solid var(--line); }
.preview-tab-group { display:flex; align-items:center; border-radius:7px; background:var(--raised); min-width:0; flex-shrink:0; }
.preview-tab { flex-shrink:0; border:0; background:none; padding:8px 10px; border-radius:7px; font-size:12px; color:var(--muted); max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.preview-tab[aria-selected=true] { color:var(--text); background:var(--hover); }
.preview-tab-close { border:0; background:none; color:var(--muted); padding:5px 8px; border-radius:5px; }
.preview-tab-close:hover { color:var(--text); background:var(--hover); }
.preview-library { overflow:auto; padding:28px; }
.preview-library h2 { font-size:18px; font-weight:500; margin:0 0 12px; }
.preview-library>p { font-size:13px; line-height:1.7; color:var(--muted); max-width:440px; }
.preview-library h3 { font-size:12px; font-weight:500; margin:30px 0 12px; color:var(--muted); }
.preview-site-card { display:flex; flex-direction:column; text-align:left; gap:8px; width:100%; padding:18px; margin-bottom:10px; border:1px solid var(--line); border-radius:12px; background:var(--bg); }
.preview-site-card:hover { background:var(--raised); }
.preview-site-card strong { font-size:13px; font-weight:500; overflow-wrap:anywhere; }
.preview-site-card span { font-size:12px; color:var(--muted); }
.preview-views { flex:1; display:flex; min-height:0; overflow:hidden; }
.preview-view { display:flex; flex-direction:column; flex:1; min-width:0; min-height:0; overflow:auto; }
.preview-message { padding:24px; font-size:13px; line-height:1.7; color:var(--muted); overflow-wrap:anywhere; }
.preview-library .preview-message { padding:0; }
.preview-website { display:block; width:100%; flex:1; min-height:200px; border:0; background:white; color-scheme:normal; }
.preview-site-hint { margin:0; padding:10px 18px; font-size:11px; line-height:1.5; color:var(--muted); border-top:1px solid var(--line); }
.preview-resize { position:absolute; left:0; top:0; bottom:0; width:6px; z-index:2; cursor:col-resize; touch-action:none; }
.preview-resize:hover,.preview-resize:focus-visible { background:var(--faint); outline:0; }
.preview-resizing iframe { pointer-events:none; }
.preview-resizing { cursor:col-resize; user-select:none; }
.preview-maximized .preview-pane { position:fixed; inset:0; z-index:45; }
.preview-maximized .preview-resize { display:none; }
.preview-document { padding:24px; min-width:0; }
.preview-document .document-download { display:inline-block; margin-top:20px; font-size:12px; color:var(--muted); }
.preview-document .document-note { color:var(--muted); font-size:12px; line-height:1.7; }
.preview-document .document-body { min-width:0; }
.preview-document .media { display:block; max-width:100%; height:auto; margin:auto; }
.preview-document audio.media { width:100%; }
.preview-document .document-markdown { font-size:14px; line-height:1.8; overflow-wrap:anywhere; }
.document-markdown h1 { font-size:25px; line-height:1.3; }
.document-markdown h2 { font-size:20px; }
.document-markdown h3 { font-size:16px; }
.document-markdown pre { overflow:auto; padding:16px; border-radius:8px; background:var(--bg); font-size:12px; }
.document-markdown table { display:block; overflow:auto; border-collapse:collapse; }
.document-markdown td,.document-markdown th { padding:8px 12px; border:1px solid var(--line); }
.pdf-controls { position:sticky; top:-1px; z-index:1; display:flex; gap:12px; align-items:center; justify-content:space-between; margin:-8px 0 18px; padding:10px 0; background:var(--surface); font-size:12px; }
.pdf-controls button,.pdf-page button { border:1px solid var(--line); background:var(--raised); border-radius:7px; padding:7px 10px; }
.pdf-page .media { width:100%; box-shadow:0 4px 20px #0002; }
@media(max-width:1100px) and (min-width:851px) {
  .workspace.preview-open { grid-template-columns:minmax(300px,1fr) clamp(340px,var(--preview-width,52vw),calc(100vw - 300px)); }
  .preview-open .sidebar { display:none; position:fixed; z-index:40; top:0; bottom:0; left:0; width:260px; box-shadow:20px 0 60px #0003; }
  .preview-open.menu-open .sidebar { display:flex; }
  .preview-open .menu-toggle { display:inline-grid; }
}
@media(max-width:850px) {
  .workspace.preview-open { grid-template-columns:240px minmax(350px,1fr); }
  .preview-pane { position:fixed; inset:0; z-index:45; }
  .preview-resize,.preview-actions #preview-maximize { display:none; }
  .preview-toolbar { padding:10px 12px; min-height:56px; }
  .preview-toolbar>strong { font-size:12px; }
  .preview-document,.preview-library { padding:20px; }
  .preview-tab { max-width:150px; }
}

.message-progress { margin: 6px 0 16px; color: var(--muted); font-size: 13px; }
.message-progress summary { cursor: pointer; user-select: none; margin-bottom: 8px; }
.message-progress .message-body { margin: 8px 0; font-size: 13px; }
.message.error .message-body { opacity: .85; }
.message-progress .message-body::after { display: none; }
.reply-target{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px;background:var(--surface-2,#f1f4f2);border-radius:8px;overflow-wrap:anywhere;font-size:13px}.reply-target[hidden]{display:none}.reply-target button{flex-shrink:0}.message-reply-target{display:block;margin:4px 0;color:var(--muted,#65736b);overflow-wrap:anywhere}
@media(min-width:1151px) {
  .workspace.without-activity:not(.preview-open) { grid-template-columns:256px minmax(350px,1fr); }
}

.adaptive-view-select{width:100%;padding:9px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:inherit;font:inherit}
.adaptive-view-hint{font-size:11px;line-height:1.5;opacity:.7;margin:12px 0}
.adaptive-view-card{padding:12px 10px;border-block-start:1px solid var(--line);overflow-wrap:anywhere}
.adaptive-view-card h3{font-size:14px;font-weight:550;margin:0 0 8px}.adaptive-view-card p{font-size:12px;line-height:1.5;margin:8px 0 0}
.adaptive-state{display:inline-block;font-size:11px;padding:3px 6px;border-radius:5px;background:var(--surface)}.adaptive-state.prepared{border:1px solid #ad8b4d;color:#c8a564}
.adaptive-view-card small{display:block;opacity:.7;font-size:10px;margin-top:5px}.adaptive-view-card progress{display:block;width:100%;height:5px;margin-top:10px}
.adaptive-more{width:100%;padding:9px;margin-top:10px;font:inherit;cursor:pointer}

/* Bounded CRM tree: nested lists retain accessible buttons and loaded-row counts. */
.adaptive-tree{list-style:none;padding:0;margin:0}.adaptive-tree[hidden]{display:none}
.adaptive-tree-toggle{display:block;margin:0 0 8px;padding:4px 7px;border:1px solid var(--line);border-radius:5px;background:var(--surface);color:inherit;font:inherit;font-size:11px;text-align:start;cursor:pointer}
.adaptive-tree-toggle:focus-visible{outline:2px solid currentColor;outline-offset:2px}
.message-source { display:block; margin:4px 0 10px; padding:0; border:0; background:none; color:var(--muted); font:inherit; font-size:12px; text-align:start; cursor:pointer; }
.message-source:hover { text-decoration:underline; }
.message-source:focus-visible { outline:2px solid currentColor; outline-offset:3px; }
.answered-revision { border-inline-start:2px solid currentColor; padding-inline-start:12px; }
.project-channel-status { margin:0 0 10px; color:var(--muted); font-size:12px; line-height:1.5; }
.project-channel-status[hidden] { display:none; }
