/* AI Studio — панель управления. Светлый стиль по образцу finam_bot: Inter, фон #f3f6f8, белые карточки, синий акцент, подсказки «?». */
:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
  --ink: #17212b; --muted: #72808b; --soft: #4a5a66; --line: #dfe7eb; --surface: #fff; --bg: #f3f6f8;
  --blue: #146ef5; --blue-soft: #edf5ff; --blue-line: #bed7ff;
  --green: #0da46b; --green-soft: #e9faf3;
  --red: #d84c50; --red-soft: #fff0f0;
  --orange: #c97a16; --orange-soft: #fff8e5;
  --violet: #7651c9;
  --radius: 14px; --radius-s: 10px;
  --shadow: 0 12px 34px #17212b08;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 90px; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: radial-gradient(circle at 85% -10%, #d9e9ff 0, transparent 36%), var(--bg);
  font-size: 15px; line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid #9fc2f5; outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: #ffffffcc; backdrop-filter: blur(8px); border-right: 1px solid var(--line); padding: 20px 14px 16px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 2px 8px 22px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 800; letter-spacing: -.04em; }
.brand strong { display: block; font-size: 16px; letter-spacing: -.02em; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.nav { display: grid; gap: 2px; }
.nav a, .nav-foot a, .nav-foot button {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-s);
  color: var(--soft); text-decoration: none; font-weight: 600; font-size: 14px; border: 0; background: none; width: 100%; text-align: left;
}
.nav a:hover, .nav-foot a:hover, .nav-foot button:hover { background: #eff4f7; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--blue-soft); color: var(--blue); }
.nav svg, .nav-foot svg { width: 19px; height: 19px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); }
.nav a[aria-current="page"] .count { color: var(--blue); }
.nav-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 12px; }
.nav-foot .who { padding: 4px 12px 8px; font-size: 13px; color: var(--muted); }
.nav-foot .who b { color: var(--ink); }

.main { min-width: 0; padding: 0 32px 64px; max-width: 1360px; width: 100%; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 14px; height: 64px; border-bottom: 1px solid var(--line); }
.menu-toggle { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0; place-items: center; }
.menu-toggle svg { width: 20px; height: 20px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; }
.top-status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.dot.off { background: #c5ced4; } .dot.warn { background: var(--orange); } .dot.bad { background: var(--red); }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--soft); }

.page-head { padding: 40px 0 22px; display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 32px; letter-spacing: -.04em; margin: 0; line-height: 1.15; display: flex; align-items: center; gap: 10px; }
.page-head p { margin: 8px 0 0; color: var(--muted); max-width: 66ch; }

/* ---------- кнопки и бейджи ---------- */
.button { border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 700; font-size: 14px; cursor: pointer; transition: transform .16s, box-shadow .16s, background .16s; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 18px #17212b12; }
.button-primary { background: var(--blue); color: #fff; }
.button-outline { background: #fff; color: var(--blue); border: 1px solid var(--blue-line); }
.button-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.button-danger { background: var(--red-soft); color: var(--red); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 6px; font-size: 12px; font-weight: 700; background: #eff4f7; color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--orange-soft); color: var(--orange); }
.badge.bad { background: var(--red-soft); color: var(--red); }
.badge.info { background: var(--blue-soft); color: var(--blue); }

/* ---------- подсказка «?» ---------- */
.q {
  display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; margin-left: 2px; padding: 0;
  border: 1px solid #cdd8de; border-radius: 50%; background: #fff; color: var(--muted);
  font-size: 11px; font-weight: 800; line-height: 1; vertical-align: middle; position: relative; top: -1px;
}
.q:hover, .q[aria-expanded="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.tip {
  position: fixed; z-index: 50; max-width: 320px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff;
  font-size: 13px; line-height: 1.5; font-weight: 500; box-shadow: 0 16px 40px #17212b33; pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tip.show { opacity: 1; transform: none; }
.tip b { display: block; margin-bottom: 4px; }
.tip span { display: block; margin-top: 6px; color: #b9c8d4; }

/* ---------- метрики (полоса из 1px-линий, как в finam_bot) ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 22px; }
.metrics > div { background: var(--surface); padding: 18px 20px; min-width: 0; }
.metrics .k { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.metrics strong { font-size: 22px; letter-spacing: -.03em; }
.metrics small { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }

/* ---------- карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; display: flex; align-items: center; gap: 6px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-body { padding: 20px 22px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; margin-bottom: 22px; }
.stack { display: grid; gap: 22px; align-content: start; }

/* ---------- видеокарта ---------- */
.vram { margin: 4px 0 6px; }
.vram-bar { display: flex; height: 22px; border-radius: 8px; overflow: hidden; background: #eaf0f3; }
.vram-seg { min-width: 3px; transition: flex-basis .5s; }
.vram-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 13px; color: var(--soft); }
.vram-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.vram-nums { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.vram-nums strong { font-size: 28px; letter-spacing: -.03em; }
.vram-nums span { color: var(--muted); font-size: 13px; }

.mode { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.mode-tile { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 14px 16px; display: grid; gap: 3px; align-content: start; transition: border-color .16s, background .16s; }
.mode-tile.on { border-color: var(--blue); background: var(--blue-soft); }
.mode-tile b { font-size: 15px; display: flex; align-items: center; gap: 4px; }
.mode-tile small { color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-bottom: 10px; }
.mode-tile .button { justify-self: start; padding: 8px 13px; font-size: 13px; }
.note { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: #f4f7fa; color: var(--soft); font-size: 13px; }
.note.warn { background: var(--orange-soft); color: #936b00; }
.note.bad { background: var(--red-soft); color: #b33138; }

/* ---------- обучение ---------- */
.train-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; margin-top: 12px; font-size: 14px; }
.train-row span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
progress { width: 100%; height: 8px; border: 0; border-radius: 99px; overflow: hidden; background: #eaf0f3; appearance: none; }
progress::-webkit-progress-bar { background: #eaf0f3; }
progress::-webkit-progress-value { background: var(--blue); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--blue); }

/* ---------- цепочка производства ---------- */
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); counter-reset: step; }
.pipeline li { position: relative; padding: 16px 14px 16px 0; counter-increment: step; }
.pipeline li::before { content: counter(step); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; margin-bottom: 12px; position: relative; z-index: 1; }
.pipeline li::after { content: ""; position: absolute; top: 29px; left: 26px; right: 0; height: 2px; background: var(--line); }
.pipeline li:last-child::after { display: none; }
.pipeline b { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.pipeline small { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--muted); font-size: 12.5px; }

/* ---------- каталог сервисов ---------- */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.service { display: flex; flex-direction: column; padding: 18px 20px; gap: 10px; }
.service-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.service h3 { margin: 0; font-size: 16.5px; letter-spacing: -.02em; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.service p { margin: 0; color: var(--soft); font-size: 14px; }
.service .use { color: var(--muted); font-size: 13px; }
.service-foot { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.service-foot .button { padding: 8px 13px; font-size: 13px; }
.service.is-off { background: #fafbfc; }
.service.is-off h3 { color: var(--soft); }
.section-title { display: flex; align-items: center; gap: 6px; margin: 34px 0 14px; font-size: 19px; letter-spacing: -.02em; }
.section-title small { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }

.cat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.cat-card { display: block; padding: 18px 20px; text-decoration: none; color: inherit; transition: border-color .16s, transform .16s; }
.cat-card:hover { border-color: var(--blue-line); transform: translateY(-1px); }
.cat-card h3 { margin: 10px 0 4px; font-size: 16px; display: flex; align-items: center; gap: 4px; }
.cat-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.cat-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--blue-soft); color: var(--blue); }
.cat-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cat-meta { margin-top: 12px; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }

.attention-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attention-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--orange-soft); font-size: 14px; }
.attention-list li span { color: var(--soft); font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; display: flex; align-items: center; gap: 10px; }

/* ---------- Strata чат ---------- */
.chat { display: grid; gap: 12px; }
.chat-log { max-height: 340px; overflow: auto; display: grid; gap: 10px; align-content: start; }
.msg { padding: 10px 13px; border-radius: 12px; background: #f4f7fa; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { background: var(--blue-soft); justify-self: end; max-width: 85%; }
.msg b { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.chat form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
textarea, input[type=text], input[type=password] { width: 100%; border: 1px solid #cbd7df; border-radius: 10px; padding: 11px 14px; background: #fff; resize: vertical; }
textarea:focus, input:focus { border-color: var(--blue); outline: 3px solid #cfe2fd; outline-offset: 0; }

/* ---------- прочее ---------- */
.cmd { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: #f2f5f8; font-size: 13px; overflow-wrap: anywhere; }
.cmd code { flex: 1; user-select: all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row b { display: flex; align-items: center; gap: 4px; }
.switch-row small { display: block; color: var(--muted); font-size: 13px; max-width: 52ch; }

dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 20px; overflow: hidden; background: #fff; box-shadow: 0 24px 80px rgba(20, 45, 70, .28); }
dialog::backdrop { background: rgba(12, 29, 48, .52); backdrop-filter: blur(4px); }
dialog form { padding: 28px 28px 24px; display: grid; gap: 14px; }
dialog h3 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
dialog p { margin: 0; color: var(--soft); font-size: 14px; }
dialog .row { display: flex; gap: 10px; justify-content: flex-end; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 60; max-width: 360px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 16px 40px #17212b33; }

/* ---------- вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth form { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px; display: grid; gap: 14px; box-shadow: 0 24px 80px rgba(20, 45, 70, .12); }
.auth h1 { margin: 6px 0 0; font-size: 26px; letter-spacing: -.03em; }
.auth label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--soft); }
.auth .err { color: var(--red); font-size: 13px; min-height: 18px; }

.skeleton { color: var(--muted); padding: 40px 0; }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .pipeline { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 8px; }
  .pipeline li:nth-child(4)::after { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-102%); transition: transform .2s; background: #fff; box-shadow: 0 0 60px #17212b33; }
  body.nav-open .sidebar { transform: none; }
  .menu-toggle { display: grid; }
  .main { padding: 0 16px 48px; }
  .page-head h1 { font-size: 26px; }
  .mode { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline li::after { display: none; }
}
@media (max-width: 520px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics > div { padding: 14px; }
  .service-grid, .cat-cards { grid-template-columns: 1fr; }
  .chat form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ======================= кабинет: проекты, сцены, очередь, ассистент, бренд-книги ======================= */
.nav-group { margin: 16px 12px 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.nav-group:first-child { margin-top: 4px; }
.banner { margin: 16px 0 0; padding: 12px 16px; border-radius: 12px; background: var(--blue-soft); border: 1px solid var(--blue-line); color: #0b3d86; font-size: 14px; }
.banner p { margin: 0; } .banner p + p { margin-top: 4px; color: #2a548f; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { padding: 3px 9px; border-radius: 999px; background: #eff4f7; color: var(--soft); font-size: 12px; font-weight: 600; }
.row.left { justify-content: flex-start; } .row.wrap { flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: center; }
.crumbs { padding-top: 22px; font-size: 13px; } .crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--blue); }
.crumbs + .page-head { padding-top: 10px; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.project-card { display: block; padding: 18px 20px; color: inherit; text-decoration: none; transition: border-color .16s, transform .16s; }
.project-card:hover { border-color: var(--blue-line); transform: translateY(-1px); }
.project-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.project-card h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.project-card .idea { margin: 12px 0; color: var(--soft); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.steps-mini { display: flex; gap: 14px; margin-top: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.empty-state { padding: 36px 28px; max-width: 640px; }
.empty-state h3 { margin: 0 0 8px; font-size: 20px; } .empty-state p { color: var(--soft); margin: 0 0 18px; }

dialog.wide { width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
dialog form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--soft); }
dialog form legend { font-size: 13px; font-weight: 600; color: var(--soft); padding: 0; margin-bottom: 8px; }
dialog form fieldset { border: 0; margin: 0; padding: 0; }
select { width: 100%; border: 1px solid #cbd7df; border-radius: 10px; padding: 10px 12px; background: #fff; }
select:focus { border-color: var(--blue); outline: 3px solid #cfe2fd; outline-offset: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; } .form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.formats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.formats legend { grid-column: 1/-1; }
.fmt { position: relative; } .fmt input { position: absolute; opacity: 0; }
.fmt span { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.fmt small { color: var(--muted); font-weight: 500; }
.fmt input:checked + span { border-color: var(--blue); background: var(--blue-soft); }
.fmt input:focus-visible + span { outline: 3px solid #9fc2f5; }
.mic.recording { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.mic { justify-self: start; }
.mic svg, .button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.steps { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; counter-reset: s; }
.steps li { background: #fff; padding: 14px 16px; counter-increment: s; }
.steps li b { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.steps li b::before { content: counter(s); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px; margin-right: 6px; }
.steps li small { display: block; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.idea-card, .settings, .plan-card { padding: 18px 22px; margin-bottom: 22px; }
.idea-card h2, .plan-card h2, .final h2 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.02em; display: flex; align-items: center; gap: 4px; }
.idea-card h3 { margin: 14px 0 4px; font-size: 14px; color: var(--soft); } .idea-card p, .plan-card p { margin: 0; color: var(--soft); }
.settings label, .assistant label.inline, .scene label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--soft); }
.plan-card .row { margin-top: 14px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 14px; }
.toolbar h2 { margin: 0; font-size: 19px; } .toolbar h2 small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.scenes { display: grid; gap: 16px; }
.scene { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; padding: 18px; }
.scene-media { display: grid; gap: 8px; align-content: start; }
.scene-media img, .scene-media video, .scene-media .ph { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: #eaf0f3; }
.scene-media.portrait img, .scene-media.portrait video, .scene-media.portrait .ph { aspect-ratio: 9 / 16; max-height: 420px; object-fit: contain; }
.scene-media.square img, .scene-media.square video, .scene-media.square .ph { aspect-ratio: 1; }
.scene-media .ph { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.scene-media audio { width: 100%; height: 36px; }
.scene-body { display: grid; gap: 12px; min-width: 0; }
.scene-head { display: flex; align-items: center; gap: 10px; }
.scene-head .num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.scene-head input[type=text] { font-weight: 700; }
.scene-head .check { display: flex; align-items: center; gap: 6px; white-space: nowrap; margin-left: auto; font-weight: 600; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); flex: none; }
.icon-btn:hover { color: var(--red); border-color: var(--red); }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scene-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.scene-actions .button { padding: 9px 13px; font-size: 13px; }
.scene-actions .dur { display: flex; align-items: center; gap: 6px; }
.scene-actions .dur select { width: 64px; padding: 8px; }
.jobline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--soft); flex-wrap: wrap; }
.final { display: grid; grid-template-columns: 1fr auto; gap: 24px; padding: 20px 24px; margin-top: 22px; align-items: start; }
.final-video { width: min(480px, 100%); border-radius: 12px; background: #000; display: block; margin-bottom: 10px; }
.final-video.portrait { width: 240px; }

.grid-2.even { grid-template-columns: 1fr 1fr; }
.lane { padding: 18px 22px; } .lane h3 { margin: 0 0 8px; font-size: 17px; display: flex; align-items: center; gap: 4px; }
.lane .state { margin: 0 0 12px; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; } .kv span { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 12px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid #eef2f4; vertical-align: top; } tbody tr:last-child td { border-bottom: 0; }
td.empty { text-align: center; padding: 24px; }

.assistant { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: start; }
.roles { padding: 14px; display: grid; gap: 6px; }
.roles h3 { margin: 4px 8px 6px; font-size: 15px; }
.role { text-align: left; border: 1px solid transparent; background: none; border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.role:hover { background: #f4f7fa; } .role.on { background: var(--blue-soft); border-color: var(--blue-line); }
.role small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.chatbox .card-head { align-items: flex-start; flex-wrap: wrap; }
.chat-log.tall { max-height: 52vh; min-height: 260px; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 12px; }
.msg { position: relative; } .msg b small { font-weight: 500; margin-left: 6px; color: var(--muted); }
.msg .copy { display: block; margin-top: 8px; border: 0; background: none; color: var(--blue); font-size: 12.5px; padding: 0; font-weight: 600; }
label.inline { display: flex; align-items: center; gap: 6px; font-size: 13px; } label.inline select { width: auto; padding: 7px 10px; }
.doclist { display: grid; gap: 10px; margin-bottom: 18px; }
.doc { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.doc small { color: var(--muted); margin-left: 8px; } .doc p { margin: 6px 0 0; color: var(--soft); font-size: 13.5px; white-space: pre-wrap; }
.doc-form { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; } .doc-form h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 4px; }
label.file { cursor: pointer; }

@media (max-width: 1100px) { .scene { grid-template-columns: 220px minmax(0, 1fr); } .assistant { grid-template-columns: 220px minmax(0, 1fr); } .grid-2.even { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .scene { grid-template-columns: 1fr; } .two, .form-row, .form-row.three { grid-template-columns: 1fr; } .steps { grid-template-columns: 1fr 1fr; }
  .assistant { grid-template-columns: 1fr; } .final { grid-template-columns: 1fr; } .scene-head .check { margin-left: 0; }
  .top-status .pill:not(:first-child) { display: none; }
}

/* подсказка «?» остаётся в строке подписи, поле уходит на следующую строку */
.settings label, .scene label:not(.check):not(.dur), dialog form label, .auth label { display: flex; flex-wrap: wrap; align-items: center; column-gap: 4px; row-gap: 6px; }
.settings label > :is(select, textarea, input), .scene label:not(.check):not(.dur) > :is(select, textarea, input), dialog form label > :is(select, textarea, input) { flex: 1 1 100%; }
.scene label.dur { display: flex; align-items: center; gap: 6px; } .scene label.check { display: flex; align-items: center; gap: 6px; }
.assistant label.inline, .chatbox label.inline { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 6px; }
.chatbox label.inline > select { flex: 0 0 auto; }
.package { padding: 18px 22px; margin-top: 22px; } .package .toolbar { margin-top: 0; }
.package details { border-top: 1px solid var(--line); padding: 10px 0; } .package summary { font-weight: 700; cursor: pointer; padding: 4px 0; }
.pf { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; padding: 8px 0; align-items: start; font-size: 14px; }
.pf span { color: var(--muted); font-size: 13px; } .pf p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.pf .copy { border: 0; background: none; color: var(--blue); font-weight: 600; font-size: 12.5px; padding: 0; }
.issues { margin: 10px 0 0; padding-left: 18px; font-size: 14px; } .issues em { color: var(--soft); font-style: normal; display: block; }
.muted { color: var(--muted); margin: 0; }
@media (max-width: 860px) { .pf { grid-template-columns: 1fr; gap: 2px; } }

/* персонажи */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.char-card { display: block; color: inherit; text-decoration: none; overflow: hidden; transition: border-color .16s, transform .16s; }
.char-card:hover { border-color: var(--blue-line); transform: translateY(-1px); }
.char-pic img, .char-pic .ph { width: 100%; aspect-ratio: 1; object-fit: cover; display: grid; place-items: center; background: #eaf0f3; color: var(--muted); }
.char-meta { padding: 14px 16px 16px; } .char-meta h3 { margin: 0 0 8px; font-size: 16px; }
.style-card { margin-top: 16px; padding: 14px 18px; } .style-card summary { cursor: pointer; font-weight: 700; }
.style-card textarea { margin: 12px 0; }
.char-detail { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.views { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.view { margin: 0; } .view img, .view .ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #eaf0f3; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.view figcaption { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 6px; font-size: 13px; font-weight: 600; }
.mini { border: 0; background: none; color: var(--blue); font-size: 12.5px; font-weight: 600; padding: 0; cursor: pointer; } .mini:disabled { opacity: .4; cursor: default; }
.sub { margin: 4px 0 10px; font-size: 14px; color: var(--soft); }
.passport { display: grid; gap: 12px; } .passport label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--soft); }
.outfits { display: grid; gap: 8px; } .outfits small { color: var(--muted); } .outfit { display: grid; grid-template-columns: 120px 1fr; gap: 8px; }
@media (max-width: 1100px) { .char-detail { grid-template-columns: 1fr; } }
.music { padding: 18px 22px; margin-top: 22px; } .music .toolbar { margin-top: 0; }
.music-form { display: grid; gap: 12px; } .music-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--soft); }
.tracks { display: grid; gap: 8px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.track { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; } .track audio { height: 34px; max-width: 100%; }
.song-opt { display: block; } .song-opt span { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.song-opt[hidden] { display: none; }
.autopilot { padding: 16px 22px; margin-bottom: 22px; } .autopilot .toolbar { margin: 0 0 10px; } .autopilot.attn { border-color: var(--orange); background: #fffdf6; }
.auto-steps { list-style: none; display: flex; gap: 8px; flex-wrap: wrap; padding: 0; margin: 0 0 12px; counter-reset: a; }
.auto-steps li { counter-increment: a; padding: 6px 12px; border-radius: 999px; background: #eff4f7; color: var(--muted); font-size: 13px; font-weight: 600; }
.auto-steps li::before { content: counter(a) ". "; } .auto-steps li.done { background: var(--green-soft); color: var(--green); } .auto-steps li.now { background: var(--blue-soft); color: var(--blue); }

/* ---------- проект-рабочая область ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 14px; border-radius: 10px 10px 0 0; color: var(--soft); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab small { color: var(--muted); font-weight: 600; margin-left: 2px; }
.tab:hover { background: #fff8; color: var(--ink); }
.tab[aria-current="page"] { color: var(--blue); border-bottom-color: var(--blue); }
.tab-hint { margin: 12px 0 18px; color: var(--muted); font-size: 13px; max-width: 760px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--soft); padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.chip-btn.on { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.series-info p { margin: 0 0 8px; color: var(--soft); }
.table-wrap { overflow-x: auto; }
table.series { width: 100%; border-collapse: collapse; font-size: 14px; }
table.series th { text-align: left; padding: 10px 16px; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); background: #fafcfd; }
table.series td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.series tr:last-child td { border-bottom: 0; }
.card + .card, .card + form.card { margin-top: 16px; }
.prompt { padding: 0; margin-bottom: 10px; }
.prompt summary { cursor: pointer; padding: 14px 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; list-style: none; }
.prompt summary::-webkit-details-marker { display: none; }
.prompt summary::before { content: "▸"; color: var(--muted); }
.prompt[open] summary::before { content: "▾"; }
.prompt > p, .prompt > textarea, .prompt > .row { margin-left: 18px; margin-right: 18px; }
.prompt > textarea { width: calc(100% - 36px); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.prompt > .row { padding-bottom: 16px; }
.trash-row, .model-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.trash-row:last-child, .model-row:last-child { border-bottom: 0; }
.trash-row small, .model-row small { display: block; color: var(--muted); font-size: 12px; }
.model-row.top { align-items: flex-start; } .model-row p { margin: 6px 0 0; color: var(--soft); font-size: 13px; }
.add-model { margin-top: 14px; } .add-model summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.danger-zone { border-color: #f0c9ca; } .danger-zone h3 { margin: 0 0 6px; }
.checklist { margin: 4px 0 12px; font-size: 14px; } .checklist summary { cursor: pointer; font-weight: 600; } .checklist ul { margin: 8px 0 0; padding-left: 20px; color: var(--soft); }
.grid-2 > .card, .grid-2 > section.card { margin-top: 0; }

.net summary .muted { margin-left: auto; font-size: 12px; }
.net-steps { margin: 0 18px 12px 38px; padding: 0; color: var(--soft); font-size: 14px; } .net-steps li { margin: 6px 0; }
.net .cmd, .net > p, .net > .row { margin-left: 18px; margin-right: 18px; } .net > .row { padding-bottom: 16px; }
.card-body .net-steps { margin-left: 20px; }
.pill-link { text-decoration: none; color: var(--ink); border-color: #f0d9a8; background: #fffaf0; } .pill-link:hover { background: #fff3d6; }

/* ---------- процессор ---------- */
.cpu-map-title { margin-top: 22px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.cpu-map { display: flex; flex-wrap: wrap; gap: 18px 26px; margin-top: 10px; }
.cpu-group-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cpu-cores { display: flex; flex-wrap: wrap; gap: 6px; }
.cpu-core { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: #f3f6f8; }
.cpu-thread { position: relative; width: 14px; height: 56px; background: #e6edf1; border-radius: 4px; display: flex; align-items: flex-end; overflow: hidden; }
.cpu-thread span { position: absolute; left: 0; right: 0; top: 2px; text-align: center; font-size: 8px; color: #5a6a75; line-height: 1; pointer-events: none; }
.cpu-fill { width: 100%; border-radius: 4px; transition: height .4s; }
.cpu-fill.low { background: #0da46b; } .cpu-fill.mid { background: #e0a12c; } .cpu-fill.hot { background: #d84c50; }
.cpu-table td:nth-child(3) { width: 22%; } .mini-bar { height: 8px; background: #edf2f5; border-radius: 4px; overflow: hidden; } .mini-bar i { display: block; height: 100%; background: var(--blue); }
.cpu-procs { margin-top: 12px; } .cpu-procs summary { cursor: pointer; color: var(--blue); font-weight: 600; }

/* ---------- видеокарта и память ---------- */
.gstats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 18px; }
.gstat { background: #f6f9fb; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.gstat small { color: var(--muted); font-size: 12px; } .gstat b { font-size: 18px; letter-spacing: -.02em; } .gstat em { font-style: normal; color: var(--muted); font-size: 12px; }
.mem-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.mem-slot { display: flex; flex-direction: column; align-items: center; gap: 3px; } .mem-slot small { color: var(--muted); font-size: 11px; }
.mem-chip { width: 64px; height: 42px; border-radius: 6px; background: #eef3f6; border: 1px solid #d5dee3; position: relative; overflow: hidden; display: flex; align-items: flex-end; }
.mem-chip.wide { width: 180px; height: 34px; }
.mem-fill { width: 100%; display: flex; flex-direction: column-reverse; height: 100%; justify-content: flex-start; }
.mem-fill i { display: block; width: 100%; }
.dimms { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.dimm { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfc; }
.dimm b { display: block; } .dimm small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- ядра видеокарты ---------- */
.sm-head { margin-top: 10px; font-size: 22px; letter-spacing: -.02em; } .sm-head span { font-size: 14px; color: var(--muted); font-weight: 500; }
.sm-grid { display: grid; grid-template-columns: repeat(22, 1fr); gap: 4px; margin-top: 10px; max-width: 760px; }
.sm-tile { aspect-ratio: 1; border-radius: 4px; background: #e6edf1; border: 1px solid #d5dee3; transition: background .4s; }
.sm-tile.on { border-color: transparent; }
@media (max-width: 640px) { .sm-grid { grid-template-columns: repeat(11, 1fr); } }

/* ---------- планки оперативной памяти ---------- */
.vram-bar.cells { -webkit-mask-image: repeating-linear-gradient(90deg, #000 0, #000 calc(100% / var(--cells, 64) - 2px), transparent calc(100% / var(--cells, 64) - 2px), transparent calc(100% / var(--cells, 64))); mask-image: repeating-linear-gradient(90deg, #000 0, #000 calc(100% / var(--cells, 64) - 2px), transparent calc(100% / var(--cells, 64) - 2px), transparent calc(100% / var(--cells, 64))); }
.dimm2 { display: flex; flex-direction: column; gap: 6px; flex: 1 1 340px; max-width: 520px; }
.dimm2 small { color: var(--muted); font-size: 12px; }
.dimm2-pcb { background: linear-gradient(180deg, #22664a, #1b523b); border-radius: 8px 8px 4px 4px; padding: 8px 10px 0; position: relative; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.dimm2-top { display: flex; justify-content: space-between; gap: 10px; color: #e6f3ec; font-size: 12px; margin-bottom: 6px; } .dimm2-top b { font-weight: 700; }
.dimm2-chips { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.dimm2-chips .mem-chip.ic { width: 100%; height: 38px; border-radius: 3px; background: #2d3438; border: 1px solid #0f1417; }
.dimm2-chips .mem-chip.ic .mem-fill i { opacity: .95; }
.dimm2-pins { height: 14px; margin: 8px -10px 0; background: repeating-linear-gradient(90deg, #d9b45a 0 3px, transparent 3px 5px); position: relative; border-radius: 0 0 4px 4px; }
.dimm2-pins i { position: absolute; left: 58%; top: 0; bottom: 0; width: 7px; background: #1b523b; border-radius: 0 0 4px 4px; }

/* ---------- накопитель и сеть ---------- */
.spark { height: 64px; border-radius: 10px; background: #f6f9fb; border: 1px solid var(--line); overflow: hidden; margin: 8px 0 4px; } .spark svg { width: 100%; height: 100%; display: block; }
.spark.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.dot-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.tone-warn { color: #b9770e; } .tone-bad { color: #c2363b; }
.m2 { display: flex; align-items: stretch; margin-top: 12px; max-width: 760px; }
.m2-pins { width: 26px; background: repeating-linear-gradient(0deg, #d9b45a 0 3px, transparent 3px 5px); border-radius: 6px 0 0 6px; position: relative; } .m2-pins i { position: absolute; left: 0; right: 0; top: 46%; height: 9px; background: #2a3550; }
.m2-board { flex: 1; background: linear-gradient(180deg, #2a3a5c, #1f2c47); border-radius: 0 10px 10px 0; padding: 12px 14px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.m2-label { background: #f4f7fa; border-radius: 7px; padding: 9px 12px 10px; display: flex; flex-direction: column; gap: 4px; } .m2-label b { font-size: 14px; } .m2-label span { color: var(--muted); font-size: 12px; }
.m2-label .vram-bar { margin-top: 4px; height: 16px; }
.net-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.net-tile { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #f9fbfc; display: flex; flex-direction: column; gap: 4px; } .net-tile.warn { border-color: #e7b45c; background: #fffaf0; }
.net-tile small { color: var(--muted); font-size: 12px; }
.net-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.net-rates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 6px; } .net-rates > div { display: flex; flex-direction: column; } .net-rates b { font-size: 19px; letter-spacing: -.02em; } .net-rates em { font-style: normal; color: var(--muted); font-size: 12px; }

/* ---------- подсветка по зонам ---------- */
.zones { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; padding-left: 10px; border-left: 3px solid var(--line); }
.zone-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; } .zone-row span { font-size: 14px; }
.zone-row .button { min-width: 112px; }

/* ---------- ряды плиток ---------- */
.gstats-row { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; } .gstats-row .gstat { padding: 10px; } .gstats-row .gstat b { font-size: 17px; white-space: nowrap; }
@media (max-width: 1100px) { .gstats-row { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } }
.service-grid > .card { margin-top: 0; }

/* ---------- режим «Авто» при создании ролика ---------- */
.auto-modes { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 10px; margin: 0 0 12px; } .auto-modes legend { padding: 0 6px; font-weight: 600; }
.auto-modes label.auto-opt { display: flex; flex-direction: row; gap: 10px; align-items: flex-start; padding: 7px 4px; cursor: pointer; font-weight: 400; flex-wrap: nowrap; } .auto-modes .auto-opt input { margin: 4px 0 0; width: auto; flex: none; }
.auto-modes .auto-opt > span { display: flex; flex-direction: column; gap: 2px; flex: 1 1 0; min-width: 0; }
.auto-opt b { display: block; font-size: 14px; } .auto-opt small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.auto-opt:has(input:checked) b { color: var(--blue); }

/* ---------- кадр и мини-ролик рядом, увеличение кадра ---------- */
.scene:has(.scene-media.pair) { grid-template-columns: minmax(440px, 600px) minmax(0, 1fr); }
.scene-media.pair { grid-template-columns: 1fr 1fr; gap: 10px; } .scene-media.pair figure { margin: 0; display: grid; gap: 4px; align-content: start; min-width: 0; }
.scene-media.pair figcaption { font-size: 12px; color: var(--muted); }
.scene-media.pair audio { grid-column: 1 / -1; }
.scene-media img.zoomable { cursor: zoom-in; }
.note-field { display: grid; gap: 6px; } .note-field textarea { border-color: #e7b45c; background: #fffdf6; }
dialog.lightbox { border: 0; padding: 0; background: #0d1318; border-radius: 14px; max-width: 96vw; max-height: 94vh; width: 96vw; overflow: hidden; }
dialog.lightbox::backdrop { background: rgba(10, 16, 22, .82); }
.lb-scroll { overflow: auto; max-height: 90vh; display: grid; place-items: center; }
.lb-scroll img { display: block; cursor: zoom-in; max-width: 94vw; max-height: 88vh; object-fit: contain; }
.lb-scroll img[data-zoom="1"] { max-width: none; max-height: none; width: auto; cursor: zoom-in; }
.lb-scroll img[data-zoom="2"] { max-width: none; max-height: none; width: 200%; cursor: zoom-out; }
.lb-close { position: absolute; top: 8px; right: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 24px; line-height: 1; cursor: pointer; }
.lb-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: #cfd8de; font-size: 12.5px; pointer-events: none; }
@media (max-width: 1100px) { .scene:has(.scene-media.pair) { grid-template-columns: 1fr; } }

/* ---------- мастер нового проекта ---------- */
dialog form.wizard { min-width: min(720px, 92vw); }
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 14px 0; }
.kind-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.kind-card:hover, .kind-card:focus-visible { border-color: var(--blue-line); background: var(--blue-soft); outline: none; }
.kind-card b { font-size: 15px; } .kind-card small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.kind-ico { width: 30px; height: 30px; color: var(--blue); } .kind-ico svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.8; }
fieldset.multi { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 4px 14px; } fieldset.multi legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--soft); }
.idea-full { white-space: pre-wrap; color: var(--soft); margin: 0 0 14px; }

/* ---------- готовый ролик: Shorts, обложка, субтитры ---------- */
.extras { margin-top: 16px; display: grid; gap: 12px; } .extras h3 { margin: 0; font-size: 15px; }
.extra-thumb { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; } .extra-thumb img { width: 320px; max-width: 100%; border-radius: 10px; display: block; }
.extra-shorts { display: flex; gap: 12px; flex-wrap: wrap; } .extra-shorts figure { margin: 0; width: 170px; } .extra-shorts video { width: 100%; aspect-ratio: 9 / 16; border-radius: 10px; background: #0d1318; object-fit: cover; }
.extra-shorts figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- мастер: всё помещается ---------- */
dialog.xwide { width: min(940px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
dialog form.wizard { min-width: 0; }
.kind-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 8px; margin: 12px 0 8px; }
.kind-card { padding: 11px 12px; gap: 3px; min-width: 0; } .kind-card b { font-size: 14px; overflow-wrap: anywhere; } .kind-card small { font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.kind-ico { width: 28px; height: 28px; margin-bottom: 2px; flex: none; } .kind-ico.small { width: 24px; height: 24px; display: inline-block; vertical-align: -5px; margin-right: 8px; }
.kind-ico svg { stroke-linecap: round; stroke-linejoin: round; }
.wiz-title { display: flex; align-items: center; }
.u-actions { white-space: nowrap; } .u-actions .button { padding: 5px 9px; font-size: 12.5px; } .u-actions .danger { color: #c2363b; }
td.detail { max-width: 420px; overflow-wrap: anywhere; color: var(--soft); font-size: 12.5px; }
.cred { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; margin: 6px 0; } .cred small { color: var(--muted); } .cred code { background: #f1f5f8; padding: 6px 9px; border-radius: 8px; overflow-wrap: anywhere; }
dialog:has(.wide-log) { width: min(980px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }

.u-actions { white-space: normal; } .u-actions .button { margin: 2px 2px 2px 0; }

/* таблицы «кто занимает …»: высота постоянная, лишние строки прокручиваются внутри блока, страница не дёргается */
.proc-scroll { height: 280px; overflow-y: auto; overflow-x: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; scrollbar-gutter: stable; }
.proc-scroll table.series th { position: sticky; top: 0; z-index: 1; }
.proc-scroll table.series tr:last-child td { border-bottom: 0; }
