/* Стили шаблонов. Владелец — по карте слотов 00-plan §4; цвета только из theme.css. */

/* Строка «Шаблон» окна встречи: выбор и откуда тип. */
.tpl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.tpl-picker { max-width: 100%; }
.tpl-source { color: var(--muted-foreground); }

/* «Итоги по типу «Ретро»» в шапке итогов: текст строки, у организатора — тихая кнопка меню (app.css .w-quiet-trigger). */
.tpl-type { min-width: 0; font-size: 13px; line-height: 20px; color: var(--body); overflow-wrap: anywhere; }

/* «Новый вариант · Заменить» под правленым «Кратко». */
.tpl-variant { display: grid; gap: 4px; margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.tpl-variant p { margin: 0; font-size: 14px; line-height: 22px; color: var(--body); white-space: pre-wrap; overflow-wrap: anywhere; }
.tpl-variant .w-btn { justify-self: start; }

/* Секции-не-списки: текст, шкала; таблица — список, как в письме (readout.css .rd-rows). */
.tpl-text { margin: 6px 0 0; font-size: 14px; line-height: 22px; color: var(--body); overflow-wrap: anywhere; }
.tpl-scale { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.tpl-scale-value { font-size: 20px; line-height: 28px; font-weight: 600; color: var(--foreground); }
.tpl-scale-value.is-empty { font-size: 14px; line-height: 22px; font-weight: 400; color: var(--muted-foreground); }
.tpl-scale-of { font-size: 13px; color: var(--muted-foreground); }

/* «Не нашлось: …» и блок «Из итогов по типу …». */
.tpl-not-found { margin-top: 20px; }
.tpl-leftover .w-h3 { color: var(--muted-foreground); }

/* Пометка «проверьте» у ответственного, когда голоса разделены приблизительно. */
.w-item-check { padding: 0 6px; border-radius: 6px; background: var(--warning-bg); color: var(--warning); font-size: 12px; line-height: 18px; }

/* Страница шаблона. */
.tpl-page { display: grid; gap: 20px; max-width: 720px; }
.tpl-page-head p { margin: 4px 0 0; color: var(--muted-foreground); }
/* The sections of the summary: one line each — the title and what it asks, cut to the line — opened on a press. */
.tpl-page-sections { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.tpl-page-sections li { border-bottom: 1px solid var(--border); }
.tpl-page-sections li:last-child { border-bottom: 0; }
.tpl-page-sections summary { display: flex; align-items: center; gap: 0; min-height: 44px; cursor: pointer; list-style: none; }
.tpl-page-sections summary::-webkit-details-marker, .tpl-fold > summary::-webkit-details-marker { display: none; }
.tpl-page-sections summary b { flex-shrink: 0; max-width: 50%; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tpl-sec-line { flex: 1; min-width: 0; color: var(--muted-foreground); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tpl-page-sections summary .w-i, .tpl-fold > summary .w-i { flex-shrink: 0; width: 16px; height: 16px; margin-left: 8px; color: var(--muted-foreground); transition: transform .12s; }
.tpl-page-sections details[open] > summary .w-i, .tpl-fold[open] > summary .w-i { transform: rotate(180deg); }
.tpl-page-sections details[open] .tpl-sec-line { visibility: hidden; }
.tpl-sec-more { display: grid; gap: 2px; padding: 0 0 10px; }
.tpl-sec-more p { margin: 0; color: var(--body); overflow-wrap: anywhere; }
.tpl-sec-more small { color: var(--muted-foreground); }
.tpl-fold > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none; }
.tpl-page-sections summary:focus-visible, .tpl-fold > summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
/* ⋯ of the page reads as clearly as its title. */
.tpl-menu .w-ib { color: var(--foreground); }
.tpl-page-list { margin: 0; padding-left: 20px; color: var(--body); }
.tpl-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--soft); color: var(--muted-foreground); font-size: 12px; line-height: 18px; }

/* «Шаблоны» (WP30, scr §10.1): одно поле ищет и собирает, строки шаблонов. */
.tpl-ask { display: flex; gap: 8px; align-items: center; margin: 16px 0 0; }
.tpl-ask .w-input { flex: 1; min-width: 0; }
/* «Например: …» under the empty field (proto): quiet words that open the window with them. */
.tpl-example { display: block; max-width: 100%; margin: 8px 0 0; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; line-height: 20px; color: var(--muted-foreground); text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.tpl-example:hover { color: var(--foreground); }
/* The list is quiet (proto): rows without frames, the name over the description, a mark in words, the facts right. */
.tpl-list { display: grid; gap: 0; margin: 12px 0 0; padding: 0; list-style: none; }
.tpl-row-link { display: grid; grid-template-columns: minmax(0, 1fr) auto 140px; align-items: center; gap: 2px 16px; width: 100%; min-height: 60px; padding: 9px 12px; border: 0; border-radius: 12px; background: none; color: var(--foreground); text-decoration: none; text-align: left; font: inherit; }
.tpl-row-link:hover { background: var(--hover); }
.tpl-row-copy { display: grid; gap: 2px; min-width: 0; }
.tpl-row-copy b { font-weight: 500; overflow-wrap: anywhere; }
.tpl-row-copy small { font-size: 13px; line-height: 20px; color: var(--muted-foreground); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tpl-row-meta { font-size: 13px; color: var(--muted-foreground); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tpl-row-marks { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tpl-mark { font-size: 13px; line-height: 20px; color: var(--accent-ink); white-space: nowrap; }
.tpl-lock .w-i { width: 14px; height: 14px; color: var(--muted-foreground); }
.tpl-build-row { grid-template-columns: auto minmax(0, 1fr); min-height: 48px; border: 1px dashed var(--border); cursor: pointer; }
.tpl-build-row .w-i, .tpl-from-words .w-i { width: 14px; height: 14px; color: var(--accent-ink); }
.tpl-none { padding: 10px 12px; }

/* Окно «Новый шаблон» (scr §10.2): слова и примеры, затем слова слева и шаблон справа. */
#tpl-wizard.org-dialog { width: 980px; }
.tpl-describe { display: grid; gap: 8px; }
.tpl-said { resize: vertical; min-height: 84px; }
.tpl-samples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.tpl-sample, .tpl-hint { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--body); font: inherit; font-size: 13px; line-height: 20px; text-align: left; cursor: pointer; }
.tpl-sample:hover, .tpl-hint:hover { background: var(--hover); }
.tpl-refusal { display: grid; gap: 6px; justify-items: start; padding: 10px 12px; border-radius: 12px; background: var(--warning-bg); color: var(--warning); }
.tpl-refusal p { margin: 0; }
.tpl-wizard-grid { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 24px; }
.tpl-wizard-words { display: grid; gap: 12px; align-content: start; }
.tpl-words-said p { margin: 4px 0 0; color: var(--body); overflow-wrap: anywhere; white-space: pre-wrap; }
.tpl-wizard-sheet { display: grid; gap: 12px; align-content: start; min-width: 0; }
.tpl-wizard-foot { justify-content: space-between; align-items: center; }
.tpl-base { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tpl-base p { margin: 0; color: var(--muted-foreground); }
.tpl-say { display: grid; gap: 6px; }
.tpl-say-row { display: flex; gap: 8px; }
.tpl-say-row .w-input { flex: 1; min-width: 0; }
.tpl-hints { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-change { margin: 0; color: var(--success); overflow-wrap: anywhere; }
.tpl-note { margin: 0; color: var(--muted-foreground); overflow-wrap: anywhere; }
.tpl-log ol { display: grid; gap: 4px; margin: 6px 0 8px; padding-left: 20px; }
.tpl-log li small { display: block; color: var(--muted-foreground); }
.tpl-part { display: grid; gap: 6px; }
.tpl-agenda { display: grid; gap: 4px; margin: 0; padding-left: 20px; color: var(--body); }
.tpl-agenda li { overflow-wrap: anywhere; }
.tpl-agenda li small { margin-left: 8px; color: var(--muted-foreground); }
.tpl-from-words { margin-right: 4px; }
.tpl-access { display: flex; gap: 6px; align-items: center; margin: 0; color: var(--muted-foreground); }
.tpl-access .w-i { width: 16px; height: 16px; }
.tpl-words { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 0; color: var(--muted-foreground); }
.tpl-word { padding: 0 6px; border-radius: 6px; background: var(--soft); color: var(--body); font-size: 12px; line-height: 18px; }

/* Страница шаблона (scr §10.3, §10.4): строка о правке, «Шаблон обновился у всех», ⋯, «Сделать для всех». */
.tpl-page-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tpl-page-desc { color: var(--body); overflow-wrap: anywhere; }
.tpl-banner, .tpl-edited, .tpl-share, .tpl-confirm { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.tpl-banner { border-color: var(--border-strong); }
.tpl-banner p, .tpl-edited p, .tpl-confirm p { margin: 0; overflow-wrap: anywhere; }
.tpl-edited { grid-template-columns: minmax(0, 1fr) auto; align-items: center; background: var(--soft); }
.tpl-pin { display: flex; gap: 8px; align-items: center; }
.tpl-page-change { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.tpl-menu .w-pop { --pop-w: 220px; }

/* «Правила шаблонов» (r2 R2.2). */
.tpl-rules { display: grid; gap: 8px; margin: 12px 0; padding: 0; list-style: none; }
/* A rule takes two lines — the condition, then «→ шаблон» under it — so no select is cut to «Название содерж…». */
.tpl-rules { gap: 16px; }
.tpl-rule { display: grid; grid-template-columns: 20px minmax(0, 200px) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.tpl-rule-n, .tpl-rule-arrow { color: var(--muted-foreground); text-align: center; }
.tpl-rule-arrow { grid-column: 1; grid-row: 2; }
.tpl-rule-template { grid-column: 2 / 4; grid-row: 2; }
.tpl-rule-del { grid-column: 4; grid-row: 1; }

@media (max-width: 760px) {
  /* The name and the description on top, the facts and the marks on the line under them. */
  .tpl-row-link { grid-template-columns: minmax(0, 1fr) auto; }
  .tpl-row-copy { grid-column: 1 / -1; }
  .tpl-row-meta { grid-row: 2; grid-column: 1; text-align: left; }
  .tpl-row-marks { grid-row: 2; grid-column: 2; justify-content: flex-end; }
  .tpl-wizard-grid { grid-template-columns: minmax(0, 1fr); }
  .tpl-wizard-foot { flex-wrap: wrap; }
  /* Three lines: the kind, its value, «→ шаблон». */
  .tpl-rule-kind { grid-column: 2 / 4; }
  .tpl-rule-value { grid-column: 2 / 4; grid-row: 2; }
  .tpl-rule-arrow { grid-row: 3; }
  .tpl-rule-template { grid-row: 3; }
  .tpl-rule-del { width: 44px; height: 44px; }
  .tpl-ask { flex-wrap: wrap; }
  /* The field takes its own line: beside «Новый шаблон» its hint was cut to «Опишите встречу или». */
  .tpl-ask .w-input { flex-basis: 100%; }
}
