/*
 * «Обзор» in «Бумага» (app/views/overview). One column by default; from 1200px the left column holds the
 * wall calendar above the undated list and the day is the hero sheet on the right. The phone (< 768px)
 * swaps the month for the week strip: the strip, the day, then the list.
 */
.board {
  --cell-h: 64px; --cell-num: 21px; --cell-gap: 4px; --ring: 132px; --date-size: 48px; --meter-num: 34px;
  max-width: 1440px; margin: 0 auto; padding: 32px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; align-items: start;
  grid-template-areas: "cal" "day" "list";
}
.board__cal { grid-area: cal; min-width: 0; padding: 20px 20px 24px; }
.board__week { grid-area: week; display: none; min-width: 0; }
.board__day { grid-area: day; min-width: 0; padding: 40px 48px 48px; container: day / inline-size; }
.board__list { grid-area: list; min-width: 0; scroll-margin-top: calc(var(--top-h) + 16px); }
.board__cal, .board__day { background: var(--surface); border-radius: 6px; box-shadow: var(--sheet-shadow); }
.move-form { display: none; }
@media (min-width: 768px) and (max-width: 1199px) {
  .board { max-width: 880px; }
  .board__day { padding: 28px 24px 32px; }
}
@media (min-width: 1200px) {
  .board {
    grid-template-columns: 540px minmax(0, 1fr);
    grid-template-areas: "cal day" "list day";
    grid-template-rows: auto 1fr;
    gap: 32px 48px;
  }
}

/* The calendar and the week strip (overview/_calendar, _week, _cell) */
.cal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cal__title { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.2; }
.cal__nav { display: flex; align-items: center; gap: 4px; }
.cal__arrow {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 10px;
  font-size: 26px; line-height: 1; text-decoration: none;
}
.cal__today {
  min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 10px;
  font-size: 15px; font-weight: 600; text-decoration: none;
}
.cal__arrow:hover, .cal__today:hover { background: var(--surface-2); }
.cal__weekdays, .cal__grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--cell-gap);
}
.cal__weekdays li { padding: 0 0 6px 10px; font-size: 14px; color: var(--text-2); }
.cal__grid { border-top: 1px solid var(--line); padding-top: 4px; }
.cal__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.cal__jump {
  min-height: 44px; margin-left: auto; padding: 0 4px; display: inline-flex; align-items: center;
  font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px;
}

.cell { --cell-bg: transparent; --cell-ink: var(--text); --cell-ink-2: var(--text-2); min-width: 0; }
.cell.is-level-zero { --cell-bg: var(--lvl-zero); }
.cell.is-level-low { --cell-bg: var(--lvl-low); }
.cell.is-level-high { --cell-bg: var(--lvl-high); }
.cell.is-level-full { --cell-bg: var(--lvl-full); }
.cell.is-outside { --cell-bg: transparent; --cell-ink: var(--text-2); }
.cell.is-selected { --cell-bg: var(--accent); --cell-ink: var(--on-accent); --cell-ink-2: var(--on-accent); }
.cell__link {
  position: relative; min-height: var(--cell-h); padding: 8px 10px; border-radius: 6px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2px;
  background: var(--cell-bg); color: var(--cell-ink); text-decoration: none;
}
.cell__link:hover { box-shadow: inset 0 0 0 2px var(--line-strong); }
.cell.is-today .cell__link { box-shadow: inset 0 0 0 2px var(--cell-ink); }
.cell__num { font-family: var(--font-display); font-size: var(--cell-num); font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cell__mark { min-height: 18px; font-size: 14px; line-height: 1.3; color: var(--cell-ink-2); font-variant-numeric: tabular-nums; }

/* The selected day (overview/_day, _plan) */
.day { position: relative; }
.day__head {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
  margin-bottom: 20px; padding: 0 0 20px; border-bottom: 1px solid var(--line);
}
.day__head > * { position: relative; z-index: 1; }
.day__kicker { margin-bottom: 6px; font-size: 16px; color: var(--text-2); }
.day__date { font-family: var(--font-display); font-size: var(--date-size); font-weight: 600; line-height: 1.1; }

.meter { position: relative; flex: none; width: var(--ring); height: var(--ring); }
.ring { display: block; width: 100%; height: 100%; }
.ring__track { fill: none; stroke: var(--ring-track); stroke-width: 9; }
.ring__bar {
  fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--progress, 0));
  transition: stroke-dashoffset 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ring__bar[data-progress="0"] { stroke-opacity: 0; }
.meter__label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.meter__value { font-family: var(--font-display); font-size: var(--meter-num); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.meter__mood { display: block; max-width: 7.5em; margin: 6px auto 0; font-size: 14px; line-height: 1.25; color: var(--text-2); }
.meter--plan { width: auto; height: auto; text-align: right; }
.meter--plan .meter__value { display: block; font-size: 48px; }
.meter--plan .meter__mood { margin: 4px 0 0; max-width: none; }

.day__stats { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px 32px; font-size: 16px; }
.day__stats div { display: flex; gap: 8px; align-items: baseline; }
.day__stats dt { color: var(--text-2); }
.day__stats dd { font-weight: 650; font-variant-numeric: tabular-nums; }
.day__message { margin-bottom: 32px; max-width: 38em; font-size: 18px; line-height: 1.5; }

/* 100%: the ink stamp. It shows while the day is closed — on its own line under the date, or, in a day
   column wide enough for both, beside the date, left of the ring; .is-stamping presses it (stamp.js),
   with the paper scraps on a canvas under the header's text. */
.stamp {
  display: none; order: 3; margin-top: 4px; padding: 6px 16px; border: 4px double var(--stamp); border-radius: 8px;
  color: var(--stamp); font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.3;
  transform: rotate(-5deg);
}
.day.is-complete .stamp { display: block; }
.day.is-stamping .stamp { animation: stamp-press 0.5s cubic-bezier(0.2, 1.3, 0.4, 1); }
.scraps { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
@container day (min-width: 640px) {
  .day__head { flex-wrap: nowrap; }
  .stamp { position: absolute; right: calc(var(--ring) + 40px); top: 50%; margin: -24px 0 0; font-size: 22px; }
}
@keyframes stamp-press {
  0% { opacity: 0; transform: rotate(-5deg) scale(1.9); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: rotate(-5deg) scale(1); }
}

/* Groups and rows */
.group:not([hidden]) ~ .group:not([hidden]) { margin-top: 32px; }
.group__title { margin-bottom: 6px; font-size: 16px; font-weight: 650; color: var(--text-2); }
.rows { list-style: none; margin: 0; padding: 0; }
.row { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 10px 6px; border-radius: 12px; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 56px; right: 0; height: 1px; background: var(--line); }
.row:hover, .row.is-menu-open { background: var(--row-hover); }
.row.is-menu-open { z-index: 5; }
.row[draggable="true"] { cursor: grab; }
.row[draggable="true"] :is(button, a, input) { cursor: pointer; }
.row.is-done[draggable="true"] { cursor: auto; }
.row.is-dragged { opacity: 0.55; }

.check {
  flex: none; width: 44px; height: 44px; padding: 0; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer;
}
.check__box {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 2px solid var(--check-line); border-radius: 8px; background: transparent;
  transition: background-color 0.2s, border-color 0.2s;
}
.check__box svg { width: 20px; height: 20px; }
.check__box path {
  fill: none; stroke: var(--on-accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 0.3s 0.05s;
}
.check:hover .check__box { border-color: var(--accent); }
.row.is-done .check__box { background: var(--accent); border-color: var(--accent); }
.row.is-done .check__box path { stroke-dashoffset: 0; }
/* A future day: nothing to check yet — a quiet dashed ring marks the row. */
.row__plan { flex: none; width: 44px; height: 44px; display: grid; place-items: center; }
.row__plan::before { content: ""; width: 24px; height: 24px; border-radius: 50%; border: 2px dashed var(--check-line); }

.row__body { flex: 1 1 auto; min-width: 0; padding-top: 8px; }
.row__line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.row__time { position: relative; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.row__title { font-size: 19px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; transition: color 0.3s; }
.row.is-done .row__title { color: var(--text-2); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.row__meta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 14px; color: var(--text-2); }

/* «Пропустить»: a skipped day is out of sight like a checked one — muted, marked «пропущено», a dash in a
   dashed box — but it is not done (no tick, no strike-through). Checking it off clears all of it. */
.row.is-skipped .row__title { color: var(--text-2); }
.row.is-skipped .check__box { position: relative; border-style: dashed; }
.row.is-skipped .check__box::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 2px; margin: -1px 0 0 -6px;
  border-radius: 1px; background: var(--check-line);
}
/* «время прошло» (today, late_controller.js): the time of an open row past its minute turns a muted red; the
   words are there for screen readers and show as a tooltip on the time. A done or skipped row drops it. */
.row__late { display: none; }
.row.is-late:not(.is-done, .is-skipped) .row__time { color: var(--late); cursor: help; }
.row.is-late:not(.is-done, .is-skipped) .row__late {
  display: block; position: absolute; left: -8px; bottom: calc(100% + 6px); z-index: 6; padding: 4px 10px; border-radius: 8px;
  background: var(--toast-bg); color: var(--toast-text); font-size: 14px; font-weight: 500; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.row.is-late .row__time:hover .row__late { opacity: 1; }

/* «Сделано · 2, пропущено · 1» (overview/_done): the day's done and skipped rows, folded under the sections; the calm line
   stands in for the sections once nothing is open. */
.day__clear { padding: 4px 0 0; }
.done { margin-top: 28px; padding-top: 10px; border-top: 1px solid var(--line); }
.done__summary {
  width: fit-content; min-height: 44px; padding: 0 12px 0 6px; border-radius: 10px; display: flex; align-items: center; gap: 8px;
  color: var(--text-2); font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; list-style: none; cursor: pointer;
}
.done__summary::-webkit-details-marker { display: none; }
.done__summary:hover { background: var(--row-hover); color: var(--text); }
.done__chevron {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.15s;
}
.done[open] .done__chevron { transform: rotate(90deg); }
.done__rows { margin-top: 4px; }

.row__skipped { font-weight: 650; color: var(--text-2); }
.row:not(.is-skipped) .row__skipped { display: none; }
.actions .act--unskip { display: none; }
.row.is-skipped .act--unskip { display: flex; }
.row.is-skipped .act--skip, .row.is-done .act--skip { display: none; }

/* A row's actions (overview/_actions): always a «⋯» menu, at every width and on every pointer, so closed
   they take no more than the 44px toggle and the title keeps the row's width. */
.actions { position: relative; flex: none; align-self: center; }
.actions__toggle {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent;
  display: grid; place-items: center; color: var(--text-2); cursor: pointer;
}
.actions__toggle svg { width: 22px; height: 22px; fill: currentColor; }
.actions__toggle:hover, .actions__toggle[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.actions__items {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  display: none; flex-direction: column; min-width: 220px; padding: 6px;
  background: var(--menu-bg); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--menu-shadow);
}
.actions__toggle[aria-expanded="true"] + .actions__items { display: flex; }
.actions__items.is-up { top: auto; bottom: calc(100% + 4px); }
.actions__form { display: contents; }
.act {
  min-height: 44px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent;
  display: flex; align-items: center; color: var(--text); font-size: 16px; text-align: left; text-decoration: none;
  white-space: nowrap; cursor: pointer;
}
.act:hover, .act:focus-visible { background: var(--surface-2); }
.act--danger { color: var(--danger); }
.row.is-done .act--move { display: none; }

/* The undated list (overview/_list, _list_row) */
.list__head { display: flex; align-items: baseline; gap: 12px; }
.list__title { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.list__count { font-size: 18px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.list__intro { margin: 6px 0 16px; font-size: 15px; color: var(--text-2); }
.list .row__title { font-size: 18px; }
.add { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.add__input {
  flex: 1 1 200px; min-width: 0; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--input-bg); color: var(--text); font-size: 16px;
}
.add__input::placeholder { color: var(--text-2); opacity: 1; }

.empty { padding: 20px 0; }
.empty__title { margin-bottom: 4px; font-size: 19px; font-weight: 650; }
.empty__text { font-size: 16px; color: var(--text-2); }
.empty__add { margin-top: 16px; }

/* Moving tasks (move_controller.js): while a task is dragged every place it can land is outlined, a
   past day dims, and the place under the pointer takes the accent. */
.board.is-dragging [data-move-day] { outline: 1px dashed var(--line-strong); outline-offset: 2px; }
.board.is-dragging .cell.is-past .cell__link { opacity: 0.45; }
.board.is-dragging .is-drop-over { outline: 3px dashed var(--accent); outline-offset: 4px; }
.board.is-dragging .cell__link.is-drop-over { outline: 0; box-shadow: inset 0 0 0 3px var(--accent); }

/* Motion: a check-off pops the box and lights the row for a moment; the day's message fades in anew. */
.row.is-checking .check__box { animation: check-pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
.row.is-checking { animation: row-flash 0.7s ease-out; }
.day__message.is-swapping { animation: fade-in 0.6s ease-out; }
@keyframes check-pop { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes row-flash { 0% { background: var(--flash); } 100% { background: transparent; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* The phone: the week strip instead of the month, full-bleed so seven 44px days fit down to 320px. */
@media (max-width: 767px) {
  .board { --ring: 108px; --date-size: 30px; --meter-num: 28px; padding: 16px; gap: 28px; grid-template-areas: "week" "day" "list"; }
  .board__cal { display: none; }
  .board__week { display: block; margin-inline: -16px; padding: 12px 4px; background: var(--surface); box-shadow: var(--sheet-shadow); }
  .board__week .cal__head { padding-inline: 8px; }
  .board__week .cal__foot { padding-inline: 8px; }
  .cal--week { --cell-gap: 2px; }
  .cal--week .cal__weekdays, .cal--week .cal__grid { grid-template-columns: repeat(7, minmax(44px, 1fr)); }
  .cal--week .cal__weekdays li { padding-left: 0; text-align: center; }
  .cal--week .cell__link { min-height: 60px; padding: 6px 2px; align-items: center; }
  .cal--week .cell__num { font-size: 20px; }
  .cal--week .cell__mark { font-size: 14px; }
  .board__day { padding: 20px 16px 24px; }
  .day__head { gap: 16px; }
  .row { gap: 6px; padding: 8px 0; }
  .row__title { font-size: 18px; }
  .meter--plan .meter__value { font-size: 40px; }
}
@media (max-width: 359px) {
  .cal--week { --cell-gap: 0px; }
}
