/* Compact task writing with the shared participant picker. */
html:root #task-drawer.form-mode { --window-normal-height:620px; width: min(1180px, calc(100vw - 40px)); }
html:root #task-drawer.form-mode .task-drawer-head { padding: 14px 20px; }
html:root #task-drawer.form-mode .task-head-title h2 { font-size:1.1rem;line-height:1.4; }
html:root #task-drawer.form-mode .task-head-title > .eyebrow { display: none; }
html:root #task-form .task-form-layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; padding: 16px 20px 20px; align-content: start; background: color-mix(in srgb, var(--surface) 65%, var(--accent-soft)); }
html:root #task-form :is(.task-form-main,.task-form-side) { min-width: 0; padding: 0; border: 0; background: transparent; }
html:root #task-form .task-form-side { align-self: start; }
html:root #task-form .task-form-main { display: grid; align-content: start; gap: 12px; }
.task-field-label-hidden { position: absolute; width: 1px; height: 1px; padding: 0 !important; margin: -1px !important; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
html:root #task-form #task-title { margin: 0; padding: 7px 10px; min-height: 42px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-primary); font-size: 1.05rem; font-weight: 600; line-height: 1.4; }
html:root #task-form #task-title::placeholder { font-weight: 500; color: var(--text-secondary); }
html:root #task-form #task-title:focus { outline: 1px solid var(--input-focus); outline-offset: 3px; }
html:root #task-form .task-composer-card { min-width: 0; margin: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: none; }
html:root #task-form .task-description-editor { padding: 14px 16px 8px; }
html:root #task-form #task-description { display: block; width: 100%; min-height: 132px; margin: 0; padding: 0 0 10px; resize: vertical; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: 0; font-size: .9rem; line-height: 1.6; }
html:root #task-form .task-description-editor:focus-within { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.task-description-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; padding: 10px 0 0; border-top: 1px solid var(--border); }
html:root #task-form .task-composer-tool { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; margin: 0; padding: 6px 0; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font-size: .88rem; font-weight: 500; box-shadow: none; }
html:root #task-form .task-composer-tool:hover { background: var(--surface-hover); }
.task-composer-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.task-description-hint { margin-left: auto; color: var(--text-secondary); font-size: .76rem; }
html:root #task-form #task-check-inputs:empty { display: none; }
html:root #task-form #task-check-inputs { margin-top: 10px; }
html:root #task-form .task-participants-card { padding: 6px 16px; }
html:root #task-form .task-participant-row { grid-template-columns:124px minmax(0,1fr) 32px;min-height:44px;padding:6px 0;gap:8px; }
html:root #task-form .task-participant-label { min-height:32px;padding:6px 0;font-size:.82rem; }
html:root #task-form .task-person-chip-name { min-height:32px;padding:2px 5px;font-size:.82rem; }
html:root #task-form .task-person-chip-avatar { width:28px;height:28px;flex-basis:28px; }
html:root #task-form .task-person-empty { min-height:32px;padding:4px 5px;font-size:.8rem; }
html:root #task-form .task-participant-add { width:32px;min-width:32px;height:32px;min-height:32px;font-size:1.25rem; }
.task-participant-row { display: grid; grid-template-columns: 145px minmax(0, 1fr) 36px; align-items: start; gap: 12px; min-height: 52px; }
.task-participant-label { color: var(--text-secondary); font-size: .9rem; }
.task-participants-card .task-participant-row { padding: 10px 0; }
.task-participants-card .task-participant-row + .task-participant-row { border-top: 1px solid var(--workspace-divider); }
.task-participants-card .task-participant-label { display: flex; align-items: center; min-height: 36px; margin: 0; padding: 7px 0; line-height: 1.4; font-weight: 600; color: var(--text-primary); }
.task-participant-selection { display: flex; align-items: flex-start; align-content: flex-start; flex-wrap: wrap; gap: 6px; min-width: 0; padding: 0; }
[data-people-multiple="true"] .task-participant-selection { max-height: 224px; overflow-y: auto; overscroll-behavior: contain; }
.task-participant-add { align-self: start; }
.task-person-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; min-width: 0; border-radius: 7px; background: var(--accent-soft); color: var(--text-primary); }
html:root .task-person-chip-name { display: inline-flex; align-items: center; flex: 1 1 auto; gap: 7px; min-width: 0; max-width: 100%; margin: 0; padding: 4px 7px; min-height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--text-primary); font: inherit; font-size: .9rem; font-weight: 500; line-height: 1.4; text-align: left; white-space: normal; box-shadow: none; }
html:root button.task-person-chip-name:hover:not(:disabled) { background: var(--surface-hover); }
.task-person-chip-name .person-name-text { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.task-participant-row:has(select) .task-person-chip { background: transparent; }
html:root .task-person-chip-name:disabled { opacity: 1; cursor: default; }
html:root .task-person-chip-remove { display: inline-grid; place-items: center; flex: 0 0 28px; width: 28px; min-width: 28px; min-height: 32px; margin: 0; padding: 0; border: 0; background: transparent; color: var(--text-secondary); font-size: 1.2rem; line-height: 1; box-shadow: none; }
html:root .task-person-chip-remove:hover:not(:disabled) { color: var(--accent); background: var(--surface-hover); }
.task-person-empty { color: var(--text-secondary); font-size: .86rem; }
.task-participants-card .task-person-empty { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 7px; }
html:root :is(#task-form,#task-fields-edit) .task-participant-add { display: inline-grid; place-items: center; width: 36px; min-width: 36px; height: 36px; min-height: 36px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 1.4rem; font-weight: 400; line-height: 1; box-shadow: none; }
html:root :is(#task-form,#task-fields-edit) .task-participant-add:is(:hover,:focus-visible,[aria-expanded="true"]):not(:disabled) { background: var(--surface-active); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.task-participants-status { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.task-participants-status:has(#task-people-state:empty) { display: none; }
html:root #task-form #task-people-state { margin: 8px 0 0; }
html:root #task-form .task-options-card { padding: 16px; }
html:root #task-form .task-options-card h3 { margin: 0 0 12px; color: var(--text-primary); font-size: .9rem; font-weight: 650; }
html:root #task-form .task-options-card label { margin: 12px 0 6px; color: var(--text-secondary); font-size: .8rem; font-weight: 500; }
html:root #task-form .task-options-card input, html:root #task-form .task-options-card select { margin: 0; min-width: 0; width: 100%; min-height: 36px; padding:7px 10px; font-size: .82rem; }
html:root #task-form .task-options-card p { margin: 12px 0 0; line-height: 1.5; font-size: .76rem; }
html:root #task-form .task-form-footer { padding: 10px 20px; }
html:root #task-form .task-drawer-actions button { min-height:36px;padding:7px 12px;font-size:.84rem; }

/* Native popover layer keeps the employee list above the window, without clipping. */
html:root .task-person-picker { position: fixed; inset: auto; display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text-primary); text-align: left; font-size: .9rem; line-height: 1.45; box-shadow: var(--shadow-dropdown); }
html:root .task-person-picker:not(:popover-open) { display: none; }
.task-person-picker-header { flex: 0 0 auto; display: grid; gap: 6px; padding: 16px 16px 12px; }
.task-person-picker-title { margin: 0; color: var(--text-primary); font-size: .95rem; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.task-person-picker-hint { margin: 0; color: var(--text-secondary); font-size: .78rem; line-height: 1.45; overflow-wrap: anywhere; }
.task-person-searchbar { flex: 0 0 auto; display: grid; gap: 6px; margin: 0 16px 10px; padding: 5px 7px; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 10px; }
.task-person-searchbar:focus-within { border-color: var(--accent); }
.task-person-search-chips { display:flex; flex-wrap:wrap; gap:6px; max-height:72px; overflow-y:auto; scrollbar-width:thin; }
.task-person-search-chips:empty { display:none; }
html:root .task-person-searchbar .task-person-chip { max-width: min(100%, 260px); }
html:root .task-person-searchbar .task-person-chip-avatar { width: 24px; height: 24px; flex: 0 0 24px; font-size: .75rem; }
html:root .task-person-searchbar .task-person-chip-name { min-height: 30px; padding: 2px 5px; font-size: .84rem; }
/* The search bar supplies its frame; theme/window field rules must not draw a second one. */
html:root .task-person-searchbar input { min-width: 0; width: 100%; min-height: 32px; padding: 4px; margin: 0; border: 0 !important; border-radius: 4px; background: transparent !important; outline: none !important; box-shadow: none !important; font-size: .9rem; }
.task-person-options { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 10px; scrollbar-width: thin; }
html:root .task-person-option { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; margin: 0; padding: 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text-primary); text-align: left; box-shadow: none; font-size: .9rem; font-weight: 450; }
html:root .task-person-option:is(:hover,[data-active="true"]) { background: var(--surface-hover); }
html:root .task-person-option[aria-selected="true"] { background: var(--accent-soft); }
html:root .task-person-option .task-person-option-avatar { width: 36px; height: 36px; flex: 0 0 36px; font-size: .8rem; }
.task-person-option-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.task-person-option-info .person-name-text { white-space: normal; overflow-wrap: anywhere; }
.task-person-option-detail { color: var(--text-secondary); font-size: .77rem; line-height: 1.35; overflow-wrap: anywhere; }
.task-person-selected-mark { color: var(--accent); flex: 0 0 20px; font-size: 1rem; opacity: 0; }
[aria-selected="true"] > .task-person-selected-mark { opacity: 1; }
.task-person-no-results { padding: 25px 12px; margin: 0; color: var(--text-secondary); font-size: .9rem; text-align: center; }
.task-person-picker-footer { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--accent-soft); }
.task-person-picker-count { min-width: 0; flex: 1; color: var(--text-secondary); font-size: .78rem; }
html:root .task-person-picker-done { padding: 7px 14px; min-height: 36px; margin: 0; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--accent); font-size: .86rem; font-weight: 600; box-shadow: none; }
/* visualViewport also shrinks when a phone's on-screen keyboard opens. */
.task-person-picker[data-compact="true"] .task-person-picker-header { padding: 10px 12px 8px; gap: 0; }
.task-person-picker[data-compact="true"] .task-person-picker-hint { display: none; }
.task-person-picker[data-compact="true"] .task-person-searchbar { margin: 0 12px 8px; }
.task-person-picker[data-compact="true"] .task-person-search-chips { max-height: 36px; }
.task-person-picker[data-compact="true"] .task-person-search-chips .person-name-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-person-picker[data-compact="true"] .task-person-picker-footer { padding-inline: 12px; }
@media (max-width: 1000px) {
  html:root #task-form .task-form-layout { grid-template-columns: 1fr; gap: 18px; }
  html:root #task-form .task-options-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
  html:root #task-form .task-options-card h3 { grid-column: 1 / -1; margin-bottom: 4px; }
  html:root #task-form .task-options-card label { margin: 4px 0 0; }
  html:root #task-form .task-options-card label[for="task-project"] { grid-column: 2; grid-row: 2; }
  html:root #task-form #task-project { grid-column: 2; grid-row: 3; }
  html:root #task-form .task-options-card p { grid-column: 1 / -1; margin-top: 4px; }
}
@media (max-width: 700px) {
  html:root #task-drawer.form-mode { width: calc(100vw - 16px); }
  html:root #task-drawer.form-mode .task-drawer-head { padding: 12px 16px; }
  html:root #task-form .task-form-layout { padding: 16px 14px 22px; gap: 16px; }
  html:root #task-form .task-form-main { gap: 12px; }
  html:root #task-form .task-description-editor { padding: 12px 14px 8px; }
  html:root #task-form #task-description { min-height: 120px; }
  .task-description-hint { margin-left: 0; font-size: .7rem; }
  html:root #task-form .task-participants-card { padding: 4px 14px; }
  html:root #task-form .task-participant-row { grid-template-columns:minmax(0,1fr) 44px;gap:2px 8px; }
  html:root #task-form .task-participant-label { min-height:28px;padding:3px 0; }
  .task-participant-row { grid-template-columns: minmax(0, 1fr) 40px; gap: 4px 8px; padding: 7px 0; }
  .task-participant-label { grid-column: 1; font-size: .8rem; }
  .task-participants-card .task-participant-label { min-height: 40px; padding: 8px 0; }
  .task-participant-selection { grid-column: 1; grid-row: 2; padding: 2px 0; }
  html:root :is(#task-form,#task-fields-edit) .task-participant-add { grid-column: 2; grid-row: 1 / 3; width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
  html:root #task-form .task-options-card { display: block; padding: 14px; }
  html:root #task-form .task-options-card label { margin: 12px 0 6px; }
  html:root #task-form :is(.task-drawer-actions button,.task-options-card input,.task-options-card select,.task-participant-add) { min-height:44px; }
  html:root #task-form .task-form-footer { padding: 12px 14px; }
  html:root .task-person-picker { border-radius: 14px; }
  .task-person-picker-header { padding: 14px 12px 10px; }
  .task-person-searchbar { margin: 0 12px 8px; }
  html:root .task-person-option { min-height: 56px; }
  html:root .task-person-chip-remove { min-height: 36px; }
}
@media (pointer: coarse) {
  html:root #task-form :is(.task-drawer-actions button,.task-options-card input,.task-options-card select) { min-height:44px; }
  html:root :is(#task-form,#task-fields-edit) .task-participant-add { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  html:root .task-person-chip-name, html:root .task-person-chip-remove { min-height: 44px; }
  html:root .task-person-chip-remove { min-width: 36px; }
  html:root .task-person-picker-done { min-height: 44px; }
}
@media (pointer: coarse) and (min-width: 701px) { .task-participant-row { grid-template-columns: 145px minmax(0, 1fr) 44px; } }
@media (pointer: coarse) and (max-width: 700px) { .task-participant-row { grid-template-columns: minmax(0, 1fr) 44px; } }

/* Keep selection/search/results stationary during repeated choices. */
.task-person-picker[data-keep-selection="true"] .task-person-search-chips {
  display:flex; height:64px; min-height:64px; max-height:64px;
  align-content:flex-start; scrollbar-gutter:stable; overflow-anchor:none;
}
.task-person-picker[data-keep-selection="true"] .task-person-search-chips:empty::before {
  content:'Пока никто не выбран'; color:var(--text-secondary); font-size:.8rem; padding:5px;
}
.task-person-options { scrollbar-gutter:stable; overflow-anchor:none; scroll-behavior:auto; }
.task-person-picker[data-compact="true"][data-keep-selection="true"] .task-person-search-chips {
  height:36px; min-height:36px; max-height:36px;
}
