.workspace.tasks-mode { display: block; }
.workspace.tasks-mode .sidebar, .workspace.tasks-mode .dialogs-header, .workspace.tasks-mode .chat-panel { display: none; }
.workspace.tasks-mode #tasks-panel { display: grid; }
.crm-tasks { color: var(--text); width: 100%; max-width: 1280px; margin: auto; padding: clamp(16px, 3vw, 32px); }
.task-dialog { position: fixed; width: min(800px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto; padding: clamp(18px, 4vw, 30px); border: 1px solid var(--line); border-radius: 22px; background: var(--sidebar); color: var(--text); box-shadow: var(--shadow); }
.task-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.task-dialog [hidden], .crm-tasks [hidden] { display: none !important; }
.task-topline, .task-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.task-topline { justify-content: space-between; margin-bottom: 22px; }
.task-topline h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); overflow-wrap: anywhere; min-width: 0; flex: 1; }
.crm-tasks .task-button, .task-dialog .task-button { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; text-decoration: none; }
.crm-tasks .task-button:hover, .task-dialog .task-button:hover { border-color: var(--accent); background: var(--surface-3); }
.crm-tasks .task-button.primary, .task-dialog .task-button.primary, .crm-tasks .task-button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.task-button:disabled { opacity: .55; cursor: wait; }
.task-button:focus-visible, .task-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.task-hint, .task-meta { color: var(--muted); font-size: 13px; line-height: 1.6; }
.task-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.task-filters input { flex: 1 1 220px; }
.task-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.crm-tasks .task-card { display: grid; gap: 12px; min-width: 0; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 18px; padding: 20px; cursor: pointer; }
.task-card:hover { border-color: var(--accent); }
.task-card strong { font-size: 18px; overflow-wrap: anywhere; }
.task-card p { margin: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.task-badge { width: fit-content; font-size: 12px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 20px; color: var(--text); }
.task-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.task-message-count { flex-shrink: 0; border-radius: 20px; padding: 5px 10px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.task-message-count[hidden] { display: none; }
.task-overdue { color: var(--danger); }
.task-empty { border: 1px dashed var(--line); border-radius: 18px; padding: 32px; color: var(--muted); grid-column: 1 / -1; line-height: 1.6; }
.task-form { display: grid; gap: 18px; }
.task-form label, .task-compose label { display: grid; gap: 8px; font-size: 14px; color: var(--text); }
.crm-tasks input, .task-dialog input:not([type="checkbox"]), .task-dialog select, .task-dialog textarea { width: 100%; min-width: 0; min-height: 44px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
.task-dialog textarea { resize: vertical; line-height: 1.6; }
.task-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; align-items: start; }
.task-form-grid [data-clear-due] { margin-top: 8px; }
.task-access { border: 1px solid var(--line); border-radius: 14px; padding: 15px; background: var(--surface-2); }
.task-access legend { padding: 0 5px; font-weight: 650; }
.task-people { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 12px; max-height: 200px; overflow: auto; }
.task-people label { display: flex; align-items: center; gap: 8px; min-height: 36px; overflow-wrap: anywhere; }
.task-people input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.task-error { color: var(--danger); font-size: 14px; line-height: 1.6; }
.task-description, .task-message p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.7; }
.task-detail-meta { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 16px; margin: 18px 0; }
.task-files { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0; }
.task-file { display: grid; align-content: start; gap: 7px; max-width: 240px; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px; overflow-wrap: anywhere; font-size: 13px; }
.task-file img, .task-file video { width: 100%; max-height: 200px; object-fit: contain; border-radius: 8px; }
.task-file a { color: var(--accent); overflow-wrap: anywhere; }
.task-chat { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
.task-message { background: var(--surface-2); border: 1px solid var(--line); padding: 14px; border-radius: 14px; margin: 12px 0; }
.task-message p { margin: 10px 0 0; }
.task-compose { display: grid; gap: 12px; margin: 18px 0; }
.task-history { font-size: 12px; color: var(--muted); line-height: 1.8; }
@media (max-width: 650px) { .task-grid, .task-form-grid, .task-people { grid-template-columns: 1fr; } .task-file { max-width: 100%; } .task-dialog { max-height: calc(100dvh - 20px); } }
