/* ИИ-Комбайн. Тёмная редакторская панель: крупная типографика, узкая
   навигационная рейка, асимметричные колонки. Сознательно не сетка карточек. */

:root {
  --bg:        oklch(16% 0.012 260);
  --bg-raise:  oklch(20% 0.014 260);
  --bg-sunken: oklch(13% 0.010 260);
  --line:      oklch(28% 0.014 260);
  --line-soft: oklch(24% 0.012 260);

  --ink:       oklch(94% 0.006 260);
  --ink-dim:   oklch(70% 0.012 260);
  --ink-faint: oklch(54% 0.012 260);

  --accent:    oklch(72% 0.145 195);
  --accent-dk: oklch(46% 0.110 195);
  --warn:      oklch(78% 0.140 75);
  --bad:       oklch(66% 0.170 25);
  --good:      oklch(74% 0.140 150);

  --r:   10px;
  --r-s: 7px;
  --rail: 210px;

  --fast: 140ms cubic-bezier(.16,1,.3,1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: clamp(26px, 1.4vw + 20px, 34px); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-faint); }

.muted { color: var(--ink-faint); }
.hint  { font-size: 11px; color: var(--ink-faint); text-transform: none; letter-spacing: 0; font-weight: 400; }
.lede  { margin: 6px 0 0; color: var(--ink-dim); max-width: 62ch; }

/* ── Рейка ──────────────────────────────────────────────────────────── */
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 14px;
  background: var(--bg-sunken);
  border-right: 1px solid var(--line);
}

.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px 22px; }
.brand b { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand small { display: block; font-size: 10.5px; color: var(--ink-faint); }
.brand-mark {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dk));
  box-shadow: 0 0 0 1px oklch(72% .145 195 / .3), 0 4px 14px oklch(72% .145 195 / .22);
}

.rail-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 10px; border: 0; border-radius: var(--r-s);
  background: transparent; color: var(--ink-dim);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.nav-item:hover:not(:disabled) { background: var(--bg-raise); color: var(--ink); }
.nav-item.is-active { background: var(--bg-raise); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item:disabled { opacity: .4; cursor: default; }
.nav-item i { font-style: normal; font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }

.rail-foot { margin-top: auto; padding: 0 6px; }
.rail-foot a { color: var(--ink-faint); font-size: 12px; text-decoration: none; }
.rail-foot a:hover { color: var(--accent); }

/* ── Сцена ──────────────────────────────────────────────────────────── */
.stage { padding: 34px clamp(20px, 3vw, 46px) 70px; min-width: 0; }
.view { display: none; }
.view.is-active { display: block; animation: rise var(--fast) both; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }

.stage-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 22px;
  padding-bottom: 20px; margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.head-actions { display: flex; gap: 10px; align-items: center; flex: none; }

.back {
  display: block; margin-bottom: 8px; padding: 0;
  border: 0; background: none; color: var(--ink-faint);
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.back:hover { color: var(--accent); }

/* ── Список персон ──────────────────────────────────────────────────── */
.persona-list { display: flex; flex-direction: column; gap: 1px; }

.prow {
  display: grid; grid-template-columns: 42px 1fr auto auto;
  gap: 16px; align-items: center;
  padding: 15px 16px;
  background: var(--bg-raise);
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color var(--fast), transform var(--fast), background var(--fast);
}
.prow:hover { border-color: var(--line); transform: translateX(3px); }

.avatar {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 600; color: var(--bg);
  background: linear-gradient(140deg, var(--accent), var(--accent-dk));
}
.avatar.is-fictional { background: linear-gradient(140deg, oklch(70% .15 300), oklch(45% .12 300)); }

.prow-name { font-weight: 550; letter-spacing: -0.01em; }
.prow-meta { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }

.pill {
  padding: 3.5px 9px; border-radius: 100px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
  background: var(--bg-sunken); color: var(--ink-dim);
  border: 1px solid var(--line);
}
.pill.ok    { color: var(--good); border-color: oklch(74% .14 150 / .35); }
.pill.draft { color: var(--warn); border-color: oklch(78% .14 75 / .35); }

.empty { padding: 60px 0; text-align: center; }
.empty p { margin: 4px 0; }

/* ── Колонки карточки ───────────────────────────────────────────────── */
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1080px) { .cols { grid-template-columns: 1fr; } }
.col-main, .col-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.panel {
  padding: 17px 18px 18px;
  background: var(--bg-raise);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
}
.panel h2 { margin-bottom: 13px; }

/* ── Готовность ─────────────────────────────────────────────────────── */
.check { display: flex; gap: 9px; padding: 6px 0; font-size: 13.5px; line-height: 1.45; }
.check::before { flex: none; width: 15px; font-weight: 700; }
.check.bad::before  { content: "✕"; color: var(--bad); }
.check.warn::before { content: "!"; color: var(--warn); }
.check.ok::before   { content: "✓"; color: var(--good); }

/* ── Мир ────────────────────────────────────────────────────────────── */
.world { display: flex; flex-direction: column; gap: 12px; }
.wgroup { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: baseline; }
.wgroup > span { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 100px; font-size: 12.5px;
  background: var(--bg-sunken); border: 1px solid var(--line-soft); color: var(--ink-dim);
}
.chip b { font-weight: 550; color: var(--ink); }
.chip.loves  { border-color: oklch(74% .14 150 / .4); }
.chip.hates  { border-color: oklch(66% .17 25 / .4); }
.chip x { cursor: pointer; color: var(--ink-faint); font-size: 14px; line-height: 1; }
.chip x:hover { color: var(--bad); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; }

.feed { display: flex; flex-direction: column; gap: 9px; }
.feed-item { font-size: 13px; padding-left: 11px; border-left: 2px solid var(--line); }
.feed-item b { display: block; font-weight: 550; }
.feed-item small { color: var(--ink-faint); }
.feed-item.hot { border-left-color: var(--accent); }

/* ── Вкладки карточки персоны ───────────────────────────────────────── */
.pane { display: none; }
.pane.is-active { display: block; animation: rise var(--fast) both; }

/* Шапка календаря: переключатель вида и навигация по периодам. */
.cal-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.cal-head h2 { margin: 0; }
.cal-head .tabs { margin: 0 0 0 auto; border: 0; }
.cal-nav { display: flex; align-items: center; gap: 7px; }
.cal-nav span { font-size: 13px; color: var(--ink-dim); min-width: 128px; text-align: center; }

.linkbtn {
  border: 0; background: none; padding: 0 0 0 8px;
  color: var(--accent); font: inherit; font-size: 11px; cursor: pointer;
}
.linkbtn:hover { text-decoration: underline; }

/* Месяц: сетка недель. Плотно, чтобы месяц читался целиком. */
.calmonth { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.calmonth .dow {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-faint); text-align: center; padding-bottom: 4px;
}
.calcell {
  min-height: 66px; padding: 5px 6px;
  background: var(--bg-sunken); border: 1px solid transparent;
  border-radius: var(--r-s); font-size: 11px;
  transition: border-color var(--fast);
}
.calcell:hover { border-color: var(--line); }
.calcell.other { opacity: .32; }
.calcell.today { border-color: var(--accent); }
.calcell b { display: block; font-size: 11.5px; color: var(--ink-dim); margin-bottom: 3px; }
.calcell .dot-slot {
  display: block; padding: 2px 5px; margin-bottom: 2px; border-radius: 4px;
  background: var(--bg-raise); border-left: 2px solid var(--warn);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.calcell .dot-slot.ready { border-left-color: var(--good); }
.calcell .dot-slot.review { border-left-color: var(--accent); }
.calcell .dot-slot.failed { border-left-color: var(--bad); }
.calcell .dot-slot.published { opacity: .55; }

/* Неделя: семь колонок со списком слотов. */
.calweek { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calweek .wcol { min-width: 0; }
.calweek .wcol > h4 {
  margin: 0 0 6px; font-size: 10.5px; font-weight: 600; text-align: center;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint);
}
.calweek .wcol.today > h4 { color: var(--accent); }

/* Календарь: дни столбцами времени, чтобы час был виден сразу. */
.calday { margin-bottom: 18px; }
.calday > h3 {
  margin: 0 0 8px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em; color: var(--ink-faint);
}
.calslot {
  display: grid; grid-template-columns: 54px 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 10px 12px; margin-bottom: 4px;
  background: var(--bg-sunken); border-radius: var(--r-s);
  border-left: 2px solid var(--line);
}
.calslot.planned { border-left-color: var(--warn); }
.calslot.ready   { border-left-color: var(--good); }
.calslot.published { border-left-color: var(--accent); opacity: .7; }
.calslot-time {
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.calslot-time small { display: block; font-size: 9.5px; font-weight: 400; color: var(--ink-faint); }
.calslot-topic { font-size: 13.5px; }
.calslot-where { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.calslot x { cursor: pointer; color: var(--ink-faint); font-size: 15px; }
.calslot x:hover { color: var(--bad); }

/* Ответ на комментарий: правится прямо здесь, до отправки. */
.cm-reply {
  margin-top: 11px; padding: 10px 12px;
  background: var(--bg-sunken); border-radius: var(--r-s);
  border-left: 2px solid var(--accent);
}
.cm-reply textarea { margin-top: 6px; font-size: 13.5px; }

/* ── Планировщик ────────────────────────────────────────────────────── */
#sched-panel { margin-bottom: 16px; }
.sched-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }

/* Переключатель автономной работы: он включает публикацию без участия
   владельца, поэтому должен читаться однозначно, а не быть галочкой. */
.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.switch input { width: 40px; height: 22px; margin: 0; appearance: none; flex: none;
  background: var(--bg-sunken); border: 1px solid var(--line); border-radius: 100px;
  position: relative; cursor: pointer; transition: background var(--fast), border-color var(--fast); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--ink-faint);
  transition: transform var(--fast), background var(--fast); }
.switch input:checked { background: oklch(72% .145 195 / .22); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(18px); background: var(--accent); }
.switch span { color: var(--ink-dim); }

.sched-tasks { display: flex; flex-direction: column; gap: 1px; }
.stask {
  display: grid; grid-template-columns: 1fr auto auto auto;
  gap: 12px; align-items: center;
  padding: 8px 10px; border-radius: var(--r-s); background: var(--bg-sunken);
  font-size: 13px;
}
.stask.err { box-shadow: inset 2px 0 0 var(--bad); }
.stask-name { font-weight: 500; }
.stask-last { font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }
.stask-next { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ── Команда: роли и конвейер ───────────────────────────────────────── */
.roles { display: flex; flex-direction: column; gap: 1px; }

.role {
  display: grid; grid-template-columns: 1fr minmax(170px, auto) auto;
  gap: 12px; align-items: center;
  padding: 11px 12px; border-radius: var(--r-s);
  border: 1px solid transparent;
  transition: background var(--fast), border-color var(--fast);
}
.role:hover { background: var(--bg-sunken); border-color: var(--line-soft); }
.role.warn { border-color: oklch(78% .14 75 / .35); }

.role-name { font-size: 14px; font-weight: 550; }
.role-note { font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }
.role select { padding: 5px 9px; font-size: 12.5px; }

/* Откуда взялось назначение. Без этого непонятно, почему выбрана эта модель. */
.src {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 7px; border-radius: 100px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--ink-faint);
}
.src.persona { color: oklch(72% .15 300); border-color: oklch(72% .15 300 / .4); }
.src.task    { color: var(--accent); border-color: oklch(72% .145 195 / .4); }
.src.auto    { color: var(--ink-faint); }

.role-will { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.role-will b { color: var(--ink-dim); font-weight: 500; }
.role-will.bad { color: var(--bad); }

/* Адрес фида: его копируют руками в настройки Дзена, значит он должен
   читаться символ в символ. */
.feedurl {
  display: inline-block; margin: 4px 6px 4px 0; padding: 3px 8px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--r-s); font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 11.5px; color: var(--accent); user-select: all;
}

/* Шаги прогона: видно кто, чем, сколько и как долго. */
.steps { display: flex; flex-direction: column; gap: 1px; margin-top: 14px; }
.step {
  display: grid; grid-template-columns: 24px 1fr auto auto auto;
  gap: 11px; align-items: center;
  padding: 9px 11px; border-radius: var(--r-s);
  background: var(--bg-sunken); font-size: 13px;
  border-left: 2px solid var(--line);
}
.step.done   { border-left-color: var(--good); }
.step.failed { border-left-color: var(--bad); }
.step.pending{ border-left-color: var(--warn); }
.step.skipped{ opacity: .45; }
.step-num { color: var(--ink-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.step-title { font-weight: 500; }
.step-who { font-size: 11.5px; color: var(--ink-dim); }
.step-ms, .step-cost { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.step-out { grid-column: 2 / -1; font-size: 12px; color: var(--ink-faint); margin-top: 3px; }

/* ── Мастерская ─────────────────────────────────────────────────────── */
.studio { max-width: 980px; margin: 0 auto; }
.studio-head { text-align: center; padding: 26px 0 22px; }
.studio-head h1 { font-size: clamp(28px, 2vw + 20px, 40px); }
.studio-head .lede { margin: 8px auto 0; }

.nav-minor { margin-top: 14px; font-size: 12.5px !important; opacity: .72; }

/* Счётчик ждущих решения: цифра рядом с разделом, а не отдельный экран. */
#queue-badge:not(:empty) {
  min-width: 18px; padding: 1px 6px; border-radius: 100px;
  background: var(--accent); color: oklch(16% .01 260);
  font-size: 10.5px; font-weight: 600; text-align: center; letter-spacing: 0;
}

/* Переключатель вида: крупные цели, а не мелкие вкладки. */
.kindbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.kindbtn {
  padding: 12px 14px; border-radius: var(--r);
  border: 1px solid var(--line-soft); background: var(--bg-raise);
  color: var(--ink-dim); font: inherit; text-align: left; cursor: pointer;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}
.kindbtn:hover { border-color: var(--line); transform: translateY(-1px); }
.kindbtn b { display: block; font-size: 14.5px; font-weight: 550; color: var(--ink); }
.kindbtn span { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.kindbtn.is-active {
  border-color: var(--accent); background: oklch(72% .145 195 / .07);
  box-shadow: 0 0 0 1px oklch(72% .145 195 / .3);
}
@media (max-width: 720px) { .kindbar { grid-template-columns: repeat(2, 1fr); } }

/* Поле ввода это главный объект экрана. */
.composer {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  transition: border-color var(--fast);
}
.composer:focus-within { border-color: var(--line); }
/* Главное поле мастерской. Раньше было без рамки и фона и полностью
   сливалось с панелью: владелец не видел, куда писать. */
.composer textarea {
  padding: 12px 14px;
  font-size: 16px; line-height: 1.5; resize: vertical; min-height: 84px;
}

/* Дорожки: по одной на каждый заказанный результат, у каждой свои модели. */
.lanes { display: flex; flex-direction: column; }
.lane {
  display: grid; grid-template-columns: 92px 1fr;
  gap: 12px; align-items: start;
  padding: 11px 0; border-top: 1px solid var(--line-soft);
}
.lane-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 550; color: var(--ink); padding-top: 4px;
}
.lane-label i { font-style: normal; font-size: 14px; }
.lane-rows { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lane-note { font-size: 11px; color: var(--accent); }

.composer-foot {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  padding-top: 11px; margin-top: 4px; border-top: 1px solid var(--line-soft);
}
.composer-foot .btn-primary { margin-left: auto; }
.composer-foot select { width: auto; padding: 4px 8px; font-size: 12.5px; }

#s-cost { opacity: .7; font-weight: 400; margin-left: 3px; }

/* Чипы моделей и параметров: выбор одним щелчком, без выпадающих списков. */
.chipset { display: flex; flex-wrap: wrap; gap: 5px; }
.gchip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 100px;
  border: 1px solid var(--line-soft); background: var(--bg-sunken);
  color: var(--ink-dim); font-size: 12.5px; cursor: pointer; white-space: nowrap;
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.gchip:hover { border-color: var(--line); color: var(--ink); }
.gchip.on { border-color: var(--accent); color: var(--accent); background: oklch(72% .145 195 / .09); }
.gchip.off { opacity: .35; cursor: not-allowed; }
.gchip small { color: var(--ink-faint); font-size: 10.5px; }
.gchip.on small { color: var(--accent); opacity: .75; }

/* Результаты */
.results { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.rcard {
  background: var(--bg-raise); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 14px 16px;
  animation: rise var(--fast) both;
}
.rcard.err { border-color: oklch(66% .17 25 / .4); }
.rcard-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 9px; font-size: 12.5px;
}
.rcard-top b { font-weight: 550; font-size: 13.5px; }
.rcard-top .cost { margin-left: auto; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.rcard-body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.rcard img { max-width: 100%; border-radius: var(--r-s); display: block; }
.rcard audio, .rcard video { width: 100%; margin-top: 4px; border-radius: var(--r-s); }
.rcard-actions { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }

.filestub {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-s);
  background: var(--bg-sunken); border: 1px dashed var(--line);
  font-size: 13px; color: var(--ink-dim);
}

/* Галерея */
.gallery-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 32px 0 12px; padding-top: 18px; border-top: 1px solid var(--line);
}
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 9px; }
.gitem {
  background: var(--bg-raise); border: 1px solid var(--line-soft);
  border-radius: var(--r-s); overflow: hidden; cursor: pointer;
  transition: border-color var(--fast), transform var(--fast);
}
.gitem:hover { border-color: var(--accent); transform: translateY(-2px); }
.gitem-thumb {
  aspect-ratio: 1; display: grid; place-items: center;
  background: var(--bg-sunken); font-size: 24px; color: var(--ink-faint);
}
.gitem-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gitem-meta { padding: 7px 9px; font-size: 11px; color: var(--ink-faint); }
.gitem-meta b { display: block; color: var(--ink-dim); font-weight: 500; font-size: 11.5px; }

/* ── Вкладки и каталог моделей ──────────────────────────────────────── */
.tabs { display: flex; gap: 2px; margin-bottom: 15px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 7px 13px; border: 0; background: none; color: var(--ink-faint);
  font: inherit; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color var(--fast), border-color var(--fast);
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.vendor { margin-bottom: 16px; }
.vendor > h3 {
  margin: 0 0 7px; font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint);
}

.mrow {
  display: grid; grid-template-columns: 1fr auto auto auto;
  gap: 12px; align-items: center;
  padding: 8px 11px; border-radius: var(--r-s);
  border: 1px solid transparent;
  transition: background var(--fast), border-color var(--fast);
}
.mrow:hover { background: var(--bg-sunken); border-color: var(--line-soft); }
.mrow.off { opacity: .42; }
.mrow-name { font-size: 13.5px; font-weight: 500; }
.mrow-name em { font-style: normal; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-left: 6px; }
.mrow-note { font-size: 11.5px; color: var(--ink-faint); }
.mrow-stars { font-size: 11px; color: var(--warn); letter-spacing: 1px; }
.mrow-cost { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.mrow-price { font-size: 11.5px; color: var(--good); letter-spacing: .5px; }

.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-dim); }
.checkline input { width: auto; margin: 0; }

.prov {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--line-soft);
}
.prov:last-child { border-bottom: 0; }
.prov small { display: block; color: var(--ink-faint); font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.dot.ready { background: var(--good); }
.dot.cooling { background: var(--warn); }
.dot.no_key { background: oklch(40% .01 260); }

/* ── Формы ──────────────────────────────────────────────────────────── */
/* Поля ввода должны читаться как поля, а не как участок фона. Разница
   даёт её тёмная подложка плюс рамка: на тёмной панели одного цвета мало,
   глаз не находит границу и не понимает, куда можно писать. */
input, select, textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  color: var(--ink); font: inherit; font-size: 13.5px;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
input:hover:not(:disabled), select:hover:not(:disabled),
textarea:hover:not(:disabled) { border-color: var(--ink-faint); }

/* Фокус подсвечиваем кольцом, а не только цветом рамки: смену оттенка
   рамки на тёмном фоне легко не заметить, особенно при беглой работе. */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px oklch(72% .145 195 / .18);
}
input::placeholder, textarea::placeholder { color: oklch(52% .012 260); }
textarea { resize: vertical; }

label { display: block; font-size: 12px; color: var(--ink-faint); }
label input, label select, label textarea { margin-top: 5px; }

.stack { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.inline-form { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 160px; }
.inline-form select { flex: 0 1 130px; }

/* Формы редактора мира: компактные, одна активна за раз. */
#world-tabs { margin-top: 16px; margin-bottom: 10px; }
.world-form { margin-top: 0; align-items: center; }
.world-form input[type="text"], .world-form input:not([type]) { flex: 1 1 130px; }
.world-form .checkline { flex: 0 0 auto; white-space: nowrap; }

.fold { margin-top: 12px; }
.fold summary { font-size: 12.5px; color: var(--ink-faint); cursor: pointer; }
.fold summary:hover { color: var(--accent); }

.btn {
  padding: 8px 15px; border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--bg-sunken); color: var(--ink);
  font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: oklch(16% .01 260); font-weight: 550; }
.btn-primary:hover { background: oklch(78% .145 195); }

/* ── Диалог ─────────────────────────────────────────────────────────── */
dialog {
  width: min(620px, 92vw); padding: 26px;
  background: var(--bg-raise); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 70px oklch(0% 0 0 / .6);
}
dialog::backdrop { background: oklch(10% .01 260 / .74); backdrop-filter: blur(3px); }
dialog h2 { font-size: 19px; text-transform: none; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 18px; }
dialog form { display: flex; flex-direction: column; gap: 13px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }

/* ── Тост ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  padding: 11px 20px; border-radius: 100px;
  background: var(--bg-raise); border: 1px solid var(--line);
  box-shadow: 0 10px 34px oklch(0% 0 0 / .5);
  font-size: 13.5px; z-index: 99;
  animation: rise var(--fast) both;
}
.toast.bad { border-color: oklch(66% .17 25 / .5); color: var(--bad); }
.toast.ok  { border-color: oklch(74% .14 150 / .5); color: var(--good); }

/* Переменная окружения: имя видно, значение нет. Хвост из четырёх знаков
   нужен, чтобы отличить один ключ от другого при ротации. */
.envvar {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 100px;
  border: 1px solid var(--line-soft); background: var(--bg-sunken);
  font-size: 11.5px;
}
.envvar code { font-family: ui-monospace, "Cascadia Code", monospace; color: var(--ink-dim); }
.envvar b { font-weight: 500; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.envvar i { font-style: normal; color: var(--ink-faint); font-family: ui-monospace, monospace; }
.envvar.on { border-color: oklch(74% .14 150 / .35); }
.envvar.on b { color: var(--good); }
.envvar.off b { color: var(--warn); }

/* Превью результата: медиа показывается сразу, а не именем файла.
   Ограничиваем высоту, чтобы вертикальный ролик 9:16 не растягивал
   карточку на весь экран. */
.rcard img, .rcard video {
  max-width: 100%; max-height: 420px; width: auto;
  border-radius: var(--r-s); display: block;
}
.mediabox { display: inline-block; line-height: 0; }
.mediabox:hover img { outline: 1px solid var(--accent); outline-offset: 2px; }

.gitem-thumb img, .gitem-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* Потерянный файл: честная отметка вместо битой картинки. */
.gitem-thumb.lost { color: var(--warn); font-size: 20px; }
.gitem.is-audio .gitem-thumb { aspect-ratio: 2.4; font-size: 18px; }
.gitem audio { width: 100%; height: 30px; padding: 0 6px; }

/* Полоса доли расхода: видно распределение без чтения цифр. */
.spendbar {
  height: 4px; margin-top: 6px; border-radius: 100px;
  background: var(--bg-sunken); overflow: hidden; max-width: 320px;
}
.spendbar span { display: block; height: 100%; background: var(--accent); }
.role[data-spend-key] { cursor: pointer; }
.role[data-spend-key]:hover { background: var(--bg-sunken); }

/* Список моделей провайдера в разделе ключей. */
.modellist { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.modelrow {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  align-items: center; padding: 4px 8px; border-radius: var(--r-s);
  font-size: 12.5px; background: var(--bg-sunken);
}
.modelrow em { font-style: normal; font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent); }

/* Переключатель способа: два принципиально разных пути к результату,
   и разница должна читаться до нажатия, а не после. */
.modebar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.modebtn {
  padding: 11px 14px; border-radius: var(--r);
  border: 1px solid var(--line-soft); background: var(--bg-raise);
  color: var(--ink-dim); font: inherit; text-align: left; cursor: pointer;
  transition: border-color var(--fast), background var(--fast);
}
.modebtn:hover { border-color: var(--line); }
.modebtn b { display: block; font-size: 14px; font-weight: 550; color: var(--ink); }
.modebtn span { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.modebtn.is-active {
  border-color: var(--accent); background: oklch(72% .145 195 / .07);
  box-shadow: 0 0 0 1px oklch(72% .145 195 / .3);
}
.feed-item small.lost { color: var(--bad); }

/* Счётчик неготовых каналов в меню: проблема должна быть видна
   из любого раздела, а не только когда зайдёшь. */
#ch-badge:not(:empty) {
  min-width: 18px; padding: 1px 6px; border-radius: 100px;
  background: var(--warn); color: oklch(16% .01 260);
  font-size: 10.5px; font-weight: 600; text-align: center; letter-spacing: 0;
}

/* Плитки по дням: нагрузка и провалы видны разом, без чтения списка. */
.plangrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px; margin-top: 4px;
}
.plancell {
  min-height: 84px; padding: 7px 8px;
  background: var(--bg-sunken); border: 1px solid var(--line-soft);
  border-radius: var(--r-s);
}
.plancell.today { border-color: var(--accent); }
.plancell.empty { opacity: .45; }
.plancell-day {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-faint); margin-bottom: 6px;
}
.plancell-day b { color: var(--ink-dim); font-size: 13px; margin-left: 3px; }

.plandot {
  padding: 4px 6px; margin-bottom: 3px; border-radius: 5px;
  background: var(--bg-raise); border-left: 2px solid var(--line);
  font-size: 11px; line-height: 1.3; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background var(--fast);
}
.plandot:hover { background: var(--bg); }
.plandot span { display: block; font-variant-numeric: tabular-nums; color: var(--ink-faint); font-size: 10px; }
.plandot.planned { border-left-color: var(--warn); }
.plandot.review, .plandot.ready { border-left-color: var(--accent); }
.plandot.published { border-left-color: var(--good); }
.plandot.failed { border-left-color: var(--bad); }
.plandot.generating { border-left-color: oklch(70% .15 300); }

.calslot[data-slot] { cursor: pointer; }
.calslot[data-slot]:hover { background: var(--bg-raise); }

/* Плашка персоны в дашборде каналов: беда должна быть видна не открывая. */
.pcard {
  background: var(--bg-raise); border: 1px solid var(--line-soft);
  border-radius: var(--r); margin-bottom: 8px; overflow: hidden;
}
.pcard.warn { border-color: oklch(78% .14 75 / .35); }
.pcard.open { border-color: var(--line); }

.pcard-head {
  display: grid; grid-template-columns: 42px 1fr auto;
  gap: 14px; align-items: center; padding: 14px 16px; cursor: pointer;
  transition: background var(--fast);
}
.pcard-head:hover { background: var(--bg-sunken); }
.pcard-name { font-weight: 550; letter-spacing: -0.01em; }
.pcard-meta { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }

.pcard-problems { padding: 0 16px 12px 72px; }
.pcard-problems .check { padding: 3px 0; font-size: 12.5px; }

.pcard-channels { padding: 0 16px 14px 72px; }
.chrow {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 9px 11px; margin-bottom: 4px;
  background: var(--bg-sunken); border-radius: var(--r-s);
  border-left: 2px solid var(--good);
}
.chrow.warn { border-left-color: var(--warn); }
.chrow-name { font-size: 13.5px; font-weight: 500; }
.chrow-meta { font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }
.chrow-bad { font-size: 11.5px; color: var(--bad); margin-top: 2px; }
.chrow-note { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }

/* ── Предпросмотр на телефоне ───────────────────────────────────────── */
/* Честно: это макет вашего материала, а не лента аккаунта. Пропорции
   и порядок элементов настоящие, попиксельного совпадения нет. */
.pv-stage { display: grid; place-items: center; padding: 18px 0; }

.phone {
  width: var(--pw); height: var(--ph);
  max-width: 100%; max-height: 70vh;
  border-radius: var(--pr);
  background: #000;
  border: 8px solid oklch(28% .01 260);
  box-shadow: 0 20px 60px oklch(0% 0 0 / .55), 0 0 0 1px oklch(38% .01 260);
  position: relative; overflow: hidden;
  transform-origin: top center;
}
.phone::before {
  content: ""; position: absolute; z-index: 3; left: 50%; transform: translateX(-50%);
  background: #000; border-radius: 100px;
}
.phone.dynamic::before { top: 9px; width: 88px; height: 26px; }
.phone.punch::before { top: 8px; width: 11px; height: 11px; }

.phone-screen {
  position: absolute; inset: 0; overflow-y: auto;
  background: oklch(12% .008 260); color: oklch(94% .006 260);
  font-size: 13px; padding-top: 44px;
}
.phone-screen::-webkit-scrollbar { width: 0; }

.pv-app { display: flex; flex-direction: column; }
.pv-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; font-size: 12.5px;
  border-bottom: 1px solid oklch(22% .01 260);
}
.pv-top span { color: oklch(56% .01 260); font-size: 11px; }
.pv-media { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.pv-empty {
  display: grid; place-items: center; background: oklch(18% .01 260);
  color: oklch(48% .01 260); font-size: 11.5px;
}
.pv-actions { padding: 8px 12px; font-size: 15px; letter-spacing: 6px; }
.pv-caption, .pv-text { padding: 0 12px 10px; line-height: 1.45; white-space: pre-wrap; }
.pv-caption i, .pv-text i { font-style: normal; color: oklch(52% .01 260); }

/* Telegram: пузырь сообщения, а не карточка поста. */
.pv-app.tg .tgtop { background: oklch(18% .02 250); border: 0; }
.pv-bubble {
  margin: 10px; padding: 0 0 6px; border-radius: 12px;
  background: oklch(20% .03 250); overflow: hidden;
}
.pv-bubble .pv-text { padding: 8px 10px 4px; }
.pv-meta { padding: 0 10px 4px; font-size: 10.5px; color: oklch(55% .01 260); }

/* Вертикальные площадки: текст поверх кадра, а не под ним. */
.pv-app.vertical { position: relative; height: 100%; }
.pv-app.vertical .pv-media { height: 100%; aspect-ratio: auto; }
.pv-overlay {
  position: absolute; left: 0; right: 54px; bottom: 0; padding: 12px;
  background: linear-gradient(transparent, oklch(0% 0 0 / .75));
}
.pv-side {
  position: absolute; right: 10px; bottom: 24px;
  font-size: 19px; line-height: 1.9; text-align: center;
}

.pv-row { display: flex; gap: 9px; padding: 11px 12px; }
.pv-ava {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--accent-dk));
}

/* ── Архив ──────────────────────────────────────────────────────────── */
.archive { display: flex; flex-direction: column; gap: 8px; }

.arcard {
  padding: 12px 14px; border-radius: var(--r-s);
  background: var(--bg-sunken); border-left: 2px solid var(--line);
}
.arcard.published { border-left-color: var(--good); }
.arcard.failed { border-left-color: var(--bad); }
.arcard.review, .arcard.approved { border-left-color: var(--accent); }

.arcard-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.arcard-head b { font-weight: 550; font-size: 13.5px; }
.arcard-head .cost { margin-left: auto; color: var(--ink-faint); font-size: 11.5px; }
.arcard-body {
  margin-top: 7px; font-size: 13px; line-height: 1.5;
  color: var(--ink-dim); white-space: pre-wrap;
}
.arcard-targets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.artag {
  padding: 2px 8px; border-radius: 100px; font-size: 11px;
  border: 1px solid var(--line); color: var(--ink-faint);
}
.artag.published { color: var(--good); border-color: oklch(74% .14 150 / .35); }
.artag.failed { color: var(--bad); border-color: oklch(66% .17 25 / .35); }

/* Лента жизни и комментариев: одна строка на событие, читается сверху вниз. */
.arline {
  display: grid; grid-template-columns: 26px 1fr auto;
  gap: 11px; align-items: start;
  padding: 9px 12px; border-radius: var(--r-s);
  background: var(--bg-sunken); font-size: 13px;
  border-left: 2px solid var(--line);
}
.arline.look { border-left-color: oklch(70% .15 300); }
.arline.state { border-left-color: var(--warn); }
.arline.fact { border-left-color: var(--accent); }
.arline.outgoing { border-left-color: var(--good); }
.arline-icon { font-size: 15px; line-height: 1.3; }
.arline-title { font-weight: 500; }
.arline-title em {
  font-style: normal; margin-left: 7px; padding: 1px 7px;
  border-radius: 100px; font-size: 10px; text-transform: uppercase;
  letter-spacing: .05em; background: var(--bg-raise); color: var(--warn);
}
.arline-note { font-size: 12px; color: var(--ink-faint); margin-top: 2px; line-height: 1.45; }
.arline-parent {
  font-size: 11.5px; color: var(--ink-faint); margin-top: 4px;
  padding-left: 9px; border-left: 2px solid var(--line);
}
.arline .cost { font-size: 11px; color: var(--ink-faint); white-space: nowrap; }

/* Память персоны: компактная сводка того, что видит генератор. */
.memgroup { margin-bottom: 14px; }
.memhead {
  font-size: 13px; font-weight: 600; color: var(--ink-faint);
  margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.memline {
  display: flex; align-items: baseline; gap: 10px;
  padding: 5px 10px; border-left: 2px solid var(--line);
  font-size: 13px;
}
.memline b { font-weight: 500; }
.memline .cost { margin-left: auto; white-space: nowrap; }
/* Необъяснённое подсвечиваем: это долг перед аудиторией, а не просто запись. */
.memline.warn { border-left-color: var(--warn); }

/* Веб-режим канала и цель диалога. */
.websess { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.websess.ok    { color: var(--good); }
.websess.expired,
.websess.blocked { color: var(--warn); }
.goalform { margin-top: 12px; }
.goalform summary { cursor: pointer; font-size: 13px; color: var(--ink-faint); }
.goalpre {
  margin-top: 10px; padding: 12px; border-radius: 8px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  font-size: 12px; line-height: 1.55; white-space: pre-wrap;
  max-height: 340px; overflow: auto;
}

/* Экран входа. Появляется только когда панель открыта по сети. */
#login-veil {
  position: fixed; inset: 0; z-index: 900;
  display: grid; place-items: center;
  background: var(--bg); background: color-mix(in oklch, var(--bg) 92%, black);
}
.loginbox {
  width: min(340px, 88vw); display: flex; flex-direction: column; gap: 12px;
  padding: 28px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-raise);
}
.loginbox h2 { margin: 0; font-size: 20px; }
.loginbox input {
  padding: 10px 12px; border-radius: 9px;
}
.loginerr { min-height: 18px; font-size: 13px; color: var(--bad); }

/* Мастерская персоны */
.mkmedia { display: flex; flex-direction: column; gap: 6px; }
.mkfile {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border: 1px solid var(--line-soft); border-radius: var(--r-s);
  background: var(--bg-sunken); font-size: 12.5px;
}
.mkfile img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.mkfile-icon {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 6px; background: var(--bg-raise); color: var(--ink-faint);
}
.mkfile span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mkactions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.mkactions input[type=datetime-local] {
  padding: 7px 9px; border-radius: var(--r-s);
}

/* Площадка не умеет выбранный формат: видно до нажатия, а не после отказа. */
.chip.cant { opacity: .4; text-decoration: line-through; }

.mkcard { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.mkcard-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; background: var(--bg-sunken); font-size: 12.5px;
}
.mkcard-body { padding: 12px; font-size: 13.5px; white-space: pre-wrap; min-height: 70px; }
.mkcard-foot {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 9px 12px; border-top: 1px solid var(--line-soft);
}

/* План по команде словами: каждый пункт можно снять до выполнения. */
.planrow {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 10px; border: 1px solid var(--line-soft);
  border-radius: var(--r-s); background: var(--bg-sunken);
  cursor: pointer;
}
.planrow:hover { border-color: var(--line); }
.planrow input { margin-top: 3px; flex: none; }
.planrow-title { font-size: 13.5px; font-weight: 500; }
.planrow-note { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
#in-cmd {
  width: 100%; padding: 10px 12px; border-radius: var(--r-s);
  font: inherit; resize: vertical;
}

/* Пульт: полоса выбора персоны над рабочими блоками. */
.personabar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 14px;
  background: var(--bg-raise); border: 1px solid var(--line-soft);
  border-radius: var(--r);
}
.personabar label { display: flex; align-items: center; gap: 9px; margin: 0; }
.personabar select {
  padding: 7px 10px; border-radius: var(--r-s);
  font: inherit; min-width: 190px;
}
#st-cmd {
  width: 100%; padding: 10px 12px; border-radius: var(--r-s);
  font: inherit; resize: vertical;
}

/* Каналы с их форматами: формат принадлежит каналу, а не материалу. */
.targets { display: flex; flex-direction: column; gap: 6px; }
.target {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 12px; align-items: center;
  padding: 8px 12px; border: 1px solid var(--line-soft);
  border-radius: var(--r-s); background: var(--bg-sunken);
  cursor: pointer;
}
.target:hover { border-color: var(--line); }
.target-name { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.target-name b { font-weight: 550; }
.target-name span {
  font-size: 12.5px; color: var(--ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.target select {
  padding: 5px 8px; border-radius: 6px; font-size: 12.5px;
}
.target.nokeys { opacity: .55; }

/* Медиатека: свои съёмки рядом со сгенерированным. */
.libgrid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.libcard {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1px solid var(--line-soft);
  border-radius: var(--r); background: var(--bg-sunken);
}
.libthumb {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--r-s); background: var(--bg);
}
.libthumb-audio {
  display: grid; place-items: center;
  font-size: 26px; color: var(--ink-faint);
}
.libcard-title { font-size: 13.5px; font-weight: 500; }
.libcard-note { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.libcard .chip { font-size: 11px; padding: 2px 8px; }
#lib-files {
  padding: 9px; border: 1px dashed var(--line);
  border-radius: var(--r-s); background: var(--bg); color: var(--ink-dim);
  width: 100%;
}
#lib-uses { max-height: 190px; overflow-y: auto; }

/* Модели в мастерской: сгруппированы по вендорам. */
.vendorrow {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  width: 100%; margin-top: 4px;
}
.vendorname {
  flex: 0 0 92px; font-size: 11px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-faint);
}
.gchip small { opacity: .65; margin-left: 4px; }

/* Живая лента канала */
.livefeed { display: flex; flex-direction: column; gap: 10px; }
.lvpost {
  display: grid; grid-template-columns: 82px 1fr; gap: 12px;
  padding: 10px; border: 1px solid var(--line-soft);
  border-radius: var(--r); background: var(--bg-sunken);
}
.lvthumb {
  width: 82px; height: 82px; object-fit: cover;
  border-radius: var(--r-s); background: var(--bg);
}
.lvthumb-none {
  display: grid; place-items: center;
  font-size: 22px; color: var(--ink-faint);
}
.lvbody { min-width: 0; }
.lvtext {
  font-size: 13.5px; line-height: 1.5; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}
.lvmeta {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px;
  font-size: 11.5px; color: var(--ink-faint);
}
.lvmeta a { color: var(--accent); text-decoration: none; }

/* Настройки аккаунта канала */
.profhead { display: flex; justify-content: space-between; align-items: center; }
.charcount {
  font-size: 11px; color: var(--ink-faint); font-weight: 400;
  text-transform: none; letter-spacing: 0;
}
/* Перебор по длине виден до сохранения, а не после обрезки площадкой. */
.charcount.over { color: var(--bad); font-weight: 600; }
#profile-box label { display: block; margin-bottom: 4px; }

/* Применение настроек в саму соцсеть: действие видимое подписчикам,
   поэтому отделено от сохранения черновика. */
.pushrow {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}

/* Каналы в «Ключи и доступы» сгруппированы по персоне: у каждой свои. */
.persona-secrets { margin-bottom: 16px; }
.persona-secrets-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 6px 2px 8px; border-bottom: 1px solid var(--line-soft);
  margin-bottom: 8px;
}
.persona-secrets-head b { font-size: 14px; }
.persona-secrets .role { margin-left: 10px; }

/* Строка ключа с вводом прямо в разделе. */
.keylist { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.keyrow {
  padding: 9px 11px; border-radius: var(--r-s);
  border: 1px solid var(--line-soft); background: var(--bg-sunken);
}
.keyrow.on  { border-left: 2px solid var(--good); }
.keyrow.off { border-left: 2px solid var(--warn); }
.keyrow-head { display: flex; align-items: baseline; gap: 10px; }
.keyrow-head code { font-size: 12.5px; color: var(--ink); }
.keystate { font-size: 11.5px; color: var(--ink-faint); }
.keyrow-edit {
  display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; align-items: center;
}
.keyinput { flex: 1 1 200px; font-size: 12.5px; padding: 6px 9px; }
.keyrow-note { font-size: 11.5px; color: var(--ink-faint); margin-top: 6px; min-height: 1em; }
.keyok  { color: var(--good); font-weight: 600; }
.keybad { color: var(--bad); font-weight: 600; }

/* Соцсети: плашки площадок и список каналов. */
.social-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.social-plate {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 16px; border-radius: var(--r); cursor: pointer;
  background: var(--bg-raise); border: 1px solid var(--line-soft);
  color: var(--ink); font: inherit; text-align: left;
  transition: border-color var(--fast), transform var(--fast);
}
.social-plate:hover { border-color: var(--line); transform: translateY(-2px); }
.social-plate.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.social-plate.empty { opacity: .7; }
.social-plate-icon { font-size: 22px; color: var(--accent); }
.social-plate b { font-size: 15px; }
.social-plate-count { font-size: 12px; color: var(--ink-faint); }

.social-list { display: flex; flex-direction: column; gap: 8px; }
.social-ch {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-s); cursor: pointer;
  background: var(--bg-sunken); border: 1px solid var(--line-soft);
  transition: border-color var(--fast), transform var(--fast);
}
.social-ch:hover { border-color: var(--line); transform: translateX(3px); }
.social-ch-name { font-weight: 550; }
.social-ch-meta { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }

/* Форма нового канала: секции и подсказки внутри диалога. */
.dlg-lede { color: var(--ink-dim); font-size: 13px; margin: 0 0 14px; }
.dlg-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-faint); margin: 14px 0 6px;
  padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.dlg-hint {
  font-size: 12px; color: var(--ink-faint); margin-top: 10px;
  padding: 8px 10px; border-radius: var(--r-s); background: var(--bg-sunken);
  min-height: 1em;
}


/* Пока вход не подтверждён, панель не показываем вообще: иначе на секунду
   мелькают данные до появления окна пароля. Снимается классом после
   успешной проверки сессии. */
body.locked > .rail,
body.locked > .stage { visibility: hidden; }
body.locked { background: var(--bg); }

/* Имена переменных, которые владельцу предстоит заполнить. */
.dlg-vars { margin-top: 8px; font-size: 11.5px; line-height: 1.9; }
.dlg-vars code {
  background: var(--bg); padding: 2px 7px; border-radius: 5px;
  border: 1px solid var(--line-soft); color: var(--accent); font-size: 11px;
}

/* Пошаговая подготовка площадки в форме канала. */
.dlg-steps { margin-bottom: 6px; }
.dlg-steps ol { margin: 0; padding-left: 20px; }
.dlg-steps li {
  font-size: 12.5px; color: var(--ink-dim); line-height: 1.6; margin-bottom: 4px;
}
.dlg-steps .muted { font-size: 12.5px; margin: 0; }
