/* tasks module styles — tokens from app.css only (no raw hex). Prefix: tk- */

/* ───────── quick add ───────── */
.tk-quick {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 8px 0 14px;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--muted); transition: border-color 0.12s, box-shadow 0.12s;
}
.tk-quick:focus-within { border-style: solid; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); color: var(--text-2); }
.tk-quick-input {
  flex: 1 1 auto; min-width: 0; height: 46px; border: 0; background: transparent; color: var(--text);
  font: 500 14.5px/1.3 var(--font); outline: none;
}
.tk-quick-input::placeholder { color: var(--faint); }
.tk-quick-key { flex: none; }
.tk-quick-tip { margin: 6px 2px 16px; font-size: 12px; color: var(--faint); }
.tk-quick-tip b { color: var(--muted); font-weight: 600; }

/* ───────── toolbar & filters ───────── */
.tk-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.tk-toolbar .search-input { flex: 0 1 240px; }
.tk-filter { display: inline-flex; min-width: 0; }
.tk-filter .input { width: auto; min-width: 136px; max-width: 210px; }
.tk-filter-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 10px; max-width: 240px;
  border-radius: 999px; background: var(--red-soft); color: var(--text); font-size: 12.5px; font-weight: 600;
}
.tk-filter-chip button { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); cursor: pointer; }
.tk-filter-chip button:hover { background: var(--surface-3); color: var(--text); }

/* ───────── grouped list ───────── */
.tk-groups { display: flex; flex-direction: column; gap: 14px; }
.tk-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.tk-group-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-2); min-height: 44px; }
.tk-group-title { font: 600 12px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-2); }
.tk-group-overdue { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.tk-group-overdue .tk-group-title { color: var(--red-ink); }
.tk-list { display: flex; flex-direction: column; }
.tk-pad { padding: 12px 14px; }

.tk-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; min-width: 0; transition: background 0.1s;
}
.tk-row:last-child { border-bottom: 0; }
.tk-row:hover { background: var(--surface-2); }
.tk-row.is-overdue { box-shadow: inset 3px 0 0 var(--red); }
.tk-row.is-done .tk-title { text-decoration: line-through; color: var(--muted); }

.tk-check { position: relative; width: 20px; height: 20px; border-radius: 50%; margin-top: 1px; }
.tk-check::after { content: ''; position: absolute; inset: -10px; }
.tk-check:disabled { opacity: 0.5; cursor: progress; }
.tk-row.is-overdue .tk-check:not(.done) { border-color: color-mix(in srgb, var(--red) 70%, var(--border-strong)); }

.tk-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.tk-title {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  font: 600 14px/1.35 var(--font); color: var(--text); overflow-wrap: anywhere;
}
.tk-title:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
.tk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--muted); }
.tk-due { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; white-space: nowrap; }
.tk-icon { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; }
.tk-side { flex: none; display: flex; align-items: center; gap: 6px; }
.tk-unassigned { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1px dashed var(--border-strong); color: var(--faint); }

.tk-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; max-width: 220px; min-width: 0;
  border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
}
a.tk-chip:hover { background: var(--border-strong); color: var(--text); }
.tk-chip .icon { color: var(--muted); }
.tk-chip-seq { background: var(--violet-soft); color: var(--violet-ink); }
.tk-chip-seq .icon { color: var(--violet-ink); }

.tk-done-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 10px 14px; border: 0; background: var(--bg-2);
  color: var(--text-2); cursor: pointer; text-align: left; font: 600 12px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.09em;
}
.tk-done-toggle:hover { color: var(--text); }
.tk-done-toggle[aria-expanded='true'] { border-bottom: 1px solid var(--border); }

/* ───────── board ───────── */
.tk-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tk-card-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.tk-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.tk-status-select { height: 28px; flex: 1 1 auto; min-width: 0; font-size: 12.5px; padding: 0 26px 0 8px; background-position: right 8px center; }

/* ───────── task modal ───────── */
.tk-context { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.tk-compose-hint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--blue-soft); color: var(--text); font-size: 13px;
}
.tk-compose-hint .icon { color: var(--blue-ink); }

/* ───────── templates ───────── */
.tk-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tk-tpl-group .section-title { display: inline-flex; align-items: center; gap: 8px; }
.tk-tpl-card {
  display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 13px 14px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font: inherit;
  transition: border-color 0.12s, background 0.12s;
}
.tk-tpl-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.tk-tpl-card.is-paused { opacity: 0.7; }
.tk-tpl-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tk-tpl-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.tk-tpl-subject { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.tk-tpl-preview {
  font-size: 12.5px; line-height: 1.5; color: var(--muted); white-space: pre-line; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere;
}
.tk-tpl-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; }
.tk-tpl-foot .icon { vertical-align: -2px; }
.tk-token { font: 500 11px/1.4 var(--mono); padding: 0 4px; border-radius: 4px; background: var(--blue-soft); color: var(--blue-ink); white-space: nowrap; }
.tk-missing { background: var(--amber-soft); color: var(--amber-ink); border-radius: 3px; padding: 0 3px; font-family: var(--mono); font-size: 0.92em; }

.tk-editor { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.tk-editor-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tk-merge { display: flex; flex-wrap: wrap; gap: 6px; }
.tk-merge-btn {
  height: 26px; padding: 0 9px; border-radius: 999px; border: 1px dashed var(--border-strong); background: var(--surface-2);
  color: var(--text-2); font: 500 11.5px/1 var(--mono); cursor: pointer;
}
.tk-merge-btn:hover { border-style: solid; border-color: var(--blue-ink); color: var(--text); background: var(--blue-soft); }
.tk-merge-btn.is-billing { border-color: color-mix(in srgb, var(--amber) 50%, var(--border-strong)); }
.tk-preview-wrap { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; min-width: 0; }
.tk-preview-subject { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.tk-preview {
  padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border);
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.55; color: var(--text); max-height: 52vh; overflow-y: auto;
}
.tk-preview.is-bubble { border-radius: 18px 18px 4px 18px; background: var(--blue-soft); border-color: transparent; align-self: flex-end; max-width: 100%; }
.tk-raw { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.55; }
.tk-raw-body { max-height: 46vh; overflow-y: auto; }

/* ───────── sequence ───────── */
.tk-seq-wrap { margin-top: 26px; }
.tk-seq-intro { margin-bottom: 10px; max-width: 80ch; }
.tk-seq { list-style: none; margin: 0; padding: 0; }
.tk-seq-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.tk-seq-step:last-child { border-bottom: 0; }
.tk-seq-num {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font: 600 12px/1 var(--mono); background: var(--surface-3); color: var(--text-2);
}
.tk-seq-num.a-shoot_date { background: var(--red-soft); color: var(--red-ink); }
.tk-seq-num.a-midpoint { background: var(--amber-soft); color: var(--amber-ink); }
.tk-seq-num.a-delivery_due { background: var(--green-soft); color: var(--green-ink); }
.tk-seq-num.a-delivered_on { background: var(--violet-soft); color: var(--violet-ink); }
.tk-seq-main { min-width: 0; }
.tk-seq-name { font-weight: 600; font-size: 13.5px; }
.tk-seq-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.tk-seq-when { font: 500 11.5px/1.3 var(--mono); color: var(--text-2); }
.tk-link { padding: 0; border: 0; background: none; color: var(--text-2); cursor: pointer; font: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.tk-link:hover { color: var(--text); text-decoration-color: var(--red); }
.tk-warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.tk-warn .icon { color: var(--amber-ink); }

/* ───────── responsive ───────── */
@media (max-width: 900px) {
  .tk-editor { grid-template-columns: minmax(0, 1fr); }
  .tk-preview-wrap { position: static; }
}
@media (max-width: 640px) {
  .tk-toolbar .search-input { flex: 1 1 100%; }
  .tk-filter { flex: 1 1 calc(50% - 4px); }
  .tk-filter .input { width: 100%; max-width: none; min-width: 0; }
  .tk-row { padding: 11px 12px; gap: 10px; }
  .tk-compose span { display: none; }
  .tk-compose { width: 28px; padding: 0; }
  .tk-chip { max-width: 160px; }
  .tk-editor-row { grid-template-columns: minmax(0, 1fr); }
  .tk-seq-step { grid-template-columns: 28px minmax(0, 1fr); }
  .tk-seq-step > .row { grid-column: 2; }
}
