/* ============================================================
   ROUTINES (second pass)
   ============================================================ */

/* The routine's name opens its editor; a pencil says so under the pointer. */

.rtn-card-edit { color: var(--text-3); font-size: var(--fs-10); opacity: 0; transition: opacity var(--dur-fast) ease; }
.rtn-card-link:hover .rtn-card-edit,
.rtn-card-link:focus-visible .rtn-card-edit { opacity: 1; }

/* Taking a habit out of the routine, from its row. */
.rtn-row-remove-form { display: contents; }
.rtn-row-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  border: none; border-radius: var(--radius-sm); background: transparent;
  color: var(--text-3); font-size: var(--fs-11); cursor: pointer;
  opacity: 0; transition: opacity var(--dur-fast) ease, color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.rtn-row:hover .rtn-row-remove,
.rtn-row-remove:focus-visible { opacity: 1; }
.rtn-row-remove:hover { color: var(--danger-bright); background: color-mix(in srgb, var(--danger-bright) 12%, transparent); }
@media (hover: none) { .rtn-row-remove { opacity: 0.6; } }

/* ROUTINE FORM — on the tokens the app's other popups use. */
.rtn-form-field { margin-bottom: 1.15rem; }
.rtn-form-label {
  display: flex; align-items: center; gap: 6px; margin-bottom: 0.4rem;
}
.rtn-form-count { color: var(--text-2); letter-spacing: 0; }
.rtn-form-hint { margin: 0.35rem 0 0; color: var(--text-3); font-size: var(--fs-11); }
.rtn-form-input, .rtn-form-textarea {
  width: 100%; box-sizing: border-box; padding: 0.55rem 0.7rem;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04); color: var(--text-1);
  font-family: inherit; font-size: var(--fs-14);
  transition: border-color var(--dur-fast) ease;
}
.rtn-form-input::placeholder, .rtn-form-textarea::placeholder { color: var(--text-3); }
.rtn-form-input:focus, .rtn-form-textarea:focus { outline: none; border-color: var(--border-strong); }
.rtn-form-textarea { resize: vertical; }
.rtn-form-link-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.rtn-form-remove-label { display: flex; align-items: center; gap: 0.3rem; color: var(--text-3); font-size: var(--fs-11); white-space: nowrap; cursor: pointer; }
.rtn-form-remove-label input, .rtn-form-image-remove input { width: auto; margin: 0; accent-color: var(--danger-bright); }
.rtn-form-dashed-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 0.4rem 0.7rem;
  border: 1px dashed var(--border); border-radius: var(--radius-md); background: transparent;
  color: var(--text-3); font: inherit; font-size: var(--fs-12); cursor: pointer;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.rtn-form-dashed-btn i { font-size: var(--fs-10); }
.rtn-form-dashed-btn:hover { border-color: var(--border-strong); color: var(--text-1); }

/* Images: a button of the app's own, with what's picked shown before saving. */
.rtn-form-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.rtn-form-file-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 0.4rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.04);
  color: var(--text-2); font-size: var(--fs-12); cursor: pointer;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.rtn-form-file-btn:hover { border-color: var(--border-strong); color: var(--text-1); }
.rtn-form-file:focus-visible + .rtn-form-file-btn { outline: 2px solid var(--accent); outline-offset: 2px; }
.rtn-form-images { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.rtn-form-images:not(:empty) { margin-bottom: 0.6rem; }
.routine-images-preview:not(:empty) { margin: 0.6rem 0 0; }
.rtn-form-image-wrap { text-align: center; }
.rtn-form-image { display: block; width: 64px; height: 64px; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius-md); }
.rtn-form-image-remove { display: flex; justify-content: center; align-items: center; gap: 0.25rem; margin-top: 0.25rem; color: var(--text-3); font-size: var(--fs-10); cursor: pointer; }

/* The habits in it, read-only. */
.rtn-form-habits { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border: 1px solid var(--border-panel); border-radius: var(--radius-md); }
.rtn-form-habits li { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-top: 1px solid var(--border-panel); color: var(--text-1); font-size: var(--fs-13); }
.rtn-form-habits li:first-child { border-top: none; }
.rtn-form-habits .rtn-cat-dot { flex-shrink: 0; box-shadow: inset 0 0 0 1px var(--border-strong); }
.rtn-form-habit-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtn-form-habit-tag { padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-3); font-size: var(--fs-10); }

/* Icon: the presets, the chosen one in the accent, and a custom one folded below. */
.rtn-form-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.rtn-form-icon-grid label {
  position: relative; display: flex; align-items: center; justify-content: center; height: 34px;
  border: 1px solid transparent; border-radius: var(--radius-md); color: var(--text-3); cursor: pointer;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.rtn-form-icon-grid label:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-1); }
.rtn-form-icon-grid input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.rtn-form-icon-grid label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.rtn-form-icon-grid label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.rtn-form-custom { margin-top: 0.6rem; }
.rtn-form-custom summary { width: max-content; color: var(--text-3); font-size: var(--fs-12); cursor: pointer; }
.rtn-form-custom summary:hover { color: var(--text-1); }
.rtn-form-custom[open] summary { margin-bottom: 0.5rem; }

.rtn-form-errors {
  margin-bottom: 1rem; padding: 0.6rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--danger-bright) 35%, transparent); border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--danger-bright) 8%, transparent); color: var(--danger-bright); font-size: var(--fs-12);
}
.rtn-form-errors h2 { margin: 0 0 0.3rem; font-size: var(--fs-11); font-weight: 700; }
.rtn-form-errors ul { margin: 0; padding-left: 1.1rem; }
.rtn-form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; margin-top: 1.5rem; }
.rtn-form-actions-left { display: flex; align-items: center; gap: 6px; margin-right: auto; }
/* In the popup the actions row is the card's footer, full-bleed past the body's padding. */
.rtn-form-modal .rtn-form-actions {
  margin: 1.25rem -16px 0; padding: 12px 16px;
  border-top: 1px solid var(--border-panel); background: var(--recess);
}

.rtn-form-cancel { padding: 8px 12px; border: none; background: transparent; color: var(--text-3); font: inherit; font-size: var(--fs-13); cursor: pointer; }
.rtn-form-cancel:hover { color: var(--text-1); }

/* A template's "Category for all", beside its section's label; a row's own picker then
   shows at rest only where it differs (routine-template#markExceptions). */
.rtn-tpl-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.rtn-tpl-label-row .rtn-tpl-label { margin-bottom: 0; }
.rtn-tpl-all { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: var(--fs-11); }
.rtn-tpl-all-select {
  max-width: 150px; padding: 3px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--recess); color: var(--text-2); font: inherit; font-size: var(--fs-11); cursor: pointer;
}
.rtn-tpl-all-select option { background: var(--surface-2); color: var(--text-1); }
.rtn-tpl-cat.is-quiet { opacity: 0; transition: opacity var(--dur-fast) ease; }
.rtn-tpl-row:hover .rtn-tpl-cat.is-quiet,
.rtn-tpl-cat.is-quiet:focus-within { opacity: 1; }
@media (hover: none) { .rtn-tpl-cat.is-quiet { opacity: 0.6; } }

/* The stats pages as tabs (stats/_tabs): Overview, Posts, Sources. */
.stats-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.02); }
.stats-tab { padding: 4px 12px; border-radius: var(--radius-sm); color: var(--text-3); font-size: var(--fs-13); font-weight: 500; text-decoration: none; transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease; }
.stats-tab:hover { color: var(--text-1); }
.stats-tab.is-current { background: var(--surface-2); color: var(--text-1); }

/* The Stats dashboard's ranges: rolling windows on one row, Month, Year and Today on a
   second, so none is cut to "M…". */

/* The stats pages with nothing to report yet (stats, sources/stats): one panel on how
   the page fills in, in place of zeros. */
.stats-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  max-width: 560px; margin: 24px auto; padding: 32px 24px; text-align: center;
  border: 1px solid var(--border-panel); border-radius: var(--radius-lg);
  background-color: var(--surface-card); background-image: var(--sheen);
}
.stats-empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-size: 20px; }
.stats-empty-title { margin: 4px 0 0; color: var(--text-1); font-size: var(--fs-16); font-weight: 600; }
.stats-empty-text { margin: 0; max-width: 420px; color: var(--text-2); font-size: var(--fs-13); line-height: 1.55; }
.stats-empty-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; margin: 10px 0 0; padding: 0; list-style: none; }
.stats-empty-links a {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-1); font-size: var(--fs-13); text-decoration: none; text-align: left;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.stats-empty-links a i { width: 16px; color: var(--accent); text-align: center; }
.stats-empty-links a:hover { border-color: var(--border-strong); background: var(--surface-2); }
@media (max-width: 720px) { .stats-empty-links { grid-template-columns: minmax(0, 1fr); } }

/* The three stats pages share one header (title, tabs, and the page's own controls on
   the right) and one width, so the tabs sit in the same place on each. */
/* Top-aligned: centred, the title sat 6px lower on Posts and Sources (one 44px row with
   the back chip) than on the Overview (whose range bar wraps to a row of its own). */
.stats-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px 20px; min-height: 44px; margin-bottom: 20px; }
.stats-title { margin: 0; color: var(--text-1); font-size: var(--fs-24); font-weight: 700; }
/* The Overview's own padding (.stats-page, stats/_styles), so the title and tabs hold
   still between the three tabs; 4.5rem dropped them 36px on Posts and Sources. */
.ledger-page.stat-stats { max-width: 1200px; padding: 2.25rem 6rem 9rem; }
@media (max-width: 1024px) { .ledger-page.stat-stats { padding: 3.25rem 3rem 6rem; } }
@media (max-width: 768px) { .ledger-page.stat-stats { padding: 2.5rem 1.5rem 4.5rem; } }

/* Monthly Review: a miss as a red wash with an edge; the overall strip's key; empty
   scored sections as one quiet line; the inspiration without a second frame. */
.mr-strip .ledger-day.is-missed { box-shadow: inset 0 0 0 1px rgba(220, 53, 69, 0.5); }
.mr-strip-key { margin: 8px 0 0; }
.mr-empty-sections { margin: 4px 0 16px; padding: 0 2px; color: var(--text-3); font-size: var(--fs-12); }
.mr-empty-sections a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.mr-empty-sections a:hover { color: var(--text-1); }
.mr-inspiration .inspiration-card .inspiration-card-body,
.mr-inspiration .inspiration-card:hover .inspiration-card-body { border-color: transparent; background: none; background-image: none; box-shadow: none; padding-inline: 2px; }

/* The Monthly Review's inspiration ends where its quote does. */

.mr-inspiration .inspiration-card { margin: 0; }
.mr-inspiration .insp-card-text { padding: 8px 2px 4px; }

/* Printed (or saved as PDF), second pass: the title and the reflection in ink on white,
   the quote legible, and nothing printed that only says what's missing or asks for
   something to be done — the unfinished-review banner, empty cards, the empty-sections
   line, the journal link. */
@media print {
  html, body { background: #fff !important; }
  .mr-gaps, .mr-card-empty, .mr-empty-sections, .mr-card-foot, .mr-edit-link,
  .mr-page .ledger-card:has(> * > .mr-card-empty), .mr-page .ledger-card:has(.mr-card-empty) { display: none !important; }
  .mr-page .ledger-title, .mr-page .ledger-title .is-current { color: #111 !important; }
  .mr-reflection-display { background: none !important; border: 1px solid #ddd !important; color: #111 !important; }
  .mr-inspiration .insp-quote { color: #111 !important; }
  .mr-inspiration .insp-author, .mr-highlights .mr-highlight-label, .stat-tile-label, .stat-tile-sub { color: #555 !important; }
  .mr-page .ledger-card-head { background: none !important; border-color: #ddd !important; }
  .mr-page a { color: #111 !important; text-decoration: none !important; }
}

/* The source form the "+" on a Library row opens in the list (library_quick_add_controller):
   the task form's card, at the indent of the rows around it, staying open after each save. */
.lib-inline-form-row { display: block; padding: 6px 14px 10px var(--lib-gutter, 14px); list-style: none; }
.lib-inline-card { max-width: 680px; margin: 0; }
.lib-inline-card .task-form-header { padding-top: 10px; padding-bottom: 10px; }
.lib-inline-hint { color: var(--text-3); font-size: var(--fs-12); }
.lib-inline-hint.is-error { color: #f87171; }
@media (max-width: 600px) { .lib-inline-form-row { padding-right: 6px; } }
.task-form-submit.lib-inline-save { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 8px 16px; font-size: var(--fs-14); }

/* The landing page's emphasis, used sparingly in the app on its selling moments
   (the Premium page and the upgrade modal): Chakra Petch italic, light blue. */
.brand-em {
  font-family: 'Chakra Petch', 'Inter', sans-serif;
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #b4c4ff;
}

/* Settings: the avatar as it is, with Change opening the picker. */
.set-avatar-picker[hidden] { display: none; }
.set-avatar-picker { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-row); }
/* Icons wait in grey; only the chosen one takes the colour. */
.set-avatar-icons .set-avatar-opt .soc-avatar { background: var(--surface-3); color: var(--text-2); opacity: 1; }
.set-avatar-icons .set-avatar-opt:hover .soc-avatar { color: var(--text-1); background: var(--border-strong); }
.set-avatar-icons .set-avatar-opt input:checked + .soc-avatar { background: hsl(var(--soc-hue) 45% 30%); color: hsl(var(--soc-hue) 80% 88%); }
/* The username's Save sits beside its field. */
.set-username-row { display: flex; align-items: center; gap: 8px; }
.set-username-row .set-input { flex: 1; min-width: 0; }
.set-use-suggestion { align-self: flex-end; font-size: var(--fs-11); }

/* ---- Calendar polish (calendars/index) ---- */

/* A past day's finished tasks, folded into one line (see fitMonthCell). */
.cal-done-summary {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  margin: 0 0 2px;
  padding: 2px 6px;
  border: none;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-3);
  font: inherit;
  font-size: var(--fs-11);
  text-align: left;
  cursor: pointer;
}
.cal-done-summary i { color: var(--accent-bright); font-size: 0.85em; }
.cal-done-summary:hover { background: rgba(255, 255, 255, 0.07); color: var(--text-2); }
.cal-done-summary[hidden] { display: none; }

/* Weekends: a faint lift that stacks on a day's other tint (past, today). */
#cal-root .cal-cell.is-weekend,
#cal-root .week-allday-cell.is-weekend,
#cal-root .week-col-hdr.is-weekend { background-image: linear-gradient(rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.028)); }
/* ...and before the account existed, both: the lift, under the hatch it would otherwise
   replace (05-calendar.css, .is-before-signup), so a new account's first weekend reads
   like the weekdays around it rather than as a pair of days it missed. */
#cal-root .cal-cell.is-weekend.is-before-signup,
#cal-root .week-allday-cell.is-weekend.is-before-signup,
#cal-root .week-col-hdr.is-weekend.is-before-signup {
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 6px, transparent 6px 12px),
                    linear-gradient(rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.028));
}
#cal-root .week-allday-cell.is-past .cal-month-pill { opacity: 0.75; }
#cal-root .week-allday-cell.is-past .cal-month-pill.tg-completed { opacity: 0.45; }

@media (min-width: 641px) {
  /* The columns end after their tasks, with room enough to drop one into a quiet week —
     they used to fill the window, which left the day's rules and value bar stranded a
     screen's height below a short day. */
  #cal-root.cal-view-week .week-allday-row { min-height: 240px; }
  #cal-root.cal-view-week .week-allday-row.is-empty { display: flex; }
  #cal-root .week-allday-cell { gap: 5px; padding: 6px 5px; }
  #cal-root .week-allday-cell .cal-month-pill:not(.cal-block-band) {
    padding: 6px 8px;
    font-size: var(--fs-13);
    border-radius: var(--radius-sm);
    /* Its cancel and add float over the pill's corner on hover rather than holding a
     column of their own, which squeezed the title to a word a line. */
    position: relative;
  }
  #cal-root .week-allday-cell .cal-month-pill:not(.cal-block-band) .cal-pill-title {
    -webkit-line-clamp: 3;
    line-height: 1.35;
  }
  #cal-root .week-allday-cell .cal-month-pill:not(.cal-block-band) .cal-pill-btn {
    position: absolute;
    top: 4px;
    padding: 2px 4px;
    border-radius: var(--radius-xs);
    background: var(--surface-pop);
    font-size: var(--fs-10);
    z-index: 2;
  }
  #cal-root .week-allday-cell .cal-month-pill:not(.cal-block-band) .cal-pill-add { right: 4px; }
  #cal-root .week-allday-cell .cal-month-pill:not(.cal-block-band) .cal-pill-cancel { right: 26px; }
}

@media (max-width: 640px) {
  /* A day list's cancel and add stay within reach but step back until you need them. */
  .week-agenda-pills .cal-pill-btn { opacity: 0.32; }
  /* The phone's month: a day where everything got done wears a ring on its number. */
  .cal-view-month .cal-cell.is-all-done:not(.is-today) .cal-day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    box-shadow: inset 0 0 0 1.5px var(--accent);
    border-radius: 50%;
  }
  #cal-root .cal-cell.has-progress::after { left: 4px; right: 4px; bottom: 3px; height: 2px; }
}

/* ---- Notes polish ---- */

/* The editor toolbar's wrapper and its › (see notes/edit). */
.ane-toolbar-wrap { position: relative; flex-shrink: 0; }
.ane-toolbar-more { display: none; }
@media (max-width: 760px) {
  .ane-toolbar-more {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    border: none;
    background: linear-gradient(to right, transparent, var(--surface-card) 45%);
    color: var(--text-2);
    font-size: var(--fs-12);
    cursor: pointer;
  }
  .ane-toolbar-more[hidden] { display: none; }
}

/* ---- Rules & Values polish ---- */
/* Today's box, while it's still to be marked: a lighter fill and a ring that breathes a
   couple of times, so the box that matters most reads as the one to press. */
.ledger-day.is-today-open { background: rgba(255, 255, 255, 0.2); animation: ledger-today 1.6s ease-in-out 2; }
@keyframes ledger-today {
  50% { box-shadow: 0 0 0 2.5px var(--text-1); }
}
@media (prefers-reduced-motion: reduce) { .ledger-day.is-today-open { animation: none; } }

/* Wide screens: the list widens and the daily bars with it, so they're bigger targets. */
@media (min-width: 1400px) {
  .ledger-page.is-scored { max-width: 1040px; }
  .ledger-page.is-scored .ledger-track .ledger-day { width: 11px; height: 20px; }
}

/* ---- Journal polish ---- */
/* Today's Save is full strength once there's something to save (journals/index script),
   rather than dim until focused. */
/* Something written: full strength, so it plainly reads as ready. */
.jd-today.has-text .jd-today-save { opacity: 1; }
/* The year strip: each month's entry count beside its name. */
.jd-strip-count { margin-left: 4px; color: var(--text-2); font-size: 0.85em; font-weight: 600; }
.ledger-strip.jd-streak .ledger-day.is-rated .jd-strip-count { color: var(--text-1); }
@media (max-width: 640px) {
  /* A phone has no room for "Oct 7": just its letter. */
  .ledger-strip.jd-streak .ledger-day[data-short]:not([data-short=""])::before {
    content: attr(data-short);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
  }
  .ledger-strip.jd-streak .ledger-day.is-rated[data-short]::before { color: var(--text-1); }
}

/* ---- Library polish ---- */
/* A cover that came back blank (application.js, checkCovers): the kind's icon on a soft
   tile instead, and in a list row no tile at all. */
.lib-row-cover.is-blank-cover { display: none; }
.lib-head-cover > i, .gallery-item-image > i { display: none; }
.lib-head-cover.is-blank-cover img, .gallery-item-image.is-blank-cover img { display: none; }
.lib-head-cover.is-blank-cover, .gallery-item-image.is-blank-cover, .gallery-item-image.is-blank {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--surface-3), var(--surface-2));
  color: var(--text-3);
}
.lib-head-cover.is-blank-cover > i, .gallery-item-image.is-blank-cover > i, .gallery-item-image.is-blank > i { display: block; font-size: 1.3em; }
.lib-head-cover.is-blank-cover > i { font-size: 30px; }
.gallery-item-image.has-picture { position: relative; overflow: hidden; }
.gallery-item-image.has-picture img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* A label on a gallery picture (badge:), e.g. Tasks' "Built-in" habits. */
.gallery-item-image:has(.gallery-item-badge) { position: relative; }
.gallery-item-badge {
  position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.68); color: #fff; font-size: var(--fs-11); font-weight: 600; letter-spacing: 0.02em;
}

/* All's list ends by saying where the earlier-finished items went. */
.lib-finished-note { display: flex; align-items: center; gap: 8px; margin: 10px 4px 0; color: var(--text-3); font-size: var(--fs-12); }
.lib-finished-note i { color: var(--accent-bright); font-size: 0.9em; }
.lib-finished-note a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--border-strong); }
.lib-finished-note a:hover { color: var(--text-1); }

/* The Find More gallery's covers as a shelf: a grid of covers with the title under each,
   rather than a column of wide rows (shared/gallery, .is-shelf). */
.gallery-list.is-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }
.gallery-list.is-shelf > .gallery-item { flex-direction: column; align-items: stretch; gap: 8px; padding: 0; border: none; background: none; }
.gallery-list.is-shelf .gallery-item-image { width: 100%; height: auto; aspect-ratio: 2 / 3; border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); }
.gallery-list.is-shelf .gallery-item-image > i { font-size: 28px; }
.gallery-list.is-shelf .gallery-item-title { font-size: var(--fs-13); line-height: 1.35; }
.gallery-list.is-shelf .gallery-actions, .gallery-list.is-shelf .gallery-saved { align-self: flex-start; }
@media (max-width: 640px) {
  .gallery-list.is-shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
  .gallery-list.is-shelf .gallery-item-meta { display: none; }
}
/* A section's own button at its heading's right (Your Channels), and the line standing in
   for a list with nothing in it yet. */
.gallery-section-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: none;
}
.gallery-section-link:hover { border-color: var(--border-strong); color: var(--text-1); }
.gallery-section-title .gallery-section-link i { color: inherit; font-size: var(--fs-11); }
.gallery-section-empty { margin: 0 0 2rem; color: var(--text-3); font-size: var(--fs-13); }

/* The YouTube channels modal (youtube_channels/index). */
.yt-channels-card { width: min(560px, 100%); }
.yt-channels-card .lib-form-title i { color: #ff3b3b; margin-right: 4px; }
.yt-channels-notice { margin: 0 0 1rem; padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: 10px; color: var(--text-2); font-size: var(--fs-13); }
.yt-channels-file { color: var(--text-2); font-size: var(--fs-13); max-width: 100%; }
.yt-channels-heading { display: flex; gap: 0.5rem; margin: 1.5rem 0 0.5rem; color: var(--text-2); font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.yt-channels-list { max-height: 320px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.yt-channel { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.yt-channel-title { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--text-1); font-size: var(--fs-14); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.yt-channel-title:hover { text-decoration: underline; }
.yt-channel-status { flex: none; color: var(--text-3); font-size: var(--fs-12); }
.yt-channel-status.is-error { color: #e08a92; }
.yt-channel-remove-form { flex: none; margin: 0; }
.yt-channel-remove { padding: 4px 8px; border: none; background: none; color: var(--text-3); cursor: pointer; }
.yt-channel-remove:hover { color: var(--text-1); }

/* ---- Monthly review polish ---- */
/* Its highlights in one row, however many there are (up to five), rather than four and
   one left over; on a phone, a compact list two across. */
.mr-highlights { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
@media (max-width: 900px) {
  .mr-highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid var(--border-panel); border-radius: var(--radius-md); background: var(--surface-card); overflow: hidden; }
  .mr-highlights li { padding: 8px 10px; border: none; border-radius: 0; background: none; border-top: 1px solid var(--hairline); }
  .mr-highlights li:nth-child(-n+2) { border-top: none; }
  .mr-highlights li:nth-child(odd) { border-right: 1px solid var(--hairline); }
  .mr-highlights li:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: none; }
  .mr-highlight-text { font-size: var(--fs-12); }
}
/* A phone: Email and Print beside the title, the month under them, rather than the two
   icons on a line of their own. */
/* A phone: the month beside the title, and Email and Print behind ⋯ (mr-head-more). */
.mr-head-more { position: relative; display: none; }
.mr-head-more > summary { list-style: none; }
.mr-head-more > summary::-webkit-details-marker { display: none; }
.mr-head-more-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; display: flex; flex-direction: column; min-width: 150px; padding: 4px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-pop); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.mr-head-more-menu form { display: flex; margin: 0; }
.mr-head-more-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: none; border-radius: var(--radius-sm);
  background: none; color: var(--text-2); font: inherit; font-size: var(--fs-13); text-align: left; cursor: pointer;
}
.mr-head-more-item:hover { background: var(--surface-2); color: var(--text-1); }
@media (max-width: 640px) {
  .mr-page > .ledger-head { flex-wrap: nowrap; gap: 8px; }
  .mr-page > .ledger-head .ledger-title { font-size: var(--fs-18, 18px); white-space: nowrap; }
  .mr-page .mr-head-right { flex-wrap: nowrap; gap: 4px; margin-left: auto; }
  .mr-page .mr-head-right > form, .mr-page .mr-head-right > .mr-head-action { display: none; }
  .mr-head-more { display: block; }
  .mr-page .ledger-month .ledger-month-label { min-width: 0; padding: 0 6px; white-space: nowrap; }
  .mr-page .ledger-month { gap: 2px; }
  .mr-page .mr-progress-badge { display: none; }
  /* Rule tags make way for the rule's name. */
  .mr-row .ledger-tag { display: none; }
}
/* A finished book's stars in the Completed feed. */
.mr-stars { color: var(--gold-bright, #f5b971); letter-spacing: 1px; }

/* ---- Things polish ---- */
/* The due card's dials wear their colours from the start — red, amber, green — so they
   read as Needs attention / So-so / Good rather than three blank circles. */
.things-due-dials .rate-dial:not(.is-on) { border-color: color-mix(in srgb, var(--dial) 70%, transparent); }
.things-due-more i { margin-right: 4px; font-size: 0.85em; }
/* A row's condition in a word. */
.thing-status.has-label {
  display: inline-flex; align-items: center;
  width: auto; height: auto; padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text-3);
  font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.02em;
  white-space: nowrap;
}
.thing-status.has-label.is-complete { background: rgba(74, 222, 128, 0.14) !important; color: #4ade80; }
.thing-status.has-label.is-mediocre { background: rgba(234, 179, 8, 0.14) !important; color: #eab308; }
.thing-status.has-label.is-failed { background: rgba(229, 72, 77, 0.16) !important; color: #f87171; }
/* A whole-month bar with nothing in it says when it was last checked. */
.thing-track .ledger-strip.is-month { position: relative; }
.thing-track .ledger-strip.is-month:not(.is-filled)::after {
  content: attr(data-note);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: var(--fs-11);
  pointer-events: none;
}
.ledger-summary-stats strong.is-overdue { color: var(--danger-bright); }

/* ---- Routines polish ---- */
/* Today, not done yet: to do, not missed. */
.rtn-recent-day.is-pending { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2); }
.rtn-recent-day.is-kept { background: rgba(34, 197, 94, 0.78); }
.rtn-recent-day.is-missed { background: rgba(214, 78, 82, 0.72); box-shadow: none; color: rgba(0, 0, 0, 0.72); }
/* A habit's time, ahead of its name. */
/* A habit's time: a quiet tag after its name (ledger-tag), so names line up. */
.rtn-time { flex-shrink: 0; margin-left: 8px; font-variant-numeric: tabular-nums; }
.rtn-cat-icon { font-size: var(--fs-12); }
/* The routine form's icon: the one chosen, and Change to open the presets. */
.rtn-icon-picker > summary { list-style: none; cursor: pointer; }
.rtn-icon-picker > summary::-webkit-details-marker { display: none; }
.rtn-icon-current { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rtn-icon-preview { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-row); color: var(--accent-bright); font-size: var(--fs-14); }
.rtn-icon-change { padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); font-size: var(--fs-12); }
.rtn-icon-picker[open] .rtn-icon-change { color: var(--text-1); border-color: var(--border-strong); }

/* ---- Badges polish ---- */
/* The social pages' header (Badges / People / Shared Lists / Assignments / Duels): one line
   that scrolls sideways on a phone, rather than wrapping and cutting off Duels. */
@media (max-width: 640px) {
  .soc-page .ledger-head-left { min-width: 0; max-width: 100%; }
  .soc-page .ledger-title { flex-wrap: nowrap; white-space: nowrap; overflow-x: auto; scrollbar-width: none; max-width: calc(100vw - 24px); }
  .soc-page .ledger-title::-webkit-scrollbar { display: none; }
  .soc-page .ledger-title > * { flex: 0 0 auto; }
}
/* Arriving from "Next up", the badge it names lights up. */
.soc-badge:target .soc-badge-medal { animation: soc-target 1.4s ease-out 2; border-radius: 50%; }
@keyframes soc-target { 40% { box-shadow: 0 0 0 4px rgba(245, 185, 113, 0.6), 0 0 24px rgba(245, 185, 113, 0.45); } }
@media (prefers-reduced-motion: reduce) { .soc-badge:target .soc-badge-medal { animation: none; box-shadow: 0 0 0 3px rgba(245, 185, 113, 0.6); } }
html:has(.soc-page) { scroll-behavior: smooth; scroll-padding-top: 120px; }
/* The scoreboard as a details: its header is the summary. */
.soc-board-card > summary { list-style: none; cursor: default; }
.soc-board-card > summary::-webkit-details-marker { display: none; }
.soc-board-card.is-solo > summary { cursor: pointer; }
.soc-board-solo { display: block; padding: 0 16px 12px; color: var(--text-3); font-size: var(--fs-12); }
.soc-board-solo a { color: var(--text-1); }
.soc-board-card.is-solo[open] .soc-board-solo { display: none; }

/* ---- Social pages combined ---- */
/* On your own profile, a quiet mark on what others don't see when they view it. */
.soc-only-you { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); font-size: var(--fs-11); font-weight: 500; letter-spacing: 0.01em; white-space: nowrap; cursor: help; }
.soc-only-you i { font-size: 9px; }
.soc-section-title .soc-only-you { align-self: center; }
.soc-section-actions { display: flex; align-items: center; gap: 8px; }
.soc-section-head:target .soc-section-title { animation: soc-section-target 1.6s ease-out; }
@keyframes soc-section-target { 30% { color: var(--accent-bright); } }
@media (prefers-reduced-motion: reduce) { .soc-section-head:target .soc-section-title { animation: none; } }
.soc-duel-tally { margin: -4px 0 10px; color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
.soc-duel-tally strong { color: var(--text-1); font-weight: 600; }
/* With Duels below it, the side column is too tall to stick. */
.soc-side { position: static; }
.soc-duels-finished > summary { list-style: none; cursor: pointer; }
.soc-duels-finished > summary::-webkit-details-marker { display: none; }
.soc-duels-finished > summary::after { content: "\f078"; font: var(--fa-font-solid); margin-left: auto; color: var(--text-3); font-size: var(--fs-10); transition: transform 0.15s; }
.soc-duels-finished[open] > summary::after { transform: rotate(180deg); }
.soc-side .ledger-empty { padding: 20px 16px; }

/* ---- People, lists, duels and profiles polish ---- */
.soc-head-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.soc-invite-btn { cursor: pointer; }
.soc-link-btn { display: inline; padding: 0; border: 0; background: none; color: var(--text-1); font: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); cursor: pointer; }
.soc-link-btn i { margin-right: 4px; font-size: 0.85em; }
.soc-link-btn:hover { text-decoration-color: currentColor; }

/* A newcomer's one welcome card, the search inside it. */
.soc-welcome { padding: 28px 24px 22px; text-align: center; }
.soc-welcome-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 50%; color: var(--accent-bright); font-size: var(--fs-16); }
.soc-welcome-title { margin: 0 0 6px; color: var(--text-1); font-size: var(--fs-20); font-weight: 600; letter-spacing: -0.01em; }
.soc-welcome-text { max-width: 460px; margin: 0 auto 18px; color: var(--text-3); font-size: var(--fs-13); line-height: 1.5; }
.soc-welcome .soc-finder { max-width: 520px; margin: 0 auto; text-align: left; }
.soc-welcome-invite { margin: 14px 0 0; color: var(--text-3); font-size: var(--fs-12); }

/* Search results hang off the search box rather than opening a card of their own. */
.soc-finder { margin-bottom: 14px; /* Everyone you could find, dropped down from the focused search box, scrolling within. */ position: relative; }
.soc-finder .soc-search { margin-bottom: 0; }
.soc-finder-results { margin-top: 6px; border: 1px solid var(--border-panel); border-radius: var(--radius-sm); background: var(--surface-row, var(--surface-2)); }
.soc-finder-results .soc-person:first-child { border-top: 0; }
.soc-finder-none { margin: 0; padding: 10px 14px; color: var(--text-3); font-size: var(--fs-12); line-height: 1.5; }
.soc-finder-clear { margin-left: 6px; color: var(--text-2); }
.soc-finder-directory { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; max-height: min(360px, 60vh); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35); }
.soc-finder-directory[hidden] { display: none; }
.soc-finder-directory .soc-person[hidden] { display: none; }

/* A section with nothing in it is one line. */
.soc-section-empty { margin: 0 0 6px; color: var(--text-3); font-size: var(--fs-13); line-height: 1.55; }
.soc-section-empty a { color: var(--text-1); }

/* How far through a list. */
.soc-progress { display: block; width: 100%; margin-top: 6px; }
.soc-progress-bar { display: block; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.soc-progress-fill { display: block; height: 100%; border-radius: inherit; opacity: 0.8; }
.soc-list-progress { display: flex; align-items: center; gap: 10px; max-width: 420px; margin: -4px 0 16px; }
.soc-list-progress .soc-progress { flex: 1; margin: 0; }
.soc-list-progress .soc-progress-bar { height: 4px; }
.soc-list-progress-text { flex: none; color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; }

/* New list: the connections it's shared with, as tickable chips. */
.soc-pick-people { margin: 0; padding: 0; border: 0; }
.soc-pick-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.soc-pick-person { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 5px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font-size: var(--fs-12); cursor: pointer; }
.soc-pick-person input { position: absolute; opacity: 0; pointer-events: none; }
.soc-pick-person:has(input:checked) { border-color: var(--accent-bright); background: rgba(107, 140, 255, 0.12); color: var(--text-1); }
.soc-pick-person:has(input:focus-visible) { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.soc-side-hint.is-inline { padding: 0; }

/* A list's add row: who and when as small chips over native pickers. */

.soc-chip-pick { position: relative; display: inline-flex; flex: none; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-3); font-size: var(--fs-12); cursor: pointer; white-space: nowrap; }
.soc-chip-pick:hover { border-color: var(--border-strong); color: var(--text-2); }
.soc-chip-pick.is-set { border-color: rgba(107, 140, 255, 0.45); color: var(--text-1); }
.soc-chip-pick:focus-within { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
.soc-chip-pick i { font-size: var(--fs-11); }
.soc-chip-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; color-scheme: dark; }
@media (max-width: 640px) {
  .soc-add .soc-add-title { flex: 1 1 100%; }
  .soc-add .soc-chip-pick { flex: none; }
  .soc-add .soc-btn.is-primary { margin-left: auto; }
}

/* A fold: "4 finished in the last 30 days", opened on a click. */
.soc-fold > summary { list-style: none; cursor: pointer; }
.soc-fold > summary::-webkit-details-marker { display: none; }
.soc-fold > summary::after { content: "\f078"; font: var(--fa-font-solid); margin-left: auto; color: var(--text-3); font-size: var(--fs-10); transition: transform 0.15s; }
.soc-fold[open] > summary::after { transform: rotate(180deg); }
.soc-fold:not([open]) > summary { border-bottom: none; }
.soc-fold .ledger-card-title { font-weight: 500; color: var(--text-2); }

/* Profiles: a line of facts, earned badges only, and sealed ones you haven't earned. */
.soc-profile-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; color: var(--text-3); font-size: var(--fs-12); }
.soc-profile-facts strong { color: var(--gold-bright); font-weight: 600; }
.soc-badges.is-profile { padding-bottom: 4px; }
.soc-profile-locked { margin: 0; padding: 4px 16px 16px; color: var(--text-3); font-size: var(--fs-12); line-height: 1.5; }
/* Someone else's badges you haven't earned: one line with how many, not a grid of "?". */
.soc-sealed-count { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.soc-sealed-count i { font-size: var(--fs-11); color: var(--gold); }
/* A person's less-used actions (Disconnect, Block) behind ⋯ (people/index, people/show). */
.soc-more { position: relative; display: inline-block; }
.soc-more > summary { list-style: none; cursor: pointer; }
.soc-more > summary::-webkit-details-marker { display: none; }
.soc-more-btn { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: var(--radius-sm); color: var(--text-3); }
.soc-more-btn:hover, .soc-more[open] > .soc-more-btn { background: var(--surface-2); color: var(--text-1); }
.soc-more-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 150px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-pop); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.soc-more-menu form { display: block; }
.soc-more-item { display: block; width: 100%; padding: 7px 10px; border: none; border-radius: var(--radius-sm); background: none; color: var(--text-1); font: inherit; font-size: var(--fs-13); text-align: left; cursor: pointer; }
.soc-more-item:hover { background: var(--surface-2); }
.soc-more-item.is-danger { color: var(--danger-bright); }
/* The Assignments section with nothing in it yet: one quiet line. */
.soc-section-empty.is-slim { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
.soc-section-empty.is-slim > i { margin-top: 3px; color: var(--text-3); font-size: var(--fs-12); }
.soc-section-empty.is-slim strong { color: var(--text-2); font-weight: 600; }
.soc-badges + .soc-profile-locked { padding-top: 0; }
.soc-badge.is-sealed .soc-badge-medal { box-shadow: inset 0 0 0 2px rgba(245, 185, 113, 0.55); border-radius: 50%; }
.soc-badge.is-sealed .soc-badge-icon i { color: rgba(245, 185, 113, 0.7); font-size: var(--fs-18); }
.soc-badge.is-sealed .soc-badge-name { color: rgba(245, 185, 113, 0.8); letter-spacing: 0.02em; opacity: 1; }
button.ledger-new { background-color: transparent; font-family: inherit; font-size: var(--fs-12); font-weight: 500; cursor: pointer; }
.soc-pick-people > legend { padding: 0; margin-bottom: 6px; }
.soc-profile-locked { padding-top: 10px; }

/* ---- Forms polish ---- */

/* One label look across every form: small capitals, no icons, and a quiet lowercase
   "optional". Doubled class names so they win over the forms' own <style> blocks. */
.src-label, .rule-form-label, .val-form-label, .rtn-form-label,
.milestone-form-label, .cat-form-label, .soc-label {
  color: var(--text-3); font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
:is(.src-label, .rule-form-label, .val-form-label, .rtn-form-label, .milestone-form-label, .cat-form-label, .soc-label) > i { display: none; }
:is(.src-label, .rule-form-label, .val-form-label, .rtn-form-label, .milestone-form-label, .cat-form-label, .soc-label) em {
  margin-left: 2px; color: var(--text-3); font-style: normal; font-weight: 400; letter-spacing: 0; text-transform: none; opacity: 0.75;
}

/* An on/off row: title and hint on the left, a switch on the right. */
.form-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 14px; border: 1px solid var(--border-panel); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.03); cursor: pointer; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
.form-toggle:hover { border-color: var(--border); background: rgba(255, 255, 255, 0.05); }
.form-toggle-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.form-toggle-title { color: var(--text-1); font-size: var(--fs-13); font-weight: 600; }
.form-toggle-hint { color: var(--text-3); font-size: var(--fs-12); line-height: 1.45; }
.form-switch { position: relative; flex-shrink: 0; width: 40px; height: 22px; }
.form-switch-input { position: absolute; inset: 0; z-index: 1; margin: 0; opacity: 0; cursor: pointer; }
.form-switch-track { display: block; width: 100%; height: 100%; border-radius: 999px; background: rgba(255, 255, 255, 0.15); transition: background-color 0.2s; }
.form-switch-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #e2e8f0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s; }
.form-switch-input:checked ~ .form-switch-track { background: #22c55e; }
.form-switch-input:checked ~ .form-switch-track .form-switch-thumb { transform: translateX(18px); }
.form-switch-input:focus-visible ~ .form-switch-track { box-shadow: 0 0 0 3px rgba(107, 140, 255, 0.4); }

/* A modal form laid out by .soc-form: its footer runs to the card's edges. */
.soc-form > .task-form-footer { margin: 4px -16px -16px; }
.task-form-submit:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.thing-drop.is-compact { min-height: 52px; }
.thing-drop.is-compact .thing-drop-preview { width: 36px; height: 36px; object-fit: contain; }
/* A textarea takes the browser's monospace unless told otherwise; notes read in the app's type. */
textarea.task-form-input, .cat-form-textarea, .rtn-form-textarea { font-family: inherit; }
/* On a phone, nothing can be hovered: a footer button's tooltip becomes a small caption
   under its icon instead (data-tip-short, set by labelFormFooterButtons). */
@media (hover: none), (max-width: 640px) {
  :is(.task-form-footer-left, .rule-form-footer-left) > [data-tip-short] {
    flex-direction: column; justify-content: center; gap: 2px; min-height: 44px; padding-top: 6px; padding-bottom: 4px;
    width: 38px;
    min-width: 0;
    padding-left: 2px;
    padding-right: 2px;
  }
  :is(.task-form-footer-left, .rule-form-footer-left) > [data-tip-short]::after {
    content: attr(data-tip-short); position: static; max-width: 44px; padding: 0; overflow: hidden;
    border: 0; background: none; box-shadow: none; color: var(--text-3); font-size: 9px; font-weight: 500; line-height: 1;
    text-overflow: ellipsis; opacity: 1; transform: none;
  }
}

/* A thing's icon: the preview and a Change button, the full picker only once opened. */
.thing-form .icon-picker { align-items: center; }
.thing-form .icon-picker:has(.icon-picker-fold[open]) { align-items: flex-start; }
.icon-picker-fold { flex: 1; min-width: 0; }
.icon-picker-fold > summary { list-style: none; }
.icon-picker-fold > summary::-webkit-details-marker { display: none; }
.icon-picker-change { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); font-size: var(--fs-12); cursor: pointer; }
.icon-picker-change:hover, .icon-picker-fold[open] > .icon-picker-change { border-color: var(--border-strong); color: var(--text-1); }
.icon-picker-fold[open] > .icon-picker-change { margin-bottom: 10px; }
@media (max-width: 640px) { .thing-form .icon-picker-preview { display: flex; } }

/* A form's date as words over its native input (friendlyDates in application.js). */
.date-words { position: relative; display: block; width: 100%; min-width: 0; }
.date-words > input { width: 100%; cursor: pointer; }
.date-words:not(:focus-within) > input { color: transparent !important; -webkit-text-fill-color: transparent !important; }
.date-words:not(:focus-within) > input::-webkit-datetime-edit { opacity: 0 !important; }
.date-words-text {
  position: absolute; top: 50%; left: 13px; right: 36px; overflow: hidden;
  color: var(--text-1); font-size: var(--fs-14); white-space: nowrap; text-overflow: ellipsis;
  transform: translateY(-50%); pointer-events: none;
}
.date-words.is-empty .date-words-text { color: var(--text-3); }
.date-words.is-disabled .date-words-text { opacity: 0.5; }
.date-words:focus-within .date-words-text { display: none; }

/* On a phone the rule and value forms' Category / Do / Review menus go two and one, so
   "Same as Do" isn't cut to "Same as". */
@media (max-width: 480px) {
  .rule-form-grid:not(.rule-form-grid-2).rule-form-grid, .val-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-form-grid:not(.rule-form-grid-2) > :last-child, .val-form-grid > :last-child { grid-column: 1 / -1; }
}

@media (hover: none), (max-width: 640px) {
  :is(.task-form-footer-left, .rule-form-footer-left) { gap: 4px; min-width: 0; }
  :is(.task-form-footer-left, .rule-form-footer-left) .task-type-cards-divider { margin: 0 1px; }
}

/* ---- Detail pages polish ---- */
/* Task, habit, area, category and tracker pages: the old bright blue goes. Actions are
   quiet outlines like the rest of the app, the primary one green; dates are neutral
   pills; today is the green ring the home calendar uses. Area colours stay — they're
   the area's own, the same surface the home page paints. */
.show-btn.is-primary { color: var(--text-1); border-color: var(--border); }
.show-btn.is-primary:hover { color: var(--text-1); border-color: var(--border-strong); background: var(--surface-2); }
.show-btn.is-solid { background: var(--accent); border-color: var(--accent); color: #06130a; }
.show-btn.is-solid:hover { background: var(--accent-bright); }

.show-crumbs a.is-parent:hover { color: var(--text-1); }
.meta-pill.is-due { --pill: var(--text-2); }
.meta-pill.is-done { --pill: var(--accent); }
.meta-pill.is-done.is-none { --pill: var(--text-3); }

.cal-day.is-today, .show-cal-swatch.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day.is-selected:not(:where(#task-calendar *)):hover { background: var(--accent); color: #06130a; }

.show-page :is(.cal-day, a.show-list-item):focus-visible { outline-color: var(--accent-bright); }
.cal-day.is-selected:not(:where(#task-calendar *)) { background: var(--accent); color: #06130a; }
.cal-day.is-selected:not(:where(#task-calendar *))::after { background: #06130a; }
/* A task's own calendar fills its days with how they went — green is Kept — so a green
   fill for the picked day read as "marked done". There the pick is a blue ring outside
   the day instead, which leaves its fill and its today ring as they were. */
#task-calendar .cal-day.is-selected { outline: 2px solid var(--blue); outline-offset: 2px; }

/* An area's score, item by item. */
.area-breakdown { display: flex; flex-direction: column; gap: 14px; }
.area-breakdown-label { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; color: var(--text-3); font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.area-breakdown-label i { font-size: var(--fs-10); }
.area-breakdown-list { margin: 0; padding: 0; list-style: none; }
.area-breakdown-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 180px) 40px; align-items: center; gap: 12px; padding: 6px 8px; margin: 0 -8px; border-radius: var(--radius-sm); color: var(--text-1); font-size: var(--fs-13); text-decoration: none; }
@media (hover: hover) { .area-breakdown-row:hover { background: var(--surface-2); } }
.area-breakdown-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-breakdown-bar { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.area-breakdown-bar > span { display: block; height: 100%; border-radius: inherit; opacity: 0.8; }
.area-breakdown-pct { color: var(--text-2); font-size: var(--fs-12); font-variant-numeric: tabular-nums; text-align: right; }
.area-breakdown-note { margin: 0; color: var(--text-3); font-size: var(--fs-11); }
@media (max-width: 560px) { .area-breakdown-row { grid-template-columns: minmax(0, 1fr) 60px 36px; gap: 8px; } }

/* A tracker's trend: the goal as a dashed green line with its met side shaded, labelled at
   the right, and the latest reading as a dot. */
.tracker-chart { position: relative; }
.tracker-chart-dot { position: absolute; right: -5px; width: 10px; height: 10px; margin-top: -5px; border: 2px solid var(--surface-1); border-radius: 50%; }
.tracker-chart-goal { position: absolute; right: 8px; margin-top: -18px; color: rgba(74, 222, 128, 0.85); font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.04em; }
.show-fold > summary { list-style: none; cursor: pointer; }
.show-fold > summary::-webkit-details-marker { display: none; }
/* A folded card's caret, the way a task row's reads: ▸ before the title while it's
   closed, turning to ▾ open. (It was a chevron at the right edge pointing down while
   closed — "down" meaning the opposite of a row's.) */
.show-fold > summary::before { content: "\f0da"; flex: none; display: inline-block; width: 0.75em; margin-right: 2px; color: var(--text-3); font: var(--fa-font-solid); font-size: var(--fs-12); text-align: center; transition: transform 0.15s; }
.show-fold[open] > summary::before { transform: rotate(90deg); }
.show-fold > summary:hover::before { color: var(--text-1); }
.show-fold:not([open]) > summary { border-bottom: none; }
.show-fold > .show-card-head.is-sub { padding-top: 8px; }
.show-fold > .show-card-head.is-sub .show-card-title { display: none; }

/* ---- Galleries polish ----
   Every "Find More" gallery the same: the find-page width, a grid of cards (the shared
   gallery's rows included — Tasks, Trackers, Write), one title style, and jump chips
   when a gallery comes in sections. The Library's cover shelf keeps its own grid. */
.gallery-page { max-width: 1040px; padding: 2rem 24px 72px; box-sizing: border-box; }
.gallery-page .gallery-head,
.set-page > .gallery-head { margin-bottom: 1rem; } /* the latter: a locked gallery's plans (premium/show) */
.gallery-list:not(.is-shelf) { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.gallery-list:not(.is-shelf) > .gallery-item {
  flex-direction: column; align-items: stretch; justify-content: space-between; gap: 10px; min-height: 92px;
  padding: 1rem 1.1rem 0.9rem; border-color: var(--border-panel); border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 var(--inset-light), 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: border-color var(--dur-fast) ease;
}
.gallery-list:not(.is-shelf) > .gallery-item:hover { border-color: var(--border-strong); }
.gallery-list:not(.is-shelf) .gallery-item-title { color: var(--text-1); font-size: 15px; font-weight: 500; line-height: 1.35; text-wrap: pretty; }
.gallery-list:not(.is-shelf) .gallery-item-heading { font-size: 15px; }
.gallery-list:not(.is-shelf) :is(.gallery-actions, .gallery-saved, .gallery-done) { align-self: flex-end; }
.gallery-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 1.25rem; }
.gallery-chips a { scroll-margin-top: 80px; }

/* is-compact (Tasks, Trackers): a title and a Save on one row, not a tall card, so a
   long list fits on a screen. */
.gallery-page.is-compact .gallery-list:not(.is-shelf) { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.gallery-page.is-compact .gallery-list:not(.is-shelf) > .gallery-item { flex-direction: row; align-items: center; gap: 10px; min-height: 0; padding: 10px 12px 10px 16px; }
.gallery-page.is-compact .gallery-list:not(.is-shelf) .gallery-item-text { flex-direction: row; align-items: baseline; gap: 8px; }
.gallery-page.is-compact .gallery-list:not(.is-shelf) .gallery-item-title { font-size: var(--fs-14); }
.gallery-page.is-compact .gallery-list:not(.is-shelf) :is(.gallery-actions, .gallery-saved, .gallery-done) { align-self: center; }


@media (max-width: 640px) { .gallery-page { padding: 1.25rem 16px 72px; } }

/* ---- SEARCH ---- */
/* As wide as the galleries it opens (.gallery-page, 880px), so a tile doesn't open onto a
   page that jumps wider and further left. */
.search-page { max-width: 1040px; margin: 0 auto; padding: 2rem 24px 72px; box-sizing: border-box; }
.search-page-title { margin: 0 0 14px; color: var(--text-1); font-size: var(--fs-22, 22px); font-weight: 600; letter-spacing: -0.02em; }
.search-box { position: relative; margin-bottom: 1rem; }
/* The browser's own clear button: a quiet gray x that whitens under the pointer, in place
   of the default blue — the page's only blue, and matching nothing on it. */
.search-box-input::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; cursor: pointer;
  background: var(--text-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6 6 18' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6 6 18' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.search-box-input::-webkit-search-cancel-button:hover { background: var(--text-1); }
.search-box-icon { position: absolute; top: 50%; left: 14px; color: var(--text-3); font-size: var(--fs-13); transform: translateY(-50%); pointer-events: none; }
.search-box-input { width: 100%; box-sizing: border-box; padding: 12px 14px 12px 38px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.05); color: var(--text-1); font: inherit; font-size: var(--fs-15, 15px); outline: none; }
.search-box-input:focus { border-color: var(--border-strong); background: rgba(255, 255, 255, 0.08); }
.search-empty, .search-count { margin: 0 0 1.25rem; color: var(--text-3); font-size: var(--fs-13); line-height: 1.5; }
.search-count { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.explore-galleries { margin-top: 2rem; }
.explore-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
/* A phone: two to a row, each tile's name with its blurb under it, icon above. Three to a
   row lost the blurbs, and with them what each gallery holds. The ninth tile spans the
   row, a wide banner to end on. */
@media (max-width: 720px) { .explore-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .explore-tile.has-photo { min-height: 112px; }
  .explore-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .explore-tile.has-photo .explore-tile-caption { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; }
  .explore-tile-label { font-size: var(--fs-14); }
  .explore-tile-blurb { font-size: var(--fs-12); } }
/* A tile with a picture: the photo fills it, darkened toward the bottom where its name
   and blurb sit, so they read in either theme. */
.explore-tile.has-photo { position: relative; align-items: flex-end; min-height: 128px; padding: 0; overflow: hidden; background: #111; }
.explore-tile-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-fast) ease; }
/* A shade darker overall than the photos themselves, so the grid sits back behind the
   page's own content and every caption reads the same. */
.explore-tile.has-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0.22) 100%); }
.explore-tile.has-photo:hover .explore-tile-photo { transform: scale(1.04); }
.explore-tile-caption { display: flex; align-items: center; gap: 12px; }
.explore-tile.has-photo .explore-tile-caption { position: relative; z-index: 1; width: 100%; padding: 12px 14px; }
.explore-tile.has-photo .explore-tile-caption i,
.explore-tile.has-photo .explore-tile-label { color: #fff; }
.explore-tile.has-photo .explore-tile-blurb { color: rgba(255, 255, 255, 0.75); }
/* Something added since you last opened the gallery (FindMore.new_count). */
.explore-tile-new {
  position: absolute; top: 8px; right: 8px; z-index: 2; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: #04130a; font-size: var(--fs-11); font-weight: 700; letter-spacing: 0.02em;
}
/* A gallery only Premium opens (Values), on a free account. */
.explore-tile-premium {
  position: absolute; top: 8px; right: 8px; z-index: 2; padding: 2px 8px; border-radius: 999px;
  background: rgba(20, 14, 6, 0.72); border: 1px solid rgba(245, 185, 113, 0.45); color: #f7d4a5;
  font-size: var(--fs-11); font-weight: 600; letter-spacing: 0.02em;
}
.explore-tile:not(.has-photo) { position: relative; }
.explore-tile { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--border-panel); border-radius: var(--radius-lg); background: var(--surface-card); background-image: var(--sheen); color: var(--text-1); font-size: var(--fs-14); text-decoration: none; transition: border-color var(--dur-fast); }
.explore-tile:hover { border-color: var(--border-strong); text-decoration: none; }
.explore-tile i { flex: none; width: 16px; color: var(--text-3); font-size: var(--fs-13); text-align: center; }
/* The gallery's name, and under it what it holds (ApplicationHelper#find_more_galleries). */
.explore-tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.explore-tile-label { line-height: 1.25; }
.explore-tile-blurb { color: var(--text-3); font-size: var(--fs-12); line-height: 1.35; }
.explore-tile:hover i { color: var(--text-2); }
.search-empty kbd {
  display: inline-block; min-width: 1.4em; padding: 0 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--radius-xs);
  background: var(--surface-2); color: var(--text-1);
  font: inherit; font-size: var(--fs-12); line-height: 1.5; text-align: center;
}
/* A group cut short at its limit: the way to the rest of it (?only=<kind>), and back. */
.search-show-all, .search-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); font-size: var(--fs-12); font-weight: 500; text-decoration: none;
}
.search-show-all { margin: 8px 0 0 2px; }
.search-show-all:hover, .search-back:hover { color: var(--text-1); text-decoration: none; }
.search-show-all i, .search-back i { font-size: var(--fs-11); }
.search-jumps { display: flex; flex-wrap: wrap; gap: 6px; }
.search-jumps a { padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font-size: var(--fs-12); text-decoration: none; }
.search-jumps a:hover { border-color: var(--border-strong); color: var(--text-1); }
.search-jumps a span { color: var(--text-3); }
.search-group { margin-bottom: 1.5rem; scroll-margin-top: 20px; }
.search-group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--text-2); font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.search-group-title i { font-size: var(--fs-12); color: var(--text-3); }
.search-group-count { color: var(--text-3); font-weight: 400; letter-spacing: 0; }
.search-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border-panel); border-radius: var(--radius-lg); background: var(--surface-card); background-image: var(--sheen); overflow: hidden; }
.search-list > li + li { border-top: 1px solid rgba(255, 255, 255, 0.04); }
.search-row { display: flex; gap: 12px; padding: 11px 14px; color: inherit; text-decoration: none; outline: none; }
@media (hover: hover) { .search-row:hover, .search-row:focus-visible { background: rgba(255, 255, 255, 0.04); } }
/* The global a:hover underline (0,1,1) outranks .search-row's own none: it underlined every
   line of a hovered result. */
.search-row:hover { text-decoration: none; }
.search-row:focus-visible { box-shadow: inset 2px 0 0 var(--accent); }
.search-row-icon { display: inline-grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.05); color: var(--text-3); font-size: var(--fs-12); }
/* A finished task: ticked, and its title greyed and struck, as on the home page. */
.search-row.is-done .search-row-icon { color: var(--accent); }
.search-row.is-done .search-row-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.3); }
.search-row-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.search-row-title { overflow: hidden; color: var(--text-1); font-size: var(--fs-14); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.search-row-meta { color: var(--text-3); font-size: var(--fs-12); }
.search-row-snippet { color: var(--text-2); font-size: var(--fs-12); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* The matched words: a faint wash of the accent and brighter type, so a match reads at a
   glance without a yellow highlighter being the loudest thing on the page. */
.search-mark { padding: 0 1px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: #fff; }
.search-row.is-done .search-mark { background: none; color: inherit; }

/* The best match: the closest title, a size up, above the groups. Enter opens it. */
.search-best {
  position: relative; align-items: flex-start; margin: 0 0 1.5rem; padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border-panel)); border-radius: var(--radius-lg);
  background: var(--surface-card); background-image: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
}
.search-best:hover, .search-best:focus-visible { background-color: var(--surface-row); }
.search-best .search-row-icon { width: 36px; height: 36px; font-size: var(--fs-15, 15px); }
.search-best .search-row-title { font-size: var(--fs-16, 16px); font-weight: 600; white-space: normal; }
.search-best .search-row-snippet { -webkit-line-clamp: 3; }
.search-best-kicker { color: var(--accent); font-size: var(--fs-11); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.search-best-enter { margin-left: auto; align-self: center; flex: none; display: inline-flex; align-items: center; gap: 6px; padding-left: 12px; color: var(--text-3); font-size: var(--fs-12); }
.search-best-enter kbd {
  display: inline-block; min-width: 1.4em; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: var(--radius-xs); background: var(--surface-2); color: var(--text-1); font: inherit; font-size: var(--fs-12); line-height: 1.5; text-align: center;
}
@media (hover: none) { .search-best-enter { display: none; } }

/* "/" in the box's right edge while it's empty, on keyboards only; typing hides it, and
   the clear button takes its place. */
.search-box-kbd {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%); pointer-events: none;
  min-width: 1.5em; padding: 0 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--radius-xs);
  background: var(--surface-2); color: var(--text-3); font: inherit; font-size: var(--fs-12); line-height: 1.55; text-align: center;
}
.search-box-input:not(:placeholder-shown) ~ .search-box-kbd { display: none; }
@media (hover: none) { .search-box-kbd { display: none; } }

/* A search that found nothing: the words as a new task or note. */
.search-none { margin: 0 0 1.5rem; padding: 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.search-none-text { margin: 0 0 12px; color: var(--text-1); font-size: var(--fs-14); }
.search-none-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.search-none-actions form { margin: 0; }
.search-none-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 14px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: rgba(255, 255, 255, 0.04);
  color: var(--text-1); font: inherit; font-size: var(--fs-13); text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-fast), border-color var(--dur-fast);
}
.search-none-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--text-3); text-decoration: none; }
.search-none-btn i { color: var(--accent); font-size: var(--fs-12); }
.search-none-hint { margin: 12px 0 0; color: var(--text-3); font-size: var(--fs-12); }

/* Someday, folded at the foot of the Posts page. */
.someday-fold { margin-top: 24px; scroll-margin-top: 20px; }
.someday-fold > summary { list-style: none; cursor: pointer; }
.someday-fold > summary::-webkit-details-marker { display: none; }
.someday-fold > summary::after { content: "\f078"; margin-left: 10px; color: var(--text-3); font: var(--fa-font-solid); font-size: var(--fs-10); transition: transform 0.15s; }
.someday-fold[open] > summary::after { transform: rotate(180deg); }
.someday-fold:not([open]) > summary { border-bottom: none; }
.someday-fold-hint { margin-left: auto; color: var(--text-3); font-size: var(--fs-12); }
.someday-fold .someday-list > .someday-item:first-child { border-top: 0; }
.ledger-new-count { color: var(--text-3); font-variant-numeric: tabular-nums; }
.show-card-head > .show-hint { align-self: center; margin: 0; }

/* ---- A tracker's page (trackers/show) ---- */
/* Complete and Delete, behind ⋯ beside Edit. */
.show-more-menu { position: relative; }
.show-more-menu > summary { list-style: none; }
.show-more-menu > summary::-webkit-details-marker { display: none; }
.show-more-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 190px; padding: 6px;
  background: var(--surface-pop); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.show-more-panel form { margin: 0; }
.show-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; border-radius: 6px;
  background: none; color: var(--text-1); font: inherit; font-size: var(--fs-13); text-align: left; cursor: pointer;
}
.show-menu-item i { width: 14px; color: var(--text-3); text-align: center; }
.show-menu-item:hover { background: rgba(255, 255, 255, 0.06); }
.show-menu-item.is-danger, .show-menu-item.is-danger i { color: var(--danger-bright, #f87171); }

/* Which way it's heading, under the current value. */
.tracker-change.is-good { color: var(--status-complete); font-weight: 600; }
.tracker-change.is-bad { color: var(--status-failed); font-weight: 600; }

/* No goal yet: set one here. */
.tracker-set-goal { margin-top: 8px; }
.tracker-goal-form form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.tracker-goal-form .show-input { width: 110px; }
.tracker-goal-form input[type=date] { width: 140px; }
.tracker-goal-form form:has(.tracker-goal-field) { align-items: flex-end; }
.tracker-goal-field { display: flex; flex-direction: column; gap: 3px; }
.tracker-goal-field > span { font-size: var(--fs-11); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.tracker-goal-field em { font-style: normal; text-transform: none; letter-spacing: 0; }
/* Edit goal: the goals before this one, newest first. */
.tracker-goal-earlier { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--border-panel); }
.tracker-goal-earlier li { display: flex; gap: 0.75rem; align-items: baseline; padding: 6px 0; font-size: var(--fs-13); color: var(--text-2); border-bottom: 1px solid var(--border-panel); }
.tracker-goal-earlier .is-num { min-width: 6rem; color: var(--text-1); font-variant-numeric: tabular-nums; }

/* The trend: a dot per reading, and the scale's ends. */
.tracker-chart-point {
  position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: var(--blue); opacity: 0.55; cursor: default; transition: opacity 0.1s, transform 0.1s;
}
.tracker-chart-point:hover { opacity: 1; transform: scale(1.6); }
.tracker-chart-scale { position: absolute; left: 4px; margin-top: -7px; color: var(--text-3); font-size: var(--fs-10); font-variant-numeric: tabular-nums; pointer-events: none; }

/* Today's reading in one step, over the table. */
.tracker-quick-log { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--border-panel); }
.tracker-quick-log-form { display: flex; align-items: center; gap: 8px; }
.tracker-quick-log-form .show-input { width: 140px; }
.tracker-quick-log-label { color: var(--text-3); font-size: var(--fs-11); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.tracker-quick-log-done { color: var(--text-2); font-size: var(--fs-13); }
.tracker-quick-log-done i { color: var(--status-complete); margin-right: 4px; }

/* The entries: change against the reading before; the row opens its form, its pencil on hover. */
.tracker-entries .tracker-entry-change { color: var(--text-3); font-size: var(--fs-12); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tracker-entries .tracker-entry-change .is-good { color: var(--status-complete); }
.tracker-entries .tracker-entry-change .is-bad { color: var(--status-failed); }
.tracker-entries tr.tracker-entry-row { cursor: pointer; }
@media (hover: hover) { .tracker-entries tr.tracker-entry-row:hover td { background: rgba(255, 255, 255, 0.025); } }
.tracker-entries .tracker-entry-edit { opacity: 0; transition: opacity 0.1s; }
.tracker-entries tr.tracker-entry-row:hover .tracker-entry-edit,
.tracker-entries .tracker-entry-edit:focus-visible { opacity: 1; }
@media (hover: none) { .tracker-entries .tracker-entry-edit { opacity: 0.6; } }
/* Value and change sit together at the right rather than the value alone mid-row. */
.tracker-entries th.is-num, .tracker-entries td.is-num { text-align: right; }
@media (min-width: 641px) { .tracker-entries td:first-child { width: 100%; } }
@media (max-width: 640px) {
  .tracker-entries td, .tracker-entries th { padding-left: 8px; padding-right: 8px; }
  .tracker-entries .subtasks-today-badge { display: none; }
}

/* ---- Routines: before you started; today's count; the new form's habits ---- */
.rtn-recent-day.is-before-start {
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0 3px, transparent 3px 6px);
  box-shadow: none; opacity: 0.55;
}
.rtn-today-count {
  margin-left: auto; color: var(--text-3); font-size: var(--fs-11); white-space: nowrap;
  padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.08);
}
.rtn-today-count strong { color: var(--text-1); font-weight: 600; }
.rtn-today-count.is-done { color: #4ade80; border-color: rgba(34, 197, 94, 0.35); }
.rtn-today-count.is-done strong { color: #4ade80; }
.rtn-today-count + .ledger-card-score { margin-left: 8px; }
.rtn-form-field[data-controller="routine-template"] .rtn-tpl-list + .rtn-tpl-list { margin-top: 6px; }
.rtn-form-field[data-controller="routine-template"] .rtn-tpl-hint { display: block; margin-bottom: 6px; }
.rtn-form-more { margin-bottom: 1.15rem; }
.rtn-form-more-toggle {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-2); font-size: var(--fs-13); font-weight: 500; padding: 4px 0;
}
.rtn-form-more-toggle::-webkit-details-marker { display: none; }
.rtn-form-more-toggle::before {
  content: "\f054"; font: var(--fa-font-solid); font-size: 0.7em; color: var(--text-3); transition: transform 0.15s;
}
.rtn-form-more[open] > .rtn-form-more-toggle::before { transform: rotate(90deg); }
.rtn-form-more-toggle span { color: var(--text-3); font-weight: 400; font-size: var(--fs-12); }
.rtn-form-more[open] > .rtn-form-more-toggle { margin-bottom: 0.75rem; }
/* Explore with nothing typed: the last few searches, to run again (SearchController#remember_search). */
/* Recent searches, dropped down from the box when it's clicked while empty. */
.search-recent-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  padding: 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface-pop); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.75);
}
.search-recent-menu[hidden] { display: none; }
.search-recent-head { margin: 4px 10px 6px; color: var(--text-3); font-size: var(--fs-11); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.search-recent-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-1); font-size: var(--fs-14); text-decoration: none; outline: none;
}
.search-recent-option i { color: var(--text-3); font-size: var(--fs-12); }
.search-recent-option:hover, .search-recent-option:focus-visible, .search-recent-option.is-active { background: rgba(255, 255, 255, 0.07); text-decoration: none; }
/* An area's icon on a task result takes its colour from the row (inline); the box stays neutral. */
.search-row-icon > i { line-height: 1; }

/* ---- Routines polish ---- */
/* The routine for this time of day: a soft outline and a Now mark. */
.rtn-card.is-now { border-color: rgba(34, 197, 94, 0.35); box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.12); }
.rtn-now {
  margin-left: 8px; padding: 1px 8px; border: 1px solid rgba(34, 197, 94, 0.4); border-radius: 999px;
  color: #4ade80; font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
/* Today's all done: a tick in the pill. */
.rtn-today-count i { margin-right: 4px; font-size: 0.85em; }
/* The fold chevron and folding: a phone's only. */
.rtn-fold-btn { display: none; }
@media (max-width: 640px) {
  .rtn-fold-btn {
    display: grid; place-items: center; width: 28px; height: 28px; margin-left: 4px; padding: 0; border: none; border-radius: var(--radius-sm);
    background: none; color: var(--text-3); cursor: pointer;
  }
  .rtn-fold-btn i { transition: transform var(--dur-fast) ease; }
  .rtn-card.is-folded .rtn-fold-btn i { transform: rotate(-90deg); }
  .rtn-card.is-folded > :not(.ledger-card-head) { display: none; }
  .rtn-card.is-folded > .ledger-card-head { border-bottom: none; }
  /* The time tag gives way to the name. */
  .rtn-row .rtn-time { display: none; }
}
/* Retired habits: one quiet line at the foot of the card, opening to the list. */
.rtn-retired { padding: 2px 16px 6px; border-top: 1px solid var(--hairline); }
.rtn-retired-toggle { padding: 6px 0; color: var(--text-3); font-size: var(--fs-11); cursor: pointer; list-style: none; }
.rtn-retired-toggle::-webkit-details-marker { display: none; }
.rtn-retired-toggle::before { content: "\f054"; margin-right: 6px; font-family: "Font Awesome 6 Free"; font-size: 8px; font-weight: 900; display: inline-block; transition: transform var(--dur-fast) ease; }
.rtn-retired[open] > .rtn-retired-toggle::before { transform: rotate(90deg); }
.rtn-retired-toggle:hover { color: var(--text-2); }
.rtn-retired-list { margin: 0 0 4px; padding: 0; list-style: none; }
.rtn-retired-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: var(--fs-12); }
.rtn-retired-name { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }
.rtn-retired-name:hover { color: var(--text-1); }
.rtn-retired-when { color: var(--text-3); font-size: var(--fs-11); }
.rtn-retired-row form { margin-left: auto; }
.rtn-retired-remove { padding: 2px 8px; border: 1px solid var(--border-panel); border-radius: var(--radius-sm); background: none; color: var(--text-3); font: inherit; font-size: var(--fs-11); cursor: pointer; }
.rtn-retired-remove:hover { border-color: var(--border-strong); color: var(--text-1); }
/* The edit modal's habits: the category's icon, not a grey dot. */
.rtn-form-habit-icon { flex-shrink: 0; width: 16px; color: var(--text-3); font-size: var(--fs-11); text-align: center; }
.rtn-form-habits li.is-retired .rtn-form-habit-name { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }

/* A tracker's planned reading past its day. */
.tracker-entry-planned.is-overdue { border-color: rgba(239, 68, 68, 0.45); color: var(--danger-bright, #f87171); }
/* The chart's high and low labels sit just above and below their lines, clear of the
   points at the edges (the first reading sat on top of "183"). */
.tracker-chart-scale.is-top { margin-top: -17px; }
.tracker-chart-scale.is-bottom { margin-top: -15px; }

/* A footer button that shows its own name (Inspiration's Favorite, Pin, Affirmation) gets no
   second, shorter one under it on a phone: it read "Favorite / Favorite". */
@media (hover: none), (max-width: 640px) {
  :is(.task-form-footer-left, .rule-form-footer-left) > [data-tip-short]:has(.insp-flag-label)::after { content: none; }
}


/* ---- A tracker's trend chart: labels out of the plot ----
   The goal's label in a gutter right of the plot, level with its line; the scale's two
   ends in a slim axis on the left. Inside the plot they sat on the readings. */
.tracker-chart:has(.tracker-chart-goal.is-outside) { margin-right: 64px; }
.tracker-chart:has(.tracker-chart-scale.is-axis) { margin-left: 46px; }
.tracker-chart-goal.is-outside { right: auto; left: calc(100% + 8px); margin-top: -7px; white-space: nowrap; }
.tracker-chart-goal.is-average { color: var(--text-3); font-weight: 500; }
.tracker-chart-scale.is-axis { left: auto; right: calc(100% + 8px); text-align: right; white-space: nowrap; }
.tracker-chart-scale.is-axis.is-top, .tracker-chart-scale.is-axis.is-bottom { margin-top: -7px; }

/* ---- A tracker's entries: each reading as a bar on one scale, the goal a tick ---- */
.tracker-entry-bar-head { width: 50%; }
/* The edit pencil's column as narrow as the pencil (it rests hidden): it took the table's
   spare width, an empty strip down the right of every row, the bars stopping short of it. */
.tracker-entries > * > tr:not(.is-editing) > :last-child { width: 1%; white-space: nowrap; }
.tracker-entry-bar-cell { padding-left: 12px !important; }
.tracker-entry-bar { position: relative; display: block; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); }
.tracker-entry-bar > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: color-mix(in srgb, var(--blue) 70%, transparent); }
.tracker-entry-bar.is-met > span { background: color-mix(in srgb, var(--accent) 70%, transparent); }
.tracker-entry-bar.is-planned > span { background: none; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 60%, transparent); }
.tracker-entry-bar > i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: rgba(74, 222, 128, 0.75); }
@media (max-width: 640px) {
  .tracker-entry-bar-head, .tracker-entry-bar-cell { display: none; }
  .tracker-chart:has(.tracker-chart-goal.is-outside) { margin-right: 52px; }
  .tracker-chart:has(.tracker-chart-scale.is-axis) { margin-left: 38px; }
}

/* ---- Goal progress, on a tracker's card on Stats and its own page ----
   Here rather than in the Stats page's own styles, which the tracker page doesn't load.
   How far along, by the figure the card leads with: a thin bar and a line of words. */
.tracker-card-progress { display: flex; flex-direction: column; gap: 5px; }
.tracker-progress-bar { position: relative; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.tracker-progress-bar > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--blue); }
.tracker-card-progress.is-met .tracker-progress-bar > span { background: var(--accent); }
.tracker-progress-text { color: var(--text-2); font-size: var(--fs-11); font-variant-numeric: tabular-nums; }
.tracker-card-progress.is-met .tracker-progress-text { color: #4ade80; }
.tracker-card-progress.is-page { margin-top: 10px; }
.area-other-note { padding: 10px 20px 0; }
/* Shared Lists with none yet: its line inside the card, padded as the card's rows are. */
.soc-lists-empty .soc-section-empty { margin: 0; padding: 14px 16px; }
.meta-pill.is-kept-rate { --pill: var(--text-2); }
.meta-pill.is-kept-rate strong { font-weight: 600; }

/* Today, picked: its green ring says both, without the blue one round it. */
#task-calendar .cal-day.is-selected.is-today { outline: none; }
