/* Appearance controls are shared by the launcher, account page and remote UI. */
/* Teleply component contract: see docs/design-language.md. */
:root{--tp-control:44px;--tp-icon:22px;--tp-stroke:1.8;--tp-radius-card:16px;--tp-radius-panel:24px;--tp-radius-pill:999px;--tp-space:8px;--tp-control-fill:#f4f5f7;--tp-control-ink:#1d2330;--tp-focus:#2563eb;--tp-control-shadow:0 4px 18px #1d233008;--tp-press-scale:.97}
:root[data-theme=dark]{--tp-control-fill:#1e1e1e;--tp-control-ink:#eee;--tp-focus:#8ab4ff;--tp-control-shadow:0 4px 18px #0003}
.tp-icon-button,.tp-button{min-height:var(--tp-control);border:0;border-radius:var(--tp-radius-pill);display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 16px;font-family:inherit;font-size:14px;font-weight:500;line-height:1.4;background:var(--tp-control-fill);color:var(--tp-control-ink);cursor:pointer;transition:transform 100ms,background-color 120ms;box-sizing:border-box}
.tp-icon-button{width:var(--tp-control);height:var(--tp-control);padding:11px;flex:none;box-shadow:var(--tp-control-shadow)}
.tp-icon-button svg{display:block;width:var(--tp-icon);height:var(--tp-icon);stroke-width:var(--tp-stroke)}
.tp-toolbar{display:inline-flex;align-items:center;padding:2px;border-radius:var(--tp-radius-pill);background:var(--tp-control-fill);box-shadow:var(--tp-control-shadow);flex:none}
.tp-toolbar .tp-icon-button{background:transparent;box-shadow:none}.tp-forward svg{transform:rotate(180deg)}
:is(.tp-icon-button,.tp-button):active:not(:disabled){transform:scale(var(--tp-press-scale))}
:is(.tp-icon-button,.tp-button):focus-visible{outline:2px solid var(--tp-focus);outline-offset:3px}
:is(.tp-icon-button,.tp-button):disabled{opacity:.35;cursor:default;box-shadow:none}
.tp-header-title{min-width:0;text-align:center}.tp-header-title strong{display:block;font-size:16px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-header-title small{display:block;color:var(--muted,#6b7280);font-size:12px;margin-top:3px}
.tp-menu>button{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:48px;width:100%;padding:12px 18px;border:0;border-radius:0;background:transparent;color:var(--tp-control-ink);text-align:left;font-size:14px}.tp-menu>button[aria-pressed=true]::after{content:'✓';font-size:16px}.tp-menu>button:focus-visible{outline:2px solid var(--tp-focus);outline-offset:-3px}
@media(prefers-reduced-motion:reduce){:is(.tp-icon-button,.tp-button){transition:none}:is(.tp-icon-button,.tp-button):active:not(:disabled){transform:none}}
:root{--page-bg:#fff;--panel-bg:#fff;--sidebar-bg:#f4f5f7;--chat-bg:#fff;background:var(--page-bg);--theme-panel:#f4f4f6;--theme-edge:#d6d6dc;--theme-focus:#2563eb;--theme-text:#171719;color-scheme:light}
:root[data-theme=dark]{--page-bg:#000;--panel-bg:#141414;--sidebar-bg:#141414;--chat-bg:#000;color-scheme:dark;--bg:#000;--card:#141414;--line:#333;--text:#eee;--ink:#eee;--muted:#a8a8a8;--soft:#1e1e1e;--blue:#8ab4ff;--green:#66d997;--red:#ff9a9a;--danger:#ff9a9a;--amber:#efbd6a;--theme-panel:#1e1e1e;--theme-edge:#767676;--theme-focus:#8ab4ff;--theme-text:#eee;--shadow:0 8px 32px #0008;background:#000;color:#eee}
.theme-title{font-size:13px;font-weight:500;color:var(--muted,#6b7280);margin:6px 0 10px}
.theme-choices{display:flex;gap:4px;flex:none;padding:4px;border:0;border-radius:999px;background:var(--theme-panel)}
.theme-choices button{flex:1;min-width:0;min-height:44px;padding:8px 10px;border:0;border-radius:999px;background:transparent;color:var(--muted,#6b7280);font-family:inherit;font-size:14px;font-weight:500;line-height:1.4;cursor:pointer;white-space:nowrap}
.theme-choices button[aria-checked=true]{color:var(--theme-text);background:var(--card,#fff);box-shadow:0 1px 5px #1d233014}
.theme-choices button:focus-visible,.theme-settings>summary:focus-visible{outline:2px solid var(--theme-focus);outline-offset:3px}
.app-settings-header{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:44px;margin-bottom:40px;position:relative}
.app-settings-header>.brand{min-width:0;margin:0;justify-content:flex-start}
.app-settings-header:has(>.theme-settings:only-child){justify-content:flex-end}
.theme-settings{position:relative;display:block;flex:none;margin:0;z-index:8}
.theme-settings>summary{display:flex;align-items:center;justify-content:center;margin:0;min-width:44px;min-height:44px;padding:0 10px;cursor:pointer;list-style:none;font-size:14px;color:var(--theme-text)}
.theme-settings>summary::-webkit-details-marker{display:none}
.theme-settings-panel{position:absolute;right:0;top:calc(100% + 8px);width:min(320px,calc(100vw - 40px));padding:16px;border:1px solid var(--line,#e4e4e7);border-radius:20px;background:var(--card,#fff);box-shadow:0 12px 40px #0002}
:root[data-theme=dark] body,:root[data-theme=dark] body[data-current-mode=chat],:root[data-theme=dark] #convView,:root[data-theme=dark] .conversation-home,:root[data-theme=dark] .cv-top,:root[data-theme=dark] .cv-bottom,:root[data-theme=dark] header{background:#000;color:#eee}
:root[data-theme=dark] :is(input,textarea,select){color:#eee;background:#1e1e1e;border-color:#767676;caret-color:#8ab4ff}
:root[data-theme=dark] :is(input,textarea,select):focus{background:#1e1e1e;outline:2px solid #8ab4ff;outline-offset:2px;box-shadow:none}
:root[data-theme=dark] :is(button,.chip,.sub-card,.reference-chip,.voice-pill,.msg-menu,.new-composer,.codex-card,.option-card){color:#eee;background-color:#1e1e1e;border-color:#767676}
:root[data-theme=dark] :is(.icon-btn,.menu-row,.nav-links button,.text-button,.reveal,.tree-add,.ctx-ring,.runtime-bar){background:transparent;color:inherit}
:root[data-theme=dark] :is(.sheet .box,dialog,.menu,.device-options,.action-menu,.theme-settings-panel){background:#1e1e1e;color:#eee;border-color:#767676}
:root[data-theme=dark] :is(.primary,.device-connect,button.big,[id="cvBtn"],.chip.on){background:#8ab4ff;color:#101010;border-color:#8ab4ff;box-shadow:none}
:root[data-theme=dark] :is(.primary,.device-connect,button.big,[id="cvBtn"]):hover{background:#b1cdff}
:root[data-theme=dark] :is(.field input,.field select,#approval .field select){background-color:#1e1e1e;color:#eee}
:root[data-theme=dark] :is(.bub.user){background:#1e1e1e;color:#eee;border:1px solid #333}
:root[data-theme=dark] :is(.bub.assistant,.bub.note){background:transparent}
:root[data-theme=dark] :is(.bub pre,.bub code,.inline-copy,#readerSheet .reader-text pre,#readerSheet .reader-text code){background:#141414;color:#eee;border-color:#333}
:root[data-theme=dark] :is(a,.thread-link){color:#8ab4ff}
:root[data-theme=dark] :is(.thread-link,.nav-links button.selected,.sub-card.running,.option-card[aria-checked=true],.model-list-row[aria-checked=true],.effort-choices button[aria-checked=true],.new-apps button[aria-checked=true],.new-pick-row[aria-selected=true],.reference-result[aria-selected=true],.pcf-row[aria-selected=true],.pcf-places button[aria-current=true]){background:#17253b;color:#b1cdff;border-color:#8ab4ff}
:root[data-theme=dark] :is(.connection-note,.pending-alert,.optbox,.parts-notice,.composer-chip.is-plan){background:#302513;color:#efbd6a;border-color:#927144}
:root[data-theme=dark] :is(.voice-pill.error,.reference-chip.is-file.is-failed,.ds-actions .ds-reject){background:#351d20;color:#ff9a9a;border-color:#bb7777}
:root[data-theme=dark] :is(.composer-chip.is-full,.ds-actions .ds-allow){background:#142b20;color:#8ce2af;border-color:#619779}
:root[data-theme=dark] :is(.cv-row,#cvText,.ctx-ring span){background:#1e1e1e;color:#eee;box-shadow:none}
:root[data-theme=dark] .cv-row{border:1px solid #767676}
:root[data-theme=dark] #cvText{border:0}
:root[data-theme=dark] .bub.note.thinking.long::after{background:linear-gradient(to right,transparent,#000 2.5em)}
:root[data-theme=dark] .brand,:root[data-theme=dark] .brand .mark{color:#fff}
:root[data-theme=dark] .theme-choices button{background:transparent;color:var(--muted)}
:root[data-theme=dark] .theme-choices button[aria-checked=true]{background:#38383a;color:#fff;box-shadow:0 1px 5px #0004}
:root[data-theme=dark] :is(.conv:active,.menu button:hover,.device-options button:hover,.text-button:hover,.tree-row:active,.msg-menu button:active){background:#292929}
:root[data-theme=dark] dialog::backdrop{background:#000a}
:root[data-theme=dark] .toast{background:#eee;color:#111}
:root[data-theme=dark] ::selection{background:#365780;color:#fff}
:root[data-theme=dark] :focus-visible{outline-color:#8ab4ff}
:root[data-theme=dark] ::placeholder{color:#a8a8a8;opacity:1}

:root[data-theme=dark] .ask-pill .ask-go{color:#efbd6a}

:root[data-theme=dark] #cvMsgs .bub.assistant.picked{background:#17253b}
:root[data-theme=dark] .new-inline-status{background:#1e1e1e;color:#a8a8a8}
:root[data-theme=dark] .ask-pill .ask-dot{background:#efbd6a}

:root[data-theme=dark] :is(.field input,.field select,.connection-card input,.connection-card select){border:1px solid #767676}

.connection-error{box-sizing:border-box;max-width:440px;margin:12vh auto;padding:24px;color:var(--theme-text);font:16px/1.7 system-ui,sans-serif}
.connection-error h1{font-size:24px}.connection-error a{display:flex;justify-content:center;align-items:center;min-height:48px;margin-top:12px;padding:8px 16px;border:1px solid var(--theme-edge);border-radius:14px;color:var(--theme-text);text-decoration:none;background:var(--theme-panel)}
.device-actions .device-connect:disabled{background:var(--soft,#f4f4f6);color:var(--muted,#86868b);border:1px solid var(--line,#ddd);opacity:1;cursor:default;box-shadow:none;transform:none}
.device-actions .icon-button{background:transparent;color:var(--ink,#111113)}

:root[data-theme=dark] .device-actions .device-connect:disabled{background:var(--soft);color:var(--muted);border:1px solid var(--line);opacity:1;box-shadow:none;transform:none}
:root[data-theme=dark] .device-actions .icon-button{background:transparent;color:var(--ink)}

.device-actions .device-connect:disabled{transition:none}

:root[data-theme=dark] .tree-app .mark.codex{color:var(--text)}

/* Code/output panels share a bounded body and a non-scrolling toolbar. */
:root{--tp-code-fill:#f5f5f5;--tp-code-edge:#e3e3e3}
:root[data-theme=dark]{--tp-code-fill:#1e1e1e;--tp-code-edge:#333333}
.code-wrap{min-width:0;max-width:100%;box-sizing:border-box;overflow:hidden;border:1px solid var(--tp-code-edge);border-radius:12px;background:var(--tp-code-fill);color:var(--text,var(--theme-text));margin:12px 0;white-space:normal;box-shadow:none}
.code-wrap>.code-head{display:flex;align-items:center;gap:4px 8px;flex-wrap:wrap;padding:4px 12px;border-bottom:1px solid var(--tp-code-edge);color:var(--muted);font:400 13px/1.4 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.code-head>span{margin-right:auto;min-width:0;overflow-wrap:anywhere}
.code-wrap>.code-head>button{min-height:44px;min-width:44px;padding:4px 8px;border:0;border-radius:999px;background:transparent;color:var(--muted);font:400 13px/1.4 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;cursor:pointer;box-shadow:none}
.code-wrap>.code-head>button:focus-visible,.code-wrap>pre:focus-visible{outline:2px solid var(--tp-focus);outline-offset:-3px}
.code-wrap>pre,.bub .code-wrap>pre{box-sizing:border-box;margin:0;padding:12px;max-height:min(320px,45dvh);max-width:100%;overflow:auto;overscroll-behavior:contain;white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal;font:400 13px/1.6 ui-monospace,Consolas,monospace;border:0;border-radius:0;background:transparent;color:inherit;tab-size:4}
.code-wrap>pre>code,.bub .code-wrap>pre>code,.activity-progress .code-wrap>pre>code{padding:0;border:0;border-radius:0;background:transparent;color:inherit;font:inherit;white-space:inherit;overflow-wrap:inherit}
.code-wrap.original-lines>pre{white-space:pre;overflow-wrap:normal}
:root[data-theme=dark] .code-wrap>pre,:root[data-theme=dark] .code-wrap>pre>code{background:transparent;color:inherit}
