/* ==========================================================================
   COMPONENTES — TO-DO DIAMANTE
   Cards de Tarefas, Chips de Sintaxe NLP, Modal de Entrada Rápida,
   Drawer de Detalhes e Ações em Lote
   ========================================================================== */

/* Cabeçalho de Visão */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.view-title-group {
  min-width: 0;
}

.view-title-group h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.view-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Banner de Tarefas Atrasadas com Reagendamento em Lote */
.overdue-banner {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.overdue-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--p1-color);
  font-weight: 600;
  font-size: 0.95rem;
}

.overdue-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Botões Reutilizáveis */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  min-height: 38px;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 6px var(--accent-glow);
}
.btn-primary:hover {
  background-color: var(--accent-primary-hover);
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--p1-color);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  min-height: 30px;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* Lista e Grupos de Tarefas */
.task-group {
  margin-bottom: 2rem;
}

.group-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.group-title.overdue-title {
  color: var(--p1-color);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Card de Tarefa Todoist-Style */
.task-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  cursor: pointer;
}

.task-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.task-card.completed {
  opacity: 0.6;
  background-color: var(--bg-surface-elevated);
}

.task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Botão de Checkbox Circular Todoist */
.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--p4-color);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition-fast);
  padding: 0;
}

.task-checkbox:hover {
  background-color: rgba(99, 102, 241, 0.15);
  transform: scale(1.1);
}

.task-checkbox.p1 { border-color: var(--p1-color); }
.task-checkbox.p2 { border-color: var(--p2-color); }
.task-checkbox.p3 { border-color: var(--p3-color); }
.task-checkbox.p4 { border-color: var(--p4-color); }

.task-checkbox.checked {
  background-color: var(--accent-emerald) !important;
  border-color: var(--accent-emerald) !important;
  color: white;
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.task-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.task-description {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Metadados da Tarefa */
.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.55rem;
  font-size: 0.775rem;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 500;
}

.meta-chip.date-chip.overdue {
  color: var(--p1-color);
  background-color: rgba(239, 68, 68, 0.12);
  font-weight: 600;
}

.meta-chip.date-chip.today {
  color: var(--accent-emerald);
  background-color: rgba(16, 185, 129, 0.12);
  font-weight: 600;
}

.meta-chip.recurrence-chip {
  color: var(--accent-cyan);
  background-color: rgba(6, 182, 212, 0.12);
}

.meta-chip.project-chip {
  color: var(--accent-primary);
  background-color: var(--accent-glow);
}

.meta-chip.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 0.1rem 0.42rem;
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  transition: opacity var(--transition-fast), filter var(--transition-fast);
}

.meta-chip.label-chip:hover {
  opacity: 0.85;
  filter: brightness(0.92);
}

.meta-chip.label-chip i {
  flex-shrink: 0;
}

.assignee-avatar-sm {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  margin-left: auto;
}

.delegation-badge {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-left: 0.2rem;
}

.delegation-badge-out {
  color: var(--accent-amber, #f59e0b);
}

.delegation-badge-in {
  color: var(--accent-primary, #4f46e5);
}

/* Botão Adicionar Tarefa Inline */
.btn-inline-add {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  border: 1px dashed var(--border-color);
  width: 100%;
  margin-top: 0.5rem;
  transition: all var(--transition-fast);
}

.btn-inline-add:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background-color: var(--accent-glow);
}

/* ==========================================================================
   MODAL DE ENTRADA RÁPIDA (TODOIST NATURAL LANGUAGE QUICK ADD)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  overflow-y: auto;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.quick-add-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform var(--transition-smooth);
}

.modal-overlay.active .quick-add-card {
  transform: translateY(0);
}

.quick-add-input-wrap {
  padding: 1.25rem 1.25rem 0.5rem;
}

.quick-add-title-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
}

.quick-add-title-input::placeholder {
  color: var(--text-muted);
}

/* Tokens Detectados em Tempo Real (Chips) */
.nlp-tokens-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  min-height: 38px;
}

.nlp-token-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.775rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
}

.nlp-token-badge.token-date { color: var(--accent-emerald); border-color: rgba(16, 185, 129, 0.3); }
.nlp-token-badge.token-priority { color: var(--p1-color); border-color: rgba(239, 68, 68, 0.3); }
.nlp-token-badge.token-project { color: var(--accent-primary); border-color: rgba(99, 102, 241, 0.3); }
.nlp-token-badge.token-label { color: #a855f7; border-color: rgba(168, 85, 247, 0.3); }
.nlp-token-badge.token-recurrence { color: var(--accent-cyan); border-color: rgba(6, 182, 212, 0.3); }
.nlp-token-badge.token-assignee { color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); }

/* Barra de Ações Rápidas do Input */
.quick-add-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-elevated);
}

.toolbar-chips {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* Dica de Atalhos */
.quick-add-shortcuts-hint {
  font-size: 0.725rem;
  color: var(--text-muted);
  padding: 0.4rem 1.25rem;
  background-color: var(--bg-sidebar);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 1rem;
}

/* ==========================================================================
   MODAL DE DETALHES DA TAREFA (ESTILO TODOIST — SPLIT VIEW CENTRALIZADO)
   ========================================================================== */
.task-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.task-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.task-detail-modal {
  background-color: var(--bg-surface);
  border-radius: 16px;
  width: 100%;
  max-width: 860px;
  height: 560px;
  max-height: 88vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.97);
  transition: transform var(--transition-fast);
  border: 1px solid var(--border-subtle);
}

.task-modal-overlay.active .task-detail-modal {
  transform: scale(1);
}

/* Barra Superior de Ações do Modal */
.task-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  flex-shrink: 0;
}

.task-modal-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast);
}

.task-modal-breadcrumb:hover {
  background-color: var(--bg-surface-elevated);
}

.task-modal-actions-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.task-modal-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.task-modal-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

/* Grade de Conteúdo (Coluna Principal + Painel de Propriedades) */
.task-modal-grid {
  display: grid;
  grid-template-columns: 1fr 270px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

@media (max-width: 768px) {
  .task-modal-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
}

/* Coluna Esquerda: Conteúdo Principal */
.task-modal-main {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.task-modal-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.task-modal-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #9ca3af;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 3px;
  transition: all var(--transition-fast);
}

.task-modal-check:hover {
  border-color: var(--accent-primary);
  background-color: rgba(99, 102, 241, 0.1);
}

.task-modal-check.checked {
  background-color: var(--accent-emerald) !important;
  border-color: var(--accent-emerald) !important;
  color: #ffffff;
}

.task-modal-title-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  outline: none;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

/* Tarefa concluída: título riscado e esmaecido, igual ao Todoist */
.task-modal-title-input.is-completed {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.task-modal-title-input:hover,
.task-modal-title-input:focus {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-color);
}

.task-modal-desc-input {
  width: calc(100% - 2.1rem);
  margin-left: 2.1rem;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  outline: none;
  resize: vertical;
  min-height: 70px;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.task-modal-desc-input:hover,
.task-modal-desc-input:focus {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-color);
}

/* Subtarefas */
.task-modal-subtasks-wrap {
  margin-left: 2.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-modal-add-subtask {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color var(--transition-fast);
}

.btn-modal-add-subtask:hover {
  color: var(--accent-primary);
}

/* Área de Comentários */
.task-modal-comments-wrap {
  margin-left: 2.1rem;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.task-modal-comment-input-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.task-modal-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.task-modal-comment-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-surface);
  padding: 0.35rem 0.85rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.task-modal-comment-pill.has-pending-attachment {
  border-radius: 14px;
}

.task-modal-comment-pill:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.task-modal-comment-pill.drag-over {
  border-color: var(--accent-primary);
  border-style: dashed;
  background: var(--accent-glow, rgba(79, 70, 229, 0.08));
}

.task-modal-comment-field-row {
  display: flex;
  align-items: center;
}

.comment-pending-attachments-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.comment-pending-attachment-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.btn-remove-pending-attachment {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  color: var(--p1-color, #ef4444);
  flex-shrink: 0;
}

.comment-pending-attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.comment-pending-actions {
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding-left: calc(26px + 0.65rem);
}

.task-modal-comment-field {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.task-modal-attach-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0 0.2rem;
  transition: color var(--transition-fast);
}

.task-modal-attach-btn:hover {
  color: var(--text-primary);
}

/* Coluna Direita: Painel de Propriedades */
.task-modal-sidebar {
  border-left: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  overflow-y: auto;
}

.task-modal-prop-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.task-modal-prop-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.task-modal-prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-primary);
  padding: 0.3rem 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.task-modal-prop-row:hover {
  background-color: var(--bg-surface-elevated);
}

.task-modal-prop-value {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.task-modal-reminder-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
}

.task-modal-reminder-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-remove-reminder {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  color: var(--text-muted);
  flex-shrink: 0;
}

.btn-remove-reminder:hover {
  color: var(--p1-color, #ef4444);
}

.reminder-picker-divider {
  height: 1px;
  background: var(--border-subtle, #f1f5f9);
  margin: 4px 0;
}

.reminder-picker-presets,
.reminder-picker-custom {
  padding: 6px;
}

.recurrence-picker-popover {
  width: 300px;
}

.task-modal-prop-add-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.task-modal-prop-add-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

/* ==========================================================================
   DRAWER LATERAL DE DETALHES DA TAREFA (LEGADO / FALLBACK)
   ========================================================================== */
.task-detail-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 480px;
  max-width: 100vw;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-modal);
  transform: translateX(100%);
  transition: transform var(--transition-smooth);
  z-index: 90;
  display: flex;
  flex-direction: column;
}

.task-detail-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Seção de Comentários */
.comments-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-card {
  background-color: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.comment-card.comment-highlight {
  background-color: var(--accent-glow, rgba(79, 70, 229, 0.12));
  box-shadow: 0 0 0 2px var(--accent-primary, #4f46e5);
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.comment-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.comment-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), background-color var(--transition-fast);
}

.comment-card:hover .comment-menu-btn,
.comment-menu-btn.menu-open {
  opacity: 1;
}

.comment-menu-btn:hover {
  background-color: var(--bg-surface-hover, var(--border-color));
  color: var(--text-primary);
}

.comment-user {
  font-weight: 600;
  font-size: 0.85rem;
}

.comment-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.comment-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Modal de Reagendamento em Lote */
.reschedule-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.reschedule-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: 0.5rem;
}

.reschedule-btn:hover {
  border-color: var(--accent-primary);
  background-color: var(--accent-glow);
}

/* ==========================================================================
   DROPDOWN DE PERFIL — TO-DO DIAMANTE (PAINEL 360PX)
   ========================================================================== */
.profile-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.profile-trigger-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  background-color: #ffffff;
  border: 1px solid #eef0f4;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.profile-trigger-btn:hover {
  background-color: #eeedfe;
}

.profile-trigger-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-trigger-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2333;
}

.profile-role-badge {
  background-color: #7c3aed;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-chevron {
  color: #8a90a6;
  transition: transform 0.2s ease-in-out;
}

.profile-trigger-btn.open .profile-chevron {
  transform: rotate(180deg);
  color: #4f39e6;
}

/* Painel Dropdown 360px */
.profile-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background-color: #ffffff;
  border: 1px solid #eef0f4;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(31, 35, 51, 0.12);
  z-index: 100;
  overflow: hidden;
  transform-origin: top right;
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  transition: opacity 140ms ease-out, transform 140ms ease-out;
}

.profile-dropdown-panel.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* Usuário no topo da barra lateral */
.sidebar-user-wrap {
  padding: 0.6rem 0.75rem 0;
}

.sidebar-user-wrap .profile-dropdown-wrap {
  display: block;
}

.sidebar-user-btn {
  width: 100%;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-color);
}

.sidebar-user-btn .profile-trigger-name {
  color: var(--text-primary);
}

/* Master usando a conta de outra pessoa: destaque âmbar no gatilho */
.sidebar-user-btn.impersonating {
  border-color: #f59e0b;
  background-color: rgba(245, 158, 11, 0.12);
}

/* Dicas de atalho (ex.: G H) à direita dos itens do menu */
.menu-kbd {
  display: inline-flex;
  gap: 3px;
  flex-shrink: 0;
  margin-left: 12px;
}

.menu-kbd kbd {
  min-width: 20px;
  text-align: center;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  background: #f1f2f6;
  border: 1px solid #e2e4ec;
  color: #6b7185;
}

.profile-dropdown-panel.align-left {
  left: 0;
  right: auto;
  width: 100%;
  min-width: 240px;
  transform-origin: top left;
}

.dropdown-user-info {
  padding: 10px 14px;
}

.dropdown-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8a90a6;
  padding: 6px 14px 2px;
}

@media (max-width: 720px) {
  .prefs-trigger-label {
    display: none;
  }
}

.dropdown-section {
  padding: 4px 6px;
  border-bottom: 1px solid #eef0f4;
}

.dropdown-section:last-of-type {
  border-bottom: none;
}

.dropdown-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color 120ms ease, color 120ms ease;
  font-family: inherit;
  color: #1f2333;
}

.dropdown-item-btn:hover,
.dropdown-item-btn:focus {
  background-color: #eeedfe;
  color: #4f39e6;
  outline: none;
}

.dropdown-item-btn:hover .item-icon,
.dropdown-item-btn:focus .item-icon {
  color: #4f39e6;
}

.dropdown-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.item-icon {
  color: #8a90a6;
  flex-shrink: 0;
  transition: color 120ms ease;
}

.item-label-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.item-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.item-title.highlight {
  font-size: 15px;
  font-weight: 600;
}

.item-subtitle {
  font-size: 12px;
  color: #8a90a6;
  line-height: 1.2;
}

.item-shortcut {
  font-size: 12px;
  color: #8a90a6;
  flex-shrink: 0;
  margin-left: 8px;
}

.dropdown-footer {
  padding: 10px 16px;
  background-color: #ffffff;
  border-top: 1px solid #eef0f4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #8a90a6;
}

.dropdown-footer a {
  color: #4f39e6;
  text-decoration: none;
  font-weight: 500;
}

.dropdown-footer a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   DATE PICKER POPOVER (ESTILO TODOIST)
   ========================================================================== */
.date-picker-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 1099;
}

.date-picker-popover {
  position: fixed;
  width: 326px;
  background-color: var(--bg-surface, #ffffff);
  border-radius: 14px;
  border: 1px solid var(--border-color, #e5e7eb);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 1100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: dpFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
}

.dp-drag-handle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 2px;
  color: var(--text-muted, #94a3b8);
  cursor: move;
  user-select: none;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
}

.dp-drag-handle:hover {
  color: var(--text-secondary, #475569);
}

.dp-scroll-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

@keyframes dpFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.dp-input-wrap {
  padding: 10px 12px 6px;
}

.dp-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.dp-col-date {
  flex: 1;
  min-width: 0;
}

.dp-col-time {
  width: 96px;
  flex-shrink: 0;
}

.dp-date-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  padding: 0 6px 0 8px;
  height: 33px;
  background-color: var(--bg-surface, #ffffff);
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.dp-date-input-wrap:focus-within {
  border-color: var(--accent-primary, #4f46e5);
  box-shadow: 0 0 0 2px var(--accent-glow, rgba(79, 70, 229, 0.15));
}

.dp-date-field-icon {
  width: 13px;
  height: 13px;
  color: var(--text-muted, #94a3b8);
  flex-shrink: 0;
  margin-right: 5px;
}

.dp-text-input {
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
  background-color: transparent;
  outline: none;
  box-sizing: border-box;
  min-width: 0;
}

.dp-text-input::placeholder {
  color: var(--text-muted, #94a3b8);
  font-weight: 400;
}

.dp-date-field-clear {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted, #94a3b8);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  display: none;
  transition: color 0.12s;
}

.dp-date-field-clear.visible {
  display: block;
}

.dp-date-field-clear:hover {
  color: #dc2626;
}

.dp-time-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  padding: 0 6px 0 8px;
  height: 33px;
  background-color: var(--bg-surface, #ffffff);
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.dp-time-input-wrap:focus-within {
  border-color: var(--accent-primary, #4f46e5);
  box-shadow: 0 0 0 2px var(--accent-glow, rgba(79, 70, 229, 0.15));
}

.dp-time-field-icon {
  width: 13px;
  height: 13px;
  color: var(--text-muted, #94a3b8);
  flex-shrink: 0;
  margin-right: 4px;
}

.dp-time-field-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
  padding: 0;
  min-width: 0;
}

.dp-time-field-input::placeholder {
  color: var(--text-muted, #94a3b8);
  font-weight: 400;
}

.dp-time-field-clear {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted, #94a3b8);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  display: none;
  transition: color 0.12s;
}

.dp-time-field-clear.visible {
  display: block;
}

.dp-time-field-clear:hover {
  color: #dc2626;
}

.dp-shortcuts-list {
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.dp-shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary, #1e293b);
  transition: background-color 0.12s;
}

.dp-shortcut-item:hover {
  background-color: var(--bg-surface-elevated, #f8fafc);
}

.dp-shortcut-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dp-shortcut-right {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}

.dp-divider {
  height: 1px;
  background-color: var(--border-subtle, #f1f5f9);
  margin: 4px 0;
}

.dp-calendar-section {
  padding: 8px 12px;
}

.dp-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dp-cal-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
}

.dp-cal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dp-cal-nav-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 0.12s;
}

.dp-cal-nav-btn:hover {
  background-color: var(--bg-surface-elevated, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

.dp-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 4px;
}

.dp-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-day-cell {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-primary, #1e293b);
  transition: background-color 0.12s, color 0.12s;
  position: relative;
}

.dp-day-cell:hover {
  background-color: var(--bg-surface-elevated, #f1f5f9);
}

.dp-day-cell.other-month {
  color: #cbd5e1;
}

.dp-day-cell.today {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  font-weight: 700;
}

.dp-day-cell.selected:not(.today) {
  border: 1.5px dashed #dc2626;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
}

.dp-next-month-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 10px 0 6px;
}

.dp-rec-row {
  margin-top: 8px;
}

.dp-rec-row.is-empty #dp-rec-display {
  color: var(--text-muted, #94a3b8);
}

.dp-pill-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--bg-surface, #ffffff);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary, #1e293b);
  transition: all 0.12s;
}

.dp-pill-btn:hover {
  background-color: var(--bg-surface-elevated, #f8fafc);
  border-color: #cbd5e1;
}

.dp-pill-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dp-pill-clear {
  color: var(--text-muted, #94a3b8);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 3px;
  transition: color 0.12s;
}

.dp-pill-clear:hover {
  color: #dc2626;
}

/* ==========================================================================
   TELA DE ETIQUETAS & MODAL DE CADASTRO (ESTILO TODOIST)
   ========================================================================== */

.labels-view-wrapper {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem 1rem;
}

.labels-page-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  padding-bottom: 1rem;
}

.labels-page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.labels-accordion-section {
  margin-bottom: 1.5rem;
}

.labels-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  transition: background-color 0.15s;
}

.labels-accordion-header:hover {
  background-color: var(--bg-surface-elevated, #f8fafc);
  border-radius: var(--radius-md, 6px);
}

.labels-accordion-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary, #1e293b);
}

.labels-accordion-chevron {
  transition: transform 0.2s ease;
  color: var(--text-muted, #64748b);
}

.labels-accordion-chevron.collapsed {
  transform: rotate(-90deg);
}

.labels-accordion-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-label-action-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-label-action-header:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

.labels-list-items {
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0;
}

.label-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.12s;
  user-select: none;
  color: var(--text-primary, #1e293b);
}

.label-item-row:hover {
  background-color: var(--bg-surface-elevated, #f8fafc);
}

.label-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.label-tag-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.label-item-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.label-item-fav-star {
  color: #f59e0b;
  margin-left: 0.25rem;
  display: inline-flex;
}

.label-item-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.label-badge-count {
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
}

.label-item-actions {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.label-item-row:hover .label-item-actions {
  display: flex;
}

.btn-label-item-action {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-label-item-action:hover {
  background: var(--bg-hover, #e2e8f0);
  color: var(--text-primary, #1e293b);
}

.btn-label-item-action.delete:hover {
  color: #ef4444;
}

/* Modal Todoist "Adicionar etiqueta" */
.label-modal-dialog {
  background: var(--bg-surface, #ffffff);
  border-radius: 10px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color, #e5e7eb);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.label-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
}

.label-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.label-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
}

.label-modal-help-btn {
  color: var(--text-muted, #94a3b8);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 50%;
  transition: color 0.15s;
}

.label-modal-help-btn:hover {
  color: var(--text-primary, #1e293b);
}

.label-modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  transition: all 0.15s;
}

.label-modal-close-btn:hover {
  background: var(--bg-surface-elevated, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

.label-modal-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.label-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.label-form-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.label-form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
}

.label-char-counter {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

.label-input-text {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #ffffff);
  color: var(--text-primary, #1e293b);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.label-input-text:focus {
  border-color: #db4c3f;
  box-shadow: 0 0 0 2px rgba(219, 76, 63, 0.15);
}

/* Dropdown Seletor de Cores */
.label-color-selector-wrap {
  position: relative;
  width: 100%;
}

.label-color-trigger-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #ffffff);
  color: var(--text-primary, #1e293b);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.label-color-trigger-btn:hover {
  border-color: #cbd5e1;
}

.label-color-trigger-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.label-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* Seletor de Etiquetas da Tarefa (popover ancorado, drawer de detalhes) */
.label-picker-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 1099;
}

.label-picker-popover {
  position: fixed;
  width: 260px;
  max-height: 320px;
  overflow-y: auto;
  background-color: var(--bg-surface, #ffffff);
  border-radius: 12px;
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 1100;
  padding: 6px;
  animation: dpFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.label-picker-empty {
  padding: 12px 10px;
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  text-align: center;
}

.label-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary, #1e293b);
}

.label-picker-item:hover {
  background-color: var(--bg-surface-elevated, #f1f5f9);
}

.label-picker-item-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.label-picker-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-picker-item-check {
  color: var(--accent-primary, #4f46e5);
  opacity: 0;
  flex-shrink: 0;
}

.label-picker-item.selected .label-picker-item-check {
  opacity: 1;
}

/* Seletor de Projeto da Tarefa (reaproveita .label-picker-*, com busca fixa no topo) */
.project-picker-popover {
  width: 280px;
  max-height: 360px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-picker-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  flex-shrink: 0;
}

.project-picker-search-input {
  width: 100%;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 0.82rem;
  background: var(--bg-surface-elevated, #f8fafc);
  color: var(--text-primary, #1e293b);
  outline: none;
}

.project-picker-search-input:focus {
  border-color: var(--accent-primary, #4f46e5);
}

#project-picker-list {
  overflow-y: auto;
  padding: 6px;
  flex: 1;
}

.project-picker-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
  padding: 8px 8px 2px;
}

/* Painel de Notificações (sino no topbar) */
.notifications-panel-popover {
  width: 340px;
  max-height: 420px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notifications-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
  flex-shrink: 0;
}

.notifications-panel-markall {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent-primary, #4f46e5);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0;
}

.notifications-panel-list {
  overflow-y: auto;
  flex: 1;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  transition: background-color var(--transition-fast);
}

.notification-item:hover {
  background-color: var(--bg-surface-elevated);
}

.notification-item.unread {
  background-color: color-mix(in srgb, var(--accent-primary, #4f46e5) 5%, transparent);
}

.notification-dot,
.notification-dot-spacer {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.3rem;
}

.notification-dot {
  background: var(--accent-primary, #4f46e5);
}

.notification-item-body {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notification-item-message {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notification-item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Modal "Meu Histórico" */
.history-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  margin-bottom: 0.75rem;
}

.history-filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.history-filter-chip:hover {
  color: var(--text-secondary);
}

.history-filter-chip.active {
  background: var(--accent-glow, rgba(79, 70, 229, 0.12));
  border-color: var(--accent-primary, #4f46e5);
  color: var(--accent-primary, #4f46e5);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 50vh;
  overflow-y: auto;
  margin: 0 -0.5rem;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.history-item:hover {
  background-color: var(--bg-surface-elevated);
}

.history-item-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.history-item-icon-added { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.history-item-icon-completed { background: rgba(5, 150, 105, 0.15); color: #059669; }
.history-item-icon-changed { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.history-item-icon-delegated { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.history-item-body {
  flex: 1;
  min-width: 0;
}

.history-item-text {
  font-size: 0.83rem;
  color: var(--text-primary);
}

.history-item-text strong {
  font-weight: 600;
}

.history-item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Painel "Mostrar" — configuração de visualização por tela */
.view-settings-popover {
  position: fixed;
  width: 300px;
  overflow-y: auto;
  background-color: var(--bg-surface, #ffffff);
  border-radius: 12px;
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 1100;
  padding: 10px 14px 14px;
  animation: dpFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.vs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  margin-bottom: 10px;
}

.vs-section {
  margin-bottom: 12px;
}

.vs-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 6px;
}

.vs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.83rem;
  color: var(--text-primary, #1e293b);
  border-bottom: 1px solid var(--border-subtle, #f1f5f9);
  margin-bottom: 10px;
}

.vs-layout-toggle {
  display: flex;
  gap: 6px;
}

.vs-layout-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface-elevated, #f8fafc);
  color: var(--text-secondary, #475569);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}

.vs-layout-btn.active {
  background: var(--accent-glow, rgba(79, 70, 229, 0.1));
  border-color: var(--accent-primary, #4f46e5);
  color: var(--accent-primary, #4f46e5);
}

.vs-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
}

.vs-field-row label {
  font-size: 0.82rem;
  color: var(--text-secondary, #475569);
  flex-shrink: 0;
}

.vs-field-row select {
  flex: 1;
  max-width: 150px;
  padding: 0.4rem 0.5rem;
  background: var(--bg-surface-elevated, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  color: var(--text-primary, #1e293b);
  font-size: 0.8rem;
}

.vs-reset-btn {
  width: 100%;
  padding: 0.55rem;
  margin-top: 4px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle, #f1f5f9);
  color: var(--p1-color, #ef4444);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}

.vs-reset-btn:hover {
  text-decoration: underline;
}

/* Botão "Mostrar" no cabeçalho de cada tela */
.btn-view-settings {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #ffffff);
  color: var(--text-secondary, #475569);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}

.btn-view-settings:hover,
.btn-view-settings.has-active-filters {
  border-color: var(--accent-primary, #4f46e5);
  color: var(--accent-primary, #4f46e5);
}

.btn-view-settings .vs-badge {
  background: var(--accent-primary, #4f46e5);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 0.05rem 0.4rem;
  min-width: 16px;
  text-align: center;
}

/* Menu de opções (⋯) de um comentário */
.comment-menu-popover {
  position: fixed;
  width: 220px;
  background-color: var(--bg-surface, #ffffff);
  border-radius: 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 1100;
  padding: 6px;
  animation: dpFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.comment-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary, #1e293b);
}

.comment-menu-item:hover {
  background-color: var(--bg-surface-elevated, #f1f5f9);
}

.comment-menu-item-danger {
  color: var(--p1-color, #ef4444);
}

.comment-menu-item-danger:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

.comment-menu-divider {
  height: 1px;
  background-color: var(--border-subtle, #f1f5f9);
  margin: 4px 2px;
}

.label-color-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  padding: 4px;
  display: none;
}

.label-color-dropdown-menu.open {
  display: block;
}

.label-color-option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-primary, #1e293b);
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 4px;
  text-align: left;
  transition: background-color 0.12s;
}

.label-color-option-btn:hover {
  background-color: var(--bg-surface-elevated, #f1f5f9);
}

.label-color-option-btn.selected {
  font-weight: 600;
  background-color: rgba(219, 76, 63, 0.08);
  color: #db4c3f;
}

/* Switch Toggle Todoist */
.label-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.25rem;
}

.label-toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
  user-select: none;
  cursor: pointer;
}

.todoist-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.todoist-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.todoist-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .2s;
  border-radius: 20px;
}

.todoist-toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.todoist-toggle input:checked + .todoist-toggle-slider {
  background-color: #db4c3f;
}

.todoist-toggle input:checked + .todoist-toggle-slider:before {
  transform: translateX(16px);
}

/* Footer do Modal */
.label-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle, #f1f5f9);
}

.btn-label-cancel {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #ffffff);
  color: var(--text-primary, #1e293b);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-label-cancel:hover {
  background: var(--bg-surface-elevated, #f1f5f9);
}

.btn-label-submit {
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  border: none;
  background: #db4c3f;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-label-submit:hover {
  background: #b5382b;
}

.btn-label-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==========================================================================
   BUSCA GLOBAL — resultados com controle segmentado
   ========================================================================== */
.search-header { margin: 0.25rem 0 1rem; }
.search-title { font-size: 1.75rem; font-weight: 800; margin: 0; word-break: break-word; }
.search-summary { margin: 0.35rem 0 0; color: var(--text-muted); font-size: 0.9rem; }

.segmented-control {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  max-width: 100%;
  overflow-x: auto;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.segmented-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.segmented-btn:hover { color: var(--text-primary); }

.segmented-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 1px;
}

.segmented-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.segmented-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.14);
  color: var(--accent-primary);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.segmented-count.zero {
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
}

.search-hit {
  background: rgba(250, 204, 21, 0.45);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.search-results { display: flex; flex-direction: column; gap: 0.5rem; }
.search-task-wrap { display: flex; flex-direction: column; }
.search-subtask-note { font-size: 0.75rem; color: var(--text-muted); padding: 0.15rem 0.75rem 0; }

.search-comment-item,
.search-project-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.search-comment-item:hover,
.search-project-item:hover { border-color: var(--accent-primary); background: var(--bg-surface-elevated); }

.search-comment-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-surface-elevated); }
.search-comment-body { min-width: 0; flex: 1; }
.search-comment-meta { display: flex; align-items: baseline; gap: 0.6rem; font-size: 0.85rem; }
.search-comment-meta span { color: var(--text-muted); font-size: 0.75rem; }
.search-comment-text { margin: 0.25rem 0; font-size: 0.92rem; line-height: 1.45; word-break: break-word; }
.search-comment-task { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-muted); }
.search-comment-project { margin-left: 0.35rem; font-weight: 600; }

.search-project-item { align-items: center; }
.search-project-main { flex: 1; min-width: 0; }
.search-project-name { font-weight: 700; }
.search-project-sub { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-count-pill { flex-shrink: 0; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: 999px; padding: 2px 10px; }

.search-dept-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}
.search-dept-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.search-dept-name { font-weight: 800; font-size: 1.05rem; flex: 1; min-width: 0; }
.search-dept-projects { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.65rem; }
.search-dept-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: inherit; font-size: 0.82rem; font-weight: 600; color: var(--text-primary);
  background: var(--bg-surface-elevated); border: 1px solid var(--border-color);
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
}
.search-dept-chip:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

.search-empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.search-empty-title { font-weight: 700; font-size: 1.05rem; color: var(--text-primary); margin: 0.6rem 0 0.25rem; }
.search-empty a { color: var(--accent-primary); font-weight: 600; }

/* Sugestões ao digitar na busca do topo */
.search-box { position: relative; }

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 440px;
  max-width: 92vw;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
  padding: 6px;
  z-index: 200;
}
.search-dropdown[hidden] { display: none; }

.search-dd-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px 3px;
}
.search-dd-label-row { display: flex; align-items: center; justify-content: space-between; }
.search-dd-clear { border: none; background: transparent; color: var(--accent-primary); font-size: 0.72rem; font-weight: 600; cursor: pointer; text-transform: none; letter-spacing: 0; }
.search-dd-sep { height: 1px; background: var(--border-color); margin: 6px 4px; }

.search-dd-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
}
.search-dd-item.active { background: rgba(99, 102, 241, 0.12); }
.search-dd-icon { width: 20px; display: inline-flex; justify-content: center; flex-shrink: 0; color: var(--text-muted); }
.search-dd-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.search-dd-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.search-dd-title { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dd-sub { font-size: 0.74rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dd-remove { border: none; background: transparent; color: var(--text-muted); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 4px; }
.search-dd-remove:hover { color: var(--text-primary); background: var(--bg-surface-elevated); }
.search-dd-item mark, .search-dd-sub mark { background: rgba(250, 204, 21, 0.45); color: inherit; border-radius: 3px; }

.search-back { display: inline-block; margin-bottom: 0.4rem; font-size: 0.85rem; font-weight: 600; color: var(--accent-primary); text-decoration: none; }
.search-back:hover { text-decoration: underline; }
.search-comment-attachment { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0.15rem 0.4rem 0.15rem 0; padding: 2px 8px; font-size: 0.8rem; color: var(--text-secondary); background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: 999px; }
.search-inactive { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: 999px; padding: 1px 7px; margin-left: 0.35rem; }
/* Árvore de departamentos e permissões por projeto (modal de usuário) */
.user-modal-wide { max-width: 760px; width: 96vw; }

.user-dept-tree {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 46vh;
  overflow-y: auto;
}

.user-dept-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.25rem 0.5rem 0.5rem;
}

.user-dept-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.25rem;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.92rem;
}
.user-dept-option input { width: 16px; height: 16px; accent-color: var(--accent-primary); }
.user-dept-name { font-weight: 700; flex: 1; min-width: 0; }
.user-dept-count { font-size: 0.75rem; color: var(--text-muted); }

.user-proj-perms { margin-top: 0.1rem; border-top: 1px dashed var(--border-color); padding-top: 0.35rem; }
.user-dept-block.dept-off .user-proj-perms { opacity: 0.45; }
.user-dept-block.dept-off .user-proj-perms::before {
  content: "Departamento desmarcado: estas permissões só valem se o membro tiver acesso ao departamento.";
  display: block; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.3rem;
}

.user-proj-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(6, 58px);
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
  font-size: 0.85rem;
  border-radius: 6px;
}
.user-proj-row:not(.user-proj-head):not(.user-proj-all):hover { background: var(--bg-surface-elevated); }
.user-proj-row input[type="checkbox"] { justify-self: center; width: 16px; height: 16px; accent-color: var(--accent-primary); }
.user-proj-row input[type="checkbox"]:disabled { opacity: 0.35; }
.user-proj-head { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.user-proj-head span:not(:first-child) { text-align: center; }
.user-proj-all { color: var(--text-secondary); font-size: 0.78rem; border-bottom: 1px solid var(--border-color); border-radius: 0; margin-bottom: 2px; }
.user-proj-name { display: flex; align-items: center; gap: 0.45rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-proj-row.row-hidden .user-proj-name { text-decoration: line-through; color: var(--text-muted); }

@media (max-width: 560px) {
  .user-proj-row { grid-template-columns: minmax(0, 1fr) repeat(6, 40px); font-size: 0.78rem; }
  .user-proj-head { font-size: 0.58rem; }
}
.project-readonly-badge { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: 999px; padding: 0.3rem 0.75rem; }
.user-proj-presets { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.4rem; font-size: 0.75rem; color: var(--text-muted); }
.perm-preset { font-family: inherit; font-size: 0.74rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; cursor: pointer; color: var(--text-secondary); background: var(--bg-surface-elevated); border: 1px solid var(--border-color); }
.perm-preset:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
.user-proj-head { font-size: 0.62rem; }
/* Controles travados por falta de permissão no projeto */
.is-locked { cursor: not-allowed !important; opacity: 0.6; }
.task-modal-title-input.is-locked, .task-modal-desc-input.is-locked { opacity: 1; cursor: default !important; }
.drawer-perm-banner {
  display: flex; align-items: center; gap: 0.45rem;
  margin: 0; padding: 0.45rem 1.25rem;
  font-size: 0.8rem; font-weight: 600;
  color: #92400e; background: rgba(245, 158, 11, 0.14);
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
}
/* Departamentos com supervisor responsável (tela de Equipe) */
.dept-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
.dept-card { padding: 0.8rem 1rem; background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: 10px; display: flex; flex-direction: column; gap: 0.5rem; }
.dept-card-warn { border-color: rgba(245, 158, 11, 0.6); background: rgba(245, 158, 11, 0.07); }
.dept-card-head { display: flex; align-items: center; gap: 0.55rem; }
.dept-card-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dept-card-resp { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.dept-card-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.dept-supervisor-select { width: 100%; padding: 0.4rem 0.5rem; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-primary); font-size: 0.85rem; }
.dept-warn-badge { display: inline-flex; align-items: center; gap: 0.3rem; align-self: flex-start; font-size: 0.72rem; font-weight: 700; color: #92400e; background: rgba(245, 158, 11, 0.18); border-radius: 999px; padding: 2px 9px; }
.user-dept-resp { font-size: 0.74rem; color: var(--text-muted); font-weight: 500; }
.user-dept-resp.is-missing { color: #b45309; font-weight: 700; }
/* ===== Responsáveis de departamento, painel, pedidos de aprovação ===== */
.dept-card-name.dept-open-panel { background: none; border: none; padding: 0; text-align: left; font: inherit; font-weight: 700; color: var(--text-primary); cursor: pointer; }
.dept-card-name.dept-open-panel:hover { color: var(--accent-primary); text-decoration: underline; }
.dept-edit-btn { margin-left: auto; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; color: var(--text-muted); cursor: pointer; }
.dept-edit-btn:hover { color: var(--accent-primary); border-color: var(--border-color); background: var(--bg-surface); }
.dept-panel-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 0.3rem; background: none; border: none; padding: 0; font-family: inherit; font-size: 0.78rem; font-weight: 600; color: var(--accent-primary); cursor: pointer; }
.dept-panel-link:hover { text-decoration: underline; }
.dept-resp-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.dept-resp-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 2px 9px 2px 3px; font-size: 0.78rem; font-weight: 600; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 999px; }
.dept-resp-chip img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.dept-resp-chip em { font-style: normal; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.dept-resp-chip.is-inactive { opacity: 0.55; text-decoration: line-through; }
.dept-note { font-size: 0.72rem; color: var(--text-muted); }

.dept-resp-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; padding: 4px; background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: 8px; }
.dept-resp-option { display: flex; align-items: center; gap: 0.55rem; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.dept-resp-option:hover { background: var(--bg-surface); }
.dept-resp-option input { width: 16px; height: 16px; accent-color: var(--accent-primary); }
.dept-resp-option img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.dept-resp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.dept-modal-error { margin-top: 0.4rem; font-size: 0.8rem; font-weight: 600; color: #dc2626; }

.approvals-badge { display: inline-block; margin-left: 0.4rem; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; vertical-align: middle; }
.approvals-filter { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-surface-elevated); border: 1px solid var(--border-color); border-radius: 999px; }
.approvals-filter-btn { border: none; background: transparent; font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.approvals-filter-btn.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.approvals-list { display: flex; flex-direction: column; gap: 0.6rem; }
.approvals-empty { text-align: center; padding: 1.4rem; color: var(--text-muted); background: var(--bg-surface-elevated); border: 1px dashed var(--border-color); border-radius: 10px; }

.request-card { padding: 0.8rem 1rem; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 10px; margin-bottom: 0.5rem; }
.request-card-head { display: flex; align-items: center; gap: 0.6rem; }
.request-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.request-card-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.request-type { font-weight: 700; font-size: 0.92rem; }
.request-meta { font-size: 0.75rem; color: var(--text-muted); }
.request-status { font-size: 0.72rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.request-status.pending { background: rgba(245, 158, 11, 0.18); color: #92400e; }
.request-status.approved { background: rgba(34, 197, 94, 0.16); color: #15803d; }
.request-status.rejected { background: rgba(220, 38, 38, 0.14); color: #b91c1c; }
.request-body { margin-top: 0.5rem; font-size: 0.9rem; color: var(--text-secondary); line-height: 1.45; }
.request-message { margin-top: 0.35rem; font-size: 0.85rem; font-style: italic; color: var(--text-muted); }
.request-decision { margin-top: 0.45rem; font-size: 0.78rem; color: var(--text-muted); border-top: 1px dashed var(--border-color); padding-top: 0.4rem; }
.request-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.6rem; }
.request-rights { display: flex; flex-direction: column; gap: 4px; }
.request-right { display: flex; align-items: center; gap: 0.55rem; padding: 6px 8px; border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; font-size: 0.9rem; }
.request-right.is-have { opacity: 0.55; cursor: default; }
.request-right em { margin-left: auto; font-size: 0.72rem; color: var(--text-muted); font-style: normal; }
.request-right input { width: 16px; height: 16px; accent-color: var(--accent-primary); }

.drawer-perm-actions { margin-left: auto; display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
.drawer-perm-btn { font-family: inherit; font-size: 0.75rem; font-weight: 700; color: #92400e; background: rgba(255,255,255,0.7); border: 1px solid rgba(245, 158, 11, 0.55); border-radius: 999px; padding: 2px 10px; cursor: pointer; }
.drawer-perm-btn:hover { background: #fff; }
.drawer-perm-text { flex: 1; min-width: 0; }

.dept-panel-back a { font-size: 0.85rem; font-weight: 600; color: var(--accent-primary); text-decoration: none; }
.dept-panel-back a:hover { text-decoration: underline; }
.dept-panel-resp { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.5rem; }
.dept-project-row { cursor: pointer; }
.dept-project-row:hover td, .dept-project-row:focus td { background: var(--bg-surface-elevated); }
.is-inactive-row { opacity: 0.55; }
.section-hint { margin-left: 0.5rem; font-size: 0.72rem; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-muted); }

.resp-timeline { list-style: none; margin: 0; padding: 0 0 0 0.4rem; border-left: 2px solid var(--border-color); display: flex; flex-direction: column; gap: 0.9rem; }
.resp-timeline li { position: relative; padding-left: 1rem; font-size: 0.9rem; }
.resp-timeline-dot { position: absolute; left: -0.85rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--bg-surface); }
.resp-timeline li.is-out .resp-timeline-dot { background: #f59e0b; }
.resp-timeline-when { display: block; font-size: 0.75rem; color: var(--text-muted); }
.resp-timeline-note { display: block; font-size: 0.78rem; color: var(--text-secondary); font-style: italic; }
/* Caixas de diálogo abertas por cima da gaveta da tarefa */
#prompt-dialog-modal, #confirm-dialog-modal, #access-request-modal, #department-modal,
#my-requests-modal, #reset-password-modal, #switch-user-modal, #profile-modal { z-index: 2100; }
.dept-panel-table th, .dept-panel-table td { padding: 0.7rem 0.75rem; }
.dept-panel-table td.team-access { white-space: nowrap; }
/* Seções do projeto: ferramentas da coluna e ações na lista */
.kanban-column-tools { display: flex; align-items: center; gap: 4px; }
.group-title .section-actions { margin-left: auto; display: inline-flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.task-group:hover .section-actions, .section-actions:focus-within { opacity: 1; }
@media (hover: none) { .group-title .section-actions { opacity: 1; } }
/* Seções: cor, recolher, reordenar, selos de fluxo */
#section-delete-modal, #section-color-modal { z-index: 2100; }
.kanban-column.has-color { border-top: 3px solid var(--sec-color); }
.task-group.has-color > .group-title { border-left: 3px solid var(--sec-color); padding-left: 0.6rem; }
.section-collapse-btn { background: none; border: 0; padding: 2px; color: var(--text-muted); cursor: pointer; display: inline-flex; border-radius: 4px; }
.section-collapse-btn:hover { color: var(--text-primary); background: var(--bg-surface-elevated); }
.section-grip { cursor: grab; color: var(--text-muted); display: inline-flex; }
.section-grip:active { cursor: grabbing; }
.section-flag { color: var(--accent-primary); display: inline-flex; }
.section-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-column.section-dragging { opacity: 0.5; }
.kanban-column.drop-before { box-shadow: -4px 0 0 var(--accent-primary); }
.kanban-column.drop-after { box-shadow: 4px 0 0 var(--accent-primary); }
.kanban-column.is-collapsed { width: 56px; min-width: 56px; cursor: pointer; }
.kanban-column.is-collapsed .kanban-column-body, .kanban-column.is-collapsed .kanban-column-tools, .kanban-column.is-collapsed .section-grip, .kanban-column.is-collapsed .section-flag { display: none; }
.kanban-column.is-collapsed .kanban-column-header { padding: 0.75rem 0.5rem; border-bottom: 0; justify-content: center; }
.kanban-column.is-collapsed .kanban-column-title { flex-direction: column; writing-mode: vertical-rl; gap: 0.4rem; }
.kanban-column.is-collapsed .section-collapse-btn { writing-mode: horizontal-tb; }
.task-group.is-collapsed > .task-list { display: none; }
.section-color-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.section-color-swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.section-color-swatch.none { background: var(--bg-surface-elevated); border-color: var(--border-color); }
.section-color-swatch.selected { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-surface); }

/* Resumo da secao e dialogo de duplicar */
#duplicate-modal { z-index: 2100; }
.section-summary { display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 0.35rem 1.15rem; font-size: 0.72rem; color: var(--text-muted); }
.task-group > .section-summary { padding-left: 0; }
.section-summary-overdue { color: #dc2626; font-weight: 700; }
.section-summary-person b { color: var(--text-secondary); }

/* Painel dos projetos no mesmo visual da Caixa de Espera: colunas soltas, titulo sublinhado */
.kanban-board { gap: 1.25rem; margin-top: 1.25rem; scrollbar-width: auto; }
.kanban-board::-webkit-scrollbar { height: 10px; }
.kanban-board::-webkit-scrollbar-track { background: var(--bg-surface-elevated); border-radius: 10px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
.kanban-board .kanban-column { width: 300px; min-width: 300px; background: transparent; border: 0; border-radius: 0; max-height: calc(100vh - 260px); }
.kanban-board .kanban-column.drag-over { background: transparent; }
.kanban-board .kanban-column-header { padding: 0 0 0.5rem; margin-bottom: 0.5rem; border-bottom: 0; }
.kanban-board .kanban-column-title { align-items: baseline; font-size: 1.05rem; }
.kanban-board .kanban-column-title .section-name { border-bottom: 2px solid var(--sec-color, var(--text-primary)); padding-bottom: 2px; }
.kanban-board .kanban-column-title .section-grip, .kanban-board .kanban-column-title .section-collapse-btn, .kanban-board .kanban-column-title .section-flag { align-self: center; }
.kanban-board .kanban-column-count { background: transparent; padding: 0; font-size: 0.875rem; font-weight: 500; }
.kanban-board .kanban-column.has-color { border-top: 0; }
.kanban-board .section-summary { padding: 0 0 0.5rem; }
.kanban-board .kanban-column-body { padding: 0.25rem 0.25rem 0.25rem 0; min-height: 120px; border-radius: 12px; }
.kanban-board .kanban-column.drag-over .kanban-column-body { outline: 2px dashed var(--accent-primary); background-color: rgba(99, 102, 241, 0.05); }
.kanban-board .kanban-column.is-collapsed { width: 56px; min-width: 56px; }
.kanban-board .kanban-column.is-collapsed .kanban-column-header { padding: 0; }
.kanban-empty-col { text-align: center; padding: 2rem 0.75rem; color: var(--text-muted); font-size: 0.85rem; background: var(--bg-surface-elevated); border-radius: 10px; border: 1px dashed var(--border-color); }

/* Tarefa recem-concluida: continua na tela, riscada, ate o aviso de desfazer sumir */
.task-card.just-completed, .today-task-card.just-completed { opacity: 1; background-color: var(--bg-surface); }
.task-card.just-completed .task-title, .today-task-card.just-completed .today-card-title { text-decoration: line-through; color: var(--text-primary); }
.today-card-checkbox.checked { background-color: var(--accent-emerald); border-color: var(--accent-emerald); color: #fff; }

/* Departamentos arquivados */
.dept-archived-list { display: flex; flex-direction: column; gap: 6px; margin-top: 0.6rem; }
.dept-archived-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem; border: 1px dashed var(--border-color); border-radius: 8px; }
.dept-archived-name { font-weight: 600; color: var(--text-secondary); }
.dept-archived-when { margin-left: auto; font-size: 0.78rem; color: var(--text-muted); }


/* Delegacao: chips, acoes e tela Delegadas por mim */
.badge-count.is-alert { background: #dc2626; color: #fff; }
.deleg-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 0.7rem; font-weight: 600; padding: 0.08rem 0.4rem; border-radius: 999px; background: var(--bg-surface-elevated); color: var(--text-secondary); white-space: nowrap; }
.deleg-in { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.deleg-out { background: rgba(14, 165, 233, 0.12); color: #0369a1; }
.deleg-new { background: #dc2626; color: #fff; }
.deleg-wait { background: rgba(245, 158, 11, 0.16); color: #b45309; }
.deleg-ok { background: rgba(16, 185, 129, 0.14); color: #047857; }
.deleg-late { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.deleg-declined { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.deleg-actions { display: inline-flex; gap: 4px; }
.deleg-btn { font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 6px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-primary); cursor: pointer; font-family: inherit; }
.deleg-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.deleg-accept { background: #10b981; border-color: #10b981; color: #fff; }
.deleg-accept:hover { background: #059669; border-color: #059669; color: #fff; }
.deleg-banner-body { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 0.35rem; }
.deleg-banner-reason { font-size: 0.8rem; font-style: italic; color: var(--text-secondary); margin-top: 0.4rem; }
.deleg-group { margin-bottom: 1rem; }
.deleg-group-hint { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.5rem; }
.deleg-row { display: grid; grid-template-columns: 1fr 170px 230px 130px; gap: 0.75rem; align-items: center; padding: 0.6rem 0; border-top: 1px solid var(--border-subtle); }
.deleg-row:first-of-type { border-top: 0; }
.deleg-row-main { display: flex; flex-direction: column; min-width: 0; cursor: pointer; }
.deleg-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deleg-row-meta { font-size: 0.75rem; color: var(--text-muted); }
.deleg-row-who { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; min-width: 0; }
.deleg-row-who img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.deleg-row-actions { display: flex; gap: 6px; justify-content: flex-end; }
@media (max-width: 820px) { .deleg-row { grid-template-columns: 1fr; } .deleg-row-actions { justify-content: flex-start; } }
#delegate-dialog-modal { z-index: 2100; }
