/* NeoCom — Tasks tab (tl-) and task detail pane (td-). Tokens and shared components come from styles.css.
   Field overrides are prefixed with #view / #detail / #sheet-root because the base input rule is specific. */

/* ================= Tasks tab ================= */

/* quick add: always on screen. Sticky offsets are measured from the scroller's padding edge, hence the -4px. */
.tl-add {
  position: sticky; top: -4px; z-index: 4; display: flex; gap: 8px;
  margin: -4px calc(-1 * var(--gutter)) 0; padding: 6px var(--gutter) 10px; background: var(--bg);
}
#view .tl-add input { height: 46px; padding: 0 14px; border-radius: 14px; background: var(--surface); font-size: 16px; }
.tl-add .icon-btn { width: 46px; height: 46px; border-radius: 14px; color: var(--muted); }

/* whose list */
.tl-who { display: flex; width: 100%; }
.tl-who button { flex: 1 1 0; min-width: 0; min-height: 38px; padding: 6px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tl-who-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-count { flex: none; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 700; }
.tl-who button.on .tl-count { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }

/* which list */
.tl-lists {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: 8px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter);
}
.tl-lists::-webkit-scrollbar { display: none; }
.tl-lists .chip { flex: none; min-height: 36px; padding: 6px 13px; }
.tl-em { font-size: 14px; line-height: 1; }

/* the list */
.tl-list { margin-top: 10px; }
.tl-row { position: relative; display: flex; align-items: stretch; background: var(--surface); border-top: 1px solid var(--line); }
.tl-row:first-child { border-top: 0; }
.tl-grip, .td-grip {
  flex: none; width: 32px; display: grid; place-items: center; color: var(--muted); opacity: .6;
  touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.tl-grip .ico, .td-grip .ico { width: 20px; height: 20px; pointer-events: none; }
.tl-tick, .td-tick { flex: none; width: 38px; display: grid; place-items: center; cursor: pointer; }
.tl-main { flex: 1; min-width: 0; min-height: 54px; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 4px; text-align: left; }
.tl-text { flex: 1; min-width: 0; display: block; }
.tl-title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  overflow-wrap: anywhere; font-weight: 600; line-height: 1.3;
}
.tl-row.unread .tl-title { font-weight: 750; }
.tl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px; margin-top: 4px; font-size: 12.5px; line-height: 1.2; color: var(--muted); }
.tl-m { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.tl-m .ico { width: 14px; height: 14px; }
.tl-m.overdue { color: var(--danger); font-weight: 650; }
.tl-m.today { color: var(--warn); font-weight: 650; }
.tl-m .avatar.sm { width: 18px; height: 18px; font-size: 10px; }
.tl-m .avatar-pair .avatar + .avatar { margin-left: -6px; box-shadow: 0 0 0 1.5px var(--surface); }
.tl-flag {
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; padding: 2px 8px 2px 5px; border-radius: 999px;
  background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); font-weight: 700; font-size: 12px;
}
.tl-flag .ico { width: 14px; height: 14px; }
.tl-main .dot { box-shadow: 0 0 8px var(--accent); }
body.wide .tl-row.on { background: color-mix(in srgb, var(--accent) 13%, var(--surface)); box-shadow: inset 3px 0 0 var(--accent); }
.tl-row.tl-leaving { opacity: .35; transition: opacity .17s ease; }
.tl-row.tl-leaving .tl-title { text-decoration: line-through; }

/* dragging (the task list and the sub-task list share this) */
.tl-sorting { -webkit-user-select: none; user-select: none; }
.tl-sorting > * { transition: transform .16s cubic-bezier(.2, .8, .2, 1); }
.tl-sorting > .tl-dragging {
  transition: none; z-index: 3; border-radius: 12px; border-color: transparent; background: var(--surface-2);
  box-shadow: 0 0 0 1.5px var(--accent) inset, 0 10px 26px rgba(0, 0, 0, .4);
}
.tl-sorting > .tl-dragging.tl-settling { transition: transform .13s ease; }
.tl-dragging .tl-grip, .tl-dragging .td-grip { opacity: 1; color: var(--accent); cursor: grabbing; }

/* upcoming */
.tl-up-head {
  display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 12px; padding: 11px 2px; text-align: left;
  color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
}
.tl-up-head .ico { width: 16px; height: 16px; }
.tl-up { margin-top: 0; }
.tl-soon-ico { flex: none; width: 42px; display: grid; place-items: center; color: var(--muted); opacity: .7; }
.tl-soon .tl-main { padding-left: 0; }
.tl-soon .tl-title { font-weight: 500; }

.tl-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px 28px; }
.tl-empty .ico { opacity: .45; margin-bottom: 4px; }
.tl-empty b { color: var(--text); font-size: 16px; }
.tl-empty p { margin: 0; max-width: 300px; }
.tl-empty p:empty { display: none; }
.tl-reset { width: auto; margin-top: 12px; padding: 0 20px; }

/* New task sheet */
.tl-pick { display: flex; width: 100%; }
.tl-pick label { position: relative; flex: 1 1 0; min-width: 0; cursor: pointer; }
.tl-pick input { position: absolute; opacity: 0; pointer-events: none; }
.tl-pick span {
  display: block; padding: 9px 6px; border-radius: 9px; text-align: center; color: var(--muted); font-weight: 600; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tl-pick input:checked + span { background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 1px var(--line) inset; }
.tl-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.tl-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; padding: 6px 2px; border-top: 1px solid var(--line); cursor: pointer; }
.tl-opt small { display: block; color: var(--muted); font-size: 12.5px; }
.tl-new .err { margin-top: 4px; }

/* "Every [2] [weeks]" */
.tl-repeat { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tl-every { display: flex; align-items: center; gap: 8px; flex: none; }
#sheet-root .tl-repeat input, #detail .tl-repeat input { width: 58px; padding-left: 6px; padding-right: 6px; text-align: center; }
#sheet-root .tl-repeat select { flex: 1; min-width: 0; }

/* on/off switch (New task sheet and the detail pane) */
.td-switch {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 46px; height: 28px; margin: 0;
  border-radius: 999px; background: color-mix(in srgb, var(--muted) 40%, transparent); cursor: pointer; transition: background .15s ease;
}
.td-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .15s ease;
}
.td-switch:checked { background: var(--accent); }
.td-switch:checked::after { transform: translateX(18px); }
.td-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================= Task detail ================= */

.td-main-act {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 11px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.td-main-act .ico { width: 20px; height: 20px; }
.td-main-act.td-reopen { background: var(--surface); border: 1px solid var(--line); color: var(--text); }

.td-banner { display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.td-banner > span { flex: 1; min-width: 0; color: var(--text); }
.td-banner .ico { width: 20px; height: 20px; }
.td-done { background: color-mix(in srgb, var(--good) 13%, var(--surface)); color: var(--good); }
.td-soon { background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.td-soon .text-btn { flex: none; }

textarea.td-title {
  width: 100%; min-height: 0; padding: 6px 0 4px; border: 0; border-radius: 0; background: none; resize: none; overflow: hidden;
  font-size: 21px; font-weight: 700; line-height: 1.25; letter-spacing: -.1px; field-sizing: content;
}
textarea.td-title:focus { box-shadow: 0 2px 0 var(--accent); }
.td-is-done textarea.td-title { color: var(--muted); text-decoration: line-through; }
.td-by { margin: 2px 0 12px; font-size: 12.5px; color: var(--muted); }

/* properties */
.td-prop { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 6px 10px 6px 12px; border-top: 1px solid var(--line); }
.td-prop:first-child { border-top: 0; }
label.td-prop { cursor: pointer; }
.td-prop-l { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.td-prop-l .ico { width: 18px; height: 18px; }
.td-for { flex: none; max-width: 76%; }
.td-for button { min-width: 0; padding: 7px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#detail .td-prop select { flex: 0 1 auto; width: auto; min-width: 0; max-width: 64%; padding: 8px 10px; border-radius: 10px; text-overflow: ellipsis; }
#detail .td-prop .tl-repeat input { padding-top: 8px; padding-bottom: 8px; border-radius: 10px; }
#detail .td-prop .tl-repeat select { max-width: none; }
.td-date {
  position: relative; flex: none; display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.td-date.unset { color: var(--muted); font-weight: 500; }
.td-date.overdue { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.td-date.today { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
#detail .td-date input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.td-x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); }
.td-x .ico { width: 18px; height: 18px; }
.td-prop .td-x { margin-right: -6px; }
/* reminder */
.td-remind-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 0 12px 10px 39px; margin-top: -4px; font-size: 12.5px; color: var(--muted); }
.td-remind-time { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
#detail .td-remind-at { flex: none; width: auto; padding: 6px 8px; border-radius: 10px; font-size: 14px; }

/* needs info */
.td-ask, .td-claude, .td-info .secondary { display: flex; align-items: center; justify-content: center; gap: 8px; }
.td-ask { margin-top: 10px; }
.td-ask .ico { color: var(--warn); }
.td-info {
  display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 12px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent);
}
.td-info-h { display: flex; align-items: center; gap: 8px; color: var(--warn); }
.td-info-q { font-size: 16px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.td-info form { display: flex; flex-direction: column; gap: 8px; }
.td-info textarea { field-sizing: content; min-height: 66px; max-height: 40dvh; background: var(--bg); resize: none; }
.td-info .primary { min-height: 46px; }

/* sections */
.td-sec .section-h { min-height: 24px; }
.td-count { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.td-none { margin: 0 2px; color: var(--muted); font-size: 14px; }
.td-quiet {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 46px; padding: 0 12px; text-align: left;
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted);
}
.td-quiet .ico { width: 18px; height: 18px; }
.td-notes {
  padding: 11px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text;
}
textarea.td-notes-in { min-height: 96px; border-radius: var(--radius); line-height: 1.45; resize: none; field-sizing: content; }

/* sub-tasks */
.td-bar { height: 4px; margin: -2px 2px 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.td-bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width .2s ease; }
.td-sub { position: relative; display: flex; align-items: stretch; min-height: 46px; background: var(--surface); border-bottom: 1px solid var(--line); }
.td-grip { width: 30px; }
.td-tick { width: 36px; }
textarea.td-sub-t {
  flex: 1; min-width: 0; min-height: 0; align-self: center; padding: 11px 4px; border: 0; border-radius: 6px; background: none;
  resize: none; overflow: hidden; line-height: 1.35; field-sizing: content;
}
.td-sub.done textarea.td-sub-t { color: var(--muted); text-decoration: line-through; }
.td-sub .td-x { align-self: center; margin-right: 4px; opacity: .75; }
.td-add { display: flex; align-items: center; }
.td-add-btn { flex: none; width: 66px; height: 46px; padding-left: 30px; display: grid; place-items: center; color: var(--muted); }
#detail .td-add input { flex: 1; padding: 11px 12px 11px 4px; border: 0; border-radius: 6px; background: none; }

/* parts and cost */
.td-part { display: flex; align-items: stretch; min-height: 54px; border-bottom: 1px solid var(--line); }
.td-part .td-tick { width: 46px; }
.td-part-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 0; text-align: left; }
.td-part-text { flex: 1; min-width: 0; display: block; }
.td-part-n { display: block; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.td-part-q { display: block; margin-top: 1px; font-size: 12.5px; color: var(--muted); }
.td-part-total { flex: none; font-weight: 700; white-space: nowrap; }
.td-part.bought .td-part-n, .td-part.bought .td-part-total { color: var(--muted); }
.td-part.bought .td-part-n { text-decoration: line-through; }
.td-part-link { flex: none; width: 46px; display: grid; place-items: center; border-left: 1px solid var(--line); color: var(--accent); }
.td-part-link .ico { width: 20px; height: 20px; }
.td-part-add { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
#detail .td-part-add input { padding: 9px 10px; border-radius: 10px; }
#detail .td-part-add input[name="name"] { flex: 1 1 100%; }         /* cover screen: the name gets its own line */
#detail .td-part-add input[name="qty"] { flex: 1 1 0; text-align: center; }
#detail .td-part-add input[name="cost"] { flex: 2 1 0; }
.td-part-add .icon-btn { color: var(--accent); }
.td-parts { container-type: inline-size; }
@container (min-width: 380px) {
  #detail .td-part-add input[name="name"] { flex: 1 1 0; }
  #detail .td-part-add input[name="qty"] { flex: none; width: 58px; }
  #detail .td-part-add input[name="cost"] { flex: none; width: 88px; }
}
.td-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.td-totals div { padding: 9px 10px 10px 12px; border-left: 1px solid var(--line); min-width: 0; }
.td-totals div:first-child { border-left: 0; }
.td-totals small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); white-space: nowrap; }
.td-totals b { font-size: 15px; white-space: nowrap; }
.td-totals .td-left b { color: var(--warn); }

/* photos */
.td-add-photos { display: inline-flex; align-items: center; gap: 6px; }
.td-add-photos .ico { width: 17px; height: 17px; }
.td-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 6px; }
.td-thumb { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.td-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.td-uploading { display: grid; place-items: center; padding: 4px; text-align: center; font-size: 12px; color: var(--muted); border-style: dashed; }
.td-file { position: fixed; left: -10px; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* comments */
.td-comments { display: flex; flex-direction: column; gap: 10px; }
.td-comment { display: flex; align-items: flex-start; gap: 8px; scroll-margin-bottom: 96px; }
.td-comment > .avatar { margin-top: 2px; }
.td-c-main { flex: 1; min-width: 0; padding: 7px 12px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; }
.td-c-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-height: 26px; font-size: 13.5px; }
.td-c-time { color: var(--muted); font-size: 12px; }
.td-c-more { flex: none; width: 34px; height: 26px; margin: 0 -8px 0 auto; display: grid; place-items: center; color: var(--muted); }
.td-c-more .ico { width: 20px; height: 20px; }
.td-c-body { margin-top: 2px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.td-c-photos { margin-top: 8px; grid-template-columns: repeat(auto-fill, minmax(64px, 96px)); }
.td-tag {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px 1px 5px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
}
.td-tag .ico { width: 12px; height: 12px; stroke-width: 2.5; }
.td-tag.q { color: var(--warn); background: color-mix(in srgb, var(--warn) 17%, transparent); }
.td-tag.a { color: var(--good); background: color-mix(in srgb, var(--good) 17%, transparent); }
.td-question .td-c-main { border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.td-answer .td-c-main { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.td-via { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--accent); white-space: nowrap; }
.td-via .ico { width: 12px; height: 12px; }

/* history */
.td-history { margin-top: 8px; }
.td-fold {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 12px 2px; text-align: left;
  color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
}
.td-fold .ico { width: 16px; height: 16px; }
.td-fold .td-count { margin-left: 2px; }
.td-timeline {
  list-style: none; margin: 0 0 6px 9px; padding: 2px 0 2px 16px; border-left: 2px solid var(--line);
  display: flex; flex-direction: column; gap: 9px; font-size: 13.5px;
}
.td-timeline li { position: relative; overflow-wrap: anywhere; }
.td-timeline li::before {
  content: ""; position: absolute; left: -22px; top: 5px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 3px var(--bg);
}
.td-tl-when { color: var(--muted); white-space: nowrap; }

.td-claude { margin-top: 10px; color: var(--accent); }
.td-claude .ico { width: 20px; height: 20px; }

/* comment composer, pinned to the bottom of the pane */
.td-composer {
  position: sticky; bottom: calc(-20px - var(--safe-b)); z-index: 3;      /* #detail's own bottom padding, cancelled */
  margin: 14px calc(-1 * var(--gutter)) calc(-20px - var(--safe-b)); padding: 8px 10px calc(8px + var(--safe-b));
  background: var(--bg); border-top: 1px solid var(--line);
}
.td-composer-row { display: flex; align-items: flex-end; gap: 4px; }
.td-composer textarea {
  flex: 1; min-width: 0; min-height: 44px; max-height: 132px; padding: 10px 14px; border-radius: 22px; background: var(--surface);
  resize: none; font-size: 16px; line-height: 1.35; field-sizing: content;
}
.td-attach, .td-send { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.td-attach { color: var(--muted); }
.td-send { margin-left: 2px; background: var(--accent); color: var(--accent-ink); }
.td-send .ico { width: 20px; height: 20px; }
.td-composer.busy .td-send, .td-composer.busy .td-attach { opacity: .4; pointer-events: none; }
.td-pend { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 8px; }
.td-pend-i { position: relative; flex: none; width: 64px; height: 64px; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.td-pend-i img { display: block; width: 100%; height: 100%; object-fit: cover; }
.td-pend-i button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .7); color: #fff; }
.td-pend-i button .ico { width: 14px; height: 14px; }

/* sheets opened from the detail pane */
.td-sheet-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-sheet-p { margin: -4px 0 12px; }
.td-menu .item { min-height: 54px; font-weight: 600; }
.td-menu .item .ico { color: var(--muted); }
.td-menu .item.td-danger, .td-menu .item.td-danger .ico { color: var(--danger); }
.td-viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.td-viewer-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.td-viewer-by { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; }
.td-viewer-img { position: relative; flex: 1; min-height: 0; overflow: hidden; border-radius: 14px; background: #000; }
.td-viewer-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.td-viewer-f { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.td-viewer-n { flex: 1; text-align: center; color: var(--muted); font-size: 13px; }
.td-viewer-del { display: inline-flex; align-items: center; gap: 6px; padding: 9px 10px; color: var(--danger); font-weight: 600; }
.td-viewer-del .ico { width: 18px; height: 18px; }
.td-viewer .icon-btn:disabled { opacity: .3; }
