/* The Tasks tab. Owned tonight by the tasks agent; see docs/FEATURES.md and
   docs/tasks.md. The add row itself (.task-add, .inp) is shared with Ideas and
   Chat and lives in styles.css; only the order of its parts is set here, and
   only inside #tab-tasks. Colours are the app's own tokens from styles.css. */

/* Quick add. On a phone the title and Add share the first line, who it is for
   and when it is due the second, and how urgent it is the third, so nothing
   is squeezed. */
#tab-tasks .task-add{align-items:stretch}
#tab-tasks #task-title{flex:1 1 calc(100% - 96px);min-width:0;order:0}
#tab-tasks #task-add-btn{order:1}
#tab-tasks #task-assignee{order:2;flex:1 1 96px}
#tab-tasks #task-due{order:2;flex:1 1 140px}
#tab-tasks .tk-pri-quick{order:3}

/* Two switches share one look: Normal / High / Urgent, and Open / Mine / Done. */
.tk-pri,.tk-seg{display:inline-flex;gap:3px;background:var(--well);border:1px solid #000;border-radius:10px;padding:3px 3px 5px;box-shadow:var(--well-in)}
.tk-pri button,.tk-seg button{border:1px solid transparent;background:none;color:var(--muted);font-weight:600;font-size:13px;min-height:38px;padding:0 11px;border-radius:7px}
.tk-pri button[aria-pressed="true"],.tk-seg button[aria-pressed="true"]{background:var(--key);border-color:#050607;box-shadow:var(--key-edge);color:var(--text)}
.tk-pri .tk-pri-high[aria-pressed="true"]{color:#f6c66e}
.tk-pri .tk-pri-urgent[aria-pressed="true"]{color:#1a0703;background:var(--gloss),linear-gradient(180deg,#f47559,#d24e31);border-color:#4e170b;box-shadow:inset 0 1px 0 rgba(255,255,255,.4),0 3px 0 #5e1d0e,0 0 14px rgba(224,87,58,.35)}
.tk-seg button{font-size:14px;padding:0 11px}
.tk-seg-n{font-family:var(--mono);font-weight:500;font-size:11.5px;color:var(--dim);margin-left:6px}
.tk-seg-n:empty{display:none}

.tk-bar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 8px;margin:0 0 6px}
.tk-week{font-size:13px;color:var(--muted)}
.tk-week b{font-family:var(--mono);font-size:16px;color:var(--green);margin-right:1px}

/* Headings in the order things need doing. Red where waiting costs something. */
.tk-group{display:flex;align-items:baseline;gap:8px;font-size:13.5px;font-weight:700;color:var(--muted);margin:18px 2px 8px}
.tk-group-n{font-family:var(--mono);font-size:12px;font-weight:500;color:var(--dim)}
.tk-group-urgent,.tk-group-overdue{color:var(--red)}
#task-list > .empty{margin-top:10px}

/* A task. The tick on the left, the title beside it, "I'm on it" on the right,
   and everything else underneath across the full width. */
.tk{display:grid;grid-template-columns:30px minmax(0,1fr) auto;column-gap:12px;row-gap:5px;align-items:start;background:var(--module);border:1px solid #050607;border-radius:11px;padding:12px;margin-bottom:8px;box-shadow:var(--bevel)}
.tk-urgent:not(.is-done){border-color:rgba(224,87,58,.55)}
.tk.is-late{background:linear-gradient(90deg,rgba(224,87,58,.12),rgba(224,87,58,0) 60%),var(--module);box-shadow:var(--bevel),inset 3px 0 0 var(--red)}
.tk.is-done{opacity:.6}

/* The tick is a 44px target around a 28px ring. With a checklist, the rim
   fills clockwise as its steps are ticked (--p is the share done). */
.tk-check{width:44px;height:44px;margin:-7px;padding:0;border:0;background:none;display:grid;place-items:center;border-radius:50%}
.tk-ring{--p:0;width:28px;height:28px;border-radius:50%;display:grid;place-items:center;
  background:radial-gradient(closest-side,var(--panel) calc(100% - 3px),transparent calc(100% - 2.5px)),
             conic-gradient(var(--green) calc(var(--p) * 1turn),#433d37 0);
  transition:transform .18s ease-out}
.tk-tick{font-size:14px;font-weight:800;line-height:1;color:transparent}
.tk-check:hover .tk-tick{color:var(--dim)}
.is-done .tk-ring,.is-finishing .tk-ring{background:var(--green)}
.is-done .tk-tick,.is-finishing .tk-tick{color:#0c1f14}
.is-finishing .tk-ring{transform:scale(1.18)}
.is-reopening .tk-ring{transform:scale(.85)}

.tk-title{grid-column:2;text-align:left;background:none;border:0;padding:5px 0 0;color:var(--text);font-size:15px;font-weight:600;line-height:1.3;overflow-wrap:anywhere}
.is-done .tk-title,.is-finishing .tk-title{text-decoration:line-through;color:var(--muted)}

.tk-claim{grid-column:3;grid-row:1;min-height:36px;padding:0 13px;border-radius:8px;border:1px solid #050607;background:var(--key);box-shadow:var(--key-edge),inset 0 0 0 1px rgba(240,138,92,.28);color:#ffb08a;font-size:13px;font-weight:700;white-space:nowrap}
.tk-claim:hover{filter:brightness(1.12)}
.tk-claim.is-mine{background:var(--lit);border-color:#4a1c0b;box-shadow:var(--lit-edge);color:#1a0a04}
.tk-claim.is-taken{box-shadow:var(--key-edge);color:var(--muted);font-weight:600}

.tk-meta{grid-column:2 / 4;display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;font-size:12.5px;color:var(--dim)}
.tk-chip{font-size:11.5px;font-weight:700;padding:2px 8px;border-radius:6px;line-height:1.35}
.tk-when.is-late{color:var(--red);font-weight:600}
.tk-count{font-family:var(--mono);font-size:12px}
.tk-notes{grid-column:2 / 4;font-size:12.5px;color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* The edit form. */
.tk-made{font-size:12.5px;color:var(--dim);margin:-4px 0 14px}
.tk-two{display:flex;gap:8px}
.tk-two input{flex:1;min-width:0}
.tk-form input[type="date"],.tk-form input[type="time"]{color-scheme:dark}
.tk-hint{font-size:12px;color:var(--dim);margin-top:6px;line-height:1.4}

.tk-cl{border-top:1px solid var(--line);padding-top:14px;margin-top:4px}
.tk-cl-head{display:flex;justify-content:space-between;align-items:baseline}
.tk-cl-n{font-family:var(--mono);font-size:12px;color:var(--muted)}
.tk-track{height:6px;border-radius:3px;background:var(--well);box-shadow:inset 0 1px 2px rgba(0,0,0,.8);overflow:hidden;margin:2px 0 6px}
.tk-fill{height:100%;background:var(--green);box-shadow:0 0 8px rgba(51,209,122,.6);border-radius:3px;transition:width .25s ease-out}
.tk-item{display:flex;align-items:center;gap:6px;border-bottom:1px solid var(--line)}
.tk-item-tick{width:40px;height:40px;flex:none;border:0;background:none;padding:0;display:grid;place-items:center;margin-left:-8px}
.tk-item-tick span{width:22px;height:22px;border-radius:6px;border:1.5px solid #4a443d;display:grid;place-items:center;font-size:13px;font-weight:800;color:transparent}
.tk-item-tick[aria-pressed="true"] span{background:var(--green);border-color:var(--green);color:#0c1f14}
.tk-item-text{flex:1;min-width:0;font-size:14px;line-height:1.35;overflow-wrap:anywhere;padding:6px 0}
.tk-item.is-done .tk-item-text{color:var(--dim);text-decoration:line-through}
.tk-item-who{display:inline-block;margin-left:7px;font-size:11.5px;color:var(--dim)}
.tk-item-tools{display:flex;flex:none}
.tk-item-tools button{width:30px;height:36px;border:0;background:none;color:var(--dim);font-size:14px;padding:0}
.tk-item-tools button:hover:not(:disabled){color:var(--text)}
.tk-item-tools button:disabled{opacity:.25;cursor:default}
.tk-cl-add{display:flex;gap:8px;margin-top:10px}
.tk-cl-add input{flex:1;min-width:0}

.tk-actions{flex-wrap:wrap;margin-top:14px}
.tk-actions .btn{flex:1}
.tk-actions .btn-primary{flex:1 1 100%}

/* Keyboard focus is always visible, on the dark panels too. */
.tk button:focus-visible,.tk-seg button:focus-visible,.tk-pri button:focus-visible,.tk-item button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

@media (prefers-reduced-motion: reduce){
  .tk-ring,.tk-fill{transition:none}
  .is-finishing .tk-ring,.is-reopening .tk-ring{transform:none}
}
