/* Canonical Habit Add/Edit sheet. One responsive component serves every host. */
html:has(.habit-sheet),
body:has(.habit-sheet) {
  overflow: hidden;
}

body:has(.habit-sheet) > .page-shell,
body:has(.habit-sheet) > .desktop-sidebar,
body:has(.habit-sheet) > .bottom-navigation {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.habit-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: block;
  background: rgba(36, 49, 44, 0.35);
  cursor: default;
}

.habit-sheet {
  --tasks-danger: #b5473a;
  --tasks-ink: var(--color-ink);
  --tasks-line: var(--color-line);
  --tasks-muted: var(--color-muted);
  --tasks-primary: var(--color-teal);
  --tasks-primary-ink: #1d5a4f;
  --tasks-surface: var(--color-card);
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 210;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(620px, calc(100vw - 2rem));
  max-height: min(86dvh, 560px);
  min-height: 430px;
  padding: 1.45rem 1.55rem 1.55rem;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: 18px;
  background: var(--color-card);
  box-shadow: 0 24px 70px rgba(27, 39, 34, 0.22);
  transform: translate(-50%, -50%);
}

.habit-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.habit-sheet__header h2 {
  margin: 0;
  color: var(--color-ink);
  font-size: 1.42rem;
  font-weight: 900;
  line-height: 1.1;
}

.habit-sheet__cancel {
  color: #8b8375;
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
}

.habit-sheet__cancel:hover,
.habit-sheet__cancel:focus-visible {
  color: var(--color-ink);
}

.habit-sheet-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.habit-sheet-form__body {
  display: grid;
  align-content: start;
  gap: 0.85rem;
  min-height: 0;
  overflow-y: auto;
  padding: 0.1rem 0.5rem 1rem;
}

.habit-sheet-form__section {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.habit-sheet-form__section legend {
  margin: 0 0 0.1rem;
  padding: 0;
  color: #8b8375;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.habit-sheet-form__identity-fields {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 0.7rem;
}

.habit-sheet-form .field input[type="text"] {
  width: 100%;
  min-height: 3.4rem;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--color-line);
  border-radius: 13px;
  background: #fffefa;
  color: var(--color-ink);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 750;
}

.habit-sheet-form .field--emoji input {
  text-align: center;
}

.habit-sheet-form .field input::placeholder {
  color: #868887;
  font-size: 0.9rem;
  opacity: 0.78;
}

.habit-sheet-form .task-chip-row {
  gap: 0.55rem;
}

.habit-sheet-form .task-form-chip {
  min-height: 2.7rem;
  padding: 0.55rem 0.95rem;
  background: #fffefa;
}

.habit-sheet-form .task-form-chip.is-selected {
  border-color: var(--color-teal);
  background: var(--color-teal);
  color: #fff;
}

.habit-sheet-form .task-form-chip--member.is-selected {
  border-color: var(--color-line);
  background: #fffefa;
  color: var(--color-ink);
}

.habit-sheet-form__actions {
  display: grid;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--color-line) 72%, transparent);
}

.habit-sheet[data-habit-sheet-mode="edit"] .habit-sheet-form__actions {
  padding-left: 4.15rem;
}

.habit-sheet__delete-form {
  position: absolute;
  bottom: 1.55rem;
  left: 1.55rem;
  z-index: 2;
  width: 3.15rem;
  margin: 0;
}

.habit-sheet__delete-button {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 3.15rem;
  padding: 0;
  border: 1.5px solid var(--app-danger);
  border-radius: 9px;
  background: var(--app-danger-soft);
  color: var(--app-danger);
  font-size: 1.05rem;
  font-weight: 850;
}

.habit-sheet__delete-button svg {
  width: 1.35rem;
  height: 1.35rem;
}

.habit-sheet-form__actions .app-button {
  width: 100%;
  min-height: 3.15rem;
  border-radius: 9px;
  font-size: 1.05rem;
  font-weight: 850;
}

.habit-sheet-form__actions .app-button:disabled {
  cursor: default;
  opacity: 0.48;
}

body:has(.habit-sheet) > .bottom-navigation {
  display: none;
}

/* Shared scrolling contract for every canonical add/edit surface. */
[data-canonical-editor-panel] {
  overflow: hidden;
}

[data-canonical-editor-scroll-region] {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

@media (max-width: 760px) {
  .habit-sheet-backdrop {
    background: rgba(36, 49, 44, 0.32);
  }

  .habit-sheet {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    max-height: 88dvh;
    min-height: 54dvh;
    padding: 1.55rem 1.35rem calc(1.25rem + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
    transform: none;
  }

  .habit-sheet__header {
    margin-bottom: 1.15rem;
  }

  .habit-sheet__header h2 {
    font-size: 1.78rem;
  }

  .habit-sheet__cancel {
    font-size: 1.05rem;
  }

  .habit-sheet-form__body {
    gap: 1rem;
    padding-bottom: 1.25rem;
  }

  .habit-sheet-form__identity-fields {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .habit-sheet-form .field input[type="text"] {
    min-height: 3.7rem;
    font-size: 1.1rem;
  }

  .habit-sheet-form .task-form-chip {
    min-height: 2.9rem;
    padding: 0.65rem 1rem;
    font-size: 0.98rem;
  }

  .habit-sheet-form__actions {
    padding-top: 1rem;
    background: var(--color-card);
  }

  .habit-sheet[data-habit-sheet-mode="edit"] .habit-sheet-form__actions {
    padding-left: 4.65rem;
  }

  .habit-sheet__delete-form {
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
    left: 1.35rem;
    width: 3.65rem;
  }

  .habit-sheet__delete-button {
    min-height: 3.65rem;
    border-radius: 13px;
  }

  .habit-sheet__delete-button svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  .habit-sheet-form__actions .app-button {
    min-height: 3.65rem;
    border-radius: 13px;
    font-size: 1.15rem;
  }
}

/* Canonical Task placeholders match the Habit sheet text scale. */
:is(.task-edit-panel, .task-create-page) .task-form--compact-modal :is(input, textarea)::placeholder {
  font-size: 0.9rem;
}

/* Canonical Task headers keep Cancel at the opposite edge on every host. */
:is(.task-edit-panel, .task-create-page) .task-edit-mobile-header {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

:is(.task-edit-panel, .task-create-page) .task-edit-mobile-header h2 {
  min-width: 0;
}

:is(.task-edit-panel, .task-create-page) .task-sheet-cancel-link {
  justify-self: end;
}

/* Canonical Task field order keeps Assigned To below Repeats. */
:is(.task-edit-panel, .task-create-page) .task-form--compact-modal .field--recurrence-frequency,
:is(.task-edit-panel, .task-create-page) .task-form--compact-modal .field--assignee {
  grid-column: 1 / -1;
}

/* Canonical Task sheet: component styling is identical on every host page. */
.page-shell [data-canonical-task-edit-panel].task-edit-panel.panel {
  --color-card: #fdfcf8;
  --color-ink: #24312c;
  --color-line: #e5e0d3;
  --color-muted: #6b7d75;
  --tasks-danger: #b5473a;
  --tasks-line: #e5e0d3;
  --tasks-muted: #6b7d75;
  --tasks-primary: #2a7a6b;
  --tasks-primary-ink: #1d5a4f;
  --tasks-surface: #fdfcf8;
  z-index: 70;
  display: grid;
  gap: 0;
  border: 1px solid color-mix(in srgb, var(--color-line) 82%, transparent);
  background: var(--color-card);
  color: var(--color-ink);
  overscroll-behavior: contain;
}

.page-shell [data-canonical-task-edit-panel].task-edit-panel.panel > .panel-heading {
  display: none !important;
}

.page-shell [data-canonical-task-edit-panel] .task-edit-mobile-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  min-height: 2rem;
  margin: 0 0 0.75rem;
}

.page-shell [data-canonical-task-edit-panel] .task-edit-mobile-header h2 {
  min-width: 0;
  margin: 0;
  color: var(--color-ink);
  font-size: 1.25rem;
  font-weight: 820;
  line-height: 1.05;
}

.page-shell [data-canonical-task-edit-panel] .task-sheet-cancel-link {
  justify-self: end;
  color: var(--color-muted);
  font-size: 0.92rem;
  font-weight: 780;
  text-decoration: none;
}

.page-shell [data-canonical-task-edit-panel] .task-form--compact-modal {
  display: grid;
  gap: 0.82rem;
  min-width: 0;
}

.page-shell [data-canonical-task-edit-panel] .task-form__grid--personal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.78rem;
}

.page-shell [data-canonical-task-edit-panel] .task-form__identity,
.page-shell [data-canonical-task-edit-panel] .field--url,
.page-shell [data-canonical-task-edit-panel] .field--task-schedule,
.page-shell [data-canonical-task-edit-panel] .field--recurrence-frequency,
.page-shell [data-canonical-task-edit-panel] .field--assignee,
.page-shell [data-canonical-task-edit-panel] .recurrence-custom-fields {
  grid-column: 1 / -1;
}

.page-shell [data-canonical-task-edit-panel] .task-form__identity-fields {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr);
  gap: 0.65rem;
}

.page-shell [data-canonical-task-edit-panel] .task-form__identity-fields .field--emoji,
.page-shell [data-canonical-task-edit-panel] .task-form__identity-fields .field--title {
  grid-column: auto;
}

.page-shell [data-canonical-task-edit-panel] .task-form .field {
  display: grid;
  gap: 0.42rem;
  min-width: 0;
}

.page-shell [data-canonical-task-edit-panel] .task-form .field label,
.page-shell [data-canonical-task-edit-panel] .task-form .field__label,
.page-shell [data-canonical-task-edit-panel] .task-form__section-label,
.page-shell [data-canonical-task-edit-panel] .notes-field > label {
  color: var(--color-muted);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-shell [data-canonical-task-edit-panel] .task-form__identity .field label {
  display: none;
}

.page-shell [data-canonical-task-edit-panel] .task-form .field input,
.page-shell [data-canonical-task-edit-panel] .task-form .field select,
.page-shell [data-canonical-task-edit-panel] .task-form .field textarea,
.page-shell [data-canonical-task-edit-panel] .notes-field textarea {
  width: 100%;
  min-width: 0;
}

.page-shell [data-canonical-task-edit-panel] .field--emoji input {
  padding-inline: 0.32rem;
  text-align: center;
}

.page-shell [data-canonical-task-edit-panel] .notes-field textarea {
  max-width: none;
  min-height: 3.15rem;
  height: 3.15rem;
}

.page-shell [data-canonical-task-edit-panel] .task-form-chip.is-selected,
.page-shell [data-canonical-task-edit-panel] .task-form-chip--native-picker.is-selected {
  color: #fff;
}

/* Canonical assignees share the selected date chip treatment. */
[data-canonical-chore-edit-panel] .task-form-chip--member,
.page-shell [data-canonical-task-edit-panel] .task-form-chip--member,
[data-canonical-habit-sheet] .task-form-chip--member {
  border-color: var(--color-line);
  background: var(--color-card);
  color: var(--color-ink);
}

[data-canonical-chore-edit-panel] .task-form-chip--member.is-selected,
.page-shell [data-canonical-task-edit-panel] .task-form-chip--member.is-selected,
[data-canonical-habit-sheet] .task-form-chip--member.is-selected {
  border-color: var(--color-teal);
  background: var(--color-teal);
  color: #fff;
}

[data-canonical-chore-edit-panel] .task-form-chip--member.is-selected .task-form-chip__dot,
.page-shell [data-canonical-task-edit-panel] .task-form-chip--member.is-selected .task-form-chip__dot,
[data-canonical-habit-sheet] .task-form-chip--member.is-selected .task-form-chip__dot {
  background: #fff;
}

.page-shell [data-canonical-task-edit-panel] .task-form-chip--native-picker.is-selected,
.page-shell [data-canonical-task-edit-panel] .task-form-chip--native-picker.is-selected span,
.page-shell [data-canonical-task-edit-panel] .task-form-chip--native-picker.is-selected .task-chip-native-input,
[data-canonical-chore-edit-panel] .task-form-chip--native-picker.is-selected,
[data-canonical-chore-edit-panel] .task-form-chip--native-picker.is-selected span,
[data-canonical-chore-edit-panel] .task-form-chip--native-picker.is-selected .task-chip-native-input,
[data-canonical-habit-sheet] .task-form-chip--native-picker.is-selected,
[data-canonical-habit-sheet] .task-form-chip--native-picker.is-selected span,
[data-canonical-habit-sheet] .task-form-chip--native-picker.is-selected .task-chip-native-input,
.page-shell [data-canonical-task-edit-panel] .task-form-chip--native-picker.is-selected .task-chip-native-input::-webkit-date-and-time-value,
[data-canonical-chore-edit-panel] .task-form-chip--native-picker.is-selected .task-chip-native-input::-webkit-date-and-time-value,
[data-canonical-habit-sheet] .task-form-chip--native-picker.is-selected .task-chip-native-input::-webkit-date-and-time-value {
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.page-shell [data-canonical-chore-edit-panel] .field--chore-schedule label.task-form-chip--native-picker.is-selected {
  color: #fff;
}

.page-shell [data-canonical-task-edit-panel] .task-subtask-editor__add-button {
  color: var(--tasks-primary);
}

.page-shell [data-canonical-task-edit-panel] .task-form > .form-actions {
  z-index: 82;
  display: grid;
  justify-content: stretch;
  width: auto;
  margin: 0;
  border-top: 1px solid color-mix(in srgb, var(--color-line) 70%, transparent);
  background: color-mix(in srgb, var(--color-card) 96%, white);
}

.page-shell [data-canonical-task-edit-panel] .task-form > .form-actions .app-button--primary {
  width: 100%;
  min-width: 0;
  height: 3.35rem;
  padding-block: 0;
  border-color: color-mix(in srgb, var(--tasks-primary) 42%, var(--tasks-line));
  border-radius: 13px;
  background: var(--tasks-primary);
  color: #fffdf8;
  line-height: 1;
}

.page-shell [data-canonical-task-edit-panel] .task-delete-icon-form {
  z-index: 83;
  margin: 0;
}

.page-shell [data-canonical-task-edit-panel] .task-delete-icon-button {
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--tasks-danger) 42%, var(--tasks-line));
  border-radius: 13px;
  background: color-mix(in srgb, var(--tasks-danger) 10%, var(--tasks-surface));
  color: var(--tasks-danger);
}

@media (max-width: 760px) {
  html:has([data-canonical-task-edit-panel]),
  body:has([data-canonical-task-edit-panel]) {
    height: 100%;
    overflow: hidden;
  }

  body:has([data-canonical-task-edit-panel]) > .bottom-navigation {
    display: none;
  }

  .page-shell [data-canonical-task-edit-panel].task-edit-panel.panel {
    position: fixed;
    inset: auto 0 0;
    grid-template-rows: auto minmax(0, 1fr);
    height: 92dvh;
    max-height: 92dvh;
    overflow: hidden;
    padding: 0.95rem 1.35rem 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
    transform: none;
  }

  .page-shell [data-canonical-task-edit-panel] .task-edit-mobile-header h2 {
    font-size: 1.35rem;
    line-height: 1.08;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form--compact-modal {
    gap: 0.72rem;
    scroll-padding-bottom: calc(8rem + env(safe-area-inset-bottom));
    padding-bottom: calc(7.55rem + env(safe-area-inset-bottom));
    padding-right: 0.15rem;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form__grid--personal {
    gap: 0.72rem 0.86rem;
  }

  .page-shell [data-canonical-task-edit-panel].task-edit-panel .task-form__identity-fields {
    grid-template-columns: 3.55rem minmax(0, 1fr);
  }

  .page-shell [data-canonical-task-edit-panel] .task-form .field input,
  .page-shell [data-canonical-task-edit-panel] .task-form .field select,
  .page-shell [data-canonical-task-edit-panel] .task-form .field textarea,
  .page-shell [data-canonical-task-edit-panel] .notes-field textarea {
    min-height: 3.25rem;
    border-radius: 13px;
    font-size: 16px;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form .task-chip-row {
    gap: 0.5rem;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form .task-form-chip {
    min-height: 2.35rem;
    padding: 0.5rem 0.82rem;
    font-size: 0.88rem;
    font-weight: 760;
  }

  .page-shell [data-canonical-task-edit-panel] .field--task-schedule .task-form-chip,
  .page-shell [data-canonical-task-edit-panel] .field--task-schedule label.task-form-chip {
    color: var(--color-ink);
    font-size: 0.88rem;
    font-weight: 760;
    letter-spacing: 0;
    text-transform: none;
  }

  .page-shell [data-canonical-task-edit-panel] .field--task-schedule .task-form-chip.is-selected,
  .page-shell [data-canonical-task-edit-panel] .field--task-schedule label.task-form-chip.is-selected {
    color: #fff;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form--compact-modal .notes-field textarea {
    max-width: none;
    background: #fffefa;
    font-weight: 700;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form > .form-actions {
    position: fixed !important;
    inset: auto 0 0;
    margin: 0;
    padding: 0.85rem 1.35rem calc(1.55rem + env(safe-area-inset-bottom));
    filter: drop-shadow(0 -12px 18px color-mix(in srgb, var(--color-ink) 14%, transparent));
    pointer-events: none;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form--edit > .form-actions {
    padding-left: 5.25rem;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form > .form-actions .app-button--primary {
    min-height: 3.35rem;
    pointer-events: auto;
  }

  .page-shell [data-canonical-task-edit-panel] .task-delete-icon-form {
    position: fixed;
    bottom: calc(1.55rem + env(safe-area-inset-bottom));
    left: 1.35rem;
  }

  .page-shell [data-canonical-task-edit-panel] .task-delete-icon-button {
    width: 3rem;
    height: 3rem;
  }
}

@media (min-width: 761px) {
  .page-shell [data-canonical-task-edit-panel].task-edit-panel.panel {
    position: fixed;
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(620px, calc(100vw - 2rem));
    height: min(86dvh, 44rem);
    max-width: none;
    max-height: min(86dvh, 44rem);
    overflow: hidden;
    padding: 1.25rem 1.35rem;
    border-radius: 22px;
    transform: translate(-50%, -50%);
  }

  .page-shell [data-canonical-task-edit-panel] .task-form--compact-modal {
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.15rem;
    scrollbar-gutter: stable;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form > .form-actions {
    position: sticky !important;
    right: auto;
    bottom: 0;
    left: auto;
    margin-top: auto;
    padding: 1rem 0 0;
    filter: none;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form--edit > .form-actions {
    padding-left: 4.05rem;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form > .form-actions .app-button--primary {
    min-height: 3.35rem;
  }

  .page-shell [data-canonical-task-edit-panel] .task-delete-icon-form {
    position: absolute;
    bottom: 1.25rem;
    left: 1.35rem;
  }

  .page-shell [data-canonical-task-edit-panel] .task-delete-icon-button {
    width: 3.35rem;
    height: 3.35rem;
  }
}

/* Final origin-preserving editor cascade guard. */
body:has(.page-shell.is-editing-chore) .bottom-navigation,
body:has(.page-shell.is-editing-shopping-item) .bottom-navigation {
  display: none;
}

.page-shell [data-canonical-chore-edit-panel] .field--recurrence-frequency > label,
.page-shell [data-canonical-chore-edit-panel] .chore-cadence-field > label {
  color: var(--color-muted);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-shell [data-canonical-chore-edit-panel] .chore-form--edit > .form-actions--with-delete {
  display: grid;
  grid-template-columns: 3.35rem minmax(0, 1fr);
  align-items: stretch;
  gap: 0.8rem;
}

.page-shell [data-canonical-chore-edit-panel] .chore-form--edit > .form-actions--with-delete .chore-delete-icon-button,
.page-shell [data-canonical-chore-edit-panel] .chore-form--edit > .form-actions--with-delete .app-button--primary {
  width: 100%;
  min-width: 0;
  height: 3.35rem;
  min-height: 3.35rem;
  margin: 0;
}

@media (min-width: 761px) {
  .page-shell [data-canonical-chore-edit-panel].chore-edit-panel.panel,
  .page-shell [data-canonical-shopping-item-edit-panel].shopping-edit-panel.panel {
    position: fixed;
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(620px, calc(100vw - 2rem));
    max-width: none;
    max-height: min(86dvh, 44rem);
    border-radius: 22px;
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 760px) {
  .page-shell [data-canonical-chore-edit-panel].chore-edit-panel.panel,
  .page-shell [data-canonical-shopping-item-edit-panel].shopping-edit-panel.panel {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
    transform: none;
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-form--edit > .form-actions--with-delete {
    padding-inline: 1.35rem;
  }
}

/* Final selected-date foreground parity across canonical Task, Habit, and Chore sheets. */
.page-shell [data-canonical-task-edit-panel] .field--task-schedule label.task-form-chip--native-picker.is-selected,
.page-shell [data-canonical-task-edit-panel] .field--task-schedule label.task-form-chip--native-picker.is-selected span,
[data-canonical-habit-sheet] .field--habit-schedule label.task-form-chip--native-picker.is-selected,
[data-canonical-habit-sheet] .field--habit-schedule label.task-form-chip--native-picker.is-selected span,
.page-shell [data-canonical-chore-edit-panel] .field--chore-schedule label.task-form-chip--native-picker.is-selected,
.page-shell [data-canonical-chore-edit-panel] .field--chore-schedule label.task-form-chip--native-picker.is-selected span {
  color: #fff;
  -webkit-text-fill-color: #fff;
}

/* Chore recurrence is the canonical Task recurrence component with Chore field names. */
.page-shell [data-canonical-chore-edit-panel] .field--recurrence-frequency,
.page-shell [data-canonical-chore-edit-panel] .recurrence-custom-fields > .field {
  gap: 0.42rem;
}

.page-shell [data-canonical-chore-edit-panel] .field--recurrence-frequency .task-chip-row {
  gap: 0.5rem;
}

.page-shell [data-canonical-chore-edit-panel] .recurrence-custom-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.page-shell [data-canonical-chore-edit-panel] .recurrence-custom-fields[hidden] {
  display: none !important;
}

.page-shell [data-canonical-chore-edit-panel] .recurrence-custom-fields :is(input, select) {
  min-height: 3.25rem;
  border-radius: 13px;
}

@media (min-width: 761px) {
  .page-shell [data-canonical-chore-edit-panel] .field--recurrence-frequency .task-chip-row {
    gap: 0.45rem;
  }

  .page-shell [data-canonical-chore-edit-panel] .field--recurrence-frequency .task-form-chip {
    min-height: 2.4rem;
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
    line-height: 1;
  }

  .page-shell [data-canonical-chore-edit-panel] .recurrence-custom-fields {
    gap: 0.65rem;
  }

  .page-shell [data-canonical-chore-edit-panel] .recurrence-custom-fields :is(input, select) {
    min-height: 3rem;
    font-size: 0.96rem;
  }
}

/* Canonical Chore checklist: one component on Chores, Inbox, and Family. */
.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor {
  display: grid;
  gap: 0.45rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--chores-ink);
}

.page-shell [data-canonical-chore-edit-panel] .checklist-heading > .task-form__section-label {
  margin: 0;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__rows {
  display: grid;
  gap: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: transparent;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__rows:has(.chore-checklist-editor__row-shell:not([hidden]):not(.is-empty)) {
  overflow: hidden;
  border: 1px solid var(--app-line);
  background: color-mix(in srgb, var(--app-surface) 96%, white);
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__rows:has(.chore-checklist-editor__row-shell.is-new.is-empty[hidden]:only-child) {
  display: none;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row-shell[hidden],
.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row-shell.is-new.is-empty {
  display: none !important;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row-shell + .chore-checklist-editor__row-shell {
  border-top: 1px solid var(--app-line);
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row {
  display: grid;
  grid-template-columns: 1.35rem minmax(0, 1fr) auto auto;
  grid-template-areas: "mark title schedule remove";
  gap: 0.35rem 0.55rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

/* Keep removable checklist metadata connected without squeezing the item title. */
.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row:has(.nested-schedule-clear-button:not([hidden])) {
  grid-template-columns: 1.35rem minmax(0, 1fr) auto;
  grid-template-areas:
    "mark title remove"
    "schedule schedule schedule";
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row:has(.nested-schedule-clear-button:not([hidden])) .chore-checklist-editor__schedule {
  justify-content: flex-start;
  flex-wrap: wrap;
  width: 100%;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__schedule {
  grid-area: schedule;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__schedule .task-subtask-editor__schedule-field {
  color: var(--chores-primary-ink);
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__schedule .task-subtask-editor__schedule-field:has(:is(input, select).is-empty) {
  display: none;
  border-color: var(--chores-line);
  background: var(--chores-surface);
  color: var(--chores-muted);
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row-shell.is-editing .chore-checklist-editor__schedule .task-subtask-editor__schedule-field:has(:is(input, select).is-empty) {
  display: inline-grid;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row > span[aria-hidden]:first-of-type {
  grid-area: mark;
  align-self: center;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row > textarea {
  grid-area: title;
  min-height: 1.8rem;
  padding: 0.25rem 0;
  border: 0;
  background: transparent;
  color: var(--chores-ink);
  font-size: 0.86rem;
  font-weight: 780;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row.is-done > textarea {
  color: var(--chores-muted);
  text-decoration: line-through;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__remove-button {
  grid-area: remove;
  width: 1.9rem;
  height: 1.9rem;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__add-button {
  justify-self: start;
  min-height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--app-primary);
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 820;
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__add-button:hover {
  color: var(--app-primary-ink);
}

.page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row input[type="time"]::-webkit-calendar-picker-indicator {
  margin-inline-start: auto;
  margin-inline-end: 0;
}

@media (max-width: 720px) {
  .page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row textarea,
  .page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row input[type="time"],
  .page-shell [data-canonical-chore-edit-panel] .chore-checklist-editor__row select {
    font-size: 16px;
  }
}

/* Canonical destructive action: Chore and Habit match Task exactly. */
.page-shell [data-canonical-task-edit-panel] .task-delete-icon-button,
.page-shell [data-canonical-chore-edit-panel] .chore-delete-icon-button,
[data-canonical-habit-sheet] .habit-sheet__delete-button,
.page-shell [data-canonical-shopping-item-edit-panel] .shopping-delete-icon-button {
  display: grid;
  place-items: center;
  pointer-events: auto;
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, #b5473a 42%, #e5e0d3);
  border-radius: 13px;
  background: color-mix(in srgb, #b5473a 10%, #fdfcf8);
  color: #b5473a;
}

.page-shell [data-canonical-task-edit-panel] .task-delete-icon-button svg,
.page-shell [data-canonical-chore-edit-panel] .chore-delete-icon-button svg,
[data-canonical-habit-sheet] .habit-sheet__delete-button svg,
.page-shell [data-canonical-shopping-item-edit-panel] .shopping-delete-icon-button svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
}

@media (max-width: 760px) {
  .page-shell [data-canonical-chore-edit-panel] .chore-form--edit > .form-actions--with-delete {
    grid-template-columns: 3rem minmax(0, 1fr);
    align-items: end;
    gap: 0.9rem;
    padding: 0.85rem 1.35rem calc(1.55rem + env(safe-area-inset-bottom));
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-form--edit > .form-actions--with-delete .chore-delete-icon-button {
    width: 3rem;
    height: 3rem;
    min-height: auto;
    align-self: end;
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-form--edit > .form-actions--with-delete .app-button--primary {
    height: 3.35rem;
    min-height: 3.35rem;
  }

  [data-canonical-habit-sheet].habit-sheet {
    padding-bottom: calc(1.55rem + env(safe-area-inset-bottom));
  }

  [data-canonical-habit-sheet][data-habit-sheet-mode="edit"] .habit-sheet-form__actions {
    padding-left: 3.9rem;
  }

  [data-canonical-habit-sheet] .habit-sheet__delete-form {
    bottom: calc(1.55rem + env(safe-area-inset-bottom));
    left: 1.35rem;
    width: 3rem;
  }

  [data-canonical-habit-sheet] .habit-sheet__delete-button {
    width: 3rem;
    height: 3rem;
    min-height: auto;
  }

  [data-canonical-habit-sheet] .habit-sheet-form__actions .app-button--primary {
    height: 3.35rem;
    min-height: 3.35rem;
    border-radius: 13px;
  }
}

@media (min-width: 761px) {
  .page-shell [data-canonical-chore-edit-panel] .chore-form--edit > .form-actions--with-delete {
    grid-template-columns: 3.35rem minmax(0, 1fr);
    align-items: end;
    gap: 0.7rem;
    margin: auto 0 0;
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-form--edit > .form-actions--with-delete .chore-delete-icon-button {
    min-height: auto;
  }

  [data-canonical-habit-sheet].habit-sheet {
    padding-bottom: 1.25rem;
  }

  [data-canonical-habit-sheet][data-habit-sheet-mode="edit"] .habit-sheet-form__actions {
    margin-inline: -0.2rem;
    padding-left: 4.05rem;
  }

  [data-canonical-habit-sheet] .habit-sheet__delete-form {
    bottom: 1.25rem;
    left: 1.35rem;
    width: 3.35rem;
  }

  [data-canonical-habit-sheet] .habit-sheet__delete-button,
  [data-canonical-habit-sheet] .habit-sheet-form__actions .app-button--primary {
    width: 100%;
    height: 3.35rem;
    border-radius: 13px;
  }

  [data-canonical-habit-sheet] .habit-sheet__delete-button {
    min-height: auto;
  }

  [data-canonical-habit-sheet] .habit-sheet-form__actions .app-button--primary {
    min-height: 3.35rem;
  }
}

/* Canonical editor action sizing: every add/edit view uses Task geometry. */
.page-shell [data-canonical-task-edit-panel] .task-form > .form-actions .app-button--primary,
.page-shell [data-canonical-chore-edit-panel] .chore-form > .form-actions .app-button--primary,
[data-canonical-habit-sheet] .habit-sheet-form__actions .app-button--primary {
  width: 100%;
  height: 3.35rem;
  min-height: 3.35rem;
  padding-block: 0;
  border-radius: 13px;
  font-weight: 790;
  line-height: 1;
}

/* Canonical editor controls: Chore and Habit reuse Task, not approximations. */
:is(.page-shell, [data-canonical-habit-sheet]) .field--work-schedule {
  grid-column: 1 / -1;
  min-width: 0;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-assignee-heading {
  flex: 0 0 100%;
  margin-top: 0.25rem;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-value-row {
  display: contents;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control {
  min-width: 2.75rem;
  min-height: 2.75rem;
  height: 2.75rem;
  border-color: var(--tasks-line);
  background: var(--tasks-surface);
  overflow: hidden;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control.is-selected {
  border-color: var(--tasks-primary);
  background: color-mix(in srgb, var(--tasks-primary) 16%, var(--tasks-surface));
  color: var(--tasks-primary-ink);
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-value-row:has(.work-schedule-control.is-selected) {
  display: flex;
  flex: 1 0 100%;
  align-items: stretch;
  min-width: 0;
  min-height: 2.75rem;
  border: 1px solid var(--tasks-primary);
  border-radius: 10px;
  background: color-mix(in srgb, var(--tasks-primary) 16%, var(--tasks-surface));
  color: var(--tasks-primary-ink);
  overflow: hidden;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-value-row:has(.work-schedule-control.is-selected) .work-schedule-control {
  flex: 1 1 auto;
  justify-content: flex-start;
  width: auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding-inline: 0.75rem;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-value-row:has(.work-schedule-control.is-selected) .work-schedule-clear-button {
  width: 2.75rem;
  height: 2.75rem;
  border-left: 1px solid color-mix(in srgb, var(--tasks-primary) 45%, transparent);
  border-radius: 0;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-value-row:has(.work-schedule-control.is-selected input:focus-visible) {
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--tasks-primary) 70%, white);
}

:is(.page-shell, [data-canonical-habit-sheet]) .task-subtask-editor__schedule-field:not(.work-schedule-control):has(input:focus-visible) {
  outline: none;
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--tasks-primary) 70%, white);
}

:is(.page-shell, [data-canonical-habit-sheet])
  .task-subtask-editor__schedule-field:not(.work-schedule-control)
  .task-subtask-editor__schedule-control
  input:is([type="date"], [type="time"]) {
  border: 0;
  border-radius: 10px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) .task-subtask-editor__schedule-field:not(.work-schedule-control) input:focus-visible {
  outline: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control:not(.is-selected):has(input:focus-visible) {
  outline: none;
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--tasks-primary) 70%, white);
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control:not(.is-selected) input:focus-visible {
  outline: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-value-row:has(.work-schedule-control.is-selected)
  .work-schedule-control:has(input:focus-visible),
:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-value-row:has(.work-schedule-control.is-selected)
  input:focus-visible {
  outline: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control--repeat {
  padding: 0;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control[data-work-schedule-control="date"]::before {
  display: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control--repeat[hidden] {
  display: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control__icon,
:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control__icon svg {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control__icon {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) [data-task-recurrence-icon] {
  color: var(--tasks-muted);
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control__icon[hidden] {
  display: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control .task-subtask-editor__schedule-value {
  letter-spacing: 0;
  text-transform: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-control .task-subtask-editor__schedule-control input:is(
  [type="date"],
  [type="time"]
) {
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-clear-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tasks-muted);
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-clear-button[hidden] {
  display: none;
}

:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-clear-button:focus-visible,
:is(.page-shell, [data-canonical-habit-sheet]) .work-schedule-clear-button:hover {
  outline: 0;
  background: color-mix(in srgb, var(--tasks-danger) 12%, transparent);
  color: var(--tasks-danger);
}

:is(.page-shell, [data-canonical-habit-sheet]) .field--work-schedule.is-derived .work-schedule-control:is(
  [data-work-schedule-control="date"],
  [data-work-schedule-control="time"]
) {
  cursor: not-allowed;
  opacity: 0.62;
}

.page-shell [data-canonical-task-edit-panel] .task-sheet-cancel-link,
.page-shell [data-canonical-chore-edit-panel] .chore-sheet-cancel-link,
[data-canonical-habit-sheet] .habit-sheet__cancel {
  font-size: 0.92rem;
  font-weight: 780;
  line-height: 1.35;
}

.page-shell [data-canonical-task-edit-panel] .task-form-chip,
.page-shell [data-canonical-chore-edit-panel] .task-form-chip,
[data-canonical-habit-sheet] .task-form-chip,
.page-shell [data-canonical-chore-edit-panel] .chore-priority-option {
  font-weight: 760;
}

.page-shell [data-canonical-chore-edit-panel] .chore-priority-option {
  line-height: 1;
}

[data-canonical-habit-sheet] .habit-sheet__delete-button {
  font-size: 1rem;
}

@media (max-width: 760px) {
  .page-shell [data-canonical-task-edit-panel] .task-chip-row,
  .page-shell [data-canonical-chore-edit-panel] .task-chip-row,
  [data-canonical-habit-sheet] .task-chip-row {
    gap: 0.5rem;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form-chip--native-picker,
  .page-shell [data-canonical-chore-edit-panel] .task-form-chip--native-picker,
  [data-canonical-habit-sheet] .task-form-chip--native-picker {
    font-weight: 760;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
  }

  .page-shell [data-canonical-chore-edit-panel] .task-form-chip,
  [data-canonical-habit-sheet] .task-form-chip {
    min-height: 2.35rem;
    height: 2.35rem;
    padding: 0.5rem 0.82rem;
    font-size: 0.88rem;
  }

  [data-canonical-habit-sheet] .habit-sheet-form__actions .app-button--primary {
    font-size: 1rem;
  }
}

@media (min-width: 761px) {
  .page-shell [data-canonical-chore-edit-panel] .chore-form > .form-actions {
    margin-right: -0.1rem;
  }

  [data-canonical-habit-sheet].habit-sheet {
    padding-inline: 1.35rem;
  }

  [data-canonical-habit-sheet] .habit-sheet-form__body {
    padding-inline: 0;
  }

  [data-canonical-habit-sheet] .habit-sheet-form__actions,
  [data-canonical-habit-sheet][data-habit-sheet-mode="edit"] .habit-sheet-form__actions {
    margin-left: 0;
    margin-right: 0;
  }

  .page-shell [data-canonical-task-edit-panel] .task-chip-row,
  .page-shell [data-canonical-chore-edit-panel] .task-chip-row,
  [data-canonical-habit-sheet] .task-chip-row {
    gap: 0.45rem;
  }

  .page-shell [data-canonical-chore-edit-panel] .task-form-chip,
  [data-canonical-habit-sheet] .task-form-chip {
    min-height: 2.4rem;
    height: 2.4rem;
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
  }

  [data-canonical-habit-sheet] .habit-sheet-form__actions .app-button--primary {
    font-size: 0.96rem;
  }

  .page-shell [data-canonical-task-edit-panel] .task-form-chip--native-picker,
  .page-shell [data-canonical-chore-edit-panel] .task-form-chip--native-picker,
  [data-canonical-habit-sheet] .task-form-chip--native-picker {
    font-size: 12.5px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}

/* Canonical editor dock spacing: Chore and Habit inherit Task's action inset. */
@media (max-width: 760px) {
  .page-shell [data-canonical-task-edit-panel],
  .page-shell [data-canonical-chore-edit-panel],
  [data-canonical-habit-sheet],
  .page-shell [data-canonical-shopping-item-edit-panel] {
    --canonical-editor-action-bottom-gap: calc(1.55rem + env(safe-area-inset-bottom));
  }

  .page-shell [data-canonical-task-edit-panel] .task-form > .form-actions,
  .page-shell [data-canonical-chore-edit-panel] .chore-form > .form-actions {
    padding-bottom: var(--canonical-editor-action-bottom-gap);
  }

  .page-shell [data-canonical-task-edit-panel] .task-delete-icon-form,
  [data-canonical-habit-sheet] .habit-sheet__delete-form,
  .page-shell [data-canonical-shopping-item-edit-panel] .shopping-delete-icon-form {
    bottom: var(--canonical-editor-action-bottom-gap);
  }

  .page-shell [data-canonical-shopping-item-edit-panel] .shopping-delete-icon-button {
    width: 3rem;
    height: 3rem;
  }

  [data-canonical-habit-sheet].habit-sheet {
    padding-bottom: var(--canonical-editor-action-bottom-gap);
  }
}

@media (min-width: 761px) {
  .page-shell [data-canonical-task-edit-panel],
  .page-shell [data-canonical-chore-edit-panel],
  [data-canonical-habit-sheet],
  .page-shell [data-canonical-shopping-item-edit-panel] {
    --canonical-editor-action-bottom-gap: 1.25rem;
  }

  .page-shell [data-canonical-task-edit-panel].task-edit-panel.panel,
  .page-shell [data-canonical-chore-edit-panel].chore-edit-panel.panel,
  [data-canonical-habit-sheet].habit-sheet {
    padding-bottom: var(--canonical-editor-action-bottom-gap);
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-form > .form-actions {
    margin-top: auto;
  }

  .page-shell [data-canonical-task-edit-panel] .task-delete-icon-form,
  [data-canonical-habit-sheet] .habit-sheet__delete-form,
  .page-shell [data-canonical-shopping-item-edit-panel] .shopping-delete-icon-form {
    bottom: var(--canonical-editor-action-bottom-gap);
  }

  .page-shell [data-canonical-shopping-item-edit-panel] .shopping-delete-icon-button {
    width: 3.35rem;
    height: 3.35rem;
  }
}

/* Canonical editor dock: Task owns footer frame, separator, surface, and rhythm. */
.page-shell [data-canonical-task-edit-panel] .task-form > .form-actions,
.page-shell [data-canonical-chore-edit-panel] .chore-form > .form-actions,
[data-canonical-habit-sheet] .habit-sheet-form__actions {
  box-sizing: border-box;
  border-top: 1px solid color-mix(in srgb, var(--color-line) 70%, transparent);
  background: color-mix(in srgb, var(--color-card) 96%, white);
}

@media (max-width: 760px) {
  [data-canonical-habit-sheet] .habit-sheet-form__actions {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    margin: 0;
    padding: 0.85rem 1.35rem var(--canonical-editor-action-bottom-gap);
    filter: drop-shadow(0 -12px 18px color-mix(in srgb, var(--color-ink) 14%, transparent));
  }

  [data-canonical-habit-sheet][data-habit-sheet-mode="edit"] .habit-sheet-form__actions {
    padding-left: 5.25rem;
  }

  [data-canonical-habit-sheet] .habit-sheet-form__body {
    scroll-padding-bottom: calc(8rem + env(safe-area-inset-bottom));
    padding-bottom: calc(7.55rem + env(safe-area-inset-bottom));
  }
}

.page-shell [data-canonical-chore-edit-panel] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.page-shell [data-canonical-chore-edit-panel] > .chore-delete-icon-form {
  display: none;
}

.page-shell [data-canonical-chore-edit-panel] > .chore-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  min-height: 0;
  overflow: visible;
}

.page-shell [data-canonical-chore-edit-panel] .chore-sheet__body {
  display: grid;
  align-content: start;
  gap: 0.72rem;
  min-height: 0;
  overflow-y: auto;
}

.page-shell [data-canonical-chore-edit-panel] .chore-form > [data-canonical-editor-footer] {
  position: static !important;
  inset: auto;
  z-index: 2;
  margin: 0;
  pointer-events: auto;
}

@media (max-width: 760px) {
  .page-shell [data-canonical-chore-edit-panel].chore-edit-panel.panel {
    height: 92dvh;
    max-height: 92dvh;
    padding: 0.95rem 1.35rem 0;
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-edit-mobile-header {
    position: static;
    margin: 0 0 0.85rem;
    padding: 0;
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-sheet__body {
    scroll-padding-bottom: 1rem;
    padding: 0 0.15rem 0.85rem 0;
    margin-bottom: 0;
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-form > [data-canonical-editor-footer] {
    margin: 0 calc(-1.35rem - 1px) -1px;
    padding: 0.85rem 1.35rem var(--canonical-editor-action-bottom-gap);
    background: color-mix(in srgb, var(--color-card) 96%, white);
    filter: drop-shadow(0 -12px 18px color-mix(in srgb, var(--color-ink) 14%, transparent));
  }
}

@media (min-width: 761px) {
  .page-shell [data-canonical-chore-edit-panel] .chore-sheet__body {
    padding-bottom: 0.25rem;
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-form > .form-actions,
  [data-canonical-habit-sheet] .habit-sheet-form__actions {
    padding-top: 1rem;
  }

  .page-shell [data-canonical-chore-edit-panel] .chore-form > .form-actions {
    margin-right: 0;
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
  }
}

/* Canonical Chore section legends use one format on phone and web. */
.page-shell [data-canonical-chore-edit-panel] .task-form__section-label,
.page-shell [data-canonical-chore-edit-panel] .chore-priority-options > legend {
  color: var(--app-muted-2, var(--color-muted));
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.page-shell [data-canonical-chore-edit-panel] .chore-priority-options > legend {
  margin-bottom: 0.45rem;
}
