/* ==========================================================================
   ПУБЛИКАЦИИ (app/js/screen-publish.js) — стили раздела
   Плитки, кнопки, поля и сегменты — общие из app.css; здесь только своё:
   пачка роликов, выбор аккаунтов, список с отправками, календарь, слоты.
   ========================================================================== */

/* Скрытое скрыто, даже если у плитки свой display (пустой редактор без роликов) */
#pubBody [hidden]{display:none !important}

/* Вкладки в шапке */
.pub-tabs{margin-inline-start:auto}
.pub-tabs button{display:inline-flex;align-items:center;gap:7px}
.pub-tabs svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:1.7}
.pub-count{font-style:normal;font-size:11px;font-weight:600;color:var(--accent)}
.pub-count:empty{display:none}

/* ── Новая публикация ──────────────────────────────────────────────────── */
.pub-grid{display:grid;grid-template-columns:minmax(0,1fr) 370px;gap:16px;align-items:start}
.pub-main{display:flex;flex-direction:column;gap:16px;min-width:0}
.pub-side{display:flex;flex-direction:column;gap:16px;position:sticky;top:calc(var(--bar) + 16px)}

/* Пустая пачка — большая зона для перетаскивания */
.pub-drop{border:1.5px dashed var(--line);box-shadow:none;background:var(--tile-2)}
.pub-drop.over,.pub-media.over{border-color:var(--accent);background:var(--accent-soft)}
.pub-drop-in{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;padding:56px 24px;color:var(--dim)}
.pub-drop-in b{font-size:17px;font-weight:600;color:var(--text)}
.pub-drop-in em{font-style:normal;font-size:12px;color:var(--faint)}
.pub-drop-ic{width:52px;height:52px;border-radius:14px;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent)}
.pub-drop-ic svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.7}
.linkbtn{color:var(--accent);font-weight:500}
.linkbtn:hover{text-decoration:underline}

/* Лента роликов */
.pub-items{display:flex;gap:12px;overflow-x:auto;padding:12px 16px 16px}
.pub-item{width:104px;flex:0 0 104px;display:flex;flex-direction:column;gap:4px;cursor:pointer;text-align:start;border-radius:12px;padding:4px;outline:none}
.pub-item:hover{background:var(--tile-2)}
.pub-item.on{background:var(--accent-soft);box-shadow:inset 0 0 0 2px var(--accent)}
.pub-item.err .pub-thumb{box-shadow:inset 0 0 0 2px var(--bad)}
.pub-item-name{font-size:12px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pub-item em{font-style:normal;font-size:11px;color:var(--faint)}
.pub-add{align-items:center;justify-content:center;min-height:190px;border:1.5px dashed var(--line);color:var(--accent);font-size:12.5px;font-weight:500}
.pub-add svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8}

.pub-thumb{position:relative;aspect-ratio:9/16;border-radius:10px;overflow:hidden;background:var(--thumb-ph);flex:none}
.pub-thumb.wide{aspect-ratio:16/9}
.pub-thumb video{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none}
.pub-ph{position:absolute;inset:0;display:grid;place-items:center;color:var(--thumb-ph-ink)}
.pub-ph svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.6;opacity:.8}
.pub-dur{position:absolute;inset-inline-end:5px;bottom:5px;font-size:10.5px;font-weight:600;color:#fff;background:rgba(0,0,0,.55);padding:1px 5px;border-radius:5px}
.pub-x{position:absolute;top:5px;inset-inline-end:5px;width:22px;height:22px;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;font-size:15px;line-height:1;display:grid;place-items:center;opacity:0;transition:opacity .15s}
.pub-item:hover .pub-x,.pub-item:focus-within .pub-x{opacity:1}
.pub-up{position:absolute;inset-inline:6px;bottom:24px;height:5px;border-radius:3px;background:rgba(255,255,255,.35);overflow:hidden}
.pub-up i{display:block;height:100%;background:#fff;transition:width .2s}
.pub-ok{position:absolute;top:6px;inset-inline-start:6px;width:20px;height:20px;border-radius:50%;background:var(--ok);color:#fff;display:grid;place-items:center}
.pub-ok svg{width:12px;height:12px;stroke:currentColor;fill:none;stroke-width:2.4}

/* Превью и поля выбранного ролика */
.pub-editor{display:grid;grid-template-columns:minmax(180px,250px) minmax(0,1fr);gap:20px;padding:16px}
.pub-preview{display:flex;flex-direction:column;gap:6px}
.pub-preview video{width:100%;max-height:440px;border-radius:12px;background:#000;display:block}
.pub-preview em{font-style:normal;font-size:11.5px;color:var(--faint);overflow-wrap:anywhere}
.pub-fields .field label{display:flex;align-items:baseline;gap:8px}
.pub-counter{margin-inline-start:auto;font-size:11.5px;font-weight:400;color:var(--faint)}
.pub-counter.over{color:var(--bad);font-weight:600}
.pub-apply{display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:12.5px;color:var(--dim)}
.pub-ed-h{font-size:12.5px;color:var(--dim);margin-bottom:10px;line-height:1.45}

/* Обложка под превью (db/030): авто, кадр ролика или своя картинка */
.pub-cover{display:flex;flex-direction:column;gap:7px;margin-top:6px;padding-top:10px;border-top:1px solid var(--line-soft)}
.pub-cover-h{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.pub-cover-h b{font-size:12.5px;font-weight:600}
.pub-cover-modes button{height:26px;padding:0 9px;font-size:12px}
.pub-cover-frame{display:flex;align-items:center;gap:8px}
.pub-range{flex:1;min-width:0;accent-color:var(--accent)}
.pub-cover-frame span{font-size:12px;color:var(--dim);font-variant-numeric:tabular-nums;min-width:44px;text-align:end}
.pub-cover-img{display:flex;align-items:center;gap:10px}
.pub-cover-img img{width:54px;aspect-ratio:9/16;object-fit:cover;border-radius:8px;background:var(--thumb-ph)}
.pub-cover .cap{margin:0;font-size:11.5px;line-height:1.4}

/* Настройки сетей: «в ленте», соавторы, доступ YouTube, «без звука» Telegram */
.pub-opt{padding:10px 0;border-top:1px solid var(--line-soft)}
.pub-opt:first-child{border-top:0;padding-top:0}
.pub-opt:last-child{padding-bottom:0}
.pub-opt-h{display:flex;align-items:center;gap:8px;margin-bottom:2px}
.pub-opt-h b{font-size:13px;font-weight:600}
.pub-opt-h .pmark.brand{display:flex;justify-content:center}
.pub-opt .field{margin:8px 0 4px}
.pub-opt .switch .lbl em{line-height:1.4}

/* Правка публикации: превью с обложкой слева, поля справа */
.pub-edit{display:grid;grid-template-columns:minmax(160px,210px) minmax(0,1fr);gap:18px;align-items:start}
.pub-edit .pub-preview video{max-height:360px}
.pub-edit-opts{margin:4px 0 12px;padding:10px 12px;border-radius:10px;background:var(--tile-2)}

/* Куда: сети и аккаунты */
.pub-type{display:flex;width:100%;margin-bottom:6px}
.pub-type button{flex:1}
.pub-type-hint{margin-bottom:10px}
.pub-net{padding:10px 0;border-top:1px solid var(--line-soft)}
.pub-net-h{display:flex;align-items:center;gap:8px;margin-bottom:4px}
.pub-net-h b{font-size:13px;font-weight:600}
/* Знак вписан в свою ячейку: вытянутые (Threads, TikTok, X) в сетке вылезали вниз на строку аккаунта */
.pub-net-h .pmark.brand{display:flex;justify-content:center}
.pub-net-h .linkbtn{margin-inline-start:auto;font-size:12px}
.pub-net-why{font-size:11.5px;color:var(--faint);margin:0 0 4px;line-height:1.4}
.pub-acc{display:flex;align-items:flex-start;gap:10px;padding:6px 4px;border-radius:8px;cursor:pointer}
.pub-acc:hover{background:var(--tile-2)}
.pub-acc input{margin-top:3px;accent-color:var(--accent);width:15px;height:15px;flex:none}
.pub-acc.off{cursor:default;opacity:.55}
.pub-acc.off:hover{background:none}
.pub-acc-t{min-width:0}
.pub-acc-t b{display:block;font-size:13px;font-weight:500}
.pub-acc-t em{display:block;font-style:normal;font-size:11.5px;color:var(--faint);line-height:1.4}
.pub-skip{color:var(--warn)}

/* Когда */
.pub-modes{display:flex;width:100%;margin-bottom:10px}
.pub-modes button{flex:1;padding:0 6px}
.pub-next{margin:6px 0 0;padding-inline-start:18px;font-size:13px;line-height:1.7}
.pub-warn{font-size:12.5px;color:var(--warn)}

/* Итог */
.pub-sum{display:flex;align-items:baseline;gap:10px;margin-bottom:8px}
.pub-sum b{font-size:30px;font-weight:600;letter-spacing:-.02em}
.pub-sum span{font-size:13px;color:var(--dim)}
.pub-skips{margin:0 0 10px;padding-inline-start:18px;font-size:11.5px;color:var(--warn);line-height:1.5}
.pub-problems{font-size:12.5px;color:var(--dim);margin-bottom:10px;line-height:1.6}
.pub-problems div::before{content:'· '}
.pub-go-btn{width:100%;height:42px;justify-content:center;gap:8px;font-size:14px}
.pub-go-btn svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8}
.pub-progress{height:8px;border-radius:4px;background:var(--line-soft);overflow:hidden;margin:4px 0 8px}
.pub-progress i{display:block;height:100%;background:var(--accent);transition:width .25s}

/* ── Список публикаций ─────────────────────────────────────────────────── */
.pub-filters{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:14px}
.pub-filters .chips{display:flex;flex-wrap:wrap;gap:6px}
.pub-filters .chip i{font-style:normal;color:var(--faint);font-size:11px}
.pub-netsel{width:auto;height:30px;font-size:12.5px;margin-inline-start:auto;background-position-y:13px,13px}
.pub-day{font-size:12px;font-weight:600;color:var(--faint);text-transform:uppercase;letter-spacing:.04em;margin:18px 2px 8px}
.pub-day:first-of-type{margin-top:4px}
.pub-post{display:flex;gap:14px;padding:12px;margin-bottom:10px;align-items:flex-start}
.pub-post .pub-thumb{width:64px}
.pub-post .pub-thumb.wide{width:112px}
.pub-post-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px}
.pub-post-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.pub-post-head b{font-size:14px;font-weight:600;min-width:0;overflow-wrap:anywhere}
.pub-st{font-size:11px;font-weight:600;padding:2px 8px;border-radius:10px;white-space:nowrap}
.pub-st.accent{background:var(--accent-soft);color:var(--accent)}
.pub-st.ok{background:var(--ok-soft);color:var(--ok)}
.pub-st.warn{background:var(--warn-soft);color:var(--warn)}
.pub-st.bad{background:var(--bad-soft);color:var(--bad)}
.pub-st.muted{background:var(--tile-3);color:var(--dim)}
.pub-post .cap{margin:0}
.pub-jobs{display:flex;flex-wrap:wrap;gap:6px}
.pub-job{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 9px;border-radius:13px;border:1px solid var(--line);
  font-size:12px;color:var(--dim);background:var(--tile)}
.pub-job svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2}
.pub-job em{font-style:normal;color:var(--faint)}
.pub-job.published{color:var(--ok);border-color:var(--ok-soft);background:var(--ok-soft)}
a.pub-job.published:hover{border-color:var(--ok)}
.pub-job.failed{color:var(--bad);border-color:var(--bad-soft);background:var(--bad-soft)}
.pub-job.working{color:var(--warn)}
.pub-job.working svg{animation:pubspin 1.2s linear infinite}
.pub-job.cancelled,.pub-job.draft{color:var(--faint)}
.pub-dot{width:8px;height:8px;border-radius:50%;flex:none}
@keyframes pubspin{to{transform:rotate(360deg)}}
.pub-err{display:flex;gap:7px;align-items:flex-start;font-size:12px;color:var(--bad);line-height:1.45}
.pub-err svg{width:14px;height:14px;flex:none;margin-top:1px;stroke:currentColor;fill:none;stroke-width:1.8}
/* Ролик вышел, а обложка или первый комментарий — нет: заметка, не ошибка */
.pub-note{display:flex;gap:7px;align-items:flex-start;font-size:12px;color:var(--warn);line-height:1.45}
.pub-note svg{width:14px;height:14px;flex:none;margin-top:1px;stroke:currentColor;fill:none;stroke-width:1.8}
.pub-extras{font-size:12px;color:var(--faint);line-height:1.45;overflow-wrap:anywhere}
.pub-acts{display:flex;flex-wrap:wrap;gap:6px;align-items:center;justify-content:flex-end;max-width:260px}
.pub-acts .btn svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:1.8}
.pub-day-list .pub-post{box-shadow:none;margin-bottom:0}

/* ── Календарь ─────────────────────────────────────────────────────────── */
.pub-cal-head{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--line-soft);flex-wrap:wrap}
.pub-cal-head b{font-size:15px;font-weight:600;min-width:150px;text-align:center}
.pub-cal-head .cap{margin:0 0 0 auto}
.pub-cal-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}
.pub-wd{font-size:11.5px;font-weight:600;color:var(--faint);padding:8px 10px;border-bottom:1px solid var(--line-soft)}
.pub-cell{min-height:112px;padding:6px;border-inline-end:1px solid var(--line-soft);border-bottom:1px solid var(--line-soft);display:flex;flex-direction:column;gap:4px;min-width:0}
.pub-cell:nth-child(7n){border-inline-end:0}
.pub-cell.out{background:var(--tile-2)}
.pub-cell.out .pub-cell-d{color:var(--faint)}
.pub-cell-d{font-size:12px;font-weight:600;width:24px;height:24px;display:grid;place-items:center;border-radius:50%}
.pub-cell.today .pub-cell-d{background:var(--accent);color:var(--accent-ink)}
.pub-cal-chip{display:flex;gap:5px;align-items:baseline;width:100%;text-align:start;font-size:11.5px;padding:3px 6px;border-radius:6px;
  background:var(--tile-3);color:var(--text);min-width:0}
.pub-cal-chip b{font-weight:600;flex:none}
.pub-cal-chip span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.pub-cal-chip.accent{background:var(--accent-soft)}
.pub-cal-chip.ok{background:var(--ok-soft)}
.pub-cal-chip.warn{background:var(--warn-soft)}
.pub-cal-chip.bad{background:var(--bad-soft)}
.pub-cal-chip.muted{opacity:.6}
.pub-more{font-size:11px;color:var(--accent);text-align:start;padding:0 6px}

/* ── Расписание ────────────────────────────────────────────────────────── */
.pub-slots-grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:16px;align-items:start}
.pub-slot-row{display:flex;align-items:center;gap:12px;padding:9px 0;border-bottom:1px solid var(--line-soft)}
.pub-slot-row:last-child{border-bottom:0}
.pub-slot-row > b{width:110px;flex:none;font-size:13px;font-weight:500}
.pub-slot-times{display:flex;flex-wrap:wrap;align-items:center;gap:6px;flex:1}
.pub-slot-times .chip{height:28px}
.pub-slot-times .chip .x{margin-inline-start:2px}
.pub-slot-add{display:inline-flex;gap:4px;margin-inline-start:auto}
.pub-slot-add .input{width:104px;height:30px;padding:0 8px}
.pub-slot-add .btn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:1.8}
.pub-slot-foot{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.pub-slot-foot .sp{flex:1}

/* ── Узкий экран ───────────────────────────────────────────────────────── */
@media (max-width:1180px){
  .pub-grid{grid-template-columns:1fr}
  .pub-side{position:static}
  .pub-slots-grid{grid-template-columns:1fr}
}
@media (max-width:820px){
  .pub-tabs{margin-inline-start:0;width:100%;overflow-x:auto}
  .pub-tabs button span{white-space:nowrap}
  .pub-editor{grid-template-columns:1fr}
  .pub-preview video{max-height:320px}
  .pub-edit{grid-template-columns:1fr}
  .pub-post{flex-wrap:wrap}
  .pub-acts{max-width:none;justify-content:flex-start;width:100%}
  .pub-cell{min-height:74px;padding:4px}
  .pub-cal-chip span{display:none}
  .pub-cal-head .cap{display:none}
  .pub-slot-row{flex-wrap:wrap}
  .pub-slot-add{margin-inline-start:0}
}
