/* Шаблоны как основа постов (ТЗ 8): дерево рубрик, статусы, окна паузы,
   архива и возврата, календарь шаблонов, мини-статус в графике. */

/* ---- статус шаблона: один чип с эмодзи ---- */
.tpl-status { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; flex-shrink: 0; border: 1px solid transparent; vertical-align: middle; }
.tpl-status.is-active { background: var(--green-soft); color: var(--green); }
.tpl-status.is-paused { background: var(--amber-soft); color: var(--amber); }
.tpl-status.is-draft { background: var(--surface-2); color: var(--violet, var(--ink-3)); border-color: var(--line); }
.tpl-status.is-archived { background: var(--surface-2); color: var(--ink-3); border-color: var(--line); }

/* ---- номер шаблона ---- */
.tpl-number { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; flex-shrink: 0; white-space: nowrap; }
.tpl-number.is-conflict { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
.tpl-number-edit { cursor: pointer; font-family: inherit; }
.tpl-number-edit:disabled { cursor: default; opacity: 1; }
.tpl-position-editor { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.tpl-position-editor small { flex-basis: 100%; }
.tpl-card-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.tpl-card-preview { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; background: var(--surface-2); }
.tpl-card-preview > summary { cursor: pointer; font-size: 13px; font-weight: 650; }
.tpl-card-preview[open] > summary { margin-bottom: 12px; }
.tpl-card-settings { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tpl-card-settings > .tpl-settings, .tpl-card-settings > .tpl-status-box { background: var(--surface); }
.rubric-asset-preview { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); padding: 8px; cursor: pointer; }
.rubric-asset-preview img, .rubric-asset-preview video { border-radius: 5px; }
.rubric-shared-photo .rubric-asset-preview { max-width: 280px; }
.rubric-legacy-media > summary { cursor: pointer; padding: 8px 0; color: var(--ink-3); }

/* ---- дерево «рубрика → шаблоны», как ветки на Reddit ---- */
.tpl-tree { display: flex; flex-direction: column; gap: 12px; }
.tpl-tree-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--ink-3); user-select: none; min-width: 0; }
.tpl-tree-head:hover { border-color: var(--accent); }
.tpl-tree-head strong { color: var(--ink); font-size: 13px; }
.tpl-tree-toggle { width: 20px; height: 20px; flex-shrink: 0; border-radius: 999px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 14px; font-weight: 700; line-height: 1; color: var(--ink-3); background: var(--surface-2); }
.tpl-tree-tag { font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-tree-meta { margin-left: auto; font-size: 11.5px; color: var(--ink-4); white-space: nowrap; }
.tpl-tree-node.is-collapsed .tpl-tree-head { background: var(--surface-2); }
.tpl-tree-children { position: relative; margin-left: 18px; padding-left: 22px; padding-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.tpl-tree-item { position: relative; min-width: 0; }
.tpl-tree-item::before { content: ""; position: absolute; left: -21px; top: -8px; width: 17px; height: calc(50% + 8px); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); border-bottom-left-radius: 10px; pointer-events: none; }
.tpl-tree-item:not(:last-child)::after { content: ""; position: absolute; left: -21px; top: 50%; bottom: -8px; border-left: 2px solid var(--line); pointer-events: none; }
.tpl-tree-thread { position: absolute; left: -7px; top: 0; bottom: 0; width: 14px; border: 0; padding: 0; background: transparent; cursor: pointer; z-index: 1; }
.tpl-tree-children:has(> .tpl-tree-thread:hover) > .tpl-tree-item::before,
.tpl-tree-children:has(> .tpl-tree-thread:hover) > .tpl-tree-item::after { border-color: var(--accent); }

/* ---- строка шаблона ---- */
.template-row.tpl-row { position: relative; padding: 11px 14px; display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; }
.template-row.tpl-row .rubric-drag-handle { opacity: .35; cursor: grab; display: inline-flex; color: var(--ink-3); }
.template-row.tpl-row:hover .rubric-drag-handle { opacity: 1; }
.template-row.tpl-row.is-dragging { opacity: .5; }
.template-row.tpl-row.is-drop-before::before { content: ""; position: absolute; left: 0; right: 0; top: -5px; height: 2px; background: var(--accent); border-radius: 2px; }
/* Три места у цели (13.11.2026): черта сверху — «перед», черта снизу — «после», рамка — «станет подгруппой».
   Подпись — номер, который шаблон получит, если отпустить здесь. */
.template-row.tpl-row.is-drop-after::before { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 2px; background: var(--accent); border-radius: 2px; }
.template-row.tpl-row.is-drop-into { box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
.template-row.tpl-row[data-drop-label]::after { content: attr(data-drop-label); position: absolute; right: 14px; top: -11px; z-index: 2; padding: 2px 9px; border-radius: var(--r-pill); background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; pointer-events: none; }
.template-row.tpl-row.is-drop-after[data-drop-label]::after { top: auto; bottom: -11px; }
.template-row.tpl-row.is-pinned { background: var(--accent-soft); }
.template-row.tpl-row.is-paused > :not(.tpl-row-status) { opacity: .5; }
.template-row.tpl-row.is-archived { border-style: dashed; }
.template-row.tpl-row.is-archived > :not(.tpl-row-status) { opacity: .6; }
.template-row.tpl-row.is-highlight { box-shadow: 0 0 0 3px var(--accent-ring, var(--accent-soft)); }
.tpl-row-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.tpl-row-main { min-width: 0; flex: 1 1 auto; }
.tpl-row-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tpl-row-title strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-row-sub { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.tpl-row-status { flex-shrink: 0; }
.tpl-note-glyph { display: inline-flex; align-items: center; font-size: 11.5px; color: var(--ink-3); cursor: default; }

/* ---- третий уровень и имя шаблона (Word-файл владельца, 12.11.2026) ---- */
.tpl-tree-subitems { position: relative; margin: 6px 0 0 26px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.tpl-tree-subitems > .tpl-tree-item::before { left: -19px; top: -6px; width: 15px; height: calc(50% + 6px); }
.tpl-tree-subitems > .tpl-tree-item:not(:last-child)::after { left: -19px; bottom: -6px; }
.template-row.tpl-row.is-chain-child { padding: 8px 12px; background: var(--surface-2); }
.template-row.tpl-row.is-chain-child .tpl-row-title strong { font-size: 13px; }
.tpl-rename-btn { flex-shrink: 0; display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-4); cursor: pointer; opacity: 0; transition: opacity .12s; }
.template-row.tpl-row:hover .tpl-rename-btn, .tpl-rename-btn:focus-visible { opacity: 1; }
.tpl-rename-btn:hover { color: var(--accent-text, var(--accent)); border-color: var(--line); background: var(--surface); }
@media (hover: none) { .tpl-rename-btn { opacity: 1; } }
.tpl-rename-input { min-width: 0; flex: 1 1 260px; max-width: 420px; height: 30px; padding: 4px 8px; font-size: 13px; font-weight: 600; }

/* ---- карточка шаблона: названия блоков и свёрнутая инструкция ---- */
.tpl-block-title { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-4); }
.tpl-note-toggle { display: flex; align-items: center; gap: 2px; width: 100%; padding: 0; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; color: inherit; }
/* Общий шеврон раскрытия (base.css) вместо символа «▸». */
.tpl-note-caret { margin: 0 9px 2px 3px; }
.tpl-note-preview { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; color: var(--ink-3); }
.post-note.is-collapsed { padding-bottom: 10px; }

/* ---- карточка шаблона 13.11.2026: инструкция по частям, формат поста с полями, выпуск из папки ---- */
.tpl-note-count { margin-left: 8px; text-transform: none; letter-spacing: 0; }
.tpl-note-view { display: flex; flex-direction: column; gap: 8px; white-space: normal; }
.tpl-note-points, .tpl-note-warnings { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.tpl-note-manual { padding: 8px 11px; border-radius: var(--r-sm); background: var(--surface-2); }
.tpl-note-warnings { padding: 8px 11px 8px 28px; border-radius: var(--r-sm); background: var(--amber-soft); }
.tpl-note-raw > summary { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.tpl-note-raw-text { margin-top: 6px; padding: 9px 11px; border-radius: var(--r-sm); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; color: var(--ink-2); max-height: 260px; overflow: auto; }

/* Значок «i» с подсказкой при наведении — вместо строки пояснения. */
.tpl-info-mark { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 16px; height: 16px; margin-left: 6px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--ink-3); font-size: 10.5px; font-weight: 700; line-height: 1; text-transform: none; letter-spacing: 0; cursor: help; user-select: none; vertical-align: middle; }
.tpl-info-mark:hover, .tpl-info-mark:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }

/* Формат поста — бланк: постоянный текст как есть, поля обведены, подстановки отмечены. */
.tpl-format-block > summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-format-block > summary::before { margin: 0 2px 2px 3px; }
.tpl-format { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.75; color: var(--ink); max-height: 420px; overflow: auto; }
.tpl-format-field { padding: 1px 7px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; white-space: normal; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.tpl-format-var { padding: 1px 7px; border-radius: 6px; background: var(--green-soft); color: var(--green); font-size: 12.5px; font-weight: 600; }
.tpl-format-link { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tpl-format-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.tpl-format-preview-toggle { margin-top: 8px; }
.tpl-format-telegram { margin-top: 8px; max-height: 520px; overflow-y: auto; padding: 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--tg-bg); background-image: radial-gradient(circle at 50% 0%, rgba(255,255,255,.55), transparent 60%); }

/* Выпуск из папки: одна строка «что делает шаблон», промпт для ИИ — свёрнут. */
.tpl-folder-rule { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tpl-folder-rule > .tpl-block-title { display: flex; align-items: center; }
.tpl-folder-rule-box { display: flex; flex-direction: column; gap: 8px; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.tpl-folder-rule-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tpl-folder-rule-what { font-size: 13px; font-weight: 600; color: var(--ink); }
.tpl-folder-rule-prompt > summary { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.tpl-folder-rule-prompt > p { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.tpl-folder-rule-form { display: grid; gap: 10px; margin: 0; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); min-width: 0; }
.tpl-folder-rule-check { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.tpl-title-editor .input { flex: 1 1 260px; min-width: 0; max-width: 420px; }

/* ---- карточка шаблона: блок статуса ---- */
.tpl-status-box { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: var(--r-md); border: 1px solid var(--line); }
.tpl-status-box.is-active { background: var(--green-soft); }
.tpl-status-box.is-paused { background: var(--amber-soft); }
.tpl-status-box.is-archived { background: var(--surface-2); border-style: dashed; }
.tpl-status-box.is-draft { background: var(--surface-2); }
.tpl-status-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 700; }
.tpl-status-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- карточка шаблона: настройки выхода ---- */
.tpl-settings { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.tpl-setting-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; font-size: 12.5px; border-top: 1px solid var(--line); background: var(--surface); }
.tpl-setting-row:first-child { border-top: 0; }
.tpl-setting-label { color: var(--ink-3); font-weight: 600; }
.tpl-setting-value { min-width: 0; color: var(--ink); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tpl-link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.tpl-link-btn:hover { text-decoration: underline; }

/* ---- окно возврата ---- */
.tpl-restore { display: flex; flex-direction: column; gap: 12px; }
.tpl-restore-block { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.tpl-restore-head { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.tpl-restore-all { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tpl-restore-dates { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tpl-restore-date { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 700; }
.tpl-restore-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.tpl-restore-row { display: grid; grid-template-columns: auto 120px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 12.5px; cursor: pointer; background: var(--surface); }
.tpl-restore-row:first-child { border-top: 0; }
.tpl-restore-row.is-off { background: var(--surface-2); color: var(--ink-3); }
.tpl-restore-when { font-weight: 700; white-space: nowrap; }
.tpl-restore-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-restore-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.tpl-restore-sum { font-size: 12.5px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--green-soft); color: var(--ink-2); }
@media (max-width: 640px) {
  .tpl-restore-row { grid-template-columns: auto minmax(0, 1fr); }
  .tpl-restore-when, .tpl-restore-badges { grid-column: 2; justify-content: flex-start; }
  .tpl-setting-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tpl-setting-label { grid-column: 1 / -1; }
}

/* ---- окна паузы и архива ---- */
.tpl-confirm-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.tpl-confirm-list .is-warning { color: var(--amber); font-weight: 600; }
.tpl-confirm-agree { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; cursor: pointer; }

/* ---- календарь шаблонов ---- */
.tpl-cal-card { border-radius: 6px; padding: 2px 5px 3px 7px; background: var(--surface); border: 1px solid var(--line); border-left-width: 3px; border-left-style: solid; min-width: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.tpl-cal-card:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.tpl-cal-top { display: flex; align-items: center; gap: 4px; line-height: 1.2; min-width: 0; }
.tpl-cal-num, .tpl-cal-time { font-size: 9.5px; font-weight: 800; color: var(--ink-3); flex-shrink: 0; }
.tpl-cal-title { font-size: 10.5px; font-weight: 650; line-height: 1.2; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-cal-chip { display: inline-flex; align-items: center; height: 14px; padding: 0 5px; border-radius: 999px; font-size: 8.5px; font-weight: 800; white-space: nowrap; line-height: 1; flex-shrink: 0; }
.tpl-cal-chip.is-active { background: var(--green-soft); color: var(--green); }
.tpl-cal-chip.is-paused { background: var(--amber-soft); color: var(--amber); }
.tpl-cal-chip.is-archived { background: var(--surface-2); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.tpl-cal-card.is-paused { opacity: .5; }
.tpl-cal-card.is-archived { opacity: .7; border-style: dashed; background: var(--surface-2); }
.tpl-cal-card.is-archived .tpl-cal-title { text-decoration: line-through; color: var(--ink-3); }
.tpl-cal-card.is-dimmed { opacity: .22 !important; }
.tpl-cal-card.is-emphasized { opacity: 1 !important; }
.tpl-cal-card.is-highlight { box-shadow: 0 0 0 2px var(--accent); }
.tpl-cal-day { min-width: 0; min-height: 96px; border-radius: 10px; padding: 5px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.tpl-cal-day.is-weekend { background: var(--surface-2); }
.tpl-cal-day.is-today { border-color: var(--accent); background: var(--accent-soft); }
.tpl-cal-empty { min-width: 0; min-height: 96px; border-radius: 10px; background: var(--surface-2); opacity: .4; }
.tpl-cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 10px; }

/* ---- график постинга: мини-статус шаблона и плитки «Пауза», «Архив» ---- */
.tpl-mini { display: inline-flex; align-items: center; gap: 2px; height: 14px; padding: 0 5px; border-radius: 999px; font-size: 8.5px; font-weight: 800; white-space: nowrap; line-height: 1; flex-shrink: 0; }
.tpl-mini.is-active { background: var(--green-soft); color: var(--green); }
.tpl-mini.is-paused { background: var(--amber-soft); color: var(--amber); }
.tpl-mini.is-released { background: transparent; color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.tpl-mini.is-archived { background: var(--surface-2); color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line); }
.scheduler-status-filters.is-eight { grid-template-columns: repeat(var(--sched-tiles, 8), minmax(0, 1fr)); }
.scheduler-status-filters.is-eight .scheduler-status-filter { min-width: 0; padding: 4px 6px; gap: 5px; }
.scheduler-status-filters.is-eight .scheduler-status-filter > span:last-child { min-width: 0; font-size: 11.5px !important; line-height: 1.15; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-align: left; }
.tpl-paused-banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--amber-soft); border: 1px solid var(--line); font-size: 12.5px; flex-wrap: wrap; }
.tpl-archived-banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--ink-4); font-size: 12.5px; flex-wrap: wrap; }

/* ---- мастер шаблона: «по ситуации» и инструкция (ТЗ 8, M-02, N-01) ---- */
.wizard-situational-toggle { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: start; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; transition: border-color .14s, background .14s; }
.wizard-situational-toggle:hover { border-color: var(--accent); }
.wizard-situational-toggle.is-on { border-color: var(--accent); background: var(--accent-soft); }
.wizard-situational-toggle input { margin-top: 2px; }
.wizard-situational-toggle span { display: grid; gap: 2px; }
.wizard-situational-toggle strong { font-size: 12.5px; color: var(--ink-2); }
.wizard-situational-toggle small { font-size: 11px; color: var(--ink-4); line-height: 1.4; }
.wizard-template-note { margin-bottom: 12px; }
.wizard-template-note .textarea { min-height: 52px; }
.wizard-template-note-hint { display: flex; gap: 4px; align-items: baseline; padding: 8px 12px; margin-bottom: 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink-2); font-size: 12.5px; line-height: 1.45; overflow: hidden; }
.wizard-template-note-hint strong { flex-shrink: 0; }
.wizard-template-note-hint span { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- график: подсказка и плашки статуса шаблона (ТЗ 8, U-03) ---- */
.scheduler-template-tip { font-weight: 600; }
.scheduler-template-tip.is-amber { color: var(--amber); }
.scheduler-template-tip.is-green { color: var(--green); }
.scheduler-template-tip.is-muted { color: var(--ink-3); }
.tpl-paused-banner, .tpl-archived-banner { margin-bottom: 12px; }
.tpl-paused-banner.is-released { background: transparent; border: 1px solid var(--amber); }
.scheduler-post-card.is-archived .tpl-mini { opacity: 1; }
@media (max-width: 760px) {
  .scheduler-status-filters.is-eight { grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); }
}

/* ---- окна «Новый пост» и «Сменить шаблон» (ТЗ 8, B-02, B-04, B-05) ---- */
/* Шаг «Рубрика» мастера: шаблоны выбранной рубрики — карточками того же вида, что рубрики (13.11.2026). */
.wizard-rubric-templates { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.wizard-rubric-templates-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.wizard-rubric-templates-head h2 { font-size: 15px; font-weight: 650; }
.wizard-rubric-templates-head .field-hint { margin-left: 10px; }
.wizard-rubric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wizard-rubric-card, .wizard-template-card { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-xs); cursor: pointer; text-align: left; font-family: inherit; transition: border-color .14s, background .14s, box-shadow .14s; }
.wizard-rubric-card:hover, .wizard-template-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.wizard-rubric-card.is-picked, .wizard-template-card.is-picked { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-ring); }
.wizard-rubric-card:focus-visible, .wizard-template-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wizard-template-card:disabled { opacity: .6; cursor: default; }
.wizard-template-card-title { display: flex; align-items: baseline; gap: 7px; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.wizard-template-card-title .wizard-rubric-number { flex-shrink: 0; }
.wizard-template-card-sub { font-size: 12px; line-height: 1.4; color: var(--ink-3); }
@media (max-width: 520px) { .wizard-rubric-grid { grid-template-columns: 1fr; } }

/* Окно «Новый пост»: две равные карточки (13.11.2026). */
.tpl-newpost { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 12px; align-items: stretch; }
.tpl-newpost-card { display: flex; align-items: flex-start; gap: 12px; min-width: 0; min-height: 132px; padding: 16px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; font: inherit; box-shadow: var(--sh-xs); transition: border-color .14s, box-shadow .14s, background .14s; }
.tpl-newpost-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.tpl-newpost-card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); outline: none; }
.tpl-newpost-icon { flex: 0 0 auto; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-text); }
.tpl-newpost-card:hover .tpl-newpost-icon { background: var(--surface); }
.tpl-newpost-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tpl-newpost-text strong { font-size: 14.5px; font-weight: 650; }
.tpl-newpost-hint { font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.tpl-newpost-go { flex: 0 0 auto; align-self: center; display: inline-flex; color: var(--ink-4); }
.tpl-newpost-card:hover .tpl-newpost-go { color: var(--accent); }
.tpl-newpost-list { min-width: 0; }
.tpl-pick-groups { max-height: 420px; overflow-y: auto; padding-right: 2px; display: flex; flex-direction: column; gap: 12px; }
.tpl-pick-group-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12.5px; color: var(--ink-2); }
.tpl-pick-items { display: flex; flex-direction: column; gap: 6px; }
.tpl-pick-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; text-align: left; font: inherit; font-size: 12.5px; color: var(--ink); }
.tpl-pick-item:hover { border-color: var(--accent); }
.tpl-pick-item.is-picked { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-ring); }
.tpl-pick-item.is-paused { opacity: .6; }
.tpl-pick-title { font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tpl-pick-sub { color: var(--ink-3); font-size: 11.5px; }
.tpl-pick-free { margin-left: auto; color: var(--ink-4); font-size: 11.5px; }
.tpl-pick-issue { margin-left: auto; color: var(--amber); font-size: 11.5px; font-weight: 700; }
.tpl-swap { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tpl-swap-what { padding: 12px; background: var(--surface-2); font-size: 12.5px; }
.tpl-swap-what ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.tpl-swap-what li.is-warning { color: var(--amber); font-weight: 600; }
@media (max-width: 760px) {
  .tpl-newpost, .tpl-swap { grid-template-columns: 1fr; }
}

/* ---- мастер поста по шаблону: плашка, инструкция и задача (ТЗ 8, U-02, N-02) ---- */
/* Шаблон поста — чип справа в шапке режима мастера (макет ТЗ 8). */
.wizard-mode-banner.has-template-chip { flex-wrap: wrap; row-gap: 8px; }
.wizard-mode-banner.has-template-chip .wizard-mode-banner-copy { flex: 1 1 220px; }
.wizard-template-plaque { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; margin-left: auto; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.wizard-template-plaque .tpl-number { flex-shrink: 0; }
.wizard-template-plaque-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.wizard-template-plaque-dot { color: var(--ink-4); }
.wizard-template-plaque button { flex-shrink: 0; border: 0; background: transparent; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; white-space: nowrap; }
.wizard-template-plaque button:hover { text-decoration: underline; }
.wizard-template-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 12px; }
.wizard-template-notes .post-note { margin: 0; }
.wizard-duplicate-issue { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ТЗ 8 (V-03): чип языка речи у ролика и его меню (макет: мастер → «Медиа»). */
.media-lang-wrap { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.media-lang-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font: inherit; font-size: 11.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.media-lang-chip:hover { border-color: var(--accent); }
.media-lang-chip:disabled { cursor: progress; opacity: .7; }
.media-lang-chip.is-manual { border-color: var(--accent-soft-2); background: var(--accent-soft); color: var(--accent-text); }
.media-lang-chip.is-unset { border-color: var(--amber-border); background: var(--amber-soft); color: var(--amber-text-strong); }
.media-lang-chip.is-pending, .media-lang-chip.is-later { color: var(--ink-3); font-weight: 600; }
.media-lang-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: media-lang-pulse 1.2s ease-in-out infinite; }
@keyframes media-lang-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.media-lang-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 230px; max-height: 320px; overflow-y: auto; padding: 6px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh-lg); }
.media-lang-menu-head { padding: 4px 8px 6px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.media-lang-option { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: transparent; font: inherit; font-size: 12.5px; color: var(--ink); text-align: left; cursor: pointer; }
.media-lang-option:hover, .media-lang-option.is-current { background: var(--accent-soft); }
.media-lang-code { min-width: 26px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.media-lang-share { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.media-lang-menu-foot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.media-lang-error { font-size: 12px; color: var(--red); }

/* ТЗ 8 (V-04): «Ролик на другом языке» над роликами и строки «куда уйдёт» по языку. */
.media-video-routing { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.media-video-routing-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.media-route-lines { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }

/* «Ролики — и на YouTube» шага «Медиа» (решение владельца 28.10.2026): итог для роликов поста
   и одно нажатие, чтобы отправить их и на YouTube; ниже — «Ссылка на ролик YouTube в тексте». */
.media-youtube-plaque { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.media-youtube-plaque.is-on { border-color: var(--accent-soft-2); background: var(--accent-soft); }
.media-youtube-plaque.is-empty { border-style: dashed; }
.media-youtube-plaque-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.media-youtube-plaque-head strong { font-size: 13px; }
.media-youtube-plaque-channel { font-size: 12px; color: var(--ink-3); min-width: 0; overflow-wrap: anywhere; }
.media-youtube-plaque-lines { display: flex; flex-direction: column; gap: 3px; margin: 0; padding-left: 18px; font-size: 12px; color: var(--ink-2); }
.media-youtube-plaque-link { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
/* ИИ-советчик шага «Медиа» (29.10.2026). */
.media-ai-advisor { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--r-md); border: 1px dashed var(--accent-soft-2); background: var(--surface-2); }
.media-ai-advisor.is-busy { border-style: solid; }
.media-ai-advisor-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.media-ai-advisor-head strong { font-size: 13px; }
.media-ai-advisor-result { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.media-ai-advisor-result.is-ok { color: var(--ink); }
.media-ai-advisor-result.is-error { color: var(--red); }
.media-ai-advisor-mode { display: inline-flex; align-items: center; gap: 6px; }
/* Раскладка по площадкам (29.10.2026). */
/* Выбор и закрепление элемента, режим ролика (29.10.2026) */
.media-routing-controls { display: inline-flex; align-items: center; gap: 6px; }
.media-pick-box {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-strong, var(--line));
  background: var(--surface); color: var(--surface); display: inline-grid; place-items: center;
  font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
}
.media-pick-box.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.media-lock-badge { cursor: pointer; border: 0; }
.media-send-mode { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.media-photo-tile[draggable="true"] { cursor: grab; }

.media-board { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.media-board-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.media-board-head strong { font-size: 13px; }
.media-board-zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.media-board-zone { min-height: 64px; padding: 8px; border-radius: var(--r-sm); border: 1.5px dashed var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.media-board-zone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.media-board-zone.is-off { border-style: dotted; opacity: .85; }
.media-board-zone-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.media-board-zone-head .field-hint { margin-left: auto; }
.media-board-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.media-board-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 6px 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 11.5px; cursor: grab; }
.media-board-chip.is-photo { border-style: dashed; }
.media-board-chip-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-board-chip-x { border: 0; background: transparent; color: var(--ink-4); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }
.media-board-empty { color: var(--ink-4); font-size: 12px; }
.series-drop-zones { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.series-drop-zone { padding: 4px 10px; border-radius: 999px; border: 1.5px dashed var(--line); font-size: 11.5px; color: var(--ink-3); }
.series-drop-zone:hover { border-color: var(--accent); color: var(--accent-text); }
.rubric-appearance-grid .scenario-choice-row.is-disabled { opacity: .6; }

/* ТЗ 8 (Y-03): YouTube — языки субтитров и дубляжа. */
.media-yt-langs { display: flex; flex-wrap: wrap; gap: 6px; }
.media-yt-lang { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 12px; font-weight: 700; color: var(--ink-3); cursor: pointer; }
.media-yt-lang.is-on { border-color: var(--accent-soft-2); background: var(--accent-soft); color: var(--accent-text); }
.media-yt-lang.is-source { border-style: dashed; }
.media-yt-lang-kind { font-size: 11px; font-weight: 600; opacity: .8; }
.media-yt-lang.is-on.is-subs .media-yt-lang-kind { color: var(--amber); opacity: 1; }
/* 05.11.2026: языки дубляжа — галочки; язык самого ролика — не галочка, а пометка «оригинал». */
.media-yt-lang-box { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid currentColor; font-size: 10px; line-height: 1; }
.media-yt-lang.is-original { cursor: default; border-style: dashed; }
.media-yt-langs-more, .media-yt-langs-reset { height: 26px; }
.media-yt-langs-reset { margin-left: auto; }
.media-video-routing-note { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
/* Форма канала YouTube в «Направлениях»: «Языки дубляжа на YouTube». */
.yt-dub-languages { display: flex; flex-direction: column; gap: 6px; }
/* 05.11.2026: версии ролика — на YouTube один оригинал, версии — его дорожками. */
.media-yt-versions { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); }
.media-yt-version { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; font-size: 12.5px; color: var(--ink-2); }
.media-yt-version.is-original { font-weight: 600; color: var(--ink); }
.media-yt-version-lang { flex: none; min-width: 28px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); text-align: center; font-size: 11.5px; font-weight: 700; }
.media-yt-version-name { min-width: 0; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-yt-version-kind { color: var(--accent-text); font-size: 12px; }
.media-yt-version-dub { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ТЗ 8 (T-06): режим медиа шаблона — сверху шага «Медиа». */
.media-mode-block { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.media-mode-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.media-mode-warn { color: var(--amber); font-weight: 600; }
.media-mode-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; }
.media-mode-first-part { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }

/* ТЗ 8 (R-01, R-02): вкладка «Сценарии» формы рубрики — список шаблонов рубрики. */
.rubric-tab-moved s { opacity: .7; }
.rubric-templates-panel { display: flex; flex-direction: column; gap: 10px; }
.rubric-templates-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rubric-templates-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.rubric-templates-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--ink); text-decoration: none; }
.rubric-templates-title:hover { color: var(--accent-text); }
.rubric-templates-number { font-variant-numeric: tabular-nums; color: var(--ink-3); }
.rubric-templates-meta { font-size: 12px; color: var(--ink-3); }
.rubric-templates-empty { font-size: 12.5px; color: var(--ink-3); }

/* ТЗ 8 (D-06): дни правила рубрики и шаблонов расходятся — вкладка «Контроль постинга». */
.rubric-templates-mismatch {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--amber-soft);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
}

/* ---- окно «Из плана»: шаблоны из таблицы «План постинга» (26.10.2026) ---- */
.tpl-seed { display: flex; flex-direction: column; gap: 14px; }
.tpl-seed-intro { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.tpl-seed-group { display: flex; flex-direction: column; gap: 10px; }
.tpl-seed-group-head, .tpl-seed-block-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; min-width: 0; }
.tpl-seed-group-head .select, .tpl-seed-block-head .select { max-width: 300px; }
.tpl-seed-block { display: flex; flex-direction: column; gap: 6px; margin-left: 12px; padding-left: 12px; border-left: 2px solid var(--line); min-width: 0; }
.tpl-seed-block-head > span:first-child { font-weight: 600; color: var(--ink-2); }
.tpl-seed-entry { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.tpl-seed-entry.is-done { opacity: .7; }
.tpl-seed-entry-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tpl-seed-title { font-size: 13px; }
.tpl-seed-status { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-seed-rule { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.tpl-seed-line { display: flex; gap: 6px; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; min-width: 0; overflow-wrap: anywhere; }
.tpl-seed-line-label { flex-shrink: 0; color: var(--ink-4); }
.tpl-seed-line.is-warn { color: var(--amber); }
.tpl-seed-line.is-muted { color: var(--ink-4); }
.tpl-seed-details { display: flex; flex-direction: column; gap: 3px; padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 2px; }
.tpl-seed-result { font-size: 12.5px; font-weight: 600; color: var(--green); }
.tpl-seed-error { font-size: 12.5px; color: var(--red); }
@media (max-width: 767px) {
  .tpl-seed-block { margin-left: 0; }
  .tpl-seed-group-head .select, .tpl-seed-block-head .select { max-width: 100%; width: 100%; }
}
.tpl-seed-modal .modal-foot { flex-wrap: wrap; align-items: center; }

/* Мастер, «Контент»: инструкция шаблона и задача к посту — свёрнутые строки (13.11.2026); свёрнутый блок
   не растягивается по высоте соседа. */
.wizard-template-notes { align-items: start; }
.wizard-post-task-details > summary { cursor: pointer; }
.wizard-post-task-details .textarea { min-height: 52px; }
.wizard-post-task-preview { margin-left: 8px; color: var(--ink-2); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.wizard-post-task-preview.is-empty { color: var(--ink-4); }
.wizard-post-task-details[open] .wizard-post-task-preview { display: none; }

/* «Промпты шаблона» (16.11.2026). */
.tpl-prompts-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.tpl-prompt-slot { display: flex; flex-direction: column; gap: 4px; }
.tpl-prompt-slot .btn { align-self: flex-end; }
