/* Persistent right sidebar. Uses theme tokens from style.css; no inline styles required. */
:root { --rs-width: 0px; }
.rs-toggle { position:fixed; right:0; top:50%; z-index:900; width:32px; height:48px; padding:0; display:grid; place-items:center; border:1px solid var(--line,#2a3550); border-right:0; border-radius:12px 0 0 12px; background:#2563eb; color:#fff; font-size:22px; line-height:1; cursor:grab; touch-action:none; box-shadow:0 6px 18px #0006; }
.rs-toggle:focus-visible, .rs-tab:focus-visible, .rs-chip:focus-visible, .rs-icon-btn:focus-visible, .rs-grip:focus-visible, .rs-body:focus-visible, .rs-item-link:focus-visible { outline:3px solid #fbbf24; outline-offset:2px; }
.rs-toggle.rs-dragging { cursor:grabbing; opacity:.9; }
.rs-toggle.rs-locked { cursor:pointer; }
.rs-badge { position:absolute; top:-6px; left:-6px; min-width:18px; padding:1px 5px; border-radius:9px; background:#dc2626; color:#fff; font:700 11px/16px system-ui,sans-serif; text-align:center; }
.rs-panel { position:fixed; top:0; right:0; bottom:0; z-index:890; display:flex; flex-direction:column; max-width:100vw; background:var(--panel,#141b2d); color:var(--text,#e7ecf5); border-left:1px solid var(--line,#2a3550); box-shadow:-12px 0 32px #0006; padding-bottom:env(safe-area-inset-bottom); }
.rs-panel[hidden] { display:none; }
.rs-header { display:flex; align-items:center; gap:6px; padding:12px; border-bottom:1px solid var(--line,#2a3550); }
.rs-title-wrap { flex:1; min-width:0; display:grid; gap:4px; }
.rs-title { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rs-working-project { display:inline-flex; align-items:center; gap:6px; width:max-content; max-width:100%; padding:2px 8px; border:1px solid #3d6591; border-radius:999px; background:#173451; color:#b9ddff; font-size:10px; font-weight:700; line-height:16px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rs-working-project:before { flex:none; width:6px; height:6px; border-radius:50%; background:#4ade80; box-shadow:0 0 0 2px #4ade8028; content:""; }
.rs-working-project.is-all-projects:before { background:#93a4bd; box-shadow:none; }
.rs-icon-btn { min-width:44px; min-height:44px; border:0; border-radius:8px; background:transparent; color:inherit; font-size:18px; cursor:pointer; }
.rs-icon-btn:hover:not(:disabled) { background:#ffffff14; }
.rs-icon-btn:disabled { opacity:.4; cursor:not-allowed; }
.rs-tabs { display:flex; gap:4px; padding:8px; overflow-x:auto; scrollbar-width:thin; border-bottom:1px solid var(--line,#2a3550); }
.rs-tab { flex:0 0 auto; min-height:44px; padding:6px 12px; border:1px solid transparent; border-radius:8px; background:transparent; color:var(--muted,#9aa6bd); cursor:pointer; white-space:nowrap; max-width:140px; display:inline-flex; align-items:center; gap:6px; }
.rs-tab-label { overflow:hidden; text-overflow:ellipsis; }
.rs-tab[aria-selected="true"] { background:#1d4ed833; color:var(--text,#e7ecf5); border-color:#3b82f6; }
.rs-body { flex:1; min-height:0; overflow:auto; padding:12px; overscroll-behavior:contain; }
.rs-list { list-style:none; margin:8px 0; padding:0; display:grid; gap:8px; }
.rs-item { border:1px solid var(--line,#2a3550); border-radius:10px; background:#0f1728; min-width:0; }
.rs-item.rs-unread { border-color:#3b82f6; }
.rs-item-link { display:grid; gap:4px; padding:10px 12px; color:inherit; text-decoration:none; min-height:44px; }
.rs-item-title { font-weight:600; overflow-wrap:anywhere; }
.rs-row { display:flex; align-items:center; gap:4px; padding:4px 8px; }
.rs-row .rs-item-title { flex:1 1 auto; min-width:8em; overflow-wrap:break-word; word-break:normal; }
.rs-muted { color:var(--muted,#9aa6bd); font-size:12px; }
.rs-error-text { color:#fca5a5; font-size:12px; overflow-wrap:anywhere; }
.rs-status { justify-self:start; padding:1px 8px; border-radius:999px; font-size:11px; font-weight:700; background:#334155; color:#e2e8f0; }
.rs-job-head { display:flex; align-items:baseline; gap:8px; min-width:0; }
.rs-job-head .rs-item-title { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rs-job-meta { display:flex; align-items:center; gap:6px; color:var(--muted,#9aa6bd); font-size:12px; line-height:1.3; min-width:0; }
.rs-job-meta-text { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rs-job-meta .rs-error-text { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rs-job-meta time { flex:0 0 auto; }
.rs-pill { flex:0 0 auto; padding:0 7px; border-radius:6px; background:#1f2a44; color:#9fb4d8; font-size:10px; font-weight:700; letter-spacing:.03em; text-transform:uppercase; line-height:18px; }
.rs-failed, .rs-sev-error, .rs-sev-critical { background:#7f1d1d; color:#fecaca; }
.rs-started, .rs-running, .rs-retrying { background:#1e3a8a; color:#bfdbfe; }
.rs-succeeded, .rs-sev-success { background:#14532d; color:#bbf7d0; }
.rs-filters { display:flex; flex-wrap:wrap; gap:6px; }
.rs-job-tabs { display:grid; grid-template-columns:1fr 1fr; gap:4px; margin-bottom:10px; padding:3px; border-radius:10px; background:#0f1728; }
.rs-job-tab { min-height:40px; padding:6px 10px; border:1px solid transparent; border-radius:8px; background:transparent; color:var(--muted,#9aa6bd); cursor:pointer; font:inherit; display:flex; align-items:center; justify-content:center; gap:7px; min-width:0; }
.rs-job-tab-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rs-running-count { flex:none; min-width:20px; height:20px; padding:0 6px; border-radius:999px; display:inline-flex; align-items:center; justify-content:center; background:#16a34a; color:#fff; font-size:11px; font-weight:700; line-height:1; }
.rs-running-count[hidden] { display:none; }
.rs-job-tab[aria-selected="true"] { border-color:#3b82f6; background:#1d4ed833; color:var(--text,#e7ecf5); }
.rs-job-tab:focus-visible { outline:3px solid #fbbf24; outline-offset:2px; }
.rs-chip { min-height:36px; padding:4px 12px; border:1px solid var(--line,#2a3550); border-radius:999px; background:transparent; color:inherit; cursor:pointer; }
.rs-context-tabs { display:flex; gap:6px; margin:6px 0; }
.rs-context-tabs .rs-chip[aria-selected="true"] { background:#1d4ed8; border-color:#3b82f6; }
.rs-bindings-section .rs-input { width:100%; box-sizing:border-box; margin-bottom:6px; }
.rs-chip[aria-pressed="true"] { background:#1d4ed8; border-color:#3b82f6; }
.rs-link { display:inline-block; margin-top:8px; color:#93c5fd; }
.rs-dl { display:grid; grid-template-columns:auto 1fr; gap:6px 12px; margin:0; }
.rs-dl dt { color:var(--muted,#9aa6bd); } .rs-dl dd { margin:0; overflow-wrap:anywhere; }
.rs-h2 { margin:0 0 8px; font-size:15px; }
.rs-grip { position:absolute; left:-4px; top:0; bottom:0; width:8px; cursor:col-resize; touch-action:none; }
.rs-edge { display:none; }
.rs-sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
/* Overlay mode: the open panel floats above page content (z-index) and never pushes or reflows it. */
@media (max-width:639px) { html, body { width:100%; max-width:100%; overflow-x:clip; } .rs-toggle { right:0 !important; } .rs-panel { width:100vw !important; max-width:100vw; } .rs-grip { display:none; } .rs-edge { display:block; position:absolute; left:0; top:0; bottom:0; width:24px; z-index:2; touch-action:pan-y; } .rs-panel { padding-top:env(safe-area-inset-top); } }
@media (prefers-reduced-motion:no-preference) { .rs-panel:not([hidden]) { animation:rs-in .16s ease-out; } @keyframes rs-in { from { transform:translateX(24px); opacity:0; } to { transform:none; opacity:1; } } }
@media print { .rs-toggle, .rs-panel { display:none !important; } }
.rs-toggle.rs-covered { display:none; }
.rs-input { width:100%; box-sizing:border-box; min-height:36px; padding:6px 8px; border:1px solid var(--line,#2a3550); border-radius:8px; background:#0f1728; color:inherit; font:inherit; }
.rs-chat-bar, .rs-chat-options { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; min-width:0; }
.rs-chat-subtabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; margin:0 0 10px; padding:3px; border:1px solid var(--line,#2a3550); border-radius:10px; background:#0f1728; }
.rs-chat-subtab { min-height:40px; padding:6px 8px; border:1px solid transparent; border-radius:8px; background:transparent; color:var(--muted,#9aa6bd); cursor:pointer; font:inherit; }
.rs-chat-subtab[aria-selected="true"] { background:#1d4ed833; border-color:#3b82f6; color:var(--text,#e7ecf5); }
.rs-chat-subtab:focus-visible { outline:3px solid #fbbf24; outline-offset:2px; }
.rs-chat-pane { min-height:0; }
.rs-chat-root { display:flex; flex-direction:column; width:100%; height:100%; min-height:0; overflow:hidden; }
.rs-chat-root > .rs-chat-subtabs { flex:0 0 auto; }
.rs-chat-root > .rs-chat-pane { flex:1 1 0; min-height:0; width:100%; overflow:hidden; }
.rs-chat-pane[hidden] { display:none; }
.rs-chat-pane[role="tabpanel"] { height:100%; }
.rs-chat-pane:not(.rs-chat-config-pane) { display:flex; flex-direction:column; }
.rs-chat-pane:not(.rs-chat-config-pane)[hidden] { display:none; }
.rs-chat-sessions-pane { overflow:auto !important; }
.rs-chat-pane .rs-chat-log { flex:1 1 auto; min-height:0; max-height:none; }
.rs-chat-pane .rs-chat-composer { flex:0 0 auto; }
.rs-chat-main-toolbar { display:flex; align-items:center; gap:8px; margin:0 0 8px; min-width:0; }
.rs-chat-content-search { display:flex; align-items:center; flex:1 1 auto; min-width:0; max-width:430px; height:36px; border:1px solid var(--line,#2a3550); border-radius:999px; background:#0f1728; overflow:hidden; }
.rs-chat-content-search .rs-input { flex:1 1 auto; min-width:48px; min-height:34px; padding:5px 9px; border:0; border-radius:0; background:transparent; outline:none; }
.rs-chat-content-search:focus-within { border-color:#3b82f6; box-shadow:0 0 0 1px #3b82f6; }
.rs-chat-search-count { flex:0 0 auto; padding:0 5px; color:var(--muted,#9aa6bd); font-size:11px; white-space:nowrap; }
.rs-chat-search-nav { flex:0 0 30px; align-self:stretch; padding:0; border:0; border-left:1px solid var(--line,#2a3550); background:transparent; color:inherit; cursor:pointer; }
.rs-chat-search-nav:disabled { opacity:.38; cursor:default; }
.rs-chat-search-nav:focus-visible { outline:2px solid #fbbf24; outline-offset:-3px; }
.rs-chat-main-toolbar > .rs-chip { flex:0 0 auto; margin-left:auto; }
.rs-chat-pane.rs-chat-config-pane { overflow:auto; }
.rs-chat-config-card { border:1px solid var(--line,#2a3550); border-radius:10px; padding:8px 10px; }
.rs-chat-config-card > summary { cursor:pointer; font-weight:600; color:var(--text,#e7ecf5); }
.rs-chat-config-card[open] > summary { margin-bottom:8px; }
.rs-chat-bar .rs-chip { display:inline-flex; align-items:center; justify-content:center; gap:5px; white-space:nowrap; }
.rs-chat-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; }
.rs-chat-options .rs-input { min-width:0; width:100%; }
.rs-chat-options .rs-muted { min-width:0; display:flex; align-items:center; gap:5px; min-height:36px; }
.rs-chat-options .rs-chip { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:center; }
.rs-chat-config-help { margin:6px 0 10px; color:var(--muted,#a8b2c5); font-size:12px; line-height:1.45; }
.rs-chat-config-field { display:flex; flex-direction:column; gap:4px; min-width:0; }
.rs-chat-config-label { color:var(--text,#e7ecf5); font-size:12px; font-weight:600; }
.rs-chat-config-hint { color:var(--muted,#a8b2c5); font-size:11px; line-height:1.35; }
.rs-chat-config-toggle { display:flex; align-items:center; gap:6px; min-height:36px; color:var(--text,#e7ecf5); font-size:12px; }
.rs-chat-config-saved { grid-column:1 / -1; padding:8px 10px; border:1px solid var(--line,#2a3550); border-radius:8px; background:rgba(59,130,246,.08); color:var(--muted,#a8b2c5); font-size:12px; line-height:1.4; }
.rs-chat-log { display:grid; align-content:start; align-items:start; gap:8px; max-height:48vh; overflow:auto; padding:4px 0; }
.rs-chat-msg { min-width:0; max-width:92%; box-sizing:border-box; padding:8px 10px; border-radius:10px; border:1px solid var(--line,#2a3550); overflow-wrap:anywhere; word-break:break-word; }
.rs-chat-user { justify-self:end; background:#1d4ed833; border-color:#3b82f6; }
.rs-chat-assistant { justify-self:start; background:#0f1728; }
.rs-chat-error { border-color:#dc2626; }
.rs-chat-body { white-space:pre-wrap; overflow-wrap:anywhere; }
.rs-chat-search-match { padding:0 1px; border-radius:2px; background:#fde68a; color:#172033; }
.rs-chat-search-current { background:#fb923c; box-shadow:0 0 0 2px #fff3; }
.rs-chat-search-match:focus { outline:2px solid #fbbf24; outline-offset:2px; }
.rs-chat-composer { display:grid; gap:6px; margin-top:8px; }
.rs-chat-composer-unified { grid-template-columns:1fr auto; align-items:end; padding:10px; border:1px solid var(--line,#2a3550); border-radius:12px; background:#0f1728; }
.rs-chat-compose-status { grid-column:1 / -1; color:#9fb0ca; font-size:12px; min-height:18px; }
.rs-chat-composer-unified .rs-chat-input { grid-column:1 / -1; min-height:44px; max-height:220px; resize:none; overflow-y:auto; background:transparent; border:0; }
.rs-chat-composer-unified .voice-mic-wrap { grid-column:1 / -1; }
.rs-chat-composer .rs-chat-input {
  width:100%;
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
  border:1px solid var(--line,#2a3550);
  outline:none;
}
.rs-chat-composer .rs-chat-input:focus-visible {
  border-color:#3b82f6;
  outline:2px solid #3b82f6;
  outline-offset:-2px;
}
.rs-chat-settings { margin-top:12px; padding-top:8px; border-top:1px solid var(--line,#2a3550); display:grid; gap:8px; }
.rs-field { display:grid; gap:2px; }
/* Mobile chat: keep composer + Send visible above the on-screen keyboard (panel tracks visualViewport via --rs-vvh). */
@media (max-width:639px) {
  .rs-panel { top:var(--rs-vvtop,0px); bottom:auto; height:var(--rs-vvh,100dvh); }
  .rs-header { padding:6px 12px; } .rs-tabs { padding:4px 8px; } .rs-tab, .rs-icon-btn { min-height:40px; }
  .rs-chat-bar { flex-wrap:wrap; overflow:visible; margin:6px 0; } .rs-chat-bar .rs-chip { flex:1 1 calc(50% - 6px); min-height:36px; min-width:0; }
  .rs-chat-options { margin:6px 0; grid-template-columns:minmax(0,1fr); }
  .rs-chat-log { max-height:none; min-height:80px; }
  .rs-chat-composer { position:sticky; bottom:-12px; z-index:3; margin:8px -12px -12px; padding:8px 12px calc(8px + env(safe-area-inset-bottom)); background:var(--panel,#141b2d); border-top:1px solid var(--line,#2a3550); grid-template-columns:1fr auto; align-items:end; }
  .rs-chat-composer .rs-chat-input { min-height:44px; max-height:30vh; resize:none; font-size:16px; }
  .rs-chat-composer .rs-chat-send { min-height:44px; padding:4px 16px; }
  .rs-chat-main-toolbar { gap:6px; }
  .rs-chat-content-search { max-width:none; }
  .rs-chat-search-nav { flex-basis:28px; }
}

/* Chat: session search, attachments */
.rs-chat-search { margin-bottom:6px; }
.rs-chat-sessions { margin: 0 0 10px; border: 1px solid var(--line,#2a3550); border-radius: 10px; padding: 7px 9px; }
.rs-chat-sessions > summary, .rs-chat-trace > summary { cursor: pointer; color: var(--muted,#9aa8bf); font-size: 12px; user-select: none; }
.rs-chat-sessions[open] { background: rgba(15,23,40,.35); }
.rs-chat-trace { margin: 2px 0 6px; padding: 6px 8px; border-left: 2px solid #58657d; background: rgba(15,23,40,.45); }
.rs-chat-final { white-space: pre-wrap; }
.rs-chat-results { max-height:40vh; overflow:auto; margin:0 0 8px; }
.rs-chat-hit { display:grid; gap:2px; width:100%; text-align:left; background:none; border:0; color:inherit; font:inherit; cursor:pointer; min-height:44px; }
.rs-chat-snippet { overflow-wrap:anywhere; }
.rs-chat-composer { grid-template-columns:1fr auto; align-items:end; }
.rs-chat-composer .rs-chat-input, .rs-chat-tray { grid-column:1 / -1; }
.rs-chat-composer .rs-chat-attach, .rs-chat-composer .rs-chat-send { grid-row:3; min-height:36px; }
.rs-chat-composer .rs-chat-attach { justify-self:start; grid-column:1; }
.rs-chat-composer .rs-chat-send { grid-column:2; }
/* Voice helpers are injected after the textarea. Keep each helper on its own
   full-width row so the transcript/countdown never shares a grid cell with
   the mic controls or gets pushed into the left action column. */
.rs-chat-composer > .voice-partial,
.rs-chat-composer > .voice-convert-preview,
.rs-chat-composer > .voice-mic-wrap { grid-column:1 / -1; width:100%; box-sizing:border-box; }
.rs-chat-composer > .voice-convert-preview { max-width:none; }
.rs-chat-composer > .voice-mic-wrap { justify-self:start; }
.rs-chat-composer .rs-chat-attach,
.rs-chat-composer .rs-chat-send { grid-row:auto; }
.rs-chat-composer.rs-dropping { outline:2px dashed #3b82f6; outline-offset:2px; border-radius:8px; }
.rs-chat-tray { display:flex; flex-wrap:wrap; gap:6px; }
.rs-chat-tray:empty { display:none; }
.rs-chat-pending { display:flex; align-items:center; gap:6px; max-width:100%; padding:4px 6px; border:1px solid var(--line,#2a3550); border-radius:8px; background:#0f1728; font-size:12px; }
.rs-chat-preview { width:44px; height:44px; object-fit:cover; border-radius:6px; flex:0 0 auto; }
.rs-chat-fileicon { font-size:24px; flex:0 0 auto; }
.rs-chat-pname { max-width:12ch; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rs-chat-files { display:flex; flex-wrap:wrap; gap:6px; margin-top:4px; }
.rs-chat-thumb img { display:block; max-width:100%; max-height:180px; border-radius:8px; }
.rs-chat-file { color:inherit; overflow-wrap:anywhere; }
@media (max-width:639px) {
  .rs-chat-composer .rs-chat-input { grid-column:1 / -1; }
  .rs-chat-composer .rs-chat-attach, .rs-chat-composer .rs-chat-send { min-height:44px; }
}
.rs-item.rs-row .rs-item-link { flex:1; min-width:0; }
.rs-item.rs-row .rs-chip { flex:0 0 auto; display:inline-flex; align-items:center; text-decoration:none; font-size:12px; white-space:nowrap; }
.rs-input { width:100%; box-sizing:border-box; min-height:36px; margin-bottom:6px; padding:4px 10px; border:1px solid var(--line,#2a3550); border-radius:8px; background:#0f1728; color:inherit; }

/* Unified composer toolbar: stable vector mic and one row of primary actions. */
.rs-chat-composer-unified { padding:10px; border:1px solid var(--line,#2a3550); border-radius:12px; background:#0f1728; }
.rs-chat-compose-status, .rs-chat-composer-unified > .voice-partial, .rs-chat-composer-unified > .voice-convert-preview { grid-column:1 / -1; }
.rs-chat-compose-status { min-height:18px; font-size:12px; color:#9fb0ca; }
.rs-chat-composer-unified .rs-chat-input { max-height:220px; resize:none; overflow-y:auto; }
.rs-chat-toolbar { grid-column:1 / -1; display:flex; align-items:center; gap:6px; flex-wrap:wrap; border-top:1px solid var(--line,#2a3550); padding-top:8px; }
.rs-chat-toolbar .voice-mic-btn { margin-left:auto; }
.rs-chat-toolbar .voice-mic-btn, .rs-chat-toolbar .rs-chat-send { width:auto; min-width:72px; min-height:44px; height:auto; padding:8px 12px; gap:6px; border-radius:12px; white-space:nowrap; }
.rs-chat-toolbar .voice-mic-btn svg { flex:none; display:block; }
.rs-chat-toolbar .voice-edit-actions { border:0; background:none; padding:0; }
.rs-chat-toolbar .voice-edit-btn, .voice-edit-menu summary { min-width:44px; min-height:44px; box-sizing:border-box; }
.voice-edit-btn:disabled { opacity:.35; cursor:default; }
.voice-edit-menu { position:relative; }
.voice-edit-menu summary { display:grid; place-items:center; cursor:pointer; list-style:none; }
.voice-edit-menu[open] > button { position:absolute; bottom:48px; left:0; z-index:5; width:250px; height:auto; padding:12px; background:#182236; border:1px solid #33415a; color:#fda4af; }
.voice-auto-option { grid-column:1 / -1; font-size:12px; color:#9fb0ca; display:flex; align-items:center; min-height:32px; }
.rs-chat-composer .voice-convert-preview { flex-wrap:wrap; }
.rs-chat-composer .voice-countdown { flex:1 0 100%; height:4px; order:3; }
.rs-chat-composer .voice-convert-cancel { width:auto; height:auto; min-height:44px; padding:6px 10px; border-radius:8px; font-size:12px; }
@media(max-width:380px) { .rs-chat-toolbar { gap:2px; } .rs-chat-toolbar .voice-edit-btn, .voice-edit-menu summary { min-width:44px; } .rs-chat-toolbar .voice-mic-btn { margin-left:auto; } }
