/* Клиентская панель. Отдельный файл без сборки ассетов.
   Светлая тема одна: прохладная светло-голубая база, синий акцент только
   на главном действии, один шрифт без засечек. Тёплая «бумажная» гамма
   и засечные заголовки убраны по замечанию к стенду: клиентские страницы
   должны читаться как современная лента, не как издание. */

.company-plan-progress {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0;
    padding: 20px;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    background: #eff6ff;
    color: #1e3a8a;
}
.company-plan-progress p { margin: 6px 0 0; line-height: 1.5; }
.company-plan-spinner {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border: 3px solid #bfdbfe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: company-plan-spin 1s linear infinite;
}
@keyframes company-plan-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .company-plan-spinner { animation: none; }
}

@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/source-sans-3-cyrillic-400.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/source-sans-3-cyrillic-600.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/source-sans-3-latin-400.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Source Sans 3";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/source-sans-3-latin-600.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #eef4fc;
    --surface: #ffffff;
    --surface-muted: #f3f7fd;
    --border: #e1eaf7;
    --border-strong: #cdd9ec;
    --text: #16233c;
    --text-muted: #66788f;
    --accent: #0f74e6;
    --accent-strong: #0b5cc0;
    --accent-soft: #e8f1ff;
    --mark: #eaf2fe;
    --mark-ink: #1f3a5f;
    --success: #1d8a5a;
    --success-soft: #e4f7ee;
    --danger: #c23a45;
    --danger-soft: #fdecee;
    --warning: #96690f;
    --warning-soft: #fff4da;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(15, 35, 60, .05), 0 12px 28px rgba(15, 35, 60, .07);
    --font: "Source Sans 3", "Segoe UI", sans-serif;
}

[x-cloak] { display: none !important; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background:
        radial-gradient(900px 420px at 85% -12%, rgba(15, 116, 230, .10) 0%, rgba(15, 116, 230, 0) 58%),
        var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    /* Android Chrome иначе раздувает текст в широких блоках (font boosting). */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { letter-spacing: -.02em; margin: 0; font-family: var(--font); font-weight: 650; }
h1 { font-size: 28px; }
h2 { font-size: 17px; }

.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }

/* --- Оболочка ------------------------------------------------------------ */

/* Колонка, а не ряд: без сайдбара ряд прижимал шапку влево, и меню
   оказывалось у левого края, а не справа экрана. */
.shell { display: flex; flex-direction: column; min-height: 100vh; }

.sidebar {
    width: 264px;
    flex: 0 0 264px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    padding: 6px 10px 18px;
}

.brand:hover { text-decoration: none; }

.brand-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14.5px;
}

.nav-item:hover { background: var(--surface-muted); text-decoration: none; }

.nav-item.active {
    background: var(--mark);
    color: var(--text);
    font-weight: 600;
}

.sidebar .spacer { flex: 1; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    min-width: 0;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--mark);
    color: var(--mark-ink);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 14px;
    flex: 0 0 34px;
}

.user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mail { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
}

.icon-btn:hover { background: var(--surface-muted); color: var(--text); }

.logout { margin: 0; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    min-height: 58px;
    width: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 22px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar .brand { padding: 0; }

.topbar-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
    min-width: 0;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    min-width: 0;
}

.top-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--text);
    font-size: 14px;
    font-weight: 550;
    white-space: nowrap;
}

.top-nav a:hover { background: var(--surface-muted); text-decoration: none; }

.top-nav a.active {
    background: var(--mark);
    color: var(--text);
}

.top-nav a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.topbar .user-name { max-width: 140px; }

.crumbs { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 14px; min-width: 0; margin-bottom: 14px; }
.crumbs:empty, .crumbs:not(:has(*)) { display: none; }
.page:has(.studio) .crumbs { display: none; }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--accent); text-decoration: none; }
.crumbs .current { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .sep { display: inline-flex; color: var(--border-strong); }

.topbar .spacer { flex: 1; }

.mobile-bar { display: none; }

/* Профиль в шапке: все пункты клиента — в выпадающем меню справа. */
.user-menu-wrap { position: relative; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    cursor: pointer;
}

.user-chip:hover { background: var(--surface-muted); }

.user-chip .avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    background: linear-gradient(160deg, #3b8cff, var(--accent-strong));
    color: #fff;
    font-size: 14px;
}

.user-caret { display: inline-flex; color: var(--text-muted); transition: transform .15s ease; }
.user-caret.open { transform: rotate(180deg); }

.user-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 224px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 30;
}

.user-menu form { margin: 0; }

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    text-align: left;
    cursor: pointer;
}

.user-menu-item:hover { background: var(--surface-muted); text-decoration: none; }
.user-menu-item.active { background: var(--mark); color: var(--text); font-weight: 600; }

/* --- Страница ------------------------------------------------------------ */

.page { padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; flex: 1 0 auto; }

.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.page-head .head-text { min-width: 0; }
.page-head h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.head-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; font-family: var(--font); font-weight: 400; }

/* Квадрат с иконкой — язык админки. На клиентских экранах его нет. */
.head-icon, .panel-icon { display: none; }

.page-head .spacer { flex: 1; }

/* --- Панели -------------------------------------------------------------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin-bottom: 20px;
    /* Страховка от широких таблиц: прокручивается панель, а не вся страница. */
    overflow-x: auto;
}

.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.panel-head .panel-text { min-width: 0; }
/* Свёрнутая анкета: шапка переключает блок. */
.panel-head[role="button"] { cursor: pointer; }
.panel-caret { color: var(--text-muted); display: inline-flex; transition: transform .15s ease; }
.panel-caret.open { transform: rotate(90deg); }
.panel-head .spacer { flex: 1; }

.panel-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    display: grid;
    place-items: center;
    flex: 0 0 40px;
}

.panel-title { font-size: 17px; font-weight: 650; }
.panel-sub { color: var(--text-muted); font-size: 13.5px; margin-top: 1px; }

/* --- Таблицы ------------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th:first-child { border-top-left-radius: var(--radius-sm); }
th:last-child { border-top-right-radius: var(--radius-sm); }

/* Кнопки действий выровнены по правому краю — и подпись колонки тоже. */
.actions-col { text-align: right; }

/* «Доставки»: короткие колонки не растягиваются, тема забирает остаток. */
.deliveries-table th:nth-child(1) { width: 64px; }
.deliveries-table th:nth-child(3) { width: 120px; }
.deliveries-table th:nth-child(4) { width: 190px; }
.deliveries-table th:nth-child(5) { width: 170px; }

td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-muted); }

td.num { color: var(--text-muted); width: 1%; }

/* --- Бейджи -------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    background: var(--accent-soft);
    color: var(--accent-strong);
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.missing { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.muted-badge { background: var(--surface-muted); color: var(--text-muted); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 13px;
    font-size: 13.5px;
    color: var(--text-muted);
}

.chip .strong { color: var(--text); font-weight: 600; }

.chip-warn { background: var(--warning-soft); border-color: transparent; color: var(--warning); }

/* Удаление источника внутри чипа: маленькое действие, не ломает строку. */
.chip-remove {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    margin-left: 2px;
    padding: 0 4px;
    font-size: 15px;
    line-height: 1;
    border-radius: 999px;
}

.chip-remove:hover { background: var(--surface-muted); color: var(--danger); }

/* Уведомления: счётчик в меню и список на странице. */
.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
}

.notice-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notice-list li { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-muted); }
.notice-list li.unread { border-color: var(--accent); background: var(--surface); }
.notice-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.notice-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.notice-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.notice-body { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.notice-time { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }

.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

/* --- Кнопки -------------------------------------------------------------- */

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

button:hover, .btn:hover { background: var(--accent-strong); }

button:focus-visible, .btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button.secondary, .btn.secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}

button.secondary:hover, .btn.secondary:hover { background: var(--surface-muted); }

button.outline, .btn.outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}

button.outline:hover, .btn.outline:hover { background: var(--surface-muted); }

button.danger-outline, .btn.danger-outline {
    background: var(--surface);
    color: var(--danger);
    border-color: rgba(194, 58, 69, .45);
}

button.danger-outline:hover, .btn.danger-outline:hover { background: var(--danger-soft); }

button:disabled { opacity: .55; cursor: not-allowed; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
td .actions { flex-wrap: nowrap; }

/* Вкладки «Активные/Опубликованные» над таблицей публикаций. */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
}

.tab {
    background: transparent;
    color: var(--text-muted);
    border: 0;
    border-radius: 999px;
    padding: 6px 13px;
    font-size: 13.5px;
    font-weight: 550;
}

.tab:not(.active):hover { background: var(--surface); color: var(--text); }

.tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.tab-count { color: var(--text-muted); font-weight: 500; }
.tab.active .tab-count { color: var(--accent-strong); }

/* Статусы каналов публикации: компактные пилюли, полное имя — в подсказке. */
.chan-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.chan-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    background: var(--surface-muted);
    color: var(--text-muted);
    white-space: nowrap;
}

.chan-pill.ok { background: var(--success-soft); color: var(--success); }
.chan-pill.warn { background: var(--warning-soft); color: var(--warning); }
.chan-pill.missing { background: var(--danger-soft); color: var(--danger); }

/* Заголовок публикации второй строкой под темой. */
.cell-sub { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }
td:last-child { white-space: nowrap; }

/* --- Формы --------------------------------------------------------------- */

label {
    display: block;
    font-size: 13px;
    font-weight: 550;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input, textarea, select {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .14);
}

textarea { resize: vertical; }

.field { margin-bottom: 14px; }

.inline-form { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 210px; margin-bottom: 0; }
/* Кнопка выровнена по строке ввода: сообщение об ошибке под соседним полем
   не тянет её вниз и не съезжает сама форма. */
.inline-form button { flex: 0 0 auto; margin-top: 25px; }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* Каналы в модалке публикации — чекбоксы: каналов может быть несколько. */
.check-list { display: flex; flex-direction: column; gap: 9px; }
.check-item { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.check-item input { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; }

/* Анкета: поля столбцом — текст длинный, в две колонки нечитаемо. */
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.stack-form .field { margin-bottom: 0; }
.stack-form .form-actions { margin-top: 2px; }
.stack-form .form-actions button { flex: 1 1 160px; justify-content: center; }
.stack-form .muted { margin: 0; }

.error { color: var(--danger); font-size: 13px; margin-top: 6px; }

.dest-select { width: 180px; min-width: 180px; padding: 8px 11px; font-size: 14px; }

/* --- Файл ---------------------------------------------------------------- */

.file-field { position: relative; }

.file-field input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.file-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.file-control:hover { border-color: var(--accent); background: var(--surface-muted); }

.file-field input:focus-visible + .file-control {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.file-button {
    display: inline-flex;
    align-items: center;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 550;
    white-space: nowrap;
}

.file-name {
    color: var(--text-muted);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Короткие ответы действий: стопка справа внизу, не полоса над лентой. */
.toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 12px 12px 14px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 12px 32px rgba(15, 35, 60, .16);
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
    animation: toast-in .22s ease;
}

.toast p { margin: 0; flex: 1; }

.toast.ok { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

button.toast-x {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
}

button.toast-x:hover { background: var(--surface-muted); color: var(--text); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
    .toast-stack {
        right: 12px;
        left: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        width: auto;
    }
}

/* --- Уведомления и пустые состояния -------------------------------------- */

.notice {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    margin-bottom: 18px;
    font-size: 14px;
}

.notice.ok { background: var(--success-soft); color: var(--success); border-color: rgba(18, 128, 92, .2); }
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: rgba(194, 58, 69, .2); }

.empty-state { text-align: center; padding: 34px 16px 30px; color: var(--text-muted); }

.empty-icon {
    width: 64px;
    height: 64px;
    border: 1.5px dashed var(--border-strong);
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
    color: var(--text-muted);
}

.empty-title { color: var(--text); font-weight: 600; margin-bottom: 4px; }
.empty-hint { font-size: 13.5px; }

.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.company-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 18px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
    min-width: 0;
}

.company-card:hover { text-decoration: none; border-color: var(--border-strong); }

.company-mark {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--mark);
    color: var(--mark-ink);
    font-family: var(--font);
    font-size: 20px;
    font-weight: 650;
}

.company-card-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.company-card-name {
    font-family: var(--font);
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -.02em;
    line-height: 1.2;
    overflow-wrap: break-word;
}

.company-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--text-muted);
    font-size: 14px;
}

/* --- Пагинация ----------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
    font-size: 14px;
}

.page-link {
    padding: 7px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
}

.page-link:hover { background: var(--surface-muted); }

.page-link.disabled {
    color: var(--text-muted);
    border-color: var(--border);
    background: var(--surface-muted);
    cursor: default;
}

.page-info { color: var(--text-muted); }

/* --- Каналы --------------------------------------------------------------- */

.channel-block + .channel-block {
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding-top: 16px;
}

.channel-block-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }

.credential-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }

.credential-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    font-size: 14px;
}

.credential-main { min-width: 0; }
.credential-meta { font-size: 12.5px; margin-top: 2px; }
.credential-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.credential-channels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pill-remove {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0 0 0 4px;
    font: inherit;
    line-height: 1;
    opacity: .7;
}

.pill-remove:hover { opacity: 1; background: transparent; }

.platform-steps { margin-top: 8px; }
.platform-steps .actions { justify-content: flex-start; margin-top: 10px; }
.credential-hint { font-size: 13px; margin: 10px 0 0; }

/* --- Медиа --------------------------------------------------------------- */

.media-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }

.media-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    font-size: 14px;
}

.media-list .size { color: var(--text-muted); white-space: nowrap; }

.media-item { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }

.media-item > span {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-thumb {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.media-section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.media-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; white-space: nowrap; }

.media-main-badge {
    font-size: 12.5px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 9px;
}

.variant-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.variant { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.variant .media-thumb { width: 72px; height: 72px; }

.media-video {
    display: block;
    width: 160px;
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border);
}

/* --- Вход ---------------------------------------------------------------- */

.auth-body { min-height: 100vh; background: radial-gradient(1100px 520px at 50% -10%, rgba(0, 119, 255, .12) 0%, var(--bg) 60%); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 34px;
}

.auth-card h1 { margin-bottom: 6px; }
.auth-card .muted { margin: 0 0 22px; }
.auth-card .brand { padding: 0 0 20px; }
.auth-card button { width: 100%; }

@media (max-width: 1400px) {
    /* Действия публикаций: компактные кнопки и перенос, иначе колонка
       растягивает таблицу и последняя кнопка упирается в край панели. */
    td .actions {
        flex-wrap: wrap;
        justify-content: flex-end;
        max-width: 320px;
    }

    td .actions button,
    td .actions .btn {
        padding: 7px 12px;
        font-size: 13.5px;
    }
}

/* --- Модальные окна ------------------------------------------------------- */

body.modal-open { overflow: hidden; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 35, 60, .30);
}

.modal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow: hidden;
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(15, 35, 60, .14);
}

.modal-title {
    font-family: var(--font);
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -.02em;
    line-height: 1.2;
}

/* Шапка не скроллится: крестик всегда в правом верхнем углу. */
.modal-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex: 0 0 auto;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
}

.modal-head .panel-text { min-width: 0; flex: 1; padding-top: 1px; }
.modal-head .icon-btn { flex: 0 0 auto; margin-top: 1px; }

.modal-body {
    padding: 18px 20px 20px;
    overflow-y: auto;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
}

/* Кнопки действий модального окна остаются на виду: длинный текст поста
   прокручивается, а «Править» / «Утвердить» не уезжают за нижний край. */
.modal-body:has(> .actions) { padding-bottom: 0; }
.modal-body > .actions {
    position: sticky;
    bottom: 0;
    margin: 16px -20px 0;
    padding: 12px 20px 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

/* --- Мобильный клиентский интерфейс -------------------------------------- */
/* Секции живут на сером фоне, содержимое — белые карточки с тенью: иначе
   белое на белом сливается в одну колонку. */

@media (max-width: 760px) {
    .panel {
        background: transparent;
        border: 0;
        box-shadow: none;
        padding: 0;
        margin-bottom: 22px;
    }

    .panel-head { padding: 0 2px; margin-bottom: 12px; flex-wrap: wrap; }
    .panel-title { font-size: 18px; }
    .panel-sub { font-size: 13px; }
    .panel-icon { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }

    .tabs { width: 100%; justify-content: space-between; background: var(--surface); }

    .page { padding: 14px 12px 48px; }
    .page-head { padding: 0 2px; flex-wrap: wrap; row-gap: 10px; }
    /* Заголовок и кнопка делят строку только если хватает места: иначе
       кнопка уходит на свою строку, а имя компании не сжимается в столбик. */
    .page-head .head-text { flex: 1 1 220px; }
    .page-head h1 { font-size: 22px; }
    .head-icon { display: none; }

    /* Таблицы → карточки. */
    table { display: block; }
    thead { display: none; }
    tbody { display: block; }

    tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 10px;
        row-gap: 2px;
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: 0 2px 10px rgba(16, 24, 40, .08);
        padding: 14px 14px 12px;
        margin-bottom: 12px;
        background: var(--surface);
    }

    tbody tr:last-child { margin-bottom: 0; }
    tbody tr:hover td { background: transparent; }

    td { display: block; border: 0; padding: 0; width: auto; min-width: 0; }

    /* Метка — запасной вариант для таблиц, не попавших в раскладку ниже. */
    td::before {
        content: attr(data-label);
        display: block;
        color: var(--text-muted);
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .06em;
        margin-bottom: 3px;
    }

    td[data-label=""]::before { display: none; }

    /* Карточка: номер и цветной статус сверху, тема крупно, дата под ней. */
    td.num { grid-column: 1; grid-row: 1; width: auto; color: var(--text-muted); font-size: 13px; font-weight: 600; }
    td.num::before { content: "#"; display: inline; margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0; }

    td[data-label="Состояние"] { grid-column: 2; grid-row: 1; justify-self: end; text-align: right; }
    td[data-label="Состояние"]::before { display: none; }

    td[data-label="Тема"] { grid-column: 1 / -1; grid-row: 2; margin-top: 4px; font-size: 15.5px; font-weight: 600; line-height: 1.35; }
    td[data-label="Тема"]::before { display: none; }
    td[data-label="Тема"] .cell-sub { font-size: 13.5px; font-weight: 400; margin-top: 3px; }

    td[data-label="Когда"],
    td[data-label="Канал"] { grid-column: 1 / -1; grid-row: 3; margin-top: 3px; color: var(--text-muted); font-size: 13px; }
    td[data-label="Когда"]::before,
    td[data-label="Канал"]::before {
        content: attr(data-label) ": ";
        display: inline;
        margin: 0;
        font-size: 13px;
        font-weight: 400;
        letter-spacing: 0;
        text-transform: none;
    }

    /* Действия — нижний блок карточки. Ячейка без метки: у «Доставок»
       последняя ячейка — статус, и трогать её нельзя. */
    td[data-label=""]:last-child {
        grid-column: 1 / -1;
        grid-row: 4;
        width: auto;
        white-space: normal;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border);
    }

    td .actions { flex-wrap: wrap; justify-content: stretch; max-width: none; gap: 8px; }
    td .actions button,
    td .actions .btn { flex: 1 1 auto; justify-content: center; }
    td .actions .dest-select { flex: 1 1 100%; width: 100%; min-width: 0; }
    /* Отзыв утверждения — редкое разрушающее действие: компактная кнопка,
       а не полоса на всю карточку. */
    td .actions .revoke-button { flex: 0 1 auto; }

    /* Формы, списки ботов, пустые состояния — такие же карточки, как строки. */
    .inline-form,
    .credential-list,
    .empty-state,
    .platform-steps {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: 0 2px 10px rgba(16, 24, 40, .08);
        padding: 14px;
        margin: 0 0 12px;
    }

    .inline-form .field { flex-basis: 100%; }
    .inline-form button { margin-top: 0; width: 100%; }

    .credential-list { padding: 10px; gap: 10px; }
    .credential-list li { border: 0; background: var(--surface-muted); border-radius: 12px; }
    .credential-main,
    .credential-actions { width: 100%; }
    .credential-actions button,
    .credential-actions .btn { flex: 1 1 auto; justify-content: center; }

    /* Подсказки — тихие подписи под карточками, а не ещё один блок. */
    .credential-hint { padding: 0 2px; margin: 0 0 12px; }

    .empty-state .empty-icon { margin-bottom: 10px; }

    .channel-block + .channel-block { border-top: 0; margin-top: 20px; padding-top: 0; }
    .channel-block-head { padding: 0 2px; margin-bottom: 10px; }

    .notice { border-radius: 12px; }
    .pagination { flex-wrap: wrap; justify-content: center; }

    /* Модалка на мобильном — снизу вверх, как bottom sheet. */
    .modal { padding: 0; align-items: flex-end; }
    .modal-panel {
        max-width: none;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
    }

    .modal-head { padding: 16px 16px 12px; }
    .modal-body { padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
    .modal-body > .actions {
        margin: 14px -16px 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

/* --- Адаптив ------------------------------------------------------------- */

@media (max-width: 900px) {
    .sidebar { display: none; }

    .mobile-bar {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        row-gap: 6px;
        min-height: 58px;
        padding: 8px 14px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .mobile-bar .brand { padding: 0; font-size: 16px; }
    .mobile-bar .spacer { flex: 1; }
    .mobile-nav { display: flex; gap: 4px; }
    .mobile-nav .nav-item { padding: 7px 10px; font-size: 14px; }

    @media (max-width: 430px) {
        .brand-name { display: none; }
    }

    .topbar { padding: 8px 12px; }
    .page { padding: 18px 16px 48px; }

    @media (max-width: 720px) {
        .top-nav a { padding: 8px; }
        .top-nav a span {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }
        .user-chip .user-name { display: none; }
    }
    .page-head h1 { white-space: normal; }
    .head-icon { display: none; }

    td .actions { flex-wrap: wrap; }
    td:last-child { width: auto; white-space: normal; }
}

/* --- AI-план: предложенные темы ----------------------------------------- */
.plan-ai-list { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 16px; }
.plan-ai-item {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}
.plan-ai-item .muted { font-size: 13.5px; }

/* --- Простой экран: карточки публикаций (ТЗ §21) ------------------------- */
.plan-cards { display: flex; flex-direction: column; gap: 12px; }
.plan-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.plan-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plan-card-date { font-weight: 600; }
.plan-card-body { display: flex; gap: 14px; align-items: flex-start; }
.plan-card-text { flex: 1; min-width: 0; }
.plan-card-text .muted { font-size: 13.5px; }
.plan-card-channels { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.plan-card-media {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.plan-card .actions { margin-top: 2px; }
.card-text { white-space: pre-line; line-height: 1.55; }
.card-text blockquote {
    margin: 8px 0;
    padding: 8px 12px;
    border-left: 3px solid var(--border);
    border-radius: 0 10px 10px 0;
    background: var(--surface-muted);
    white-space: pre-line;
}

/* --- Медиатека: сетка материалов, карточка, панель файла ----------------- */
a.btn { text-decoration: none; }

.media-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.media-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    /* Грид-элемент по умолчанию min-width: auto — длинное имя файла
       растягивало трек и налезало на соседние карточки. */
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.media-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.media-card.active { border-color: var(--accent); background: var(--accent-soft); }
.media-card .media-thumb { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; }
.media-card-name {
    font-weight: 600;
    font-size: 13.5px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.media-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    color: var(--text-muted);
    font-size: 12.5px;
}
.media-card-meta > span {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-thumb-file {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    font-weight: 600;
}

.media-detail {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}
.media-detail-preview img {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: block;
}
.media-detail-preview .media-thumb-file { height: 200px; border-radius: var(--radius-sm); }
.media-detail-body { display: flex; flex-direction: column; gap: 14px; }

.cat-list { display: flex; flex-direction: column; gap: 6px; }
.cat-add { display: flex; gap: 8px; }
.cat-add input { flex: 1; min-width: 0; }

.media-usage-head { margin-top: 6px; }
.media-usage { display: flex; flex-direction: column; gap: 8px; }
.media-usage-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}
.media-usage-title { flex: 1; min-width: 0; font-weight: 550; }
.media-usage-time { color: var(--text-muted); font-size: 13px; }

@media (max-width: 760px) {
    .media-detail { grid-template-columns: 1fr; }
    .media-library-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* --- Экран компании: светлая шапка и лента постов, без обложки ------------ */

.page:has(.studio) {
    max-width: 1080px;
}

.studio { color: var(--text); }

.anketa-gate {
    margin: 0 0 22px;
    padding: 18px 20px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.anketa-gate h2 { font-size: 28px; }

.anketa-gate .lead {
    margin: 6px 0 16px;
    color: var(--text-muted);
    font-size: 14.5px;
}

.channel-sheet {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin: 0 0 28px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.channel-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.channel-avatar {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--mark);
    color: var(--mark-ink);
    font-family: var(--font);
    font-size: 22px;
    font-weight: 650;
}

.channel-id { min-width: 0; flex: 1; }

.channel-name {
    font-family: var(--font);
    font-size: 32px;
    font-weight: 650;
    letter-spacing: -.03em;
    line-height: 1.15;
    overflow-wrap: break-word;
    word-break: normal;
}

.channel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 13.5px;
}

.channel-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 4px 14px;
}

.channel-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 13.5px;
}

.plan-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 8px;
}

.plan-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0;
}

.plan-field select { width: auto; min-width: 76px; padding: 10px 12px; }

.plan-go,
.plan-quiet {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    font-weight: 650;
}

.plan-go { padding: 11px 18px; }

button.plan-own {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 600;
}

button.plan-own:hover { background: var(--surface-muted); }

.plan-quiet {
    background: transparent;
    color: var(--text-muted);
    border: 0;
    padding: 8px 0;
    font-weight: 600;
    text-decoration: none;
}

.plan-quiet:hover { background: transparent; color: var(--text); text-decoration: none; }

.plan-status {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-weight: 650;
    font-size: 13.5px;
    background: var(--surface-muted);
}

.plan-status.ok { background: var(--success-soft); color: var(--success); }
.plan-status.warn { background: var(--warning-soft); color: var(--warning); }

/* Темы плана не занимают экран: список открывается у кнопки рядом с профилем. */
.topics-menu { position: relative; }

.topics-count {
    min-width: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.topics-drop {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    width: min(420px, 80vw);
    max-height: 70vh;
    overflow: auto;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.topics-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
}

.topics-item + .topics-item { border-top: 1px solid var(--border); }

.topics-item-title { font-weight: 650; font-size: 14.5px; line-height: 1.35; }
.topics-item-meta { color: var(--text-muted); font-size: 12.5px; margin-top: 3px; }
.topics-item-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.topics-item-actions button,
.topics-item-actions .plan-quiet { padding: 6px 10px; font-size: 13px; }

.feed {
    max-width: 560px;
    margin: 0 auto;
}

.feed-head { margin: 0 2px 14px; }
.feed-head h2 { font-size: 18px; font-weight: 650; }
.feed-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 13.5px; }

.feed .notice { border-radius: 12px; }

.post-list { display: flex; flex-direction: column; gap: 18px; }

.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.post-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px;
}

.post-avatar {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--mark);
    color: var(--mark-ink);
    font-family: var(--font);
    font-weight: 650;
    font-size: 16px;
}

.post-who { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.post-company { font-weight: 700; font-size: 14.5px; }
.post-when { color: var(--text-muted); font-size: 12.5px; overflow-wrap: anywhere; }

.post-status {
    align-self: flex-start;
    margin-top: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
}

.post-status.ok { background: var(--success-soft); color: var(--success); }
.post-status.missing { background: var(--danger-soft); color: var(--danger); }
.post-status.warn { background: var(--warning-soft); color: var(--warning); }
.post-status.draft { background: var(--warning-soft); color: var(--warning); }

.post-media {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
}

.post-body { padding: 12px 16px 10px; }
.post-title {
    font-family: var(--font);
    font-weight: 650;
    font-size: 20px;
    line-height: 1.3;
    letter-spacing: -.02em;
    margin: 0 0 6px;
    overflow-wrap: break-word;
    word-break: normal;
}
.post-text { margin: 0; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; font-size: 15px; line-height: 1.45; }

.post-stamp {
    display: block;
    margin-top: 8px;
    text-align: right;
    color: var(--text-muted);
    font-size: 12px;
}

.post-foot {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 8px;
    border-top: 1px solid var(--border);
    background: transparent;
}

.post-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    width: 100%;
}

.icon-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.icon-action:hover { background: var(--surface-muted); color: var(--text); }
.icon-action.accent {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 8px 14px;
}
.icon-action.accent:hover { background: var(--accent-strong); color: #fff; }

@media (max-width: 860px) {
    .channel-actions,
    .plan-form { justify-content: flex-start; }
    .topics-drop { left: 0; right: auto; width: min(420px, calc(100vw - 48px)); }
}
