/* Desktop management-list contract: Habits is the reference shell for pushed lists. */
@media (min-width: 761px) {
  body:has(.page-shell--tasks:not(.is-creating-task):not(.is-editing-task)),
  body:has(.page-shell--calendar) {
    padding-left: 0;
  }

  body:has(.page-shell--tasks:not(.is-creating-task):not(.is-editing-task)) .desktop-sidebar,
  body:has(.page-shell--calendar) .desktop-sidebar {
    top: var(--app-desktop-header-top);
    right: var(--app-desktop-content-gutter);
    left: var(--app-desktop-content-gutter);
    display: flex;
    width: auto;
    height: var(--app-desktop-header-height);
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
  }

  body:has(.page-shell--tasks:not(.is-creating-task):not(.is-editing-task)) .desktop-sidebar__nav,
  body:has(.page-shell--calendar) .desktop-sidebar__nav {
    min-height: var(--app-desktop-header-height);
    align-items: center;
    justify-content: center;
    gap: clamp(0.9rem, 1.8vw, 1.65rem);
  }

  body:has(.page-shell--tasks:not(.is-creating-task):not(.is-editing-task)) .desktop-sidebar__link,
  body:has(.page-shell--calendar) .desktop-sidebar__link {
    align-self: center;
    gap: 0.55rem;
    min-height: 2.65rem;
    padding: 0 0.95rem;
    border: 1px solid transparent;
    border-radius: 14px;
    color: color-mix(in srgb, var(--app-ink) 58%, var(--app-muted));
    font-size: 0.95rem;
    font-weight: 820;
  }

  body:has(.page-shell--tasks:not(.is-creating-task):not(.is-editing-task)) .desktop-sidebar__link.is-active,
  body:has(.page-shell--calendar) .desktop-sidebar__link.is-active {
    min-width: 6.9rem;
    min-height: 2.9rem;
    border-color: color-mix(in srgb, var(--app-primary) 24%, var(--app-line));
    background: color-mix(in srgb, var(--app-primary-soft) 72%, var(--app-surface));
    color: var(--app-primary-ink);
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task),
  .page-shell--calendar {
    margin-left: 0;
    padding: calc(var(--app-desktop-header-top) + var(--app-desktop-header-height) + 1.9rem) var(--app-desktop-content-gutter) 4rem;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) > .tasks-app-header,
  .page-shell--calendar > .calendar-app-header {
    display: none;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-layout,
  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-workspace,
  .page-shell--calendar .calendar-layout,
  .page-shell--calendar .calendar-workspace {
    width: min(100%, 72rem);
    max-width: 72rem;
    margin-inline: auto;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-workspace {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-panel,
  .page-shell--calendar .calendar-list-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-titlebar,
  .page-shell--calendar .calendar-list-titlebar {
    display: flex;
    min-height: 2.8rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.05rem;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-titlebar__copy,
  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-titlebar__controls,
  .page-shell--calendar .calendar-list-titlebar__copy {
    align-self: center;
    min-width: 0;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-titlebar__copy h2,
  .page-shell--calendar .calendar-list-titlebar__copy h2 {
    margin: 0;
    color: var(--app-ink);
    font-size: 1.65rem;
    font-weight: 860;
    line-height: 1.05;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-titlebar__controls {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 0.8rem;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-filter.segmented {
    flex: 0 1 27rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: clamp(20rem, 34vw, 27rem);
    max-width: 27rem;
    min-height: auto;
    padding: 0.18rem;
    border-radius: var(--radius-md);
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-filter__link {
    min-width: 0;
    min-height: 1.55rem;
    padding: 0 0.45rem;
    font-size: var(--font-size-meta);
    font-weight: var(--font-weight-meta);
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-filter__link > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-titlebar__add {
    display: inline-flex;
    width: auto;
    min-width: 6.45rem;
    min-height: 2.8rem;
    align-items: center;
    justify-content: center;
    padding: 0 1.05rem;
    border: 1px solid color-mix(in srgb, var(--tasks-primary) 42%, var(--tasks-line));
    border-radius: 8px;
    background: var(--tasks-primary);
    color: #fffdf8;
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-strong);
    line-height: 1;
    text-decoration: none;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-titlebar__add::before,
  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-titlebar__add::after {
    content: none;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .task-section,
  .page-shell--calendar .calendar-section {
    gap: 0.85rem;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .task-section + .task-section,
  .page-shell--calendar .calendar-section + .calendar-section {
    margin-top: 1.35rem;
  }

  .page-shell--calendar .calendar-section .task-section__header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    margin: 0.1rem 0 0.15rem;
  }

  .page-shell--calendar .calendar-section .task-section__header::before {
    align-self: center;
    width: 0.42rem;
    height: 2rem;
    min-height: 2rem;
  }

  .page-shell--calendar .calendar-section .task-section__count {
    min-height: 2rem;
    padding: 0 0.9rem;
    font-size: 0.9rem;
    font-weight: 820;
  }

  .page-shell--calendar .calendar-event-list {
    gap: 0.85rem;
  }

  .page-shell--calendar .calendar-event-row {
    min-height: 4.25rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    background: var(--app-surface);
  }
}

/* Final phone management-list sizing contract: screenshot 1 rhythm shared by pushed list screens. */
@media (max-width: 760px) {
  .page-shell--calendar .calendar-list-titlebar {
    display: none;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task),
  .page-shell--calendar,
  .page-shell--chores:not(.is-creating-chore):not(.is-editing-chore),
  .page-shell--inbox:not(.is-editing-task) {
    gap: 0.7rem;
  }

  .page-shell--inbox:not(.is-editing-task) .inbox-app-header .app-header__title {
    color: var(--habits-ink);
    font-size: var(--font-size-display);
    font-weight: var(--font-weight-title);
    letter-spacing: 0;
    line-height: 1;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-panel,
  .page-shell--calendar .calendar-list-panel,
  .page-shell--chores:not(.is-creating-chore):not(.is-editing-chore) .chores-list-panel,
  .page-shell--inbox:not(.is-editing-task) .inbox-list-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .tasks-list-titlebar,
  .page-shell--calendar .calendar-list-titlebar,
  .page-shell--chores:not(.is-creating-chore):not(.is-editing-chore) .chores-list-heading,
  .page-shell--inbox:not(.is-editing-task) .inbox-list-heading {
    margin: 0 0 1.25rem;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .personal-task-list,
  .page-shell--calendar .calendar-event-list,
  .page-shell--chores:not(.is-creating-chore):not(.is-editing-chore) .chore-list,
  .page-shell--inbox:not(.is-editing-task) .daily-inbox-list {
    gap: 0.7rem;
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .personal-task-row,
  .page-shell--calendar .calendar-event-row,
  .page-shell--chores:not(.is-creating-chore):not(.is-editing-chore) .chore-row,
  .page-shell--inbox:not(.is-editing-task) .daily-inbox-row {
    min-height: 3.85rem;
    padding: 0.9rem 1.05rem;
    border-radius: 16px;
    background: var(--app-surface);
  }

  .page-shell--tasks:not(.is-creating-task):not(.is-editing-task) .personal-task-row__copy .task-row__title,
  .page-shell--calendar .calendar-event-row__copy strong,
  .page-shell--chores:not(.is-creating-chore):not(.is-editing-chore) .chore-row__copy .task-row__title,
  .page-shell--inbox:not(.is-editing-task) .daily-inbox-row__copy .task-row__title {
    font-size: 0.96rem;
    font-weight: 790;
    line-height: 1.2;
  }
}

/* Final completion preview contract: every checked-off list row mirrors Home. */
.task-row.is-completing.is-completion-held,
.habit-row.is-completing.is-completion-held,
.shopping-item-row.is-completing.is-completion-held {
  opacity: 0.72;
}

.habit-row.is-completed .habit-row__copy strong,
.family-habit-work-row.is-completed .task-row__title,
.chore-row.is-completed .task-row__title,
.personal-task-row.is-completed .task-row__title,
.shopping-item-row.is-completed .shopping-item-row__title {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;
  text-decoration-skip-ink: none;
}

/* Done filters use checked controls as persistent status; strikes belong to the short completion preview. */
.page-shell--tasks-filter-completed .personal-task-row.is-completed .task-row__title {
  text-decoration: none;
}

.page-shell--shopping-filter-done .shopping-item-row.is-completed .shopping-item-row__title {
  text-decoration: none;
}

/*
 * Continuous completed Chore Checklist Item strike:
 * completed time and title render as one text run, so native decoration paints
 * continuously through spacing/separator and follows every wrapped visual line.
 */
.page-shell .chore-checklist-preview__item.is-done .chore-checklist-preview__strike {
  display: inline;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;
  text-decoration-skip-ink: none;
}

/*
 * Continuous completed Task Subtask strike:
 * completed due label and title render as one text run. Native decoration
 * remains continuous through their spacing and follows every wrapped line.
 */
.page-shell .task-subtask-preview__item.is-done .task-subtask-preview__copy,
.page-shell .daily-task-subtask-preview__item.is-done .daily-task-subtask-preview__copy {
  display: block;
  width: fit-content;
  max-width: 100%;
  background-image: none;
  white-space: normal;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.page-shell .task-subtask-preview__item.is-done .task-subtask-preview__strike,
.page-shell .daily-task-subtask-preview__item.is-done .daily-task-subtask-preview__strike {
  display: inline;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;
  text-decoration-skip-ink: none;
}

/* Calendar visual contract: passive source dots replace accent bars, and event counts match task/habit pills. */
.page-shell--dashboard .daily-calendar-events-pill {
  border-radius: 999px;
  background: var(--app-primary-soft);
  color: var(--app-primary-ink);
  line-height: 1;
  white-space: nowrap;
}

.daily-calendar-row::before,
.calendar-event-row__main::before {
  position: static;
  inset: auto;
  flex: 0 0 auto;
  align-self: center;
  width: 1.5rem;
  min-width: 1.5rem;
  height: 1.5rem;
  min-height: 1.5rem;
  border-radius: 999px;
  background: var(--event-accent, var(--app-primary));
  pointer-events: none;
}

.page-shell--dashboard .daily-calendar-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.46rem;
}

.page-shell--dashboard .daily-calendar-row__main {
  padding-left: 0;
}

.calendar-section--upcoming .task-section__header::before {
  background: var(--habits-muted-2);
}

.calendar-section--upcoming .task-section__header .section-title {
  color: var(--habits-muted);
}

.calendar-section--upcoming .task-section__count {
  background: var(--habits-surface-soft);
  color: var(--habits-muted);
}

@media (max-width: 760px) {
  .page-shell--dashboard .daily-calendar-row::before,
  .page-shell--calendar .calendar-event-row__main::before {
    width: 1.56rem;
    min-width: 1.56rem;
    height: 1.56rem;
    min-height: 1.56rem;
  }
}

@media (min-width: 761px) {
  .page-shell--dashboard .daily-calendar-row::before,
  .page-shell--calendar .calendar-event-row__main::before {
    width: 1.48rem;
    min-width: 1.48rem;
    height: 1.48rem;
    min-height: 1.48rem;
  }
}
