/* ============================================================
   MONTHLY REVIEW
   The LEDGER look once more, with the month's shape drawn beside every row that has a
   daily reading. The page used to carry eight big stat tiles, five of which said "avg
   completion"; those are one summary line now, and the space went to the strips.
   ============================================================ */

.mr-strip .ledger-day { cursor: default; }
.mr-strip-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  color: var(--text-3);
  font-size: var(--fs-10);
}

.mr-no-strip { color: var(--text-3); font-size: var(--fs-11); }

/* The section average, above its rows — an eyebrow and a number rather than a tile. */

.mr-rate { font-size: var(--fs-16); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Rows: name · strip · score. The strip and score are fixed columns so they line up down
   a card whatever the names do. */
.mr-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 12px;
  padding: 7px 16px;
}
.mr-row-body { display: flex; align-items: center; gap: 2px; min-width: 0; }
.mr-row-icon { flex-shrink: 0; margin-right: 6px; font-size: var(--fs-11); }
.mr-row .ledger-name {
  display: block;
  overflow: hidden;
  font-size: var(--fs-13);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mr-row .ledger-tag { flex-shrink: 0; margin-left: 6px; }
.mr-track { display: flex; justify-content: flex-end; flex-shrink: 0; width: 268px; }
.mr-score {
  flex-shrink: 0;
  width: 44px;
  text-align: right;
  font-size: var(--fs-12);
  font-variant-numeric: tabular-nums;
}
.mr-when {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-3);
  font-size: var(--fs-11);
  white-space: nowrap;
}
.mr-when i { font-size: var(--fs-10); opacity: 0; transition: opacity var(--dur-fast) ease; }
.mr-row:hover .mr-when i { opacity: 1; }

/* The Completed feed's rows are two columns, not three. */
.mr-row:has(.mr-when) { grid-template-columns: minmax(0, 1fr) auto; }

.mr-milestone-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mr-milestone-form { padding: 0 16px 10px; }
.mr-milestone-form[hidden] { display: none; }

.mr-thumb-more { align-self: center; color: var(--text-3); font-size: var(--fs-11); }

.mr-inspiration { list-style: none; margin: 0; padding: 8px 16px 12px; }

.mr-card-empty { padding: 16px; color: var(--text-3); font-size: var(--fs-13); text-align: center; }
.mr-card-foot {
  padding: 10px 16px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.035);
  font-size: var(--fs-12);
}
.mr-card-foot a { color: var(--text-2); text-decoration: none; }
.mr-card-foot a:hover { color: var(--text-1); }

.mr-inline-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent-bright);
  font-size: var(--fs-13);
  cursor: pointer;
  text-decoration: underline;
}
.mr-inline-link:hover { color: var(--accent); }
.mr-input-link { color: var(--text-3); font-size: var(--fs-12); text-decoration: none; }
.mr-input-link:hover { color: var(--text-1); }

/* The reflection editor. These four are used by _review_entry, which the save turbo
   stream re-renders on its own — they are not optional decoration for this card. */
.mr-reflection { padding: 12px 16px 4px; }
.mr-textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--fs-13);
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--dur-fast) ease;
}
.mr-textarea:focus { outline: none; border-color: var(--border-strong); }
.mr-textarea::placeholder { color: var(--text-3); }
.mr-reflection-display {
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border-panel);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-1);
  font-size: var(--fs-13);
  line-height: 1.7;
  white-space: pre-wrap;
  text-wrap: pretty;
}
.mr-edit-link {
  display: inline-block;
  color: var(--text-3);
  font-size: var(--fs-12);
  text-decoration: none;
}
.mr-edit-link:hover { color: var(--text-1); }

/* Saving the reflection is the page's own action and stays primary. Emailing leaves the
   app, so it sits quieter and confirms first. */
.mr-save-btn {
  margin-top: 10px;
  height: 28px;
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #04140a;
  font: inherit;
  font-size: var(--fs-12);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease;
}
.mr-save-btn:hover { background: var(--accent-bright); }

/* ── The review's opening: the month in a sentence, four figures against the month
   before, the strip, the focus it had, and its highlights. ── */
.mr-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mr-head-action { background: none; font: inherit; font-size: var(--fs-12); cursor: pointer; }
.mr-head-right form { display: inline-flex; margin: 0; }
.mr-progress-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: rgba(255, 255, 255, 0.04); color: var(--text-2); font-size: var(--fs-11); font-weight: 600; }
.mr-month-menu .ledger-month-item { display: flex; justify-content: space-between; gap: 12px; }
.mr-month-kept { font-size: var(--fs-11); font-weight: 600; font-variant-numeric: tabular-nums; }
.mr-headline { margin: 0 0 12px; color: var(--text-2); font-family: Inter, system-ui, sans-serif; font-size: 18px; line-height: 1.45; }
.mr-headline strong { color: var(--text-1); font-size: 18px; font-weight: 600; }
.mr-headline-note { color: var(--text-3); font-family: Inter, system-ui, sans-serif; font-size: var(--fs-13); }
.mr-tile-empty-link { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.mr-tile-empty-link:hover { color: var(--text-1); text-decoration-color: currentColor; }
.mr-tiles { margin-bottom: 12px; }
/* Monthly Review's brief under its schedule row on the 1st (monthly_reviews/_brief). */
.mr-brief-frame { display: block; }
.mr-brief { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; color: var(--text-3); font-size: var(--fs-12); line-height: 1.5; }
.mr-brief-line { min-width: 0; }
.mr-brief-line i { font-size: var(--fs-11); }
.mr-brief strong { font-weight: 600; }
.mr-brief a { color: var(--text-2); text-decoration: none; }
.mr-brief a:hover { text-decoration: underline; }
.mr-tile-of { color: var(--text-3); font-size: 16px; font-weight: 500; }
.mr-summary { padding-top: 14px; }
.mr-focus-results { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid rgba(167, 139, 250, 0.25); border-radius: var(--radius-lg); background: rgba(167, 139, 250, 0.05); }
.mr-focus-result { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-13); }
.mr-focus-result i { color: #a78bfa; font-size: var(--fs-11); }
/* auto-fit, so two highlights share the row rather than leaving a third of it empty. */
.mr-highlights { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.mr-highlights li { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 8px; padding: 10px 12px; border: 1px solid var(--border-panel); border-radius: var(--radius-md); background: var(--surface-card); }
.mr-highlights i { grid-row: 1 / 3; align-self: center; color: var(--text-3); font-size: var(--fs-13); text-align: center; }
.mr-highlight-label { color: var(--text-3); font-size: var(--fs-10); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
/* Wraps rather than cutting off: "Thu, Sep 24 · 3 tas…" lost the very thing it said. */
.mr-highlight-text { color: var(--text-1); font-size: var(--fs-13); line-height: 1.4; }
/* Under the stat tiles, said once: there's no earlier month to compare them with. */
/* Settings: notifications already seen, folded under one heading. */
.set-past-notes > summary { list-style: none; cursor: pointer; }
.set-past-notes > summary::-webkit-details-marker { display: none; }
.set-past-count { margin-left: 6px; color: var(--text-3); font-weight: 400; }
.set-past-chevron { margin-left: auto; font-size: var(--fs-11); transition: transform var(--dur-fast); }
.mr-tiles-note { margin: -6px 0 14px; color: var(--text-3); font-size: var(--fs-12); }

/* The reflection: one open box, read back as written. */
.mr-reflection-form { display: flex; flex-direction: column; gap: 12px; }
.mr-reflection-form .mr-textarea { font-family: Newsreader, Georgia, serif; font-size: 16px; line-height: 1.5; }
.mr-reflection-form .mr-save-btn { align-self: flex-start; }
.mr-reflection-actions { display: flex; align-items: center; gap: 10px; }
.mr-autosave-status { color: var(--text-3); font-size: var(--fs-11); }
.mr-autosave-status:empty { display: none; }
/* The review's banner names what's still to do, as a list that loses items as they're done. */
.mr-gaps .mr-gap-item { color: var(--text-1); }
.mr-gaps .mr-gap-item + .mr-gap-item::before { content: ', '; color: var(--text-2); }
.mr-gaps .ledger-gaps-go { text-decoration: none; }
/* A day before a row began or after it ended: its place in the strip, but no pill. */
.mr-strip .ledger-day.is-out { visibility: hidden; }

/* Next month's focus: up to three rules or values, as chips. */
.mr-focus-form { margin: 8px 16px 14px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.mr-focus-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
.mr-focus-hint { color: var(--text-3); font-size: var(--fs-11); }
.mr-focus-picker { margin-bottom: 10px; }
.mr-focus-picker .lib-kind-option input:checked + span { border-color: rgba(167, 139, 250, 0.6); background: rgba(167, 139, 250, 0.12); color: #ddd6fe; }
.mr-focus-picker .lib-kind-option input:disabled + span { opacity: 0.4; cursor: not-allowed; }
/* What's picked, as chips, with Change to open the list; the list narrows as you type. */
.mr-focus-chosen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; }
.mr-focus-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mr-focus-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid rgba(167, 139, 250, 0.45); border-radius: 999px;
  background: rgba(167, 139, 250, 0.1); color: #ddd6fe; font-size: var(--fs-12);
}
.mr-focus-chip i { color: #a78bfa; font-size: var(--fs-10); }
.mr-focus-search {
  width: 100%; max-width: 320px; height: 32px; padding: 0 10px; border: 1px solid var(--border-panel); border-radius: var(--radius-md);
  background: var(--surface-2); color: var(--text-1); font: inherit; font-size: var(--fs-13);
}
.mr-focus-search:focus { outline: none; border-color: var(--border-strong); }
.mr-focus-picker[hidden], .mr-focus-group[hidden], .mr-focus-picker .lib-kind-option[hidden], .mr-focus-chosen[hidden] { display: none; }

/* Completed work, under the area it belongs to. */
.mr-area-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px 2px; color: var(--text-2); font-size: var(--fs-11); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.mr-area-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--area); }
.mr-area-count { color: var(--text-3); font-weight: 400; }

/* Values in the serif, all their names together. */
.ledger-card-stat { margin-left: auto; }

/* Favourite journal entries read as the journal reads: the serif, two lines, a photo. */
.mr-journal-row { display: block; padding: 0; }
.mr-journal-link { display: flex; align-items: flex-start; gap: 12px; padding: 10px 16px; color: inherit; text-decoration: none; }
.mr-journal-link:hover { background: rgba(255, 255, 255, 0.025); }
.mr-journal-thumb { position: relative; flex-shrink: 0; }
.mr-journal-thumb img { display: block; width: 52px; height: 52px; border-radius: 6px; object-fit: cover; }
.mr-journal-thumb .mr-thumb-more { position: absolute; right: 3px; bottom: 2px; color: #fff; font-size: var(--fs-10); text-shadow: 0 1px 2px #000; }
.mr-journal-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mr-journal-date { color: var(--text-3); font-size: var(--fs-11); }
.mr-journal-entry { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--text-1); font-family: Newsreader, Georgia, serif; font-size: 16px; line-height: 1.45; }

/* The summary's soft fills take light day numbers. */
.mr-summary .ledger-strip.is-summary .ledger-day.is-rated { color: var(--text-1); }

@media (max-width: 720px) {
  .mr-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mr-tiles.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .mr-tiles.is-three .stat-tile { padding: 10px; }
  .mr-tiles.is-three .stat-tile-value { font-size: 22px; }
  .mr-headline { font-size: 16px; }
  .mr-head-action span { display: none; }
  .mr-summary .ledger-strip.is-summary .ledger-day { font-size: 0; }
}

/* Printed (or saved as PDF): the review alone, dark text on white, nothing to click. */
@media print {
  #app-sidebar, .mr-head-right, .mr-edit-link, .mr-focus-form,
  .mr-card-foot, #mr-new-inspiration, .fab, [class*="fab"] { display: none !important; }
  body, .mr-page, .ledger-card, .stat-tile, .mr-highlights li { background: #fff !important; color: #111 !important; box-shadow: none !important; }
  .mr-page { max-width: none; padding: 0; }
  .ledger-card, .stat-tile, .mr-highlights li { border-color: #ddd !important; break-inside: avoid; }
  .ledger-name, .ledger-card-title, .stat-tile-value, .mr-highlight-text, .mr-journal-entry, .mr-reflection-display { color: #111 !important; }
  .mr-headline { color: #333; }
}

@media (max-width: 760px) {
  /* A month of days will not share a row with a name on a phone. */
  .mr-track { display: none; }
  .mr-row { grid-template-columns: minmax(0, 1fr) auto; }
  .mr-when i { opacity: 1; }
}
/* A milestone's row is all button: one column, or the empty second one's gap left its
   date 12px short of the others. */
.mr-row:has(> .mr-milestone-toggle) { grid-template-columns: minmax(0, 1fr); }

/* ---- Monthly review polish ---- */
.mr-tiles.is-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Values' key: poor to great in the one violet. */
.mr-values-key { display: flex; align-items: center; gap: 4px; margin: 0; padding: 8px 16px 2px; }
.mr-values-key i { width: 12px; height: 8px; border-radius: 2px; background: var(--key); }
.mr-values-key span { color: var(--text-3); font-size: var(--fs-11); }
.mr-values-key span:first-child { margin-right: 4px; }
.mr-values-key span:last-child { margin-left: 4px; }
/* Finished items: one icon a row, in its area's colour. */
.mr-area-list .mr-row-icon { width: 14px; color: var(--area) !important; text-align: center; }
/* A month under way: the reflection as a one-line prompt until it's opened. */
.mr-reflection-fold > summary { list-style: none; }
.mr-reflection-fold > summary::-webkit-details-marker { display: none; }
.mr-reflection-fold[open] > .mr-reflection-prompt { display: none; }
.mr-reflection-prompt {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  color: var(--text-3); font-size: var(--fs-13); cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.mr-reflection-prompt:hover { border-color: var(--text-3); color: var(--text-1); }
/* The empty month's ways in, as buttons with their section's icon. */
.mr-welcome-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mr-welcome-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-1) !important; font-size: var(--fs-12); text-decoration: none !important;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.mr-welcome-btn i { color: var(--accent-bright); font-size: var(--fs-11); }
.mr-welcome-btn:hover { background: var(--surface-2); border-color: var(--text-3); }
@media (max-width: 760px) {
  /* The month's strip under each name on a phone, the width of the row, rather than none. */
  .mr-row:has(> .mr-track .mr-strip) { row-gap: 6px; }
  .mr-row > .mr-track:has(.mr-strip) { display: flex; grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .mr-row > .mr-track .mr-strip { width: 100%; }
}
/* Today on a row's strip: an outline, as Rules and Routines mark it, not a dot under it. */
.mr-strip:not(.is-summary) .ledger-day.is-today { box-shadow: 0 0 0 1.5px var(--text-2); }
.mr-strip:not(.is-summary) .ledger-day.is-today::after { display: none; }
/* Three tiles stay one row on a phone, rather than two and one alone. */
@media (max-width: 760px) {
  .stat-tiles.mr-tiles.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat-tiles.mr-tiles.is-three .stat-tile { padding: 10px; min-width: 0; }
  .stat-tiles.mr-tiles.is-three .stat-tile-value { font-size: 22px; }
  .stat-tiles.mr-tiles.is-three .stat-tile-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* A highlight as a tile (a month with only the busiest day to tell): words, not a figure,
   so set smaller than the numbers beside it and level with them. */
.mr-tiles .stat-tile-value.mr-tile-text { font-size: var(--fs-16); font-weight: 500; line-height: 1.35; padding-top: 4px; }
.mr-rate.is-early { color: var(--text-3); font-size: var(--fs-12); font-weight: 500; }


/* The month strip: a day with nothing logged is an outline with a faint number, so the
   days that were scored stand out from it. */
.mr-summary .ledger-strip.is-summary .ledger-day:not(.is-rated):not(.is-before-start):not(.is-out) {
  background: transparent; box-shadow: inset 0 0 0 1px var(--hairline); color: var(--text-3);
}
.mr-strip-key i.is-blank { background: transparent !important; box-shadow: inset 0 0 0 1px var(--border-strong); }
.mr-strip-wait { color: var(--text-3); font-size: var(--fs-11); }
/* Phone: a highlight tile's words at the size of a line, so it's no taller than the
   figures beside it. */
@media (max-width: 640px) {
  .mr-tiles .stat-tile-value.mr-tile-text { font-size: var(--fs-13); padding-top: 2px; }
}
