/* Tarefas e Rotinas + Coach 1:1 (Fase 4). Reaproveita .cp-tabs/.cp-table/.badge de campaigns.css e components.css. */

.tk-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}
.tk-count {
  appearance: none;
  text-align: left;
  font: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  min-height: 60px;
  min-width: 0;
}
.tk-count strong { font-size: 22px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; }
.tk-count span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.02em; color: var(--color-muted); }
.tk-count small { font-size: 11px; color: var(--color-muted); }
.tk-count:hover { border-color: var(--color-border-strong, #cbd5e1); }
.tk-count.is-alert { background: #FFF6E5; border-color: #F5C26B; }
.tk-count.is-alert strong { color: #B54708; }
.tk-count--next { cursor: default; grid-column: span 2; }
.tk-count--next strong { font-size: 15px; white-space: nowrap; }
.tk-na { color: var(--color-muted); font-weight: 600; font-size: 0.9rem; }

.tk-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 12px; }
.tk-filters.is-hidden, .tk-view.is-hidden { display: none; }
.tk-filters .ev-filter-field { min-width: 130px; }

.tk-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tk-nav strong { flex: 1; text-align: center; min-width: 160px; }

/* cards de tarefa */
.tk-card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.tk-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid #98A2B3;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tk-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tk-card-title { text-align: left; overflow-wrap: anywhere; }
.tk-badges { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.tk-prio-low { border-left-color: #98A2B3; }
.tk-prio-medium { border-left-color: #2563EB; }
.tk-prio-high { border-left-color: #F79009; }
.tk-prio-critical { border-left-color: #D92D20; }
.tk-card.is-overdue { background: #FFFBFA; box-shadow: inset 0 0 0 1px #FDA29B; }
.tk-card.is-closed { opacity: 0.72; }
.tk-meta { margin: 0; font-size: 0.82rem; color: var(--color-text-soft); overflow-wrap: anywhere; }
.tk-chips { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.tk-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--color-surface-soft); border: 1px solid var(--color-border); color: var(--color-text-soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-chip--link { background: #EEF4FF; border-color: #C7D7FE; color: #3538CD; }
.tk-chip--check { background: #ECFDF3; border-color: #ABEFC6; color: #067647; }
.tk-chip--routine { background: #F4F3FF; border-color: #D9D6FE; color: #5925DC; }
.tk-card-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.tk-empty { color: var(--color-muted); font-size: 0.9rem; margin: 8px 0; }
.tk-empty--small { font-size: 12px; margin: 4px 0; }
.tk-hint { color: var(--color-muted); font-size: 12px; margin: 0 0 8px; }

.tk-blocks { display: grid; gap: 16px; }
.tk-block h4 { margin: 0 0 8px; font-size: 0.98rem; }

/* semana */
.tk-week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
.tk-day { background: var(--color-surface-soft); border: 1px solid var(--color-border); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tk-day.is-today { border-color: var(--color-accent, #0e7c86); box-shadow: 0 0 0 2px var(--color-accent-ring); }
.tk-day header { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; }
.tk-day header span { flex: 1; color: var(--color-muted); font-size: 11px; }
.tk-day-add { appearance: none; border: 1px solid var(--color-border-strong, #cbd5e1); background: var(--color-surface); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-size: 16px; line-height: 1; }
.tk-day .tk-card { padding: 8px; }
.tk-day .tk-card header { flex-direction: column; }
.tk-day .tk-card-actions .primary-action, .tk-day .tk-card-actions .secondary-action { padding: 4px 8px; font-size: 12px; }

/* mes */
.tk-month-head, .tk-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.tk-month-head div { text-align: center; font-size: 11px; font-weight: 700; color: var(--color-muted); padding: 4px 0; }
.tk-cell { appearance: none; font: inherit; text-align: left; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; min-height: 68px; padding: 6px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; min-width: 0; }
.tk-cell.is-empty { background: transparent; border: none; cursor: default; }
.tk-cell.is-today { border-color: var(--color-accent, #0e7c86); box-shadow: 0 0 0 2px var(--color-accent-ring); }
.tk-cell.has-tasks { background: #F8FAFF; }
.tk-cell-day { font-size: 12px; font-weight: 700; }
.tk-cell-counts { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.tk-cell-counts b { font-size: 15px; }
.tk-cell-counts i { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 999px; }
.tk-cell-counts .is-late { background: #FEE4E2; color: #B42318; }
.tk-cell-counts .is-done { background: #D1FADF; color: #067647; }
.tk-cell-counts .is-crit { background: #B42318; color: #fff; }

/* lista */
.tk-table td, .tk-table th { vertical-align: top; }

/* modais */
.tk-form-card { width: min(860px, 96vw); max-height: 92vh; overflow-y: auto; }
.tk-detail-card, .tk-day-card, .tk-routines-card, .coach-card { width: min(760px, 96vw); max-height: 92vh; overflow-y: auto; }
.tk-small-card { width: min(460px, 96vw); }
.tk-section { margin: 12px 0; }
.tk-checklist-edit { display: grid; gap: 6px; margin-bottom: 8px; }
.tk-checklist-row { display: flex; gap: 6px; }
.tk-checklist-row input { flex: 1; min-width: 0; }
.tk-weekdays { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-weekday { display: inline-flex; align-items: center; gap: 4px; font-size: 0.88rem; }
.tk-scope-options { display: grid; gap: 8px; margin: 12px 0; }
.tk-checklist { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.tk-checklist li { display: flex; flex-direction: column; gap: 1px; }
.tk-checklist label { display: flex; gap: 8px; align-items: center; min-height: 32px; }
.tk-checklist input[type="checkbox"] { width: 20px; height: 20px; }
.tk-checklist .is-done { text-decoration: line-through; color: var(--color-muted); }
.tk-checklist small, .tk-history small { display: block; color: var(--color-muted); font-size: 11px; }
.tk-add-item { display: flex; gap: 6px; }
.tk-add-item input { flex: 1; min-width: 0; }
.tk-history { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: 0.88rem; }
.tk-routine-list, .tk-commitments { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.tk-routine-list li, .tk-commitments li { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid var(--color-border); border-radius: 10px; padding: 8px 10px; flex-wrap: wrap; }
.tk-routine-list li.is-inactive { opacity: 0.6; }
.tk-routine-list small, .tk-commitments small { display: block; color: var(--color-muted); font-size: 12px; }
.tk-commitments li.is-overdue { border-color: #FDA29B; background: #FFFBFA; }
.tk-routine-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tk-routine-edit { border: 1px solid var(--color-border); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.tk-reasons { margin: 4px 0; padding-left: 18px; font-size: 0.86rem; color: var(--color-text-soft); }
.tk-reasons .is-overdue { color: #B42318; }
.coach-priority { border-left-color: #7A5AF8; }
.coach-metrics { margin-bottom: 8px; }
.coach-hist-filter { max-width: 260px; margin-bottom: 8px; }
.tk-section.is-hidden, #tk-form-repeat-options.is-hidden, .tk-routine-edit.is-hidden { display: none; }

/* destaques em outras telas */
.dash-alert-task { margin-left: 6px; }
.cp-tasks-block { margin-top: 12px; }
.cp-tasks-block ul { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 6px; }
.cp-tasks-block li { font-size: 0.88rem; border: 1px solid var(--color-border); border-radius: 8px; padding: 6px 10px; }

/* mobile: cartoes, botoes grandes, formulario curto */
@media (max-width: 768px) {
  .tk-week-grid { grid-template-columns: 1fr; }
  .tk-card-list { grid-template-columns: 1fr; }
  .tk-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tk-count--next { grid-column: span 2; }
  .tk-filters .ev-filter-field { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); }
  .tk-card-actions .primary-action, .tk-card-actions .secondary-action { min-height: 44px; flex: 1 1 auto; font-size: 0.95rem; }
  .tk-card-actions .ev-row-menu-trigger { min-height: 44px; width: 52px; }
  .tk-month-grid, .tk-month-head { gap: 2px; }
  .tk-cell { min-height: 52px; padding: 3px; }
  .tk-cell-counts b { font-size: 13px; }
  .tk-checklist label { min-height: 44px; }
  .tk-checklist input[type="checkbox"] { width: 26px; height: 26px; }
  .tk-form-card, .tk-detail-card, .tk-day-card, .tk-routines-card, .coach-card { width: 100vw; max-height: 100vh; border-radius: 0; }
  .tk-nav strong { order: -1; flex-basis: 100%; }

  #tk-list .table-wrap { overflow: visible; border: none; }
  #tk-list .tk-table, #tk-list .tk-table tbody { display: block; width: 100%; }
  #tk-list .tk-table thead { display: none; }
  #tk-list .tk-table tr { display: block; border: 1px solid var(--color-border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--color-surface); }
  #tk-list .tk-table td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border: none; padding: 5px 0; text-align: right; min-width: 0; }
  #tk-list .tk-table td::before { content: attr(data-label); flex: 0 0 34%; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--color-muted); }
  #tk-list .tk-table td[data-label="Tarefa"] { display: block; text-align: left; }
  #tk-list .tk-table td[data-label="Tarefa"]::before { display: none; }
  #tk-list .tk-table td.cp-actions { justify-content: flex-start; flex-wrap: wrap; padding-top: 10px; }
  #tk-list .tk-table td.cp-actions::before { display: none; }
  #tk-list .tk-table td.cp-actions .primary-action, #tk-list .tk-table td.cp-actions .secondary-action { min-height: 44px; flex: 1 1 auto; }
}
