:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-strong: #eef3f1;
  --line: #d8dee4;
  --text: #1f2933;
  --muted: #687382;
  --teal: #147a73;
  --teal-dark: #0d5f59;
  --amber: #b7791f;
  --green: #2f855a;
  --red: #c24132;
  --ink: #111827;
  --shadow: 0 18px 40px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

body.preview-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
}

.status-dot.ok {
  background: #65d4c8;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.executor-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.executor-picker span {
  font-size: 12px;
  color: var(--muted);
}

.executor-picker select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
}

.form-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-actions {
  margin-top: 10px;
}

.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

.button.primary {
  background: var(--teal);
  color: #fff;
}

.button.primary:hover {
  background: var(--teal-dark);
}

.button.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.button.ghost {
  background: transparent;
  color: var(--teal-dark);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric,
.config-band,
.bug-list-panel,
.bug-detail-panel,
.run-list-panel,
.task-band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 82px;
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 26px;
}

.config-band {
  margin-bottom: 16px;
  padding: 18px;
}

.config-form {
  display: grid;
  gap: 16px;
}

.form-heading,
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.form-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: inline-flex;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.segment {
  min-width: 78px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segment.active {
  background: var(--surface);
  color: var(--teal-dark);
  box-shadow: 0 1px 4px rgba(31, 41, 51, 0.12);
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-field {
  min-height: 63px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding-top: 22px;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 18px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
}

input,
select {
  min-height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 84px;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(20, 122, 115, 0.22);
  border-color: var(--teal);
}

.combo-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 0.7fr);
  gap: 8px;
}

.wide-field {
  grid-column: span 2;
}

.assignment-add-grid {
  grid-template-columns: minmax(160px, 0.6fr) minmax(160px, 0.6fr) minmax(260px, 1.8fr);
}

.assignment-people-list {
  display: grid;
  gap: 12px;
}

.assignment-person {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.assignment-person-fields {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(140px, 0.5fr) minmax(140px, 0.5fr) minmax(260px, 1.8fr);
  gap: 12px;
}

.assignment-person-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 22px;
}

.button.danger {
  color: var(--red);
}

.credential-state {
  color: var(--muted);
  font-size: 13px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(420px, 1.35fr);
  gap: 16px;
  align-items: start;
}

.bug-list-panel,
.bug-detail-panel,
.run-list-panel,
.task-band {
  min-width: 0;
  padding: 16px;
}

.panel-title {
  margin-bottom: 12px;
}

.compact-title {
  margin-top: 16px;
}

.panel-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.bug-list {
  display: grid;
  gap: 14px;
}

.bug-status-group {
  display: grid;
  gap: 8px;
}

.bug-status-heading {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bug-status-heading strong {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--teal-dark);
  font-size: 12px;
}

.bug-status-items {
  display: grid;
  gap: 10px;
}

.bug-item {
  width: 100%;
  min-height: 112px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.bug-item:hover,
.bug-item.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(20, 122, 115, 0.12);
}

.bug-code {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
}

.bug-title {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tag-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  min-height: 24px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef3f1;
  color: #40515b;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.tag.high,
.tag.s2 {
  background: #fff1e6;
  color: #9a4d0b;
}

.tag.validated,
.tag.reviewed,
.tag.closed {
  background: #e6f5ee;
  color: var(--green);
}

.tag.review,
.tag.needs-review,
.tag.awaiting-review {
  background: #fff1e6;
  color: var(--amber);
}

.tag.ready {
  background: #edf2f7;
  color: #4a5568;
}

.tag.running,
.tag.reviewing {
  background: #e7f5ff;
  color: #1668a6;
}

.tag.validating {
  background: #e7f5ff;
  color: #1668a6;
}

.tag.stopping,
.tag.stopped {
  background: #edf2f7;
  color: #4a5568;
}

.tag.pending,
.tag.skipped {
  background: #edf2f7;
  color: #4a5568;
}

.tag.assignment {
  background: #e8f4f2;
  color: var(--green);
}

.tag.assignment-pending {
  background: #e7f5ff;
  color: #1668a6;
}

.tag.blocked,
.tag.attention {
  background: #fff1e6;
  color: var(--amber);
}

.tag.status-pending {
  background: #fff1e6;
  color: #9a4d0b;
}

.tag.status-processing {
  background: #e7f5ff;
  color: #1668a6;
}

.tag.status-resolved {
  background: #e6f5ee;
  color: var(--green);
}

.tag.status-other {
  background: #edf2f7;
  color: #4a5568;
}

.bug-detail {
  display: grid;
  gap: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-heading {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-heading strong {
  color: var(--ink);
  font-size: 19px;
  line-height: 1.35;
}

.detail-section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-section p,
.detail-section li {
  color: var(--text);
  line-height: 1.6;
}

.description-content {
  min-width: 0;
  color: var(--text);
  line-height: 1.6;
}

.description-content p,
.description-content div,
.description-content ul,
.description-content ol,
.description-content pre {
  margin: 0 0 10px;
}

.description-content > :last-child {
  margin-bottom: 0;
}

.description-content a:not(.description-image-link) {
  color: var(--teal-dark);
  overflow-wrap: anywhere;
}

.description-image-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0;
}

.description-image {
  display: block;
  max-width: 100%;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fa;
  object-fit: contain;
  cursor: zoom-in;
}

.muted-text {
  color: var(--muted) !important;
}

.error-text {
  color: var(--red) !important;
}

.attachment-list {
  display: grid;
  gap: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.attachment-main {
  min-width: 0;
}

.attachment-name {
  display: block;
  max-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-align: left;
  text-decoration: none;
}

.attachment-preview-trigger {
  cursor: zoom-in;
}

.attachment-name:hover {
  text-decoration: underline;
}

.attachment-main span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.attachment-download {
  flex: 0 0 auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.attachment-download:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.attachment-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.78);
}

.attachment-preview-modal[hidden] {
  display: none;
}

.attachment-preview-dialog {
  width: min(1120px, 100%);
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.attachment-preview-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.attachment-preview-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.attachment-preview-stage {
  position: relative;
  min-height: min(68vh, 640px);
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background: #eef1f3;
}

.attachment-preview-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
}

.attachment-preview-stage p {
  position: absolute;
  margin: 0;
  color: var(--muted);
}

.attachment-preview-stage img:not([src]) {
  display: none;
}

.detail-section ol {
  margin: 0;
  padding-left: 20px;
}

.task-band {
  margin-top: 16px;
}

pre {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: #26323a;
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.inline-pre {
  min-height: 120px;
  max-height: 300px;
}

.review-rounds {
  display: grid;
  gap: 10px;
}

.review-round {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.review-round strong {
  color: var(--ink);
  font-size: 13px;
}

.review-round ul {
  margin: 0;
  padding-left: 18px;
}

.empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.compact-empty {
  min-height: 92px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17212b;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .workbench {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .form-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .metric-grid,
  .fields-grid,
  .workbench {
    grid-template-columns: 1fr;
  }

  .wide-field,
  .assignment-person .wide-field {
    grid-column: auto;
  }

  .assignment-add-grid,
  .assignment-person,
  .assignment-person-fields,
  .combo-field {
    grid-template-columns: 1fr;
  }

  .assignment-person-actions {
    padding-top: 0;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 22px;
  }

  .form-actions {
    align-items: stretch;
  }

  .button,
  .form-actions .button {
    width: 100%;
  }
}

/* Keep hidden views excluded even when components define their own display. */
[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(40px, 7vh, 80px) 24px 24px;
  background: #fff;
}

.login-card {
  width: min(360px, 100%);
  text-align: center;
  color: var(--muted);
}

.member-list {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.member-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.member-card .fields-grid {
  margin-top: 14px;
}

.member-card p {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

.role-table {
  width: 100%;
  margin: 16px 0 28px;
  border-collapse: collapse;
}

.role-table th,
.role-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table-scroll {
  overflow-x: auto;
}

body[data-can-execute="false"] :is(#syncNow, #assignAll, [data-assignment-recommend], [data-assignment-apply]),
body[data-can-configure="false"] :is([data-nav="config"], #toggleScheduler),
body[data-can-manage-people="false"] :is(#assignmentPeopleForm, [data-save-person], [data-delete-person]),
body[data-can-manage-members="false"] [data-nav="members"] {
  display: none !important;
}

/* History-specific browsing and conversation layout. */

.history-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: calc(100dvh - 72px); min-width: 0; }
.history-browser { min-width: 0; padding: 20px 12px; border-right: 1px solid #eee; height: calc(100dvh - 72px); overflow: auto; }
.history-filters { display: grid; gap: 12px; padding: 0 6px; }
.history-filters label { display: grid; min-width: 0; gap: 7px; font-size: 11px; color: #777; }
.history-filters input, .history-filters select { width: 100%; min-width: 0; border: 1px solid #e5e5e5; border-radius: 8px; background: #fafafa; padding: 9px; font-size: 12px; color: #444; }
.history-selects { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 8px; }
.history-page .button { background: white; color: #444; border: 1px solid #e4e4e4; border-radius: 8px; box-shadow: none; font-size: 12px; min-height: 32px; padding: 7px 10px; }
.history-page .button:hover { background: #f5f5f5; }
.history-page .button:disabled { opacity: .4; }
#historyStatus, .history-browser > p[role] { color: #888; font-size: 11px; line-height: 1.7; padding: 6px; }
.history-list { display: grid; gap: 4px; min-width: 0; }
@media (min-width: 761px) {
  .history-browser { display: flex; flex-direction: column; overflow: hidden; }
  .history-browser > :not(.history-list) { flex-shrink: 0; }
  .history-list { align-content: start; min-height: 80px; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
}
.history-card { display: grid; gap: 6px; width: 100%; padding: 13px 12px; border: 0; border-radius: 9px; color: #333; background: transparent; cursor: pointer; text-align: left; min-width: 0; }
.history-card:hover { background: #f7f7f7; }
.history-card[aria-pressed="true"] { background: #efefef; }
.history-card strong { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.history-card > span { font-size: 11px; color: #898989; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-card:focus-visible { outline: 2px solid #555; outline-offset: 1px; }
.history-meta { color: #858585; font-size: 12px; overflow-wrap: anywhere; }
.history-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 6px; font-size: 11px; color: #888; }
.history-pagination > span { flex: 0 0 auto; white-space: nowrap; }
.history-pagination > .button { width: auto; flex: 0 0 auto; min-width: 34px; }
.history-source-details { font-size: 11px; color: #8b8b8b; margin: 18px 6px; }
.history-source-details summary { cursor: pointer; }
.history-detail { min-width: 0; height: calc(100dvh - 72px); overflow-y: auto; background: white; overflow-wrap: anywhere; }
.history-empty { display: grid; justify-items: center; align-content: center; min-height: 65vh; gap: 10px; color: #999; text-align: center; }
.history-empty > span { font-size: 40px; color: #b0b0b0; }
.history-empty h2 { font-size: 20px; font-weight: 500; color: #555; margin: 10px 0 0; }
.history-empty p { font-size: 13px; }
.history-chat-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 30px; border-bottom: 1px solid #f1f1f1; }
.history-chat-header h2 { font-size: 15px; line-height: 1.5; font-weight: 600; margin: 0 0 4px; }
.history-chat-header span { color: #929292; font-size: 11px; }
.history-readonly { flex-shrink: 0; border: 1px solid #e8e8e8; border-radius: 6px; padding: 4px 8px; }
.history-chat-content { max-width: 850px; margin: 0 auto; padding: 30px 40px 60px; }
.history-session-info { color: #858585; font-size: 12px; margin-bottom: 12px; }
.history-session-info > summary { display: flex; align-items: center; gap: 8px; width: fit-content; cursor: pointer; list-style: none; padding: 4px 0; }
.history-session-info > summary::-webkit-details-marker, .history-work > summary::-webkit-details-marker { display: none; }
.history-session-info > summary span { font-size: 17px; transition: transform .15s; }
.history-session-info[open] > summary span { transform: rotate(90deg); }
.history-info { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; font-size: 12px; line-height: 1.6; padding-top: 12px; }
.history-info dd { margin: 0; color: #666; }
.history-record-status { color: #858585; font-size: 12px; line-height: 1.7; margin: 0 0 24px; }
.history-record-status > summary { width: fit-content; max-width: 100%; cursor: pointer; padding: 4px 0; }
.history-record-status > p { max-width: 64ch; margin: 8px 0 0; }
.history-legacy-excerpt { margin: 20px 0; color: #858585; font-size: 13px; }
.history-legacy-excerpt > summary { cursor: pointer; width: fit-content; }
.history-session-info > summary:focus-visible, .history-record-status > summary:focus-visible, .history-work summary:focus-visible { outline: 2px solid #3478eb; outline-offset: 4px; border-radius: 4px; }
.history-messages { display: grid; gap: 32px; margin-top: 24px; }
/* Keep absolute screen-reader labels inside the message's scroll container. */
.history-message { position: relative; min-width: 0; font-size: 16px; line-height: 1.8; color: #242628; }
.history-message.user { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.history-message.user > div { background: #e8f3ff; border-radius: 22px; padding: 12px 18px; max-width: 88%; min-width: 0; white-space: pre-wrap; color: #203950; }
.history-message.assistant { background: transparent; padding: 0; }
.history-message-body, .history-markdown { min-width: 0; overflow-wrap: anywhere; }
.history-message-time { display: block; width: fit-content; margin-top: 10px; color: #929292; font-size: 12px; font-weight: 400; line-height: 1.5; }
.history-message.user > .history-message-time { margin-top: 0; padding-right: 3px; }
.history-markdown p { margin: 0 0 20px; }
.history-markdown p:last-child { margin-bottom: 0; }
.history-markdown ul, .history-markdown ol { padding-left: 26px; margin: 12px 0 20px; }
.history-markdown li { margin: 6px 0; }
.history-markdown h3, .history-markdown h4, .history-markdown h5, .history-markdown h6 { margin: 20px 0 12px; font-size: 17px; line-height: 1.6; }
.history-markdown a { color: #3c6091; text-decoration: none; }
.history-markdown a:hover { text-decoration: underline; }
.history-markdown code { background: #efefef; border-radius: 6px; padding: 2px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.history-markdown hr { height: 0; border: 0; border-top: 1px solid #e8e8e8; margin: 24px 0; }
.history-table { max-width: 100%; overflow-x: auto; margin: 22px 0; }
.history-table table { width: 100%; border-collapse: collapse; font-size: inherit; line-height: 1.7; }
.history-table th, .history-table td { padding: 12px 16px 12px 0; text-align: left; vertical-align: top; border-bottom: 1px solid #e8e8e8; min-width: 90px; }
.history-table th { font-weight: 600; border-bottom-color: #d9d9d9; }
.history-table tbody tr:last-child td { border-bottom: 0; }
.history-table .history-table-align-center { text-align: center; }
.history-table .history-table-align-right { text-align: right; }
.history-code { max-width: 100%; border: 1px solid #e7e7e7; border-radius: 12px; overflow: hidden; margin: 20px 0; }
.history-code > span { display: block; font-size: 11px; color: #888; background: #f7f7f7; padding: 8px 14px; }
.history-code pre, .history-tool pre { min-height: 0; max-height: 450px; max-width: 100%; overflow: auto; margin: 0; border: 0; padding: 14px; border-radius: 0; color: #373737; background: #fafafa; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-code pre code { padding: 0; background: none; }
.history-work { min-width: 0; color: #808080; }
.history-work > summary { display: flex; align-items: center; gap: 9px; width: fit-content; max-width: 100%; padding: 4px 0; cursor: pointer; list-style: none; background: transparent; }
.history-work-icon { display: grid; flex: 0 0 auto; place-items: center; height: 20px; width: 20px; color: #888; font-size: 17px; }
.history-work-icon svg { display: block; width: 20px; height: 20px; }
.history-work strong { font-size: 14px; font-weight: 400; }
.history-work small { display: block; color: #888; margin-top: 4px; font-size: 12px; }
.history-chevron { margin-left: 3px; color: #999; font-size: 20px; line-height: 1; transition: transform .15s; }
.history-work[open] .history-chevron { transform: rotate(90deg); }
.history-work-body { margin: 12px 0 0 9px; padding-left: 18px; border-left: 1px solid #e6e6e6; }
.history-work-commentary { color: #777; font-size: 14px; line-height: 1.8; margin: 16px 0; }
.history-work-commentary:first-child { margin-top: 0; }
.history-tool { min-width: 0; border-bottom: 1px solid #eee; }
.history-tool:last-child { border-bottom: 0; }
.history-tool summary { cursor: pointer; padding: 10px 0; font-size: 12px; overflow-wrap: anywhere; }
.history-tool summary > span { color: #aaa; margin-left: 10px; font-size: 10px; }
.history-chat-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 11px; color: #a0a0a0; margin-top: 36px; }
.history-warning { color: #9b6b28; font-size: 12px; }
.history-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 1100px) {
  .history-layout { grid-template-columns: 250px minmax(0, 1fr); }
  .history-chat-content { padding: 24px; }
}
@media (max-width: 760px) {
  .history-layout { grid-template-columns: minmax(0, 1fr); }
  .history-browser { height: auto; max-height: 460px; border-bottom: 1px solid #eee; }
  .history-detail { height: auto; min-height: 450px; }
  .history-chat-header { padding: 20px; }
}
.history-images { display: grid; gap: 12px; margin-top: 12px; white-space: normal; }
.history-images figure { margin: 0; }
.history-images img { display: block; max-width: 100%; width: auto; height: auto; max-height: 650px; object-fit: contain; border: 1px solid #e5e5e5; border-radius: 10px; background: #fff; }
.history-images figcaption { font-size: 11px; color: #999; margin-top: 5px; }
.history-image-unavailable { font-size: 12px; color: #999; }

/* Task-first workspace, sharing the existing BugFlow palette. */

.task-center { line-height: 1.6; }
.task-center h2 { margin: 0; font-size: 20px; }
.task-center h3 { font-size: 15px; margin: 16px 0 8px; }
.tc-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }

.tc-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tc-actions .button { font-size: 14px; }
#tc-common-directories { margin-top: -6px; }
#tc-common-directories .tc-actions { align-items: stretch; }
#tc-common-directories .button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
#tc-common-directories details { margin-top: 10px; }
#tc-common-directories details .tc-actions { margin-top: 10px; }
.tc-picker-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.tc-picker-row input[readonly] { background: #f8fafb; color: var(--ink); }
.tc-nav, .tc-tabs { display: flex; gap: 22px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tc-nav { margin-bottom: 24px; }
.tc-nav button, .tc-nav a, .tc-tabs button { border: 0; background: transparent; padding: 12px 0; color: var(--muted); cursor: pointer; font-size: 14px; text-decoration: none; }
.tc-nav button[aria-pressed="true"], .tc-nav a[aria-current="page"], .tc-tabs button[aria-pressed="true"] { color: var(--teal-dark); box-shadow: inset 0 -2px var(--teal); }
.tc-nav span { margin-left: 8px; font-size: 12px; }
.tc-create { width: min(100%, 800px); margin: 0 auto; display: flex; flex-direction: column; min-height: 440px; height: min(680px, 70dvh); }
.tc-create-log { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 4px; }
.tc-create-log .tc-empty { padding-top: 60px; }
.tc-create-message { margin: 20px 0 12px auto; width: fit-content; max-width: 90%; background: #edf6f4; padding: 14px 18px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tc-create-reply { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0 20px; }
.tc-composer { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.tc-composer:focus-within { border-color: var(--teal); box-shadow: 0 0 0 2px #edf6f4; }
.tc-inbox .tc-composer { margin-top: 12px; }
.tc-inbox .tc-composer label { display: block; margin-bottom: 12px; font-size: 14px; }
.tc-inbox .tc-composer select { display: block; width: min(100%, 440px); margin-top: 6px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.tc-composer textarea { display: block; width: 100%; min-height: 104px; max-height: 260px; resize: vertical; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; line-height: 1.6; }
.tc-composer footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.tc-composer .tc-form-error { margin-bottom: 0; }
.tc-create-settings { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(150px, .8fr) minmax(140px, .65fr); gap: 10px; align-items: end; margin-top: 8px; }
.tc-create-setting { min-width: 0; color: var(--muted); font-size: 12px; }
.tc-create-setting select { display: block; width: 100%; min-width: 0; margin-top: 5px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; }
.tc-create-directory { display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 10px; }
.tc-create-directory input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--muted); font-size: 13px; }
.tc-create-directory .button { flex: 0 0 auto; padding: 7px 10px; font-size: 13px; }
.tc-create-hint { margin: 7px 0 0; font-size: 12px; color: var(--muted); }
.tc-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.tc-list { padding: 18px 12px; border-right: 1px solid var(--line); min-width: 0; }
.tc-list h3 { margin: 6px 10px 12px; color: var(--muted); font-size: 14px; }
.tc-list h3 span { margin-left: 8px; }
.tc-task { width: 100%; display: grid; gap: 6px; text-align: left; padding: 14px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; color: var(--text); margin-bottom: 8px; overflow-wrap: anywhere; }
.tc-task:hover { background: var(--bg); }
.tc-task[aria-pressed="true"] { background: #edf6f4; border-color: #bbd9d3; }
.tc-task strong { font-size: 15px; }
.tc-task span { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-task small, .tc-meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tc-detail { padding: 26px; min-width: 0; }
.tc-detail-head { margin-bottom: 18px; }
.tc-detail-head h2 { margin-top: 8px; overflow-wrap: anywhere; }
.tc-tag { display: inline-block; font-size: 13px; color: var(--teal-dark); background: #edf6f4; border-radius: 5px; padding: 3px 8px; }
.tc-next { margin: 22px 0; padding: 16px; border-radius: 8px; background: var(--bg); }
.tc-next p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tc-timeline { margin-top: 24px; }
.tc-timeline > article { border-left: 2px solid var(--line); padding: 0 0 24px 18px; }
.tc-timeline p { margin: 6px 0 0; overflow-wrap: anywhere; }
.tc-context p { white-space: pre-wrap; overflow-wrap: anywhere; }
.tc-session, .tc-handoff { border-bottom: 1px solid var(--line); padding: 18px 0; overflow-wrap: anywhere; }
.tc-session p { margin: 5px 0; }
.tc-session .tc-actions { margin-top: 12px; }
.tc-inbox { padding: 24px; background: var(--surface); border-radius: 12px; border: 1px solid var(--line); }
.tc-search { margin-left: auto; min-width: 0; font-size: 14px; }
.tc-search input { max-width: 100%; width: 290px; display: block; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.tc-empty { padding: 56px 16px; text-align: center; }
.tc-empty p { color: var(--muted); }
.tc-dialog { width: min(680px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 26px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); }
.tc-dialog::backdrop { background: rgb(17 24 39 / 45%); }
.tc-dialog header { justify-content: space-between; margin-bottom: 20px; }
.tc-dialog h2 { font-size: 21px; margin: 0; }
.tc-dialog label { display: block; font-size: 14px; margin: 14px 0; }
.tc-dialog input:not([type="checkbox"]), .tc-dialog select, .tc-dialog textarea { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: 16px; background: var(--surface); color: var(--text); }
.tc-dialog textarea { resize: vertical; }
.tc-dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 14px; }
.tc-dialog .tc-check { display: flex; align-items: center; gap: 8px; }
.tc-dialog .tc-check input { width: auto; }
.tc-dialog footer { display: flex; justify-content: flex-end; }
.tc-form-error { color: var(--red); }
.tc-callout { background: var(--bg); padding: 12px; font-size: 14px; }
.tc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tc-message { border-bottom: 1px solid var(--line); margin: 18px 0; }
#tc-messages { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .tc-layout { grid-template-columns: 230px minmax(0, 1fr); } .tc-detail { padding: 20px; } }
@media (max-width: 800px) { .tc-layout { grid-template-columns: 1fr; } .tc-list { border-right: 0; border-bottom: 1px solid var(--line); } .tc-two, .tc-picker-row, .tc-create-settings { grid-template-columns: 1fr; gap: 8px; } .tc-picker-row .button { margin-top: 8px; } .tc-search { margin-left: 0; } .tc-nav { gap: 16px; } }
body[data-can-execute="false"] .nav-create-task, body[data-can-execute="false"] .task-center [data-tc="new"], body[data-can-execute="false"] .task-center [data-tc="edit"], body[data-can-execute="false"] .task-center [data-tc="handoff-dialog"] { display: none; }
.tc-execution { margin: 18px 0; padding: 18px; border: 1px solid #bbd9d3; border-radius: 8px; background: #f7fbfa; }
.tc-execution p { margin: 8px 0; overflow-wrap: anywhere; }
.tc-execution pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 14px; }
.tc-execution details { margin-top: 12px; }
.tc-execution a.button { text-decoration: none; }

/* Shared workspace palette. Shell layout lives in web/src/app/App.module.css. */
body {
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-strong: #f3f3f3;
  --line: #e7e7e7;
  --text: #303030;
  --muted: #7b7b7b;
  --teal: #2f2f2f;
  --teal-dark: #202020;
  --ink: #202020;
  --shadow: none;
  background: #fff;
}

.status-dot.online { background: #5a9f74; }

.button { border-radius: 8px; font-size: 13px; }
.button.primary { background: #303030; }
.button.primary:hover { background: #111; }
.button.secondary { background: #fff; }

.metric,
.config-band,
.bug-list-panel,
.bug-detail-panel,
.run-list-panel,
.task-band,
.tc-layout,
.tc-inbox {
  border-color: #e7e7e7;
  border-radius: 12px;
  box-shadow: none;
}

.settings-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 12px;
  border-right: 1px solid #eee;
  background: #fbfbfb;
}
.settings-nav a {
  width: 100%;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 12px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #555;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}
.settings-nav a:hover,
.settings-nav a.active { background: #ededed; color: #202020; }
.settings-nav a > span:first-child { color: #888; font-size: 17px; text-align: center; }
.settings-nav strong,
.settings-nav small { display: block; }
.settings-nav strong { font-size: 13px; font-weight: 550; }
.settings-nav small { margin-top: 4px; color: #929292; font-size: 11px; }
.settings-content { min-width: 0; padding: 28px; container-type: inline-size; }
.settings-panel { width: min(1040px, 100%); }
.settings-panel .config-band,
.settings-panel .task-band { margin: 0 0 16px; padding: 22px; }
.settings-panel .config-band > h2 { margin-bottom: 6px; font-size: 17px; }
.settings-panel .config-band > p { color: var(--muted); font-size: 13px; line-height: 1.7; }

@container (max-width: 680px) {
  .settings-panel :is(.fields-grid, .assignment-add-grid, .assignment-person, .assignment-person-fields, .combo-field) { grid-template-columns: minmax(0, 1fr); }
  .settings-panel .wide-field { grid-column: auto; }
  .settings-panel .assignment-person-actions { padding-top: 0; }
}

body[data-can-configure="false"] [data-settings-target="config"],
body[data-can-manage-members="false"] [data-settings-target="members"] { display: none; }

@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid #eee; }
  .settings-nav a { min-width: 150px; }
  .settings-content { padding: 20px 16px; }
}

/* Task-owned conversation timeline. */
.tc-timeline-item { min-width: 0; padding: 0 0 24px 18px; border-left: 1px solid var(--line); }
.tc-timeline-item > time { display: block; margin-bottom: 8px; }
.tc-session-thread { background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tc-session-thread > summary { cursor: pointer; padding: 14px 16px; }
.tc-session-thread > summary .tc-meta { display: block; margin: 6px 0 0; }
.tc-thread-content { padding: 16px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.tc-thread-content pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: none; }
.tc-thread-content .history-messages { margin: 18px 0; }
.tc-context-disclosure { margin: 16px 0; }
.tc-context-disclosure > summary { cursor: pointer; }
.tc-task-footer { border-top: 1px solid var(--line); padding-top: 18px; }
.tc-task-search { display: grid; gap: 6px; margin: 12px 0; }
.tc-task-search input { width: 100%; min-width: 0; }
@media (max-width: 700px) { .tc-timeline-item { padding-left: 8px; } .tc-thread-content { padding: 12px; } }

.tc-session > .tc-session-thread { flex: 1; min-width: 0; }

.history-composer { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.history-compose-heading, .history-compose-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.history-compose-heading { margin-bottom: 16px; }
.history-compose-heading a { color: inherit; font-size: 12px; }
.history-composer form { display: grid; gap: 10px; }
.history-composer label { font-size: 13px; }
.history-composer textarea { width: 100%; min-height: 96px; resize: vertical; border: 1px solid #ddd; border-radius: 12px; padding: 12px; color: #333; background: #fafafa; font: inherit; }
.history-composer button { padding: 8px 16px; border: 1px solid #ddd; border-radius: 8px; background: #fff; color: #333; cursor: pointer; }
.history-composer button[type=submit] { background: #292929; color: #fff; border-color: #292929; }
.history-composer button:disabled { opacity: .5; cursor: default; }
.history-composer [data-actions] { display: flex; flex-wrap: wrap; gap: 8px; }
.history-composer [data-output] { margin-bottom: 16px; overflow-wrap: anywhere; }
.history-composer [data-output] details > summary { cursor: pointer; margin-bottom: 12px; }
.history-composer [role=alert] { color: #b42318; font-size: 13px; }
@media (pointer: coarse) { .history-composer button { min-height: 44px; } .history-composer textarea { font-size: 16px; } }

/* New and resumed conversations share a viewport and a docked composer. */
.history-detail { display: flex; flex-direction: column; overflow: hidden; }
.history-chat-header { flex: 0 0 auto; padding: 16px 28px; }
.history-chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scroll-behavior: smooth; scrollbar-gutter: stable; }
.history-chat-content { width: 100%; max-width: 900px; padding: 32px 32px 24px; }
.history-composer { flex: 0 0 auto; width: 100%; max-width: 900px; margin: 0 auto; padding: 12px 32px 20px; border: 0; background: #fff; overflow: visible; }
.history-composer .conversation-composer, .tc-composer.conversation-composer { display: block; border: 1px solid #e5e5e5; border-radius: 24px; padding: 16px; background: #fff; box-shadow: 0 4px 20px #00000006; }
.conversation-composer:focus-within { border-color: #b8b8b8; box-shadow: 0 4px 20px #00000008; }
.history-composer textarea, .tc-composer.conversation-composer textarea { display: block; width: 100%; min-height: 76px; max-height: 180px; padding: 0 2px; border: 0; border-radius: 0; outline: none; resize: vertical; background: transparent; font-size: 15px; line-height: 1.7; }
.history-compose-footer { margin-top: 12px; }
.conversation-context { color: #777; font-size: 12px; text-decoration: none; overflow-wrap: anywhere; }
.conversation-context:hover { color: #222; }
.history-composer button[type=submit] { width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 23px; }
.history-composer [data-status], .history-composer [data-error] { margin: 8px 4px 0; font-size: 11px; }
.history-composer [data-status]:empty, .history-composer [data-error]:empty, .history-composer [data-actions]:empty { display: none; }
.history-composer [data-actions]:not(:empty) { margin-top: 8px; }
#historyLiveOutput:not(:empty) { margin-top: 28px; }
.tc-create-message { background: #e8f3ff; border-radius: 22px; }

body[data-view="new-task"] .task-center { height: 100dvh; display: flex; flex-direction: column; }

body[data-view="new-task"] .tc-create { flex: 1; width: 100%; max-width: 900px; height: auto; min-height: 0; padding: 0 32px 20px; }
.tc-create-log .tc-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.tc-composer.conversation-composer { flex: 0 0 auto; max-height: 60%; overflow-y: auto; }
.conversation-settings { margin-top: 12px; font-size: 12px; color: #777; }
.conversation-settings > summary { cursor: pointer; width: fit-content; padding: 4px 0; }
.tc-composer.conversation-composer footer { margin-top: 8px; }
@media (max-width: 860px) {
  .history-detail { height: 85dvh; min-height: 480px; }
  body[data-view="new-task"] .task-center { height: calc(100dvh - 64px); min-height: 480px; }
}
@media (min-width: 761px) and (max-width: 860px) {
  /* Two-column history below the 62px mobile navigation and 72px page heading. */
  .history-layout { min-height: calc(100dvh - 134px); }
  .history-browser, .history-detail { height: calc(100dvh - 134px); min-height: 0; }
}
@media (max-width: 600px) {
  .history-browser { max-height: clamp(280px, 42dvh, 360px); padding: 14px 12px; }
  .history-filters { gap: 8px; }
  .history-browser > p[role] { margin: 8px 0; }
  .history-card { gap: 4px; padding: 10px 12px; }
  .history-pagination { margin: 12px 6px; }
  .history-source-details { margin: 12px 6px; }
  .history-chat-content { padding: 24px 16px; }
  .history-messages { gap: 28px; }
  .history-message { font-size: 15px; }
  .history-message.user > div { max-width: 94%; padding: 12px 16px; }
  .history-work-body { margin-left: 4px; padding-left: 12px; }
  .history-table th, .history-table td { padding: 10px 12px 10px 0; min-width: 80px; }
  .history-composer { padding: 8px 12px 12px; }
  body[data-view="new-task"] .tc-create { padding: 0 12px 12px; }
  .history-compose-footer .history-meta { display: none; }
  .tc-create-directory { flex-wrap: wrap; }
}
.tc-composer.conversation-composer button[type=submit] { width: 34px; height: 34px; min-height: 34px; padding: 0; border-radius: 50%; font-size: 23px; }

/* New task: environment above the composer, generation settings in the footer. */
.tc-create-shell { flex: 0 0 auto; min-width: 0; position: relative; }
.tc-create-context { display: flex; align-items: center; gap: 12px; margin: 0 12px -12px; padding: 10px 12px 22px; min-height: 58px; border-radius: 18px 18px 0 0; background: #f5f5f5; }
.tc-create-context > p { min-width: 0; overflow-wrap: anywhere; }
.tc-create-shell .tc-composer { position: relative; max-height: none; overflow: visible; }
.tc-create-shell textarea { min-height: 110px; }
.tc-config-menu { position: relative; min-width: 0; font-size: 14px; color: var(--text); }
.tc-config-menu > summary { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; cursor: pointer; list-style: none; }
.tc-config-menu > summary::-webkit-details-marker { display: none; }
.tc-config-menu > summary:hover, .tc-config-menu[open] > summary { background: #eaeaea; }
.tc-config-menu > summary:focus-visible, .tc-target-control select:focus-visible, .tc-directory-options button:focus-visible { outline: 2px solid #3478eb; outline-offset: 2px; }
.tc-config-menu > summary > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-config-menu svg, .tc-target-control svg { flex-shrink: 0; }
.tc-config-chevron, .tc-effort-label { color: var(--muted); flex-shrink: 0; }
.tc-directory-menu { max-width: 45%; }
.tc-target-control { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 55%; }
.tc-target-control select { width: 100%; min-width: 0; border: 0; border-radius: 8px; padding: 7px 4px; color: var(--text); background: transparent; font: inherit; font-size: 14px; text-overflow: ellipsis; cursor: pointer; }
.tc-config-panel { position: absolute; bottom: calc(100% + 10px); left: 0; width: 340px; max-width: calc(100vw - 64px); max-height: min(380px, 50dvh); overflow-y: auto; z-index: 20; padding: 16px; border: 1px solid #e5e5e5; border-radius: 14px; background: #fff; box-shadow: 0 8px 32px #00000014; }
.tc-config-panel > .tc-create-setting { display: block; margin-bottom: 12px; }
.tc-config-panel > input { width: 100%; min-width: 0; padding: 10px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.tc-config-panel > input:focus-visible { outline: 2px solid #3478eb; outline-offset: 1px; }
.tc-config-panel .tc-actions { gap: 6px; margin-bottom: 14px; }
.tc-config-panel .button { padding: 7px 10px; font-size: 13px; }
.tc-directory-options { display: grid; gap: 4px; margin-top: 6px; }
.tc-directory-options button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.tc-directory-options button:hover, .tc-directory-options button[aria-pressed="true"] { background: #f3f5f7; }
.tc-directory-options span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tc-directory-options small { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.tc-create-send { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.tc-create-send button[type=submit] { flex-shrink: 0; }
.tc-model-menu { min-width: 0; }
.tc-model-menu .tc-config-panel { left: auto; right: 0; }
.tc-model-menu > summary { gap: 5px; min-height: 36px; padding: 7px 11px; background: #ededee; border-radius: 12px; }
.tc-model-menu > summary:hover, .tc-model-menu[open] > summary { background: #e4e4e6; }
.tc-model-chevron { margin-left: 2px; color: #666; }
.tc-model-menu .tc-model-panel { width: 300px; padding: 12px 14px 14px; border-color: #e6e6e8; border-radius: 17px; box-shadow: 0 14px 42px #00000018; }
.tc-model-card-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 26px; }
.tc-model-card-header > span { color: #999; font-size: 23px; line-height: 1; }
.tc-model-card-header strong { color: #3478eb; font-size: 15px; font-weight: 600; }
.tc-model-card-header button { justify-self: end; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #999; font-size: 23px; line-height: 1; cursor: pointer; }
.tc-model-card-header button:hover:not(:disabled) { background: #f1f1f1; color: #555; }
.tc-model-card-header button:disabled { opacity: .45; cursor: default; }
.tc-model-select-wrap { position: relative; display: block; margin: 0 0 9px; }
.tc-model-panel .tc-model-select-wrap select { appearance: none; display: block; width: 100%; min-height: 30px; margin: 0; padding: 4px 28px; border: 0; border-radius: 7px; background: transparent; color: #666; font-size: 13px; text-align: center; cursor: pointer; }
.tc-model-panel .tc-model-select-wrap select:hover { background: #f5f5f5; }
.tc-model-panel .tc-model-select-wrap select:focus-visible, .tc-model-card-header button:focus-visible { outline: 2px solid #3478eb; outline-offset: 1px; }
.tc-model-select-wrap > span { position: absolute; top: 50%; right: 25px; color: #888; pointer-events: none; transform: translateY(-50%); }
.tc-effort-track { position: relative; height: 38px; }
.tc-effort-track::before { position: absolute; top: 5px; left: 0; right: 0; height: 28px; border-radius: 999px; background: linear-gradient(to right, #3b82f6 var(--tc-effort-progress), #e6e6e8 var(--tc-effort-progress)); content: ''; }
.tc-effort-track input[type=range] { appearance: none; position: absolute; inset: 0; z-index: 2; width: 100%; height: 38px; margin: 0; background: transparent; cursor: pointer; }
.tc-effort-track input[type=range]::-webkit-slider-runnable-track { height: 38px; background: transparent; }
.tc-effort-track input[type=range]::-moz-range-track { height: 38px; background: transparent; }
.tc-effort-track input[type=range]::-webkit-slider-thumb { appearance: none; width: 30px; height: 30px; margin-top: 4px; border: 1px solid #e7e7e9; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px #00000024; }
.tc-effort-track input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border: 1px solid #e7e7e9; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px #00000024; }
.tc-effort-track input[type=range]:focus-visible { outline: 2px solid #3478eb; outline-offset: 2px; border-radius: 8px; }
.tc-effort-track input[type=range]:disabled { cursor: default; opacity: .55; }
.tc-effort-ticks { position: absolute; top: 17px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.tc-effort-ticks > span { width: 4px; height: 4px; border-radius: 50%; background: #aaa; }
.tc-model-panel > .tc-create-hint { margin: 5px 0 0; }
.tc-create-shortcut { color: #999; font-size: 12px; white-space: nowrap; }
.tc-create-shell .tc-form-error:empty { display: none; }
@media (max-width: 600px) {
  .tc-create-context { gap: 6px; margin-left: 6px; margin-right: 6px; padding-left: 6px; padding-right: 6px; }
  .tc-create-shortcut { display: none; }
  .tc-create-send { width: 100%; }
  .tc-create-context .tc-config-menu > summary { padding-left: 4px; padding-right: 4px; }
  .tc-target-control { gap: 4px; }
  .tc-target-control select, .tc-config-menu { font-size: 13px; }
  .tc-model-menu .tc-config-panel { right: -46px; }
  .tc-config-panel { max-width: calc(100vw - 60px); }
}
.tc-create-context { flex-wrap: wrap; gap: 8px; }
.tc-create-context .tc-target-control { max-width: 50%; }
.tc-branch-menu { max-width: 40%; }
.tc-branch-options { display: grid; gap: 3px; max-height: 180px; overflow-y: auto; margin: 10px 0; }
.tc-branch-options button { border: 0; background: transparent; text-align: left; padding: 9px; border-radius: 7px; overflow-wrap: anywhere; cursor: pointer; }
.tc-branch-options button:hover, .tc-branch-options button[aria-pressed=true] { background: #f2f4f7; }
.tc-branch-menu .tc-create-setting input { display: block; width: 100%; margin-top: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.tc-create-tools { display: flex; gap: 8px; align-items: center; }
.tc-attach-button { font-size: 24px; background: transparent; border: 0; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; }
.tc-attach-button:hover { background: #f3f3f3; }
.tc-attach-button:disabled { opacity: .4; cursor: default; }
.tc-attachment-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-attachment { display: flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.tc-attachment > span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-attachment small { color: var(--muted); white-space: nowrap; }
.tc-attachment button { background: transparent; border: 0; cursor: pointer; }
@media (max-width: 600px) {
  .tc-branch-menu .tc-config-panel { left: 0; }
  .tc-create-send { width: auto; flex: 1; }
  .tc-branch-menu { max-width: 100%; }
  .tc-create-context { position: relative; }
  .tc-branch-menu { position: static; }
}
.tc-branch-menu .tc-config-panel { left: auto; right: 0; }
@media (max-width: 600px) { .tc-branch-menu .tc-config-panel { left: 0; right: auto; } }
.tc-task-content { padding: 8px 0 20px; overflow-wrap: anywhere; }
.tc-task-content > :first-child { margin-top: 0; }
.tc-task-content pre { max-width: 100%; overflow-x: auto; }
.tc-dialog textarea.tc-markdown-editor { min-height: 300px; max-height: 65dvh; line-height: 1.7; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; }

.conversation-switch .tc-create-context { margin-bottom: -12px; }
.conversation-switch .conversation-composer { position: relative; }
.conversation-new-controls { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.conversation-new-button { white-space: nowrap; }
.conversation-new-status { margin: 8px 2px 0; color: var(--muted, #64748b); font-size: 12px; overflow-wrap: anywhere; }
.conversation-new-status:empty { display: none; }
@media (max-width: 600px) {
  .history-compose-footer { align-items: flex-end; }
  .conversation-new-controls { flex-wrap: wrap; gap: 6px; }
  .conversation-new-button { padding-left: 10px; padding-right: 10px; }
}
.history-inherited { margin-bottom: 16px; padding: 12px; border: 1px solid #dce3eb; border-radius: 10px; }
