/* The app's stylesheets, one file per part of the app, loaded in their numbered order
   (ApplicationHelper#app_stylesheets) — the order is the cascade, so a later file's rule
   wins a tie with an earlier one's. This first file is the base every page builds on. */

@keyframes jd-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

@keyframes aoi-jump-flash {
  0%, 100% { box-shadow: none; }
  30%      { box-shadow: 0 0 0 3px rgba(29, 161, 242, 0.8); }
}

.aoi-jump-highlight {
  border-radius: var(--radius-lg);
  animation: aoi-jump-flash 1.2s ease-out;
}

/* ── Journal form ────────────────────────────────────────────────────────────
   New and Edit render one partial (journals/_form), so everything here dresses
   both. It is built out of the task form's parts rather than its own: the card,
   .task-form-body's 16px rhythm, .task-form-input fields, .task-type-card
   toggles in the footer and the arrow submit all come from there. What is left
   below is only what a journal has and a task does not — the entry textarea,
   the attachment cards' states, tags, and the bulk importer. */

/* display:contents so the block bulk mode hides takes no part in layout: its
   fields stay direct children of .task-form-body and keep its 16px gap. The
   [hidden] rule is what JS still turns it off with. */
.jd-single { display: contents; }
.jd-single[hidden] { display: none; }

.jd-form { color: var(--text-1); }

/* The form sits inside .task-form-card, which draws the border, the fill and the
   corners, and .task-form-body brings the padding. */
.jd-form.jd-form-modal { background: none; border: none; border-radius: 0; padding: 0; }

.jd-form-errors {
  background: rgba(239, 68, 68, 0.09);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: var(--danger-bright);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  font-size: var(--fs-12);
  line-height: 1.5;
}
.jd-form-errors strong { font-weight: 600; }
.jd-form-errors ul { margin: 0.35rem 0 0 1.1rem; padding: 0; }

/* The entry is this form's title field — the one thing every entry has — so it
   takes the hero treatment .task-form-input-title gives a task's title, plus the
   height a paragraph needs. Line height 1.35 rather than a roomier 1.6: Safari draws the
   caret on every line after the first up to the bottom of the line above, so the extra
   leading made it visibly taller there than on the first line (17px against 22px). */
.jd-form-entry {
  line-height: 1.35;
  resize: vertical;
  max-height: 60vh;
  /* The serif the entry is read in, so writing it feels like the page it'll become. */
  font-family: Newsreader, Georgia, 'Times New Roman', serif;
  font-size: 15px;
}
.jd-form-entry::placeholder { font-style: italic; }

/* When: the day and the time as chips. The real date and time inputs sit beneath them,
   out of sight but still in the form and still there for showPicker() to open. */
.jd-when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.jd-when-item { position: relative; display: inline-flex; align-items: center; gap: 2px; }
.jd-when-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  white-space: nowrap;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-1);
  font: inherit;
  font-size: var(--fs-13);
  cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.jd-when-chip i { color: var(--text-3); font-size: var(--fs-12); }
.jd-when-chip:hover { border-color: var(--border-strong); }
.jd-when-chip.is-empty { border-style: dashed; background: transparent; color: var(--text-3); }
.jd-when-chip.is-empty:hover { color: var(--text-1); }
.jd-when-clear {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-3);
  font-size: var(--fs-11);
  cursor: pointer;
}
.jd-when-clear:hover { background: var(--hairline); color: var(--text-1); }
.jd-when-clear[hidden] { display: none; }
.jd-when-input {
  position: absolute !important;
  left: 0;
  bottom: 0;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.jd-form-entry:focus {
  border-color: var(--field-required-border);
  box-shadow: var(--field-required-ring);
}

/* Date and time share a line. The date is required and takes the green focus
   pair, the time is optional and takes the blue — the split documented at :root. */

.jd-form-date:focus {
  border-color: var(--field-required-border);
  box-shadow: var(--field-required-ring);
}

/* An empty time input still paints a full --:-- --, which shouted beside a date
   that always has one. Unfilled segments stay quiet until the field has a value. */
.jd-form-time:not(.has-value),
.jd-form-time:not(.has-value)::-webkit-datetime-edit { color: var(--text-3); }

/* Favourite is a footer toggle like Priority and Maybe on a task, so it is an
   .icon-card and reads its state from aria-pressed rather than an inline
   colour written by JS. Gold, matching the bookmark on a saved entry. Icon only,
   named by its title — the footer sizes these to 40px squares beside the submit,
   which is no room for a label. */
.icon-card[data-type="favorite"][aria-pressed="true"] {
  border-color: var(--gold-bright);
  background: rgba(251, 191, 36, 0.12);
}
.icon-card[data-type="favorite"][aria-pressed="true"] i {
  color: var(--gold-bright);
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

/* Photo, Record and Audio file are three ways to hang something off the entry,
   so they are one row of .icon-card buttons. Laid out here rather than with
   .task-type-cards: that class is the segmented-switcher shell — its own fill and
   border, children at flex:1 — and it made the row read as a second footer. The
   recording and recorded states replace the two voice cards and wrap onto their
   own line, hence the wrap. */
.jd-attach-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
/* The three read as buttons, not as switched-off ones: the shared .icon-card's #555 is
   for the task form's toggles at rest. */
.jd-attach-row .icon-card i { color: var(--text-2); }
.jd-attach-row .icon-card span { color: var(--text-2); font-weight: 500; }
.jd-attach-group { display: flex; gap: 6px; align-items: stretch; }

/* "Also save photo as an inspiration" — sits under the attach row once a photo is
   there to copy. */
.jd-inspire-toggle { align-items: center; gap: 0.4rem; margin-top: 8px; cursor: pointer;
  color: var(--text-2); font-size: var(--fs-12); }
.jd-inspire-toggle input { margin: 0; cursor: pointer; }
.jd-inspire-toggle:has(input:checked) { color: var(--text-1); }

/* Groups an element with the control it belongs to without joining the layout. */
.jd-contents { display: contents; }

/* A file input inside a .task-type-card label: hidden from sight, not from the
   keyboard, so the card can still be reached by tabbing to it. */
.jd-file-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.icon-card:has(.jd-file-input:focus-visible),
.icon-card:focus-visible {
  outline: none;
  border-color: var(--field-optional-border);
  box-shadow: var(--field-optional-ring);
}

/* jdShow() flips these between display:flex and none, so only the rest is here. */
.jd-voice-state { flex-basis: 100%; align-items: center; gap: 0.6rem; }
.jd-voice-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: jd-pulse 1s infinite;
  flex-shrink: 0;
}
.jd-voice-timer {
  color: var(--danger);
  font-size: var(--fs-12);
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
}
.jd-voice-stop {
  background: var(--surface-3);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.65rem;
  cursor: pointer;
  color: var(--text-1);
  font-size: var(--fs-12);
  font-family: inherit;
}
.jd-voice-stop:hover { background: var(--surface-pop); }
.jd-voice-recorded { flex-direction: column; align-items: stretch; gap: 0.35rem; }
.jd-voice-file-info { display: none; align-items: center; gap: 0.5rem; }
.jd-voice-file-icon { color: var(--text-3); font-size: var(--fs-13); flex-shrink: 0; }
.jd-voice-filename {
  font-size: var(--fs-12);
  color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 260px;
}
.jd-voice-dur {
  font-size: var(--fs-12);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.jd-voice-player-row { display: flex; align-items: center; gap: 0.5rem; }
.jd-voice-audio { height: 28px; flex: 1; min-width: 0; accent-color: var(--field-optional-border); }
.jd-voice-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  font-size: var(--fs-14);
  padding: 0.2rem;
  flex-shrink: 0;
  font-family: inherit;
}
.jd-voice-clear:hover { color: var(--danger); }

.jd-voice-existing { display: flex; align-items: center; gap: 0.5rem; }
.jd-remove-check { accent-color: var(--danger); cursor: pointer; }
.jd-remove-label { display: flex; align-items: center; gap: 0.25rem; cursor: pointer; }
.jd-remove-label span {
  color: var(--danger);
  font-size: var(--fs-11);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tags and the bulk importer are both things you open only when you want them,
   so they share one disclosure look: a quiet line that turns its chevron down. */
.jd-disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  cursor: pointer;
  color: var(--text-3);
  font-size: var(--fs-11);
  transition: color var(--dur-fast);
}
.jd-disclosure > summary::-webkit-details-marker { display: none; }
.jd-disclosure > summary:hover { color: var(--text-2); }
.jd-disclosure > summary:focus-visible { outline: none; color: var(--text-2); text-decoration: underline; }
.jd-disclosure > summary i { font-size: var(--fs-9); transition: transform var(--dur-fast); }
.jd-disclosure[open] > summary { color: var(--text-2); margin-bottom: 8px; }
.jd-disclosure[open] > summary i { transform: rotate(90deg); }

.jd-tag-pill {
  display: inline-block;
  font-size: var(--fs-11);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  color: var(--text-3);
  background: transparent;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
  user-select: none;
}
label:has(input[type="checkbox"]:checked) .jd-tag-pill {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: var(--accent-soft);
}
.jd-tag-pill:hover { border-color: var(--border-strong); color: var(--text-2); }

/* The checkbox was display:none, which took the pill out of the tab order
   altogether. Hidden this way it still focuses, and the ring below is what the
   keyboard sees. */
.jd-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.jd-tags label { position: relative; cursor: pointer; }
.jd-tag-check {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
label:has(.jd-tag-check:focus-visible) .jd-tag-pill {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--field-required-ring);
}

/* ---- Journal bulk import ----
   The form's second mode: a batch writes a record per memo and per photo-day, so
   the single-entry block is disabled and hidden while this is showing. Sized for
   the compose modal, which is narrower than the standalone /journals/import page —
   hence a plain date input per memo rather than that page's 11.5rem calendar. */
.jd-bulk-drop {
  display: block;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.jd-bulk-drop:hover { border-color: var(--accent); background: rgba(34, 197, 94, 0.04); }
.jd-bulk-drop.is-dragging { border-color: var(--accent); border-style: solid; background: var(--accent-soft); }
.jd-bulk-drop.is-dragging .jd-bulk-drop-main { color: var(--accent-bright); }
.jd-bulk-drop-icon { color: var(--text-3); font-size: var(--fs-14); }
.jd-bulk-drop-main { display: block; color: var(--text-2); font-size: var(--fs-12); margin-top: 0.3rem; }
.jd-bulk-drop-hint { display: block; color: var(--text-3); font-size: var(--fs-11); line-height: 1.45; margin-top: 0.15rem; }

.jd-bulk-bar { display: flex; align-items: baseline; justify-content: space-between; margin-top: 0.75rem; }
.jd-bulk-summary { color: var(--text-1); font-size: var(--fs-12); }
.jd-bulk-cancel {
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--text-3); font-size: var(--fs-11); padding: 0;
}
.jd-bulk-cancel:hover { color: var(--danger); }

.jd-bulk-note {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(249, 115, 22, 0.08);
  color: var(--warn-bright);
  font-size: var(--fs-11);
  line-height: 1.5;
}

.jd-bulk-all { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.6rem; color: var(--text-3); font-size: var(--fs-11); }
.jd-bulk-all button {
  background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text-2);
  font-size: var(--fs-11); padding: 0.25rem 0.5rem; cursor: pointer; font-family: inherit;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.jd-bulk-all button:hover { border-color: var(--accent); color: var(--accent-bright); }

.jd-bulk-rows { margin-top: 0.5rem; }
.jd-bulk-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--border-panel);
  color: var(--text-2); font-size: var(--fs-12);
}
.jd-bulk-name { flex: 1; min-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jd-bulk-size { color: var(--text-3); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.jd-bulk-auto { color: var(--accent-bright); font-size: var(--fs-11); flex-shrink: 0; }
.jd-bulk-fields { display: flex; flex-wrap: wrap; gap: 0.35rem; width: 100%; }

.jd-bulk-all input, .jd-bulk-fields input {
  background: var(--surface-row); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-1); font-size: var(--fs-11); padding: 0.22rem 0.4rem;
  font-family: inherit; color-scheme: dark; min-width: 0;
}
.jd-bulk-fields input[type="text"], .jd-bulk-all input[type="text"] { flex: 1; min-width: 5rem; }
.jd-bulk-all input:focus, .jd-bulk-fields input:focus {
  outline: none;
  border-color: var(--field-optional-border);
  box-shadow: var(--field-optional-ring);
}

.jd-media-preview {
  position: relative;
  display: inline-block;
}
.jd-media-preview img {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-md);
  display: block;
  border: 1px solid var(--border);
}
.jd-media-remove {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: var(--danger-bright);
  font-size: var(--fs-11);
  font-family: inherit;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: background var(--dur-fast);
}
.jd-media-remove:hover { background: rgba(0, 0, 0, 0.85); }
.jd-media-remove span {
  color: var(--danger-bright);
  font-size: var(--fs-10);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Note editor formatting toolbar */
.ane-format-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  flex-shrink: 0;
}
.ane-fmt-btn {
  font-family: inherit;
}
.ane-fmt-btn.ane-fmt-i { font-style: italic; font-size: var(--fs-13); }
.ane-fmt-sep { width: 1px; background: var(--border); height: 14px; margin: 0 3px; flex-shrink: 0; }

/* Note checklists — the circle is drawn with pseudo-elements rather than a real
   <input>, so it can't be selected, deleted or duplicated inside the editor.
   Every rule is scoped with `>` so the style applies to one level only: a
   nested list inside a checklist item keeps whatever type it is (bullets,
   numbers, or a checklist of its own). */
/* The item's own padding stands in for the marker column a bulleted list gets
   from the UA, so the text lines up with bullet text and the circle sits over
   where the bullet's dot would be. */
.ane-checklist { list-style: none; padding-left: 0; margin: 4px 0; }
.ane-checklist > li {
  position: relative; padding-left: 1.5em; margin: 2px 0; list-style: none;
}
.ane-checklist > li::before {
  content: ''; position: absolute; left: 0; top: 0.1em;
  width: 1.3em; height: 1.3em; box-sizing: border-box;
  border: 1.5px solid #636366; border-radius: 50%;
  cursor: pointer;
}
.ane-checklist > li[data-checked="true"]::before {
  background: #f5c518; border-color: #f5c518;
}
/* The tick is a background image on a box laid exactly over the circle, so
   `center` centres it — a rotated two-border box can't be: its ink sits in one
   corner, at an offset from the box centre that no amount of nudging pins down. */
.ane-checklist > li[data-checked="true"]::after {
  content: ''; position: absolute; left: 0; top: 0.1em;
  width: 1.3em; height: 1.3em; pointer-events: none;
  background: no-repeat center / 0.62em 0.62em
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 L4.9 8.6 L9.5 3.4' fill='none' stroke='%231c1c1e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* Checking an item marks the circle only — the text is left exactly as it was. */
/* Sub-lists align under the parent's text, not its checkbox */
.ane-checklist > li > ul, .ane-checklist > li > ol { padding-left: 1.5em; }

@media (hover: hover) { /* Individual icon hover highlight in task row action buttons */
.task-row-hover-buttons i.fa-solid:hover,
.task-row-hover-buttons button:hover i.fa-solid,
.task-row-hover-buttons a:hover i.fa-solid,
.task-row-hover-buttons span:hover > i.fa-solid,
.task-row-hover-buttons i.star-priority:hover {
  color: #e0e0e0 !important;
  transition: color var(--dur-fast);
} }

/* Ghost post styling for faded drafts in Next column */
.ghost-post {
  opacity: 0.5 !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
  pointer-events: none !important;
}

.ghost-post .handle,
.ghost-post td {
  pointer-events: none !important;
}
.alert-success {
  background-color: #155724;
  color: #e0e0e0;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0.25rem;
}
.alert-danger {
  background-color: #721c24;
  color: #e0e0e0;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0.25rem;
}
.line-through {
  text-decoration: line-through;
}
.collapse {
  display: none;
}
.btn {
  display: inline-block;
  font-weight: 400;
  text-align: center;
  vertical-align: middle;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: var(--fs-16);
  line-height: 1.5;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: color var(--dur-fast) ease-in-out, background-color var(--dur-fast) ease-in-out, border-color var(--dur-fast) ease-in-out;
}
.highlighted {
  border: 2px solid #28a745 !important;
  background-color: rgba(40, 167, 69, 0.2);
}
tr[data-task-row-target="form"] {
  display: none;
}
tr[data-task-row-target="form"][style*="display: table-row"] {
  display: table-row !important;
}
.dragging {
  background-color: rgba(0, 123, 255, 0.15) !important;
  outline: 2px dashed #007bff;
  outline-offset: -2px;
}
tr[draggable="true"]:hover {
  cursor: move;
}
tr.subtask-inline-row.dragging-subtask {
  opacity: 0.4;
  background-color: rgba(99, 102, 241, 0.1);
  outline: 1px dashed #6366f1;
  outline-offset: -1px;
}
tr.subtask-inline-row .subtask-drag-handle:hover {
  color: #999;
}
tr.subtask-inline-row[draggable="true"]:hover {
  cursor: grab;
}
.collapse.show {
  display: block;
}
.block-task {
  background-color: #1c1c1c;
  border-left: 2px dashed #59636c;
  border-right: 2px dashed #59636c;
}
.block-task.highlight {
  background-color: #555;
}
.drop-target {
  background-color: #555;
  border: 2px solid #28a745;
}
.column {
  flex: 1;
  padding: 0.5rem;
  border-radius: 0.5rem;
  overflow-y: auto;
  height: 100%;
}
.categories-column,
.daily-column {
  width: 100%;
  max-width: 100%;
}
/* Selecting a long run of days (a whole month is 30+ .day-section blocks, each with a
   task table, a rules table, a hidden dropdown and a hidden milestone form) puts far
   more in the schedule column than fits on screen, and laying out and painting all of
   it on every scroll frame is what makes the column stutter. content-visibility lets
   the browser skip the subtree of any day that is off screen; `contain-intrinsic-size:
   auto` remembers each day's last real height, so a day already scrolled past keeps its
   size and the scrollbar doesn't jump. 900px is the placeholder for days not yet
   rendered once — roughly a typical day's height, so the initial scroll range is close.

   content-visibility also brings paint containment, which would clip the date dropdown
   and milestone form where they hang past a short day's box, so the day that has one
   open opts out (.popup-open, toggled in calendars/_task_schedule). */
.daily-column .day-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 900px;
}

/* A day the user has something open in drops the optimisation entirely: paint
   containment would clip a panel that hangs past the day's own box, and a day being
   worked in is on screen anyway, so there is nothing to save there. .popup-open is
   set by the date dropdown and milestone form (calendars/_task_schedule); the rest
   are panels that only exist while open. The pencil dropdown needs no rule — it
   reparents itself to <body> when an ancestor clips (see hasClippingAncestor). */
.daily-column .day-section.popup-open,
.daily-column .day-section:has(.new-task-form-row),
.daily-column .day-section:has(.task-title-tag-suggestions),
.daily-column .day-section:has(.tag-suggestions-dropdown[style*="block"]) {
  content-visibility: visible;
  contain-intrinsic-size: none;
}

/* ---------------------------------------------------------------------------
   Task row chrome.

   These declarations used to ride along as style="" on every task row. The
   schedule renders one row per task per selected day, so a month-long selection
   repeated each of them 900+ times — 1.9MB of the page was inline style
   attributes. They are identical on every row, so they belong here.

   Inline styles outrank every stylesheet rule, so anything moved down here is
   newly reachable by the cascade. Each rule below is scoped tightly enough to
   land on exactly the elements that carried the attribute, and the row snapshot
   test (test/system/row_snapshot_test.rb) is how that was checked.
   --------------------------------------------------------------------------- */

/* The cancel / delete / add cells: their control fills the cell edge to edge. Not by
   positioning the cell — a positioned cell in a collapsed-border table is painted on a
   layer of its own, and Safari drew a block's 3px top border thinner and lower over these
   two cells than over the rest of the row. The 1px height is the table trick that gives
   the control's height: 100% a box to fill (the row's height wins, so the cell isn't 1px). */
.task-row > td.delete-cancel-cell,
.task-row > td.add-cell {
  padding: 0;
  height: 1px;
}
.task-row > td.delete-cancel-cell > .cell-overlay,
.task-row > td.add-cell > .cell-overlay {
  position: static;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
}

/* Wraps a row's tools so the phone's open strip has a positioned box that isn't the
   table cell (see 12-polish); otherwise not a box at all. */
.row-tools-host { display: contents; }

/* The trailing spacer cell that closes every row. */
.task-row > td.row-end-cell {
  padding: 0;
  width: 0;
}

/* A control that fills its cell edge to edge: the cancel ban, the delete x, the
   add plus, and the completion checkbox's click target. */
.cell-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The pencil panel. It ships empty and is filled on first open, and while open it
   may be reparented to <body> with position/top/left set inline — those inline
   values still win over this, which is only the resting state. */
.pencil-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 500;
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 12px;
  width: 280px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  margin-top: 6px;
}

/* Five dots rating one occurrence of a task on a value (tasks/_rating_dots) — the pencil
   panel's Ratings and the table on the task's page. Sized like a value task's dial. */
.rating-dots { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; margin: 0; }
.rating-dot {
  position: relative;
  flex: none;
  box-sizing: border-box;
  display: inline-flex;
  width: 17px;
  height: 17px;
  border: 2px solid #555;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s ease;
}
.rating-dot:hover { border-color: var(--text-2); }
.rating-dot:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 1px; }
.rating-dot input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; pointer-events: none; }

/* The pencil panel's Ratings: one row per value a task is rated on (TaskRatedValue). */
.pencil-ratings-label { font-size: var(--fs-11); color: #888; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; cursor: help; }
.pencil-ratings-label i { margin-right: 4px; }
.pencil-rating-row { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.pencil-rating-name { flex: 1 1 auto; min-width: 0; font-size: var(--fs-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The pencil panel's note on the occurrence (tasks/_pencil_occurrence_note_section). */
.pencil-occurrence-note-form { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.pencil-occurrence-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-row);
  color: #e0e0e0;
  font-size: var(--fs-13);
  resize: vertical;
}
.pencil-occurrence-actions { display: flex; align-items: center; justify-content: space-between; }
.pencil-occurrence-saved { font-size: var(--fs-12); color: #888; }
.pencil-occurrence-saved .fa-check { color: var(--accent); margin-right: 3px; }
.pencil-occurrence-save { background: #1a4020; border: 1px solid #2a6030; color: #fff; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: var(--fs-12); }

/* The two padded cells of a task row. A block row and the categories column still set
   their own padding inline — the block's is different and the categories column's is
   computed from the nesting depth — and both outrank these. Only the constant case,
   which is every row the schedule renders, comes from here. */
.task-row > td.row-lead-cell {
  padding: 0.5rem 0.25rem 0.5rem 0.5rem;
}

.task-row > td.row-title-cell {
  padding: 0.5rem 0;
}

/* The tray (calendars/_unplaced_divider): a day's rows with no considered place yet lead
   the day, drawn as one card like the categories column's Inbox — a header ("Unsorted"),
   the rows on the card's surface, a closing foot. Neutral gray
   and no side stripe: in the schedule a stripe reads as an area's colour, and these
   aren't filed under anything in the day yet. The sides are inset shadows, not borders:
   the table collapses borders onto the grid lines, where they'd sit half a pixel off the
   header's and foot's own boxes. On the row's last visible cell, since every task row
   ends in a zero-width spacer that can't draw one. The surface is a background-image so
   it lays over the row's inline background, with the hover's lift redrawn on top. Picked
   out with :has() rather than a class, so a row dragged in or out of the tray is wrapped
   or not the moment it lands. */
.unplaced-head > td,
.unplaced-divider > td { padding: 0; border: none; }
.unplaced-head > td { padding-top: 4px; }
.unplaced-divider > td { padding-bottom: 14px; }
.unplaced-head-card,
.unplaced-foot-card { background: var(--surface-row); }
.unplaced-head-card {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 14px 10px;
  border-radius: 12px 12px 0 0;
  /* The Inbox's lit top edge, over the card's hairline. */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, var(--cat-toplight)),
              inset 0 1px 0 var(--tray-edge), inset 1px 0 0 var(--tray-edge), inset -1px 0 0 var(--tray-edge);
  animation: unplaced-caption-in var(--dur-base) ease-out;
}
.unplaced-head-title {
  font-weight: 600;
  color: #f0f0f2;
  font-size: var(--fs-14);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.unplaced-head-title > i { margin-right: 0.4rem; font-size: var(--fs-13); color: #a1a1aa; }
.unplaced-foot-card {
  height: 14px;
  border-radius: 0 0 12px 12px;
  box-shadow: inset 0 -1px 0 var(--tray-edge), inset 1px 0 0 var(--tray-edge), inset -1px 0 0 var(--tray-edge);
}
.task-row:has(~ .unplaced-divider) > td {
  background-image: linear-gradient(var(--surface-row), var(--surface-row));
}
@media (hover: hover) { .daily-column tbody tr.task-row:not(.place-task):hover:has(~ .unplaced-divider) > td {
  background-image: linear-gradient(rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.025)),
                    linear-gradient(var(--surface-row), var(--surface-row));
} }
/* :first-child, not .row-lead-cell: the Journal form row is one colspan cell with no lead. */
.task-row:has(~ .unplaced-divider) > td:first-child { box-shadow: inset 1px 0 0 var(--tray-edge); }
.task-row:has(~ .unplaced-divider) > td:has(+ td.row-end-cell:last-child),
.task-row:has(~ .unplaced-divider) > td:last-child:not(.row-end-cell) { box-shadow: inset -1px 0 0 var(--tray-edge); }
.task-row:has(~ .unplaced-divider) > td:only-child { box-shadow: inset 1px 0 0 var(--tray-edge), inset -1px 0 0 var(--tray-edge); }
/* An assignment's own mark takes the lead cell's shadow; keep the card's edge beside it. */
tr.task-row.is-incoming-assignment:has(~ .unplaced-divider) > td:first-child { box-shadow: inset 3px 0 0 #818cf8, inset 1px 0 0 var(--tray-edge); }
@keyframes unplaced-caption-in { from { opacity: 0; } }
/* The last tray row dragged out, deleted, or moved leaves the header and foot with nothing
   between them until the server's re-render drops them; hide them meanwhile rather than
   show an empty card. A ghost (turbo_stream_actions.js __ghostRow) is a row already gone,
   dimmed in place until the next full render, so it doesn't hold the tray open — and it
   sheds the tray's fill and edges with it. */
tbody:not(:has(.task-row:not([data-ghost-row]) ~ .unplaced-divider)) > :is(.unplaced-head, .unplaced-divider) { display: none; }
tbody:not(:has(.task-row:not([data-ghost-row]) ~ .unplaced-divider)) > .task-row[data-ghost-row]:has(~ .unplaced-divider) > td {
  background-image: none;
  box-shadow: none;
}

/* The one-time padlock tip (task_drag.js showDayLockTip): hangs under the day title once
   the tray has been emptied, pointing up at the open padlock. Dressed like .app-hint. */
.date-separator:has(> .day-lock-tip) { position: relative; }
.day-lock-tip {
  position: absolute; top: calc(100% + 4px); left: 50%; z-index: 20;
  transform: translateX(-50%);
  display: flex; align-items: flex-start; gap: 10px;
  width: min(340px, calc(100vw - 32px)); padding: 10px 12px 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 10px;
  background: linear-gradient(color-mix(in srgb, var(--accent) 7%, transparent), color-mix(in srgb, var(--accent) 7%, transparent)), var(--surface-pop);
  box-shadow: var(--shadow-card);
  color: var(--text-2); font-size: var(--fs-12); font-weight: 400; letter-spacing: 0; line-height: 1.5;
  text-align: left; white-space: normal;
  animation: unplaced-caption-in var(--dur-base) ease-out;
}
.day-lock-tip-icon { margin-top: 3px; color: var(--accent); }
.day-lock-tip-text strong { color: var(--text-1); font-weight: 600; }
.day-lock-tip-actions { display: flex; gap: 6px; margin-top: 8px; }
.day-lock-tip-actions button {
  padding: 3px 10px; border-radius: 999px; font: inherit; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: none; color: var(--accent);
}
.day-lock-tip-actions .day-lock-tip-close { border-color: transparent; color: var(--text-3); }
.day-lock-tip-actions button:hover { background: rgba(255, 255, 255, 0.06); }

/* The icons in the cancel / delete / add cells. `.delete-button, .cancel-button,
   .add-task-button { color: white }` in calendars/_task_schedule sits at (0,1,0) and
   used to lose to the inline colour; this replaces it at (0,2,2) so it still does.
   The hover previews further down all carry !important, so they keep winning. */
.task-row > td.delete-cancel-cell i,
.task-row > td.add-cell i {
  color: var(--text-3);
}

/* The recurring task's dynamic value (or its repeat glyph) beside the title. */
.task-row .dynamic-aspect {
  color: var(--text-3);
  opacity: 30%;
  cursor: pointer;
  margin-left: 0.5rem;
}

/* A habit's target in every task form (tasks/_target_fields): ≥/≤, the number, the
   unit — one row, the number taking whatever width is left. Three classes deep to
   outrank the repeat block's "every control fills the track" rule. */
.task-target-fields { display: flex; gap: 6px; flex: 1; min-width: 0; }
.task-target-fields .task-form-input.task-target-direction { width: 56px; flex: none; padding-left: 0.6rem; padding-right: 0.25rem; }
.task-target-fields .task-form-input.task-target-value { flex: 1; min-width: 0; }
.task-target-fields .task-form-input.task-target-unit { width: 96px; flex: none; }

/* The inline editor that stands in for .dynamic-aspect: the number box, then the
   habit's unit beside it ("2.3 [miles]") so only the number is typed. */
/* The day's note or number for a recurring row (task_row_actions.js): one dark field with a
   green focus ring, its unit, and a ✓ that saves — on its own line under the title, lined
   up with it, and short of the row's tools on the right. */
.dynamic-aspect-editor {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 2px;
  max-width: 16rem;
  white-space: nowrap;
}
.dynamic-aspect-input {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-1);
  font: inherit;
  font-size: var(--fs-13);
  outline: none;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.dynamic-aspect-input.is-number { flex: none; width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.dynamic-aspect-input::placeholder { color: var(--text-3); }
.dynamic-aspect-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dynamic-aspect-unit { color: var(--text-3); font-size: var(--fs-13); }
.dynamic-aspect-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #04110a;
  font-size: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .dynamic-aspect-save:hover { background: var(--accent-bright); } }
/* Phones: 16px so iPhone Safari doesn't zoom in on focus; a little taller to tap. */
@media (max-width: 819px) {
  .dynamic-aspect-editor { max-width: none; }
  .dynamic-aspect-input { height: 32px; font-size: 16px; }
  .dynamic-aspect-save { width: 32px; height: 32px; }
}

.task-row > td.schedule-icon-cell {
  text-align: center;
}

/* The hover-buttons cell: a fixed little toolbar, structurally identical on every row.
   `td.task-row-icon-cell > div` below already reaches the wrapper, so these are the
   declarations that used to sit inline alongside it. */
td.task-row-hover-buttons {
  padding: 0.2rem;
}

.task-row .row-tools {
  display: flex;
  align-items: center;
  height: 100%;
}

.task-row .row-tools-stack {
  display: flex;
  flex-direction: column;
  margin-left: 0.25rem;
}

/* The date/assign stack leads the toolbar, so it hangs off the other edge. */
.task-row .row-tools-stack.is-leading {
  align-items: center;
  margin-left: 0;
  margin-right: 0.25rem;
}

/* The subtask chevron in the categories column, in a column of its own ahead of the
   tools and centred on the row, so the two-high stacks beside it keep their shape
   (tasks/_task_row). In the schedule it stays under the calendar. */
.task-row .row-tools-stack.is-caret {
  align-items: center;
  justify-content: center;
  align-self: stretch;
  margin-left: 0;
  margin-right: 0.4rem;
}

.task-row .row-tools-line {
  display: flex;
  align-items: center;
}

.task-row .row-tools-line + .row-tools-line {
  margin-top: 0.25rem;
}

/* A place's three tools in one evenly spaced line (tasks/_task_row). */
.task-row .row-tools-stack.is-single-line { margin-left: 0; }
.task-row .row-tools-stack.is-single-line .row-tools-line { gap: 0.5rem; }
/* Each tool the same centred box, and none of the margins that space the two-high stacks
   (the calendar's bottom one, the tag's right one), so they share one centre line. */
.task-row .row-tools-stack.is-single-line .row-tools-line > *,
.task-row .row-tools-stack.is-single-line .pencil-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 16px;
  margin: 0;
  line-height: 1;
}

/* Positioning context for the pencil panel. */
.task-row .row-tools-anchor {
  position: relative;
  display: inline-block;
  margin-left: 0.25rem;
}

.task-row .inline-tag-btn,
.task-row .pencil-dropdown-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.task-row .inline-tag-btn {
  margin-right: 0.45rem;
}

.task-row .pencil-dropdown-toggle {
  line-height: 1;
}

.task-row .star-priority {
  cursor: pointer;
  /* Optical nudge: the glyph sits 1px right of the column it shares with the tag above. */
  position: relative;
  left: -1px;
}

.task-row .subtask-caret-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.task-row .calendar-date-picker {
  cursor: pointer;
  margin-bottom: 0.25rem;
}

.task-row .task-share-btn {
  color: var(--text-3);
  cursor: pointer;
}

/* Pointing out of the schedule and into the categories column. */
.daily-column .task-row .task-share-btn {
  transform: rotate(90deg);
}

th {
  word-wrap: break-word;
}
.categories-column tr:not(.subtask) .task-title {
  padding: 0 0 0 0.6rem;
}
.task-form-container.subtask {
  border-left: 3px solid #1da1f2;
  padding-left: 0.5rem;
}
.nest-controls {
  display: inline-flex;
  gap: 2px;
  align-self: stretch;
}

.daily-column .task-form-container {
  width: 100%;
  margin-right: 0;
  padding-right: 0;
}
.daily-column .task-form-container form {
  width: 100%;
  max-width: 100%;
  margin: 0;
}
.daily-column tr[id^="new-task-form-"] td {
  padding-right: 0;
}
.daily-column table {
  width: 100%;
  table-layout: fixed;
}
.daily-column .task-form-container input,
.daily-column .task-form-container select,
.daily-column .task-form-container button {
  box-sizing: border-box;
  width: 100%;
}
.categories-column tr.task-in-other-columns {
  background-color: #00008B !important;
}

/* Inline goal/entry edit forms (sidebar stats + goal cells) */
.goal-inline-form form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 2px 0;
}
.goal-inline-form input[type="number"],
.goal-inline-form input[type="date"] {
  width: 100%;
  box-sizing: border-box;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: var(--radius-sm);
  color: #e2e8f0;
  padding: 4px 6px;
  font-size: var(--fs-12);
  font-family: inherit;
  text-align: center;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.goal-inline-form input[type="number"]:focus,
.goal-inline-form input[type="date"]:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 2px #22c55e26;
}
.goal-inline-form input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
}
.goal-inline-form input[type="submit"] {
  background: #22c55e;
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: var(--fs-12);
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--dur-fast);
}
.goal-inline-form input[type="submit"]:hover { opacity: 0.85; }
.goal-inline-form .cancel-edit {
  color: #666;
  font-size: var(--fs-11);
  text-align: center;
  text-decoration: none;
}
.goal-inline-form .cancel-edit:hover { color: #aaa; }
a {
  color: var(--blue);
  text-decoration: none;
}
/* Zero specificity, so any class rule that sets text-decoration on a link wins on hover too. */
:where(a:hover) {
  text-decoration: underline;
}
table {
  table-layout: fixed;
}
td {
  word-wrap: break-word;
}
form.inline {
  display: inline;
  margin: 0;
  padding: 0;
}
.toggle-completed {
  appearance: none;
  cursor: pointer;
  position: relative;
  margin: 0;
  box-sizing: border-box;
  margin-bottom: -1px;
}
.toggle-completed:checked {
  background-color: #22c55e;
}
/* A checked box had no hover state: `:checked` and `:hover` are both (0,2,0) and
   `:checked` sits later in the file, so it simply won and hovering a completed
   task gave no feedback at all. `:checked:hover` is (0,3,0) and settles it.
   The fill lifts and the border picks up the accent, mirroring the unchecked
   hover above rather than inventing a different gesture. */
.toggle-completed:checked:hover {
  background: #4ade80;
  border-color: var(--accent-bright);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.toggle-completed:checked::after {
  position: absolute;
  top: 50%;
  left: 50%;
  line-height: 1;
}
/* Task table column widths for daily and categories columns */
.daily-column table td:nth-child(1) { width: 13%; text-align: center; }
.categories-column table td:nth-child(1) { width: 40px; text-align: center; }
.daily-column table td:nth-child(2) { width: 13%; padding: 6px; }
.daily-column table td:nth-child(3),
.categories-column table td:nth-child(3) { width: 44%; }
.daily-column table td:nth-child(4),
.categories-column table td:nth-child(4) { width: 14%; text-align: center; }
.daily-column table td:nth-child(5),
.categories-column table td:nth-child(5) { width: 8%; text-align: center; }
.daily-column table td:nth-child(6) { width: 8%; text-align: center; }
/* Updated column widths for posts table */
.add-task-button {
  text-decoration: none;
  text-align: center;
  font-size: var(--fs-14);
}
.add-task-button:hover {
  text-decoration: none;
}
.delete-button {
  text-decoration: none;
  text-align: center;
  font-size: var(--fs-14);
}
.delete-button:hover {
  text-decoration: none;
}
.cancel-button {
  text-decoration: none;
  text-align: center;
  font-size: var(--fs-14);
}
.cancel-button:hover {
  text-decoration: none;
}
.block-cancel-footer-link {
  transition: background-color var(--dur-fast) ease;
}
/* Mouse only: on phones :hover sticks to whatever a scrolling thumb last touched. */
@media (hover: hover) {
  .cancel-button.block-cancel-footer-link:hover {
    background-color: #4a9edd !important;
  }
  .block-cancel-footer-link:hover i {
    color: #fff !important;
  }
}
.priority  -symbol {
  font-size: 1.2em;
  color: #ff6f00;
  text-decoration: none;
}
.drop-target-task {
  border: 2px solid #007bff !important;
  background-color: rgba(0, 123, 255, 0.2) !important;
}
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
   width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,  0,0.7);
  display: none;
}
.modal  -header h2 {
  font-size: var(--fs-20);
  font-weight: bold;
  color: #fff;
  margin: 0;
}
.close {
  color: #fff;
  font-size: var(--fs-24);
  font-weight:  bold;
  cursor: pointer;
  padding: 5px;
}
.close:hover,
.close:focus {
  color: #1da1f2;
}
.btn-primary {
  background-color: #1da1f2;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  color: white;
  font-size: var(--fs-14);
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  transition: background-color var(--dur-fast), transform var(--dur-fast);
}
.btn-primary:hover {
  background-color: #1a91da;
}
.btn-primary:disabled {
  background-color: #4a90e2;
  cursor: not-allowed;
}
.posts-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--proc-surface);
  border: 1px solid var(--proc-line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
/* No posts table renders a header row — the row partial says so, and the date and
   draft columns carry their meaning in a title attribute instead — so the th rules
   that used to live here styled nothing. */
.posts-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--proc-line);
  color: var(--proc-ink);
}
.posts-table tr.dragging {
  opacity: 0.5;
  background-color: var(--proc-accent-well);
}
/* ── Row state ──────────────────────────────────────────────────────────────
   Five states used to be five background tints: three of them the same green at
   4%, 7% and 16%, plus a warm favourite and a red overdue. Differences you could
   not name without a swatch beside you, and together they gave the title column
   an uneven ground all the way down the list — while leaving the two states that
   are genuinely different in kind (favourited, overdue) as just two more tints in
   a field of five.
   Now every row sits on the card, and state is a 3px bar down its leading edge.
   It reads at a glance, it stacks with :hover instead of competing with it, and
   the states that mean something else get a hue of their own back.
   The bar is an inset shadow on the leading cell rather than a border on the tr:
   no layout shift, and nothing that depends on how the collapsed border model
   paints row edges. */
.post-row { --row-mark: transparent; }

/* In depth order, so the later rule wins where a row is in more than one state:
   attention peaks at "completed, awaiting publish" and falls away once it is out
   the door — then favourite and overdue, which are not points on that scale. */
.posts-table tr.progress-published { --row-mark: var(--row-published); }
.posts-table tr.progress-near_complete { --row-mark: var(--row-near); }
.posts-table tr:is(.progress-completed, .progress-to_publish, .progress-on_x) { --row-mark: var(--row-done); }
.posts-table tr.favorited { --row-mark: var(--row-favorite); }
.post-row.is-overdue { --row-mark: var(--row-overdue); }

/* Published before yesterday: still in its place in the hand-ordered list, so a drag
   keeps it there, but out of sight until "More" adds .is-showing-older. */
#draft-x-tbody-process:not(.is-showing-older) .is-older-published { display: none; }
/* Dated today: a lighter ground, so the day stands out between what's gone out and
   what's still ahead. */
#draft-x-tbody-process .post-row.is-publish-today {
  background-color: rgba(34, 197, 94, 0.06);
}
#draft-x-tbody-process .post-row.is-publish-today:hover {
  background-color: rgba(34, 197, 94, 0.1);
}

/* ── Posts index: the two-column shell ──────────────────────────────────────
   The panel's column and the writing column are both --proc-measure wide, so opening the
   panel puts the same rows at the same width side by side rather than a squeezed copy
   beside the original. Nothing about the columns changes when it opens — only the
   gutters, which give up the room the second column needs to fit inside the 1190px cap
   .main-content puts on this page. */
.posts-shell { display: flex; align-items: flex-start; container-type: inline-size; }

#proc-column { flex: 1; min-width: 0; max-width: var(--proc-measure); }

/* The same measure with the Sections panel open or closed: a post row is as wide in the
   writing column as it is in the panel, whichever is showing. Open, a shell too narrow
   for two full measures gives each half of itself less the panel's chrome; closed, the
   column holds to that same width (100cqw is the shell), so opening the panel never
   changes a row's width. */
.posts-shell:not(:has(.sections-panel[data-expanded="true"])) #proc-column {
  max-width: min(var(--proc-measure), calc(50cqw - var(--sections-chrome)));
}

/* ── Posts index: the collapsible Sections column ───────────────────────── */
.sections-panel {
  flex: 0 0 auto;
  width: var(--sections-rail-w);
  transition: width var(--dur-base) ease;
  /* No fixed app header to clear, so the rail pins to the viewport top.
     The height is explicit rather than content-derived: collapsed, the rail
     holds only a button and a few icons, and a content-height panel would
     stop its right-hand divider halfway down the page. */
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: stretch;
  border-right: 1px solid var(--border-panel);
  box-sizing: border-box;
}
/* Never more than half the shell. The writing column shrinks when the shell cannot give
   it a full measure, and a panel that held its full width while that happened left the
   rows beside it wider than the rows they are meant to match. */
.sections-panel[data-expanded="true"] {
  width: min(var(--sections-panel-w), 50%);
}

/* Collapsed, the rail is still a table of contents: each section's own icon,
   in page order, jumping to that section when clicked. */
.sections-rail {
  width: var(--sections-rail-w);
  flex: 0 0 var(--sections-rail-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0.75rem 0;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 0;
}
.sections-toggle {
  background: none;
  border: 1px solid var(--proc-line);
  color: var(--proc-ink-dim);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: var(--fs-12);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.sections-toggle:hover {
  color: var(--proc-accent);
  border-color: var(--proc-accent);
}
.sections-toggle i {
  transition: transform var(--dur-base) ease;
}
.sections-panel[data-expanded="true"] .sections-toggle i {
  transform: rotate(180deg);
}
.sections-rail-count {
  font-size: var(--fs-10);
  color: var(--proc-ink-faint);
  letter-spacing: 0.04em;
}
.sections-rail-icons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding-top: 4px;
  border-top: 1px solid var(--proc-line);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}
.sections-rail-icon {
  background: none;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--proc-ink-faint);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: var(--fs-13);
  opacity: 0.7;
  transition: opacity var(--dur-fast) ease, background var(--dur-fast) ease;
}
.sections-rail-icon:hover {
  opacity: 1;
  color: var(--proc-accent);
  background: var(--surface-3);
}
.sections-rail-empty {
  font-size: var(--fs-10);
  color: var(--proc-ink-faint);
  writing-mode: vertical-rl;
  letter-spacing: 0.08em;
  padding-top: 6px;
}
.sections-panel[data-expanded="true"] .sections-rail-icons,
.sections-panel[data-expanded="true"] .sections-rail-count,
.sections-panel[data-expanded="true"] .sections-rail-empty {
  display: none;
}

.sections-body {
  display: none;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.75rem 1.25rem 2rem 0;
  overflow-y: auto;
  max-height: 100%;
  min-height: 0;
}
.sections-panel[data-expanded="true"] .sections-body {
  display: block;
}
.sections-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-panel);
}
.sections-body h2 {
  margin: 0;
  font-size: var(--fs-16);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--proc-ink);
}
.sections-head-count {
  margin-right: auto;
  color: var(--proc-ink-faint);
  font-size: var(--fs-11);
  font-variant-numeric: tabular-nums;
}
/* The same frame a step body puts around its table in the writing column: the border
   belongs to the wrapper and the table inside drops its own, so the rows come out at the
   identical width in both. Left to its own border the table was two pixels wider than the
   column it is meant to match — and, with no global border-box, rendered two wider still. */
.section-posts-wrapper {
  border: 1px solid var(--border-panel);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.section-posts-wrapper .posts-table {
  border: none;
  border-radius: 0;
}
/* Safety valve: on a window too narrow for a full-width panel, a row scrolls sideways
   inside its own section rather than being clipped by the panel edge. */
.sections-body .section-posts-wrapper {
  overflow-x: auto;
}

/* ── Posts index: one section's block in that panel ──────────────────────────
   Was 15 inline hex values and a mode switcher made of bare text glyphs (≡ ▤ —),
   which left the panel reading as a different app from the column beside it.
   Same ramp, same icon set, same button shapes as the writing column. */
.sec-block { margin-bottom: 2rem; }
.sec-block.is-sub {
  margin-bottom: 1rem;
  margin-left: 1.25rem;
  padding-left: 1rem;
  border-left: 2px solid color-mix(in srgb, var(--proc-accent) 22%, transparent);
}
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--proc-line);
}
.sec-block.is-sub .sec-head { margin-bottom: 0.5rem; }
.sec-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
  color: var(--proc-ink);
  font-size: var(--fs-16);
  font-weight: 600;
  letter-spacing: -0.015em;
}
h4.sec-name { font-size: var(--fs-13); font-weight: 500; color: var(--proc-ink-dim); }
.sec-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* How many posts are filed here — the one thing a collapsed section still needs to say. */
.sec-count {
  flex-shrink: 0;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--proc-ink-dim);
  font-size: var(--fs-10);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.sec-empty { padding: 18px 8px; font-size: var(--fs-12); }
.sec-name-arrow { color: color-mix(in srgb, var(--proc-accent) 45%, transparent); font-size: var(--fs-10); }
.sec-edit {
  flex-shrink: 0;
  color: var(--proc-ink-faint);
  font-size: var(--fs-10);
  line-height: 1;
  text-decoration: none;
  opacity: 0;
  transition: color var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.sec-block:hover .sec-edit,
.sec-edit:focus-visible { opacity: 1; }
.sec-edit:hover { color: var(--proc-ink); }

.sec-modes { display: flex; gap: 3px; flex-shrink: 0; }
/* At rest only the mode that is on is drawn — three buttons per section was a lot of
   furniture for a panel this narrow. The other two arrive with the cursor. */
.sec-mode:not(.is-on) { opacity: 0; }
.sec-block:hover .sec-mode,
.sec-modes:focus-within .sec-mode { opacity: 1; }
.sec-mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--proc-ink-faint);
  font-size: var(--fs-10);
  cursor: pointer;
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease,
              border-color var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.sec-mode:hover { color: var(--proc-ink); }
.sec-mode.is-on {
  border-color: var(--border-strong);
  background: var(--surface-3);
  color: var(--proc-ink);
}

/* "N more" only exists while semi mode is actually holding rows back. */
.section-show-more { display: none; text-align: center; padding: 6px 0; }
.section-show-more.is-shown { display: block; }
.sec-more {
  padding: 2px 8px;
  border: none;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--proc-ink-faint);
  font-size: var(--fs-11);
  cursor: pointer;
  transition: color var(--dur-fast) ease;
}
.sec-more:hover { color: var(--proc-ink); }
.sec-more i { font-size: var(--fs-9); }
.sections-new[hidden] { display: none; }
.sections-new {
  margin-bottom: 1.25rem;
  padding: 10px;
  border: 1px solid var(--border-panel);
  border-radius: var(--radius-sm);
  background: var(--proc-well);
}
.sections-new-form { display: flex; flex-direction: column; gap: 8px; }
.sections-new-line { display: flex; align-items: center; gap: 8px; }
.sections-new-label { color: var(--proc-ink-faint); font-size: var(--fs-11); white-space: nowrap; }
.sections-icon-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: 1px solid var(--proc-field-line);
  border-radius: var(--radius-xs);
  color: var(--proc-ink);
  font-size: var(--fs-14);
}
.sections-field {
  box-sizing: border-box;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--proc-field-line);
  border-radius: var(--radius-xs);
  background: var(--proc-field);
  color: var(--proc-ink);
  font-family: inherit;
  font-size: var(--fs-13);
  outline: none;
  transition: border-color var(--dur-fast) ease;
}
.sections-field.is-grow { flex: 1; }
.sections-field.is-small { padding: 5px 8px; font-size: var(--fs-12); }
.sections-field::placeholder { color: var(--proc-ink-faint); }
.sections-field:focus { border-color: var(--proc-accent); }
.sections-btn-add {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid #2a6030;
  border-radius: var(--radius-xs);
  background: #1a4020;
  color: #fff;
  font-size: var(--fs-12);
  cursor: pointer;
  transition: border-color var(--dur-fast) ease;
}
.sections-btn-add:hover { border-color: var(--proc-accent); }
.sections-btn-cancel {
  align-self: flex-start;
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--proc-field);
  color: var(--proc-ink-dim);
  font-size: var(--fs-12);
  cursor: pointer;
  transition: color var(--dur-fast) ease;
}
.sections-btn-cancel:hover { color: var(--proc-ink); }
/* Briefly rings a section after the rail jumps to it, so the eye lands. */
@keyframes sections-flash {
  from { background: var(--proc-accent-well); }
  to   { background: transparent; }
}
.category-section.is-flashed {
  animation: sections-flash var(--dur-slow) ease-out 2;
}

.sortable-ghost {
  background-color: var(--proc-line) !important;
  opacity: 0.7;
}
.task-row-hover-buttons i.fa-solid,
.task-row-hover-buttons i.star-priority {
  opacity: 0;
}
.task-row:hover .task-row-hover-buttons i.fa-solid,
.task-row:hover .task-row-hover-buttons i.star-priority {
  opacity: 1;
}
.subtask-inline-row:hover .task-row-hover-buttons i.fa-solid,
.subtask-inline-row:hover .task-row-hover-buttons i.star-priority {
  opacity: 1;
}
.task-row-hover-buttons .pencil-dropdown i.fa-solid {
  opacity: 1;
}
.task-row-hover-buttons .subtask-caret-always-visible i.fa-solid {
  opacity: 1;
  color: #e0e0e0;
}

/* Category header classes */
.category-header.green, .subcategory-header.green {
  background-color: #28a745 !important;
  color: #fff !important;
}
.category-header.completed-category, .subcategory-header.completed-category {
  background-color: #6c757d !important;
  color: #fff !important;
}
.category-header.red  , .subcategory-header.red {
  background-color: #721c24 !important;
  color: #fff !important;
}
tr.alert-success {
  background-color: #28a745;
  color: #121212;
}
tr.alert-danger {
  background-color: #a62934;
   color  : #121212;
}

.goal-editable,
.entry-editable,
.add-goal-editable {
  display: block;
}
.goal-editable::first-line,
.entry-editable::first-line,
.add-goal-editable::first-line {
  font-size: var(--fs-12);
}

/* Subcategory header default background - removed for dynamic coloring */
.subcategory-header {
  color: #fff !important;
}
/* Subcategory header icon colors */
.subcategory-header .fa-solid { color: #777; }
@media (hover: hover) { .subcategory-header .delete-cancel-cell:hover .fa-solid { color: white; } }
@media (hover: hover) { .subcategory-header .add-cell:hover .fa-solid { color: white; } }

/* Placeholder group border styling */

.block-group-row {
  background-color: #1c1c1c;
  border-left: 2px dashed #59636c !important;
  border-right: 2px dashed #59636c !important;
  border-bottom: none !important;
}

.block-group-row.group-end {
  border-bottom: 2px dashed #59636c !important;
}

.block-group-row.group-end td {
  border-bottom: 2px dashed #59636c !important;
}

.dragging.block-group-row {
  outline: 2px dashed #007bff !important;
  outline-offset: -2px;
}

.categories-column .block-group-row,
.category-show .block-group-row {
  border: none !important;
  background-color: transparent !important;
}

/* Blocks only mean something in the home page schedule column, so the category
   show page drops the dashed enclosure the schedule draws around them. */
.category-show .block-task {
  border-top: none !important;
}

.block-task {
  border-top: 2px dashed #59636c !important;
}
