/* ==================================================================================================
   Tasks — task panel (drawer + full page), New task modal, Move modal, My tasks.  owner: tasks agent
   Everything is scoped: .task-panel / .tp-* (panel), .task-create / .tc-* (modal), .my-tasks /
   .mt-* (My tasks), [data-task-drawer] (drawer tweaks). Tokens only; motion gated by
   prefers-reduced-motion.
   ================================================================================================== */

/* -- Inspector chrome (r4 · 12.12) ----------------------------------------------------------------
   The glass header floats over the body: content scrolls under it (tasks.js adds .is-scrolled to
   the dialog — the header turns into chrome glass — and .is-title-hidden once the big title has
   gone under it, when the header shows a small title instead of the crumbs). Order in the header:
   ‹ › (drawer_nav) · crumbs · actions — .drawer__actions is display: contents so the nav capsule
   can lead without becoming part of the dialog's accessible name (#drawer-title). */
.drawer[data-task-drawer] {
  --tp-hdr: 52px;
}
.drawer[data-task-drawer] .drawer__panel {
  position: relative;
}
.drawer[data-task-drawer] .drawer__header {
  position: absolute;
  inset: 0 0 auto;
  gap: 2px;
  height: var(--tp-hdr);
  min-height: 0;
  padding: 8px 10px 8px 12px;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 0.5px 0 transparent;
  transition:
    background-color var(--dur-2) ease,
    box-shadow var(--dur-2) ease;
}
.drawer[data-task-drawer].is-scrolled .drawer__header {
  background: var(--glass-sheen), var(--mat-chrome);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  box-shadow: 0 0.5px 0 var(--line-subtle);
}
.drawer[data-task-drawer] .drawer__actions {
  display: contents;
}
.drawer[data-task-drawer] .drawer__heading {
  display: grid;
  order: 0;
  margin-right: 4px;
  overflow: hidden;
}
.drawer[data-task-drawer] .drawer__heading > * {
  grid-area: 1 / 1;
}
.drawer[data-task-drawer] .drawer__body {
  padding: calc(var(--tp-hdr) + 6px) 24px calc(36px + var(--safe-bottom));
  scroll-padding-top: calc(var(--tp-hdr) + 12px);
  scroll-padding-bottom: 24px;
}
@media (max-width: 767px) {
  .drawer[data-task-drawer] {
    --tp-hdr: 62px;
  }
  .drawer[data-task-drawer] .drawer__header {
    padding: 18px 8px 8px 10px;
  }
  .drawer[data-task-drawer] .drawer__body {
    padding: calc(var(--tp-hdr) + 4px) 16px calc(28px + var(--safe-bottom));
  }
}

/* Small title: replaces the crumbs once the big title scrolled away (iOS inline title). */
.tp-hdr-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  translate: 0 6px;
  transition:
    opacity var(--dur-2) ease,
    translate var(--dur-snappy) var(--spring-snappy),
    visibility 0s linear var(--dur-2);
}
.drawer[data-task-drawer].is-title-hidden .tp-hdr-title {
  opacity: 1;
  visibility: visible;
  translate: 0 0;
  transition-delay: 0s;
}
.tp-crumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  transition:
    opacity var(--dur-2) ease,
    translate var(--dur-snappy) var(--spring-snappy),
    visibility 0s linear 0s;
}
.drawer[data-task-drawer].is-title-hidden .tp-crumbs {
  opacity: 0;
  visibility: hidden;
  translate: 0 -6px;
  transition-delay: 0s, 0s, var(--dur-2);
}
.tp-crumbs__project {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 1;
  min-width: 0;
  max-width: 240px;
  height: 28px;
  padding: 0 8px 0 5px;
  border-radius: var(--radius-full);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.tp-crumbs__project .icon-tile {
  --size: 18px;
  flex-shrink: 0;
  border-radius: 5px;
}
.tp-crumbs__project:hover {
  background: var(--fill-1);
  color: var(--text);
}
.tp-crumbs__name,
.tp-crumbs__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-crumbs__sep {
  flex-shrink: 0;
  color: var(--text-3);
  opacity: 0.7;
}
.tp-crumbs__parent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 220px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.tp-crumbs__parent:hover {
  background: var(--fill-1);
  color: var(--text);
}
.tp-key {
  flex-shrink: 0;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  cursor: copy;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.tp-key:hover {
  background: var(--fill-1);
  color: var(--text);
}
.tp-key:focus-visible,
.tp-crumbs__project:focus-visible,
.tp-crumbs__parent:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
@media (max-width: 639px) {
  .tp-crumbs__name,
  .tp-crumbs__title {
    display: none;
  }
  .tp-crumbs__project {
    padding-right: 5px;
  }
}

/* Previous / next task: a ‹ › capsule at the leading edge of the header (Mail's toolbar group). */
.tp-nav {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  order: -1;
  margin-right: 6px;
}
.tp-nav[hidden] {
  display: none;
}
.tp-nav__group {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 1px;
  border-radius: var(--radius-full);
  background: var(--fill-1);
}
.tp-nav__btn.btn {
  --btn-h: 28px;
  width: 30px;
  min-width: 0;
  border-radius: var(--radius-full);
}
.tp-nav__btn + .tp-nav__btn {
  position: relative;
}
.tp-nav__btn + .tp-nav__btn::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -0.5px;
  width: 1px;
  background: var(--line);
}
.tp-nav__btn:disabled {
  opacity: 0.35;
}
.tp-nav__pos {
  order: 2;
  min-width: 2.6em;
  margin-left: 6px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 1279px) {
  .tp-nav__pos {
    display: none;
  }
}

.tp-follow.is-on {
  background: transparent;
  color: var(--accent-ink);
}
.tp-follow.is-on:hover {
  background: var(--accent-softer);
  color: var(--accent-ink);
}
@media (prefers-reduced-motion: no-preference) {
  .tp-follow.is-on .icon {
    animation: tp-ring 560ms var(--ease-out);
    transform-origin: 50% 15%;
  }
}
@keyframes tp-ring {
  0% { transform: rotate(0); }
  20% { transform: rotate(14deg); }
  40% { transform: rotate(-11deg); }
  60% { transform: rotate(7deg); }
  80% { transform: rotate(-3deg); }
  100% { transform: rotate(0); }
}

/* -- Panel layout -------------------------------------------------------------------------------- */
/* Surfaces: inside the inspector the groups are quiet fills on the white panel; on the full page
   (grey grouped background) they are white cards — iOS inset grouped. */
.task-panel {
  --tp-card: var(--surface-2);
  --tp-group: var(--fill-1);
  --tp-group-ring: none;
  --tp-bubble: var(--fill-1);
  --tp-label-min: 92px;
  container: tpanel / inline-size;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.tp-body {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
  margin-top: 6px;
}
.tp-page {
  max-width: 1200px;
  margin-inline: auto;
}
.tp-page-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 2px;
}
@media (max-width: 1279px) {
  .tp-page-actions .btn.tp-copy-link {
    display: none; /* also in the "…" menu; the topbar is tight below 1280px */
  }
}
/* Full page (tasks:detail): the same panel, centred at most 860px wide; from 1280px two columns —
   title, description, subtasks, files and activity on the left, the properties (320px) sticky on
   the right. */
.task-panel--page {
  --tp-card: var(--surface);
  --tp-group: var(--surface);
  --tp-group-ring: 0 0 0 0.5px var(--card-ring), var(--shadow-xs), inset 0 0.5px 0 var(--card-highlight);
  --tp-bubble: var(--surface);
  max-width: 860px;
  margin-inline: auto;
}
@media (min-width: 1280px) {
  .task-panel--page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-areas:
      "head props"
      "body props";
    grid-template-rows: auto 1fr;
    align-items: start;
    gap: 18px 40px;
    max-width: 1200px;
  }
  .task-panel--page > .tp-head {
    grid-area: head;
  }
  .task-panel--page > .tp-props {
    grid-area: props;
    position: sticky;
    top: calc(var(--topbar-h) + var(--safe-top) + 12px);
  }
  .task-panel--page > .tp-body {
    grid-area: body;
  }
  .task-panel--page:has(> .tp-archived) {
    grid-template-areas:
      "notice notice"
      "head props"
      "body props";
    grid-template-rows: auto auto 1fr;
  }
  .task-panel--page > .tp-archived {
    grid-area: notice;
  }
}

/* -- Head: complete check + title (r4 · 12.12: check-circle --lg 26px + a 22/24px bold title) --- */
.tp-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-width: 0;
}
/* The big check: the same look as the core .check-circle (9.7) — a 1.6px ring that fills with
   --success, the ✓ draws, the circle pops on a spring and six dots burst out (.is-celebrating). */
.tp-complete {
  --check: var(--success);
  position: relative;
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-3);
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.tp-complete::before {
  content: "";
  position: absolute;
  inset: -9px; /* a 44px target */
}
.tp-complete::after {
  content: "";
  position: absolute;
  inset: -10px;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle, var(--check) 1.8px, transparent 2.4px) 50% 0 / 7px 7px no-repeat,
    radial-gradient(circle, var(--check) 1.8px, transparent 2.4px) 94% 26% / 7px 7px no-repeat,
    radial-gradient(circle, var(--check) 1.8px, transparent 2.4px) 94% 74% / 7px 7px no-repeat,
    radial-gradient(circle, var(--check) 1.8px, transparent 2.4px) 50% 100% / 7px 7px no-repeat,
    radial-gradient(circle, var(--check) 1.8px, transparent 2.4px) 6% 74% / 7px 7px no-repeat,
    radial-gradient(circle, var(--check) 1.8px, transparent 2.4px) 6% 26% / 7px 7px no-repeat;
}
.tp-complete__check {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tp-complete__check circle {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.7;
  transition:
    fill var(--dur-2) ease,
    stroke var(--dur-2) ease;
}
.tp-complete__check path {
  fill: none;
  stroke: var(--text-on-accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset var(--dur-3) var(--ease-out) 60ms;
}
@media (hover: hover) {
  button.tp-complete:not(.is-done):hover .tp-complete__check path {
    stroke: var(--text-3);
    stroke-dashoffset: 0;
    opacity: 0.45;
    transition-delay: 0ms;
  }
}
button.tp-complete:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--focus-outline),
    0 0 0 5px var(--focus-ring);
}
.tp-complete.is-done {
  color: var(--check);
}
.tp-complete.is-done .tp-complete__check circle {
  fill: var(--check);
  stroke: var(--check);
}
.tp-complete.is-done .tp-complete__check path {
  stroke: var(--text-on-accent);
  stroke-dashoffset: 0;
  opacity: 1;
}
.tp-complete.is-busy {
  pointer-events: none;
}
.tp-complete--static:not(.is-done) {
  opacity: 0.55;
}
@media (prefers-reduced-motion: no-preference) {
  button.tp-complete:active .tp-complete__check {
    transform: scale(0.88);
    transition: transform var(--dur-1) var(--ease-out);
  }
  .tp-complete.is-celebrating .tp-complete__check {
    animation: cc-pop var(--dur-bouncy) var(--spring-bouncy);
  }
  .tp-complete.is-celebrating::after {
    animation: cc-burst 600ms var(--ease-out) both;
  }
}
@keyframes tp-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.22); }
  65% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

.tp-title {
  min-width: 0;
}
.tp-title__form {
  margin: 0;
}
.tp-title__input,
.tp-title__text {
  display: block;
  width: calc(100% + 12px);
  margin: 0 -6px;
  padding: 0 6px 1px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--fs-title-2);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: 1.25;
  overflow-wrap: anywhere;
  transition: color var(--dur-2) ease;
}
/* Inline rename: no field background, only the focus ring (Notes / Reminders). */
.tp-title__input {
  min-height: calc(1.25em + 1px);
  resize: none;
  field-sizing: content;
  transition:
    box-shadow var(--dur-2) ease,
    color var(--dur-2) ease;
}
.tp-title__input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.tp-head:has(.tp-complete.is-done) :is(.tp-title__input:not(:focus), .tp-title__text) {
  color: var(--text-2);
}
.tp-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin-top: 4px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.tp-meta__done {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--success-ink);
  font-weight: var(--fw-medium);
}
.tp-meta__done time {
  color: var(--text-3);
  font-weight: var(--fw-regular);
}
@media (max-width: 767px) {
  .tp-title__input,
  .tp-title__text {
    font-size: calc(1.5rem * var(--text-scale)); /* 24px on phones */
  }
  .tp-complete {
    margin-top: 3px;
  }
}

/* -- Properties (r4 · 12.12: an inspector .form-group) -------------------------------------------
   One rounded group of "label ··· value" rows: icon + 13px --text-2 label on the left (the label
   column is as wide as the longest label — one subgrid, Kyrgyz/Russian never truncate), the value
   on the right as a popup button that spans the row with a ⌄ at its end. Inside the inspector the
   group is a quiet fill (macOS inspector boxes); on the full page it is the white grouped card.
   A row that changed flashes --accent-softer once (.is-flash, tasks.js). Two row columns once the
   group is ≥ 620px wide (the full page between 768 and 1279px). */
.tp-props {
  container: tprops / inline-size;
  min-width: 0;
}
.tp-props__grid {
  display: grid;
  grid-template-columns: minmax(var(--tp-label-min), max-content) minmax(0, 1fr);
  column-gap: 12px;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-card);
  background: var(--tp-group);
  box-shadow: var(--tp-group-ring);
}
.tp-prop {
  position: relative;
  display: grid;
  grid-column: span 2;
  grid-template-columns: subgrid;
  align-items: center;
  min-width: 0;
  min-height: var(--row-h-list);
  padding: 2px 8px 2px 14px;
  border-radius: inherit;
}
.tp-prop + .tp-prop::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 14px;
  height: 0.5px;
  background: var(--line);
  pointer-events: none;
}
.tp-prop--top {
  align-items: start;
}
.tp-prop__label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: calc(var(--row-h-list) - 4px);
  margin: 0;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.25;
}
.tp-prop__label .icon {
  flex-shrink: 0;
  color: var(--text-3);
}
.tp-prop__value {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin: 0;
  font-size: var(--fs-md);
}
.tp-prop--top .tp-prop__value {
  min-height: calc(var(--row-h-list) - 4px);
}
/* The popup button fills the value cell (its ⌄ sits at the end of the row). */
.tp-prop__value > .tp-picker {
  flex: 1 1 auto;
}
.tp-prop__value > .tp-picker > .tp-field {
  width: 100%;
}
.tp-prop__value > .tp-field,
.tp-prop__value > .tp-inline-input {
  width: calc(100% + 8px);
  max-width: none;
}
.tp-prop .tp-field__chevron {
  opacity: 0.55;
}
.tp-prop.is-flash {
  animation: tp-prop-flash 900ms var(--ease-out);
}
@keyframes tp-prop-flash {
  0%,
  35% {
    background-color: var(--accent-softer);
  }
  100% {
    background-color: transparent;
  }
}
@container tprops (min-width: 620px) {
  .tp-props__grid {
    grid-template-columns:
      minmax(var(--tp-label-min), max-content) minmax(0, 1fr)
      minmax(var(--tp-label-min), max-content) minmax(0, 1fr);
  }
  .tp-prop + .tp-prop::before {
    display: none;
  }
  .tp-prop:nth-child(n + 3)::before {
    display: block;
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 14px;
    height: 0.5px;
    background: var(--line);
  }
  .tp-prop[data-prop="labels"] {
    grid-column: 1 / -1;
  }
  .tp-prop[data-prop="labels"] .tp-prop__value {
    grid-column: 2 / -1;
  }
}
@container tprops (max-width: 360px) {
  .tp-props__grid {
    column-gap: 10px;
  }
  .tp-prop {
    padding-left: 12px;
  }
  .tp-prop__label {
    gap: 7px;
  }
}

/* Field buttons that open pickers. The picker is pulled 8px left so the value's text lines up with
   the column while the hover background still has breathing room. */
.tp-picker {
  display: inline-flex;
  min-width: 0;
  max-width: calc(100% + 8px);
  margin-left: -8px;
}
.tp-picker--wrap {
  display: flex;
  width: calc(100% + 8px);
}
.tp-subtask__meta .tp-picker {
  max-width: 100%;
  margin-left: 0;
}
.tp-static {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 32px;
}
.tp-static--wrap {
  flex-wrap: wrap;
  gap: 5px;
  padding-block: 6px;
}
.tp-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  padding: 2px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.tp-field:hover,
.tp-field[aria-expanded="true"] {
  background: var(--fill-1);
}
.tp-field:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.tp-field.is-empty {
  color: var(--text-3);
}
.tp-field__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-field__icon,
.tp-field__chevron {
  flex-shrink: 0;
  color: var(--text-3);
}
.tp-field__chevron {
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--dur-1) ease;
}
.tp-field:hover .tp-field__chevron,
.tp-field:focus-visible .tp-field__chevron,
.tp-field[aria-expanded="true"] .tp-field__chevron {
  opacity: 1;
}
.tp-field--wrap {
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
  padding-block: 5px;
}
.tp-field--icon {
  justify-content: center;
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
}
.tp-field--compact {
  min-height: 28px;
  padding: 0 6px;
}
.tp-field--link,
.tp-prop__value > button.tp-field {
  margin-left: -8px; /* line the value up with the other rows (pickers are pulled left too) */
  color: var(--text);
}
.tp-field .due {
  margin-left: -2px;
}
.tp-field .icon-tile {
  flex-shrink: 0;
}
.tp-status,
.tp-type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.tp-status {
  font-weight: var(--fw-medium);
}
.tp-status__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-status .dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  box-shadow: 0 0 0 3px var(--tone-soft);
}
.tp-done-mark {
  color: var(--success);
}
.tp-assign-me {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-1) ease, background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.tp-assign-me:hover {
  background: var(--accent-softer);
  color: var(--accent-ink);
}
.tp-assign-me:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
  opacity: 1;
}
.tp-prop:hover .tp-assign-me {
  opacity: 1;
}
@media (hover: none) {
  .tp-assign-me {
    opacity: 1;
  }
}
.tp-inline-input {
  width: calc(100% + 8px);
  max-width: 260px;
  height: 32px;
  margin-left: -8px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-md);
  text-overflow: ellipsis;
  transition: background-color var(--dur-1) ease, box-shadow var(--dur-2) ease;
}
.tp-inline-input::placeholder {
  color: var(--text-3);
}
.tp-inline-input:hover {
  background: var(--fill-1);
}
.tp-inline-input:focus {
  outline: none;
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 0 4px var(--focus-ring);
}
@media (pointer: coarse), (max-width: 767px) {
  .tp-inline-input {
    font-size: 16px;
  }
}
.tp-empty-text {
  color: var(--text-3);
  font-size: var(--fs-md);
}
.tp-date {
  font-variant-numeric: tabular-nums;
}

/* Time logged */
.tp-time {
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.tp-time__sum {
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.tp-time__of {
  color: var(--text-3);
  white-space: nowrap;
}
.tp-time__bar {
  flex: 0 1 44px;
  min-width: 24px;
  margin-left: 4px;
}
.tp-time.is-over .tp-time__sum {
  color: var(--danger-ink);
}
@container tprops (max-width: 300px) {
  .tp-time__bar {
    display: none;
  }
}

/* Popover panels used by the pickers */
.tp-pop {
  min-width: 260px;
  max-width: min(320px, calc(100vw - 16px));
  padding: 6px;
}
.tp-pop__list {
  display: flex;
  flex-direction: column;
  max-height: min(44vh, 340px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tp-pop .menu__item {
  flex-shrink: 0;
}
.tp-pop .menu__text .menu__sub {
  font-size: var(--fs-2xs);
}
.tp-people .menu__item {
  height: auto;
  min-height: var(--row-h);
  padding-block: 5px;
}
.tp-check {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  min-height: var(--row-h);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tp-check:hover,
.tp-check:focus-within {
  background: var(--fill-2);
}
.tp-check input {
  flex-shrink: 0;
}
.tp-check__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-labelpop__create {
  margin-top: 4px;
  color: var(--accent-ink);
}
.tp-labelpop__create > .icon:first-child {
  color: var(--accent-ink);
}
.tp-datepop {
  width: 272px;
  min-width: 0;
}
.tp-datepop .menu__kbd {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* r4 · 9.9: the month grid (macOS graphical date picker) — month + ‹ ›, 7 columns of 32px round
   days; today in accent text, the picked day a filled accent circle with a white number. */
.date-grid {
  padding: 2px 4px 4px;
}
.date-grid:empty {
  display: none;
}
.date-grid__head {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 0 0 0 6px;
}
.date-grid__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.date-grid__nav {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--accent-ink);
  cursor: default;
}
.date-grid__nav:hover {
  background: var(--fill-1);
}
.date-grid__nav:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.date-grid__grid {
  display: grid;
  gap: 2px;
}
@media (prefers-reduced-motion: no-preference) {
  .date-grid__grid.is-next {
    animation: dg-in-next var(--dur-snappy) var(--spring-snappy);
  }
  .date-grid__grid.is-prev {
    animation: dg-in-prev var(--dur-snappy) var(--spring-snappy);
  }
}
@keyframes dg-in-next {
  from {
    opacity: 0.2;
    transform: translateX(10px);
  }
}
@keyframes dg-in-prev {
  from {
    opacity: 0.2;
    transform: translateX(-10px);
  }
}
.date-grid__row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  justify-items: center;
}
.date-grid__wd {
  height: 22px;
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: 22px;
  text-transform: uppercase;
}
.date-grid__day {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-1) ease,
    color var(--dur-1) ease,
    transform var(--dur-snappy) var(--spring-snappy);
}
.date-grid__day.is-other {
  color: var(--text-3);
}
.date-grid__day:hover {
  background: var(--fill-1);
}
.date-grid__day:active {
  transform: scale(0.9);
}
.date-grid__day.is-today {
  color: var(--accent-ink);
  font-weight: var(--fw-bold);
}
.date-grid__day.is-selected {
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: var(--fw-semibold);
}
.date-grid__day:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--focus-outline),
    0 0 0 4px var(--focus-ring);
}
@media (pointer: coarse) {
  .date-grid__day {
    width: 36px;
    height: 36px;
  }
  .tp-datepop {
    width: 296px;
  }
}
.tp-timepop {
  width: 320px;
  padding: 12px;
}
.tp-timepop__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tp-timepop__grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 8px;
}
.tp-timepop__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tp-timepop__total {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.tp-mini-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.tp-entries {
  display: flex;
  flex-direction: column;
  max-height: 220px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.tp-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 4px 4px 8px;
  border-radius: var(--radius-sm);
}
.tp-entry:hover {
  background: var(--fill-1);
}
.tp-entry__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  font-size: var(--fs-sm);
}
.tp-entry__top {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-entry__meta {
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-entry__delete {
  opacity: 0;
}
.tp-entry:hover .tp-entry__delete,
.tp-entry__delete:focus-visible {
  opacity: 1;
}
.tp-entry__delete:hover {
  color: var(--danger-ink);
}
@media (hover: none) {
  .tp-entry__delete {
    opacity: 1;
  }
}

/* -- Sections ------------------------------------------------------------------------------------ */
.tp-section {
  min-width: 0;
}
.tp-section__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  margin-bottom: 10px;
}
.tp-section__title {
  display: inline-flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-snug);
}
.tp-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--fill-1);
  color: var(--text-2);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.tp-count[hidden] {
  display: none;
}
.tp-section__action {
  margin-right: -6px;
  color: var(--text-2);
}
.tp-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--text-3);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.tp-hint .kbd {
  font-size: var(--fs-2xs);
}
.tp-hint__dot {
  margin: 0 2px;
}

/* -- Description --------------------------------------------------------------------------------- */
.tp-desc__body {
  margin: 0 -10px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  overflow-wrap: anywhere;
}
.tp-desc__body.is-editable {
  cursor: text;
  transition: background-color var(--dur-1) ease;
}
.tp-desc__body.is-editable:hover {
  background: var(--fill-1);
}
.tp-desc__empty {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% + 20px);
  min-height: 44px;
  margin: 0 -10px;
  padding: 10px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text-3);
  font-size: var(--fs-md);
  text-align: left;
  cursor: text;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.tp-desc__empty .icon {
  flex-shrink: 0;
}
.tp-desc__empty:hover {
  background: var(--fill-1);
  color: var(--text-2);
}
.tp-desc__empty:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px var(--focus-ring);
}
.tp-editor {
  overflow: hidden;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-lg);
  background: var(--input-bg);
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-2) ease;
}
.tp-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--focus-ring);
}
@media (prefers-reduced-motion: no-preference) {
  .tp-desc.is-editing .tp-editor {
    animation: tp-editor-in var(--dur-2) var(--ease-out);
  }
}
@keyframes tp-editor-in {
  from {
    opacity: 0.4;
    transform: translateY(-2px);
  }
}
.tp-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--fill-1) 50%, transparent);
}
.tp-tool {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  cursor: pointer;
}
.tp-tool b {
  font-weight: var(--fw-bold);
}
.tp-tool i {
  font-style: italic;
  font-weight: var(--fw-medium);
}
.tp-tool__glyph {
  font-weight: var(--fw-bold);
  font-size: var(--fs-md);
}
.tp-tool:hover {
  background: var(--fill-1);
  color: var(--text);
}
.tp-tool:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.tp-tool__sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--line-strong);
}
.tp-editor__md {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding-right: 6px;
  color: var(--text-3);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
}
.tp-editor__input {
  display: block;
  width: 100%;
  min-height: 160px;
  max-height: 60vh;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.6;
  resize: none;
  field-sizing: content;
}
.tp-editor__input:focus {
  outline: none;
}
.tp-editor__input::placeholder {
  color: var(--text-3);
}
.tp-editor__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.tp-editor__foot .tp-hint {
  margin-right: auto;
}
@media (pointer: coarse), (max-width: 767px) {
  .tp-editor__input {
    font-size: 16px;
  }
}

/* Markdown checklists (rich_text) */
.prose li.md-task {
  position: relative;
  list-style: none;
}
.prose li.md-task > p {
  display: inline;
}
.md-check {
  display: inline-block;
  width: 17px;
  height: 17px;
  margin: 0 8px 0 calc(-1.4em + 1px);
  border: 1.5px solid var(--control-border);
  border-radius: 5px;
  vertical-align: -3px;
  transition: background-color var(--dur-1) ease, border-color var(--dur-1) ease, transform var(--dur-1) var(--ease-out);
}
.md-check[data-check-index] {
  cursor: pointer;
}
.md-check[data-check-index]:hover {
  border-color: var(--accent);
}
.md-check[data-check-index]:active {
  transform: scale(0.9);
}
.md-check:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.md-check[aria-checked="true"] {
  position: relative;
  border-color: var(--success);
  background: var(--success);
}
.md-check[aria-disabled="true"][aria-checked="true"] {
  border-color: var(--text-3);
  background: var(--text-3);
}
.md-check[aria-checked="true"]::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--text-on-accent);
  -webkit-mask: var(--check-mask) center / contain no-repeat;
  mask: var(--check-mask) center / contain no-repeat;
}
.prose li.md-task.is-checked {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

/* -- Subtasks ------------------------------------------------------------------------------------ */
.tp-subprogress {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.tp-subprogress__bar {
  flex: none;
  width: 72px;
}
.tp-subprogress.is-complete {
  color: var(--success-ink);
  font-weight: var(--fw-medium);
}
.tp-sublist {
  display: flex;
  flex-direction: column;
  margin: 0 -8px;
  padding: 0;
  list-style: none;
}
/* Reminders list: an 18px check-circle, 14px title, hairlines that start after the circle; the
   grip shows on hover (drag to reorder). */
.tp-subtask {
  --cc-size: 18px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 1px 4px 1px 10px;
  border-radius: var(--radius-sm);
  transition: background-color var(--dur-1) ease;
}
.tp-subtask .check-circle {
  --cc-size: 18px;
}
.tp-subtask + .tp-subtask::before {
  content: "";
  position: absolute;
  top: 0;
  right: 4px;
  left: 38px;
  height: 0.5px;
  background: var(--line);
  transition: opacity var(--dur-1) ease;
}
.tp-subtask:hover::before,
.tp-subtask:hover + .tp-subtask::before,
.tp-subtask:focus-within::before,
.tp-subtask:focus-within + .tp-subtask::before {
  opacity: 0;
}
.tp-subtask:hover,
.tp-subtask:focus-within {
  background: var(--fill-1);
}
.tp-subtask__handle {
  position: absolute;
  left: -14px;
  display: grid;
  place-items: center;
  width: 14px;
  height: 28px;
  color: var(--text-3);
  cursor: grab;
  opacity: 0;
  transition: opacity var(--dur-1) ease;
}
.tp-subtask:hover .tp-subtask__handle {
  opacity: 1;
}
.tp-subtask__title {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 28px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--dur-2) ease;
}
input.tp-subtask__title:focus {
  outline: none;
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 0 4px var(--focus-ring);
}
.tp-subtask:has(.check-circle[aria-checked="true"]) .tp-subtask__title {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
.tp-subtask__meta {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 2px;
}
.tp-subtask__meta .tp-field.is-empty,
.tp-subtask__open,
.tp-subtask__delete {
  opacity: 0;
  transition: opacity var(--dur-1) ease;
}
.tp-subtask:hover .tp-subtask__meta .tp-field.is-empty,
.tp-subtask:focus-within .tp-subtask__meta .tp-field.is-empty,
.tp-subtask:hover .tp-subtask__open,
.tp-subtask:focus-within .tp-subtask__open,
.tp-subtask:hover .tp-subtask__delete,
.tp-subtask:focus-within .tp-subtask__delete,
.tp-subtask__meta .tp-field[aria-expanded="true"] {
  opacity: 1;
}
.tp-subtask__delete:hover {
  color: var(--danger-ink);
}
@media (hover: none) {
  .tp-subtask__meta .tp-field.is-empty,
  .tp-subtask__open {
    opacity: 1;
  }
  .tp-subtask__handle,
  .tp-subtask__delete {
    display: none;
  }
}
.tp-subadd {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  margin: 0 -8px;
  padding: 1px 10px 1px 10px;
  border-radius: var(--radius-sm);
  transition: background-color var(--dur-1) ease;
}
.tp-subadd:hover {
  background: var(--fill-1);
}
.tp-subadd:focus-within {
  background: var(--fill-1);
}
/* "⊕ Add subtask": Reminders' accent "New Reminder" row. */
.tp-subadd__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
}
@media (pointer: coarse) {
  .tp-subadd__icon {
    width: 22px;
    height: 22px;
  }
}
.tp-subadd__input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-md);
}
.tp-subadd__input::placeholder {
  color: var(--accent-ink);
  opacity: 0.85;
}
.tp-subadd__input:focus::placeholder {
  color: var(--text-3);
  opacity: 1;
}
.tp-subadd__input:focus {
  outline: none;
}
.tp-subadd__hint {
  opacity: 0;
  transition: opacity var(--dur-1) ease;
}
.tp-subadd:has(.tp-subadd__input:not(:placeholder-shown):focus) .tp-subadd__hint {
  opacity: 1;
}
@media (pointer: coarse), (max-width: 767px) {
  .tp-subadd__input,
  .tp-subtask__title {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .tp-subtask.is-new {
    animation: tp-row-in var(--dur-3) var(--ease-spring-soft) both;
  }
  .tp-subtask .check-circle[aria-checked="true"] + .tp-subtask__title {
    transition: color var(--dur-3) ease;
  }
}
@keyframes tp-row-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

/* -- Attachments (r4 · 12.12: Finder-like 120px tiles) --------------------------------------------
   A square preview (the image, or the file kind in a tone squircle with its extension), the name
   (12px) and size (--text-3) under it; hover actions float on the preview. The "add" tile has a
   dashed outline. */
.tp-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 120px));
  gap: 14px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tp-gallery:empty {
  display: none;
}
@container tpanel (max-width: 420px) {
  .tp-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 10px;
  }
}
.tp-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.tp-tile__preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: var(--surface-sunken);
  box-shadow: inset 0 0 0 0.5px var(--line);
  color: inherit;
  cursor: default;
  transition:
    box-shadow var(--dur-2) var(--ease-out),
    transform var(--dur-snappy) var(--spring-snappy);
}
.tp-tile--image .tp-tile__preview {
  cursor: zoom-in;
}
.tp-tile__preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (hover: hover) {
  .tp-tile:not(.tp-tile--add):hover .tp-tile__preview {
    box-shadow:
      inset 0 0 0 0.5px var(--line),
      var(--shadow-md);
  }
}
@media (prefers-reduced-motion: no-preference) {
  .tp-tile:not(.tp-tile--add) .tp-tile__preview:active {
    transform: scale(0.97);
  }
}
.tp-tile__preview:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--focus-outline),
    0 0 0 5px var(--focus-ring);
}
.tp-tile--file .tp-tile__preview {
  background: var(--tone-softer);
}
.tp-tile__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: var(--tone-gradient);
  box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.3), 0 1px 2px rgb(0 0 0 / 0.12);
  color: var(--tone-on);
}
.tp-tile__ext {
  color: var(--tone-ink);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.06em;
}
.tp-tile__foot {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 0 2px;
  text-align: center;
}
.tp-tile__name {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-tile__meta {
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--fs-2xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-tile__actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity var(--dur-1) ease, transform var(--dur-2) var(--ease-out);
}
.tp-tile:hover .tp-tile__actions,
.tp-tile:focus-within .tp-tile__actions {
  opacity: 1;
  transform: none;
}
@media (hover: none) {
  .tp-tile__actions {
    opacity: 1;
    transform: none;
  }
}
.tp-tile__action {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0.5px solid var(--glass-border);
  border-radius: 50%;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--glass-rim), var(--shadow-sm);
  color: var(--text);
  cursor: default;
}
.tp-tile__action:hover {
  background: var(--surface-elevated);
}
.tp-tile__action--danger:hover {
  color: var(--danger-ink);
}
.tp-tile__action:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.tp-tile--add {
  background: none;
  box-shadow: none;
}
.tp-tile__drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  aspect-ratio: 1;
  padding: 10px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.3;
  text-align: center;
  cursor: default;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease, border-color var(--dur-1) ease;
}
.tp-tile__drop:hover,
.tp-tile__drop:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-softer);
  color: var(--accent-ink);
}
.tp-tile--uploading .tp-tile__preview {
  cursor: default;
}
.tp-tile--uploading .tp-tile__icon {
  background: var(--accent);
  color: var(--text-on-accent);
}
.tp-tile__progress {
  position: absolute;
  right: 12px;
  bottom: 10px;
  left: 12px;
}

.tp-files__empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px 10px;
  min-height: 44px;
  padding: 6px 12px 6px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
  cursor: pointer;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease, border-color var(--dur-1) ease;
}
.tp-files__empty:hover,
.tp-files__empty:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-softer);
  color: var(--text-2);
}
.tp-files__empty-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--fill-1);
  color: var(--text-2);
}
.tp-files__browse {
  color: var(--accent-ink);
  font-weight: var(--fw-medium);
}
.tp-files__limit {
  margin-left: auto;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
@container tpanel (max-width: 420px) {
  .tp-files__limit {
    display: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .tp-tile--uploading {
    animation: tp-row-in var(--dur-3) var(--ease-spring-soft) both;
  }
}

/* Drop overlay (drawer panel or the whole page) */
.tp-dropzone {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: inherit;
  background: color-mix(in srgb, var(--surface-elevated) 72%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2) ease;
}
.task-panel > .tp-dropzone,
.tp-page .tp-dropzone {
  position: fixed;
  z-index: var(--z-overlay);
}
.tp-dropzone.is-visible {
  opacity: 1;
}
.tp-dropzone__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  border: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: var(--radius-xl);
  background: var(--accent-softer);
  color: var(--accent-ink);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
}
@media (prefers-reduced-motion: no-preference) {
  .tp-dropzone.is-visible .tp-dropzone__inner .icon {
    animation: tp-bob 1100ms var(--ease-in-out) infinite alternate;
  }
}
@keyframes tp-bob {
  to {
    transform: translateY(-5px);
  }
}

/* Lightbox */
.tp-lightbox {
  --lb-bg: light-dark(color-mix(in srgb, var(--surface-inverse) 94%, transparent), color-mix(in srgb, var(--bg) 94%, transparent));
  --lb-fg: light-dark(var(--text-inverse), var(--text));
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0 0 24px;
  border: 0;
  background: var(--lb-bg);
  color: var(--lb-fg);
  opacity: 1;
  transition: opacity var(--dur-2) ease;
}
.tp-lightbox:not([open]) {
  display: none;
}
.tp-lightbox::backdrop {
  background: transparent;
}
@starting-style {
  .tp-lightbox[open] {
    opacity: 0;
  }
}
.tp-lightbox.is-closing {
  opacity: 0;
}
.tp-lightbox__bar {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 12px 10px 20px;
}
.tp-lightbox__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-lightbox__count {
  opacity: 0.7;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.tp-lightbox__btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--lb-fg) 12%, transparent);
  color: var(--lb-fg);
  cursor: pointer;
}
.tp-lightbox__btn:hover {
  background: color-mix(in srgb, var(--lb-fg) 22%, transparent);
}
.tp-lightbox__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.tp-lightbox__nav {
  align-self: center;
  justify-self: center;
}
.tp-lightbox__nav[hidden] {
  visibility: hidden;
}
.tp-lightbox img {
  align-self: center;
  justify-self: center;
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  object-fit: contain;
  box-shadow: var(--shadow-xl);
}
@media (prefers-reduced-motion: no-preference) {
  .tp-lightbox[open] img {
    animation: tp-zoom-in var(--dur-3) var(--ease-out);
  }
}
@keyframes tp-zoom-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
}
@media (max-width: 639px) {
  .tp-lightbox {
    grid-template-columns: 0 minmax(0, 1fr) 0;
    padding: 0 8px 16px;
  }
  .tp-lightbox__nav {
    position: fixed;
    bottom: calc(18px + var(--safe-bottom));
  }
  .tp-lightbox__nav--prev {
    left: 18px;
  }
  .tp-lightbox__nav--next {
    right: 18px;
  }
}

/* -- Activity (r4 · 12.12) -------------------------------------------------------------------------
   Segmented All | Comments N. Events: one quiet 13px line with a 16px glyph. Comments: a 24px
   avatar + name (600) + time, the text in a bubble (--tp-bubble, radius 16), reactions as tapback
   capsules under it; "…" and 😊+ show on hover. A hairline rail joins the avatars and glyphs. */
.tp-feed__filter {
  flex-shrink: 0;
}
.tp-feed__filter .tp-count {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--fill-2);
  font-size: 10px;
}
.tp-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tp-timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 11.5px;
  width: 1px;
  background: var(--line-subtle);
}
.tp-timeline:not(:has(> .tp-event, > .tp-comment))::before {
  display: none;
}
.tp-event {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 3px 0;
}
.tp-event[hidden] {
  display: none;
}
.tp-event__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--surface-elevated);
  box-shadow: 0 0 0 3px var(--surface-elevated);
  color: var(--text-3);
}
.tp-event__icon .icon {
  width: 14px;
  height: 14px;
}
.task-panel--page .tp-event__icon {
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--bg);
}
.tp-event__icon[data-color="green"] {
  color: var(--success-ink); /* "completed" is the one event that carries meaning in color */
}
/* System events stay quiet (13px --text-2 line); only what changed reads stronger. */
.tp-event__text {
  min-width: 0;
  padding-top: 1px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.tp-event__actor {
  color: var(--text);
  font-weight: var(--fw-medium);
}
.tp-event__detail {
  display: inline;
  margin-left: 4px;
  color: var(--text);
}
.tp-event__detail + .tp-event__detail::before {
  content: "· ";
  color: var(--text-3);
}
.tp-event__time {
  margin-left: 6px;
  color: var(--text-3);
  white-space: nowrap;
}
.tp-ev-more,
.tp-comments-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  margin: 2px 0 4px 34px;
  padding: 4px 11px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--fill-1);
  color: var(--text-2);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  cursor: default;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.tp-comments-more {
  align-self: center;
  margin: 0 0 8px;
  font-size: var(--fs-sm);
}
.tp-ev-more:hover,
.tp-comments-more:hover {
  background: var(--fill-2);
  color: var(--text);
}
.tp-ev-more:focus-visible,
.tp-comments-more:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.tp-timeline[data-filter="comments"] > :is(.tp-event, .tp-ev-more) {
  display: none;
}
.tp-timeline[data-filter="comments"]::before {
  display: none;
}

/* Comments */
.tp-comment {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 8px 0 6px;
}
.tp-comment__avatar {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--surface-elevated);
}
.task-panel--page .tp-comment__avatar {
  box-shadow: 0 0 0 3px var(--bg);
}
.tp-comment__avatar .avatar {
  --size: 24px;
}
.tp-comment__main {
  min-width: 0;
}
.tp-comment__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}
.tp-comment__author {
  overflow: hidden;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-comment__time,
.tp-comment__edited {
  flex-shrink: 0;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.tp-comment__edited {
  font-style: italic;
}
.tp-comment__menu {
  margin: -4px -6px -4px auto;
  opacity: 0;
  transition: opacity var(--dur-1) ease;
}
.tp-comment:hover .tp-comment__menu,
.tp-comment:focus-within .tp-comment__menu,
.tp-comment__menu:has([aria-expanded="true"]) {
  opacity: 1;
}
@media (hover: none) {
  .tp-comment__menu {
    opacity: 1;
  }
}
/* The bubble (iMessage-like, but left-aligned: a document thread, not a chat). */
.tp-comment__body {
  width: fit-content;
  max-width: 100%;
  margin-top: 4px;
  padding: 9px 12px 10px;
  border-radius: 16px;
  border-top-left-radius: 6px;
  background: var(--tp-bubble);
  box-shadow: var(--tp-bubble-ring, none);
  font-size: var(--fs-md);
  overflow-wrap: anywhere;
}
.task-panel--page .tp-comment__body {
  --tp-bubble-ring: 0 0 0 0.5px var(--card-ring), var(--shadow-xs);
}
.tp-comment.is-editing .tp-comment__body,
.tp-comment:not(.is-editing) .tp-comment__edit {
  display: none;
}
.tp-comment__edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.tp-comment__input {
  min-height: 64px;
  border-radius: 14px;
  resize: none;
  field-sizing: content;
}
.tp-comment__edit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.tp-comment__edit-actions .tp-hint {
  margin-right: auto;
}
@media (prefers-reduced-motion: no-preference) {
  .tp-comment.is-new {
    animation: tp-bubble-in var(--dur-bouncy) var(--spring-bouncy) both;
    transform-origin: 34px 0;
  }
  .tp-comment.is-new .tp-comment__body {
    animation: tp-flash 1600ms var(--ease-out);
  }
}
@keyframes tp-bubble-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}
@keyframes tp-flash {
  from {
    background: var(--accent-soft);
  }
}

/* Reactions: tapback capsules (24px); mine are --accent-soft. */
.tp-reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
.tp-reactions.is-empty {
  position: absolute;
  top: 8px;
  right: 30px;
  margin: 0;
}
.tp-reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--fill-1);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-1) ease,
    transform var(--dur-snappy) var(--spring-snappy);
}
.tp-reaction:hover:not(:disabled) {
  background: var(--fill-2);
}
.tp-reaction:active:not(:disabled) {
  transform: scale(0.9);
  transition-duration: var(--dur-1);
}
.tp-reaction:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.tp-reaction.is-mine {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.tp-reaction__emoji {
  font-size: 14px;
  line-height: 1;
}
.tp-reaction--add {
  justify-content: center;
  width: 28px;
  padding: 0;
  background: transparent;
  color: var(--text-3);
  opacity: 0;
}
.tp-comment:hover .tp-reaction--add,
.tp-comment:focus-within .tp-reaction--add,
.tp-reaction--add[aria-expanded="true"] {
  opacity: 1;
}
@media (hover: none) {
  .tp-reaction--add {
    opacity: 1;
  }
  .tp-reactions.is-empty {
    position: static;
    margin-top: 6px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .tp-reaction.is-mine .tp-reaction__emoji {
    animation: tp-pop 420ms var(--ease-spring);
  }
}
/* The emoji row: an iMessage tapback capsule. */
.tp-emoji-pop {
  display: flex;
  gap: 2px;
  min-width: 0;
  padding: 5px;
  border-radius: var(--radius-full);
}
.tp-emoji {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 21px;
  cursor: default;
  transition: transform var(--dur-snappy) var(--spring-bouncy), background-color var(--dur-1) ease;
}
.tp-emoji:hover,
.tp-emoji:focus-visible {
  outline: none;
  background: var(--fill-2);
  transform: scale(1.18);
}
.tp-feed__empty {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-card);
  background: var(--tp-group);
  box-shadow: var(--tp-group-ring);
  font-size: var(--fs-sm);
}
.tp-feed__empty p {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.tp-feed__empty span:not(.icon-tile) {
  color: var(--text-2);
}
.tp-feed:not(:has(.tp-comment)) .tp-feed__empty {
  display: flex;
}

/* Followers strip (end of the activity) */
.tp-followers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.tp-followers__label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.tp-followers__label .icon {
  color: var(--text-3);
}
.tp-follow-btn {
  margin-left: auto;
}
.tp-follow-btn.is-on {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* Composer (drawer footer / under the activity on the full page) — r4 · 12.12: a 28px avatar, a
   --fill-1 capsule (1–8 lines) and a 30px round ↑ that is grey while empty and springs to the
   accent once there is text (Messages). */
.drawer__footer.tp-footer {
  padding: 10px 14px calc(10px + var(--safe-bottom));
  border-top: 0;
  background: var(--glass-sheen), var(--mat-chrome);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
  box-shadow: 0 -0.5px 0 var(--line-subtle);
}
.tp-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.tp-feed .tp-composer {
  margin-top: 16px;
}
/* Full page: the composer stays pinned to the bottom of the window while the activity is on screen
   (phones keep it in the flow — the floating tab bar already owns the bottom edge). */
@media (min-width: 768px) {
  .task-panel--page .tp-feed > .tp-composer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 8px -12px 0;
    padding: 14px 12px 16px;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 16px);
  }
  /* The page reserves the docked composer's height: anything scrolled or focused into view (a new
     comment, a #link to an activity item, Tab through the feed) stops above it, not behind it. */
  html:has(.task-panel--page .tp-feed > .tp-composer) {
    scroll-padding-bottom: 112px;
  }
  .task-panel--page .tp-feed :is(.tp-comment, .tp-event) {
    scroll-margin-bottom: 112px;
  }
  /* While it floats over the feed (stuck), the field lifts — an obvious overlay, not a cut. */
  .task-panel--page .tp-feed > .tp-composer {
    container-type: scroll-state;
  }
  @container scroll-state(stuck: bottom) {
    .tp-composer__field:not(:focus-within) {
      box-shadow: var(--shadow-md);
    }
  }
}
.tp-composer__avatar {
  flex-shrink: 0;
  margin-bottom: 4px;
}
.tp-composer__avatar .avatar {
  --size: 28px;
}
.tp-composer__field {
  position: relative;
  display: flex;
  flex: 1;
  align-items: flex-end;
  min-width: 0;
  border-radius: 18px;
  background: var(--fill-1);
  box-shadow: inset 0 0 0 0.5px var(--line-subtle);
  transition:
    background-color var(--dur-1) ease,
    box-shadow var(--dur-2) ease;
}
.task-panel--page .tp-composer__field {
  background: var(--surface);
  box-shadow: 0 0 0 0.5px var(--card-ring), var(--shadow-xs);
}
.tp-composer__field:focus-within {
  box-shadow:
    inset 0 0 0 0.5px var(--line),
    0 0 0 3.5px var(--focus-ring);
}
.tp-composer__input {
  display: block;
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  max-height: calc(8 * 1.45em + 16px); /* 8 lines, then it scrolls */
  padding: 8px 4px 8px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.45;
  resize: none;
  field-sizing: content;
}
.tp-composer__input:focus {
  outline: none;
}
.tp-composer__input::placeholder {
  overflow: hidden;
  color: var(--text-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-composer__bar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  padding: 3px;
}
.tp-composer__hint {
  display: none;
}
.tp-composer__send.btn {
  --btn-h: 30px;
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  box-shadow: none;
  transition:
    background-color var(--dur-2) ease,
    color var(--dur-2) ease,
    transform var(--dur-snappy) var(--spring-snappy);
}
.tp-composer:has(.tp-composer__input:placeholder-shown) .tp-composer__send.btn {
  background: var(--fill-3);
  color: var(--text-on-accent);
  transform: scale(0.86);
}
@media (pointer: coarse), (max-width: 767px) {
  .tp-composer__input {
    min-height: 38px;
    font-size: 16px;
  }
  .tp-composer__send.btn {
    --btn-h: 32px;
    width: 32px;
  }
}
@media (max-width: 639px) {
  .tp-composer__avatar {
    display: none;
  }
}

/* @mention suggestions (top layer) */
.tp-mentions {
  position: fixed;
  inset: auto;
  z-index: var(--z-overlay);
  display: none;
  flex-direction: column;
  max-height: 260px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-lg);
  background: var(--surface-overlay);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.tp-mentions.is-open {
  display: flex;
}
@media (prefers-reduced-motion: no-preference) {
  .tp-mentions.is-open {
    animation: tp-pop-in var(--dur-2) var(--ease-out);
  }
}
@keyframes tp-pop-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
}
.tp-mention {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-size: var(--fs-md);
  text-align: left;
  cursor: pointer;
}
.tp-mention[aria-selected="true"] {
  background: var(--fill-2);
}
.tp-mention__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-mention__handle {
  margin-left: auto;
  padding-left: 10px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.tp-mention__empty {
  padding: 8px 10px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}

/* Drawer content swap (previous / next task): a quick slide in the direction of travel */
@media (prefers-reduced-motion: no-preference) {
  .drawer[data-task-drawer].tp-enter-next .drawer__body > .task-panel,
  .drawer[data-task-drawer].tp-enter-prev .drawer__body > .task-panel {
    animation: tp-enter-next 260ms var(--ease-out);
  }
  .drawer[data-task-drawer].tp-enter-prev .drawer__body > .task-panel {
    animation-name: tp-enter-prev;
  }
  .drawer[data-task-drawer].tp-enter-swap .drawer__body > .task-panel {
    animation: fade-in var(--dur-2) var(--ease-out);
  }
}
@keyframes tp-enter-next {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes tp-enter-prev {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
}

/* -- Move modal (r4 · 12.25: a search over an inset grouped list, ✓ on the picked project) ------- */
.tp-move__search {
  margin-bottom: 12px;
}
.tp-move {
  display: flex;
  flex-direction: column;
  max-height: min(46vh, 380px);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--fill-1);
}
.tp-move__option {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 14px;
  cursor: default;
  transition: background-color var(--dur-1) ease;
}
.tp-move__option + .tp-move__option::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 52px;
  height: 0.5px;
  background: var(--line);
}
.tp-move__option:hover {
  background: var(--fill-1);
}
.tp-move__option:has(input:focus-visible) {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.tp-move__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: var(--fw-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-move__check {
  flex-shrink: 0;
  color: var(--accent-ink);
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity var(--dur-1) ease,
    transform var(--dur-snappy) var(--spring-bouncy);
}
.tp-move__option:has(input:checked) .tp-move__check {
  opacity: 1;
  transform: none;
}
.tp-move__empty {
  padding: 14px;
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
}
.tp-hint--block {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.45;
  white-space: normal;
}
.tp-hint--block .icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-3);
}

/* -- New task sheet (r4 · 12.13) ------------------------------------------------------------------ */
dialog.modal.task-create {
  --modal-w: 560px; /* sheet md */
}

.task-create .modal__body {
  padding-top: 2px;
}
.tc {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tc-parent {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  max-width: 100%;
  margin-bottom: 10px;
  padding: 3px 10px 3px 6px;
  border-radius: var(--radius-full);
  background: var(--fill-1);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.tc-parent__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tc-title,
.tc-desc {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  resize: none;
  field-sizing: content;
}
.tc-title {
  min-height: 34px;
  font-family: var(--font-display);
  font-size: var(--fs-title-3);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-snug);
  line-height: 1.3;
}
.tc-desc {
  min-height: 44px;
  max-height: 36vh;
  margin-top: 6px;
  font-size: var(--fs-md);
  line-height: 1.55;
}
.tc-title::placeholder,
.tc-desc::placeholder {
  color: var(--text-3);
}
.tc-title:focus,
.tc-desc:focus {
  outline: none;
}
.tc-title[aria-invalid="true"]::placeholder {
  color: var(--danger-ink);
}
.tc-error {
  margin-top: 6px;
}
.tc .form-errors {
  margin-bottom: 12px;
}
@media (pointer: coarse), (max-width: 639px) {
  .tc-desc {
    font-size: 16px;
  }
}
/* The picker pills (Project · Status · Assignee · Due · Priority · Type · Labels) — one row, like
   Things / Reminders' details bar; an empty one is a dashed capsule (core .picker-pill). On phones
   the row scrolls sideways with faded edges. */
.tc-props {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}
@media (max-width: 639px) {
  .tc-props {
    flex-wrap: nowrap;
    margin-inline: -16px;
    padding: 2px 16px 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  }
  .tc-props::-webkit-scrollbar {
    display: none;
  }
  .tc-props .tc-pick {
    flex-shrink: 0;
  }
}
.tc-project-fields {
  display: contents;
}
.tc-pick {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
}
/* The pickers: core .picker-pill (.tc-pill is its alias) — static/css/core/controls.css. */
.tc-opt {
  display: inline-flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tc-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.tc-kbd {
  display: inline-flex;
  margin-left: 4px;
}
@media (max-width: 639px) {
  .tc-more {
    flex: 1 1 100%;
    order: -1;
    margin-bottom: 4px;
  }
}

/* -- My tasks (r4 · 12.2 — Reminders) --------------------------------------------------------------
   Large title + one summary line; search · Upcoming | Completed · "…" (filters) on the right; a
   "⊕ New task" row that opens into a card while used; sections as inset grouped lists under sticky
   glass heads (34px) that the rows scroll under. */
.my-tasks {
  --mt-head-bg: color-mix(in srgb, var(--bg) 80%, transparent);
  max-width: 1040px;
  margin-inline: auto;
}
:root[data-transparency="reduced"] .my-tasks {
  --mt-head-bg: var(--bg);
}
@media (prefers-reduced-transparency: reduce) {
  .my-tasks {
    --mt-head-bg: var(--bg);
  }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .my-tasks {
    --mt-head-bg: var(--bg);
  }
}
.mt-header {
  align-items: flex-end;
  margin-bottom: 14px;
}
.mt-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 0;
  color: var(--text-2);
  font-size: var(--type-subhead);
}
.mt-summary > :not(:last-child)::after {
  content: "·";
  margin: 0 7px;
  color: var(--text-3);
  font-weight: var(--fw-regular);
}
.mt-summary__item {
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.mt-summary__item--overdue {
  color: var(--danger-ink);
}
.mt-summary__item--today {
  color: var(--warning-ink);
}
.mt-actions {
  flex-wrap: nowrap;
  min-width: 0;
}
.mt-toolbar {
  display: contents;
}
.mt-actions .toolbar-search {
  order: -1;
  flex: 0 1 200px;
}
.mt-views .segmented__item > span .icon {
  flex-shrink: 0;
}
.mt-filter {
  position: relative;
}
.mt-filter__btn.btn {
  --btn-h: var(--control-h);
  width: var(--control-h);
  min-width: 0;
  padding: 0;
  border-radius: 50%;
}
.mt-filter__btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.mt-filter__dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}
.mt-filter__menu {
  max-height: min(70vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 767px) {
  .mt-header {
    margin-bottom: 12px;
  }
  .mt-actions {
    flex-wrap: wrap;
    gap: 10px 8px;
  }
  .mt-views {
    flex: 1 1 100%;
    order: -2;
  }
  .mt-views .segmented__item {
    flex: 1 1 0;
  }
  .mt-actions .toolbar-search {
    flex: 1 1 auto;
    height: var(--control-h);
  }
}
.my-tasks .active-filters {
  margin-bottom: 12px;
}

/* Quick add: Reminders' "⊕ New task" row — at rest an accent ⊕ and a placeholder on the page; while
   used (focus, text, an open picker) it becomes a card and the project / due pills appear. */
.mt-quick {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin-bottom: 4px;
  padding: 5px 6px 5px 14px;
  border-radius: var(--radius-card);
  background: transparent;
  box-shadow: 0 0 0 0 transparent;
  transition:
    background-color var(--dur-2) ease,
    box-shadow var(--dur-2) ease;
}
.mt-quick:is(:focus-within, :has(.mt-quick__input:not(:placeholder-shown)), :has([aria-expanded="true"])) {
  background: var(--surface);
  box-shadow:
    0 0 0 0.5px var(--card-ring),
    var(--shadow-sm);
}
.mt-quick__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
  transition: transform var(--dur-snappy) var(--spring-snappy);
}
@media (prefers-reduced-motion: no-preference) {
  .mt-quick:focus-within .mt-quick__icon {
    transform: rotate(90deg);
  }
}
.mt-quick__input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--type-body);
}
.mt-quick__input::placeholder {
  color: var(--accent-ink);
}
.mt-quick:focus-within .mt-quick__input::placeholder {
  color: var(--text-3);
}
.mt-quick__input:focus {
  outline: none;
}
.mt-quick__opts {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.mt-quick:is(:focus-within, :has(.mt-quick__input:not(:placeholder-shown)), :has([aria-expanded="true"])) .mt-quick__opts {
  display: flex;
}
@media (prefers-reduced-motion: no-preference) {
  .mt-quick:is(:focus-within, :has(.mt-quick__input:not(:placeholder-shown)), :has([aria-expanded="true"])) .mt-quick__opts {
    animation: mt-opts-in var(--dur-snappy) var(--spring-snappy) both;
  }
}
@keyframes mt-opts-in {
  from {
    opacity: 0;
    translate: 8px 0;
  }
}
.mt-quick__pill {
  max-width: 220px;
}
.mt-quick__pill .tc-pill__text {
  max-width: 150px;
}
@media (max-width: 767px) {
  .mt-quick {
    flex-wrap: wrap;
    padding: 6px 8px 6px 14px;
  }
  .mt-quick__input {
    flex-basis: calc(100% - 40px);
    font-size: 16px;
  }
  .mt-quick__opts {
    flex: 1 1 100%;
    padding-bottom: 2px;
  }
  .mt-quick__opts .tc-pick:first-child {
    flex: 0 1 auto;
    min-width: 0;
  }
  .mt-quick__opts .tc-pick + .tc-pick {
    flex: none;
  }
  .mt-quick__pill {
    max-width: 100%;
    height: 34px;
  }
  .mt-quick__add {
    --btn-h: 34px;
    margin-left: auto;
  }
}

/* Sections: a sticky glass head (34px) the rows scroll under, then the inset grouped list. */
.mt-section {
  margin-top: 14px;
}
.mt-section.is-empty {
  display: none;
}
.mt-sections.is-dragging .mt-section.is-empty[data-drop] {
  display: block;
}
.mt-section__head {
  position: sticky;
  z-index: 3;
  top: calc(var(--topbar-h) + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  margin: 0 -10px 4px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  background: var(--mt-head-bg);
  -webkit-backdrop-filter: var(--mat-filter);
  backdrop-filter: var(--mat-filter);
}
.mt-section__toggle,
.mt-section__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 30px;
  margin-left: -6px;
  padding: 0 8px 0 4px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text);
}
.mt-section__toggle {
  cursor: default;
  transition: background-color var(--dur-1) ease;
}
.mt-section__toggle:hover {
  background: var(--fill-1);
}
.mt-section__toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.mt-section__icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: var(--text-3);
}
/* Color only where it means something: overdue (red) and today (warm). */
.mt-section[data-section="overdue"] .mt-section__icon {
  background: var(--danger);
  color: var(--text-on-accent);
}
.mt-section[data-section="today"] .mt-section__icon {
  color: var(--warning-ink);
}
.mt-section--static .mt-section__icon {
  color: var(--success-ink);
}
.mt-section__title {
  overflow: hidden;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-snug);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-section[data-section="overdue"] .mt-section__title {
  color: var(--danger-ink);
}
.mt-section__count {
  color: var(--text-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.mt-section[data-section="overdue"] .mt-section__count {
  color: var(--danger-ink);
}
.mt-section__chevron {
  color: var(--text-3);
  transition: transform var(--dur-snappy) var(--spring-snappy);
}
.mt-section.is-collapsed .mt-section__chevron {
  transform: rotate(-90deg);
}
.mt-list {
  min-height: 0;
}
.mt-drop-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.mt-sections.is-dragging .mt-list:not(:has(.task-row:not(.sortable-ghost))) .mt-drop-hint {
  display: flex;
}
.mt-sections.is-dragging .mt-section[data-drop] .mt-list {
  box-shadow:
    0 0 0 1.5px color-mix(in srgb, var(--accent) 35%, transparent),
    var(--shadow-sm);
}
.my-tasks .task-row__cell--assignee {
  display: none;
}
.my-tasks .mt-list .task-row {
  touch-action: pan-y;
}
/* Narrow lists (a docked inspector at 1280px): the project chip keeps only its app icon and the
   label chips their dots, so the title keeps its room. */
@media (min-width: 768px) {
  @container task-row (max-width: 600px) {
    .my-tasks .task-row__project .project-chip {
      width: 26px;
      padding: 0;
      justify-content: center;
    }
    .my-tasks .task-row__project .project-chip .chip__text {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
    .my-tasks .task-row__labels .label-chip {
      width: 18px;
      padding: 0;
      justify-content: center;
    }
    .my-tasks .task-row__labels .label-chip .chip__text {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
  }
}
/* Completed tab: struck, quiet rows (tapping the check reopens one). */
.mt-body[data-view="completed"] .task-row__title {
  color: var(--text-3);
}
.my-tasks .task-row.is-leaving {
  min-height: 0;
  padding-block: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    height var(--dur-3) var(--ease-in-out),
    padding var(--dur-3) var(--ease-in-out),
    opacity var(--dur-2) ease;
}
@media (prefers-reduced-motion: no-preference) {
  .my-tasks .task-row.is-new {
    animation:
      mt-row-in var(--dur-bouncy) var(--spring-bouncy) both,
      tp-flash-row 1600ms var(--ease-out);
  }
  .mt-caught-up .empty-state__art {
    animation: tp-float 3.2s var(--ease-in-out) infinite alternate;
  }
}
@keyframes mt-row-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}
@keyframes tp-flash-row {
  from {
    background: var(--accent-soft);
  }
}
@keyframes tp-float {
  from {
    transform: translateY(2px) rotate(-3deg);
  }
  to {
    transform: translateY(-4px) rotate(3deg);
  }
}
.my-tasks .empty-state {
  margin-top: 28px;
}
