/* Стили шаблонов. Цвета только из 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; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 720px; }
.tpl-page, #tpl-wizard { overflow-wrap: anywhere; }
.tpl-page-head p { margin: 4px 0 0; color: var(--muted-foreground); }
.tpl-title-tools { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.tpl-quick-edit {
  position: relative; isolation: isolate; height: 32px; gap: 5px; padding-inline: 7px;
  border: 0; background: transparent; color: var(--body); font-weight: 500;
}
.tpl-quick-edit.w-ib { width: 32px; padding: 0; }
.tpl-quick-edit .w-i { width: 15px; height: 15px; }
.tpl-quick-edit::before {
  content: ""; position: absolute; z-index: -1; inset: 2px 0; border-radius: 7px; pointer-events: none;
}
.tpl-quick-edit:is(:hover, [aria-expanded="true"]) { background: transparent; color: var(--foreground); }
.tpl-quick-edit:hover::before { background: var(--hover); }
.tpl-quick-edit.tpl-magic[aria-expanded="true"] { color: var(--accent-ink); }
.tpl-quick-edit.tpl-magic[aria-expanded="true"]::before { background: var(--accent-soft); }
.tpl-quick-edit:disabled, .tpl-say-send:disabled { opacity: .45; cursor: default; }
/* 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; }

/* «Шаблоны»: одно поле ищет и собирает, строки шаблонов. */
.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: quiet words that open the window with them. */
/* The list is quiet: rows without frames, the name over the description, a mark in words, the facts right. */
/* One frame of rows, as a group of settings (settings/rows.js); a row is lit whole on hover. */
.tpl-list { display: grid; gap: 0; margin: 16px 0 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.tpl-list > li + li { border-top: 1px solid var(--border); }
.tpl-row-link { display: grid; grid-template-columns: minmax(0, 1fr) auto 140px; align-items: center; gap: 2px 16px; width: 100%; min-height: 56px; padding: 9px 16px; border: 0; border-radius: 0; background: none; color: var(--foreground); text-decoration: none; text-align: left; font: inherit; }
.tpl-row-link:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.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; 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; }

/* Окно «Новый шаблон»: слова и примеры, затем слова слева и шаблон справа. */
#tpl-wizard.org-dialog { width: 980px; }
.tpl-describe { display: grid; grid-template-columns: minmax(0, 1fr); 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 { 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 { 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; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.tpl-wizard-words > .w-btn { justify-self: start; }
.tpl-words-said p { margin: 4px 0 0; color: var(--body); overflow-wrap: anywhere; white-space: pre-wrap; }
.tpl-wizard-sheet { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.tpl-preview-manual { justify-self: start; }
.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; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.tpl-say-row { display: flex; align-items: center; gap: 8px; }
.tpl-say-row .w-input { flex: 1; min-width: 0; }
.tpl-say-compact { max-width: 32rem; gap: 0; }
.tpl-say-compact .tpl-say-row { gap: 4px; }
.tpl-say-compact .tpl-say-send { position: relative; isolation: isolate; background: transparent; color: var(--accent-ink); }
.tpl-say-send::before {
  content: ""; position: absolute; z-index: -1; inset: 0; border-radius: 50%;
  background: var(--accent-soft); pointer-events: none;
}
.tpl-say-send:hover:not(:disabled)::before { background: var(--hover); }
.tpl-hints { display: flex; flex-wrap: wrap; gap: 0 12px; }
.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; grid-template-columns: minmax(0, 1fr); 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-participants-get { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.tpl-participants-get .w-pick-btn { min-width: 96px; }
.tpl-access { display: flex; gap: 6px; align-items: flex-start; margin: 0; color: var(--muted-foreground); }
.tpl-access .w-i { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 3px; }
.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; }

/* Страница шаблона: строка о правке, «Шаблон обновился у всех», ⋯, «Сделать для всех». */
.tpl-page-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tpl-page-title > .w-h2 { min-width: 0; }
.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; }

/* «Правила шаблонов». */
/* The rules: one frame of rows, as a group of settings (settings/rows.js). */
.tpl-rules { display: grid; gap: 8px; margin: 20px 0 12px; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
/* A rule takes two lines — the condition, then «→ шаблон» under it — so no select is cut to «Название содерж…». */
.tpl-rules { gap: 0; }
.tpl-rules > .tpl-rule { margin: 0 16px; padding: 14px 0; }
.tpl-rules > .tpl-rule + .tpl-rule { border-top: 1px solid var(--border); }
.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; }

/* Manual editing uses the same form on the page and in the wizard. */
.tpl-manual-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-width: 36rem; overflow-wrap: anywhere; }
#tpl-wizard .tpl-manual-form { margin-inline: auto; }
@media (min-width: 761px) {
  #tpl-wizard.org-dialog:has(.tpl-manual-form) { width: 560px; }
}
.tpl-manual-form :is(.w-note, .w-field-error) { margin: 0; }
.tpl-manual-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; min-width: 0; }
.tpl-manual-form .w-input { min-width: 0; padding-inline: 10px; border-radius: 8px; }
.tpl-manual-form textarea.w-input { min-height: 36px; max-height: 10rem; padding-block: 6px; resize: vertical; }
.tpl-manual-form input[readonly], .tpl-manual-form textarea[readonly] { background: var(--sunken); color: var(--muted-foreground); }
.tpl-manual-duration, .tpl-manual-duration .tpl-manual-field { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.tpl-manual-duration .w-input { width: 72px; }
.tpl-manual-group { border-top: 1px solid var(--border); }
.tpl-manual-group:last-child { border-bottom: 1px solid var(--border); }
.tpl-manual-group > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; list-style: none; cursor: pointer; font-weight: 500; }
.tpl-manual-group > summary::-webkit-details-marker { display: none; }
.tpl-manual-group > summary .w-i { width: 16px; height: 16px; margin-inline-start: auto; color: var(--muted-foreground); flex-shrink: 0; }
.tpl-manual-group[open] > summary .w-i { transform: rotate(180deg); }
.tpl-manual-group-body { display: grid; gap: 4px; padding-bottom: 4px; }
.tpl-manual-group-body > .w-btn, .tpl-manual-shape > .w-btn { justify-self: start; }
.tpl-manual-rows, .tpl-manual-shape ul { display: grid; gap: 0; padding: 0; margin: 0; list-style: none; }
.tpl-manual-row { display: grid; gap: 4px; padding-block: 2px 8px; border-bottom: 1px solid var(--border); }
.tpl-manual-row-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.tpl-manual-agenda-fields { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 6px; }
.tpl-manual-unit { position: relative; }
.tpl-manual-unit .w-input { padding-inline-end: 30px; font-variant-numeric: tabular-nums; }
.tpl-manual-unit > span { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted-foreground); pointer-events: none; }
.tpl-manual-row-controls { display: flex; justify-content: flex-end; flex-shrink: 0; }
.tpl-manual-form .w-ib:disabled { opacity: .35; cursor: default; }
.tpl-manual-section-options { display: flex; align-items: end; flex-wrap: wrap; gap: 4px 12px; }
.tpl-manual-section-options .tpl-manual-field { flex: 0 1 132px; }
.tpl-manual-check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 13px; }
.tpl-manual-check input { margin: 0; accent-color: var(--primary); }
.tpl-manual-shape { display: grid; gap: 6px; padding-inline-start: 12px; border-inline-start: 1px solid var(--border); }
.tpl-manual-shape .w-label { margin: 0; }
.tpl-manual-shape-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0 8px; }
.tpl-manual-shape-row .w-ib { align-self: end; margin-bottom: 6px; }
.tpl-manual-shape-row .tpl-manual-check { grid-column: 1 / -1; }
.tpl-manual-foot { position: sticky; bottom: 0; z-index: 2; display: grid; gap: 4px; padding-block: 4px; border-top: 1px solid var(--border); background: var(--background); }
.tpl-manual-foot .w-actions { justify-content: flex-end; }
#tpl-wizard .tpl-manual-foot { background: var(--card); }

@media (max-width: 760px) {
  .tpl-manual-form .w-input, .tpl-manual-form textarea.w-input { min-height: 44px; font-size: 16px; }
  .tpl-manual-form :is(.w-btn, .tpl-manual-check) { min-height: 44px; }
  .tpl-manual-form .w-ib { width: 44px; height: 44px; }
  .tpl-manual-shape-row .w-ib { margin-bottom: 0; }
  .tpl-manual-foot { bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); }
  .tpl-manual-form .tpl-manual-save { position: relative; isolation: isolate; background: transparent; border: 0; box-shadow: none; }
  .tpl-manual-save::before {
    content: ""; position: absolute; z-index: -1; inset: 5px 0; border-radius: 8px;
    background: var(--primary-fill); pointer-events: none;
  }
  #tpl-wizard .tpl-manual-foot { bottom: 0; }
  .tpl-page { gap: 16px; }
  .tpl-title-tools { gap: 0; }
  .tpl-quick-edit.w-ib, .tpl-say-compact .tpl-say-send { width: 44px; height: 44px; }
  .tpl-quick-edit::before { inset-block: 7px; }
  .tpl-quick-edit.w-ib::before { inset-inline: 7px; }
  .tpl-say-send::before { inset: 8px; }
  .tpl-page-sections summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: center; gap: 2px 8px; padding: 8px 0; }
  .tpl-page-sections summary b { max-width: none; white-space: normal; }
  .tpl-page-sections summary .w-i { grid-area: 1 / 2; margin-left: 0; }
  .tpl-sec-line { grid-column: 1; white-space: normal; font-size: 13px; line-height: 20px; }
  .tpl-sec-sep, .tpl-page-sections details[open] .tpl-sec-line { display: none; }
  .tpl-edited { display: flex; flex-wrap: wrap; justify-content: space-between; }
  :is(.tpl-page, #tpl-wizard) :is(.w-btn, .tpl-pin, .tpl-sample) { min-height: 44px; }
  :is(.tpl-page, #tpl-wizard) .w-input { min-height: 44px; font-size: 16px; }
  .tpl-menu .w-ib, #tpl-wizard .org-dialog-head .w-ib { width: 44px; height: 44px; }
  #tpl-wizard :is(.org-dialog-head, .org-dialog-body, .org-dialog-foot) { padding-inline: 16px; }
  .tpl-samples { align-items: stretch; flex-direction: column; gap: 4px; }
  .tpl-sample { padding-block: 6px; border-radius: 8px; }
  /* 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-copy small { white-space: normal; }
  .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%; }
}
