/* Lightweight VS Code-inspired workbench. No editor framework or web fonts. */
:root {
  --bg: #1e1e1e; --panel: #181818; --panel-2: #252526; --line: #303031;
  --text: #cccccc; --muted: #969696; --accent: #0078d4; --accent-2: #0068ba;
  --danger: #f48771; --success: #89d185; --warning: #cca700;
  --ui-font-family: "Segoe WPC", "Segoe UI", system-ui, sans-serif;
  --chat-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --ui-font-size: 13px; --chat-font-size: 14px; --chat-line-height: 1.5;
  --monospace-font-family: Consolas, "Courier New", monospace;
  font-family: var(--ui-font-family); font-size: var(--ui-font-size);
}
html, body { overflow: hidden; }
/* Let touch scrolling reach Chrome's root pull-to-refresh action. Pane sizes
   remain controlled by the workbench's viewport grid. */
@media (pointer: coarse) {
  html { overflow-y: auto; overscroll-behavior-y: auto; }
  body { overflow: visible; }
  html .chat-scroll, html .dock-enabled .window-body.projects-tab { overscroll-behavior-y: auto; }
}
* { scrollbar-width: thin; scrollbar-color: #5557 transparent; }
button:focus-visible, [tabindex]:focus-visible { outline: 1px solid #75beff; outline-offset: -2px; }
button:hover { filter: brightness(1.12); }
input, textarea, select { border-radius: 3px; background: #313131; padding: 7px 9px; }
input:focus, textarea:focus, select:focus { box-shadow: none; border-color: var(--accent); }
.primary { border-radius: 3px; padding: 7px 12px; color: #fff; font-weight: 500; }
.card { background: var(--panel); border-radius: 8px; }
.login-view { background: var(--bg); }
.brand-mark { background: #0078d4; color: #fff; border-radius: 6px; }
.brand-mark.small { width: 24px; height: 24px; border-radius: 4px; font-size: 10px; }
.app-view { height: 100dvh; grid-template-rows: 38px minmax(0, 1fr) 24px; }
.topbar { background: var(--panel); padding: 0 12px; gap: 12px; }
.brand { margin: 0; font-size: 12px; flex: 1; }
.brand strong { font-weight: 500; }
.workspace-title { width: min(36vw, 520px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 1px solid #3b3b3b; border-radius: 5px; color: var(--text); background: #222; padding: 3px 16px; }
.connection { background: transparent; padding: 0; font-size: 12px; line-height:20px; }
.connection::before { content: "●"; margin-right: 5px; font-size: 8px; }
.topbar .icon-button { font-size: 12px; line-height:20px; padding: 4px; }
.layout { grid-template-columns: 48px 250px minmax(0, 1fr); overflow: hidden; }
.activity-bar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.activity-button { position: relative; flex-shrink: 0; display: grid; place-items: center; width: 47px; height: 48px; padding: 0; background: transparent; border: 0; color: #868686; }
.activity-button svg { width: 25px; height: 25px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.activity-button:hover, .activity-button.active { color: #eee; }
.activity-button.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.activity-bottom { margin-top: auto; }
.sidebar { grid-template-rows: auto minmax(0, 1fr); min-width: 0; overflow: hidden; }
.sidebar-head { padding: 12px 10px 10px; gap: 8px; }
.sidebar-head > label { display: none; }
.sidebar-caption { display: flex; justify-content: space-between; padding: 0 5px 4px; font-size: 10px; letter-spacing: .6px; }
.sidebar-caption > .muted { font-size: 9px; }
.sidebar-head select { background: #252526; font-size: 12px; }
.sidebar-head .secondary-button { font-size: 12px; padding: 5px; background: transparent; border: 0; }
.conversation-list { padding: 6px 0; }
.conversation-item { border-radius: 0; padding: 9px 15px; }
.conversation-item strong { font-size: 12px; font-weight: 400; }
.conversation-item span { font-size: 10px; margin-top: 3px; }
.conversation-item:hover { background: #37373d; }
.sidebar-explorer { display: none; min-height: 0; }
.layout[data-view="files"] .conversation-list { display: none; }
.layout[data-view="files"] .sidebar-explorer { display: grid; }
.layout.sidebar-collapsed { grid-template-columns: 48px minmax(0, 1fr); }
.layout.sidebar-collapsed .sidebar { display: none; }
.chat-panel { grid-template-rows: 43px minmax(0, 1fr); background: var(--bg); }
.workspace-tabs { display: none; }
.chat-head { min-height: 0; padding: 6px 16px; gap: 6px; background: var(--panel); overflow: hidden; }
.chat-title { flex: 1; min-width: 0; }
.chat-head h2 { font-size: 12px; font-weight: 500; }
.chat-head p { font-size: 10px; margin: 2px 0 0; }
.title-action { font-size: 14px; padding: 0 4px; }
.mode-button { border-radius: 4px; background: transparent; min-height: 28px; border-color: transparent; padding: 4px 7px; font-size: 12px; }
.mode-button.active { background: #0078d422; color: #75beff; border-color: #0078d466; }
.chat-head .danger-button { font-size: 10px; color: var(--muted); }
.chat-head .danger-button:hover { color: var(--danger); }
.chat-tab.active { grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
.chat-scroll { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
.messages { overflow: visible; min-height: 100%; padding: 24px max(20px, calc((100% - 860px) / 2)) 10px; }
.messages:has(.message) { min-height: 0; }
.message { max-width: 820px; margin: 0 auto 24px; }
.message-role { font-size: 10px; margin-bottom: 9px; }
.message-body { border: 0; border-radius: 0; background: transparent; padding: 0; font-size: var(--chat-font-size); line-height: var(--chat-line-height); }
.message.user { width: fit-content; max-width: 88%; margin-right: 0; }
.message.user .message-role { display: none; }
.message.user .message-body { background: #2b2b2b; border: 0; border-radius: 14px; padding: 10px 16px; }
.message .status { font-size: 10px; margin-top: 6px; }
.empty-state { min-height: 140px; font-size: 12px; }
.empty-state strong { font-size: 19px; font-weight: 500; }
.plan-tray, .activity-tray, .approval-tray { padding: 0 20px; }
.plan-card { background: #242628; border-color: #414141; border-radius: 6px; }
.activity-card { border-radius: 6px; background: transparent; }
.composer { border: 0; background: var(--bg); padding: 10px max(16px, calc((100% - 900px) / 2)) 7px; min-width: 0; }
.composer-box { border: 1px solid #3c3c3c; border-radius: 15px; background: #2b2b2b; padding: 10px 10px 6px; }
.composer-box:focus-within { border-color: #555; }
.composer textarea { border: 0; background: transparent; padding: 3px 5px; min-height: 50px; font-size: 13px; box-shadow: none; }
.composer textarea::placeholder { color: #8b8b8b; }
.compose-actions { gap: 5px; margin-top: 5px; }
.attach-button { padding: 3px; font-size: 11px; }
.attach-button > span:first-child { font-size: 21px; line-height: 1; }
.voice-button { border: 0; background: transparent; font-size: 11px; padding: 4px 6px; }
.send-button { width: 30px; height: 30px; padding: 0; border-radius: 50%; background: #c9c9c9; color: #252526; font-size: 21px; }
.session-controls { gap: 2px; align-items: center; margin-top: 5px; flex-wrap: wrap; justify-content: flex-end; }
.session-controls label { min-width: 0; display: block; }
.session-controls .access-control { margin-right: auto; }
.session-controls select { width: 100%; max-width: 180px; background: transparent; border: 1px solid transparent; border-radius: 3px; padding: 4px 2px; color: var(--text); font-size: 11px; }
.session-controls select:hover { background: #383838; }
.session-controls select option { background: #252526; }
.session-controls #accessSelect { color: #d7ba7d; max-width: 166px; }
.composer-caption { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 4px 0; color: var(--muted); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.explorer-container { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; overflow: hidden; }
.explorer-head { padding: 4px; min-height: 32px; gap: 2px; }
.explorer-head .icon-button { font-size: 11px; padding: 5px; }
.file-tree { border: 0; padding: 3px 0; }
.file-row { border-radius: 0; padding: 0 10px; min-height: 22px; font-size: var(--ui-font-size); line-height: 22px; }
.file-row .file-size { display: none; }
.files-tab { grid-template-rows: 43px minmax(0, 1fr); }
.files-layout { grid-template-columns: minmax(0, 1fr); }
.editor-tabbar { display: flex; align-items: center; min-width: 0; gap: 8px; background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 10px; }
.editor-tabbar > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-style: italic; }
.editor-tabbar .muted { font-size: 9px; white-space: nowrap; }
.editor-tabbar .icon-button { padding: 4px; font-size: 18px; }
.file-meta { min-height: 30px; padding: 7px 12px; background: var(--bg); font-size: 11px; }
.code-view { display: flex; min-height: 0; min-width: 0; overflow: auto; background: var(--bg); }
.code-view pre { overflow: visible; flex: 1; background: transparent; color: #d4d4d4; padding: 10px 14px 10px 0; font-size: 13px; }
.code-view #lineNumbers { position: sticky; left: 0; flex: 0 0 auto; min-width: 46px; padding: 10px 12px; color: #858585; background: var(--bg); text-align: right; user-select: none; }
.diff-view pre { background: var(--bg); color: var(--text); }
.git-tab { background: var(--panel); }
.git-toolbar { min-height: 46px; padding: 6px 10px; }
.git-toolbar strong { font-weight: 500; }
.git-toolbar .muted, .git-remote { font-size: 11px; }
.git-actions { gap: 3px; }
.git-actions button { border-radius: 3px; font-size: 11px; padding: 5px 7px; }
.git-commit-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px 10px; gap: 5px; }
.git-commit-bar input { grid-column: 1 / -1; border-radius: 3px; min-width: 0; }
.git-commit-bar button { padding: 6px 3px; border-radius: 3px; font-size: 11px; }
.git-commit-bar .recommended { background: #0078d4; border-color: #0078d4; color: #fff; }
.git-message { font-size: 11px; }
.git-columns { grid-template-columns: 1fr; grid-template-rows: minmax(70px, .65fr) minmax(90px, 1fr); }
.git-columns section + section { border-left: 0; border-top: 1px solid var(--line); }
.git-columns h3 { padding: 6px 12px; font-size: 11px; font-weight: 500; text-transform: uppercase; }
.git-row, .commit-row { border-radius: 0; padding: 5px; font-size: 12px; }
.commit-meta { font-size: 10px; }
.project-card h2 { font-size: 15px; }
.public-key { background: var(--bg); color: var(--text); }
.statusbar { display: flex; align-items: center; gap: 14px; border-top: 1px solid var(--line); background: var(--panel); font-size: 10px; min-width: 0; overflow: hidden; padding-right: 12px; -webkit-user-select: none; user-select: none; }
.status-remote { align-self: stretch; display: grid; place-items: center; padding: 0 11px; background: #0078d4; color: #fff; }
#statusProject { max-width: 35vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-spacer { flex: 1; }
@media (min-width: 1101px) {
  .chat-panel[data-view="files"], .chat-panel[data-view="git"] { grid-template-columns: minmax(300px, .9fr) minmax(430px, 1.1fr); }
  .chat-panel[data-view="files"] .chat-head, .chat-panel[data-view="git"] .chat-head { grid-column: 2; grid-row: 1; border-left: 1px solid var(--line); }
  .chat-panel[data-view="files"] #chatTab, .chat-panel[data-view="git"] #chatTab { display: grid; grid-column: 2; grid-row: 2; border-left: 1px solid var(--line); }
  .chat-panel[data-view="files"] #filesTab, .chat-panel[data-view="git"] #gitTab { grid-column: 1; grid-row: 1 / -1; }
}
@media (min-width: 721px) and (max-width: 1100px) {
  .layout { grid-template-columns: 48px 210px minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .app-view { grid-template-rows: 38px minmax(0, 1fr) 22px; }
  .layout, .layout.sidebar-collapsed { grid-template-columns: 44px minmax(0, 1fr); }
  .activity-button { width: 43px; min-height: 44px; }
  .activity-button svg { width: 22px; height: 22px; }
  .activity-bottom { display: none; }
  .sidebar { grid-column: 2; border-right: 0; }
  .layout.sidebar-collapsed:not(.chat-open) .sidebar { display: grid; }
  .chat-panel { grid-column: 2; }
  .layout.chat-open .sidebar { display: none; }
  .layout[data-view="files"]:not(.chat-open) .conversation-list { display: block; }
  .sidebar-explorer { display: none !important; }
  .workspace-title { width: 40vw; font-size: 11px; }
  .topbar { gap: 8px; padding: 0 8px; }
  .brand strong, .remote-label { display: none; }
  .brand { flex: 0; }
  .connection { margin-left: auto; }
  .chat-head { flex-wrap: nowrap; align-items: center; padding: 5px 7px; }
  .chat-head h2 { font-size: 11px; }
  .chat-head .danger-button { font-size: 0; padding: 3px; }
  .chat-head .danger-button::after { content: "×"; font-size: 17px; }
  .messages { padding: 20px 12px 8px; }
  .message-body { font-size: var(--chat-font-size); }
  .message.user .message-body { padding: 8px 12px; }
  .composer { padding: 6px 8px calc(4px + env(safe-area-inset-bottom)); }
  .composer-box { padding: 7px; border-radius: 11px; }
  .composer textarea { min-height: 45px; font-size: 16px; }
  .compose-actions { gap: 3px; }
  .compose-actions .mode-button { font-size: 11px; padding: 4px; }
  .attach-button span:last-child { display: none; }
  .voice-button { font-size: 0; padding: 4px; }
  .voice-button::first-letter { font-size: 16px; }
  .session-controls { width: auto; flex-wrap: wrap; overflow: visible; padding: 0; gap: 0; }
  .session-controls label { flex: 0 1 auto; }
  .session-controls .access-control { flex-basis: 100%; }
  .session-controls .model-control { margin-right: auto; }
  .session-controls select { max-width: 145px; font-size: 10px; }
  .composer-caption { display: none; }
  .plan-tray, .activity-tray, .approval-tray { padding: 0 10px; }
  .files-tab { grid-template-columns: minmax(90px, 38%) minmax(0, 1fr); grid-template-rows: 43px minmax(0, 1fr); }
  .editor-tabbar { grid-column: 1 / -1; }
  .editor-tabbar .muted { display: none; }
  .explorer-container { grid-row: 2; border-right: 1px solid var(--line); }
  .files-layout { grid-row: 2; grid-column: 2; grid-template-columns: minmax(0, 1fr); }
  .explorer-head { flex-wrap: wrap; }
  .explorer-head #filesPath { flex-basis: 40%; font-size: 10px; }
  .file-row { padding: 7px 4px; font-size: var(--ui-font-size); gap: 3px; }
  .code-view pre { font-size: 11px; }
  .code-view #lineNumbers { min-width: 29px; padding-left: 4px; padding-right: 7px; }
  .git-tab { overflow: hidden; grid-template-rows: auto auto auto auto minmax(110px, 1fr) minmax(90px, .6fr); }
  .git-toolbar { flex-wrap: wrap; }
  .git-columns { min-height: 0; }
  .git-columns section { min-height: 0; }
  .git-commit-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 5px; }
  .git-commit-bar .recommended { grid-column: auto; }
  .git-commit-bar button { font-size: 10px; }
  .statusbar { gap: 8px; padding-right: 6px; font-size: 9px; }
  .status-encoding, #statusBranch { display: none; }
}
