/* ---- Полоса загрузки ролика поверх плитки (js/video-pending.js: videoProgress) — как у поиска контента ---- */
.vp { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; display: grid; gap: 6px; line-height: 1.3; box-sizing: border-box; padding: 8px 10px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); pointer-events: none; }
.vp[hidden] { display: none; }
.vp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; }
.vp-label { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.vp-percent { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.vp-track { height: 6px; overflow: hidden; border-radius: 999px; background: var(--line); }
.vp-fill { display: block; width: 3%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.8s ease; }
.vp-spinner { display: none; width: 14px; height: 14px; flex: none; box-sizing: border-box; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: vp-spin .8s linear infinite; }
@keyframes vp-spin { to { transform: rotate(360deg); } }
.vp.is-indeterminate .vp-spinner { display: block; }
.vp.is-indeterminate .vp-track { display: none; }
.vp.is-indeterminate .vp-head { justify-content: flex-start; align-items: center; }
.vp.is-compact { left: 5px; right: 5px; bottom: 5px; gap: 3px; padding: 4px 5px; border-radius: 6px; }
.vp.is-compact .vp-head { justify-content: center; font-size: 10px; }
.vp.is-compact.is-indeterminate .vp-head { justify-content: center; }
.has-vp > .pv-cell-plate, .has-vp > .sp-plate { visibility: hidden; }   /* подпись «Видео загружается…» заменила полоса */
@media (prefers-reduced-motion: reduce) { .vp-fill, .vp-spinner, .search-progress-fill, .pe-progress-fill { animation: none; } }

/* ---- Ролик TikTok/Shorts ещё загружается (js/tabs.js) ---- */
.own-x { align-items: stretch; }
.own-x textarea { flex: 1 1 320px; min-width: 0; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font: inherit; resize: vertical; }

/* ---- Текстовый пост без картинки (TOPICS_SEARCH_PROMPT.md, часть E) ---- */
.text-post { display: grid; gap: 10px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.text-post-body { margin: 0; font-size: 17px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 12; -webkit-box-orient: vertical; overflow: hidden; }
.text-post-body.is-expanded { display: block; -webkit-line-clamp: unset; overflow: visible; }
.text-post-more { justify-self: start; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.proposal-tile.is-text { display: block; padding: 0; }
.proposal-tile.is-text { height: auto; min-height: 0; aspect-ratio: auto; overflow: hidden; }
.proposal-tile.is-text .text-post { border: 0; background: transparent; padding: 12px; }
.proposal-tile.is-text .text-post-body { font-size: 15px; -webkit-line-clamp: 8; }
.proposal-tile.is-text { background: var(--surface-2); color: var(--text); }
.proposal-media:has(> .proposal-tile.is-text) { aspect-ratio: auto; height: auto; }

/* ---- Тема: строка «Ищем: …», правка формата и чипы «Уточнить» (TOPICS_SEARCH_PROMPT.md, B.6 и D.4) ---- */
.topic-mode-box { display: grid; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.topic-mode { margin: 0; }
.topic-mode-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.topic-mode-judge select { margin-left: 4px; }
.tag-chip.is-topic-chip, .tag-chip.is-hashtag { cursor: pointer; }
.topic-mode-box > .topic-link { justify-self: start; }
.tag-chip.is-topic-chip::before { content: none; }

/* ---- Превью источника: карточка поста поверх карточки источника (js/sources.js, openSourcePreview) ---- */
.source-preview-overlay { position: fixed; inset: 0; z-index: 1400; background: rgba(17, 17, 17, 0.25); }
.source-preview-card { box-sizing: border-box; position: absolute; display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.source-preview-card img { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius); background: var(--surface-2); }
.source-preview-close { position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); font-weight: 700; line-height: 1; }
.source-preview-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.source-preview-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-preview-foot a { color: var(--link); text-decoration: underline; }
.source-preview-counter { color: var(--muted); }
.source-preview-nav { min-width: 32px; height: 30px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
@media (max-width: 600px) { .source-preview-name { display: none; } }

/* ---- Календарь v4 по макету (CALENDAR_V4_MATCH): раскладка в три колонки, карточки 58 px, колонка охвата, слоты ---- */
.cal-stage { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 18px; flex: 1; min-height: 0; }
.cal-pool-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; overflow: hidden; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); box-shadow: 0 4px 4px 18px rgba(5, 6, 14, .45); }
.cal-pool-col.is-collapsed { width: 44px; padding: 10px 6px; align-items: center; }
.cal-pool-col.is-collapsed > :not(.cal-pool-head) { display: none; }
.cal-pool-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cal-pool-head h2 { margin: 0; font-family: var(--font-ui); font-size: 20px; font-weight: 600; }
.cal-pool-col.is-collapsed .cal-pool-head { flex-direction: column; align-items: center; gap: 6px; }
.cal-pool-col.is-collapsed .cal-pool-head h2 { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 16px; }
.cal-pool-count, .cal-pool-note { font-size: 13px; color: var(--muted); margin: 0; }
.cal-pool-toggle { border: 0; background: transparent; font-size: 16px; padding: 2px 6px; }
.cal-pool-fill { height: 44px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--red); color: var(--on-bright); font: 700 15px var(--font-ui); box-shadow: var(--shadow-btn); }
.cal-pool-fill:disabled { opacity: 0.5; box-shadow: none; }
.cal-pool-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.cal-pool-filters button { padding: 3px 7px; white-space: nowrap; border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: 12px; }
.cal-pool-filters button[aria-pressed="true"] { background: var(--line-strong); color: var(--surface); }
.cal-pool-list { display: grid; gap: 8px; align-content: start; grid-auto-rows: max-content; grid-template-columns: minmax(0, 1fr); overflow-x: hidden; overflow-y: auto; min-height: 0; flex: 1; padding: 0; margin: 0; list-style: none; }
.cal-pool-item { display: grid; grid-template-columns: 52px minmax(0, 1fr); box-sizing: border-box; min-width: 0; gap: 10px; width: 100%; padding: 6px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface-2); text-align: left; }
.cal-pool-item > img { grid-row: 1 / span 2; width: 52px; height: 52px; object-fit: cover; border-radius: 8px; }
.cal-pool-item .cal-plan-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.cal-panel { position: static; width: auto; max-height: none; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); box-shadow: 0 4px 4px 18px rgba(5, 6, 14, .45); }
.cal-panel[hidden] { display: flex; }
.cal-panel-empty-title { font-family: var(--font-ui); font-size: 20px; font-weight: 600; margin: 0; }
.cal-tg { border-radius: 14px; background: var(--tg-bg); padding: 12px; display: grid; gap: 8px; }
.cal-tg-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.cal-tg-dot { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; }
.cal-tg-msg { border-radius: 12px; background: #FFFFFF; color: var(--on-bright); padding: 8px; display: grid; gap: 6px; }
.cal-tg-msg img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; }
.cal-tg-msg p { margin: 0; font-size: 13px; line-height: 1.3; }
.cal-tg-foot { font-size: 11px; color: #54504A; text-align: right; font-variant-numeric: tabular-nums; }
.cal-tg-note { font-size: 12px; color: var(--muted); margin: 0; }
.cal-rows { display: grid; gap: 4px; margin: 0; }
.cal-rows div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.cal-rows dt { color: var(--muted); }
.cal-rows dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-dup-warning { padding: 8px 10px; border: 1.5px solid var(--danger); border-radius: var(--radius); background: var(--warn-bg); color: var(--text); font-size: 13px; margin: 0; }
.cal-panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cal-panel-grid .primary-button { min-height: 44px; font-size: 14px; font-weight: 700; }
.cal-panel-grid .cal-act { min-height: 44px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.cal-panel-grid .cal-act.is-danger { color: var(--danger); border: 0; background: transparent; }

/* Колонка охвата по часам: 74 px, полоски трёх уровней */
.cal-axis { width: 74px; background: var(--surface); border-right: 1px solid var(--line); }
.cal-axis-title { position: absolute; left: 8px; top: 8px; right: 6px; font-size: 11px; color: var(--muted); line-height: 1.2; }
.cal-hour { left: 6px; right: auto; text-align: left; white-space: nowrap; }
.cal-reach-bar { position: absolute; left: 42px; top: 50%; transform: translateY(-50%); height: 8px; max-width: 28px; border-radius: 4px; background: var(--line); }
.cal-reach-bar.is-best { background: var(--red); }
.cal-reach-bar.is-good { background: var(--warm); }
.cal-hour.is-best { color: var(--text); font-weight: 700; }
.cal-col > .cal-best-row { position: absolute; left: 0; right: 0; background: var(--best-tint); pointer-events: none; }
.cal-now { z-index: 0; }
.cal-now-tag-col { position: absolute; right: 4px; top: -10px; padding: 1px 6px; border-radius: 6px; background: var(--red); color: var(--on-bright); font-variant-numeric: tabular-nums; }

.cal-status-dot { display: inline-block; flex: none; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--faint); }
.cal-status-dot.is-ok { background: var(--ok); }
.cal-status-dot.is-danger { background: var(--danger); }
.cal-status-dot.is-blue { background: var(--blue); }
.cal-status-dot.is-accent { background: var(--accent); }
.cal-ghost-card { position: absolute; left: 0; top: 0; z-index: 1; box-sizing: border-box; display: grid; place-items: center; overflow: hidden; opacity: 0.6; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); pointer-events: none; }
.cal-ghost-card img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.cal-day.is-past { background: var(--surface-2); }
.cal-text-ph { font-size: 11px; color: var(--muted); text-align: center; }

/* Два-три поста в одно время: первая карточка целиком, бейдж «+N» в правом верхнем углу, список по клику */
.cal-cover { position: absolute; left: 0; top: 0; z-index: 1; }
.cal-cover-more { position: absolute; top: -9px; right: -5px; z-index: 2; min-width: 18px; height: 18px; padding: 0 5px; border: 0; border-radius: 9px; background: var(--line-strong); color: var(--accent); font-size: 11px; font-weight: 700; line-height: 18px; }
.cal-cover-list { position: absolute; top: 62px; left: 0; z-index: 6; display: grid; gap: 2px; min-width: 200px; padding: 6px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-btn); }
.cal-cover-item { padding: 4px 6px; border: 0; background: transparent; font-size: 13px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-cover-item:hover { background: var(--surface-3); }
.cal-badge { width: auto; height: auto; min-width: 0; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; color: var(--on-bright); border: 0; line-height: 1.5; white-space: nowrap; }
.cal-badge::before { content: none; }
.cal-badge.is-ok { background: var(--ok-pill); }
.cal-badge.is-danger { background: var(--danger); }
.cal-badge.is-blue { background: var(--blue); }
.cal-badge.is-accent { background: var(--accent); color: var(--accent-text); }

/* Дыры недели в панели: пустое состояние */
.cal-holes { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cal-holes li { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 8px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; }

@media (max-width: 1199px) {
    .cal-stage { grid-template-columns: 44px minmax(0, 1fr); }
    .cal-stage > .cal-panel { grid-column: 1 / -1; }
}


/* Вкладка календаря на всю ширину: три колонки макета (Предложка 250, сетка, панель 300) */
#calendar-tab.wide-panel { max-width: none; }

/* ---- Автоперевод: пометка «Переведено с …» и «Показать оригинал» (js/content.js, applyTextMode) ---- */
.item-translate { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.item-translate-toggle { padding: 0; border: 0; background: transparent; color: var(--link); text-decoration: underline; font-size: 12px; }

/* ---- Календарь: сдвиг часов мышью и перенос из Предложки (js/calendar-drag.js) ---- */
.cal-days { cursor: grab; }
body.is-panning, body.is-panning * { cursor: grabbing !important; }
.cal-pool-item { cursor: grab; touch-action: pan-y; }
.cal-pool-item.is-dragging { opacity: 0.45; }

/* ---- Карточка статьи, читалка и общая обрезка текста (ARTICLE_CARDS_PROMPT.md) ---- */
.card-ai { margin-top: 12px; }
.card-ai > summary { cursor: pointer; font-size: 14px; font-weight: 700; list-style: none; }
.card-ai > summary::-webkit-details-marker { display: none; }
.card-ai > summary::before { content: '▸ '; }
.card-ai[open] > summary::before { content: '▾ '; }
.card-ai .desc-text { margin-top: 6px; }
.clamp-text { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.clamp-text-body { margin: 0; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp-text-body.is-expanded { display: block; -webkit-line-clamp: unset; overflow: visible; }
.clamp-text-more { margin-top: 2px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.article-card { display: grid; gap: 12px; min-width: 0; }
.article-cover { display: block; width: 100%; max-height: 300px; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.article-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.article-cover.is-plate { display: flex; align-items: center; justify-content: center; gap: 12px; background: var(--surface-3); cursor: default; }
.article-plate-name { font-family: var(--font-ui); font-size: 22px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.article-meta { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.site-badge { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border: 1.5px solid var(--line-strong); border-radius: 50%; font-size: 13px; font-weight: 700; color: var(--accent-text); }
.site-badge.tone-0 { background: var(--accent); }
.site-badge.tone-1 { background: var(--blue); color: var(--on-bright); }
.site-badge.tone-2 { background: var(--ok); }
.site-badge.tone-3 { background: var(--warm); }
.article-title { margin: 0; font-family: var(--font-ui); font-size: 22px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.article-lead { margin: 0; font-size: 16px; line-height: 1.45; color: var(--text); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.article-read { justify-self: start; padding: 10px 18px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--accent); color: var(--accent-text); font-size: 15px; font-weight: 700; box-shadow: var(--shadow-btn); cursor: pointer; }
.article-hint { margin: 0; color: var(--muted); font-size: 12px; }

.article-reader { position: fixed; inset: 0; z-index: 1000; display: grid; justify-items: center; align-items: start; padding: 32px 16px; overflow-y: auto; background: var(--modal-dim); }
.article-reader[hidden] { display: none; }
body.is-reading { overflow: hidden; }
.article-reader-sheet { display: flex; flex-direction: column; width: min(680px, 100%); max-height: calc(100vh - 64px); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card); }
.article-reader-head, .article-reader-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.article-reader-head { border-bottom: 1px solid var(--line); }
.article-reader-foot { border-top: 1px solid var(--line); }
.article-reader-site { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.article-reader-link { color: var(--link); font-size: 14px; text-decoration: underline; }
.article-reader-body { min-height: 240px; padding: 20px 24px; overflow-y: auto; }
.ar-article { display: grid; gap: 14px; min-width: 0; }
.ar-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.ar-title { margin: 0; font-family: var(--font-ui); font-size: 26px; line-height: 1.2; overflow-wrap: anywhere; }
.ar-h { margin: 12px 0 0; font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
.ar-p, .ar-list li { margin: 0; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.ar-p a, .ar-list a { color: var(--link); }
.ar-list { display: grid; gap: 6px; margin: 0; padding-left: 20px; }
.ar-quote { margin: 4px 0; padding: 8px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); font-size: 16px; font-style: italic; overflow-wrap: anywhere; }
.ar-figure { display: grid; gap: 6px; margin: 0; }
.ar-image { padding: 0; border: 0; background: none; cursor: zoom-in; }
.ar-image img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.ar-figure figcaption { color: var(--muted); font-size: 13px; }
.ar-embed { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--link); font-size: 14px; overflow-wrap: anywhere; }
.ar-embed.is-card { color: var(--text); }
.ar-skeleton { display: grid; gap: 12px; }
.ar-bar { height: 14px; border-radius: 6px; background: var(--surface-3); animation: ar-pulse 1.2s ease-in-out infinite; }
.ar-bar.is-short { width: 55%; }
.ar-note { margin: 0; color: var(--muted); }
.ar-note.is-error { color: var(--danger); }
@keyframes ar-pulse { 50% { opacity: 0.45; } }
@media (max-width: 720px) {
    .article-reader { padding: 0; }
    .article-reader-sheet { width: 100%; height: 100vh; max-height: 100vh; border: 0; border-radius: 0; }
    .article-reader-body { padding: 16px; }
}

/* ---- Статья в предложке ---- */
.proposal-article-open { display: block; width: 100%; cursor: zoom-in; }
.proposal-article-open .article-cover { max-height: none; }
.proposal-article-title { margin: 0; font-family: var(--font-ui); font-size: 17px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.proposal-article-read { justify-self: start; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; cursor: pointer; }

/* ---- Шапка и журнал (HEADER_CONSOLE_PROMPT.md): журнал сворачивается на любой вкладке, вкладки в одну строку ---- */
.console-toggle { width: 26px; height: 26px; margin-left: auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-2); color: var(--text); font: 700 14px/1 var(--mono); cursor: pointer; }
.console-mini { display: none; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid rgba(124, 92, 255, .5); border-radius: 16px; background: var(--surface); box-shadow: 0 0 22px rgba(124, 92, 255, .25); color: var(--text); font: 12px/1 var(--mono); cursor: pointer; }
.console-mini:not([hidden]) { display: inline-flex; }
.console-mini .console-indicator { flex: none; }
.console-mini.is-active .console-indicator { background: var(--accent); animation: console-pulse 1.2s ease-in-out infinite; }
.console-mini-title { font-weight: 700; }
.console-mini-status { min-width: 0; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.console-mini.is-active .console-mini-status { color: var(--text); }
.console-mini-open { color: var(--muted); }
body.console-collapsed .activity-console { display: none; }
.view-panel.wide-panel { max-width: none; }
@media (max-width: 899px) {
    .console-mini:not([hidden]) { width: 100%; justify-content: flex-start; }
    .console-mini-status { flex: 1; max-width: none; }
}

.article-reader-foot .btn { width: auto; height: auto; padding: 10px 16px; white-space: nowrap; font-size: 15px; }
.cal-phone-text.is-article b { font-family: var(--font-ui); font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.cal-phone-lead { color: var(--muted); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
/* Телефон: строка темы не шире экрана (поле ввода не тянет ширину документа) */
.topic-form, .topic-row { min-width: 0; max-width: 100%; }
.topic-row input { min-width: 0; flex: 1 1 auto; width: 100%; }
/* Карточка записи: шапка (источник, дата) и ряд меток (активность, «По теме», теги) */
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
.card-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; min-width: 0; }
/* «Свежак!» не перекрывает текст поста без картинки */
.card.is-fresh .media-shell .text-post { padding-top: 100px; }   /* звезда «Свежак!» занимает верхний левый угол */
/* Статья в телефонном календаре: высота по заголовку и двум строкам анонса, не 64 px */
.cal-phone-card.is-article { height: auto; min-height: 64px; }
.cal-phone-text.is-article { display: grid; gap: 2px; -webkit-line-clamp: unset; overflow: visible; }
.cal-phone-lead { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- Посты кандидата в источники: компактные строки, много постов на экране (SOURCE_POST_CARDS_V2_PROMPT.md) ---- */
.source-card .source-head { display: grid; gap: 4px; padding: 12px 16px; }
.source-card .source-head .badge { justify-self: start; }
.source-card .source-head #source-stats { margin-top: 2px; }
.source-feed-box { display: grid; gap: 8px; padding: 10px 10px 4px; border-top: 1px solid var(--line); min-width: 0; }
.source-feed-box { container-type: inline-size; }   /* колонки ленты считаются по ширине самой ленты */
.source-posts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
@container (min-width: 520px) { .source-posts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 860px) { .source-posts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.source-empty-note { margin: 0; color: var(--muted); font-size: 14px; }
.source-feed-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; min-width: 0; }
.source-coverage { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.source-posts-more { padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; cursor: pointer; }
.source-about { margin: 0; padding: 8px 16px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.source-about > summary { cursor: pointer; font-weight: 700; }
.source-about .item-ai-note, .source-about .desc-text { margin-top: 6px; }
.sp-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.sp-card.is-text { grid-template-columns: minmax(0, 1fr); grid-column: 1 / -1; }   /* текстовый пост — строка на всю ширину */
.sp-card:hover { background: var(--surface-2); }
.sp-card:focus-visible { outline: 3px solid var(--ring-active); outline-offset: 2px; }
.sp-thumb { position: relative; width: 96px; height: 96px; overflow: hidden; border-radius: calc(var(--radius) - 3px); background: var(--surface-2); }
.sp-thumb img, .sp-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.sp-plate { position: absolute; inset: 0; display: grid; place-items: center; padding: 6px; color: var(--muted); font-size: 16px; text-align: center; overflow: hidden; }
.sp-count { position: absolute; left: 4px; top: 4px; z-index: 1; padding: 0 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.7); color: #ffffff; font-size: 11px; font-weight: 700; }
.sp-body { display: grid; gap: 4px; align-content: start; min-width: 0; }
.sp-text, .sp-text-big { margin: 0; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; }
.sp-text { font-size: 14px; line-height: 1.35; -webkit-line-clamp: 4; }
.sp-text.is-empty { color: var(--muted); font-style: italic; -webkit-line-clamp: 1; }
.sp-text-big { font-size: 15px; line-height: 1.45; -webkit-line-clamp: 8; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.sp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; color: var(--muted); font-size: 12px; min-width: 0; }
.sp-link { margin-left: auto; color: var(--text); font-size: 14px; font-weight: 700; text-decoration: none; }
.sp-link:hover { text-decoration: underline; }
@media (max-width: 600px) {
    .sp-card { grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
    .sp-thumb { width: 72px; height: 72px; }
}


/* ---- Возврат переноса (CALENDAR_DRAG_BACK_PROMPT.md): зона Предложки, возврат карточки, снятие с расписания ---- */
#cal-pool-col.is-drop-zone { outline: 3px dashed var(--line-strong); outline-offset: 6px; transition: background-color 0.15s; }
#cal-pool-col.is-drop-hot { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); outline-style: solid; }
.is-returned { animation: cal-returned 0.6s ease-out; }
@keyframes cal-returned { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .is-returned { animation: none; outline: 2px solid var(--accent); } }
/* Фильтры площадок (предложка и «Источники темы») переносятся по строкам на телефоне */
.proposals-filters { flex-wrap: wrap; max-width: 100%; }
/* Предложка: пост с такой картинкой уже в расписании — плашка под текстом, рамка цветом акцента */
.cal-pool-item.is-scheduled { border-color: var(--accent); }
.cal-pool-sched { grid-column: 2; font-family: var(--mono); font-size: 11px; color: var(--accent-text); background: var(--accent); border-radius: 4px; padding: 1px 6px; justify-self: start; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Журнал не выше окна: на широком экране страница не растягивается сверх высоты окна (журнал прокручивается внутри себя) */
/* Журнал — всплывающая панель поверх страницы: открытие и закрытие не двигают вёрстку */
.activity-console { position: fixed; z-index: 950; left: 12px; top: var(--console-top, 12px); width: min(420px, calc(100vw - 24px)); height: calc(100vh - var(--console-top, 12px) - 12px); margin: 0; }
@media (min-width: 761px) { .activity-console { left: 262px; } }
.activity-console-header { cursor: grab; touch-action: none; }
.activity-console-header:active { cursor: grabbing; }

/* Часы обрезаны: тонкая тень у верхнего и нижнего края сетки (есть ещё часы за краем) */
.cal-body.is-cut-top::before, .cal-body.is-cut-bottom::after { content: ''; position: absolute; left: 0; right: 0; height: 22px; z-index: 5; pointer-events: none; }
.cal-body.is-cut-top::before { top: var(--cal-head); background: linear-gradient(var(--surface), transparent); }
.cal-body.is-cut-bottom::after { bottom: 0; background: linear-gradient(transparent, var(--surface)); }

/* ---- Вид «дни строками» (CALENDAR_V5): дни — строки сверху вниз, часы — слева направо; классы те же, что у колонок ---- */
.cal-body.is-rows { --cal-head: 30px; }
.cal-body.is-rows .cal-axis { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: var(--cal-head); border-right: 0; border-bottom: 1px solid var(--line); }
.cal-body.is-rows .cal-axis-title { left: 8px; top: 6px; right: auto; width: 62px; font-size: 10px; }
.cal-body.is-rows .cal-hour { left: 0; top: 7px; right: auto; text-align: center; transform: translateX(-50%); white-space: nowrap; }
.cal-body.is-rows .cal-reach-bar { left: 50%; top: auto; bottom: 0; transform: translateX(-50%); width: 24px; max-width: 24px; }
.cal-body.is-rows .cal-days { left: 0; right: 0; top: var(--cal-head); bottom: 0; background-image: linear-gradient(90deg, var(--hour-c) 1px, transparent 1px), linear-gradient(90deg, var(--half-c) 1px, transparent 1px), linear-gradient(90deg, var(--tenth-c) 1px, transparent 1px); background-size: var(--hour-px, 60px) 100%, calc(var(--hour-px, 60px) / 2) 100%, calc(var(--hour-px, 60px) / 6) 100%; background-position: 74px 0, 74px 0, 74px 0; }
.cal-body.is-rows .cal-day { left: 0; right: 0; bottom: auto; border-left: 0; border-top: 1px solid var(--line); }
.cal-body.is-rows .cal-day-head { top: 0; bottom: 0; left: 0; right: auto; width: 74px; height: auto; flex-direction: column; justify-content: center; gap: 2px; padding: 2px 4px; border-bottom: 0; border-right: 1px solid var(--line); }
.cal-body.is-rows .cal-day.is-narrow .cal-day-head { gap: 2px; }
.cal-body.is-rows .cal-col { top: 0; bottom: 0; left: 74px; right: 0; }
.cal-body.is-rows .cal-col > .cal-best-row { left: auto; right: auto; top: 0; bottom: 0; }
.cal-body.is-rows .cal-now { top: 0; bottom: 0; right: auto; width: 0; height: auto; border-top: 0; border-left: 2px solid var(--red); }
.cal-body.is-rows .cal-now::before { left: -5px; top: -4px; }
.cal-body.is-rows .cal-now-tag-col { right: auto; top: 2px; left: 4px; }
.cal-body.is-rows .cal-mark { top: 50%; left: 0; margin: -3px 0 0 -3px; }
.cal-body.is-rows .cal-mark.is-hour, .cal-body.is-rows .cal-mark.is-slot { margin: -5px 0 0 -5px; }
.cal-body.is-rows .cal-mark.is-on, .cal-body.is-rows .cal-mark.is-slot.is-on { margin: -7px 0 0 -7px; }
.cal-body.is-rows .cal-time-tick { width: 2px; height: 12px; }

/* ---- Правая колонка календаря: «Куда публиковать» (CALENDAR_V5, часть 3) ---- */
.cal-resources { display: grid; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cal-resources-title { margin: 0; font-family: var(--font-ui); font-size: 17px; font-weight: 600; }
.cal-res-list, .cal-group-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cal-res { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.cal-res input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--line-strong); }
.cal-res-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; cursor: pointer; }
.cal-res-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-res-user { color: var(--muted); font-size: 12px; }
.cal-res-platform { color: var(--muted); font-size: 13px; }
.cal-res-note { margin: 0; font-size: 12px; }
.cal-res-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.cal-group { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.cal-group-note { margin: 0; font-weight: 700; }
.cal-group-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cal-group-row .cal-act { margin-left: auto; }

/* ---- Просмотрщик постов (POST_VIEW_V2_PROMPT.md): карточка по центру, листание по бокам, медиа — мозаика; один модуль js/post-view.js ---- */
.pv { position: fixed; inset: 0; z-index: 950; display: grid; box-sizing: border-box; place-items: center; padding: 20px; background: rgba(0, 0, 0, .3); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.pv[hidden] { display: none; }
body.pv-open { overflow: hidden; }
.pv-frame { display: flex; align-items: center; justify-content: center; gap: 16px; width: 100%; height: 100%; min-height: 0; }
.pv-sheet { display: flex; flex: none; flex-direction: column; box-sizing: border-box; width: min(720px, calc(100% - 144px)); max-height: 100%; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card); }
.pv-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pv-counter { flex: none; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-2); color: var(--text); font: 700 12px/1.4 var(--mono); white-space: nowrap; cursor: help; }
.pv-side-nav[hidden] { display: none; }
.pv-title { flex: 1; min-width: 0; overflow: hidden; color: var(--text); font-family: var(--font-ui); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.pv-close { width: 36px; height: 36px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--accent); color: var(--accent-text); font-weight: 700; cursor: pointer; }
.pv-side-nav { display: grid; flex: none; place-items: center; width: 56px; height: 56px; padding: 0; border: var(--border) solid var(--line-strong); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-btn); color: var(--text); font-size: 28px; font-weight: 700; line-height: 1; cursor: pointer; }
.pv-side-nav:hover:not(:disabled) { background: var(--accent); color: var(--accent-text); }
.pv-side-nav:disabled { opacity: 0.3; cursor: default; }
.pv-body { min-height: 0; overflow-y: auto; }
.pv-read { display: flex; flex-direction: column; gap: 12px; padding: 20px; box-sizing: border-box; }
.pv-media { display: grid; gap: 6px; }
.pv-mosaic { display: grid; gap: 4px; width: 100%; box-sizing: border-box; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.pv-cell { position: relative; display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; padding: 0; border: 0; overflow: hidden; background: #171b31; color: #ffffff; cursor: pointer; }
.pv-cell img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pv-cell-plate { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; box-sizing: border-box; font-size: 14px; font-weight: 700; text-align: center; text-shadow: 0 1px 3px #000000; }
.pv-cell-mark { position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); color: #ffffff; font-size: 12px; font-variant-numeric: tabular-nums; }
.pv-cell-link { display: grid; place-items: center; padding: 8px; box-sizing: border-box; color: var(--accent); font-weight: 700; text-align: center; text-decoration: none; }
.pv-mosaic-note { margin: 0; color: var(--muted); font-size: 14px; }
.pv-cell-retry { gap: 6px; }
.pv-cell-retry img { position: absolute; inset: 0; }
.pv-cell-link small { color: #ffffff; font-size: 12px; font-weight: 400; }
.pv-retry { position: relative; padding: 6px 12px; border: 1px solid var(--accent); border-radius: 8px; background: rgba(0, 0, 0, 0.6); color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
/* Видео в плитке (post-view.js, videoTile): играет без звука; панель контролов — после первого нажатия */
.pv-cell-video, .pv-cell-poster { cursor: pointer; }
.pv-cell-media { display: block; width: 100%; height: 100%; object-fit: cover; background: #000000; }
.pv-youtube { border: 0; background: #000; }
.pv-mosaic.n-1 .pv-cell-media { object-fit: contain; }
.pv-cell-video:focus-visible, .pv-cell-poster:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Раскладка по числу файлов; высоты заданы заранее — вёрстка не прыгает при загрузке картинок */
.pv-mosaic.n-1 { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.pv-mosaic.n-1 .pv-cell { width: auto; height: 360px; max-width: 100%; aspect-ratio: var(--ar, 16 / 9); }
.pv-mosaic.n-1 .pv-cell img { object-fit: contain; }
.pv-mosaic.n-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 280px; }
.pv-mosaic.n-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 158px 158px; }
.pv-mosaic.n-3 .pv-cell:first-child { grid-row: span 2; }
.pv-mosaic.n-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 178px 178px; }
.pv-mosaic.n-5 { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: 200px 140px; }
.pv-mosaic.n-5 .pv-cell { grid-column: span 2; }
.pv-mosaic.n-5 .pv-cell:nth-child(-n + 2) { grid-column: span 3; }
.pv-mosaic.n-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: 150px 150px; }
.pv-mosaic.n-many { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pv-mosaic.n-many .pv-cell { height: auto; aspect-ratio: 1; }
.pv-quiet { margin: 0; color: var(--faint); font-style: italic; }
.pv-source { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pv-source-text { display: grid; min-width: 0; }
.pv-source-name { color: var(--text); font-family: var(--font-ui); font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.pv-date { color: var(--muted); font-size: 13px; }
.pv-badge { align-self: flex-start; padding: 3px 10px; border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 700; }
.pv-badge.tone-ok { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.pv-badge.tone-bad { border-color: #C43C3C; color: #C43C3C; }
.pv-badge.tone-accent { border-color: var(--accent); }
.pv-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-insight { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; }
.pv-insight p { margin: 0; }
.pv-verdict { font-weight: 700; font-size: 14px; }
.pv-verdict.tone-hot { color: var(--text); }
.pv-verdict.tone-hot::after { content: ''; display: block; height: 3px; margin-top: 4px; border-radius: 2px; background: var(--accent); }
.pv-verdict.tone-cold { color: var(--muted); }
.pv-metrics { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; margin: 0; }
.pv-metrics dt { color: var(--muted); }
.pv-metrics dd { margin: 0; color: var(--text); font-weight: 600; }
.pv-facts { color: var(--muted); }
.pv-warn { padding: 6px 10px; border-left: 3px solid #C43C3C; color: var(--text); line-height: 1.4; }
.pv-tools-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-mini { padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
.pv-mini:hover { background: var(--accent); color: var(--accent-text); }
.pv-text { color: var(--text); font-size: 16px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-text-big { color: var(--text); font-size: 24px; font-weight: 600; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-text a, .pv-text-big a, .pv-article-fallback a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; overflow-wrap: anywhere; }
.pv-tag { color: var(--muted); font-weight: 600; }
.pv-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 10px; background: var(--surface); }
.pv-action { padding: 9px 14px; border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font-weight: 700; cursor: pointer; }
.pv-action.is-primary { background: var(--accent); color: var(--accent-text); }
.pv-action[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.pv-link { align-self: flex-start; color: var(--text); font-weight: 700; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pv-poll { display: grid; gap: 6px; }
.pv-poll-q { margin: 0; color: var(--text); font-weight: 700; }
.pv-poll-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pv-option { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); }
.pv-article-title { margin: 0; color: var(--text); font-family: var(--font-ui); font-size: 28px; line-height: 1.2; overflow-wrap: anywhere; }
.pv-article-lead { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.5; }
.pv-article-blocks { display: grid; gap: 12px; }
.pv-article-blocks .ar-skeleton { height: 160px; border-radius: var(--radius); background: var(--surface-2); }
.pv-article-fallback { display: grid; gap: 12px; }
/* Лист поста внутри «Подбора» (post-view.js: renderPostSheet): без боковых кнопок и без липкой полосы действий */
.pv-embedded { padding: 16px 18px; }
.card.is-fresh .pv-embedded .pv-source { padding-left: 84px; }   /* значок «Свежак!» — в левом верхнем углу карточки: строку источника сдвигаем правее */
.is-embedded .pv-actions { position: static; }
.item-post { min-width: 0; }
@media (max-width: 899px) {
    .pv { padding: 12px; }
    .pv-frame { position: relative; }
    .pv-sheet { width: 100%; max-height: 100%; }
    .pv-side-nav { position: absolute; top: 50%; z-index: 2; width: 40px; height: 40px; transform: translateY(-50%); background: color-mix(in srgb, var(--surface) 85%, transparent); font-size: 22px; transition: opacity 0.2s; }
    .pv-side-nav.is-prev { left: 6px; }
    .pv-side-nav.is-next { right: 6px; }
    .pv-frame.is-scrolling .pv-side-nav { opacity: 0; pointer-events: none; }
    .pv-actions { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
    .pv-mosaic.n-1 .pv-cell { height: 270px; }
    .pv-mosaic.n-2 { grid-template-rows: 210px; }
    .pv-mosaic.n-3 { grid-template-rows: 118px 118px; }
    .pv-mosaic.n-4 { grid-template-rows: 133px 133px; }
    .pv-mosaic.n-5 { grid-template-rows: 150px 105px; }
    .pv-mosaic.n-6 { grid-template-rows: 112px 112px; }
    .pv-mosaic.n-many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .pv * { transition: none !important; animation: none !important; } }

/* статусы поиска — по центру колонки карточки */
@media (min-width: 1240px) {
    #content-tab > .status-msg, #content-tab > .search-progress { justify-self: center; width: min(100%, 460px); }
}

/* ---- «Подбор»: форма темы — панель в стиле панели оценки (рамка, тень, те же отступы) ---- */
#content-tab > .topic-form {
    box-sizing: border-box; gap: 12px; padding: 18px 16px 16px;
    border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card);
}
#content-tab > .topic-form > label[for="topic-input"] { color: var(--text); font-family: var(--font-ui); font-size: 15px; font-weight: 700; }
#content-tab .topic-row input { border: var(--border) solid var(--line-strong); border-radius: var(--radius); background: var(--bg); font-size: 15px; font-weight: 700; }
#content-tab .topic-row button { flex: none; box-shadow: var(--shadow-btn); }
#content-tab .topic-mode-box { margin-top: 0; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
#content-tab .topic-children { margin-top: 0; }
#content-tab .topic2-field { border-radius: var(--radius); }
.query-field { max-width: 100%; }
#query-field #query-input { flex: 1; min-width: 0; min-height: 36px; padding: 0; border: 0; border-radius: 0; outline: none; background: transparent; font-size: 13px; cursor: inherit; }
#content-tab .filter-row { display: grid; gap: 8px; margin-top: 0; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
#content-tab .filter-row::before { content: "Фильтры"; color: var(--muted); font-size: 12px; font-weight: 600; }
#content-tab .filter-row .check-chip { display: flex; width: 100%; box-sizing: border-box; min-height: 38px; border-width: var(--ring); border-radius: var(--radius); font-weight: 600; }
#content-tab .filter-row .check-chip:has(input:checked) { box-shadow: none; }
@media (min-width: 1240px) {
    #content-tab > .topic-form { top: 20px; }
}

/* ---- Правка: шапка не переносится, форма — вплотную к посту ---- */
/* Кластер «форма | пост | панель оценки» по центру окна, без пустоты между ними */
@media (min-width: 1500px) {
    #content-tab.active { grid-template-columns: 0 340px minmax(0, 1fr) 330px 0; column-gap: 20px; }
    #content-tab > * { grid-column: 3; }
    #content-tab > .topic-form { grid-column: 2; grid-row: 1; justify-self: stretch; width: auto; }
    #item-card-wrapper > .card { grid-column: 3; }
    #item-card-wrapper > .controls { grid-column: 4; }
}

/* Выпадающие списки шапки (тема, сводка) — поверх липких панелей страницы (.controls z-index 30, журнал 20) */
/* Шапка — строка над вкладками-страницами: выбор темы слева, журнал справа, как строка-шапка студии */
.app-top { position: relative; z-index: 60; display: flex; align-items: center; gap: 16px; margin: 0 0 16px; }
.app-top .console-mini { margin-left: auto; }

/* Значок «это видео»: миниатюра в углу плитки, на случай если ролик завис; курсор — «нажми, откроется» */
.pv-cell-video, .pv-cell-poster, .pv-cell-video .pv-cell-media { cursor: pointer; }
.pv-cell-mark { display: inline-flex; align-items: center; }

/* ---- Карточки календаря (CALENDAR_CARDS_PROMPT.md): язык Posta — рамка, жёсткая тень, аватар канала, плашка статуса.
   Цвета — токены, поэтому ночная тема работает сама. Позиция карточки задаётся transform, наведение — отдельным свойством translate. ---- */
.cal-card { position: absolute; left: 0; top: 0; z-index: 1; display: flex; align-items: stretch; box-sizing: border-box; height: 72px; padding: 0; overflow: hidden; text-align: left; color: var(--text); background: var(--surface); border: 2px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 2px 2px 18px rgba(5, 6, 14, .45); transition: translate 120ms ease, box-shadow 120ms ease; }
.cal-card:hover { z-index: 2; translate: none; box-shadow: 0 4px 4px 18px rgba(5, 6, 14, .45); }
.cal-card:focus-visible { outline: 2px dashed var(--line-strong); outline-offset: 3px; }
.cal-card.is-selected, .cal-card[aria-pressed="true"] { border: 2px solid var(--line-strong); box-shadow: 0 0 0 3px var(--accent), 4px 4px 0 3px var(--shadow-ink); }
.cal-card.is-dragging { opacity: 0.35; pointer-events: none; }

/* Полная: миниатюра во всю высоту 64 px, справа черта */
.cal-card[data-mode="full"] { height: 72px; padding: 0; }
.cal-card .cal-media { position: relative; flex: none; width: 64px; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; border-right: 2px solid var(--line-strong); background: var(--surface-2); }
.cal-card .cal-media img, .cal-card .cal-media video, .cal-card .cal-thumb { width: 100%; height: 100%; object-fit: cover; }
.cal-card .cal-quote { display: grid; place-items: center; width: 100%; height: 100%; font-family: var(--font-ui); font-size: 44px; line-height: 1; color: var(--text); background: color-mix(in srgb, var(--c) 35%, var(--surface)); }
.cal-card .cal-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-start; gap: 3px; padding: 6px 8px; }
.cal-card .cal-card-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.cal-card .cal-when { font-family: var(--font-ui); font-size: 19px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-card .cal-spacer { flex: 1; min-width: 0; }
.cal-card .cal-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; font-size: 12.5px; line-height: 1.25; overflow-wrap: anywhere; }
.cal-card[data-status="failed"] .cal-card-body { padding: 5px 8px 6px; gap: 2px; }
.cal-card[data-status="failed"][data-mode="full"] .cal-text { -webkit-line-clamp: 1; }
.cal-card .cal-err { font-size: 11px; font-weight: 500; line-height: 1.25; color: var(--danger); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-card .cal-forecast { font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cal-card .cal-dup { padding: 3px 5px; border: 1.5px solid var(--dup-line); border-radius: 5px; background: var(--dup-bg); color: var(--dup-text); font: 700 10px/1 var(--font-ui); white-space: nowrap; }

/* Плашка статуса внизу миниатюры; полоса «уходит…» — бегущая, без анимации при reduce */
.cal-card .cal-plate { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 0; border-top: 2px solid var(--line-strong); text-align: center; font: 700 10px/1.2 var(--font-ui); color: var(--plate-blue-ink); }
.cal-card .cal-plate.is-blue { background: var(--blue); }
.cal-card .cal-plate.is-danger { background: var(--danger); color: var(--plate-danger-ink); }
.cal-card .cal-plate.is-ok { background: var(--ok); color: var(--plate-ok-ink); }
.cal-card .cal-plate.is-accent { background: var(--accent); color: var(--accent-text); }
.cal-card .cal-plate-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: linear-gradient(90deg, var(--accent) 0 35%, transparent 35% 65%, var(--accent) 65%); background-size: 200% 100%; animation: cal-sweep 1.2s linear infinite; }
@keyframes cal-sweep { to { background-position: -200% 0; } }

/* Аватар канала и группа внахлёст */
.cal-card .cal-avatars { display: inline-flex; align-items: center; flex: none; }
.cal-card .cal-avatar { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--c); color: var(--on-bright); font: 700 10px/1 var(--font-ui); }
.cal-card .cal-avatar.is-sm { width: 14px; height: 14px; font-size: 8px; }
.cal-card .cal-avatar + .cal-avatar, .cal-card .cal-avatar-more { margin-left: -5px; }
.cal-card .cal-avatar-more { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 3px; border: 1.5px solid var(--line-strong); border-radius: 9px; background: var(--surface-3); color: var(--text); font: 700 9px/1 var(--font-ui); }
.cal-card .cal-avatar-more.is-sm { height: 14px; min-width: 14px; font-size: 8px; }

/* Точка статуса (средняя и пилюля) */
.cal-card .cal-status-dot { width: 6px; height: 6px; border: 0; border-radius: 50%; background: transparent; flex: none; }
.cal-card .cal-status-dot.is-blue { background: var(--blue); }
.cal-card .cal-status-dot.is-danger { background: var(--danger); }
.cal-card .cal-status-dot.is-accent { background: var(--accent); animation: cal-pulse 1.2s ease-in-out infinite; }

/* Средняя: миниатюра 24, время, точка, аватар; текст — одна строка (56 px) */
.cal-card[data-mode="mid"] { display: flex; height: 56px; border-radius: 9px; box-shadow: 0 2px 2px 18px rgba(5, 6, 14, .45); }
.cal-card[data-mode="mid"] .cal-media { width: 24px; height: 24px; flex: none; border: 1.5px solid var(--line-strong); border-radius: 5px; }
.cal-card[data-mode="mid"] .cal-quote { font-size: 18px; }
.cal-card[data-mode="mid"] .cal-card-body { gap: 2px; padding: 0; }
.cal-card[data-mode="mid"] .cal-when { font-size: 16px; }
.cal-card[data-mode="mid"] .cal-text { -webkit-line-clamp: 1; font-size: 11.5px; }
.cal-card[data-mode="mid"] { flex-direction: column; align-items: stretch; gap: 4px; padding: 5px 6px; }
.cal-card .cal-card-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.cal-card .cal-card-top .cal-card-row { flex: 1; min-width: 0; }
.cal-card[data-mode="mid"] .cal-text { width: 100%; }
.cal-card[data-mode="mid"] .cal-card-top .cal-media { flex: none; }

/* Пилюля: 22 px, время и точка в одну строку */
.cal-card[data-mode="pill"] { height: 22px; align-items: center; gap: 4px; padding: 0 6px; border-width: 1.5px; border-radius: 6px; background: color-mix(in srgb, var(--c) 22%, var(--surface)); box-shadow: none; }
.cal-card[data-mode="pill"] .cal-card-body { flex-direction: row; align-items: center; padding: 0; }
.cal-card[data-mode="pill"] .cal-when { font-size: 12px; font-weight: 600; }
.cal-card[data-mode="pill"]:hover { box-shadow: none; }

/* Прошлое: без прозрачности и фильтров; миниатюра в оттенках серого; контраст текста — 4.5:1 и выше */
.cal-card.is-past { opacity: 1; filter: none; background: var(--surface-2); border: 2px solid var(--line); box-shadow: none; }
.cal-card.is-past:hover { box-shadow: none; translate: none; }
.cal-card[data-status="failed"] { border-color: var(--danger); box-shadow: 0 2px 2px 18px rgba(5, 6, 14, .45); }   /* ошибка остаётся заметной и у прошедшего поста (стоит после «прошлого») */
.cal-card.is-past .cal-when, .cal-card.is-past .cal-text, .cal-card.is-past .cal-forecast { color: var(--muted); }
.cal-card.is-past .cal-media img, .cal-card.is-past .cal-thumb { filter: grayscale(1); }
.cal-card.is-past .cal-media { border-right-color: var(--line); }

/* Телефон: та же карточка, что в сетке — миниатюра во всю высоту, плашка, аватар, крупный; строка ~72 px под 390 px */
.cal-phone-row { grid-template-columns: 52px minmax(0, 1fr); }
.cal-phone-time { font-size: 19px; line-height: 1; }
.cal-phone-card { height: 72px; gap: 0; padding: 0; border: 2px solid var(--line-strong); border-radius: 12px; box-shadow: 0 2px 2px 18px rgba(5, 6, 14, .45); }
.cal-phone-card .cal-phone-media { position: relative; flex: none; width: 72px; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; border-right: 2px solid var(--line-strong); background: var(--surface-2); }
.cal-phone-card .cal-phone-media img, .cal-phone-card .cal-phone-media .cal-thumb { width: 100%; height: 100%; object-fit: cover; }
.cal-phone-card .cal-quote { display: grid; place-items: center; width: 100%; height: 100%; font-family: var(--font-ui); font-size: 44px; line-height: 1; color: var(--text); background: color-mix(in srgb, var(--c) 35%, var(--surface)); }
.cal-phone-card .cal-plate { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 0; border-top: 2px solid var(--line-strong); text-align: center; font: 700 10px/1.2 var(--font-ui); color: var(--plate-blue-ink); }
.cal-phone-card .cal-plate.is-blue { background: var(--blue); }
.cal-phone-card .cal-plate.is-danger { background: var(--danger); color: var(--plate-danger-ink); }
.cal-phone-card .cal-plate.is-ok { background: var(--ok); color: var(--plate-ok-ink); }
.cal-phone-card .cal-plate.is-accent { background: var(--accent); color: var(--accent-text); }
.cal-phone-card .cal-plate-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }
.cal-phone-card .cal-phone-main { flex: 1; min-width: 0; padding: 6px 10px 6px 10px; }
.cal-phone-card .cal-phone-meta { display: flex; align-items: center; gap: 6px; }
.cal-phone-card .cal-avatar { display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--c); color: var(--on-bright); font: 700 8px/1 var(--font-ui); flex: none; }
.cal-phone-card.is-past { background: var(--surface-2); border-color: var(--line); box-shadow: none; }
.cal-phone-card.is-past .cal-phone-text, .cal-phone-card.is-past .cal-phone-meta { color: var(--muted); }
.cal-phone-card.is-past .cal-phone-media img { filter: grayscale(1); }
.cal-phone-card.is-past .cal-phone-media { border-right-color: var(--line); }

/* Свободный слот и стопка — 22 px, в новом языке */

/* Анимация возврата карточки (после переноса, отмены) — тот же переход, что был */
.cal-card.is-animate { transition: transform 0.3s ease, opacity 0.12s; }

/* Вид «дни строками» (CALENDAR_V5): карточка 164×52, миниатюра 48 во всю высоту, время 16, аватар 16, текст одной строкой */
.cal-body.is-rows .cal-card[data-mode="full"] { width: 164px; height: 52px; border-radius: 9px; }
.cal-body.is-rows .cal-card[data-mode="full"] .cal-media { width: 48px; height: 48px; }
.cal-body.is-rows .cal-card[data-mode="full"] .cal-card-body { padding: 4px 8px; gap: 2px; }
.cal-body.is-rows .cal-card[data-mode="full"] .cal-when { font-size: 16px; }
.cal-body.is-rows .cal-card[data-mode="full"] .cal-avatar { width: 16px; height: 16px; }
.cal-body.is-rows .cal-card[data-mode="full"] .cal-text { -webkit-line-clamp: 1; font-size: 11.5px; }
.cal-body.is-rows .cal-card[data-mode="full"] .cal-plate { font-size: 9px; padding: 2px 0; }

/* Свободный слот: пилюля «+ 10:40», пунктир цветом канала; в лучший час — подложка лучшего часа */
.cal-free { position: absolute; left: 0; top: 0; z-index: 1; display: flex; align-items: center; box-sizing: border-box; height: 22px; padding: 0 8px; border: 1.5px dashed var(--c); border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; cursor: pointer; }
.cal-free.is-best { background: var(--best-tint); }
.cal-free:hover { border-style: solid; border-color: var(--line-strong); background: var(--accent); color: var(--accent-text); }
.cal-free .cal-free-time { font-variant-numeric: tabular-nums; }
.cal-free.is-tight { justify-content: center; padding: 0 4px; font-size: 11px; }

/* Каскад: карточки веером, из-под каждой торчит верхняя полоса; наведение — карточка целиком выходит вперёд */
.cal-cascade { position: absolute; left: 0; top: 0; z-index: 3; }
.cal-cascade:hover, .cal-cascade:focus-within { z-index: 6; }
.cal-cascade > .cal-card, .cal-cascade > .cal-free { z-index: var(--z, 1); transition: translate 140ms ease, box-shadow 140ms ease; }
.cal-cascade > .cal-card[data-mode="pill"] { align-items: flex-start; padding: 2px 6px 0; box-shadow: 0 1px 0 var(--shadow-ink); }
.cal-cascade > .cal-card[data-mode="pill"] .cal-card-body { align-items: flex-start; }
.cal-cascade > .cal-card[data-mode="pill"] .cal-when { line-height: 14px; }
.cal-cascade > .cal-card[data-mode="pill"] .cal-card-body::after { content: attr(data-text); min-width: 0; flex: 1; overflow: hidden; line-height: 14px; font-size: 11.5px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.cal-cascade > .cal-card:hover, .cal-cascade > .cal-card:focus-visible, .cal-cascade > .cal-free:hover, .cal-cascade > .cal-free:focus-visible { z-index: 30; translate: 0 -2px; }
.cal-cascade > .cal-card[data-mode="pill"]:hover, .cal-cascade > .cal-card[data-mode="pill"]:focus-visible { box-shadow: 0 2px 2px 18px rgba(5, 6, 14, .45); }
.cal-cascade > .cal-card[data-mode="pill"]:hover .cal-card-body::after { color: var(--text); }
.cal-cascade-count { position: absolute; top: -8px; right: -4px; z-index: 40; min-width: 18px; height: 18px; padding: 0 5px; border: 1.5px solid var(--line-strong); border-radius: 9px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 700; line-height: 15px; cursor: zoom-in; }
.cal-cascade-count:hover { background: var(--surface); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
    .cal-card, .cal-card:hover { transition: none; }
    .cal-card.is-animate { transition: none; }
    .cal-card .cal-plate-bar, .cal-card .cal-status-dot.is-accent { animation: none; }
}

/* Колонка дня (CALENDAR_CARDS_FINISH, 1.3): шапка сегодня — жёлтая полоса с чёрной чертой; ось часов — 13 px на подложке; «сейчас» — плашка 12 px */
.cal-today-label { font-size: 13px; font-weight: 600; color: var(--accent-text); white-space: nowrap; }
.cal-axis { background: var(--surface-2); }
.cal-now-tag-col { font-family: var(--font-ui); font-size: 12px; font-weight: 600; }

/* ---- Журнал: плашки парсера вместо псевдографики ---- */
.activity-console-line.console-box { margin: 8px 0; padding: 0; text-indent: 0; overflow: hidden; border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--surface-2); }
.activity-console-line.console-box::before { content: none; }
.console-box-title { padding: 6px 10px; background: var(--surface-3); color: var(--text); font: 700 12px/1.3 var(--font-ui); }
.console-box-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 10px; border-top: 1px dashed var(--line); }
.console-box-key { flex: none; color: var(--faint); font-size: 11px; }
.console-box-value { min-width: 0; color: var(--text); font-weight: 700; text-align: right; overflow-wrap: anywhere; }

/* Подтверждение внутри страницы (ask() в js/core.js) — вместо браузерного confirm() */
.ask-dialog { width: min(440px, calc(100vw - 32px)); max-width: none; padding: 20px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); }


/* All modal backdrops share a single dim and blur treatment. */
:root {
    --modal-backdrop-color: rgba(0, 0, 0, .3);
    --modal-backdrop-blur: blur(4px);
}
.tree-backdrop, .image-viewer, .pe-overlay, .dtp-overlay, .cal-hint-layer,
.source-preview-overlay, .article-reader, .pv, .telegram-auth-modal,
dialog::backdrop {
    background: var(--modal-backdrop-color);
    -webkit-backdrop-filter: var(--modal-backdrop-blur);
    backdrop-filter: var(--modal-backdrop-blur);
}
.ask-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.ask-dialog p { margin: 0 0 10px; line-height: 1.45; }
.ask-dialog .dialog-actions { margin-top: 16px; }
.ask-dialog button { min-height: 40px; padding: 0 16px; border-radius: 8px; font: inherit; cursor: pointer; }
.ask-dialog .ask-cancel { border: 1px solid var(--line-strong); background: transparent; color: var(--text); }
.ask-dialog .ask-ok { border: 0; background: var(--text); color: var(--surface); font-weight: 600; }
.ask-dialog .ask-ok.danger { background: #D92D20; color: #fff; }

/* Админка: модели по ролям и параметры поведения */
.llm-roles { display: grid; gap: 10px; margin: 12px 0; }
.llm-role { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: 10px; }
.llm-target { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.llm-target select { max-width: 100%; }
.llm-threshold input { width: 5em; }
.tunables { display: grid; gap: 14px; }
.tunable-group { border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: 10px; padding: 8px 12px 12px; display: grid; gap: 10px; }
.tunable-group legend { font-weight: 700; padding: 0 6px; }
.tunable { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; }
.tunable small { grid-column: 1 / -1; }
.tunable input[type=number] { width: 7em; }
.tunable input[type=text] { width: 14em; }
.tunable.is-changed .tunable-title { font-weight: 700; }
.tunable .link-button { grid-column: 1 / -1; justify-self: start; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font-size: .85em; }
@media (max-width: 560px) { .tunable { grid-template-columns: 1fr; } }

/* Финальная привязка интерактивных акцентов к теме после компонентных правил. */
.primary-button, .topic-row button { background: #ffda1a; color: #27251f; box-shadow: 0 2px 0 rgba(39, 37, 31, .16); }
.primary-button:hover:not(:disabled), .topic-row button:hover:not(:disabled) { background: #f0cb00; box-shadow: 0 3px 0 rgba(39, 37, 31, .18); }
.secondary-button:hover, .refresh-button:hover, .debug-banner button:hover, .database-record-actions button:hover { border-color: #bdb29e; background: #f3e8ae; }
.topic-row button { border-radius: 6px; }
.btn-main { background: #ffda1a; color: #27251f; box-shadow: 0 2px 0 rgba(39, 37, 31, .16); }
.activity-console-line.console-box { border-left-color: #8a7100; }
.cal-fill { background: #a52d25; color: #fffdf7; }

.image-viewer-draft-add { margin-left: 0; width: 38px; }

/* Пустая подпись занимает столько же места, сколько одна строка текста. */
.pv-text-empty, .cal-plan-text:empty, .cal-text:empty, .cal-phone-text:empty, .cal-pick-text:empty, .cal-pop-text:empty, .sp-text:empty { min-height: 1lh; }

#admin-prompts .tunable-group { margin: 1rem 0; }
#admin-prompts textarea { box-sizing: border-box; width: 100%; min-height: 12rem; resize: vertical; }

/* Database workspace */
.admin-section[data-admin-section="databases"] { display: grid; align-content: start; gap: 18px; height: auto; overflow: visible; }
.db-page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.db-page-heading h2 { margin: 5px 0 4px; font-size: 26px; letter-spacing: -.035em; }
.db-page-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.db-eyebrow { color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.database-layout { grid-template-columns: minmax(260px, 32%) minmax(0, 1fr); gap: 0; height: min(72vh, 760px); min-height: 500px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.database-sidebar { gap: 0; border-right: 1px solid var(--line); background: var(--bg); }
.database-toolbar { gap: 10px; padding: 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.database-toolbar label { min-width: 120px; font-size: 11px; font-weight: 600; }
.database-toolbar select { height: 38px; }
.db-list-heading { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 10px; font-size: 13px; }
.db-list-heading span { padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.db-search { display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); }
.db-search:focus-within { border-color: var(--accent); }
.db-search span { font-size: 20px; line-height: 1; }
.db-search input { width: 100%; min-width: 0; height: 36px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.database-list { gap: 2px; padding: 0 8px 10px; border: 0; border-radius: 0; background: transparent; }
.database-list-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 11px 9px; border: 1px solid transparent; border-radius: 7px; background: transparent; text-align: left; white-space: normal; }
.database-list-item:hover { background: var(--surface-2); border-color: transparent; }
.database-list-item.active { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
.db-item-number { min-width: 26px; padding-top: 2px; color: var(--faint); font: 11px var(--mono); }
.database-list-item.active .db-item-number { color: var(--accent); }
.db-item-copy { display: grid; gap: 4px; min-width: 0; }
.db-item-copy strong, .db-item-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-item-copy strong { font-size: 13px; font-weight: 600; }
.db-item-copy small { color: var(--muted); font-size: 11px; }
.db-no-results { padding: 22px 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.database-main { gap: 0; padding: 18px 22px; overflow: auto; }
.database-status { min-height: 0; margin: 0; }
.database-status:not(:empty) { margin-bottom: 12px; }
.database-browser { flex: 1; min-height: 0; gap: 14px; }
.database-header { padding: 0 0 13px; border-bottom: 1px solid var(--line); }
.database-breadcrumb { flex-wrap: wrap; font-size: 12px; }
.database-breadcrumb span:last-child { color: var(--text); font-weight: 600; }
.database-viewer { flex: 1; min-height: 0; grid-template-columns: 30px minmax(0, 1fr) 30px; gap: 10px; align-items: center; }
.database-nav-btn { width: 30px; height: 34px; border-radius: 7px; font-size: 20px; }
.database-record-view { max-height: 100%; height: 100%; border: 0; background: transparent; }
.database-record-top { grid-template-columns: minmax(180px, .8fr) minmax(0, 1.2fr); gap: 20px; padding: 8px 4px 20px; border-color: var(--line); }
.database-record-top:has(> .database-record-info-section:only-child) { grid-template-columns: minmax(0, 1fr); }
.database-record-item-media-wrapper-large { min-height: 180px; max-height: 300px; }
.database-record-title { font-size: 22px; line-height: 1.25; letter-spacing: -.025em; }
.database-record-priority-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.database-priority-field { padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.database-priority-content strong { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.database-priority-value { white-space: pre-wrap; }
.database-record-expandable { margin: 14px 4px; }
.database-record-expandable summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; }
.database-record-actions { justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--line); }
.database-danger-zone { margin-top: 0; }
@media (max-width: 760px) {
    .db-page-heading { align-items: start; flex-wrap: wrap; }
    .database-layout { display: flex; flex-direction: column; height: auto; min-height: 0; overflow: visible; }
    .database-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
    .database-list { max-height: 260px; min-height: 80px; }
    .database-main { min-height: 320px; padding: 16px; }
    .database-viewer { min-height: 260px; grid-template-columns: 28px minmax(0, 1fr) 28px; gap: 5px; }
    .database-record-view { max-height: 60vh; }
    .database-record-top { grid-template-columns: minmax(0, 1fr); }
    .database-danger-zone { flex-wrap: wrap; }
}

/* Database record: every field is visible in one compact list. */
.database-record-content { min-width: 0; padding: 0 4px 18px; }
.database-media-preview { display: flex; justify-content: flex-start; max-height: 230px; margin: 0 0 18px; overflow: hidden; }
.database-media-preview img, .database-media-preview video { display: block; max-width: 100%; max-height: 230px; object-fit: contain; border-radius: 6px; }
.database-media-preview img { cursor: zoom-in; }
.database-fields { border-top: 1px solid var(--line); }
.database-fields .database-record-field { display: grid; grid-template-columns: minmax(120px, 27%) minmax(0, 1fr); gap: 16px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.database-fields .database-record-field-label { padding-top: 2px; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.database-fields .database-record-field-value { min-width: 0; color: var(--text); font-size: 13px; font-weight: 400; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }
.database-fields .database-record-field-value.code { margin: 0; padding: 0; background: transparent; font-size: 12px; }
.database-fields a.database-record-field-value { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 600px) {
    .database-fields .database-record-field { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}

/* Инструменты источников */
.source-tools-trigger { margin: 0 0 20px; }
.source-tools-trigger span { margin-left: 7px; color: var(--muted); }
.source-tools-dialog { box-sizing: border-box; width: min(960px, calc(100vw - 32px)); max-width: none; max-height: min(88vh, 920px); padding: 0; overflow: auto; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--panel); color: var(--text); box-shadow: 0 24px 80px #0009; }

.source-tools-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 20px; padding: 24px 28px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.source-tools-header h2 { margin: 5px 0 5px; font-size: 23px; }
.source-tools-header p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.source-tools-eyebrow { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.source-tools-close { flex: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); color: var(--text); font-size: 24px; line-height: 1; cursor: pointer; }
.source-tools-body { display: grid; gap: 14px; padding: 20px 28px 28px; }
#source-tab .source-tools-body > .source-add, #source-tab .source-tools-body > .own-content, .source-tools-body > .source-extra-section { box-sizing: border-box; max-width: none; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel2); }
.source-tools-body > .source-extra-section > summary { padding: 0; }
.source-tools-body .section-title { margin: 0 0 8px; }
.source-tools-body .source-add-hint { line-height: 1.55; }
.source-tools-body input, .source-tools-body textarea, .source-tools-body select { max-width: 100%; }
@media (max-width: 600px) {
  .source-tools-dialog { width: calc(100vw - 16px); max-height: 92vh; border-radius: 16px; }
  .source-tools-header { padding: 19px 18px 16px; }
  .source-tools-body { padding: 14px; }
  .source-tools-body .source-add-form { flex-wrap: wrap; }
  .source-tools-body .source-add-form input { flex-basis: 100%; }
}

/* Быстрый вход Telegram для загрузки недоступного в вебе видео. */
.telegram-auth-modal { position: fixed; z-index: 1200; inset: 0; display: grid; place-items: center; padding: 20px;  }
.telegram-auth-modal[hidden] { display: none; }
.telegram-auth-panel { position: relative; width: min(100%, 560px); max-height: min(90vh, 820px); overflow-y: auto; padding: 30px clamp(20px, 5vw, 38px); border: 1px solid color-mix(in srgb, var(--line-strong) 75%, #34a9e8); border-radius: 24px; background: var(--surface); box-shadow: 0 28px 90px rgb(0 0 0 / 32%); animation: tg-auth-in .22s ease-out; }
.telegram-auth-close { position: absolute; top: 14px; right: 16px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); background: var(--surface-2); font-size: 25px; cursor: pointer; }
.telegram-auth-brand { display: flex; align-items: center; gap: 10px; color: #279bd7; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.telegram-auth-logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; color: white; background: linear-gradient(145deg,#35b9ef,#168acb); font-size: 17px; transform: rotate(-18deg); }
.telegram-auth-panel h2 { margin: 18px 0 7px; font-size: clamp(22px, 5vw, 29px); letter-spacing: -.025em; }
.telegram-auth-lead, .telegram-auth-foot { color: var(--muted); line-height: 1.55; }
.telegram-auth-foot { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; }
.telegram-auth-panel .tgu-card { margin-top: 16px; padding: 0; border: 0; }
.telegram-auth-panel .tgu-card > h4, .telegram-auth-panel .tgu-card > p:first-of-type { display: none; }
.telegram-auth-panel .telegram-steps { padding-left: 20px; }
.telegram-auth-panel .tgu-card form { max-width: none; }
.telegram-auth-open { overflow: hidden; }
.pv-mosaic-note { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.pv-tg-connect { flex: 0 0 auto; padding: 8px 14px; border: 0; border-radius: 999px; color: white; background: #229ed9; font: inherit; font-weight: 650; cursor: pointer; }
.pv-tg-connect:hover { background: #1689c0; }
@keyframes tg-auth-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) { .telegram-auth-modal { padding: 10px; align-items: end; } .telegram-auth-panel { max-height: 92vh; padding: 25px 18px 20px; border-radius: 22px 22px 12px 12px; } }
@media (prefers-reduced-motion: reduce) { .telegram-auth-panel { animation: none; } }

/* Complete, lightweight previews of the current unrated pool. */
#content-tab > .content-pool-section { min-width: 0; width: 100%; box-sizing: border-box; margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.content-pool-section h2 { margin: 0; font-size: 19px; }
#content-pool-count { color: var(--muted); font-size: 13px; font-weight: 500; }
.content-pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.content-pool-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; padding: 0; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--bg); cursor: pointer; }
.content-pool-card:hover, .content-pool-card:focus-visible,
.content-pool-card[aria-current="true"] { border-color: var(--accent); }
.content-pool-thumb { display: block; position: relative; width: 100%; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.content-pool-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.content-pool-card-body { display: flex; flex-direction: column; gap: 7px; padding: 12px; width: 100%; box-sizing: border-box; }
.content-pool-card-text { overflow-wrap: anywhere; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; }
.content-pool-card-meta { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
@media (min-width: 1240px) {
    #content-tab > .content-pool-section { grid-column: 2 / -1; grid-row: auto; }
}
@media (min-width: 1500px) {
    #content-tab > .content-pool-section { grid-column: 2 / 5; }
}

/* Keep the review panels above the full-width suggestion pool. */
#content-tab > .topic-form,
#content-tab #item-card-wrapper > .controls { position: static; top: auto; bottom: auto; }

/* AI explanation is full text, not a clipped card preview. */
#item-ai .item-ai-note, #item-ai .desc-text { max-height: none; overflow: visible; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }

/* Post editor: native drag and drop feedback, stable media cards. */
.pe-grid.is-file-drop { outline: 2px dashed var(--accent); outline-offset: 5px; border-radius: 10px; }
.pe-poll-help { margin: 0; color: var(--text-muted, #888); font-size: 13px; line-height: 1.5; }

.pe-extra-section { grid-column:1 / -1; }
.pe-extras-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(250px,100%),1fr)); gap:10px; }
.pe-extra-control,.pe-extra-preview { display:flex; align-items:center; gap:8px; font-size:13px; }
.pe-extra-preview select { min-width:0; flex:1; }
.pe-extra-control:has(input:disabled),.pe-extra-preview:has(select:disabled) { opacity:.55; }
.pe-button-rows { display:grid; gap:8px; }
.pe-button-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,2fr) auto; gap:8px; }
@media(max-width:540px){.pe-button-row{grid-template-columns:1fr auto}.pe-button-row input:first-child{grid-column:1/-1}}

.pe-extra-cards { display:grid; gap:8px; border-top:1px solid var(--line); padding-top:10px; }
.pe-card-field { display:grid; grid-template-columns:minmax(100px,1fr) minmax(0,2fr); gap:8px; align-items:center; font-size:13px; }

.pe-format-bar{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin:2px 0 4px}.pe-format-switch{display:flex;align-items:center;gap:6px;font-size:12px;margin-right:5px}.pe-format-action{min-width:30px}.pe-format-action:nth-of-type(1){font-weight:700}.pe-format-action:nth-of-type(2){font-style:italic}.pe-format-action:nth-of-type(3){text-decoration:underline}.pe-format-action:nth-of-type(4){text-decoration:line-through}.pe-format-preview{margin-top:8px;border:1px solid var(--line);border-radius:10px;padding:10px;overflow-wrap:anywhere}.pe-preview-label{opacity:.65;font-size:11px}.pe-preview-copy{white-space:pre-wrap;margin-top:6px;line-height:1.45}.pe-preview-link{color:#478cf1;text-decoration:underline}

.pe-video-note video{border-radius:50%;object-fit:contain;aspect-ratio:1;overflow:hidden}

.pe-variant-bar{border-bottom:1px solid var(--line)}.pe-variant-label{font-size:12px;opacity:.65;margin-right:4px}.pe-variant-tab{max-width:220px;overflow:hidden;text-overflow:ellipsis;border:1px solid var(--line);border-radius:8px;background:transparent;color:inherit;padding:6px 10px;font-size:12px;cursor:pointer}.pe-variant-tab.is-active{background:var(--panel);border-color:var(--accent);font-weight:600}.pe-variant-reset{margin-left:auto}.pe-check:has(button){grid-template-columns:minmax(0,1fr) minmax(0,2fr) auto}.pe-comment-field{grid-column:1/-1}.pe-comment-field textarea{min-height:68px;resize:vertical;flex:1}

/* Keep per-resource editing compact without hiding individual selections. */
.pe-variant-bar{display:flex;flex:none;flex-wrap:nowrap;overflow-x:auto;max-width:100%;min-width:0;gap:6px;align-items:center;padding:5px 0;scrollbar-width:thin}.pe-variant-bar>*{flex-shrink:0}.pe-variant-tab{white-space:nowrap}.pe-check:has(button){grid-template-columns:minmax(0,1fr) auto;align-items:center}.pe-check:has(button)>span{grid-column:1/-1}.pe-check:has(button)>button{grid-column:2;grid-row:1}.pe-body>.pe-section{align-self:start}.pe-extra-preview{flex-wrap:wrap}.pe-extra-text input,.pe-extra-text textarea,.pe-extra-text select{min-width:0;max-width:100%}

.pe-cover-tools{position:absolute;bottom:4px;left:4px;right:4px;display:flex;gap:3px;z-index:2}.pe-cover-tools .pe-btn{background:rgba(0,0,0,.75);color:white;padding:3px 6px;font-size:10px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pe-cover-pick{flex:1}.pe-cover-remove{flex:none}

/* Composer: one attachment toolbox; validation appears only when needed. */
.pe-attachment-toolbar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
.pe-attachment-toolbar>.pe-attachments,.pe-card-actions{display:contents}
.pe-attachment-toolbar .is-on{border-color:var(--accent);color:var(--accent);background:var(--surface)}
.pe-file-area{display:grid;gap:10px;min-width:0}.pe-file-area[hidden],.pe-extra-cards[hidden],.pe-checks[hidden],.pe-card-field[hidden],.pe-attachment-toolbar [hidden]{display:none!important}
.pe-attachment-detail,.pe-extra-cards{border-top:1px solid var(--line);padding-top:12px;min-width:0}
.pe-body>.pe-attachment-section:has(.pe-attachment-detail:not([hidden])){align-self:start}
.pe-window>.pe-checks{display:flex;flex-direction:column;flex:none;min-width:0}
.pe-window>.pe-checks .pe-check{grid-template-columns:minmax(0,1fr) auto;gap:3px 10px;border-color:color-mix(in srgb,var(--danger) 42%,var(--line));background:color-mix(in srgb,var(--danger) 6%,var(--surface));border-left:3px solid var(--danger)}
.pe-window>.pe-checks .pe-check strong{color:var(--danger);grid-column:1;font-size:12px}.pe-window>.pe-checks .pe-check span{grid-column:1/-1;font-size:13px;line-height:1.4}.pe-window>.pe-checks .pe-check button{grid-column:2;grid-row:1}
@media(max-width:720px){.pe-window>.pe-checks{max-height:110px}.pe-attachment-toolbar{gap:5px}}

/* Composer layout: independent content/settings columns, fixed validation and actions. */
.pe-window{width:min(1200px,100%);height:94dvh;max-height:calc(100dvh - 32px);gap:12px;padding:20px 22px 16px}
.pe-window>.pe-body{grid-template-columns:minmax(0,2fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr);align-content:stretch;gap:18px;overflow:hidden;padding:0;scrollbar-gutter:auto}
.pe-compose-column,.pe-settings-column{display:flex;flex-direction:column;gap:14px;min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:1px 6px 8px 1px}
.pe-settings-column{border-left:1px solid var(--line);padding-left:18px}
.pe-compose-column>.pe-section,.pe-settings-column>.pe-section,.pe-chips>.pe-section{flex:none;min-width:0;padding:0 0 14px;border-bottom:1px solid var(--line)}
.pe-compose-column>.pe-section:last-child,.pe-settings-column>.pe-section:last-child{border-bottom:0}
.pe-window .pe-section-head h3{font-size:14px;color:var(--text)}
.pe-window .pe-text{min-height:clamp(150px,25dvh,280px);resize:vertical}
.pe-window .pe-grid{grid-template-columns:repeat(auto-fill,minmax(96px,1fr))}
.pe-window .pe-chips{display:flex;flex-direction:column;gap:14px;margin:0;min-width:0}
.pe-destination-list{display:grid;gap:5px;min-width:0;max-height:220px;overflow:auto;scrollbar-width:thin}
.pe-destination-list .pe-target-option{justify-content:space-between;border:1px solid var(--line);border-radius:8px;min-width:0;padding:9px 11px}
.pe-destination-list .pe-target-option:has(input:checked){background:var(--surface-2);border-color:var(--line-strong)}
.pe-target-name{overflow-wrap:anywhere;min-width:0}
.pe-target-count{color:var(--muted);font-size:12px;font-weight:400;white-space:nowrap}
.pe-timing-section .pe-target{display:flex;flex-direction:column;min-width:0}
.pe-timing-section .pe-chip{width:100%;border-radius:8px;justify-content:space-between;text-align:left;white-space:normal;box-sizing:border-box}
.pe-timing-section .pe-chip strong{overflow-wrap:anywhere;min-width:0}
.pe-timing-section .pe-target-menu{position:static;width:100%;min-width:0;max-width:100%;box-sizing:border-box}
.pe-window>.pe-checks{max-height:min(100px,14dvh)}
.pe-window>.pe-footer{flex:none;padding-top:10px}
@media(max-width:820px){
  .pe-window{width:100%;height:100dvh;max-height:100dvh;padding:14px;gap:10px}
  .pe-overlay{padding:0}
  .pe-window>.pe-body{display:flex;flex-direction:column;gap:16px;overflow:auto;scrollbar-width:thin}
  .pe-compose-column,.pe-settings-column{overflow:visible;flex:none;min-height:auto;padding:0;gap:12px}
  .pe-settings-column{order:-1;border-left:0;border-bottom:1px solid var(--line);padding-bottom:12px}
  .pe-destination-list{max-height:150px}
  .pe-window .pe-text{min-height:200px}
}

/* No scrolling panels in the composer: compact content, explicit pages for overflow. */
.pe-window>.pe-body,.pe-window .pe-compose-column,.pe-window .pe-settings-column{overflow:hidden;scrollbar-gutter:auto;scrollbar-width:auto}
.pe-window .pe-compose-column,.pe-window .pe-settings-column{gap:10px;padding-bottom:0}
.pe-window .pe-compose-column>.pe-section,.pe-window .pe-settings-column>.pe-section,.pe-window .pe-chips>.pe-section{gap:8px;padding-bottom:10px}
.pe-window .pe-variant-bar{overflow:hidden;flex-wrap:wrap;gap:4px;padding:2px 0 7px;min-width:0}
.pe-window .pe-variant-label{flex:none;margin-right:3px}
.pe-window .pe-variant-tab{flex:1 1 0;min-width:0;max-width:none;overflow:hidden;text-overflow:ellipsis;padding:5px 7px}
.pe-window .pe-variant-reset{flex:0 0 auto;margin-left:auto}
.pe-window .pe-variant-select{flex:1;min-width:0;width:auto}
.pe-window .pe-text{height:clamp(115px,18dvh,200px);min-height:0;resize:none;flex:none}
.pe-window .pe-format-bar{margin:0;gap:4px}
.pe-window .pe-chip-row{gap:5px}
.pe-window .pe-style{padding:6px 10px}
.pe-window .pe-style-text{height:68px;min-height:0;resize:none}
.pe-window .pe-format-preview{margin:0;padding:6px 9px}
.pe-window .pe-preview-copy{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
.pe-window .pe-attachment-toolbar{gap:4px}
.pe-window .pe-attachment{padding:6px 8px;font-size:12px}
.pe-window .pe-grid{grid-template-columns:repeat(auto-fill,minmax(76px,1fr));gap:6px}
.pe-window .pe-card,.pe-window .pe-add{aspect-ratio:4/3}
.pe-window .pe-add-empty{grid-column:1/-1;aspect-ratio:auto;min-height:40px;display:flex;justify-content:center;align-items:center;gap:8px}
.pe-window .pe-url-row{flex-wrap:nowrap;gap:6px}
.pe-window .pe-url-row .pe-input{min-width:0}
.pe-window .pe-url-row button{flex:none;padding:7px 10px}
.pe-window .pe-file-area{gap:7px}
.pe-window .pe-destination-list{max-height:none;overflow:visible;gap:4px}
.pe-window .pe-target-option{padding:7px 9px}
.pe-window .pe-timing-section .pe-target-menu{max-height:none;overflow:visible}
.pe-settings-open{text-align:left;width:100%;font-size:13px}
.pe-settings-column[data-view=main]>.pe-extra-section,.pe-settings-column[data-view=settings]>.pe-chips,.pe-settings-column[data-view=settings]>.pe-settings-open{display:none!important}
.pe-window .pe-extras-fields{display:flex;flex-direction:column;gap:9px}
.pe-window .pe-extra-preview{flex-direction:column;align-items:stretch;gap:4px}
.pe-window .pe-extra-preview select{flex:none}
.pe-window .pe-button-row{grid-template-columns:minmax(0,1fr) auto}
.pe-window .pe-button-row input:first-child{grid-column:1/-1}
.pe-window .pe-page-hidden{display:none!important}
.pe-pager{display:flex;flex:none;align-items:center;justify-content:center;gap:10px;color:var(--muted);font-size:12px}
.pe-pager button{padding:3px 12px}
.pe-pane-nav,.pe-mobile-nav{display:flex;flex:none;gap:5px}
.pe-pane-nav .is-active{border-color:var(--accent);color:var(--text)}
.pe-mobile-nav{display:none}
.pe-compose-column[data-view=text]>.pe-attachment-section,
.pe-compose-column[data-view=media]>.pe-section:not(.pe-attachment-section),
.pe-compose-column[data-view=poll]>.pe-section:not(.pe-attachment-section),
.pe-compose-column[data-view=poll] .pe-attachment-section>:not(.pe-attachment-detail):not(.pe-section-head):not(.pe-attachment-toolbar),
.pe-compose-column[data-view=media][data-split-poll=true] .pe-attachment-detail { display: none !important; }
.pe-window .pe-poll-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.pe-window .pe-poll-row .pe-input{padding:6px 8px}
.pe-window .pe-attachment-detail{gap:6px}
.pe-window>.pe-checks{max-height:none;overflow:visible;gap:4px}
.pe-window>.pe-checks .pe-check{padding:6px 10px}
@media(max-width:820px){
  .pe-window>.pe-body{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);overflow:hidden}
  .pe-window .pe-mobile-nav{display:flex}
  .pe-window[data-mobile=compose] .pe-settings-column,.pe-window[data-mobile=settings] .pe-compose-column{display:none}
  .pe-window .pe-compose-column,.pe-window .pe-settings-column{min-height:0;overflow:hidden;padding:0}
  .pe-window .pe-settings-column{order:0;border:0}
  .pe-window .pe-text{height:clamp(100px,16dvh,180px)}
  .pe-window .pe-variant-tab{flex:1 1 30%}
  .pe-window .pe-variant-label{width:100%}
}

/* Keep editing by keyboard/wheel available for long text without visible scrollbars. */
.pe-window,.pe-window *{scrollbar-width:none}
.pe-window::-webkit-scrollbar,.pe-window *::-webkit-scrollbar{display:none;width:0;height:0}

/* Extreme viewport fallback: no visible scrollbars, but no clipped inputs. */
.pe-window .pe-compose-column[data-overflow=true],.pe-window .pe-settings-column[data-overflow=true]{overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}

/* Social settings: shared theme, responsive connection cards, no overflowing setup forms. */
.social-settings { gap: 16px; }
.social-settings [hidden] { display: none !important; }
.connections-heading { margin: 0 0 2px; padding: 2px 2px 0; }
.connections-heading h2, .connections-heading h3 { margin: 0 0 4px; font-size: 22px; line-height: 1.25; }
.connections-heading p { margin: 0; }
.connections-subheading h3 { font-size: 17px; }
.connections-card { display: grid; gap: 14px; min-width: 0; }
.connections-title, .connection-form-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.connections-title h3, .connections-title p, .connections-card h4 { margin: 0; }
.connections-title p { margin-top: 4px; }
.connection-total { flex: none; font-size: 12px; color: var(--muted); text-align: right; }
.connection-total strong { display: block; font-size: 22px; color: var(--text); line-height: 1.1; }
.connection-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,250px),1fr)); gap: 10px; }
.connection-list { display: grid; gap: 6px; min-width: 0; }
.connection-tile, .connection-row { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.connection-tile { display: grid; gap: 12px; }
.connection-tile-head, .connection-row, .connection-tile-foot { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.connection-copy { display: grid; gap: 3px; flex: 1 1 100px; min-width: 0; overflow-wrap: anywhere; }
.connection-copy strong { font-size: 14px; color: var(--text); }
.connection-copy span { font-size: 12px; color: var(--muted); }
.connection-icon { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-3); font-weight: 800; font-size: 12px; }
.connection-icon-max { background: #e7e2fb; color: #5543b6; }
.connection-icon-vk { background: #e3eefc; color: #1762b9; }
.connection-icon-ok { background: #f9e8d5; color: #a64b0b; }
.connection-icon-youtube, .connection-icon-pinterest { background: #f8e4e0; color: #a82926; }
.connection-state { flex: none; font-size: 11px; line-height: 1.4; color: var(--muted); padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; }
.connection-state.is-connected { color: #287044; border-color: #9dc5a6; }
.connection-tile-foot { justify-content: space-between; }
.connection-tile-foot .secondary-button { margin-left: auto; min-height: 34px; padding: 6px 12px; }
.connection-row .account-secondary { min-height: 34px; }
.connection-empty, .connection-security { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.connection-empty { padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.connection-form { border: 1px solid var(--line-strong); border-radius: 12px; padding: 14px; min-width: 0; }
.connection-instructions { font-size: 13px; color: var(--muted); }
.connection-instructions summary, #networks-inactive summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.social-settings .account-card, .social-settings .telegram-form { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .connections-title { align-items: start; } .connection-tile-head .connection-state { margin-left: auto; } .connection-row .account-secondary { margin-left: auto; } }

.max-bot-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.max-bot-actions a { text-decoration: none; }
.max-bot-link-steps { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.max-bot-link-steps p { margin: 0; }
.max-bot-owner { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.max-bot-owner summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.max-bot-owner form { margin-top: 12px; }
