/* Дополнения к дизайн-системе (main.css) для шаблонов Django.
   Здесь — то, что в макетах было inline-стилями (CSP запрещает style=""), и мелкие служебные классы. */

/* Honeypot: поле скрыто от людей, но видно ботам */
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

.fieldset-plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset-plain > legend { margin-bottom: 8px; padding: 0; }
.menu-anchor { position: relative; }
.menu--right { right: 0; top: 48px; }
.panel-user { line-height: 1.3; min-width: 0; }
.panel-user__name { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-sidebar__site { margin-left: auto; color: #E4D6F0; }
.stat-card__suffix { font-size: 1rem; color: var(--c-text-3); font-weight: 500; }
.box__title--flush { margin: 0; }
.label-col { min-width: 90px; }
.badge--compact { height: 20px; font-size: 11px; }
.detail-drawer__title { font-size: var(--fs-20); }
.textarea--short { min-height: 96px; }
.success-panel--compact { padding: 8px 0; }
.panel-grid--flush { margin-top: 0; }
.w-80 { width: 80%; }
.w-55 { width: 55%; }

/* Высота столбиков диаграмм — классами с шагом 5% */
.h-0{height:0}.h-5{height:5%}.h-10{height:10%}.h-15{height:15%}.h-20{height:20%}.h-25{height:25%}.h-30{height:30%}
.h-35{height:35%}.h-40{height:40%}.h-45{height:45%}.h-50{height:50%}.h-55{height:55%}.h-60{height:60%}.h-65{height:65%}
.h-70{height:70%}.h-75{height:75%}.h-80{height:80%}.h-85{height:85%}.h-90{height:90%}.h-95{height:95%}.h-100{height:100%}

/* Объявление на главной */
.announcement { margin-bottom: var(--s-4); }
.announcement a { font-weight: 600; }

/* Ошибки форм без поля */
.errorlist { list-style: none; margin: 0; padding: 0; }

/* Пустые аватары удалённых пользователей */
.avatar--c6:empty::after { content: "?"; }

/* Комментарии */
.comments { margin-top: var(--s-10); }
.comment { display: grid; grid-template-columns: 40px 1fr; gap: var(--s-3); padding: var(--s-4) 0; border-top: 1px solid var(--c-border); }
.comment__head { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: baseline; font-size: var(--fs-14); }
.comment__author { font-weight: 600; color: var(--c-text); }
.comment__time { color: var(--c-text-3); }
.comment__text { margin-top: var(--s-1); overflow-wrap: anywhere; }
.comment__actions { display: flex; gap: var(--s-2); margin-top: var(--s-2); }
.comment__deleted { color: var(--c-text-3); font-style: italic; }
.comment__quote { border-left: 3px solid var(--c-border-strong); padding-left: var(--s-3); color: var(--c-text-2); font-size: var(--fs-14); margin-top: var(--s-1); }

/* Ссылка-кнопка в строку */
.link-btn { background: none; border: 0; padding: 0; color: var(--c-primary); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; min-height: 32px; }
.link-btn--danger { color: var(--c-danger); }
.inline-form { display: inline; }

/* Плашка превью для сотрудников */
.staff-banner { margin-bottom: var(--s-4); }

/* SVG-графики панели */
.svg-chart { width: 100%; height: auto; display: block; color: var(--c-primary); }
.svg-chart text { fill: var(--c-text-3); font-size: 11px; font-family: var(--font-ui, inherit); }
.svg-chart .grid { stroke: var(--c-border); stroke-width: 1; }
.svg-chart .bar { fill: currentColor; opacity: .85; }
.svg-chart .bar--accent { fill: var(--c-accent); }
.svg-chart .line { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.svg-chart .area { fill: currentColor; opacity: .12; }
.heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.heat__cell { aspect-ratio: 1; border-radius: 3px; background: var(--c-primary); }
.heat__axis { display: grid; grid-template-columns: repeat(24, 1fr); font-size: 10px; color: var(--c-text-3); margin-top: 4px; }
.op-0{opacity:.06}.op-1{opacity:.15}.op-2{opacity:.3}.op-3{opacity:.45}.op-4{opacity:.6}.op-5{opacity:.75}.op-6{opacity:.9}.op-7{opacity:1}

/* Таблицы мини-статистики */
.kv { display: grid; grid-template-columns: 1fr auto; gap: var(--s-2) var(--s-4); font-size: var(--fs-14); }
.kv dt { color: var(--c-text-2); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* Редактор новостей */
.md-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--c-border-strong); border-bottom: 0; border-radius: var(--r-md) var(--r-md) 0 0; background: var(--c-surface-2); }
.md-toolbar + .textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.md-toolbar .btn { min-height: 36px; padding: 0 10px; }
.editor-grid { display: grid; gap: var(--s-6); }
@media (min-width: 1100px) { .editor-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.editor-preview { min-height: 200px; }
.cover-preview { border-radius: var(--r-md); max-width: 100%; height: auto; display: block; }
.textarea--tall { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; }

/* Галерея вложений в панели */
.attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-3); }
.attachments img, .attachments video { width: 100%; border-radius: var(--r-sm); display: block; background: var(--c-surface-2); }
.attachments img { aspect-ratio: 4/3; object-fit: cover; }
.attachment__name { font-size: var(--fs-13); color: var(--c-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; margin-top: 4px; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.timeline li { border-left: 2px solid var(--c-border); padding-left: var(--s-3); font-size: var(--fs-14); }
.timeline time { color: var(--c-text-3); display: block; font-size: var(--fs-13); }

.snapshot { background: var(--c-surface-2); border-radius: var(--r-md); padding: var(--s-4); display: grid; gap: var(--s-2); overflow-wrap: anywhere; }
.snapshot__msg { font-size: var(--fs-14); }
.snapshot__msg--reported { background: var(--c-danger-soft); color: var(--c-danger-soft-text); border-radius: var(--r-sm); padding: 4px 8px; }

.chat-search-results { display: grid; gap: var(--s-3); }
.chat-state-note { margin: var(--s-3); }
.msg.is-hidden-blocked .msg__text, .msg.is-hidden-blocked .msg__img { display: none; }
.msg.is-hidden-blocked .msg__bubble::after { content: "Сообщение скрыто: вы заблокировали автора"; color: var(--c-text-3); font-size: var(--fs-13); }
.msg.is-pending { opacity: .6; }
.pinned-list { display: grid; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--c-border); }
.pinned-item { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--fs-14); }
.pinned-item .icon { flex: none; color: var(--brand-lights, #FBC773); }

.form-errors { margin-bottom: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mt-8 { margin-top: var(--s-8); }
.mb-6 { margin-bottom: var(--s-6); }
.text-small { font-size: var(--fs-14); }
.text-center { text-align: center; }
.break { overflow-wrap: anywhere; }

/* Кнопка «Выйти» в шторке выглядит как пункт меню */
.drawer__nav form { margin: 0; }
.drawer__nav-btn { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 48px; padding: 0 var(--s-3); border: 0; background: none; color: inherit; font: inherit; font-weight: 500; text-align: left; cursor: pointer; border-radius: var(--r-md); }
.drawer__nav-btn:hover { background: var(--c-surface-2); }
.tabs--compact { margin-block: 0; border-bottom: 0; }
.tabs--compact .tabs__link { background: none; border-top: 0; border-left: 0; border-right: 0; font: inherit; cursor: pointer; }
.row--center { justify-content: center; }
.msg__author a { color: inherit; text-decoration: none; }
.msg__author a:hover { text-decoration: underline; }
.composer.is-editing .composer__input { border-color: var(--c-primary); }
.msg__status.is-read { color: var(--c-success, #1E6B45); }
.dm__placeholder { display: grid; place-items: center; }
.chat__title a { color: inherit; text-decoration: none; }
.menu form { margin: 0; }
.menu form .menu__item { width: 100%; }
.segmented__link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s-3); border-radius: var(--r-md); text-decoration: none; color: var(--c-text-2); font-weight: 500; }
.segmented__link.is-active { background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-1); }
a.stat-card { text-decoration: none; color: inherit; }
a.stat-card:hover { border-color: var(--c-border-strong); }
.dialog-item .avatar-wrap { grid-row: span 2; }
.chat__online--offline::before { display: none; }
/* Фон бокового меню панели тянется на всю высоту страницы, а не только экрана (липкое меню 100dvh) */
@media (min-width: 1024px) { .panel { background: linear-gradient(90deg, var(--brand-ground) 0 260px, var(--c-bg) 260px); } }

/* ---------------------------------------------------------------- Справочник телефонов */
.phone-emergency { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-3); }
.phone-emergency__btn { display: grid; gap: 2px; align-content: center; min-height: 76px; padding: var(--s-3) var(--s-4); border-radius: var(--r-lg); background: var(--c-danger-soft); color: var(--c-danger-soft-text); text-decoration: none; border: 1px solid transparent; }
.phone-emergency__btn:first-of-type { background: var(--c-danger); color: #fff; }
.phone-emergency__btn:hover { border-color: currentColor; }
.phone-emergency__num { font-family: var(--font-display); font-size: var(--fs-30); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.phone-emergency__name { font-size: var(--fs-14); font-weight: 600; line-height: 1.25; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .phone-emergency__btn:first-of-type { color: #1E0A30; } }
:root[data-theme="dark"] .phone-emergency__btn:first-of-type { color: #1E0A30; }
.phone-group { margin-top: var(--s-8); }
.phone-group__title { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-4); }
.phone-group__title .icon { color: var(--c-primary); }
.phone-grid { display: grid; gap: var(--s-4); }
/* Разделы раскладываются по колонкам, как газетная полоса: разделы с одной-двумя записями не оставляют пустот */
.phone-groups { column-gap: var(--s-6); }
@media (min-width: 768px) { .phone-groups { column-count: 2; } }
@media (min-width: 1200px) { .phone-groups { column-count: 3; } }
.phone-groups .phone-group { break-inside: avoid; display: inline-block; width: 100%; margin-top: 0; margin-bottom: var(--s-8); }
.phone-card { display: grid; gap: var(--s-3); align-content: start; padding: var(--s-5); border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); scroll-margin-top: 90px; }
.phone-card:target { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.phone-card--emergency { border-color: var(--c-danger-soft); }
.phone-card__title { font-size: var(--fs-18); line-height: 1.25; margin: 0; }
.phone-card__sub { color: var(--c-text-2); font-size: var(--fs-14); margin: 4px 0 0; }
.phone-card__numbers { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.phone-row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.phone-row__call { min-height: 44px; font-variant-numeric: tabular-nums; }
.phone-row__number { white-space: nowrap; }
.phone-row__label { color: var(--c-text-3); font-size: var(--fs-14); flex: 1 1 auto; min-width: 0; }
.phone-row__copy { margin-left: auto; }
.phone-row__copy.is-done { color: var(--c-success, #1E6B45); }
.phone-card__meta { margin: 0; display: grid; gap: 6px; font-size: var(--fs-14); color: var(--c-text-2); }
.phone-card__meta div { display: flex; gap: var(--s-2); align-items: baseline; }
.phone-card__meta dt { color: var(--c-text-3); flex: none; }
.phone-card__meta dd { margin: 0; overflow-wrap: anywhere; }
.phone-card__foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s-2); flex-wrap: wrap; border-top: 1px solid var(--c-border); padding-top: var(--s-3); font-size: var(--fs-13); }
.phone-card__verified { display: inline-flex; align-items: center; gap: 4px; color: var(--c-success-soft-text, #1E6B45); }
.phone-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: var(--s-2); }
.phone-mini a { display: grid; min-height: 52px; align-content: center; padding: 6px 10px; border-radius: var(--r-md); background: var(--c-danger-soft); color: var(--c-danger-soft-text); text-decoration: none; }
.phone-mini b { font-size: var(--fs-20); font-variant-numeric: tabular-nums; }
.phone-mini span { font-size: var(--fs-12); line-height: 1.2; }

/* ---------- Новостной бот (панель и статья) ---------- */
.bot-subtabs { margin: var(--s-4) 0; }
.bot-list { display: grid; gap: var(--s-4); }
.bot-item { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
.bot-item--flagged { box-shadow: inset 4px 0 0 var(--c-warning); }
.bot-item__media img, .bot-item__noimg { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r-md); background: var(--c-surface-2); }
.bot-item__noimg { display: grid; place-items: center; color: var(--c-text-3); }
.bot-item__body { min-width: 0; display: grid; gap: var(--s-2); align-content: start; }
.bot-item__badges { gap: var(--s-2); }
.bot-item__title { font-size: var(--fs-20); line-height: 1.25; overflow-wrap: anywhere; }
.bot-item__lead { color: var(--c-text-2); line-height: 1.5; }
.bot-item__orig summary { cursor: pointer; color: var(--c-text-2); font-size: var(--fs-14); }
.bot-item__orig p { margin-top: var(--s-2); font-size: var(--fs-14); color: var(--c-text-2); }
.bot-item__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.pre-line { white-space: pre-line; overflow-wrap: anywhere; }
.bot-auto { background: var(--c-warning-soft); color: var(--c-warning-soft-text, #6B4A00); }
.bot-sources td a { overflow-wrap: anywhere; }
.bot-error { color: var(--c-danger); font-size: var(--fs-13); overflow-wrap: anywhere; }
.bot-kw { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bot-kw form { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-pill); background: var(--c-surface); }
.bot-kw .is-off { text-decoration: line-through; color: var(--c-text-3); }
.bot-kw button { min-height: 32px; }
.bot-test-item { border-top: 1px solid var(--c-border); padding-top: var(--s-3); display: grid; gap: var(--s-1); }
.bot-provider { display: grid; gap: var(--s-2); }
.code-inline { font-family: ui-monospace, monospace; font-size: .9em; background: var(--c-surface-2); padding: 1px 6px; border-radius: var(--r-xs); overflow-wrap: anywhere; }
.article-source { margin-top: var(--s-6); padding: var(--s-3) var(--s-4); border-left: 4px solid var(--c-primary); background: var(--c-surface-2); border-radius: 0 var(--r-md) var(--r-md) 0; font-size: var(--fs-14); color: var(--c-text-2); overflow-wrap: anywhere; }
.article-source a { font-weight: 600; }
@media (min-width: 768px) {
  .bot-item { grid-template-columns: 220px 1fr; }
}
