.ai-view { display: flex; flex-direction: column; overflow: hidden; }
.ai-view > .work-header { flex: 0 0 auto; }
.ai-layout { display: flex; flex: 1; min-height: 0; min-width: 0; gap: 20px; }
.ai-topic-picker { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; min-width: 0; margin-bottom: 12px; color: var(--work-muted); font-size: 12px; }
.ai-topic-picker select { min-width: 0; max-width: 100%; flex: 1; padding: 8px; color: var(--work-text); border: 1px solid var(--work-line); border-radius: 8px; background: var(--work-surface); }
.ai-thread-list { flex: 0 0 180px; overflow: auto; }
.ai-thread-list > button { display: block; width: 100%; background: transparent; border: 0; border-radius: 8px; padding: 12px; color: var(--work-text); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ai-thread-list > button.is-active { background: var(--work-tint); }
.ai-conversation { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--work-line); background: var(--work-surface); border-radius: 16px; overflow: hidden; }
.ai-transcript { flex: 1; min-height: 100px; overflow: auto; padding: 22px; overscroll-behavior: contain; }
.ai-welcome { max-width: 650px; margin: 28px auto; text-align: center; }
.ai-symbol { display: inline-block; border-radius: 18px; padding: 15px 20px; color: #237565; background: #e2f2df; font-size: 32px; margin-bottom: 20px; }
.ai-welcome p { line-height: 1.8; color: var(--work-muted); }
.ai-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.ai-starters button { border: 1px solid var(--work-line); border-radius: 12px; padding: 12px; background: var(--work-tint); color: var(--work-text); cursor: pointer; }
.ai-run { margin-bottom: 32px; overflow-wrap: anywhere; }
.ai-question { background: var(--work-tint); border-radius: 12px; padding: 14px 18px; max-width: 90%; margin-left: auto; }
.ai-question p { white-space: pre-wrap; margin: 8px 0; line-height: 1.8; }
.ai-response { padding: 22px 0 0; }
.ai-response-label { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; color: var(--work-accent); font-size: 13px; }
.ai-response-label small { color: var(--work-muted); font-size: 11px; }
.ai-answer { line-height: 1.9; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.ai-answer h3 { margin: 22px 0 10px; font-size: 17px; }
.ai-answer p { margin: 10px 0; }
.ai-answer ul { padding-left: 22px; }
.ai-answer pre, .rich-table { max-width: 100%; overflow: auto; }
.ai-answer pre { background: #182b25; color: #e6f1eb; padding: 16px; border-radius: 9px; line-height: 1.65; white-space: pre; }
.ai-answer table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.ai-answer th, .ai-answer td { border: 1px solid var(--work-line, #dce7e2); padding: 9px 12px; text-align: left; min-width: 80px; }
.ai-answer th { background: var(--work-tint, #e7f3ee); }
.ai-sources { border-left: 3px solid var(--work-accent); padding: 10px 14px; margin: 16px 0; background: var(--work-tint); font-size: 12px; }
.ai-sources button { display: block; text-align: left; border: 0; color: var(--work-text); background: none; padding: 7px 0; cursor: pointer; overflow-wrap: anywhere; }
.ai-proposals { background: var(--work-tint); border: 1px solid var(--work-line); border-radius: 12px; padding: 14px; margin: 18px 0; }
.ai-proposals > div { margin-top: 12px; border-top: 1px solid var(--work-line); padding-top: 12px; }
.ai-proposals p { font-size: 13px; }
.ai-run-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.ai-compose { display: flex; flex-direction: column; flex: 0 0 auto; min-height: 0; border-top: 1px solid var(--work-line); padding: 16px 20px; max-height: 55%; overflow: hidden; }
.ai-compose-fields { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.ai-compose .work-field { margin-bottom: 8px; }
.ai-compose textarea { min-height: 76px; max-height: 180px; }
.ai-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.ai-controls select { width: auto; padding: 7px; }
.ai-controls > .work-button { padding: 7px 11px; }
.ai-compose-footer { display: flex; flex: 0 0 auto; gap: 10px; align-items: center; justify-content: space-between; padding-top: 8px; background: var(--work-surface); }
.ai-compose-footer small { color: var(--work-muted); font-size: 11px; }
.ai-attachment-list { display: flex; gap: 7px; flex-wrap: wrap; margin: 8px 0; }
.ai-attachment-list > span { background: var(--work-tint); border-radius: 6px; padding: 4px 8px; font-size: 12px; max-width: 100%; overflow-wrap: anywhere; }
.ai-attachment-list button { border: 0; background: none; cursor: pointer; color: inherit; }
.ai-pending { color: var(--work-muted); font-size: 13px; }
.ai-topic-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; flex: 0 0 auto; }
.ai-topic-search { flex: 1; min-width: 120px; }
.ai-topic-search input { width: 100%; padding: 8px 12px; border: 1px solid var(--work-line); border-radius: 9px; background: var(--work-surface); color: var(--work-text); font: inherit; }
.ai-topic-picker { flex-wrap: wrap; }
.ai-topic-picker select { flex: 1 1 160px; width: 0; }
.ai-topic-picker .work-button, .ai-topic-tools .work-button { padding: 7px 10px; font-size: 12px; }
.ai-material-preview { max-height: 300px; overflow: auto; border: 1px solid var(--work-line); border-radius: 12px; background: var(--work-tint); padding: 14px; margin: 12px 0; font-size: 12px; overflow-wrap: anywhere; }
.ai-material-preview h4 { margin: 12px 0 6px; }
.ai-compose-options { margin: 10px 0; font-size: 12px; color: var(--work-muted); }
.ai-compose-options summary { cursor: pointer; padding: 5px 0; }
.ai-material-preview details { margin: 8px 0; }
.ai-material-preview summary { cursor: pointer; }
.ai-material-preview .work-preserve { white-space: pre-wrap; }
.ai-transcript { overflow-anchor: none; scrollbar-gutter: stable; }
.ai-view button:focus-visible, .ai-view input:focus-visible, .ai-view select:focus-visible { outline: 2px solid var(--work-accent); outline-offset: 2px; }
@media (max-width: 1150px) { .ai-thread-list { flex-basis: 135px; } }
@media (max-width: 900px) { .ai-thread-list { display: none; } }
@media (max-width: 600px) {
  .ai-view { padding: 12px 8px; }
  .ai-view .work-header { gap: 8px; margin-bottom: 10px; }
  .ai-view .work-header p { display: none; }
  .ai-view .work-header h2 { font-size: 21px; }
  .ai-compose { max-height: 60%; padding: 10px; }
  .ai-transcript { min-height: 0; padding: 12px; }
  .ai-controls > .work-help { display: none; }
  .ai-compose-footer { flex-wrap: wrap; }
  .ai-consent { font-size: 11px; }
  .ai-question { max-width: 100%; }
  .ai-topic-tools { gap: 6px; margin-bottom: 7px; }
  .ai-topic-picker { gap: 6px; margin-bottom: 8px; }
  .ai-topic-picker select { flex-basis: 130px; }
}
@media (max-height: 600px) { .ai-view .work-header { margin-bottom: 6px; } .ai-view .work-header p, .ai-topic-tools { display: none; } .ai-compose { max-height: 62%; } .ai-compose textarea { min-height: 46px; } }
