:root {
  color-scheme: light dark;
  --canvas: light-dark(#f8f6f1, #201d19);
  --panel: light-dark(#f6eee6, #312821);
  --paper: light-dark(#fffcf6, #29251f);
  --inset: light-dark(#f2ebe2, #241f1a);
  --text: light-dark(#3a2823, #f3e6dc);
  --muted: light-dark(#6a5148, #c4a99c);
  --line: light-dark(#e5d8cf, #514038);
  --edge: light-dark(#ad9285, #8d7163);
  --wash: light-dark(#f3e5db, #443127);
  --accent: light-dark(#8c402d, #ffc2aa);
  --on-accent: light-dark(#fff, #351e16);
  --error-text: light-dark(#9f1239, #fecaca);
  --warning-text: light-dark(#79490a, #fcd34d);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--canvas);
  color: var(--text);
  accent-color: var(--accent);
}
:root[data-appearance="light"] { color-scheme: light; }
:root[data-appearance="dark"] { color-scheme: dark; }
:root[data-appearance="ocean"] {
  color-scheme: light;
  --canvas: #edf5fa;
  --panel: #dcecf6;
  --paper: #f7fbff;
  --inset: #e4f0f8;
  --text: #1b3346;
  --muted: #3f5c71;
  --line: #c7dce9;
  --edge: #6c899d;
  --wash: #d7eaf6;
  --accent: #075c8b;
  --on-accent: #ffffff;
}
:root[data-appearance="sage"] {
  color-scheme: light;
  --canvas: #f0f5eb;
  --panel: #e3ecdc;
  --paper: #f9fcf5;
  --inset: #eaf1e4;
  --text: #253726;
  --muted: #4a614a;
  --line: #d0ddc9;
  --edge: #71886e;
  --wash: #dcebd8;
  --accent: #346143;
  --on-accent: #ffffff;
}
:root[data-appearance="lavender"] {
  color-scheme: light;
  --canvas: #f4f0fa;
  --panel: #eae1f5;
  --paper: #fcf9ff;
  --inset: #eee7f7;
  --text: #372747;
  --muted: #624c77;
  --line: #ddd0ec;
  --edge: #8b769f;
  --wash: #e9dcf6;
  --accent: #694197;
  --on-accent: #ffffff;
}
:root[data-appearance="sand"] {
  color-scheme: light;
  --canvas: #faf3e2;
  --panel: #f3e5c7;
  --paper: #fffaf0;
  --inset: #f7ebd1;
  --text: #41331b;
  --muted: #665235;
  --line: #e6d5af;
  --edge: #92784c;
  --wash: #efdfbc;
  --accent: #805116;
  --on-accent: #ffffff;
}
:root[data-appearance="midnight"] {
  color-scheme: dark;
  --canvas: #10182b;
  --panel: #192743;
  --paper: #141f36;
  --inset: #111b31;
  --text: #e5edff;
  --muted: #afbdd8;
  --line: #30415f;
  --edge: #687da4;
  --wash: #233457;
  --accent: #8fbbff;
  --on-accent: #142340;
}
:root[data-appearance="forest"] {
  color-scheme: dark;
  --canvas: #122019;
  --panel: #1d3326;
  --paper: #17291e;
  --inset: #14241b;
  --text: #e2f1e5;
  --muted: #acc8b3;
  --line: #304939;
  --edge: #607e69;
  --wash: #274333;
  --accent: #97d8ab;
  --on-accent: #173123;
}
:root[data-appearance="plum"] {
  color-scheme: dark;
  --canvas: #231724;
  --panel: #362438;
  --paper: #2b1d2e;
  --inset: #261a29;
  --text: #f5e7f4;
  --muted: #d1b2cd;
  --line: #50394f;
  --edge: #8b6788;
  --wash: #492e48;
  --accent: #f3ace0;
  --on-accent: #3b2140;
}
:root[data-appearance="graphite"] {
  color-scheme: dark;
  --canvas: #17181a;
  --panel: #242629;
  --paper: #1e2023;
  --inset: #1a1c1e;
  --text: #f2f3f5;
  --muted: #b9bec6;
  --line: #363a40;
  --edge: #767d87;
  --wash: #30343a;
  --accent: #d7dce4;
  --on-accent: #25282d;
}
/* The composer is one box: the message on top, and below it a single row of
   attach, a one-line hint that truncates, and icon buttons, at any width. */
.composer { display:flex; flex-direction:column; gap:6px; max-width:960px; width:100%; margin:auto; padding:8px; border:1px solid var(--edge); border-radius:10px; background:var(--paper); }
.composer:focus-within { border-color:var(--muted); }
.composer textarea { width:100%; min-height:44px; resize:none; field-sizing:content; border:0; outline:none; background:transparent; color:inherit; padding:4px 6px; }
.composer-bar { display:flex; align-items:center; gap:8px; min-width:0; }
.composer .icon-button { flex:none; display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; padding:0; line-height:0; }
.composer-attach { position:relative; cursor:pointer; }
.composer-attach:focus-within { outline:2px solid var(--accent); outline-offset:1px; }
.composer-attach input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.composer-attach[data-count]::after { content:attr(data-count); position:absolute; top:-6px; right:-6px; min-width:16px; height:16px; padding:0 4px; border-radius:8px; background:var(--accent); color:var(--on-accent); font-size:.7rem; line-height:16px; text-align:center; }
.composer-actions { flex:1; min-width:0; display:flex; align-items:center; gap:8px; }
.composer-actions small { flex:1; min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:var(--muted); font-size:.78rem; }
.composer-buttons { flex:none; display:flex; gap:6px; }
/* Model, effort, and the context indicator sit under the message box, left of
   the hint, and shrink before the send button does. */
.composer-settings { flex:0 1 auto; min-width:0; display:flex; align-items:center; gap:6px; overflow:hidden; }
.composer-settings select { min-width:0; max-width:180px; height:32px; padding:0 6px; border:1px solid var(--edge); border-radius:6px; background:var(--canvas); color:inherit; font-size:.8rem; text-overflow:ellipsis; }
.context-usage { flex:none; display:inline-flex; align-items:center; gap:6px; height:32px; padding:0 8px; font-size:.78rem; font-variant-numeric:tabular-nums; }
.context-meter { display:inline-block; width:36px; height:6px; border-radius:3px; background:var(--line); overflow:hidden; }
.context-meter>span { display:block; height:100%; background:#22c55e; }
.context-meter[data-level="medium"]>span { background:#eab308; }
.context-meter[data-level="high"]>span { background:#ef4444; }
.context-note { font-size:.8rem; color:var(--muted); margin:0 0 8px; }
.context-panel details { margin-top:8px; }
.context-messages { margin:6px 0 0; padding-left:24px; display:flex; flex-direction:column; gap:4px; font-size:.85rem; }
.context-messages summary { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; cursor:pointer; }
.new-session-chat { justify-content:center; }
.new-session-box { width:100%; max-width:960px; margin:0 auto; display:flex; flex-direction:column; gap:12px; }
.new-session-box h1 { text-align:center; }
.new-session-form .composer-settings { flex:1; }
.new-session-form .composer-buttons { margin-left:auto; }
.new-session-form .session-name-input { border:0; border-bottom:1px solid var(--line); outline:none; background:transparent; color:inherit; padding:6px; font-weight:600; }
.session-name-error:empty { display:none; }
/* A form whose session name is refused cannot be sent: its submit buttons
   are disabled by app.js and look it. */
form:has(.session-name-input[aria-invalid="true"]) button[type="submit"]:disabled { background:var(--edge); color:var(--muted); opacity:.6; cursor:not-allowed; }
@media (max-width:640px) { .composer-actions small { display:none; } .composer-settings select { max-width:110px; } }
[data-state="working"] #send-button { background:#854d0e; color:#fff; }
[data-state="working"] #send-button svg { animation:working-pulse 1.2s ease-in-out infinite; }
@keyframes working-pulse { 50% { opacity:.35; } }
@media (prefers-reduced-motion:reduce) { #send-button svg { animation:none!important; } .icon-button svg { transition:none; } }
.sessions-page { height:100dvh; min-height:0; display:flex; flex-direction:column; overflow:hidden; }
.sessions-page>.app-header { flex-shrink:0; }
.sessions-page .app-shell { flex:1; min-height:0; grid-template-rows:minmax(0,1fr); overflow:hidden; }
.sessions-page .sidebar { min-height:0; overflow:hidden; }
.sessions-page .sidebar-header,.sessions-page .label-filter { flex-shrink:0; }
.sessions-page .session-list { flex:1; min-height:0; overscroll-behavior:contain; }
.sessions-page .chat-panel { min-height:0; overflow:hidden; padding-block:16px; }
.sessions-page .chat-panel>header { flex-shrink:0; max-height:25%; overflow:auto; padding-bottom:10px; }
.sessions-page .message-list { overscroll-behavior:contain; }
.sessions-page .message-list>* { flex-shrink:0; }
.sessions-page .history .message-list { min-height:0; }
.sessions-page .composer { flex-shrink:0; margin:0 auto env(safe-area-inset-bottom); }
.sessions-page .composer textarea { max-height:25dvh; }
.sessions-page #live-status:empty,.sessions-page #context-panel:empty { display:none; }
.session-split { flex:1; min-height:0; display:flex; --skill-panel-width:380px; }
.chat-column { flex:1; min-width:0; min-height:0; display:flex; flex-direction:column; gap:16px; position:relative; }
.history { position:relative; }
.jump-latest { position:absolute; left:50%; transform:translateX(-50%); z-index:2; padding:6px 14px; border-radius:999px; font-size:.85rem; box-shadow:0 4px 12px rgb(0 0 0 / .4); }
.jump-latest[data-count]::after { content:attr(data-count); margin-left:8px; padding:0 6px; border-radius:999px; background:var(--paper); color:var(--accent); font-weight:700; }
/* A live chat runs edge to edge like the terminal: the header's bottom line
   spans the pane, and the skills split's line runs from it to the bottom. */
.sessions-page .chat-panel:has(>.session-split) { padding:0; gap:0; }
.sessions-page .chat-panel:has(>.session-split)>header { padding:10px 20px 8px; align-items:center; gap:8px; }
.sessions-page .chat-panel:has(>.session-split)>header h1 { font-size:1.15rem; }
.sessions-page .chat-panel>.session-split>.chat-column { padding:16px 20px; }
.split-handle { flex:none; width:1px; cursor:col-resize; position:relative; touch-action:none; background:var(--line); }
.split-handle::after { content:""; position:absolute; z-index:1; inset:0 -3px; }
.split-handle:hover::after,.split-handle:focus-visible::after,.split-handle.dragging::after { background:var(--accent); }
.split-handle:focus-visible { outline:none; }
.skill-panel { flex:none; width:var(--skill-panel-width); min-width:240px; max-width:70%; min-height:0; display:flex; flex-direction:column; background:var(--inset); }
.skill-panel-body { flex:1; min-height:0; overflow:hidden; display:flex; flex-direction:column; }
.skill-panel-body>:is(.extension-status,.extension-notes) { padding:8px; }
/* The panel and its handle appear once a skill has put something on screen. */
.session-split:not(:has(.skill-panel-body :is(.extension-status > *, .skill-view, .extension-note))) :is(.split-handle, .skill-panel) { display:none; }
.extension-status:empty,.skill-views:empty,.extension-dialogs:empty,.extension-notes:empty { display:none; }
.extension-status { display:flex; flex-wrap:wrap; gap:6px; color:var(--muted); font-size:.8rem; }.extension-status span { background:var(--paper); border:1px solid var(--line); border-radius:999px; padding:3px 8px; }
.extension-notes { display:grid; gap:8px; }
/* Plugin dialogs are popups over the page while a plugin waits for an answer. */
.extension-dialogs { position:fixed; z-index:40; inset:0; display:grid; place-content:center; gap:12px; padding:16px; overflow:auto; background:rgba(15,23,42,.7); }
/* The panel's windows sit side by side; a window's flex-grow is its share of
   the width, which the handle between two windows moves. The views wait in
   the hidden #skill-views until a window shows them. */
.skill-views { display:none; }
.skill-panel-body:not(:has(.skill-view))>.skill-windows { display:none; }
.skill-windows { flex:1 1 0; min-height:0; display:flex; overflow-x:auto; }
.skill-window { flex:1 1 0; min-width:120px; min-height:0; display:flex; flex-direction:column; }
.skill-window.selected>.skill-window-bar { box-shadow:inset 0 -2px var(--accent); }
.skill-window-bar { padding-left:6px; }
.skill-window-select { flex:1; min-width:0; background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:2px 6px; font-size:.8rem; }
.skill-window-body { flex:1; min-height:0; overflow:auto; padding:8px; overscroll-behavior:contain; display:flex; flex-direction:column; }
.skill-window-empty { margin:auto; max-width:240px; padding:16px; border:1px dashed var(--edge); border-radius:8px; text-align:center; color:var(--muted); font-size:.85rem; }
.skill-window-empty strong { display:block; margin-bottom:4px; color:var(--text); }.skill-window-empty p { margin:0; }
.skill-view>.extension-widget { border:0; padding:0; background:none; }
.window-handle { flex:none; width:1px; cursor:col-resize; position:relative; touch-action:none; background:var(--line); }
.window-handle::after { content:""; position:absolute; z-index:1; inset:0 -3px; }
.window-handle:hover::after,.window-handle:focus-visible::after,.window-handle.dragging::after { background:var(--accent); }
.window-handle:focus-visible { outline:none; }
/* Collapsed, the panel keeps only its bar: beside the chat a narrow strip,
   with the collapse button still at the top, the new-tab link below it, and
   the panel's name running down the strip. */
.skill-panel[data-collapsed] { width:auto; min-width:0; }
.skill-panel[data-collapsed] :is(.skill-panel-body,.skill-panel-split) { display:none; }
.session-split:has(>.skill-panel[data-collapsed])>.split-handle { display:none; }
.skill-panel[data-collapsed]>.skill-panel-bar { flex:1; flex-direction:column; justify-content:flex-start; padding:4px; border-bottom:0; border-left:1px solid var(--line); }
.skill-panel[data-collapsed]>.skill-panel-bar strong { order:1; writing-mode:vertical-rl; }
.skill-panel[data-collapsed]>.skill-panel-bar .pane-bar-actions { flex-direction:column-reverse; }
/* The chevron points the way the button moves the panel: right to collapse it, left to expand it. */
.skill-panel-toggle svg { transform:rotate(-90deg); }.skill-panel-toggle[aria-expanded="false"] svg { transform:rotate(90deg); }
.extension-widget { margin:0; padding:10px; border:1px solid var(--line); border-radius:8px; background:var(--panel); white-space:pre; overflow-x:auto; font:12px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace; }
.extension-dialog { display:grid; gap:8px; width:min(480px,calc(100vw - 32px)); padding:16px; border:1px solid var(--accent); border-radius:10px; background:var(--panel); box-shadow:0 12px 32px rgba(0,0,0,.5); }.extension-dialog p { margin:0; white-space:pre-wrap; }.extension-dialog-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:flex-start; }.extension-dialog input,.extension-dialog textarea { flex:1 1 100%; background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; }.extension-dialog textarea { min-height:120px; resize:vertical; }
.extension-notes { max-height:30%; overflow:auto; }.extension-note { margin:0; color:var(--muted); font-size:.85rem; border-left:2px solid var(--line); padding-left:8px; }
.notify-warning { color:var(--warning-text); border-color:#a16207; }.notify-error { color:var(--error-text); border-color:#991b1b; }
.page-panel.skills-page { display:flex; flex-direction:column; gap:12px; padding-block:12px; }
.page-panel>header.skills-page-bar { display:flex; align-items:baseline; justify-content:space-between; gap:12px; min-width:0; max-width:none; margin:0; padding-bottom:8px; }
.page-panel .skills-page-bar h1 { margin:0; font-size:.95rem; font-weight:600; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.skills-page-bar h1 span { font-weight:400; color:var(--muted); }
.skills-page-bar a { flex:none; font-size:.85rem; color:var(--muted); }
/* Skill layouts: a header, then a light window with a bar and columns of cards. */
.skill-layout { container-type:inline-size; display:flex; flex-direction:column; gap:14px; }
.skill-layout-head h2 { margin:2px 0 0; font-size:clamp(1.3rem,4cqi,2.4rem); font-weight:500; line-height:1.15; text-wrap:balance; color:var(--text); }
.skill-layout-eyebrow { margin:0; font-size:.8rem; letter-spacing:.18em; text-transform:uppercase; color:var(--accent); }
.skill-layout-window { background:#eceff1; color:#263238; border-radius:14px; overflow:hidden; box-shadow:0 10px 30px rgba(0,0,0,.35); }
.skill-layout-bar { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; padding:10px 16px; background:#cfd8dc; color:#37474f; }
.skill-layout-bar>span:first-child { flex:1; min-width:0; }
.skill-layout-badge { padding:2px 10px; border-radius:8px; background:#546e7a; color:#fff; font-size:.85rem; }
.skill-layout-columns { display:grid; gap:16px; padding:16px; }
@container (max-width:640px) { .skill-layout-columns { grid-template-columns:minmax(0,1fr)!important; } }
.skill-layout-card { min-width:0; display:flex; flex-direction:column; gap:10px; background:#fff; border-radius:10px; padding:14px 16px; }
.skill-layout-heading { margin:0; font-size:.78rem; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:#546e7a; }
.skill-layout-text { margin:0; color:#263238; line-height:1.55; overflow-wrap:anywhere; }
.skill-layout-code { margin:0; padding:10px 12px; max-height:60vh; overflow:auto; background:#eceff1; border:1px solid #cfd8dc; border-radius:8px; color:#263238; white-space:pre; font:12px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; tab-size:4; }
.skill-layout-table { overflow-x:auto; }
.skill-layout-table table { width:100%; border-collapse:collapse; }
.skill-layout-table th { text-align:left; background:#e3ecef; padding:7px 9px; font-weight:600; }
.skill-layout-table td { padding:7px 9px; border-top:1px solid #e3ecef; }
.skill-layout-stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:12px; font-variant-numeric:tabular-nums; }
.skill-layout-stats p { margin:0; }.skill-layout-stats b { display:block; font-size:1.7rem; font-weight:600; color:#263238; }.skill-layout-stats span { color:#4e626b; font-size:.88rem; }
.skill-layout-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; font-variant-numeric:tabular-nums; }
.skill-layout-list li { line-height:1.4; }
.skill-layout-actions { display:inline-flex; flex-wrap:wrap; gap:6px; vertical-align:middle; }
.skill-layout-list .skill-layout-actions { margin-left:8px; }
.skill-layout-action { margin:0; }
.skill-layout-window .skill-layout-action button { font-size:.85rem; padding:4px 12px; border-radius:8px; border:2px solid #37474f; cursor:pointer; }
.skill-layout-window .skill-layout-action button.primary { background:#37474f; color:#fff; }
.skill-layout-window .skill-layout-action button.secondary { background:transparent; color:#37474f; }
.skill-layout-window .skill-layout-action a { display:inline-block; text-decoration:none; font-size:.85rem; padding:4px 12px; border-radius:8px; border:2px solid #37474f; cursor:pointer; }
.skill-layout-window .skill-layout-action a.primary { background:#37474f; color:#fff; }
.skill-layout-window .skill-layout-action a.secondary { background:transparent; color:#37474f; }
.skill-layout-window .skill-layout-action a:focus-visible { outline:2px solid #f2b544; outline-offset:2px; }
.skill-layout-window .skill-layout-action button:focus-visible { outline:2px solid #f2b544; outline-offset:2px; }
/* Colored styles (layoutActionStyles), each with a background of its own so a
   button never falls back to the browser's gray: view is filled green and
   download filled blue, for a file or a folder alike; open is a light orange (amber)
   outline with black text. White on each fill keeps at least 5:1 contrast. */
.skill-layout-window .skill-layout-action .action-open { background:#fff; color:#000; border-color:#ffb300; }
.skill-layout-window .skill-layout-action .action-view { background:#2e7d32; color:#fff; border-color:#2e7d32; }
.skill-layout-window .skill-layout-action .action-download { background:#1565c0; color:#fff; border-color:#1565c0; }
.skill-layout-list .skill-layout-action button,.skill-layout-list .skill-layout-action a { font-size:.78rem; padding:1px 8px; }
.skill-layout-spacer { flex:1; min-height:8px; }
/* Markdown blocks on the light cards. Contrast is at least 4.5:1 on each
   background; tables and code scroll inside their own box. */
.skill-layout-markdown { min-width:0; color:#263238; line-height:1.65; overflow-wrap:anywhere; }
.skill-layout-markdown>:first-child { margin-top:0; }.skill-layout-markdown>:last-child { margin-bottom:0; }
.skill-layout-markdown :is(p,ul,ol,pre,blockquote,table,hr) { margin:0 0 .85em; }
.skill-layout-markdown :is(h1,h2,h3,h4,h5,h6) { margin:1.3em 0 .5em; line-height:1.3; font-weight:600; color:#263238; scroll-margin-top:8px; }
.skill-layout-markdown h1 { font-size:1.45rem; }.skill-layout-markdown h2 { font-size:1.25rem; padding-bottom:.2em; border-bottom:1px solid #cfd8dc; }.skill-layout-markdown h3 { font-size:1.1rem; }.skill-layout-markdown h4 { font-size:1rem; }.skill-layout-markdown h5 { font-size:.92rem; }.skill-layout-markdown h6 { font-size:.85rem; color:#4e626b; }
.skill-layout-markdown :is(ul,ol) { padding-left:1.6em; }.skill-layout-markdown ul { list-style:disc; }.skill-layout-markdown ol { list-style:decimal; }
.skill-layout-markdown li>:is(ul,ol) { margin:.25em 0; }.skill-layout-markdown li+li { margin-top:.25em; }.skill-layout-markdown li>p { margin:0 0 .4em; }
.skill-layout-markdown li:has(>input[type=checkbox]) { list-style:none; margin-left:-1.4em; }.skill-layout-markdown li>input[type=checkbox] { margin:0 .45em 0 0; vertical-align:-.1em; accent-color:#37474f; }
.skill-layout-markdown a { color:#1a5fa0; text-decoration:underline; text-underline-offset:2px; }
.skill-layout-markdown a:focus-visible { outline:2px solid #1a5fa0; outline-offset:2px; }
.skill-layout-markdown code { font:.88em ui-monospace,SFMono-Regular,Menlo,monospace; background:#eceff1; border:1px solid #cfd8dc; border-radius:4px; padding:1px 4px; color:#263238; }
.skill-layout-markdown pre { overflow:auto; max-height:70vh; background:#f5f7f8; border:1px solid #cfd8dc; border-radius:8px; padding:10px 12px; white-space:pre; overflow-wrap:normal; line-height:1.5; tab-size:4; }
.skill-layout-markdown pre code { font-size:12px; border:0; padding:0; background:none; }
.skill-layout-markdown blockquote { padding:.2em 0 .2em 12px; border-left:3px solid #90a4ae; color:#37474f; }
.skill-layout-markdown table { display:block; max-width:100%; overflow-x:auto; border-collapse:collapse; overflow-wrap:normal; font-variant-numeric:tabular-nums; }
.skill-layout-markdown :is(th,td) { padding:6px 10px; border:1px solid #cfd8dc; text-align:left; vertical-align:top; }
.skill-layout-markdown th { background:#e3ecef; font-weight:600; }
.skill-layout-markdown hr { border:0; border-top:1px solid #cfd8dc; }
.skill-layout-markdown del { color:#4e626b; }
/* Document mode: one column of long text at a readable line length. */
.skill-layout-document { padding:20px clamp(16px,4cqi,40px); }
.skill-layout-document>* { width:100%; max-width:72ch; margin-inline:auto; }
.skill-layout-document .skill-layout-markdown { line-height:1.8; }
.skill-layout-toc { padding:10px 14px; background:#f5f7f8; border:1px solid #cfd8dc; border-radius:8px; font-size:.92rem; }
.skill-layout-toc ul { list-style:none; margin:0; padding:0; display:grid; gap:4px; }
.skill-layout-toc a { color:#1a5fa0; text-decoration:none; }.skill-layout-toc a:hover { text-decoration:underline; }
.skill-layout-toc-2 { padding-left:1em; }.skill-layout-toc-3 { padding-left:2em; font-size:.9em; }
.usage-section .settings-form { grid-template-columns:repeat(auto-fit,minmax(170px,max-content)); align-items:end; }
.usage-section .settings-form > p { grid-column:1/-1; margin:0; display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; }
.usage-section .settings-form a, .usage-section .skill-layout-table a { color:var(--accent); }
.usage-section .skill-layout-stats { padding:16px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
.usage-section .skill-layout-stats b { color:var(--text); font-size:1.5rem; }.usage-section .skill-layout-stats span { color:var(--muted); }
.usage-section .skill-layout-table { border:1px solid var(--line); border-radius:8px; }
.usage-section .skill-layout-table th { background:var(--paper); color:var(--text); white-space:nowrap; }
.usage-section .skill-layout-table td { border-top-color:var(--line); font-variant-numeric:tabular-nums; }
.usage-section .skill-layout-table :is(th,td):not(:first-child) { text-align:right; }
.usage-section .skill-layout-table td:first-child { overflow-wrap:anywhere; }
.usage-section .tone-muted, .usage-section .empty-list { color:var(--muted); padding:0; }
.usage-chart { display:grid; grid-template-columns:auto minmax(0,1fr); column-gap:8px; padding:14px 14px 8px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
.usage-y { position:relative; height:140px; min-width:2.5em; color:var(--muted); font-size:.75rem; font-variant-numeric:tabular-nums; }
.usage-y span { position:absolute; right:0; transform:translateY(50%); line-height:1; }
.usage-days { position:relative; display:flex; align-items:flex-end; gap:2px; height:140px; border-left:1px solid var(--edge); border-bottom:1px solid var(--edge); }
.usage-days i { position:absolute; left:0; right:0; border-top:1px dashed var(--line); pointer-events:none; }
.usage-days span { position:relative; flex:1; min-width:2px; background:var(--accent); border-radius:2px 2px 0 0; }.usage-days span:hover { background:var(--accent); }.usage-days span.empty { height:2px; background:var(--line); }
.usage-axis { display:flex; justify-content:space-between; color:var(--muted); font-size:.8rem; padding-top:6px; }
.tone-good { color:#2e7d32; }.tone-warning { color:#8a5a00; }.tone-bad { color:#c62828; }.tone-muted { color:#4e626b; }
.skills-page .skill-panel { flex:1; width:auto; max-width:none; background:none; }
.page-panel.skills-page { height:calc(100dvh - 66px); min-height:0; }
.skills-page .skill-panel-body:not(:has(.extension-status > *, .skill-view, .extension-note))::before { content:"No skill has shown anything in this session yet."; color:var(--muted); }
/* Phones and portrait tablets stack the skill panel under the chat. */
@media (max-width:700px), (max-width:1024px) and (orientation:portrait) {
  .session-split { flex-direction:column; }
  /* The handle above the panel sets its height, as the terminal's does. */
  .split-handle { width:auto; height:1px; cursor:row-resize; }
  .split-handle::after { inset:-3px 0; }
  /* The windows share the panel's height, so the panel needs one of its own. */
  .skill-panel { width:auto; max-width:none; height:var(--skill-panel-height,45%); }
  /* Under the chat a collapsed panel is its header bar, as the terminal's is. */
  .skill-panel[data-collapsed] { height:auto; border-top:1px solid var(--line); }
  .skill-panel[data-collapsed]>.skill-panel-bar { flex-direction:row; justify-content:space-between; padding:4px 12px; border-left:0; }
  .skill-panel[data-collapsed]>.skill-panel-bar strong { order:0; writing-mode:horizontal-tb; }
  .skill-panel[data-collapsed]>.skill-panel-bar .pane-bar-actions { flex-direction:row; }
  .skill-panel-toggle svg { transform:none; }.skill-panel-toggle[aria-expanded="false"] svg { transform:rotate(180deg); }
}
@media (max-width:700px) {
  .sessions-page .chat-panel { padding:12px; gap:8px; }
  .sessions-page .chat-panel:has(>.session-split)>header { padding:12px 12px 8px; }
  .sessions-page .chat-panel>.session-split>.chat-column { padding:12px; gap:8px; }
}
* { box-sizing:border-box; }
body { margin:0; min-height:100dvh; }
button, input, textarea { font:inherit; }
button { cursor:pointer; }
.app-shell { min-height:calc(100dvh - 66px); display:grid; grid-template-columns:300px minmax(0,1fr); }
.sidebar { background:var(--panel); border-right:1px solid var(--line); display:flex; flex-direction:column; min-height:calc(100dvh - 66px); padding:18px 12px; gap:16px; }
.eyebrow,.session-row small { color:var(--muted); font-size:.78rem; }
.sidebar-header { display:flex; align-items:center; justify-content:space-between; gap:4px; }
.sidebar-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:4px; padding:0 4px; }
.sidebar-actions .admin-override { margin:0; white-space:normal; overflow-wrap:anywhere; }
.sidebar-actions .icon-button { flex:none; display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; padding:0; line-height:0; }
.primary,.secondary,.danger,.secondary-nav a { border:0; border-radius:7px; padding:9px 11px; color:inherit; }.primary { background:var(--accent); color:var(--on-accent); }.secondary,.secondary-nav a { background:var(--wash); }.danger { background:#9f1239; color:#fff; }
.session-list { display:flex; flex-direction:column; gap:5px; overflow:auto; }.session-row { display:block; text-decoration:none; background:transparent; border:1px solid transparent; color:inherit; text-align:left; border-radius:7px; padding:9px; }.session-row:hover { background:var(--wash); border-color:var(--edge); }.session-row span,.session-row small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.empty-list { color:var(--muted); padding:0 8px; }.secondary-nav { margin-top:auto; display:grid; gap:6px; }.secondary-nav a { text-align:left; color:var(--text); text-decoration:none; }
.chat-panel { min-width:0; min-height:100dvh; padding:28px clamp(18px,5vw,72px); display:flex; flex-direction:column; gap:16px; background:var(--canvas); }.chat-panel>header { display:flex; justify-content:space-between; align-items:flex-start; border-bottom:1px solid var(--line); padding-bottom:18px; }.chat-panel h1:where(:not(.skill-panel *)) { margin:2px 0; font-size:1.4rem; }.chat-panel h2:where(:not(.skill-panel *)) { font-size:1rem; }.chat-panel p:where(:not(.skill-panel *)) { color:var(--text); }.empty-chat { justify-content:center; align-items:center; text-align:center; }.empty-chat>div { max-width:440px; }.session-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }button,.link-button { white-space:nowrap; }
.message-list { flex:1; min-height:0; max-width:960px; width:100%; margin:auto; overflow:auto; display:flex; flex-direction:column; gap:12px; padding:4px 0 16px; }.message { border:1px solid var(--line); border-radius:10px; padding:12px; max-width:90%; }.message.user { align-self:flex-end; background:var(--wash); border-color:var(--line); }.message.assistant { background:var(--paper); }.message.error { background:light-dark(#fff1ee, #450a0a); border-color:#991b1b; }.message-role { color:var(--muted); font-size:.75rem; text-transform:uppercase; margin-bottom:6px; }.message-head { display:flex; align-items:baseline; gap:8px; margin-bottom:6px; }.message-head .message-role { margin-bottom:0; }.message-time { color:var(--muted); font-size:.75rem; }.message pre { margin:0; white-space:pre-wrap; font:inherit; }.tool-result { border:1px solid var(--line); border-radius:8px; background:var(--panel); max-width:90%; overflow:hidden; }.tool-result summary { cursor:pointer; color:var(--text); padding:9px 12px; }.tool-result pre { border-top:1px solid var(--line); margin:0; padding:12px; white-space:pre-wrap; font:inherit; }.live-status,.system-note { color:var(--muted); font-size:.85rem; }.reply-meta { color:var(--muted); font-size:.75rem; margin:8px 0 0; }
.markdown { line-height:1.55; overflow-wrap:anywhere; }.markdown>:first-child { margin-top:0; }.markdown>:last-child { margin-bottom:0; }.markdown p,.markdown ul,.markdown ol,.markdown pre,.markdown blockquote,.markdown table { margin:0 0 .75em; }.markdown h1,.markdown h2,.markdown h3,.markdown h4 { margin:1em 0 .5em; line-height:1.3; }.markdown h1 { font-size:1.3rem; }.markdown h2 { font-size:1.15rem; }.markdown h3,.markdown h4 { font-size:1rem; }.markdown ul,.markdown ol { padding-left:1.5em; }.markdown a { color:var(--accent); }.message.user .markdown a { color:var(--accent); }.markdown a.unverified-link { color:var(--warning-text); text-decoration-style:dotted; }.markdown a.unverified-link::after { content:" (" attr(data-host) ")"; font-size:.8em; }.markdown code { font:.9em ui-monospace,SFMono-Regular,Menlo,monospace; background:var(--inset); border:1px solid var(--line); border-radius:4px; padding:1px 4px; }.markdown pre { overflow:auto; background:var(--inset); border:1px solid var(--line); border-radius:8px; padding:10px; white-space:pre; }.markdown pre code { border:0; padding:0; background:none; }.markdown blockquote { border-left:3px solid var(--edge); padding-left:10px; color:var(--text); }.markdown table { border-collapse:collapse; display:block; overflow:auto; }.markdown th,.markdown td { border:1px solid var(--line); padding:4px 8px; text-align:left; }.markdown hr { border:0; border-top:1px solid var(--line); }.thinking { margin-bottom:8px; color:var(--muted); font-style:italic; }.thinking summary { cursor:pointer; font-style:normal; font-size:.85rem; }.thinking .markdown { border-left:2px solid var(--line); padding-left:10px; margin-top:6px; }
.history { flex:1; display:flex; flex-direction:column; min-height:0; }.history .message-list { min-height:60vh; }.settings form,.settings-form { display:grid; gap:12px; }.settings label,.settings-form label { display:grid; gap:5px; max-width:640px; color:var(--text); }.settings input,.settings-form input { background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; }.check { display:flex!important; align-items:center; gap:8px; }.imap-account { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; border:1px solid var(--line); border-radius:8px; padding:12px; }.imap-check { grid-column:1/-1; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }.link-button { display:inline-block; text-decoration:none; }.ui-error { color:#fecaca; background:#450a0a; padding:10px; border-radius:7px; }.settings textarea { background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; font:12px ui-monospace,SFMono-Regular,Menlo,monospace; resize:vertical; }
.context-panel { border:1px solid var(--edge); border-radius:10px; padding:12px; max-width:960px; width:100%; margin:auto; background:var(--panel); }.context-panel header { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }.context-panel header small { display:block; color:var(--muted); margin-top:4px; }.context-summary { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; color:var(--text); font-size:.85rem; }.context-summary span { background:var(--paper); border:1px solid var(--line); border-radius:999px; padding:4px 8px; }.context-panel pre { max-height:40dvh; overflow:auto; white-space:pre-wrap; word-break:break-word; font:12px ui-monospace,SFMono-Regular,Menlo,monospace; background:var(--inset); border:1px solid var(--line); border-radius:8px; padding:10px; } .control-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }.control-grid form,.model-form { display:flex; gap:8px; align-items:end; }.control-grid select,.model-form input { background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; }.model-form { margin-top:12px; }
.page-shell { min-height:100dvh; background:var(--canvas); }.app-header { min-height:66px; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px 20px; padding:8px clamp(18px,5vw,72px); border-bottom:1px solid var(--line); background:var(--panel); }.app-header nav,.header-start { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }.app-header a { color:var(--text); text-decoration:none; padding:8px 10px; border-radius:7px; }.app-header a:hover,.app-header a.active { background:var(--wash); color:var(--text); }.page-brand { display:flex; align-items:center; gap:9px; padding-left:0!important; color:var(--text)!important; font-weight:700; }.page-brand:hover { background:transparent!important; }.page-brand img { width:28px; height:28px; }.page-panel { min-width:0; min-height:calc(100dvh - 66px); padding:28px clamp(18px,5vw,72px); background:var(--canvas); }.page-panel>header { display:flex; justify-content:space-between; align-items:flex-start; border-bottom:1px solid var(--line); padding-bottom:18px; max-width:1180px; margin:0 auto 22px; }.page-panel h1 { margin:2px 0; font-size:1.6rem; }.page-panel h2 { font-size:1rem; }.page-panel>section { width:min(1180px,100%); margin:0 auto 24px; }
.login-panel { min-height:100dvh; display:grid; place-items:center; padding:24px; background:var(--canvas); }.login-form { width:min(380px,100%); background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:24px; }.login-form h1 { margin:4px 0 8px; font-size:1.4rem; }.login-form label { display:grid; gap:5px; color:var(--text); }.login-form input { background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; }
.login-form .page-brand { font-size:1.25rem; }.login-form .page-brand img { width:48px; height:48px; }
.language-switch { display:grid; gap:8px; margin:0; }
.language-switch > label { color:var(--muted); font-size:.8rem; }
.login-panel > .language-switch { position:absolute; inset-block-start:16px; inset-inline-end:16px; }
.preference-select { position:relative; display:block; }
.preference-select select {
  appearance:none;
  width:100%;
  min-height:36px;
  padding:6px 10px;
  padding-inline-end:36px;
  border:1px solid var(--edge);
  border-radius:7px;
  background:var(--canvas);
  color:var(--text);
  font:inherit;
  font-size:.85rem;
}
.preference-select > svg {
  position:absolute;
  inset-block-start:50%;
  inset-inline-end:12px;
  transform:translateY(-50%);
  pointer-events:none;
  color:var(--text);
}
@media (pointer:coarse) {
  .preference-select select { min-height:44px; }
}
.signout { display:flex; align-items:center; gap:8px; margin:0 0 0 8px; }.user-name { color:var(--muted); font-size:.85rem; }
.workspace-list { display:grid; gap:8px; }.workspace-row { display:flex; justify-content:space-between; align-items:center; gap:12px; border:1px solid var(--line); border-radius:8px; padding:12px; background:var(--panel); }.workspace-row strong,.workspace-row small { display:block; }.workspace-row small { color:var(--muted); font-size:.8rem; margin-top:3px; }.workspace-row a:not(.primary, .danger) { color:var(--accent); }.workspace-row.pinned { border-color:var(--accent); }.status-error { color:var(--error-text)!important; }
.inline-form { display:flex!important; flex-wrap:wrap; align-items:end; gap:8px; }.inline-form input { background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; }
.share-warning { margin:6px 0; color:var(--warning-text); font-size:.82rem; }
.admin-override { display:inline-block; margin:0 6px; padding:1px 7px; border:1px solid #b45309; border-radius:999px; background:#451a03; color:#fde68a; font-size:.72rem; font-weight:600; line-height:1.5; white-space:nowrap; vertical-align:middle; align-self:center; }
.provider-card { border:1px solid var(--line); border-radius:8px; padding:12px; margin-bottom:12px; background:var(--panel); }.provider-card h3 { margin:0 0 6px; }.account-line { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.workspace-access { width:min(1180px,100%); margin:0 auto; display:grid; gap:28px; min-width:0; }
.workspace-access>section { display:grid; gap:16px; min-width:0; }
.workspace-access h2,.workspace-access p { margin:0; }
.workspace-access p { color:var(--text); line-height:1.5; }
.workspace-access .settings-form { width:min(640px,100%); grid-template-columns:minmax(0,1fr); padding:16px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
.workspace-access .settings-form label { min-width:0; max-width:none; }
.workspace-access .settings-form input:not([type="checkbox"]),.workspace-access .settings-form select { width:100%; min-width:0; }
.workspace-access .settings-form button { justify-self:start; }
.workspace-access .check { align-items:flex-start; line-height:1.5; }
.workspace-access .check input { flex:none; margin-top:5px; }
.workspace-access .workspace-row>div { min-width:0; overflow-wrap:anywhere; }
.workspace-access details.provider-card { margin:0; }
.workspace-access details.provider-card>summary { cursor:pointer; }
.workspace-access details.provider-card[open]>summary { margin-bottom:12px; }
.workspace-access details.provider-card .settings-form { padding:0; border:0; background:none; }
#services-panel pre { margin:0; overflow:auto; background:var(--inset); border:1px solid var(--line); border-radius:8px; padding:10px; font:12px ui-monospace,SFMono-Regular,Menlo,monospace; }
#services-panel .skill-layout-table th { background:var(--paper); color:var(--text); }
#services-panel .skill-layout-table td { border-top-color:var(--line); overflow-wrap:anywhere; }
.workspace-settings { width:min(1180px,100%); margin:0 auto 28px; display:grid; gap:28px; min-width:0; }
.workspace-settings>section { display:grid; gap:16px; min-width:0; }
.workspace-settings>section+section:not(.danger-zone) { border-top:1px solid var(--line); padding-top:28px; }
#workspace-settings-error:empty { display:none; }
.workspace-settings h2,.workspace-settings p { margin:0; }
.workspace-settings label { display:grid; gap:5px; color:var(--text); }
.workspace-summary small { display:block; color:var(--muted); font-size:.8rem; margin-top:3px; overflow-wrap:anywhere; }
.workspace-settings .session-actions { justify-content:flex-start; }
.danger-zone { border:1px solid #9f1239; border-radius:8px; padding:16px; justify-items:start; }
.policy-document { width:100%; min-height:260px; font:12px ui-monospace,SFMono-Regular,Menlo,monospace; background:var(--inset); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:10px; }.inline-form select,.settings-form select { background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; }.provider-card details { margin-top:10px; }
.template-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px; }.template-card { border:1px solid var(--line); border-radius:8px; padding:14px; background:var(--panel); display:flex; flex-direction:column; gap:8px; }.template-card p { color:var(--muted); font-size:.85rem; margin:0; flex:1; }.template-card .inline-form { flex-wrap:nowrap; }.template-card input { min-width:0; flex:1; }
.field-group { border:1px solid var(--edge); border-radius:6px; padding:10px 14px 12px; display:grid; gap:10px; margin:0; min-width:0; }.field-group legend { color:var(--text); font-weight:600; padding:0 6px; }.field-group .system-note { margin:0; }.plugin-heading { margin:4px 0 0; color:var(--text); font-weight:600; }.plugin-list { display:grid; gap:6px; padding-left:12px; border-left:2px solid var(--line); }
.settings-tabs { display:flex; flex-wrap:wrap; gap:4px; max-width:1180px; margin:0 auto 22px; border-bottom:1px solid var(--line); }.settings-tabs a { color:var(--text); text-decoration:none; padding:8px 14px; border-bottom:2px solid transparent; margin-bottom:-1px; }.settings-tabs a:hover { color:var(--accent); }.settings-tabs a.active { color:var(--text); border-bottom-color:var(--accent); }
.connection-card .account-line { margin-bottom:8px; }.status-badge { font-size:.75rem; padding:2px 8px; border-radius:999px; border:1px solid; }.status-badge.ok { color:#bbf7d0; border-color:#166534; background:#052e16; }.status-badge.warn { color:#fde68a; border-color:#92400e; background:#451a03; }.status-badge.off { color:var(--text); border-color:var(--edge); background:var(--paper); }.connection-facts { display:grid; grid-template-columns:max-content 1fr; gap:6px 16px; margin:0 0 10px; }.connection-facts dt { color:var(--muted); }.connection-facts dd { margin:0; }.connection-facts ul { margin:0; padding-left:18px; }
.sessions-page .app-shell { grid-template-columns:var(--sidebar-width,300px) auto minmax(0,1fr); }
.workspace-main { min-width:0; min-height:0; display:flex; flex-direction:column; --terminal-height:260px; }
.workspace-main [hidden] { display:none!important; }
.session-panes { flex:1; min-height:0; display:flex; }
.session-panes>.chat-panel { flex:1; }
.pane-bar { flex:none; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:4px 12px; background:var(--panel); border-bottom:1px solid var(--line); }
.pane-bar strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.8rem; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.pane-bar-actions { display:flex; gap:6px; }
.pane-bar .secondary { font-size:.8rem; padding:3px 10px; }
.pane-bar .icon-button { display:inline-flex; align-items:center; justify-content:center; padding:4px; line-height:0; }
.icon-button svg { display:block; transition:transform .15s ease; }
/* One chevron: it points the way the button moves the pane. */
.terminal-toggle[aria-expanded="false"] svg { transform:rotate(180deg); }
/* A terminal in a tab of its own fills the page. */
.terminal-page>.terminal-panel { flex:1; height:auto; }
.terminal-panel { flex:none; height:var(--terminal-height); min-height:0; display:flex; flex-direction:column; background:var(--inset); }
.terminal-view { flex:1; min-height:0; overflow:hidden; padding:4px 0 0 8px; }
/* Collapsed panels keep their header bar, whose button expands them again. */
.terminal-panel[data-collapsed] { height:auto; }.terminal-panel[data-collapsed] :is(.terminal-view,.terminal-restart) { display:none; }
.pane-bar-actions { flex:none; }
.pane-handle { flex:none; position:relative; touch-action:none; background:var(--line); }
.pane-handle[aria-orientation="vertical"] { width:1px; cursor:col-resize; }
.pane-handle[aria-orientation="horizontal"] { height:1px; cursor:row-resize; }
.pane-handle::after { content:""; position:absolute; z-index:1; inset:0 -3px; }
.pane-handle[aria-orientation="horizontal"]::after { inset:-3px 0; }
.pane-handle:hover::after,.pane-handle:focus-visible::after,.pane-handle.dragging::after { background:var(--accent); }
.pane-handle:focus-visible { outline:none; }
.resizing { user-select:none; }.resizing iframe { pointer-events:none; }
.sessions-page .sidebar { border-right:0; }
.session-item { display:flex; gap:2px; }
.session-item .session-row { flex:1; min-width:0; }
.session-status { float:left; width:8px; height:8px; margin:6px 7px 0 0; border-radius:50%; background:var(--muted); }
.session-item[data-status="running"] .session-status { background:var(--accent); animation:session-pulse 1.4s ease-in-out infinite; }
.session-item[data-status="waiting"] .session-status { background:#22c55e; }
.session-item.attention .session-row { border-color:#f59e0b; }
.session-item.attention .session-row>span { font-weight:700; }
@keyframes session-pulse { 50% { opacity:.35; } }
@media (prefers-reduced-motion:reduce) { .session-status { animation:none!important; } }
.connection-status { flex-shrink:0; max-width:960px; width:100%; margin:0 auto; }
/* Touch: widen the handles' hit areas and show only the line while dragging. */
@media (pointer:coarse) {
  .pane-handle::after { inset:0 -10px; }
  .pane-handle[aria-orientation="horizontal"]::after { inset:-10px 0; }
  .pane-handle:is(:hover,:focus-visible,.dragging)::after { background:transparent; }
  .pane-handle.dragging { background:var(--accent); }
  .split-handle::after { inset:0 -10px; }
  .window-handle::after { inset:0 -10px; }
  @media (max-width:700px), (max-width:1024px) and (orientation:portrait) { .split-handle::after { inset:-10px 0; } }
  :is(.split-handle,.window-handle):is(:hover,:focus-visible,.dragging)::after { background:transparent; }
  :is(.split-handle,.window-handle).dragging { background:var(--accent); }
}
/* Tablets: a narrower default sidebar. A width the user dragged still wins. */
@media (max-width:1180px) {
  .sessions-page .app-shell { grid-template-columns:var(--sidebar-width,240px) auto minmax(0,1fr); }
}
/* Phones: the sidebar is a drawer and one pane is shown at a time. */
.pane-tabs,.drawer-backdrop { display:none; }
@media (max-width:700px) {
  .sessions-page .app-shell { grid-template-columns:minmax(0,1fr); }
  .sessions-page .sidebar { position:fixed; z-index:20; inset:0 auto 0 0; width:min(320px,85vw); min-height:0; border-right:1px solid var(--line); transform:translateX(-100%); visibility:hidden; transition:transform .2s ease,visibility .2s; }
  .sessions-page .app-shell[data-drawer-open] .sidebar { transform:none; visibility:visible; }
  .sessions-page .app-shell[data-drawer-open] .drawer-backdrop { display:block; position:fixed; z-index:19; inset:0; background:rgba(15,23,42,.6); }
  .sessions-page .pane-handle { display:none!important; }
  .pane-tabs { flex:none; display:flex; gap:4px; padding:6px 12px; overflow-x:auto; background:var(--panel); border-bottom:1px solid var(--line); }
  .pane-tab { flex:none; border:0; border-radius:7px; padding:6px 12px; background:transparent; color:var(--text); }
  .pane-tab[aria-pressed="true"],.drawer-toggle { background:var(--wash); color:var(--text); }
  /* A dot on a tab whose pane has something new. */
  .pane-tab[data-attention]::after { content:""; display:inline-block; width:7px; height:7px; margin-left:6px; border-radius:50%; background:#22c55e; vertical-align:middle; }
  .session-panes { flex-direction:column; }
  .terminal-panel { flex:1; height:auto; }
  .workspace-main:not([data-pane="terminal"]) .terminal-panel,
  .workspace-main[data-pane="terminal"] .session-panes { display:none; }
  /* The skills panel is a pane of its own, whose tab appears once a skill
     has put something on screen. Its pane cannot be collapsed. */
  .workspace-main:not(:has(.skill-panel-body :is(.extension-status > *, .skill-view, .extension-note))) .pane-tab[data-pane="skills"] { display:none; }
  .workspace-main:not([data-pane="skills"]) .skill-panel,
  .workspace-main .split-handle,
  .workspace-main[data-pane="skills"] :is(.chat-column,.skill-panel-toggle) { display:none!important; }
  .workspace-main[data-pane="skills"] .skill-panel { flex:1; height:auto; }
  .workspace-main[data-pane="skills"] .skill-panel[data-collapsed]>.skill-panel-body { display:flex; }
  .workspace-main[data-pane="skills"] .skill-panel[data-collapsed] .skill-panel-split { display:inline-flex; }
  .workspace-main[data-pane="skills"] .skill-panel[data-collapsed]>.skill-panel-bar { flex:none; border-bottom:1px solid var(--line); }
}
@media (max-width:700px) and (prefers-reduced-motion:reduce) { .sessions-page .sidebar { transition:none; } }
/* Phones: shared page chrome and forms. */
@media (max-width:700px) {
  .app-header { min-height:52px; padding:6px 12px; gap:6px 12px; }
  .app-header nav,.header-start { gap:4px; }
  .app-header a { padding:6px 8px; font-size:.9rem; }
  .signout { margin-left:4px; }.signout button { padding:6px 10px; font-size:.9rem; }
  /* The logo links to the workspace list, so its text link can go. */
  .page-brand span,.user-name,.header-start>a:not(.page-brand) { display:none; }
  .page-panel { min-height:calc(100dvh - 52px); padding:22px 14px; }
  .chat-panel h1 { overflow-wrap:anywhere; }
  .chat-panel { min-height:60dvh; }
  .imap-account,.control-grid { grid-template-columns:1fr; }
  .workspace-row { flex-direction:column; align-items:flex-start; }
}
.session-panes>.chat-panel { padding-inline:20px; }
.session-panes>.chat-panel>header { flex-wrap:wrap; gap:8px; }
.session-panes .session-actions { flex-wrap:wrap; }
.session-panes .session-actions button { padding:6px 10px; font-size:.85rem; }

.policy-diff { overflow-x:auto; background:var(--inset); border:1px solid var(--edge); border-radius:6px; padding:10px; font:12px ui-monospace,SFMono-Regular,Menlo,monospace; line-height:1.5; }
.policy-diff span { display:block; white-space:pre; }
.policy-diff .diff-added { background:rgba(34,197,94,.18); color:#bbf7d0; }
.policy-diff .diff-removed { background:rgba(239,68,68,.18); color:#fecaca; }
.policy-diff .diff-same { color:var(--muted); }
.environment-label { display:inline-block; padding:1px 7px; border-radius:999px; font-size:.75rem; font-weight:600; border:1px solid var(--edge); color:#fff; }.environment-development { background:#1e3a5f; border-color:#2563eb; }.environment-testing { background:#3f3a12; border-color:#ca8a04; }.environment-staging { background:#3b2152; border-color:#9333ea; }.environment-production { background:#4c1414; border-color:#dc2626; }
.image-versions { margin:8px 0 0; padding-left:20px; color:var(--text); font-size:13px; }.image-versions li { margin:2px 0; }
.summary-link { margin-left:14px; }
/* Admin lists with Add and Edit forms (policies, templates, users): space
   between the Add or Edit line and what it opens, and forms whose fields fill
   their sections up to one readable width. */
:is(#policy-list,#template-list,#user-list) details[open] > summary { margin-bottom:12px; }
:is(#policy-list,#template-list,#user-list) details > .system-note { margin:0 0 12px; max-width:820px; }
:is(#policy-list,#template-list,#user-list) .settings-form { max-width:820px; }
:is(#policy-list,#template-list,#user-list) .settings-form label:not(.check) { max-width:none; }
:is(#policy-list,#template-list,#user-list) .settings-form :is(input:not([type="checkbox"]),select) { width:100%; }
:is(#policy-list,#template-list,#user-list) .settings-form button { justify-self:start; }
:is(#policy-list,#template-list,#user-list) .settings-form > p { margin:0; }
#template-list .settings-form fieldset { border:1px solid var(--edge); border-radius:6px; padding:10px 14px 12px; display:grid; gap:10px; margin:0; min-width:0; }#template-list .settings-form legend { color:var(--text); padding:0 6px; }#template-list .settings-form fieldset .system-note { margin:0; }
:is(#policy-list,#template-list,#user-list) .settings-form .check { max-width:none; align-items:flex-start; }:is(#policy-list,#template-list,#user-list) .settings-form .check input { margin:3px 0 0; flex:none; }
/* My Settings: every form in one 640px column, its buttons at the start
   below it, and the form's own gap as the only spacing. */
#page-content form > p { margin:0; }
#page-content form button { justify-self:start; }
#page-content .session-actions { justify-content:flex-start; }
#page-content .agent-defaults .control-grid { max-width:640px; }
#page-content .agent-defaults .model-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; max-width:640px; margin-top:0; }
#page-content .agent-defaults .model-form input { width:100%; min-width:0; }
#page-content select { background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; }
#page-content .imap-account { background:var(--panel); }
/* Diffs of a turn: a closed entry in the chat, and a modal comparing a file. */
.turn-diffs ul,.turn-files ul { list-style:none; margin:0; padding:8px 12px 10px; border-top:1px solid var(--line); display:flex; flex-direction:column; gap:6px; }
.turn-diffs li,.turn-files li { display:flex; align-items:baseline; gap:10px; min-width:0; }
.diff-file { color:var(--text); text-decoration:none; overflow-wrap:anywhere; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.85rem; }
.diff-file:hover { color:var(--accent); text-decoration:underline; }
.diff-status { font-size:.72rem; text-transform:uppercase; letter-spacing:.03em; color:var(--muted); }
.diff-status.added { color:#4ade80; }
.diff-status.deleted { color:#f87171; }
.diff-status.modified { color:#fbbf24; }
.diff-count { font-size:.78rem; color:var(--muted); }
.diff-added { color:#4ade80; }
.diff-removed { color:#f87171; }
.diff-note { margin:0; padding:8px 12px; color:var(--muted); font-size:.85rem; }
.diff-modal { width:min(1400px,94vw); height:min(86vh,900px); max-width:none; max-height:none; margin:auto; padding:0; border:1px solid var(--edge); border-radius:10px; background:var(--canvas); color:var(--text); overflow:hidden; }
.diff-modal[open] { display:flex; flex-direction:column; }
.diff-modal::backdrop { background:rgba(2,6,23,.65); }
.diff-modal-bar { flex:none; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 12px; border-bottom:1px solid var(--line); background:var(--paper); }
/* The bar's file picker: the shown file's name opens a menu of the turn's
   files below it. */
.diff-picker { position:relative; flex:1; min-width:0; display:flex; align-items:center; gap:10px; white-space:nowrap; }
.diff-picker-toggle { min-width:0; display:inline-flex; align-items:center; gap:6px; padding:4px 8px; border:1px solid transparent; border-radius:6px; background:transparent; color:var(--text); font:inherit; font-weight:600; cursor:pointer; }
.diff-picker-toggle:hover,.diff-picker-toggle[aria-expanded="true"] { border-color:var(--edge); background:var(--canvas); color:var(--accent); }
.diff-picker-name { min-width:0; overflow:hidden; text-overflow:ellipsis; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.85rem; }
.diff-picker-caret { flex:none; color:var(--muted); font-size:.75rem; }
.diff-picker .diff-status,.diff-picker .diff-count { flex:none; }
.diff-picker-place { flex:none; color:var(--muted); font-size:.75rem; }
.diff-picker-menu { position:absolute; top:calc(100% + 6px); left:0; z-index:3; width:min(640px,80vw); max-height:60vh; overflow:auto; display:flex; flex-direction:column; border:1px solid var(--edge); border-radius:8px; background:var(--inset); box-shadow:0 12px 32px rgba(0,0,0,.5); }
.diff-picker-menu[hidden] { display:none; }
.diff-picker-file { display:flex; align-items:baseline; gap:8px; padding:7px 12px; border-bottom:1px solid var(--wash); color:var(--text); text-decoration:none; font-size:.82rem; white-space:normal; }
.diff-picker-file:hover { background:var(--wash); }
.diff-picker-file[aria-current] { background:var(--wash); box-shadow:inset 3px 0 var(--accent); }
.diff-picker-file-name { flex:1; min-width:0; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; overflow-wrap:anywhere; }
.diff-modal-main { flex:1; min-width:0; min-height:0; overflow:auto; }
.diff-table { width:100%; border-collapse:collapse; table-layout:fixed; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.8rem; }
.diff-table col.diff-no { width:48px; }
.diff-table td { vertical-align:top; padding:0 6px; }
.diff-table td.diff-text { border-right:1px solid var(--line); }
.diff-table td.diff-text:last-child { border-right:0; }
.diff-table td.diff-no { text-align:right; color:var(--muted); user-select:none; background:var(--inset); }
.diff-table pre { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; min-height:1.3em; }
.diff-table .diff-del { background:#3b1219; }
.diff-table .diff-add { background:#10321f; }
.diff-table td.diff-no.diff-del { background:#4c1d24; color:#fca5a5; }
.diff-table td.diff-no.diff-add { background:#14532d; color:#86efac; }
.diff-table .diff-empty { background:var(--inset); }
/* Folds are one colour, the bars': the Show bar, the Hide bars, and the rows
   an opened fold shows, with line numbers a shade darker as elsewhere. */
.diff-table { --diff-fold-bg:var(--wash); --diff-fold-no:var(--inset); --diff-fold-hover:var(--wash); --diff-fold-text:var(--accent); }
.diff-table .diff-fold td { padding:0; background:var(--diff-fold-bg); }
.diff-fold-button,.diff-more-button { display:block; width:100%; padding:4px 12px; border:0; border-radius:0; background:transparent; color:var(--diff-fold-text); font:inherit; font-size:.75rem; text-align:center; cursor:pointer; }
.diff-fold-button:hover,.diff-more-button:hover { background:var(--diff-fold-hover); }
.diff-table .diff-folded td.diff-text { background:var(--diff-fold-bg); }
.diff-table .diff-folded td.diff-no { background:var(--diff-fold-no); }
/* Before is red and After green wherever a side is named: the headings of a
   comparison, the labels of a file shown without text, and its cells. */
/* The headings are a shade stronger than the removed and added lines under
   them, and stay at the top while the comparison scrolls. */
.diff-side-head { position:sticky; top:0; z-index:1; padding:5px 12px; text-align:left; font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.03em; box-shadow:inset 0 -1px var(--line); }
.diff-side-head.diff-side-before { background:#5a1a26; color:#fecaca; }
.diff-side-head.diff-side-after { background:#17452a; color:#bbf7d0; }
.diff-side-omitted.diff-side-before { background:#3b1219; color:#fca5a5; }
.diff-side-omitted.diff-side-after { background:#10321f; color:#86efac; }
.diff-count.diff-side-before { color:#f87171; }
.diff-count.diff-side-after { color:#4ade80; }
.diff-table th + th { border-left:1px solid var(--line); }
/* A file shown without text: Before and After, each with a note. */
.diff-sides { width:100%; border-collapse:collapse; table-layout:fixed; font-size:.85rem; }
.diff-sides th + th,.diff-sides td + td { border-left:1px solid var(--line); }
.diff-sides td { padding:14px 12px; }
.diff-side-none { background:var(--inset); color:var(--muted); font-style:italic; }
/* Files the agent wrote (changes/023): the links under a turn's reply and
   the modal that lists and views them. */
.turn-files .file-download { font-size:.78rem; color:var(--accent); text-decoration:none; }
.turn-files .file-download:hover { text-decoration:underline; }
.file-modal-body { flex:1; min-height:0; display:grid; grid-template-columns:minmax(200px,300px) minmax(0,1fr); }
.file-list { overflow:auto; display:flex; flex-direction:column; border-right:1px solid var(--line); background:var(--inset); }
.file-modal-single { grid-template-columns:minmax(0,1fr); }
.file-crumbs { position:sticky; top:0; z-index:1; display:flex; flex-wrap:wrap; align-items:baseline; gap:4px; padding:8px 12px; border-bottom:1px solid var(--line); background:var(--inset); color:var(--text); font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.8rem; overflow-wrap:anywhere; }
.file-crumbs a { color:var(--accent); text-decoration:none; }
.file-crumbs a:hover { text-decoration:underline; }
.file-crumb-sep { color:var(--muted); }
.file-zip { display:block; padding:6px 12px; border-bottom:1px solid var(--wash); color:var(--accent); font-size:.8rem; text-decoration:none; }
.file-zip:hover { background:var(--wash); text-decoration:underline; }
.file-folder .file-item-name { color:var(--text); font-weight:600; }
.file-item { display:flex; flex-direction:column; gap:2px; padding:8px 12px; border-bottom:1px solid var(--wash); color:var(--text); text-decoration:none; font-size:.82rem; }
.file-item:hover { background:var(--wash); }
.file-item[aria-current] { background:var(--wash); box-shadow:inset 3px 0 var(--accent); }
.file-item-name { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; overflow-wrap:anywhere; }
.file-item-meta { color:var(--muted); font-size:.75rem; }
.file-viewer { min-width:0; min-height:0; display:flex; flex-direction:column; }
.file-viewer-bar { flex:none; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 12px; border-bottom:1px solid var(--line); }
.file-viewer-bar>div { min-width:0; display:flex; flex-direction:column; }
.file-viewer-name { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.85rem; overflow-wrap:anywhere; }
.file-viewer-bar small { color:var(--muted); }
.file-viewer-bar .button { flex:none; padding:6px 10px; font-size:.85rem; text-decoration:none; }
.file-tabs { flex:1; display:flex; gap:4px; }
.file-tab { padding:4px 10px; border-radius:6px; color:var(--muted); text-decoration:none; font-size:.85rem; }
.file-tab[aria-current] { background:var(--paper); color:var(--text); }
.file-viewer-body { flex:1; min-height:0; overflow:auto; display:flex; flex-direction:column; }
.file-image,.file-media { flex:1; display:flex; align-items:center; justify-content:center; padding:12px; background:#0b1220; }
.file-image img { max-width:100%; max-height:100%; object-fit:contain; }
.file-media video { max-width:100%; max-height:100%; }
.file-frame { flex:1; width:100%; min-height:0; border:0; }
.file-html { background:#fff; }
.file-text { margin:0; padding:12px; white-space:pre; overflow:auto; font:.8rem/1.45 ui-monospace,SFMono-Regular,Menlo,monospace; }
.file-markdown { padding:12px 20px; overflow-wrap:anywhere; }
.file-table { border-collapse:collapse; font-size:.82rem; }
.file-table th,.file-table td { border:1px solid var(--line); padding:4px 8px; text-align:left; vertical-align:top; }
.file-table th { position:sticky; top:0; background:var(--paper); }
@media (max-width:720px) { .file-modal-body { grid-template-columns:1fr; grid-template-rows:minmax(80px,30%) minmax(0,1fr); } .file-modal-single { grid-template-rows:minmax(0,1fr); } .file-list { border-right:0; border-bottom:1px solid var(--line); } }
.file-toast { position:fixed; left:50%; bottom:24px; transform:translateX(-50%); z-index:10; max-width:min(560px,90vw); box-shadow:0 8px 24px rgba(0,0,0,.45); }

.session-branch { font-size:.85rem; font-weight:normal; color:var(--muted); margin-left:.4em; }
.session-label { display:inline-block; flex:none; padding:0 7px; border:1px solid transparent; border-radius:999px; font-size:.75rem; font-weight:600; line-height:1.5; vertical-align:middle; white-space:nowrap; }
h1 .session-label { margin-left:10px; }
.session-row .session-title { display:flex; align-items:center; gap:6px; }
.session-row small span { display:inline; }
.session-row .session-title > span:first-child { flex:0 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.session-row .session-title > .session-label { display:inline-block; }
.label-form { max-width:480px; }
.label-row { display:flex; gap:10px; align-items:center; }
.label-row input[name="labelName"] { flex:1; }
.workspace-access .label-row input[type="color"] { flex:none; width:48px; height:36px; padding:2px; }
.label-row button { flex:none; }
.label-filter { display:flex; flex-wrap:wrap; gap:6px; padding:0 2px; }
.label-filter-option { position:relative; cursor:pointer; }
.label-filter-option input { position:absolute; opacity:0; pointer-events:none; }
.label-filter-option .session-label { opacity:.55; outline:2px solid transparent; outline-offset:1px; }
.label-filter-option input:checked + .session-label { opacity:1; outline-color:var(--muted); }
.label-filter-option input:focus-visible + .session-label { outline-color:var(--accent); }
.label-filter .session-search { flex:1 1 100%; background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:7px 8px; min-width:0; }
.session-item.open { background:var(--paper); border-radius:7px; }
.session-item.open .session-row,.session-item.open .session-row:hover { border-color:var(--accent); background:transparent; }
.session-item.open .session-row>.session-title>span:first-child { font-weight:700; }
.session-edit { width:min(520px,92vw); padding:20px; border:1px solid var(--edge); border-radius:10px; background:var(--canvas); color:var(--text); }
.session-edit::backdrop { background:rgba(2,6,23,.65); }
.session-edit h2 { margin:0; font-size:1.1rem; }
.session-edit select { background:var(--paper); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; }
.session-edit-error:empty { display:none; }
.session-edit-actions { display:flex; justify-content:flex-end; gap:8px; }
.chat-panel>header .session-actions { align-items:center; gap:8px; }
.chat-panel>header .session-actions :is(button,a) { box-sizing:border-box; display:inline-flex; align-items:center; justify-content:center; height:36px; padding:0 12px; font-size:.9rem; line-height:1; margin:0; }
.chat-panel>header .session-actions a.icon-button { width:36px; padding:0; }
.session-creator { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; color:var(--muted); font-size:.8rem; }
.session-creator button { height:28px; padding:0 10px; font-size:.8rem; line-height:1; }

/* Message actions: a row of icon buttons under each saved message (Copy
   text, Edit, Fork from here, Delete from here), on the message's side of the
   chat, and the in-place editor. */
.message-block { display:flex; flex-direction:column; align-items:flex-start; gap:2px; max-width:90%; }
.message-block.user { align-self:flex-end; align-items:flex-end; }
.message-block>.message { max-width:100%; }
.message-actions { display:flex; gap:2px; opacity:.55; transition:opacity .15s; }
.message-block:hover .message-actions,.message-actions:focus-within { opacity:1; }
@media (hover:none) { .message-actions { opacity:.8; } }
.message-action { display:flex; background:none; border:0; border-radius:6px; padding:5px; color:var(--muted); cursor:pointer; }
.message-action:hover,.message-action:focus-visible { background:var(--wash); color:var(--text); }
.message-action.danger-action:hover,.message-action.danger-action:focus-visible { color:var(--error-text); }
.message-block:has(.message.editing) .message-actions { display:none; }
.message.editing>:not(.message-head,.message-role,.message-edit) { display:none; }
.message-edit { display:grid; gap:8px; }
.message-edit textarea { width:min(640px,70vw); max-width:100%; box-sizing:border-box; background:var(--inset); color:inherit; border:1px solid var(--edge); border-radius:6px; padding:8px; font:inherit; resize:vertical; }
.message-edit-actions { display:flex; justify-content:flex-end; gap:8px; }
.file-toast:not(.ui-error) { background:var(--wash); color:var(--text); padding:10px; border-radius:7px; }
