  /* ── Thread header enriched ── */
  .thread-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    position: relative;
    font-size: 14px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .thread-header-top {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .thread-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  .thread-actions button {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
  }
  .thread-actions button:hover { border-color: var(--accent); color: var(--accent); }
  .thread-actions button.danger:hover { border-color: var(--red); color: var(--red); }
  .thread-actions button.loading { opacity: 0.5; pointer-events: none; }

  /* ── Thread tabs ── */
  .thread-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 2px;
    align-self: flex-start;
  }
  .thread-tabs button {
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }
  .thread-tabs button:hover { color: var(--fg); }
  .thread-tabs button.active {
    background: var(--surface);
    color: var(--fg);
    border-color: var(--accent);
  }
  .clear-chat-btn {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    margin-left: 4px;
  }
  .clear-chat-btn:hover { border-color: var(--red); color: var(--red); }

  /* ── Persona panel ── */
  .persona-panel {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--fg);
  }
  .persona-panel .persona-empty {
    color: var(--muted);
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
  }
  .persona-panel pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    margin: 0;
  }
  /* ── Persona frontmatter table ── */
  .persona-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    font-size: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .persona-meta dt {
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 11px;
    padding: 2px 0;
  }
  .persona-meta dd {
    color: var(--text);
    padding: 2px 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
  }
  .persona-fm-details summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    user-select: none;
  }
  .persona-fm-details summary:hover { color: var(--text); }
  .persona-engine-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
  }
  .persona-engine-row label {
    font-weight: 600;
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  .persona-engine-row select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    outline: none;
  }
  .persona-engine-row select:focus { border-color: var(--accent); }
  .persona-yaml {
    font-size: 12px;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    margin-top: 0;
  }
  .persona-body {
    white-space: normal;
    word-wrap: break-word;
    font-family: inherit;
    margin: 0;
    line-height: 1.7;
  }
  .persona-body ul, .persona-body ol { margin: 4px 0; padding-left: 20px; }
  .persona-body li { margin: 2px 0; }
  .persona-cheatsheet {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 11px;
  }
  .persona-cheatsheet summary {
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    user-select: none;
  }
  .persona-cheatsheet summary:hover { color: var(--accent); }
  .persona-cheatsheet-body { padding: 0 10px 10px; }
  .persona-cheatsheet-section { margin-bottom: 8px; }
  .persona-cheatsheet-section strong { font-size: 11px; }
  .persona-cheatsheet-section dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    margin: 4px 0 0;
  }
  .persona-cheatsheet-section dt {
    font-family: 'SFMono-Regular', Consolas, monospace;
    color: var(--accent);
    padding: 1px 0;
  }
  .persona-cheatsheet-section dd {
    color: var(--text-dim);
    padding: 1px 0;
  }
  .persona-cheatsheet-section em { font-style: normal; color: var(--yellow); }

  /* ── Thread search ── */
  .thread-search-btn {
    margin-left: auto;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
  }
  .thread-search-btn:hover { border-color: var(--accent); color: var(--accent); }
  .thread-search-btn.active { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

  .thread-search-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0 0;
    border-top: 1px solid var(--border);
  }
  .thread-search-panel > :first-child {
    display: flex;
    gap: 8px;
  }
  .thread-search-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--fg);
    font-size: 13px;
    outline: none;
  }
  .thread-search-input:focus { border-color: var(--accent); }
  .thread-search-input::placeholder { color: var(--muted); }

  .thread-search-all-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
  }
  .thread-search-all-btn:hover { border-color: var(--accent); color: var(--accent); }
  .thread-search-all-btn.loading { opacity: 0.5; pointer-events: none; }

  .thread-search-results {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .search-result {
    padding: 6px 8px;
    border-radius: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: default;
    font-size: 12px;
  }
  .search-result:hover { border-color: var(--accent); }
  .search-result-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
  }
  .search-result-agent {
    font-weight: 600;
    color: var(--accent);
    font-size: 11px;
  }
  .search-result-time {
    color: var(--muted);
    font-size: 11px;
  }
  .search-result-snippet {
    color: var(--fg);
    line-height: 1.4;
    word-break: break-word;
  }
  mark.search-highlight {
    background: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--fg);
    border-radius: 2px;
    padding: 0 1px;
  }
  .search-empty {
    color: var(--muted);
    font-style: italic;
    text-align: center;
    padding: 12px;
    font-size: 12px;
  }
  .search-result-full {
    margin-top: 6px;
    border-top: 1px solid var(--border);
    padding-top: 6px;
  }
  .search-result-text {
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--fg);
    margin: 0 0 6px;
    max-height: 200px;
    overflow-y: auto;
  }
  .search-copy-btn {
    font-size: 11px;
    padding: 2px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
  }
  .search-copy-btn:hover { border-color: var(--accent); color: var(--accent); }

  /* ── Mobile back button ── */
  .mobile-back {
    display: none;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    margin-right: 4px;
  }
  .mobile-back:hover { border-color: var(--accent); color: var(--accent); }
