/* r3 (20 Nov 2026): resizable columns, centered tick, Kirby's phone pass. Loaded last. */

/* ---------- resizable columns (desktop, Asana style) ---------- */
.col-resize { display: none; }
@media (min-width: 900px) {
  .grid .thead > div { position: relative; }
  .grid .thead > div > .th-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid .thead .col-resize { display: block; position: absolute; top: 0; bottom: 0; right: 0; width: 9px; cursor: col-resize; z-index: 4; touch-action: none; }
  .grid .thead .col-resize::after { content: ''; position: absolute; top: 20%; bottom: 20%; right: 0; width: 1px; background: var(--hairline, var(--line)); opacity: 0; transition: opacity .12s; }
  .grid .thead:hover .col-resize::after { opacity: 1; }
  .grid .thead .col-resize:hover::after, .grid .thead .col-resize.active::after { opacity: 1; width: 2px; background: var(--text, var(--ink)); }
  body.is-resizing, body.is-resizing * { cursor: col-resize !important; user-select: none; -webkit-user-select: none; }
}

/* ---------- completed tick, centered at every size (John, 20 Nov: off-center, most visible on the web) ----------
   The old tick was a rotated L border nudged by hand per size (22, 20, 16 px), which never sat on the true center.
   Now one SVG mask, centered on the circle with geometry symmetric about (12,12) in a 24 box, any size, any theme. */
:root .check.check:checked::after { content: ''; position: absolute; inset: 0; left: 0; top: 0; width: auto; height: auto; border: 0; transform: none;
  background: var(--accent-ink, #fff);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12.25l3.75 3.75 7.25-7.5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12.25l3.75 3.75 7.25-7.5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
:root .check.check:disabled:checked::after { background: #fff; }

/* ---------- P2-6: a subtask shows at once while it saves ---------- */
.subtask.pending .sub-title { opacity: .6; }

/* ======================================================================================================================
   Kirby phone pass (kirby-premium/phone-pass/spec.md, 20 Nov 2026). Phone only (<= 600 px); desktop and tablets unchanged.
   HIG type (system font), Newli colors (variables only, so light and dark both follow), weights 400/500/600.
   ==================================================================================================================== */
@media (max-width: 600px) {
  :root { --pt-pin: 268px; --colhead-h: 36px; --hig-colhead: 500 15px/20px var(--font-ui); }
  main.grid { --pt-c1: max(var(--pt-c1-min, 100px), calc(var(--pt-w, 100vw) - var(--pt-pin))); } /* the tag column gets the rest */

  /* ---- 1. list and table at Asana's phone scale ---- */
  main.grid .pt-inner .task .title-line > .title { font: 400 17px/44px var(--font-ui); }
  main.grid .pt-inner .task > .first { padding-left: 16px; }
  main.grid .pt-inner .task .check-hit { width: 34px; min-width: 34px; justify-content: flex-start; } /* 22 circle + 12 gap */
  main.grid .pt-inner .task .check-hit::after { left: -16px; right: -6px; top: 4px; bottom: 4px; }     /* 56 x 44 hit area */
  main.grid .pt-inner .task .check { width: 22px; height: 22px; }
  main.grid .pt-inner .task .title-line > .row-more { width: 44px; }
  main.grid .pt-inner .task .title-line > .row-more svg { width: 20px; height: 20px; }

  main.grid .pt-inner .section { margin-top: 18px; /* 10 + 8 extra between sections */
    background: linear-gradient(to bottom, var(--section-head) 0 48px, var(--hairline) 48px 49px, transparent 49px) 0 0 / 100% 49px no-repeat; }
  main.grid .pt-inner .section:not(.collapsed) {
    background: linear-gradient(to bottom, var(--section-head) 0 48px, var(--hairline) 48px 49px, transparent 49px) 0 0 / 100% 49px no-repeat,
      linear-gradient(var(--hairline), var(--hairline)) 0 100% / 100% 1px no-repeat; }
  main.grid .pt-inner > .thead + .section { margin-top: 0; }
  main.grid .pt-inner .section-head { height: 49px; min-height: 49px; padding: 0 4px 0 0; }
  main.grid .pt-inner .section-head h2 { font: 600 19px/24px var(--font-ui); color: var(--text); margin-left: -6px; } /* 8 px after the chevron */
  main.grid .pt-inner .section-head .count { font: 400 15px/20px var(--font-ui); color: var(--text-2); }
  main.grid .pt-inner .section-head .collapse-btn { width: 44px; min-width: 44px; height: 48px; min-height: 48px; margin: 0; padding: 0 0 0 16px; justify-content: flex-start; color: var(--text-3); }
  main.grid .pt-inner .section-head > .icon-btn:last-child { height: 48px; min-height: 48px; }
  main.grid .pt-inner .section-head .caret svg { width: 14px; height: 14px; }

  main.grid .pt-inner > .thead { height: 36px; min-height: 36px; }
  main.grid .pt-inner > .thead > div, main.grid .pt-inner > .thead > .c-pin::before { font: 500 15px/20px var(--font-ui); color: var(--text-2); }

  main.grid .pt-inner .task > .c-tag > .chip { display: inline-block; height: 26px; padding: 0 10px; border-radius: 13px; font: 500 15px/26px var(--font-ui);
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* r3 Kirby final (9:45 PM): title column 268, tag column the rest (122 at 390); cell 8 / 8, pill 8 px sides, 26 tall, 15 px.
     Pills never touch the screen edge; only long names (AI Products Proven) ellipsize inside the pill. */
  main.grid .pt-inner .task > .c-tag { padding: 0 8px; box-sizing: border-box; min-width: 0; }
  main.grid .pt-inner .task > .c-tag > .chip { flex: 0 1 auto; min-width: 0; max-width: 100%; box-sizing: border-box; padding: 0 8px; }

  .pt-inner > .toolbar { gap: 8px; padding: 8px 16px 12px; }
  .pt-inner > .toolbar .pill { height: 36px; min-height: 36px; padding: 0 14px; font: 500 15px/20px var(--font-ui); }
  .pt-inner > .toolbar .pill::after { content: ''; position: absolute; left: 0; right: 0; top: -4px; bottom: -4px; } /* 44 px tap height */

  main.grid .pt-inner .quick-add { height: 52px; min-height: 52px; padding-left: 5px; }
  main.grid .pt-inner .quick-add .plus { width: 44px; font: 400 20px/1 var(--font-ui); }
  main.grid .pt-inner .quick-add :is(input, textarea) { height: 52px; min-height: 52px; font: 400 17px/22px var(--font-ui); }
  main.grid .pt-inner .quick-add :is(input, textarea)::placeholder { font: 400 17px/22px var(--font-ui); }

  /* ---- 2. header: iOS nav bar (44, sticky) + large title. The logo is no longer stacked on the project name ---- */
  .topbar:has(.topbar-id) { border-bottom-color: transparent; }
  .topbar-inner { position: relative; display: grid; grid-template-columns: 44px 1fr auto auto; grid-template-rows: 44px auto; align-items: center;
    gap: 0; min-height: 0; padding: 0 max(10px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); }
  .topbar-inner > .icon-btn[data-test=all-projects] { grid-column: 1; grid-row: 1; width: 44px; min-width: 44px; height: 44px; }
  .topbar-inner > [data-test=project-menu] { grid-column: 3; grid-row: 1; height: 44px; margin-right: -6px; }
  .topbar-inner > [aria-label^="Account"] { grid-column: 4; grid-row: 1; height: 44px; }
  .topbar-inner > [aria-label^="Account"] .avatar { width: 32px; height: 32px; }
  .topbar-id { display: contents; }
  .topbar-id .newli-logo { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); height: 20px; margin: 0; padding: 0; border: 0; align-self: auto; }
  .topbar-id .newli-logo img { height: 20px; }
  .topbar-id .newli-logo::before { top: -12px; bottom: -12px; left: -8px; right: -8px; }
  .topbar-id .title-row, .topbar-id > h1 { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 16px 12px; margin: 0 calc(-1 * max(10px, env(safe-area-inset-right))) 0 calc(-1 * max(8px, env(safe-area-inset-left))); }
  .topbar-id h1 { font: 600 28px/34px var(--font-ui); max-height: 34px; padding: 0; flex: 0 1 auto; min-width: 0; color: var(--text);
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 1; line-clamp: 1; }
  .topbar-id .title-row .star-btn { flex: none; width: 44px; height: 44px; margin: -12px -12px -12px -12px; }
  .topbar-id .title-row .star-btn svg { width: 20px; height: 20px; }
  /* scrolled: the large title goes (phone-table.js sets body.lt-collapsed from the list's scroll), hairline under the bar */
  body.lt-collapsed .topbar-id .title-row, body.lt-collapsed .topbar-id > h1 { display: none; }
  body.lt-collapsed .topbar:has(.topbar-id) { border-bottom-color: var(--hairline); }
}

/* ---- 3. Project settings > Tag columns card (Kirby, all widths: the sheet is the same component) ---- */
@media (max-width: 600px) {
  .tagcols-label { font: 500 13px/18px var(--font-ui); color: var(--text-2); margin: 24px 0 8px; }
  .tagcol { padding: 16px; border-radius: 12px; border: 1px solid var(--hairline); gap: 0; margin-bottom: 12px; display: block; }
  .tagcol > .switch, .tagcol > .tagcol-name { min-height: 44px; display: flex; align-items: center; font: 400 17px/22px var(--font-ui); }
  .tagcol > .switch > span { font: 400 17px/22px var(--font-ui); }
  .tagcol > .opt-list, .tagcol > .small { margin-top: 12px; }
  .tagcol .opt-list { display: flex; flex-wrap: wrap; gap: 8px 8px; padding: 0; list-style: none; }
  .tagcol .opt-list .chip { height: 24px; padding: 0 10px; border-radius: 12px; font: 500 13px/24px var(--font-ui); }
  .tagcol > .tagcol-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: nowrap; }
  .tagcol > .tagcol-actions .btn { height: 44px; min-height: 44px; padding: 0 16px; border-radius: 8px; font: 500 15px/20px var(--font-ui); }
  .tagcol > .tagcol-actions .tagcol-del { margin-left: auto; color: var(--danger, #D92D20); }
  .tagcol:last-of-type { margin-bottom: 0; }
  .tagcol-add { margin-top: 20px; display: flex; gap: 8px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .tagcol-add .input { flex: 1; height: 44px; min-height: 44px; padding: 0 12px; border-radius: 8px; font-size: 17px; }
  .tagcol-add .btn { height: 44px; min-height: 44px; padding: 0 16px; font: 500 15px/20px var(--font-ui); }
}

/* r3 Kirby fix 2: the title's hover underline (r2) stuck on touch screens after a tap and showed at rest; it is a mouse-hover
   cue only now. The edit underline (.title-input) is untouched. */
@media (hover: none), (pointer: coarse), (max-width: 600px) {
  .task .title[role="button"]:hover { box-shadow: none; }
}

/* ======================================================================================================================
   r4 (John, 21 Nov 4:45 PM JST): phone list width. Phone only (<= 600 px); desktop and tablets unchanged.
   Asana shows about 28 characters of a task name with the Initiative pill cut off at the screen edge; r3 showed about 14
   (268 px title column, 122 px tag column, a 44 px row ⋯). Now the title column takes all but 84 px of the screen
   (306 px at 390) and the row ⋯ is gone: press and hold a row, then let go without moving, for the same actions sheet
   (also in the task panel's ⋯). The tag column keeps a 120 px track, so its pill runs past the screen edge and is cut
   off there, under the right-edge fade (sideways scroll shows the rest). HIG type and Newli colors as in r3.
   ==================================================================================================================== */
@media (max-width: 600px) {
  :root { --pt-pin: clamp(236px, calc(var(--pt-w, 100vw) - 72px), 528px); }
  main.grid { --pt-c1: max(120px, calc(var(--pt-w, 100vw) - var(--pt-pin))); }
  /* P2-7 (Hawkeye): the row ⋯ stays for screen readers and keyboards only ('Task actions: <title>', opens the same sheet).
     Visually hidden, out of the flex row (no width), zero hit area (clip-path), so it never takes a tap or a drag. A
     keyboard focus shows it as a 32 x 44 overlay at the right of the title cell (still no layout change). */
  main.grid .pt-inner .task .title-line > .row-more { position: absolute; width: 1px; height: 1px; min-width: 0; min-height: 0; margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  main.grid .pt-inner .task .title-line > .row-more:focus-visible { right: 0; top: 4px; width: 32px; height: 44px; margin: 0; clip: auto; clip-path: none;
    background: var(--row-bg); color: var(--text); outline: 2px solid var(--text); outline-offset: -2px; border-radius: 8px; z-index: 3; }
  main.grid .pt-inner .task .title-line > .open-detail { flex: 1 0 12px; min-width: 12px; } /* 12 px after the name, then the column edge */
  /* the tag pill: whole up to the 120 px track (8 px left inset), then ellipsized; the screen edge cuts what runs past it */
  main.grid .pt-inner .task > .c-tag { padding: 0 8px 0 12px; }
  main.grid .pt-inner > .thead > div:not(.c-pin) { padding-left: 12px; }
  /* Kirby r4 tweak (21 Nov): the right-edge fade is 16 px on phone (28 declared before, about 24 visible) */
  body:has(> #app > main.grid)::after { width: 16px; }
}

/* r4 P2-7: one-time 'Press and hold a task for more actions' tip, phones <= 600px only (app.js maybeHoldTip). A quiet HIG
   toast: panel color, hairline edge, 15 px regular text, 44 px close target. It sits at the bottom; the list gets the same
   room after its last control (+ Add section) so everything can scroll clear of it, and focus in any Add box dismisses it. */
.hold-tip { display: none; }
@media (max-width: 600px) {
  .hold-tip { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; gap: 4px;
    min-height: 48px; padding: 0 4px 0 16px; box-sizing: border-box; border-radius: 12px; background: var(--panel); color: var(--text);
    border: 1px solid var(--hairline); box-shadow: var(--shadow-pop); font: 400 15px/20px var(--font-ui); cursor: default; }
  .hold-tip-text { flex: 1; min-width: 0; padding: 12px 0; }
  .hold-tip-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0; padding: 0;
    border: 0; border-radius: 10px; background: none; color: var(--text-2); cursor: pointer; }
  .hold-tip-close svg { width: 16px; height: 16px; }
  .hold-tip-close:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; }
  body.has-detail .hold-tip { display: none; }
  /* P3-22: the room for the tip comes AFTER '+ Add section' (the last control), sized to the tip as drawn (it wraps to two
     lines at 320): tip height + its 16 px inset + 16 px of air, on top of the list's own 24 px end padding */
  body.hold-tip-on main.grid > .pt-inner::after { content: ''; display: block; height: calc(var(--hold-tip-h, 48px) + 32px); }
}

/* ======================================================================================================================
   r4.1 (John, 21 Nov 7:55 PM JST, iPhone video): the phone list was "not locked". main.grid was one native scroller for
   BOTH axes (overflow: auto, touch-action: pan-x pan-y) over a table wider than the screen (318 + 120 + the other
   columns = 842 px at 390), and iOS Safari has no axis lock in an overflow scroller: every vertical swipe also moved it
   sideways (diagonal drift), and a sideways swipe pushed the rows off. Now, at <= 600 px only, nothing can move sideways:
   the table is clipped at the screen edge (like Asana), the scroller pans vertically only, and no box is wider than the
   screen, so neither the list nor the page can pan. Widths stay r4 (title = screen - 72, pill cut under the 16 px fade).
   Tablets (601-899) keep the sideways table; desktop is unchanged.
   ==================================================================================================================== */
@media (max-width: 600px) {
  html:has(> body > #app > main.grid), body:has(> #app > main.grid), body:has(> #app > main.grid) > #app {
    overflow-x: hidden; overscroll-behavior-x: none; max-width: 100%; }
  main.grid { overflow-x: hidden; overflow-y: auto; touch-action: pan-y pinch-zoom; overscroll-behavior-x: none; overscroll-behavior-y: contain; scroll-padding-left: 0; }
  /* the table keeps its columns but is clipped at the screen edge: the clip adds no scrollable width, so scrollLeft is
     always 0 (also for scripts, focus or scrollIntoView) */
  main.grid > .pt-inner { width: 100%; min-width: 0; max-width: 100%; overflow-x: clip; overflow-clip-margin: 0px; touch-action: pan-y pinch-zoom; }
  /* vertical panning only (pinch zoom stays allowed for accessibility) */
  main.grid .pt-inner .tasks, main.grid .pt-inner .task { touch-action: pan-y pinch-zoom; }
  /* the right fade always shows when there are columns past the edge (is-end is always true without a sideways scroll) */
  body:has(> #app > main.grid.is-end)::after { opacity: 1; }
  body:has(> #app > main.grid[style*="--pt-minw:0px"])::after, body.has-detail::after { opacity: 0; }
}
