    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    outline: none;
    font-family: inherit;
    max-width: 130px;
  }
  .status-select:focus { border-color: #7dcfff; }
  #user-label, #session-label, #agent-label { display: flex; align-items: center; gap: 4px; color: #565f89; font-size: 11px; }
  .status-btn {
    background: #2a2a4a;
    border: 1px solid #3b4261;
    color: #a9b1d6;
    padding: 2px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    transition: 0.15s;
  }
  .status-btn:hover { background: #3b4261; border-color: #7dcfff; color: #c0caf5; }
  .status-btn:active { background: #565f89; }
  .status-btn.restarting { opacity: 0.5; pointer-events: none; }
#btn-restart.restarting { animation: spin 1s linear infinite; opacity: 0.6; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

  /* Cloud / Local — UI only (no backend routing) */
  #control-host-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
    padding-right: 12px;
    border-right: 1px solid #2a2a4a;
    flex-shrink: 0;
  }
  #control-host-toggle .ch-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #565f89;
    font-weight: 600;
  }
  #control-host-toggle .segment-track {
    display: flex;
    background: #0d0d1a;
    border: 1px solid #2a2a4a;
    border-radius: 7px;
    padding: 2px;
    gap: 0;
  }
  #control-host-toggle .segment-track button {
    border: none;
    background: transparent;
    color: #565f89;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
  }
  #control-host-toggle .segment-track button:hover:not(.active) { color: #a9b1d6; }
  #control-host-toggle .segment-track button.active {
    background: #2a2a4a;
    color: #c0caf5;
  }
  #control-host-toggle .segment-track button:focus-visible {
    outline: 2px solid #7dcfff;
    outline-offset: 1px;
  }

  /* ── Responsive ── */
  @media (max-width: 800px) {
    #app-container { flex-direction: column; }
    #chat-side { width: 100%; min-width: 0; border-left: none; border-top: 1px solid #2a2a4a; flex: 1; min-height: 0; max-height: none; }
    #terminal-side { flex: 1; min-height: 0; }
    body.chat-hidden #chat-side,
    body.chat-hidden #chat-resize-handle { display: none !important; }
    body.chat-visible #terminal-side { display: none !important; }
  }

  /* ── Tab buttons in status bar ── */
  .tab-btn-group {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: 8px;
    padding-right: 12px;
    border-right: 1px solid #2a2a4a;
  }
  .tab-btn-group .tab-btn {
    background: none;
    border: none;
    color: #565f89;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
    border-radius: 4px;
    transition: 0.15s;
    font-weight: 500;
  }
  .tab-btn-group .tab-btn:hover { color: #a9b1d6; background: #1a1a2e; }
  .tab-btn-group .tab-btn.active {
    color: #7dcfff;
    background: #7dcfff15;
  }
  .tab-content { display: none; flex: 1; min-height: 0; }
  .tab-content.active { display: flex; flex-direction: column; }

  /* ── Stream viewer ── */
  #stream-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0d0d1a;
    font-size: 12px;
    min-height: 0;
  }
  #stream-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #2a2a4a;
    align-items: center;
    flex-shrink: 0;
    background: #1a1a2e;
  }
  #stream-filter-panel {
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #2a2a4a transparent;
  }
  #stream-filter-panel-inner {
    line-height: 1.8;
  }
  .str-flt-label:hover { color: #c0caf5 !important; }
  .str-flt-label input { cursor: pointer; }
  #stream-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    font-family: 'Fira Code', Menlo, monospace;
    font-size: 12px;
    line-height: 1.5;
  }
  .str-entry {
    margin-bottom: 6px;
    animation: str-fadein 0.3s ease;
  }
  .str-entry.str-hidden { display: none; }

  /* ── Input button ── */
  .str-input-section {
    background: #0d0d1a;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    margin: 6px 0;
    padding: 8px;
    max-height: 300px;
    overflow: auto;
  }
  .str-input-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Fira Code', Menlo, monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #a9b1d6;
  }

  /* ── Collapsible JSON tree ── */
  .json-root {
    font-family: 'Fira Code', Menlo, monospace;
    font-size: 11px;
    line-height: 1.6;
  }
  .json-line {
    padding-left: 12px;
  }
  .json-block {
    cursor: default;
  }
  .json-block.json-collapsed > .json-children { display: none; }
  .json-block.json-collapsed > .json-punc:first-of-type::after { content: ' ... '; color: #565f89; font-style: italic; }
  .json-toggle {
    cursor: pointer;
    color: #565f89;
    font-size: 9px;
    margin-right: 2px;
    user-select: none;
  }
  .json-toggle:hover { color: #7dcfff; }
  .json-punc { color: #565f89; }
  .json-key { color: #7dcfff; }
  .json-str { color: #9ece6a; }
  .json-num { color: #e0af68; }
  .json-bool { color: #bb9af7; }
  .json-null { color: #565f89; font-style: italic; }

  /* ── Markdown-rendered content fields ── */
  .json-content-md {
    display: inline-block;
    vertical-align: top;
    padding: 8px 12px;
    margin: 2px 0 2px 8px;
    background: #0d0d1a;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    line-height: 1.6;
    color: #c0caf5;
    max-width: 100%;
    overflow-x: auto;
    min-width: 120px;
  }
  .json-content-md h1 { font-size: 16px; font-weight: 700; color: #7dcfff; margin: 8px 0 4px; }
  .json-content-md h2 { font-size: 14px; font-weight: 700; color: #89ddff; margin: 6px 0 3px; }
  .json-content-md h3 { font-size: 13px; font-weight: 600; color: #c0caf5; margin: 5px 0 2px; }
  .json-content-md h4,
  .json-content-md h5,
  .json-content-md h6 { font-size: 12px; font-weight: 600; color: #a9b1d6; margin: 4px 0 2px; }
  .json-content-md p { margin: 4px 0; }
  .json-content-md pre {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    padding: 8px 10px;
    margin: 4px 0;
    overflow-x: auto;
    max-width: 100%;
  }
  .json-content-md code {
    font-family: 'Fira Code', Menlo, monospace;
    font-size: 11px;
    background: #1a1a2e;
    padding: 1px 4px;
    border-radius: 3px;
    color: #e0af68;
  }
  .json-content-md pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: #c0caf5;
    white-space: pre-wrap;
    word-break: break-word;
  }
  .json-content-md ul,
  .json-content-md ol {
    margin: 4px 0;
    padding-left: 20px;
  }
  .json-content-md li { margin: 2px 0; }
  .json-content-md strong { color: #c0caf5; font-weight: 700; }
  .json-content-md em { font-style: italic; color: #a9b1d6; }
  .json-content-md a { color: #7dcfff; text-decoration: underline; }
  .json-content-md a:hover { color: #89ddff; }
  .json-content-md br { content: ''; display: block; margin: 0; }
  .json-content-md h1:first-child,
  .json-content-md h2:first-child,
  .json-content-md h3:first-child,
  .json-content-md p:first-child { margin-top: 0; }
  .json-content-md :last-child { margin-bottom: 0; }
  .db-cell-json {
    overflow: auto;
    max-height: 200px;
    padding: 4px;
  }
  .str-input-btn {
    background: none;
    border: none;
    color: #3b4261;
    cursor: pointer;
    font-size: 11px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
    font-family: inherit;
  }
  .str-input-btn:hover { color: #7dcfff; }

  /* ── Collapse buttons ── */
  .str-coll-btn, .str-coll-all-btn {
    background: none;
    border: none;
    color: #3b4261;
    cursor: pointer;
    font-size: 10px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
    font-family: inherit;
  }
  .str-coll-btn:hover, .str-coll-all-btn:hover { color: #7dcfff; }
  .str-collapsed .str-coll-btn { color: #7dcfff; }
  .str-collapsed .str-body { display: none; }

  /* ── User & Assistant: bubble style like chat ── */
  .str-entry[data-role="user"],
  .str-entry[data-role="assistant"] {
    padding: 8px 12px;
    border-radius: 10px;
    max-width: 90%;
    word-wrap: break-word;
  }
  .str-entry[data-role="user"] {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    color: #a9b1d6;
    margin-left: auto;
    border-bottom-right-radius: 4px;
  }
  .str-entry[data-role="assistant"] {
    background: #7dcfff10;
    border: 1px solid #7dcfff25;
    color: #c0caf5;
    margin-right: auto;
    border-bottom-left-radius: 4px;
  }
  .str-entry[data-role="user"] .str-body { color: #a9b1d6; }
  .str-entry[data-role="assistant"] .str-body { color: #c0caf5; }

  /* ── Tool: no bubble, plain on stage ── */
  .str-entry[data-role="tool"] {
    background: transparent;
    border: none;
    padding: 2px 0;
    color: #a9b1d6;
    margin-right: auto;
    font-size: 12px;
    line-height: 1.5;
  }
  .str-entry[data-role="tool"] .str-body {
    color: #a9b1d6;
    max-height: none;
  }

  @keyframes str-fadein {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ── Header inside user/assistant bubbles ── */
  .str-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 11px;
  }
  .str-role {
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .str-entry[data-role="user"] .str-role { color: #7dcfff; }
  .str-entry[data-role="assistant"] .str-role { color: #9ece6a; }
  .str-time {
    color: #565f89;
    font-size: 10px;
  }
  .str-tool {
    color: #e0af68;
    font-size: 10px;
    margin-left: 4px;
  }
  .str-session {
    color: #3b4261;
    font-size: 10px;
    margin-left: auto;
  }
  .str-body {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.5;
  }
  .str-entry[data-role="tool"] .str-body {
    color: #888;
    font-family: 'Fira Code', Menlo, monospace;
    font-size: 11px;
  }
  .str-entry[data-role="tool"] .str-header {
    opacity: 0.6;
  }

  /* ── Database viewer ── */
  #db-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-0);
    font-size: 12px;
    min-height: 0;
  }
  #db-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    flex-shrink: 0;
  }
  #db-toolbar select {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--fg-1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    font-family: inherit;
  }
  #db-toolbar select:focus { border-color: var(--accent); }
  #db-refresh {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--fg-1);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
  }
  #db-refresh:hover { border-color: var(--accent); color: var(--accent); }
  #db-panel {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
  }
  #db-table-list {
    width: 180px;
    min-width: 140px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 4px 0;
    flex-shrink: 0;
  }
  .db-table-item {
    padding: 6px 14px;
    cursor: pointer;
    color: var(--fg-2);
    display: flex;
    justify-content: space-between;
    font-size: 12px;
  }
  .db-table-item:hover { background: var(--bg-elev); }
  .db-table-item.active { background: var(--accent-soft); color: var(--accent); }
  .db-table-item .count {
    color: var(--fg-3);
    font-size: 11px;
  }
  .db-table-reset-btn {
    background: none;
    border: none;
    color: var(--fg-3);
    cursor: pointer;
    font-size: 10px;
    padding: 0 4px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
  }
  .db-table-item:hover .db-table-reset-btn {
    opacity: 1;
  }
  .db-table-reset-btn:hover {
    color: var(--danger);
  }
  #db-table-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
  }
  #db-table-header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--fg-3);
    font-size: 11px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 42px;
    box-sizing: border-box;
  }
  #db-table-data {
    flex: 1;
    overflow: auto;
    padding: 0;
  }
  .db-hint {
    color: var(--fg-3);
    text-align: center;
    padding: 40px 20px;
    font-size: 13px;
  }
  .db-table {
    min-width: 100%;
    width: auto;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 12px;
    font-family: 'Fira Code', Menlo, monospace;
  }
  .db-table th {
    background: var(--bg-elev);
    color: var(--accent);
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
  }
