/* Saasworks application shell stylesheet. */

:root {
  color-scheme: dark;
  --app-height: 100dvh;
  --shell: #090d0b;
  --panel: #101613;
  --panel-alt: #0d1310;
  --surface: #151d18;
  --surface-raised: #1b251f;
  --surface-hover: #202c25;
  --ink: #e3ebe5;
  --ink-strong: #f4f8f5;
  --muted: #929e96;
  --faint: #68736c;
  --line: #29342e;
  --line-strong: #3b4941;
  --green: #5bc68f;
  --green-strong: #83dfaa;
  --green-soft: rgba(91, 198, 143, .12);
  --blue: #75aaea;
  --blue-soft: rgba(117, 170, 234, .13);
  --amber: #e1ad59;
  --amber-soft: rgba(225, 173, 89, .14);
  --red: #ed8178;
  --red-soft: rgba(237, 129, 120, .13);
  --shadow-small: 0 5px 16px rgba(0, 0, 0, .24);
  --shadow-large: 0 20px 54px rgba(0, 0, 0, .42);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: var(--app-height, 100dvh); margin: 0; overflow: hidden; }
html { background: var(--shell); }
body {
  min-width: 0;
  color: var(--ink);
  background: var(--shell);
  font: 13px/1.48 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { margin: 0; color: inherit; font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: var(--blue); }
img, svg { max-width: 100%; }
::selection { color: var(--ink-strong); background: rgba(91, 198, 143, .28); }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.app { display: grid; grid-template-columns: 252px minmax(0, 1fr) 316px; width: 100%; height: var(--app-height, 100dvh); min-width: 0; min-height: 0; overflow: hidden; background: var(--shell); }
.rail, .workspace, .inspector { min-width: 0; min-height: 0; }
.rail { display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: var(--panel); }
.workspace { display: grid; grid-template-rows: 58px minmax(0, 1fr) auto; overflow: hidden; background: var(--shell); }
.inspector { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--line); background: var(--panel-alt); scrollbar-color: var(--line-strong) transparent; }

.brand { display: flex; flex: 0 0 58px; align-items: center; gap: 10px; min-width: 0; padding: 0 15px; border-bottom: 1px solid var(--line); }
.brand > div:last-child { min-width: 0; }
.brand-mark { display: grid; flex: 0 0 28px; width: 28px; height: 28px; place-items: center; border: 1px solid rgba(91, 198, 143, .52); border-radius: 6px; color: var(--green-strong); background: var(--green-soft); font-size: 12px; font-weight: 800; }
.brand strong, .brand small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand strong { color: var(--ink-strong); font-size: 12px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 10px; }

.section-head { display: flex; min-width: 0; min-height: 42px; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 13px; }
.section-actions { display: flex; min-width: 0; align-items: center; gap: 2px; }
.section-head h2 { min-width: 0; margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .11em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.inspector-section > .section-head { min-height: 34px; margin: -5px -7px 7px; padding: 0 7px; }

.icon-button, .button, .send, .context-menu button, .menu-item { border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--ink); }
.icon-button { display: grid; flex: 0 0 34px; width: 34px; height: 34px; padding: 0; place-items: center; border-color: transparent; background: transparent; color: var(--muted); line-height: 1; }
.button { min-height: 36px; padding: 6px 10px; font-weight: 650; white-space: nowrap; }
.button.primary { border-color: var(--green); color: #07120c; background: var(--green); }
.icon-button:hover, .button:hover, .context-menu button:hover, .menu-item:hover { border-color: var(--line-strong); color: var(--ink-strong); background: var(--surface-hover); }
.button.primary:hover { border-color: var(--green-strong); background: var(--green-strong); }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

input, select, textarea { min-width: 0; border: 1px solid var(--line-strong); border-radius: 5px; outline: 0; color: var(--ink); background: var(--surface); }
input, select { min-height: 36px; padding: 6px 9px; }
textarea { padding: 8px 9px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(117, 170, 234, .16); }

.rail-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 0 9px 9px; border-bottom: 1px solid var(--line); }
.rail-toolbar select { width: 100%; }
.folder-tree { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; gap: 3px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 8px; scrollbar-color: var(--line-strong) transparent; }
.rail-footer { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; min-width: 0; padding: 9px; border-top: 1px solid var(--line); }
.rail-footer .button { flex: 1 1 auto; }
.scope { flex: 0 1 auto; max-width: 96px; overflow: hidden; padding: 4px 7px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); background: var(--surface); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.scope.online, .scope.connected { border-color: rgba(91, 198, 143, .45); color: var(--green-strong); background: var(--green-soft); }

.project-group, .project-folder, .folder-group, .tree-group, .chat-list, .nested-chat-list, .tree-children, .folder-children, .nested-chat-children { display: grid; min-width: 0; gap: 3px; }
.chat-list, .nested-chat-list, .tree-children, .folder-children, .nested-chat-children { margin-left: 15px; padding-left: 7px; border-left: 1px solid var(--line); }
.project-row, .project-button, .folder-row, .tree-row, .chat-row, .chat-button, .nested-chat-row, .archive-row, .file-row { display: flex; position: relative; width: 100%; min-width: 0; min-height: 40px; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid transparent; border-radius: 5px; color: var(--ink); background: transparent; text-align: left; }
.project-row:hover, .project-button:hover, .folder-row:hover, .tree-row:hover, .chat-row:hover, .chat-button:hover, .nested-chat-row:hover, .archive-row:hover, .file-row:hover { border-color: var(--line); background: var(--surface-hover); }
.project-row.active, .project-button.active, .folder-row.active, .tree-row.active, .chat-row.active, .chat-button.active, .nested-chat-row.active, .file-row.active { border-color: rgba(91, 198, 143, .32); color: var(--ink-strong); background: var(--green-soft); box-shadow: inset 2px 0 0 var(--green); }
.chat-row, .chat-button, .nested-chat-row { min-height: 42px; padding-left: 23px; }
.chat-row::before, .chat-button::before, .nested-chat-row::before { content: ""; position: absolute; left: 9px; width: 6px; height: 6px; border: 1px solid var(--faint); border-radius: 50%; }
.chat-row.active::before, .chat-button.active::before, .nested-chat-row.active::before { border-color: var(--green); background: var(--green); }
.project-row > *, .project-button > *, .folder-row > *, .tree-row > *, .chat-row > *, .chat-button > *, .nested-chat-row > * { min-width: 0; }
.project-name, .folder-name, .chat-name, .chat-title, .row-title, .tree-label, .project-row strong, .project-button strong, .folder-row strong, .tree-row strong, .chat-row strong, .chat-button strong, .nested-chat-row strong { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta, .chat-meta, .project-meta, .count { flex: 0 0 auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
.row-actions, .project-actions, .chat-actions { display: flex; flex: 0 0 auto; gap: 3px; }
.row-actions .icon-button, .project-actions .icon-button, .chat-actions .icon-button { width: 30px; height: 30px; }

.topbar { display: flex; min-width: 0; min-height: 58px; align-items: center; justify-content: space-between; gap: 11px; padding: 0 17px; border-bottom: 1px solid var(--line); background: var(--panel); }
.title { flex: 1 1 auto; min-width: 0; }
.title h1, .title p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title h1 { margin: 0; color: var(--ink-strong); font-size: 14px; line-height: 1.3; }
.title p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.top-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 4px; }
.mobile-only { display: none; }

.timeline { min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 25px max(18px, calc((100% - 790px) / 2)); background: var(--shell); scrollbar-color: var(--line-strong) transparent; }
.empty { display: grid; min-width: 0; min-height: 120px; place-content: center; padding: 20px; color: var(--muted); text-align: center; }
.empty strong, .empty span { display: block; }
.empty strong { margin-bottom: 4px; color: var(--ink-strong); font-size: 14px; }
.empty span { overflow-wrap: anywhere; }
.folder-tree > .empty, .agent-monitor > .empty { min-height: 140px; }

.message { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; width: 100%; min-width: 0; margin: 0 0 22px; }
.message > :last-child, .message-content { min-width: 0; }
.avatar { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); background: var(--surface); font-size: 9px; font-weight: 800; }
.message.user .avatar { color: var(--ink-strong); background: var(--surface-raised); }
.message.developer .avatar { border-color: rgba(91, 198, 143, .47); color: var(--green-strong); background: var(--green-soft); }
.message.engineer .avatar { border-color: rgba(117, 170, 234, .48); color: var(--blue); background: var(--blue-soft); }
.message.technician .avatar { border-color: rgba(225, 173, 89, .5); color: var(--amber); background: var(--amber-soft); }
.message-head { display: flex; min-width: 0; align-items: baseline; flex-wrap: wrap; gap: 5px 7px; margin-bottom: 5px; }
.message-head strong { color: var(--ink-strong); font-size: 12px; text-transform: capitalize; }
.message-head span { min-width: 0; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.message-body { min-width: 0; max-width: 100%; color: #dbe5de; font-size: 13px; overflow-wrap: anywhere; word-break: normal; }
.message-body > :first-child { margin-top: 0; }
.message-body > :last-child { margin-bottom: 0; }
.message-body p { margin: .5em 0; }
.message-body h1, .message-body h2, .message-body h3, .message-body h4, .message-body h5, .message-body h6 { margin: 1em 0 .4em; color: var(--ink-strong); line-height: 1.28; }
.message-body h1 { font-size: 19px; }
.message-body h2 { font-size: 16px; }
.message-body h3 { font-size: 14px; }
.message-body h4, .message-body h5, .message-body h6 { font-size: 13px; }
.message-body ul, .message-body ol { margin: .5em 0; padding-left: 1.4em; }
.message-body li + li { margin-top: .24em; }
.message-body blockquote { margin: .7em 0; padding: .38em .8em; border-left: 2px solid var(--green); color: #b6c6bc; background: var(--green-soft); }
.message-body code { padding: .12em .32em; border: 1px solid var(--line); border-radius: 3px; color: #bce9cc; background: #080d0a; font: .9em/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.message-body pre { display: block; width: 100%; max-width: 100%; margin: .7em 0; padding: 11px; overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; color: #d9e7de; background: #080d0a; scrollbar-color: var(--line-strong) transparent; }
.message-body pre code { padding: 0; border: 0; color: inherit; background: transparent; white-space: pre; }
.message-body table { display: block; width: max-content; max-width: 100%; margin: .7em 0; overflow-x: auto; border-collapse: collapse; scrollbar-color: var(--line-strong) transparent; }
.message-body th, .message-body td { min-width: 88px; padding: 6px 8px; border: 1px solid var(--line-strong); text-align: left; white-space: nowrap; }
.message-body th { color: var(--ink-strong); background: var(--surface-raised); }
.message-body a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.message-body hr { margin: 1em 0; border: 0; border-top: 1px solid var(--line); }
.message-meta, .metadata-chips, .message-chips { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.meta-chip, .metadata-chip, .message-chip { max-width: 100%; padding: 2px 6px; overflow-wrap: anywhere; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); background: var(--surface); font-size: 9px; line-height: 1.4; }
.meta-chip.provider, .metadata-chip.provider, [data-meta="provider"] { border-color: rgba(91, 198, 143, .43); color: var(--green-strong); }
.meta-chip.model, .metadata-chip.model, [data-meta="model"] { border-color: rgba(117, 170, 234, .44); color: var(--blue); }
.meta-chip.reasoning, .metadata-chip.reasoning, [data-meta="reasoning"] { border-color: rgba(225, 173, 89, .46); color: var(--amber); }

.composer-wrap { min-width: 0; padding: 10px max(13px, calc((100% - 820px) / 2)) 12px; border-top: 1px solid var(--line); background: var(--panel-alt); }
.controls { display: grid; grid-template-columns: 148px minmax(120px, 1fr) 236px; gap: 7px; min-width: 0; align-items: center; margin-bottom: 7px; }
.controls select, .controls input { width: 100%; }
.reasoning { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); }
.reasoning button { min-width: 0; min-height: 34px; padding: 4px 5px; border: 0; border-right: 1px solid var(--line); border-radius: 0; color: var(--muted); background: transparent; font-size: 10px; }
.reasoning button:last-child { border-right: 0; }
.reasoning button:hover, .reasoning button:focus-visible { color: var(--ink-strong); background: var(--surface-hover); outline-offset: -2px; }
.reasoning button.active, .reasoning button[aria-pressed="true"] { color: var(--green-strong); background: var(--green-soft); box-shadow: inset 0 -2px 0 var(--green); font-weight: 750; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 7px; min-width: 0; padding: 7px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-small); }
.composer:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(117, 170, 234, .15); }
.composer textarea { width: 100%; min-height: 48px; max-height: 180px; padding: 4px; resize: vertical; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.composer textarea:focus-visible { box-shadow: none; }
.send { align-self: end; width: 44px; height: 44px; padding: 0; border-color: var(--green); color: #07120c; background: var(--green); font-size: 18px; font-weight: 850; line-height: 1; transition: background .16s ease, transform .16s ease; }
.send:hover, .send:focus-visible { border-color: var(--green-strong); background: var(--green-strong); transform: translateY(-1px); }
.send:disabled { border-color: #304038; color: var(--faint); background: #27342d; opacity: 1; transform: none; }
.composer-meta { display: flex; min-width: 0; min-height: 20px; justify-content: space-between; gap: 10px; padding: 5px 2px 0; color: var(--muted); font-size: 10px; }
.composer-meta span { min-width: 0; overflow-wrap: anywhere; }
.run-state { flex: 0 0 auto; text-transform: capitalize; white-space: nowrap; }
.run-state.queued { color: var(--amber); }
.run-state.running { color: var(--blue); }
.run-state.completed, .run-state.complete { color: var(--green-strong); }
.run-state.failed, .run-state.partial { color: var(--red); }
.run-state.cooldown { color: var(--amber); }

.inspector > .section-head { position: sticky; z-index: 2; top: 0; border-bottom: 1px solid var(--line); background: var(--panel-alt); }
.inspector-section { min-width: 0; padding: 14px; border-bottom: 1px solid var(--line); }
.inspector-section > h2 { margin: 0 0 10px; color: var(--ink-strong); font-size: 11px; }
.muted { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.agent-monitor, .provider-list, .artifacts, .archive-list, .settings-list { display: grid; min-width: 0; gap: 6px; }
.monitor-row, .agent-row, .provider-row, .usage-row, .artifact, .archive-row, .settings-row { min-width: 0; }
.monitor-row, .agent-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.monitor-row:last-child, .agent-row:last-child { border-bottom: 0; }
.monitor-content, .agent-content { min-width: 0; }
.monitor-content strong, .agent-content strong { display: block; color: var(--ink-strong); font-size: 11px; overflow-wrap: anywhere; }
.monitor-content small, .agent-content small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.monitor-dot, .agent-dot, .provider-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--faint); }
.monitor-state, .status-badge, .provider-tag, .usage-tag { max-width: 100%; padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); background: var(--surface); font-size: 9px; line-height: 1.4; text-transform: capitalize; white-space: nowrap; }
.queued .monitor-dot, .queued .agent-dot, .monitor-state.queued, .status-badge.queued { color: var(--amber); border-color: rgba(225, 173, 89, .45); background-color: var(--amber-soft); }
.running .monitor-dot, .running .agent-dot, .monitor-state.running, .status-badge.running { color: var(--blue); border-color: rgba(117, 170, 234, .46); background-color: var(--blue-soft); }
.completed .monitor-dot, .complete .monitor-dot, .completed .agent-dot, .complete .agent-dot, .monitor-state.completed, .status-badge.completed { color: var(--green-strong); border-color: rgba(91, 198, 143, .45); background-color: var(--green-soft); }
.failed .monitor-dot, .failed .agent-dot, .monitor-state.failed, .status-badge.failed { color: var(--red); border-color: rgba(237, 129, 120, .47); background-color: var(--red-soft); }
.cooldown .monitor-dot, .cooldown .agent-dot, .monitor-state.cooldown, .status-badge.cooldown { color: var(--amber); border-color: rgba(225, 173, 89, .45); background-color: var(--amber-soft); }
.monitor-row.running .monitor-dot, .agent-row.running .agent-dot, .monitor-state.running::before, .status-badge.running::before { animation: microagent-pulse 1.35s ease-in-out infinite; }
.monitor-state.running::before, .status-badge.running::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 4px; border-radius: 50%; background: currentColor; }

.provider-row, .usage-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 43px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.provider-row:last-child, .usage-row:last-child { border-bottom: 0; }
.provider-row > div, .usage-row > div { min-width: 0; }
.provider-row strong, .usage-row strong { display: block; color: var(--ink-strong); font-size: 11px; overflow-wrap: anywhere; }
.provider-row small, .usage-row small { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.provider-dot.up, .provider-dot.online, .provider-row.connected .provider-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.provider-dot.down, .provider-dot.offline { background: var(--red); }
.usage-bar { grid-column: 2 / -1; height: 3px; overflow: hidden; border-radius: 2px; background: var(--line); }
.usage-fill { height: 100%; background: var(--green); }
.provider-usage-card .usage-bars,
.provider-usage-card .usage-source { grid-column: 2 / -1; }
.usage-bars { display: grid; min-width: 0; gap: 8px; }
.usage-window { display: grid; min-width: 0; gap: 4px; }
.usage-window-label { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 8px; }
.usage-window-label span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.usage-window-label strong { flex: 0 0 auto; color: var(--ink-strong); font-size: 10px; }
.usage-window > .usage-bar { grid-column: auto; width: 100%; }
.usage-window > small,
.provider-usage-card .usage-source { display: block; min-width: 0; overflow: hidden; color: var(--faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.usage-report { grid-column: 2 / -1; min-width: 0; margin-top: 4px; color: var(--muted); font-size: 9px; }
.usage-report summary { cursor: pointer; color: var(--faint); }
.usage-report pre { max-height: 120px; margin: 4px 0 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font: inherit; }.usage-policy { display: block; min-width: 0; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.artifact { padding: 5px 0 5px 9px; border-left: 2px solid var(--line-strong); }
.artifact strong { display: block; color: var(--ink-strong); font-size: 10px; overflow-wrap: anywhere; }
.artifact p { display: -webkit-box; margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }

.context-menu { position: fixed; z-index: 50; min-width: 180px; max-width: min(260px, calc(100vw - 16px)); padding: 4px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink); background: var(--surface-raised); box-shadow: var(--shadow-large); }
.context-menu button, .menu-item { display: flex; width: 100%; min-height: 38px; align-items: center; gap: 8px; padding: 7px 9px; border-color: transparent; background: transparent; text-align: left; }
.context-menu .danger, .menu-item.danger { color: var(--red); }
.menu-divider { height: 1px; margin: 4px; background: var(--line); }

.veil { display: none; position: fixed; z-index: 39; inset: 0; width: 100%; height: var(--app-height, 100dvh); padding: 0; border: 0; border-radius: 0; background: rgba(0, 0, 0, .66); }
.settings-drawer { display: flex; position: fixed; z-index: 45; inset: 0 0 0 auto; width: min(390px, 92vw); height: var(--app-height, 100dvh); min-width: 0; flex-direction: column; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--line-strong); color: var(--ink); background: var(--panel); box-shadow: var(--shadow-large); }
.settings-modal { position: fixed; z-index: 55; top: 50%; left: 50%; width: min(540px, calc(100vw - 28px)); max-height: min(720px, calc(var(--app-height, 100dvh) - 28px)); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; transform: translate(-50%, -50%); border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow-large); }
.settings-header, .modal-header { display: flex; position: sticky; z-index: 1; top: 0; min-height: 54px; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; border-bottom: 1px solid var(--line); background: var(--panel); }
.settings-header h2, .modal-header h2, #modal-title { min-width: 0; margin: 0; color: var(--ink-strong); font-size: 14px; overflow-wrap: anywhere; }
.settings-content, .modal-body { display: grid; min-width: 0; gap: 14px; padding: 14px; }
.settings-section { min-width: 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.settings-section:last-child { padding-bottom: 0; border-bottom: 0; }
.settings-section h3 { margin: 0 0 9px; color: var(--ink-strong); font-size: 11px; }
.settings-row { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row > *, .settings-row label { min-width: 0; overflow-wrap: anywhere; }
.form-field { display: grid; min-width: 0; gap: 5px; }
.form-field label { color: var(--muted); font-size: 10px; }
.form-field input, .form-field select, .form-field textarea { width: 100%; }
.settings-actions, .modal-actions { display: flex; position: sticky; bottom: 0; justify-content: flex-end; gap: 7px; padding: 10px 13px; border-top: 1px solid var(--line); background: var(--panel); }
.toggle, .switch { flex: 0 0 auto; accent-color: var(--green); }
body.show-settings .veil, body.settings-open .veil, body.show-modal .veil, body.modal-open .veil { display: block; }
body.show-modal .settings-drawer, body.modal-open .settings-drawer { z-index: 42; }

.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); width: max-content; max-width: min(440px, calc(100vw - 24px)); padding: 8px 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); border: 1px solid var(--line-strong); border-radius: 5px; color: var(--ink-strong); background: var(--surface-raised); box-shadow: var(--shadow-large); overflow-wrap: anywhere; transition: opacity .16s ease, transform .16s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) and (min-width: 981px) {
  .app { grid-template-columns: 224px minmax(0, 1fr) 280px; }
  .controls { grid-template-columns: 130px minmax(100px, 1fr); }
  .reasoning { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 232px minmax(0, 1fr); }
  .inspector { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(330px, 90vw); height: var(--app-height, 100dvh); transform: translateX(102%); border-left-color: var(--line-strong); box-shadow: var(--shadow-large); transition: transform .18s ease; }
  body.show-inspector .inspector, body.inspector-open .inspector { transform: translateX(0); }
  body.show-inspector .veil, body.inspector-open .veil { display: block; }
  .mobile-inspector { display: grid; }
  .close-inspector { display: grid; }
}

@media (max-width: 700px) {
  html, body, .app, .workspace { width: 100%; height: var(--app-height, 100dvh); min-height: 0; overflow: hidden; }
  body { max-width: 100vw; overflow-x: hidden; }
  .app { display: block; }
  .workspace { display: grid; grid-template-rows: 54px minmax(0, 1fr) auto; }
  .rail { position: fixed; z-index: 41; top: 0; bottom: 0; left: 0; width: min(300px, 90vw); height: var(--app-height, 100dvh); transform: translateX(-102%); border-right-color: var(--line-strong); box-shadow: var(--shadow-large); transition: transform .18s ease; }
  body.show-projects .rail, body.navigation-open .rail { transform: translateX(0); }
  body.show-projects .veil, body.navigation-open .veil { display: block; }
  .mobile-projects { display: grid; }
  .close-navigation { display: grid; }
  .brand, .topbar { min-height: 54px; }
  .brand { flex-basis: 54px; }
  .topbar { padding: 0 8px; }
  .topbar .title { min-width: 0; }
  .title h1, .title p { max-width: calc(100vw - 132px); }
  .timeline { width: 100%; min-width: 0; min-height: 0; padding: 17px 11px; overflow-x: hidden; overflow-y: auto; }
  .composer-wrap { width: 100%; min-width: 0; padding: 7px 7px calc(8px + env(safe-area-inset-bottom)); }
  .controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; margin-bottom: 6px; overflow: visible; }
  .reasoning { grid-column: 1 / -1; }
  input, select, textarea { min-height: 44px; font-size: 16px !important; }
  .icon-button, .button, .send, .reasoning button, .context-menu button, .menu-item { min-height: 44px; }
  .icon-button { width: 44px; height: 44px; }
  .rail-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .project-row, .project-button, .folder-row, .tree-row, .chat-row, .chat-button, .nested-chat-row, .archive-row, .file-row, .provider-row, .usage-row, .settings-row { min-height: 44px; }
  .composer { grid-template-columns: minmax(0, 1fr) 44px; }
  .composer textarea { min-height: 44px; max-height: min(150px, 30dvh); }
  .composer-meta { flex-wrap: wrap; gap: 2px 8px; }
  .message { grid-template-columns: 26px minmax(0, 1fr); gap: 7px; margin-bottom: 19px; }
  .avatar { width: 25px; height: 25px; }
  .message-body, .message-body pre, .message-body table { max-width: 100%; }
  .settings-drawer { width: min(100vw, 390px); }
  .settings-modal { width: calc(100vw - 16px); max-height: calc(var(--app-height, 100dvh) - 16px); }
}

@media (max-width: 340px) {
  .topbar { padding-inline: 4px; gap: 4px; }
  .title h1, .title p { max-width: calc(100vw - 126px); }
  .timeline { padding-inline: 8px; }
  .composer-wrap { padding-inline: 5px; }
  .controls { gap: 5px; }
  .reasoning button { padding-inline: 2px; font-size: 9px; }
  .message { grid-template-columns: 24px minmax(0, 1fr); gap: 6px; }
  .avatar { width: 24px; height: 24px; font-size: 8px; }
  .composer-meta { font-size: 9px; }
}

@keyframes microagent-pulse {
  0%, 100% { opacity: .42; transform: scale(.78); }
  50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
/* Runtime-rendered semantic contract. */
.tree-section { display: grid; min-width: 0; gap: 3px; }
.tree-main {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}
.folder-toggle {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
}
.folder-toggle:hover, .folder-toggle:focus-visible { color: var(--ink-strong); background: var(--surface-hover); }
.tree-icon { display: grid; flex: 0 0 16px; width: 16px; place-items: center; color: var(--muted); font-size: 11px; }
.tree-copy { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.tree-copy strong, .tree-copy small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-copy strong { color: var(--ink); font-size: 11px; }
.tree-copy small { margin-top: 1px; color: var(--muted); font-size: 9px; }
.tree-menu { flex: 0 0 30px; width: 30px; height: 30px; }
.tree-empty { padding: 8px 9px; color: var(--faint); font-size: 10px; overflow-wrap: anywhere; }
.folder-row.archived, .tree-row.archived { opacity: .68; }
.fixed-folder .folder-toggle { visibility: hidden; }

.monitor-copy, .provider-copy { min-width: 0; }
.monitor-copy strong, .provider-copy strong { display: block; color: var(--ink-strong); font-size: 11px; overflow-wrap: anywhere; }
.monitor-copy small, .provider-copy small { display: block; min-width: 0; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.artifact small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; overflow-wrap: anywhere; }
.provider-dot.status-cooldown, .provider-dot.status-exhausted { background: var(--amber); }
.provider-dot.status-error { background: var(--red); }

.settings-head, .modal-head {
  display: flex;
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.settings-head > div { min-width: 0; }
.settings-head h2, .modal-head h2 { margin: 0; color: var(--ink-strong); font-size: 14px; overflow-wrap: anywhere; }
.settings-head p { margin: 2px 0 0; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.settings-modal > form { display: flex; min-width: 0; flex-direction: column; }
#settings-form { display: grid; min-width: 0; gap: 0; padding: 0 14px; }
.settings-drawer > .settings-section { margin: 0 14px; }
.settings-section { padding-top: 14px; }
.field { display: grid; min-width: 0; gap: 5px; margin-bottom: 10px; }
.field:last-child { margin-bottom: 0; }
.field > span { color: var(--muted); font-size: 10px; }
.field input, .field select, .field textarea { width: 100%; }
.toggle {
  display: flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.toggle input { flex: 0 0 auto; width: 16px; min-width: 16px; min-height: 16px; accent-color: var(--green); }
.toggle span { min-width: 0; overflow-wrap: anywhere; }
.settings-toggle { border-bottom: 1px solid var(--line); }
.provider-settings > .section-head { margin: -5px 0 7px; padding: 0; }
.provider-settings > .section-head h3 { margin: 0; }
.settings-note { margin: 0 0 12px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.provider-setting { min-width: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.provider-setting-head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 10px; }
.provider-setting-head > div { min-width: 0; }
.provider-setting-head strong, .provider-setting-head small { display: block; overflow-wrap: anywhere; }
.provider-setting-head strong { color: var(--ink-strong); font-size: 11px; }
.provider-setting-head small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.provider-setting-head .toggle { min-height: 28px; }
.provider-setting-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; min-width: 0; margin-top: 9px; }
.provider-setting-actions { display: flex; min-width: 0; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 9px; }
.modal-body { display: grid; min-width: 0; gap: 10px; padding: 14px; }
.modal-actions { z-index: 2; }
body.show-navigation .rail { transform: translateX(0); }
body.show-navigation .veil, .veil.visible { display: block; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

body.compact .project-row,
body.compact .project-button,
body.compact .folder-row,
body.compact .tree-row,
body.compact .chat-row,
body.compact .chat-button { min-height: 34px; padding-block: 4px; }
body.compact .message { margin-bottom: 15px; }
body.compact .timeline { padding-top: 18px; padding-bottom: 18px; }
body.compact .inspector-section { padding-top: 10px; padding-bottom: 10px; }

@media (max-width: 700px) {
  .tree-main { min-height: 42px; }
  .folder-toggle, .tree-menu { width: 44px; height: 44px; }
  .provider-setting-grid { grid-template-columns: minmax(0, 1fr); }
  .provider-setting-actions .button { flex: 1 1 120px; min-width: 0; white-space: normal; }
  .settings-head, .modal-head { min-height: 54px; }
  .field input, .field select, .field textarea { font-size: 16px !important; }
  body.compact .project-row,
  body.compact .project-button,
  body.compact .folder-row,
  body.compact .tree-row,
  body.compact .chat-row,
  body.compact .chat-button { min-height: 44px; }
}

/* Saasworks shell and Microagent workspace utilities. */
.brand {
  display: grid;
  flex: 0 0 70px;
  min-width: 0;
  align-content: center;
  gap: 3px;
  padding: 9px 15px;
  border-bottom: 1px solid var(--line);
  background: #080c0a;
}
.brand-logo {
  display: block;
  width: 148px;
  height: 27px;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}
.brand small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-search {
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  height: 36px;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--faint);
  background: var(--surface);
}
.workspace-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(117, 170, 234, .16);
}
.workspace-search input {
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.workspace-search input:focus-visible { box-shadow: none; }
.tool-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}
.tool-nav button {
  display: flex;
  min-width: 0;
  min-height: 31px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
}
.tool-nav button > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-nav button:hover,
.tool-nav button:focus-visible,
.tool-nav button.active,
.tool-nav button[aria-pressed="true"] {
  border-color: var(--line-strong);
  color: var(--ink-strong);
  background: var(--surface-hover);
}


.composer {
  grid-template-columns: minmax(0, 1fr) auto 44px;
}
.composer-actions {
  display: flex;
  align-self: end;
  gap: 2px;
}
.composer-tool {
  display: grid;
  width: 32px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
}
.composer-tool:hover,
.composer-tool:focus-visible {
  color: var(--ink-strong);
  background: var(--surface-hover);
}

.usage-heading { align-items: center; }
.freshness {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}
.freshness > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.usage-bar {
  height: 5px;
  border-radius: 3px;
}
.usage-bar.low .usage-fill,
.usage-low .usage-fill,
[data-usage="low"] .usage-fill { background: var(--amber); }
.usage-bar.exhausted .usage-fill,
.usage-exhausted .usage-fill,
[data-usage="exhausted"] .usage-fill { background: var(--red); }
.usage-bar.unknown,
.usage-unknown .usage-bar,
[data-usage="unknown"] .usage-bar {
  border: 1px solid var(--line-strong);
  background: transparent;
}
.usage-bar.unknown .usage-fill,
.usage-unknown .usage-fill,
[data-usage="unknown"] .usage-fill { width: 0 !important; }
.provider-dot.status-low { background: var(--amber); }
.provider-dot.status-unknown {
  background: var(--faint);
  box-shadow: none;
}

.settings-drawer,
.utility-drawer {
  display: flex;
  position: fixed;
  z-index: 45;
  inset: 0 0 0 auto;
  width: min(390px, 92vw);
  height: var(--app-height, 100dvh);
  min-width: 0;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-left: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow-large);
}
.utility-head {
  display: flex;
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 8px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.utility-head h2 {
  min-width: 0;
  margin: 0;
  color: var(--ink-strong);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.utility-content {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 12px;
}
.tag,
.job-tag,
.file-tag,
.doc-tag,
.todo-tag,
.action-tag,
.review-tag {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  padding: 2px 6px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-row,
.file-row,
.doc-row,
.todo-row,
.action-row,
.review-row,
.preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.job-row > *,
.file-row > *,
.doc-row > *,
.todo-row > *,
.action-row > *,
.review-row > *,
.preview-row > * { min-width: 0; }
.job-row strong,
.file-row strong,
.doc-row strong,
.todo-row strong,
.action-row strong,
.review-row strong,
.preview-row strong {
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview,
.message-preview {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-alt);
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  .brand {
    min-height: 70px;
    flex-basis: 70px;
  }
  .tool-nav button { min-height: 40px; }
  .composer {
    grid-template-columns: minmax(0, 1fr) auto 44px;
  }
  .composer-actions {
    display: grid;
    grid-template-columns: 32px;
  }
  .composer-tool {
    width: 32px;
    height: 22px;
    min-height: 22px;
  }
  .settings-drawer,
  .utility-drawer { width: 100vw; }
}

@media (max-width: 340px) {
  .composer {
    grid-template-columns: minmax(0, 1fr) 28px 44px;
    gap: 4px;
    padding: 5px;
  }
  .composer-actions { grid-template-columns: 28px; }
  .composer-tool { width: 28px; }
  .tool-nav button { gap: 3px; }
}

.tree-label-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 4px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}
.tree-label-row:not(:first-child) {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.chat-tags {
  display: flex;
  min-width: 0;
  gap: 3px;
  margin-top: 4px;
  overflow: hidden;
}
.chat-tag {
  max-width: 82px;
  padding: 1px 4px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--muted);
  background: var(--panel-alt);
  font-size: 8px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.utility-list {
  display: grid;
  min-width: 0;
}
.utility-toolbar {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.utility-row {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  gap: 3px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
button.utility-row:hover,
button.utility-row:focus-visible {
  color: var(--ink-strong);
  background: var(--surface-hover);
}
.utility-row > *,
.utility-row > span,
.utility-row > div { min-width: 0; }
.utility-row strong,
.utility-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.utility-row strong {
  color: var(--ink-strong);
  font-size: 11px;
  white-space: nowrap;
}
.utility-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.job-row {
  grid-template-columns: auto minmax(0, 1fr);
}
.action-row {
  grid-template-columns: minmax(0, 1fr) auto;
}
.review-summary {
  min-width: 0;
}
.review-summary h3 {
  margin: 8px 0;
  color: var(--ink-strong);
  font-size: 11px;
}
.review-diff {
  max-width: 100%;
  overflow: auto;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: #080d0a;
  font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.dispatch-preview {
  display: grid;
  min-width: 0;
  gap: 12px;
}
.preview-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}
.preview-meta span {
  max-width: 100%;
  padding: 2px 6px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 340px) {
  .tree-label-row { padding-inline: 5px; }
  .utility-content { padding-inline: 9px; }
  .action-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .action-row .row-actions { justify-content: flex-end; }
}

/* Saasworks owns the shell; Microagent is the active product. */
.brand {
  flex: 0 0 90px;
  min-height: 90px;
  gap: 5px;
  padding: 10px 13px 8px;
}
.brand-logo {
  width: 142px;
  height: 29px;
}
.tenant-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}
.tenant-line #workspace-label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 10px;
}
.shell-trust,
.planning-mode {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
  white-space: nowrap;
}
.shell-trust {
  flex: 0 0 auto;
}
.shell-trust::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}
.planning-mode {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-alt);
}
.product-switcher {
  display: grid;
  position: relative;
  z-index: 40;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 6px 7px;
  border-bottom: 1px solid var(--line);
  background: #080c0a;
}
.product-tab {
  display: grid;
  min-width: 0;
  min-height: 40px;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: center;
  gap: 3px;
  padding: 4px 3px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--faint);
  background: transparent;
  font-size: 8px;
  text-align: left;
}
.product-tab > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-tab:hover,
.product-tab:focus-visible {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface);
}
.product-tab.active,
.product-tab[aria-current="page"] {
  border-color: var(--line-strong);
  color: var(--ink-strong);
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--green);
}
.product-mark {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}
.microagent-mark {
  border-color: rgba(91, 198, 143, .48);
  color: var(--green-strong);
  background: var(--green-soft);
}
.microhost-mark {
  border-color: rgba(117, 170, 234, .44);
  color: var(--blue);
  background: var(--blue-soft);
}
.microcloud-mark {
  border-color: rgba(225, 173, 89, .45);
  color: var(--amber);
  background: var(--amber-soft);
}

/* Legacy runtime copy is visually normalized until the shared script is renamed. */
.workspace:has(#prompt:disabled) #chat-title {
  font-size: 0;
}
.workspace:has(#prompt:disabled) #chat-title::after {
  content: "Welcome to Microagent";
  font-size: 14px;
}
.settings-head h2 {
  font-size: 0;
}
.settings-head h2::after {
  content: "Microagent settings";
  font-size: 14px;
}
.provider-settings > .settings-note {
  font-size: 0;
}
.provider-settings > .settings-note::after {
  content: "Microagent checks provider capacity in the background. Unknown capacity remains private and is never overwritten by a failed probe.";
  font-size: 10px;
}

@media (max-width: 700px) {
  .brand {
    min-height: 90px;
    flex-basis: 90px;
  }
  .product-switcher {
    padding-inline: 9px;
  }
  .product-tab {
    min-height: 44px;
    font-size: 9px;
  }
}

@media (max-width: 340px) {
  .brand-logo { width: 132px; }
  .product-switcher {
    gap: 1px;
    padding-inline: 5px;
  }
  .product-tab {
    grid-template-columns: 15px minmax(0, 1fr);
    gap: 2px;
    padding-inline: 2px;
    font-size: 8px;
  }
  .product-mark {
    width: 15px;
    height: 15px;
  }
}



.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  background: #090d0b;
}
.auth-screen[hidden] { display: none; }
.auth-card {
  width: min(100%, 420px);
  padding: 32px;
  border: 1px solid #26352d;
  border-radius: 10px;
  background: #101813;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .38);
}
.auth-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 22px;
  border: 2px solid #68dba5;
  border-radius: 12px;
  color: #68dba5;
  font-size: 24px;
  font-weight: 800;
}
.auth-card .eyebrow { margin: 0 0 8px; color: #68dba5; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.auth-card h1 { margin: 0 0 10px; font-size: 32px; }
.auth-copy { margin: 0 0 24px; color: #a9b8af; line-height: 1.5; }
.auth-card label { display: block; margin: 16px 0 7px; color: #d8e4db; font-size: 13px; font-weight: 700; }
.auth-card input { display: block; width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid #34493d; border-radius: 7px; background: #0a100c; color: #eff8f0; font: inherit; font-size: 16px; }
.auth-card input:focus { outline: 2px solid #68dba5; outline-offset: 2px; border-color: #68dba5; }
.auth-submit { width: 100%; min-height: 48px; margin-top: 24px; }
.auth-status { min-height: 20px; margin: 12px 0 0; color: #ff9f9f; font-size: 13px; }
.auth-status:empty { display: none; }
body.auth-required .app { pointer-events: none; }
@media (max-width: 520px) {
  .auth-screen { align-items: start; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
  .auth-card { padding: 24px; }
  .auth-card h1 { font-size: 27px; }
}
.role-controls { display: grid; gap: 5px; min-width: 0; margin-bottom: 7px; }
.role-controls-title { margin: 0; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.role-control-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.role-control { display: grid; gap: 3px; min-width: 0; }
.role-control > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.role-control select { width: 100%; min-width: 0; min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); padding: 0 7px; font: inherit; font-size: 10px; }
@media (max-width: 700px) {
  .role-control-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .role-control > span { font-size: 9px; }
  .role-control select { min-height: 44px; padding: 0 4px; font-size: 9px; }
}
