.ai-work-panel { display: grid; gap: 14px; max-width: 860px; margin-inline: auto; min-width: 0; }
.ai-work-device { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; }
.ai-work-device > .field { min-width: min(240px, 100%); }
.ai-work-device > p { margin: 0; align-self: center; }
.ai-work-timeline { display: grid; align-content: start; gap: 26px; min-height: 180px; max-height: 58dvh; overflow: auto; padding: 14px; border-radius: 14px; border: 1px solid var(--theme-line); background: var(--theme-surface); }
.ai-work-empty { margin: 18px 4px; }
.ai-work-turn { display: grid; gap: 15px; min-width: 0; }
.ai-work-user { justify-self: end; max-width: min(85%, 680px); background: var(--c-primary); color: var(--c-on-primary); border-radius: 17px 17px 5px 17px; padding: 9px 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.ai-work-user a { color: inherit; text-decoration: underline; }
.ai-work-peer { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 9px; align-items: start; }
.ai-work-peer-content { display: grid; gap: 5px; min-width: 0; }
.ai-work-avatar { display: grid; place-items: center; inline-size: 30px; block-size: 30px; border-radius: 50%; background: hsl(var(--ai-peer-tone, 242) 58% 86%); color: hsl(var(--ai-peer-tone, 242) 46% 24%); font-size: .8rem; font-weight: 700; }
[data-theme='dark'] .ai-work-avatar { background: hsl(var(--ai-peer-tone, 242) 34% 27%); color: hsl(var(--ai-peer-tone, 242) 65% 92%); }
.ai-work-identity { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; min-height: 23px; padding-block-start: 3px; overflow-wrap: anywhere; }
.ai-work-sender { font-size: .9rem; color: var(--theme-ink); }
.ai-work-sender-model, .ai-work-state { font-size: .76rem; color: var(--theme-muted); }
.ai-work-state[data-state='running'] { color: var(--c-accent-text); }
.ai-work-state[data-state='failed'], .ai-work-error { color: var(--theme-danger); }
.ai-work-messages { display: grid; justify-items: start; gap: 6px; min-width: 0; }
.ai-work-messages:empty { display: none; }
.ai-work-approvals { width: min(100%, 650px); }
.ai-work-activity, .ai-work-approval { border: 1px solid var(--theme-line); border-radius: 9px; padding: 3px 11px; background: var(--theme-recessed); min-width: 0; }
.ai-work-activity { justify-self: start; width: min(100%, 650px); }
.ai-work-activity summary { cursor: pointer; min-height: 44px; padding-block: 11px; }
.ai-work-tools { padding-inline-start: 8px; }
.ai-work-tools > details { border-top: 1px solid var(--theme-line); }
.ai-work-activity pre, .ai-work-approval pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; margin: 4px 0 10px; }
.ai-work-approval { padding: 12px; border-color: var(--c-primary-line); margin: 5px 0; }
.ai-work-decisions { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-work-approval .button, .ai-work-composer .button { min-height: 44px; }
.ai-work-reply { width: fit-content; max-width: min(100%, 720px); min-width: 0; border-radius: 5px 17px 17px 17px; padding: 9px 13px; background: var(--theme-recessed); color: var(--theme-ink); overflow-wrap: anywhere; }
.ai-work-rich-text { line-height: 1.62; min-width: 0; }
.ai-work-rich-text :is(p, ul, ol, blockquote, pre, .ai-work-table-scroll, hr) { margin-block: 0 .68em; }
.ai-work-rich-text > :last-child, .ai-work-rich-text li > :last-child { margin-block-end: 0; }
.ai-work-rich-text :is(ul, ol) { padding-inline-start: 1.45em; }
.ai-work-rich-text li + li { margin-block-start: .24em; }
.ai-work-rich-text li > input[type='checkbox'] { float: inline-start; margin: .4em .45em 0 0; }
.ai-work-rich-text :is(h3, h4, h5, h6) { font-size: 1em; line-height: 1.4; margin-block: .2em .44em; }
.ai-work-rich-text a { color: var(--c-accent-text); text-decoration: underline; text-underline-offset: .12em; }
.ai-work-rich-text blockquote { padding-inline-start: .75em; border-inline-start: 3px solid var(--theme-line-strong); color: var(--theme-ink-secondary); }
.ai-work-rich-text code { border-radius: 4px; padding: .1em .28em; background: var(--theme-surface); font-size: .88em; }
.ai-work-rich-text pre { overflow-x: auto; max-width: 100%; border: 1px solid var(--theme-line); border-radius: 8px; padding: 8px 10px; background: var(--theme-surface); }
.ai-work-rich-text pre code { padding: 0; overflow-wrap: normal; }
.ai-work-table-scroll { overflow-x: auto; max-width: 100%; }
.ai-work-rich-text table { border-collapse: collapse; font-size: .9em; }
.ai-work-rich-text :is(th, td) { text-align: start; min-width: 3rem; padding: .3em .6em; border: 1px solid var(--theme-line-strong); }
.ai-work-rich-text hr { border: 0; border-block-start: 1px solid var(--theme-line-strong); }
.ai-work-composer:not([hidden]) { display: grid; gap: 8px; }
.ai-work-composer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: end; }
.ai-work-composer-actions .attach-button { margin-right: auto; width: 44px; height: 44px; }
.ai-work-reviewer { width: auto; max-width: 100%; min-height: 44px; }
.ai-work-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ai-work-file { display: inline-block; border: 1px solid currentColor; border-radius: 7px; color: inherit; padding: 4px 9px; overflow-wrap: anywhere; }
.ai-work-steer { align-self: end; margin-left: auto; }
.ai-work-steer-state { display: block; margin-top: 4px; }
.ai-work-approval summary > span { margin-left: .75em; }
.ai-work-composer textarea { flex: 1; min-width: 0; min-height: 44px; resize: vertical; font-size: 16px; }
.ai-work-error { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-work-panel [hidden] { display: none; }
@media (max-width: 700px) {
  .ai-work-timeline { padding: 12px; max-height: 54dvh; }
  .ai-work-user { max-width: 90%; }
  .ai-work-peer { grid-template-columns: 25px minmax(0, 1fr); gap: 7px; }
  .ai-work-avatar { inline-size: 25px; block-size: 25px; }
  .ai-work-reply { padding: 8px 10px; }
}
.ai-work-user p { margin: 0; }
.ai-work-layout { display: grid; grid-template-columns: minmax(185px, 250px) minmax(0, 1fr); gap: 20px; max-width: 1160px; margin-inline: auto; }
.ai-work-layout > .ai-work-panel { width: 100%; max-width: initial; margin: 0; }
.ai-work-room-sidebar { min-width: 0; align-self: start; padding: 12px; border: 1px solid var(--theme-line); border-radius: 14px; background: var(--theme-surface); }
.ai-work-room-sidebar > summary { min-height: 44px; padding: 11px 2px; font-weight: 650; cursor: pointer; }
.ai-work-room-sidebar > .button { width: 100%; min-height: 44px; }
.ai-work-room-list { max-height: 60dvh; overflow: auto; }
.ai-work-room-group { display: grid; gap: 4px; margin-block: 12px 4px; }
.ai-work-room-group h2 { margin: 3px 6px; overflow-wrap: anywhere; }
.ai-work-room-link.button { display: grid; justify-content: stretch; gap: 2px; padding: 7px 9px; min-height: 46px; text-align: left; line-height: 1.35; overflow-wrap: anywhere; }
.ai-work-room-link[aria-current='page'] { background: var(--c-primary-soft); border-color: var(--c-primary-line); }
.ai-work-room-name { flex: 1 0 100%; margin: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.ai-work-room-name:empty { display: none; }
.ai-work-assignee { width: min(100%, 220px); }
.ai-work-member-rows { display: grid; gap: 10px; }
.ai-work-member-rows:empty { display: none; }
.ai-work-member-form { display: grid; min-width: 0; gap: 8px; margin: 0; padding: 10px; border: 1px solid var(--theme-line); border-radius: 10px; }
.ai-work-member-form > .button { justify-self: start; }
.ai-work-room-dialog { max-height: min(88dvh, 920px); overflow: auto; }
.ai-work-room-dialog :is(.button, .input) { min-height: 44px; }
@media (max-width: 850px) {
  .ai-work-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .ai-work-room-sidebar { padding-block: 3px; }
  .ai-work-room-sidebar[open] { padding-bottom: 10px; }
}
.ai-work-layout.ai-work-viewer-open { max-width: 100%; grid-template-columns: minmax(160px, 210px) minmax(340px, 1fr) minmax(280px, 1fr); }
.ai-work-viewer { min-width: 0; align-self: start; display: grid; gap: 9px; padding: 12px; border: 1px solid var(--theme-line); border-radius: 14px; background: var(--theme-surface); }
.ai-work-viewer [hidden], .ai-work-viewer[hidden] { display: none; }
.ai-work-viewer-head, .ai-work-viewer-address, .ai-work-file-actions { display: flex; align-items: center; gap: 7px; }
.ai-work-viewer-head strong { margin-right: auto; }
.ai-work-viewer-address .input { flex: 1; min-width: 0; }
.ai-work-viewer > p { margin: 0; overflow-wrap: anywhere; }
.ai-work-viewer-frame { display: block; width: 100%; height: min(65dvh, 850px); border: 1px solid var(--theme-line); border-radius: 8px; background: white; }
.ai-work-connection-page { max-width: 660px; margin-inline: auto; }
.ai-work-view-link.button { min-height: 30px; font-size: .78rem; padding: 3px 7px; }
@media (max-width: 1080px) {
  .ai-work-layout.ai-work-viewer-open { grid-template-columns: minmax(0, 1fr); }
}
.ai-work-thread-link { color: var(--theme-muted); font-size: .82rem; justify-self: start; max-width: 100%; }
.ai-work-thread-link > summary { cursor: pointer; min-height: 32px; align-content: center; }
.ai-work-thread-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-block: 5px; }
.ai-work-thread-controls > .input { flex: 1 1 22ch; min-width: 0; font-size: .85rem; }
@media (max-width: 700px) {
  .ai-work-thread-controls :is(.button, .input), .ai-work-thread-link > summary { min-height: 44px; }
  .ai-work-thread-controls > .input { flex-basis: 100%; }
}
