/* Shared presentation layer. Runtime and lifecycle behavior live in their existing modules. */
.action-dialog select { box-sizing:border-box; width:100%; min-height:44px; padding:10px; border:1px solid var(--line); border-radius:10px; background:var(--panel); color:var(--text); }
.action-dialog textarea { box-sizing:border-box; width:100%; min-height:100px; max-height:40dvh; resize:vertical; }
.turn-actions { flex:0 0 auto; margin-inline-start:8px; }
:root {
  --bg: #fcfcfa;
  --side: #f3f3f0;
  --panel: #fff;
  --soft: #f0f0ed;
  --hover: #e9e9e5;
  --text: #242622;
  --muted: #65695f;
  --faint: #73776e;
  --line: #e2e4dd;
  --strong: #cdd1c6;
  --accent: #262b23;
  --accentText: #fff;
  --ok: #20855d;
  --warn: #9a6700;
  --bad: #b42318;
  --badBg: #fff1ef;
  --code: #171716;
  --codeText: #f2f2ee;
  --sidebar: 280px;
  --content: 820px;
  --shadow: 0 20px 70px rgb(27 34 20 / 12%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
}

/* Frequent actions have the same touch target in regular and collection views. */
@media (pointer:coarse), (max-width:760px) {
  .icon-button,.tiny-button,.thread-menu-button,.thread-menu-action,.attachment-remove,.attachment-retry,
  .attach-button,.pill-select,.pill-button,.composer-toggle,.collection-toggle,.collection-actions-summary,
  .collections-icon-button,.collection-card-copy,.collections-retry { min-height:44px; }
  .icon-button,.tiny-button,.thread-menu-button,.attachment-remove,.collections-icon-button,.collection-toggle { min-width:44px; }
  .composer-right { flex-wrap:wrap; }
  .composer-left { align-items:center; }
  .action-dialog .modal-actions { flex-wrap:wrap; }
}
.toast { display:flex; align-items:center; gap:10px; }
.toast-copy { flex:1; min-width:0; overflow-wrap:anywhere; }
.toast-action,.toast-close { flex:none; border:0; background:transparent; color:inherit; min-height:36px; cursor:pointer; }
.toast-action { font-weight:600; text-decoration:underline; }
.toast-close { padding:0 8px; font-size:18px; }
.attachment-copy { min-width:0; flex:1; }
.attachment-progress { display:block; height:3px; margin-top:5px; background:var(--line); overflow:hidden; border-radius:999px; }
.attachment-progress-fill { display:block; height:100%; background:var(--ok); transition:width .12s; }
.attachment-error { color:var(--bad); max-width:32ch; overflow-wrap:anywhere; }
.attachment-retry { flex:none; border:0; background:transparent; color:var(--text); font:inherit; cursor:pointer; padding:4px 8px; }
.attachment-chip[data-status="error"] { border-color:var(--bad); }
.thread-state-glyph { display:inline-block; width:12px; height:12px; flex:none; margin-right:6px; vertical-align:middle; color:var(--muted); }
.thread-state-glyph[data-state="running"],.thread-state-glyph[data-state="starting"] { border:2px solid var(--line); border-top-color:var(--ok); border-radius:50%; animation:cweb-sync-spin 1s linear infinite; }
.thread-state-glyph[data-state="waiting"] { border:2px solid var(--warn); border-radius:50%; background:var(--warn); box-shadow:inset 0 0 0 2px var(--side); }
.thread-state-glyph[data-state="error"] { color:var(--bad); font-weight:700; text-align:center; line-height:12px; }
.thread-state-glyph[data-state="idle"] { display:none; }
.thread[data-activity="waiting"] .thread-meta { color:var(--warn); }
.thread[data-activity="error"] .thread-meta { color:var(--bad); }
.action-dialog .modal-card { max-width:520px; }
.action-dialog .modal-card>h2 { margin:0 0 12px; font-size:20px; }
.action-dialog .modal-card>p { line-height:1.65; overflow-wrap:anywhere; }
.action-dialog .modal-actions { margin-top:24px; }
:root[data-theme="dark"] {
  --bg:#191b18; --side:#20221e; --panel:#252823; --soft:#2c2f29; --hover:#35382f; --text:#eeefe9; --muted:#b2b7aa; --faint:#a1a799; --line:#393d34; --strong:#4e5547; --accent:#edf0e6; --accentText:#20241c; --ok:#63bd91; --warn:#e1b45a; --bad:#ff8e84; --badBg:#3a211f; --code:#10100f; --codeText:#eee; --shadow:0 20px 70px rgb(0 0 0 / 28%);
}
@media (prefers-color-scheme:dark) {
  /* Preserve system appearance if the early preference script cannot load. */
  :root:not([data-theme]) {
    --bg:#191b18; --side:#20221e; --panel:#252823; --soft:#2c2f29; --hover:#35382f; --text:#eeefe9; --muted:#b2b7aa; --faint:#a1a799; --line:#393d34; --strong:#4e5547; --accent:#edf0e6; --accentText:#20241c; --ok:#63bd91; --warn:#e1b45a; --bad:#ff8e84; --badBg:#3a211f; --code:#10100f; --codeText:#eee; --shadow:0 20px 70px rgb(0 0 0 / 28%);
  }
}
button, a, input, select, textarea, summary { -webkit-tap-highlight-color:transparent; }
[hidden] { display:none!important; }
button { transition:background-color .14s, border-color .14s, color .14s; }
:is(button,a,input,select,textarea,summary,[tabindex]):focus-visible { outline:2px solid var(--text); outline-offset:3px; }
button:disabled { cursor:not-allowed; }
.ui-icon { width:19px; height:19px; flex:none; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.ui-icon circle { fill:var(--side); }
.sidebar { padding:20px 12px 12px; gap:14px; border-right:1px solid var(--line); }
.brand-row { padding:0 8px; min-height:40px; flex-shrink:0; }
.brand { gap:10px; }
.brand-copy strong { font-size:17px; letter-spacing:-.025em; }
.brand-copy small { margin-top:2px; font-size:11px; }
.brand-mark { width:32px; height:32px; }
.new-chat { min-height:44px; padding:0 12px; border:1px solid var(--line); background:var(--panel); font-size:13px; box-shadow:0 1px 2px rgb(0 0 0 / 2%); flex-shrink:0; }
.new-chat kbd { font-size:10px; background:var(--soft); padding:3px 5px; }
.sidebar>.search-box { background:transparent; min-height:40px; flex-shrink:0; }
.search-box input { font-size:13px; }
.search-box:focus-within { outline:2px solid var(--text); outline-offset:1px; }
.search-box input:focus-visible { outline:none; }
.sidebar-content { min-height:0; flex:1; overflow:auto; overflow-x:hidden; overscroll-behavior:contain; scrollbar-width:thin; }
.sidebar-content .thread-list { overflow:visible; flex:none; }
.section-label { min-height:38px; height:auto; padding:0 10px; font-size:11px; letter-spacing:.02em; text-transform:none; }
.section-actions { display:flex; align-items:center; gap:2px; }
.archive-filter { background:transparent; color:var(--muted); border:0; padding:6px; border-radius:7px; min-height:32px; font-size:11px; }
.archive-filter:hover,.archive-filter[aria-pressed="true"] { background:var(--hover); color:var(--text); }
.thread { padding:10px; margin:2px 0; border-radius:10px; }
.thread.active { border-color:var(--line); box-shadow:0 1px 3px rgb(0 0 0 / 3%); }
.thread-row-copy { display:block; width:100%; min-width:0; padding:0 24px 0 0; border:0; background:transparent; color:inherit; text-align:left; cursor:pointer; }
.thread-title { font-size:13px; line-height:1.45; font-weight:500; }
.thread-meta { margin-top:4px; font-size:11px; line-height:1.4; }
.thread-menu-button { min-width:30px; min-height:30px; }
.thread-menu-action { min-height:36px; font-size:13px; }
.sidebar-footer { flex-shrink:0; padding-top:10px; display:grid; gap:3px; }
.sidebar-footer .nav-button { min-height:42px; gap:11px; padding:0 12px; font-size:13px; color:var(--muted); }
.settings-trigger small { margin-left:auto; font-size:11px; }
.icon-button { width:36px; height:36px; flex-shrink:0; font-size:18px; }
.topbar { padding:14px 28px; min-height:76px; background:var(--bg); backdrop-filter:none; }
.topbar-left { flex:1; }
.thread-heading h1 { font-size:15px; letter-spacing:-.015em; max-width:100%; }
.thread-heading { flex:1; }
.thread-subline { font-size:11px; gap:7px; margin-top:5px; }
.top-actions { flex-shrink:0; margin-left:16px; gap:3px; }
.top-actions .history-mode-button { width:auto; font-size:12px; gap:6px; color:var(--muted); min-height:36px; padding:0 9px; }
.top-actions .history-mode-button.active { background:var(--soft); color:var(--text); }
.empty-state { padding:36px 28px 64px; overflow:auto; }
.empty-inner { width:100%; max-width:660px; }
.empty-logo { width:48px; height:48px; margin-bottom:24px; background:transparent; }
.home-eyebrow { color:var(--muted); font-size:12px; margin-bottom:14px; letter-spacing:.08em; }
.empty-state h2 { font-size:clamp(27px,3vw,38px); line-height:1.35; font-weight:650; letter-spacing:-.045em; margin:0 0 18px; }
.empty-state p { max-width:430px; font-size:14px; line-height:1.8; margin-bottom:28px; }
.empty-state.collection-home h2 { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; overflow:hidden; overflow-wrap:anywhere; }
.home-actions { display:flex; justify-content:center; align-items:center; gap:10px; flex-wrap:wrap; }
.home-actions button { min-height:44px; padding:0 18px; display:inline-flex; align-items:center; justify-content:center; gap:7px; }
.home-footnote { margin-top:24px; color:var(--muted); font-size:11px; letter-spacing:.025em; }
.primary-button,.secondary-button,.danger-button { min-height:40px; padding:0 16px; border-radius:10px; font-size:13px; font-weight:550; }
.primary-button:hover:not(:disabled) { filter:brightness(1.15); }
.secondary-button:hover:not(:disabled) { background:var(--soft); }
.timeline { padding:30px max(28px,calc((100% - var(--content))/2)) 48px; }
.message { font-size:15px; line-height:1.85; }
.message.user .message-bubble { padding:12px 18px; border:0; border-radius:20px 20px 5px 20px; max-width:min(86%,670px); }
.turn-block { gap:18px; margin-bottom:34px; }
.turn-timing,.turn-timing-label,.turn-status,.message-label { font-size:11px; }
.rich-text code:not(pre code) { font-size:.88em; }
.code-block pre { font-size:12px; line-height:1.7; padding:16px; border-radius:12px; }
.copy-code { padding:5px 8px; font-size:11px; }
.message-actions { display:flex; gap:4px; margin-top:2px; }
.message-copy { min-height:32px; padding:5px 8px; border:0; border-radius:8px; background:transparent; color:var(--muted); font:inherit; font-size:11px; line-height:1.3; cursor:pointer; }
.message-copy:hover,.message-copy:focus-visible { background:var(--soft); color:var(--text); }
.message.user .message-actions { align-self:flex-end; }
@media(pointer:coarse), (max-width:760px) { .message-copy,.copy-code { min-height:44px; min-width:44px; } }
.activity-title,.activity-body,.reasoning-card summary,.reasoning-content,.plan-card { font-size:12px; }
.activity-meta,.status-badge,.work-log-label,.work-log-count,.work-log-status { font-size:11px; }
.activity-head { min-height:42px; padding:10px 12px; }
.terminal-output,.diff-output,.activity-body pre { font-size:12px; line-height:1.65; }
.composer-wrap { padding:0 max(28px,calc((100% - var(--content))/2)) max(24px,env(safe-area-inset-bottom)); }
.composer-card { border:1px solid var(--strong); border-radius:20px; padding:14px; box-shadow:0 4px 20px rgb(34 44 22 / 5%); }
.composer-card:focus-within { border-color:var(--muted); box-shadow:0 4px 24px rgb(34 44 22 / 8%); }
.composer-card textarea { resize:none; font-size:15px; min-height:48px; padding:2px 3px 14px; line-height:1.65; }
.composer-toolbar { gap:8px; }
.pill-button,.pill-select,.composer-toggle { min-height:34px; font-size:12px; background:transparent; color:var(--muted); }
.pill-button:hover,.pill-select:hover,.composer-toggle:hover { background:var(--soft); }
.pill-select { max-width:145px; padding-left:9px; }
.composer-left,.composer-right { gap:4px; }
.composer-toggle { padding:0 9px; }
.composer-toggle.active { background:transparent; border-color:transparent; color:var(--muted); }
.composer-sync-status { display:inline-block; font-size:11px; }
.composer-sync-status[data-state="configSynced"] { width:7px; height:7px; padding:0; border-radius:50%; background:var(--ok); color:transparent; overflow:hidden; flex-shrink:0; }
.send-button { width:38px; height:38px; border-radius:12px; font-size:21px; }
.attachment-copy strong { font-size:12px; }.attachment-copy small { font-size:11px; }
.attachment-remove { min-width:28px; min-height:28px; }
.jump-bottom { font-size:12px; padding:8px 14px; bottom:144px; box-shadow:0 2px 8px rgb(0 0 0 / 5%); }
.modal { padding:24px; background:rgb(17 24 12 / 30%); backdrop-filter:blur(4px); }
.modal-card { width:min(500px,100%); border-radius:20px; padding:26px; border:1px solid var(--line); box-shadow:var(--shadow); }
.modal-head { justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:24px; }
.modal-head>div { min-width:0; }
.modal-card h2 { font-size:20px; letter-spacing:-.025em; margin:0; }
.modal-card p { font-size:13px; line-height:1.7; }
.modal-card .muted { color:var(--muted); margin:8px 0 0; }
.modal-card label { font-size:13px; }
.modal-card :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea) { width:100%; min-height:44px; padding:11px 13px; border:1px solid var(--strong); border-radius:10px; background:var(--bg); color:var(--text); font-size:14px; line-height:1.5; }
.modal-card :is(input,textarea):focus { border-color:var(--muted); }
.modal-actions { margin-top:24px; gap:8px; flex-wrap:wrap; }
.modal-actions button { min-height:42px; }
.app-settings-card { width:min(530px,100%); }
.appearance-setting { display:grid; grid-template-columns:1fr minmax(130px,46%); align-items:center; gap:8px 20px; margin-bottom:24px; }
.appearance-setting label { font-weight:600; margin:0; }
.appearance-setting small { grid-column:1/-1; color:var(--muted); font-size:12px; line-height:1.5; }
.settings-preference { display:grid; gap:10px; margin:0; padding:18px 0; border-top:1px solid var(--line); }
.settings-preference-row { display:flex; align-items:center; justify-content:space-between; gap:16px; min-width:0; }
.settings-preference label { font-size:13px; font-weight:600; margin:0; }
.settings-preference p { margin:0; color:var(--muted); font-size:12px; line-height:1.6; }
.settings-switch { position:relative; flex:none; width:44px; height:44px; display:grid; place-items:center; }
.settings-switch input { position:absolute; inset:0; z-index:1; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; }
.settings-switch-track { position:relative; width:42px; height:24px; border:1px solid var(--strong); border-radius:999px; background:var(--soft); transition:background .16s ease; }
.settings-switch-track::after { content:""; position:absolute; width:18px; height:18px; top:2px; left:2px; border-radius:50%; background:var(--muted); transition:transform .16s ease,background .16s ease; }
.settings-switch input:checked+.settings-switch-track { background:var(--text); border-color:var(--text); }
.settings-switch input:checked+.settings-switch-track::after { transform:translateX(18px); background:var(--bg); }
.settings-switch input:focus-visible { outline:0; }
.settings-switch input:focus-visible+.settings-switch-track { outline:2px solid var(--text); outline-offset:3px; }
.settings-switch input:disabled { cursor:not-allowed; }
.settings-switch input:disabled+.settings-switch-track { opacity:.45; }
.app-settings-card .conversation-root-setting { margin:0; border-bottom:0; }
@media(prefers-reduced-motion:reduce){.settings-switch-track,.settings-switch-track::after{transition:none}}
.app-settings-card .sidebar-control-panel { margin:0; padding:16px; border-radius:12px; background:var(--bg); }
.app-settings-card .sidebar-control-heading { font-size:13px; margin-bottom:12px; }
.app-settings-card .sidebar-control-heading small { font-size:12px; }
.app-settings-card .sidebar-switch { min-height:44px; padding:8px; font-size:13px; }
.app-settings-card .sidebar-switch strong { font-size:12px; }
.app-settings-card .sidebar-control-note { display:block; margin-top:12px; font-size:12px; line-height:1.7; }
.settings-details { margin-top:20px; border-bottom:1px solid var(--line); padding-bottom:20px; }
.settings-details summary { cursor:pointer; font-size:13px; color:var(--muted); }
.settings-details dl { display:grid; gap:8px; font-size:12px; margin:16px 0 0; }
.settings-details dt { color:var(--muted); }
.settings-details dd { margin:0 0 8px; overflow-wrap:anywhere; line-height:1.5; }
.app-settings-card .sidebar-footer-row { margin-top:16px; justify-content:space-between; gap:12px; }
.app-settings-card .nav-button { flex:initial; width:auto; min-height:40px; padding:0 14px; border:1px solid var(--line); font-size:13px; }
#protocolPanel { grid-template-rows:auto auto minmax(0,1fr); width:min(var(--drawer-width,850px),calc(100vw - 24px)); }
.drawer-head { display:flex; align-items:center; gap:12px; padding:24px; }
.drawer-head>div { min-width:0; flex:1; }
.drawer-head h2 { font-size:19px; }
.drawer-head small { display:block; font-size:11px; line-height:1.6; margin-top:4px; overflow-wrap:anywhere; }
.tools-tabs { display:flex; padding:0 24px; gap:24px; border-bottom:1px solid var(--line); }
.tools-tabs button { min-height:48px; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--muted); padding:0 2px; font-size:13px; }
.tools-tabs button[aria-selected="true"] { color:var(--text); border-bottom-color:var(--text); font-weight:600; }
.extensions-view { overflow:auto; min-height:0; padding:24px; }
.capability-summary { border:0; padding:0; background:transparent; }
.capability-summary-head strong { font-size:13px; }.capability-summary-head small { font-size:12px; margin-top:6px; }
.capability-cards { gap:12px; margin-top:20px; }
.capability-group { border-radius:12px; }
.capability-group>summary { min-height:74px; padding:16px; gap:12px; }
.capability-group-label { font-size:14px; }.capability-group-detail { font-size:12px; margin-top:5px; }
.capability-state { font-size:11px; }
.capability-group-body { padding:0 16px 16px; max-height:none; overflow:visible; }
.capability-row-name { font-size:13px; }.capability-row-description,.capability-row-meta,.capability-row-detail { font-size:12px; }
.developer-view { display:grid; grid-template-rows:auto auto auto minmax(0,1fr); overflow:hidden; min-height:0; }
.developer-summary { padding:12px 20px; color:var(--muted); font-size:11px; overflow-wrap:anywhere; }
.protocol-toolbar { padding:14px 18px; grid-template-columns:minmax(0,1fr) 155px; }
.protocol-toolbar .search-box { min-height:40px; background:var(--soft); }
.protocol-toolbar select { min-width:0; font-size:12px; }
.protocol-grid { grid-template-columns:minmax(190px,32%) minmax(0,1fr); }
.method-list { padding:10px; }
.method-item { padding:12px; font-family:inherit; font-size:12px; border-radius:10px; }
.method-human-title { font-size:13px; }.method-human-description { font-size:11px; line-height:1.5; }
.method-detail { padding:22px; }
.method-detail h3 { font-size:17px; font-family:inherit; }
.method-detail p,.method-detail details summary { font-size:12px; line-height:1.65; }
.method-detail details summary { padding:12px; }
.method-detail textarea,.method-detail details pre { font-size:12px; line-height:1.65; }
.official-event-log>summary { min-height:40px; font-size:12px; padding:12px 20px; }
.official-event-rows { max-height:160px; }
.approval-tray { bottom:150px; }
.approval-card { border-radius:16px; padding:18px; }
.approval-heading { font-size:15px!important; }.approval-card p,.approval-question label { font-size:13px; }
.approval-fact-label,.approval-kicker { font-size:11px; }.approval-fact-value,.approval-technical summary { font-size:12px; }
.worker-detail-body { font-size:13px; }.worker-card-title { font-size:13px; }.worker-card-subtitle,.worker-card-state,.worker-card-body { font-size:12px; }
.worker-card-actions button,.worker-detail-actions button { min-height:34px; font-size:12px; }
.toast { font-size:13px; border-radius:12px; }
@media (max-width:1100px) { .top-actions #fullHistoryLabel { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; } .thread-heading h1 { max-width:calc(100vw - var(--sidebar) - 230px); } }
@container (max-width:720px) { .composer-toolbar { gap:6px; } .composer-left { gap:4px; } .composer-right { gap:6px; } }
@container (max-width:620px) {
  .protocol-grid { grid-template-columns:1fr; grid-template-rows:minmax(110px,32%) minmax(0,1fr); }
  .protocol-grid .method-list { max-height:none; border-right:0; border-bottom:1px solid var(--line); }
  .method-detail { padding:16px; }
  .protocol-toolbar { grid-template-columns:minmax(0,1fr) 126px; padding:12px; }
  .protocol-toolbar select { font-size:11px; }
}
@media (max-width:760px) {
  :root { --sidebar:min(300px,85vw); --content:100%; }
  .sidebar { padding-top:max(20px,env(safe-area-inset-top)); }
  .topbar { padding:12px; min-height:68px; }
  .top-actions { margin-left:8px; gap:0; }
  .top-actions .icon-button { width:32px; height:36px; }
  .top-actions #reloadThread,.top-actions #homeButtonTop { display:none; }
  .thread-heading h1 { max-width:100%; font-size:14px; }
  .thread-subline { font-size:10px; }
  .workspace-header { max-width:32vw; }
  .empty-state { padding:28px 20px; }
  .empty-state h2 { font-size:28px; }
  .empty-state p { font-size:13px; margin-bottom:22px; }
  .empty-logo { margin-bottom:18px; width:40px; height:40px; }
  .home-eyebrow { font-size:11px; margin-bottom:10px; }
  .home-footnote { font-size:10px; margin-top:20px; }
  .home-actions { gap:8px; }.home-actions button { padding:0 12px; font-size:12px; }
  .timeline { padding:24px 18px 36px; }
  .message { font-size:15px; line-height:1.8; }
  .message.user .message-bubble { max-width:92%; padding:10px 14px; }
  .composer-wrap { padding:0 12px max(12px,env(safe-area-inset-bottom)); }
  .composer-card { padding:10px; border-radius:18px; }
  .composer-card textarea { font-size:16px; min-height:42px; }
  .pill-button,.pill-select,.composer-toggle { min-height:34px; font-size:11px; }
  .composer-toggle { max-width:none; }.auto-scroll-label { overflow:visible; }
  #modelSelect { max-width:130px; } #effortSelect { max-width:90px; }
  .send-button { width:36px; height:36px; }
  .composer-sync-status[data-state="configSynced"] { display:none; }
  .modal { padding:16px; }.modal-card { padding:22px; max-height:calc(100dvh - 32px); border-radius:18px; }
  .modal-card :is(input,textarea,select) { font-size:16px; }
  #protocolPanel { width:100vw; }
  .drawer-head { padding:18px; }.drawer-head h2 { font-size:18px; }
  .tools-tabs { padding:0 18px; gap:20px; }
  .extensions-view { padding:18px; }
  .protocol-grid { grid-template-columns:1fr; grid-template-rows:minmax(110px,32%) minmax(0,1fr); }
  .protocol-grid .method-list { max-height:none; border-right:0; border-bottom:1px solid var(--line); }
  .method-detail { padding:16px; }
  .protocol-toolbar { grid-template-columns:minmax(0,1fr) 126px; padding:12px; }
  .protocol-toolbar select { font-size:11px; }
  .approval-tray { right:12px; width:calc(100% - 24px); bottom:160px; }
}
@media (max-height:580px) {
  .empty-state { padding:20px; }.empty-logo,.home-eyebrow,.home-footnote { display:none; }
  .empty-state h2 { font-size:26px; margin-bottom:8px; }.empty-state p { margin-bottom:16px; }
  .sidebar { gap:8px; }.sidebar-content { min-height:80px; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; animation:none!important; transition:none!important; } }


.conversation-root-setting { display:grid; gap:8px; margin:20px 0; padding:18px 0; border-block:1px solid var(--line); }
.conversation-root-setting label { font-size:13px; font-weight:600; }
.conversation-root-setting p { margin:0; color:var(--muted); font-size:12px; line-height:1.6; }
.conversation-root-input-row { display:flex; gap:8px; min-width:0; }
.conversation-root-input-row input { flex:1; min-width:0; font-size:13px; padding:10px 12px; }
.conversation-root-input-row button { flex-shrink:0; }
.conversation-root-status { color:var(--muted); font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
.conversation-root-status:empty { display:none; }
.conversation-root-status.error { color:var(--bad); }
.conversation-existing-directory { justify-self:start; border:0; padding:4px 0; background:transparent; color:var(--muted); font-size:12px; text-align:left; }
.conversation-existing-directory:hover { color:var(--text); }
#conversationRootShortcut[hidden],#existingDirectoryConversation[hidden],#retryConversationRoot[hidden] { display:none; }
@media(max-width:760px){.conversation-root-input-row input{font-size:16px}.conversation-root-input-row{flex-wrap:wrap}.conversation-root-input-row input{flex-basis:180px}}

/* Mobile fit: keep the app canvas inside the visible viewport and let the
   collection header and composer wrap instead of widening the page. */
@media(max-width:760px){
  html,body,#app{width:100%;max-width:100%;min-width:0}
  body{overflow-x:clip}
  .shell,.shell.sidebar-collapsed{position:fixed;inset:var(--cweb-viewport-top,0px) 0 auto;width:100%;max-width:100%;min-width:0;height:100vh;height:var(--cweb-viewport-height,100dvh);max-height:var(--cweb-viewport-height,100dvh);overflow:hidden;grid-template-columns:minmax(0,1fr)}
  .main{width:100%;max-width:100%;min-width:0;min-height:0;overflow:hidden;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr) auto}
  .topbar{width:100%;max-width:100%;min-width:0;min-height:68px;gap:6px;padding:12px max(12px,env(safe-area-inset-right)) 12px max(12px,env(safe-area-inset-left));overflow:hidden}
  .topbar-left{flex:1 1 0%;width:auto;max-width:none;min-width:0;gap:5px;overflow:hidden}
  .thread-heading{flex:1 1 0%;width:auto;max-width:100%;min-width:0;overflow:hidden}
  .thread-heading-line,.thread-subline{width:100%;max-width:100%;min-width:0;overflow:hidden}
  .thread-heading h1{width:100%;max-width:100%;min-width:0;font-size:14px}
  .thread-subline{white-space:nowrap;text-overflow:ellipsis}
  .top-actions{flex:0 0 auto;width:auto;max-width:45%;min-width:0;margin:0;gap:1px;overflow:hidden}
  .top-actions .icon-button{width:32px;min-width:32px;height:36px;flex:0 0 32px}
  .top-actions #reloadThread,.top-actions #homeButtonTop{display:none}
  .top-actions .stop-button{max-width:64px;padding-inline:7px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .connection-banner{box-sizing:border-box;width:calc(100% - 16px);max-width:calc(100% - 16px);min-width:0;margin:6px 8px 0;overflow-wrap:anywhere}
  .connection-banner.collection-sync-error{display:flex;align-items:center;justify-content:space-between;gap:8px}
  .connection-banner.collection-sync-error>span{flex:1 1 150px;min-width:0;line-height:1.45}
  .connection-banner-retry{flex:0 0 auto;min-height:34px;padding:0 10px;border:1px solid color-mix(in srgb,var(--warn) 38%,var(--line));border-radius:8px;background:var(--panel);color:var(--text);font-size:12px;white-space:nowrap}
  .empty-state{min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain}
  .empty-state.collection-home{padding:clamp(12px,3vh,24px) 14px}
  .collection-home .empty-inner{width:100%;max-width:560px;min-width:0}
  .empty-state.collection-home h2{font-size:clamp(21px,6vw,25px);line-height:1.28;overflow-wrap:anywhere}
  .empty-state.collection-home p{max-width:36em;font-size:12px;line-height:1.65;margin-bottom:16px;overflow-wrap:anywhere}
  .collection-home .empty-logo{width:40px;height:40px;margin-bottom:14px}
  .collection-home .home-eyebrow{font-size:10px;margin-bottom:8px}
  .collection-home .home-footnote{font-size:10px;margin-top:14px;overflow-wrap:anywhere}
  .collection-home .home-actions{gap:7px}
  .collection-home .home-actions button{min-height:42px;max-width:100%;padding-inline:12px;font-size:12px;white-space:normal}
  .timeline{min-width:0;max-width:100%;overflow-x:hidden}
  .composer-wrap{box-sizing:border-box;width:100%;max-width:100%;min-width:0;min-height:0;padding:0 max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));overflow:visible}
  .composer-card{box-sizing:border-box;width:100%;max-width:100%;min-width:0;padding:10px;border-radius:18px}
  .composer-card textarea{box-sizing:border-box;width:100%;min-width:0;min-height:42px;max-height:120px;font-size:16px}
  .composer-card:focus-within{border-color:var(--strong);box-shadow:0 0 0 1px var(--strong)}
  .composer-card textarea:focus-visible{outline:none}
  .composer-toolbar{display:grid;width:100%;min-width:0;max-width:100%;grid-template-columns:minmax(0,1fr);align-items:stretch;gap:5px}
  .composer-left{display:flex;flex:1 1 auto;width:100%;max-width:100%;min-width:0;gap:4px;overflow:visible;flex-wrap:wrap}
  .composer-left>*{flex:0 1 auto;min-width:0;max-width:100%}
  .composer-right{display:flex;flex:0 1 auto;width:100%;max-width:100%;min-width:0;justify-content:flex-end;gap:5px;flex-wrap:nowrap}
  .attach-button{max-width:min(112px,30vw);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .pill-select{box-sizing:border-box;min-width:0;max-width:32vw;padding-inline:7px 19px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #modelSelect{width:min(116px,34vw);max-width:min(116px,34vw);flex:0 1 116px}
  #effortSelect{width:min(84px,24vw);max-width:min(84px,24vw);flex:0 1 84px}
  .composer-mode{flex:0 1 auto;min-width:0;max-width:34%;overflow:hidden;text-overflow:ellipsis}
  .context-usage{flex:0 1 auto;min-width:0;max-width:40%}
  .context-usage>summary{max-width:100%;min-width:30px;overflow:hidden}
  .composer-sync-status{display:grid;place-items:center;flex:0 0 18px;width:18px;height:18px;overflow:hidden;font-size:0;line-height:1}
  .composer-sync-status[data-state="configSynced"]{display:none}
  .composer-sync-status[data-state="configSyncing"]{border:2px solid var(--line);border-top-color:var(--warn);border-radius:50%;color:transparent;animation:cweb-sync-spin .8s linear infinite}
  .composer-sync-status[data-state="configSyncFailed"],.composer-sync-status[data-state="configWriteFailed"]{border:1px solid var(--bad);border-radius:50%;color:var(--bad)}
  .composer-sync-status[data-state="configSyncFailed"]::after,.composer-sync-status[data-state="configWriteFailed"]::after{content:'!';font-size:12px;font-weight:700}
  .send-button{flex:0 0 36px;width:36px;height:36px}
}
@media(max-width:420px){
  .composer-left{gap:4px}
  .attach-button{max-width:26vw}
  #modelSelect{width:min(108px,32vw);max-width:min(108px,32vw)}
  #effortSelect{width:min(78px,23vw);max-width:min(78px,23vw)}
  #autoScrollLabel,#autoScrollState{display:none}
  #autoScrollToggle{flex:0 0 30px;width:30px;justify-content:center;padding:0}
  .context-usage{max-width:34%}
}
@media(max-height:700px) and (max-width:760px){
  .empty-state{padding:8px 12px}
  .empty-logo,.home-eyebrow,.home-footnote{display:none}
  .empty-state h2{font-size:clamp(20px,5.5vw,23px);margin-bottom:8px}
  .empty-state p{margin-bottom:12px}
  .composer-card textarea{max-height:88px}
}
@keyframes cweb-sync-spin{to{transform:rotate(360deg)}}

/* The sidebar's rate-limit meter (usage-meter.js): one button, a row per window of the main Codex bucket. The bar shows
   what is left; warning and danger colours come at 70 % and 90 % used. Stale figures are dimmed. */
.sidebar-usage { min-width: 0; }
.usage-meter { display: grid; gap: 4px; width: 100%; min-width: 0; padding: 6px 8px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; text-align: left; cursor: pointer; }
.usage-meter:hover { background: var(--hover); }
.usage-meter.is-stale { opacity: .55; }
.usage-line { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; font-size: 11px; line-height: 1.3; }
.usage-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-bar { height: 4px; overflow: hidden; border-radius: 999px; background: var(--line); }
.usage-fill { display: block; height: 100%; border-radius: inherit; background: var(--faint); transition: width .25s ease; }
.usage-fill.is-warning { background: var(--warn); }
.usage-fill.is-danger { background: var(--bad); }
.usage-value { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 760px) { .usage-meter { min-height: 44px; } }

@media (pointer:coarse), (max-width:760px) {
  #menuToggle,#attachButton,#modelSelect,#effortSelect,#autoScrollToggle,#planModeToggle,
  .shell .thread-menu-button,.shell .thread-menu-action,.shell .collection-toggle,
  .shell .collections-icon-button,.shell .collection-card-copy,.attachment-remove,.attachment-retry,
  .toast-action,.toast-close { min-height:44px; }
  #menuToggle,.shell .thread-menu-button,.attachment-remove,.toast-close { min-width:44px; }
  #send { flex:0 0 44px; width:44px; height:44px; min-height:44px; }
  #autoScrollToggle { flex:0 0 44px; width:44px; }
  .composer-toolbar .composer-right { flex-wrap:wrap; row-gap:6px; }
  .composer-card textarea { min-height:44px; }
}
.composer-card textarea:focus-visible { outline:none; }
.composer-card:focus-within { box-shadow:0 0 0 2px var(--line); }
.composer-secondary-menu,.composer-secondary-panel { display:contents; }
.composer-secondary-summary,.composer-secondary-usage { display:none; }
@media (max-width:760px) {
  .composer-secondary-menu { display:block; position:relative; flex:0 0 44px; }
  .composer-secondary-summary { display:flex; align-items:center; justify-content:center; width:44px; min-height:44px; border-radius:10px; cursor:pointer; list-style:none; color:var(--muted); }
  .composer-secondary-summary::-webkit-details-marker { display:none; }
  .composer-secondary-panel { display:flex; flex-direction:column; position:absolute; bottom:calc(100% + 8px); right:0; z-index:20; width:min(240px,calc(100vw - 48px)); padding:8px; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); }
  .composer-secondary-menu:not([open]) .composer-secondary-panel { display:none; }
  .composer-secondary-panel #autoScrollToggle,.composer-secondary-usage { display:flex; width:100%; min-height:44px; flex:auto; align-items:center; justify-content:flex-start; gap:8px; padding:8px 12px; color:var(--text); background:transparent; border:0; border-radius:8px; font:inherit; text-align:left; cursor:pointer; }
  .composer-secondary-panel #autoScrollLabel,.composer-secondary-panel #autoScrollState { display:inline; }
  .composer-secondary-panel button:hover { background:var(--soft); }
}

/* === MULTI-PLATFORM PRODUCT UI (CODEX / ANTIGRAVITY / MINIMAX) === */
.platform-auth-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.platform-auth-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.platform-auth-header-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.platform-auth-subtitle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.platform-auth-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.platform-auth-card {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  min-width: 0;
}
.platform-auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.platform-auth-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}
.platform-auth-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}
.platform-auth-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.platform-auth-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  flex-shrink: 0;
}
.platform-auth-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.platform-auth-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  flex-shrink: 0;
}
.platform-auth-status.is-authed {
  color: var(--good, #16a34a);
  font-weight: 500;
}
.platform-auth-status.is-authed::before {
  background: var(--good, #16a34a);
}
.platform-auth-status.is-pending {
  color: var(--warn, #d97706);
}
.platform-auth-status.is-pending::before {
  background: var(--warn, #d97706);
}
.platform-auth-status.is-error {
  color: var(--bad, #dc2626);
}
.platform-auth-status.is-error::before {
  background: var(--bad, #dc2626);
}
.platform-auth-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.platform-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap !important;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.platform-auth-btn:hover {
  background: var(--hover);
}
.platform-auth-btn.primary {
  background: var(--text);
  color: var(--bg, #fff);
  border-color: var(--text);
}
.platform-auth-btn.primary:hover {
  opacity: .9;
}
.platform-auth-btn.subtle {
  color: var(--muted);
  background: transparent;
}
.platform-auth-btn.ghost {
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
  color: var(--muted);
}
.platform-auth-btn[hidden] {
  display: none !important;
}
.platform-auth-select {
  height: 30px;
  padding: 0 22px 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.platform-auth-flow {
  display: grid;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  min-width: 0;
}
.platform-auth-flow[hidden] {
  display: none !important;
}
.platform-auth-flow-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-decoration: underline;
  overflow-wrap: anywhere;
}
.platform-auth-flow-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.platform-auth-flow-input-row input {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 8px;
}
.platform-auth-flow-code {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.platform-auth-feedback {
  font-size: 12px;
  min-height: 0;
}
.platform-auth-feedback:empty {
  display: none;
}

/* 3-Platform Sidebar Usage Meter */
.usage-meter {
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.usage-platform-group {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.usage-platform-group + .usage-platform-group {
  padding-top: 5px;
  border-top: 1px solid var(--line);
}
.usage-platform-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  font-size: 10.5px;
  line-height: 1.2;
}
.usage-platform-title {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.usage-platform-meta {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.usage-line {
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 6px;
  font-size: 11px;
}

/* Platform Filter Tabs & Badges in Tools & Extensions Drawer */
.capability-platform-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.capability-platform-tab {
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.capability-platform-tab.active {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.capability-platform-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: middle;
}
.capability-platform-badge.is-codex {
  color: var(--text);
}
.capability-platform-badge.is-agy {
  color: #2563eb;
}
.capability-platform-badge.is-mcode {
  color: #7c3aed;
}

@media (max-width: 480px) {
  .platform-auth-card {
    padding: 8px 10px;
  }
  .platform-auth-row {
    gap: 8px;
  }
  .platform-auth-tag {
    display: none;
  }
  .platform-auth-btn {
    height: 28px;
    padding: 0 8px;
    font-size: 11.5px;
  }
  .platform-auth-select {
    height: 28px;
    padding: 0 18px 0 6px;
    font-size: 11.5px;
  }
}
