/*
 * Chat shares Brain's surface: the same ink, rail, lines and dark mode, so
 * switching tabs in the dock never changes the room you are in. One stylesheet,
 * in reading order: tokens, shell, sidebar, conversation, composer, side rails,
 * dialogs, then the narrow-screen rules at the end.
 *
 * Every size is in rem. <html> carries --t from the text-size cookie, so the
 * whole page scales from one number and the layout stays put.
 */
:root {
  --bg: #ffffff;
  --rail: #f7f7f5;
  --ink: #24343c;
  --ink-soft: #647279;
  --ink-faint: #717d82;
  --line: rgba(55, 53, 47, .09);
  --line-strong: rgba(55, 53, 47, .16);
  --hover: rgba(55, 53, 47, .06);
  --bubble: #f1f1ef;
  --bubble-you: #37352f;
  --bubble-you-ink: #ffffff;
  --blue: #476c5e;
  --blue-bg: #eaf1ed;
  --good: #448361;
  --warn: #cb912f;
  --warn-bg: #fbf3db;
  --bad: #d44c47;
  --bad-bg: #fbecec;
  --shadow: 0 10px 30px rgba(0, 0, 0, .12);
  --sidebar-w: 260px;
  --details-w: 300px;
  --column: 52rem;
  --header-h: 4.5rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --rail: #202020;
    --ink: #d4d4d4;
    --ink-soft: #aaaaaa;
    --ink-faint: #999999;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .14);
    --hover: rgba(255, 255, 255, .055);
    --bubble: #262626;
    --bubble-you: #e6e6e6;
    --bubble-you-ink: #191919;
    --blue: #529cca;
    --blue-bg: rgba(82, 156, 202, .16);
    --good: #7ba787;
    --warn: #c99f5c;
    --warn-bg: #2d2620;
    --bad: #df5452;
    --bad-bg: #2f2222;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
html[data-text-step="0"] { --t: .875; }
html[data-text-step="1"] { --t: 1; }
html[data-text-step="2"] { --t: 1.125; }
html[data-text-step="3"] { --t: 1.25; }
html[data-text-step="4"] { --t: 1.5; }
html[data-text-step="5"] { --t: 1.75; }
html { font-size: calc(16px * var(--t, 1)); -webkit-text-size-adjust: 100%; }
html[data-text-step="4"], html[data-text-step="5"] { --sidebar-w: 300px; }

/* ---- base ------------------------------------------------------------- */
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1rem/1.6 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif;
  font-synthesis: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
button:disabled, select:disabled { cursor: default; opacity: .5; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon-button.mobile-only { display: none; }
img { display: block; }
h1, h2, h3, p { margin: 0; }

/* Text in a size that reads as a caption: labels, hints, timestamps. */
.hint, .message-label, .composer-footnote, .file-link small, .mail-card small, .count,
.model-help, .model-option-detail, .artifact-card-path, .artifact-header small, .recovery-note,
.prompt-option small, .harness-diagnostics, .connection-card summary, .rename-error { font-size: .8125rem; line-height: 1.5; color: var(--ink-soft); }
.section-label {
  font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); padding: 0 .625rem;
}
.section-label span { float: right; letter-spacing: 0; }

/* ---- generic controls ------------------------------------------------- */
.secondary, .stop, .recovery-actions button, .permission button, .model-refresh {
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  min-height: 2.125rem; padding: .375rem .875rem;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--ink);
  font-size: .875rem; font-weight: 500; white-space: nowrap;
}
.secondary:hover:not(:disabled), .stop:hover, .recovery-actions button:hover:not(:disabled),
.permission button:hover:not(:disabled), .model-refresh:hover:not(:disabled) { background: var(--hover); }
.icon-button {
  display: inline-grid; place-items: center; width: 2.125rem; height: 2.125rem;
  border-radius: 6px; color: var(--ink-soft); font-size: 1.375rem; line-height: 1;
}
.icon-button:hover { background: var(--hover); color: var(--ink); }
.notice {
  margin: .75rem auto 0; width: min(var(--column), 100% - 2rem);
  padding: .625rem .875rem; border-radius: 6px; background: var(--warn-bg); color: #715024;
  font-size: .875rem; line-height: 1.5; flex: none;
}
.notice button { margin-inline-start: .5rem; color: inherit; font-weight: 600; }
@media (prefers-color-scheme: dark) { .notice { color: #e2c48c; } }

/* ---- shell ------------------------------------------------------------ */
.shell {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--details-w);
  height: 100dvh; overflow: hidden; position: relative;
}
.shell.hide-details, .shell.new-chat { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.shell.hide-details .details, .shell.new-chat .details { display: none; }
.shell.artifact-open { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) minmax(28rem, 42vw); }
.shell.artifact-open .details { display: none; }
.browser-panel { display: flex; flex-direction: column; min-width: 0; }
.browser-toolbar { display: flex; gap: .25rem; padding: .5rem; border-bottom: 1px solid var(--line); }
.browser-toolbar input { flex: 1; min-width: 0; padding: .4rem; }
.browser-toolbar button { padding: .4rem; }
.browser-panel > .hint, .browser-panel > button { margin: .5rem .75rem; }
.browser-viewport { flex: 1; min-height: 240px; overflow: hidden; background: #fff; }
.browser-viewport img { display: block; width: 100%; height: auto; outline-offset: -2px; cursor: default; }
.browser-note { padding: .5rem; border-top: 1px solid var(--line); }

/* ---- sidebar ---------------------------------------------------------- */
.sidebar {
  display: flex; flex-direction: column; min-height: 0; overflow-y: auto;
  background: var(--rail); border-right: 1px solid var(--line); padding: .875rem .5rem 0;
}
.sidebar-heading { display: flex; align-items: center; gap: .5rem; padding: 0 .25rem 0 .625rem; margin-bottom: .75rem; }
.sidebar-heading .service-brand { flex: 1; min-width: 0; }
.service-brand { display: block; font-size: 1.375rem; font-weight: 700; letter-spacing: -.04em; line-height: 1.3; color: var(--ink); }
.service-brand .brand-dot { display: inline-block; vertical-align: top; color: #eb9564; font-size: .5rem; margin: .125rem 0 0 .125rem; }
.search {
  display: flex; align-items: center; gap: .5rem; margin: 0 .25rem .875rem;
  padding: .5rem .625rem; border-radius: 6px; background: var(--hover); color: var(--ink-faint);
}
.search > span { font-size: 1.125rem; line-height: 1; }
.search input { min-width: 0; flex: 1; border: 0; background: none; outline: none; font-size: .9375rem; color: var(--ink); }
.search input::placeholder { color: var(--ink-faint); }
/* The list keeps room for a few people at any text size; when the footer needs more space, the whole
   sidebar scrolls instead of the list shrinking to a sliver. */
#agents { overflow-y: auto; min-height: min(11rem, 40vh); flex: 1 1 auto; padding: .25rem 0; }
.agent-button {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  padding: .5rem .625rem; margin: .125rem 0; border-radius: 8px; text-align: left; transition: background .12s;
}
.agent-button:hover { background: var(--hover); }
.agent-button.selected { background: var(--line-strong); }
@media (prefers-color-scheme: dark) { .agent-button.selected { background: var(--line-strong); } }
.agent-button img { width: 2.75rem; height: 2.75rem; flex: none; }
.agent-button .agent-text { min-width: 0; flex: 1; }
.agent-button strong { display: block; font-size: .9375rem; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-button small { display: block; margin-top: .125rem; font-size: .8125rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-dot { flex: none; width: .5rem; height: .5rem; border-radius: 50%; background: var(--warn); }
.working-dot { background: var(--good); }
.thread-heading { display: flex; align-items: center; justify-content: space-between; margin: 1rem 0 .375rem; cursor: pointer; list-style: none; }
.thread-heading::-webkit-details-marker { display: none; }
#threads { overflow: auto; min-height: 3rem; flex: 0 1 auto; margin-top: .5rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.thread-button {
  display: block; width: 100%; padding: .5rem .625rem; border-radius: 6px; text-align: left;
  font-size: .875rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.thread-button:hover, .thread-button.selected { background: var(--hover); color: var(--ink); }
.empty-thread { padding: 0 .625rem; font-size: .8125rem; color: var(--ink-faint); }
#archived-agents { margin-top: .5rem; }
#archived-agents .agent-button { opacity: .65; }
.sidebar-footer { margin-top: auto; flex: none; padding: .5rem .25rem .625rem; border-top: 1px solid var(--line); }
.sidebar-actions { display: grid; gap: .25rem; margin: .5rem 0 .75rem; }
.sidebar-action { display: flex; align-items: center; gap: .625rem; width: 100%; min-height: 2.625rem; padding: .5rem .625rem; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-soft); font-size: .875rem; font-weight: 500; text-align: left; }
.sidebar-action:hover { background: var(--hover); color: var(--ink); }
.sidebar-action svg { width: 1.125rem; height: 1.125rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.action-arrow { margin-left: auto; color: var(--ink-faint); }
.sidebar-action.update-available { background: var(--blue-bg); color: var(--blue); }
.sidebar-action:focus-visible, .primary-action:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.secondary.primary-action { background: var(--bubble-you); border-color: var(--bubble-you); color: var(--bubble-you-ink); min-height: 2.625rem; padding: .625rem 1rem; border-radius: 8px; }
.secondary.primary-action:hover:not(:disabled) { background: var(--bubble-you); filter: brightness(.9); }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .625rem; margin-top: 1rem; }
.share-fields { display: grid; gap: .375rem; margin: 1.25rem 0 .875rem; }
.share-fields label { font-size: .8125rem; color: var(--ink-soft); }
.share-fields input { width: 100%; padding: .625rem .75rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--ink); }
#share-dialog .connection-close, #updates-dialog .connection-close, #customise-dialog .connection-close { float: right; margin: -.5rem -.75rem 0 0; }
.customise-place { display: flex; align-items: center; gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--line); }
.customise-place:first-child { border-top: 0; }
.customise-place div { flex: 1; }
.customise-place strong { display: block; font-size: .9375rem; }
.customise-place small { display: block; color: var(--ink-soft); font-size: .8125rem; line-height: 1.4; }
#customise-dialog h3 { margin-top: 1.5rem; }
.plugin-row { padding: .75rem 0; border-top: 1px solid var(--line); }
.plugin-row:first-child { border-top: 0; }
.plugin-head { display: flex; align-items: flex-start; gap: 1rem; }
.plugin-head > div { flex: 1; min-width: 0; }
.plugin-head strong { font-size: .9375rem; }
.plugin-head small { display: block; color: var(--ink-soft); font-size: .8125rem; line-height: 1.4; }
.plugin-badge { display: inline-block; margin-left: .5rem; padding: 0 .375rem; border-radius: 4px; font-size: .75rem; font-weight: 500; background: var(--hover); color: var(--ink-soft); }
.plugin-badge.on { background: var(--blue-bg); color: var(--blue); }
.plugin-badge.attention, .plugin-badge.broken, .plugin-badge.incompatible { background: var(--warn-bg); color: var(--warn); }
.plugin-reason { margin: .375rem 0 0; font-size: .8125rem; color: var(--warn); }
.plugin-toggle { display: flex; align-items: center; gap: .375rem; font-size: .875rem; white-space: nowrap; }
.plugin-row .dialog-actions { margin-top: .5rem; }
.plugin-row .secondary { min-height: 1.75rem; padding: .125rem .625rem; font-size: .8125rem; }
.defaults-form .plugin-check { display: flex; align-items: center; gap: .5rem; }
.defaults-form .plugin-check input { width: auto; }
.plugin-consent { margin: .75rem 0; padding: .75rem 1rem; border: 1px solid var(--warn); border-radius: 8px; background: var(--warn-bg); color: var(--ink); }
.plugin-consent p { margin: .5rem 0; font-size: .875rem; }
.plugin-consent ul { margin: .25rem 0 .5rem; padding-left: 1.25rem; font-size: .875rem; }
.own-failure { white-space: pre-wrap; max-height: 8rem; overflow: auto; padding: .5rem .625rem; border-radius: 6px; background: var(--hover); font-size: .75rem; }
.service-privacy { margin: .375rem .375rem 0; font-size: .6875rem; line-height: 1.4; color: var(--ink-faint); }
.service-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .25rem; padding: .125rem 0 .25rem; }
.service-quick button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 50px; padding: 4px 2px; border-radius: 6px; color: var(--ink-soft); }
.service-quick button:hover { background: var(--hover); color: var(--ink); }
.service-quick svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.service-quick .quick-label { font-size: clamp(10px, calc(10px * var(--t, 1)), 12px); line-height: 1.2; white-space: nowrap; }
.service-quick .update-available { color: var(--blue); }
.service-dock {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem;
  margin: .625rem 0 0; padding: .375rem 0 0; border-top: 1px solid var(--line);
}
.service-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .125rem;
  min-height: 3.125rem; padding: .25rem; border-radius: 6px;
  font-size: .875rem; color: var(--ink-soft); text-decoration: none; white-space: nowrap;
}
.service-tab:hover { background: var(--hover); color: var(--ink); }
.service-tab[aria-current="page"] { background: var(--bg); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line-strong); }
.service-tab svg { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.service-tab.update-available { position: relative; }
.service-tab.update-available::after { content: ""; position: absolute; top: .35rem; right: .65rem; width: .4rem; height: .4rem; border-radius: 50%; background: var(--blue); }

/* ---- conversation pane ------------------------------------------------ */
.conversation { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.chat-header {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; flex: none;
  min-height: var(--header-h); padding: .75rem 1.25rem; border-bottom: 1px solid var(--line);
}
.chat-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; min-width: 0; max-width: 100%; }
.chat-header .avatar { width: 2.5rem; height: 2.5rem; flex: none; }
.header-identity { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.header-identity #agent-name { font-size: 1.0625rem; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-identity #agent-status { font-size: .8125rem; color: var(--ink-soft); line-height: 1.4; }
.agent-trigger { flex: 1 1 12rem; display: flex; align-items: center; gap: .75rem; min-width: 0; max-width: 100%; padding: .25rem .5rem; margin-left: -.5rem; border-radius: 8px; text-align: left; }
.agent-trigger .header-identity { flex: 0 1 auto; }
.agent-trigger:hover, .agent-trigger:focus-visible { background: var(--hover); }
.rename-name {
  width: 100%; max-width: 22rem; min-width: 0; margin-left: -.375rem;
  padding: .125rem .375rem; border: 1px solid transparent; border-radius: 5px; background: transparent;
  font: inherit; color: inherit; text-overflow: ellipsis;
}
.rename-name:hover:not(:disabled), .rename-name:focus { background: var(--hover); border-color: var(--line); outline: none; }
.agent-card .rename-name { margin: 0 auto; text-align: center; font-size: inherit; font-weight: inherit; letter-spacing: inherit; }
.rename-error { color: var(--bad); }
.rename-error:empty { display: none; }

/* The timeline and composer use the conversation pane; bubbles stay readable. */
.timeline { flex: 1; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 2rem; overflow-anchor: none; overscroll-behavior: contain; }
#messages, .activity, .permissions, #older-messages, #recovery-card, .welcome { width: 100%; max-width: var(--column); margin-left: auto; margin-right: auto; }
#older-messages { display: flex; margin-bottom: 1.25rem; width: auto; }

.welcome { text-align: center; padding: clamp(1.5rem, 8vh, 6rem) 0 1rem; }
.welcome-face { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.welcome-face img { width: 5rem; height: 5rem; }
.eyebrow { font-size: .6875rem; font-weight: 600; letter-spacing: .12em; color: var(--ink-faint); margin-bottom: .75rem; }
.welcome h2 { font-size: 1.875rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin-bottom: .75rem; }
.welcome > p { max-width: 28rem; margin: 0 auto; font-size: 1rem; color: var(--ink-soft); }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; max-width: 32rem; margin: 1.75rem auto 0; }
.suggestion {
  display: flex; align-items: center; gap: .625rem; padding: .75rem .875rem;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg);
  text-align: left; font-size: .875rem; line-height: 1.4; color: var(--ink);
}
.suggestion:hover { background: var(--hover); }
.suggestion span { flex: none; font-size: 1.0625rem; color: var(--ink-faint); }

.message { display: flex; align-items: flex-start; gap: .75rem; margin: 1.5rem 0; }
.message img { width: 2.25rem; height: 2.25rem; flex: none; }
.message-content { min-width: 0; max-width: calc(100% - 3rem); }
.message.user { justify-content: flex-end; }
.message.user .message-content { max-width: min(56rem, 85%); }
.message-label { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .25rem; }
.message-label strong { font-weight: 600; color: var(--ink); }
.message.user .message-label { justify-content: flex-end; }
.message-body { font-size: 1rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.assistant .message-body, .message.user .message-body { padding: .625rem .875rem; border-radius: 16px; }
.message.assistant .message-body { background: transparent; padding: .25rem 0; border-radius: 0; }
.message.assistant .markdown-body { white-space: normal; }
.message.user .message-body { background: var(--rail); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; }
.message.system { justify-content: center; text-align: center; font-size: .8125rem; color: var(--ink-faint); white-space: pre-wrap; overflow-wrap: anywhere; }
.message.system:not(.routine-divider) { justify-content: flex-start; text-align: left; width: calc(100% - 3rem); margin: .75rem 0 .75rem 3rem; padding: .5rem .75rem; border-left: 2px solid var(--line-strong); border-radius: 0 6px 6px 0; background: var(--rail); color: var(--ink-soft); }
.handoff { max-width: min(46rem, 100%); }
.handoff > summary { cursor: pointer; list-style: none; white-space: normal; }
.handoff > summary::-webkit-details-marker { display: none; }
.handoff > summary:hover { color: var(--ink-soft); }
.handoff[open] > summary { color: var(--ink-soft); margin-bottom: .375rem; }
.handoff-body { text-align: left; white-space: normal; color: var(--ink-soft); background: var(--hover); border-radius: 10px; padding: .5rem .75rem; }
.introduction .message-content { width: min(40rem, calc(100% - 3rem)); }
.introduction-card { margin-top: .375rem; padding: .75rem; border-radius: 16px; background: var(--rail); }
.introduction-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .9375rem; font-weight: 600; }
.introduction-heading h2 { font-size: inherit; font-weight: inherit; }
.introduction-close { width: 1.75rem; height: 1.75rem; flex: none; border-radius: 50%; color: var(--ink-soft); font-size: 1.25rem; line-height: 1; }
.introduction-close:hover { background: var(--hover); color: var(--ink); }
.introduction-hint { margin: .125rem 0 .625rem; color: var(--ink-soft); font-size: .8125rem; }
.introduction-option { display: flex; flex-direction: column; width: 100%; padding: .5rem .625rem; border: 1px solid var(--line-strong); border-bottom: 0; background: var(--bg); text-align: left; font-size: .875rem; line-height: 1.4; }
.introduction-option:first-of-type { border-radius: 8px 8px 0 0; }
.introduction-option:last-child { border-bottom: 1px solid var(--line-strong); border-radius: 0 0 8px 8px; }
.introduction-option:hover { background: var(--hover); }
.introduction-option strong { font-weight: 500; }
.introduction-option span { color: var(--ink-soft); font-size: .8125rem; }
.message.failed .message-body, .message.interrupted .message-body { box-shadow: none; }
.message-state { display: inline-block; margin-top: .375rem; padding: .125rem .4375rem; border-radius: 5px; background: var(--warn-bg); font-size: .6875rem; color: color-mix(in srgb, var(--warn) 50%, var(--ink)); }
.failed-output summary, .harness-diagnostics summary { cursor: pointer; color: var(--ink-soft); font-size: .8125rem; }
.failed-output .message-body { margin-top: .5rem; padding: .625rem .875rem; border-radius: 8px; background: var(--bubble); }
.harness-diagnostics { margin-bottom: .5rem; }
.harness-diagnostics pre { margin: .25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }

.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body blockquote, .markdown-body pre { margin: .625em 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { font-size: 1.05em; line-height: 1.4; margin: 1.1em 0 .4em; }
.markdown-body h1 { font-size: 1.3em; } .markdown-body h2 { font-size: 1.18em; } .markdown-body h3 { font-size: 1.08em; }
.markdown-body ul, .markdown-body ol { padding-left: 1.4em; }
.markdown-body li { margin: .2em 0; }
.markdown-body li > p { margin: .2em 0; }
.markdown-body a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.markdown-body blockquote { border-left: 3px solid var(--line-strong); padding-left: .75rem; color: var(--ink-soft); }
.markdown-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875em; background: var(--hover); border-radius: 4px; padding: .1em .3em; }
.markdown-body pre { max-width: 100%; overflow-x: auto; white-space: pre; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: .75rem; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: .75em 0; }
/* Cells must not inherit the bubble's break-anywhere, or a wide table squeezes to one letter per line instead of scrolling. */
.markdown-body th, .markdown-body td { border: 1px solid var(--line-strong); padding: .375rem .625rem; text-align: left; overflow-wrap: normal; word-break: normal; }
.markdown-body th { white-space: nowrap; }
.markdown-body [align=right] { text-align: right; font-variant-numeric: tabular-nums; }
.markdown-body [align=center] { text-align: center; }
.markdown-body th { background: var(--hover); }
.markdown-body hr { border: 0; border-top: 1px solid var(--line-strong); margin: 1em 0; }

.brain-references { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .5rem; }
.brain-references a {
  display: inline-block; padding: .3rem .625rem; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--blue-bg); color: var(--blue); text-decoration: none; font-size: .8125rem;
}
.brain-references a:hover { border-color: var(--blue); }

.activity { margin-top: .75rem; margin-bottom: .75rem; padding-left: 3rem; font-size: .8125rem; line-height: 1.7; color: var(--ink-soft); }
.activity:empty { display: none; }
.activity .pulse { display: inline-block; width: .375rem; height: .375rem; margin-right: .5rem; border-radius: 50%; background: var(--warn); animation: pulse 1.4s infinite; vertical-align: middle; }
@keyframes pulse { 50% { opacity: .3; } }
.permission {
  margin: 1rem 0; padding: 1rem 1.125rem; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--warn-bg); color: #715024;
}
@media (prefers-color-scheme: dark) { .permission { color: #e2c48c; } }
.permission h3 { font-size: .9375rem; font-weight: 600; margin-bottom: .375rem; }
.permission p, .permission pre { font-size: .875rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; margin: .25rem 0; }
.permission pre { max-height: 11rem; overflow: auto; font-family: ui-monospace, Menlo, monospace; font-size: .8125rem; }
.permission summary { cursor: pointer; font-size: .8125rem; }
.permission button { margin: .5rem .5rem 0 0; }
.recovery-card { margin: 1rem auto; padding: 1rem 1.125rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--rail); }
.recovery-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.recovery-card p { font-size: .875rem; margin: .25rem 0 .75rem; }
.recovery-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.recovery-actions button:first-child { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.recovery-actions button:first-child:hover:not(:disabled) { background: var(--ink); opacity: .85; }
.recovery-card .recovery-note { margin-top: .75rem; }
.recovery-card summary { cursor: pointer; font-size: .8125rem; color: var(--ink-soft); }
.recovery-card pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8125rem; }

/* Keep file names readable in the conversation; images retain their previews. */
.artifact-cards { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.message-generated-files { margin-top: .625rem; color: var(--ink-soft); font-size: .8125rem; }
.message-generated-files > summary { cursor: pointer; width: fit-content; padding: .25rem 0; }
.message-file-list { display: flex; flex-direction: column; gap: .125rem; margin-top: .25rem; border-left: 1px solid var(--line-strong); padding-left: .75rem; }
.message-file-link { background: none; border: 0; text-align: left; color: var(--ink-soft); padding: .375rem .25rem; font-size: inherit; overflow-wrap: anywhere; }
.message-file-link:hover { color: var(--ink); background: var(--hover); }
.artifact-card {
  width: 9.5rem; max-width: 100%; overflow: hidden; text-align: left;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--ink);
}
.artifact-card:hover { background: var(--hover); }
.artifact-thumb { height: 7rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .375rem; overflow: hidden; background: var(--rail); }
.artifact-icon { font-size: 2rem; line-height: 1; }
.artifact-type { color: var(--ink-soft); font-size: .75rem; font-weight: 700; letter-spacing: .04em; }
.artifact-card .artifact-thumb img { width: 100%; height: 100%; object-fit: cover; }
.artifact-card-name { display: block; padding: .5rem .625rem; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-card-path { display: block; padding: 0 .625rem .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message .artifact-card:not(:has(img)) { display: flex; align-items: center; width: min(22rem, 100%); }
.message .artifact-card:not(:has(img)) .artifact-thumb { flex: none; width: 3.25rem; height: 3.25rem; gap: .125rem; }
.message .artifact-card:not(:has(img)) .artifact-icon { font-size: 1.25rem; }
.message .artifact-card:not(:has(img)) .artifact-type { font-size: .5625rem; }
.message .artifact-card.source-file, .composer-files .artifact-card { width: min(18rem, 100%); display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; }
.message .artifact-card.source-file .artifact-thumb, .composer-files .artifact-thumb { grid-row: 1 / 3; height: 3.25rem; font-size: .75rem; }
.source-file .artifact-icon, .composer-files .artifact-icon { font-size: 1.25rem; }
.message .artifact-card.source-file .artifact-card-name, .composer-files .artifact-card-name { padding: .375rem .625rem 0; }
.message .artifact-card.source-file .artifact-card-path, .composer-files .artifact-card-path { padding-bottom: .375rem; }

/* ---- composer ---------------------------------------------------------- */
.cloud-pilot-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; padding: .25rem clamp(.75rem, 3vw, 2.5rem); }
.cloud-pilot-controls .hint { margin: 0; }
.cloud-pilot-controls button { flex: none; }
.cloud-pilot-review h3, .cloud-pilot-files h3 { margin: 1rem 0 .375rem; }
.cloud-pilot-review p, .cloud-pilot-files p { margin: .375rem 0; }
#cloud-pilot-confirm:not(:disabled) { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.cloud-review-limits { margin: .625rem 0; }
.cloud-review-limits summary { cursor: pointer; }
.cloud-review-blocks { padding: .625rem .75rem .625rem 1.75rem; border: 1px solid var(--warn); border-radius: 8px; background: var(--warn-bg); }
.cloud-file-list { list-style: none; margin: .625rem 0; padding: 0; }
.cloud-file-list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .5rem .625rem; border-bottom: 1px solid var(--line); }
.cloud-file-list li[data-selected="true"] { background: var(--blue-bg); border-radius: 6px; }
.cloud-file-list small { display: block; }
.cloud-file-list strong { overflow-wrap: anywhere; }
.cloud-file-list button { flex: none; }
.composer-wrap { flex: none; min-width: 0; position: relative; z-index: 3; padding: .5rem clamp(1rem, 3vw, 2.5rem) 1rem; }
.composer-wrap form {
  position: relative; width: 100%; max-width: var(--column); margin: 0 auto;
  border: 1px solid var(--line-strong); border-radius: 18px; background: var(--bg);
  padding: .5rem .625rem .5rem .75rem; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.composer-wrap form:focus-within { border-color: var(--ink-faint); }
.chat-file-drop-hint { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; margin: 0; padding: 1rem; border: 2px dashed var(--blue); border-radius: inherit; background: var(--bg); color: var(--ink); font-weight: 600; text-align: center; pointer-events: none; }
.composer-entry { display: flex; align-items: flex-start; gap: .5rem; }
.attach-files {
  flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; margin-top: .125rem;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--rail); color: var(--ink); font-size: 1.25rem; line-height: 1;
}
.attach-files:hover:not(:disabled) { background: var(--hover); }
.composer-wrap textarea {
  flex: 1; min-width: 0; width: 100%; min-height: 2.25rem; max-height: 12rem; padding: .375rem 0;
  border: 0; background: none; resize: none; outline: none; font-size: 1rem; line-height: 1.5; color: var(--ink);
}
.composer-wrap textarea::placeholder { color: var(--ink-faint); }
.composer-files { display: flex; flex-wrap: wrap; gap: .5rem; padding: .25rem .25rem .5rem; }
.composer-controls { display: flex; align-items: center; gap: .5rem; min-height: 2.125rem; padding-top: .125rem; }
/* At large text sizes the pickers wrap to a second line rather than squeezing their labels to nothing. */
.runtime-picker { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; min-width: 0; flex: 1; }
.runtime-dot { flex: none; width: .375rem; height: .375rem; border-radius: 50%; background: var(--warn); margin: 0 .25rem 0 .5rem; }
/* Flat like the model and approvals pickers beside it: without appearance: none, macOS draws its gradient push button. */
.runtime-picker select {
  appearance: none; -webkit-appearance: none; max-width: 8rem; padding: .3rem 1.375rem .3rem .5rem; margin-right: -1.125rem;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: .8125rem; line-height: 1.3;
  text-overflow: ellipsis; cursor: pointer;
}
.runtime-picker select:hover:not(:disabled), .runtime-picker select:focus-visible { background: var(--hover); }
.runtime-chevron { pointer-events: none; margin-right: .25rem; color: var(--ink-soft); }
.model-picker { min-width: 0; position: static; }
.model-picker > summary {
  display: flex; align-items: center; gap: .375rem; max-width: min(12rem, 40vw); padding: .3rem .5rem;
  border-radius: 6px; color: var(--ink-soft); font-size: .8125rem; line-height: 1.3; cursor: pointer; list-style: none;
}
.model-picker > summary::-webkit-details-marker { display: none; }
.model-picker > summary:hover, .model-picker[open] > summary { background: var(--hover); color: var(--ink); }
.model-picker > summary[aria-disabled="true"] { cursor: default; opacity: .5; }
#model-label, #approvals-label { min-width: 2.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-chevron { flex: none; font-size: .9375rem; line-height: 1; }
.model-popover {
  position: absolute; z-index: 12; left: 0; bottom: calc(100% + .5rem); width: min(22rem, 100%); max-height: min(24rem, 65dvh);
  overflow-y: auto; padding: .625rem; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow);
}
.model-popover-title { display: flex; justify-content: space-between; gap: .75rem; margin: .125rem .25rem .5rem; font-size: .8125rem; font-weight: 600; }
.model-popover-title span { color: var(--ink-soft); font-weight: 400; }
.model-options { display: grid; gap: .125rem; }
.model-option { display: grid; gap: .0625rem; width: 100%; padding: .5rem .625rem; border-radius: 6px; text-align: left; }
.model-option:hover:not(:disabled), .model-option:focus-visible { background: var(--hover); }
.model-option[aria-pressed="true"] { background: var(--blue-bg); }
.model-option-name { font-size: .875rem; font-weight: 500; overflow-wrap: anywhere; }
.model-option[aria-pressed="true"] .model-option-name::before { content: "✓ "; color: var(--blue); }
.model-refresh { width: 100%; margin-top: .5rem; justify-content: flex-start; font-weight: 400; }
.model-help { margin: .5rem .25rem .125rem; }
.custom-model { margin: .5rem .25rem 0; padding-top: .5rem; border-top: 1px solid var(--line); font-size: .8125rem; }
.custom-model summary { color: var(--blue); cursor: pointer; }
#custom-model-form { display: grid; gap: .375rem; margin-top: .625rem; }
#custom-model-id { width: 100%; padding: .5rem; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; }
#custom-model-form .secondary { justify-self: start; }
.custom-model p { margin-top: .5rem; color: var(--ink-soft); line-height: 1.45; }
.stop { margin-left: auto; border-radius: 999px; }
.send { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 1.25rem; line-height: 1; }
.send:hover:not(:disabled) { opacity: .85; }
.composer-footnote { margin: .375rem auto 0; width: 100%; text-align: center; color: var(--ink-faint); }
.composer-footnote:empty { display: none; }
.prompt-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + .5rem); max-height: min(20rem, 45vh); overflow: auto;
  padding: .375rem; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow);
}
.prompt-option { display: block; width: 100%; padding: .5rem .625rem; border-radius: 6px; text-align: left; }
.prompt-option:hover, .prompt-option:focus-visible { background: var(--hover); }
.prompt-option strong, .prompt-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt-option strong { font-size: .875rem; font-weight: 600; }
.prompt-option small { margin-top: .125rem; }
.prompt-empty { padding: .5rem .625rem; font-size: .8125rem; color: var(--ink-soft); }

/* ---- new chat: the recipient picker replaces the thread ----------------- */
.shell.new-chat .chat-header, .shell.new-chat .timeline, .shell.new-chat .composer-wrap, .shell.new-chat .notice { display: none; }
#new-chat { flex: 1; min-height: 0; overflow: auto; }
.recipient-bar { display: flex; gap: .75rem; align-items: center; min-height: var(--header-h); padding: .5rem 1rem; border-bottom: 1px solid var(--line); }
.recipient-bar label { color: var(--ink-soft); font-size: 1.125rem; }
.recipient-bar input { min-width: 0; flex: 1; border: 0; background: transparent; color: var(--ink); font-size: 1.125rem; padding: .5rem 0; outline: none; }
.recipient-options { width: min(var(--column), 100% - 2rem); margin: 1rem auto; padding: .375rem; max-height: calc(100dvh - 11rem); overflow: auto; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow); }
.agent-privacy-option { display: block; font-size: .875rem; color: var(--ink); }
.agent-privacy-option input { margin-right: .375rem; }
.agent-privacy-option small { display: block; margin: .25rem 0 0 1.5rem; color: var(--ink-soft); line-height: 1.45; }
#new-chat > .agent-privacy-option { width: min(var(--column), 100% - 2rem); margin: 0 auto; }
.recipient-option { display: flex; align-items: center; gap: .875rem; width: 100%; padding: .625rem .75rem; border-radius: 8px; color: var(--ink); text-align: left; font-size: 1rem; overflow-wrap: anywhere; }
.recipient-option:hover, .recipient-option:focus-visible { background: var(--hover); }
.recipient-option img, .recipient-plus { width: 2.25rem; height: 2.25rem; flex: none; }
.recipient-plus { display: grid; place-items: center; border-radius: 50%; background: var(--hover); font-size: 1.375rem; color: var(--ink-soft); }
#new-chat-result { width: min(var(--column), 100% - 2rem); margin: .75rem auto; color: var(--ink-soft); font-size: .875rem; }
#new-chat-result:empty { display: none; }

/* ---- details rail ------------------------------------------------------- */
.details { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 1.25rem 1.25rem 1.5rem; background: var(--rail); border-left: 1px solid var(--line); }
.details > .section-label { padding: 0; }
.agent-card { text-align: center; margin: 1.5rem 0 1.25rem; }
.agent-card > img { width: 5rem; height: 5rem; margin: 0 auto; }
.look-button { display: grid; justify-items: center; margin: 0 auto; border-radius: 10px; padding: .25rem; }
.look-button:hover { background: var(--hover); }
.look-button img { width: 5rem; height: 5rem; }
.look-editor { margin-top: .75rem; text-align: left; padding: .75rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); }
.look-editor .face-head, .look-editor .face-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; justify-content: space-between; font-size: .8125rem; }
.look-editor .face-head { margin-bottom: .5rem; }
.look-editor .face-tools button { text-decoration: underline; }
.look-editor .face-shapes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .25rem; margin-bottom: .75rem; }
.look-editor .face-shapes svg { width: 100%; height: auto; }
.look-editor button[aria-pressed=true] { outline: 2px solid var(--blue); outline-offset: 2px; }
.look-editor .face-colours { display: flex; flex-wrap: wrap; gap: .75rem; }
.look-editor .swatch { width: 1.5rem; height: 1.5rem; border-radius: 50%; }
.details-resizer { position: absolute; top: 0; bottom: 0; right: var(--details-w); width: 8px; margin-right: -4px; z-index: 7; cursor: col-resize; touch-action: none; }
.details-resizer:hover, .details-resizer:focus-visible, .details-resizer.resizing { background: var(--blue-bg); outline: 1px solid var(--blue); }
.shell.hide-details .details-resizer, .shell.new-chat .details-resizer, .shell.artifact-open .details-resizer { display: none; }
@media (max-width: 700px) { .details-resizer { display: none; } }
.agent-card h2 { font-size: 1.375rem; font-weight: 650; letter-spacing: -.01em; margin: .75rem 0 .25rem; }
.agent-card p { max-width: 15rem; margin: 0 auto 1rem; font-size: .875rem; color: var(--ink-soft); }
.memory-pill { display: inline-block; padding: .3rem .625rem; border-radius: 6px; background: var(--hover); color: var(--good); font-size: .75rem; }
.detail-section { padding: 1.125rem 0; border-top: 1px solid var(--line); }
.detail-section h3, .charter summary { font-size: .9375rem; font-weight: 600; color: var(--ink); }
.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.count { padding: .125rem .5rem; border-radius: 10px; background: var(--hover); }
.hint { margin-top: .5rem; }
.detail-section .secondary { width: 100%; margin-top: .75rem; }
.file-drop { border-style: dashed; min-height: 4rem; white-space: normal; }
.file-drop.drag-over { border-color: var(--blue); background: var(--hover); outline: 2px solid var(--blue); }
.mail-card { margin-top: .75rem; padding: .625rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.mail-card strong { display: block; font-size: .875rem; }
.mail-card p { margin: .25rem 0; max-height: 7rem; overflow: auto; white-space: pre-wrap; font-size: .875rem; color: var(--ink-soft); line-height: 1.5; }
.charter summary { cursor: pointer; }
#charter { margin-top: .75rem; font-size: .9375rem; line-height: 1.6; overflow-wrap: anywhere; }
#charter pre { font-family: ui-monospace, Menlo, monospace; white-space: pre-wrap; }
.charter textarea { width: 100%; margin-top: .625rem; padding: .625rem; resize: vertical; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); font-size: .875rem; line-height: 1.5; }
.charter-actions { display: flex; gap: .5rem; }
.charter-actions .secondary { flex: 1; width: auto; }
#archive-agent { width: 100%; margin-top: 1rem; }
.file-link { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .625rem .375rem; margin: 0 -.375rem; border-radius: 6px; text-align: left; font-size: .875rem; overflow-wrap: anywhere; }
.file-link:hover { background: var(--hover); }
.file-link > span:first-child { flex: none; color: var(--ink-faint); }
.file-link small { display: block; margin-top: .125rem; }

/* ---- artifact preview, in the same right rail --------------------------- */
.artifact-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg); }
.artifact-header { display: flex; align-items: center; gap: .75rem; min-height: var(--header-h); padding: .625rem 1rem; border-bottom: 1px solid var(--line); }
.artifact-header > div { min-width: 0; flex: 1; }
.artifact-header strong { display: block; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-header small { display: block; margin-top: .125rem; overflow-wrap: anywhere; }
.artifact-header #artifact-path { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.artifact-header a { flex: none; padding: .375rem .625rem; border-radius: 6px; font-size: .8125rem; text-decoration: none; }
.artifact-header a:hover { background: var(--hover); }
.artifact-content { flex: 1; min-height: 0; overflow: auto; background: var(--rail); }
.artifact-content > img { display: block; max-width: 100%; height: auto; margin: auto; }
.artifact-content > iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.artifact-content > video { display: block; width: 100%; max-height: 100%; margin: auto; background: #000; }
.artifact-content > pre { margin: 0; padding: 1.125rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8125rem; line-height: 1.6; }
.artifact-source { display: flex; flex-direction: column; gap: .625rem; min-height: 100%; padding: .875rem; background: var(--bg); }
.artifact-source p { margin: 0; }
.artifact-source label { display: flex; flex-direction: column; gap: .375rem; }
.artifact-source > label { flex: 1; }
.artifact-source textarea { width: 100%; flex: 1; min-height: 14rem; resize: vertical; padding: .625rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: .85rem/1.5 ui-monospace, monospace; tab-size: 2; }
.artifact-source-actions { display: flex; flex-wrap: wrap; gap: .375rem; }
.artifact-source-conflict:not(:empty) { display: grid; gap: .375rem; justify-items: start; border-top: 1px solid var(--line); padding-top: .625rem; }
.artifact-source-conflict label { width: 100%; }
@media (max-width: 760px) {
  #artifact-panel .artifact-header { flex-wrap: wrap; gap: .375rem; }
  #artifact-panel .artifact-header > div { flex-basis: 10rem; }
}
.artifact-comparison { min-height: 100%; display: flex; flex-direction: column; container-type: inline-size; }
.artifact-comparison-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .75rem; padding: .625rem .875rem; background: var(--bg); border-bottom: 1px solid var(--line); }
.artifact-comparison-controls label { display: flex; min-width: 0; align-items: center; gap: .5rem; font-size: .8125rem; }
.artifact-comparison-controls select { min-width: 0; max-width: 75%; }
.artifact-comparison-controls p { flex-basis: 100%; margin: 0; }
.workspace-app-focus .artifact-comparison-expand { display: none; }
.artifact-word-report { display: grid; gap: .375rem; padding: .625rem .875rem; background: var(--bg); border-bottom: 1px solid var(--line); }
.artifact-word-report p { margin: 0; }
.artifact-word-report summary { cursor: pointer; font-weight: 600; }
.artifact-word-changes { display: grid; gap: .5rem; max-height: 18rem; overflow: auto; padding: .25rem .5rem .25rem 1.5rem; }
.artifact-word-changes li > div { padding: .25rem; overflow-wrap: anywhere; }
.artifact-word-changes strong { display: block; font-size: .75rem; }
.artifact-word-row-label { color: var(--ink-soft); }
.artifact-word-changes del { background: #fbe7e4; color: #752822; }
.artifact-word-changes ins { background: #e4f3e8; color: #205a35; text-decoration: none; }
.artifact-comparison-panes { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.artifact-comparison-file { display: flex; min-width: 0; flex-direction: column; background: var(--bg); }
.artifact-comparison-label { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .125rem .5rem; padding: .625rem .875rem; border-bottom: 1px solid var(--line); }
.artifact-comparison-label h3 { grid-column: 1 / -1; margin: 0; font-size: .875rem; }
.artifact-comparison-label small, .artifact-comparison-label h3 { overflow-wrap: anywhere; }
.artifact-comparison-label a { font-size: .75rem; }
.artifact-comparison-preview { flex: 1; min-height: 20rem; position: relative; overflow: auto; }
.artifact-comparison-preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: white; }
.artifact-comparison-preview > pre { margin: 0; padding: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
@container (max-width: 34rem) {
  .artifact-comparison-panes { grid-template-columns: 1fr; }
  .artifact-comparison-preview { min-height: 24rem; }
}
.artifact-markdown { padding: 1.125rem 1.25rem; background: var(--bg); min-height: 100%; }
.artifact-table { padding: .75rem; }
.artifact-table table { border-collapse: collapse; font-size: .8125rem; background: var(--bg); }
.artifact-table th, .artifact-table td { padding: .3125rem .625rem; border: 1px solid var(--line); text-align: left; vertical-align: top; white-space: pre-wrap; max-width: 24rem; }
.artifact-table th { position: sticky; top: 0; background: var(--rail); font-weight: 600; }
.artifact-header .artifact-action { flex: none; padding: .375rem .625rem; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; font-size: .8125rem; cursor: pointer; }
.artifact-header .artifact-action:hover { background: var(--hover); }
.live-consent { max-width: 34rem; margin: 1.5rem auto; padding: 1.125rem 1.25rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); font-size: .875rem; }
.live-consent h3 { font-size: 1rem; font-weight: 600; margin-bottom: .375rem; }
.live-consent p { margin: .375rem 0; }
.live-consent ul { margin: .25rem 0 .875rem 1.25rem; }
.live-consent li.refused { color: var(--bad); }
.live-consent .recovery-actions { display: flex; gap: .5rem; margin-bottom: .625rem; }
.live-error { color: var(--bad); }
.live-notice, .live-loading { margin: 0; padding: .75rem 1rem; font-size: .8125rem; }
.live-notice { background: var(--warn-bg); color: #715024; }
.artifact-content > .live-notice + iframe { height: calc(100% - 3rem); }
.artifact-versions { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; margin-top: .375rem; font-size: .75rem; }
.artifact-versions button { padding: .125rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: inherit; font: inherit; cursor: pointer; }
.artifact-versions button:disabled { opacity: .4; cursor: default; }
.artifact-versions button:not(:disabled):hover { background: var(--hover); }
.artifact-versions #artifact-latest { margin-left: .25rem; }

/* ---- dialogs ------------------------------------------------------------ */
dialog {
  width: min(44rem, calc(100vw - 1.5rem)); max-height: 90dvh; overflow: auto; padding: 1.75rem 2rem;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg); color: var(--ink); line-height: 1.6; box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, .4); }
dialog h2 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; margin-bottom: .5rem; }
dialog h3 { font-size: 1.0625rem; font-weight: 600; margin: 1.5rem 0 .25rem; }
dialog p { font-size: .9375rem; }
dialog .hint { font-size: .8125rem; }
#messaging-modal .connection-close { float: right; margin: -.5rem -.75rem 0 0; }
#connections-dialog .engine-intro { margin: .25rem 0 1.25rem; color: var(--ink-soft); }
#connection-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
#connections-dialog .connection-card { padding: 1rem; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
#connections-dialog .connection-card > p { margin: .25rem 0 .75rem; }
#connections-dialog .connection-card .connection-check { color: var(--ink-soft); font-size: .8125rem; overflow-wrap: anywhere; }
#connections-dialog .signin-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
#connections-dialog .signin-actions .secondary { margin: 0; }
.engine-defaults { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.engine-defaults h3 { margin-top: 0; }
.engine-preferences-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.engine-preferences-form > .hint, .engine-preferences-form > button { grid-column: 1 / -1; }
.engine-preferences-form .preference-choices { grid-column: 1 / -1; min-width: 0; margin: 0; padding: 0; border: 0; }
.preference-choices legend { margin-bottom: .5rem; font-size: .875rem; color: var(--ink-soft); }
.preference-choices .engine-choices { margin-bottom: 0; }
.preference-choices .engine-choice { min-width: 0; font: inherit; font-size: .875rem; }
.preference-choices .engine-choice span { overflow-wrap: anywhere; }
.preference-byte-avatar { width: 2rem; height: 2rem; flex: none; border-radius: 50%; object-fit: cover; }
.byte-preference-choices { max-height: 13rem; overflow-y: auto; padding: 2px; }
.inherited-engine-icon { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; flex: none; font-size: 1.25rem; }
.engine-network { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.engine-network summary { cursor: pointer; color: var(--ink-soft); font-size: .875rem; }
@media (max-width: 650px) { #connection-cards { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .engine-preferences-form { grid-template-columns: minmax(0, 1fr); } }
.connection-card { padding: 1rem 0; border-top: 1px solid var(--line); }
.connection-card:first-child { border-top: 0; }
.connection-card h3 { margin: 0 0 .125rem; }
.connection-card a { display: inline-block; font-size: .875rem; color: var(--blue); }
.connection-card code { display: block; margin: .625rem 0; padding: .5rem .75rem; border-radius: 6px; background: var(--rail); border: 1px solid var(--line); font-family: ui-monospace, Menlo, monospace; font-size: .875rem; user-select: all; }
.connection-card .secondary { width: auto; margin: 0 .5rem .5rem 0; }
.connection-check { white-space: pre-wrap; font-size: .875rem; }
.connection-check:empty { display: none; }
.connection-card details { margin-top: .25rem; }
.connection-card details .hint { margin-top: .25rem; }
.defaults-form { display: grid; gap: .75rem; margin-top: .5rem; }
.defaults-form label { display: grid; gap: .25rem; font-size: .875rem; color: var(--ink-soft); }
.defaults-form input, .defaults-form select, .defaults-form textarea, .onboarding-answer {
  width: 100%; padding: .5rem .625rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--ink); font-size: 1rem;
}
.defaults-form input:focus, .defaults-form select:focus, .defaults-form textarea:focus, .onboarding-answer:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-bg); }
.defaults-form .hint { margin: 0; }
.defaults-form > .secondary { justify-self: start; }
#connections-result:empty { display: none; }

#onboarding-dialog[open] { display: flex; flex-direction: column; max-height: 85vh; width: min(28rem, calc(100vw - 2rem)); overflow: hidden; }
#onboarding-dialog > * { flex-shrink: 0; }
#onboarding-form { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.onboarding-content { flex: 1; min-height: 0; overflow-y: auto; padding-right: .25rem; }
.onboarding-brand { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
#onboarding-faces { display: flex; gap: .25rem; }
#onboarding-faces img { width: 2rem; height: 2rem; }
#onboarding-title { margin-top: 1.25rem; }
#onboarding-title:focus { outline: none; }
#onboarding-description { color: var(--ink-soft); margin: .5rem 0 1.25rem; }
.onboarding-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-top: 1rem; border-top: 1px solid var(--line); flex-shrink: 0; }
.onboarding-actions .secondary { width: auto; }
.onboarding-next { padding: .625rem 1.25rem; border-radius: 8px; background: var(--blue); color: #fff; font-size: .9375rem; font-weight: 600; }
.onboarding-next:hover:not(:disabled) { filter: brightness(1.06); }
#onboarding-form .onboarding-privacy { margin-top: .75rem; font-size: .75rem; font-weight: 400; letter-spacing: normal; text-transform: none; }
#onboarding-result:empty { display: none; }
#onboarding-result { color: var(--bad); }

/* ---- Microsoft 365 setup: the dialog, its three steps, and the card a reply can show --------------- */
#microsoft-dialog .connection-close { float: right; margin: -.5rem -.75rem 0 0; }
.customise-ways { margin-top: 1.25rem; }
.ms-logo { width: 1.75rem; height: 1.75rem; flex: none; }
.ms-row { border-top: 0; }
.ms-live-status { overflow-wrap: anywhere; }
.connect-card {
  display: flex; align-items: center; gap: .875rem; margin: .75rem 0; padding: .875rem 1rem; max-width: 30rem;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); line-height: 1.4;
}
.connect-card > div { flex: 1; min-width: 0; }
.connect-card strong { display: block; font-size: .9375rem; }
.connect-card small { display: block; color: var(--ink-soft); font-size: .8125rem; }
.ms-brand { display: flex; align-items: center; gap: 1rem; margin-bottom: .25rem; }
.ms-brand img { width: 2.75rem; height: 2.75rem; flex: none; }
.ms-brand h2 { margin: 0; }
.ms-progress { display: flex; gap: .5rem; margin: 1.25rem 0 .5rem; padding: 0; list-style: none; }
.ms-progress li { flex: 1; display: flex; align-items: center; gap: .5rem; padding-top: .625rem; border-top: 4px solid var(--line-strong); font-size: .8125rem; color: var(--ink-faint); }
.ms-progress li span { display: inline-grid; place-items: center; width: 1.375rem; height: 1.375rem; border-radius: 50%; background: var(--hover); font-size: .75rem; font-weight: 600; }
.ms-progress li.reached { border-top-color: var(--blue); color: var(--ink); font-weight: 500; }
.ms-progress li.reached span { background: var(--blue); color: #fff; }
.ms-progress li.done span { font-size: 0; }
.ms-progress li.done span::after { content: "✓"; font-size: .75rem; }
#ms-details h3, #ms-signin h3, #ms-test h3 { margin-top: 1rem; }
#ms-details .hint { margin-top: -.5rem; }
.ms-agents { border: 0; padding: 0; margin: .25rem 0 0; min-width: 0; }
.ms-agents legend { font-size: .875rem; color: var(--ink-soft); padding: 0; margin-bottom: .375rem; }
#ms-agents { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.defaults-form .ms-agent { display: inline-flex; align-items: center; gap: .5rem; padding: .375rem .75rem .375rem .5rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); font-size: .875rem; cursor: pointer; }
.defaults-form .ms-agent input { width: auto; }
.ms-agent:has(input:checked) { border-color: var(--blue); background: var(--blue-bg); }
.ms-face { width: 1.375rem; height: 1.375rem; }
.ms-banner { display: block; margin: .75rem 0; padding: .625rem .875rem; border-radius: 8px; background: var(--blue-bg); font-size: .875rem; line-height: 1.5; }
.ms-banner.good { background: color-mix(in srgb, var(--good) 14%, transparent); }
.ms-banner.warn { background: var(--warn-bg); }
.ms-code {
  margin: 1rem 0 .25rem; padding: .875rem 1rem; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--rail);
  font: 650 2rem/1.2 ui-monospace, Menlo, monospace; letter-spacing: .18em; text-align: center; user-select: all;
}
.ms-code-actions a { text-decoration: none; }
.ms-howto { margin: 1rem 0 0; padding-left: 1.25rem; font-size: .9375rem; }
.ms-howto li { margin: .125rem 0; }
.ms-wait { margin-top: .75rem; color: var(--ink-soft); }
.ms-wait:empty, .ms-status:empty { display: none; }
.ms-status { margin-top: .75rem; color: var(--bad); }
.ms-steps { margin: .75rem 0 0; padding: 0; list-style: none; }
.ms-check { display: flex; gap: .75rem; padding: .625rem 0; border-top: 1px solid var(--line); }
.ms-check:first-child { border-top: 0; }
.ms-check strong { display: block; font-size: .9375rem; font-weight: 550; }
.ms-check small { display: block; color: var(--ink-soft); font-size: .8125rem; }
.ms-mark { display: inline-grid; place-items: center; flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--hover); color: var(--ink-soft); font-weight: 700; font-size: .8125rem; }
.ms-check.ok .ms-mark { background: var(--good); color: #fff; }
.ms-check.bad .ms-mark { background: var(--bad); color: #fff; }
.ms-facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: .75rem 0 0; font-size: .875rem; }
.ms-facts dt { color: var(--ink-soft); }
.ms-facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---- narrow screens --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
@media (min-width: 1600px) { :root { --details-w: 320px; } }
@media (max-width: 1120px) {
  .shell, .shell.artifact-open { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .details, .artifact-panel { display: none; }
  .shell.show-details .details, .shell.artifact-open .artifact-panel {
    display: flex; position: absolute; right: 0; top: var(--header-h); bottom: 0; z-index: 4;
    width: min(var(--details-w), calc(100vw - var(--sidebar-w))); box-shadow: var(--shadow);
  }
  .shell.artifact-open .artifact-panel { width: min(42rem, calc(100vw - var(--sidebar-w))); }
}
@media (max-width: 700px) {
  :root { --header-h: 3.75rem; }
  .shell, .shell.hide-details, .shell.new-chat, .shell.artifact-open { display: flex; }
  .conversation { width: 100%; }
  .icon-button.mobile-only { display: inline-grid; }
  .sidebar { display: none; position: absolute; left: 0; top: 0; bottom: 0; z-index: 6; width: min(18rem, 85vw); box-shadow: var(--shadow); }
  .shell.show-agents .sidebar { display: flex; }
  /* A scrim behind the drawer: tap it to put the drawer away. */
  .shell.show-agents .conversation::before { content: ""; position: absolute; inset: 0; z-index: 5; background: rgba(0, 0, 0, .3); }
  .chat-header { padding: .5rem .75rem; gap: .5rem; }
  .chat-header .agent-trigger { flex-basis: 0; }
  .chat-actions { flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; padding: .125rem 0; }
  .chat-actions > button { flex: none; }
  .chat-header .avatar { width: 2.25rem; height: 2.25rem; }
  .timeline { padding: .75rem .75rem 1rem; }
  .message-content, .message.user .message-content { max-width: calc(100% - 3rem); }
  .activity { padding-left: 0; }
  .welcome { padding-top: 2rem; }
  .welcome h2 { font-size: 1.5rem; }
  .suggestions { gap: .375rem; }
  .suggestion { padding: .625rem .75rem; font-size: .8125rem; }
  .composer-wrap { padding: .375rem .625rem .625rem; }
  .runtime-picker select { max-width: 6.5rem; }
  .model-picker > summary { max-width: 8rem; }
  .shell.show-details .details, .shell.artifact-open .artifact-panel { width: 100%; }
  .shell.show-details .composer-wrap { display: none; }
  .recipient-options, #new-chat-result, .notice { width: calc(100% - 1.25rem); }
  .artifact-card { width: 7.75rem; }
  .artifact-thumb { height: 6rem; }
  dialog { padding: 1.25rem 1rem; }
  dialog h2 { font-size: 1.25rem; }
}

.share-command { white-space: pre-wrap; overflow-wrap: anywhere; }

.signin-portal { margin: .75rem 0; }
.signin-links { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.signin-code { display: flex; flex-wrap: wrap; gap: .5rem; }
.signin-code input { min-width: 0; flex: 1 1 14rem; padding: .5rem .625rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--ink); }
#update-notes { white-space: pre-wrap; }

#share-history p { overflow-wrap: anywhere; }
/* Every other menu: flat with a drawn chevron. Left native, macOS draws a gradient button with up/down arrows. */
:where(select:not(#runtime)) {
  padding: .5rem .625rem; border: 1px solid var(--line-strong); border-radius: 6px; background-color: var(--bg); color: var(--ink); font-size: 1rem;
}
select:not(#runtime) {
  appearance: none; -webkit-appearance: none; padding-right: 2rem; cursor: pointer; max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: .625rem auto;
}
.onboarding-question select { width: 100%; }
.setup-later-note { margin: .5rem 0 1.25rem; }
/* Engine choice: one card per engine with its official mark. The mark sits on a white tile so dark marks read in dark mode. */
.engine-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.engine-choice { display: flex; align-items: center; gap: .625rem; padding: .625rem .75rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); color: var(--ink); text-align: left; cursor: pointer; }
.engine-choice:hover:not(:disabled) { background: var(--hover); }
.engine-choice[aria-checked="true"] { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); background: var(--blue-bg); }
.engine-choice:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.engine-choice-text { display: grid; min-width: 0; }
.engine-choice-text strong { font-size: .9375rem; font-weight: 600; }
.engine-choice-text small { color: var(--ink-soft); font-size: .75rem; }
.engine-logo { flex: none; width: 1.75rem; height: 1.75rem; padding: .25rem; border-radius: 6px; background: #fff; border: 1px solid var(--line); object-fit: contain; }
.engine-heading { display: flex; align-items: center; gap: .5rem; }
.engine-heading .engine-logo { width: 1.5rem; height: 1.5rem; }
.signin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
/* Composer menu: the highlighted row follows the arrow keys; a coloured tag says what each option is. */
.prompt-option { display: flex; align-items: center; gap: .625rem; }
.prompt-option-text { flex: 1; min-width: 0; }
.prompt-option.active { background: var(--hover); }
.prompt-tag { flex: none; padding: .0625rem .375rem; border-radius: 4px; font-size: .6875rem; font-weight: 600; letter-spacing: .01em; }
.kind-skill { --kind: #7c3aed; } .kind-command { --kind: #2563eb; } .kind-page { --kind: #0f766e; } .kind-note { --kind: #15803d; } .kind-file { --kind: #6b7280; }
@media (prefers-color-scheme: dark) { .kind-skill { --kind: #a78bfa; } .kind-command { --kind: #60a5fa; } .kind-page { --kind: #2dd4bf; } .kind-note { --kind: #4ade80; } .kind-file { --kind: #9ca3af; } }
.prompt-option .prompt-tag, .composer-chip .prompt-tag { color: var(--kind); background: color-mix(in srgb, var(--kind) 14%, transparent); }
.message-skill { color: var(--kind); background: color-mix(in srgb, var(--kind) 14%, transparent); padding: .125rem .375rem; border-radius: 4px; font-weight: 600; }
.prompt-option[class*="kind-"] > .prompt-option-text strong { color: var(--kind); }
.composer-chip { display: inline-flex; align-items: center; gap: .375rem; max-width: 100%; padding: .1875rem .5rem .1875rem .25rem; border: 1px solid color-mix(in srgb, var(--kind) 35%, transparent); border-radius: 999px; font-size: .8125rem; color: var(--ink); }
.composer-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- routines: the panel list and detail, proposal and missed-run cards, the run divider ---- */
.routine-icon, .routine-mark { display: inline-grid; place-items: center; flex: none; }
.routine-icon svg, .routine-mark svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.routine-mark { color: var(--ink-faint); }
.routine-list { margin-top: .5rem; }
.routine-item { display: flex; align-items: flex-start; gap: .625rem; width: 100%; padding: .5rem .375rem; margin: 0 -.375rem; border-radius: 6px; text-align: left; }
.routine-item:hover { background: var(--hover); }
.routine-item > .routine-icon { margin-top: .1875rem; color: var(--ink-soft); }
.routine-item.paused > .routine-icon, .routine-item.paused strong { color: var(--ink-faint); }
.routine-text { flex: 1; min-width: 0; }
.routine-text strong { display: block; font-size: .875rem; font-weight: 600; overflow-wrap: anywhere; }
.routine-text small { display: block; font-size: .8125rem; line-height: 1.45; color: var(--ink-soft); }
.routine-text .routine-next { color: var(--ink-faint); }
.routine-failed, .routine-text .routine-failed { color: var(--bad); }
.routine-chevron { flex: none; align-self: center; color: var(--ink-faint); font-size: 1.125rem; }
/* The detail replaces the rest of the panel, like opening a page; the panel heading stays. */
.routine-view { display: none; }
.details.routine-open > :not(.detail-heading):not(.routine-view) { display: none; }
.details.routine-open > .routine-view { display: block; margin-top: .75rem; }
.routine-view-head { display: flex; align-items: center; gap: .375rem; margin: 0 0 .75rem -.5rem; }
.routine-view-head h3 { flex: 1; min-width: 0; font-size: 1.0625rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.routine-status { flex: none; padding: .0625rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 500; background: var(--hover); color: var(--good); }
.routine-status.paused { color: var(--ink-soft); }
.routine-facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: 0 0 1rem; font-size: .8125rem; line-height: 1.5; }
.routine-facts dt { color: var(--ink-faint); }
.routine-facts dd { margin: 0; overflow-wrap: anywhere; }
.routine-missed { margin: 0 0 1rem; padding: .5rem .75rem; border-radius: 6px; background: var(--warn-bg); color: #715024; font-size: .8125rem; line-height: 1.5; }
@media (prefers-color-scheme: dark) { .routine-missed { color: #e2c48c; } }
.routine-label { padding: 0; margin-bottom: .375rem; }
.routine-view .routine-instruction { padding: .625rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.routine-instruction.plain { white-space: pre-wrap; }
.routine-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.routine-actions .secondary, .detail-section .routine-actions .secondary { width: auto; margin: 0; }
.routine-actions .secondary.primary-action { min-height: 2.125rem; padding: .375rem .875rem; border-radius: 6px; }
.secondary.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.secondary.danger:hover:not(:disabled) { background: var(--bad-bg); }
.routine-confirm { margin-top: 1rem; padding: .75rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); }
.routine-confirm p { font-size: .875rem; line-height: 1.5; }
.routine-confirm .routine-actions { margin-top: .75rem; }
.routine-error { margin-top: .625rem; font-size: .8125rem; line-height: 1.5; color: var(--bad); }
.routine-error:empty { display: none; }
.routine-note { margin-top: .625rem; }
.routine-form { display: grid; gap: .75rem; }
.routine-field { display: grid; gap: .25rem; font-size: .8125rem; color: var(--ink-soft); }
.routine-field input, .routine-field textarea, .routine-field select { width: 100%; min-width: 0; padding: .4375rem .625rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--ink); font-size: .875rem; }
.routine-field textarea { resize: vertical; line-height: 1.5; }
.routine-field input[type="time"] { color-scheme: light dark; }
.routine-when { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .75rem; }
.routine-days { display: flex; flex-wrap: wrap; gap: .375rem; margin: 0; padding: 0; border: 0; }
.routine-days legend { padding: 0; margin-bottom: .25rem; font-size: .8125rem; color: var(--ink-soft); }
.day-chip { position: relative; }
.day-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.day-chip span { display: inline-block; min-width: 2.75rem; padding: .25rem .5rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); text-align: center; font-size: .8125rem; color: var(--ink-soft); }
.day-chip input:checked + span { border-color: var(--blue); background: var(--blue-bg); color: var(--ink); font-weight: 500; }
.day-chip input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.routine-form .routine-actions { margin-top: 0; }
/* Cards under the conversation: calm like the recovery card, one per proposal or missed run. */
.routine-cards { width: 100%; }
.routine-cards:empty { display: none; }
.routine-card { margin: 1rem auto; max-width: var(--column); padding: 1rem 1.125rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--rail); }
.routine-card h3 { display: flex; align-items: center; gap: .5rem; font-size: 1rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.routine-card h3 .routine-icon { color: var(--blue); }
.routine-card.missed h3 .routine-icon { color: var(--warn); }
.routine-card-when { margin: .125rem 0 .625rem 1.5rem; font-size: .875rem; color: var(--ink-soft); }
.routine-card-instruction { margin-bottom: .875rem; }
.routine-card .routine-instruction { padding: .625rem .75rem; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: .875rem; line-height: 1.6; overflow-wrap: anywhere; }
.routine-instruction.clamped { max-height: 8.5rem; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.routine-more { margin-top: .375rem; font-size: .8125rem; color: var(--blue); }
.routine-more:hover { text-decoration: underline; }
.routine-card .recovery-note { margin: .75rem 0 0; }
.routine-saved { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; max-width: var(--column); margin: 1rem auto; padding: .5rem .875rem; border-radius: 8px; background: var(--hover); font-size: .875rem; color: var(--good); }
.routine-saved .routine-more { margin: 0 0 0 auto; }
/* A run's opening line: a quiet rule with the routine's name in the middle. */
.message.system.routine-divider { align-items: center; gap: .75rem; margin: 1.75rem 0 1rem; }
.message.system.routine-divider::before, .message.system.routine-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.routine-divider-label { display: inline-flex; align-items: center; gap: .375rem; max-width: 80%; padding: .125rem .5rem; border-radius: 999px; font-size: .8125rem; color: var(--ink-soft); white-space: normal; }
button.routine-divider-label:hover { background: var(--hover); color: var(--ink); }

/* Projects: a warm, spacious home for a team's conversations. */
.project-nav { flex: 1 1 auto; min-height: 12rem; }
.projects-mode .sidebar { overflow: hidden; }
.projects-mode .sidebar > :not(.project-nav) { flex: none; }
.projects-mode .project-nav { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.projects-mode .project-nav-heading, .projects-mode .all-projects { flex: none; }
.projects-mode .project-nav-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-top: .25rem; }
/* Enlarged text or a short window may need the chrome itself to scroll. */
.projects-mode.project-navigation-overflow .sidebar { overflow-y: auto; overflow-x: hidden; }
.projects-mode.project-navigation-overflow .project-nav { flex: none; overflow: visible; }
.projects-mode.project-navigation-overflow .project-nav-scroll { flex: none; height: 6rem; min-height: 6rem; overscroll-behavior: auto; }
.project-nav-heading { display: flex; align-items: center; justify-content: space-between; gap: .375rem; margin-bottom: .25rem; }
.project-nav-heading .section-label { flex: 1; }
.project-nav-heading .icon-button { width: 1.75rem; height: 1.75rem; font-size: 1.125rem; }
.project-nav-heading .section-label span { float: none; margin-left: .5rem; }
.project-group { margin: .1875rem 0; }
.project-group-row { display: flex; align-items: center; gap: .0625rem; min-width: 0; border-radius: 8px; }
.project-group.selected > .project-group-row { background: var(--hover); }
.project-group .project-button { flex: 1; min-width: 0; padding: .4375rem .1875rem; margin: 0; gap: .5rem; }
.project-group .project-button:hover { background: transparent; }
.project-group .project-mark { width: 1.625rem; height: 1.625rem; font-size: .9375rem; border-radius: 6px; }
.project-disclosure, .project-pin { display: inline-grid; place-items: center; flex: none; width: 1.625rem; height: 1.875rem; border-radius: 5px; color: var(--ink-faint); font-size: 1rem; }
.project-disclosure:hover, .project-pin:hover { background: var(--hover); color: var(--ink); }
.project-pin { opacity: 0; margin-right: .1875rem; }
.project-pin svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.project-pin[aria-pressed="true"] { opacity: 1; color: #a27454; }
.project-group-row:hover .project-pin, .project-pin:focus-visible, .project-pin:disabled { opacity: 1; }
.project-group-threads { margin: .25rem .25rem .625rem .875rem; padding: .125rem 0 .125rem .625rem; border-left: 1px solid var(--line-strong); }
.project-group-threads .project-thread-button { gap: .5rem; padding: .4375rem .5rem; }
.project-group-add { display: block; width: 100%; padding: .4375rem .5rem; text-align: left; color: var(--ink-faint); font-size: .6875rem; border-radius: 6px; margin-top: .125rem; }
.project-group-add:hover { background: var(--hover); color: var(--ink); }
.project-group-status { font-size: .6875rem; padding: .25rem .5rem; overflow-wrap: anywhere; }
.project-retry.secondary { min-height: 1.5rem; padding: .125rem .375rem; font-size: .6875rem; margin: .375rem 0 0; display: block; }
.projects-hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .625rem; }
.projects-hero-actions > .secondary:not(.primary-action) { font-size: .8125rem; }
.routing-controls { display: block; margin: 0 0 .5rem; font-size: .6875rem; color: var(--ink-soft); }
.routing-controls label { white-space: nowrap; }
.routing-controls select { padding: .25rem 1.5rem .25rem .5rem; min-height: 1.75rem; font-size: .6875rem; border-color: var(--line); background-position: right .5rem center; }
.project-auto-setting { margin: .25rem .25rem .625rem; padding: .75rem 0 .5rem; border-top: 1px solid var(--line); background: transparent; }
.project-auto-setting label { display: flex; align-items: center; gap: .75rem; cursor: pointer; }
.project-auto-setting label > span:first-child { flex: 1; min-width: 0; }
.project-auto-setting strong { display: block; font-size: .75rem; font-weight: 600; }
.project-auto-setting small { display: block; margin-top: .2rem; font-size: .6875rem; color: var(--ink-soft); }
.project-auto-setting p { margin: .375rem 0 0; font-size: .625rem; line-height: 1.5; color: var(--ink-faint); }
.project-auto-help { margin-top: .375rem; font-size: .625rem; color: var(--ink-soft); }
.project-auto-help > summary { width: fit-content; cursor: pointer; }
.project-auto-setting input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.project-switch { flex: none; width: 2.125rem; height: 1.25rem; padding: 3px; border-radius: 1rem; background: var(--line-strong); transition: background .15s; }
.project-switch::after { content: ""; display: block; width: .875rem; height: .875rem; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0002; transition: transform .15s; }
.project-auto-setting input:checked + .project-switch { background: #687b64; }
.project-auto-setting input:checked + .project-switch::after { transform: translateX(.875rem); }
.project-auto-setting input:focus-visible + .project-switch { outline: 2px solid var(--ink); outline-offset: 3px; }
.routing-controls > summary { cursor: pointer; font-size: .6875rem; padding: .25rem 0; }
.routing-options { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .5rem 0; }
.routing-options > span { flex-basis: 100%; color: var(--ink-faint); }
.project-tools, .project-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .625rem; }
.project-tools { justify-content: space-between; margin-top: 1rem; }
.project-header-actions .secondary { font-size: .75rem; }

.team-review { flex: none; min-width: 0; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--rail) 35%, var(--bg)); }
.team-review > summary { display: flex; align-items: center; gap: .5rem; min-height: 2.125rem; padding: .375rem 1.25rem; cursor: pointer; list-style: none; font-size: .75rem; color: var(--ink-soft); }
.team-review > summary::-webkit-details-marker { display: none; }
.team-review > summary::after { content: "⌄"; flex: none; font-size: .9375rem; color: var(--ink-faint); }
.team-review[open] > summary::after { transform: rotate(180deg); }
.team-review > summary:hover { background: var(--hover); }
.team-review-symbol { color: #a0825f; }
.team-review-label { color: var(--ink); font-weight: 500; }
#team-review-state { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#team-review-action { margin-left: auto; flex: none; font-size: .6875rem; }
.team-review.has-review #team-review-state { padding: .0625rem .4375rem; border-radius: 999px; color: #95764e; background: #f4ede0; }
.team-review.has-review #team-review-action { color: var(--ink); font-weight: 500; }
.team-review[open] > summary { border-bottom: 1px solid var(--line); }
.team-decisions { max-height: min(44dvh, 30rem); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: .75rem 1rem; }
.team-decision-card { max-width: 58rem; margin: 0 auto .625rem; padding: 1rem 1.125rem; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; }
.team-decision-card:last-child { margin-bottom: 0; }
.team-decision-heading { display: flex; align-items: center; gap: .5rem; }
.team-decision-heading h3 { font-size: .9375rem; font-weight: 600; line-height: 1.4; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.decision-symbol { color: #a0825f; font-size: 1.125rem; }
.decision-badge { flex: none; border-radius: 999px; padding: .125rem .5rem; background: var(--rail); color: var(--ink-soft); font-size: .625rem; font-weight: 500; white-space: nowrap; }
.decision-badge.pending { background: #f4ede0; color: #95764e; }
.decision-badge.accepted { background: #edf2eb; color: #667d5c; }
.decision-source { font-size: .6875rem; color: var(--ink-faint); margin: .125rem 0 .5rem 1.625rem; }
.decision-rationale { font-size: .8125rem; line-height: 1.65; color: var(--ink-soft); margin: .5rem 0 .75rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.decision-assignments { display: grid; gap: .625rem; }
.decision-assignment { display: flex; align-items: flex-start; gap: .625rem; padding: .625rem .75rem; border-radius: 8px; background: var(--rail); }
.decision-assignment > img { width: 1.875rem; height: 1.875rem; flex: none; }
.decision-assignment > div { min-width: 0; }
.decision-assignment strong { font-size: .75rem; font-weight: 600; }
.decision-assignment p { font-size: .75rem; line-height: 1.6; color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.decision-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .875rem; }
.decision-actions .secondary { font-size: .75rem; min-height: 2rem; padding: .375rem .625rem; }
.decision-actions .primary-action { min-height: 2.125rem; padding: .4375rem .75rem; }
.routing-provider, .routing-fallback { margin: .625rem 0 0; font-size: .6875rem; line-height: 1.55; color: var(--ink-faint); overflow-wrap: anywhere; }
.routing-fallback { color: #9b7751; padding: .4375rem .625rem; border-radius: 6px; background: color-mix(in srgb, var(--warn-bg) 55%, transparent); }
.routing-advice-note { max-width: 58rem; margin: 0 auto .625rem; }
.decision-receipts { margin-top: .75rem; padding-top: .5rem; border-top: 1px solid var(--line); display: grid; gap: .375rem; }
.decision-receipt { display: flex; align-items: center; gap: .5rem; font-size: .6875rem; color: var(--ink-soft); }
.receipt-status { color: var(--good); width: 1rem; text-align: center; }
.receipt-status.status-failed { color: var(--bad); }
.receipt-link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.receipt-link:hover { color: var(--blue); }
.decision-history { max-width: 58rem; margin: 0 auto; }
.decision-history > summary { cursor: pointer; font-size: .75rem; color: var(--ink-soft); padding: .25rem .125rem; }
.decision-history-list { margin-top: .75rem; }
.recommended-project { padding: .875rem; border: 1px solid var(--line); border-radius: 8px; background: var(--rail); }
.recommended-project > strong { display: block; font-size: .875rem; font-weight: 600; }
.recommended-project > p { font-size: .75rem; color: var(--ink-soft); line-height: 1.6; margin: .375rem 0 .625rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.recommended-project .team-avatars { vertical-align: middle; margin-right: .5rem; }
.recommended-project > small { font-size: .6875rem; color: var(--ink-soft); }
.decision-review-note { margin-top: .75rem; font-size: .6875rem; color: var(--ink-faint); line-height: 1.6; }
.team-decision-card > .project-form-error { margin-top: .75rem; }
.routing-edit-assignments { display: grid; gap: .875rem; }
.routing-edit-assignment { display: grid; gap: .75rem; padding: 1rem; background: var(--rail); border: 1px solid var(--line); border-radius: 8px; }
.routing-edit-assignment > .secondary { justify-self: end; font-size: .75rem; min-height: 1.75rem; padding: .25rem .5rem; }
@media (hover: none) { .project-pin { opacity: 1; } }
@media (prefers-color-scheme: dark) { .decision-badge.pending, .team-review.has-review #team-review-state { background: #3a3021; color: #c9ad82; } .decision-badge.accepted { background: #293727; color: #a8c09d; } }
@media (max-width: 700px) { .team-review > summary { padding: .5rem .875rem; gap: .375rem; font-size: .6875rem; } .team-decisions { padding: .625rem .75rem; max-height: 40dvh; } .team-decision-card { padding: .875rem; } .team-decision-heading { flex-wrap: wrap; } .decision-badge { margin-left: 1.5rem; } .projects-hero-actions { align-items: flex-start; flex-direction: column; } }
@media (max-height: 620px) { .projects-mode .project-sidebar-note, .projects-mode .service-privacy { display: none; } }
@media (max-height: 480px) { .projects-mode .sidebar { padding-top: .5rem; } .projects-mode .sidebar-heading { margin-bottom: .25rem; } .projects-mode .search { margin-bottom: .5rem; } }
.all-projects { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .5rem .625rem; border-radius: 7px; text-align: left; color: var(--ink-soft); }
.all-projects span { font-size: .875rem; }
.all-projects:hover, .all-projects.selected { background: var(--hover); color: var(--ink); }
.project-button { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .5rem .625rem; border-radius: 8px; text-align: left; margin: .125rem 0; }
.project-button > span:last-child { flex: 1; min-width: 0; font-size: .875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-button:hover, .project-button.selected { background: var(--hover); }
.project-button.selected { box-shadow: inset 2px 0 #a27454; }
.project-mark { display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 8px; background: #f0e5d9; color: #906b4d; font: 600 1.0625rem/1 ui-serif, Georgia, serif; }
.project-colour-1 { background: #e6ede5; color: #617a64; }
.project-colour-2 { background: #e9e7f0; color: #7a6d96; }
.project-colour-3 { background: #e5ecf0; color: #5a798a; }
#project-thread-section { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .75rem; }
.project-thread-button { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .5rem .625rem; border-radius: 7px; text-align: left; margin: .125rem 0; }
.project-thread-button:hover, .project-thread-button.selected { background: var(--hover); }
.project-thread-icon { color: var(--ink-faint); font-size: 1.125rem; flex: none; }
.project-thread-text { flex: 1; min-width: 0; display: grid; gap: .125rem; }
.project-thread-text strong { font-size: .8125rem; font-weight: 500; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-thread-text small { color: var(--ink-faint); font-size: .6875rem; line-height: 1.4; }
.project-sidebar-note { padding: 1.75rem .75rem 1.25rem; color: var(--ink-faint); font: italic .875rem/1.8 ui-serif, Georgia, serif; }
.agent-config-label { font-size: .6875rem; color: var(--ink-soft); padding: .25rem; margin-left: .125rem; white-space: nowrap; }
.chat-header .secondary { min-height: 2.125rem; font-size: .75rem; padding: .375rem .625rem; }
.chat-header .thread-rename { margin-left: 0; }
.chat-header #move-to-project { flex: none; white-space: nowrap; }
.project-workspace { flex: 1; min-height: 0; overflow-y: auto; padding: 1.25rem clamp(1.25rem, 4vw, 4rem) 3rem; background: linear-gradient(145deg, #fbf9f5 0%, var(--bg) 55%); }
.project-workspace-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; max-width: 66rem; margin: 0 auto; min-height: 2.5rem; }
#project-workspace-content { max-width: 66rem; margin: 0 auto; }
.project-back { display: inline-block; font-size: .8125rem; color: var(--ink-soft); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-back:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.projects-hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.75rem 0; }
.projects-hero .eyebrow { color: #9b7659; font-size: .625rem; letter-spacing: .14em; }
.projects-hero h1 { font: 500 clamp(1.75rem, 3vw, 2.5rem)/1.2 ui-serif, Georgia, "Times New Roman", serif; letter-spacing: -.045em; white-space: pre-line; }
.projects-hero > p { max-width: 29rem; margin: 1.125rem 0 1.625rem; font-size: .9375rem; line-height: 1.75; color: var(--ink-soft); }
.project-empty { position: relative; display: grid; align-content: center; justify-items: center; min-height: 17rem; padding: 2rem; text-align: center; border: 1px dashed var(--line-strong); border-radius: 16px; background: color-mix(in srgb, var(--rail) 45%, transparent); }
.project-empty h2 { font: 500 1.375rem/1.4 ui-serif, Georgia, serif; letter-spacing: -.025em; }
.project-empty p { max-width: 29rem; margin-top: .625rem; color: var(--ink-soft); font-size: .875rem; line-height: 1.7; }
.project-empty-sketch { position: relative; width: 7rem; height: 5.5rem; margin-bottom: 1.25rem; }
.sketch-page, .sketch-note { position: absolute; display: grid; place-items: center; border: 1px solid #e2d9cd; border-radius: 9px; background: #faf6ef; color: #ad8966; box-shadow: 0 6px 12px #6b4c2610; }
.sketch-page { width: 4rem; height: 4.75rem; left: .875rem; top: .125rem; transform: rotate(-9deg); font-size: 1.75rem; }
.sketch-note { width: 3rem; height: 2.75rem; right: .125rem; bottom: .25rem; transform: rotate(10deg); background: #edf1e9; color: #74866d; font-size: 1.25rem; }
.sketch-dot { position: absolute; width: .5rem; height: .5rem; border-radius: 50%; background: #d6a06d; right: .875rem; top: 0; }
.project-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 1.125rem; }
.project-conversation-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.project-section-heading h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.02em; }
.project-section-heading p { margin-top: .1875rem; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: 1rem; }
.project-card { display: flex; flex-direction: column; gap: .625rem; padding: 1.375rem; min-width: 0; min-height: 14.5rem; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); text-align: left; transition: transform .15s, box-shadow .15s, border-color .15s; }
.project-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px #44331b0b; border-color: #b7a38e; }
.project-card-top { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-bottom: .25rem; }
.project-card-top .project-mark { width: 2.5rem; height: 2.5rem; border-radius: 9px; font-size: 1.25rem; }
.project-card-arrow { color: var(--ink-faint); font-size: 1.125rem; }
.project-card > strong { font-size: 1.0625rem; font-weight: 600; line-height: 1.4; letter-spacing: -.02em; overflow-wrap: anywhere; }
.project-card-brief { color: var(--ink-soft); font-size: .8125rem; line-height: 1.65; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.project-card-footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: auto; padding-top: 1rem; width: 100%; }
.project-card-footer > span:last-child { font-size: .6875rem; color: var(--ink-faint); }
.team-avatars { display: inline-flex; align-items: center; flex: none; padding-left: .25rem; }
.team-avatars img, .team-overflow { display: grid; place-items: center; width: 1.875rem; height: 1.875rem; border: 2px solid var(--bg); border-radius: 50%; margin-left: -.25rem; background: var(--rail); }
.team-overflow { font-size: .625rem; color: var(--ink-soft); }
.project-hero { padding: 1.5rem 0; border-bottom: 1px solid var(--line-strong); }
.project-hero-heading { display: flex; align-items: center; gap: 1rem; }
.project-hero-heading > .project-mark { width: 3.5rem; height: 3.5rem; border-radius: 12px; font-size: 1.75rem; }
.project-hero-heading > div { flex: 1; min-width: 0; }
.project-hero-heading .eyebrow { font-size: .625rem; margin-bottom: .125rem; }
.project-hero h1 { font: 500 clamp(1.75rem, 3vw, 2.75rem)/1.2 ui-serif, Georgia, serif; letter-spacing: -.04em; overflow-wrap: anywhere; }
.project-hero-heading .secondary { font-size: .8125rem; }
.project-brief { max-width: 44rem; margin-top: 1.375rem; font-size: .9375rem; line-height: 1.75; color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.project-shared-context > summary { cursor: pointer; }
.project-conversations { margin-top: 2rem; }
.project-conversations .primary-action { font-size: .8125rem; }
.project-conversation-list { border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--bg); }
.project-conversation-card { display: flex; align-items: center; gap: .875rem; width: 100%; padding: 1.125rem 1.25rem; text-align: left; border-bottom: 1px solid var(--line); }
.project-conversation-card:last-child { border-bottom: 0; }
.project-conversation-card:hover { background: var(--rail); }
.project-conversation-card .project-thread-icon { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 8px; color: #8a795e; background: #f4f0e9; }
.project-conversation-card .project-thread-text strong { font-size: .9375rem; font-weight: 500; }
.project-conversation-card .project-thread-text small { font-size: .75rem; color: var(--ink-soft); }
.project-thread-date { font-size: .75rem; color: var(--ink-faint); white-space: nowrap; }
.project-thread-arrow { margin-left: .5rem; color: var(--ink-faint); }
.project-conversations-empty { padding: 2.75rem 1.5rem; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; }
.project-empty-symbol { display: block; color: #a58b69; font-size: 1.75rem; margin-bottom: .5rem; }
.project-conversations-empty h3 { font-size: 1rem; font-weight: 500; }
.project-conversations-empty > p { max-width: 26rem; margin: .5rem auto 1.125rem; color: var(--ink-soft); font-size: .8125rem; line-height: 1.7; }
.project-conversations-empty .secondary { font-size: .8125rem; }
.project-context { flex: none; display: flex; align-items: center; gap: 1.125rem; padding: .75rem 1.5rem; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--rail) 55%, var(--bg)); }
.project-context > .project-back { flex: 0 1 12rem; }
#project-context-copy { display: grid; flex: 1; min-width: 0; gap: .125rem; }
#project-context-copy strong { font-size: .75rem; font-weight: 500; }
#project-context-copy > span { color: var(--ink-soft); font-size: .6875rem; line-height: 1.45; }
#project-context-copy .project-readonly { color: var(--bad); }
.project-dialog { width: min(35rem, 100% - 2rem); max-height: min(90dvh, 54rem); padding: 2rem; scroll-padding-block: 1rem 6rem; }
.project-dialog > form[method="dialog"] .connection-close { position: absolute; right: 1rem; top: 1rem; }
.project-dialog > .eyebrow { margin-bottom: .5rem; padding-right: 1rem; color: #a07756; font-size: .625rem; letter-spacing: .11em; }
.project-dialog-intro { margin-top: .375rem; margin-bottom: 1.5rem; }
.project-form { display: grid; gap: 1.25rem; }
.project-context-settings { border-top: 1px solid var(--line); padding-top: 1rem; }
.project-context-settings > summary { cursor: pointer; font-size: .8125rem; font-weight: 500; padding: .25rem 0; }
.project-context-settings > summary .optional { margin-left: .5rem; }
.project-context-settings-fields { display: grid; gap: 1.25rem; padding-top: 1rem; }
.project-edit-impact { flex-basis: 100%; margin: 0; font-size: .75rem; line-height: 1.55; }
.project-field { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .375rem; font-size: .8125rem; font-weight: 500; }
.project-field > input, .project-field > textarea, .project-field > select { width: 100%; min-width: 0; padding: .625rem .75rem; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--bg); font-size: .875rem; color: var(--ink); font-weight: 400; }
.project-field > textarea { resize: vertical; line-height: 1.6; }
.project-field .hint { font-size: .75rem; font-weight: 400; }
.optional { font-size: .6875rem; font-weight: 400; color: var(--ink-faint); }
.project-members, .project-thread-mode { margin: 0; padding: 0; border: 0; min-width: 0; }
.project-members legend, .project-thread-mode legend { font-size: .8125rem; font-weight: 500; margin-bottom: .375rem; padding: 0; width: 100%; }
.project-members legend span { float: right; color: var(--ink-faint); font-size: .6875rem; font-weight: 400; }
.project-members > .hint { margin-bottom: .75rem; font-size: .75rem; }
.project-member-options { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; max-height: 16rem; overflow-y: auto; padding: 2px; }
.project-member { display: flex; align-items: center; gap: .5rem; padding: .75rem .625rem; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; min-width: 0; }
.project-member:hover { background: var(--rail); }
.project-member:has(input:checked) { background: #f5f3ed; border-color: #b7a38b; }
.project-member input { accent-color: #806b50; flex: none; width: .875rem; height: .875rem; margin: 0; }
.project-member > img { width: 2rem; height: 2rem; flex: none; }
.project-member > span { display: grid; min-width: 0; gap: .0625rem; }
.project-member strong { font-size: .8125rem; line-height: 1.3; font-weight: 500; overflow-wrap: anywhere; }
.project-member small { font-size: .625rem; line-height: 1.4; color: var(--ink-soft); overflow-wrap: anywhere; }
.project-form .dialog-actions { margin-top: 0; }
#project-form > .dialog-actions { position: sticky; bottom: 0; z-index: 1; padding: 1rem 0 .25rem; border-top: 1px solid var(--line); background: var(--bg); box-shadow: 0 3rem 0 var(--bg), 0 -1rem 1rem var(--bg); }
.project-form-error { color: var(--bad); font-size: .8125rem; line-height: 1.55; }
.project-form-error:empty { display: none; }
.project-knowledge-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin: 1.25rem 0 .75rem; }
.project-knowledge-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin: 1.25rem 0 .5rem; }
.project-knowledge-heading h3, .project-knowledge-section-title { margin: 0; font-size: .8125rem; font-weight: 500; }
.project-knowledge-section-title { margin-top: 1.5rem; }
.project-context-library { padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.project-context-library > .hint { font-size: .75rem; }
.project-context-library .project-knowledge-list { max-height: 24dvh; }
.project-context-title { display: block; font-size: .8125rem; font-weight: 500; overflow-wrap: anywhere; }
.project-context-link.unavailable small { color: var(--bad); }
.project-context-decisions { margin: .75rem 0 1rem; font-size: .75rem; color: var(--ink-soft); }
.project-context-decisions > summary { cursor: pointer; }
.project-context-decisions ol { max-height: 20dvh; overflow-y: auto; overscroll-behavior: contain; padding-left: 1.25rem; margin: .5rem 0 0; }
.project-context-decisions li { margin-bottom: .75rem; overflow-wrap: anywhere; }
.project-context-decisions li:last-child { margin-bottom: 0; }
.project-context-decisions strong { font-weight: 500; }
.project-context-decisions p { margin: .125rem 0; }
.project-context-decisions small { font-size: .625rem; color: var(--ink-faint); }
.project-knowledge-list { list-style: none; padding: 0; margin: .75rem 0 1rem; max-height: 40dvh; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; }
.project-knowledge-file { display: flex; align-items: center; gap: .75rem; padding: .875rem; border-bottom: 1px solid var(--line); }
.project-knowledge-file:last-child { border-bottom: 0; }
.project-knowledge-file > div { flex: 1; min-width: 0; }
.project-knowledge-download { display: block; font-size: .8125rem; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.project-knowledge-file small { display: block; font-size: .6875rem; color: var(--ink-faint); margin-top: .125rem; }
.project-knowledge-file .secondary { flex: none; font-size: .75rem; }
.project-knowledge-empty { padding: 1rem; line-height: 1.65; }
#project-knowledge-status:empty { display: none; }
#project-knowledge-error { margin-top: .75rem; }
.thread-kind { display: flex; align-items: center; gap: .75rem; padding: .875rem 1rem; border: 1px solid var(--line-strong); border-radius: 8px; margin-top: .5rem; cursor: pointer; }
.thread-kind:has(input:checked) { background: #f5f3ed; border-color: #b7a38b; }
.thread-kind:has(input:disabled) { opacity: .5; cursor: default; }
.thread-kind input { accent-color: #806b50; margin: 0; }
.thread-kind > span:first-of-type { flex: 1; display: grid; }
.thread-kind strong { font-size: .875rem; font-weight: 500; }
.thread-kind small { font-size: .75rem; color: var(--ink-soft); }
.thread-kind > span:last-child { color: #9b8267; }
@media (prefers-reduced-motion: reduce) { .project-card { transition: none; } .project-card:hover { transform: none; } }
@media (prefers-color-scheme: dark) {
  .project-workspace { background: linear-gradient(145deg, #25221e 0%, var(--bg) 60%); }
  .project-mark { background: #3c3329; color: #c8ab85; }
  .project-colour-1 { background: #2e3b30; color: #a7bca4; } .project-colour-2 { background: #343040; color: #b4a8c8; } .project-colour-3 { background: #293a42; color: #9fb9c5; }
  .project-member:has(input:checked), .thread-kind:has(input:checked) { background: #2e2a24; border-color: #8f7d66; }
  .project-conversation-card .project-thread-icon { background: #302b25; color: #b4a083; }
  .sketch-page { background: #302a22; border-color: #514638; color: #c8ab85; } .sketch-note { background: #293327; border-color: #46503f; color: #a7bca4; }
}
@media (max-width: 900px) { .agent-config-label { display: none; } .project-context { gap: .75rem; padding: .625rem 1rem; } .project-context > .project-back { flex-basis: 9rem; } .project-context .team-avatars { display: none; } }
@media (max-width: 700px) {
  .project-disclosure, .project-pin { width: 2.75rem; height: 2.75rem; }
  .project-pin { opacity: 1; color: var(--ink-soft); }
  .project-group .project-button, .project-group-add { min-height: 2.75rem; }
  .project-nav-heading .icon-button { width: 2.75rem; height: 2.75rem; }
  .project-workspace { padding: .75rem 1.25rem 2rem; }
  .project-workspace-toolbar { margin: 0 -.375rem; }
  .projects-hero { padding-top: 2rem; }
  .projects-hero h1 { font-size: 2rem; }
  .project-hero { padding-top: 1.5rem; }
  .project-hero-heading { gap: .75rem; flex-wrap: wrap; }
  .project-hero-heading > div { flex-basis: calc(100% - 4.5rem); }
  .project-hero-heading > .secondary { margin: .5rem 0 0; }
  .project-section-heading { align-items: flex-start; flex-wrap: wrap; gap: .75rem; }
  .project-context { align-items: flex-start; flex-direction: column; gap: .25rem; }
  .project-context > .project-back { flex-basis: auto; max-width: 100%; }
  #project-context-copy > span { font-size: .6875rem; }
  .project-thread-date { display: none; }
  .project-conversation-card { padding: .875rem; gap: .625rem; }
  .project-dialog { padding: 1.5rem; }
  .project-member-options { grid-template-columns: 1fr; max-height: 15rem; }
  .project-empty { padding: 2rem 1rem; min-height: 18rem; }
}

.browser-progress { min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browser-activity { position: relative; flex: none; border-bottom: 1px solid var(--line); padding: .4rem .75rem; font-size: .8rem; }
.browser-activity summary { cursor: pointer; }
.browser-activity ol { position: absolute; z-index: 2; left: 0; right: 0; background: var(--bg, white); box-shadow: 0 4px 8px #0002; max-height: 140px; overflow-y: auto; padding: 0; margin: .4rem 0 0; list-style: none; }
.browser-activity li { display: flex; gap: .4rem; align-items: baseline; padding: .2rem 0; overflow-wrap: anywhere; }
.browser-activity time { flex: none; color: var(--muted); font-size: .7rem; }
.browser-activity [data-status="running"] { font-weight: 600; }
.browser-activity [data-status="handoff"], .browser-activity [data-status="in_flight"], .browser-activity [data-status="error"] { color: #9a5b10; }

.browser-window-controls { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.browser-viewport { position: relative; }
.browser-viewport img { user-select: none; -webkit-user-select: none; touch-action: none; }
.browser-input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: .01; resize: none; pointer-events: none; }
.browser-click-feedback { position: absolute; width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; background: #ffffff60; }
.shell.browser-expanded #browser-panel { position: fixed; inset: 0; z-index: 50; border: 0; width: 100%; }
.shell.browser-expanded .browser-viewport { max-width: 1600px; width: 100%; align-self: center; }

/* Native website content is an OS view positioned over this viewport. */
.native-browser #browser-screen, .native-browser #browser-input, .native-browser #browser-click-feedback { display: none; }
.browser-mode-bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line, #e7e7e5); flex-wrap: wrap; }
.browser-mode-badge { font-size: 11px; font-weight: 650; padding: 5px 8px; background: #f1f1ed; border-radius: 6px; white-space: nowrap; }
.browser-mode-badge[data-mode="chrome"] { background: #e8f0e9; color: #2e5841; }
.browser-mode-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.browser-mode-actions button { padding: 6px 9px; font-size: 11px; }
.browser-signin { margin: 12px 16px 0; padding: 12px; border: 1px solid #d8e2d6; border-radius: 10px; background: #f5f8f2; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.browser-signin strong { font-size: 12px; }
.browser-signin p { font-size: 12px; line-height: 1.5; color: #5d6659; margin: 4px 0 0; }
.browser-signin button { font-size: 11px; white-space: nowrap; }
.browser-empty { min-height: 260px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 32px 24px; color: #76766e; }
.browser-empty > span { font-size: 28px; color: #85877b; margin-bottom: 12px; }
.browser-empty h3 { font-size: 16px; color: #36372f; margin: 0 0 10px; }
.browser-empty p { font-size: 13px; line-height: 1.65; max-width: 300px; margin: 0; }
.browser-chrome-dialog { width: min(520px, calc(100vw - 32px)); box-sizing: border-box; }
.browser-chrome-dialog > p { font-size: 13px; line-height: 1.65; }
.browser-setup-steps { padding-left: 22px; margin: 20px 0; }
.browser-setup-steps li { margin: 16px 0; padding-left: 6px; font-size: 13px; }
.browser-setup-steps strong, .browser-setup-steps span { display: block; }
.browser-setup-steps span { color: #76766e; line-height: 1.6; margin-top: 4px; }
.browser-access-note { padding-top: 12px; border-top: 1px solid var(--line, #e7e7e5); }
.browser-signin[hidden], .browser-empty[hidden] { display: none; }
@media (max-width: 600px) { .browser-mode-bar { padding: 8px 10px; } .browser-signin { margin-inline: 10px; } }
.native-browser .browser-activity ol { position: static; box-shadow: none; }

.browser-panel.browser-actual-size .browser-viewport { overflow: auto; }
.browser-panel.browser-actual-size #browser-screen { width: auto; max-width: none; }

.project-brief { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
/* Conversation participation stays separate from the project's available Byte roster. */
.participation-add, .participation-manage { min-height: 2.75rem; white-space: nowrap; font-size: .75rem; }
.conversation-collaboration { flex: none; max-height: min(32dvh, 17rem); overflow-y: auto; border-bottom: 1px solid var(--line); padding: .625rem 1.5rem; background: color-mix(in srgb, var(--rail) 25%, var(--bg)); }
.collaboration-section-label { display: block; margin-bottom: .25rem; color: var(--ink-faint); font-size: .625rem; text-transform: uppercase; letter-spacing: .06em; }
.conversation-contribution { display: flex; align-items: center; gap: .625rem; padding: .25rem 0; min-width: 0; }
.conversation-contribution > .avatar { width: 1.75rem; height: 1.75rem; flex: none; }
.conversation-contribution > div { min-width: 0; flex: 1; font-size: .75rem; }
.conversation-contribution details > summary { cursor: pointer; color: var(--ink-soft); font-weight: 500; }
.conversation-contribution details > p { margin: .375rem 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .75rem; }
.conversation-contribution > button { min-height: 2.75rem; flex: none; font-size: .6875rem; }
.collaboration-suggestion { padding: .625rem .75rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--bg); }
.collaboration-suggestion + .collaboration-suggestion { margin-top: .5rem; }
.collaboration-suggestion > strong { font-size: .75rem; }
.collaboration-suggestion > p, .collaboration-suggestion li { margin: .25rem 0; font-size: .75rem; color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.collaboration-suggestion > ul { padding-left: 1.125rem; margin: .375rem 0; }
.collaboration-suggestion button { min-height: 2.75rem; }
.collaboration-dialog h3 { margin-top: 1.25rem; }
.collaboration-dialog #collaboration-mode-help { margin-top: .375rem; }
.collaboration-current, .collaboration-options { display: grid; gap: .5rem; }
.collaboration-person { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .75rem; border: 1px solid var(--line); border-radius: .75rem; }
.collaboration-person-identity { display: flex; align-items: center; min-width: 0; flex: 1 1 12rem; gap: .625rem; font-size: .8125rem; }
.collaboration-person-identity > .avatar { width: 2rem; height: 2rem; flex: none; }
.collaboration-person-identity > div { min-width: 0; }
.collaboration-person-identity strong, .collaboration-person-identity small { display: block; overflow-wrap: anywhere; }
.collaboration-person-identity small { margin-top: .125rem; font-size: .6875rem; color: var(--ink-soft); }
.collaboration-person-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; }
.collaboration-person-actions button { min-height: 2.75rem; font-size: .6875rem; }
.collaboration-person-actions small, .collaboration-coordinator { font-size: .6875rem; color: var(--ink-soft); }
.collaboration-search { margin: 1.25rem 0 .75rem; }
.composer-helpers { display: flex; flex-wrap: wrap; gap: .375rem; margin: .125rem .25rem .5rem; }
.composer-helper { display: inline-flex; min-width: 0; align-items: center; gap: .375rem; padding: .125rem .25rem .125rem .5rem; border: 1px solid var(--line); border-radius: .625rem; font-size: .75rem; background: var(--rail); }
.composer-helper .prompt-tag, .prompt-option.kind-byte .prompt-tag { color: #456c83; background: color-mix(in srgb, #85b5ce 20%, var(--bg)); }
.composer-helper.unavailable { color: var(--bad); }
.composer-helper button { min-height: 2rem; min-width: 2rem; border: 0; border-radius: .375rem; background: transparent; color: inherit; cursor: pointer; }
.composer-helper button:hover { background: var(--hover); }
@media (max-width: 700px) {
  .chat-header .participation-add { padding: .375rem .5rem; font-size: .6875rem; }
  .project-context > .participation-manage { flex: none; padding: .375rem .5rem; font-size: .6875rem; }
  .conversation-collaboration { padding: .5rem .75rem; }
  .conversation-contribution { flex-wrap: wrap; }
  .conversation-contribution > button { margin-left: 2.375rem; min-height: 2.5rem; }
  .collaboration-person { padding: .625rem; }
  .collaboration-person-identity { flex-basis: 100%; }
  .collaboration-person-actions { width: 100%; }
  .collaboration-person-actions button { flex: 1; }
  .composer-helper button { min-width: 2.75rem; min-height: 2.75rem; }
}

:root { --topbar-h: 3.75rem; --sidebar-w: 252px; }
@media (prefers-color-scheme: light) {
  :root { --ink: #24343c; --ink-soft: #738087; --ink-faint: #8c969a; --rail: #f7f8f6; --line: #e7eae7; --line-strong: #dce4df; --bubble-you: #263b35; --blue: #54766b; --blue-bg: #eaf1ed; }
}
.app-topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 2.5rem; padding: 0 1.5rem; border-bottom: 1px solid var(--line); background: var(--bg); }
.app-brand { text-decoration: none; font-size: 1.35rem; font-weight: 750; letter-spacing: -.06em; }
.app-brand span { color: #dfad72; font-size: .55rem; vertical-align: top; margin-left: .25rem; }
.app-navigation { display: flex; align-self: stretch; gap: 1.75rem; }
.app-navigation button { position: relative; color: var(--ink-soft); font-size: .875rem; padding: 0 .25rem; }
.app-navigation button[aria-current] { color: var(--ink); font-weight: 650; }
.app-navigation button[aria-current]::after { content: ""; position: absolute; height: 2px; bottom: 0; left: .25rem; right: .25rem; background: var(--good); }
.app-local { margin-left: auto; color: var(--ink-faint); font-size: .75rem; }
.shell { height: calc(100dvh - var(--topbar-h)); }
.sidebar { padding: 1.25rem .75rem 0; gap: .25rem; }
.sidebar-heading { padding: 0 .5rem; margin-bottom: .5rem; justify-content: space-between; }
.sidebar-heading .section-label { padding: 0; font-size: .625rem; letter-spacing: .12em; }
.new-chat-button { background: var(--bg); border: 1px solid var(--line-strong); border-radius: 9px; text-align: left; padding: .6rem .75rem; margin: 0 .25rem .875rem; font-size: .8125rem; font-weight: 600; box-shadow: 0 1px 2px #00000004; }
.new-chat-button:hover { background: var(--hover); }
.search { background: transparent; padding: .35rem .5rem; margin-bottom: .75rem; }
.search input { font-size: .8125rem; }
#agents { flex: none; overflow: visible; min-height: 0; padding: .125rem 0 .75rem; }
#bytes-label, .project-nav-heading { margin-top: .5rem; }
#bytes-tab, #projects-tab { font: inherit; letter-spacing: inherit; text-align: left; }
.agent-button { padding: .5rem .625rem; gap: .625rem; }
.agent-button img { width: 2.125rem; height: 2.125rem; }
.agent-button strong { font-size: .8125rem; }
.agent-button small { font-size: .6875rem; }
.agent-button.selected { background: var(--blue-bg); }
.project-nav { flex: none; overflow: visible; min-height: 0; }
.project-nav-scroll, .projects-mode .project-nav-scroll { overflow: visible; flex: none; min-height: 0; }
.project-nav-heading { padding: 0 .25rem; }
.project-nav-heading .section-label { flex: 1; }
.project-group-row { gap: 0; }
.project-button { gap: .5rem; padding: .4rem .25rem; }
.project-button > span:last-child { font-size: .8125rem; }
.project-group.selected > .project-group-row { border-radius: 8px; background: var(--blue-bg); }
.project-disclosure { width: 1rem; }
.project-pin { width: 1.5rem; }
.project-thread-button { font-size: .75rem; }
.project-thread-text small { font-size: .625rem; }
.sidebar-footer { margin-top: auto; border: 0; padding: 1.25rem .5rem; }
.sidebar-footnote { font-size: .6875rem; color: var(--ink-faint); }
.room-avatar, .project-mark.room-avatar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; width: 2.25rem; height: 2.25rem; padding: .125rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); overflow: hidden; align-items: center; }
.room-avatar img { width: 100%; height: 100%; min-height: 0; object-fit: contain; margin: 0; border: 0; border-radius: 0; }
.room-avatar img:only-child { grid-column: 1 / -1; grid-row: 1 / -1; }
.room-avatar img:nth-child(3):last-child { grid-column: 1 / -1; width: 50%; justify-self: center; }
.project-thread-icon.avatar { width: 1.75rem; height: 1.75rem; }
.project-thread-icon.room-avatar { width: 1.75rem; height: 1.75rem; }
.project-hero-heading > .room-avatar { width: 3.5rem; height: 3.5rem; }
#header-room-avatar { width: 2.75rem; height: 2.75rem; flex: none; }
.chat-header { min-height: 5rem; border-bottom: 1px solid var(--line); padding: .875rem 1.75rem; gap: .5rem; }
.chat-header .secondary { padding: .375rem .625rem; font-size: .75rem; min-height: 2rem; border-color: var(--line); }
.header-identity #agent-name { font-size: 1rem; }
.agent-config-label { display: none; }
.project-context { background: transparent; padding: .5rem 1.75rem; }
.project-context-copy { min-width: 0; }
.timeline { padding-top: 1.5rem; }
.composer-wrap { padding-bottom: 1.25rem; }
#composer { border-radius: 14px; box-shadow: 0 3px 15px #00000004; }
.new-chat-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; justify-content: space-between; padding: 2rem; }
.new-chat-heading h1 { font-size: 1.5rem; letter-spacing: -.04em; }
.workspace-surface { min-width: 0; min-height: 0; overflow: auto; background: var(--bg); }
#brain-surface { display: flex; }
#brain-frame { width: 100%; height: 100%; border: 0; }
.shell[data-area="brain"], .shell[data-area="settings"] { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.shell[data-area="brain"] > .details, .shell[data-area="settings"] > .details,
.shell[data-area="brain"] > .artifact-panel, .shell[data-area="settings"] > .artifact-panel,
.shell[data-area="brain"] > .details-resizer, .shell[data-area="settings"] > .details-resizer { display: none; }
.shell[data-area="brain"] .sidebar > :not(.sidebar-heading):not(#brain-navigation):not(.sidebar-footer),
.shell[data-area="settings"] .sidebar > :not(.sidebar-heading):not(#settings-navigation):not(.sidebar-footer) { display: none; }
.context-navigation { display: grid; gap: .25rem; }
.context-navigation button { width: 100%; padding: .65rem .75rem; text-align: left; border-radius: 8px; color: var(--ink-soft); font-size: .8125rem; }
.context-navigation button:hover, .context-navigation button[aria-current] { background: var(--blue-bg); color: var(--ink); }
.context-navigation .section-label { margin: 1.5rem 0 .5rem; }
.context-navigation .brain-byte-link { display: flex; align-items: center; gap: .5rem; }
.brain-byte-link img { width: 1.75rem; height: 1.75rem; }
.settings-content { max-width: 54rem; margin: 0 auto; padding: 3rem 3.5rem; }
.settings-content h1 { font-size: 2rem; line-height: 1.25; letter-spacing: -.04em; margin: .5rem 0 .75rem; }
.settings-content h2 { font-size: 1rem; }
.settings-content h3 { margin-top: 1.75rem; font-size: .9375rem; }
.settings-content > section { margin-top: 2rem; }
.settings-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.settings-tag { font-size: .6875rem; color: var(--ink-soft); border: 1px solid var(--line); padding: .2rem .5rem; border-radius: 5px; }
#settings-microsoft .ms-row { margin-top: 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 12px; }
#settings-navigation > button, #settings-navigation > a { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .65rem .75rem; text-align: left; text-decoration: none; border-radius: 8px; color: var(--ink-soft); font-size: .8125rem; }
#settings-navigation > a:hover { background: var(--blue-bg); color: var(--ink); }
.settings-navigation-divider { height: 1px; background: var(--line); margin: .75rem; }
#update-button-label:not(:empty) { margin-left: auto; padding: .125rem .375rem; border-radius: 4px; background: var(--blue-bg); color: var(--ink-soft); font-size: .625rem; font-weight: 500; }
#settings-engines #connection-cards { display: grid; gap: .75rem; margin-top: 1.25rem; }
#settings-engines .connection-card { margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; }
#settings-engines .connection-card h3 { margin-top: 0; }
#settings-engines .defaults-form { border: 1px solid var(--line); padding: 1.25rem; border-radius: 12px; margin-top: .75rem; }
#settings-engines select, #settings-engines input { max-width: 100%; min-width: 0; }
#connections-result { margin-top: 1rem; color: var(--good); }
#ms-advanced { padding: .875rem; background: var(--rail); border: 1px solid var(--line); border-radius: 8px; }
#ms-advanced summary { cursor: pointer; font-size: .8125rem; font-weight: 600; }
#ms-advanced label { margin-top: .875rem; }
.context-tabs { display: flex; border-bottom: 1px solid var(--line); margin: .75rem 0 1rem; }
.context-tabs button { flex: 1; font-size: .6875rem; padding: .625rem .125rem; white-space: nowrap; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.context-tabs button[aria-selected="true"] { border-bottom-color: var(--good); color: var(--ink); }
.context-panel { display: none; }
.details[data-context="files"] .context-files, .details[data-context="instructions"] .context-instructions, .details[data-context="activity"] .context-activity { display: block; }
.room-context .context-instructions .charter { display: none; }
.room-instructions-copy { font-size: .8125rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: .75rem 0; }
#room-instructions .secondary { width: 100%; margin-top: .5rem; font-size: .75rem; }
.details .context-panel .detail-section:first-child { padding-top: .25rem; }
@media (max-width: 1100px) {
  .chat-header { padding: .75rem 1rem; flex-wrap: wrap; }
  .agent-trigger { flex: 1 1 45%; }
  .settings-content { padding: 2.5rem 2rem; }
}
@media (max-width: 700px) {
  .app-topbar { padding: 0 1rem; gap: 1.5rem; }
  .app-navigation { gap: 1rem; }
  .app-local { display: none; }
  #app-show-navigation { margin-left: auto; }
  .shell[data-area="brain"], .shell[data-area="settings"] { grid-template-columns: minmax(0, 1fr); }
  .shell.show-agents[data-area="brain"] .sidebar, .shell.show-agents[data-area="settings"] .sidebar { display: flex; }
  .chat-header { gap: .375rem; padding: .75rem; }
  .chat-header .agent-trigger { flex: 1 1 calc(100% - 3rem); }
  .chat-header .secondary { font-size: .6875rem; }
  .project-context { padding: .5rem .75rem; flex-wrap: wrap; }
  .project-context #project-context-team { margin-left: 0; }
  .settings-content { padding: 2rem 1.25rem; }
  .settings-content h1 { font-size: 1.65rem; }
  .settings-section-heading { flex-wrap: wrap; gap: .5rem; }
  .new-chat-heading { padding: 1.5rem 1rem; }
  .new-chat-heading h1 { font-size: 1.25rem; }
  .shell.show-details .details, .shell.artifact-open .artifact-panel { top: 0; height: 100%; }
  .app-topbar .icon-button.mobile-only { display: inline-grid; }
  .shell.show-agents::after { content: ""; position: absolute; inset: 0; background: #0003; z-index: 5; }
  .shell.show-agents .sidebar { z-index: 6; }
}
#messages, .activity, .permissions, #recovery-card, .welcome { max-width: 50rem; }
#composer { max-width: 50rem; margin-inline: auto; }
#context-activity .conversation-contributions { display: grid; gap: .75rem; padding: 1rem 0; }
#context-activity .conversation-contribution { flex-wrap: wrap; }
#context-activity .conversation-contribution > div { flex: 1; min-width: 0; }
#context-activity .conversation-contribution .avatar { width: 1.75rem; height: 1.75rem; }
#context-activity > .secondary { font-size: .75rem; width: 100%; }
.engine-default-badge { margin-left: auto; font-weight: 400; }
.sidebar { overflow: hidden; }
#agents { max-height: 36vh; overflow-y: auto; flex-shrink: 0; }
.project-nav { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 6rem; overflow: hidden; }
.project-nav-scroll, .projects-mode .project-nav-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.project-navigation-overflow .sidebar { overflow-y: auto; }
.project-navigation-overflow .project-nav { flex: none; min-height: 8rem; }
@media (max-width: 700px) {
  .project-disclosure, .project-pin { width: 2.75rem; height: 2.75rem; flex: none; }
  .project-nav-heading .icon-button { min-width: 2.75rem; min-height: 2.75rem; }
  .sidebar-heading { flex-shrink: 0; }
}
.gateway-form { margin-top: 1rem; }
.gateway-form h5 { margin: .875rem 0 .25rem; font-size: .875rem; }
.gateway-form details { margin: .75rem 0; }
.gateway-form summary { cursor: pointer; }
.gateway-choices { max-height: 15rem; overflow-y: auto; }
.gateway-form .gateway-choice { display: flex; align-items: center; gap: .625rem; padding: .5rem 0; }
.gateway-form .gateway-choice input { flex: none; width: 1rem; height: 1rem; margin: 0; }
.gateway-create { display: inline-block; width: fit-content; text-decoration: none; }
.gateway-qr { display: block; max-width: 100%; height: auto; margin: 1rem auto; }
.gateway-pairing { text-align: center; padding: 1rem 0; }
.gateway-pairing h3 { margin: 0 0 .75rem; }
.gateway-settings { margin-top: 1rem; }

#bytes-label { display: flex; align-items: center; gap: .5rem; padding-right: .25rem; }
#bytes-label > #bytes-tab { flex: 1; }
#bytes-label > .icon-button { width: 2rem; height: 2rem; font-size: 1.25rem; font-weight: 400; letter-spacing: 0; }
.chat-title-group { flex: 1; min-width: 0; display: grid; gap: .125rem; }
.chat-title-group .agent-trigger { width: 100%; min-width: 0; }
.chat-title-group > .project-back { justify-self: start; padding: 0; margin-left: 3.5rem; font-size: .6875rem; color: var(--ink-soft); }
.chat-header .thread-rename { margin-left: 0; }
.chat-header > .secondary { flex: none; }
#conversation-participants { font-size: .75rem; }
#open-review { color: var(--warn); border-color: var(--line); background: var(--warn-bg); }
.conversation-options { position: relative; flex: none; }
.conversation-options > summary { display: grid; place-items: center; cursor: pointer; padding: .25rem; list-style: none; border-radius: 8px; }
.conversation-options > summary::-webkit-details-marker { display: none; }
.conversation-options-panel { position: absolute; right: 0; top: 100%; z-index: 8; min-width: 12rem; padding: .5rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); box-shadow: var(--shadow); }
.conversation-options-panel button { display: block; width: 100%; text-align: left; }
.conversation-options-label { display: block; padding: .375rem .5rem; font-size: .6875rem; color: var(--ink-soft); }
.conversation-options > summary:hover { background: var(--hover); }
#context-instructions #project-context { padding: .75rem 0; margin-bottom: 1rem; flex-direction: column; align-items: start; border: 0; border-bottom: 1px solid var(--line); }
#context-activity .team-review { margin: 0; border: 0; }
#context-activity .team-review > summary { flex-wrap: wrap; padding: .5rem 0; }
#context-activity .team-decisions { padding: .75rem 0; max-height: none; }
#context-activity .team-decision-card { padding: .875rem; }
#context-activity .decision-actions { flex-wrap: wrap; }
.reply-picker .model-popover { width: min(22rem, 85vw); }
.reply-picker .routing-controls { display: grid; gap: .625rem; padding: .875rem; }
.reply-picker .routing-controls label { font-weight: 600; }
.reply-picker #message-routing-mode { max-width: 100%; }
.reply-picker #message-routing-help { font-size: .75rem; line-height: 1.5; }
.file-folder { margin: .25rem 0; }
.file-folder > summary { cursor: pointer; font-size: .8125rem; padding: .375rem .25rem; overflow-wrap: anywhere; }
.file-folder-children { margin-left: .625rem; padding-left: .5rem; border-left: 1px solid var(--line); }
.file-tree .file-link { width: 100%; padding: .5rem .25rem; }
.file-tree .file-link > span:last-child { min-width: 0; overflow-wrap: anywhere; font-size: .8125rem; }
.room-context .file-drop { min-height: 0; padding: .5rem; margin-bottom: .5rem; font-size: .75rem; border-style: solid; }
@media (max-width: 700px) {
  .chat-header { flex-wrap: wrap; }
  .chat-title-group { flex-basis: 100%; }
  .chat-title-group > .project-back { margin-left: 3rem; }
  #bytes-label > .icon-button { width: 2.75rem; height: 2.75rem; }
}
/* Browser verification stays readable without repeating the same warning. */
.recovery-card.browser-recovery { padding: 0; border: 0; background: transparent; }
.browser-recovery-options > summary, .browser-notice summary { color: var(--ink-soft); font-size: .8125rem; cursor: pointer; padding: .375rem 0; }
.browser-recovery-options[open] { padding: .75rem; border: 1px solid var(--line); border-radius: 8px; }
.browser-recovery-options .recovery-actions { margin-top: .5rem; }
.message.system.browser-notice { padding: 0; border: 0; background: transparent; }
.browser-notice details { min-width: 0; width: 100%; }
.browser-notice p { padding: .5rem .75rem; border-left: 2px solid var(--line-strong); background: var(--rail); }

/* Browser chrome stays compact; the website gets the available space. */
.browser-panel { background: var(--rail); }
.browser-panel .browser-header { flex: none; min-height: 3.25rem; flex-wrap: wrap; gap: .375rem; padding: .5rem .75rem; border-bottom: 0; }
.browser-heading { display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 0; }
.browser-heading > svg { color: var(--ink-soft); flex: none; }
.browser-heading strong { font-size: .8125rem; font-weight: 600; flex: none; }
.browser-heading .browser-mode-badge { padding: 0; background: transparent; font-size: .6875rem; font-weight: 400; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; max-width: 9rem; }
.browser-heading .browser-mode-badge[data-mode="chrome"] { background: transparent; color: var(--ink-soft); }
.browser-header .browser-window-controls { margin-left: 0; }
.browser-header .browser-mode-actions { margin-left: auto; gap: .25rem; flex: none; }
.browser-header .icon-button, .browser-toolbar button { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: .375rem; border-radius: 7px; flex: none; color: var(--ink-soft); }
.browser-header .icon-button:hover, .browser-toolbar button:hover:not(:disabled) { color: var(--ink); background: var(--hover); }
.browser-header .secondary { min-height: 2.25rem; padding: .375rem .5rem; font-size: .6875rem; }
.browser-toolbar { flex: none; align-items: center; gap: .5rem; padding: 0 .75rem .625rem; border-bottom: 1px solid var(--line); }
.browser-navigation { display: flex; align-items: center; gap: .125rem; flex: none; }
.browser-location { display: flex; align-items: center; flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; padding: .125rem; transition: border-color 150ms; }
.browser-location:focus-within { border-color: var(--blue); outline: 2px solid var(--blue-bg); }
.browser-toolbar .browser-location input { width: 100%; min-width: 0; border: 0; border-radius: 8px; padding: .375rem .625rem; background: transparent; font-size: .8125rem; line-height: 1.5; outline: none; }
.browser-location > button { width: 1.875rem; height: 1.875rem; margin-right: .125rem; }
.browser-panel > .hint:empty { display: none; }
.browser-panel > .browser-progress { margin: 0; padding: .375rem .875rem; font-size: .75rem; border-bottom: 1px solid var(--line); }
.browser-viewport { min-height: 0; }
.browser-empty { min-height: 0; height: 100%; gap: .5rem; color: var(--ink-soft); }
.browser-empty > svg { width: 2.5rem; height: 2.5rem; margin-bottom: .5rem; opacity: .6; }
.browser-empty h3 { font-size: 1rem; color: var(--ink); }
.browser-empty p { font-size: .8125rem; }
.browser-activity { padding: .25rem .75rem; border-bottom: 0; border-top: 1px solid var(--line); background: var(--rail); font-size: .6875rem; color: var(--ink-soft); }
.browser-activity summary { padding: .125rem 0; width: fit-content; }
.browser-activity ol { top: auto; bottom: 100%; left: .5rem; right: .5rem; margin: 0 0 .375rem; padding: .5rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); box-shadow: var(--shadow); max-height: 12rem; }
.browser-activity li { padding: .375rem .25rem; font-size: .75rem; }
.browser-activity time { color: var(--ink-soft); font-size: .6875rem; }
.native-browser .browser-activity ol { position: static; margin: .5rem 0; max-height: 9rem; }
@media (max-width: 700px) {
  .browser-panel .browser-header { padding: .375rem .5rem; }
  .browser-toolbar { padding: 0 .5rem .5rem; gap: .25rem; }
  .browser-header .icon-button, .browser-toolbar button { width: 44px; height: 44px; }
  .browser-heading .browser-mode-badge { max-width: 5rem; }
  .browser-header .secondary { min-height: 44px; }
  .browser-toolbar .browser-location input { font-size: 1rem; padding: .375rem; }
  .browser-location > button { width: 44px; }
  .browser-activity summary { min-height: 32px; display: flex; align-items: center; gap: .375rem; }
}
@media (prefers-reduced-motion: reduce) { .browser-location { transition: none; } }

.browser-activity summary { display: flex; align-items: center; gap: .375rem; list-style: none; }
.browser-activity summary::-webkit-details-marker { display: none; }
.browser-activity[open] > summary svg { transform: rotate(180deg); }


.chat-header > .chat-actions { display: flex; flex-wrap: nowrap; flex: none; max-width: none; overflow: visible; padding: 0; }
@media (max-width: 1120px) { .shell.artifact-open .artifact-panel { top: 0; height: 100%; } }

.room-file-browser { padding: .5rem 0 1rem; border-bottom: 1px solid var(--line); }
.room-file-browser > .section-label { padding: 0; font-size: .625rem; }
.room-file-browser > h3 { margin: .375rem 0 .875rem; font-size: 1rem; overflow-wrap: anywhere; }
.room-file-tools { display: flex; align-items: center; gap: .375rem; }
.room-file-tools input { min-width: 0; width: 100%; flex: 1; border: 1px solid var(--line-strong); border-radius: 8px; padding: .5rem .625rem; background: var(--bg); color: var(--ink); font-size: .8125rem; }
.room-file-tools .secondary { flex: none; padding: .5rem; font-size: .6875rem; }
.room-folders { margin-top: .875rem; }
.room-folders > summary { cursor: pointer; font-size: .75rem; color: var(--ink-soft); padding: .375rem 0; }
.room-conversation-folder { display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 2.5rem; padding: .5rem; border-radius: 7px; color: var(--ink-soft); text-align: left; font-size: .8125rem; }
.room-conversation-folder > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.room-conversation-folder:hover, .room-conversation-folder[aria-current] { color: var(--ink); background: var(--blue-bg); }
.room-folder-icon { display: flex; flex: none; width: 1.125rem; height: 1.125rem; }
.room-folder-icon svg { width: 100%; height: 100%; }
#room-conversation-folders > .hint { padding: .5rem; }
#room-conversation-folders { max-height: 12rem; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 700px) { .room-file-tools .secondary, .room-conversation-folder { min-height: 44px; } }
.sidebar-heading #sidebar-title { flex: 1; }
#open-search { display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; }
#sidebar-search { flex: none; margin-bottom: .75rem; }
.memory-pill:empty { display: none; }
@media (max-width: 700px) { #open-search { width: 44px; height: 44px; } }
.sidebar-entity { display: flex; align-items: center; min-width: 0; }
.sidebar-entity > .agent-button, .sidebar-entity > .thread-button { flex: 1; min-width: 0; }
.entity-more { flex: none; display: grid; place-items: center; width: 1.75rem; height: 2rem; padding: 0; border-radius: 6px; color: var(--ink-soft); opacity: 0; }
.sidebar-entity:hover > .entity-more, .project-group-row:hover > .entity-more, .entity-more:focus-visible, .sidebar-entity:focus-within > .entity-more { opacity: 1; }
.entity-more:hover { background: var(--hover); }
#entity-context-menu { position: fixed; z-index: 100; margin: 0; padding: .375rem; width: min(15rem, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--ink); box-shadow: var(--shadow); }
#entity-context-menu .context-menu-title { display: block; padding: .375rem .625rem; font-size: .6875rem; color: var(--ink-soft); overflow-wrap: anywhere; }
#entity-context-menu button { display: block; width: 100%; min-height: 2.25rem; padding: .5rem .625rem; border-radius: 6px; font-size: .8125rem; text-align: left; }
#entity-context-menu button:hover, #entity-context-menu button:focus-visible { background: var(--hover); outline: none; }
#entity-context-menu .destructive { color: var(--bad); }
.trash-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .875rem 0; border-bottom: 1px solid var(--line); }
.trash-item > span { min-width: 0; overflow-wrap: anywhere; }
.trash-item strong, .trash-item small { display: block; }
.trash-item small { color: var(--ink-soft); font-size: .75rem; margin-top: .25rem; }
#trash-items { margin-top: 1rem; }
@media (hover: none) { .entity-more { opacity: 1; } }
@media (max-width: 700px) { .entity-more { width: 44px; height: 44px; } #entity-context-menu button { min-height: 44px; } }
.project-group-row > .project-button { flex: 1; min-width: 0; padding-left: .5rem; }

.activity-steps { margin-top: .25rem; }
.activity-steps summary { cursor: pointer; }
.activity-step-list { margin-top: .35rem; border-left: 1px solid var(--line); padding-left: .75rem; }
.activity-step { padding: .2rem 0; }
.activity-step summary { overflow-wrap: anywhere; }
.activity-step-status { margin-left: .75rem; font-size: .75rem; color: var(--ink-soft); }
.activity-step[data-status="failed"] .activity-step-status { color: var(--danger); }
.activity-step pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: .35rem 0; font-size: .75rem; }
.recovery-advanced { border-top: 1px solid var(--line); margin-top: .75rem; padding-top: .75rem; }

.connector-form { display: grid; gap: 10px; min-width: 0; }
.connector-form input:not([type=checkbox]), .connector-form select, .connector-form textarea { width: 100%; box-sizing: border-box; min-width: 0; border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; background: var(--paper, #fff); }
.connector-form textarea { font-family: ui-monospace, monospace; }
.connector-card { border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 12px 0; min-width: 0; }
.connector-heading, .connector-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.connector-heading { justify-content: space-between; margin-bottom: 16px; }
.connector-identity strong { overflow-wrap: anywhere; }
.connector-identity .connector-logo { flex: none; }
.connector-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--ink-soft); font-size: .8125rem; flex: none; }
.connector-toggle input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border: 0; border-radius: 20px; background: var(--line-strong); position: relative; cursor: pointer; margin: 0; }
.connector-toggle input::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px #0002; transition: transform .15s; }
.connector-toggle input:checked { background: var(--green, #326b55); }
.connector-toggle input:checked::after { transform: translateX(16px); }
.connector-toggle input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.connector-toggle input:disabled { opacity: .5; cursor: wait; }
.connector-access { border-top: 1px solid var(--line); }
.connector-access > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; cursor: pointer; list-style: none; font-size: .875rem; }
.connector-access > summary::-webkit-details-marker { display: none; }
.connector-access-value { margin-left: auto; text-align: right; color: var(--ink-soft); }
.connector-access > summary::after { content: "⌄"; color: var(--ink-soft); }
.connector-access[open] > summary::after { transform: rotate(180deg); }
.connector-access-body { padding: 0 0 12px; }
.connector-choice-list { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; padding-right: 8px; }
.connector-choice { display: flex; align-items: flex-start; gap: 9px; margin: 0; padding: 10px 0; overflow-wrap: anywhere; cursor: pointer; font-size: .875rem; }
.connector-choice input { flex: 0 0 auto; margin-top: 4px; accent-color: var(--green, #326b55); }
.connector-choice small { display: block; margin-top: 3px; font-size: .75rem; line-height: 1.5; }
.connector-bulk-choice { border-bottom: 1px solid var(--line); margin: 4px 0; font-weight: 600; }
.connector-choice[hidden] { display: none; }
.connector-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.connector-actions[hidden] { display: none; }
.connector-connection { margin-top: 12px; font-size: .75rem; color: var(--ink-soft); }
.connector-connection > summary { cursor: pointer; width: fit-content; }
.connector-connection .connector-actions { margin-top: 12px; gap: 16px; }
.connector-feedback { margin-bottom: 0; }
@media (max-width: 600px) {
  .connector-card { padding: 16px; }
  .connector-heading { gap: 8px; }
  .connector-identity { gap: 8px; }
  .connector-toggle { gap: 6px; }
}
#connector-dialog { width: min(560px, calc(100vw - 40px)); }


.gateway-group-setup { border: 1px solid var(--line); border-radius: .75rem; padding: 1.125rem; margin-top: 1rem; background: var(--bubble); }
.gateway-group-setup h3 { margin-top: 0; font-size: 1rem; }
.gateway-group-setup ol { padding-left: 1.25rem; margin: .75rem 0; }
.gateway-group-setup li { padding: .3rem 0; line-height: 1.6; font-size: .875rem; }
.gateway-group-setup code { display: inline; width: auto; margin: 0; padding: .125rem .3rem; white-space: nowrap; font-size: .8125rem; }
.gateway-enabled-group { border-top: 1px solid var(--line); padding-top: .625rem; font-size: .8125rem; }

.room-history-row { display: flex; align-items: center; gap: .5rem; }
.room-history-row > .project-thread-button { flex: 1; min-width: 0; }
.messaging-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.messaging-summary { border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.messaging-summary-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .625rem; width: 100%; }
.settings-content .messaging-summary h3 { margin: 0; }
.messaging-icon { width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: .5rem; }
.messaging-icon svg { width: 1.5rem; height: 1.5rem; }
.messaging-icon img { width: 1.5rem; height: 1.5rem; }
.messaging-icon-whatsapp { background: #e8f5ec; color: #13743b; font-size: 1.5rem; }
.messaging-summary-status { color: var(--ink-soft); font-size: .6875rem; margin-left: auto; }
.messaging-summary-status[data-connected="true"] { color: #13743b; }
.messaging-summary-detail { font-size: .8125rem; line-height: 1.6; overflow-wrap: anywhere; margin: .875rem 0 .375rem; }
.messaging-summary > .hint { margin: 0 0 .75rem; }
.messaging-summary-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; }
.messaging-access { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; }
@media (max-width: 700px) {
  .messaging-summary-grid { grid-template-columns: 1fr; }
  .messaging-summary { padding: 1rem; }
}

#messaging-modal { width: min(960px, calc(100vw - 32px)); max-width: none; box-sizing: border-box; }
.gateway-access-columns { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.5rem; }
.gateway-contact-list { max-height: 22rem; overflow-y: auto; margin: .75rem 0; }
.gateway-contact { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.gateway-contact-info { min-width: 0; display: grid; gap: .25rem; flex: 1; }
.gateway-contact-number { font-size: .8125rem; overflow-wrap: anywhere; }
.gateway-form .gateway-contact-name { padding: .3rem .4rem; margin: 0; width: 100%; box-sizing: border-box; }
.gateway-form label.gateway-contact-access { display: flex; align-items: center; gap: .375rem; font-size: .75rem; }
.gateway-form .gateway-contact-access input { width: 1rem; margin: 0; }
.gateway-add-person { display: flex; align-items: end; gap: .5rem; }
.gateway-add-person label { min-width: 0; flex: 1; }
.gateway-add-person button { flex: none; margin-bottom: .5rem; }
.gateway-form .gateway-permissions { grid-column: 1 / -1; }
.gateway-form:has(.gateway-permissions) { max-width: none; }
@media (max-width: 680px) {
  #messaging-modal { width: calc(100vw - 16px); }
  .gateway-access-columns { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
}

.gateway-choice[hidden] { display: none !important; }
.gateway-form .gateway-choice:has(input[type="text"]) { flex-wrap: wrap; }
.gateway-form .gateway-choice input[type="text"] { width: min(100%, 15rem); flex: 1; margin: 0; }

#messaging-modal[data-messaging-view="access"] #messaging-access-title,
#messaging-modal[data-messaging-view="access"] #messaging-access > .hint { display: none; }
#messaging-modal[data-messaging-view="access"] .messaging-access { border: 0; margin: 0; padding: 0; }
.gateway-form > .dialog-actions { position: sticky; bottom: -1.75rem; background: var(--bg); border-top: 1px solid var(--line); padding: .75rem 0; z-index: 1; }
#access-whatsapp-panel > [role="status"] { color: var(--ink); font-weight: 600; }

.gateway-destination { border: 0; margin: .5rem 0; padding: 0; min-width: 0; }
.gateway-destination legend { font-size: .875rem; color: var(--ink-soft); margin-bottom: .5rem; }
.gateway-add-person { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: end; }
.gateway-add-person button { grid-column: 1 / -1; justify-self: start; }

.gateway-destination-picker { position: relative; }
.gateway-destination-button, .gateway-destination-option { display: flex; align-items: center; gap: .625rem; width: 100%; min-width: 0; text-align: left; font: inherit; color: var(--ink); background: var(--bg); padding: .625rem .75rem; cursor: pointer; }
.gateway-destination-button { border: 1px solid var(--line-strong); border-radius: 6px; }
.gateway-destination-caret { margin-left: auto; color: var(--ink-soft); }
.gateway-destination-options { position: absolute; z-index: 5; top: calc(100% + .25rem); left: 0; right: 0; max-height: 18rem; overflow-y: auto; padding: .25rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); box-shadow: var(--shadow); }
.gateway-destination-option { border: 0; border-radius: 4px; }
.gateway-destination-option[aria-selected="true"], .gateway-destination-option:hover { background: var(--bubble); }
.gateway-destination-button:focus-visible, .gateway-destination-option:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.gateway-destination-picker .team-avatars { flex: none; }

#gateway-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.gateway-view-tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.gateway-view-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-soft); padding: .625rem 0; font: inherit; font-size: .875rem; cursor: pointer; }
.gateway-view-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.gateway-view-tabs button:disabled { opacity: .5; cursor: default; }
.gateway-command-help code { display: inline; padding: .125rem .25rem; font-size: .8125rem; }

#messaging-title { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }

#settings-engines #mcp-connections { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }

.project-folder-settings { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1rem 0; }
.project-folder-settings h3 { margin: 0; }
.project-directory-list { list-style: none; padding: 0; margin: .75rem 0; }
.project-directory { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .625rem 0; border-bottom: 1px solid var(--line); }
.project-directory-copy { display: grid; gap: .25rem; min-width: 0; }
.project-directory-path { font-size: .8125rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.project-directory-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .625rem; flex: none; font-size: .75rem; }
.project-folder-manual summary { cursor: pointer; font-size: .8125rem; color: var(--ink-soft); }
.project-folder-path-entry { display: flex; align-items: end; gap: .5rem; margin-top: .5rem; }
.project-folder-path-entry label { flex: 1; min-width: 0; }
.project-folder-path-entry button { flex: none; margin-bottom: .5rem; }
@media (max-width: 600px) { .project-directory { align-items: start; flex-direction: column; } .project-directory-actions { justify-content: flex-start; } }

.context-activity-drawer { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: 1rem; }
.context-activity-drawer > summary { cursor: pointer; font-size: .8125rem; color: var(--ink-soft); }
#project-knowledge-view { padding-bottom: 1rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
#project-knowledge-view h3 { font-size: .8125rem; margin: .75rem 0 .5rem; }
#project-knowledge-view .project-knowledge-heading { flex-wrap: wrap; gap: .5rem; }
#project-knowledge-view .project-directory { align-items: start; flex-direction: column; }
#project-knowledge-view .project-knowledge-toolbar { flex-wrap: wrap; }
#project-knowledge-view .project-context-library { margin: 1rem 0; }
#project-knowledge-view .project-context-library > summary { cursor: pointer; font-size: .8125rem; }
#project-knowledge-view .project-knowledge-list { margin: .5rem 0; }

#project-knowledge-view .project-knowledge-empty { padding: .5rem 0; border: 0; background: transparent; }

#project-linked-directories { margin: 0; }
#legacy-room-sources { margin-top: 1rem; font-size: .8125rem; }
#project-knowledge-view { border-bottom: 0; }
#project-dialog[data-mode="folders"] .project-form > :not(.project-folder-settings):not(.dialog-actions):not(.project-form-error) { display: none; }
#project-dialog[data-mode="folders"] #project-edit-impact { display: none; }
#details .file-link { border: 0; border-radius: 0; background: transparent; }
#details .file-link:hover { background: var(--hover); }

.project-directory-actions .settings-tag { border: 0; border-radius: 0; padding: 0; background: transparent; }
#project-knowledge-view .project-knowledge-file { padding: .5rem 0; border: 0; border-radius: 0; background: transparent; }

/* Sending while work is active keeps queueing separate from explicit cancellation. */
.send.send-pending { width: auto; min-width: 3.5rem; padding: 0 .75rem; border-radius: 1rem; font-size: .78rem; }
#message-delivery { margin-left: auto; max-width: 5rem; font-size: .78rem; }

#project-dialog[data-mode="folders"] { width: 30rem; padding: 1.5rem; }
#project-dialog[data-mode="folders"] > .eyebrow,
#project-dialog[data-mode="folders"] > .project-dialog-intro,
#project-dialog[data-mode="folders"] #project-folders-title { display: none; }
#project-dialog[data-mode="folders"] h2 { margin: 0 0 1rem; }
#project-dialog[data-mode="folders"] .project-folder-settings { border: 0; padding: 0; }
#project-dialog[data-mode="folders"] .dialog-actions { margin-top: .5rem; padding-top: 1rem; }
.project-picker-pending { display: flex; align-items: center; justify-content: space-between; gap: .75rem; font-size: .8125rem; color: var(--ink-soft); padding: .5rem 0; }
.project-picker-pending[hidden] { display: none; }

.file-row { display: flex; align-items: center; gap: .25rem; border-bottom: 1px solid var(--line); }
.file-row .file-link { flex: 1; min-width: 0; margin: 0; padding: .75rem 0; }
.file-row .file-link > span:last-child { flex: 1; min-width: 0; }
.file-row-icon { width: 1.25rem; height: 1.5rem; color: var(--ink-soft); }
.file-row-icon svg, .file-download svg { display: block; width: 100%; height: 100%; }
.file-download { flex: none; width: 2rem; height: 2rem; padding: .4rem; color: var(--ink-soft); border-radius: 4px; }
.file-download:hover { background: var(--hover); color: var(--ink); }
.conversation-file-tools { display: flex; flex-direction: column; gap: .625rem; margin: .625rem 0 1rem; }
.conversation-file-tools input[type="search"] { width: 100%; min-width: 0; padding: .625rem .75rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; font-size: .8125rem; }
.conversation-file-modes { display: flex; gap: .25rem; }
.conversation-file-modes button { padding: .375rem .625rem; font-size: .75rem; }
.conversation-file-modes button[aria-pressed="true"] { color: var(--ink); background: var(--hover); border-color: var(--ink-faint); }
.conversation-file-group { margin: .75rem 0; }
.conversation-file-group > h4, .conversation-file-group > summary { margin: 0; padding: .375rem 0; font-size: .8125rem; font-weight: 600; color: var(--ink-soft); }
.conversation-file-group > summary { cursor: pointer; }
.file-pin { flex: none; width: 2rem; height: 2rem; padding: .25rem; border: 0; background: transparent; color: var(--ink-soft); border-radius: 4px; }
.file-pin:hover, .file-pin[aria-pressed="true"] { color: var(--ink); background: var(--hover); }
.file-preview-unavailable { margin: 2rem; }
#project-dialog[data-mode="folders"] .project-knowledge-heading { margin: 0; }
#project-dialog[data-mode="folders"] .project-folder-settings > .hint { margin: .75rem 0; }
#project-dialog[data-mode="folders"] .project-folder-manual { margin-top: 1rem; }

/* Sidebar controls share one icon scale, without bordered button tiles. */
.navigation-icon { display: block; width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .search > span { display: grid; place-items: center; }
.sidebar .icon-button:not(.mobile-only) { display: inline-grid; place-items: center; }
.sidebar .project-nav-heading .icon-button, .sidebar #add-agent { color: var(--ink-soft); }
.sidebar .project-group-row { min-height: 2.625rem; border-radius: 6px; }
.sidebar .project-group.selected > .project-group-row { border-radius: 6px; background: var(--hover); }
.sidebar .project-button > .room-avatar { width: 1.625rem; height: 1.625rem; border: 0; background: transparent; padding: 0; border-radius: 4px; }
.sidebar .project-disclosure, .sidebar .project-pin { display: inline-grid; place-items: center; padding: 0; border: 0; background: transparent; box-shadow: none; color: var(--ink-faint); }
.sidebar .project-disclosure .navigation-icon { width: .75rem; height: .75rem; }
.sidebar .project-disclosure[aria-expanded="true"] .navigation-icon { transform: rotate(90deg); }
.sidebar .project-pin .navigation-icon { width: .875rem; height: .875rem; }
.sidebar .project-pin[aria-pressed="true"] { color: var(--ink-soft); }
.sidebar .project-disclosure:hover, .sidebar .project-pin:hover { color: var(--ink); background: var(--hover); }
.sidebar .project-group-threads { margin: .125rem 0 .5rem 1.25rem; padding: .125rem 0 .125rem .5rem; border-left-color: var(--line); }
.sidebar .project-group-add { display: flex; align-items: center; gap: .5rem; min-height: 2rem; margin: 0; padding: .375rem .5rem; border: 0; border-radius: 5px; background: transparent; color: var(--ink-soft); font-size: .75rem; }
.sidebar .project-group-add:hover { background: var(--hover); color: var(--ink); }
.sidebar .sidebar-room-thread { min-height: 2rem; gap: .5rem; margin: 0; padding: .375rem .5rem; border-radius: 5px; }
.sidebar .sidebar-room-thread > .navigation-icon { color: var(--ink-faint); width: .9375rem; height: .9375rem; }
.sidebar .sidebar-room-thread .project-thread-text strong { font-size: .75rem; font-weight: 400; }
.sidebar .sidebar-room-thread[aria-current="page"] .project-thread-text strong { font-weight: 600; }
@media (max-width: 700px) {
  .sidebar .project-group-row, .sidebar .project-group-add, .sidebar .sidebar-room-thread { min-height: 2.75rem; }
  .sidebar .project-pin { opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) { .sidebar .project-disclosure .navigation-icon { transition: transform .12s ease; } }

/* Linked folders and conversation files share the same compact explorer. */
#context-files > .detail-section { border: 0; padding: 0; }
#context-files > .detail-section > h3 { display: none; }
#project-knowledge-view { margin: 0; padding: 0; border: 0; }
#project-knowledge-view .project-knowledge-heading { margin: .5rem 0 .75rem; justify-content: space-between; }
#project-knowledge-view #project-linked-folders-title { margin: 0; font-size: .75rem; font-weight: 500; color: var(--ink-soft); }
#project-manage-directories { font-size: .75rem; color: var(--ink-soft); }
#project-linked-directories { margin: 0; padding: 0; }
#files .file-row { border: 0; }
#files .file-link { padding: .5rem .25rem; }

#project-knowledge-view .project-knowledge-heading { gap: .75rem; }

.project-folder-node { margin: 0; min-width: 0; }
.project-folder-summary { display: flex; align-items: center; gap: .375rem; min-height: 2rem; padding: .375rem .25rem; border-radius: 4px; list-style: none; cursor: pointer; font-size: .8125rem; }
.project-folder-summary::-webkit-details-marker { display: none; }
.project-folder-summary:hover, .folder-tree-file:hover { background: var(--hover); }
.project-folder-summary > .navigation-icon:first-child { width: .625rem; height: .625rem; color: var(--ink-faint); }
.project-folder-node[open] > .project-folder-summary > .navigation-icon:first-child { transform: rotate(90deg); }
.project-folder-summary > .navigation-icon { color: var(--ink-soft); }
.folder-node-label { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linked-folder > .project-folder-summary .folder-node-label { font-weight: 500; }
.folder-root-parent { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--ink-faint); font-size: .6875rem; font-weight: 400; }
.folder-node-count { color: var(--ink-faint); font-size: .6875rem; font-variant-numeric: tabular-nums; }
.folder-node-content { margin-left: .5rem; padding: 0 0 .25rem .5rem; border-left: 1px solid var(--line); }
.linked-folder > .folder-node-content { max-height: 22rem; overflow-y: auto; overscroll-behavior: contain; }
.folder-tree-file { display: flex; align-items: center; gap: .5rem; padding: .375rem .25rem .375rem 1.25rem; min-height: 2rem; color: var(--ink); font-size: .8125rem; text-decoration: none; border-radius: 4px; }
.folder-tree-file > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-tree-file .navigation-icon { width: .875rem; height: .875rem; color: var(--ink-faint); }
.folder-node-status { margin: .25rem; font-size: .75rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.folder-node-status:empty { display: none; }
.folder-node-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: .5rem .25rem; font-size: .75rem; }
.folder-node-footer[hidden] { display: none; }
.linked-folder > .folder-node-content > .folder-node-footer { position: sticky; bottom: 0; margin-bottom: 0; padding: .5rem .25rem; background: var(--rail); border-top: 1px solid var(--line); }
.folder-node-progress { color: var(--ink-faint); font-size: .6875rem; }
@media (max-width: 700px) { .project-folder-summary, .folder-tree-file { min-height: 2.75rem; } }

.folder-tree-actions { display: flex; align-items: center; gap: .5rem; }
.folder-tree-actions .icon-button { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; }
.folder-tree-actions .navigation-icon { width: .875rem; height: .875rem; }
.chat-header .conversation-tool { display: inline-flex; align-items: center; justify-content: center; gap: .375rem; min-height: 2rem; margin: 0; padding: .375rem .5rem; border: 0; border-radius: 5px; background: transparent; box-shadow: none; font-size: .75rem; font-weight: 500; color: var(--ink-soft); }
.chat-header .conversation-tool:hover { background: var(--bg); color: var(--ink); }
.conversation-tool .navigation-icon { width: .9375rem; height: .9375rem; }
.chat-header .panel-toggle[aria-expanded="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px #0000000d; }
.chat-header .conversation-options > summary { width: 2rem; height: 2rem; }
@media (max-width: 700px) {
  .chat-header .conversation-tool { min-height: 2.75rem; padding: .5rem; }
  .conversation-tool .navigation-icon { width: 1.125rem; height: 1.125rem; }
}

.context-tabs[hidden] { display: none; }
#room-details-dialog .context-instructions { display: block; }
#room-details-dialog .charter { display: none; }
#room-details-dialog .participation-manage { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
#room-details-dialog .participation-manage[hidden] { display: none; }
#room-details-dialog .detail-section { border: 0; padding: .75rem 0; }
#room-details-dialog #project-context { margin: 0; padding: .5rem 0; }
#room-details-dialog .room-instructions-copy { white-space: pre-wrap; }

.chat-header .panel-toggle { width: 2.25rem; height: 2.25rem; padding: .5rem; }
.chat-header .panel-toggle .navigation-icon { width: 1.25rem; height: 1.25rem; }
.browser-panel > .context-tabs { flex: none; margin: 0 .75rem .75rem; }
.context-tabs button[hidden] { display: none; }

.app-action-receipt { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .625rem; margin: .625rem 0; padding: .625rem .75rem; border-left: 2px solid var(--line-strong); text-align: left; font-size: .75rem; background: var(--rail); }
.app-action-receipt > strong { font-weight: 500; }
.app-action-receipt > p, .app-action-receipt > details { flex-basis: 100%; margin: 0; }
.app-action-status, .app-action-target { color: var(--ink-soft); }
.app-action-receipt pre { max-height: 18rem; max-width: 100%; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.app-action-buttons { display: flex; gap: .5rem; flex-basis: 100%; }
.app-action-buttons .secondary { min-height: 2rem; font-size: .75rem; }

.message.user.channel-message { align-self: stretch; max-width: min(100%, 42rem); }
.channel-message .message-content { min-width: 0; border-left: 2px solid var(--line-strong); padding-left: .875rem; }
.channel-message-source { display: flex; align-items: center; gap: .375rem; color: var(--ink-soft); font-size: .6875rem; margin-bottom: .5rem; }
.channel-message-source svg { width: .875rem; height: .875rem; }
.channel-message-chat { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-message-chat::before, .channel-message-thread::before { content: "·"; margin-right: .375rem; }
.channel-discussion { color: var(--ink-soft); font-size: .75rem; margin-bottom: .5rem; }
.channel-discussion > summary { cursor: pointer; }
.channel-discussion-messages { border-left: 1px solid var(--line); padding-left: .75rem; margin: .5rem 0; }
.channel-discussion-message { padding: .375rem 0; }
.channel-discussion-message time { margin-left: .5rem; color: var(--ink-faint); font-size: .6875rem; }
.channel-discussion-message p { white-space: pre-wrap; overflow-wrap: anywhere; margin: .25rem 0; color: var(--ink); }

.channel-chat-link { display: flex; align-items: center; gap: .5rem; }
.channel-chat-link svg { width: 1rem; height: 1rem; flex: none; }
.channel-chat-link > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.channel-message-source .messaging-icon { width: 1.25rem; height: 1.25rem; padding: .125rem; border-radius: 3px; background: transparent; }
.channel-message-source .messaging-icon img { width: .875rem; height: .875rem; }
.channel-chat-link .messaging-icon { width: 1rem; height: 1rem; padding: 0; background: transparent; flex: none; }

.channel-message-quote { margin: .5rem 0; padding: .375rem .75rem; border-left: 2px solid var(--line-strong); color: var(--ink-soft); font-size: .75rem; max-height: 8rem; overflow: auto; }
.channel-message-quote p { white-space: pre-wrap; overflow-wrap: anywhere; margin: .25rem 0 0; }

.channel-thread-group { margin: .375rem 0; min-width: 0; }
.channel-thread-group > summary { display: flex; align-items: center; gap: .375rem; list-style: none; cursor: pointer; padding: .375rem .5rem; color: var(--ink-soft); font-size: .6875rem; }
.channel-thread-group > summary::-webkit-details-marker { display: none; }
.channel-thread-group > summary > .navigation-icon { width: .5rem; height: .5rem; }
.channel-thread-group[open] > summary > .navigation-icon { transform: rotate(90deg); }
.channel-thread-group .messaging-icon { width: .875rem; height: .875rem; padding: 0; background: transparent; border-radius: 0; }
.channel-thread-group .messaging-icon svg, .channel-thread-group .messaging-icon img { width: .875rem; height: .875rem; }
.channel-thread-rows { margin-left: 1rem; padding-left: .25rem; border-left: 1px solid var(--line); }
.channel-thread-row { display: flex; align-items: center; gap: .375rem; width: 100%; min-height: 1.875rem; padding: .375rem .5rem; color: var(--ink); font-size: .75rem; text-align: left; border-radius: 4px; }
.channel-thread-row > .navigation-icon { width: .8125rem; height: .8125rem; color: var(--ink-faint); flex: none; }
.channel-thread-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-thread-row > small { color: var(--ink-faint); margin-left: auto; font-size: .625rem; }
.channel-thread-row:hover, .channel-thread-row.selected { background: var(--hover); }
.byte-nav-row { display: flex; align-items: center; min-width: 0; padding-left: 1.25rem; }
.byte-nav-row:has(.byte-disclosure) { padding-left: 0; }
.byte-nav-row .agent-button { flex: 1; min-width: 0; }
.byte-disclosure { display: inline-grid; place-items: center; flex: none; width: 1.25rem; height: 2rem; padding: 0; color: var(--ink-faint); border-radius: 4px; }
.byte-disclosure:hover { background: var(--hover); color: var(--ink); }
.byte-disclosure .navigation-icon { width: .625rem; height: .625rem; }
.byte-disclosure[aria-expanded="true"] .navigation-icon { transform: rotate(90deg); }
.byte-channel-chats { margin: 0 0 .5rem 1.375rem; }
@media (max-width: 700px) { .byte-nav-row { padding-left: 2rem; } .byte-disclosure { width: 2rem; height: 2.75rem; } }
.timeline[data-channel] .message { margin: 1rem 0; gap: .75rem; }
.timeline[data-channel] .channel-message-source { display: none; }
.timeline[data-channel] .channel-message .message-content { border: 0; padding-left: 0; }
.timeline[data-channel] .message.user { justify-content: flex-start; max-width: none; }
.timeline[data-channel] .message .message-content { flex: 1; max-width: calc(100% - 2.75rem); }
.timeline[data-channel] .message.user .message-label { display: flex; }
.timeline[data-channel] .message-label { justify-content: flex-start; flex-wrap: wrap; font-size: .8125rem; }
.timeline[data-channel] .message > img, .channel-user-avatar { width: 2rem; height: 2rem; flex: 0 0 2rem; }
.channel-user-avatar { display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--hover); color: var(--ink-soft); font-size: .75rem; font-weight: 600; }
.timeline[data-channel] .message.user .message-body { padding: .25rem 0; border: 0; border-radius: 0; background: transparent; }
.timeline[data-channel] .channel-discussion { margin: .5rem 0 0; }
.timeline[data-channel] .channel-discussion > summary { color: var(--ink-faint); font-size: .6875rem; }
@media (max-width: 700px) { .channel-thread-row { min-height: 2.5rem; } .channel-thread-group > summary { min-height: 2rem; } }

.timeline[data-channel] .welcome, .timeline[data-channel] .introduction { display: none; }
.timeline[data-channel] .message.system:not(.routine-divider) { margin: .5rem 0 .5rem 2.75rem; width: calc(100% - 2.75rem); padding: .25rem 0; border: 0; background: transparent; font-size: .75rem; }

.connector-search { width: 100%; box-sizing: border-box; border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; background: var(--paper, #fff); }
.connector-preset { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.connector-preset > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.connector-preset p { margin: 5px 0 0; }
.connector-preset > button { flex-shrink: 0; }
#connector-preset-help { overflow-wrap: anywhere; }
#connector-preset-help a { display: inline-block; margin-left: 4px; }
#connector-signin { text-align: center; }

.connector-logo { display: inline-block; width: 28px; height: 28px; object-fit: contain; flex: 0 0 28px; vertical-align: middle; }
#connector-title .connector-logo { margin-right: 10px; }
#connector-title .connector-logo { width: 32px; height: 32px; }

.connector-category { border-bottom: 1px solid var(--line); }
.connector-category > summary { padding: 18px 0; cursor: pointer; font-weight: 600; }
.connector-category-count { float: right; color: var(--muted); font-size: 13px; font-weight: 400; }
.connector-category .connector-preset:last-child { border-bottom: 0; }

.connector-collection-title { margin: 1.5rem 0 .25rem; font-size: .875rem; color: var(--ink-soft); }

.channel-mention { color: var(--blue); background: var(--blue-bg); border-radius: 3px; padding: 0 .125rem; font-weight: 500; }

#artifact-content audio { width: min(100%, 36rem); margin: 1rem auto; display: block; }

.room-invitation { border: 1px solid var(--line); border-radius: 8px; background: transparent; padding: .625rem .75rem; }
.room-invitation-avatars { display: inline-flex; align-items: center; }
.room-invitation-avatars img { width: 1.5rem; height: 1.5rem; }
.room-invitation .app-action-buttons { margin-left: auto; }

.hidden-chat-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-width: 0; }
.hidden-chat-title { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: .8125rem; }
.hidden-chat-title small { display: block; color: var(--ink-soft); font-size: .6875rem; margin-top: 3px; }
.hidden-chat-row button { flex: none; font-size: .75rem; }

.chat-context-menu { position: fixed; z-index: 1000; min-width: 180px; padding: 5px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); }
.chat-context-menu button { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; font: inherit; font-size: .8125rem; cursor: pointer; }
.chat-context-menu button:hover, .chat-context-menu button:focus-visible { background: var(--hover); outline: none; }

#advanced-navigation { display: flex; flex-wrap: wrap; gap: .375rem; border-bottom: 1px solid var(--line); padding-bottom: .75rem; margin-bottom: 1.5rem; }
#advanced-navigation button { padding: .5rem .625rem; border-radius: 6px; font-size: .8125rem; color: var(--ink-soft); }
#advanced-navigation button[aria-current], #advanced-navigation button:hover { background: var(--blue-bg); color: var(--ink); }
#advanced-content { font-size: .875rem; line-height: 1.6; }
#advanced-content p { margin: .75rem 0; }
#advanced-content a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
#advanced-content .settings-fold, #advanced-content .toggle { padding: 1rem 0; border-bottom: 1px solid var(--line); }
#advanced-content summary { cursor: pointer; font-weight: 600; }
#advanced-content summary > span { margin-left: .75rem; font-size: .75rem; font-weight: 400; color: var(--ink-soft); }
#advanced-content .row, #advanced-content .settings-control, #advanced-content .settings-status { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: .875rem 0; }
#advanced-content .main, #advanced-content .settings-status { flex: 1; }
#advanced-content .snip, #advanced-content .faint, #advanced-content .soft { color: var(--ink-soft); }
#advanced-content .row-form, #advanced-content .textsize { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
#advanced-content button, #advanced-content .btn { padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 6px; }
#advanced-content .stack, #advanced-content .settings-provider-form { display: grid; gap: .75rem; margin-top: 1rem; }
#advanced-content input:not([type=radio]):not([type=checkbox]):not([type=hidden]):not([type=file]), #advanced-content textarea { width: 100%; padding: .625rem; border: 1px solid var(--line); border-radius: 6px; }
#advanced-content code, #advanced-content pre { overflow-wrap: anywhere; white-space: pre-wrap; font-size: .75rem; }
#advanced-content .settings-brains > div { display: flex; justify-content: space-between; padding: .5rem 0; gap: 1rem; }
#advanced-content .settings-model-choice { display: flex; align-items: start; gap: .5rem; padding: .5rem 0; }
#advanced-content small { display: block; color: var(--ink-soft); }

#settings-mobile { margin-bottom: 16px; }
#mobile-relay-address { width: 100%; box-sizing: border-box; }
#mobile-pairing-dialog { width: min(440px, calc(100vw - 48px)); max-height: calc(100dvh - 48px); overflow: auto; }
#mobile-pairing-qr { display: flex; justify-content: center; margin: 16px 0; }
#mobile-pairing-qr img { width: 280px; max-width: 100%; height: auto; }
#mobile-pairing-code { width: 100%; box-sizing: border-box; margin-top: 8px; }

.cloud-nav { display: flex; align-items: center; gap: .55rem; min-height: 2.5rem; }
.cloud-nav svg { flex: none; color: var(--ink-soft); }
.cloud-composer-state {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  padding: .25rem .6rem;
  color: var(--ink-soft);
  font-size: .8125rem;
}
.cloud-location {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  border-radius: 999px;
  padding: .22rem .6rem;
  background: var(--rail);
  color: var(--ink);
  font-size: .8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.cloud-location[data-location="cloud"] { background: var(--blue-bg); color: var(--blue); }
.cloud-location::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }
.cloud-composer-actions, .cloud-setup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.cloud-text-action { background: transparent; border: 0; color: var(--blue); font: inherit; font-weight: 600; padding: .45rem .1rem; text-decoration: none; cursor: pointer; }
.cloud-text-action:hover:not(:disabled) { text-decoration: underline; }
.cloud-text-action:disabled { color: var(--ink-faint); cursor: default; }
.cloud-composer-status { flex: 1 0 100%; margin: 0; color: var(--ink-soft); }
.cloud-dashboard { display: grid; gap: .8rem; max-width: 46rem; }
.cloud-setup-card, .connector-scope {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: .75rem;
  padding: 1rem 1.15rem;
}
.cloud-setup-card h2 { font-size: 1rem; margin: 0; }
.cloud-setup-card p, .connector-scope p { margin: .35rem 0 .65rem; }
.cloud-card-heading, .connector-scope { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.connector-scope { margin-bottom: 1rem; }
.connector-scope p { margin-bottom: 0; }
.cloud-setup-actions a.secondary { display: inline-flex; align-items: center; text-decoration: none; }
.cloud-primary:not(:disabled) { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.cloud-primary:hover:not(:disabled) { filter: brightness(.85); }
.cloud-agent-select { display: flex; align-items: center; flex-wrap: wrap; margin-block: .75rem; gap: .5rem; font-size: .875rem; }
.cloud-agent-select select { max-width: 100%; }
.cloud-chat-list { margin-bottom: 0; }
.cloud-chat-list li:last-child { border-bottom: 0; }
#cloud-back-chat { justify-self: start; }
#cloud-pilot-review .dialog-actions button, #cloud-return-review .dialog-actions button { min-height: 44px; }
@media (max-width: 550px) {
  .cloud-composer-actions { gap: .4rem .65rem; }
  .cloud-text-action { min-height: 44px; display: inline-flex; align-items: center; }
  .cloud-composer-state { gap: .2rem .65rem; }
  .cloud-chat-list li { align-items: flex-start; flex-wrap: wrap; }
}
.connector-view-switch { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 1.1rem; }
.connector-view-switch [aria-pressed="true"] { background: var(--rail); border-color: var(--ink-soft); color: var(--ink); }
#connector-add { margin-left: auto; }

#cloud-private-login-feedback { flex-basis: 100%; margin: 0; }
