/* ============ PRIORITIES / KANBAN ============ */
.priorities-view {
  padding: 16px 24px 60px;
  min-height: 400px;
}

.priorities-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.priorities-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.priorities-filters select,
.priorities-filters input[type="text"] {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.priorities-filters input[type="text"] {
  min-width: 180px;
}
.priorities-filters select:focus,
.priorities-filters input[type="text"]:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.12);
}
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
}
.filter-toggle.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.priorities-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.priorities-actions .btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
}

/* Kanban board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  min-height: 300px;
}

.kanban-column {
  background: var(--surface-alt);
  border-radius: var(--radius-lg);
  padding: 12px;
  min-height: 200px;
  transition: background 0.15s;
}
.kanban-column.drag-over {
  background: var(--primary-light);
  outline: 2px dashed var(--primary);
  outline-offset: -4px;
}
.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 4px;
}
.kanban-column-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kanban-column.urgent .kanban-column-title { color: var(--danger); }
.kanban-column.high .kanban-column-title { color: var(--warning); }
.kanban-column.medium .kanban-column-title { color: var(--info); }
.kanban-column.admin .kanban-column-title { color: var(--text-muted); }
.kanban-column-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  padding: 1px 8px;
  border-radius: 10px;
}
.kanban-tasks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.task-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.task-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}
.task-card.done {
  opacity: 0.6;
  background: var(--surface-alt);
}
.task-card.done .task-card-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
  word-break: break-word;
}
.task-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.task-card-badges {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.task-card-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text-muted);
}
.task-card-badge.status-in_progress { background: var(--info-bg); color: var(--info); }
.task-card-badge.status-blocked { background: var(--warning-bg); color: var(--warning); }
.task-card-badge.status-done { background: var(--success-bg); color: var(--success); }
.task-card-badge.patient {
  background: var(--primary-light);
  color: var(--primary);
  cursor: pointer;
}
.task-card-badge.due-overdue { background: var(--danger-bg); color: var(--danger); }
.task-card-badge.due-today { background: var(--warning-bg); color: var(--warning); font-weight: 700; }
.task-card-badge.comments {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.task-card-assignee {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.task-card-assignee.unassigned {
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
}

.kanban-empty {
  padding: 20px 10px;
  text-align: center;
  color: var(--text-light);
  font-size: 11px;
  font-style: italic;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
}

/* List view for tasks */
.tasks-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.tasks-list-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto auto auto;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.tasks-list-row:hover { background: var(--surface-hover); }
.tasks-list-row:last-child { border-bottom: none; }
.tasks-list-row.done { opacity: 0.5; }
.tasks-list-row.done .tasks-list-title { text-decoration: line-through; }
.tasks-list-priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tasks-list-priority-dot.urgent { background: var(--danger); }
.tasks-list-priority-dot.high { background: var(--warning); }
.tasks-list-priority-dot.medium { background: var(--info); }
.tasks-list-priority-dot.admin { background: var(--text-muted); }
.tasks-list-title {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}

/* Task Modal */
.task-modal-content {
  max-width: 640px;
  padding: 0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.task-modal-header {
  padding: 24px 28px 12px;
  border-bottom: 1px solid var(--border);
}
.task-title-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  padding: 6px 4px;
  background: transparent;
  font-family: inherit;
}
.task-title-input:focus {
  background: var(--surface-alt);
  border-radius: 4px;
}
.task-title-input::placeholder { color: var(--text-light); }
.task-modal-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding-left: 4px;
}
.task-modal-body {
  padding: 20px 28px;
  overflow-y: auto;
  flex: 1;
}
.task-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.task-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.task-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.task-field select,
.task-field input,
.task-field textarea {
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.task-field select:focus,
.task-field input:focus,
.task-field textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.task-field textarea { resize: vertical; min-height: 80px; padding: 10px 12px; }
.task-related-patient {
  padding: 8px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
}

.task-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin: 20px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.task-comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  max-height: 240px;
  overflow-y: auto;
}
.task-comment {
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.task-comment-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.task-comment-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}
.task-comment-time {
  font-size: 10px;
  color: var(--text-muted);
}
.task-comment-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.task-comment-add {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.task-comment-add textarea {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  outline: none;
}
.task-comment-add textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.12);
}
.task-comment-add button { padding: 8px 14px; font-size: 12px; align-self: flex-end; }

.task-modal-footer {
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.task-save-status {
  flex: 1;
  font-size: 11px;
  color: var(--text-muted);
}
.task-save-status.saving { color: var(--info); }
.task-save-status.saved { color: var(--success); }
.task-save-status.error { color: var(--danger); }

/* Responsive Kanban */
@media (max-width: 1100px) {
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .kanban-board { grid-template-columns: 1fr; }
  .task-fields-grid { grid-template-columns: 1fr; }
  .priorities-view { padding: 12px 14px 60px; }
  .tasks-list-row {
    grid-template-columns: 16px 1fr auto auto;
    font-size: 12px;
  }
  .tasks-list-row .tasks-list-hide-mobile { display: none; }
}

/* ============ TASK MODAL TITLE ROW + DONE TOGGLE ============ */
.task-modal-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.task-modal-title-row .task-title-input { flex: 1; }
.task-done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  user-select: none;
  transition: all 0.15s;
  flex-shrink: 0;
}
.task-done-toggle:hover { border-color: var(--primary); }
.task-done-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--success);
}
.task-done-toggle:has(input:checked) {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

/* ============ RICH TEXT EDITOR ============ */
.rich-editor-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s;
}
.rich-editor-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.rich-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.rich-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  transition: all 0.1s;
}
.rich-btn:hover { background: var(--surface); color: var(--text); }
.rich-btn:active { transform: scale(0.95); }
.rich-btn input[type="file"] { display: none; }
.rich-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}
.rich-editor {
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  outline: none;
  font-family: inherit;
}
.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-light);
  pointer-events: none;
}
.rich-editor h3, .rich-editor h4 {
  margin: 8px 0 4px;
  font-weight: 700;
  color: var(--text);
}
.rich-editor h3 { font-size: 15px; }
.rich-editor h4 { font-size: 14px; }
.rich-editor p { margin: 0 0 6px; }
.rich-editor ul, .rich-editor ol { margin: 4px 0 6px; padding-left: 22px; }
.rich-editor li { margin: 2px 0; }
.rich-editor a { color: var(--primary); text-decoration: underline; }
.rich-editor img { max-width: 100%; height: auto; border-radius: 6px; margin: 4px 0; display: block; }
.rich-editor b, .rich-editor strong { font-weight: 700; }

/* Task card - top row with title + done checkbox */
.task-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.task-card-top .task-card-title { flex: 1; margin-bottom: 0; }
.task-card-check {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--success);
}

/* Description in card - keep it clean */
.task-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

