/* ============================================================
   THINGS — the things index
   The LEDGER look again, with the outline tree inside it: each top-level thing is a card
   whose own row is the header, and everything nested sits as rows under guide lines.
   Each row carries the browsed month as a LEDGER strip, with its dials opening beneath
   it on a click, the way the rules and values rows do.
   ============================================================ */

/* The tree carries more per row than a rules or values list, so it gets a wider column. */
.ledger-page.is-wide { max-width: 1040px; }
/* A source's page is a record page: the same 848px content as .show-page. */
/* The task and journal show pages' width (.show-page: 880px inside its 16px sides) — this
   page's border-box 880 left it 32px narrower and its edges indented. */
.ledger-page.lib-show { max-width: 912px; padding-left: 16px; padding-right: 16px; }
/* show-topbar on a ledger page sits where .ledger-back did. */
.ledger-page > .show-topbar { margin: -8px 0 12px; }
/* The routine form's habits: a × to take one out, and a row to add one (routines/_form). */
.rtn-form-habit-remove { margin-left: 6px; padding: 2px 6px; border: none; border-radius: var(--radius-xs); background: none; color: var(--text-3); cursor: pointer; }
.rtn-form-habit-remove:hover { background: var(--surface-3); color: var(--danger-bright); }
.rtn-form-add { display: flex; gap: 6px; margin-top: 8px; }
.rtn-form-add-input { flex: 1 1 auto; min-width: 0; }
.rtn-form-add-select { flex: 0 1 180px; min-width: 0; }
.rtn-form-add-btn { padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-1); font: inherit; font-size: var(--fs-13); cursor: pointer; }
.rtn-form-add-btn:hover { background: var(--surface-3); }
/* Routine templates: under the cards, one line that opens them (routines/_templates). */
.rtn-templates-fold > summary { list-style: none; }
.rtn-templates-fold > summary::-webkit-details-marker { display: none; }
.rtn-templates-toggle { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--text-2); font-size: var(--fs-13); cursor: pointer; }
.rtn-templates-toggle:hover { color: var(--text-1); }
.rtn-templates-toggle i { font-size: var(--fs-11); color: var(--text-3); }
.rtn-templates-count { color: var(--text-3); }
.rtn-templates-fold[open] > .rtn-templates-toggle { display: none; }

.things-strip .ledger-day { cursor: default; }

/* A thing's condition as a dot: beside each name, and before each count on the Overall
   line. The same calm palette as the strips. */
.thing-status {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}
.thing-status.is-complete { background: #4ade80; }
.thing-status.is-mediocre { background: var(--warn); }
.thing-status.is-failed { background: #e5484d; }

/* The Overall line's counts, each a way to see just those things. */
.things-stats { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.things-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  text-decoration: none;
}
.things-stat .thing-status { margin-right: 1px; }
.things-stat:hover { color: var(--text-1); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }

/* Due for a checkup: the card at the top, nearest first, each answered in a tap. */
.things-due { margin-bottom: 12px; padding: 12px 14px 8px; }
.things-due-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.things-due-head .ledger-eyebrow i { margin-right: 4px; color: var(--gold-bright); }
.things-due-sum { color: var(--text-3); font-size: var(--fs-12); }
.things-due-sum .is-overdue { color: var(--danger-bright); }
.things-due-list { margin: 0; padding: 0; list-style: none; }
.things-due-row {
  display: grid;
  align-items: center;
  column-gap: 12px;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.035);
  transition: opacity var(--dur-fast) ease;
}
.things-due-row:first-child { border-top: none; }
.things-due-row.is-saving { opacity: 0.45; pointer-events: none; }
.things-due-body { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.things-due-trail { overflow: hidden; color: var(--text-3); font-size: var(--fs-11); text-overflow: ellipsis; white-space: nowrap; }
.things-due-dials { gap: 6px; }
.things-due-more {
  margin: 4px 0 2px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: var(--fs-12);
  cursor: pointer;
}
.things-due-more:hover { color: var(--text-1); }

/* Jump to a place, and fold or open the whole tree. */
.things-jump {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}
.things-jump-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.things-jump-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: var(--fs-12);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.things-jump-chip i, .things-jump-chip .icon-image { color: var(--text-3); font-size: var(--fs-11); }
.things-jump-chip:hover { border-color: var(--border-strong); background: var(--hairline); color: var(--text-1); }
.things-jump-tools { display: flex; flex-shrink: 0; gap: 4px; }
.things-jump-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: var(--fs-12);
  cursor: pointer;
}
.things-jump-tool i { font-size: var(--fs-10); }
.things-jump-tool:hover { background: var(--hairline); color: var(--text-1); }
.thing-card { scroll-margin-top: 16px; padding-bottom: 4px; }
.thing-card.is-jumped { animation: thing-jumped 1.4s ease-out; }
@keyframes thing-jumped {
  0%, 30% { box-shadow: 0 0 0 2px var(--border-strong); }
  100% { box-shadow: 0 0 0 2px transparent; }
}

.things-list { margin: 0; padding: 0; list-style: none; min-height: 4px; }
.things-list.is-root { min-height: 0; }

.thing-ghost { opacity: 0.4; background-color: var(--surface-3) !important; }

/* Guide lines for the nesting. The card's own stripe stands in for the first level, so
   only what sits inside a thing draws one. */
.thing-children,
.thing-tasks {
  margin-left: 17px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
}
.thing-tasks { margin-left: 40px; list-style: none; }

/* Rows: lead cluster · name and meta · strip · actions. The middle column is the only
   one that flexes, so the strips stay in a column down the card however deep a row is
   nested or however long its name. */
.thing-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 12px;
  padding: 7px 12px 7px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.035);
  transition: background-color var(--dur-fast) ease;
}
@media (hover: hover) { .thing-row:hover { background-color: rgba(255, 255, 255, 0.025); } }
.things-list:not(.is-root) > li:first-child > .thing-row { border-top-color: transparent; }

/* A top-level thing's row is its card's header: no hairline, a heavier name, and the
   card's accent under it. */
.thing-row.is-head {
  /* Same right padding as a plain row, so its strip lines up with theirs. */
  padding: 11px 12px 10px 12px;
  border-top: none;
  border-bottom: 1px solid color-mix(in srgb, var(--ledger-accent, #ffffff) 12%, transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
/* A card that's only its header (nothing inside it, no tasks under it): no line under the
   header, which was a divider with nothing after it. */
.thing-row.is-head:not(:has(~ * li)) { border-bottom-color: transparent; }
.thing-row.is-head .thing-name { font-size: var(--fs-14); font-weight: 600; }
.thing-row.is-head .thing-circle { width: 26px; height: 26px; }

.thing-lead { display: flex; align-items: center; gap: 7px; }

.thing-collapse-toggle,
.thing-collapse-spacer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: var(--fs-11);
}
.thing-collapse-toggle { cursor: pointer; }
.thing-collapse-toggle:hover { color: var(--text-1); }

/* The handle only appears on hover — a column of ⋮⋮ down every row was reading as noise,
   and the row it belongs to is obvious once you are over it. */
.thing-handle {
  flex-shrink: 0;
  color: var(--text-3);
  font-size: var(--fs-11);
  cursor: grab;
  user-select: none;
  opacity: 0;
  transition: opacity var(--dur-fast) ease;
}
.thing-row:hover .thing-handle { opacity: 1; }
.thing-handle:active { cursor: grabbing; }

.thing-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  font-size: var(--fs-11);
}
/* A photo takes the icon's place, filling the circle. */
.thing-circle.has-photo, .thing-circle:has(.thing-circle-photo) { overflow: hidden; background: none; }
.thing-circle-photo {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px var(--border);
}

.thing-body { min-width: 0; }
.thing-name-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.thing-name {
  overflow: hidden;
  color: var(--text-1);
  font-size: var(--fs-13);
  font-weight: 500;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thing-name:hover { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.thing-cat-dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; }
/* Sharing (ThingMembership): the avatars on a shared tree's head, the invitations above
   the list, and the panel under the form. */
.thing-share-chip { display: inline-flex; flex-shrink: 0; }
.thing-share-chip > span + span { margin-left: -4px; }
.thing-share-chip .soc-avatar { font-size: 8px !important; box-shadow: 0 0 0 1.5px var(--surface-row); }
.thing-share-chip .is-pending { opacity: 0.45; }
.thing-invites { margin-bottom: 16px; }
.thing-invites .soc-people { margin: 0; padding: 4px 14px 10px; }
.thing-invites .soc-person-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.thing-invite-name { color: var(--text-1); font-weight: 600; }
.thing-share-panel { margin: 0 20px 20px; padding-top: 16px; border-top: 1px solid var(--border-panel); }
.thing-share-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--text-1); font-size: var(--fs-14); font-weight: 600; }
.thing-share-title i { color: var(--text-3); }
.thing-share-panel .soc-people { margin: 0 0 10px; padding: 0; }
/* On the edit modal the panel sits between the fields and the footer, so it reads as
   part of the form; the note under its title says it doesn't wait for the arrow. */
.thing-share-note { margin: -6px 0 10px; color: var(--text-3); font-size: var(--fs-12); }
/* A link and notes, as icons with their text on hover — the row stays one line. */
.thing-flag {
  flex-shrink: 0;
  color: var(--text-3);
  font-size: var(--fs-10);
  text-decoration: none;
  cursor: help;
}
a.thing-flag { cursor: pointer; }
.thing-flag:hover, .thing-flag:focus-visible { color: var(--text-1); outline: none; }

.thing-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; min-width: 0; }
.thing-freq {
  flex-shrink: 0;
  padding: 1px 7px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-3);
  font-size: var(--fs-10);
  letter-spacing: 0.02em;
}
/* When the next checkup falls: quiet while it's a way off, orange when it's close, red
   once it has passed. */
.thing-due { flex-shrink: 0; color: var(--text-3); font-size: var(--fs-11); white-space: nowrap; }
.thing-due.is-near { color: var(--warn-bright); }
.thing-due.is-overdue { color: var(--danger-bright); }
/* What a container holds, or where a borrowed colour comes from. */
.thing-relation { overflow: hidden; color: var(--text-3); font-size: var(--fs-11); text-overflow: ellipsis; white-space: nowrap; }
.thing-relation.is-borrowed { font-style: italic; }

.thing-dot-form { display: inline-flex; margin: 0; }

/* Pin, add and delete. Held back until the row is hovered or focused — three of these on
   every row was most of what the page was showing. Space is reserved either way, so
   nothing shifts as the pointer moves down the list. */
.thing-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-shrink: 0; width: 58px; }
.thing-action {
  opacity: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: var(--fs-12);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.thing-row:hover .thing-action,
.thing-row:focus-within .thing-action { opacity: 1; }
.thing-action:hover { color: var(--text-1); }
/* A pinned thing keeps its pin showing: that is state, not an action. */

.thing-action.is-danger:hover { color: var(--danger-bright); }

/* The New Task card's close x (things/index's inline form), top right. */
.thing-taskform-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--text-3);
  font-size: var(--fs-14);
  cursor: pointer;
}
.thing-taskform-close:hover { color: var(--text-1); background-color: rgba(255, 255, 255, 0.06); }

/* Tasks hanging off a thing. */
/* Laid out like a home task row (things/_thing_task_row): box · title · hover tools ·
   delete · add, the tools and cells ghosted until the row is hovered. */
.thing-tasks { margin-top: 0; margin-bottom: 0; }
.thing-task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 0 0 8px;
  border-radius: var(--radius-xs);
}
@media (hover: hover) { .thing-task-row:hover { background-color: rgba(255, 255, 255, 0.025); } }
.thing-task-main { flex: 1; min-width: 0; padding: 4px 0; }
.thing-task-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.thing-task-due { color: var(--text-3); font-size: var(--fs-11); }
.thing-task-tag {
  background: rgba(168, 85, 247, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(168, 85, 247, 0.35);
  padding: 0.1rem 0.3rem;
  border-radius: 0.2rem;
  font-size: var(--fs-11);
}
.thing-task-tools { flex-shrink: 0; padding: 0.2rem; font-size: var(--fs-12); }
.thing-task-cell {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  text-decoration: none;
}
/* Out of sight until the row is hovered or focused: ghosted, they lined every task row
   with a faint x and + whether you meant to use them or not. */
.thing-task-cell i { opacity: 0; transition: opacity var(--dur-fast); }
.thing-task-row:hover .thing-task-cell i,
.thing-task-row:focus-within .thing-task-cell i { opacity: 1; }
.thing-task-cell.is-delete:hover { background-color: rgba(239, 68, 68, 0.13); }
.thing-task-cell.is-delete:hover i { color: #f87171; }
.thing-task-cell.is-add:hover { background-color: rgba(77, 159, 255, 0.13); }
.thing-task-cell.is-add:hover i { color: #79b8ff; }
.thing-task-cell.is-add { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }
.thing-task-box {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  padding: 0;
  border: 2px solid var(--text-3);
  border-radius: var(--radius-xs);
  background-color: transparent;
  cursor: pointer;
}
.thing-task-box.is-done { border-color: var(--accent); background-color: var(--accent); }
.thing-task-name { color: var(--text-2); font-size: var(--fs-12); text-decoration: none; }
.thing-task-name:hover { color: var(--text-1); }
.thing-task-name.is-done { color: var(--text-3); text-decoration: line-through; }
.thing-task-repeat { color: var(--text-3); font-size: var(--fs-10); }
/* Grabbed to move to another thing (thing_drag.js). */
.thing-task-row { cursor: grab; }
/* A thing with no tasks keeps an empty list that takes no room until a task is being
   dragged, when every thing's list opens up as a place to drop it. */
.thing-tasks.is-empty { min-height: 0; border-left-color: transparent; }
body.is-dragging-thing-task .thing-tasks { min-height: 22px; }
body.is-dragging-thing-task .thing-tasks.is-empty {
  margin-top: 2px;
  margin-bottom: 2px;
  border: 1px dashed var(--text-3);
  border-radius: var(--radius-xs);
}

@media (max-width: 860px) {
  .thing-row { column-gap: 8px; }
  .thing-actions { width: auto; }
  .thing-handle { display: none; }
  .thing-action { opacity: 1; }
}

/* A month of fixed 7px days is wider than a phone's row, so the strip drops to a line of
   its own under the name and stretches to fit, as it does on the rules index. */
@media (max-width: 720px) {
  .thing-row { row-gap: 8px; }
  .thing-row > .thing-track { grid-column: 2 / -1; grid-row: 2; align-items: stretch; min-width: 0; }
  /* The tools stay out of sight until the row is tapped (the index script marks it). */
  .thing-actions { display: none; }
  .thing-row.is-tapped { background-color: rgba(255, 255, 255, 0.03); }
  .thing-row.is-tapped > .thing-actions { display: flex; gap: 16px; }
  .thing-row.is-tapped .thing-action { font-size: var(--fs-14); }
  /* A tighter step per level, so a deep tree doesn't squeeze its names to nothing. */
  .thing-children { margin-left: 7px; padding-left: 7px; }
  .thing-tasks { margin-left: 22px; padding-left: 8px; }
  .things-jump { flex-direction: column; align-items: stretch; }
  .things-jump-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .things-jump-tools { justify-content: flex-end; }
  .things-due-row { row-gap: 6px; }
  .things-due-row > .things-due-dials { justify-self: start; }
  .things-due-trail { display: none; }
}

/* The thing form (things/_form), in the task form's frame: the name as the hero, the
   icon presets grouped and searchable, and the photo as a drop zone. */
.thing-form-card { width: min(640px, 100%); }
.thing-inline-form .thing-form-card { width: 100%; margin: 0; }
.thing-form .task-form-body { display: flex; flex-direction: column; gap: 12px; }
.thing-form .task-form-field { margin: 0; }
.thing-form .src-label { display: block; margin-bottom: 5px; }
.thing-form textarea.task-form-input { resize: vertical; min-height: 56px; }

.thing-form .icon-picker { display: flex; gap: 12px; }
.thing-form .icon-picker-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--recess);
  color: var(--text-1);
  font-size: var(--fs-18);
}
.thing-form .icon-picker-main { flex: 1; min-width: 0; }
.thing-form .icon-picker-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.thing-form .icon-picker-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 172px;
  margin-top: 8px;
  padding-right: 4px;
  overflow-y: auto;
}
.thing-form .icon-picker-group[hidden] { display: none; }
.thing-form .icon-picker-group-name {
  display: block;
  margin-bottom: 4px;
  color: var(--text-3);
  font-size: var(--fs-10);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.thing-form .icon-picker-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.thing-form .icon-picker-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--recess);
  color: var(--text-2);
  font-size: var(--fs-14);
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.thing-form .icon-picker-option[hidden] { display: none; }
.thing-form .icon-picker-option:hover { border-color: var(--border-strong); color: var(--text-1); }
.thing-form .icon-picker-option--active { border-color: #22c55e; background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.thing-form .icon-picker-none { margin: 0; color: var(--text-3); font-size: var(--fs-12); }

.thing-monthly-day-line { display: flex; align-items: center; gap: 10px; }
.thing-monthly-day-line .thing-monthly-day-input { width: 80px; }

.thing-drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--recess);
  color: var(--text-3);
  font-size: var(--fs-13);
  cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.thing-drop:hover, .thing-drop.is-over { border-color: #22c55e; background: rgba(34, 197, 94, 0.06); color: var(--text-1); }
.thing-drop-text { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.thing-drop-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thing-drop-preview { width: 56px; height: 56px; flex-shrink: 0; border-radius: var(--radius-sm); object-fit: cover; }
.thing-drop-preview[hidden] { display: none; }
.thing-drop.has-photo .thing-drop-text i { display: none; }
/* The real input covers the zone, invisible, so a click or a drop anywhere on it lands. */
.thing-drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.thing-image-remove { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--text-3); font-size: var(--fs-12); cursor: pointer; }

.thing-archive { display: flex; align-items: flex-start; gap: 8px; color: var(--text-3); font-size: var(--fs-12); line-height: 1.45; cursor: pointer; }
.thing-archive input { margin-top: 2px; flex-shrink: 0; }

.thing-form-cancel { padding: 0 6px 0 0; border: none; background: none; color: var(--text-3); font: inherit; font-size: var(--fs-13); cursor: pointer; }
.thing-form-cancel:hover { color: var(--text-1); }
.thing-form-nest {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--recess);
  color: var(--text-2);
  cursor: pointer;
}
.thing-form-nest:hover:not(:disabled) { color: var(--text-1); border-color: var(--border-strong); }
.thing-form-nest:disabled { opacity: 0.35; cursor: default; }
.thing-form .task-form-footer-left { display: flex; align-items: center; gap: 6px; }

@media (max-width: 560px) {
  .thing-form .icon-picker-inputs { grid-template-columns: 1fr; }
  .thing-form .icon-picker-preview { display: none; }
}

/* Find More Things (things/gallery): cards in a grid, filtered by category chips, each
   with a Save and a "+" that puts it straight inside one of your things. */
.things-gallery.gallery-page { max-width: 1040px; }
.things-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.things-gallery-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface-card);
  background-image: var(--sheen);
}
/* Its photo, across the top of the card edge to edge (cancelling the card's padding). */
.things-gallery-photo {
  flex-basis: calc(100% + 26px);
  margin: -12px -12px 2px -14px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--surface-3);
}
.things-gallery-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.things-gallery-card .thing-circle { width: 34px; height: 34px; font-size: var(--fs-14); }
.things-gallery-text { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
/* The name and cadence get the card's full width, with Save and "+" on a line of their own
   at the right — beside them the name was cut ("Smoke de…"). */
.things-gallery-card { flex-wrap: wrap; row-gap: 8px; }
.things-gallery-card .things-gallery-text { flex-basis: calc(100% - 46px); }
.things-gallery-card .things-gallery-actions { margin-left: auto; }
.things-gallery-name { color: var(--text-1); font-size: var(--fs-14); font-weight: 600; line-height: 1.3; }
.things-gallery-meta { color: var(--text-3); font-size: var(--fs-11); }
.things-gallery-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.things-gallery-place { position: relative; }
.things-gallery-place > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: var(--fs-11);
  list-style: none;
  cursor: pointer;
}
.things-gallery-place > summary::-webkit-details-marker { display: none; }
.things-gallery-place > summary:hover,
.things-gallery-place[open] > summary { border-color: var(--border-strong); color: var(--text-1); }
.things-gallery-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 190px;
  max-height: 280px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
}
.things-gallery-menu-title { padding: 4px 8px 6px; color: var(--text-3); font-size: var(--fs-10); letter-spacing: 0.06em; text-transform: uppercase; }
.things-gallery-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: var(--fs-13);
  text-decoration: none;
}
.things-gallery-menu-item i { width: 14px; color: var(--text-3); font-size: var(--fs-11); text-align: center; }
.things-gallery-menu-item:hover { background: var(--hairline); color: var(--text-1); }
@media (max-width: 720px) {
  .things-gallery.gallery-page { padding: 1.25rem 16px; }
}

/* ---- Things: Overdue's circles named at the ends; quieter empty bars ---- */
.things-due-row { grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; }
@media (max-width: 720px) {
  .things-due-row { grid-template-columns: auto auto auto minmax(0, 1fr); }
  .things-due-row > .things-due-dials { grid-column: 3; grid-row: 2; margin-left: 0; }
  .things-due-row > .thing-due { grid-column: 3 / -1; }
}
/* An empty month bar is a place to click to check up, not a button: a faint dashed edge
   in place of the bright outline (the current month's), its insides blank. */
.thing-track .ledger-strip.is-month:not(.is-filled) { box-shadow: none !important; outline: 1px dashed rgba(255, 255, 255, 0.14); outline-offset: -1px; border-radius: 6px; }
.thing-track .ledger-strip.is-month:not(.is-filled) .ledger-week,
.thing-track .ledger-strip.is-month:not(.is-filled) .ledger-day { box-shadow: none !important; border: none !important; background: transparent !important; }
.thing-track .ledger-strip.is-month:not(.is-filled):hover { outline-color: rgba(255, 255, 255, 0.3); }

/* The due card's dials as labelled pills (ThingsHelper#thing_due_dials), as a rule's are. */
.things-due-dials.is-labelled { display: inline-flex; gap: 6px; }
.things-due-dials.is-labelled .rate-dial {
  width: auto; height: 26px; padding: 0 11px;
  border-width: 1.5px; border-radius: 999px;
  color: var(--text-1); font: inherit; font-size: var(--fs-11); font-weight: 600; line-height: 1;
}
.things-due-dials.is-labelled .rate-dial::before { border-radius: 999px; }
.things-due-dials.is-labelled .rate-dial.is-on { color: #0a0a0c; }

/* Folded "Coming up" rows stay folded: the row's display: grid outranked [hidden]. */
.things-due-row[hidden] { display: none; }

/* Touch screens have no hover: the delete and add cells wait behind the row's ellipsis
   (row_tools.js opens it with .row-tools-open), so a task row shows one control, not three. */
@media (hover: none) {
  .thing-task-row .thing-task-cell { display: none; }
  .thing-task-row.row-tools-open .thing-task-cell { display: flex; }
  .thing-task-row.row-tools-open .thing-task-cell i { opacity: 1; }
}

/* ---- Things polish: tinted dials, phone header and due card ---- */
/* The strip's dials wear their tone faintly before one's picked, as on Rules and Values. */
.things-page .ledger-dials-row .rate-dial:not(.is-on) { border-color: color-mix(in srgb, var(--dial) 55%, transparent); }
@media (max-width: 720px) {
  /* The name gets the row: the circle, the name, when it's due; the three ratings on a
     line of their own under the name. Squeezed beside them, "Fiddle leaf fig" read "Fiddl…". */
  .things-due-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .things-due-row > .things-due-body { grid-column: 2; grid-row: 1; }
  .things-due-row > .thing-due { grid-column: 3; grid-row: 1; }
  .things-due-row > .things-due-dials { grid-column: 2 / -1; grid-row: 2; justify-self: start; }
  .things-due-body .thing-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 640px) {
  /* The month switcher smaller and to the right, as on Rules and Values. */
  .things-page .ledger-head { flex-wrap: wrap; row-gap: 8px; }
  .things-page .ledger-head .ledger-month { order: 0; width: auto; margin-left: auto; justify-content: flex-end; }
  .things-page .ledger-head .ledger-month-label { min-width: 0; padding: 0 6px; font-size: var(--fs-13); }
  .things-page .ledger-head .ledger-nav-btn { width: 24px; height: 24px; border-color: transparent; }
}

/* The form: the search alone on its line, the raw icon field behind "Custom icon or
   emoji", and a hairline where the optional fields under More begin. */
.thing-form .icon-picker-inputs { grid-template-columns: minmax(0, 1fr); }
.thing-form .icon-picker-custom { margin: 6px 0 2px; }
.thing-form .icon-picker-custom > summary {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-3); font-size: var(--fs-11); cursor: pointer; list-style: none;
}
.thing-form .icon-picker-custom > summary::-webkit-details-marker { display: none; }
.thing-form .icon-picker-custom > summary::before { content: '+'; font-weight: 600; }
.thing-form .icon-picker-custom[open] > summary::before { content: '−'; }
.thing-form .icon-picker-custom > summary:hover { color: var(--text-1); }
.thing-form .icon-picker-custom .task-form-input { margin-top: 6px; }
.thing-form .src-more { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--hairline); }

/* No things yet: the heading over the panel's left edge rather than off at the page's. */
.things-empty .ledger-head { max-width: 440px; margin-left: auto; margin-right: auto; }
/* Find More Things' picks, on the empty page and under a short list: a compact row with
   the gallery's photo as a square thumbnail at its left, the Save at its right. */
:is(.things-empty, .things-page) .starter-picks .gallery-list > .gallery-item:has(.gallery-item-image) {
  flex-direction: row; align-items: center; gap: 12px; min-height: 0; padding: 10px 12px;
}
:is(.things-empty, .things-page) .starter-picks .gallery-item-image {
  width: 52px; height: 52px; aspect-ratio: 1; border-radius: var(--radius-sm);
}

/* Due for a checkup, folded to one line: what's due (each name a jump to its row in the
   tree), the count, and Check in, which opens the list with its one-tap answers. */
details.things-due { padding-bottom: 12px; }
details.things-due[open] { padding-bottom: 8px; }
.things-due > summary.things-due-head { display: flex; align-items: baseline; gap: 10px; margin: 0; list-style: none; cursor: pointer; }
.things-due > summary.things-due-head::-webkit-details-marker { display: none; }
details.things-due[open] > summary.things-due-head { margin-bottom: 6px; }
.things-due-names { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--text-2); font-size: var(--fs-13); text-overflow: ellipsis; white-space: nowrap; }
.things-due-name { color: var(--text-1); text-decoration: none; }
.things-due-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.things-due-toggle { flex: 0 0 auto; color: var(--text-2); font-size: var(--fs-12); white-space: nowrap; }
.things-due-toggle i { margin-left: 4px; font-size: 0.8em; transition: transform var(--dur-fast); }
details.things-due[open] .things-due-toggle i { transform: rotate(180deg); }
.things-due > summary:hover .things-due-toggle { color: var(--text-1); }
@media (max-width: 600px) {
  .things-due > summary.things-due-head { flex-wrap: wrap; row-gap: 4px; }
  .things-due-names { order: 3; flex-basis: 100%; }
}

/* Sections in a four-column frame: a full one spans it, a one- or two-card one takes half,
   so two small sections share a row. */
.things-gallery-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; }
.things-gallery-sections > .gallery-section { grid-column: 1 / -1; min-width: 0; }
.things-gallery-sections > .gallery-section.is-small { grid-column: auto; }
.things-gallery-sections > .gallery-section.is-small .things-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) {
  .things-gallery-sections > .gallery-section.is-small { grid-column: 1 / -1; }
}
