/* ==========================================================================
   Этап 9 — живой дизайн: светлая тема сайта, предпросмотр «как в VK»,
   мелкие живые элементы (скелетоны, подсказки, индикатор очереди).
   ========================================================================== */

/* ---------------- светлая тема сайта ---------------- */

html[data-theme="light"] {
    --bg: #eef1f6;
    --bg-2: #e3e8f1;
    --panel: rgba(255, 255, 255, .88);
    --panel-2: rgba(247, 249, 252, .92);
    --line: rgba(26, 50, 82, .14);
    --text: #16202c;
    --muted: #5a6b7f;
    --brand: #12996f;
    --brand-2: #2f6fe4;
    --danger: #cf3b3b;
    --warn: #a9700f;
    --shadow: 0 16px 40px rgba(20, 40, 70, .14);
}

html[data-theme="light"] .bg {
    background:
        radial-gradient(1100px 600px at 12% -10%, rgba(18, 153, 111, .16), transparent 60%),
        radial-gradient(900px 520px at 88% 6%, rgba(47, 111, 228, .14), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

html[data-theme="light"] .bg::after {
    background-image:
        linear-gradient(rgba(26, 50, 82, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 50, 82, .05) 1px, transparent 1px);
}

html[data-theme="light"] .topbar { background: rgba(255, 255, 255, .8); }
html[data-theme="light"] .nav__item.is-active,
html[data-theme="light"] .tabs__item.is-active { color: #fff; }
html[data-theme="light"] code { background: rgba(26, 50, 82, .08); }
html[data-theme="light"] .btn--primary { color: #fff; }
html[data-theme="light"] .dropzone { background: rgba(255, 255, 255, .6); }
html[data-theme="light"] .flash { background: rgba(255, 255, 255, .92); }
html[data-theme="light"] .preview { background: rgba(26, 50, 82, .05); }
html[data-theme="light"] .brand__mark { filter: drop-shadow(0 0 10px rgba(18, 153, 111, .35)); }

/* мягкая смена темы, чтобы переход не «мигал» */
body, .card, .tile, .topbar, .input, .table td, .table th {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease;
}

.themeswitch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(120, 160, 200, .08);
    color: var(--muted);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, transform .2s ease;
}

.themeswitch:hover { color: var(--text); border-color: var(--brand); transform: translateY(-1px); }
.themeswitch__icon { font-size: 15px; }

/* ---------------- индикатор очереди в шапке ---------------- */

.queuechip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(120, 160, 200, .08);
    font-size: 13.5px;
    color: var(--muted);
    text-decoration: none;
}

.queuechip:hover { text-decoration: none; color: var(--text); border-color: var(--brand); }
.queuechip__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 0 rgba(86, 209, 164, .55);
    animation: pulse 2.4s ease-out infinite;
}
.queuechip--pause .queuechip__dot { background: var(--warn); animation: none; }
.queuechip--busy .queuechip__dot { background: var(--brand-2); }
/* G-15: нет ответа сервера — индикатор серый, без «живого» пульса */
.queuechip--off .queuechip__dot { background: var(--muted); animation: none; }
.queuechip b { color: var(--text); }

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(86, 209, 164, .5); }
    70%  { box-shadow: 0 0 0 9px rgba(86, 209, 164, 0); }
    100% { box-shadow: 0 0 0 0 rgba(86, 209, 164, 0); }
}

/* ---------------- скелетоны загрузки ---------------- */

.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(120, 160, 200, .12);
    border-radius: var(--radius-sm);
    min-height: 96px;
}

/* «скелетон» на месте фотографии, которая ещё едет с сервера */
.skeleton--photo { aspect-ratio: 4 / 3; }

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16), transparent);
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* ---------------- подсказки без библиотек ---------------- */

[data-hint] { position: relative; border-bottom: 1px dotted var(--line); cursor: help; }

[data-hint]::after {
    content: attr(data-hint);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translate(-50%, 4px);
    width: max-content;
    max-width: 260px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 30;
}

[data-hint]:hover::after,
[data-hint]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

/* служебные классы для маленьких правок разметки без встроенных стилей */
.is-hidden { display: none !important; }

.chart-line { display: block; width: 100%; height: 4px; margin-top: 4px; background: var(--line); border-radius: 3px; }
.chart-line .chart-line__fill { fill: var(--brand); }

/* ---------------- живые мелочи ---------------- */

.btn--primary {
    animation: breathe 6s ease-in-out infinite;
    background-image: linear-gradient(135deg, var(--brand), var(--brand-2));
}

@keyframes breathe {
    0%, 100% { box-shadow: 0 6px 18px rgba(86, 209, 164, .18); }
    50%      { box-shadow: 0 10px 26px rgba(86, 209, 164, .34); }
}

.card, .tile { transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease; }
.card:hover { border-color: rgba(120, 160, 200, .32); }
.tile:hover { transform: translateY(-2px); border-color: rgba(86, 209, 164, .45); }

.photo { transition: transform .25s ease, border-color .25s ease; }
.photo:hover { transform: translateY(-2px); }
.photo img { transition: transform .35s ease; }
.photo:hover img { transform: scale(1.04); }

/* только что добавленная фотография «проявляется» */
.photo.is-new, .drafts__item.is-new { animation: appear .45s ease both; }

@keyframes appear {
    from { opacity: 0; transform: translateY(6px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

/* кнопки, у которых идёт работа: видно, что нажатие принято */
.btn[data-busy-state]::after {
    content: "";
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-left: 7px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: -2px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Предпросмотр поста «как в VK»
   ========================================================================== */

.vkpreview__switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vkpreview__label { color: var(--muted); font-size: 12.5px; margin-left: 6px; }

.vkpreview__btn {
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(120, 160, 200, .07);
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.vkpreview__btn:hover { color: var(--text); border-color: var(--brand); }
.vkpreview__btn.is-active { color: #08131a; background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; font-weight: 600; }
html[data-theme="light"] .vkpreview__btn.is-active { color: #fff; }

/* рамка вокруг «экрана VK»: у VK светлая и тёмная темы, показываем обе */
.vkpreview {
    --vk-page: #edeef0;
    --vk-card: #ffffff;
    --vk-text: #000000;
    --vk-muted: #818c99;
    --vk-line: #e7e8ec;
    --vk-link: #2a5885;
    --vk-action: #818c99;
    --vk-like: #e64646;
    --vk-ava: linear-gradient(135deg, #71aaeb, #2a5885);
    background: var(--vk-page);
    border: 1px solid var(--vk-line);
    border-radius: 12px;
    padding: 12px;
    margin-top: 12px;
}

.vkpreview[data-theme="dark"] {
    --vk-page: #0f0f10;
    --vk-card: #232324;
    --vk-text: #e1e3e6;
    --vk-muted: #76787a;
    --vk-line: #2c2d2e;
    --vk-link: #71aaeb;
    --vk-action: #909499;
    --vk-ava: linear-gradient(135deg, #4a76a8, #2c4a70);
}

.vkpost {
    background: var(--vk-card);
    color: var(--vk-text);
    border-radius: 8px;
    padding: 12px 14px 4px;
    font: 15px/1.4 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

.vkpost__head { display: flex; align-items: center; gap: 10px; }

.vkpost__ava {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--vk-ava);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 17px;
}

.vkpost__meta { display: flex; flex-direction: column; min-width: 0; }
.vkpost__name { font-weight: 600; color: var(--vk-text); }
.vkpost__time { color: var(--vk-muted); font-size: 13px; }
.vkpost__dots { margin-left: auto; color: var(--vk-muted); letter-spacing: 1px; font-size: 12px; }

.vkpost__text { margin-top: 10px; white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; }
.vkpost__text.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vkpost__mention { color: var(--vk-link); }

.vkpost__more {
    margin-top: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--vk-link);
    font: inherit;
    cursor: pointer;
}
.vkpost__more:hover { text-decoration: underline; }

/* коллаж фотографий: VK склеивает их с зазором 2 пикселя и скругляет только внешние углы */
.vkpost__media {
    display: grid;
    gap: 2px;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
}

.vkpost__media--one { grid-template-columns: 1fr; }
.vkpost__media--one img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 510px;
    object-fit: contain;
    background: #000;
}

.vkpost__media--two { grid-template-columns: 1fr 1fr; }
.vkpost__media--two .vkpost__photo { aspect-ratio: 3 / 2; }

.vkpost__media--three {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: 300px;
}
.vkpost__media--three .vkpost__photo:first-child { grid-row: span 2; }

.vkpost__media--four,
.vkpost__media--many { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.vkpost__media--four .vkpost__photo,
.vkpost__media--many .vkpost__photo { aspect-ratio: 3 / 2; }

.vkpost__photo { display: block; position: relative; overflow: hidden; min-height: 0; }
.vkpost__photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

.vkpost__photo--more::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
}

.vkpost__more-count {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    font-weight: 600;
}

.vkpost__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin-top: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--vk-line);
    color: var(--vk-action);
    font-size: 14px;
}

.vkpost__action { display: inline-flex; align-items: center; gap: 7px; cursor: default; }
.vkpost__action svg { fill: currentColor; }
.vkpost__action--like:hover { color: var(--vk-like); }
.vkpost__action:hover { color: var(--vk-link); }
.vkpost__eye { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.vkpost__eye svg { fill: currentColor; }

/* в предпросмотре «предложенной записи» у VK подпись меняется */
.vkpreview[data-mode="suggest"] .vkpost__time { color: var(--vk-link); }

/* ---------------- теги целей ---------------- */

/* чип тега: цвет текста подставляется инлайн из target_tags.color (CSP
   разрешает style-src 'unsafe-inline'); без цвета — нейтральный */
.tag-chip {
    display: inline-block;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

/* системный тег: вычисляется из targets.suggests_allowed, вручную не назначается */
.tag-chip--sys {
    border-style: dashed;
}

/* кнопка-чип в панели фильтров пикера */
.picker__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

button.tag-chip {
    cursor: pointer;
    font: inherit;
    font-size: 12.5px;
    padding: 3px 11px;
}

button.tag-chip:hover { border-color: var(--muted); }

.tag-chip.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* переключатель И/ИЛИ в панели фильтров */
.tag-chip--mode {
    border-style: solid;
    font-weight: 600;
    color: var(--text);
}

@media (max-width: 760px) {
    .picker__tags { gap: 5px; }
}

@media (max-width: 760px) {
    .vkpost__media--three { height: 220px; }
    .vkpost__actions { gap: 14px; font-size: 13px; }
    .vkpreview { padding: 8px; }

    /* телефон: шапка переносится, лишние подписи убираем, чтобы не было горизонтальной прокрутки */
    .topbar { gap: 10px; padding: 12px 14px; }
    .topbar__right { margin-left: 0; width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
    .topbar__right .who { order: 1; }
    .queuechip [data-queue-label] { display: none; }
    .themeswitch { padding: 6px 10px; }
    .nav { margin-left: 0; }
}

/* на совсем узких экранах подписи в шапке тоже убираем */
@media (max-width: 460px) {
    .queuechip { padding: 6px 9px; }
    .themeswitch { padding: 6px 9px; font-size: 12.5px; }
    .topbar__right .who small { display: none; }
}

/* --------------------------------------------------------------------------
   Автопостинг (U-08, этапы 2–3): статус-блок и живые таймеры.
   Без анимаций — только текст (уважает «уменьшить движение»).
   -------------------------------------------------------------------------- */

.autopost-status {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
    padding: 10px 14px;
    margin-top: 10px;
}

.autopost-status[data-stage="sending_window"] { border-color: rgba(18, 153, 111, .45); }
.autopost-status[data-stage="paused"],
.autopost-status[data-stage="off"] { border-color: var(--danger); }

.autopost-status .muted {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Триада состояний очереди (Прошлое — Настоящее — Будущее)
   -------------------------------------------------------------------------- */

.triad-widget {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 10px 14px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 12px 0;
    font-size: 13px;
    line-height: 1.45;
}

.triad-widget--global {
    border-color: rgba(43, 140, 255, .35);
    background: linear-gradient(180deg, rgba(43, 140, 255, .04), transparent);
}

.triad-widget--card {
    margin: 10px 0 16px 0;
}

.triad-widget--compact {
    margin: 8px 0 0 0;
    padding: 6px 10px;
    font-size: 11.5px;
    gap: 5px;
    border-radius: 8px;
    background: rgba(0, 0, 0, .12);
}

[data-theme="light"] .triad-widget--compact {
    background: rgba(0, 0, 0, .03);
}

.triad-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--text);
}

.triad-line--prev {
    color: var(--muted);
}

.triad-line--current.is-inflight {
    color: var(--text);
    font-weight: 500;
}

.triad-badge {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: .02em;
    user-select: none;
}

.triad-widget--compact .triad-badge {
    font-size: 10px;
    padding: 1px 5px;
}

.triad-badge--prev {
    background: rgba(140, 150, 165, .18);
    color: var(--muted);
}

.triad-badge--current {
    background: rgba(43, 140, 255, .18);
    color: #4da3ff;
}

.triad-line--current.is-inflight .triad-badge--current {
    background: rgba(18, 153, 111, .25);
    color: #2ed59e;
}

.triad-badge--next {
    background: rgba(245, 166, 35, .18);
    color: #f5a623;
}

.triad-clock {
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
    padding: 1px 5px;
    background: rgba(255, 255, 255, .08);
    border-radius: 4px;
    letter-spacing: .03em;
}

.triad-clock--ready {
    color: var(--brand);
    background: rgba(86, 209, 164, .15);
    border: 1px solid rgba(86, 209, 164, .35);
}

[data-theme="light"] .triad-clock {
    background: rgba(0, 0, 0, .07);
}

[data-theme="light"] .triad-clock--ready {
    background: rgba(18, 153, 111, .12);
    border-color: rgba(18, 153, 111, .35);
}

.triad-widget--compact .triad-clock {
    font-size: 11px;
    padding: 0 4px;
}

/* ---------------- «Состояние системы»: виджет оператора ---------------- */

.syslive {
    margin: 0 auto;
    padding: 0 18px;
    max-width: 1180px;
}

.syslive__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 14px;
    margin-top: 10px;
    font: inherit;
    font-size: 13.5px;
    color: var(--muted);
    background: rgba(120, 160, 200, .08);
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease;
}

.syslive__bar:hover { color: var(--text); border-color: var(--brand); }

/* ---------------- U-28: Подсветка времени модерации ---------------- */

.badge--moderation-time {
    display: inline-block;
    padding: 2px 7px;
    font-size: 11.5px;
    font-weight: 700;
    color: #3730a3;
    background: #e0e7ff;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    letter-spacing: .02em;
}

[data-theme="dark"] .badge--moderation-time {
    color: #c7d2fe;
    background: rgba(99, 102, 241, .22);
    border-color: rgba(99, 102, 241, .45);
}

/* ---------------- U-28: Мини-панель магнитофона и кардиограмма ---------------- */

.tape-deck {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(180deg, rgba(30, 41, 59, .95), rgba(15, 23, 42, .98));
    border: 1px solid rgba(71, 85, 105, .6);
    border-radius: 8px;
    padding: 3px 4px;
    gap: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .1);
    user-select: none;
    margin-bottom: 6px;
    vertical-align: middle;
}

[data-theme="light"] .tape-deck {
    background: linear-gradient(180deg, #f8fafc, #e2e8f0);
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .8);
}

.tape-deck form {
    margin: 0 !important;
    display: inline-flex;
}

.tape-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 4px 9px;
    font-size: 11.5px;
    font-weight: 600;
    color: #cbd5e1;
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    border: 1px solid #475569;
    border-top-color: #64748b;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 2px 0 #0f172a, 0 3px 3px rgba(0, 0, 0, .35);
    transition: transform .1s ease, box-shadow .1s ease, color .15s ease, background .15s ease;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .6);
    overflow: visible;
    text-decoration: none;
    line-height: 1.3;
}

[data-theme="light"] .tape-btn {
    color: #334155;
    background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
    border-color: #cbd5e1;
    border-top-color: #f1f5f9;
    box-shadow: 0 2px 0 #94a3b8, 0 2px 3px rgba(0, 0, 0, .08);
    text-shadow: none;
}

.tape-btn:hover {
    color: #ffffff;
    background: linear-gradient(180deg, #3b4c63 0%, #243247 100%);
    border-color: #64748b;
}

[data-theme="light"] .tape-btn:hover {
    color: #0f172a;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border-color: #94a3b8;
}

/* Нажатое / зажатое состояние (утопленная клавиша) */
.tape-btn:active,
.tape-btn--active,
.tape-btn--active-fast {
    transform: translateY(2px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .65), inset 0 0 6px rgba(0, 0, 0, .45);
}

/* Зажатый Постинг (Play) */
.tape-btn--active {
    color: #38bdf8 !important;
    background: linear-gradient(180deg, #075985 0%, #0c4a6e 100%) !important;
    border-color: #0284c7 !important;
    border-top-color: #0369a1 !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .75), 0 0 8px rgba(56, 189, 248, .35) !important;
}

/* Зажатый Автопостинг (Fast-forward) */
.tape-btn--active-fast {
    color: #4ade80 !important;
    background: linear-gradient(180deg, #166534 0%, #14532d 100%) !important;
    border-color: #16a34a !important;
    border-top-color: #15803d !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .75), 0 0 8px rgba(74, 222, 128, .35) !important;
}

/* SVG дорожки кардиограммы и сияющие точки */
.tape-ecg {
    position: absolute;
    pointer-events: none;
    z-index: 4;
    overflow: visible;
}

.tape-ecg--top {
    top: -4px;
    left: 0;
    width: 100%;
    height: 10px;
}

.tape-ecg--perimeter {
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
}

.tape-ecg__track {
    stroke: rgba(255, 255, 255, .15);
    stroke-width: 0.8;
}

[data-theme="light"] .tape-ecg__track {
    stroke: rgba(0, 0, 0, .12);
}

.tape-ecg__dot--play {
    fill: #38bdf8;
    filter: drop-shadow(0 0 3px #38bdf8) drop-shadow(0 0 6px #0ea5e9);
}

.tape-ecg__dot--fast {
    fill: #4ade80;
    filter: drop-shadow(0 0 3px #4ade80) drop-shadow(0 0 7px #22c55e);
}

.syslive__text { color: var(--text); }
.syslive__text b { color: var(--brand); }
.syslive__summary { color: var(--muted); }
.syslive__chevron { margin-left: auto; transition: transform .2s ease; }
.syslive__bar[aria-expanded="true"] .syslive__chevron { transform: rotate(180deg); }

.syslive__dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--muted);
}

.syslive[data-syslive-state="ok"] .syslive__dot {
    background: var(--brand);
    box-shadow: 0 0 0 0 rgba(86, 209, 164, .5);
    animation: pulse 2.4s ease-out infinite;
}
.syslive[data-syslive-state="busy"] .syslive__dot {
    background: var(--brand-2);
    box-shadow: 0 0 0 0 rgba(86, 209, 164, .5);
    animation: pulse 1.2s ease-out infinite;
}
.syslive[data-syslive-state="warn"] .syslive__dot { background: var(--warn); animation: none; }
.syslive[data-syslive-state="pause"] .syslive__dot { background: var(--warn); animation: none; }
.syslive[data-syslive-state="offline"] .syslive__dot { background: var(--danger); animation: none; }
.syslive[data-syslive-state="offline"] .syslive__text b { color: var(--danger); }

.syslive__panel {
    margin-top: 8px;
    padding: 12px 16px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.syslive__details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 4px 14px;
    margin: 0 0 8px;
    font-size: 13.5px;
}
.syslive__details dt { color: var(--muted); white-space: nowrap; }
.syslive__details dd { margin: 0; color: var(--text); }
.syslive__value--warn { color: var(--warn) !important; }

.syslive__events {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 13px;
    color: var(--muted);
}
.syslive__event { padding: 2px 0; }
.syslive__event--sent { color: var(--brand); }
.syslive__event--failed { color: var(--danger); }
.syslive__event--moderation { color: var(--warn); }

.syslive__hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--muted);
}

@media (max-width: 760px) {
    .syslive__summary { display: none; }
}

/* --------------------------------------------------------------------------
   U-22 / U-64: Адаптивная таблица доставок в архиве, оптимальное распределение колонок
   и безопасный перенос слов и бейджей без вылезания таблицы за пределы экрана
   -------------------------------------------------------------------------- */

.table--deliveries {
    width: 100%;
    table-layout: auto;
    min-width: 680px;
}

.table--deliveries th,
.table--deliveries td {
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: normal;
}

/* Колонка 1: чекбокс массового перевыставления */
.table--deliveries th:nth-child(1),
.table--deliveries td:nth-child(1),
.table--deliveries .col-check {
    width: 38px;
    min-width: 38px;
    max-width: 42px;
    text-align: center;
    padding-left: 6px;
    padding-right: 6px;
}

/* Колонка 2: Цель (паблик/сообщество) */
.table--deliveries th:nth-child(2),
.table--deliveries td:nth-child(2),
.table--deliveries .col-target {
    width: 23%;
    min-width: 140px;
}

/* Колонка 3: Способ публикации и признак автопостинга */
.table--deliveries th:nth-child(3),
.table--deliveries td:nth-child(3),
.table--deliveries .col-mode {
    width: 14%;
    min-width: 110px;
}

/* Колонка 4: Состояние доставки */
.table--deliveries th:nth-child(4),
.table--deliveries td:nth-child(4),
.table--deliveries .col-status {
    width: 13%;
    min-width: 105px;
}

/* Колонка 5: Количество попыток */
.table--deliveries th:nth-child(5),
.table--deliveries td:nth-child(5),
.table--deliveries .col-attempts {
    width: 65px;
    min-width: 55px;
    max-width: 75px;
    text-align: center;
}

/* Колонка 6: Результат (ссылка на VK, даты, статус модерации, перевыставление) */
.table--deliveries th:nth-child(6),
.table--deliveries td:nth-child(6),
.table--deliveries .col-result,
.delivery-result {
    width: 45%;
    min-width: 220px;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
}

.table--deliveries .badge {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.3;
}

.table--deliveries .badge--moderation-time {
    display: inline-block;
    white-space: nowrap;
}

.delivery-result__error {
    margin-top: 3px;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
}

.btn--xs {
    padding: 3px 8px;
    font-size: 11.5px;
    line-height: 1.25;
}

/* --------------------------------------------------------------------------
   U-31: Живая проверка статуса (кнопка «Статус» без перезагрузки страницы)
   -------------------------------------------------------------------------- */

.tape-btn--checking {
    color: #38bdf8 !important;
    background: linear-gradient(180deg, #1e3a8a 0%, #172554 100%) !important;
    border-color: #3b82f6 !important;
    cursor: wait !important;
    animation: tapeCheckingPulse 1.1s infinite ease-in-out;
}
@keyframes tapeCheckingPulse {
    0%, 100% { opacity: 1; transform: translateY(1px); }
    50% { opacity: 0.75; transform: translateY(2px) scale(0.98); }
}

.tape-btn--success {
    color: #4ade80 !important;
    background: linear-gradient(180deg, #14532d 0%, #052e16 100%) !important;
    border-color: #22c55e !important;
    box-shadow: 0 0 10px rgba(34, 197, 94, .5) !important;
}

.live-highlight {
    animation: liveHighlightAnim 2s ease-out;
}
@keyframes liveHighlightAnim {
    0% { background-color: rgba(34, 197, 94, 0.35); outline: 2px solid rgba(34, 197, 94, 0.7); }
    100% { background-color: transparent; outline: 2px solid transparent; }
}

.live-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    max-width: 480px;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 500;
    color: #f8fafc;
    background: #0f172a;
    border: 1px solid #334155;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
.live-toast.is-show {
    opacity: 1;
    transform: translateY(0);
}
.live-toast--ok {
    border-left: 5px solid #22c55e;
}
.live-toast--warn {
    border-left: 5px solid #f59e0b;
}
.live-toast--bad {
    border-left: 5px solid #ef4444;
}

/* ------------------------------------------------------------------ */
/* Модальное окно детализации доставок по стенам (U-34)                */
/* ------------------------------------------------------------------ */

.wall-stats-popup-btn {
    border-radius: 6px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap !important;
}

.table--autopost {
    width: 100%;
}
.table--autopost th:nth-child(1),
.table--autopost td:nth-child(1) {
    width: 38%;
    min-width: 230px;
}
.table--autopost th:nth-child(2),
.table--autopost td:nth-child(2) {
    width: 8%;
    min-width: 60px;
    text-align: center;
}
.table--autopost th:nth-child(3),
.table--autopost td:nth-child(3) {
    width: 6%;
    min-width: 50px;
    text-align: center;
}
.table--autopost th:nth-child(4),
.table--autopost td:nth-child(4) {
    width: 30%;
    min-width: 250px;
}
.table--autopost th:nth-child(5),
.table--autopost td:nth-child(5) {
    width: 18%;
    min-width: 130px;
}
.wall-stats-popup-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
}
[data-theme="dark"] .wall-stats-popup-btn {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}
[data-theme="dark"] .wall-stats-popup-btn:hover {
    background: #334155;
    border-color: #475569;
    color: #f8fafc;
}

.wall-stats-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.wall-stats-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.wall-stats-modal {
    background: #ffffff;
    color: #0f172a;
    width: 96vw;
    max-width: 980px;
    height: min(88vh, 860px);
    max-height: 88vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border: 1px solid #cbd5e1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.2s ease;
}
.wall-stats-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    flex: 1 1 auto;
}
.wall-stats-modal-backdrop.is-open .wall-stats-modal {
    transform: translateY(0) scale(1);
}
[data-theme="dark"] .wall-stats-modal {
    background: #0f172a;
    color: #f8fafc;
    border-color: #334155;
}

.wall-modal-header {
    flex-shrink: 0;
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
[data-theme="dark"] .wall-modal-header {
    background: #1e293b;
    border-color: #334155;
}
.wall-modal-title {
    font-size: 15.5px;
    font-weight: 700;
    line-height: 1.35;
}
.wall-modal-subtitle {
    font-size: 12.5px;
    margin-top: 3px;
    color: #64748b;
}
[data-theme="dark"] .wall-modal-subtitle {
    color: #94a3b8;
}

/* Переключатель вкладок Группы / Таблица */
.wall-view-switcher {
    display: inline-flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 8px;
    gap: 3px;
}
[data-theme="dark"] .wall-view-switcher {
    background: #0f172a;
    border: 1px solid #334155;
}
.wall-view-tab {
    background: transparent;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    user-select: none;
}
.wall-view-tab:hover {
    color: #0f172a;
}
.wall-view-tab.is-active {
    background: #ffffff;
    color: #0284c7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
[data-theme="dark"] .wall-view-tab {
    color: #94a3b8;
}
[data-theme="dark"] .wall-view-tab:hover {
    color: #f8fafc;
}
[data-theme="dark"] .wall-view-tab.is-active {
    background: #1e293b;
    color: #38bdf8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.wall-modal-close-icon {
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.wall-modal-close-icon:hover {
    background: #e2e8f0;
    color: #0f172a;
}
[data-theme="dark"] .wall-modal-close-icon {
    color: #94a3b8;
}
[data-theme="dark"] .wall-modal-close-icon:hover {
    background: #334155;
    color: #ffffff;
}

/* Видимый, прокручиваемый контейнер тела */
.wall-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(88vh - 120px);
    padding: 16px 20px;
    overflow-y: scroll !important; /* Всегда держим видимый трек прокрутки */
    overflow-x: auto;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: #64748b #e2e8f0;
}
[data-theme="dark"] .wall-modal-body {
    scrollbar-color: #94a3b8 #1e293b;
}
.wall-modal-body::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}
.wall-modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-left: 1px solid #e2e8f0;
}
.wall-modal-body::-webkit-scrollbar-thumb {
    background-color: #94a3b8;
    border-radius: 6px;
    border: 2px solid #f1f5f9;
}
.wall-modal-body::-webkit-scrollbar-thumb:hover {
    background-color: #64748b;
}
[data-theme="dark"] .wall-modal-body::-webkit-scrollbar-track {
    background: #0f172a;
    border-left: 1px solid #1e293b;
}
[data-theme="dark"] .wall-modal-body::-webkit-scrollbar-thumb {
    background-color: #475569;
    border: 2px solid #0f172a;
}
[data-theme="dark"] .wall-modal-body::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Панели видов */
.wall-view-pane {
    display: none;
    width: 100%;
}
.wall-view-pane.is-active {
    display: block;
}

/* Панель фильтров и поиска таблицы */
.wall-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.wall-table-search-box {
    flex: 1 1 240px;
    min-width: 200px;
}
.wall-table-search {
    width: 100%;
    padding: 7px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.wall-table-search:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}
[data-theme="dark"] .wall-table-search {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
[data-theme="dark"] .wall-table-search:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.wall-table-filter-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.wall-filter-pill {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.wall-filter-pill:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.wall-filter-pill.is-active {
    background: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
}
.wall-filter-pill--err.is-active {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}
.wall-filter-pill--ok.is-active {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}
.wall-filter-pill--warn.is-active {
    background: #d97706;
    border-color: #d97706;
    color: #ffffff;
}
.wall-filter-pill--queue.is-active {
    background: #475569;
    border-color: #475569;
    color: #ffffff;
}
[data-theme="dark"] .wall-filter-pill {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}
[data-theme="dark"] .wall-filter-pill:hover {
    background: #334155;
    color: #f8fafc;
}

/* Адаптивная таблица с сортировкой */
.wall-table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
}
[data-theme="dark"] .wall-table-responsive {
    border-color: #334155;
    background: #0f172a;
}
.wall-sort-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    text-align: left;
}
.wall-sort-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 12px;
    padding: 10px 12px;
    border-bottom: 2px solid #cbd5e1;
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}
[data-theme="dark"] .wall-sort-table thead th {
    background: #1e293b;
    color: #cbd5e1;
    border-bottom-color: #334155;
}
.wall-sort-table thead th.is-sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, color 0.15s;
}
.wall-sort-table thead th.is-sortable:hover {
    background: #e2e8f0;
    color: #0f172a;
}
[data-theme="dark"] .wall-sort-table thead th.is-sortable:hover {
    background: #334155;
    color: #ffffff;
}
.wall-sort-table thead th .sort-ico {
    display: inline-block;
    font-size: 11px;
    margin-left: 3px;
    opacity: 0.6;
}
.wall-sort-table thead th.is-sorted-asc .sort-ico,
.wall-sort-table thead th.is-sorted-desc .sort-ico {
    opacity: 1;
    color: #0284c7;
}
[data-theme="dark"] .wall-sort-table thead th.is-sorted-asc .sort-ico,
[data-theme="dark"] .wall-sort-table thead th.is-sorted-desc .sort-ico {
    color: #38bdf8;
}

.wall-sort-table tbody tr {
    transition: background 0.12s ease;
}
.wall-sort-table tbody tr:hover {
    background: #f8fafc;
}
[data-theme="dark"] .wall-sort-table tbody tr:hover {
    background: #1e293b;
}
.wall-sort-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
[data-theme="dark"] .wall-sort-table tbody td {
    border-bottom-color: #1e293b;
}
.wall-sort-table tbody tr:last-child td {
    border-bottom: none;
}

.wall-modal-footer {
    flex-shrink: 0;
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
[data-theme="dark"] .wall-modal-footer {
    background: #1e293b;
    border-color: #334155;
}

.wall-group {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
[data-theme="dark"] .wall-group {
    border-color: #334155;
}
.wall-group-title {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.wall-group--err .wall-group-title {
    background: #fef2f2;
    color: #991b1b;
    border-bottom: 1px solid #fee2e2;
}
[data-theme="dark"] .wall-group--err .wall-group-title {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-bottom-color: rgba(239, 68, 68, 0.25);
}
.wall-group--ok .wall-group-title {
    background: #f0fdf4;
    color: #166534;
    border-bottom: 1px solid #dcfce7;
}
[data-theme="dark"] .wall-group--ok .wall-group-title {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border-bottom-color: rgba(34, 197, 94, 0.25);
}
.wall-group--queue .wall-group-title {
    background: #fffbeb;
    color: #92400e;
    border-bottom: 1px solid #fef3c7;
}
[data-theme="dark"] .wall-group--queue .wall-group-title {
    background: rgba(245, 158, 11, 0.15);
    color: #fde68a;
    border-bottom-color: rgba(245, 158, 11, 0.25);
}

.wall-list {
    display: flex;
    flex-direction: column;
}
.wall-item {
    padding: 9px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.wall-item:last-child {
    border-bottom: none;
}
[data-theme="dark"] .wall-item {
    border-bottom-color: #1e293b;
}

.wall-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.wall-target-name {
    font-weight: 600;
}
.wall-vk-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 12px;
}
.wall-vk-link:hover {
    text-decoration: underline;
}
[data-theme="dark"] .wall-vk-link {
    color: #60a5fa;
}

.target-card-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.target-card-info__name {
    line-height: 1.35;
}
.target-card-info__links {
    font-size: 11.5px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}
.target-card-info__subscribers {
    font-size: 11.5px;
    color: var(--text-muted, #64748b);
    line-height: 1.25;
}

.wall-item-reason {
    font-size: 12px;
    line-height: 1.4;
    padding-left: 2px;
}

.wall-metrics-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11.5px;
    color: #334155;
    white-space: nowrap;
    vertical-align: middle;
}
[data-theme="dark"] .wall-metrics-pill {
    background: #1e293b;
    color: #cbd5e1;
}
.wall-metric {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 500;
}
.wall-metric--views {
    color: #0369a1;
}
[data-theme="dark"] .wall-metric--views {
    color: #38bdf8;
}
.wall-metric--likes {
    color: #e11d48;
}
[data-theme="dark"] .wall-metric--likes {
    color: #fb7185;
}
.wall-metric--reposts {
    color: #059669;
}
[data-theme="dark"] .wall-metric--reposts {
    color: #34d399;
}
.wall-metric-heart {
    filter: drop-shadow(0 0 1px rgba(225, 29, 72, .35));
}
.wall-metric-sep {
    opacity: 0.3;
    margin: 0 1px;
}

/* ------------------------------------------------------------------ */
/* Полная история доставок по всем виткам (U-60, Этап 3)               */
/* ------------------------------------------------------------------ */

.wall-history-cycle-card {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
[data-theme="dark"] .wall-history-cycle-card {
    background: #111827;
    border-color: #374151;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.wall-history-cycle-head {
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
[data-theme="dark"] .wall-history-cycle-head {
    background: #1e293b;
    border-color: #334155;
}
.wall-history-cycle-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.wall-history-cycle-select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    font-size: 12.5px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}
.wall-history-cycle-select:focus {
    border-color: #0284c7;
}
[data-theme="dark"] .wall-history-cycle-select {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
[data-theme="dark"] .wall-history-cycle-select:focus {
    border-color: #38bdf8;
}

/* ------------------------------------------------------------------ */
/* Глобальная сквозная статистика и журнал доставок (U-61, Этап 4)     */
/* ------------------------------------------------------------------ */

.global-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.global-kpi-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
[data-theme="dark"] .global-kpi-card {
    background: #1e293b;
    border-color: #334155;
}
.global-kpi-title {
    font-size: 11.5px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
[data-theme="dark"] .global-kpi-title {
    color: #94a3b8;
}
.global-kpi-val {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}
[data-theme="dark"] .global-kpi-val {
    color: #f8fafc;
}
.global-kpi-sub {
    font-size: 12px;
    color: #64748b;
    line-height: 1.35;
}
[data-theme="dark"] .global-kpi-sub {
    color: #94a3b8;
}
.global-history-post-select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    font-size: 12.5px;
    max-width: 260px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}
.global-history-post-select:focus {
    border-color: #0284c7;
}
[data-theme="dark"] .global-history-post-select {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
[data-theme="dark"] .global-history-post-select:focus {
    border-color: #38bdf8;
}

@media (max-width: 640px) {
    .wall-stats-modal-backdrop {
        padding: 8px;
    }
    .wall-stats-modal {
        width: 100vw;
        max-width: 100%;
        height: 94vh;
        max-height: 94vh;
        border-radius: 8px;
    }
    .wall-modal-header,
    .wall-modal-body,
    .wall-modal-footer {
        padding: 10px 14px;
    }
    .wall-item-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ------------------------------------------------------------------ */
/* Статистика: компактные таблицы и защита от переполнения (U-43)    */
/* ------------------------------------------------------------------ */

.card {
    min-width: 0;
}

.grid--stats-tiles {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 16px;
}

@media (max-width: 1340px) {
    .grid--stats-tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .grid--stats-tiles {
        grid-template-columns: minmax(0, 1fr);
    }
}

.grid--stats-tables {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    margin-bottom: 16px;
}

@media (max-width: 1080px) {
    .grid--stats-tables {
        grid-template-columns: minmax(0, 1fr);
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table--compact {
    font-size: 13px;
    width: 100%;
}
.table--compact th,
.table--compact td {
    padding: 6px 8px;
    line-height: 1.35;
}
.table--compact th {
    font-size: 11px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.stats-table-scroll {
    max-height: 580px;
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-gutter: stable;
}
.stats-table-scroll table thead th {
    position: sticky;
    top: 0;
    background: var(--panel, #ffffff);
    z-index: 2;
    box-shadow: 0 1px 0 var(--line, #e2e8f0);
}
[data-theme="dark"] .stats-table-scroll table thead th {
    background: var(--panel, #0f172a);
    box-shadow: 0 1px 0 var(--line, #334155);
}

/* ------------------------------------------------------------------ */
/* Кнопка возврата наверх (кошачья лапка)                             */
/* ------------------------------------------------------------------ */

.scroll-sentinel {
    position: absolute;
    top: 260px;
    left: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
    visibility: hidden;
}

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 990;
    width: 62px;
    height: 62px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--brand, #56d1a4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(16px) scale(0.92);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.28s ease, color 0.2s ease, filter 0.25s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

.back-to-top svg {
    width: 56px;
    height: 56px;
    display: block;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Когда страница прокручена вниз — полупрозрачная лапка */
.back-to-top.is-visible {
    opacity: 0.42;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* При наведении — становится яркой, приподнимается и подсвечивается изумрудным свечением */
.back-to-top.is-visible:hover {
    opacity: 1;
    color: #7cd4a1;
    filter: drop-shadow(0 6px 16px rgba(86, 209, 164, 0.65)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
    transform: translateY(-5px) scale(1.12);
}

.back-to-top:active {
    transform: translateY(-1px) scale(0.98);
}

@media (max-width: 768px) {
    .back-to-top {
        right: 14px;
        bottom: 16px;
        width: 52px;
        height: 52px;
    }
    .back-to-top svg {
        width: 48px;
        height: 48px;
    }
}

/* ---------------- бейджи предупреждений и блокировок ---------------- */

.badge--warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, .14);
    border: 1px solid rgba(245, 158, 11, .38);
    font-weight: 600;
}

html[data-theme="light"] .badge--warning {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

/* ---------------- адаптивные бейджи блокировок в таблице целей ---------------- */

.target-ban-badge {
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: break-word;
    display: inline-block;
    line-height: 1.35;
    text-align: left;
    vertical-align: top;
    margin-top: 4px;
}

.table--targets .target-ban-badge--col2 {
    max-width: 320px;
}

.table--targets .target-ban-badge--col7 {
    max-width: 175px;
    font-size: 11px !important;
    padding: 3px 8px;
    line-height: 1.3;
    margin-top: 3px;
}

.table--targets td.target-check-cell {
    white-space: normal;
    min-width: 140px;
    max-width: 200px;
}





