/* Чек-листы по локациям (3.1.6, TRACKER-567; 3.2 — телефон и таблица, Данил 29.10): раздел и заполнение (checklists.js).
   Только токены style.css — тёмная тема сама. Пункт — одна разметка: на узкой странице карточка (номер и план — левой колонкой,
   цели нажатия 44 px, поля 16 px), от 880 px ширины страницы — строка таблицы в одной карточке. Состояние — не только цветом:
   заполнено — галочка у номера, отклонение — ромб и слово «Отклонение», не хватает — подпись «Не хватает: …». */
.cl-page { max-width: 880px; container-type: inline-size; }
.cl-page.cl-list-p { max-width: 1600px; }
.cl-sec { margin-bottom: var(--sp-4); }
.cl-lines { display: flex; flex-direction: column; }
.cl-line { display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; padding: var(--sp-2); border-radius: var(--r-m); color: var(--text); }
.cl-line:hover, .cl-line:focus-visible { background: var(--hover); text-decoration: none; }
.cl-line > .i-svg, .cl-pick > .i-svg { flex: none; color: var(--muted); }
.cl-line-b, .cl-pick-b { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.chip.cl-done { background: var(--done-soft); color: var(--done); }
.chip.cl-err { background: var(--danger-soft); color: var(--danger); }
.chip.cl-chip-draft { background: var(--primary-soft); color: var(--primary); }

/* выбор: локация → шаблон */
.cl-locs { flex-wrap: wrap; padding: 0 var(--sp-2) var(--sp-3); overflow: visible; }
.cl-picks { display: flex; flex-direction: column; }
.cl-pick { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 56px; padding: var(--sp-2); border: 0; border-radius: var(--r-m);
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.cl-pick + .cl-pick { box-shadow: 0 -1px 0 var(--border); }
.cl-pick:hover, .cl-pick:focus-visible { background: var(--hover); }
.cl-last { white-space: nowrap; }

/* администратор: обмен с Итилиумом, подразделения, все шаблоны */
.cl-note { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-3); }
.cl-note-err { color: var(--danger); }
.cl-map-r { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-2); }
.cl-map-r + .cl-map-r { box-shadow: 0 -1px 0 var(--border); }
.cl-map-n { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; }
.cl-map-r select { flex: 0 1 360px; min-width: 0; }
.cl-map-r select + select { flex-basis: 100%; }   /* 3.2: состав услуги — своей строкой под подразделением */
.cl-map-no .cl-map-n > b::before { content: ''; display: inline-block; width: 8px; height: 8px; margin: 0 var(--sp-2) 1px 0; background: var(--warn); transform: rotate(45deg); }
.cl-adm > summary { cursor: pointer; padding: var(--sp-1) 0; font-weight: 600; }
.cl-adm-ts { display: flex; flex-direction: column; margin-top: var(--sp-2); }
.cl-adm-t { display: flex; flex-direction: column; padding: var(--sp-2) 0; box-shadow: 0 -1px 0 var(--border); }
.cl-adm-t.cl-arch { opacity: .7; }

/* заполненный: где он сейчас */
.cl-state { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.cl-state-b { flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; }
.cl-state-err .cl-state-b > b { color: var(--danger); }
.cl-total { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; }
.cl-total > b { font-size: 28px; line-height: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* пункт — карточка (телефон, узкая страница) */
.cl-rows { display: flex; flex-direction: column; gap: var(--sp-3); }
.cl-row.cl-head { display: none; }
.cl-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: "n what" "plan fact" "com com" "file file" "res res" "need need";
  column-gap: var(--sp-3); padding: var(--sp-3); background: var(--panel); border-radius: var(--r-l); box-shadow: var(--shadow); scroll-margin: 72px 0 160px; }
.cl-c-n { grid-area: n; } .cl-c-what { grid-area: what; min-width: 0; } .cl-c-plan { grid-area: plan; } .cl-c-fact { grid-area: fact; }
.cl-c-com { grid-area: com; } .cl-c-file { grid-area: file; } .cl-c-res { grid-area: res; } .cl-need { grid-area: need; }
.cl-c-plan, .cl-c-fact, .cl-c-com, .cl-c-file, .cl-c-res, .cl-need { margin-top: var(--sp-2); }   /* не row-gap: у пустых строк сетки (нет комментария, результата) зазор остался бы */
.cl-n { display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 40px; height: 28px; padding: 0 var(--sp-1); border-radius: var(--r-s);
  background: var(--panel2); font-weight: 600; font-variant-numeric: tabular-nums; }
.cl-n > .i-svg { display: none; }
.cl-ok .cl-n { background: var(--done-soft); color: var(--done); } .cl-ok .cl-n > .i-svg { display: inline-block; }
.cl-dev .cl-n { background: var(--warn-soft); color: var(--warn-text); }
.cl-tags { display: flex; align-items: baseline; gap: var(--sp-1) var(--sp-2); flex-wrap: wrap; }
.cl-point { flex: 1 1 auto; min-width: 0; }
.chip.cl-ko { background: var(--warn-soft); color: var(--warn-text); }
.chip.cl-dev-chip { display: none; align-items: center; gap: var(--sp-1); background: var(--warn-soft); color: var(--warn-text); }
.cl-dev .chip.cl-dev-chip { display: inline-flex; }
.cl-dia { display: inline-block; width: 7px; height: 7px; background: currentColor; transform: rotate(45deg); }
.cl-desc { margin: var(--sp-1) 0 0; font-size: var(--fs-m); line-height: var(--lh-page); overflow-wrap: anywhere; }
.cl-c-plan { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44px; }
.cl-c-plan > b { font-size: 16px; line-height: 24px; font-variant-numeric: tabular-nums; }
.cl-lbl { font-size: var(--fs-s); line-height: var(--lh-page-s); color: var(--muted); }
.cl-c-fact { display: flex; align-items: center; gap: var(--sp-2); }
.cl-fact-l { display: inline-flex; flex-direction: column; }
.cl-c-fact .cl-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }   /* подпись — диктору; на экране — «Факт» в поле */
.cl-fact { width: 80px; height: 44px; font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.cl-fact::placeholder { color: var(--muted); }
.cl-fact[readonly], .cl-com[readonly] { border-color: transparent; background: none; box-shadow: none; padding-left: 0; text-align: left; }
.cl-same { flex: 1 1 auto; height: 44px; justify-content: center; }
.cl-dev .cl-fact:not([readonly]) { border-color: var(--warn); }
.cl-c-com { display: none; flex-direction: column; }
.cl-c-com.cl-open { display: flex; }
.cl-com-f { position: relative; display: block; }
.cl-com { display: block; width: 100%; min-height: 44px; padding-right: 56px; resize: none; font-size: 16px; field-sizing: content; }
.cl-cnt { position: absolute; right: var(--sp-2); bottom: var(--sp-2); font-size: 12px; line-height: 16px; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.cl-com-need .cl-com:not([readonly]) { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.cl-com-need .cl-cnt { color: var(--danger); }
.cl-com-btn, .cl-cam, .cl-attach { height: 44px; }
.cl-c-file { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.cl-c-file:empty { display: none; }
.cl-up:empty { display: none; }   /* «Загрузка 40 %» — только пока грузится, иначе пустая строка под кнопками */
.cl-c-file .cam { display: contents; }
.cl-cam, .cl-attach, .cl-com-btn { flex: 1 1 0; justify-content: center; padding: 0 var(--sp-2); }
/* заполненный: факт — текстом, как план */
.cl-ro .cl-c-fact .cl-lbl { position: static; width: auto; height: auto; clip-path: none; }
.cl-ro .cl-fact-l { align-items: center; }
.cl-ro .cl-fact { width: 4em; height: 24px; padding: 0; font-size: 16px; font-weight: 600; text-align: center; }
.cl-ro .cl-com { min-height: 0; padding: 0; field-sizing: content; }
/* 3.2 (аудит интерфейса): файл пункта — одной строкой: миниатюра, имя с многоточием, крестик «Убрать фото»; «Комментарий» — строкой выше */
.cl-c-file.cl-has > .cl-com-btn { flex: 1 1 100%; justify-content: flex-start; }
.cl-f1 { display: flex; align-items: center; gap: var(--sp-1); flex: 1 1 100%; min-width: 0; }
.cl-fname { min-width: 0; max-width: 100%; height: 44px; justify-content: flex-start; } .cl-f1 > .cl-fname { flex: 0 1 auto; }
.cl-fname > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cl-thumb { flex: none; width: 32px; height: 32px; margin-left: -4px; border-radius: var(--r-s); object-fit: cover; background: var(--panel2); }
.cl-f1 > .muted, .cl-f1 > .cl-x { flex: none; }
.cl-x { width: 44px; height: 44px; padding: 0; justify-content: center; }
.cl-c-res { display: flex; flex-direction: column; gap: var(--sp-1); }
.cl-c-res:empty { display: none; }
.cl-res b { font-variant-numeric: tabular-nums; }
.cl-inc { display: flex; flex-direction: column; }
.cl-inc-btn { height: 44px; align-self: flex-start; }
.cl-need { margin: 0; color: var(--danger); }
.cl-row.cl-miss { box-shadow: inset 0 0 0 2px var(--danger); }
.cl-row.cl-flash { animation: cl-flash 1.2s var(--ease-out); }
@keyframes cl-flash { from { background: var(--primary-soft); } }
@media (prefers-reduced-motion: reduce) { .cl-row.cl-flash { animation: none; } }
.cl-foot { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin: var(--sp-4) 0; }

/* нижняя панель: сколько заполнено, чего не хватает, «Отправить» — закреплена над нижней панелью телефона */
.cl-dock { position: sticky; bottom: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-4) 0 0; padding: var(--sp-3) var(--sp-4);
  background: var(--panel); border-radius: var(--r-l) var(--r-l) 0 0; box-shadow: 0 -1px 0 var(--border), 0 -8px 24px -12px rgba(27, 31, 59, .18); }
.cl-prog { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px var(--sp-3); }
.cl-prog-t { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cl-bar { height: 6px; border-radius: var(--r-full); background: var(--panel2); overflow: hidden; }
.cl-bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width var(--t-mid) var(--ease-out); }
.cl-ready .cl-bar > i { background: var(--done); }
.cl-hint { grid-column: 1 / -1; }
.cl-dock-a { display: flex; gap: var(--sp-2); }
.cl-next .i-svg { margin: 0 0 0 2px; }

@container (max-width: 599px) {
  .cl-dock { flex-direction: column; align-items: stretch; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3) var(--sp-3); margin-left: calc(-1 * var(--sp-2)); margin-right: calc(-1 * var(--sp-2)); }
  .cl-dock-a > .btn { flex: 1 1 auto; height: 44px; justify-content: center; }
  .cl-dock-a > .cl-next { flex: 0 1 auto; }
  .cl-state .btn { width: 100%; height: 44px; justify-content: center; }
  .cl-foot > .btn { flex: 1 1 auto; justify-content: center; height: 44px; }
}
@media (max-width: 600px) {
  .cl-dock { bottom: calc(57px + env(safe-area-inset-bottom)); }   /* над нижней панелью (.tabbar), как .ag-dock */
  .cl-pick { min-height: 60px; }
}

/* таблица: страница от 880 px — пункт строкой, колонки: № · пункт · план · факт · комментарий · файл (· Итилиум) */
@container (min-width: 880px) {
  .cl-rows { gap: 0; background: var(--panel); border-radius: var(--r-l); box-shadow: var(--shadow); padding: 0 var(--sp-2); }
  .cl-row { grid-template-columns: 48px minmax(0, 2.2fr) 56px 216px minmax(0, 1.6fr) 196px; grid-template-areas: "n what plan fact com file" "n need need need need need";
    align-items: start; column-gap: var(--sp-3); padding: var(--sp-3) var(--sp-2); background: none; border-radius: var(--r-m); box-shadow: none; }
  .cl-row + .cl-row { box-shadow: 0 -1px 0 var(--border); }
  .cl-c-plan, .cl-c-fact, .cl-c-com, .cl-c-file, .cl-c-res { margin-top: 0; }
  .cl-row.cl-miss { box-shadow: inset 0 0 0 2px var(--danger); }
  .cl-sent .cl-row { grid-template-columns: 48px minmax(0, 2fr) 56px 88px minmax(0, 1.4fr) 180px 220px; grid-template-areas: "n what plan fact com file res" "n need need need need need need"; }
  .cl-row.cl-head { display: grid; position: sticky; top: 56px; z-index: var(--z-1); padding-block: var(--sp-2); background: var(--panel); border-radius: var(--r-l) var(--r-l) 0 0;
    font-size: var(--fs-s); line-height: var(--lh-page-s); font-weight: 500; color: var(--muted); }
  .cl-head > span:nth-child(1) { grid-area: n; } .cl-head > span:nth-child(2) { grid-area: what; } .cl-head > span:nth-child(3) { grid-area: plan; }
  .cl-head > span:nth-child(4) { grid-area: fact; } .cl-head > span:nth-child(5) { grid-area: com; } .cl-head > span:nth-child(6) { grid-area: file; } .cl-head > span:nth-child(7) { grid-area: res; }
  .cl-head > span { align-self: center; }
  .cl-c-plan { align-items: flex-start; justify-content: flex-start; min-height: 36px; padding-top: 6px; }
  .cl-c-plan > .cl-lbl { display: none; }
  .cl-c-plan > b { font-size: var(--fs-m); line-height: var(--lh-page); }
  .cl-fact { width: 72px; height: 36px; font-size: var(--fs-m); }
  .cl-same, .cl-com-btn, .cl-cam, .cl-attach, .cl-fname, .cl-inc-btn { height: 36px; flex: 0 0 auto; }
  .cl-x { width: 36px; height: 36px; }
  .cl-com-btn { display: none !important; }   /* на компьютере поле комментария всегда на месте */
  .cl-c-com { display: flex; }
  .cl-c-file:empty { display: block; }
  .cl-ro .cl-c-fact .cl-lbl { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
  .cl-ro .cl-fact { height: 32px; font-size: var(--fs-m); text-align: left; }   /* 3.2 (аудит): строка факта — на линии плана (у плана отступ 6 + строка 20) */
  .cl-com { min-height: 36px; font-size: var(--fs-m); }
  .cl-c-file { gap: var(--sp-1); }
  .cl-thumb { width: 24px; height: 24px; }
  .cl-desc { margin-top: 0; }
  .cl-tags { order: 2; margin-top: var(--sp-1); }
  .cl-c-what { display: flex; flex-direction: column; }
}
.cl-ro .cl-c-plan { justify-content: flex-start; }
