.cw-workspace, .cw-main, .cw-turn, .cw-source-detail, .cw-selection-evidence { display: grid; gap: 12px; min-width: 0; }
.cw-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 14px; align-items: start; min-width: 0; }
.cw-layout.cw-chat-only { grid-template-columns: minmax(0, 1fr); }
.cw-layout.cw-single-column { grid-template-columns: minmax(0, 1fr); }
.cw-chat-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cw-toolbar, .cw-form, .cw-candidate, .cw-sendbar { display: flex; align-items: end; flex-wrap: wrap; gap: 8px 12px; }
.cw-toolbar .field { min-width: min(13rem, 100%); }
.cw-toolbar .cw-hint { margin-block-end: 8px; }
.cw-toolbar .button { margin-inline-start: auto; }
.cw-panel, .cw-chat { display: grid; gap: 12px; min-width: 0; padding: 15px; }
.cw-panel h2, .cw-chat h2 { font: 700 20px/1.35 var(--serif); letter-spacing: -.04em; }
.cw-form .field { flex: 1 1 150px; min-width: 0; }
.cw-form input { width: 100%; }
.cw-hint { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.cw-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)); gap: 9px; }
.cw-source { display: grid; gap: 4px; justify-items: start; border: 1px solid var(--line); border-radius: 3px; padding: 11px; }
.cw-candidates-wrap { display: grid; gap: 8px; }
.cw-candidates { max-height: 245px; overflow: auto; border: 1px solid var(--line-light); border-radius: 3px; }
.cw-candidates > .cw-hint { padding: 8px 10px; }
.cw-candidate { justify-content: space-between; align-items: center; padding: 8px 10px; }
.cw-candidate + .cw-candidate { border-top: 1px solid var(--line-light); }
.cw-candidate > div { flex: 1 1 115px; min-width: 0; }
.cw-candidate .button { flex: none; }
.cw-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 3px; }
.cw-table { width: 100%; min-width: 395px; border-collapse: collapse; }
.cw-table :is(th, td) { border-bottom: 1px solid var(--line-light); padding: 8px; text-align: left; vertical-align: middle; }
.cw-table tbody tr:last-child :is(th, td) { border-bottom: 0; }
.cw-table thead th { background: var(--paper-light); }
.cw-table .cw-selected { background: var(--green); }
.cw-table .cw-hint { font-size: 11px; }
.cw-performance-table { min-width: 670px; }
.cw-performance-table :is(th, td) { padding-inline: 6px; }
.cw-performance-table th[scope='row'] { min-width: 110px; }
.cw-performance-table .cw-actual-value { white-space: nowrap; }
.cw-rank-summary { min-width: 105px; }
.cw-workspace input[type='checkbox'] { width: 16px; height: 16px; min-width: 16px; margin: 0; accent-color: var(--forest); vertical-align: middle; }
.cw-evidence-list { display: grid; gap: 7px; }
.cw-evidence { display: flex; align-items: start; gap: 8px; padding: 8px; border: 1px solid var(--line-light); border-radius: 3px; background: var(--paper-light); }
.cw-evidence input { margin-top: 3px !important; }
.cw-evidence-details > summary { color: var(--forest-dark); font-weight: 620; cursor: pointer; }
.cw-evidence-details :is(ul, ol) { margin-block: 5px; padding-inline-start: 22px; }
.cw-evidence-details li + li { margin-top: 4px; }
.cw-sendbar { justify-content: space-between; align-items: center; background: var(--green); color: var(--forest-dark); padding: 9px; border-radius: 3px; }
.cw-context, .cw-success, .cw-error { padding: 8px 10px; border-radius: 3px; }
.cw-context { background: var(--paper-dark); color: var(--muted); }
.cw-success { color: var(--forest-dark); background: var(--green); }
.cw-error { color: var(--danger); background: var(--danger-bg); }
.cw-error > .button { margin-inline-start: 8px; }
.cw-attachment, .cw-result { display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 3px; padding: 11px; min-width: 0; }
.cw-attachment h3, .cw-result h3 { color: var(--forest-dark); }
.cw-attached-evidence, .cw-attached-group { border-top: 1px solid var(--line-light); padding-top: 7px; margin-top: 3px; }
.cw-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.cw-badge { display: inline-flex; padding: 2px 6px; border-radius: 4px; background: var(--paper-dark); color: var(--muted); font-size: 11px; }
.cw-tags .cw-badge { background: var(--green); color: var(--forest-dark); }
.cw-message { justify-self: end; max-width: 95%; padding: 8px 11px; background: var(--green); color: var(--forest-dark); border-radius: 4px; }
.cw-result .button { justify-self: start; }
.cw-evaluation { display: grid; gap: 5px; }
.cw-evaluation > div { border-top: 1px solid var(--line-light); padding-top: 5px; }
.cw-evaluation dt { color: var(--forest-dark); font-weight: 680; }
.cw-evaluation dd { color: var(--muted); }

.cw-ai-workspace .cw-toolbar > .button ~ .button { margin-inline-start: 0; }
.cw-ai-workspace .cw-toolbar [aria-expanded='true'] { border-color: var(--forest); background: var(--green); color: var(--forest-dark); }
.cw-ai-workspace .cw-chat, .cw-evidence-drawer { border-radius: 8px; }
.cw-ai-workspace .cw-chat { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.cw-evidence-drawer h2 { font-size: 17px; }
.cw-evidence-tabs { flex-wrap: wrap; }
.cw-evidence-sources, .cw-evidence-source, .cw-evidence-attach, .cw-compose, .cw-compose-attachments { display: grid; min-width: 0; gap: 8px; }
.cw-evidence-source + .cw-evidence-source, .cw-evidence-attach { padding-top: 10px; border-top: 1px solid var(--line-light); }
.cw-evidence-sources > .button, .cw-evidence-source > .button, .cw-evidence-source details > .button, .cw-evidence-attach > .button { justify-self: start; }
.cw-evidence-caption { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 650; overflow-wrap: anywhere; }
.cw-mybox-files, .cw-attachment-files { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; }
.cw-mybox-file strong, .cw-attachment-files strong { overflow-wrap: anywhere; }
.cw-evidence-source details > :is(div, p, button) { margin-top: 7px; }
.cw-evidence-keywords, .cw-evidence-subset { max-height: 230px; overflow: auto; }
.cw-compose { padding-top: 12px; background: var(--white); border-top: 1px solid var(--line-light); }
.cw-compose .cw-form .field { flex: 1 1 min(260px, 100%); }
.cw-compose textarea { width: 100%; resize: vertical; }
.cw-compose-attachments { align-items: start; grid-template-columns: minmax(0, 1fr) auto; }
.cw-compose-attachments .cw-attachment { background: var(--paper-light); }
.cw-attachment-files > li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.cw-blog-query > a, .cw-blog-snapshot > a { justify-self: start; }
.cw-blog-volume, .cw-blog-author, .cw-blog-select { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; }
.cw-blog-volume > .cw-hint { flex-basis: 100%; }
.cw-blog-observation, .cw-blog-snapshot, .cw-blog-ranks { display: grid; gap: 6px; min-width: 0; }
.cw-blog-snapshot { padding-block: 7px; border-top: 1px solid var(--line-light); }
.cw-blog-select { font-size: 12px; }
.cw-blog-ranks { margin: 0; padding-inline-start: 24px; overflow-wrap: anywhere; }
.cw-blog-author { margin-block-start: 2px; font-size: 11px; }
.cw-blog-author > a { text-decoration: underline; }

@media (min-width: 1081px) {
  .cw-layout.cw-chat-only.cw-with-evidence { grid-template-columns: minmax(0, 1fr) minmax(275px, 340px); }
  .cw-evidence-drawer { position: sticky; top: 12px; max-height: calc(100dvh - 24px); overflow: auto; }
  .cw-compose { position: sticky; bottom: 0; z-index: 1; padding-bottom: 8px; }
}

@media (max-width: 1000px) {
  .cw-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .cw-sources { grid-template-columns: minmax(0, 1fr); }
  .cw-panel, .cw-chat { padding: 11px; }
  .cw-toolbar .button { margin-inline-start: 0; }
  .cw-compose-attachments { grid-template-columns: minmax(0, 1fr); }
  .cw-compose-attachments > .button { justify-self: start; }
}
