/* Codex desktop-inspired surfaces, spacing and typography. */
:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  --canvas: #fff; --sidebar: #f8f8f8; --surface: #fff; --surface-raised: #fff; --surface-subtle: #f6f6f6;
  --sidebar-hover: #eee; --sidebar-active: #e9e9e9; --hover: #f2f2f2;
  --ink: #242424; --ink-soft: #595959; --muted: #818181; --fine: #a0a0a0;
  --line: #e5e5e5; --line-soft: #eee; --input-line: #dedede;
  --accent: #242424; --accent-soft: #f0f0f0; --inverse: #fff;
  --success: #348358; --danger: #bc4141; --danger-soft: #fff5f5; --warning: #957231; --focus: #707070;
  --scrim: rgb(0 0 0 / 24%); --shadow: 0 12px 42px rgb(0 0 0 / 12%), 0 1px 4px rgb(0 0 0 / 5%);
  --composer-shadow: 0 3px 14px rgb(0 0 0 / 3%);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace; --reading-width: 780px;
  background: var(--canvas); color: var(--ink);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #202020; --sidebar: #191919; --surface: #292929; --surface-raised: #292929; --surface-subtle: #262626;
  --sidebar-hover: #272727; --sidebar-active: #303030; --hover: #333;
  --ink: #ededed; --ink-soft: #b4b4b4; --muted: #919191; --fine: #747474;
  --line: #383838; --line-soft: #2d2d2d; --input-line: #414141;
  --accent: #ededed; --accent-soft: #343434; --inverse: #202020;
  --success: #83bc96; --danger: #ed9191; --danger-soft: #342626; --warning: #cbb478; --focus: #a5a5a5;
  --scrim: rgb(0 0 0 / 48%); --shadow: 0 14px 46px rgb(0 0 0 / 30%), 0 1px 4px rgb(0 0 0 / 20%);
  --composer-shadow: 0 3px 14px rgb(0 0 0 / 8%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --canvas: #202020; --sidebar: #191919; --surface: #292929; --surface-raised: #292929; --surface-subtle: #262626;
    --sidebar-hover: #272727; --sidebar-active: #303030; --hover: #333;
    --ink: #ededed; --ink-soft: #b4b4b4; --muted: #919191; --fine: #747474;
    --line: #383838; --line-soft: #2d2d2d; --input-line: #414141;
    --accent: #ededed; --accent-soft: #343434; --inverse: #202020;
    --success: #83bc96; --danger: #ed9191; --danger-soft: #342626; --warning: #cbb478; --focus: #a5a5a5;
    --scrim: rgb(0 0 0 / 48%); --shadow: 0 14px 46px rgb(0 0 0 / 30%), 0 1px 4px rgb(0 0 0 / 20%);
    --composer-shadow: 0 3px 14px rgb(0 0 0 / 8%);
  }
}
* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; background: var(--canvas); }
button, input, textarea, select { color: inherit; font: inherit; }
button { border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .45; }
button, a, input, textarea, select, summary { touch-action: manipulation; }
button, a, summary { -webkit-user-select: none; user-select: none; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
input, textarea { min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); }
svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
a { color: inherit; text-underline-offset: 3px; }
::selection { color: var(--ink); background: var(--sidebar-active); }
[hidden] { display: none !important; }

/* Sidebar */
.codex-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); width: 100%; height: 100vh; height: 100dvh; overflow: hidden; background: var(--canvas); }
.codex-sidebar { z-index: 30; display: flex; min-width: 0; min-height: 0; flex-direction: column; padding: 10px 10px 9px; overflow: hidden; background: var(--sidebar); border-right: 1px solid var(--line-soft); }
.sidebar-head, .codex-brand, .new-task, .search-box, .project-row, .thread-row, .foot-row, .account-row,
.codex-topbar, .top-project, .live-state, .composer-bottom, .composer-tools, .event-card summary, .event-line,
.picker-header, .picker-search, .picker-project, .picker-footer, .token-field, .settings-health, .rename-actions,
.approval-actions, .connection-pill { display: flex; align-items: center; }
.sidebar-head { min-height: 31px; justify-content: space-between; gap: 8px; padding: 0 4px; margin-bottom: 13px; }
.codex-brand { gap: 7px; padding: 3px 4px; color: var(--ink); background: transparent; font-size: 15px; font-weight: 600; letter-spacing: -.35px; }
.codex-brand > svg { width: 21px; height: 21px; }
.brand-mark { display: inline-grid; width: 22px; height: 22px; place-items: center; color: var(--ink); font: 600 18px/1 var(--mono); }
.icon-button { display: inline-grid; width: 30px; height: 30px; padding: 0; place-items: center; flex: 0 0 auto; color: var(--ink-soft); background: transparent; border-radius: 7px; }
.icon-button:hover, .icon-button.is-active { color: var(--ink); background: var(--hover); }
.codex-sidebar .icon-button:hover { background: var(--sidebar-hover); }
.mobile-close, .mobile-menu, .sidebar-open { display: none; }
.new-task { gap: 9px; width: 100%; height: 36px; padding: 0 10px; color: var(--ink); background: transparent; border-radius: 7px; text-align: left; font-size: 13px; font-weight: 500; }
.new-task:hover { background: var(--sidebar-hover); }
.new-task kbd, .search-box kbd { margin-left: auto; color: var(--fine); white-space: nowrap; font-family: inherit; font-size: 11px; }
.search-box { gap: 9px; height: 35px; margin: 2px 0 13px; padding: 0 10px; color: var(--muted); border-radius: 7px; }
.search-box:hover, .search-box:focus-within { background: var(--sidebar-hover); }
.search-box:focus-within { color: var(--ink); }
.search-box input, .picker-search input { width: 100%; min-width: 0; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 13px; }
.search-box input:focus-visible, .picker-search input:focus-visible { outline: 0; }
.sidebar-scroll { min-height: 0; flex: 1; overflow: auto; padding-bottom: 20px; scrollbar-width: thin; scrollbar-color: transparent transparent; overscroll-behavior: contain; }
.sidebar-scroll:hover { scrollbar-color: var(--line) transparent; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 35px; margin-top: 5px; padding: 6px 10px; color: var(--muted); font-size: 11px; font-weight: 500; }
.section-heading > span { display: flex; align-items: center; gap: 6px; }
.section-heading .icon-button, .section-action { display: inline-grid; width: 23px; height: 23px; padding: 0; place-items: center; color: var(--muted); background: transparent; border-radius: 5px; }
.section-heading .icon-button:hover, .section-action:hover { color: var(--ink); background: var(--sidebar-hover); }
.section-heading svg { width: 14px; height: 14px; }
.section-count { color: var(--fine); font-size: 10px; }
.project-list, .thread-list { display: grid; gap: 2px; }
.project-group { margin-bottom: 8px; }
.project-row { position: relative; gap: 8px; width: 100%; min-height: 34px; padding: 7px 9px; color: var(--ink-soft); background: transparent; border-radius: 6px; text-align: left; font-size: 12px; }
.project-row:hover, .thread-row:hover { background: var(--sidebar-hover); }
.project-row.is-active { color: var(--ink); }
.project-row strong { font-weight: 500; }
.project-row:has(.project-toggle) { gap: 4px; min-height: 31px; padding: 3px 4px; }
.project-toggle { display: inline-grid; width: 19px; height: 25px; flex: 0 0 auto; padding: 0; place-items: center; color: var(--muted); background: transparent; border-radius: 4px; }
.project-toggle:hover { color: var(--ink); }
.project-toggle svg { width: 11px; height: 11px; }
.project-name { display: flex; min-width: 0; height: 25px; flex: 1; align-items: center; gap: 7px; padding: 0; color: var(--ink-soft); background: transparent; text-align: left; font-size: 12px; }
.project-name > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-name > svg { width: 14px; height: 14px; color: var(--muted); }
.project-add { width: 24px; height: 24px; opacity: 0; }
.project-add svg { width: 14px; height: 14px; }
.project-row:hover .project-add, .project-row:focus-within .project-add { opacity: 1; }
.project-empty { padding: 8px 14px; font-size: 11px; }
.project-row > span:not(.project-folder):not(.project-check):not(.project-chevron):not(.thread-count) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-folder { display: inline-flex; color: var(--muted); }
.project-folder svg { width: 15px; height: 15px; }
.project-chevron { display: inline-flex; color: var(--muted); }
.project-chevron svg { width: 12px; height: 12px; transition: transform .15s ease; }
.project-group.is-collapsed .project-chevron svg { transform: rotate(-90deg); }
.project-check, .thread-count { margin-left: auto; color: var(--muted); font-size: 10px; }
.project-check svg { width: 13px; height: 13px; }
.project-copy, .thread-copy { display: grid; flex: 1; min-width: 0; gap: 3px; }
.project-copy strong, .thread-copy strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-copy small, .thread-copy small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 400; }
.project-threads { display: grid; gap: 2px; margin: 2px 0 0; padding-left: 17px; }
.project-group.is-collapsed .project-threads { display: none; }
.thread-row { position: relative; gap: 7px; width: 100%; min-height: 32px; padding: 7px 9px; color: var(--ink-soft); background: transparent; border-radius: 6px; text-align: left; font-size: 12px; }
.thread-row.is-active { color: var(--ink); background: var(--sidebar-active); }
.thread-copy strong { font-weight: 400; }
.thread-row.is-active .thread-copy strong { font-weight: 500; }
.thread-row time, .thread-age { flex: 0 0 auto; margin-left: auto; color: var(--fine); font-size: 10px; }
.thread-indicator { width: 6px; height: 6px; flex: 0 0 auto; background: transparent; border-radius: 50%; }
.thread-indicator.is-running { background: var(--ink-soft); animation: pulse 1.5s ease-in-out infinite; }
.thread-indicator.is-error { background: var(--danger); }
.thread-indicator.is-unread { background: var(--ink); }
.thread-pulse { width: 5px; height: 5px; margin-left: auto; background: var(--ink-soft); border-radius: 50%; animation: pulse 1.5s ease-in-out infinite; }
.thread-more { opacity: 0; width: 23px; height: 23px; margin: -4px -4px -4px 0; }
.thread-row:hover .thread-more, .thread-row:focus-within .thread-more { opacity: 1; }
.empty-side { padding: 13px 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.sidebar-foot { display: grid; gap: 2px; flex: 0 0 auto; padding-top: 8px; }
.foot-row { gap: 9px; width: 100%; min-height: 33px; padding: 7px 10px; color: var(--ink-soft); background: transparent; border-radius: 6px; text-align: left; font-size: 12px; }
.foot-row:hover, .account-row:hover { color: var(--ink); background: var(--sidebar-hover); }
.foot-row svg { width: 16px; height: 16px; }
.website-entry { text-decoration: none; }
.foot-row .sync-dot { margin-left: auto; }
.sync-dot { display: inline-block; width: 6px; height: 6px; flex: 0 0 auto; background: var(--fine); border-radius: 50%; }
.sync-dot.is-on { background: var(--success); }
.sync-dot.is-error { background: var(--danger); }
.account-row { gap: 9px; width: 100%; min-height: 43px; margin-top: 7px; padding: 7px 9px; color: var(--ink-soft); background: transparent; border-radius: 7px; text-align: left; }
.account-row > span:nth-child(2) { display: grid; min-width: 0; gap: 3px; }
.account-row strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.account-row small { color: var(--muted); font-size: 10px; }
.account-row > svg { width: 14px; height: 14px; margin-left: auto; color: var(--muted); }
.account-avatar { display: grid; width: 25px; height: 25px; flex: 0 0 auto; place-items: center; color: var(--ink-soft); background: var(--sidebar-active); border-radius: 50%; font-size: 10px; font-weight: 500; }
.codex-shell.sidebar-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.sidebar-collapsed .codex-sidebar { visibility: hidden; padding-right: 0; padding-left: 0; border: 0; }
.sidebar-collapsed .sidebar-open { display: inline-grid; }

/* Main canvas */
.codex-main { position: relative; display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; background: var(--canvas); }
.codex-topbar { z-index: 3; min-height: 49px; height: 49px; flex: 0 0 auto; gap: 10px; padding: 0 21px; }
.codex-topbar > [data-action="toggle-nav"] { display: none; }
.sidebar-collapsed .codex-topbar > [data-action="toggle-nav"] { display: inline-grid; }
.top-project { gap: 7px; min-width: 0; color: var(--ink-soft); background: transparent; font-size: 12px; }
.top-project > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-project > svg { width: 13px; height: 13px; color: var(--muted); }
.top-project-mark { display: inline-flex; color: var(--muted); }
.top-project-mark svg { width: 15px; height: 15px; }
.topbar-divider { color: var(--fine); font-size: 13px; }
.topbar-title { min-width: 0; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.live-state { gap: 6px; color: var(--muted); white-space: nowrap; font-size: 11px; }
.connection-pill { gap: 6px; padding: 5px 8px; color: var(--muted); background: transparent; border-radius: 6px; white-space: nowrap; font-size: 11px; }
.connection-pill.is-error { color: var(--danger); }
.connection-pill.is-reconnecting { color: var(--warning); }
.codex-content { position: relative; display: flex; min-width: 0; min-height: 0; flex: 1; justify-content: center; overflow: hidden; }
.thread-view { position: relative; display: flex; width: 100%; min-width: 0; min-height: 0; flex: 1; flex-direction: column; }
.thread-header { width: min(var(--reading-width), calc(100% - 64px)); margin: 24px auto 0; }
.thread-header h1 { margin: 0 0 10px; font-size: 23px; line-height: 1.4; font-weight: 600; }
.thread-context { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; }
.thread-context span { display: inline-flex; align-items: center; gap: 5px; }
.thread-context svg { width: 13px; height: 13px; }
.thread-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.branch-pill { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.message-scroll { min-width: 0; min-height: 0; flex: 1; overflow-x: hidden; overflow-y: auto; padding: 27px max(32px, calc((100% - var(--reading-width)) / 2)) 24px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; overscroll-behavior: contain; scroll-padding-bottom: 28px; }
.message-list { width: 100%; max-width: var(--reading-width); margin: 0 auto; }
.message { display: flex; width: 100%; min-width: 0; align-items: flex-start; margin: 0 0 25px; color: var(--ink); font-size: 14px; line-height: 1.8; }
.message-body { min-width: 0; max-width: 100%; flex: 1; }
.message-avatar, .message-byline { display: none; }
.user-message { justify-content: flex-end; margin-top: 10px; margin-bottom: 30px; }
.user-message .message-body { max-width: min(88%, 670px); flex: 0 1 auto; }
.user-message .message-text { padding: 11px 16px; color: var(--ink); background: var(--surface-subtle); border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-message { margin-bottom: 25px; }
.assistant-message .message-text { color: var(--ink); }
.message-text { min-width: 0; overflow-wrap: anywhere; }
.message-text:empty { display: none; }
.message-text > :first-child { margin-top: 0; }
.message-text > :last-child { margin-bottom: 0; }
.message-actions { display: flex; align-items: center; gap: 3px; min-height: 25px; margin: 8px 0 0 -6px; color: var(--muted); }
.message-actions .icon-button { width: 26px; height: 26px; color: var(--muted); }
.message-actions svg { width: 14px; height: 14px; }
.message-actions time, .message-time { color: var(--fine); font-size: 10px; }
.user-message .message-actions { justify-content: flex-end; margin-right: -5px; }
.message-actions button { opacity: .6; }
.message:hover .message-actions button, .message:focus-within .message-actions button { opacity: 1; }
.markdown p { margin: 0 0 15px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 24px 0 10px; color: var(--ink); font-weight: 600; line-height: 1.4; }
.markdown h1 { font-size: 23px; }.markdown h2 { font-size: 19px; }.markdown h3 { font-size: 16px; }.markdown h4 { font-size: 14px; }
.markdown strong { font-weight: 600; }
.markdown a { color: var(--ink); text-decoration-color: var(--fine); }
.markdown a:hover { text-decoration-color: var(--ink); }
.markdown ul, .markdown ol { margin: 8px 0 18px; padding-left: 25px; }
.markdown li { margin: 4px 0; padding-left: 3px; }
.markdown li > p { margin: 6px 0; }
.markdown li > ul, .markdown li > ol { margin: 6px 0; }
.markdown blockquote { margin: 16px 0; padding: 0 0 0 15px; color: var(--ink-soft); border-left: 3px solid var(--line); }
.markdown hr { height: 1px; margin: 25px 0; background: var(--line); border: 0; }
.markdown code { padding: 2px 5px; background: var(--surface-subtle); border-radius: 4px; font: .88em/1.6 var(--mono); }
.markdown pre, .event-detail pre { max-width: 100%; overflow: auto; margin: 15px 0; padding: 15px 17px; color: var(--ink); background: var(--surface-subtle); border: 1px solid var(--line-soft); border-radius: 10px; font: 12px/1.7 var(--mono); tab-size: 2; white-space: pre; }
.markdown pre code { padding: 0; color: inherit; background: transparent; border: 0; border-radius: 0; font: inherit; }
.markdown table { display: block; width: max-content; max-width: 100%; margin: 18px 0; overflow-x: auto; border-collapse: collapse; font-size: 13px; }
.markdown th, .markdown td { padding: 9px 13px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.markdown th { background: var(--surface-subtle); font-weight: 600; }
.markdown img { max-width: 100%; height: auto; border-radius: 9px; }
.markdown input[type="checkbox"] { margin-right: 6px; }
.markdown .code-block { position: relative; }
.markdown .code-copy { position: absolute; top: 8px; right: 8px; }
.markdown pre { position: relative; padding-right: 61px; }
.code-copy { padding: 4px 7px; color: var(--muted); background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 5px; font-family: inherit; font-size: 10px; line-height: 1.4; }
.code-copy:hover { color: var(--ink); background: var(--hover); }
.is-live .message-text::after { display: inline-block; width: 5px; height: 14px; margin-left: 4px; vertical-align: -2px; background: var(--ink-soft); border-radius: 1px; content: ""; animation: blink 1.2s step-end infinite; }

/* Expandable tool activity */
.event-card { min-width: 0; margin: 8px 0 15px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 9px; }
.event-card summary { gap: 8px; min-width: 0; min-height: 38px; padding: 9px 12px; list-style: none; cursor: pointer; font-size: 12px; }
.event-card summary::-webkit-details-marker { display: none; }
.event-card summary:hover { color: var(--ink); background: var(--surface-subtle); border-radius: 9px; }
.event-card summary > span:not(.event-status):not(.event-time):not(.event-symbol) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-card summary::after { width: 6px; height: 6px; margin: -3px 2px 0 auto; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); transform: rotate(45deg); content: ""; flex: 0 0 auto; }
.event-card[open] summary::after { margin-top: 3px; transform: rotate(225deg); }
.event-card summary:has(> svg:last-child)::after { display: none; }
.event-card summary > svg:last-child { width: 11px; height: 11px; }
.event-card[open] summary > svg:last-child { transform: rotate(90deg); }
.command-preview { min-width: 0; max-width: 60%; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font: 10px/1.5 var(--mono); }
.file-change-path { margin: 5px 0; color: var(--ink-soft); font: 11px/1.6 var(--mono); }
.event-card summary svg { width: 15px; height: 15px; color: var(--muted); }
.event-symbol { color: var(--muted); }
.event-time { color: var(--fine); font-size: 10px; }
.event-status { margin-left: auto; color: var(--muted); font-size: 10px; }
.event-status.is-error { color: var(--danger); }
.event-detail { min-width: 0; padding: 3px 13px 12px; color: var(--ink-soft); overflow-wrap: anywhere; font-size: 12px; line-height: 1.7; }
.event-detail pre { max-height: 380px; margin: 6px 0 0; padding: 11px 12px; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.event-detail p { margin: 5px 0 9px; }
.command-detail code { display: block; color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.7 var(--mono); }
.event-line { gap: 8px; min-height: 27px; margin: 5px 0 13px; color: var(--muted); overflow-wrap: anywhere; font-size: 12px; }
.event-line svg { width: 14px; height: 14px; }
.event-line small { margin-left: auto; color: var(--fine); font-size: 10px; }
.error-line, .error-line svg { color: var(--danger); }
.reasoning-card { border-color: transparent; }
.reasoning-card summary { padding-left: 0; color: var(--muted); }
.reasoning-card .event-detail { padding-left: 0; }
.thinking-row { display: flex; align-items: center; gap: 8px; min-height: 30px; margin: 13px 0; color: var(--muted); font-size: 12px; }
.thinking-dots { display: inline-flex; gap: 3px; }
.thinking-dots i { width: 4px; height: 4px; background: var(--muted); border-radius: 50%; animation: pulse 1.2s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .18s; }.thinking-dots i:nth-child(3) { animation-delay: .36s; }
.history-loading, .history-empty { padding: 70px 14px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.7; }
.history-loading { display: flex; align-items: center; justify-content: center; gap: 9px; }
.load-older { display: block; margin: 0 auto 24px; padding: 6px 11px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; }
.load-older:hover { color: var(--ink); background: var(--hover); }
.jump-bottom { position: absolute; z-index: 4; bottom: 155px; left: 50%; display: grid; width: 33px; height: 33px; padding: 0; place-items: center; color: var(--ink-soft); background: var(--surface-raised); border: 1px solid var(--line); border-radius: 50%; box-shadow: 0 2px 8px rgb(0 0 0 / 6%); transform: translateX(-50%); }
.jump-bottom:hover { color: var(--ink); background: var(--hover); }

/* Composer */
.composer-wrap { z-index: 2; width: 100%; flex: 0 0 auto; padding: 9px max(32px, calc((100% - var(--reading-width)) / 2)) 15px; background: var(--canvas); }
.composer { width: 100%; max-width: var(--reading-width); margin: 0 auto; padding: 13px 12px 9px; background: var(--surface); border: 1px solid var(--input-line); border-radius: 18px; box-shadow: var(--composer-shadow); transition: border-color .15s ease; }
.composer:focus-within { border-color: var(--fine); }
.composer textarea { display: block; width: 100%; min-height: 46px; max-height: 220px; margin: 0; padding: 2px 4px 11px; resize: none; color: var(--ink); background: transparent; border: 0; outline: 0; scrollbar-width: thin; font-size: 14px; line-height: 1.6; }
.composer textarea:focus-visible { outline: 0; }
.composer textarea::placeholder { color: var(--muted); }
.composer-bottom { min-height: 31px; justify-content: space-between; gap: 7px; }
.composer-tools { min-width: 0; gap: 3px; }
.image-entry, .image-composer-entry { text-decoration: none; }
.image-composer-entry { display: inline-flex; align-items: center; gap: 5px; }
.image-composer-entry svg { width: 15px; height: 15px; }
.tool-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; height: 28px; padding: 0 7px; color: var(--ink-soft); background: transparent; border-radius: 7px; white-space: nowrap; font-size: 11px; }
.tool-button:hover, .tool-button.is-active { color: var(--ink); background: var(--hover); }
.tool-button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tool-button svg { width: 14px; height: 14px; }
.tool-button > svg:last-child:not(:first-child) { width: 11px; height: 11px; color: var(--muted); }
.tool-button.icon-only { width: 28px; padding: 0; }
.composer-divider { width: 1px; height: 13px; margin: 0 4px; background: var(--line); }
.composer-hint { overflow: hidden; max-width: 42%; margin-left: auto; color: var(--fine); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.send-button { display: grid; width: 30px; height: 30px; flex: 0 0 auto; padding: 0; place-items: center; color: var(--inverse); background: var(--ink); border: 1px solid transparent; border-radius: 50%; }
.send-button:hover:not(:disabled) { opacity: .8; }
.send-button:disabled { color: var(--fine); background: var(--surface-subtle); opacity: 1; }
.send-button.is-stop { color: var(--ink); background: var(--surface-subtle); border-color: var(--line); }
.send-button.is-stop svg { width: 12px; height: 12px; fill: currentColor; stroke-width: 0; }
.send-button svg { width: 17px; height: 17px; stroke-width: 1.9; }
.composer-note { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 21px; padding-top: 7px; color: var(--fine); text-align: center; font-size: 10px; line-height: 1.4; }
.composer-note svg { width: 11px; height: 11px; }
.composer-note { justify-content: flex-start; gap: 13px; padding-right: 7px; padding-left: 7px; }
.composer-note > span { display: inline-flex; min-width: 0; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-note .composer-shortcut { margin-left: auto; }
.composer-note button { padding: 0; color: inherit; background: transparent; font-size: inherit; }
.composer-note button:hover { color: var(--ink-soft); }
.composer-context { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 4px 9px; }
.context-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; color: var(--ink-soft); background: var(--surface-subtle); border: 1px solid var(--line-soft); border-radius: 5px; font-size: 10px; }

/* New task */
.welcome-screen { display: flex; width: 100%; max-width: 940px; min-height: 0; align-self: center; align-items: center; flex-direction: column; padding: 24px 48px 90px; text-align: center; }
.welcome-screen h1 { margin: 0 0 17px; color: var(--ink); font-size: clamp(25px, 2.7vw, 32px); font-weight: 550; line-height: 1.3; letter-spacing: -.9px; }
.welcome-screen > p { margin: -5px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.welcome-mark { display: none; }
.welcome-eyebrow { display: inline-grid; width: 38px; height: 38px; margin: 0 0 16px; place-items: center; color: var(--ink); }
.welcome-eyebrow svg { width: 31px; height: 31px; stroke-width: 1.6; }
.welcome-screen > .welcome-footnote { margin: 24px 0 0; color: var(--fine); font-size: 11px; }
.welcome-project { display: flex; align-items: center; justify-content: center; gap: 7px; max-width: 100%; margin: 0 auto 25px; padding: 5px 8px; color: var(--ink-soft); background: transparent; border: 0; border-radius: 7px; text-align: center; font-size: 13px; }
button.welcome-project:hover { color: var(--ink); background: var(--hover); }
.welcome-project > span { display: inline-flex; min-width: 0; }
.welcome-project > svg { width: 15px; height: 15px; color: var(--muted); }
.welcome-project > svg:last-child:not(:first-child) { width: 12px; height: 12px; }
.welcome-project div { display: flex; min-width: 0; align-items: center; gap: 8px; }
.welcome-project strong { overflow: hidden; color: var(--ink-soft); text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.welcome-project small { color: var(--muted); font-size: 11px; }
.welcome-project button { display: inline-flex; align-items: center; gap: 4px; padding: 3px 5px; color: var(--muted); background: transparent; border-radius: 5px; font-size: 11px; }
.welcome-project button:hover { color: var(--ink); background: var(--hover); }
.welcome-project button svg { width: 12px; height: 12px; }
.welcome-screen .composer-wrap { width: 100%; max-width: var(--reading-width); padding: 0; text-align: left; }
.welcome-screen .composer textarea { min-height: 58px; }
.welcome-screen .composer-note { margin-top: 3px; }
.starter-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; width: 100%; margin-top: 21px; }
.starter-card { display: inline-flex; min-width: 0; align-items: center; justify-content: center; gap: 7px; padding: 8px 12px; color: var(--ink-soft); background: transparent; border: 1px solid var(--line); border-radius: 20px; text-align: left; font-size: 11px; line-height: 1.5; }
.starter-card:hover { color: var(--ink); background: var(--surface-subtle); border-color: var(--input-line); }
.starter-card svg { width: 14px; height: 14px; color: var(--muted); }
.starter-card strong { font-size: inherit; font-weight: 400; }
.starter-card small { display: none; }

/* Dialogs, settings, and permission requests */
.overlay { position: fixed; z-index: 60; inset: 0; display: flex; align-items: center; justify-content: center; padding: 28px; background: var(--scrim); }
.dialog-panel, .picker-panel, .settings-panel, .rename-panel, .approval-panel { display: flex; width: min(520px, 100%); max-height: min(760px, calc(100dvh - 56px)); flex-direction: column; overflow: auto; color: var(--ink); background: var(--surface-raised); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.picker-header { gap: 16px; min-height: 66px; flex: 0 0 auto; justify-content: space-between; padding: 17px 20px 15px; }
.picker-header > div { min-width: 0; }
.picker-header small { color: var(--muted); font-size: 10px; }
.picker-header h2 { margin: 0; color: var(--ink); font-size: 17px; font-weight: 600; line-height: 1.4; }
.picker-header small + h2 { margin-top: 4px; }
.picker-search { gap: 8px; min-height: 39px; flex: 0 0 auto; margin: 0 16px 12px; padding: 9px 11px; color: var(--muted); background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 8px; }
.picker-search:focus-within { border-color: var(--fine); }
.picker-search svg { width: 16px; height: 16px; }
.picker-list { min-height: 0; max-height: 420px; flex: 1; overflow: auto; padding: 0 9px 12px; scrollbar-width: thin; }
.picker-project { gap: 11px; width: 100%; padding: 12px 11px; color: var(--ink-soft); background: transparent; border-radius: 8px; text-align: left; }
.picker-project:hover, .picker-project.is-active { background: var(--hover); }
.picker-project > svg { width: 17px; height: 17px; color: var(--muted); }
.picker-project > span { display: grid; min-width: 0; gap: 4px; }
.picker-project strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.picker-project small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font: 10px/1.4 var(--mono); }
.picker-project em { margin-left: auto; color: var(--muted); font-size: 11px; font-style: normal; }
.picker-footer { gap: 12px; flex: 0 0 auto; justify-content: space-between; padding: 13px 20px; color: var(--muted); border-top: 1px solid var(--line-soft); font-size: 11px; line-height: 1.5; }
.small-button, .secondary-button { display: inline-flex; min-height: 32px; flex: 0 0 auto; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; color: var(--inverse); background: var(--ink); border: 1px solid transparent; border-radius: 7px; white-space: nowrap; font-size: 12px; font-weight: 500; }
.small-button:hover:not(:disabled) { opacity: .85; }
.secondary-button { color: var(--ink-soft); background: transparent; border-color: var(--line); }
.secondary-button:hover:not(:disabled) { color: var(--ink); background: var(--hover); opacity: 1; }
.small-button svg, .secondary-button svg { width: 14px; height: 14px; }
.settings-panel { width: min(490px, 100%); }
.settings-block { display: grid; gap: 11px; padding: 18px 20px; border-top: 1px solid var(--line-soft); }
.settings-block label, .settings-label { color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.settings-block p { margin: 0; color: var(--muted); overflow-wrap: anywhere; font-size: 11px; line-height: 1.6; }
.settings-block code { font: 10px/1.6 var(--mono); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.settings-select, .settings-block select { min-height: 35px; width: 100%; padding: 7px 10px; color: var(--ink); background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 7px; font-size: 12px; }
.settings-row select { width: auto; min-width: 125px; }
.token-field { gap: 8px; }
.token-field input, .rename-panel input, .dialog-input, .question-input { min-width: 0; min-height: 37px; flex: 1; padding: 9px 11px; color: var(--ink); background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 7px; outline-offset: 2px; font-size: 12px; }
.token-field input { width: 100%; font-family: var(--mono); font-size: 11px; }
.settings-project { display: flex; min-width: 0; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.settings-project span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-health { gap: 8px; color: var(--ink-soft); font-size: 12px; }
.settings-health .sync-dot { width: 6px; height: 6px; }
.rename-panel { width: min(430px, 100%); padding-bottom: 18px; }
.rename-panel > input { width: calc(100% - 40px); margin: 0 20px 20px; flex: 0 0 auto; }
.rename-actions { justify-content: flex-end; gap: 8px; padding: 0 20px; }
.approval-panel { width: min(570px, 100%); padding: 23px; }
.approval-panel .picker-header { min-height: 0; padding: 0 0 17px; }
.approval-panel > .settings-block { padding: 0; border: 0; }
.request-context { display: flex; min-width: 0; align-items: center; gap: 7px; margin-bottom: 5px; color: var(--muted); overflow-wrap: anywhere; font-size: 11px; line-height: 1.6; }
.request-context svg { width: 14px; height: 14px; }
.request-count { color: var(--muted); white-space: nowrap; font-size: 11px; }
.approval-icon { display: inline-grid; width: 28px; height: 28px; margin-bottom: 11px; place-items: center; color: var(--ink-soft); background: var(--surface-subtle); border-radius: 8px; }
.approval-eyebrow { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.approval-panel h2 { margin: 0 0 9px; color: var(--ink); font-size: 18px; font-weight: 600; line-height: 1.4; }
.approval-copy { margin: 0 0 16px; color: var(--ink-soft); overflow-wrap: anywhere; font-size: 12px; line-height: 1.7; }
.approval-command { display: grid; gap: 9px; max-height: 270px; overflow: auto; padding: 12px 13px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 8px; }
.approval-command code { color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.7 var(--mono); }
.approval-command small { color: var(--muted); overflow-wrap: anywhere; font: 10px/1.5 var(--mono); }
.approval-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.approval-allow { color: var(--inverse); background: var(--ink); }
.approval-meta { margin: 12px 0 0; color: var(--muted); overflow-wrap: anywhere; font-size: 11px; line-height: 1.6; }
.question-group { display: grid; gap: 8px; min-width: 0; margin: 0 0 19px; padding: 0; border: 0; }
.question-group > label, .question-group legend { display: block; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 500; line-height: 1.6; }
.question-group p { margin: 0 0 5px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.question-option { display: flex; align-items: flex-start; gap: 9px; width: 100%; padding: 10px 12px; color: var(--ink-soft); background: transparent; border: 1px solid var(--line); border-radius: 8px; text-align: left; cursor: pointer; font-size: 12px; line-height: 1.5; }
.question-option:hover { background: var(--hover); }
.question-option:has(input:checked), .question-option.is-selected { color: var(--ink); background: var(--surface-subtle); border-color: var(--fine); }
.question-option input { margin: 3px 0 0; }
.question-option > span { display: grid; min-width: 0; gap: 3px; }
.question-option strong { font-weight: 500; }
.question-option small { color: var(--muted); font-size: 11px; }
.question-input { width: 100%; resize: vertical; line-height: 1.6; }

/* Menus are positioned next to their trigger by the application. */
.menu-backdrop { position: fixed; z-index: 44; inset: 0; background: transparent; }
.context-menu, .thread-context-menu, .model-context-menu, .effort-context-menu { position: fixed; z-index: 45; display: grid; min-width: 170px; max-width: min(360px, calc(100vw - 24px)); max-height: min(420px, calc(100dvh - 32px)); overflow: auto; padding: 5px; color: var(--ink); background: var(--surface-raised); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); scrollbar-width: thin; }
.context-menu button, .thread-context-menu button, .model-context-menu button, .effort-context-menu button { display: flex; min-height: 34px; align-items: center; gap: 9px; width: 100%; padding: 8px 9px; color: var(--ink-soft); background: transparent; border-radius: 6px; text-align: left; font-size: 12px; line-height: 1.45; }
.context-menu button:hover, .context-menu button.is-active, .thread-context-menu button:hover, .model-context-menu button:hover, .effort-context-menu button:hover { color: var(--ink); background: var(--hover); }
.context-menu button > span, .model-context-menu button > span, .effort-context-menu button > span { display: grid; min-width: 0; gap: 3px; }
.context-menu strong, .model-context-menu strong, .effort-context-menu strong { color: var(--ink); font-size: 12px; font-weight: 500; }
.context-menu small, .model-context-menu small, .effort-context-menu small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.context-menu button > svg, .thread-context-menu button > svg { width: 15px; height: 15px; }
.context-menu button > svg:last-child:not(:first-child), .model-context-menu button > svg, .effort-context-menu button > svg { width: 14px; height: 14px; margin-left: auto; color: var(--ink-soft); }
.context-menu .is-danger { color: var(--danger); }
.menu-label { padding: 7px 9px 5px; color: var(--muted); font-size: 10px; }
.menu-divider, .context-menu hr { height: 1px; margin: 5px 4px; background: var(--line-soft); border: 0; }
.menu-empty { padding: 17px 12px; color: var(--muted); text-align: center; font-size: 12px; }
.menu-check { display: inline-flex; margin-left: auto; }
.thread-context-menu { top: 47px; right: 18px; }
.model-context-menu { bottom: 100px; left: calc(50% - 120px); width: 315px; }
.effort-context-menu { bottom: 100px; left: calc(50% + 30px); width: 200px; }

/* Feedback and accessibility */
.error-banner { display: flex; align-items: flex-start; gap: 9px; width: 100%; max-width: var(--reading-width); margin: 0 auto 14px; padding: 11px 13px; color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); border-radius: 8px; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
.error-banner > svg { width: 16px; height: 16px; margin-top: 2px; }
.error-banner > span, .error-banner > div { min-width: 0; flex: 1; }
.error-banner button { flex: 0 0 auto; color: inherit; background: transparent; font-size: 11px; }
.error-banner .icon-button { width: 22px; height: 22px; margin: -1px -3px 0 0; }
.writer-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; flex: 0 0 auto; width: calc(100% - 32px); max-width: var(--reading-width); margin: 8px auto 12px; padding: 14px 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; line-height: 1.6; }
.writer-notice > div:first-child { flex: 1 1 310px; min-width: 0; }
.writer-notice strong { font-weight: 600; }
.writer-notice p { margin: 4px 0 0; color: var(--muted); }
.writer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fork-badge { flex: 0 0 auto; padding: 1px 4px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 9px; }
.fork-context { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 0 0 auto; width: calc(100% - 32px); max-width: var(--reading-width); margin: 6px auto 10px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.fork-context svg { width: 14px; height: 14px; }
.fork-context button { padding: 2px 4px; border-radius: 4px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.read-only-note { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.read-only-note span { flex: 1; }
.toast { position: fixed; z-index: 90; bottom: 26px; left: 50%; max-width: min(480px, calc(100vw - 28px)); padding: 11px 16px; color: var(--inverse); background: var(--ink); border-radius: 10px; box-shadow: var(--shadow); transform: translateX(-50%); text-align: center; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; animation: toast-in .15s ease-out; }
.toast > svg { width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; }
.loading-skeleton { display: grid; gap: 15px; padding-top: 12px; }
.loading-skeleton:empty { min-width: 90px; height: 10px; margin: 10px; padding: 0; background: var(--surface-subtle); border-radius: 5px; animation: pulse 1.5s ease-in-out infinite; }
.loading-skeleton span, .loading-skeleton i, .loading-skeleton > div { display: block; height: 11px; background: var(--surface-subtle); border-radius: 5px; animation: pulse 1.5s ease-in-out infinite; }
.loading-skeleton > :nth-child(2) { width: 87%; }.loading-skeleton > :nth-child(3) { width: 62%; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mobile-scrim { display: none; }
.muted { color: var(--muted); }
.spinner { width: 14px; height: 14px; border: 1.5px solid var(--line); border-top-color: var(--muted); border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes pulse { 50% { opacity: .4; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; translate: 0 5px; } to { opacity: 1; translate: 0 0; } }

@media (min-width: 1440px) { :root { --reading-width: 800px; } }
@media (max-width: 1100px) {
  .codex-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .welcome-screen { padding-right: 35px; padding-left: 35px; }
  .topbar-title { max-width: 290px; }
  .composer-hint { display: none; }
}
@media (max-width: 760px) {
  .codex-shell, .codex-shell.sidebar-collapsed { display: block; }
  .codex-sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(290px, 86vw); padding: 10px 10px max(10px, env(safe-area-inset-bottom)); border-right: 1px solid var(--line); visibility: hidden; transform: translateX(-101%); transition: transform .18s ease, visibility .18s; }
  .codex-shell.is-mobile-nav .codex-sidebar { visibility: visible; transform: translateX(0); }
  .sidebar-collapsed .codex-sidebar { padding-right: 10px; padding-left: 10px; }
  .is-mobile-nav .mobile-scrim { position: fixed; z-index: 49; inset: 0; display: block; width: 100%; height: 100%; background: var(--scrim); }
  .mobile-close, .mobile-menu { display: inline-grid; }
  .desktop-collapse, .sidebar-collapse, .sidebar-open, .sidebar-collapsed .sidebar-open { display: none; }
  .codex-main { width: 100%; height: 100vh; height: 100dvh; }
  .codex-topbar { min-height: 49px; height: 49px; gap: 7px; padding: 0 11px; }
  .codex-topbar > [data-action="toggle-nav"] { display: inline-grid; }
  .project-add { opacity: 1; }
  .topbar-title { max-width: none; font-size: 12px; }
  .top-project { max-width: 34vw; font-size: 11px; }
  .top-project-mark { display: none; }
  .topbar-spacer { min-width: 0; }
  .live-state { font-size: 10px; }
  .connection-pill { padding: 5px; font-size: 10px; }
  .connection-pill .connection-label { display: none; }
  .topbar-actions { gap: 0; }
  .codex-topbar .icon-button { width: 28px; height: 30px; }
  .message-scroll { padding: 21px 20px 18px; }
  .message { font-size: 14px; line-height: 1.8; }
  .user-message .message-body { max-width: 92%; }
  .user-message .message-text { padding: 10px 14px; border-radius: 16px; }
  .message-actions button { opacity: 1; }
  .thread-header { width: calc(100% - 40px); margin-top: 18px; }
  .markdown pre { padding: 13px; font-size: 11px; }
  .markdown h1 { font-size: 21px; }.markdown h2 { font-size: 18px; }
  .composer-wrap { padding: 8px 14px max(10px, env(safe-area-inset-bottom)); }
  .composer { padding: 11px 10px 8px; border-radius: 17px; }
  .composer textarea { font-size: 16px; min-height: 44px; max-height: 180px; }
  .composer-tools { gap: 0; }
  .tool-button { max-width: 140px; padding: 0 6px; font-size: 10px; }
  .tool-button > svg:first-child:not(:last-child) { width: 13px; height: 13px; }
  .composer-divider { margin: 0 2px; }
  .composer-note { min-height: 19px; padding-top: 6px; font-size: 9px; }
  .composer-note .composer-shortcut { display: none; }
  .jump-bottom { bottom: 143px; }
  .welcome-screen { max-height: 100%; padding: 28px 20px 66px; overflow-y: auto; }
  .welcome-screen h1 { margin-bottom: 15px; font-size: 26px; letter-spacing: -.7px; }
  .welcome-eyebrow { margin-bottom: 11px; }
  .welcome-eyebrow svg { width: 27px; height: 27px; }
  .welcome-project { margin-bottom: 22px; font-size: 12px; }
  .welcome-project strong { font-size: 12px; }
  .welcome-screen .composer-wrap { padding: 0; }
  .welcome-screen .composer textarea { min-height: 64px; }
  .starter-grid { gap: 7px; margin-top: 19px; }
  .starter-card { gap: 5px; padding: 7px 10px; font-size: 10px; }
  .starter-card svg { width: 13px; height: 13px; }
  .overlay { padding: 16px; }
  .dialog-panel, .picker-panel, .settings-panel, .rename-panel, .approval-panel { max-height: calc(100dvh - 32px); border-radius: 13px; }
  .picker-header { min-height: 62px; padding: 15px 17px 13px; }
  .picker-header h2 { font-size: 16px; }
  .picker-search input, .token-field input, .rename-panel input, .question-input { font-size: 16px; }
  .picker-list { max-height: min(420px, 55dvh); }
  .picker-footer { flex-wrap: wrap; padding: 13px 17px; }
  .settings-block { padding: 17px; }
  .token-field { flex-wrap: wrap; }
  .token-field input { flex-basis: calc(100% - 86px); }
  .approval-panel { padding: 19px; }
  .approval-actions { gap: 7px; }
  .approval-actions .small-button { font-size: 11px; }
  .toast { bottom: max(19px, env(safe-area-inset-bottom)); }
  .thread-more { opacity: 1; }
}
@media (max-width: 390px) {
  .top-project { max-width: 27vw; }
  .live-state > span:not(.sync-dot) { display: none; }
  .composer-tools .tool-button { max-width: 125px; }
  .welcome-screen { padding-right: 15px; padding-left: 15px; }
  .welcome-screen h1 { font-size: 24px; }
  .starter-grid { gap: 6px; }
  .starter-card { padding: 7px 9px; }
}
@media (max-height: 650px) and (min-width: 761px) {
  .welcome-screen { max-height: 100%; padding-top: 24px; padding-bottom: 28px; overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Account access and member permissions share the workspace surfaces. */
.auth-screen { display: flex; min-height: 100%; height: 100%; flex-direction: column; align-items: center; gap: 26px; padding: 25px 30px; overflow-y: auto; background: var(--canvas); }
.auth-brand { display: flex; align-self: flex-start; align-items: center; gap: 8px; color: var(--ink); font-size: 18px; font-weight: 600; letter-spacing: -.45px; }
.auth-brand svg { width: 25px; height: 25px; }
.auth-card { width: min(370px, 100%); margin: auto 0; padding: 22px 0; }
.auth-mark { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-mark svg { width: 34px; height: 34px; stroke-width: 1.45; }
.auth-card h1 { margin: 0; text-align: center; font-size: 26px; font-weight: 550; letter-spacing: -.8px; line-height: 1.4; }
.auth-description { margin: 10px 0 29px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.7; }
.auth-form, .account-field { display: grid; gap: 17px; }
.account-field { gap: 7px; min-width: 0; }
.account-field label { color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.account-field input { width: 100%; min-height: 44px; padding: 11px 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--input-line); border-radius: 9px; font-size: 13px; outline-offset: 2px; }
.account-field small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.auth-submit { min-height: 43px; margin-top: 3px; border-radius: 9px; font-size: 13px; }
.auth-switch { display: flex; align-items: center; justify-content: center; gap: 5px; margin: 21px 0 0; color: var(--muted); font-size: 12px; }
.auth-switch button { padding: 4px; color: var(--ink); background: transparent; border-radius: 4px; text-decoration: underline; text-underline-offset: 3px; }
.auth-access-note { margin: 24px 0 0; padding-top: 19px; color: var(--muted); border-top: 1px solid var(--line-soft); text-align: center; font-size: 11px; line-height: 1.8; }
.auth-footer { margin: 0; color: var(--muted); text-align: center; font-size: 10px; line-height: 1.7; }
.auth-loading { display: flex; align-items: center; gap: 10px; margin: auto; color: var(--muted); font-size: 13px; }
.account-error { margin: 0; padding: 10px 12px; color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 18%, transparent); border-radius: 7px; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
.account-dialog-error { flex: 0 0 auto; margin: 0 20px 16px; }
.account-initial { font-size: 12px; font-weight: 550; }
.account-panel .account-identity { display: flex; align-items: center; gap: 12px; }
.account-identity > .account-avatar { width: 40px; height: 40px; font-size: 17px; }
.account-identity > div { min-width: 0; }
.account-identity strong { margin-right: 8px; overflow-wrap: anywhere; font-size: 14px; font-weight: 550; }
.account-identity p { margin-top: 8px; }
.account-role { display: inline-block; padding: 2px 6px; color: var(--muted); background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 5px; vertical-align: 1px; white-space: nowrap; font-size: 10px; line-height: 1.5; }
.account-role.is-disabled { color: var(--danger); }
.account-panel h3 { margin: 0 0 7px; color: var(--ink); overflow-wrap: anywhere; font-size: 13px; font-weight: 550; line-height: 1.5; }
.account-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.account-section-heading > div { min-width: 0; }
.account-inline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.account-inline input { width: 100%; }
.account-panel .picker-footer { justify-content: space-between; }
.members-panel { width: min(850px, 100%); max-height: min(820px, calc(100dvh - 56px)); overflow: hidden; }
.members-intro { flex: 0 0 auto; padding: 0 20px 17px; }
.members-intro p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.permission-filter { flex: 0 0 auto; margin-bottom: 16px; }
.members-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 0; flex: 1 1 auto; border-top: 1px solid var(--line); }
.members-sidebar { display: flex; min-height: 0; flex-direction: column; gap: 15px; overflow-y: auto; padding: 12px 10px; background: var(--surface-subtle); border-right: 1px solid var(--line); scrollbar-width: thin; }
.member-list { display: grid; align-content: start; gap: 3px; }
.member-list-row { display: flex; min-width: 0; align-items: center; gap: 9px; width: 100%; padding: 9px 8px; color: var(--ink-soft); background: transparent; border-radius: 7px; text-align: left; }
.member-list-row:hover { background: var(--hover); }
.member-list-row.is-selected { color: var(--ink); background: var(--sidebar-active); }
.member-list-row > span:nth-child(2) { display: grid; min-width: 0; flex: 1; gap: 4px; }
.member-list-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.member-list-row small { color: var(--muted); font-size: 10px; }
.member-list-row > svg { width: 13px; height: 13px; }
.member-list-row .account-avatar { width: 28px; height: 28px; background: var(--surface); border: 1px solid var(--line); }
.member-create { display: grid; gap: 9px; margin-top: auto; padding: 15px 5px 3px; border-top: 1px solid var(--line); }
.member-create h3 { margin-bottom: 2px; font-size: 12px; }
.member-create input { width: 100%; background: var(--surface); font-size: 11px; }
.member-detail { min-width: 0; min-height: 0; overflow-y: auto; padding: 19px 21px 24px; scrollbar-width: thin; }
.member-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.member-detail-head > div { min-width: 0; }
.member-detail-head h3 { font-size: 16px; }
.member-detail-head .account-role { margin-right: 5px; }
.member-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.member-section h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 9px; font-size: 12px; font-weight: 550; }
.member-section h4 > span { color: var(--muted); font-size: 10px; font-weight: 400; }
.member-section > p { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.permission-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 8px; }
.permission-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 14px; padding: 10px; border-top: 1px solid var(--line-soft); }
.permission-row:first-child { border-top: 0; }
.permission-row > span { display: flex; min-width: 0; align-items: flex-start; gap: 8px; }
.permission-row > span > svg { width: 15px; height: 15px; margin-top: 2px; color: var(--muted); }
.permission-row > span > span { display: grid; min-width: 0; gap: 4px; }
.permission-row strong { color: var(--ink-soft); overflow-wrap: anywhere; font-size: 11px; font-weight: 500; line-height: 1.5; }
.permission-row small { color: var(--muted); overflow-wrap: anywhere; font-size: 10px; line-height: 1.5; }
.permission-row select { width: 105px; min-height: 32px; flex: 0 0 105px; padding: 6px; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 11px; }
.website-permission-row input { width: 17px; height: 17px; flex: 0 0 auto; cursor: pointer; }
.permission-manage-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; color: var(--ink-soft); font-size: 11px; }
.permission-manage-link svg { width: 12px; height: 12px; }
.permission-empty { margin: 0; padding: 15px 10px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.member-empty { padding: 30px 10px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.7; }
.members-panel .picker-footer { justify-content: flex-end; gap: 9px; }
.members-save-note { margin-right: auto; color: var(--muted); font-size: 11px; line-height: 1.5; }

@media (max-width: 760px) {
  .auth-screen { gap: 22px; padding: 22px 24px max(22px, env(safe-area-inset-bottom)); }
  .auth-brand { font-size: 16px; }
  .auth-card { padding: 16px 0; }
  .auth-card h1 { font-size: 25px; }
  .account-field input, .account-panel input { font-size: 16px; }
  .auth-footer { font-size: 10px; }
  .members-panel { max-height: calc(100dvh - 32px); overflow-y: auto; }
  .members-layout { grid-template-columns: minmax(0, 1fr); flex: 0 0 auto; }
  .members-sidebar { overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .member-list { max-height: 175px; overflow-y: auto; }
  .member-create { grid-template-columns: minmax(0, 1fr); padding: 13px 6px 5px; }
  .member-detail { overflow: visible; padding: 19px 17px 23px; }
  .account-section-heading { align-items: flex-start; gap: 12px; }
  .account-inline { flex-wrap: wrap; }
  .account-inline input { flex-basis: 100%; }
  .account-inline > button { margin-left: auto; }
  .permission-row { gap: 8px; }
  .permission-row > span > svg { display: none; }
  .permission-row select { width: 101px; flex-basis: 101px; font-size: 12px; }
  .members-panel .picker-footer { position: sticky; bottom: 0; background: var(--surface-raised); }
  .members-save-note { flex-basis: 100%; }
}
