/* Rich project workspace and a persistent, separate owner terminal. */
.rich-session-sub { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; font-weight: 450; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-header-status.error { color: var(--error); }
.rich-header-status.work { color: var(--work); }
.rich-header-status.warn { color: var(--warn); }
.rich-terminal-contexts { display: flex; gap: 4px; padding: 4px 8px; overflow-x: auto; flex: none; }
.rich-terminal-contexts .button { min-height: 36px; flex: none; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-terminal-contexts [aria-pressed="true"] { color: var(--accent); }
.rich-message, .rich-message-text, .conversation-message-body { max-width: 100%; min-width: 0; }
.rich-message-text { overflow-wrap: anywhere; }
.rich-message-text table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.rich-message-text th, .rich-message-text td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.rich-message-text pre, .message-code { max-width: 100%; overflow-x: auto; }
.rich-thinking { display: inline-flex; align-items: center; gap: 8px; margin: 2px 0; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.rich-thinking::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: rich-blink 1s ease-in-out infinite; }
.rich-message-text a { color: var(--accent); overflow-wrap: anywhere; }
.rich-message-head > .text-copy { margin-left: auto; }
/* Conversation presentation. Collapsed groups do not mount their payloads. */
.conversation-feed { position: relative; overflow-anchor: none; scroll-behavior: auto; }
.conversation-content { min-width: 0; }
.conversation-item { display: flow-root; padding-bottom: 14px; min-width: 0; }
.conversation-item .rich-message { margin-bottom: 0; }
.message-actions { display: flex; align-items: center; gap: 3px; margin-top: 4px; }
.rich-message.user .message-actions { justify-content: flex-end; }
.message-pin { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; touch-action: manipulation; }
.message-pin[aria-pressed="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.conversation-feed svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; flex: none; }
.conversation-pins-button { display: block; width: 100%; min-height: 40px; padding: 6px 12px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; }
.conversation-toolbar { display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 10; background: var(--bg-raised, var(--surface-1)); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 6px 0; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.conversation-toolbar[hidden] { display: none !important; }
.conversation-toolbar .conversation-pins-button { position: static; min-width: 0; flex: 1; width: auto; }
.conversation-toolbar .conversation-page { flex: none; min-width: 40px; min-height: 40px; }
.rich-message.assistant.streaming .rich-message-text::after { content: "▋"; display: inline-block; margin-left: 3px; color: var(--accent); font-size: 13px; vertical-align: baseline; animation: rich-blink 0.85s ease-in-out infinite; }
@keyframes rich-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.conversation-page { min-height: 40px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--text-2, #aaa); font: inherit; font-size: 12px; cursor: pointer; touch-action: manipulation; }
.conversation-feed > .conversation-page { display: block; width: 100%; margin: 8px 0; }
.conversation-spacer { pointer-events: none; }
.tool-group { margin-bottom: 12px; padding-bottom: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-1, #111318); }
.tool-group-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 10px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--text-2); text-align: left; font: inherit; font-size: 13px; cursor: pointer; }
.tool-group-toggle[aria-expanded="true"] > svg { transform: rotate(180deg); }
.tool-group-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-status { flex: none; font-size: 10px; color: var(--muted); }
.tool-status[data-status="running"] { color: var(--accent); }
.tool-status[data-status="error"] { color: var(--error); }
.tool-status[data-status="succeeded"] { color: var(--ok); }
.tool-group-body { padding: 0 10px 10px; border-top: 1px solid var(--line); }
.tool-legacy-note { margin: 8px 2px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.tool-call { min-width: 0; border-bottom: 1px solid var(--line); }
.tool-call-summary { display: flex; align-items: center; gap: 8px; min-height: 44px; list-style: none; cursor: pointer; }
.tool-call-summary::-webkit-details-marker { display: none; }
.tool-call-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.tool-field { margin: 8px 0; min-width: 0; }
.tool-field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.tool-field-text { margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.6 ui-monospace, monospace; user-select: text; }
.tool-call-pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 8px; }
.tool-call-pager > span { margin-right: auto; }
.conversation-pins-dialog { width: min(640px, calc(100% - 24px)); max-height: 80dvh; overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-1, #111318); color: var(--text); }
.conversation-pin-list { display: grid; gap: 8px; margin: 12px 0; }
.conversation-pin-row { width: 100%; min-height: 48px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.conversation-highlight { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
@media (max-width: 640px) {
  .message-actions .text-copy, .message-pin, .tool-field-head .text-copy { min-width: 44px; min-height: 44px; }
  .tool-group-toggle { gap: 6px; padding: 8px; }
  .tool-status { max-width: 96px; text-align: right; }
}
.text-copy { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; min-width: 36px; padding: 6px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; vertical-align: middle; touch-action: manipulation; font: inherit; }
.text-copy:hover { background: var(--surface-2, #20242a); color: var(--text); }
.text-copy svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; }
.copy-status:not(:empty) { position: absolute; bottom: 100%; right: 0; padding: 5px 8px; border-radius: 6px; background: var(--surface-4); color: var(--text); white-space: nowrap; font-size: 12px; z-index: 5; }
.clipboard-buffer { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; }
.message-code { position: relative; margin: 8px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.message-code > .text-copy { position: absolute; right: 4px; top: 4px; }
.message-code pre { margin: 0; padding: 32px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px ui-monospace, monospace; }
.rich-account-actions .button, .rich-version-row .button { min-height: 40px; }
.rich-path { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.rich-account-create .button { min-height: 44px; }
.rich-field { display: flex; flex-direction: column; gap: 7px; flex: 1 1 160px; min-width: 0; max-width: 100%; }
.rich-select { width: 100%; min-width: 0; min-height: 44px; padding: 10px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.rich-empty { padding: 32px 16px; text-align: center; }
.rich-account-create { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 18px; }
.rich-account-actions { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }
.rich-version-row { padding: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); }
.rich-version-copy { flex: 1; min-width: 170px; display: grid; gap: 6px; }
.rich-terminal-dock { position: fixed; z-index: 24; top: var(--topbar-height); bottom: 0; right: 0; width: var(--terminal-width); background: #141311; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.rich-terminal-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: #f0ece6; background: #201d19; flex: none; }
.rich-terminal-head strong { min-width: 0; margin-right: auto; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-terminal-head .button { flex: none; color: #f0ece6; }
.rich-terminal-body { flex: 1; min-height: 0; }
.rich-terminal-frame { width: 100%; height: 100%; border: 0; display: block; }
.rich-terminal-open #main { margin-right: var(--terminal-width); width: auto; max-width: none; }
.rich-terminal-dock.collapsed { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); width: auto; border: 1px solid var(--line); border-radius: 12px; right: 16px; overflow: hidden; }
.rich-terminal-dock.collapsed .rich-terminal-body, .rich-terminal-dock.collapsed #rich-terminal-collapse { display: none; }
.rich-terminal-dock:not(.collapsed) #rich-terminal-expand { display: none; }
.mark img, .glyph img { display: block; width: 65%; height: 65%; object-fit: contain; }
.glyph { display: inline-grid; place-items: center; }
html[data-theme="light"] .mark.codex img,
html[data-theme="light"] .glyph.codex img { filter: invert(1); }
.mark.grok img, .glyph.grok img { width: 90%; height: 90%; }
.account-email { overflow-wrap: anywhere; }
.rich-authorized { color: var(--ok); }
.rich-auth-body { display: grid; gap: 14px; }
.rich-auth-body p { margin: 0; }
.rich-auth-link { text-align: center; white-space: normal; }
.rich-device-code { font-size: 22px; letter-spacing: .1em; padding: 14px; border: 1px solid var(--line); border-radius: 10px; text-align: center; }
.rich-auth-code-form { display: grid; gap: 12px; }
.rich-auth-code-form input { width: 100%; min-width: 0; }
@media (max-width: 1439.98px) {
  .rich-terminal-dock { width: calc(100% - var(--sidebar)); }
  .rich-terminal-open #main { margin-right: 0; }
}
@media (max-width: 1023.98px) {
  .rich-terminal-dock { width: 100%; bottom: calc(var(--nav-height) + 1px + env(safe-area-inset-bottom)); }
  .rich-terminal-dock.collapsed { width: auto; max-width: calc(100% - 32px); bottom: calc(var(--nav-height) + 12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .rich-version-row > .button { flex: 1; }
}
.empty-connection { border-style: dashed; background: transparent; }
.empty-connection p { margin: 0; }
.connection-slot { margin: 0 0 6px; }
.rich-auth-steps { display: grid; gap: 6px; margin: 0; padding-left: 20px; font-size: 13px; color: var(--text-2); }
.rich-auth-links { display: flex; flex-wrap: wrap; gap: 8px; }

/* Agent session, Happier-style: full-height chat, a status line and a composer card with chips. */
main.session-open { display: flex; flex-direction: column; height: calc(100dvh - var(--topbar-height)); padding-bottom: 16px; }
main.session-open .page-heading, main.session-open .page-footer { display: none; }
main.session-open #content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rich-session { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.rich-session-head { display: flex; align-items: center; gap: 12px; min-width: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); position: relative; }
.rich-session-head > .mark { width: 42px; height: 42px; border-radius: 50%; }
.rich-session-title { flex: 1; min-width: 0; }
.rich-session-title h2 { margin: 0 0 2px; font-size: 18px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-session-title .rich-path { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rich-session-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.rich-session-head .icon-button { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; }
.rich-session-head .icon-button .icon { width: 20px; height: 20px; }
.rich-conversation { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rich-feed { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px 2px 12px; }
.rich-feed-inner, .rich-dock { width: 100%; max-width: 880px; margin: 0 auto; }
.rich-message { margin: 0 0 18px; }
.rich-message-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.rich-message-head strong { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rich-message-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.6; color: var(--text); }
.rich-message.user { width: fit-content; margin-left: auto; max-width: min(88%, 680px); padding: 12px 16px; border-radius: 18px; background: var(--surface-3); }
.rich-message.user .rich-message-head { display: flex; justify-content: flex-end; margin: -8px -8px 0 0; }
.rich-message.user .rich-message-head > strong, .rich-message.user .rich-message-head > time { display: none; }
.rich-message.tool, .rich-message.status { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-1); }
.rich-message.tool .rich-message-text, .rich-message.status .rich-message-text { font-size: 12.5px; color: var(--text-2); }
.rich-message.tool .rich-message-text { font-family: var(--mono); }
pre.rich-message-text { font-family: var(--mono); max-height: 320px; overflow: auto; }
.rich-dock { flex: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.rich-status-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 6px; min-height: 22px; font-size: 13px; }
.rich-presence { display: inline-flex; align-items: center; gap: 7px; min-width: 0; color: var(--text-2); }
.rich-presence > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-presence .dot { width: 8px; height: 8px; flex: none; }
.rich-presence.ok .dot { background: var(--ok); } .rich-presence.ok { color: var(--ok); }
.rich-presence.work .dot { background: var(--work); animation: rich-pulse 1.2s ease-in-out infinite; }
.rich-presence.error .dot { background: var(--error); animation: rich-pulse 1s ease-in-out infinite; } .rich-presence.error { color: var(--error); }
.rich-presence.idle .dot { background: var(--muted); }
.rich-mode-badge { flex: none; font-size: 12.5px; font-weight: 650; letter-spacing: .02em; color: var(--muted); }
.rich-mode-badge.warn { color: var(--warn); } .rich-mode-badge.error { color: var(--error); } .rich-mode-badge.work { color: var(--work); }
.rich-composer { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px 12px 10px 16px; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--surface-1); box-shadow: 0 8px 28px -18px var(--shadow-strong, rgba(0,0,0,.5)); }
.rich-composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
.rich-composer textarea { width: 100%; min-height: 28px; max-height: 140px; resize: none; border: 0; outline: 0; padding: 4px 0; background: transparent; color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.5; }
.rich-composer textarea::placeholder { color: var(--muted); }
.rich-composer-foot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rich-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; flex: 1; }
.button.rich-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 220px; padding: 0 10px; border: 0; border-radius: 12px; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 550; }
.button.rich-chip:hover:enabled, .button.rich-chip[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.button.rich-chip .icon { width: 18px; height: 18px; flex: none; }
.button.rich-chip .mark.tiny { width: 20px; height: 20px; border-radius: 50%; }
.rich-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-chip-sub { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.button.rich-plan-chip[aria-pressed="true"] { color: var(--work); }
.button.rich-mode-chip.mode-auto { color: var(--warn); }
.button.rich-mode-chip.mode-yolo { color: var(--error); }
.rich-composer-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.button.rich-round { width: 42px; height: 42px; min-height: 42px; padding: 0; justify-content: center; border-radius: 50%; border: 0; }
.button.rich-round .icon { width: 20px; height: 20px; stroke-width: 2; }
.button.rich-mic { background: transparent; color: var(--text-2); position: relative; }
.button.rich-mic:hover:enabled { background: var(--surface-3); color: var(--text); }
.button.rich-mic.recording, .button.rich-mic.recording:hover:enabled { background: var(--error); color: #fff; }
.button.rich-mic.recording::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--error); animation: rich-ring 1.4s ease-out infinite; }
.button.rich-mic.transcribing { color: var(--work); animation: rich-pulse 1s ease-in-out infinite; }
.button.rich-send { background: var(--accent); color: var(--accent-ink); }
.button.rich-send:disabled { background: var(--surface-3); color: var(--muted); opacity: 1; }
.button.rich-send.stop { background: var(--text); color: var(--bg); }
.button.rich-send.stop .icon { fill: currentColor; width: 14px; height: 14px; }
@keyframes rich-pulse { 50% { opacity: .35; } }
@keyframes rich-ring { from { transform: scale(.9); opacity: .8; } to { transform: scale(1.35); opacity: 0; } }

.rich-popover { position: absolute; z-index: 20; left: 8px; right: 8px; bottom: calc(100% + 8px); max-height: min(62dvh, 560px); overflow: auto; overscroll-behavior: contain;
  padding: 14px; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface-1); box-shadow: 0 24px 60px -20px var(--shadow-strong, rgba(0,0,0,.6)); }
.rich-popover.appear { animation: rich-pop .16s ease-out; }
.rich-session-actions .rich-popover { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); width: min(320px, calc(100vw - 32px)); }
@keyframes rich-pop { from { opacity: 0; transform: translateY(6px); } }
.rich-pop-title { margin: 6px 4px 4px; font-size: 11.5px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rich-pop-title:first-child { margin-top: 0; }
.rich-pop-note { margin: 0 4px 10px; font-size: 12.5px; color: var(--muted); }
.rich-pop-agents { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.button.rich-pop-agent { min-height: 38px; max-width: 100%; gap: 8px; padding: 0 12px 0 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-weight: 550; }
.button.rich-pop-agent[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); color: var(--text); }
.rich-pop-agent-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-pop-search { width: 100%; min-height: 42px; margin-bottom: 8px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; }
.rich-pop-list { display: grid; gap: 2px; }
.rich-composer .rich-slash-menu { max-height: min(45dvh, 440px); padding: 10px; }
.button.rich-slash-choice { display: grid; justify-content: stretch; gap: 2px; width: 100%; min-height: 48px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--text); text-align: left; white-space: normal; }
.button.rich-slash-choice strong { font-family: var(--mono); font-size: 13px; }
.button.rich-slash-choice small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.button.rich-slash-choice[aria-selected="true"], .button.rich-slash-choice:hover:enabled { background: var(--surface-3); }
.rich-slash-menu .rich-pop-foot { font-size: 11px; }
.rich-pop-model { border-radius: 14px; }
.rich-pop-model.selected { background: var(--surface-2); padding-bottom: 10px; }
.button.rich-model-choice { width: 100%; min-height: 48px; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 0; border-radius: 14px; background: transparent; color: var(--text); text-align: left; white-space: normal; }
.button.rich-model-choice:hover:enabled { background: var(--surface-2); }
.rich-pop-model-copy { display: grid; gap: 2px; min-width: 0; }
.rich-pop-model-copy strong { font-weight: 560; }
.rich-pop-model-copy small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.rich-pop-label { margin: 4px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rich-effort-group { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; margin: 0 10px; padding: 3px; border-radius: 12px; background: var(--surface-3); }
.button.rich-effort-choice { min-height: 32px; min-width: 0; padding: 0 4px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.button.rich-effort-choice[aria-pressed="true"] { background: var(--surface-1); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.rich-pop-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 4px 0; }
.rich-mode-list { display: grid; gap: 2px; }
.button.rich-mode-choice { width: 100%; min-height: 54px; justify-content: flex-start; gap: 14px; padding: 8px 10px; border: 0; border-radius: 14px; background: transparent; color: var(--text); text-align: left; white-space: normal; }
.button.rich-mode-choice:hover:enabled { background: var(--surface-2); }
.rich-radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); }
.rich-mode-choice[aria-checked="true"] .rich-radio { border: 6px solid var(--work); }
.rich-mode-choice[aria-checked="true"] strong { color: var(--work); }
.rich-mode-choice.mode-yolo[aria-checked="true"] strong { color: var(--error); }
.rich-mode-choice.mode-yolo[aria-checked="true"] .rich-radio { border-color: var(--error); }
.rich-mode-copy { display: grid; gap: 2px; min-width: 0; }
.rich-mode-copy small { color: var(--muted); font-size: 12.5px; }
.rich-pop-wide { width: 100%; }
.rich-start { padding: 24px; text-align: center; }
.rich-start h3 { margin: 0 0 14px; }
.rich-start-agents { justify-content: center; }
@media (min-width: 1024px) {
  main.session-open { padding-bottom: 20px; }
  .rich-popover:not(.rich-more-menu) { right: auto; width: 440px; }
}
@media (max-width: 1023.98px) {
  main.session-open { padding-top: 12px; padding-bottom: calc(var(--nav-height) + 14px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .rich-select, .rich-composer textarea, .rich-pop-search { font-size: 16px; }
  .rich-session-head { gap: 8px; }
  .rich-session-head > .mark { width: 36px; height: 36px; }
  .rich-session-head .icon-button { width: 36px; height: 36px; }
  .rich-composer { padding: 10px 8px 8px 12px; border-radius: 20px; }
  .button.rich-chip { min-width: 40px; min-height: 40px; justify-content: center; padding: 0 8px; font-size: 13.5px; max-width: 150px; }
  /* The status line already names the mode; idle chips keep only their icon. */
  .rich-plan-chip[aria-pressed="false"] .rich-chip-text, .rich-mode-chip .rich-chip-text { display: none; }
  .rich-model-chip .rich-chip-sub { display: none; }
  .rich-model-chip .rich-chip-text { max-width: 92px; }
  .rich-popover { left: 0; right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .rich-thinking::before { animation: none; }
  .rich-presence .dot, .button.rich-mic.recording::after, .button.rich-mic.transcribing, .rich-popover { animation: none; }
}

/* Stage 12C: session list, new-session sheet, Files / Git / Details. */
.rich-sessions { display: grid; gap: 12px; }
.rich-session-list { display: grid; gap: 14px; align-content: start; min-width: 0; }
.rich-list-tools { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rich-list-tools .rich-pop-search { margin: 0; flex: 1; min-width: 0; }
.rich-list-tools .icon-button { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 12px; flex: none; }
.rich-groups { display: grid; gap: 14px; }
.rich-sessions, .rich-session-list, .rich-groups, .rich-group-rows { grid-template-columns: minmax(0, 1fr); }
.rich-group { min-width: 0; }
.rich-group-head { display: flex; align-items: center; gap: 6px; padding: 0 2px 6px; }
.button.rich-group-toggle { flex: 1; min-width: 0; min-height: 40px; justify-content: flex-start; gap: 6px; padding: 0 6px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; }
.rich-group-toggle .icon { width: 16px; height: 16px; transition: transform .15s; }
.rich-group-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.rich-group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-group-head .icon-button { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 10px; }
.rich-group-lock { font-size: 12px; color: var(--muted); padding-right: 8px; }
.rich-group-rows { display: grid; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-1); overflow: hidden; }
.button.rich-session-row { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 54px; padding: 8px 14px; border: 0; border-radius: 0;
  background: transparent; color: var(--text-2); text-align: left; font-weight: 450; }
.button.rich-session-row + .rich-session-row { border-top: 1px solid var(--line); }
.button.rich-session-row:hover { background: var(--surface-2); }
.button.rich-session-row[aria-current="true"] { background: color-mix(in srgb, var(--accent) 10%, var(--surface-1)); color: var(--text); }
.button.rich-session-row.unread { color: var(--text); font-weight: 650; }
.rich-session-row .mark.tiny { width: 24px; height: 24px; border-radius: 50%; }
.rich-session-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-session-name > span, .rich-session-agent { display: block; overflow: hidden; text-overflow: ellipsis; }
.rich-session-agent { color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 3px; }
.rich-unread-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--error); }
.rich-session-age { flex: none; color: var(--muted); font-size: 12px; font-weight: 450; }
.rich-group-empty { margin: 0; padding: 14px; }
.rich-frame { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.rich-split { flex: 1; min-height: 0; display: flex; }
.rich-split > .rich-session { flex: 1; min-width: 0; }
.rich-side { display: none; }
@media (min-width: 1280px) {
  .rich-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
  .rich-side { display: block; min-height: 0; overflow: auto; padding-right: 4px; border-right: 1px solid var(--line); }
  .rich-side .rich-group-rows { border-radius: 14px; }
}
.rich-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); align-self: flex-start; }
.button.rich-tab { min-height: 38px; gap: 8px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; color: var(--text-2); font-weight: 560; }
.button.rich-tab[aria-current="page"] { background: var(--surface-1); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.button.rich-tab .icon { width: 18px; height: 18px; }
.rich-tab .mark.tiny { width: 20px; height: 20px; border-radius: 50%; }
.rich-panel { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 880px; margin: 0 auto; }
.rich-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 12.5px; }
.rich-crumbs code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.button.rich-up { flex: none; gap: 4px; }
.rich-file-list { display: grid; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-1); overflow: hidden; }
.button.rich-file-row { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 46px; padding: 6px 14px; border: 0; border-radius: 0; background: transparent; color: var(--text); text-align: left; font-weight: 450; }
.button.rich-file-row + .rich-file-row { border-top: 1px solid var(--line); }
.button.rich-file-row:hover { background: var(--surface-2); }
.rich-file-row .icon { width: 20px; height: 20px; flex: none; color: var(--muted); }
.rich-file-row.dir .icon { color: var(--work); }
.rich-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.rich-file-size { flex: none; }
.rich-change { flex: none; display: inline-flex; gap: 6px; font-family: var(--mono); font-size: 12px; }
.rich-add-count { color: var(--ok); } .rich-del-count { color: var(--error); }
.rich-git-status { flex: none; width: 22px; text-align: center; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--warn); }
.rich-git-status.s-A, .rich-git-status.s-U { color: var(--ok); } .rich-git-status.s-D { color: var(--error); } .rich-git-status.s-R { color: var(--work); }
.rich-branch { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 0; font-size: 14px; }
.rich-branch .icon { width: 16px; height: 16px; flex: none; }
.rich-viewer-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rich-viewer-head .icon-button { width: 40px; height: 40px; padding: 0; justify-content: center; flex: none; }
.rich-viewer-title { flex: 1; min-width: 0; display: grid; }
.rich-viewer-title small, .rich-viewer-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-code { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-1); font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  overflow: auto; white-space: pre; tab-size: 4; min-height: 120px; }
.rich-diff .add { color: var(--ok); background: color-mix(in srgb, var(--ok) 9%, transparent); display: block; }
.rich-diff .del { color: var(--error); background: color-mix(in srgb, var(--error) 9%, transparent); display: block; }
.rich-diff .hunk { color: var(--work); display: block; }
.rich-details-card { display: grid; justify-items: center; gap: 10px; padding: 24px 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-1); text-align: center; }
.rich-details-card h3 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.mark.large { width: 72px; height: 72px; border-radius: 50%; font-size: 26px; }
.rich-details-list { margin: 0; display: grid; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-1); overflow: hidden; }
.rich-details-row { display: grid; grid-template-columns: minmax(120px, 38%) minmax(0, 1fr); gap: 12px; padding: 11px 16px; }
.rich-details-row + .rich-details-row { border-top: 1px solid var(--line); }
.rich-details-row dt { color: var(--muted); font-size: 13px; }
.rich-details-row dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; }
.rich-details-row dd.mono { font-family: var(--mono); font-size: 12px; }
.rich-actions { display: grid; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-1); overflow: hidden; }
.button.rich-action-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; white-space: normal; overflow-wrap: anywhere; padding: 10px 16px; border: 0; border-radius: 0; background: transparent; color: var(--text); text-align: left; }
.button.rich-action-row + .rich-action-row { border-top: 1px solid var(--line); }
.button.rich-action-row:hover:enabled { background: var(--surface-2); }
.rich-action-row > .icon:first-child { width: 22px; height: 22px; color: var(--work); flex: none; }
.rich-action-row > .icon:last-child { width: 16px; height: 16px; color: var(--muted); margin-left: auto; flex: none; }
.button.rich-attach { background: transparent; color: var(--text-2); }
.button.rich-attach:hover:enabled { background: var(--surface-3); color: var(--text); }
.rich-sheet { width: min(560px, calc(100vw - 24px)); }
.rich-sheet .rich-pop-search { margin: 6px 0 4px; }
.rich-folder-list { display: grid; gap: 2px; max-height: 60dvh; overflow: auto; }
.button.rich-folder-row { display: flex; align-items: center; justify-content: flex-start; gap: 12px; white-space: normal; width: 100%; min-height: 56px; padding: 8px 12px; border: 0; border-radius: 14px; background: transparent; color: var(--text); text-align: left; }
.button.rich-folder-row:hover:enabled { background: var(--surface-2); }
.rich-folder-row > .icon { width: 22px; height: 22px; color: var(--work); flex: none; }
.rich-folder-copy { display: grid; min-width: 0; }
.rich-folder-copy strong { font-weight: 560; overflow-wrap: anywhere; }
.rich-folder-copy small { color: var(--muted); overflow-wrap: anywhere; }
.button.rich-sheet-back { gap: 8px; margin-bottom: 6px; }
.rich-sheet-agents { margin-top: 4px; }
@media (max-width: 1023.98px) {
  /* A session is a full screen with its own floating tab bar, like Happier. */
  .shell:has(main.session-open) .sidebar { display: none; }
  main.session-open { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .rich-tabs { position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom));
    border: 1px solid var(--line-strong); border-radius: 999px; background: color-mix(in srgb, var(--surface-1) 94%, transparent); backdrop-filter: blur(14px);
    box-shadow: 0 12px 34px -16px var(--shadow-strong); }
  .button.rich-tab { min-width: 54px; min-height: 46px; padding: 0 12px; border-radius: 999px; justify-content: center; }
  .rich-tab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .shell:has(main.session-open) .rich-terminal-dock { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .rich-details-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .rich-code { font-size: 12px; padding: 10px; }
}

.rich-embedded { margin-bottom: 20px; }
.rich-embedded .rich-conversation, .rich-embedded .rich-panel { flex: none; height: min(72dvh, 760px); }
@media (max-width: 1023.98px) {
  .rich-embedded .rich-tabs { position: static; transform: none; align-self: stretch; box-shadow: none; backdrop-filter: none; border: 0; border-radius: 16px; background: var(--surface-2); }
  .rich-embedded .button.rich-tab { flex: 1; min-width: 0; padding: 0 6px; border-radius: 12px; }
}
@media (min-width: 480px) and (max-width: 1023.98px) {
  .rich-embedded .rich-tab-label { position: static; width: auto; height: auto; clip: auto; }
}

/* Compact agent/model and mode menus (owner feedback 2026-10-13). */
.rich-popover { padding: 12px; border-radius: 18px; }
.rich-pop-title { margin: 2px 6px 6px; font-size: 11px; }
.rich-pop-agents { gap: 6px; margin-bottom: 10px; }
.button.rich-pop-agent { min-height: 36px; max-width: 230px; gap: 7px; padding: 0 11px 0 4px; font-size: 13px; }
.button.rich-pop-agent .mark.tiny { width: 26px; height: 26px; border-radius: 50%; }
.rich-pop-list { gap: 0; }
.button.rich-model-choice { min-height: 42px; padding: 6px 10px; border-radius: 12px; }
.rich-pop-model-copy strong { font-size: 14px; }
.rich-pop-model-copy small { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.rich-pop-model { border-radius: 12px; }
.rich-pop-model.selected { padding-bottom: 8px; }
.rich-pop-label { margin: 2px 10px 4px; font-size: 10.5px; }
.rich-effort-group { margin: 0 8px; padding: 2px; border-radius: 10px; }
.button.rich-effort-choice { min-height: 30px; border-radius: 8px; font-size: 12px; }
.rich-pop-foot { margin: 8px 4px 0; flex-wrap: nowrap; }
.rich-pop-foot > span { min-width: 0; font-size: 11.5px; }
.rich-pop-reload { flex: none; width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 10px; }
.rich-pop-reload .icon { width: 17px; height: 17px; }
.button.rich-mode-choice { min-height: 48px; gap: 12px; padding: 6px 10px; border-radius: 12px; }
.rich-radio { width: 18px; height: 18px; }
.rich-mode-choice[aria-checked="true"] .rich-radio { border-width: 5px; }
.rich-mode-copy small { font-size: 12px; }
@media (min-width: 1024px) {
  .rich-popover:not(.rich-more-menu) { width: 400px; }
}
@media (pointer: coarse) {
  .button.rich-effort-choice { min-height: 36px; }
  .button.rich-pop-agent { min-height: 40px; }
}
@media (max-width: 640px) {
  /* Phone composer: text with 📎 🎤 ↑ beside it, one row of chips underneath. */
  .rich-composer { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "input actions" "chips chips"; align-items: end; column-gap: 6px; }
  .rich-composer textarea { grid-area: input; align-self: center; }
  .rich-composer-foot { display: contents; }
  .rich-chips { grid-area: chips; flex-wrap: nowrap; margin-left: -6px; }
  .rich-composer-actions { grid-area: actions; gap: 4px; }
  .button.rich-round { width: 38px; height: 38px; min-height: 38px; }
  .rich-model-chip .rich-chip-text { max-width: 120px; }
}

/* Stage B: Richi workspace with restrained bronze selections. */
.mark svg { display: block; width: 65%; height: 65%; }
html[data-theme="light"] .mark.codex svg { filter: invert(1); }
.rich-session-list { gap: 16px; }
.rich-list-tools { flex: none; }
.rich-session-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.button.rich-session-filter { border: 1px solid transparent; border-radius: 999px; background: transparent; min-height: 36px; padding: 6px 11px; color: var(--muted); font-size: 12px; }
.button.rich-session-filter[aria-pressed="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface-1)); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); }
.rich-group-head { gap: 2px; }
.button.rich-group-toggle { gap: 7px; font-size: 12px; }
.rich-group-count { font-size: 11px; font-weight: 450; opacity: .65; margin-left: 3px; }
.rich-group-head .icon-button { color: var(--muted); }
.rich-group-rows { border-radius: 16px; }
.rich-session-entry { display: flex; align-items: stretch; min-width: 0; position: relative; }
.rich-session-entry + .rich-session-entry { border-top: 1px solid var(--line); }
.rich-session-entry:has([aria-current="true"]) { background: color-mix(in srgb, var(--accent) 7%, var(--surface-1)); }
.rich-session-entry:has([aria-current="true"])::before { content: ''; position: absolute; width: 3px; inset: 12px auto 12px 0; background: var(--accent); border-radius: 0 3px 3px 0; }
.button.rich-session-row { flex: 1; width: auto; min-width: 0; gap: 10px; padding: 12px; min-height: 68px; background: transparent; }
.button.rich-session-row[aria-current="true"] { background: transparent; }
.rich-session-task { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 550; line-height: 1.35; }
.rich-session-agent { display: block; font-size: 11px; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 400; }
.rich-session-trailing { flex: none; display: grid; gap: 4px; text-align: right; }
.rich-session-state { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; color: var(--muted); font-size: 10px; font-weight: 450; }
.rich-session-state.work { color: var(--work); }
.rich-session-state.error { color: var(--error); }
.rich-session-state.warn { color: var(--warn); }
.rich-session-state .dot { width: 5px; height: 5px; }
.rich-session-age { display: flex; gap: 5px; align-items: center; justify-content: flex-end; font-size: 10px; }
.button.rich-row-menu { align-self: center; flex: none; width: 36px; min-height: 40px; padding: 8px; margin-right: 3px; color: var(--muted); }
.rich-row-menu .icon { width: 17px; height: 17px; }
.rich-session-entry.state-running { background: color-mix(in srgb, var(--work) 3%, var(--surface-1)); }
.rich-list-menu { width: min(390px, calc(100vw - 24px)); }
.rich-list-menu h2 { overflow-wrap: anywhere; }
.button.rich-list-menu-action { display: flex; justify-content: flex-start; width: 100%; min-height: 44px; border: 0; padding: 10px 12px; border-radius: 10px; background: transparent; text-align: left; font-weight: 450; }
.rich-list-menu-action:hover { background: var(--surface-2); }
.rich-list-menu > .text-copy { width: 100%; min-height: 44px; display: flex; gap: 10px; justify-content: flex-start; padding: 10px 12px; font-size: 13px; }
.rich-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.rich-rename-form { display: grid; gap: 16px; margin-top: 16px; }
.rich-session-head { flex: none; gap: 8px; padding-bottom: 10px; }
.rich-session-title h2 { font-size: 16px; font-weight: 580; }
.rich-session-location { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11px; color: var(--muted); margin-top: 3px; }
.rich-session-location > span { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rich-session-location .rich-path { min-width: 0; font-size: 10px; opacity: .7; }
.rich-session-meta { display: flex; align-items: center; gap: 12px; position: relative; flex: none; min-width: 0; }
.button.rich-current-agent { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-1); min-height: 38px; padding: 5px 10px; min-width: 0; max-width: 65%; }
.rich-current-agent-copy { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.rich-current-agent-copy strong { font-size: 12px; font-weight: 550; }
.rich-current-agent-copy small { font-size: 10px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rich-current-agent .icon { width: 12px; height: 12px; flex: none; color: var(--muted); }
.rich-current-agent .mark.tiny { width: 19px; height: 19px; }
.rich-current-model { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; color: var(--muted); }
.rich-session-meta .rich-model-menu { top: calc(100% + 6px); bottom: auto; left: 0; right: auto; max-height: min(60dvh, 540px); width: min(440px, 100%); }
.rich-start { display: grid; justify-items: start; align-content: center; gap: 12px; margin: auto 0; padding: 24px; }
.rich-start > .icon { width: 34px; height: 34px; color: var(--accent); }
.rich-start p { max-width: 360px; line-height: 1.6; }
/* The outer panel owns scrolling. Lists never shrink and hide their last rows. */
.rich-files { overscroll-behavior-y: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; scrollbar-gutter: stable; }
.rich-files > *, .rich-file-list, .rich-code, .rich-details-list, .rich-actions { flex-shrink: 0; }
.rich-files .rich-list-tools { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 0 0 8px; margin: 0; }
.rich-files .rich-crumbs { min-height: 30px; }
.rich-file-row { touch-action: pan-y; }
.rich-files input { min-width: 0; font-size: 16px; }
.rich-panel { padding-bottom: 12px; }
@media (min-width: 1024px) {
  .rich-side { width: auto; }
  .rich-split { grid-template-columns: 320px minmax(0, 1fr); gap: 22px; }
  .rich-side .rich-session-state { font-size: 9px; }
  .rich-side .rich-session-row { padding: 10px; gap: 8px; }
  .rich-side .rich-session-task { font-size: 12.5px; }
  .rich-side .rich-row-menu { width: 30px; margin-right: 2px; }
}
@media (max-width: 1023.98px) {
  :root { --topbar-height: calc(56px + max(env(safe-area-inset-top), var(--rich-safe-top, 0px))); }
  .topbar { padding-top: max(env(safe-area-inset-top), var(--rich-safe-top, 0px)); }
  main.session-open { height: calc(var(--rich-viewport-height, 100dvh) - var(--topbar-height)); padding-bottom: calc(72px + max(env(safe-area-inset-bottom), var(--rich-safe-bottom, 0px))); padding-top: 12px; overflow: hidden; }
  .rich-session { gap: 9px; }
  .rich-tabs { bottom: calc(10px + var(--rich-viewport-bottom, 0px) + max(env(safe-area-inset-bottom), var(--rich-safe-bottom, 0px))); gap: 2px; padding: 4px; }
  .button.rich-tab { min-width: 52px; min-height: 44px; }
  .rich-session-head .icon-button { width: 40px; height: 40px; min-height: 40px; }
  .rich-session-title h2 { font-size: 15px; }
  .rich-session-location { gap: 5px; }
  .rich-session-meta { gap: 8px; }
  .rich-current-agent-copy small { max-width: 120px; }
  .rich-session-meta .rich-model-menu { width: min(440px, 100%); max-height: calc(var(--rich-viewport-height, 100dvh) - 210px); }
  .rich-list-menu, .rich-rename-dialog, .rich-sheet { max-height: calc(var(--rich-viewport-height, 100dvh) - 32px); margin-bottom: calc(var(--rich-viewport-bottom, 0px) + max(env(safe-area-inset-bottom), var(--rich-safe-bottom, 0px))); }
  .rich-session-filters { gap: 4px; }
  .button.rich-session-filter { min-height: 38px; padding: 6px 9px; font-size: 11px; }
  .rich-group-head .icon-button { width: 38px; min-height: 40px; }
}
@media (max-width: 360px) {
  .rich-session-row { gap: 7px; }
  .rich-session-task { font-size: 12px; }
  .rich-session-trailing { max-width: 58px; }
  .rich-current-agent-copy small { display: none; }
  .rich-session-location > span { max-width: 60%; }
  .rich-session-location .rich-path { display: none; }
}

/* Reference composition: grouped lists, quiet chat, round dock and model sheet. */
.rich-sessions { gap: 18px; }
.rich-session-list { gap: 18px; max-width: 100%; min-width: 0; }
.rich-groups, .rich-group { max-width: 100%; min-width: 0; }
.rich-session-filters { max-width: 100%; min-width: 0; overscroll-behavior-x: contain; }
.rich-groups { gap: 22px; }
.rich-group-head { padding: 0 6px 8px; }
.button.rich-group-toggle { font-size: 13px; font-weight: 550; color: var(--muted); }
.rich-group-rows { border: 0; border-radius: 22px; background: var(--surface-1); }
.button.rich-session-row { min-height: 72px; padding: 14px; }
.rich-session-task { font-size: 14px; font-weight: 500; }
.rich-session-row.unread .rich-session-task { font-weight: 650; }
.rich-session-entry:has([aria-current="true"]) { background: color-mix(in srgb, var(--accent) 5%, var(--surface-1)); }
.rich-session-entry:has([aria-current="true"])::before { display: none; }
.rich-session-entry.state-running { background: var(--surface-1); }
.rich-session-row .mark.tiny { background: transparent; border-color: transparent; width: 28px; height: 28px; }
.rich-session-row .mark svg, .rich-session-row .mark img { width: 88%; height: 88%; }
.button.rich-session-filter { border-radius: 12px; font-weight: 500; }
.button.rich-session-filter[aria-pressed="true"] { color: var(--accent-text); border-color: var(--line); background: var(--surface-1); box-shadow: 0 2px 5px -3px var(--shadow-strong); }
.rich-pop-search { background: var(--surface-2); border-color: transparent; border-radius: 14px; }
.rich-session-head { border-bottom-color: var(--line); }
.rich-session-title h2 { font-weight: 620; letter-spacing: -.015em; }
.rich-current-agent { background: transparent; }
.rich-current-model { color: var(--muted); }
.rich-composer { border: 1px solid var(--line); border-radius: 26px; background: var(--surface-1); padding: 16px 14px 12px;
  box-shadow: 0 10px 36px -26px var(--shadow-strong); }
.rich-composer:focus-within { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.rich-composer textarea { color: var(--text); line-height: 1.55; }
.rich-composer textarea::placeholder { color: var(--muted); }
.rich-composer .rich-chip { color: var(--muted); font-weight: 500; }
.button.rich-round { min-width: 44px; width: 44px; height: 44px; min-height: 44px; }
.button.rich-send { color: var(--bronze-ink); background: var(--bronze-solid); border-radius: 50%; box-shadow: none; }
.button.rich-send:hover:enabled { background: var(--bronze-hover); }
.button.rich-send.stop { background: var(--text); color: var(--bg); }
.rich-message-text { font-size: 15px; line-height: 1.7; }
.rich-message.user { background: var(--surface-2); border-radius: 20px; padding: 12px 16px; }
.tool-group { border-radius: 16px; background: var(--surface-2); border-color: transparent; }
.tool-group-toggle { min-height: 46px; font-size: 13px; font-weight: 500; }
.conversation-pins-button, .conversation-page { border-color: var(--line); border-radius: 12px; }
.message-actions .text-copy, .message-pin { color: var(--muted); }
.message-pin[aria-pressed="true"] { color: var(--accent-text); }
.rich-popover { border: 1px solid var(--line); border-radius: 24px; padding: 18px; background: var(--surface-1);
  box-shadow: 0 22px 64px -24px var(--shadow-strong); }
.rich-pop-title { font-size: 11px; font-weight: 500; letter-spacing: .055em; }
.rich-pop-model.selected { background: var(--surface-2); border-color: transparent; border-radius: 18px; padding-bottom: 12px; }
.button.rich-model-choice { min-height: 50px; padding: 10px 12px; }
.rich-pop-model-copy strong { font-size: 15px; font-weight: 600; }
.rich-pop-model-copy small { font-size: 12px; line-height: 1.5; }
.rich-pop-label { font-size: 10px; font-weight: 500; margin: 6px 12px; }
.rich-effort-group { padding: 3px; border-radius: 13px; background: var(--surface-3); }
.button.rich-effort-choice { border-radius: 10px; min-height: 36px; font-weight: 450; }
.rich-effort-choice[aria-pressed="true"] { background: var(--surface-1); color: var(--accent-text); box-shadow: 0 2px 5px -3px var(--shadow-strong); }
.rich-mode-choice[aria-checked="true"] { background: var(--surface-2); }
.rich-details-card, .rich-details-list, .rich-actions { border-color: var(--line); border-radius: 22px; }
@media (max-width: 1023.98px) {
  .rich-tabs { border-color: var(--line); padding: 6px; border-radius: 32px; box-shadow: var(--floating-shadow); }
  .button.rich-tab { min-height: 46px; min-width: 54px; border-radius: 26px; }
  .button.rich-tab[aria-current="page"] { background: color-mix(in srgb, var(--accent) 8%, var(--surface-1)); color: var(--accent-text); }
  .rich-popover { max-height: min(62dvh, 560px); }
}
@media (max-width: 640px) {
  .rich-composer { grid-template-columns: minmax(0, 1fr) 44px; grid-template-areas: "input input" "chips actions"; align-items: center; padding: 10px 10px 8px; row-gap: 8px; }
  .rich-composer textarea { min-height: 38px; max-height: 100px; padding-right: 88px; font-size: 15px; }
  .rich-chips { flex-wrap: nowrap; min-width: 0; gap: 2px; }
  .rich-composer-actions { display: contents; }
  .rich-composer .rich-attach, .rich-composer .rich-mic { position: absolute; top: 8px; }
  .rich-composer .rich-attach { right: 54px; }
  .rich-composer .rich-mic { right: 10px; }
  .rich-composer .rich-send { grid-area: actions; }
  .rich-composer .rich-model-chip { min-width: 0; flex: 1; max-width: 180px; }
  .rich-model-chip .rich-chip-text { max-width: 100px; min-width: 0; }
  .button.rich-round { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .rich-popover { padding: 14px; }
  .rich-session-task { font-size: 14px; }
}

.rich-session-row .mark.claude svg { filter: grayscale(1); }

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .mark.codex svg,
  html:not([data-theme="dark"]) .mark.codex img { filter: invert(1); }
}

/* ---- Compact Mobile-First Session Header & Info Sheet ---- */
.rich-session-title-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent;
  padding: 4px 6px; margin: 0; border-radius: 12px; cursor: pointer; text-align: left;
  max-width: 100%; min-width: 0; transition: background .15s ease;
}
.rich-session-title-btn:hover { background: var(--surface-2); }
.rich-session-name {
  margin: 0; font-size: 16px; font-weight: 600; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.rich-header-status {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 550;
  padding: 2px 7px; border-radius: 999px; flex: none; line-height: 1;
}
.rich-header-status .dot { width: 6px; height: 6px; border-radius: 50%; }
.rich-header-status.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.rich-header-status.ok .dot { background: var(--ok); }
.rich-header-status.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.rich-header-status.warn .dot { background: var(--warn); }

.rich-offline-ribbon {
  grid-column: 1 / -1; font-size: 11.5px; line-height: 1.4; color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  border-radius: 10px; padding: 6px 10px; text-align: center;
}

/* Session Info Dialog */
.rich-info-dialog {
  width: min(480px, calc(100vw - 24px)); border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface-1); color: var(--text); padding: 18px 20px; box-shadow: 0 20px 60px -20px var(--shadow-strong);
}
.rich-info-title { font-size: 17px; margin: 0; font-weight: 650; }
.rich-info-status {
  padding: 10px 12px; border-radius: 12px; margin: 12px 0 16px; border: 1px solid var(--line);
  background: var(--surface-2); display: grid; gap: 4px;
}
.rich-info-status.ok { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, var(--surface-1)); }
.rich-info-status.warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 8%, var(--surface-1)); }
.rich-info-status-title { display: flex; align-items: center; gap: 8px; }
.rich-info-status-title strong { font-size: 13.5px; }
.rich-path-dd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rich-path-dd code { overflow-wrap: anywhere; word-break: break-all; }

/* Mobile full-height & decluttering */
@media (max-width: 1023.98px) {
  body.session-active .sidebar,
  .shell:has(main.session-open) .sidebar { display: none !important; }
  body.session-active .topbar,
  .workspace-main:has(main.session-open) .topbar { display: none !important; }
  
  main.session-open {
    height: var(--rich-viewport-height, 100dvh);
    padding: 0;
    overflow: hidden;
  }
  .rich-session {
    height: 100%;
    gap: 0;
  }
  .rich-session-head {
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
    background: color-mix(in srgb, var(--bg-raised) 92%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    min-height: 48px;
  }
  .rich-desktop-only { display: none !important; }
  .button.rich-session-row { min-height: 52px; padding: 7px 10px; }
  .rich-session-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .button.rich-session-filter { flex: none; min-height: 32px; padding: 4px 10px; }
  .rich-composer { border-radius: 18px; }
  .rich-composer .rich-model-menu { left: 0; right: 0; width: auto; max-height: min(58dvh, 480px); }
  .rich-session-head .rich-back { width: 36px; height: 36px; min-height: 36px; }
  .rich-session-head .rich-info-btn,
  .rich-session-head .rich-more-btn { width: 36px; height: 36px; min-height: 36px; }
  
  .rich-conversation {
    flex: 1;
    min-height: 0;
    height: 100%;
  }
  .rich-feed {
    padding: 10px 12px 8px;
  }
  .rich-dock {
    padding: 4px 10px max(8px, env(safe-area-inset-bottom));
    background: var(--bg);
  }
  .rich-tabs {
    display: none;
  }
}

/* Richi · night neon. Last layer: tokens first, then the dialogue in the Happier order —
   plain agent text, separate tool cards, user bubbles, one composer with labelled chips. */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07080d;
  --bg-raised: #0b0d14;
  --surface-1: #0f121b;
  --surface-2: #141824;
  --surface-3: #1b2030;
  --surface-4: #242a3d;
  --line: rgba(150, 170, 255, .085);
  --line-strong: rgba(150, 170, 255, .16);
  --text: #eceff8;
  --text-2: #bcc3d6;
  --muted: #8a93ab;
  --faint: #5b637a;
  --neon: #22d3ee;
  --neon-2: #a78bfa;
  --neon-3: #f472b6;
  --accent: var(--neon);
  --accent-ink: #02131a;
  --accent-text: #5ee6fa;
  --ok: #34d399;
  --work: #22d3ee;
  --warn: #fbbf24;
  --error: #fb7185;
  --protect: #a78bfa;
  --idle: #7c849b;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --mint: #34d399;
  --mix: white;
  --wash: rgba(120, 140, 255, .04);
  --hero-top: #0d1019;
  --shadow-strong: rgba(0, 0, 0, .9);
  --flow-line: rgba(150, 170, 255, .12);
  --bronze-solid: #22d3ee;
  --bronze-hover: #67e8f9;
  --bronze-ink: #02131a;
  --glow: 0 0 0 1px rgba(34, 211, 238, .38), 0 0 22px -4px rgba(34, 211, 238, .45);
  --glow-soft: 0 0 0 1px rgba(34, 211, 238, .22), 0 0 16px -8px rgba(34, 211, 238, .5);
  --neon-gradient: linear-gradient(135deg, #22d3ee 0%, #818cf8 55%, #c084fc 100%);
}
:root[data-theme="light"] { --neon: #0891b2; --neon-2: #7c3aed; --accent-text: #0e7490; --glow: 0 0 0 1px rgba(8, 145, 178, .35); --glow-soft: 0 0 0 1px rgba(8, 145, 178, .2);
  --neon-gradient: linear-gradient(135deg, #0891b2, #6366f1); --accent: #0891b2; --accent-ink: #ffffff; --bronze-solid: #0891b2; --bronze-hover: #0e7490; --bronze-ink: #fff; }

/* Night backdrop: two faint neon glows, nothing that moves. */
:root:not([data-theme="light"]) body {
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(129, 140, 248, .10), transparent 60%),
    radial-gradient(100% 50% at 100% 100%, rgba(34, 211, 238, .08), transparent 60%),
    var(--bg) fixed;
}
:root:not([data-theme="light"]) .topbar, :root:not([data-theme="light"]) .rich-session-head { background: rgba(9, 11, 18, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
:root:not([data-theme="light"]) .brand-mark { background: var(--neon-gradient); color: #050610; box-shadow: var(--glow); }
:root:not([data-theme="light"]) .button.primary { background: var(--neon-gradient); color: #050610; box-shadow: var(--glow); }
:root:not([data-theme="light"]) .connection .dot, :root:not([data-theme="light"]) .rich-presence.ok .dot { box-shadow: 0 0 10px var(--ok); }
:root:not([data-theme="light"]) .rich-presence.work .dot { box-shadow: 0 0 10px var(--work); }
:root:not([data-theme="light"]) .rich-presence.error .dot { box-shadow: 0 0 10px var(--error); }
:root:not([data-theme="light"]) .nav-main[aria-current="page"] .icon, :root:not([data-theme="light"]) .nav a[aria-current="page"] .icon { filter: drop-shadow(0 0 6px rgba(34, 211, 238, .7)); }
:root:not([data-theme="light"]) .card, :root:not([data-theme="light"]) .panel { border-color: var(--line); }

/* ---- Dialogue ---- */
.conversation-item { padding-bottom: 18px; }
.conversation-item.from-user { display: flex; flex-direction: column; align-items: flex-end; }
.rich-message, .conversation-item .rich-message { margin: 0; }
.rich-message.user { max-width: min(86%, 680px); padding: 11px 15px; border: 1px solid var(--line-strong); border-radius: 20px 20px 6px 20px; background: var(--surface-3); }
:root:not([data-theme="light"]) .rich-message.user { background: linear-gradient(180deg, #1c2236, #171c2c); border-color: rgba(129, 140, 248, .22); }
.rich-message.assistant, .rich-message.report { padding: 0 2px; background: none; border: 0; }
.rich-message-text { font-size: 15.5px; line-height: 1.62; color: var(--text); }
.rich-message.user .rich-message-text { font-size: 15px; }

/* Quiet actions under the text, as in Happier: time, copy, pin. */
.message-actions { display: flex; justify-content: flex-end; align-items: center; gap: 2px; margin-top: 4px; min-height: 30px; opacity: .72; }
.from-user .message-actions { padding-right: 2px; }
.message-actions .message-time { margin-right: auto; padding-left: 2px; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.from-user .message-actions .message-time { margin-right: 6px; }
.message-actions .text-copy, .message-actions .message-pin { width: 32px; min-width: 32px; height: 30px; min-height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: inline-grid; place-items: center; }
.message-actions .text-copy svg, .message-actions .message-pin svg { width: 16px; height: 16px; }
.message-actions .text-copy:hover, .message-actions .message-pin:hover { color: var(--accent-text); background: var(--surface-2); }
.message-pin[aria-pressed="true"] { color: var(--accent-text); opacity: 1; }
@media (max-width: 640px) {
  .message-actions .text-copy, .message-pin { min-width: 36px; min-height: 34px; }
}

/* Markdown */
.rich-message-text > :first-child { margin-top: 0; }
.rich-message-text > :last-child { margin-bottom: 0; }
.rich-message-text .md-p { margin: 0 0 .7em; }
.rich-message-text .md-h { margin: 1em 0 .45em; font-weight: 680; line-height: 1.3; letter-spacing: -.01em; color: var(--text); }
.rich-message-text h3.md-h { font-size: 1.18em; }
.rich-message-text h4.md-h { font-size: 1.08em; }
.rich-message-text h5.md-h, .rich-message-text h6.md-h { font-size: 1em; }
.rich-message-text .md-ul, .rich-message-text .md-ol { margin: 0 0 .7em; padding-left: 1.35em; }
.rich-message-text li { margin: .18em 0; padding-left: .15em; }
.rich-message-text li::marker { color: var(--accent-text); }
.rich-message-text .md-quote { margin: 0 0 .7em; padding: 2px 0 2px 12px; border-left: 2px solid var(--neon-2); color: var(--text-2); }
.rich-message-text .md-hr { height: 1px; margin: 1em 0; border: 0; background: var(--line-strong); }
.rich-message-text strong { font-weight: 680; color: var(--text); }
.rich-message-text .md-code { padding: .08em .38em; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--line); font-family: var(--mono); font-size: .86em; color: var(--accent-text); white-space: break-spaces; }
.rich-message-text .message-code { position: relative; margin: .2em 0 .8em; border: 1px solid var(--line-strong); border-radius: 12px; background: #05060b; }
:root[data-theme="light"] .rich-message-text .message-code { background: var(--surface-2); }
.rich-message-text .message-code pre { margin: 0; padding: 12px 14px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre; }
.rich-message-text .message-code > .text-copy { position: absolute; top: 6px; right: 6px; }
.rich-message-text a { color: var(--accent-text); text-decoration: underline; text-decoration-color: rgba(34, 211, 238, .35); text-underline-offset: 3px; }

/* Typing: a neon caret only on the reply that is still arriving. */
.rich-message.assistant.streaming .rich-message-text::after { content: ""; display: inline-block; width: .55em; height: 1.05em; margin-left: 3px; vertical-align: -.15em; border-radius: 2px; background: var(--neon); box-shadow: 0 0 10px var(--neon); animation: rich-blink 1s steps(2, start) infinite; }
.rich-message:not(.streaming) .rich-message-text::after { content: none !important; }
.rich-thinking { display: inline-flex; align-items: center; gap: 10px; margin: 2px 0; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.rich-thinking::before { content: none; }
.rich-thinking-dots { position: relative; width: 26px; height: 6px; background: radial-gradient(circle, var(--neon) 2.6px, transparent 3px) 0 50% / 10px 6px repeat-x; animation: hpr-dots 1.1s linear infinite; filter: drop-shadow(0 0 4px var(--neon)); }
@keyframes hpr-dots { 0% { opacity: .35; } 50% { opacity: 1; } 100% { opacity: .35; } }

/* Tool calls: their own card, never glued to the text around them. */
.tool-group { margin: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-1); overflow: hidden; }
:root:not([data-theme="light"]) .tool-group { background: rgba(15, 18, 27, .88); }
.conversation-item.tool-group { padding-bottom: 0; margin-bottom: 18px; }
.tool-group-toggle { gap: 10px; min-height: 50px; padding: 10px 14px; border-radius: 16px; background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 560; }
.tool-group-toggle > svg:first-child { color: var(--muted); }
.tool-group-toggle > svg:last-child { color: var(--muted); transition: transform .18s var(--ease); }
.tool-group-toggle[aria-expanded="true"] > svg:first-child { transform: none; }
.tool-group-toggle[aria-expanded="true"] > svg:last-child { transform: rotate(180deg); }
.tool-group .tool-status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 560; background: var(--surface-2); color: var(--muted); }
.tool-group .tool-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tool-status[data-status="succeeded"] { color: var(--ok); }
.tool-status[data-status="error"] { color: var(--error); }
.tool-status[data-status="running"] { color: var(--neon); }
:root:not([data-theme="light"]) .tool-status[data-status="running"]::before { box-shadow: 0 0 8px var(--neon); animation: hpr-dots 1.1s linear infinite; }
.tool-group-body { margin: 0 12px 0 22px; padding: 2px 0 8px 12px; border-top: 0; border-left: 1px solid var(--line-strong); }
.tool-call { border-bottom: 0; }
.tool-call-summary { min-height: 38px; gap: 10px; color: var(--text-2); }
.tool-call-summary > svg { color: var(--muted); }
.tool-call-name { font-family: var(--mono); font-size: 12px; }
.tool-call .tool-status { font-size: 10.5px; }
.tool-field-text { background: #05060b; border-color: var(--line); font-size: 12px; }
:root[data-theme="light"] .tool-field-text { background: var(--surface-2); }

/* Scroll-to-latest floats over the feed instead of a white bar on top of it. */
.conversation-toolbar { background: transparent; border: 0; box-shadow: none; padding: 0; }
.conversation-latest { position: sticky; bottom: 12px; z-index: 12; display: grid; place-items: center; width: 40px; height: 40px; margin: -52px 6px 12px auto;
  border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 18px; box-shadow: 0 8px 24px -10px var(--shadow-strong); cursor: pointer; }
:root:not([data-theme="light"]) .conversation-latest { box-shadow: var(--glow-soft), 0 8px 24px -10px #000; }
.conversation-latest[hidden] { display: none !important; }

/* ---- Status line and composer ---- */
.rich-status-line { padding: 0 8px; font-size: 12.5px; color: var(--muted); }
.rich-status-line .rich-mode-badge { font-weight: 650; letter-spacing: .02em; }
.rich-composer { border: 1px solid var(--line-strong); border-radius: 24px; background: var(--surface-1); box-shadow: 0 12px 40px -26px #000; transition: border-color .2s, box-shadow .2s; }
:root:not([data-theme="light"]) .rich-composer { background: rgba(14, 17, 26, .96); }
.rich-composer:focus-within { border-color: rgba(34, 211, 238, .45); box-shadow: var(--glow-soft), 0 12px 40px -26px #000; }
.rich-composer textarea { font-size: 16px; }
.rich-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 4px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent); padding-right: 14px; }
.rich-chips::-webkit-scrollbar { display: none; }
.rich-composer .button.rich-chip { flex: none; gap: 6px; min-height: 34px; max-width: none; padding: 0 10px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 520; }
.rich-composer .button.rich-chip:hover:enabled, .rich-composer .button.rich-chip[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.rich-composer .button.rich-chip[aria-expanded="true"] { box-shadow: var(--glow-soft); }
.rich-composer .rich-chip .rich-chip-text { display: inline; max-width: 170px; }
.rich-composer .rich-model-chip .rich-chip-sub { display: inline; font-family: inherit; font-size: 12.5px; color: var(--muted); }
.rich-composer .rich-mode-chip.mode-yolo { color: var(--error); }
.rich-composer .rich-plan-chip[aria-pressed="true"] { color: var(--warn); }
.button.rich-round { border-radius: 50%; }
.button.rich-attach, .button.rich-mic { background: transparent; color: var(--muted); }
.button.rich-attach:hover:enabled, .button.rich-mic:hover:enabled { color: var(--text); background: var(--surface-2); }
.button.rich-send { background: var(--neon-gradient); color: #050610; }
:root:not([data-theme="light"]) .button.rich-send:enabled { box-shadow: var(--glow); }
.button.rich-send:hover:enabled { filter: brightness(1.08); background: var(--neon-gradient); }
.button.rich-send:disabled { background: var(--surface-3); color: var(--faint); box-shadow: none; }
.button.rich-send.stop { background: var(--text); color: var(--bg); box-shadow: none; }
@media (max-width: 640px) {
  .rich-plan-chip[aria-pressed="false"] .rich-chip-text, .rich-mode-chip .rich-chip-text { display: inline; }
  .rich-model-chip .rich-chip-sub { display: inline; }
  .rich-composer .button.rich-chip { min-width: 0; padding: 0 9px; font-size: 13px; }
  .rich-composer .rich-model-chip .rich-chip-text { max-width: 128px; }
}

/* ---- Popovers: opaque, separated cards ---- */
.rich-popover { background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: 0 24px 60px -24px #000; }
:root:not([data-theme="light"]) .rich-popover { background: #0e111a; box-shadow: var(--glow-soft), 0 24px 60px -24px #000; }
.rich-pop-agents { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -2px -2px 12px; padding: 2px 2px 12px; border-bottom: 1px solid var(--line); }
.rich-pop-agents::-webkit-scrollbar { display: none; }
.button.rich-pop-agent { flex: none; background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.button.rich-pop-agent[aria-pressed="true"] { background: rgba(34, 211, 238, .1); border-color: rgba(34, 211, 238, .55); color: var(--text); box-shadow: var(--glow-soft); }
.rich-pop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.rich-pop-head-copy { min-width: 0; }
.rich-pop-head .rich-pop-title { margin: 2px 4px 2px; }
.rich-pop-head .rich-pop-note { margin: 0 4px; font-size: 12px; }
.rich-pop-head .rich-pop-reload { border: 1px solid var(--line-strong); border-radius: 50%; }
.rich-pop-search { background: var(--surface-2); border: 1px solid var(--line); }
.rich-pop-search:focus { outline: none; border-color: rgba(34, 211, 238, .5); }
.rich-pop-model { margin: 1px 0; }
.rich-pop-model.selected { background: var(--surface-2); border: 1px solid var(--line-strong); }
:root:not([data-theme="light"]) .rich-pop-model.selected { border-color: rgba(34, 211, 238, .3); }
.rich-pop-model.selected .rich-model-choice .icon { color: var(--accent-text); }
.rich-effort-group { background: var(--surface-3); }
.button.rich-effort-choice[aria-pressed="true"] { background: var(--surface-1); color: var(--accent-text); box-shadow: var(--glow-soft); }
.rich-pop-source { margin: 10px 4px 0; font-size: 11.5px; color: var(--faint); }
.rich-mode-choice[aria-checked="true"] .rich-radio { border-color: var(--neon); }
:root:not([data-theme="light"]) .rich-mode-choice[aria-checked="true"] .rich-radio { box-shadow: 0 0 10px rgba(34, 211, 238, .55); }

/* ---- Lists, cards and navigation in the same night palette ---- */
:root:not([data-theme="light"]) .rich-session-row[aria-current="true"], :root:not([data-theme="light"]) .rich-session-entry:has([aria-current="true"]) { background: rgba(34, 211, 238, .06); }
:root:not([data-theme="light"]) .button.rich-session-filter[aria-pressed="true"] { color: var(--accent-text); border-color: rgba(34, 211, 238, .4); box-shadow: var(--glow-soft); }
:root:not([data-theme="light"]) .nav { background: rgba(9, 11, 18, .86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
@media (prefers-reduced-motion: reduce) {
  .rich-thinking-dots, .rich-message.assistant.streaming .rich-message-text::after, .tool-status[data-status="running"]::before { animation: none; }
}
.rich-message-text .md-h { text-transform: none; letter-spacing: -.01em; font-size: 1.08em; }
.rich-message-text h3.md-h { font-size: 1.18em; }
.rich-group-rows:empty { display: none; }

/* ---- Compact: smaller titles, buttons and rows (owner 05.11) ---- */
.tool-group .tool-status, .rich-header-status, .rich-session-state { white-space: nowrap; }
.tool-group .tool-status { flex: none; }
#page-title, .page-heading h1 { font-size: 20px; letter-spacing: -.02em; }
#page-description { font-size: 12.5px; margin-top: 2px; }
.page-heading { margin-bottom: 12px; }
.button { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.button.compact { min-height: 28px; padding: 0 10px; font-size: 12px; }
.topbar { min-height: 48px; }
.topbar-actions .icon-button { height: 32px; }
.provider-card { padding: 12px; gap: 4px; }
.provider-card-name { font-size: 15px; }
.provider-card-stat { font-size: 11.5px; }
.button.rich-session-row { min-height: 50px; padding: 8px 12px; gap: 10px; }
.rich-session-task { font-size: 13.5px; }
.rich-session-agent { font-size: 11.5px; }
.rich-session-row .mark.tiny { width: 24px; height: 24px; }
.button.rich-session-filter { min-height: 28px; padding: 3px 9px; font-size: 11.5px; }
.button.rich-group-toggle { min-height: 32px; font-size: 12.5px; }
.rich-group-head { padding-bottom: 4px; }
.rich-group-head .icon-button { width: 28px; height: 28px; }
.rich-session-head { gap: 6px; padding-bottom: 8px; }
.rich-session-head .rich-session-name { font-size: 14px; }
.rich-session-head .icon-button { width: 32px; height: 32px; }
.rich-header-status { font-size: 10.5px; }
.rich-message-text { font-size: 15px; line-height: 1.58; }
.tool-group-toggle { min-height: 42px; padding: 8px 12px; font-size: 13px; }
.tool-call-summary { min-height: 34px; }
.rich-composer { padding: 10px 10px 8px 14px; border-radius: 20px; gap: 4px; }
.rich-composer .button.rich-chip { min-height: 30px; padding: 0 8px; font-size: 12.5px; gap: 5px; }
.rich-composer .button.rich-chip .icon { width: 16px; height: 16px; }
.button.rich-round { width: 38px; min-width: 38px; height: 38px; min-height: 38px; }
.button.rich-attach, .button.rich-mic { width: 34px; min-width: 34px; height: 34px; min-height: 34px; }
.rich-status-line { min-height: 20px; font-size: 12px; }
.rich-popover { padding: 10px; }
.rich-pop-model-copy strong { font-size: 13.5px; }
.button.rich-effort-choice { min-height: 30px; font-size: 12px; }
.button.rich-pop-agent { min-height: 32px; font-size: 12.5px; }
@media (max-width: 640px) {
  .button { min-height: 34px; }
  .topbar-actions .icon-button { width: 34px; height: 34px; }
  .button.rich-session-filter { min-height: 30px; }
  .message-actions .text-copy, .message-pin { min-width: 32px; min-height: 30px; }
  .rich-composer .button.rich-chip { min-height: 32px; padding: 0 7px; font-size: 12.5px; }
  .rich-composer .rich-model-chip .rich-chip-text { max-width: 110px; }
}
@media (pointer: coarse) {
  .button.rich-effort-choice { min-height: 32px; }
  .button.rich-pop-agent { min-height: 34px; }
}
.metric, .metrics.large .metric { padding: 10px 12px 9px; }
.metric-value, .metrics.large .metric-value { margin-top: 6px; font-size: 19px; }
.metric-sub { font-size: 11.5px; }
.metric > :nth-child(4) { margin-top: 8px; }
.spark { height: 26px; }
.provider-board { gap: 8px; }
.rich-sessions .rich-group:has(.rich-group-rows:empty), .rich-sessions .rich-group:not(:has(.rich-group-rows)) { margin-bottom: 0; padding-bottom: 0; }
.rich-sessions .rich-group:has(.rich-group-rows:empty) .rich-group-head { padding-bottom: 0; }
.rich-groups { gap: 2px; }
.rich-groups > .rich-group:has(.rich-group-rows:not(:empty)) { margin: 4px 0 12px; }
.rich-sessions { gap: 12px; }
.tool-group .tool-status { max-width: none; }
.tool-call-summary { min-width: 0; overflow: hidden; }

/* ---- Compact, second step (owner 05.11 «ещё компактнее») ---- */
#page-title, .page-heading h1 { font-size: 18px; }
#page-description { font-size: 12px; }
.page-heading { margin-bottom: 10px; }
.button { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.provider-card { padding: 10px; }
.provider-card-name { font-size: 14px; }
.provider-card-stat { font-size: 11px; }
.metric, .metrics.large .metric { padding: 8px 10px 7px; }
.metric-head { font-size: 11px; }
.metric-value, .metrics.large .metric-value { margin-top: 4px; font-size: 17px; }
.spark { height: 22px; }
.button.rich-session-row { min-height: 44px; padding: 6px 10px; gap: 9px; }
.rich-session-task { font-size: 13px; }
.rich-session-agent { font-size: 11px; }
.rich-session-row .mark.tiny { width: 22px; height: 22px; }
.button.rich-session-filter { min-height: 26px; padding: 2px 8px; font-size: 11px; }
.button.rich-group-toggle { min-height: 28px; font-size: 12px; }
.rich-session-head .rich-session-name { font-size: 13.5px; }
.rich-session-head .icon-button { width: 30px; height: 30px; }
.rich-message-text { font-size: 14.5px; line-height: 1.52; }
.rich-message.user .rich-message-text { font-size: 14.5px; }
.conversation-item { padding-bottom: 12px; }
.conversation-item.tool-group { margin-bottom: 12px; }
.rich-message.user { padding: 8px 12px; border-radius: 16px 16px 5px 16px; }
.message-actions { min-height: 24px; margin-top: 2px; }
.message-actions .text-copy, .message-actions .message-pin { width: 28px; min-width: 28px; height: 26px; min-height: 26px; }
.message-actions .text-copy svg, .message-actions .message-pin svg { width: 14px; height: 14px; }
.tool-group { border-radius: 13px; }
.tool-group-toggle { min-height: 38px; padding: 6px 10px; font-size: 12.5px; gap: 8px; }
.tool-call-summary { min-height: 30px; }
.rich-status-line { font-size: 11.5px; min-height: 18px; }
.rich-composer { padding: 8px 8px 6px 12px; border-radius: 18px; }
.rich-composer .button.rich-chip { min-height: 28px; padding: 0 7px; font-size: 12px; }
.button.rich-round { width: 34px; min-width: 34px; height: 34px; min-height: 34px; }
.button.rich-round .icon { width: 17px; height: 17px; }
.button.rich-attach, .button.rich-mic { width: 30px; min-width: 30px; height: 30px; min-height: 30px; }
.button.rich-model-choice { min-height: 40px; padding: 6px 10px; }
.button.rich-effort-choice { min-height: 28px; font-size: 11.5px; }
.button.rich-pop-agent { min-height: 30px; font-size: 12px; }
@media (max-width: 1023.98px) {
  .nav-main, .nav-more { min-height: 44px; gap: 2px; font-size: 10px; }
  .nav-main .icon, .nav-more .icon { width: 19px; height: 19px; }
  .topbar-actions .icon-button { width: 32px; height: 32px; }
}
@media (max-width: 640px) {
  .button { min-height: 32px; }
  .button.rich-session-filter { min-height: 28px; }
  .message-actions .text-copy, .message-pin { min-width: 30px; min-height: 28px; }
  .rich-composer .button.rich-chip { min-height: 30px; padding: 0 6px; font-size: 12px; }
}
@media (pointer: coarse) {
  .button.rich-effort-choice { min-height: 30px; }
  .button.rich-pop-agent { min-height: 32px; }
}
