/* ==========================================================================
   Day grid — columns, headers, task rows, the "ruled paper" lines
   Interaction timings and geometry mirror the live app (0.25s ease-in-out
   fades, 2px button gap, buttons that collapse to zero width until hover).
   ========================================================================== */

.grid {
  /* --columns (visible day count) and --offset (days scrolled) are set in JS */
  transform: translateX(calc(var(--offset, 0) * -100% / var(--columns, 5)));
  /* Live: at least 54vh, but grows with the tallest column. */
  min-height: 54vh;
}

[dir="rtl"] .grid {
  transform: translateX(calc(var(--offset, 0) * 100% / var(--columns, 5)));
}

.grid__item {
  flex: 0 0 calc(100% / var(--columns, 5));
  width: calc(100% / var(--columns, 5));
  position: relative;
  min-height: 54vh;
}

/* Buffered navigation days must not make an open Someday panel taller than
   the days currently on screen. They are rebuilt as visible on navigation. */
.main--expanded .grid > .grid__item:not(.grid__item--visible) {
  height: 0;
  overflow: hidden;
}

/* ---- Day column ---- */
.day {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--todo-text);
  padding-top: 0;
  /* Prayer labels follow the day title colour, softened a little. */
  --day-title-color: var(--todo-text);
  --prayer-color: color-mix(in srgb, var(--day-title-color) 65%, #ffffff 35%);
}

.day--current {
  --day-title-color: var(--accent-highlight);
}

.day--past {
  --day-title-color: var(--text-past);
}

.todo--past {
  color: var(--text-past);
}
.todo--past .todo__date,
.todo--past .todo__title {
  color: var(--text-past);
}
.todo--past .day-label {
  opacity: 0.5;
}

.todo__header-wrapper {
  position: relative;
  flex: 0 0 auto;
}

/* Block (not flex) so the labels row and the header text stack, exactly like
   live's `.todo__header`; the add-label button is then absolute within it. */
.todo__header {
  display: block;
  margin-bottom: 1.2222rem;
  position: relative;
  width: 100%;
  z-index: 15;
}

.todo__labels {
  display: grid;
  grid-template-columns: 1fr auto;
  margin-bottom: 0.8889rem;
  padding-inline-start: var(--todo-outer-margin);
  padding-inline-end: var(--todo-outer-margin);
  min-height: 1.3333rem;
}

.todo__header__text {
  flex: 1 0 auto;
  max-width: 100%;
  padding-inline-start: calc(var(--todo-outer-margin) + 0.5556rem);
  padding-inline-end: var(--todo-outer-margin);
}

.todo__date {
  color: var(--text-dim);
  font-size: 0.5556rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 0.1667rem;
  text-transform: uppercase;
}

.todo__title {
  font-family: var(--ff-condensed);
  font-size: 1.3333rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--todo-text);
}

.day--current .todo__title {
  color: var(--accent-highlight); /* live --todo-text-today-color */
}

/* Lifeview milestone labels in day headers. */
.day-label {
  display: inline-block;
  max-width: 100%;
  background: var(--day-label-bg);
  color: var(--day-label-color);
  border-radius: 5px;
  padding: 0.1111rem 0.5556rem;
  font-size: 0.5556rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-label__emoji {
  margin-inline-end: 0.2778rem;
}

/* Live's `.create-day-label`: absolute at the header's bottom-right, so the
   gift sits on the day-name row. */
.ui-button--day-label {
  position: absolute;
  bottom: 0.1111rem;
  inset-inline-end: var(--todo-outer-margin);
  width: 1.3333rem;
  height: 1.3333rem;
  padding: 0;
  background: var(--surface-sunken);
  color: var(--text-dim);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease-in-out;
}
.todo__labels:has(.day-label) .ui-button--day-label,
.todo__header-wrapper:hover .ui-button--day-label {
  opacity: 1;
  visibility: visible;
}
.ui-button--day-label .ui-icon {
  width: 0.8889rem;
  height: 0.8889rem;
}

/* ---- Ruled line fill ---- */
.todo__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  font-size: var(--fs-s);
  position: relative;
  min-height: 0;
}

.todo__body::after {
  content: "";
  flex: 1 0 calc(var(--todo-height) * 2 - 1px);
  margin-inline-start: var(--todo-outer-margin);
  margin-inline-end: var(--todo-outer-margin);
  width: calc(100% - var(--todo-outer-margin) * 2);
  background-image: repeating-linear-gradient(
    var(--todo-line),
    var(--todo-line) var(--list-divider-thickness),
    transparent var(--list-divider-thickness),
    transparent var(--todo-height)
  );
}

html.hide-lines--true .todo__body::after,
.todo__body--no-lines::after {
  background-image: none;
}

/* The empty area behaves as an "add task" affordance */
.todo__body--empty-area {
  flex: 1 0 auto;
  cursor: text;
}

/* ==========================================================================
   Prayer sections (Misho layer)
   The day's task area is split into: before Fajr, Fajr, Dhuhr, Asr, Maghrib,
   Isha. Each section has a light prayer-name/time header and its own task
   list, which doubles as the drag-and-drop target for that slot.
   ========================================================================== */

.prayer-sections {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  font-size: var(--fs-s);
  position: relative;
}

/* One grid spans the whole day, including the flexible gaps between prayer
   sections. Section-local filler backgrounds restarted at different heights
   and left visible holes in shorter columns. */
.prayer-sections::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-end: var(--todo-outer-margin);
  bottom: var(--todo-height);
  inset-inline-start: var(--todo-outer-margin);
  pointer-events: none;
  /* A separately rasterized tile keeps thin rules visible at fractional zoom.
     A repeating gradient can drop entire rules between device pixels. */
  background-image: linear-gradient(to top,
    var(--todo-line) 0 var(--list-divider-thickness),
    transparent var(--list-divider-thickness));
  background-size: 100% var(--todo-height);
  background-repeat: repeat-y;
}
html.hide-lines--true .prayer-sections::before { display: none; }

.prayer-section {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  position: relative;
}

.prayer-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  height: var(--todo-height);
  position: relative;
  margin: 0 var(--todo-outer-margin);
  padding: 0 0.5556rem;
  box-sizing: border-box;
  border-bottom: var(--list-divider-thickness) solid transparent;
  background: transparent;
  color: var(--text-dim);
  cursor: text;
  user-select: none;
}

.prayer-header--current {
  color: var(--prayer-color);
}
.prayer-header--current .prayer-time {
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--prayer-color) 14%, transparent);
  opacity: 1;
}

/* Prayer glyph in the left gutter — hidden until its header is hovered,
   mirroring the way task checkboxes appear on hover. */
/* Extend the header's hover/click area into the left gutter so moving onto the
   revealed prayer icon does not make it flicker away. */
.prayer-header::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: calc(-1 * var(--todo-outer-margin));
  width: var(--todo-outer-margin);
}

.prayer-icon {
  position: absolute;
  inset-inline-start: calc(-1 * var(--todo-outer-margin) + 0.0556rem);
  top: 50%;
  transform: translateY(-50%) scale(0.85);
  width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.15s ease-in-out,
    transform 0.2s ease-in-out;
  will-change: transform, opacity;
}

.prayer-icon svg {
  width: 0.75rem;
  height: 0.75rem;
  display: block;
}

/* Each prayer gets a motion that matches its place in the day. */
.prayer-header:hover .prayer-icon--fajr,
.prayer-header:focus-visible .prayer-icon--fajr {
  animation: prayer-fajr-bloom 640ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.prayer-icon--fajr .prayer-sun {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.prayer-header:hover .prayer-icon--fajr .prayer-sun,
.prayer-header:focus-visible .prayer-icon--fajr .prayer-sun {
  animation: prayer-fajr-sun 640ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.prayer-header:hover .prayer-icon--dhuhr,
.prayer-header:focus-visible .prayer-icon--dhuhr {
  animation: prayer-dhuhr-spin 700ms cubic-bezier(0.22, 0.9, 0.3, 1.15) both;
}

.prayer-header:hover .prayer-icon--asr,
.prayer-header:focus-visible .prayer-icon--asr {
  animation: prayer-asr-bloom 700ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.prayer-icon--asr .prayer-sun {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.prayer-header:hover .prayer-icon--asr .prayer-sun,
.prayer-header:focus-visible .prayer-icon--asr .prayer-sun {
  animation: prayer-asr-rays 700ms cubic-bezier(0.22, 0.9, 0.3, 1.15) both;
}

.prayer-header:hover .prayer-icon--maghrib,
.prayer-header:focus-visible .prayer-icon--maghrib {
  animation: prayer-maghrib-bloom 640ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.prayer-icon--maghrib .prayer-sun {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.prayer-header:hover .prayer-icon--maghrib .prayer-sun,
.prayer-header:focus-visible .prayer-icon--maghrib .prayer-sun {
  animation: prayer-maghrib-sun 640ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.prayer-header:hover .prayer-icon--isha,
.prayer-header:focus-visible .prayer-icon--isha {
  animation: prayer-isha-rise 720ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Fajr — the sun lifts out from behind the horizon. */
@keyframes prayer-fajr-bloom {
  0% {
    opacity: 0;
    transform: translateY(-46%) scale(0.6);
  }
  60% {
    opacity: 1;
    transform: translateY(-52%) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes prayer-fajr-sun {
  0% {
    transform: translateY(4px) rotate(-22deg);
  }
  70% {
    transform: translateY(-0.5px) rotate(5deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

/* Dhuhr — high sun, rays turning overhead. */
@keyframes prayer-dhuhr-spin {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.7) rotate(-180deg);
  }
  75% {
    opacity: 1;
    transform: translateY(-50%) scale(1.06) rotate(10deg);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1) rotate(0deg);
  }
}

/* Asr — the afternoon sun lolls west: its rays turn while the horizon holds. */
@keyframes prayer-asr-bloom {
  0% {
    opacity: 0;
    transform: translateY(-56%) scale(0.55);
  }
  55% {
    opacity: 1;
    transform: translateY(-46%) scale(1.12);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes prayer-asr-rays {
  0% {
    transform: rotate(-16deg);
  }
  65% {
    transform: rotate(4deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* Maghrib — the exact reverse of Fajr: the sun sinks behind the horizon. */
@keyframes prayer-maghrib-bloom {
  0% {
    opacity: 0;
    transform: translateY(-54%) scale(0.6);
  }
  60% {
    opacity: 1;
    transform: translateY(-48%) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes prayer-maghrib-sun {
  0% {
    transform: translateY(-4px) rotate(22deg);
  }
  70% {
    transform: translateY(0.5px) rotate(-5deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

/* Isha — the moon rises, then its stars twinkle. */
@keyframes prayer-isha-rise {
  0% {
    opacity: 0;
    transform: translateY(38%) scale(0.55) rotate(90deg);
  }
  55% {
    opacity: 1;
    transform: translateY(-58%) scale(1.14) rotate(-8deg);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1) rotate(0deg);
  }
}

.prayer-header:hover .prayer-icon--isha circle,
.prayer-header:focus-visible .prayer-icon--isha circle {
  animation: prayer-star-twinkle 700ms ease-in-out infinite alternate;
}

.prayer-header:hover .prayer-icon--isha circle:nth-of-type(2),
.prayer-header:focus-visible .prayer-icon--isha circle:nth-of-type(2) {
  animation-delay: 160ms;
}

.prayer-header:hover .prayer-icon--isha circle:nth-of-type(3),
.prayer-header:focus-visible .prayer-icon--isha circle:nth-of-type(3) {
  animation-delay: 320ms;
}

@keyframes prayer-star-twinkle {
  0% {
    opacity: 0.25;
  }
  100% {
    opacity: 0.95;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prayer-header:hover .prayer-icon,
  .prayer-header:focus-visible .prayer-icon {
    animation: none;
    opacity: 1;
    transform: translateY(-50%);
  }

  .prayer-header:hover .prayer-icon .prayer-sun,
  .prayer-header:focus-visible .prayer-icon .prayer-sun {
    animation: none;
    transform: none;
  }

  .prayer-header:hover .prayer-icon--isha circle,
  .prayer-header:focus-visible .prayer-icon--isha circle {
    animation: none;
    opacity: 1;
  }
}

.prayer-name {
  text-align: start;
  font-size: 0.5556rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  color: inherit;
}

.prayer-time {
  flex: 0 0 auto;
  margin-inline-start: auto;
  min-width: 3.4rem;
  text-align: end;
  font-size: 0.5556rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  opacity: 0.85;
  white-space: nowrap;
}

.prayer-header--current .prayer-icon {
  color: var(--prayer-color);
  opacity: 1;
  transform: translateY(-50%) scale(1);
}


.prayer-section__body {
  flex: 0 0 auto;
  min-height: var(--todo-height);
}

/* Keep one composer row in each section; only the trailing area repeats lines. */
.prayer-section__body::after {
  display: none;
}



.prayer-sections__fill {
  flex: 1 0 calc(var(--todo-height) * 2);
  min-height: var(--todo-height);
  margin: 0 var(--todo-outer-margin);
  cursor: text;
}

/* Two spare rows after the longest visible day. Shorter days extend their
   ruled area to the same bottom edge, so all visible columns stay aligned. */
.main--expanded .prayer-sections__fill {
  flex: 1 0 calc(var(--todo-height) * 2);
  min-height: 0;
}
.main--expanded .prayer-sections { flex: 1 1 auto; }

/* ==========================================================================
   Task row
   ========================================================================== */

.todo__list-item {
  display: flex;
  align-items: flex-start;
  height: var(--todo-height);
  list-style: none;
  outline: none;
  padding-inline-start: var(--todo-outer-margin);
  padding-inline-end: var(--todo-outer-margin);
  position: relative;
  z-index: var(--z-todo);
}

.todo__list-item:hover {
  z-index: var(--z-todo-hover);
}
.todo__list-item.is-editing {
  user-select: auto;
}
.todo__list-item.draggable {
  cursor: grab;
}
.todo__list-item.draggable--pointer-down,
.todo__list-item.draggable--pointer-dragging {
  cursor: grabbing;
}
.todo__list-item.grid__item.draggable--pointer-dragging {
  z-index: var(--z-todo-dragging);
}
.main--dragging .grid .todo__list-item {
  transition-duration: 0.01ms;
}

.todo-content {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  height: var(--todo-height);
  line-height: var(--line-height);
  overflow-wrap: anywhere;
  border-top: var(--list-divider-thickness) solid transparent;
  position: relative;
}

/* The shared day grid owns rules; row borders must not double them. */
.prayer-section .todo-content {
  box-sizing: border-box;
  border-top: 0 !important;
  border-bottom: var(--list-divider-thickness) solid transparent !important;
}
.prayer-section .todo-content::after { display: none !important; }
html.hide-lines--true .prayer-header,
html.hide-lines--true .prayer-section .todo-content { border-bottom-color: transparent !important; }

.todo__list-item + .todo__list-item:not(.is-heading) .todo-content {
  border-color: var(--todo-line);
}
.todo__list-item.is-heading + .todo__list-item .todo-content {
  border-color: transparent;
}
.todo__list-item.is-heading .todo-content::after {
  display: none;
}

/* Highlight pill behind the text */
.todo-content::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  top: 0.2222rem;
  bottom: 0.2222rem;
  border-radius: var(--todo-bdrs);
  background-color: var(--todo-highlight-bg, transparent);
  z-index: 1;
}
html.space--medium .todo-content::before {
  top: 0.1111rem;
  bottom: 0.1111rem;
}
html.space--small .todo-content::before {
  top: 0.0556rem;
  bottom: 0.0556rem;
}
.todo__list-item.is-done .todo-content::before {
  opacity: 0.5;
}

.todo-content__text {
  flex: 1 1 1px;
  width: 1px;
  max-width: 100%;
  padding: calc(var(--todo-spacing-y) - var(--list-divider-thickness) / 2) 0.5556rem;
  position: relative;
  z-index: 5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--todo-highlight-color, var(--app-color));
  user-select: none;
  text-rendering: auto;
}

.todo-content__text a {
  text-decoration: underline;
  transition: none;
}

.todo-content__text h5 {
  color: var(--todo-head-text);
  font-size: 0.7142857em;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.1667rem 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.fz--small .todo-content__text h5 {
  padding-top: 0.0556rem;
}

.todo-content__text hr {
  border: 0;
  border-top: 1px dashed var(--text-dim);
  margin: 0.5em 0;
}

/* Heading rows */
.todo__list-item.is-heading .todo-content::before {
  background-color: var(--todo-head-bg);
}
.todo__list-item.is-heading .todo-content__text {
  color: var(--todo-head-text);
}

/* Completed rows */
.todo__list-item.is-done .todo-content__text {
  color: var(--todo-text-done);
  opacity: 0.2;
  text-decoration: line-through;
}
html[theme="dark"] .todo__list-item.is-done .todo-content__text {
  opacity: 0.3;
}
.todo__list-item.is-done.is-heading .todo-content__text {
  opacity: 1;
  text-decoration-color: #ccc;
}

/* Hover: reveal the full text and paint over the ruled lines */
@media (pointer: fine) and (min-width: 48.0625em) {
  .todo__list-item:hover .todo-content__text {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    z-index: var(--z-todo-hover);
  }
  .todo__list-item:not(.is-done):not(.is-highlighted):not(.is-heading):hover .todo-content__text {
    color: var(--todo-text-hover);
  }
  .todo__list-item:not(.is-editing):hover .todo-content {
    background-color: var(--todo-hover-bg);
    height: auto;
    min-height: 100%;
  }
}

.someday-list-section .todo__list-item {
  --todo-hover-bg: var(--someday-bg);
}

/* ==========================================================================
   Checkbox
   ========================================================================== */

.todo__checkbox-wrapper {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: -1.9285714em;
  width: 2.1428571em;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: calc(var(--todo-spacing-y) - 0.0556rem);
  cursor: pointer;
  z-index: 7;
}
html.fz--small .todo__checkbox-wrapper {
  inset-inline-start: -1.5rem;
  width: 1.6667rem;
  padding-top: calc(var(--todo-spacing-y) - 0.1667rem);
}

.todo__checkbox {
  -webkit-appearance: none;
  appearance: none;
  display: inline-block;
  width: 1.2857143em;
  height: 1.2857143em;
  margin: 0;
  border: 0;
  border-radius: var(--todo-bdrs);
  background-color: var(--todo-check-off);
  cursor: pointer;
  position: relative;
  outline: 0;
  vertical-align: top;
}
html.fz--small .todo__checkbox {
  width: 1rem;
  height: 1rem;
}

.todo__checkbox::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0.8889rem;
  height: 0.8889rem;
  background-color: var(--accent);
  -webkit-mask: var(--checkmark-mask) no-repeat 50% 50%;
  mask: var(--checkmark-mask) no-repeat 50% 50%;
  -webkit-mask-size: 1.1428571em 1.1428571em;
  mask-size: 1.1428571em 1.1428571em;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  z-index: 1;
}
html.fz--small .todo__checkbox::after {
  -webkit-mask-size: 0.8889rem 0.8889rem;
  mask-size: 0.8889rem 0.8889rem;
}

@media (pointer: fine) {
  .todo__checkbox {
    opacity: 0;
    transition: none;
  }
  .todo__list-item:hover .todo__checkbox {
    opacity: 1;
    transition: opacity 0.25s ease-in-out;
  }
  .todo__checkbox-wrapper:hover .todo__checkbox {
    background-color: var(--accent);
    transition: background-color 0.25s ease-in-out;
  }
  .todo__checkbox-wrapper:hover .todo__checkbox::after {
    background-color: var(--custom-color-text, #fff);
    opacity: 1;
  }
}

.todo__checkbox:focus-visible {
  opacity: 1;
}
.todo__checkbox:checked::after {
  background-color: var(--todo-check-done) !important;
  opacity: 1;
}
.todo__list-item.is-done .todo__checkbox {
  background-color: transparent;
}
.todo__list-item.is-done .todo__checkbox:hover {
  background-color: var(--todo-line);
}

/* ==========================================================================
   Row action buttons — collapse to zero width until the row is hovered, so
   long task text keeps the full row width at rest.
   ========================================================================== */

.todo-buttons {
  align-self: flex-start;
  display: flex;
  justify-content: flex-end;
  gap: 0.1111rem;
  padding-inline-end: var(--todo-button-group-padding-x);
  margin: calc(var(--todo-spacing-y) - var(--todo-button-offset)) 0.0278rem 0 0;
  border-radius: 0.3333rem;
  z-index: var(--z-todo-buttons);
}

.todo-buttons__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4285714em;
  min-height: 1.4285714em;
  padding: 0;
  border-radius: 0.3333rem;
  background-color: var(--todo-button-bg);
  color: var(--todo-button-color);
  transition:
    background-color 0.25s ease-in-out,
    color 0.25s ease-in-out;
}
.todo-buttons__button svg {
  width: var(--todo-button-icon-size);
  height: var(--todo-button-icon-size);
  display: block;
  fill: currentColor;
}
.todo-buttons__button:hover,
.todo-buttons__button:focus-visible {
  background-color: var(--accent);
  color: #fff;
}

@media (pointer: fine) {
  .todo-buttons,
  .todo__list-item:has(.todo__checkbox:checked):not(:hover) .todo-buttons {
    margin-inline-end: -1.3888889rem;
    opacity: 0;
    visibility: hidden;
    width: 0;
    transition: none;
  }
  html.space--small .todo-buttons {
    margin-inline-end: -1.3333333rem;
  }
  html.fz--large .todo-buttons {
    margin-inline-end: -1.6111111rem;
  }
  .todo__list-item:focus-within .todo-buttons,
  .todo__list-item:hover .todo-buttons {
    color: var(--todo-text-hover);
    opacity: 1;
    visibility: visible;
    width: auto;
    transition: opacity 0.25s ease-in-out;
  }
}

/* The delete glyph morphs from a minus into a cross (live's
   .feature--todo_details timing). */
.ui-button--delete .line-1,
.ui-button--delete .line-2 {
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  transition: transform 0.2s ease-in-out 0.1s;
}
.ui-button--delete:hover .line-1,
.ui-button--delete:focus-visible .line-1 {
  transform: rotate(45deg);
}
.ui-button--delete:hover .line-2,
.ui-button--delete:focus-visible .line-2 {
  transform: rotate(-45deg);
}

/* The repeat glyph spins round on hover. */
.todo-buttons__button--recurring:hover svg {
  transform: rotate(180deg);
  transition: transform 0.35s ease-in-out;
}

/* Details (notes) indicator, shown until the row is hovered */
.todo__details-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  position: absolute;
  inset-inline-end: 0.1111rem;
  top: calc(var(--todo-spacing-y) - 0.0833rem);
  color: var(--todo-indicator);
  pointer-events: none;
  z-index: 2;
}
html.fz--small .todo__details-indicator {
  top: calc(var(--todo-spacing-y) - 0.1389rem);
}
.todo__list-item:not(.has-note) .todo__details-indicator {
  display: none;
}
.todo__list-item.has-note:not(:hover):not(:focus-within) .todo-content__text {
  padding-inline-end: calc(var(--todo-spacing-y) + 1.2222rem);
}
@media (pointer: fine) {
  .todo__list-item:hover .todo__details-indicator,
  .todo__list-item:focus-within .todo__details-indicator {
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
  }
}

/* Recurring marker */
.todo__recurring-indicator {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  margin-inline-end: 0.3333rem;
  position: relative;
  z-index: 2;
}
.todo__recurring-indicator .ui-icon {
  width: 0.7222rem;
  height: 0.7222rem;
}

/* ==========================================================================
   Inline editor / create row
   ========================================================================== */

.todo-input-wrap {
  display: flex;
  flex: 1 1 1px;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  z-index: 5;
}

.todo__input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-height: 100%;
  background-color: transparent;
  border: 0;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  color: var(--todo-text);
  padding: var(--todo-spacing-y) 0.5556rem calc(var(--todo-spacing-y) - 0.0714em);
  position: relative;
  z-index: 5;
}

.todo__input:focus {
  color: var(--todo-text-focus);
}
.todo__input::placeholder {
  color: inherit;
}

.todo-content--create .todo__input[type="text"] {
  color: #707070;
  padding-inline-start: 0.2222rem;
}
.todo-content--create .todo__input[type="text"]:focus,
.todo-content--create .todo__input[type="text"]:not(:placeholder-shown) {
  color: var(--todo-text);
}

/* Keep list composers on the same surface while editing. */
.todo__input--secondary[type="text"] {
  padding: 0 0.5556rem;
}
.todo__input--secondary:hover,
.todo__input--secondary:active,
.todo__input--secondary:focus {
  background-color: transparent;
  box-shadow: none;
}

/* The create-row wrapper keeps the editor's layout stable. */
.todo-content--create .todo-input-wrap {
  overflow: visible;
}

/* Editing keeps the row on the column background. */
.todo__list-item.is-editing .todo-content {
  z-index: var(--z-todo-hover);
}
.todo__list-item.is-editing .todo-content::before {
  background: var(--todo-head-bg);
  opacity: 0;
}
.todo__list-item.is-editing .todo-content::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  bottom: -1px;
  height: var(--list-divider-thickness);
  background-color: var(--todo-line);
}

/* ==========================================================================
   Drag & drop
   ========================================================================== */

.draggable {
  position: relative;
  transition: transform 0.15s;
  user-select: none;
}

.draggable--clone {
  position: absolute !important;
  left: 0;
  top: 0;
  z-index: 1000 !important;
  pointer-events: none;
  transition: none;
}
.draggable--clone.draggable--dropping {
  transition: transform 0.15s ease;
}

.draggable--pointer-dragging,
.draggable--pointer-dropping {
  cursor: grabbing;
  opacity: 0.8;
  z-index: 1;
}

/* The source row is replaced by its dashed placeholder while dragging. */
.todo__list-item.draggable--origin > .todo-content {
  opacity: 0;
}
.todo__list-item.draggable--origin > .todo__checkbox-wrapper,
.todo__list-item.draggable--origin > .todo-buttons {
  opacity: 0;
}

.draggable-origin-placeholder {
  position: absolute;
  inset-inline-start: 1.6667rem !important;
  inset-inline-end: 1.6667rem !important;
  width: auto !important;
  background: rgba(0, 0, 0, 0.05);
  border: 1px dashed #888;
  height: var(--todo-height);
  transition: transform 0.15s;
  z-index: 5;
  pointer-events: none;
}
html[theme="dark"] .draggable-origin-placeholder {
  background: rgba(255, 255, 255, 0.06);
}
.grid__item--secondary .draggable-origin-placeholder {
  inset-inline-start: 0.8333rem !important;
  inset-inline-end: 0.8333rem !important;
}

/* Drag preview: the live app does not widen the hovered column. It leaves the
   dashed origin placeholder in the old slot and shifts the rows below the
   insertion point down by one row (translateY, .15s) to open a real gap. The
   shift is applied as an inline transform from js/dnd.js. */

/* ==========================================================================
   Completion celebration
   ========================================================================== */

.celebration {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}

/* ---- Column count 1 ---- */
.grid[data-columns="1"] .todo__body {
  max-width: 100%;
}
/* The # heading text sits in the vertical center of its task pill. */
.todo__list-item.is-heading .todo-content__text { display:flex;align-items:center; }
.todo__list-item.is-heading .todo-content__text h5 { margin:0;padding:0;line-height:1.2;max-width:100%; }

/* Quantity is independent of completion; generous targets also work on touch. */
.task-counter { position: relative; z-index: 5; display: inline-flex; align-items: center; flex: 0 0 auto; align-self: center;
  margin-inline: 6px; border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  border-radius: 12px; background: color-mix(in srgb, currentColor 5%, transparent);
  color: inherit; user-select: none; }
.task-counter button { display: grid; place-items: center; width: 32px; min-height: 24px; height: calc(var(--todo-height) - 4px);
  padding: 0; border: 0; border-radius: 10px; background: transparent; color: inherit;
  font: inherit; font-size: 20px; cursor: pointer; }
.task-counter button:hover:not(:disabled) { background: color-mix(in srgb, currentColor 12%, transparent); }
.task-counter button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.task-counter button:disabled { opacity: .25; cursor: default; }
.task-counter output { min-width: 2ch; padding-inline: 3px; text-align: center;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .task-counter button { width: 44px; } }

/* Hover surfaces sit above the shared ruled layer. Retain the row's guide
   inside that surface, including when a long title wraps onto more lines. */
html:not(.hide-lines--true) .todo__list-item:hover .todo-content {
  box-shadow: inset 0 calc(-1 * var(--list-divider-thickness)) 0 var(--todo-line);
}
html:not(.hide-lines--true) .someday-list-section .todo__list-item:hover .todo-content {
  box-shadow: inset 0 calc(-1 * var(--list-divider-thickness)) 0 var(--todo-border-color);
}
