.codex-workbench {
  display: grid;
  grid-template-columns: minmax(285px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.codex-workbench .terminal-section { min-width: 0; padding-top: 0; }
.codex-workbench .terminal-heading { min-height: 48px; margin-bottom: 14px; }
.thread-panel {
  position: sticky;
  top: 122px;
  max-height: calc(100vh - 145px);
  min-height: 640px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, #121615, #0c0f0e 70%);
}
.thread-panel-head {
  min-height: 75px;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.thread-panel-head .section-kicker { margin-bottom: 4px; }
.thread-panel-head h3 { margin: 0; font-size: 16px; letter-spacing: -.03em; }
.thread-icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
  color: var(--muted-bright);
  cursor: pointer;
}
.thread-icon-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.05); }
.thread-icon-button:disabled { opacity: .4; cursor: wait; }
.thread-search {
  min-height: 40px;
  margin: 12px 12px 7px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #090c0b;
  color: var(--muted);
}
.thread-search svg { width: 13px; height: 13px; }
.thread-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 9px;
}
.thread-filters { padding: 0 12px 9px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.thread-filters button {
  min-height: 29px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  cursor: pointer;
}
.thread-filters button:hover { color: var(--muted-bright); background: rgba(255,255,255,.03); }
.thread-filters button.active { border-color: rgba(166,244,106,.2); background: var(--accent-soft); color: var(--accent); }
.thread-list {
  min-height: 150px;
  flex: 1 1 auto;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.thread-row {
  width: 100%;
  min-height: 76px;
  padding: 12px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.055);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.thread-row:hover { background: rgba(255,255,255,.025); }
.thread-row.active { background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent); }
.thread-status { width: 6px; height: 6px; margin-top: 4px; border-radius: 50%; background: #5e6762; }
.thread-status.active { background: var(--accent); box-shadow: 0 0 9px rgba(166,244,106,.65); }
.thread-status.idle { background: var(--warning); }
.thread-status.systemError { background: var(--danger); }
.thread-row-copy { min-width: 0; display: grid; gap: 4px; }
.thread-row-copy strong {
  overflow: hidden;
  color: var(--muted-bright);
  font-size: 9px;
  font-weight: 680;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-row.active strong { color: var(--text); }
.thread-row-copy strong svg { width: 9px; height: 9px; color: var(--accent); fill: var(--accent); }
.thread-row-copy small, .thread-row-copy em { color: var(--muted); font-size: 7px; font-style: normal; }
.thread-empty { min-height: 165px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); font-size: 9px; }
.thread-empty svg { width: 18px; height: 18px; color: var(--accent); }
.thread-compose { padding: 13px; display: grid; grid-template-columns: 1fr 90px; gap: 8px; background: rgba(255,255,255,.012); }
.thread-selection { grid-column: 1 / -1; min-width: 0; display: grid; gap: 4px; }
.thread-selection strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.thread-selection small { color: var(--accent); font-size: 7px; }
.thread-selection p {
  display: -webkit-box;
  max-height: 34px;
  margin: 2px 0 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.thread-compose label { min-width: 0; display: grid; gap: 5px; }
.thread-compose label > span { color: var(--muted); font-size: 7px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.thread-compose select,
.thread-compose textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #080b0a;
  color: var(--text);
  font-size: 8px;
}
.thread-compose select { min-height: 34px; padding: 0 8px; }
.thread-compose textarea { grid-column: 1 / -1; min-height: 64px; padding: 9px; resize: vertical; line-height: 1.45; }
.thread-send {
  grid-column: 1 / -1;
  min-height: 37px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #10150d;
  font-size: 9px;
  font-weight: 780;
  cursor: pointer;
}
.thread-send:disabled { opacity: .38; cursor: not-allowed; }

@media (max-width: 1120px) {
  .codex-workbench { grid-template-columns: 1fr; }
  .thread-panel { position: static; min-height: 560px; max-height: 720px; }
}

@media (max-width: 760px) {
  .workbench-section .section-heading { margin-bottom: 14px; }
  .thread-panel { min-height: 540px; max-height: 680px; }
  .thread-compose { grid-template-columns: 1fr; }
  .thread-selection, .thread-compose textarea, .thread-send { grid-column: 1; }
}
