/* The task and its discussion are independent panes in one working window. */
html:root #task-drawer.detail-mode { --task-pane-width:42%; --window-normal-width:1280px; --window-normal-height:800px; --window-height-limit:calc(100dvh - 72px); }
html:root #task-drawer.detail-mode:not(.window-maximized) { top:50%; }
html:root #task-drawer.detail-mode > .task-drawer-head { display:grid; grid-template-columns:minmax(0,var(--task-pane-width)) minmax(0,1fr) auto auto; align-items:center; gap:0; padding:0; background:var(--surface); }
html:root #task-drawer.detail-mode .task-head-title { grid-column:1; grid-row:1; align-self:stretch; display:flex; flex-direction:column; justify-content:center; padding:14px 18px; border-right:1px solid var(--border); background:color-mix(in srgb,var(--surface) 55%,var(--accent-soft)); }
html:root #task-drawer.detail-mode .task-head-title > .eyebrow { display:none; }
html:root #task-drawer.detail-mode .task-head-title h2 { font-size:1.1rem; line-height:1.4; font-weight:650; }
html:root #task-drawer .task-stream-heading { display:none; }
html:root #task-drawer.detail-mode .task-stream-heading { grid-column:2; grid-row:1; display:flex; align-items:center; gap:10px; padding:12px 16px; border:0; background:transparent; backdrop-filter:none; }
html:root #task-drawer.detail-mode .task-stream-heading h3 { font-size:1rem; font-weight:600; }
.task-chat-symbol { display:grid; place-items:center; flex:0 0 40px; width:40px; height:40px; border-radius:50%; color:var(--accent); background:var(--accent-soft); }
.task-chat-symbol svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
html:root #task-drawer.detail-mode .task-head-actions { grid-column:3; grid-row:1; gap:2px; padding:0 6px; }
html:root #task-drawer.detail-mode .window-controls { grid-column:4; grid-row:1; margin:0 12px 0 0; }
html:root[data-theme="macos"] #task-drawer.detail-mode .task-head-title { padding-left:128px; }
html:root[data-theme="macos"] #task-drawer.detail-mode .window-controls { grid-column:1; grid-row:1; justify-self:start; align-self:start; margin:16px 0 0 10px; }
html:root #task-drawer.detail-mode .task-drawer-body { display:flex; flex:1; min-height:0; overflow:hidden; }
html:root #task-drawer.detail-mode #task-detail { display:flex; flex:1; flex-direction:column; min-height:0; min-width:0; height:auto; }
html:root #task-drawer.detail-mode .task-detail-layout { flex:1; min-height:0; height:auto; grid-template-columns:minmax(0,var(--task-pane-width)) minmax(0,1fr); }
html:root #task-drawer.detail-mode .task-detail-main { display:flex; flex-direction:column; background:color-mix(in srgb,var(--surface) 55%,var(--accent-soft)); background-image:none; border-color:var(--border); }
html:root #task-drawer.detail-mode .task-detail-scroll { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; padding:4px 16px 16px; gap:10px; }
html:root #task-drawer.detail-mode .task-info-card { padding:14px 16px; border:1px solid var(--border); border-radius:10px; background:var(--surface); backdrop-filter:none; }
html:root #task-drawer.detail-mode .task-checklist-card.is-empty { padding-block:12px; }
html:root #task-drawer.detail-mode .task-description-card { display:flex; flex-direction:column; }
html:root #task-drawer.detail-mode .task-description-card > .task-card-heading { order:2; margin-top:12px; padding-top:6px; border-top:1px solid var(--border); }
html:root #task-drawer.detail-mode #task-description-heading { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
html:root #task-drawer.detail-mode #task-detail-description { margin:0; font-size:.875rem; line-height:1.65; font-weight:400; overflow-wrap:anywhere; }
html:root #task-drawer :is(#task-description,#task-inline-description,#task-detail-description,#task-comment,.task-message-edit textarea) { text-align:justify;text-justify:inter-word; }
html:root #task-drawer.detail-mode #task-edit-description { display:inline-flex; align-items:center; gap:7px; width:auto; padding:5px 0; min-height:32px; font-size:.85rem; font-weight:500; }
html:root #task-drawer.detail-mode .task-detail-fields { grid-template-columns:112px minmax(0,1fr); align-items:start; gap:10px 12px; margin:12px 0 0; font-size:.82rem; line-height:1.5; }
html:root #task-drawer.detail-mode .task-detail-fields dt { padding-top:3px; }
html:root #task-drawer.detail-mode .task-people-labels { display:grid; gap:8px; max-height:224px; overflow-y:auto; overscroll-behavior:contain; }
html:root #task-drawer.detail-mode .task-detail-fields dd { font-weight:400; min-width:0; }
html:root #task-drawer.detail-mode .task-people-card .task-detail-fields { margin:0; }
html:root #task-drawer.detail-mode .task-detail-fields .person-avatar { width:28px; height:28px; flex-basis:28px; }
html:root #task-drawer.detail-mode #task-detail-status { display:inline-block; margin:0; padding:4px 10px; border-radius:8px; background:var(--accent-soft); color:var(--accent); font-size:.8rem; font-weight:500; }
html:root #task-drawer.detail-mode .task-work-footer { display:flex; align-items:center; flex:0 0 auto; gap:8px; min-height:58px; padding:8px 16px; border-top:1px solid var(--border); background:var(--surface); }
html:root #task-drawer.detail-mode #task-detail-actions { display:flex; flex:1; align-items:center; gap:8px; padding:0; border:0; position:static; background:transparent; backdrop-filter:none; }
html:root #task-drawer.detail-mode .task-primary-actions { gap:8px; }
html:root #task-drawer.detail-mode .task-primary-actions button { flex:0 0 auto; min-height:36px; padding:7px 10px; font-size:.82rem; font-weight:500; }
html:root #task-drawer.detail-mode #task-complete { background:var(--surface); border:1px solid var(--border); color:var(--text-primary); }
.task-status-menu { position:relative;flex:0 0 auto;margin-left:auto; }
html:root #task-drawer.detail-mode .task-status-menu > summary { display:grid; place-items:center; width:32px; min-height:36px; padding:0; border:0; border-radius:8px; list-style:none; cursor:pointer; color:var(--text-secondary); font-size:1.2rem; }
.task-status-menu > summary::-webkit-details-marker { display:none; }
html:root #task-drawer.detail-mode .task-status-menu > summary:is(:hover,:focus-visible),html:root #task-drawer.detail-mode .task-status-menu[open] > summary { background:var(--accent-soft); color:var(--accent); }
html:root #task-drawer.detail-mode .task-status-control,html:root .task-status-control[data-crm-popover-open] { position:fixed;inset:auto;margin:0;z-index:8;box-sizing:border-box;width:min(250px,calc(100vw - 24px));padding:10px;border:1px solid var(--border);border-radius:12px;background:var(--surface);color:var(--text-primary);box-shadow:var(--shadow-dropdown); }
html:root #task-drawer.detail-mode .task-status-control[popover]:not(:popover-open):not([data-crm-popover-open]) { display:none; }
html:root[data-crm-popover-fallback] .task-status-control[data-crm-popover-open]:not([hidden]) { display:grid!important; }
html:root #task-drawer.detail-mode #task-view-receipt { margin:0 0 0 auto; flex:0 0 auto; }
html:root #task-drawer.detail-mode #task-view-receipt .view-receipt { padding:4px 0; min-height:32px; font-size:.75rem; }
html:root #task-drawer.detail-mode .task-detail-stream { min-height:0; background:var(--theme-stream); }
html:root #task-drawer.detail-mode #task-activity { display:flex; flex:1; min-height:0; max-height:none; overflow:auto; overscroll-behavior:contain; padding:16px 18px 18px 62px; gap:10px; }
html:root #task-drawer.detail-mode #task-activity .task-activity-event { padding:8px 12px 5px; border-radius:11px 11px 11px 4px; border-color:color-mix(in srgb,var(--border) 60%,transparent); background:var(--surface); box-shadow:0 1px 3px #00000006; }
html:root #task-drawer.detail-mode #task-activity .task-activity-event.own { background:color-mix(in srgb,var(--surface) 92%,var(--accent-soft)); }
html:root #task-drawer.detail-mode #task-activity .task-activity-event.is-editing { padding:8px; }
html:root #task-drawer.detail-mode #task-activity .message-inline-editor { padding:8px; }
html:root #task-drawer.detail-mode #task-activity .message-inline-editor .message-composer-input { min-height:120px; max-height:320px; }
html:root #task-drawer.detail-mode #task-activity .task-activity-event > p { font-size:.875rem; line-height:1.5;text-align:left; }
html:root #task-drawer.detail-mode #task-activity .news-quote { text-align:left; }
html:root #task-drawer.detail-mode #task-activity .task-event-actor strong { font-size:.78rem; }
html:root #task-drawer.detail-mode #task-activity .task-message-avatar { left:-42px; }
html:root #task-drawer.detail-mode #task-activity .task-message-avatar .person-avatar { width:32px;height:32px;flex-basis:32px; }
html:root #task-drawer.detail-mode #task-activity .task-message-footer { min-height:36px;gap:2px 0; }
html:root #task-drawer.detail-mode #task-activity button.task-message-action { width:36px;min-width:36px;height:36px;min-height:36px;border-radius:6px; }
/* History stays readable without looking like another chat message. */
html:root #task-drawer.detail-mode #task-activity .task-activity-event.system { align-self:stretch;max-width:100%;min-width:0;padding:5px 10px;border:0;border-left:2px solid var(--border);border-radius:0;background:transparent;box-shadow:none;color:var(--text-secondary); }
html:root #task-drawer.detail-mode #task-activity .system .task-event-actor { display:flex;align-items:baseline;flex-wrap:wrap;gap:2px 10px;margin:0; }
html:root #task-drawer.detail-mode #task-activity .system .task-event-actor strong { flex:1;font-size:.74rem;line-height:1.5;font-weight:400; }
html:root #task-drawer.detail-mode #task-activity .system time { margin:0;font-size:.68rem;white-space:nowrap; }
html:root #task-drawer.detail-mode #task-activity .system > p { margin:2px 0 0;font-size:.73rem;line-height:1.45; }
html:root #task-drawer.detail-mode #task-activity .system > p:empty { display:none; }
html:root #task-drawer.detail-mode #task-comment-form { flex:0 0 auto; max-height:48%; margin:0 14px 14px; padding:8px 12px; border-radius:12px; background:var(--surface); backdrop-filter:none; }
html:root #task-drawer.detail-mode .task-inline-form { margin-top:10px;padding-top:10px; }
html:root #task-drawer.detail-mode .task-inline-form :is(input:not([type="checkbox"]),select,textarea) { font-size:.82rem;padding:7px 9px;border-radius:7px; }
html:root #task-drawer.detail-mode .task-inline-actions button,html:root #task-drawer.detail-mode #task-inline-add-check { min-height:34px;padding:6px 10px;font-size:.8rem; }
.task-workspace-tabs { display:none; }
html:root #task-fields-edit .task-participants-card { min-width:0; margin:14px 0; padding:8px 12px; border:1px solid var(--workspace-divider); border-radius:10px; }
html:root #task-fields-edit .task-participant-row { grid-template-columns:112px minmax(0,1fr) 36px; min-height:48px; gap:8px; }
html:root #task-fields-edit .task-participant-label { font-size:.8125rem; }
html:root #task-fields-edit .task-person-chip-name { font-size:.8125rem; }
html:root #task-fields-edit .task-person-chip-name .person-avatar { width:28px; height:28px; flex-basis:28px; }
html:root #task-fields-edit .task-participants-status:has(#task-inline-people-state:empty) { display:none; }
html:root #task-fields-edit #task-inline-people-state { margin:8px 0; }
@media(pointer:coarse) and (min-width:701px) {
  html:root :is(#task-form,#task-fields-edit) .task-participant-row { grid-template-columns:112px minmax(0,1fr) 44px; }
}
@media(max-width:700px) {
  html:root #task-fields-edit .task-participants-card { padding:8px 10px; }
  html:root #task-fields-edit .task-participant-row { grid-template-columns:minmax(0,1fr) 44px; gap:4px 8px; }
  html:root #task-fields-edit .task-participant-add { width:44px; min-width:44px; height:44px; min-height:44px; }
}
@media(max-width:900px) {
  html:root #task-drawer.detail-mode { --window-height-limit:calc(100dvh - 24px); }
  html:root #task-drawer.detail-mode > .task-drawer-head { grid-template-columns:minmax(0,1fr) auto; gap:8px; padding:14px 16px 10px; }
  html:root #task-drawer.detail-mode .task-head-title { grid-column:1 / -1; padding:0; border:0; background:transparent; }
  html:root #task-drawer.detail-mode .task-head-title h2 { font-size:1.125rem; }
  html:root #task-drawer.detail-mode .task-head-actions { grid-column:1; grid-row:2; justify-self:start; padding:0; }
  html:root #task-drawer.detail-mode .window-controls { grid-column:2; grid-row:2; margin:0; }
  html:root #task-drawer.detail-mode .task-stream-heading { display:none; }
  html:root[data-theme="macos"] #task-drawer.detail-mode .task-head-title { padding-left:0; }
  html:root[data-theme="macos"] #task-drawer.detail-mode .window-controls { grid-column:1; grid-row:2; margin:0; align-self:center; }
  html:root[data-theme="macos"] #task-drawer.detail-mode .task-head-actions { grid-column:2; justify-self:end; }
  html:root #task-drawer.detail-mode .task-workspace-tabs { display:flex; flex:0 0 auto; gap:6px; padding:8px 12px; background:var(--surface); border-bottom:1px solid var(--border); }
  html:root #task-drawer.detail-mode .task-workspace-tabs button { flex:1; min-height:44px; margin:0; padding:8px; border:0; background:transparent; color:var(--text-secondary); box-shadow:none; }
  html:root #task-drawer.detail-mode .task-workspace-tabs button[aria-pressed="true"] { background:var(--accent-soft); color:var(--accent); }
  html:root #task-drawer.detail-mode .task-detail-layout { display:flex; min-height:0; }
  html:root #task-drawer.detail-mode :is(.task-detail-main,.task-detail-stream) { flex:1; min-width:0; border:0; }
  html:root #task-drawer.detail-mode #task-detail[data-pane="details"] .task-detail-stream,html:root #task-drawer.detail-mode #task-detail[data-pane="discussion"] .task-detail-main { display:none; }
  html:root #task-drawer.detail-mode .task-detail-scroll { padding:12px; }
  html:root #task-drawer.detail-mode .task-info-card { padding:12px 14px; }
  html:root #task-drawer.detail-mode .task-detail-fields { grid-template-columns:100px minmax(0,1fr); gap:10px; font-size:.8125rem; }
  html:root #task-drawer.detail-mode .task-work-footer { min-height:68px; padding:10px 12px; }
  html:root #task-drawer.detail-mode .task-primary-actions button { min-height:44px;padding:8px 10px; font-size:.8125rem; }
  html:root #task-drawer.detail-mode .task-primary-actions svg { display:none; }
  html:root #task-drawer.detail-mode #task-activity { padding:16px 14px 20px 55px; }
  html:root #task-drawer.detail-mode #task-activity .task-activity-event:not(.system):not(.is-editing) { padding:8px 10px 4px; }
  html:root #task-drawer.detail-mode #task-comment-form { margin:0 12px 12px; padding:10px 12px; }
}
@media(max-width:700px),(pointer:coarse) {
  html:root #task-drawer.detail-mode :is(.task-primary-actions button,.task-status-menu>summary,.task-inline-actions button,#task-inline-add-check) { min-height:44px; }
  html:root #task-drawer.detail-mode #task-activity button.task-message-action { width:44px;min-width:44px;height:44px;min-height:44px; }
}
