/* «Тон» — сторінка «Сьогодні» (Overview, клас сторінки ton-today-page; прототип #/n5). Перенесено з assets/next4.css (розкладка .t4,
   теки-розділювачі .dv), next5.css (тиждень смугою .wkb), next2.css і next3.css (виїзд, свіжі фото, «Усе розібрано») та next.css (міні-дошка).
   Колір теки — колір об'єкта (--object), текст на ньому — --fold-on за правилом Д29 (ObjectTone::textOnColour); смуга тижня — токени band*.
   Кольорів-літералів немає: лише var(--…) і color-mix із них (tests/Arch/DesignTokensTest.php). */

/* ——— загальне сторінки ——— */
.ton-today-page [x-cloak] { display: none !important; }
.ton-today-page .ton-dim { color: var(--ink-3); }
.ton-today-page .ton-sect { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; }
.ton-today-page .ton-h2 { margin: 0 auto 0 0; font: var(--type-h2); letter-spacing: var(--track-h2); color: var(--ink); }
.ton-today-page .ton-sect a { font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ton-today-page .ton-quote { margin: 0; font: var(--type-quote); font-size: 25px; line-height: 1.14; letter-spacing: var(--track-quote); text-wrap: pretty; }
.ton-today__note { margin: 0; font-size: 14px; color: var(--ink-2); }

/* ——— розкладка: справи й виїзд поруч, тиждень і фото під ними на всю ширину ——— */
.ton-today { display: grid; grid-template-columns: minmax(0, 1fr); gap: 60px; }
.ton-today__top { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--gap); align-items: start; min-width: 0; }
.ton-today__main { display: grid; gap: 40px; min-width: 0; }
.ton-today__side, .ton-today__week, .ton-today__photos { min-width: 0; }
.ton-today__title {
  margin: 0;
  font: var(--type-display);
  font-size: clamp(36px, 5.2vw, 78px);
  letter-spacing: var(--track-display);
  color: var(--ink);
  text-wrap: balance;
}
.ton-today__title .ton-dim { display: block; }
.ton-today__tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.ton-legend { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.ton-calm { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 20px 0 4px; border-top: 1px solid var(--ink); }

@media (min-width: 1101px) and (min-height: 820px) {
  .ton-today__side { position: sticky; top: calc(var(--bar) + 20px); }
}

/* ——— «Перші кроки» ——— */
.ton-steps { margin-bottom: 44px; }
.ton-steps__help { max-width: 62ch; margin: -6px 0 16px; color: var(--ink-2); }
.ton-steps__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.ton-steps__step { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 16px; border-radius: var(--r-s); background: var(--sheet); }
.ton-steps__mark .fi-icon { width: 14px; height: 14px; }
.ton-steps__t { display: grid; justify-items: start; gap: 6px; min-width: 0; }
.ton-steps__t a { font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ton-steps__t small { font-size: 13px; line-height: 1.35; color: var(--ink-2); }
.ton-steps__step.is-done { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.ton-steps__step.is-done a { color: var(--ink-3); text-decoration: line-through; }

/* ——— порожньо ——— */
.ton-empty { display: grid; justify-items: start; gap: 14px; max-width: 62ch; padding-top: 22px; border-top: 1px solid var(--ink); }
.ton-empty p { margin: 0; }
.ton-empty p + p { color: var(--ink-2); }

/* ——— теки-розділювачі (Д21, Д23) ———
   Аркуш кольору об'єкта з тонким контуром і вушком-трапецією; наступний лежить поверх попереднього, тож унизу кожного лишено місце під
   вушко сусіда. Рядок — справа: кружок, назва з деталлю, стрілка; тихий рядок «чекаємо» — годинник замість кружка. */
.ton-folders {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .34 -.13'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  display: grid;
  padding-top: 48px;
}
.ton-folder {
  --fold-on: var(--white);
  --fold-2: color-mix(in srgb, var(--fold-on) 66%, var(--object));
  --fold-line: color-mix(in srgb, var(--object) 83%, var(--fold-on));
  --fold-edge: color-mix(in srgb, var(--object) 50%, var(--ink));
  --tab: 40px;
  position: relative;
  min-width: 0;
  color: var(--fold-on);
  filter: drop-shadow(0 -3px 5px color-mix(in srgb, var(--ink) 9%, transparent));
}
.ton-folder + .ton-folder { margin-top: -14px; }
.ton-folder__in {
  position: relative;
  padding: 8px 14px 64px;
  border: 1px solid var(--fold-edge);
  border-radius: 12px;
  background-color: var(--object);
  background-image: var(--grain);
  background-size: 180px 180px;
  background-blend-mode: multiply;
}
.ton-folder:last-child .ton-folder__in { padding-bottom: 10px; }
.ton-folder__tab {
  position: absolute;
  z-index: 1;
  left: 18px;
  top: calc(1px - var(--tab));
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 96px);
  height: var(--tab);
  padding: 0 26px 0 24px;
  white-space: nowrap;
}
.ton-folder__tab::before, .ton-folder__tab::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  border-top: 1px solid var(--fold-edge);
  background-color: var(--object);
  background-image: var(--grain);
  background-size: 180px 180px;
  background-blend-mode: multiply;
}
.ton-folder__tab::before { left: 0; right: 30%; border-left: 1px solid var(--fold-edge); border-radius: 9px 0 0 0; transform-origin: 0 100%; transform: skewX(-17deg); }
.ton-folder__tab::after { left: 30%; right: 0; border-right: 1px solid var(--fold-edge); border-radius: 0 9px 0 0; transform-origin: 100% 100%; transform: skewX(17deg); }
.ton-folder__name {
  min-width: 0;
  margin-right: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.012em;
  text-decoration: none;
}
.ton-folder__name:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ton-folder .ton-disc--wait { color: var(--fold-on); box-shadow: inset 0 0 0 1.5px var(--fold-on); }
.ton-folder :is(.ton-disc--alert, .ton-disc--call) { box-shadow: 0 0 0 1.5px var(--fold-on); }

/* вушка йдуть сходинками */
.ton-folder--1 .ton-folder__tab { left: 34%; }
.ton-folder--2 .ton-folder__tab { left: auto; right: 5%; }
.ton-folder--3 .ton-folder__tab { left: 11%; }
.ton-folder--4 .ton-folder__tab { left: 42%; }
.ton-folder--5 .ton-folder__tab { left: auto; right: 12%; }

.ton-folder__row {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 6px;
  border-top: 1px solid var(--fold-line);
  color: inherit;
  text-decoration: none;
}
.ton-folder__row:first-child { border-top-color: transparent; }
.ton-folder__row .ton-disc { justify-self: start; }
.ton-folder__t { display: grid; gap: 2px; min-width: 0; }
.ton-folder__t b { font-size: 15.5px; font-weight: 600; line-height: 1.2; letter-spacing: -.014em; text-wrap: pretty; overflow-wrap: anywhere; }
.ton-folder__detail { font-size: 12.5px; line-height: 1.3; color: var(--fold-2); overflow-wrap: anywhere; }
.ton-folder__who { font-size: 12.5px; font-weight: 500; color: var(--fold-2); }
.ton-folder__go { display: grid; place-items: center; width: 22px; height: 22px; color: var(--fold-2); }
.ton-folder__go .fi-icon { width: 16px; height: 16px; }
.ton-folder__row:hover .ton-folder__t b { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ton-folder__row:hover .ton-folder__go { color: var(--fold-on); }
.ton-folder__row:focus-visible { outline-color: var(--fold-on); outline-offset: -2px; border-radius: 6px; }
.ton-folder__row--wait .ton-folder__t b { font-weight: 500; }
.ton-folder__clock { display: grid; place-items: center; width: 24px; height: 24px; }
.ton-folder__clock .fi-icon { width: 24px; height: 24px; }

/* ——— виїзд (R8): план із точками зауважень на кольорі об'єкта, час і що перевірити ——— */
.ton-visit { height: auto; }
.ton-visit__plan { display: block; aspect-ratio: auto; }
.ton-visit__sheet { position: relative; display: block; }
/* Креслення — біла лінія на кольорі об'єкта, як рисунок зразка. */
.ton-visit__sheet img { display: block; width: 100%; height: auto; filter: grayscale(1) invert(1) contrast(1.3); mix-blend-mode: screen; }
.ton-visit__mark {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--white) 94%, transparent);
}
.ton-visit__cap { padding: 18px 8px 10px; }
.ton-visit__body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; align-items: end; }
.ton-visit__time { font-size: clamp(56px, 5.4vw, 86px); font-weight: 500; line-height: .8; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.ton-visit__what { grid-column: 1 / -1; font-size: 18px; font-weight: 600; line-height: 1.15; letter-spacing: -.018em; }
.ton-visit__what span { display: block; color: color-mix(in srgb, var(--on-light) 62%, transparent); overflow-wrap: anywhere; }
.ton-visit__list { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.ton-visit__list div {
  padding-top: 8px;
  border-top: 1px solid var(--on-light);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.3;
  color: color-mix(in srgb, var(--on-light) 78%, transparent);
  overflow-wrap: anywhere;
}
.ton-visit__list b { display: block; font-size: 22px; font-weight: 500; line-height: 1.1; letter-spacing: -.03em; color: var(--on-light); }

/* ——— тиждень смугою (Д22, Д24): верх і низ ростуть разом з найдовшим днем, смуга лишається рівною ——— */
.ton-week {
  --band-h: 100px;
  --zone: 148px;
  --ov: 30px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: minmax(var(--zone), auto) var(--band-h) minmax(var(--zone), auto);
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.ton-week::before { content: ""; position: absolute; grid-area: 2 / 1 / 3 / -1; inset: 0; background: var(--band); }
.ton-week__day { --day-on: var(--on-band); position: relative; display: grid; grid-row: 1 / -1; grid-template-rows: subgrid; min-width: 0; }
.ton-week__up, .ton-week__down { display: flex; flex-direction: column; min-width: 0; }
.ton-week__up { grid-row: 1; justify-content: flex-end; }
.ton-week__down { grid-row: 3; justify-content: flex-start; }
.ton-week__d { grid-row: 2; position: relative; z-index: 2; display: flex; align-items: flex-start; gap: 6px; padding: 12px 6px 12px 13px; pointer-events: none; }
.ton-week__day--down .ton-week__d { align-items: flex-end; }
.ton-week__day--both .ton-week__d { align-items: center; }
.ton-week__d b { font-size: 72px; font-weight: 600; line-height: .74; letter-spacing: -.055em; color: var(--band-number); font-variant-numeric: tabular-nums; }
.ton-week__d span { font-size: 13px; font-weight: 600; line-height: 1; letter-spacing: -.005em; color: var(--day-on); white-space: nowrap; }
.ton-week__day.is-today { --day-on: var(--on-band-today); }
.ton-week__day.is-today::before { content: ""; position: absolute; grid-area: 2 / 1 / 3 / 2; inset: 0; background: var(--band-today); }
.ton-week__day.is-today .ton-week__d b { color: var(--on-band-today); }
.ton-week__day.is-today .ton-week__w { display: none; }

.ton-week__tx { display: block; min-width: 0; padding: 0 12px 0 11px; border-left: 2px solid var(--band); color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.ton-week__tx b { display: block; font-size: 15px; font-weight: 600; line-height: 1.2; letter-spacing: -.014em; text-wrap: pretty; }
.ton-week__tx small { display: block; margin-top: 5px; font-size: 12.5px; line-height: 1.3; color: var(--ink-2); text-wrap: pretty; }
.ton-week__tx.is-alert small { color: var(--alert); font-weight: 500; }
.ton-week__o { display: block; margin-top: 4px; padding-left: 13px; text-indent: -13px; font-size: 12.5px; line-height: 1.3; color: var(--ink-3); }
.ton-week__o i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 1.5px; background: var(--object); vertical-align: 1px; }
a.ton-week__tx:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ton-week__free { display: block; padding: 0 12px 0 11px; border-left: 2px solid var(--band); font-size: 13.5px; color: var(--ink-3); }
.ton-week__tx + .ton-week__tx, .ton-week__tx + .ton-week__more { margin-top: 12px; }
.ton-week__more {
  align-self: flex-start;
  padding: 1px 12px 1px 11px;
  border: 0;
  border-left: 2px solid var(--band);
  border-radius: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}
.ton-week__more:hover { color: var(--ink); }

/* рисунок малюється двічі з однієї маски: частина поза смугою — кольором тексту, частина на смузі — кольором, що читається на ній */
.ton-week__art { position: relative; z-index: 1; flex: none; display: block; width: min(94%, 176px); aspect-ratio: 1; margin: 0 auto; color: var(--ink); pointer-events: none; }
.ton-week__art i { position: absolute; inset: 0; background: currentColor; -webkit-mask: var(--art) center / contain no-repeat; mask: var(--art) center / contain no-repeat; }
.ton-week__art i + i { color: var(--day-on); }

@media (min-width: 981px) {
  .ton-week__up { padding-top: 6px; }
  .ton-week__up .ton-week__tx:last-child { padding-bottom: 14px; }
  .ton-week__down :is(.ton-week__tx, .ton-week__free):first-child { padding-top: 14px; }
  .ton-week__down .ton-week__more:last-child { margin-bottom: 4px; }
  .ton-week__up .ton-week__art { margin-bottom: calc(-1 * var(--ov)); }
  .ton-week__down .ton-week__art { margin-top: calc(-1 * var(--ov)); }
  .ton-week__up .ton-week__art i:first-child { clip-path: inset(0 0 var(--ov) 0); }
  .ton-week__up .ton-week__art i + i { clip-path: inset(calc(100% - var(--ov)) 0 0 0); }
  .ton-week__down .ton-week__art i:first-child { clip-path: inset(var(--ov) 0 0 0); }
  .ton-week__down .ton-week__art i + i { clip-path: inset(0 0 calc(100% - var(--ov)) 0); }
}
@media (min-width: 981px) and (max-width: 1100px) {
  .ton-week__tx b { font-size: 14px; }
  .ton-week__d b { font-size: 60px; }
}
@media (min-width: 981px) and (max-width: 1239px) {
  .ton-week__day.is-today .ton-week__w { display: inline; }
  .ton-week__day.is-today .ton-week__n { display: none; }
}
/* вузько: смуга вертикальна, події обабіч неї */
@media (max-width: 980px) {
  .ton-week { --band-h: 84px; --ov: 18px; display: block; max-width: 620px; margin-left: auto; margin-right: auto; }
  .ton-week::before { inset: 0 auto 0 calc(50% - var(--band-h) / 2); width: var(--band-h); }
  .ton-week__day { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) var(--band-h) minmax(0, 1fr); min-height: 128px; }
  .ton-week__up, .ton-week__d, .ton-week__down { grid-row: 1; }
  .ton-week__up { grid-column: 1; align-items: flex-end; justify-content: center; padding: 12px 0; }
  .ton-week__d { grid-column: 2; }
  .ton-week__down { grid-column: 3; align-items: flex-start; justify-content: center; padding: 12px 0; }
  .ton-week__day.is-today::before { grid-area: 1 / 2 / 2 / 3; }
  .ton-week__up .ton-week__tx { margin-right: 5px; padding: 2px 11px 2px 0; border-left: 0; border-right: 2px solid var(--band); text-align: right; }
  .ton-week__down :is(.ton-week__tx, .ton-week__free) { margin-left: 5px; padding: 2px 0 2px 11px; }
  .ton-week__down .ton-week__more { margin-left: 5px; }
  .ton-week__up .ton-week__o { padding-left: 0; text-indent: 0; }
  .ton-week__d, .ton-week__day--down .ton-week__d, .ton-week__day--both .ton-week__d { flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 10px 9px; }
  .ton-week__day--up .ton-week__d { align-items: flex-start; }
  .ton-week__day--down .ton-week__d { align-items: flex-end; }
  .ton-week__tx b { font-size: 14px; }
  .ton-week__d b { font-size: 46px; }
  .ton-week__d span { font-size: 12px; }
  .ton-week__art { width: min(100%, 136px); margin: 0; }
  .ton-week__up .ton-week__art { margin: 0 calc(-1 * var(--ov)) 0 0; }
  .ton-week__down .ton-week__art { margin: 0 0 0 calc(-1 * var(--ov)); }
  .ton-week__up .ton-week__art i:first-child { clip-path: inset(0 var(--ov) 0 0); }
  .ton-week__up .ton-week__art i + i { clip-path: inset(0 0 0 calc(100% - var(--ov))); }
  .ton-week__down .ton-week__art i:first-child { clip-path: inset(0 0 0 var(--ov)); }
  .ton-week__down .ton-week__art i + i { clip-path: inset(0 calc(100% - var(--ov)) 0 0); }
}

/* ——— «Щойно з об'єктів»: відбиток на білому паспарту, колір — під курсором чи фокусом ——— */
.ton-fresh { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ton-today__side .ton-fresh { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ton-fresh__item { display: block; min-width: 0; padding: 8px 8px 12px; border-radius: var(--r-s); background: var(--sheet); color: var(--ink); text-decoration: none; }
.ton-fresh__item .ton-print { border-radius: 3px; }
.ton-fresh__item:is(:hover, :focus-visible) .ton-print img { filter: none; mix-blend-mode: normal; }
.ton-fresh__item:is(:hover, :focus-visible) .ton-print::after { opacity: 0; }
.ton-fresh__cap { display: block; padding: 10px 4px 0; font-size: 12.5px; line-height: 1.3; overflow-wrap: anywhere; }
.ton-fresh__cap b { display: block; font-weight: 600; }
.ton-fresh__cap span { color: var(--ink-2); }

/* ——— «Об'єкти»: малі зразки ——— */
.ton-today__objects { margin-top: 44px; }
.ton-mini { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.ton-mini .ton-swatch:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ——— вузько: усе в стовпчик — заголовок, виїзд, справи, тиждень, фото (фото без виїзду теж ідуть після тижня) ——— */
@media (max-width: 1100px) {
  .ton-today { display: flex; flex-direction: column; align-items: stretch; gap: 32px; }
  .ton-today__top, .ton-today__main { display: contents; }
  .ton-today__title { order: 1; }
  .ton-today__side { order: 2; }
  .ton-today__folders { order: 3; }
  .ton-today__week { order: 4; margin-top: 8px; }
  .ton-today__photos, .ton-today__side--photos { order: 5; }
  .ton-visit { flex-direction: row; gap: 8px; }
  .ton-visit .ton-swatch__field { flex: none; align-self: flex-start; width: 46%; }
  .ton-visit__cap { justify-content: flex-end; padding: 8px 10px 8px 12px; }
}
@media (min-width: 641px) and (max-width: 900px) {
  .ton-mini { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .ton-today { gap: 26px; }
  .ton-today-page .ton-quote { font-size: 21px; }
  .ton-calm { flex-wrap: wrap; }
  .ton-visit { flex-direction: column; gap: 0; }
  .ton-visit .ton-swatch__field { align-self: auto; width: auto; }
  .ton-visit__cap { padding: 18px 8px 10px; }
  .ton-folders { padding-top: 44px; }
  .ton-folder { --tab: 36px; }
  .ton-folder__in { padding: 4px 8px 58px; border-radius: 11px; }
  .ton-folder__tab { left: 10px; max-width: calc(100% - 78px); padding: 0 20px 0 18px; gap: 5px; }
  .ton-folder__name { font-size: 13.5px; }
  .ton-folder--1 .ton-folder__tab { left: 38px; }
  .ton-folder--2 .ton-folder__tab { left: auto; right: 10px; }
  .ton-folder--3 .ton-folder__tab { left: 22px; }
  .ton-folder--4 .ton-folder__tab { left: 46px; }
  .ton-folder--5 .ton-folder__tab { left: auto; right: 24px; }
  .ton-folder__row { grid-template-columns: 26px minmax(0, 1fr) 20px; gap: 10px; min-height: 58px; padding: 9px 2px 9px 4px; }
  .ton-folder__t b { font-size: 15px; }
  .ton-folder__who { display: none; }
  .ton-folder__go { grid-column: 3; }
  .ton-fresh, .ton-today__side .ton-fresh { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ton-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ton-mini :is(.ton-swatch__info, .ton-swatch__foot) { display: none; }
  .ton-visit__list { gap: 8px; }
}

/* найвужчі телефони: вушко займає майже всю ширину */
@media (max-width: 380px) {
  .ton-folder__tab { max-width: calc(100% - 24px); }
}

@media (prefers-reduced-motion: no-preference) {
  .ton-folder__go { transition: transform .18s, color .18s; }
  .ton-folder__row:hover .ton-folder__go { transform: translate(2px, -2px); }
}
