/* Tasks workspace (see app.js renderTasksPage). Built on the Money design
   system: the .money-app shell and .m-* parts from money.css, the pl- sidebar
   pieces from pipeline.css, and the tk- pieces below. Designed in Figma, page
   "Tasks". Every colour is a money token, so the dark theme follows. */

.tk-navbtn { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.tk-seglabel { font-size: 11.5px; font-weight: 500; color: var(--m-faint); }
.tk-status { flex: 1; min-width: 160px; font-size: 11.5px; color: var(--m-faint); }

/* ---- sidebar ---- */
.tk-deals { display: flex; flex-direction: column; gap: 1px; }
.tk-deal { display: flex; align-items: center; gap: 9px; width: 100%; padding: 5px 10px; border: 0; border-radius: 7px; background: none; font: inherit; color: var(--m-ink); text-align: left; cursor: pointer; }
.tk-deal:hover { background: var(--m-surface-2); }
.tk-deal.active { background: var(--m-accent-soft); }
.tk-deal .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tk-deal .a, .tk-deal .c { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-deal .a { font-size: 12px; font-weight: 500; }
.tk-deal .c { font-size: 10.5px; color: var(--m-faint); }
.tk-deal.active .a { color: var(--m-accent); font-weight: 600; }
.tk-owners { display: flex; flex-wrap: wrap; gap: 6px; }
.tk-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 0; border-radius: 999px; background: var(--m-surface-2); color: var(--m-muted); font: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.tk-chip b { font-weight: 600; color: var(--m-ink); }
.tk-chip:hover { color: var(--m-ink); }
.tk-chip.on { background: var(--m-accent-soft); color: var(--m-accent); font-weight: 600; }
.tk-chip.on b { color: var(--m-accent); }
.tk-foot-note { font-size: 11px; line-height: 1.45; color: var(--m-faint); }

/* ---- brain dump and review ---- */
.tk-dump textarea { display: block; width: 100%; min-height: 84px; resize: vertical; font: inherit; font-size: 13px; line-height: 1.5; padding: 12px 14px; border: 1px solid var(--m-line); border-radius: 10px; background: var(--m-surface); color: var(--m-ink); }
.tk-dump textarea::placeholder { color: var(--m-faint); }
.tk-dump textarea:focus { outline: none; border-color: var(--m-accent); box-shadow: 0 0 0 3px var(--m-accent-soft); }
.tk-dump-acts { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tk-review .m-card-head { margin-bottom: 4px; }
.tk-note { margin: 8px 0 4px; }
.tk-draft-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--m-line-soft); }
.tk-draft-line { display: grid; grid-template-columns: minmax(0, 1fr) 140px 120px; gap: 10px; align-items: end; }
.tk-draft-line.b { grid-template-columns: minmax(0, 1fr) 250px 32px; }
.tk-notify { padding-bottom: 9px; font-size: 12px; }
.tk-discard { margin-bottom: 3px; }
.tk-draft-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--m-line); }

/* ---- list ---- */
.tk-listhead { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 4px 20px 0; border-bottom: 1px solid var(--m-line); }
.tk-tabs { display: flex; gap: 4px; }
.tk-tab { display: inline-flex; align-items: center; gap: 6px; padding: 11px 6px 10px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--m-muted); cursor: pointer; white-space: nowrap; }
.tk-tab:hover { color: var(--m-ink); }
.tk-tab .n { font-size: 11px; font-weight: 600; color: var(--m-faint); }
.tk-tab.active { color: var(--m-accent); border-bottom-color: var(--m-accent); font-weight: 600; }
.tk-tab.active .n { color: var(--m-accent); }
.tk-owner { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 0; }
.tk-group { display: flex; align-items: center; gap: 8px; padding: 8px 20px; border-top: 1px solid var(--m-line-soft); background: color-mix(in srgb, var(--m-surface-2) 60%, transparent); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--m-faint); }
.tk-listhead + .tk-group, .tk-listhead + .tk-month { border-top: 0; }
.tk-group .n { letter-spacing: 0; font-weight: 600; }
.tk-group.warn { color: var(--m-warn); }
.tk-group.deal { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--m-ink); }
.money-app .tk-group.deal a { font-weight: 600; }
.money-app .tk-group.deal a:hover { color: var(--m-accent); }
.tk-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 11px 20px; border-top: 1px solid var(--m-line-soft); cursor: pointer; }
.tk-row:hover { background: var(--m-surface-2); }
.tk-row.sel { background: var(--m-accent-soft); box-shadow: inset 3px 0 0 var(--m-accent); }
.tk-check { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--m-line); border-radius: 999px; color: #fff; }
.tk-row:hover .tk-check { border-color: var(--m-pos); }
.tk-row.done .tk-check { background: var(--m-pos); border-color: var(--m-pos); }
.money-app .tk-check svg.i { width: 11px; height: 11px; stroke-width: 3; }
.tk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.tk-text { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.tk-row.done .tk-text { color: var(--m-faint); text-decoration: line-through; }
.tk-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.tk-where { font-size: 11.5px; color: var(--m-faint); }
.tk-due { font-size: 12px; font-weight: 500; color: var(--m-muted); white-space: nowrap; }
.tk-due.late { color: var(--m-warn); font-weight: 600; }
.tk-acts { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .1s; }
.tk-row:hover .tk-acts, .tk-row:focus-within .tk-acts, .tk-row.sel .tk-acts { opacity: 1; }
.tk-empty { padding: 28px 20px; text-align: center; font-size: 12.5px; color: var(--m-faint); }
.tk-month { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--m-line-soft); }
.tk-month .pl-select { width: auto; min-width: 160px; }

/* ---- detail ---- */
.tk-cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.tk-side-stack { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 74px; min-width: 0; }
.tk-detail { display: flex; flex-direction: column; gap: 14px; }
.tk-detail-top { display: flex; align-items: center; gap: 6px; }
.tk-detail-top .m-iconbtn { margin-left: auto; }
.tk-detail h2 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.tk-facts { display: flex; flex-direction: column; }
.tk-fact { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--m-line-soft); font-size: 12.5px; }
.tk-fact .k { color: var(--m-faint); flex-shrink: 0; }
.tk-fact .v { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.money-app .tk-fact a.v { color: var(--m-accent); font-weight: 600; }
.tk-edit { display: flex; flex-direction: column; gap: 10px; }
.tk-edit-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tk-detail-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--m-line); }
.tk-detail-acts .danger { margin-left: auto; border-color: transparent; }
.tk-others { padding-bottom: 8px; }
.tk-others .m-card-title { margin-bottom: 6px; }
.tk-other { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 0; border: 0; border-top: 1px solid var(--m-line-soft); background: none; font: inherit; color: var(--m-ink); text-align: left; cursor: pointer; }
.tk-other:hover .t { color: var(--m-accent); }
.tk-other .tk-check { width: 14px; height: 14px; }
.tk-other .t { flex: 1; min-width: 0; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-other .d { font-size: 11.5px; color: var(--m-faint); white-space: nowrap; }

@media (hover: none) { .tk-acts { opacity: 1; } }
@media (max-width: 1100px) {
  .tk-cols { grid-template-columns: minmax(0, 1fr); }
  .tk-side-stack { position: static; }
}
@media (max-width: 900px) {
  /* one column that may shrink below its content, and rows that do not stretch */
  .tk-app { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .tk-side .tk-deals, .tk-side .tk-foot { display: none; }
  .tk-side .tk-navbtn { width: auto; }
  .tk-draft-line, .tk-draft-line.b { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tk-draft-line .tk-f-text, .tk-draft-line .tk-f-deal { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .tk-row { flex-wrap: wrap; }
  .tk-due { margin-left: 30px; }
  .tk-acts { margin-left: auto; }
}

/* Where a task lives: on a transaction (a deal's todos) or in the CRM. */
.tk-src { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.tk-src.tx { background: var(--m-accent-soft); color: var(--m-accent-ink, var(--m-accent)); }
.tk-src.crm { background: var(--m-pos-soft); color: var(--m-pos); }
