/* Página Tarefas + janela de edição de tarefa (também usada dentro do cartão do CRM) */
.tk { max-width: 1180px; margin: 0 auto; }
.tk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tk-head h2 { margin: 0 0 4px; }
.tk-head p { margin: 0; color: var(--muted); font-size: 14px; }
.tk-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tk-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.tk-seg button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; color: var(--muted); font-size: 14px; }
.tk-seg button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.tk-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tk-tab { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 6px 12px; cursor: pointer; font-size: 13px; color: inherit; }
.tk-tab[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tk-tab .n { margin-left: 6px; font-size: 12px; opacity: .85; }
.tk-note { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }

.tk-filters { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(120px, 1fr)); gap: 10px; align-items: end; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; margin-bottom: 14px; }
.tk-filters .field { margin: 0; display: grid; gap: 4px; min-width: 0; }
.tk-filters label { font-size: 12px; color: var(--muted); }
.tk-filters input, .tk-filters select { width: 100%; box-sizing: border-box; min-width: 0; padding: 8px 10px; }
.tk-filters .tk-clear { align-self: end; }
.tk-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand); border-radius: 99px; padding: 3px 10px; font-size: 13px; }
.tk-chip button { border: 0; background: transparent; cursor: pointer; font-size: 16px; line-height: 1; color: inherit; padding: 0 2px; }

/* indicadores de prazo: cor + texto (nunca só a cor) */
.tk-ind { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.tk-ind::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--off, #9aa3ad); flex: none; }
.tk-ind-ok .tk-ind::before, .tk-ind.ok::before { background: var(--ok); }
.tk-ind.today::before { background: #e0a800; }
.tk-ind.late::before { background: var(--danger); }
.tk-ind.done::before { background: var(--ok); }
.tk-ind.cancelled::before, .tk-ind.none::before { background: var(--off, #9aa3ad); }
.tk-ind.late { color: var(--danger); font-weight: 600; }
.tk-ind.today { color: #8a6500; font-weight: 600; }

.tk-prio { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap; }
.tk-prio.p-high { background: var(--wait-soft); color: #8a6500; }
.tk-prio.p-urgent { background: var(--danger-soft); color: var(--danger); }
.tk-prio.p-low { background: var(--bg); color: var(--muted); }

.tk-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 160px 84px 150px auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.tk-row.i-ok { border-left-color: var(--ok); }
.tk-row.i-today { border-left-color: #e0a800; }
.tk-row.i-late { border-left-color: var(--danger); }
.tk-row.i-done { border-left-color: var(--ok); opacity: .8; }
.tk-row.i-cancelled { border-left-color: var(--off, #9aa3ad); opacity: .75; }
.tk-row.is-deleted { opacity: .7; border-style: dashed; }
.tk-main { min-width: 0; }
.tk-title { border: 0; background: transparent; padding: 0; cursor: pointer; font-weight: 600; text-align: left; font-size: 15px; color: inherit; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.tk-title:hover { text-decoration: underline; }
.tk-row.i-done .tk-title, .tk-row.i-cancelled .tk-title { text-decoration: line-through; color: var(--muted); }
.tk-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tk-meta .tk-link { border: 0; background: transparent; padding: 0; cursor: pointer; color: var(--brand); font-size: 12.5px; text-decoration: underline; }
.tk-stage { display: inline-flex; align-items: center; gap: 5px; }
.tk-stage i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tk-act { display: flex; gap: 6px; }
.tk-row select { padding: 6px 8px; font-size: 13px; max-width: 100%; }
.tk-desc { margin: 3px 0 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tk-empty { text-align: center; color: var(--muted); padding: 40px 12px; border: 2px dashed var(--line); border-radius: var(--radius-lg); background: var(--panel); }
.tk-empty svg { width: 34px; height: 34px; stroke: currentColor; fill: none; stroke-width: 1.6; margin-bottom: 8px; }
.tk-empty b { display: block; color: inherit; margin-bottom: 4px; }

/* Kanban de tarefas */
.tk-kanban { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.tk-col { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 160px; }
.tk-col.over { outline: 2px dashed var(--brand); outline-offset: -4px; }
.tk-col h3 { margin: 0 0 10px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.tk-col h3 .n { font-weight: 500; color: var(--muted); font-size: 13px; }
.tk-card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: grab; display: grid; gap: 6px; }
.tk-card.dragging { opacity: .5; }
.tk-card.i-ok { border-left-color: var(--ok); } .tk-card.i-today { border-left-color: #e0a800; } .tk-card.i-late { border-left-color: var(--danger); } .tk-card.i-done { border-left-color: var(--ok); }
.tk-card .tk-title { white-space: normal; }
.tk-card select { padding: 5px 8px; font-size: 12.5px; }
.tk-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Janela de criar e editar */
.tk-overlay { position: fixed; inset: 0; background: rgba(15, 22, 30, .42); z-index: 60; }
.tk-modal { position: fixed; z-index: 61; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(680px, 94vw); max-height: 92vh; overflow: auto; background: var(--panel); border-radius: 14px; padding: 20px; box-shadow: var(--shadow-md, 0 12px 40px rgba(0, 0, 0, .25)); }
.tk-modal h3 { margin: 0 0 14px; }
.tk-modal .field input:not([type=checkbox]), .tk-modal .field textarea, .tk-modal .field select { width: 100%; box-sizing: border-box; }
.tk-modal .field-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tk-modal fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; margin: 4px 0 14px; }
.tk-modal legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.tk-modal .hint { margin: -4px 0 10px; font-size: 12.5px; color: var(--muted); }
.tk-results { list-style: none; margin: 6px 0 0; padding: 0; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.tk-results:empty { display: none; }
.tk-results button { width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; cursor: pointer; display: grid; gap: 2px; }
.tk-results button:hover, .tk-results button:focus { background: var(--brand-soft); }
.tk-results small { color: var(--muted); }
.tk-card-chosen { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; }
.tk-card-chosen small { display: block; color: var(--muted); }
.tk-modal-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.tk-modal-foot .tk-danger { margin-right: auto; }

/* dentro do cartão do CRM */
.task .t-title.tk-open { border: 0; background: transparent; padding: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.task .t-title.tk-open:hover { text-decoration: underline; }
.task .t-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; align-items: center; }
.task.cancelled .t-title { text-decoration: line-through; color: var(--muted); }

@media (max-width: 980px) {
  .tk-filters { grid-template-columns: 1fr 1fr; }
  .tk-filters .field:first-child { grid-column: 1 / -1; }
  .tk-row { grid-template-columns: auto minmax(0, 1fr); }
  .tk-row > .tk-due, .tk-row > .tk-prio-wrap, .tk-row > .tk-stat, .tk-row > .tk-act { grid-column: 2; }
  .tk-kanban { grid-template-columns: 1fr; }
  .tk-modal .field-row3 { grid-template-columns: 1fr; }
}
