/* ============================================
   BEAUTIFIED TASK FORM STYLES
   ============================================ */

.new-task-form-row td {
  padding: 0 !important;
}

.task-form-card {
  background: var(--surface-1);
  background-image: var(--sheen);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 8px 4px;
  /* Same top-edge inset highlight .day-section carries, so the form reads as lit
     from above like the panels around it rather than as a flat cutout. The
     --sheen wash alone gave it the gradient but not the lit edge. */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow-card);
  overflow: hidden;
}

.task-form {
  display: flex;
  flex-direction: column;
}

.task-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  /* Recessed relative to the card rather than a fill of its own, so it tracks
     --surface-1 instead of drifting from it. Same idiom as .task-form-footer,
     which is the matching recess at the other end of the card. */
  background: var(--recess);
  border-bottom: 1px solid var(--border-panel);
}

.task-form-title {
  color: var(--text-1);
  font-weight: 600;
  font-size: var(--fs-14);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-form-title i { color: var(--accent); }

/* Task ⇄ Subcategory in an inline form's header: the title's last word is the switch —
   "New Task" to "New Subcategory" and back (tasks/_subcategory_switch, and the word
   task_form_button.js puts in the subcategory form it swaps in). Only on the home
   categories column, where there is a card to place the new subcategory by; elsewhere
   the word is plain. */
.task-form-kind-word {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline dotted var(--text-3);
  text-underline-offset: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.task-form-title .task-form-kind-word i,
.task-form-kind-word i { color: var(--text-3); font-size: var(--fs-10); transition: color var(--dur-fast); }
.task-form-kind-word:hover,
.task-form-kind-word:hover i { color: var(--accent); text-decoration-color: var(--accent); }
#categories-list .task-form-to-subcategory,
.task-form-to-task { display: inline-flex; }
#categories-list .task-form-kind-plain { display: none; }
.task-form-subcategory-placement {
  padding: 10px 16px 0;
  font-size: var(--fs-12);
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-form-subcategory-placement i { margin-right: 4px; }
.task-form-subcategory-pane .cat-form-header-title { white-space: nowrap; }

.task-form-close {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-2);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--dur-base) ease,
              border-color var(--dur-base) ease,
              color var(--dur-base) ease,
              box-shadow var(--dur-base) ease;
  font-size: var(--fs-14);
}

.task-form-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.task-form-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* The rows Repeat hides: the plain date field, the time row under it and "Show on".
   They are wrapped only so one toggle can hide them together, so the wrapper is
   display:contents and takes no part in layout - the rows go on being spaced by
   .task-date-section exactly as they were before the wrapper existed. Hiding still
   works: initTaskDateSection sets an inline display:none, which beats this. */
#task-nonrepeat-section {
  display: contents;
}

/* The date section is the one field holding more than one row — date, then the time row
   under it, then the repeat block and "show on" when they open. It stacks them on the
   body's own 16px so every line in the form is the same distance from the last however
   they are grouped: the gap under the time row matches the gap above Add info. Rows that
   are display:none take no gap with them.

   Was scoped to .task-form-modal, the calendar "+" arrangement, which left every other
   caller on the 4px `.task-form-field` sets — close enough to nothing that the time row
   read as stuck to the date input. Stated at (0,2,0) so it beats that rule regardless of
   source order. */
.task-form-field.task-date-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.task-form-body.subtask {
  border-left: 3px solid #1da1f2;
}

/* How deep a nested form goes (task_form_button.js syncNestDepth sets --nest-depth): the
   solid bar is the task's own level, and every level above it adds a fainter bar further
   out, with the form stepping in to make room. Without these, sibling and child both
   showed the one bar. */
.task-form-body.subtask,
.task-form-container.subtask {
  position: relative;
  margin-left: calc(8px + (min(var(--nest-depth, 1), 6) - 1) * 6px);
}
.task-form-container.subtask {
  margin-left: calc(2rem + (min(var(--nest-depth, 1), 6) - 1) * 6px);
}
.task-form-body.subtask::before,
.task-form-container.subtask::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: calc(100% + 3px);
  width: calc((min(var(--nest-depth, 1), 6) - 1) * 6px);
  background: repeating-linear-gradient(to right, rgba(29, 161, 242, 0.4) 0 3px, transparent 3px 6px);
  pointer-events: none;
}

/* Conditional sections — AoI, Value, the recurrence extras, the weekly day
   pills, the reminder chip — are all shown by JS flipping inline
   style.display, in a dozen places across four forms plus two inline oninput
   handlers. Rather than rewire every one of those call sites, `display` is
   transitioned as a discrete property so the browser keeps the element
   rendered for the length of the fade, and @starting-style gives it a state to
   animate *from* on the way in. The JS keeps setting display exactly as it
   did; picking "Block" or "Weekly" now eases the section in instead of
   snapping it.

   Entry only: hiding sets display:none with no accompanying selector change,
   so there is no end state to animate toward and the section still leaves at
   once. Animating the exit too would mean the class-based toggle refactor. */
.task-form-aoi-section,
.task-form-value-section,
.task-form-dynamic-section,
.task-form-routines-section,
.task-form-weekly-days,
.task-form-time-row,
.task-reminder-card {
  transition: opacity var(--dur-base) ease,
              transform var(--dur-base) ease,
              display var(--dur-base) allow-discrete;
}

@starting-style {
  .task-form-aoi-section,
  .task-form-value-section,
  .task-form-dynamic-section,
  .task-form-routines-section,
  .task-form-weekly-days,
  .task-form-time-row,
  .task-reminder-card {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .task-form-aoi-section,
  .task-form-value-section,
  .task-form-dynamic-section,
  .task-form-routines-section,
  .task-form-weekly-days,
  .task-form-time-row,
  .task-reminder-card {
    transition: none;
  }
}

.task-form-title-row .task-form-field-title {
  flex: 1;
  min-width: 0;
}

.task-form-title-row .task-form-input-title {
  height: 100%;
  box-sizing: border-box;
}

.task-form-input-title {
  font-size: var(--fs-14) !important;
  padding: 10px 12px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  transition: background-color var(--dur-base) ease,
              border-color var(--dur-base) ease,
              color var(--dur-base) ease,
              box-shadow var(--dur-base) ease;
}

.task-form-input-title::placeholder {
  color: #555;
}

.task-form-input-title:focus {
  border-color: var(--field-required-border) !important;
}

.task-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.task-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Hidden from sight, not from screen readers. display:none took these out of the
   accessibility tree entirely, which left every field named only by its
   placeholder - a name that disappears the moment the field has a value. */
.task-form-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.task-form-label i {
  font-size: var(--fs-11);
  opacity: 0.7;
}

.task-form-input,
.task-form-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: #e0e0e0;
  font-size: var(--fs-14);
  transition: background-color var(--dur-base) ease,
              border-color var(--dur-base) ease,
              color var(--dur-base) ease,
              box-shadow var(--dur-base) ease;
  width: 100%;
  box-sizing: border-box;
}

.task-form-input[type="date"],
.task-form-input[type="time"] {
  color: #e0e0e0;
  -webkit-text-fill-color: #e0e0e0;
}

.task-form-input[type="time"]::-webkit-datetime-edit {
  color: #555;
  -webkit-text-fill-color: #555;
}

.task-form-input[type="time"]::-webkit-datetime-edit-hour-field,
.task-form-input[type="time"]::-webkit-datetime-edit-minute-field,
.task-form-input[type="time"]::-webkit-datetime-edit-ampm-field,
.task-form-input[type="time"]::-webkit-datetime-edit-text {
  color: #555 !important;
  -webkit-text-fill-color: #555 !important;
  opacity: 1 !important;
}

.task-form-input[type="date"]::-webkit-datetime-edit {
  color: #555;
  -webkit-text-fill-color: #555;
}

.task-form-input[type="date"]::-webkit-datetime-edit-month-field {
  color: #555 !important;
  -webkit-text-fill-color: #555 !important;
  opacity: 1 !important;
}

.task-form-input[type="date"]::-webkit-datetime-edit-day-field {
  color: #555 !important;
  -webkit-text-fill-color: #555 !important;
  opacity: 1 !important;
}

.task-form-input[type="date"]::-webkit-datetime-edit-year-field {
  color: #555 !important;
  -webkit-text-fill-color: #555 !important;
  opacity: 1 !important;
}

.task-form-input[type="date"]::-webkit-datetime-edit-text {
  color: #555 !important;
  -webkit-text-fill-color: #555 !important;
  opacity: 1 !important;
}

.task-form-input[type="date"].has-value,
.task-form-input[type="time"].has-value {
  color: #e0e0e0;
  -webkit-text-fill-color: #e0e0e0;
}

.task-form-input[type="date"].has-value::-webkit-datetime-edit,
.task-form-input[type="time"].has-value::-webkit-datetime-edit {
  color: #e0e0e0 !important;
  -webkit-text-fill-color: #e0e0e0 !important;
}

.task-form-input[type="time"].has-value::-webkit-datetime-edit-hour-field,
.task-form-input[type="time"].has-value::-webkit-datetime-edit-minute-field,
.task-form-input[type="time"].has-value::-webkit-datetime-edit-ampm-field,
.task-form-input[type="time"].has-value::-webkit-datetime-edit-text {
  color: #e0e0e0 !important;
  -webkit-text-fill-color: #e0e0e0 !important;
  opacity: 1 !important;
}

.task-form-input[type="date"].has-value::-webkit-datetime-edit-month-field {
  color: #e0e0e0 !important;
  -webkit-text-fill-color: #e0e0e0 !important;
  opacity: 1 !important;
}

.task-form-input[type="date"].has-value::-webkit-datetime-edit-day-field {
  color: #e0e0e0 !important;
  -webkit-text-fill-color: #e0e0e0 !important;
  opacity: 1 !important;
}

.task-form-input[type="date"].has-value::-webkit-datetime-edit-year-field {
  color: #e0e0e0 !important;
  -webkit-text-fill-color: #e0e0e0 !important;
  opacity: 1 !important;
}

.task-form-input[type="date"].has-value::-webkit-datetime-edit-text {
  color: #e0e0e0 !important;
  -webkit-text-fill-color: #e0e0e0 !important;
  opacity: 1 !important;
}

.task-form-input:focus,
.task-form-select:focus {
  outline: none;
  border-color: var(--field-optional-border);
  background-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--field-optional-ring);
}

/* Tags are typed as "#name" in the title, so they render as pills right under
   the title input rather than in a field of their own. The row collapses when
   there are no pills. */
.task-title-tags {
  display: contents;
}

.task-tag-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Not :empty — the partial renders the container across several lines, so it
   always holds a whitespace text node and :empty never matches. It stayed a
   zero-height flex *item* of the title field, which meant the field carried its
   parent's 4px column gap for a row of pills that wasn't there. Invisible
   everywhere except Place, where the repeat button is moved into the title row
   and stretches to it — the button came out 4px taller than in the category and
   value rows. :has() tracks pills added by task_tag_input.js at runtime too,
   which :empty could only ever do for whitespace-free markup. */
.task-tag-pills:not(:has(.tag-pill)) {
  display: none;
}

.task-tag-pills .tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #555;
  color: #fff;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-size: var(--fs-12);
  white-space: nowrap;
}

.task-tag-pills .tag-pill-remove {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  padding: 0;
  font-size: var(--fs-12);
  line-height: 1;
}

.task-tag-pills .tag-pill-remove:hover {
  color: #fff;
}

.task-tag-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: #333;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  max-height: 160px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.task-tag-suggestion {
  padding: 6px 10px;
  font-size: var(--fs-13);
  color: #e0e0e0;
  cursor: pointer;
}

.task-tag-suggestion:hover,
.task-tag-suggestion.is-active {
  background: rgba(255, 255, 255, 0.08);
}

.task-form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0aec0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  color: #555;
}

.task-form-select.has-value {
  color: #e0e0e0;
}

.time-specifier-wrapper {
  position: relative;
  flex-shrink: 0;
}
.time-specifier-wrapper select {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}
.time-specifier-wrapper .time-specifier-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  pointer-events: none;
  color: #6b7280;
  font-size: var(--fs-14);
  z-index: 2;
}
.time-specifier-wrapper:has(select.has-value) .time-specifier-icon {
  display: none;
}

.task-time-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  cursor: text;
  font-family: inherit;
  font-size: var(--fs-14);
  transition: border-color var(--dur-base) ease, box-shadow var(--dur-base) ease;
}

.task-time-input-wrapper:focus-within {
  border-color: var(--field-optional-border);
  box-shadow: var(--field-optional-ring);
}

.task-time-segment {
  display: inline-block;
  outline: none;
  padding: 2px 3px;
  border-radius: var(--radius-xs);
  color: #fff;
  cursor: pointer;
  user-select: none;
  text-align: center;
}

.task-time-segment[data-segment="hour"] {
  min-width: 1.1em;
}

.task-time-segment[data-segment="hour"]:not(.is-set) {
  color: #555;
}

.task-time-segment[data-segment="minute"] {
  min-width: 1.45em;
}

/* The nbsp separator before AM/PM only needs to read as a thin space. */
.task-time-segment[data-segment="minute"] + .task-time-sep {
  padding: 0;
  font-size: 0.6em;
}

.task-time-segment[data-segment="meridiem"] {
  min-width: 2em;
}

/* Unset time reads as placeholder: same flat #555 as every other empty field,
   rather than white dimmed with opacity (which lands lighter than #555). */
.task-time-input-wrapper:not(.has-time) .task-time-segment[data-segment="minute"],
.task-time-input-wrapper:not(.has-time) .task-time-segment[data-segment="meridiem"],
.task-time-input-wrapper:not(.has-time) .task-time-sep {
  color: #555;
}

.task-time-segment:focus {
  background: rgba(34, 197, 94, 0.28);
  color: #fff;
}

.task-time-sep {
  color: #6b7280;
  padding: 0 1px;
}

.task-form-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Custom category select ─────────────────────────────── */
.cat-sel-wrapper {
  position: relative;
}

.cat-sel-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: #555;
  font-size: var(--fs-14);
  transition: border-color var(--dur-base), background var(--dur-base), box-shadow var(--dur-base);
  cursor: pointer;
  box-sizing: border-box;
  font-family: inherit;
}

.cat-sel-trigger.has-value { color: #e0e0e0; }

.category-field-wrapper .cat-sel-wrapper { display: flex; flex-direction: column; }
.category-field-wrapper .cat-sel-trigger { flex: 1; }

.cat-sel-trigger.open {
  outline: none;
  border-color: var(--field-optional-border);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: var(--field-optional-ring);
}

.cat-sel-trigger:hover:not(.open) {
  outline: none;
  border-color: var(--field-optional-hover);
  background: rgba(255, 255, 255, 0.09);
}

.cat-sel-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-sel-chevron {
  flex-shrink: 0;
  color: #a0aec0;
  transition: transform var(--dur-base);
}

.cat-sel-trigger.open .cat-sel-chevron {
  transform: rotate(180deg);
}

.cat-sel-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #1d1d29;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  z-index: 200;
  overflow: hidden;
}

.cat-sel-search-wrap {
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.cat-sel-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: #e0e0e0;
  font-size: var(--fs-13);
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}

.cat-sel-search::placeholder { color: #4a5568; }

.cat-sel-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}

.cat-sel-list::-webkit-scrollbar { width: 4px; }
.cat-sel-list::-webkit-scrollbar-track { background: transparent; }
.cat-sel-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xs);
}

.cat-sel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: var(--fs-14);
  color: #e0e0e0;
  transition: background var(--dur-fast);
  user-select: none;
}

@media (hover: hover) { .cat-sel-item:hover { background: rgba(255, 255, 255, 0.07); } }
.cat-sel-item.selected { background: rgba(29, 161, 242, 0.12); color: #93c5fd; }

.cat-sel-item.type-cat.dl-0 { font-weight: 500; color: #f1f5f9; }
.cat-sel-item.type-cat.dl-1 { color: #94a3b8; font-size: var(--fs-13); }
.cat-sel-item.type-cat.dl-1 .cat-sel-dot { opacity: 0.75; }
.cat-sel-item.type-task { color: #6b7280; font-size: var(--fs-13); }
.cat-sel-task-icon {
  width: 7px;
  height: 7px;
  border: 1.5px solid #4a5568;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.cat-sel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.cat-sel-no-results {
  padding: 12px;
  text-align: center;
  color: #4a5568;
  font-size: var(--fs-13);
  font-style: italic;
}
/* ─────────────────────────────────────────────────────── */

.task-form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #a0aec0;
  font-size: var(--fs-13);
  cursor: pointer;
  transition: color var(--dur-base) ease;
}

.task-form-checkbox-label:hover {
  color: #e0e0e0;
}

.task-form-checkbox {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  appearance: none;
  position: relative;
}

.task-form-checkbox:checked {
  background: #1da1f2;
  border-color: #1da1f2;
}

/* Drawn from two borders rather than set as \2713: the glyph's weight and
   baseline shift with whatever font resolves it, so it sat off-centre in the
   16px box. This lands on the same pixel every time. */
.task-form-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

/* The inputs get their focus ring from .task-form-input:focus; these four are
   buttons and a checkbox, which had hover states and nothing at all for the
   keyboard. :focus-visible so a mouse press doesn't leave a ring behind. */
.task-form-close:focus-visible,
.task-form-checkbox:focus-visible,
.task-form-nest-btn:focus-visible {
  outline: none;
  border-color: var(--field-optional-border);
  box-shadow: var(--field-optional-ring);
}

.task-form-submit:focus-visible {
  outline: none;
  box-shadow: var(--field-required-ring);
}

.task-form-nest-btn {
  padding: 6px 24px;
  font-size: var(--fs-12);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #555;
  cursor: pointer;
  transition: background-color var(--dur-base) ease,
              border-color var(--dur-base) ease,
              color var(--dur-base) ease,
              box-shadow var(--dur-base) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  box-sizing: border-box;
}

.task-form-nest-btn:disabled {
  color: #222;
  opacity: 1;
  cursor: not-allowed;
}

.task-type-toggle {
  padding: 6px 12px;
  font-size: var(--fs-12);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #a0aec0;
  cursor: pointer;
  transition: background-color var(--dur-base) ease,
              border-color var(--dur-base) ease,
              color var(--dur-base) ease,
              box-shadow var(--dur-base) ease;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 100px;
}

.task-type-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #e0e0e0;
}

.task-type-toggle[data-state="place"] {
  background: rgba(29, 161, 242, 0.2);
  border-color: #1da1f2;
  color: #1da1f2;
}

.task-type-toggle[data-state="placeholder"] {
  background: rgba(128, 90, 213, 0.2);
  border-color: #805ad5;
  color: #b794f4;
}

.task-form-day-checkboxes {
  /* Always exactly seven columns, so Sat can never wrap to its own line. The
     tracks are max-content rather than 1fr — the pills size to their labels and
     the row sits centred instead of being stretched edge to edge — and the
     minmax(0, ...) floor keeps them shrinking together instead of overflowing
     when the column is tight. */
  display: grid;
  grid-template-columns: repeat(7, minmax(0, max-content));
  justify-content: center;
  gap: 4px;
}

.day-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0.3rem 0.2rem;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  font-size: var(--fs-12);
  color: #718096;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, color var(--dur-fast) ease;
  user-select: none;
}

.day-pill input[type="checkbox"] {
  display: none;
}

.day-pill:has(input:checked) {
  border-color: #1da1f2;
  background: rgba(29, 161, 242, 0.18);
  color: #63b3ed;
}

.day-pill:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #cbd5e0;
}

/* Routines borrow .day-pill, whose padding is cut for three-letter day
   abbreviations. A word like "Afternoon" needs room around it, so the
   horizontal padding is widened here only — the day picker below still has to
   fit seven pills across a narrow column. */
.task-form-checkboxes .day-pill {
  padding: 0.35rem 0.7rem;
}

.task-form-day-checkboxes .day-pill {
  padding: calc(0.3rem + 1px) calc(0.2rem + 2px);
}

/* The Assign card's note, once someone new is picked (tasks/_assign_card): its own line
   under the cards. */
.task-form-assign-note {
  flex: 1 0 100%; order: 99; box-sizing: border-box; padding: 7px 10px;
  border: 1px solid rgba(129, 140, 248, 0.35); border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.08); color: var(--text-1); font: inherit; font-size: var(--fs-13);
}
.task-form-assign-note:focus { border-color: rgba(129, 140, 248, 0.7); outline: none; }

.task-type-cards-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 2px;
  align-self: stretch;
}

/* The square icon button the forms are built from: an icon over an optional tiny
   label, 64px wide, 40px and icon-only in a footer. .icon-card is the look and
   nothing else. .task-type-card is that look plus the task form's behaviour — the
   document-level click handler in task_form_button.js matches it, preventDefaults
   it and runs Block/Place/Value mutual exclusion on it. So a form that wants the
   button and not the behaviour reaches for .icon-card; reaching for
   .task-type-card silently enrolls it in the task form's toggling, which is how
   the journal form's Photo label lost its file picker. Everything below this pair
   of rules is task-only: the .active variants, .is-disabled, the data-type colours. */
.icon-card,
.task-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  width: 64px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.icon-card i,
.task-type-card i {
  font-size: var(--fs-14);
  color: #555;
  transition: color var(--dur-fast);
}

.icon-card span,
.task-type-card span {
  font-size: var(--fs-9);
  color: #555;
  text-align: center;
  line-height: 1.2;
}

.icon-card:hover,
.task-type-card:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.task-type-card[data-type="block"].active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
}

.task-type-card[data-type="block"].active i,
.task-type-card[data-type="block"].active span {
  color: #fbbf24;
}

.task-type-card[data-type="priority"].active {
  border-color: #f0e040;
  background: rgba(240, 224, 64, 0.12);
}

.task-type-card[data-type="priority"].active i,
.task-type-card[data-type="priority"].active span {
  color: #f0e040;
  text-shadow: 0 0 6px rgba(240, 224, 64, 0.4);
}

.task-type-card[data-type="someday"].active {
  border-color: #5eead4;
  background: rgba(94, 234, 212, 0.15);
}

.task-type-card[data-type="someday"].active i,
.task-type-card[data-type="someday"].active span {
  color: #5eead4;
  text-shadow: 0 0 6px rgba(94, 234, 212, 0.4);
}

/* Maybe sits beside Someday as the other deferral. Each active state
   is keyed to its own data-type, so a card with no rule here reverts to the plain
   card style the moment the pointer leaves — which is why these have to exist. */
.task-type-card[data-type="maybe"].active {
  border-color: #a5b4fc;
  background: rgba(165, 180, 252, 0.15);
}

.task-type-card[data-type="maybe"].active i,
.task-type-card[data-type="maybe"].active span {
  color: #a5b4fc;
  text-shadow: 0 0 6px rgba(165, 180, 252, 0.4);
}

/* "Assign to" (tasks/_assign_card): the reminder card's trick — an invisible select over
   the card — lit in sharing's indigo once someone's picked. */
.task-assign-card { position: relative; overflow: hidden; cursor: pointer; }
.task-assign-card select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.task-assign-card.active { border-color: #818cf8; background: rgba(129, 140, 248, 0.15); }
.task-assign-card.active i { color: #a5b4fc; text-shadow: 0 0 6px rgba(129, 140, 248, 0.4); }

/* With the dashboard's "Assigned" pill on, tasks you've handed to someone come back to
   their categories — faded, since they're the other person's to do. */
tr.task-row:has(.task-share-chip.is-sent) > td { opacity: 0.55; }

.task-type-card[data-type="placeholder"].active {
  border-color: #805ad5;
  background: rgba(128, 90, 213, 0.15);
}

.task-type-card[data-type="placeholder"].active i,
.task-type-card[data-type="placeholder"].active span {
  color: #b794f4;
}

.task-type-card[data-type="place"].active {
  border-color: #1da1f2;
  background: rgba(29, 161, 242, 0.15);
}

.task-type-card[data-type="place"].active i,
.task-type-card[data-type="place"].active span {
  color: #1da1f2;
}

/* Archive, used by the rule form's type cards — muted amber, since archiving is
   retiring a rule rather than flagging it. */
.task-type-card[data-type="archive"].active {
  border-color: #a16207;
  background: rgba(161, 98, 7, 0.18);
}

.task-type-card[data-type="archive"].active i,
.task-type-card[data-type="archive"].active span {
  color: #fcd34d;
}

/* A card whose checkbox can't be changed (someday, once a rule has history). */
.task-type-card.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.task-type-card.is-disabled:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

/* Why a disabled type card can't be picked, shown under the cards on click. */
.task-type-notice {
  margin-top: 10px;
  font-size: var(--fs-12);
  color: var(--text-2);
}

.task-type-card[data-type="value"].active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.15);
}

.task-type-card[data-type="value"].active i,
.task-type-card[data-type="value"].active span {
  color: #a5b4fc;
}

.task-type-card[data-type="standard"].active {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.09);
}

.task-type-card[data-type="standard"].active i,
.task-type-card[data-type="standard"].active span {
  color: #e0e0e0;
}

.mark-completed-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-size: var(--fs-13);
  color: #555;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
  width: 100%;
  user-select: none;
  box-sizing: border-box;
  max-width: 100%;
}

.mark-completed-btn i {
  font-size: var(--fs-14);
  color: #555;
  transition: color var(--dur-fast);
}

.mark-completed-btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #888;
}

.mark-completed-btn:hover i {
  color: #888;
}

.mark-completed-btn.active {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
}

.mark-completed-btn.active i {
  color: #4ade80;
}

/* The negative top/side margins cancel .task-form-body's padding so the strip
   runs edge to edge under the header. The bottom stays 0: the body is a flex
   column with gap:16px, so any bottom margin here is *added* to that gap and
   the title alone ends up sitting further from what's above it than every
   other field does. */
.task-type-switcher {
  display: flex;
  align-items: stretch;
  margin: -16px -16px 0;
  /* One step below --surface-1, so the strip reads as sunk into the form card. */
  background: #111114;
  border-radius: 0;
}

.task-type-switcher .task-type-card {
  flex: 1;
  border-radius: 0;
  border-color: transparent;
  background: transparent;
}

.task-type-switcher .task-type-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Same flush strip as .task-type-switcher, in the forms that lead with nest
   controls instead of the type tabs — and the same reason for a 0 bottom. */
.nest-controls-flush {
  display: flex;
  align-items: stretch;
  margin: -16px -16px 0;
  background: #111114;
  border-radius: 0;
  gap: 0;
}

.nest-controls-flush .task-form-nest-btn {
  flex: 1;
  padding: 8px 24px;
  border-radius: 0;
  border-color: transparent;
  background: transparent;
}

.nest-controls-flush .task-form-nest-btn i {
  font-size: var(--fs-14);
}

.task-form-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.task-date-trigger {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: #6b7280;
  font-size: var(--fs-14);
  cursor: pointer;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color var(--dur-base) ease;
  box-sizing: border-box;
}
.task-date-trigger.has-date { color: #e0e0e0; }
.task-date-trigger:hover { border-color: rgba(255, 255, 255, 0.22); }

.task-date-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.task-repeat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  align-self: stretch;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: #555;
  font-size: var(--fs-13);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.task-repeat-btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
}
.task-repeat-btn.active {
  border-color: #1da1f2;
  background: rgba(29, 161, 242, 0.15);
  color: #1da1f2;
}

.task-repeat-extra {
  flex-direction: column;
  gap: 8px;
}

.task-repeat-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
}

/* Under the weekly day pills, on a line of its own: missed, carry on to the next day
   until the week ends (Task#carry_over, CarryOver). */
.task-repeat-weekly-days { flex-wrap: wrap; }
.task-carry-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-basis: 100%;
  color: var(--text-2);
  font-size: var(--fs-12);
  cursor: pointer;
}
.task-carry-toggle input { width: 14px; height: 14px; margin: 0; color-scheme: dark; cursor: pointer; }

/* Every control in the repeat block shares one track, starting after the icon
   and running to the right edge — Frequency, End date, Freebies, and the day
   picker too. Without the day grid in here its box hugged its own pills and sat
   hard left; sharing the track is what lets it centre against the three fields
   stacked around it. */
.task-repeat-field .task-form-select,
.task-repeat-field .task-form-input,
.task-repeat-field .task-form-day-checkboxes,
.task-repeat-field .task-month-day-grid,
.task-repeat-field .task-month-of-year-grid {
  flex: 1;
  min-width: 0;
}

/* Day-of-month picker for monthly repeats. Laid out as the calendar's
   "…or lock by date of month" grid is — seven columns, 1-31 then L — since it is
   the same choice being made, and a control that looks like that one is already
   understood. The selected state takes the form's blue rather than the calendar's
   green so it agrees with the weekly day pills sitting directly above it. */
.task-month-day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

/* The month strip for yearly repeats, sitting directly above the day grid — a yearly
   repeat is a monthly one that also names its month, so it is the same button in a
   shorter row rather than a control of its own. Six columns puts the twelve months in
   two tidy rows at the same button height as the days below. */
.task-month-of-year-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.task-month-day-btn {
  height: 20px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.04);
  color: #718096;
  font-size: var(--fs-11);
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease,
              color var(--dur-fast) ease;
}

.task-month-day-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #cbd5e0;
}

.task-month-day-btn.on {
  border-color: #1da1f2;
  background: rgba(29, 161, 242, 0.18);
  color: #63b3ed;
}

/* Day label on a context row — the ancestor shown on a day it isn't scheduled,
   carrying a descendant that is ("Video · Tue" above Sunday's "Script"). */
.subtask-context-day {
  margin-left: 0.5rem;
  padding: 1px 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xs);
  color: #718096;
  font-size: var(--fs-11);
  white-space: nowrap;
  vertical-align: middle;
}

.task-repeat-field-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  text-align: center;
  color: #6b7280;
  font-size: var(--fs-13);
  cursor: default;
}

svg.task-repeat-field-icon {
  display: block;
}

.task-repeat-freebie-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-repeat-freebie-icon span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  display: inline-block;
  opacity: 0.85;
}

.task-number-input-wrapper {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
}

.task-number-input {
  flex: 1;
  min-width: 0;
  padding-right: 26px !important;
  -moz-appearance: textfield;
  appearance: textfield;
}

.task-number-input::-webkit-outer-spin-button,
.task-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.task-number-spinner {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-number-spin-btn {
  width: 18px;
  height: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xs);
  color: #888;
  font-size: var(--fs-9);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.task-number-spin-btn:hover {
  background: rgba(34, 197, 94, 0.18);
  color: #22c55e;
}

.task-number-spin-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.06);
  color: #888;
}

.task-date-sub-label {
  font-size: var(--fs-11);
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-left: 2px;
}

.task-reminder-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.task-reminder-card select {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.task-form-footer {
  padding: 12px 16px;
  background: var(--recess);
  border-top: 1px solid var(--border-panel);
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 8px;
}

.task-form-footer-left {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

/* A new account's first task (task_form_button.js, first_task_after): only the question
   and the submit button until "More options" brings the rest back. */
.is-first-task .task-type-switcher,
.is-first-task .task-form-catrepeat-row,
.is-first-task .task-form-counts-section,
.is-first-task .task-date-section,
.is-first-task .task-form-field:has(> textarea),
.is-first-task .task-form-footer-left > * { display: none !important; }
.first-task-more {
  align-self: flex-start;
  margin: -2px 0 2px;
  padding: 2px 0;
  background: none;
  border: none;
  font: inherit;
  font-size: var(--fs-12);
  color: var(--text-muted, rgba(255,255,255,0.55));
  cursor: pointer;
}
.first-task-more b { font-weight: 500; color: rgba(255,255,255,0.8); }
.first-task-more:hover { color: #fff; }

/* The first-task form as one compact card: no "New Task" header, and one row under
   the question with where it's filed and More options on the left, the close button
   and the submit on the right (task_form_button.js moves them there). */
.is-first-task .task-form-header,
.is-first-task .task-form-footer-left { display: none !important; }
.is-first-task .task-form-body { padding-bottom: 10px; }
.is-first-task .task-form-footer {
  padding: 0 14px 14px 16px;
  background: none;
  border-top: none;
  align-items: center;
}
.is-first-task .task-form-footer .first-task-more { margin: 0 auto 0 0; text-align: left; }
.is-first-task .task-form-footer .task-form-close { flex: none; background: none; }
.is-first-task .task-form-footer .task-form-close:hover { background: rgba(255, 255, 255, 0.08); }

.task-form-footer-left .icon-card,
.task-form-footer-left .task-type-card {
  width: 40px;
  padding: 8px;
  justify-content: center;
}

.task-form-submit {
  background: var(--accent);
  border: none;
  color: #06130a;
  width: 40px;
  padding: 8px;
  border-radius: var(--radius-md) !important;
  font-weight: 600;
  font-size: var(--fs-16);
  font-family: inherit;
  cursor: pointer;
  transition: background-color var(--dur-fast), transform var(--dur-fast),
              box-shadow var(--dur-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* The button is the one thing in the footer you actually press, so it lifts on
   hover and takes the press back down past its resting position. The old
   :active rule translated to 0 from a resting 0, so nothing moved. */
.task-form-submit:hover {
  background: var(--accent-bright);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(34, 197, 94, 0.32);
}

.task-form-submit:active {
  transform: translateY(1px);
  box-shadow: none;
  transition-duration: 0.06s;
}

@media (prefers-reduced-motion: reduce) {
  .task-form-submit:hover,
  .task-form-submit:active {
    transform: none;
  }
}

/* The repeat fields' short labels, after their icons ("Starts", "Freebies/wk"). */
.task-repeat-field-label { flex-shrink: 0; width: 5.5rem; color: var(--text-3); font-size: var(--fs-12); white-space: nowrap; }
/* The Counts toward compass in the footer: hidden unless a subcategory is picked. */
.task-form-counts-btn[hidden] { display: none; }
/* The edit form's deadline/target history, folded to one line at its foot. */
.task-history-fold { border: 1px solid var(--border-panel); border-radius: var(--radius-md); background: var(--recess); --band-pad-x: 12px; --band-divider: none; }
.task-history-toggle { padding: 9px 12px; color: var(--text-3); font-size: var(--fs-12); cursor: pointer; list-style: none; }
.task-history-toggle::-webkit-details-marker { display: none; }
.task-history-toggle::before { content: "\f054"; margin-right: 8px; font-family: "Font Awesome 6 Free"; font-size: 9px; font-weight: 900; display: inline-block; transition: transform var(--dur-fast) ease; }
.task-history-fold[open] > .task-history-toggle::before { transform: rotate(90deg); }
.task-history-fold .form-section-label { display: none; }
/* The section holds only the folded select (the compass opens it): no gap while closed. */
.task-form-counts-section:has(.task-form-counts-wrap[hidden]) { display: none; }

/* A footer toggle that's on says what it is beside its icon: four look-alike icons, one a
   question mark, didn't say which were set. */
.task-type-card-label { display: none; font-size: var(--fs-11); font-weight: 600; }
.task-type-card.active:has(> .task-type-card-label) { flex-direction: row; width: auto; gap: 6px; padding-inline: 9px; }
.task-type-card.active > .task-type-card-label { display: inline; }
/* The date and its time on one row; the time wraps under it only when there's no room. */
.task-date-time-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.task-date-time-row > #task-cal-date { flex: 1 1 200px; min-width: 0; }
.task-date-time-row > .task-form-time-row { flex: 0 1 auto; }
#task-nonrepeat-section.task-date-time-row { display: flex; }
.task-date-time-row > #task-display-date-wrapper { flex-basis: 100%; }
.task-date-time-row > .date-words { flex: 1 1 200px; min-width: 0; }
