/* r6 (John 24 Nov 6:39 PM JST, Q1 A): tasks under tasks. On top of r5.css. A row without a parent or subtasks looks exactly
   as before; phone r4.1 rules (no sideways scroll at <=600px, title column 318, pinned header) are untouched: the indent
   sits inside the title column and the name gives up the room. */

/* indent: one step per parent on screen, drawn up to 3 steps (app.js TREE_CAP) */
main.grid { --tree-step: 24px; }
main.grid .task.tree-child .check-hit { margin-left: calc(var(--d, 1) * var(--tree-step)) !important; }
@media (max-width: 899px) { main.grid { --tree-step: 20px; } }
@media (max-width: 600px) { main.grid { --tree-step: 18px; } }

/* the fold toggle: a quiet chevron + count after the name of a task that has subtasks */
.task .tree-toggle { flex: none; display: inline-flex; align-items: center; gap: 2px; height: 18px; margin: 0 0 0 6px; padding: 0 6px 0 3px; position: relative;
  border: 1px solid var(--hairline); border-radius: 999px; background: transparent; color: var(--text-2);
  font: 500 11px/16px var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: 0; cursor: pointer; }
.task .tree-toggle svg { width: 12px; height: 12px; stroke-width: 2; transition: transform .15s; }
.task .tree-toggle.folded svg { transform: rotate(-90deg); }
.task .tree-toggle:focus { outline: none; }
.task .tree-toggle:focus-visible { box-shadow: 0 0 0 2px var(--focus-ring); }
@media (hover: hover) { .task .tree-toggle:hover { background: var(--hover); color: var(--text); } }
@media (prefers-reduced-motion: reduce) { .task .tree-toggle svg { transition: none; } }
/* Hawkeye: the desktop chevron (18px tall) gets an invisible click area of at least 24x24; the pill itself is unchanged */
.task .tree-toggle::after { content: ''; position: absolute; left: -1px; right: -1px; top: -4px; bottom: -4px; min-width: 24px; }
/* touch: a 44px tall target around the small pill */
@media (hover: none), (pointer: coarse) { .task .tree-toggle::after { content: ''; position: absolute; left: -6px; right: -6px; top: -13px; bottom: -13px; } }
@media (max-width: 899px) {
  main.grid .pt-inner .task .title-line > .tree-toggle { order: -1; flex: none; height: 20px; margin-left: 6px; font-size: 12px; }
  main.grid .pt-inner .task .title-line > .tree-toggle svg { width: 13px; height: 13px; }
}

/* panel: Parent task */
.parent-row .dval { gap: 4px; }
.parent-row .parent-link { display: inline-flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 auto; min-height: 44px; padding: 0 2px; border: 0; background: none;
  color: var(--text); font: 400 15px/20px var(--font-body); text-align: right; cursor: pointer; }
.parent-row .parent-link .pl-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 3px; }
.parent-row .parent-link svg { flex: none; width: 14px; height: 14px; color: var(--text-3); }
.parent-row.ro .parent-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
@media (hover: hover) { .parent-row .parent-link:hover .pl-text { text-decoration-color: currentColor; } }
.parent-row .parent-pick { flex: none; min-height: 44px; padding: 0 24px 0 6px; border: 0; border-radius: 0; cursor: pointer; color: var(--text-2); font: 400 15px/20px var(--font-body);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B8B8B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") no-repeat right 0 center; }
.parent-row .parent-pick:not(.has) { color: var(--text-3); }
.parent-row .parent-pick.has { font-size: 13px; }
.parent-row :is(.parent-link, .parent-pick):focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.parent-row .parent-clear { flex: none; width: 32px; height: 32px; min-width: 32px; color: var(--text-3); }
.parent-row .parent-clear svg { width: 14px; height: 14px; }
@media (max-width: 899px) { .parent-row .parent-link, .parent-row .parent-pick:not(.has) { font-size: 16px; } .parent-row .parent-clear { width: 44px; height: 44px; min-width: 44px; } }

/* the picker sheet */
.parent-sheet .parent-help { margin: 0 0 10px; color: var(--text-2); }
.parent-sheet .parent-search { width: 100%; min-height: 44px; font-size: 16px; }
.parent-sheet .parent-remove { margin: 10px 0 0; display: inline-flex; align-items: center; gap: 6px; }
.parent-sheet .parent-remove svg { width: 16px; height: 16px; }
.parent-sheet .parent-note:empty { display: none; }
.parent-sheet .parent-note { margin: 10px 0 0; }
.parent-list { list-style: none; margin: 8px 0 0; padding: 0; }
.parent-list .parent-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--hairline);
  background: none; text-align: left; color: var(--text); font: 400 15px/20px var(--font-body); cursor: pointer; }
.parent-list .parent-opt .po-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.parent-list .parent-opt .po-sec { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 13px; }
.parent-list .parent-opt.done .po-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--hairline); }
.parent-list .parent-opt.current { font-weight: 600; }
.parent-list .parent-opt.current .po-sec::before { content: 'Current · '; font-weight: 400; }
.parent-list .parent-opt:focus { outline: none; }
.parent-list .parent-opt:focus-visible { box-shadow: inset 0 0 0 2px var(--focus-ring); border-radius: 6px; }
@media (hover: hover) { .parent-list .parent-opt:hover { background: var(--hover); } }
.parent-list .parent-opt:active { background: var(--hover); }
.parent-list .parent-empty { padding: 14px 4px; color: var(--text-3); font-size: 14px; }
@media (max-width: 899px) { .parent-list .parent-opt { font-size: 16px; } }

/* panel: Subtasks (tasks) */
.child-list { list-style: none; margin: 0; padding: 0; }
.child-task { display: flex; align-items: center; gap: 8px; min-height: 44px; border-bottom: 1px solid var(--hairline); }
.child-task .check-hit { margin: 0 -6px 0 -12px; }
.child-task .child-link { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--text); font: 400 15px/20px var(--font-body); text-align: left; }
.child-task .child-link .cl-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.child-task .child-link svg { flex: none; width: 16px; height: 16px; color: var(--text-3); }
.child-task.done .cl-text { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--hairline); }
.child-task .child-link:focus { outline: none; }
.child-task .child-link:focus-visible { box-shadow: var(--focus); border-radius: 6px; }
@media (hover: hover) { .child-task .child-link:hover .cl-text { text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 3px; } }
@media (max-width: 899px) { .child-task .child-link { font-size: 16px; } }

/* P3-27: a subtask whose parent is off the list (Hide completed / Assigned to me) says where it sits: a small muted hint
   after the name. It gives way first (the name keeps at least 60% of the line) and stays inside the title column. */
.task .tree-hint { flex: 0 10 auto; min-width: 0; max-width: 40%; margin-left: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 12px; line-height: 16px; font-weight: 400; color: var(--text-2); }
@media (max-width: 899px) {
  main.grid .pt-inner .task .title-line > .tree-hint { order: -1; align-self: center; height: auto; min-width: 56px; margin-left: 6px; } /* "under …" stays readable */
}

/* Kirby (r6 OK, 9:53 PM): at 600px and below the hint is a second line under the name (12/16, muted), from the name's left
   edge (indent included) to the end of the title column, one line with an ellipsis. Only these rows grow, 52 -> 62px; the
   name keeps the full width of its line. The row is still one gesture surface: tap, hold and drag work as on any row. */
@media (max-width: 600px) {
  main.grid .pt-inner .task.has-hint { height: 62px; min-height: 62px; }
  /* P2-9 (Hawkeye): no wrapping. Line 1 is the name, the chevron and the invisible open strip on one line (nowrap, like any
     row, so a long name ends in an ellipsis and the strip can never drop to a line of its own); the hint is line 2, placed
     under it, from the name's left edge to the title column's inset. Rows: 10 + 24 + 2 + 16 + 10 = 62. */
  main.grid .pt-inner .task.has-hint .title-line { position: relative; flex-wrap: nowrap; align-items: flex-start; height: 62px; padding: 10px 0 0; box-sizing: border-box; }
  main.grid .pt-inner .task.has-hint .title-line > .title { flex: 0 1 auto; min-width: 0; height: 24px; line-height: 24px; }
  main.grid .pt-inner .task.has-hint .title-line > .tree-toggle { margin-top: 2px; }
  main.grid .pt-inner .task.has-hint .title-line > .open-detail { flex: 1 0 8px; min-width: 8px; height: 24px; }
  main.grid .pt-inner .task.has-hint .title-line > .tree-hint { position: absolute; left: 0; right: 0; top: 36px; order: 1; width: auto; max-width: none; min-width: 0;
    margin: 0; padding-right: 12px; box-sizing: border-box; height: 16px; font-size: 12px; line-height: 16px; }
}
