/* ============================================================
   CAHIER DES TÂCHES — éditorial joy (mockup tasks-page.jsx)
   ------------------------------------------------------------
   Règle d'or : aucune couleur en dur. Tokens thème + --joy-*.
   La teinte d'une ligne (--tk-ink/--tk-tint) = priorité ; le chip
   couple porte sa propre teinte inline (mariage → hue stable).
   ============================================================ */

.tk-page { display: flex; flex-direction: column; gap: 26px; }

/* En-tête */
.tk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.tk-title { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 5vw, 50px); line-height: 1.05; margin: 10px 0 0; color: var(--ink); letter-spacing: -.01em; }
.tk-title em { font-style: italic; color: var(--accent); }
.tk-sub { margin-top: 10px; display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--muted); flex-wrap: wrap; }
.tk-sub b { font-weight: 400; font-style: normal; color: var(--ink-soft); }
.tk-sub .done b { color: var(--joy-sage-ink); }
.tk-sub-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted-soft); }
.tk-actions { display: flex; gap: 12px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }

.tk-select { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 11px 14px; cursor: pointer; outline: none; min-width: 170px; transition: border-color .15s ease; }
.tk-select:focus { border-color: var(--accent); }
.tk-btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-family: var(--sans); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; padding: 11px 18px; border-radius: 3px; transition: filter .15s ease, background .15s ease, transform .12s ease; white-space: nowrap; }
.tk-btn:active { transform: translateY(1px); }
.tk-btn-ghost { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line); }
.tk-btn-ghost:hover { background: var(--surface-tinted); }
.tk-btn-primary { background: var(--primary); color: #fff; border: 1px solid var(--primary); }
.tk-btn-primary:hover { filter: brightness(1.08); }

/* Stats */
.tk-stats { display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 5%, transparent); }
.tk-stat { flex: 1; padding: 22px 26px; position: relative; cursor: default; background: transparent; border: none; text-align: left; transition: background .2s ease; min-width: 0; }
.tk-stat + .tk-stat { border-left: 1px solid var(--line-soft); }
.tk-stat.is-clickable { cursor: pointer; }
.tk-stat.is-clickable:hover { background: color-mix(in srgb, var(--tk-tint) 30%, transparent); }
.tk-stat.is-active { background: color-mix(in srgb, var(--tk-tint) 45%, transparent); box-shadow: inset 0 -2px 0 var(--tk-ink); }
.tk-stat-head { display: flex; align-items: center; gap: 8px; }
.tk-stat-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tk-ink); }
.tk-stat-label { font-family: var(--sans); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tk-stat-num { margin-top: 12px; font-family: var(--serif); font-size: 44px; line-height: 1; color: var(--ink); font-feature-settings: "lnum"; }
.tk-stat.is-active .tk-stat-num, .tk-stat.has-num .tk-stat-num { color: var(--tk-ink); }
.tk-stat-ico { position: absolute; right: 18px; top: 20px; color: var(--tk-ink); opacity: .2; transition: opacity .2s ease; }
.tk-stat.is-clickable:hover .tk-stat-ico { opacity: .5; }

/* Filtre priorité (segmenté) */
.tk-priofilter { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; align-self: flex-start; flex-wrap: wrap; }
.tk-prio { display: inline-flex; align-items: center; gap: 7px; font-family: var(--sans); font-size: 11.5px; letter-spacing: .04em; font-weight: 500; padding: 8px 16px; border-radius: 999px; border: none; cursor: pointer; background: transparent; color: var(--muted); transition: background .18s ease, color .18s ease; }
.tk-prio:hover { color: var(--ink-soft); }
.tk-prio.on { background: var(--ink); color: var(--surface); font-weight: 600; }
.tk-prio-dot2 { width: 7px; height: 7px; border-radius: 50%; background: var(--tk-ink); }
.tk-prio.on .tk-prio-dot2 { background: var(--tk-tint); }

/* Cartes liste */
.tk-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; position: relative; box-shadow: 0 10px 30px color-mix(in srgb, var(--ink) 5%, transparent); }
.tk-sprig { position: absolute; top: -8px; right: -6px; transform: rotate(18deg); pointer-events: none; }
.tk-card-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 22px 14px; }
.tk-card-head-l { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex-wrap: wrap; }
.tk-card-title { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0; color: var(--ink); }
.tk-card-title em { font-style: italic; color: var(--accent); }
.tk-card-scope { font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.tk-card-count { font-family: var(--serif); font-size: 15px; font-style: italic; color: var(--accent); width: 32px; height: 32px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 33%, transparent); display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 8%, transparent); flex-shrink: 0; }

/* Ligne tâche */
.tk-row { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 16px; align-items: center; padding: 15px 20px 15px 16px; position: relative; transition: background .18s ease; }
.tk-row + .tk-row { border-top: 1px solid var(--line-soft); }
.tk-row:hover { background: color-mix(in srgb, var(--tk-tint) 22%, transparent); }
.tk-row.done { opacity: .62; }
.tk-row.done:hover { background: transparent; }
.tk-row-accent { position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--tk-ink); opacity: 0; transition: opacity .18s ease; }
.tk-row:hover .tk-row-accent { opacity: 1; }
.tk-row.done .tk-row-accent { display: none; }

/* Checkbox animée */
.tk-check { position: relative; width: 22px; height: 22px; flex-shrink: 0; cursor: pointer; padding: 0; border-radius: 6px; border: 1.5px solid var(--line); background: transparent; display: flex; align-items: center; justify-content: center; transition: background .2s ease, border-color .2s ease, transform .12s ease; }
.tk-check:hover { border-color: var(--tk-ink); }
.tk-check:active { transform: scale(.9); }
.tk-check.done { background: var(--tk-ink); border-color: var(--tk-ink); }
.tk-check svg { color: #fff; opacity: 0; transform: scale(.4); transition: opacity .2s ease, transform .2s ease; }
.tk-check.done svg { opacity: 1; transform: scale(1); }

.tk-row-main { min-width: 0; }
.tk-row-titleline { display: flex; align-items: center; gap: 10px; }
.tk-prio-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tk-ink); flex-shrink: 0; }
.tk-row-title { font-family: var(--sans); font-size: 14.5px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .2s ease; }
.tk-row.done .tk-row-title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--tk-ink) 60%, transparent); }
.tk-row-meta { margin-top: 6px; margin-left: 17px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tk-row.done .tk-row-meta { margin-left: 0; }
.tk-couple { font-family: var(--sans); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--c-ink); background: var(--c-tint); padding: 3px 9px; border-radius: 999px; white-space: nowrap; cursor: pointer; }
.tk-due { font-family: var(--serif); font-style: italic; font-size: 13.5px; white-space: nowrap; }
.tk-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 78px; font-family: var(--sans); font-size: 9.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: 5px 11px; border-radius: 999px; color: var(--tk-ink); background: var(--tk-tint); border: 1px solid color-mix(in srgb, var(--tk-ink) 28%, transparent); white-space: nowrap; }
.tk-chip.solid { background: var(--tk-ink); color: var(--surface); border-color: var(--tk-ink); }

.tk-tools { display: flex; gap: 2px; width: 60px; justify-content: flex-end; opacity: 0; transform: translateX(4px); transition: opacity .16s ease, transform .16s ease; }
.tk-row:hover .tk-tools { opacity: 1; transform: none; }
.tk-tool { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s ease, color .15s ease; }
.tk-tool:hover { background: var(--bg-deep, var(--surface-tinted)); color: var(--ink-soft); }
.tk-tool.danger:hover { color: var(--danger, #b4665c); }

.tk-empty { padding: 50px 22px; text-align: center; font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--muted); }

/* Complétées (repliable) */
.tk-done-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; background: transparent; border: none; cursor: pointer; }
.tk-done-toggle .chev { transition: transform .2s ease; display: inline-flex; color: var(--muted); }
.tk-done-toggle.open .chev { transform: rotate(180deg); }
.tk-done-body { border-top: 1px solid var(--line-soft); }

/* Bannière filtre actif */
.tk-filter-banner { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 12px; color: var(--muted); background: var(--surface-tinted); border: 1px solid var(--line-soft); border-radius: 6px; padding: 10px 16px; }
.tk-filter-banner b { color: var(--ink-soft); font-weight: 600; }

/* Responsive */
@media (max-width: 760px) {
  .tk-stats { flex-wrap: wrap; }
  .tk-stat { flex: 1 1 50%; min-width: 50%; }
  .tk-stat:nth-child(3) { border-left: none; }
  .tk-stat:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .tk-row { grid-template-columns: 22px 1fr auto; }
  .tk-chip { display: none; }
  .tk-tools { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tk-check, .tk-check svg, .tk-row, .tk-tools, .tk-stat { transition: none !important; }
}

/* ── Modale tâche — touches éditoriales ───────────────────── */
.tk-modal .modal-header { position: relative; }
.tk-modal-eyebrow { display: block; font-family: var(--sans); font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.tk-modal .modal-header h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; letter-spacing: -.01em; color: var(--ink); margin: 0; }
.tk-modal .form-label { font-family: var(--sans); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tk-modal .form-input:focus,
.tk-modal .form-select:focus,
.tk-modal .form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
/* Barre d'actions contextuelle (terminer / supprimer / & voir le mariage) */
.tk-modal .task-modal-actions { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line-soft, var(--color-border-light)); }
