/* Монохромный минимализм (Linear/Vercel/Notion): фиксированная палитра, светлая и тёмная темы.
   Тёмная тема — html[data-theme="dark"] (из Telegram), без неё — prefers-color-scheme. */
:root {
  --bg: #F7F7F8;
  --bg2: #FFFFFF;
  --surface: #FFFFFF;
  --text: #0A0A0A;
  --text2: #6B6B6B;
  --hint: #999999;
  --accent: #0A0A0A;
  --accent-text: #FFFFFF;
  --line: rgba(0, 0, 0, 0.08);
  --line-hover: rgba(0, 0, 0, 0.12);
  --hover: rgba(0, 0, 0, 0.04);
  --glass: rgba(0, 0, 0, 0.04);
  --glass-soft: rgba(0, 0, 0, 0.03);
  --card-glass: rgba(255, 255, 255, 0.6);
  --dash: rgba(0, 0, 0, 0.1);
  --divider: rgba(0, 0, 0, 0.06);
  --mesh-a: rgba(255, 255, 255, 0.95); --mesh-a0: rgba(255, 255, 255, 0);
  --mesh-b: rgba(0, 0, 0, 0.05); --mesh-b0: rgba(0, 0, 0, 0);
  color-scheme: light;
  --danger: #E53935;
  --r-card: 16px;
  --r-field: 12px;
  --side: 16px;
  --gap-section: 24px;
  --gap-card: 12px;
  --gap-el: 8px;
  --ease: 200ms ease-out;
}
html[data-theme="dark"] {
  --bg: #0A0A0A; --bg2: #161616; --surface: #161616;
  --text: #FAFAFA; --text2: #A0A0A0; --hint: #666666;
  --accent: #FFFFFF; --accent-text: #0A0A0A;
  --line: rgba(255, 255, 255, 0.08); --line-hover: rgba(255, 255, 255, 0.16);
  --hover: rgba(255, 255, 255, 0.06); --glass: rgba(255, 255, 255, 0.06);
  --glass-soft: rgba(255, 255, 255, 0.05); --dash: rgba(255, 255, 255, 0.1);
  --divider: rgba(255, 255, 255, 0.06);
  --card-glass: rgba(255, 255, 255, 0.04);
  --mesh-a: rgba(255, 255, 255, 0.07); --mesh-a0: rgba(255, 255, 255, 0);
  --mesh-b: rgba(255, 255, 255, 0.04); --mesh-b0: rgba(255, 255, 255, 0);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #0A0A0A; --bg2: #161616; --surface: #161616;
    --text: #FAFAFA; --text2: #A0A0A0; --hint: #666666;
    --accent: #FFFFFF; --accent-text: #0A0A0A;
    --line: rgba(255, 255, 255, 0.08); --line-hover: rgba(255, 255, 255, 0.16);
    --hover: rgba(255, 255, 255, 0.06); --glass: rgba(255, 255, 255, 0.06);
    --glass-soft: rgba(255, 255, 255, 0.05); --dash: rgba(255, 255, 255, 0.1);
    --divider: rgba(255, 255, 255, 0.06);
    --card-glass: rgba(255, 255, 255, 0.04);
    --mesh-a: rgba(255, 255, 255, 0.07); --mesh-a0: rgba(255, 255, 255, 0);
    --mesh-b: rgba(255, 255, 255, 0.04); --mesh-b0: rgba(255, 255, 255, 0);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; touch-action: manipulation; overscroll-behavior: none; }
/* Фон на весь экран при любом объёме содержимого: основа — html, поверх неё фиксированный слой body::before;
   сам body прозрачный (иначе его сплошной фон перекрывал бы градиент только по высоте содержимого) */
html { background: var(--bg); background-color: var(--bg); min-height: 100vh; }
body {
  background: transparent; color: var(--text);
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  font: 400 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui,
        sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
/* Мягкий mesh-градиент: радиальные пятна из углов, только серые тона */
body::before { content: ""; position: fixed; left: 0; right: 0; top: -120px; bottom: -120px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 15% 12%, var(--mesh-a) 0%, var(--mesh-a0) 55%),
    radial-gradient(circle at 88% 22%, var(--mesh-b) 0%, var(--mesh-b0) 52%),
    radial-gradient(circle at 10% 78%, var(--mesh-b) 0%, var(--mesh-b0) 52%),
    radial-gradient(circle at 90% 90%, var(--mesh-a) 0%, var(--mesh-a0) 55%),
    var(--bg); }

/* ----- Верх: шапка и вкладки ----- */
.top { position: sticky; top: 0; z-index: 5; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
        padding: 10px var(--side) 6px; }
.brand { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; overflow: hidden;
         text-overflow: ellipsis; min-width: 0; }
.account { display: flex; align-items: center; gap: 10px; border: 0; background: transparent;
           color: var(--text); font: inherit; padding: 4px 4px 4px 8px; border-radius: 999px; cursor: pointer;
           min-width: 0; transition: transform 100ms ease-out; }
.account:active { transform: scale(0.97); }
.account[hidden] { display: none; }
.account__name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis;
                 white-space: nowrap; max-width: 40vw; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
          font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none;
          overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 64px; height: 64px; font-size: 26px; }
.avatar--sm { width: 36px; height: 36px; font-size: 15px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px var(--side) 10px; scrollbar-width: none; position: relative; }
.tabs::-webkit-scrollbar { display: none; }
.tabs[hidden] { display: none; }
.tabs button { flex: none; border: 1px solid var(--line); border-radius: 999px; background: transparent;
               color: var(--text); font: inherit; font-size: 15px; font-weight: 600; padding: 8px 16px;
               cursor: pointer; white-space: nowrap; transition: background var(--ease), color var(--ease),
               border-color var(--ease), transform 100ms ease-out; }
.tabs button:hover { background: var(--hover); }
.tabs button:active { transform: scale(0.97); }
.tabs button { position: relative; }
.tab-badge { position: absolute; top: -4px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px;
             border-radius: 8px; background: #e53935; color: #fff; font-size: 10px; line-height: 16px;
             font-weight: 600; text-align: center; box-sizing: border-box; pointer-events: none; }
.tab-badge[hidden] { display: none; }
/* метка «beta» у вкладки в бета-тесте */
.tab-beta { margin-left: 6px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
            opacity: 0.6; vertical-align: 1px; pointer-events: none; }
.tabs button.on, .tabs button.on:hover { background: var(--accent); color: var(--accent-text);
                                         border-color: var(--accent); }

/* Сегментированный контрол: стеклянная основа, скользящая подсветка (.seg__hl) под кнопками */
.seg { position: relative; display: flex; flex-wrap: wrap; gap: 2px; background: var(--glass); border-radius: 14px; padding: 4px;
       min-height: 44px; border: 0; }
.seg[hidden] { display: none; }
.seg__hl { position: absolute; left: 0; top: 0; z-index: 0; width: 0; height: 0; border-radius: 10px; background: var(--accent);
           pointer-events: none; opacity: 0; transition: transform 250ms ease-out, width 250ms ease-out, height 250ms ease-out; }
.seg button { position: relative; z-index: 1; flex: 1 1 auto; min-width: 0; min-height: 36px; border: 0; background: transparent;
              color: var(--hint); font: inherit; font-size: 15px; font-weight: 500; padding: 8px 14px; border-radius: 10px;
              cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 200ms ease-out; }
.seg button.on { color: var(--accent-text); font-weight: 600; }
.seg--sub { margin: 0 0 14px; }
/* Одна строка с горизонтальной прокруткой (как вкладки .tabs): кнопки не сжимаются и не переносятся;
   подсветка .seg__hl лежит внутри и едет вместе с ними */
.seg--scroll { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain;
               max-width: 100%; min-width: 0; touch-action: pan-x pan-y; }
.seg--scroll::-webkit-scrollbar { display: none; }
.seg--scroll button { flex: 1 0 auto; overflow: visible; text-overflow: clip; }

.view { flex: 1 0 auto; width: 100%; padding: 12px var(--side) 32px; max-width: 760px; margin: 0 auto; scroll-behavior: smooth; }
html { scroll-behavior: smooth; }

/* ----- Разделы ----- */
.section { margin: 24px 4px 12px; font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--text);
           text-transform: none; letter-spacing: 0; }
.section:first-child { margin-top: 6px; }

/* ----- Сворачиваемые разделы редактора макета ----- */
.section-collapsible { margin: 0 0 8px; background: var(--glass-soft); border: 1px solid var(--line);
                       border-radius: 12px; overflow: hidden; }
.section-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer;
                  padding: 16px; font-size: 16px; font-weight: 700; line-height: 1.3; user-select: none; }
.section-header .chevron { font-size: 12px; color: var(--hint); transition: transform 200ms; }
.section-collapsible.open .section-header .chevron { transform: rotate(180deg); }
/* «Скрыть» в шапке секции редактора (владелец): убирает секцию из active_sections */
.section-hide { margin: 0 10px 0 auto; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--hint);
                font: inherit; font-size: 12px; padding: 2px 10px; cursor: pointer; }
.section-hide:hover { background: var(--hover); color: var(--text); }
.section-content { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 0fr; transition: grid-template-rows 200ms ease; }
.section-collapsible.open .section-content { grid-template-rows: 1fr; }
.section-content__inner { min-height: 0; min-width: 0; overflow: hidden; padding: 0 16px; }   /* min-width: 0 — содержимое (например, seg--scroll) не раздвигает раздел */
.section-collapsible.open .section-content__inner { padding-bottom: 16px; overflow: visible; }
.caption { font-size: 13px; font-weight: 400; color: var(--hint); }

/* ----- Карточки и списки ----- */
.card { background: var(--card-glass); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px;
        margin-bottom: var(--gap-card); transition: border-color var(--ease); }
@media (hover: hover) { .card:hover { border-color: var(--line-hover); } }
.list { background: var(--card-glass); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
        margin-bottom: var(--gap-card); transition: border-color var(--ease); }
@media (hover: hover) { .list:hover { border-color: var(--line-hover); } }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer;
        position: relative; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0;
                        border-top: 1px solid var(--line); }
.item { transition: background 100ms ease-out, transform 100ms ease-out; }
@media (hover: hover) { .item:hover { background: var(--hover); } }
.item:active { background: var(--hover); transform: scale(0.985); }
.item__main { flex: 1; min-width: 0; }
.item__title { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.item__sub { font-size: 13px; color: var(--text2); margin-top: 1px; overflow: hidden;
             text-overflow: ellipsis; }
.item__aside { font-size: 13px; color: var(--hint); white-space: nowrap; }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--hint); border-top: 2px solid var(--hint);
        transform: rotate(45deg); flex: none; opacity: 0.7; }
.check { width: 6px; height: 12px; border-right: 2.5px solid var(--accent);
         border-bottom: 2.5px solid var(--accent); transform: rotate(40deg); flex: none;
         margin-right: 4px; visibility: hidden; }
.item--on .check { visibility: visible; }
.badge { display: inline-block; font-size: 12px; line-height: 1; padding: 4px 8px; margin-left: 8px;
         border-radius: 999px; background: var(--glass); color: var(--text2); vertical-align: 1px;
         font-weight: 500; }
.badge--accent { background: var(--accent); color: var(--accent-text); }

/* Ключ-значение */
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--hint); font-size: 14px; }
.kv dd { margin: 0; word-break: break-word; white-space: pre-wrap; }

/* ----- Цифры и графики ----- */
.big { display: flex; }
.big > div { flex: 1; text-align: center; }
.big > div + div { border-left: 1px solid var(--line); }
.big__value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.big__label { font-size: 13px; color: var(--hint); }
.chart { position: relative; height: 240px; }

/* ----- Формы ----- */
.field { margin-bottom: var(--gap-card); }
.field > label { display: block; font-size: 13px; color: var(--hint); margin: 0 0 6px 4px; }
input[type=text], input[type=search], input[type=password], input[type=datetime-local], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-field); background: var(--glass-soft);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  color: var(--text); font: inherit; padding: 12px; transition: border-color var(--ease); outline: none; appearance: none; -webkit-appearance: none; }
textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--text); }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type=file] { width: 100%; font: inherit; color: var(--text); background: var(--bg2);
                   border-radius: var(--r-field); padding: 10px 12px; }
.counter { font-size: 12px; color: var(--hint); text-align: right; margin: 4px 4px 0 0; }

/* ----- Кнопки ----- */
.btns { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.btn { width: 100%; border: 1px solid transparent; border-radius: 999px; background: var(--accent);
       color: var(--accent-text); font: inherit; font-size: 15px; font-weight: 600; padding: 14px 20px;
       cursor: pointer; }
.btn { transition: transform 100ms ease-out, opacity var(--ease), background var(--ease),
       border-color var(--ease); }
@media (hover: hover) { .btn:hover { opacity: 0.9; } }
.btn:active { transform: scale(0.97); }
/* вторичная «стеклянная» */
.btn--soft { background: var(--glass); color: var(--text); border-color: var(--line);
             -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
/* третичная: только текст */
.btn--ghost { background: transparent; color: var(--text2); border-color: transparent; }
@media (hover: hover) { .btn--ghost:hover { opacity: 1; background: var(--hover); } }
/* деструктивная: нейтральный фон и рамка, красный текст */
.btn--danger { background: var(--glass); color: var(--danger); border-color: var(--line); }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ----- Прочее ----- */
.preview { display: block; width: 100%; max-height: 440px; object-fit: contain; border-radius: var(--r-card);
           background: var(--bg2); margin-bottom: 12px; }
.banner { background: var(--bg2); border-radius: var(--r-card); color: var(--hint); font-size: 13px;
          padding: 10px 14px; margin-bottom: 12px; }
.empty { color: var(--hint); text-align: center; padding: 36px 12px; }
.table-wrap { overflow-x: auto; background: var(--bg2); border-radius: var(--r-card); margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; white-space: nowrap; }
th { color: var(--hint); font-weight: 500; font-size: 12px; text-transform: uppercase; }
tbody tr + tr td { border-top: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile { background: var(--bg2); border-radius: var(--r-card); padding: 16px; cursor: pointer;
        font-weight: 500; }
.tile:active { opacity: 0.7; }
.thumb { background: var(--bg2); border-radius: var(--r-card); overflow: hidden; }
.thumb img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; cursor: pointer; }
.thumb__body { padding: 8px 12px 10px; font-size: 14px; }
.toast { position: fixed; left: var(--side); right: var(--side); bottom: calc(20px + env(safe-area-inset-bottom));
         background: var(--accent); color: var(--accent-text); padding: 12px 14px; border-radius: 12px;
         z-index: 1200; text-align: center; font-size: 14px; }  /* поверх нижних окон (.sheet — 1000) */
.toast--error { background: var(--danger); color: #fff; }
.toast[hidden] { display: none; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.92); z-index: 20; display: flex;
            flex-direction: column; align-items: center; justify-content: center; gap: 14px;
            padding: 16px; }
.lightbox img { max-width: 100%; max-height: 72vh; border-radius: 8px; }
.lightbox .btn { max-width: 320px; }

/* ----- Миниатюры в списках ----- */
.thumb-sm { width: 52px; height: 52px; border-radius: 8px; background: var(--bg); object-fit: cover;
            flex: none; display: flex; align-items: center; justify-content: center;
            color: var(--hint); font-size: 11px; }

/* ----- Предложенные новости: чат-стиль ----- */
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-end; cursor: pointer; }
.msg:active .bubble { transform: scale(0.985); }
.bubble { background: var(--bg2); border-radius: 18px 18px 18px 6px; padding: 10px 14px 8px;
          min-width: 0; max-width: calc(100% - 46px); transition: transform 100ms ease-out; }
.msg__name { font-size: 14px; font-weight: 600; color: var(--accent); }
.msg__channel { font-size: 12px; color: var(--hint); margin-bottom: 4px; }
.msg__text { white-space: pre-wrap; word-break: break-word; display: -webkit-box;
             -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.msg__media { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; margin: 6px 0 2px;
              background: var(--bg); }
.msg__foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 4px;
             font-size: 12px; color: var(--hint); }
.msg__foot .badge { margin: 0; }

/* ----- Скелетоны ----- */
.skel { background: var(--bg2); border-radius: var(--r-card); height: 64px; margin-bottom: 12px;
        animation: pulse 1.2s ease-in-out infinite; }
.skel--tall { height: 140px; }
.skel--line { height: 14px; border-radius: 7px; width: 40%; margin-bottom: 10px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  * { transition: none !important; }
}

/* ----- Аккаунт ----- */
.profile { display: flex; gap: 14px; align-items: center; }
.profile__name { font-size: 18px; font-weight: 700; }

/* ----- Создание поста: область загрузки и предпросмотра ----- */
.upload { position: relative; width: 100%; max-width: 560px; margin: 0 auto 16px; background: var(--glass-soft);
          -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
          border: 1px solid var(--line-hover); border-radius: 20px; overflow: hidden; cursor: pointer;
          aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
          transition: border-color var(--ease), background var(--ease); }
.upload--empty { border: 1px dashed var(--dash); }
.upload--drag { border: 1px dashed var(--text2); background: var(--hover); }
.upload__ph { text-align: center; padding: 16px; }
.upload__ph[hidden], .upload__img[hidden], .upload__skel[hidden] { display: none; }
.upload__plus { position: relative; width: 48px; height: 48px; margin: 0 auto 10px; }
.upload__plus::before, .upload__plus::after { content: ""; position: absolute; background: var(--hint); border-radius: 1px; }
.upload__plus::before { left: 0; right: 0; top: 23px; height: 1.5px; }
.upload__plus::after { top: 0; bottom: 0; left: 23px; width: 1.5px; }
.upload__title { font-size: 32px; font-weight: 600; color: var(--hint); }
.upload__hint { font-size: 15px; color: var(--hint); margin-top: 6px; }
.upload__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.upload__skel { position: absolute; inset: 0; background: var(--bg2); opacity: 0.8;
                animation: pulse 1.2s ease-in-out infinite; }
.list > .item:only-child::before { display: none; }

/* ----- Нижняя шторка выбора ----- */
.sheet { position: fixed; inset: 0; z-index: 15; background: rgba(0, 0, 0, 0.4); display: flex;
         align-items: flex-end; justify-content: center; }
.sheet__panel { background: var(--surface); width: 100%; max-width: 760px; max-height: 82vh; overflow-y: auto;
                border-radius: 20px 20px 0 0; padding: 4px var(--side) calc(16px + env(safe-area-inset-bottom)); position: relative; }

/* ----- Образцы цвета стиля ----- */
.swatches { display: flex; flex: none; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); margin-left: -6px;
          box-shadow: 0 0 0 2px var(--bg2); }
.swatch:first-child { margin-left: 0; }

/* ----- Панель акцента над полями текста ----- */
.toolbar { margin-bottom: 12px; }
.toolbar .caption { margin: 0 4px 6px; }
.tools { display: flex; gap: 8px; }
.tool { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
        border-radius: var(--r-field); background: var(--glass); color: var(--text); font: inherit;
        font-weight: 500; padding: 10px 12px; cursor: pointer; transition: transform 100ms ease-out; }
.tool:active { transform: scale(0.97); }
.tool .swatch { margin-left: 0; box-shadow: none; }

/* ----- Выбор цвета (color-picker.js) ----- */
.cp-trigger { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--bg);
              color: var(--text); font: inherit; font-size: 13px; padding: 4px 10px 4px 4px;
              border-radius: 999px; cursor: pointer; transition: transform 100ms ease-out; }
.cp-trigger:active { transform: scale(0.97); }
.cp-chip { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); flex: none; }
.cp-label { font-variant-numeric: tabular-nums; }
.cp-overlay { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.45); display: flex;
              align-items: flex-end; justify-content: center; animation: cp-fade 160ms ease-out; }
.cp-panel { background: var(--surface); color: var(--text); width: 100%; max-width: 420px; max-height: 88vh;
            overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px var(--side)
            calc(16px + env(safe-area-inset-bottom)); animation: cp-up 220ms ease-out; }
@media (min-width: 700px) {
  .cp-overlay { align-items: center; }
  .cp-panel { border-radius: 16px; padding-bottom: 16px; animation-name: cp-pop; }
}
.cp-current { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cp-big { width: 56px; height: 56px; border-radius: 14px; border: 1px solid var(--line); flex: none; }
.cp-hexinput { flex: 1; min-width: 0; border: 2px solid transparent; background: var(--bg2); color: var(--text);
               font: inherit; font-size: 18px; font-weight: 600; padding: 10px 12px; border-radius: var(--r-field);
               outline: none; text-transform: uppercase; }
.cp-hexinput.cp-bad { border-color: var(--danger); }
.cp-copy { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 13px;
           font-weight: 600; cursor: pointer; padding: 8px 4px; white-space: nowrap; }
.cp-slider { margin-bottom: 12px; }
.cp-slider__head { display: flex; justify-content: space-between; font-size: 13px; color: var(--hint);
                   margin: 0 2px 6px; }
.cp-val { color: var(--text); font-variant-numeric: tabular-nums; }
.cp-range { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 7px;
            margin: 0; outline: none; border: 1px solid var(--line); }
.cp-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px;
            border-radius: 50%; background: #fff; border: 1px solid rgba(0, 0, 0, 0.25);
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); cursor: pointer; }
.cp-range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff;
            border: 1px solid rgba(0, 0, 0, 0.25); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); cursor: pointer; }
.cp-actions { display: flex; gap: 10px; margin-top: 16px; }
.cp-cancel { flex: 1; border: 1px solid var(--line); border-radius: 12px; background: var(--glass); color: var(--text); font: inherit;
             font-weight: 600; padding: 12px 16px; cursor: pointer; transition: transform 100ms ease-out; }
.cp-cancel:active { transform: scale(0.97); }
.cp-title { font-size: 13px; color: var(--hint); text-transform: uppercase; letter-spacing: 0.03em;
            margin: 14px 2px 8px; }
.cp-grid { display: grid; grid-template-columns: repeat(8, 32px); gap: 8px; justify-content: space-between; }
.cp-recent { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-swatch { width: 32px; height: 32px; padding: 0; border-radius: 6px; border: 1px solid var(--line);
             cursor: pointer; transition: transform 100ms ease-out, border-color 120ms ease-out; }
.cp-swatch:hover { border-color: var(--text); }
.cp-swatch:active { transform: scale(0.9); }
.cp-swatch.cp-on { outline: 2px solid var(--accent); outline-offset: 2px; }
.cp-swatch.cp-small { width: 24px; height: 24px; }
.cp-apply { flex: 1; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-text);
            font: inherit; font-weight: 600; padding: 12px 16px; cursor: pointer;
            transition: transform 100ms ease-out; }
.cp-apply:active { transform: scale(0.97); }
.color-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
             padding: 10px 16px; }
.color-row + .color-row { border-top: 1px solid var(--line); }
@keyframes cp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cp-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cp-pop { from { transform: scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* ----- Редактор макета ----- */
.editor { display: block; }
.editor__preview { position: static; background: transparent;
                   padding: 8px 0 4px; margin-bottom: 8px; }
.editor__frame { position: relative; border-radius: var(--r-card); overflow: hidden; background: var(--bg2);
                 text-align: center; }
.editor__img { display: block; margin: 0 auto; width: 100%; height: auto; max-height: 58vh; object-fit: contain; }
.editor__frame .upload__skel { position: absolute; inset: 0; }
.editor__scale { position: absolute; right: 8px; bottom: 8px; padding: 3px 10px; border-radius: 999px;
                 font-size: 12px; line-height: 1.4; color: #fff; background: rgba(0, 0, 0, .6); pointer-events: none; }
.editor__scale[hidden] { display: none; }
.editor__scale--limit { background: rgba(190, 90, 0, .85); }
.section-collapsible[hidden] { display: none; }
@media (min-width: 900px) {
  .view:has(.editor) { max-width: 1100px; }
  .editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .editor__preview { order: 2; }
  .editor__form { order: 1; }
  .editor__img { max-height: 80vh; min-height: 400px; }
  .editor__preview { position: sticky; top: 8px; }
}
.srow { padding: 8px 0; }
.srow__head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 8px; }
.srow__val { display: inline-flex; align-items: center; gap: 4px; }
.num { width: 72px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit;
       font-size: 14px; text-align: right; padding: 6px 8px; font-variant-numeric: tabular-nums; outline: none; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; margin: 8px 0;
         background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--line) var(--p, 0%)); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 50%;
         background: #fff; border: 1px solid rgba(0, 0, 0, 0.2); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); cursor: pointer; }
.range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff;
         border: 1px solid rgba(0, 0, 0, 0.2); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); cursor: pointer; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch__knob { position: absolute; inset: 0; border-radius: 16px; background: rgba(120, 120, 128, 0.32);
         transition: background var(--ease); }
.switch__knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
         background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: transform var(--ease); }
.switch__input:checked + .switch__knob { background: var(--accent); }
.switch__input:checked + .switch__knob::after { transform: translateX(20px); }
.card .color-row { padding-left: 0; padding-right: 0; }

/* ----- Редактор макета: стили, миниатюры ----- */
.overlay-thumb { display: block; max-width: 100%; max-height: 160px; border-radius: 10px; margin: 8px 0;
                 background: repeating-conic-gradient(var(--line) 0% 25%, transparent 0% 50%) 50% / 16px 16px; }
.overlay-thumb--sm { width: 56px; height: 56px; max-height: none; object-fit: contain; margin: 0; flex: none; }
.overlay-thumb--none { display: flex; align-items: center; justify-content: center; color: var(--hint);
                       font-size: 12px; background: var(--bg); }
.style-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.seg--wrap { flex-wrap: wrap; }
.seg--wrap button { flex: 1 1 30%; }

/* ----- Пользователи ----- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot--green { background: #34c759; } .dot--red { background: #ff3b30; } .dot--yellow { background: #ffcc00; }
.badge--green { background: rgba(52, 199, 89, 0.18); color: #248a3d; }
.badge--red { background: rgba(255, 59, 48, 0.16); color: #d70015; }
.badge--yellow { background: rgba(255, 204, 0, 0.25); color: #8a6d00; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions .btn { width: auto; padding: 7px 12px; font-size: 13px; }
.steps { display: flex; gap: 6px; margin: 4px 0 8px; }
.steps__dot { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background 160ms ease-out; }
.steps__dot--on { background: var(--accent); }
.pwd { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 28px; font-weight: 700;
       letter-spacing: 0.06em; text-align: center; word-break: break-all; padding: 18px 8px; margin: 8px 0 12px;
       background: var(--bg2); border-radius: var(--r-card); user-select: all; -webkit-user-select: all; }

/* ----- Ведомства и каналы ----- */
.statgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--bg2); border-radius: var(--r-card); padding: 12px 8px; text-align: center; }
.stat__value { font-size: 24px; font-weight: 700; }

/* ----- Стекло (умеренное): только шапка при прокрутке и подложки окон ----- */
/* Шапка (.head) в покое сплошная; при прокрутке больше 10 px (класс .scrolled на .top) становится стеклом.
   Вкладки (.tabs), кнопки, карточки, формы и списки остаются сплошными. */
.top { background: transparent; }
/* разделитель между шапкой и вкладками: 1px, всегда виден (цвет не анимируется и при прокрутке не меняется) */
.head { background: transparent; border-bottom: 1px solid var(--divider);
        transition: background-color 200ms ease, backdrop-filter 200ms ease, -webkit-backdrop-filter 200ms ease; }
.tabs { background: transparent; border-bottom: 1px solid transparent;
        transition: background-color 200ms ease, border-color 200ms ease, backdrop-filter 200ms ease, -webkit-backdrop-filter 200ms ease; }
.top.scrolled .head, .top.scrolled .tabs { background: rgba(247, 247, 248, 0.7);
                      -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
/* тёмная тема: из Telegram (html[data-theme]), без неё — из настроек системы */
.top.scrolled .tabs { border-bottom-color: rgba(0, 0, 0, 0.08); }
html[data-theme="dark"] .top.scrolled .head, html[data-theme="dark"] .top.scrolled .tabs { background: rgba(10, 10, 10, 0.6); }
html[data-theme="dark"] .top.scrolled .tabs { border-bottom-color: rgba(255, 255, 255, 0.08); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .top.scrolled .head, html:not([data-theme]) .top.scrolled .tabs { background: rgba(10, 10, 10, 0.6); }
  html:not([data-theme]) .top.scrolled .tabs { border-bottom-color: rgba(255, 255, 255, 0.08); }
}
/* Подложка модальных окон и шторок: затемнение и размытие фона; содержимое окна сплошное */
.sheet, .cp-overlay, .lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.3);
                                 -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
.lightbox { background: rgba(0, 0, 0, 0.55); }
@media (prefers-reduced-transparency: reduce) {
  .top.scrolled .head, .top.scrolled .tabs { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  .sheet, .cp-overlay, .lightbox { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(0, 0, 0, 0.5); }
}

/* ----- Отправка новости (для пользователей без входа) ----- */
.upload__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.news-done { text-align: center; padding: 28px 8px; }
.news-done__title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }

/* ----- Страница «Создать пост» ----- */
.page-title { margin: 4px 0 16px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.label { margin: 24px 4px 12px; font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--text);
         text-transform: none; letter-spacing: 0; }
.upload__x { position: absolute; top: 10px; right: 10px; z-index: 2; width: 32px; height: 32px; border-radius: 50%;
             border: 1px solid var(--line); background: var(--glass); color: var(--text); font: inherit; font-size: 20px;
             line-height: 1; padding: 0 0 2px; cursor: pointer; -webkit-backdrop-filter: blur(20px) saturate(180%);
             backdrop-filter: blur(20px) saturate(180%); transition: transform 100ms ease-out; }
.upload__x:active { transform: scale(0.9); }
.upload__x[hidden] { display: none; }
.upload__video { z-index: 0; }

/* Горизонтальная прокрутка макетов и стилей */
.chips { display: flex; gap: var(--gap-el); overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line);
        border-radius: 999px; background: var(--glass); color: var(--text); font: inherit; font-size: 15px;
        font-weight: 600; padding: 8px 16px; cursor: pointer; white-space: nowrap;
        -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
        transition: background var(--ease), color var(--ease), border-color var(--ease), transform 100ms ease-out; }
.chip:active { transform: scale(0.97); }
.chip__tag { font-size: 12px; font-weight: 500; opacity: 0.6; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent);
           -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Кружки стилей в форме поста: заливка — акцент, точка — основной цвет, выбранный в кольце.
   Ряд — одна строка с горизонтальной прокруткой (как вкладки и seg--scroll) */
.sdots { position: relative; display: flex; flex-wrap: nowrap; gap: 12px; align-items: center; overflow-x: auto; overflow-y: hidden;
         max-width: 100%; min-width: 0; padding: 6px 6px 8px; scrollbar-width: none; overscroll-behavior-x: contain;
         touch-action: pan-x pan-y; }
.sdots::-webkit-scrollbar { display: none; }
.sdot { flex: none; position: relative; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent;
        cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font: inherit;
        transition: box-shadow var(--ease), transform 100ms ease-out; }
.sdot:active { transform: scale(0.94); }
.sdot__fill { width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); display: flex; align-items: center; justify-content: center; }
.sdot__base { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 0 3px var(--line); }
.sdot.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.sdot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sdot--plus { border: 1.5px dashed var(--hint); color: var(--hint); font-size: 22px; font-weight: 500; line-height: 1; background: var(--glass); }
.sdots__cap { font-size: 13px; color: var(--hint); padding: 0 6px 4px; }
.sdots__name { color: var(--text); font-weight: 600; font-size: 14px; }
.sdots__hint { font-size: 12px; }
.sheet__preview { display: block; width: 100%; max-height: 38vh; object-fit: contain; border-radius: 12px; margin: 8px 0; }
.sheet__preview[hidden] { display: none; }

/* Стеклянные поля и плавающая панель */
.glass-input { background: var(--glass-soft); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
               border-radius: 16px; resize: none; overflow: hidden; line-height: 1.5; }
.text-hint { margin: -4px 4px 12px; }
.field--tools { position: relative; }
.toolbar { position: absolute; top: -10px; right: 0; z-index: 3; display: flex; gap: 6px; margin: 0;
           opacity: 0; transform: translateY(4px); pointer-events: none;
           transition: opacity var(--ease), transform var(--ease); }
.toolbar--show { opacity: 1; transform: none; pointer-events: auto; }
.toolbar .tool { flex: none; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600;
                 -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }

/* Область загрузки и предпросмотра — одна: плавная смена «пусто» → готовый пост */
.upload__img { transition: opacity 250ms ease-out; }
.upload--empty .upload__img { opacity: 0; }
.upload:not(.upload--empty) .upload__skel { background: var(--hover); opacity: 0.6; }

/* Строка прогресса загрузки файла: полоса и подпись поверх области предпросмотра */
.upload__progress { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2; padding: 10px 12px; border-radius: 14px;
                    background: var(--bg2); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
                    border: 1px solid var(--line); pointer-events: none; }
.upload__progress[hidden] { display: none; }
.upload__track { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.upload__fill { height: 100%; width: 0; border-radius: 3px; background: var(--accent); transition: width 160ms ease-out; }
.upload__plabel { margin-top: 7px; font-size: 13px; font-weight: 600; text-align: center; color: var(--text); }
.upload__progress--busy .upload__fill { animation: pulse 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .upload__progress--busy .upload__fill { animation: none; } .upload__fill { transition: none; } }

/* Кнопки ведомств над сеткой макетов */
.dept-bar { margin: 0 0 14px; }
.dept-bar[hidden] { display: none; }
.dept-bar__label { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text2); }

/* Выбор битрейта карточками: число, подпись качества, размер файла */
.bitrate { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 8px; }
.bitrate__opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px 10px;
                border-radius: 16px; border: 1px solid var(--line); background: var(--glass-soft); color: var(--text); font: inherit;
                cursor: pointer; transition: transform var(--ease), background var(--ease), border-color var(--ease), box-shadow var(--ease);
                -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); }
.bitrate__opt:active { transform: scale(0.97); }
.bitrate__opt:disabled { cursor: default; opacity: 0.6; }
.bitrate__opt:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.bitrate__opt.on { border-color: var(--text); background: var(--hover); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }
.bitrate__opt.on::after { content: "✓"; position: absolute; top: 6px; right: 8px; font-size: 12px; font-weight: 700; }
.bitrate__num { font-size: 22px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.bitrate__unit { font-size: 11px; color: var(--text2); }
.bitrate__hint { margin-top: 4px; font-size: 12px; font-weight: 600; }
.bitrate__size { font-size: 11px; color: var(--text2); }
.bitrate__now { margin-top: 3px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; background: var(--text); color: var(--bg); }
@media (prefers-reduced-motion: reduce) { .bitrate__opt { transition: none; } }

/* Окно хода долгой задачи (рендер видео): карточка по центру поверх затемнения */
.job { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center;
       padding: 16px; background: rgba(0, 0, 0, 0.45); }
.job__card { width: min(360px, 100%); padding: 18px 16px; border-radius: 18px; background: var(--bg2); border: 1px solid var(--line); }
.job__title { margin-bottom: 12px; font-size: 16px; font-weight: 700; color: var(--text); text-align: center; }
.job__steps { display: flex; flex-direction: column; gap: 10px; }
.job__step { opacity: 0.55; }
.job__step--now, .job__step--done { opacity: 1; }
.job__step-name { margin-bottom: 5px; font-size: 13px; font-weight: 600; color: var(--text); }
.job__step--done .job__step-name { color: var(--text2); }
.job__label { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--text2); text-align: center; }

/* Нижняя панель действий: приклеена к низу, одна строка кнопок, при нехватке места — прокрутка вбок */
#bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; }
.actions { display: flex; flex-direction: row; align-items: center; gap: 10px; margin: 0;
           padding: 8px max(10px, calc((100% - 760px) / 2 + 10px)) calc(8px + env(safe-area-inset-bottom, 0px));
           overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none;
           border-top: 1px solid var(--line);
           background: rgba(247, 247, 248, 0.82); box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.04);
           -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
.actions::-webkit-scrollbar { display: none; }
body.has-bar .view { padding-bottom: calc(var(--bar-h, 80px) + 20px); }
body.has-bar .toast { bottom: calc(var(--bar-h, 80px) + 12px); }
html[data-theme="dark"] .actions { background: rgba(10, 10, 10, 0.78); box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.3); }
@media (prefers-color-scheme: dark) { html:not([data-theme]) .actions { background: rgba(10, 10, 10, 0.78); box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.3); } }
.actions__row { display: contents; }   /* кнопки всех рядов встают в одну строку в прежнем порядке */
.actions .btn, .actions .actions__row .btn, .actions .actions__row--main .btn:first-child {
  flex: 0 0 auto; width: auto; height: 60px; padding: 0 24px; font-size: 16px; font-weight: 600;
  border-radius: 999px; white-space: nowrap; }
/* вторичные кнопки панели — как кнопки панели форматирования: стекло, тонкая рамка, размытие, пилюля */
.actions .btn--soft, .actions .btn--ghost, .actions .btn--danger {
  background: var(--glass-soft); border-color: var(--line);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.actions .btn--ghost { color: var(--text); }
/* Компактная панель редакторов и мастеров: две кнопки в одну строку по 50%, без прокрутки.
   Панель создания поста (.actions без этого класса) остаётся прежней. */
.actions.editor-bottom-bar { gap: 8px; padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
                             overflow: visible; }
.actions.editor-bottom-bar .btn { flex: 1 1 0; min-width: 0; height: 44px; padding: 0 16px; font-size: 14px;
                                  white-space: normal; line-height: 1.15; }
body.has-bar .view { padding-bottom: calc(var(--bar-h, 60px) + 20px); }
.pill { border-radius: 999px; }
.btn--pill { border-radius: 999px; }
@media (prefers-reduced-transparency: reduce) {
  .actions, .glass-input, .upload, .chip { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .actions { background: var(--bg); }
}

/* ----- Этап 3: единые компоненты админки ----- */
/* Шапка страницы */
.phead { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.phead__text { flex: 1; min-width: 0; }
.phead .page-title { margin: 0; word-break: break-word; }
.phead .caption { margin-top: 2px; }
.phead > .btn { width: auto; flex: none; padding: 8px 16px; }
.phead__back { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass);
               display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
               transition: transform 100ms ease-out, background var(--ease); }
.phead__back:active { transform: scale(0.94); }
.phead__arrow { width: 9px; height: 9px; border-left: 2px solid var(--text); border-bottom: 2px solid var(--text);
                transform: rotate(45deg); margin-left: 3px; }
.phead--user .avatar--lg { flex: none; }

/* Карточки списков */
.cards { display: flex; flex-direction: column; gap: var(--gap-card); margin-bottom: var(--gap-card); }
.cards.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ccard { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--card-glass);
         border: 1px solid var(--line); border-radius: 16px;
         transition: border-color var(--ease), transform 100ms ease-out; }
.ccard--tap { cursor: pointer; }
.ccard--tap:active { transform: scale(0.98); }
@media (hover: hover) { .ccard--tap:hover { border-color: var(--line-hover); } }
.ccard__icon { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line);
               display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 17px; }
.ccard__main { flex: 1; min-width: 0; }
.ccard__title { font-size: 17px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.ccard__sub { font-size: 13px; color: var(--text2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.ccard__aside { flex: none; font-size: 13px; color: var(--hint); white-space: nowrap; max-width: 40%; overflow: hidden;
                text-overflow: ellipsis; }
.ccard--tile { align-items: flex-start; }
.cards > * { animation: rise 300ms ease-out both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fmt { display: block; width: 20px; height: 20px; border: 1.5px solid currentColor; border-radius: 4px; }
.fmt--vertical { width: 16px; height: 22px; }

/* Поля форм */
.field--u > label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; margin-left: 2px; }
.helper { display: block; font-size: 13px; color: var(--hint); margin: 6px 2px 0; }
.toggle-row { cursor: pointer; }
.toggle-row__text { flex: 1; min-width: 0; font-size: 15px; }
.toggle-row .helper { margin-top: 2px; }

/* Мастер */
.wizard__top { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.wizard__top .steps { flex: 1; margin: 0; }
.wizard__count { font-size: 13px; color: var(--hint); font-variant-numeric: tabular-nums; }
.wizard__title { font-size: 20px; font-weight: 600; margin-bottom: 12px; }
.wizard__nav { align-items: center; }
.steps__dot--on { background: var(--accent); }

/* Плавающая кнопка «+» */
.fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 7; width: 56px; height: 56px;
       border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text); cursor: pointer;
       box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22); transition: transform 100ms ease-out, opacity var(--ease); }
.fab:active { transform: scale(0.94); }
@media (hover: hover) { .fab:hover { opacity: 0.9; } }
.fab__plus { position: absolute; inset: 0; }
.fab__plus::before, .fab__plus::after { content: ""; position: absolute; background: var(--accent-text); border-radius: 1px; }
.fab__plus::before { left: 19px; right: 19px; top: 27px; height: 2px; }
.fab__plus::after { top: 19px; bottom: 19px; left: 27px; width: 2px; }
.view:has(.fab) { padding-bottom: 96px; }

/* Модальные окна */
.sheet__handle { height: 20px; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; }
.sheet__handle::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--line-hover); }
.sheet__title { font-size: 17px; font-weight: 600; margin: 0 40px 12px 2px; }
.sheet__close { position: absolute; top: 14px; right: var(--side); width: 32px; height: 32px; border-radius: 50%;
                border: 1px solid var(--line); background: var(--glass); color: var(--text); font: inherit; font-size: 20px;
                line-height: 1; padding: 0 0 2px; cursor: pointer; }
@media (min-width: 700px) {
  .sheet { align-items: center; }
  .sheet__panel { max-width: 520px; border-radius: 20px; padding-bottom: 16px; }
  .sheet__handle { display: none; }
  .sheet__panel > .sheet__title { margin-top: 12px; }
  .sheet__close { top: 12px; }
}
.sheet--center { align-items: center; padding: 0 var(--side); }
.dialog { background: var(--surface); width: 100%; max-width: 340px; border-radius: 20px; padding: 20px;
          border: 1px solid var(--line); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); animation: rise 200ms ease-out both; }
.dialog__title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.dialog__text { font-size: 15px; color: var(--text2); word-break: break-word; }
.dialog__btns { display: flex; gap: var(--gap-el); justify-content: flex-end; margin-top: 18px; }
.dialog__btns .btn { width: auto; padding: 11px 18px; }
.cp-panel { border-radius: 20px 20px 0 0; }

/* Редактор макета и списки действий */
.editor__frame { background: var(--glass-soft); border: 1px solid var(--line); border-radius: 20px;
                 -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.thumb { border: 1px solid var(--line); border-radius: 16px; background: var(--card-glass); }
.thumb__actions { padding: 0 12px 12px; }
.thumb__actions .btn { padding: 8px 14px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .cards > *, .dialog { animation: none; } }

/* ----- Ссылки для предложки и канал персональной ссылки ----- */
.linkrow { padding: 12px 0; }
.linkrow + .linkrow { border-top: 1px solid var(--line); }
.linkrow:first-child { padding-top: 0; }
.linkrow:last-child { padding-bottom: 0; }
.linkrow__head { display: flex; align-items: center; gap: 12px; }
.linkrow__copy { width: auto; flex: none; padding: 8px 14px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.linkrow__url { display: block; margin-top: 8px; font: 12px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
                color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.icon-copy { position: relative; width: 11px; height: 13px; border: 1.5px solid currentColor; border-radius: 2px; display: inline-block; }
.icon-copy::before { content: ""; position: absolute; left: 3px; top: -4px; width: 8px; height: 10px; border: 1.5px solid currentColor;
                     border-radius: 2px; border-left: 0; border-bottom: 0; }
.bound-chip { display: inline-block; margin: 0 0 16px; padding: 8px 14px; border-radius: 999px; background: var(--glass);
              border: 1px solid var(--line); font-size: 13px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
              white-space: nowrap; }

/* ----- Клавиатура открыта: нижние панели прячутся, а не поднимаются ----- */
.actions, .fab { transition: opacity 150ms ease-out; }
body.keyboard-open .actions, body.keyboard-open .sticky-bottom, body.keyboard-open .fab {
  opacity: 0; pointer-events: none; }

/* ----- Имя в профиле ----- */
.profile__info { flex: 1; min-width: 0; }
.nameedit__view { display: flex; align-items: baseline; gap: 8px; border: 0; background: transparent; color: var(--text);
                  font: inherit; padding: 0; cursor: pointer; text-align: left; max-width: 100%; }
.nameedit__view .profile__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nameedit__hint { font-size: 12px; color: var(--hint); flex: none; }
.nameedit__btns { display: flex; gap: var(--gap-el); margin-top: 8px; }
.nameedit__btns .btn { width: auto; padding: 8px 16px; font-size: 13px; }

.actions__row--main .btn:first-child { flex: 2; }

/* ----- Клавиатура открыта: без «поплывших» текстур ----- */
/* шапка не липнет (на iOS липкий элемент дёргается при смене visualViewport), стекло и градиент не перерисовываются */
body.keyboard-open .top { position: static; }
body.keyboard-open *, body.keyboard-open *::before, body.keyboard-open *::after {
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
body.keyboard-open::before { display: none; }
body.keyboard-open .top.scrolled .head, body.keyboard-open .top.scrolled .tabs { background: var(--bg); }
/* окна: по высоте видимой области, без отступа под нижнюю «чёлку» */
body.keyboard-open .sheet { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100%); }
html.sheet-open, html.sheet-open body { overflow: hidden; overscroll-behavior: none; }
.sheet { touch-action: none; overscroll-behavior: contain; }   /* затемнённый фон не прокручивает страницу */
.sheet__panel { touch-action: pan-y; overscroll-behavior: contain; }
body.keyboard-open .sheet__panel, body.keyboard-open .cp-panel {
  max-height: calc(var(--vvh, 50vh) - 16px); overflow-y: auto; padding-bottom: 16px; }
body.keyboard-open .cp-overlay { bottom: auto; height: var(--vvh, 100%); }

/* ----- Пользователи: поиск, вкладки-пилюли, сортировка ----- */
.filterbar { display: flex; align-items: center; gap: var(--gap-el); flex-wrap: wrap; margin-bottom: var(--gap-card); }
.filterbar__tabs { flex: 1 1 240px; min-width: 0; }
.seg--pill { border-radius: 999px; }
.seg--pill .seg__hl, .seg--pill button { border-radius: 999px; }
.seg--pill button { padding: 8px 12px; }
.sort-select { width: auto; flex: 0 0 auto; padding: 8px 12px; font-size: 13px; border-radius: 999px; }
.ccard--round .ccard__icon { border-radius: 50%; }
.ccard__title .badge { margin-left: 6px; }

/* ----- Подпись: форматирование и быстрые тексты ----- */
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
.cap-head label { margin: 0 !important; }
.cap-snippets { width: auto; flex: none; padding: 6px 12px; font-size: 13px; }
.ctools { display: flex; gap: 6px; margin-bottom: 8px; position: static;
          padding: 4px; border-radius: 999px; background: var(--glass-soft); border: 1px solid var(--line);
          -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); width: fit-content; max-width: 100%; overflow-x: auto; }
.ctool { flex: none; min-width: 36px; height: 32px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent;
         color: var(--text); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: background var(--ease), transform 100ms ease-out; }
.ctool:hover { background: var(--hover); }
.ctool:active { transform: scale(0.94); }
.ctool--i { font-style: italic; font-weight: 600; } .ctool--u { text-decoration: underline; } .ctool--s { text-decoration: line-through; }
.ctool--code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 600; font-size: 12px; }
.counter--over { color: var(--danger); }
.cap-preview { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--glass-soft); border: 1px solid var(--line);
               font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.cap-preview[hidden] { display: none; }
.cap-preview a { color: var(--text); text-decoration: underline; }
.cap-preview code { font-family: ui-monospace, "SF Mono", Menlo, monospace; background: var(--glass); padding: 0 4px; border-radius: 4px; }
.snip { padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card-glass); cursor: pointer;
        transition: border-color var(--ease), transform 100ms ease-out; }
.snip:active { transform: scale(0.985); }
.snip__title { font-size: 15px; font-weight: 600; }
.snip__text { font-size: 13px; color: var(--text2); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.snip--row { display: flex; align-items: center; gap: 10px; cursor: default; flex-wrap: wrap; }
.snip__main { flex: 1 1 160px; min-width: 0; }
.snip--row .row-actions .btn { padding: 6px 12px; font-size: 13px; }
.cap-head label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; margin-left: 2px; color: var(--hint); }
/* В окнах панель форматирования — обычный блок: прокручивается вместе с содержимым */
.sheet .ctools, .cp-overlay .ctools { position: static; top: auto; }

.snip-tabs:not(:empty) { margin-bottom: var(--gap-card); }

/* ----- «Создать пост»: поля с подсказкой внутри, редактор подписи, карточки макетов ----- */
.glass-input { padding: 16px; font-size: 16px; line-height: 1.5; border-radius: 16px; }
.glass-input::placeholder { color: var(--hint); opacity: 1; }
/* Поле с неизменяемой надписью слева (и справа): «WHAT'S ON | ник артиста» */
.prefix-field { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
                background: var(--glass-soft); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.prefix-field:focus-within { border-color: var(--accent, var(--text2)); }
.prefix-field__fixed { display: flex; align-items: center; padding: 0 12px 0 16px; font-size: 16px; font-weight: 700; letter-spacing: .04em;
                       text-transform: uppercase; white-space: nowrap; color: var(--text2); background: rgba(255, 255, 255, .07);
                       border-right: 1px solid var(--line); user-select: none; -webkit-user-select: none; cursor: default; }
.prefix-field__fixed--end { border-right: 0; border-left: 1px solid var(--line); padding: 0 16px 0 12px; }
.prefix-field .glass-input { flex: 1; min-width: 0; min-height: 0; border: 0; border-radius: 0; background: transparent; padding: 14px 14px 14px 12px;
                             -webkit-backdrop-filter: none; backdrop-filter: none; }
.prefix-field .glass-input:focus { outline: none; }
.rich { display: block; width: 100%; min-height: calc(3 * 1.5em + 32px); border: 1px solid var(--line); background: var(--glass-soft);
        color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; outline: none; -webkit-user-select: text; user-select: text;
        transition: border-color var(--ease); }
.rich:focus { border-color: var(--text); }
.rich:empty::before { content: attr(data-placeholder); color: var(--hint); pointer-events: none; }
.rich a { color: inherit; text-decoration: underline; }
.rich code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.ctools { margin-bottom: 8px; }
.cap-snippets { width: 100%; margin-bottom: 8px; padding: 12px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.icon-snip { position: relative; width: 12px; height: 15px; border: 1.5px solid currentColor; border-radius: 2px; display: inline-block; }
.icon-snip::before { content: ""; position: absolute; left: 2px; right: 2px; top: 3px; height: 1.5px; background: currentColor; box-shadow: 0 3px 0 currentColor; }
.accent-bar { display: flex; gap: var(--gap-el); margin-bottom: var(--gap-el); }
.accent-bar:empty { display: none; }
.accent-bar .tool { flex: none; border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600; }
.tcard { flex: none; width: 112px; height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
         padding: 10px 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--glass); color: var(--text); font: inherit; cursor: pointer;
         transition: background var(--ease), color var(--ease), border-color var(--ease), transform 100ms ease-out; }
.tcard:active { transform: scale(0.97); }
.tcard__art { height: 44px; display: flex; align-items: center; justify-content: center; }
.tcard__name { font-size: 14px; font-weight: 600; line-height: 1.2; text-align: center; max-width: 100%; overflow: hidden;
               display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tcard__tag { font-size: 11px; opacity: 0.6; }
.tcard.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.fmt--none { border-style: dashed; opacity: 0.6; }
.chip { height: 40px; padding: 0 18px; }

/* ----- Подпись: одна строка кнопок, подпись не прячет нижнюю панель ----- */
.ctools { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.ctools::-webkit-scrollbar { display: none; }
.ctool--snip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.rich { scroll-margin: calc(var(--top-h, 100px) + 16px) 0 24px; }

/* ----- «Куда публикуем»: ведомство и канал (только чтение или список) ----- */
.where > div + div { border-top: 1px solid var(--line); }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; font-size: 15px; min-height: 48px; }
.info-row__k { color: var(--hint); flex: none; }
.info-row__v { text-align: right; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.info-select { width: auto; max-width: 70%; flex: 1; padding: 8px 12px; font-size: 15px; font-weight: 600; border-radius: 999px; text-align: right; }

/* ----- Единые строки «Ведомство» / «Канал» ----- */
.info-row, .info-row__k, .info-row__v, .info-select { font-family: inherit; font-size: 15px; line-height: 1.4; }
.info-row__k { font-size: 16px; font-weight: 600; color: var(--text); }
.info-row__v, .info-select { font-size: 14px; font-weight: 400; color: var(--text2); }
.info-row--tap { cursor: pointer; }
.info-row--tap .chev { flex: none; }

/* ----- Панель форматирования: обычный блок потока над полем, без sticky и fixed ----- */
.field > .ctools { position: static; }
.field:focus-within > .ctools { position: static; }   /* панель — обычный блок над полем: не прилипает и не прыгает */

/* ----- Окно «Быстрые тексты» ----- */
.snip-modal { display: flex; flex-direction: column; gap: 12px; }
.snip-modal .snip-tabs:empty { display: none; }
.snip-list { display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.snip-card { border: 1px solid var(--line); border-radius: 16px; background: var(--card-glass); overflow: hidden;
             transition: border-color var(--ease); }
@media (hover: hover) { .snip-card:hover { border-color: var(--line-hover); } }
.snip-card__row { display: flex; align-items: flex-start; gap: 8px; padding: 14px 8px 14px 16px; cursor: pointer; transition: background 100ms ease-out; }
.snip-card__row:active { background: var(--hover); }
.snip-card__main { flex: 1; min-width: 0; }
.snip-card__title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.snip-card__text { font-size: 14px; color: var(--text2); margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.snip-card__more { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--text2);
                   font-size: 22px; line-height: 1; cursor: pointer; }
.snip-card__more:active { background: var(--hover); }
.snip-card__actions { display: flex; gap: 8px; padding: 0 16px 14px; }
.snip-card__actions[hidden] { display: none; }
.snip-card__actions .btn { width: auto; flex: 1; padding: 8px 12px; font-size: 13px; }
.snip-footer { position: sticky; bottom: -16px; margin: 4px -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
               background: var(--surface); border-top: 1px solid var(--line); z-index: 2; }
.sheet .field:focus-within > .ctools { position: static; }

/* ----- Пары «подпись — значение»: подпись жирная, значение приглушено ----- */
.kv dt { color: var(--text); font-size: 15px; font-weight: 600; }
.kv dd { color: var(--text2); font-size: 14px; font-weight: 400; }

/* ----- Входящие новости: пузыри как в Telegram ----- */
.chat { gap: 12px; }
.msg { align-items: flex-end; gap: 10px; }
.bubble { background: var(--card-glass); border: 1px solid var(--line); border-radius: 18px; padding: 12px 16px; min-width: 0;
          max-width: min(80%, calc(100% - 46px)); }
.msg .avatar { background: var(--accent); color: var(--accent-text); }
.msg__top { display: flex; align-items: baseline; gap: 8px; }
.msg__name { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__time { flex: none; font-size: 12px; color: var(--hint); }
.msg__more { flex: none; width: 28px; height: 28px; margin: -4px -8px -4px 0; border: 0; border-radius: 50%; background: transparent; color: var(--text2);
             font-size: 20px; line-height: 1; cursor: pointer; }
.msg__more:active { background: var(--hover); }
.msg__channel { font-size: 12px; color: var(--hint); margin: 2px 0 6px; }
.msg__media { border-radius: 14px; }
.msg__video { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; padding: 14px; border-radius: 14px; background: var(--glass);
              border: 1px solid var(--line); font-size: 13px; color: var(--text2); }
.msg__play { width: 0; height: 0; border-left: 10px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.msg__foot { justify-content: flex-end; margin-top: 8px; }

/* ----- База изображений ----- */
.cat-card { gap: 12px; }
.cat-thumb { flex: none; width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--glass); border: 1px solid var(--line); }
.cat-thumb--ph { display: flex; align-items: center; justify-content: center; color: var(--hint); }
.icon-img { position: relative; width: 22px; height: 18px; border: 1.5px solid currentColor; border-radius: 4px; display: inline-block; }
.icon-img::before { content: ""; position: absolute; left: 3px; top: 3px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.icon-img::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 2px; height: 5px; border-bottom: 1.5px solid currentColor; transform: skewY(-18deg); }
.cat-card .snip-card__more { flex: none; }
.imggrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
@media (min-width: 560px) { .imggrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .imggrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.itile { position: relative; cursor: pointer; transition: transform 100ms ease-out; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.itile:active { transform: scale(0.98); }
.itile__art { aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: var(--glass); border: 1px solid var(--line); }
.itile__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.itile__name { margin-top: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.itile__more { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; background: var(--card-glass);
               color: var(--text); font-size: 18px; line-height: 1; padding: 0 0 3px; cursor: pointer;
               -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.viewer__img { display: block; width: 100%; max-height: 58vh; object-fit: contain; border-radius: 12px; background: var(--glass); margin-bottom: 12px; }
.viewer__tags { margin: -4px 2px 12px; }
.upload-mini { max-width: none; aspect-ratio: 16 / 10; margin: 0; }

/* ----- Сетки не выходят за экран: колонки minmax(0, 1fr), у ячеек min-width: 0, ничего не задано в пикселях ----- */
.grid, .cards.grid, .imggrid, .statgrid { width: 100%; max-width: 100%; box-sizing: border-box; }
.grid > *, .cards.grid > *, .imggrid > *, .statgrid > *, .cards > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
.ccard--tile .ccard__main { min-width: 0; }

.view { overflow-x: clip; }   /* clip, а не hidden: hidden сделал бы страницу контейнером прокрутки и сломал липкие панели */

/* ----- Плитки ведомств («База изображений»): значок сверху, название в 2 строки, подпись по строкам ----- */
.ccard--tile { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px; }
.ccard--tile .ccard__main { width: 100%; }
.ccard--tile .ccard__title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
                             font-size: 15px; overflow-wrap: break-word; word-break: normal; hyphens: auto; }
.ccard--tile .ccard__sub { font-size: 13px; }
.tile-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccard--tile .chev { display: none; }
.itile__name { padding: 0 2px; text-align: left; }

/* ----- Мои посты: сетка карточек ----- */
.cards.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .cards.pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .cards.pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pcard { min-width: 0; padding: 8px; border-radius: 16px; background: var(--card-glass); cursor: pointer; transition: transform 100ms ease-out; }
.pcard:active { transform: scale(0.98); }
.pcard__art { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: var(--glass); }
.pcard__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pcard__ph { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--hint); font-size: 13px; }
.pcard__badge { position: absolute; top: 6px; left: 6px; max-width: calc(100% - 12px); padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
                background: var(--card-glass); color: var(--text); border: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
                -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.pcard__title { margin: 8px 2px 0; font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
                overflow: hidden; overflow-wrap: break-word; }
.pcard__date { margin: 2px 2px 2px; font-size: 12px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pgrid + * , .seg--pill + .cards { margin-top: var(--gap-card); }

/* ----- Карточки — стекло: полупрозрачный фон, размытие, рамка (кнопки и поля не затронуты) ----- */
.card, .list, .ccard, .pcard, .snip-card, .snip, .bubble, .thumb {
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
@media (prefers-reduced-transparency: reduce) {
  .card, .list, .ccard, .pcard, .snip-card, .snip, .bubble, .thumb { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
}
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ----- Аватар цитаты: квадрат слева, кнопки справа от него ----- */
.avatar-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.avatar-pick { position: relative; flex: none; width: 80px; height: 80px; border-radius: 12px; padding: 0; overflow: hidden;
               border: 1px dashed var(--line); background: var(--glass); color: var(--hint); cursor: pointer;
               display: flex; align-items: center; justify-content: center; }
.avatar-pick--filled { border: 1px solid var(--line); }
.avatar-pick__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-pick__plus { width: 28px; height: 28px; background:
  linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
  linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat; opacity: 0.7; }
.avatar-pick--filled .avatar-pick__plus { display: none; }
.avatar-btns { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.avatar-btns .btn { width: auto; padding: 7px 16px; font-size: 14px; min-height: 0; }
.avatar-btns .btn[hidden] { display: none; }

/* ----- Шахматная доска под предпросмотром в редакторе макета (CSS, без файла) ----- */
.template-preview {
  background-color: #f0f0f0;
  background-image:
    linear-gradient(45deg, #ddd 25%, transparent 25%),
    linear-gradient(-45deg, #ddd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd 75%),
    linear-gradient(-45deg, transparent 75%, #ddd 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  border-radius: 12px;
}
html[data-theme="dark"] .template-preview {
  background-color: #1a1a1a;
  background-image:
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .template-preview {
    background-color: #1a1a1a;
    background-image:
      linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
      linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
      linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
  }
}
.editor__frame.template-preview { border-radius: 20px; }

/* ----- Страница «Создать пост»: разделы в карточках, компактные отступы ----- */
.section-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
                padding: 16px; margin-bottom: 16px; }
.section-card .label { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--hint); }
.section-card .label:not(:first-child) { margin-top: 12px; }
.section-card .field, .section-card .list, .section-card .chips { margin-bottom: 10px; }
.section-card > :last-child, .section-card > :last-child > :last-child { margin-bottom: 0; }
.section-card [hidden] { display: none; }

/* ----- «Настройка положений» на странице создания поста ----- */
.pos-group + .pos-group { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.pos-group__title { font-size: 14px; font-weight: 700; color: var(--hint); margin-bottom: 6px; }
.pos-group .caption { margin-bottom: 6px; }
.section-card[hidden] { display: none; }

/* ----- Аудио: список и карточка трека ----- */
.audio-cover { display: flex; flex: none; align-items: center; justify-content: center; overflow: hidden;
               background: var(--glass-soft); border: 1px solid var(--line); border-radius: 12px; }
.audio-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.audio-cover--sm { width: 56px; height: 56px; }
.audio-cover--lg { width: min(100%, 320px); aspect-ratio: 1 / 1; margin: 0 auto 16px; border-radius: 20px; }
.audio-cover__ph { width: 40%; height: 40%; opacity: 0.35; background: var(--hint);
                   -webkit-mask: radial-gradient(circle at 30% 75%, #000 0 22%, transparent 23%) , linear-gradient(#000, #000) 55% 15% / 12% 60% no-repeat;
                   mask: radial-gradient(circle at 30% 75%, #000 0 22%, transparent 23%), linear-gradient(#000, #000) 55% 15% / 12% 60% no-repeat; }
.audio-card { gap: 12px; }

/* ----- Аудио: обложка-кнопка, водяной знак ----- */
.audio-cover { position: relative; }
.audio-cover--btn { cursor: pointer; }
.audio-cover__edit { position: absolute; inset: auto 0 0 0; padding: 10px; text-align: center; font-size: 14px; font-weight: 600; color: #fff;
                     background: linear-gradient(transparent, rgba(0, 0, 0, 0.55)); opacity: 0; transition: opacity 150ms; }
.audio-cover--btn:hover .audio-cover__edit, .audio-cover--btn:focus-visible .audio-cover__edit { opacity: 1; }
@media (hover: none) { .audio-cover--btn .audio-cover__edit { opacity: 1; } }   /* на телефоне подсказка видна всегда */
.audio-cover--busy { opacity: 0.6; pointer-events: none; }
.audio-cover[role="button"] .audio-cover__ph { width: 30%; height: 30%; }
.seg--wrap { flex-wrap: wrap; }
.section-card .srow { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) { .seg__hl, .seg button { transition: none; } }

/* кнопка с идущей операцией: спиннер, приглушена, нажать нельзя */
.btn--loading, .btn--loading:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px;
                        border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
                        animation: btn-spin 700ms linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn--loading::before { animation-duration: 2s; } }

/* ----- Маленькая стеклянная кнопка «Изменить» (имя в профиле) ----- */
.btn-edit-small { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 6px 12px; border-radius: 999px;
                  background: rgba(0, 0, 0, 0.04); border: 1px solid rgba(0, 0, 0, 0.08); color: var(--text);
                  font: inherit; font-size: 13px; font-weight: 500; line-height: 1.2; cursor: pointer;
                  transition: background 200ms, transform 100ms; }
.btn-edit-small:hover { background: rgba(0, 0, 0, 0.08); }
.btn-edit-small:active { transform: scale(0.97); }
html[data-theme="dark"] .btn-edit-small { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .btn-edit-small:hover { background: rgba(255, 255, 255, 0.12); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .btn-edit-small { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.08); }
  html:not([data-theme]) .btn-edit-small:hover { background: rgba(255, 255, 255, 0.12); }
}
.nameedit__view { align-items: center; }
.nameedit__view .profile__name { cursor: pointer; }

/* ----- Карточка профиля: просмотр и правка имени ----- */
.profile-card { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 16px; }
.profile-card__body { animation: profile-fade 200ms ease-out; }
.profile-card__row { display: flex; align-items: center; gap: 12px; }
.profile-card__row .avatar--lg { flex: none; width: 64px; height: 64px; }
.profile-card__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.profile-card__input { flex: 1; min-width: 0; padding: 12px; font-size: 16px; border-radius: 12px; }
.profile-card .helper { margin: 8px 2px 0; font-size: 13px; color: var(--hint); }
.profile-card__btns { display: flex; gap: 8px; margin-top: 12px; }
.profile-card__btns .btn { width: auto; }
.profile-card__btns .profile-card__save { flex: 1; }
.profile-card__btns .btn--ghost { flex: 0 0 auto; padding-left: 20px; padding-right: 20px; }
.profile-card__info { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--hint);
                      display: grid; gap: 4px; }
@keyframes profile-fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .profile-card__body { animation: none; } }

/* ----- Редактор строк инфографики (список, таблица, рейтинг) при создании поста ----- */
.info-box { margin-top: 4px; }
.info-box[hidden] { display: none; }
.info-head { margin: 4px 0 10px; }
.info-head__count { font-size: 14px; font-weight: 700; color: var(--text); }
.info-head__count--over { color: var(--danger); }
.info-btn { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass-soft);
            color: var(--text); font-size: 16px; line-height: 1; cursor: pointer; }
.info-btn:disabled { opacity: .35; cursor: default; }
.info-btn--danger { color: var(--danger); }
.info-hint { margin-top: 6px; font-size: 12px; }

/* Компактные строки: номер слева, поля, кнопки справа; на телефоне ячейка таблицы — одна линия «заголовок | подпись» */
.irow-wrap { position: relative; margin-bottom: 8px; border-radius: var(--r-card); overflow: hidden;
             transition: transform 150ms ease-out; }
.irow-wrap__del { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end;
                  padding-right: 22px; font-size: 14px; font-weight: 600; color: #fff; background: var(--danger); opacity: 0; }
.irow-wrap--swipe .irow-wrap__del { opacity: var(--swipe, 0); }
.irow-wrap--swipe .info-card { background: var(--bg2); }   /* непрозрачная, чтобы красная подложка не просвечивала */
.irow-wrap--drag { z-index: 5; transition: none; overflow: visible; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25); }
.irow-wrap--drag .info-card { background: var(--bg2); }
.info-box--dragging { user-select: none; -webkit-user-select: none; }
.info-card.irow { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start;
                  padding: 8px; background: var(--card-glass); border: 1px solid var(--line);
                  border-radius: var(--r-card); touch-action: pan-y; }   /* вертикальная прокрутка — браузеру, смахивание — нам */
.irow--gone { transition: transform 150ms ease-in; }
.irow--heading { background: var(--glass-soft); }
.irow__num { min-width: 22px; padding-top: 11px; text-align: center; font-size: 13px; font-weight: 700; color: var(--hint); }
.irow__num--mark { font-size: 16px; }
.irow .irow__input { width: 100%; min-height: 40px; padding: 8px 10px; font-size: 16px; line-height: 1.3; border-radius: 10px; }
.irow .irow__numinput { width: 52px; padding: 8px 4px; text-align: center; }
.irow__field { position: relative; min-width: 0; }
.irow__counter { position: absolute; right: 8px; bottom: 2px; font-size: 10px; line-height: 1; color: var(--hint); pointer-events: none; }
.irow__counter[hidden] { display: none; }
.irow__counter--full { color: var(--danger); }
.irow__main { display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
.irow__fields { display: grid; gap: 6px; flex: 1 1 auto; min-width: 0; }
.irow__cells { display: grid; gap: 6px; min-width: 0; }
.irow__cell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
@media (min-width: 600px) {
  .irow__cells { grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); gap: 8px; }
  .irow__cell { grid-template-columns: minmax(0, 1fr); }
}
.irow__tools { display: grid; justify-items: center; gap: 4px; }
.irow .info-btn { width: 30px; height: 28px; border-radius: 8px; font-size: 16px; }
.irow .irow__handle { width: 34px; height: 34px; font-size: 18px; cursor: grab; touch-action: none; user-select: none;
                      -webkit-user-select: none; }
.irow-wrap--drag .irow__handle { cursor: grabbing; }
.irow .irow__heart { font-size: 18px; color: var(--text2); }
.irow .irow__heart--on { color: #ff5c7a; border-color: #ff5c7a; background: rgba(255, 92, 122, .14); }
.info-undo { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin: 0 0 8px;
             padding: 4px 6px 4px 14px; font-size: 14px; color: var(--text2); background: var(--glass-soft);
             border: 1px solid var(--line); border-radius: var(--r-card); }
.info-undo__btn { min-height: 36px; padding: 0 14px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text);
                  background: var(--glass); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.irow__icon { flex: none; }
.irow__thumb { position: relative; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
               padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--glass-soft);
               font: inherit; font-size: 22px; color: var(--hint); cursor: pointer; }
.irow__thumb--empty { border: 1px dashed var(--hint); }
.irow__thumb:disabled { cursor: default; }
.irow__img { width: 100%; height: 100%; object-fit: cover; }
.irow__progress { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
                  font-size: 11px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.45); }

/* ---------- Макет с блоком «Код»: поля формы поста ---------- */
.glass-input--code { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 14px; line-height: 1.5; white-space: pre; overflow: auto; tab-size: 2; }
input.glass-input--code { white-space: normal; }
.glass-input--error { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; line-height: 1.35; margin: 6px 4px 0; }
.field-error[hidden] { display: none; }
.upload--static { cursor: default; }
.upload--stale .upload__img { opacity: 0.45; filter: grayscale(0.4); }
.code-asset { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.code-asset__thumb { width: 72px; height: 72px; object-fit: contain; border-radius: 12px;
  background: var(--glass); border: 1px solid var(--line); }
.code-asset__thumb[hidden] { display: none; }

/* ---------- Создание поста: выбор макета (шаг 1) и компактная форма (шаг 2) ---------- */
/* Экран выбора макета: заголовок, поиск (если макетов много), «Недавние», сетка карточек */
.tpl-pick__head { margin: 4px 4px 16px; }
.tpl-pick__head .page-title { margin-bottom: 4px; }
.tpl-pick__sub { margin: 0; font-size: 15px; color: var(--text2); }
.tpl-search { display: block; width: 100%; min-height: 44px; margin: 0 0 12px; padding: 10px 14px;
              font: inherit; font-size: 16px; color: var(--text); background: var(--glass-soft);
              border: 1px solid var(--line); border-radius: var(--r-field);
              -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
              transition: border-color var(--ease); }
.tpl-search:focus { outline: none; border-color: var(--line-hover); }
.tpl-search[hidden], .tpl-recent[hidden] { display: none; }
.tpl-recent { margin: 0 0 12px; }
.tpl-recent__label { margin: 0 4px 6px; font-size: 13px; color: var(--hint); }

.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap-card); }
@media (min-width: 600px) { .tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .tpl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tpl-card { display: flex; flex-direction: column; min-width: 0; padding: 0; text-align: left;
            font: inherit; color: var(--text); background: var(--card-glass);
            border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
            cursor: pointer; transition: border-color var(--ease), transform 100ms ease-out; }
.tpl-card:active { transform: scale(0.98); }
.tpl-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .tpl-card:hover { border-color: var(--line-hover); } }
.tpl-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
/* плитка: у всех макетов одна рамка 3:4 (как WEBAPP_TPL_THUMB_SIZE) на спокойной подложке в тон темы;
   пост лежит на ней целиком и по центру карточкой (скругление, рамка, тень) — квадрат и вертикаль выглядят одинаково.
   Картинка позиционируется абсолютно: проценты max-размеров считаются от плитки, а не от высоты из aspect-ratio */
.tpl-card__thumb { position: relative; width: 100%; aspect-ratio: 3 / 4; background: var(--glass);
                   display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tpl-card__img { position: absolute; inset: 8px; margin: auto; width: auto; height: auto;
                 max-width: calc(100% - 16px); max-height: calc(100% - 16px); object-fit: contain; display: block;
                 border-radius: 8px; box-shadow: 0 0 0 1px var(--line), 0 6px 16px rgba(0, 0, 0, 0.18);
                 transition: opacity var(--ease); }
.tpl-card__img[hidden] { display: none; }
/* заглушка, пока миниатюра грузится или её нет: значок формата и название на фоне */
.tpl-card__ph { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px;
                text-align: center; font-size: 13px; color: var(--hint); }
.tpl-card__ph[hidden] { display: none; }
.tpl-card__ico { font-size: 32px; line-height: 1; color: var(--text2); }
.tpl-card__thumb--loading { background: linear-gradient(100deg, var(--glass) 30%, var(--hover) 50%,
                            var(--glass) 70%); background-size: 200% 100%;
                            animation: tpl-shimmer 1.4s linear infinite; }
@keyframes tpl-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.tpl-card__body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; min-width: 0; }
.tpl-card__name { font-size: 15px; font-weight: 600; line-height: 1.25; overflow: hidden;
                  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tpl-none { grid-column: 1 / -1; padding: 36px 12px; text-align: center; color: var(--hint); }

/* Выбранный макет в форме: одна строка «название · формат · Сменить» */
.tpl-bar { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 6px 6px 14px;
           margin: 0 0 var(--gap-card); background: var(--card-glass); border: 1px solid var(--line);
           border-radius: var(--r-card); }
.tpl-bar__name { flex: 1 1 auto; min-width: 0; font-size: 16px; font-weight: 600; overflow: hidden;
                 text-overflow: ellipsis; white-space: nowrap; }
.tpl-bar__tag { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--hint); }
.tpl-bar__change { flex: none; min-height: 40px; padding: 0 16px; font: inherit; font-size: 14px;
                   font-weight: 600; color: var(--text); background: var(--glass);
                   border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
                   transition: transform 100ms ease-out, background var(--ease); }
.tpl-bar__change:active { transform: scale(0.96); }
@media (hover: hover) { .tpl-bar__change:hover { background: var(--hover); } }

/* Необязательное фото: узкая строка вместо большой области загрузки */
.photo-add { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px;
             padding: 8px 14px; margin: 0 0 var(--gap-card); font: inherit; font-size: 15px;
             font-weight: 600; color: var(--text2); text-align: left; background: var(--glass-soft);
             border: 1px dashed var(--dash); border-radius: var(--r-card); cursor: pointer;
             transition: border-color var(--ease), background var(--ease); }
.photo-add[hidden] { display: none; }
.photo-add:active { background: var(--hover); }
.photo-add__plus { flex: none; font-size: 22px; font-weight: 400; line-height: 1; color: var(--text); }
.photo-add__thumb { flex: none; width: 40px; height: 40px; object-fit: cover; border-radius: 10px; }
.photo-add__text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
                   white-space: nowrap; }
.photo-add--filled { border-style: solid; border-color: var(--line); color: var(--text); }

/* «+ Ещё»: необязательные поля (дата, верхний текст, прогресс) сворачиваются под кнопку */
.more { margin: 0 0 var(--gap-card); }
.more__toggle { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px;
                font: inherit; font-size: 15px; font-weight: 600; color: var(--text2);
                background: transparent; border: 0; cursor: pointer; }
.more__toggle::before { content: "+"; font-size: 20px; font-weight: 400; line-height: 1;
                        transition: transform var(--ease); }
.more.open .more__toggle::before { transform: rotate(45deg); }
.more__body { display: none; padding-top: 4px; }
.more.open .more__body { display: block; }
.more__body[hidden] { display: none; }

/* Нижняя панель: главная кнопка и «⋯» (остальные действия — в меню над панелью) */
.actions[hidden] { display: none; }   /* экран выбора макета: панели действий нет */
.actions.actions--compact { overflow: visible; }
/* перебивает общие правила панели (.actions .actions__row .btn и :first-child): их специфичность выше */
.actions.actions--compact .actions__row .btn { height: 52px; }
.actions.actions--compact .actions__row--main .btn.btn--main { flex: 1 1 auto; width: auto; min-width: 0; }
.actions.actions--compact .actions__row .actions__more { flex: none; width: 52px; padding: 0;
                                                            font-size: 22px; line-height: 1; }
.menu { position: fixed; z-index: 8; right: max(var(--side), calc((100% - 760px) / 2 + var(--side)));
        bottom: calc(var(--bar-h, 80px) + 8px); min-width: 220px; max-width: calc(100% - 2 * var(--side));
        padding: 6px; background: var(--surface); border: 1px solid var(--line-hover);
        border-radius: var(--r-card); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
        animation: tpl-menu-in 140ms ease-out; }
.menu[hidden] { display: none; }
.menu__item { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 14px;
              font: inherit; font-size: 15px; font-weight: 500; color: var(--text); text-align: left;
              background: transparent; border: 0; border-radius: 12px; cursor: pointer; }
.menu__item:active { background: var(--hover); }
.menu__item[disabled] { color: var(--hint); cursor: default; }
.menu__item--danger { color: var(--danger); }
@media (hover: hover) { .menu__item:not([disabled]):hover { background: var(--hover); } }
@keyframes tpl-menu-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .tpl-card__thumb--loading { animation: none; }
  .menu { animation: none; }
}
@media (prefers-reduced-motion: reduce) { .irow-wrap, .irow--gone { transition: none; } }

/* ---------- Создание поста, этап 2: липкий блок (превью + вкладки) ---------- */
/* Блок прилипает под шапкой приложения (--top-h); при открытой клавиатуре шапка не липнет, а backdrop-filter отключён
   (правила выше), поэтому блок липнет к самому верху и получает сплошной фон. */
.dock {
  --dock-max-vh: 30; --dock-mini-px: 72px; --dock-empty-px: 96px;   /* умолчания; точные значения приходят из настроек (config.py) */
  position: sticky; top: var(--top-h, 0px); z-index: 4;
  margin: 0 calc(-1 * var(--side)) 12px; padding: 8px var(--side) 0;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 247, 248, 0.82);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
html[data-theme="dark"] .dock { background: rgba(10, 10, 10, 0.78); }
@media (prefers-color-scheme: dark) { html:not([data-theme]) .dock { background: rgba(10, 10, 10, 0.78); } }
body.keyboard-open .dock { top: 0; background: var(--bg); }

/* сцена: превью по центру, кнопки поверх её правого края */
.dock__stage { position: relative; display: flex; justify-content: center; margin-bottom: 8px; }
/* ширину задаёт соотношение сторон макета (его ставит JS) при заданной высоте */
.dock .upload { width: auto; max-width: 100%; height: calc(var(--dock-max-vh) * 1vh); margin: 0; border-radius: 14px;
                transition: height 150ms ease-out; }
/* пока фото нет, область широкая и невысокая: удобно попасть пальцем (!important перебивает aspect-ratio, заданный JS в style) */
.dock .upload--empty { width: 100%; height: var(--dock-empty-px); aspect-ratio: auto !important; }
.dock--mini .upload, body.keyboard-open .dock .upload { height: var(--dock-mini-px); }
.dock .upload:not(.upload--empty) { cursor: zoom-in; }   /* готовое превью открывается на весь экран */
.dock__btn { position: absolute; right: 6px; z-index: 3; width: 32px; height: 32px; padding: 0; border-radius: 50%;
             border: 1px solid var(--line); background: var(--glass); color: var(--text); font: inherit; font-size: 16px;
             line-height: 1; cursor: pointer; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
             transition: transform 100ms ease-out; }
.dock__btn:active { transform: scale(0.9); }
.dock__btn[hidden] { display: none; }
.dock__btn--fold { top: 6px; }
.dock__btn--full { top: 44px; }
.dock--mini .dock__btn--full, body.keyboard-open .dock__btn--full { display: none; }

/* вкладки внутри блока и их содержимое */
.dock .seg { margin: 0 0 8px; }
.seg button.has-error::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px;
                               border-radius: 50%; background: var(--danger); vertical-align: middle; }
.tabpane[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .dock .upload { transition: none; } }

/* пустая область фото в липком блоке: плюс и подпись в одну строку — иначе не помещаются в --dock-empty-px и подпись обрезается */
.dock .upload__ph { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 16px; }
.dock .upload__plus { flex: none; width: 32px; height: 32px; margin: 0; }
.dock .upload__plus::before { top: 15px; }
.dock .upload__plus::after { left: 15px; }
.dock .upload__hint { margin: 0; text-align: left; }

/* карточка «Новогодний стиль» в редакторе макета */
.ny-card .caption + .caption { margin-top: 4px; }
.ny-card .list { margin-top: 10px; }

/* ---------- Генератор видео (TikTok-ролики) ---------- */
.tt-saved { font-size: 13px; color: var(--hint); white-space: nowrap; }
.tt-row__thumb { width: 40px; height: 56px; flex: none; border-radius: 8px; object-fit: cover; background: var(--hover); }
.tt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 10px; }
.tt-frame { position: relative; aspect-ratio: 9 / 16; padding: 0; border: 1px solid var(--line); border-radius: 12px;
            overflow: hidden; background: var(--hover); cursor: pointer; color: var(--text); font: inherit;
            transition: transform 100ms ease-out, box-shadow var(--ease); }
.tt-frame:active { transform: scale(0.97); }
.tt-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tt-frame.on { box-shadow: 0 0 0 3px var(--accent); border-color: var(--accent); }
.tt-frame__n, .tt-frame__dur { position: absolute; padding: 2px 7px; border-radius: 999px; background: rgba(0, 0, 0, 0.6);
                               color: #fff; font-size: 12px; font-weight: 600; line-height: 16px; pointer-events: none; }
.tt-frame__n { top: 6px; left: 6px; }
.tt-frame__dur { bottom: 6px; right: 6px; }
.tt-frame--vid .tt-frame__a { max-width: calc(100% - 66px); }
.tt-frame__a { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 2px 7px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
               background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 700; line-height: 16px; pointer-events: none; }
/* экран «Кадры по тексту» */
.tt-af__how { margin: 0 2px 10px; font-size: 14px; line-height: 1.4; color: var(--text2); }
.tt-af { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -2px; scrollbar-width: none; }
.tt-af::-webkit-scrollbar { display: none; }
.tt-af__f { position: relative; flex: none; width: 66px; padding: 0; border: 0; border-radius: 14px; background: transparent; color: var(--text); font: inherit; cursor: pointer; text-align: center; }
.tt-af__f img { display: block; width: 66px; height: 96px; object-fit: cover; border-radius: 14px; background: var(--hover); box-shadow: 0 0 0 1px var(--line); pointer-events: none; }
.tt-af__f.on img { box-shadow: 0 0 0 3px var(--accent); }
.tt-af__f--start img, .tt-af__f--insert img { opacity: 0.55; }
.tt-af__n { position: absolute; top: 5px; left: 5px; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: rgba(20, 20, 30, 0.6); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; }
.tt-af__s { display: block; margin-top: 5px; max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 600; color: var(--hint); }
.tt-af__f--anchor .tt-af__s { color: var(--accent); }
.tt-af__note { margin: 2px 2px 8px; min-height: 36px; font-size: 14px; line-height: 1.4; font-weight: 600; }
.tt-af__reset { margin: 0 0 8px; }
.tt-af__reset[hidden] { display: none; }
.tt-flow { margin: 6px 0 10px; padding: 14px; border-radius: 18px; background: var(--glass); max-height: 42vh; overflow-y: auto; font-size: 17px; line-height: 2.1; }
.tt-w { display: inline; padding: 3px 1px; margin: 0; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; border-radius: 6px; }
.tt-w:active { background: var(--hover); }
.tt-mark { display: inline-flex; align-items: center; justify-content: center; vertical-align: 2px; min-width: 24px; height: 24px; margin: 0 4px 0 6px; padding: 0 6px; border-radius: 12px; border: 1.5px dashed var(--hint);
           background: transparent; color: var(--hint); font: inherit; font-size: 13px; font-weight: 700; line-height: 1; cursor: pointer; }
.tt-mark--anchor { border: 0; background: var(--accent); color: var(--accent-text); }
.tt-mark--start, .tt-mark--insert { border-style: solid; border-color: var(--line-hover); }
.tt-mark.on { box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.35); border-color: var(--tab-on, #0A84FF); color: var(--tab-on, #0A84FF); }
.tt-mark--anchor.on { background: var(--tab-on, #0A84FF); color: #fff; }
.tt-frame { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tt-frame img { -webkit-user-drag: none; pointer-events: none; }
.tt-frame--lift { position: relative; z-index: 3; transition: box-shadow var(--ease); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35), 0 0 0 3px var(--accent); }
.tt-frame--add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
                 border-style: dashed; background: transparent; font-size: 13px; font-weight: 600; color: var(--hint); }
.tt-plus { font-size: 30px; font-weight: 300; line-height: 1; }
.tt-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.tt-tools[hidden] { display: none; }
.tt-tools .btn { width: auto; flex: 0 0 auto; }
.tt-line { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.tt-words { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tt-words .chip { padding: 6px 12px; font-size: 14px; }
.tt-listen { width: 100%; margin-top: 8px; }
.tt-insert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
.tt-trim { width: 72px; text-align: center; }
.tt-dict { margin-top: 8px; display: grid; gap: 8px; }
.tt-dict[hidden], .tt-listen[hidden] { display: none; }   /* иначе display перебивал hidden: строка словаря была видна всегда */
.tt-dict__add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.tt-dict__add input { min-width: 0; }
.tt-board { display: flex; gap: 3px; height: 36px; margin-bottom: 8px; border-radius: 10px; overflow: hidden; }
.tt-board:empty { display: none; }
.tt-board__part { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden;
                  background: var(--hover); font-size: 12px; font-weight: 600; color: var(--hint); }
.tt-board__cta { background: var(--accent); color: var(--accent-text); }
.tt-result__video { display: block; width: 100%; max-height: 60vh; border-radius: 12px; background: #000; margin-bottom: 4px; }

/* ---------- Карусель: лента слайдов под предпросмотром ---------- */
.cr-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 auto 6px; max-width: 560px;
            scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.cr-thumb { position: relative; flex: none; width: 72px; aspect-ratio: 4 / 5; padding: 0; border: 1px solid var(--line);
            border-radius: 12px; overflow: hidden; background: var(--hover); cursor: pointer; color: var(--text);
            font: inherit; scroll-snap-align: start; transition: transform 100ms ease-out, box-shadow var(--ease); }
.cr-thumb:active { transform: scale(0.97); }
.cr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cr-thumb.on { box-shadow: 0 0 0 3px var(--accent); border-color: var(--accent); }
.cr-thumb__n { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 8px; font-size: 10px;
               font-weight: 600; background: rgba(0, 0, 0, 0.6); color: #fff; }
.cr-thumb--add { display: flex; align-items: center; justify-content: center; border-style: dashed; background: transparent; }
.cr-thumb__plus { font-size: 26px; font-weight: 300; line-height: 1; color: var(--hint); }
.cr-slide .tt-tools { margin-top: 8px; }
.cr-product .glass-input { margin: 0 0 12px; }
.cr-product .helper, .cr-slide .helper { margin: 4px 2px 10px; }
.cr-thumb__text { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;
                  font-size: 20px; font-weight: 700; color: var(--accent);
                  background: radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%), #111; }
.cr-kicker { margin-top: 10px; }
.cr-kicker .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
/* предпросмотр карусели: все слайды в ряд, прокрутка с привязкой к слайду (свайп — как в Telegram) */
.cr-preview { overflow: hidden; user-select: none; -webkit-user-select: none; }
.cr-pager { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden;
            scroll-snap-type: x mandatory; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
            scrollbar-width: none; }
.cr-pager::-webkit-scrollbar { display: none; }
.cr-page { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.cr-page__img { display: block; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none;
                animation: cr-fade 200ms ease-out; }
@keyframes cr-fade { from { opacity: 0.4; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cr-page__img { animation: none; } }
/* перестановка слайдов удержанием */
.cr-thumb { -webkit-touch-callout: none; transition: transform 180ms ease-out, box-shadow var(--ease); }
.cr-thumb img { -webkit-user-drag: none; pointer-events: none; }
.cr-thumb--lift { position: relative; z-index: 2; transition: box-shadow var(--ease);
                  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), 0 0 0 3px var(--accent); }
.cr-strip--drag { scroll-snap-type: none; }
.cr-hint { margin: -2px auto 10px; max-width: 560px; text-align: center; }
/* ход загрузки на миниатюре слайда */
.cr-thumb__load { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
                  gap: 5px; padding: 0 7px 9px; background: rgba(0, 0, 0, 0.45); color: #fff; }
.cr-thumb__pct { font-size: 12px; font-weight: 600; }
.cr-thumb__bar { width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.cr-thumb__fill { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--accent); transition: width 160ms ease-out; }
.cr-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.cr-thumb__dur { position: absolute; right: 4px; top: 4px; padding: 1px 5px; border-radius: 8px; font-size: 10px;
                 font-weight: 600; background: rgba(0, 0, 0, 0.6); color: #fff; pointer-events: none; }
.cr-meta { margin: 6px 0 10px; }
.cr-meta__row { display: flex; gap: 8px; }
.cr-meta__row .glass-input { flex: 1 1 0; min-width: 0; margin: 0; text-align: center; }
