:root {
  --bg: #1c1f26;
  --panel: #23262f;
  --panel-2: #2a2e38;
  --line: #353a46;
  --text: #e7e9ee;
  --muted: #98a0b0;
  --accent: #4c8dff;
  --accent-2: #34c17b;
  --danger: #e5544b;
  --sel: #4c8dff;
  --radius: 8px;
  --app-min-width: 1280px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  font-size: 13px;
  user-select: none;
}

/* Desktop contract: 1280 CSS px is the supported minimum. Narrower windows
   keep the complete desktop layout and scroll at the document boundary instead
   of silently clipping controls. Feature surfaces own their vertical overflow. */
html {
  min-width: var(--app-min-width);
  overflow-x: auto;
  overflow-y: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-width: var(--app-min-width);
  overflow: hidden;
}

/* ---------- Toolbar ---------- */
/* Осмысленные группы-«пилюли» в порядке работы: добавить → разложить → лист → проект → экспорт → вид.
   .tb-row = display:contents: группы текут одним потоком и переносятся без «сирот» на любой ширине. */
#toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.tb-row { display: contents; }
.tb-group {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, .028);
  border: 1px solid rgba(255, 255, 255, .055);
  border-radius: 10px;
}
/* в тулбаре элементы компактнее, чем в панелях */
#toolbar .btn { padding: 6px 10px; }
#toolbar .btn.icon { padding: 5px 8px; }
#toolbar .select, #toolbar .num { padding: 5px 7px; }
#toolbar .num { width: 52px; }
#toolbar input[type="color"] { width: 30px; height: 28px; }
.tb-group.zoom { gap: 4px; }
.tb-menu { position: relative; flex: none; }
.tb-menu-trigger[aria-expanded="true"] { border-color: var(--accent); background: #333846; }
.tb-menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 230px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.tb-menu-pop.align-end { right: 0; left: auto; }
.tb-menu-item {
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.tb-menu-item:hover, .tb-menu-item:focus-visible { background: #333846; }
.tb-cap {
  font-size: 10px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: #78808f;
  margin: 0 4px 0 2px;
}
.tb-sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.tb-sep.small { height: 18px; }
.tb-spacer { flex: 1; }
.tb-label { color: var(--muted); font-size: 12px; }
.tb-check { cursor: pointer; white-space: nowrap; }
.tb-check input { vertical-align: -2px; margin-right: 4px; cursor: pointer; }
.proj-name {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  width: 150px;
}

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #333846; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #3f7ff0; }
.btn.accent { background: var(--accent-2); border-color: var(--accent-2); color: #06281a; font-weight: 600; }
.btn.accent:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: 6px 8px; font-size: 12px; flex: 1; }
.btn.icon { padding: 6px 9px; font-size: 15px; line-height: 1; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- Unified confirm dialog ---------- */
.dialog-host {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 14, .74);
}
.csm-dialog {
  width: min(460px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .58);
}
.csm-dialog-danger { border-color: var(--danger); box-shadow: 0 24px 64px rgba(82, 12, 12, .45); }
.csm-dialog-normal { border-color: var(--accent); }
.csm-dialog-header { display: flex; align-items: flex-start; gap: 16px; }
.csm-dialog-title { flex: 1; margin: 0; font-size: 17px; line-height: 1.35; }
.csm-dialog-danger .csm-dialog-title { color: #ffb5b0; }
.csm-dialog-close {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}
.csm-dialog-close:hover { background: #333846; }
.csm-dialog-message {
  margin: 14px 0 20px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-line;
  user-select: text;
}
.csm-dialog-message:empty { display: none; }
.csm-dialog-form { display: grid; gap: 14px; }
.csm-dialog-form .csm-dialog-message { margin-bottom: 6px; }
.csm-dialog-body { display: grid; gap: 7px; }
.csm-dialog-label { color: var(--text); font-size: 12px; font-weight: 600; }
.csm-dialog-control {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  user-select: text;
}
textarea.csm-dialog-control { min-height: 110px; resize: vertical; }
.csm-dialog-error { min-height: 18px; color: var(--danger); font-size: 12px; line-height: 1.4; }
.csm-dialog-choices { min-width: 0; margin: 0; padding: 0; border: 0; display: grid; gap: 7px; }
.csm-dialog-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.csm-dialog-choice-input { margin-top: 3px; }
.csm-dialog-choice-label { display: grid; gap: 3px; cursor: pointer; }
.csm-dialog-choice-name { color: var(--text); overflow-wrap: anywhere; }
.csm-dialog-choice-description { color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.csm-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.csm-dialog-actions .btn { min-width: 110px; }

/* ---------- Web identity and account management ---------- */
.login-box.identity-login-box {
  width: min(640px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  overflow-y: auto;
  gap: 14px;
}
.identity-dialog-head,
.identity-dialog-toolbar,
.identity-banner-actions,
.identity-account-actions,
.identity-token-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.identity-dialog-head { align-items: flex-start; justify-content: space-between; }
.identity-dialog-head .login-title { margin: 0; }
.identity-close {
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.identity-close:hover,
.identity-close:focus-visible { color: var(--text); background: var(--panel-2); }
.identity-auth-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.identity-auth-tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}
.identity-auth-tab.active,
.identity-auth-tab[aria-selected="true"] { border-color: var(--accent); color: var(--text); background: rgba(76, 141, 255, .12); }
.identity-auth-form { display: grid; gap: 7px; }
.identity-auth-form label,
.identity-field-label { color: var(--text); font-size: 12px; font-weight: 600; }
.identity-form-note,
.identity-field-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.identity-form-note.warning { color: #f4c56d; }
.identity-token-input,
.identity-token-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.identity-auth-form input,
.identity-field input,
.identity-token-code { user-select: text; }
.identity-legacy-banner {
  position: relative;
  z-index: 20;
  flex: none;
  width: auto;
  margin: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 12px;
  border: 1px solid #9c6b22;
  border-radius: 10px;
  background: #392b18;
  color: #ffe2a6;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
  font-size: 12px;
}
.identity-legacy-banner.hidden { display: none; }
.identity-banner-actions { flex: none; flex-wrap: wrap; justify-content: flex-end; }
.identity-modal {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 6, 10, .76);
}
.identity-modal-panel {
  width: min(760px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 24px 72px rgba(0, 0, 0, .55);
}
.identity-modal-title { flex: 1; margin: 0; font-size: 18px; }
.identity-modal-content { display: grid; gap: 14px; }
.identity-section {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .018);
}
.identity-section-title { margin: 0; font-size: 14px; }
.identity-invite-grid { display: grid; grid-template-columns: 1fr 1.35fr minmax(120px, .7fr) auto; gap: 8px; align-items: end; }
.identity-field { display: grid; gap: 5px; min-width: 0; }
.identity-field input,
.identity-field select {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.identity-account-list { display: grid; gap: 8px; }
.identity-account-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
}
.identity-account-permissions { grid-column: 1 / -1; display: grid; gap: 8px; padding-top: 9px; border-top: 1px solid var(--line); }
.identity-permission-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.identity-permission-group { min-width: 0; display: grid; align-content: start; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(10,15,25,.22); }
.identity-permission-group-title { color: #f0f5ff; font-size: 14px; }
.identity-permission-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.identity-permission-toggle { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: #dce5f4; background: rgba(255,255,255,.022); font-size: 13px; line-height: 1.35; cursor: pointer; }
.identity-permission-toggle:has(input:checked) { border-color: rgba(55,199,132,.55); background: rgba(55,199,132,.09); }
.identity-permission-toggle input { flex: 0 0 auto; width: 17px; height: 17px; }
.identity-account-permissions > .btn { justify-self: start; }
.identity-account-name { font-weight: 600; overflow-wrap: anywhere; }
.identity-account-meta { margin-top: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.identity-account-actions { flex-wrap: wrap; justify-content: flex-end; }
.identity-account-actions label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; }
.identity-account-actions select { min-width: 110px; }
.identity-token-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #8a6b25;
  border-radius: 9px;
  background: #302816;
}
.identity-token-code {
  display: block;
  padding: 8px;
  border-radius: 6px;
  background: #171717;
  color: #ffe8a8;
  overflow-wrap: anywhere;
  user-select: all;
}
.identity-status { min-height: 18px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.identity-status.error { color: var(--danger); }
.identity-status.success { color: #7bd99a; }
.legacy-recovery-card {
  display: grid;
  gap: 8px;
  margin: 7px 0 12px;
  padding: 10px;
  border: 1px solid #765f2d;
  border-radius: 9px;
  background: rgba(121, 90, 31, .12);
}
.legacy-recovery-title { margin: 0; color: var(--text); font-size: 13px; }
.legacy-recovery-status { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.legacy-recovery-status.warning { color: #f4c56d; }
.legacy-recovery-status.error,
.legacy-recovery-error { color: var(--danger); }
.legacy-recovery-status.success { color: #7bd99a; }
.legacy-recovery-controls { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.legacy-recovery-form { width: 100%; display: grid; gap: 8px; }
.legacy-recovery-error { min-height: 18px; font-size: 12px; line-height: 1.45; }
.legacy-recovery-complete:disabled { opacity: 1; color: #7bd99a; border-color: #3f8157; }
.identity-modal-panel.task-center-dialog { width: min(920px, calc(100vw - 32px)); }
.task-center-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .018);
}
.task-center-intro { margin: 0; color: var(--text); font-size: 13px; line-height: 1.45; }
.task-center-contract-note { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.task-center-refresh { flex: none; }
.task-center-reset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 48%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
}
.task-center-reset-copy { min-width: 0; }
.task-center-reset-title { margin: 0; color: var(--text); font-size: 14px; }
.task-center-reset-note { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.task-center-reset-button { flex: none; min-height: 40px; white-space: nowrap; }
.task-center-reset-feedback { flex: 1 0 100%; min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; }
.task-center-reset-feedback.success { color: var(--success); }
.task-center-reset-feedback.error { color: var(--danger); }
.task-center-view { min-height: 120px; }
.task-center-message { margin: 0; padding: 20px 12px; color: var(--muted); text-align: center; }
.task-center-message.error { color: var(--danger); }
.task-center-section { display: grid; gap: 8px; }
.task-center-section + .task-center-section { margin-top: 18px; }
.task-center-section-title { margin: 0; color: var(--text); font-size: 14px; }
.task-center-section-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.task-center-list { display: grid; gap: 10px; }
.task-center-job {
  padding: 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--panel-2);
}
.task-center-job-queued { border-left-color: #d6a84c; }
.task-center-job-active { border-left-color: var(--accent); }
.task-center-job-succeeded { border-left-color: #55b879; }
.task-center-job-failed { border-left-color: var(--danger); }
.task-center-job-cancelled { border-left-color: #999; }
.task-center-receipt-reserved { border-left-color: #d6a84c; }
.task-center-receipt-active { border-left-color: #79b7ff; }
.task-center-receipt-manual {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--panel-2) 88%, var(--danger));
}
.task-center-job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.task-center-job-title { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.task-center-state {
  flex: none;
  padding: 3px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.task-center-state-queued { color: #e7bd69; }
.task-center-state-active { color: #79b7ff; }
.task-center-state-succeeded { color: #7bd99a; }
.task-center-state-failed { color: #ff9189; }
.task-center-state-cancelled,
.task-center-state-unknown { color: #bbb; }
.task-center-state-reserved { color: #e7bd69; }
.task-center-state-manual { color: #ff9189; }
.task-center-receipt-action,
.task-center-receipt-overflow {
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--line));
  border-radius: 8px;
  color: #ffaaa3;
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  font-size: 12px;
  line-height: 1.45;
}
.task-center-receipt-overflow { margin: 0; color: #f4c56d; border-color: #7f682f; }
.task-center-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 16px; margin-top: 9px; }
.task-center-meta-row { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px; font-size: 12px; line-height: 1.4; }
.task-center-meta-label { color: var(--muted); }
.task-center-meta-value { color: var(--text); overflow-wrap: anywhere; user-select: text; }
.task-center-result-link {
  display: inline-flex;
  width: max-content;
  margin-top: 10px;
  text-decoration: none;
}
.identity-modal :focus-visible,
.identity-login-box :focus-visible,
.identity-legacy-banner :focus-visible,
.legacy-recovery-card :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) {
  .identity-legacy-banner { align-items: flex-start; flex-direction: column; }
  .identity-banner-actions { justify-content: flex-start; }
  .identity-invite-grid { grid-template-columns: 1fr; }
  .identity-account-row { grid-template-columns: 1fr; }
  .identity-account-actions { justify-content: flex-start; }
  .identity-permission-groups { grid-template-columns: 1fr; }
  .identity-permission-toggles { grid-template-columns: 1fr; }
  .task-center-toolbar { flex-direction: column; }
  .task-center-reset { align-items: stretch; flex-direction: column; }
  .task-center-meta { grid-template-columns: 1fr; }
}

.select, .num, input[type="color"] {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}
.select.full, .num.full { width: 100%; }
.num { width: 62px; }
input[type="color"] { width: 34px; height: 32px; padding: 2px; cursor: pointer; }

:where(button, input, select, textarea, a[href], [tabindex]):focus-visible {
  outline: 2px solid #9bc5ff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(76, 141, 255, .24);
}

.zoom-label { min-width: 46px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Workspace ---------- */
#workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}
#workspace.hidden { display: none; }

/* Sidebar */
#sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 10px;
}
.sb-hint { color: var(--muted); font-size: 12px; margin-bottom: 10px; line-height: 1.4; }

.cat {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--panel-2);
  font-weight: 600;
}
.cat-head .count { color: var(--muted); font-weight: 400; font-size: 12px; }
.cat-drop {
  padding: 8px;
  min-height: 44px;
}
.cat-drop.drag-over { background: rgba(76,141,255,.12); outline: 2px dashed var(--accent); outline-offset: -6px; }
.dropzone-label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 10px 4px;
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.thumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border-radius: 6px;
  margin-bottom: 5px;
  cursor: pointer;
  background: var(--panel-2);
}
.thumb:hover { background: #333846; }
.thumb.selected { outline: 2px solid var(--sel); }
.thumb.hidden-item { opacity: .45; }
.thumb.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.thumb.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.thumb img {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: #000;
  flex: none;
}
.thumb .t-name {
  flex: 1;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thumb .t-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
}
.thumb .t-btn:hover { color: var(--text); background: rgba(255,255,255,.08); }

/* Viewport / board */
#viewport {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  touch-action: none;
  background:
    repeating-conic-gradient(#20242c 0% 25%, #191c22 0% 50%) 50% / 28px 28px;
  cursor: default;
}
#viewport.panning { cursor: grabbing; }
/* зажатый пробел — «рука»: курсор grab поверх всего, включая фото и маркеры */
#viewport.space-pan, #viewport.space-pan .item, #viewport.space-pan .handle { cursor: grab; }
#viewport.space-pan.panning, #viewport.space-pan.panning .item, #viewport.space-pan.panning .handle { cursor: grabbing; }

#board {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  /* will-change ставится ТОЛЬКО во время жеста (класс .gesture): в покое доска
     перерисовывается резко под текущий зум/DPI, а не растягивается кэш-текстурой (мыло как в старой версии) */
}
#board.gesture { will-change: transform; }
#board.custom-size { outline: calc(2px / var(--vs, 1)) solid var(--sel); }

.board-resize-handle {
  position: absolute;
  display: none;
  z-index: 10020;
  box-sizing: border-box;
}
#board.custom-size > .board-resize-handle { display: block; }
.board-resize-handle.n,
.board-resize-handle.s {
  left: calc(16px / var(--vs, 1));
  right: calc(16px / var(--vs, 1));
  height: calc(14px / var(--vs, 1));
  cursor: ns-resize;
}
.board-resize-handle.n { top: calc(-7px / var(--vs, 1)); }
.board-resize-handle.s { bottom: calc(-7px / var(--vs, 1)); }
.board-resize-handle.e,
.board-resize-handle.w {
  top: calc(16px / var(--vs, 1));
  bottom: calc(16px / var(--vs, 1));
  width: calc(14px / var(--vs, 1));
  cursor: ew-resize;
}
.board-resize-handle.e { right: calc(-7px / var(--vs, 1)); }
.board-resize-handle.w { left: calc(-7px / var(--vs, 1)); }
.board-resize-handle.nw,
.board-resize-handle.ne,
.board-resize-handle.se,
.board-resize-handle.sw {
  width: calc(15px / var(--vs, 1));
  height: calc(15px / var(--vs, 1));
  border: calc(2px / var(--vs, 1)) solid #fff;
  border-radius: 50%;
  background: var(--sel);
}
.board-resize-handle.nw { left: calc(-8px / var(--vs, 1)); top: calc(-8px / var(--vs, 1)); cursor: nwse-resize; }
.board-resize-handle.ne { right: calc(-8px / var(--vs, 1)); top: calc(-8px / var(--vs, 1)); cursor: nesw-resize; }
.board-resize-handle.se { right: calc(-8px / var(--vs, 1)); bottom: calc(-8px / var(--vs, 1)); cursor: nwse-resize; }
.board-resize-handle.sw { left: calc(-8px / var(--vs, 1)); bottom: calc(-8px / var(--vs, 1)); cursor: nesw-resize; }

.item {
  position: absolute;
  outline: 1px solid rgba(0,0,0,.04);
}
.item .clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.item img {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  image-rendering: auto;
}
.item.selected { outline: none; }
.item .frame {
  position: absolute;
  inset: 0;
  border: calc(1.5px / var(--vs, 1)) solid var(--sel);
  pointer-events: none;
  display: none;
}
.item.selected .frame { display: block; }

.handle {
  position: absolute;
  width: calc(11px / var(--vs, 1));
  height: calc(11px / var(--vs, 1));
  background: #fff;
  border: calc(1.5px / var(--vs, 1)) solid var(--sel);
  border-radius: 2px;
  display: none;
  z-index: 5;
}
/* обычный режим: только углы (пропорциональный масштаб);
   края — только в режиме обрезки ✂, как в Figma */
.item.selected.solo .handle:not(.edge) { display: block; }

/* Текстовый блок на листе */
.item .tx {
  position: absolute;
  inset: 0;
  white-space: pre;
  line-height: 1.3;
  font-family: "Segoe UI", Arial, sans-serif;
  pointer-events: none;
  overflow: visible;
}
.item.text-item { outline: none; }

/* Режим обрезки: показываем все маркеры и подсвечиваем рамку оранжевым */
.item.crop-mode .handle { display: block; background: #ffb020; border-color: #ff8a00; }
.item.crop-mode .handle.edge { display: block; }
.item.crop-mode .frame { display: block; border-color: #ffb020; }

/* Режим «двигать кадр» (двойной клик): пунктирная рамка, курсор перемещения */
.item.pan-mode { cursor: move; }
.item.pan-mode .frame { display: block; border-style: dashed; }

/* «Магниты» моей раскладки: полупрозрачные ячейки видны только во время перетаскивания */
.slot-ghosts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 55;
}
.slot-ghost {
  position: absolute;
  border: calc(2px / var(--vs, 1)) dashed rgba(124, 58, 237, 0.55);
  background: rgba(124, 58, 237, 0.07);
  border-radius: calc(6px / var(--vs, 1));
  transition: background 0.12s, border-color 0.12s;
}
.slot-ghost.hot {
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.95);
  border-style: solid;
}
.slot-ghost .sg-name {
  position: absolute;
  top: calc(4px / var(--vs, 1));
  left: calc(6px / var(--vs, 1));
  font-size: calc(12px / var(--vs, 1));
  line-height: 1.4;
  color: rgba(93, 34, 196, 0.95);
  background: rgba(255, 255, 255, 0.78);
  padding: 0 calc(5px / var(--vs, 1));
  border-radius: calc(3px / var(--vs, 1));
  white-space: nowrap;
}

/* Вкладки и Примерочная */
#tabsBar { display: flex; align-items: flex-end; gap: 6px; min-width: 0; padding: 4px 10px 0; background: #1b1d21; border-bottom: 1px solid #2a2d33; }
#tabsBar .tab { background: transparent; color: #9aa0aa; border: 0; padding: 7px 16px; cursor: pointer; border-radius: 8px 8px 0 0; font-size: 13px; }
#tabsBar .tab.active { background: #24262c; color: #fff; }
#tabsBar #userBox {
  min-width: 0;
  max-width: 48%;
  margin: 0 0 4px auto;
  padding: 2px 4px 2px 8px;
}
#tabsBar #userLabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#tabsBar #btnLogout,
#tabsBar #btnAccountPassword,
#tabsBar #btnAccounts,
#tabsBar #btnTaskCenter { flex: none; padding: 4px 8px; font-size: 12px; }
#tryonView, #genView { flex: 1; min-height: 0; display: flex; gap: 16px; padding: 16px; overflow: auto; background: #202227; }
#tryonView.hidden, #genView.hidden { display: none; }
#tryonView { gap: 0; padding: 0; overflow: hidden; }
.gen-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.gen-seed { width: 110px; }
.gen-refrow { margin-top: 4px; }
.gen-refdrop { flex: 1; min-width: 220px; min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; color: var(--muted); font-size: 12px; border: 1px dashed var(--line); border-radius: 8px; cursor: pointer; }
.gen-refdrop.drag { border-color: var(--accent); background: rgba(76,141,255,.10); }
.gen-refdrop.has { color: var(--text); border-style: solid; }
.gen-refdrop img { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; flex: none; }
textarea.tr-prompt { resize: vertical; font-family: inherit; }
.tr-left { flex: 1; max-width: 640px; }
.tryon-panel {
  width: 330px;
  min-width: 330px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #1b1d22;
  border-right: 1px solid #30343b;
  padding: 14px;
  box-sizing: border-box;
}
.tr-title { color: #d5d9e0; font-size: 14px; margin-bottom: 10px; }
.tr-slots { display: flex; gap: 12px; margin-bottom: 10px; }
.tryon-panel .tr-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tr-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.tr-slot { width: 150px; height: 200px; border: 2px dashed #4a4f59; border-radius: 10px; display: flex; align-items: center; justify-content: center; text-align: center; color: #8b919c; cursor: pointer; font-size: 13px; overflow: hidden; background: #26282e; }
.tryon-panel .tr-slot { width: auto; height: 128px; min-width: 0; border-radius: 8px; font-size: 12px; }
.tr-slot:hover { border-color: #7c3aed; color: #cbd0da; }
.tr-slot.filled { border-style: solid; border-color: #7c3aed; }
.tr-slot img { width: 100%; height: 100%; object-fit: cover; }
.tr-prompt { width: 100%; box-sizing: border-box; margin-bottom: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid #3a3e46; background: #26282e; color: #e8eaee; }
.tr-status { margin-top: 8px; color: #9aa0aa; font-size: 13px; min-height: 18px; }
.tr-result { margin-top: 10px; }
.tr-result img { max-width: 100%; max-height: 52vh; border-radius: 10px; border: 1px solid #3a3e46; }
.tr-history { width: 300px; flex: none; }
.tryon-history { width: auto; flex: 1; min-height: 0; margin-top: 16px; display: flex; flex-direction: column; }
.tryon-history #histList { overflow-y: auto; min-height: 0; padding-right: 2px; }
.tryon-stage {
  flex: 1;
  min-width: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 28px;
  box-sizing: border-box;
  background: #2b2f36;
}
.tryon-sheet {
  width: min(760px, 100%);
  min-height: calc(100vh - 150px);
  background: #f3f2ee;
  box-shadow: 0 14px 42px rgba(0,0,0,.42);
  border: 1px solid rgba(0,0,0,.08);
  padding: 28px;
  box-sizing: border-box;
  display: flex;
}
.tr-result-sheet {
  margin: 0;
  width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tr-result-sheet img {
  max-width: 100%;
  max-height: calc(100vh - 210px);
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}
.tryon-empty {
  color: #9a9a9a;
  font-size: 14px;
  text-align: center;
}
.hist-item { display: flex; align-items: center; gap: 8px; background: #26282e; border: 1px solid #33363e; border-radius: 8px; padding: 6px; margin-bottom: 8px; }
.hist-item[draggable="true"] { cursor: grab; }
.hist-item[draggable="true"]:active { cursor: grabbing; }
.hist-item img { width: 56px; height: 74px; object-fit: cover; border-radius: 6px; cursor: grab; flex: none; }
.hist-item .hi-meta { flex: 1; color: #aab0ba; font-size: 11.5px; line-height: 1.35; }
.hist-item .hi-acts { display: flex; flex-direction: column; gap: 4px; flex: none; }

/* слот примерочной — подсветка при перетаскивании с полки */
.tr-slot.drag-over { border-color: #7c3aed; background: #2e2740; }

/* Полка результатов — выезжающая панель справа, поверх обеих вкладок */
#resultTray {
  position: fixed; top: 0; right: 0; height: 100vh; width: 300px;
  background: #1c1e23; border-left: 1px solid #33363e; box-shadow: -6px 0 20px rgba(0,0,0,0.4);
  transform: translateX(100%); transition: transform 0.18s ease; z-index: 2000;
  display: flex; flex-direction: column; padding: 12px; box-sizing: border-box;
}
#resultTray.open { transform: translateX(0); }
#resultTray .tray-head { display: flex; align-items: center; justify-content: space-between; color: #e6e9ee; font-size: 14px; margin-bottom: 6px; }
#resultTray .tray-hint { color: #8b919c; font-size: 11.5px; margin-bottom: 10px; }
#trayList { overflow-y: auto; flex: 1; }

/* Курсор сотрудника в режиме наблюдения (координаты листа, компенсируем зум через --vs) */
.live-cursor {
  position: absolute;
  z-index: 60;
  pointer-events: none;
  transition: left 0.18s linear, top 0.18s linear;
}
.live-cursor .lc-dot {
  width: calc(12px / var(--vs, 1));
  height: calc(12px / var(--vs, 1));
  border-radius: 50%;
  background: #ff5722;
  border: calc(2px / var(--vs, 1)) solid #fff;
  box-shadow: 0 0 calc(6px / var(--vs, 1)) rgba(0, 0, 0, 0.45);
}
.live-cursor .lc-name {
  margin-top: calc(4px / var(--vs, 1));
  background: #ff5722;
  color: #fff;
  font-size: calc(12px / var(--vs, 1));
  padding: calc(2px / var(--vs, 1)) calc(6px / var(--vs, 1));
  border-radius: calc(4px / var(--vs, 1));
  white-space: nowrap;
  width: max-content;
}

/* Баннер режима наблюдения */
.live-banner {
  position: fixed;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  background: #7c3aed;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-size: 13px;
}
.live-banner button {
  background: #fff;
  color: #7c3aed;
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
}

.handle.nw { left: calc(-6px / var(--vs, 1)); top: calc(-6px / var(--vs, 1)); cursor: nwse-resize; }
.handle.ne { right: calc(-6px / var(--vs, 1)); top: calc(-6px / var(--vs, 1)); cursor: nesw-resize; }
.handle.sw { left: calc(-6px / var(--vs, 1)); bottom: calc(-6px / var(--vs, 1)); cursor: nesw-resize; }
.handle.se { right: calc(-6px / var(--vs, 1)); bottom: calc(-6px / var(--vs, 1)); cursor: nwse-resize; }
.handle.n { top: calc(-6px / var(--vs, 1)); left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.handle.s { bottom: calc(-6px / var(--vs, 1)); left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.handle.w { left: calc(-6px / var(--vs, 1)); top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.handle.e { right: calc(-6px / var(--vs, 1)); top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.guide {
  position: absolute;
  background: #ff3b6b;
  display: none;
  z-index: 9999;
  pointer-events: none;
}
.guide.vertical { top: 0; width: calc(1px / var(--vs, 1)); height: 100%; }
.guide.horizontal { left: 0; height: calc(1px / var(--vs, 1)); width: 100%; }

.empty-hint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: min(560px, calc(100% - 40px));
  padding: 22px 28px;
  border: 1px solid rgba(190, 201, 219, .28);
  border-radius: 14px;
  background: rgba(18, 21, 27, .92);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .38);
  text-align: center;
  color: #cbd2de;
  pointer-events: auto;
}
.empty-hint .eh-icon { font-size: 44px; margin-bottom: 10px; }
.empty-hint .eh-title { font-size: 17px; font-weight: 600; color: #fff; margin-bottom: 7px; }
.empty-hint .eh-text { font-size: 13.5px; line-height: 1.55; }
.empty-hint .eh-steps { margin: 10px 0 8px; padding-left: 24px; text-align: left; font-size: 12.5px; line-height: 1.55; }
.empty-hint .eh-terms { max-width: 480px; color: var(--muted); font-size: 11.5px; line-height: 1.4; text-align: left; }
.empty-hint-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #aeb7c6;
  font: 26px/30px Arial, sans-serif;
  cursor: pointer;
  pointer-events: auto;
}
.empty-hint-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.empty-hint-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty-hint.hidden { display: none; }

/* Inspector */
#inspector {
  width: 250px;
  min-width: 250px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 12px;
}
.insp-empty { color: var(--muted); font-size: 12px; line-height: 1.5; }
.insp-body.hidden, .insp-empty.hidden { display: none; }
.insp-name { font-weight: 600; margin-bottom: 2px; word-break: break-all; }
.insp-res { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span { color: var(--muted); font-size: 12px; }
.field-row { display: flex; gap: 8px; }
.field.small { flex: 1; }
.insp-tip { color: var(--muted); font-size: 11px; margin: -4px 0 12px; line-height: 1.4; display: none; }
.insp-tip.show { display: block; }
.insp-actions { display: flex; gap: 6px; margin-bottom: 8px; }

#photoProps.hidden, #textProps.hidden { display: none; }
.hidden, .hidden0 { display: none !important; }
.web-modal-sec {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin: 10px 0 2px;
  text-transform: none;
}
#ispZoom { width: 100%; cursor: pointer; }
.insp-hint { color: var(--muted); font-weight: 400; font-size: 11px; }
.ratio-row { display: flex; gap: 4px; flex-wrap: wrap; }
.ratio-row .btn { flex: 1; padding: 5px 4px; font-size: 12px; }
.txtarea {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
  resize: vertical;
  font-family: inherit;
}
#txColor { width: 100%; height: 32px; }

/* Statusbar */
#statusbar {
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.build-tag {
  margin-left: auto;
  padding-left: 12px;
  color: var(--muted);
  font-size: 11px;
  opacity: .8;
  white-space: nowrap;
}

/* Общий drop-overlay при перетаскивании файлов в окно */
#viewport.drag-over::after {
  content: "Отпустите, чтобы добавить фото";
  position: absolute;
  inset: 16px;
  border: 3px dashed var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 18px;
  background: rgba(76,141,255,.08);
  z-index: 10000;
  pointer-events: none;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3f4c; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* --- Панель-план «Макро» --- */
.macro-plan {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(10, 12, 16, .62);
  display: flex; align-items: center; justify-content: center;
}
.macro-plan.hidden { display: none; }
.macro-plan .mp-box {
  width: min(560px, 94vw); max-height: 90vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 18px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.mp-title { color: #e6e9ee; font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.mp-sub { color: #8b919c; font-size: 12px; line-height: 1.4; margin-bottom: 12px; }
.mp-note {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: var(--panel-2); color: #e6e9ee; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 12px;
}
.mp-count-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; color: #b9bfc9; font-size: 13px; }
.mp-cnt {
  min-width: 32px; height: 30px; padding: 0 8px;
  background: var(--panel-2); color: #cfd4dd; border: 1px solid var(--line);
  border-radius: 7px; cursor: pointer; font-size: 13px;
}
.mp-cnt:hover { border-color: var(--accent); }
.mp-cnt.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.mp-slot-hint { color: #8b919c; font-size: 11.5px; margin-left: 4px; flex-basis: 100%; }
.mp-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.mp-row { display: flex; align-items: center; gap: 8px; }
.mp-idx {
  flex: 0 0 22px; height: 22px; line-height: 22px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 50%;
  color: #8b919c; font-size: 12px;
}
.mp-desc {
  flex: 1 1 auto; min-width: 0;
  background: var(--panel-2); color: #e6e9ee; border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 9px; font-size: 13px;
}
.mp-zoom {
  flex: 0 0 130px;
  background: var(--panel-2); color: #e6e9ee; border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 6px; font-size: 12.5px;
}
.mp-actions { display: flex; align-items: center; gap: 8px; }
.mp-spacer { flex: 1 1 auto; }

/* 2-й реф — щит-лист вещей */
.mp-items-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; margin-bottom: 12px; padding: 8px;
  background: rgba(255, 255, 255, .03); border: 1.5px dashed var(--line); border-radius: 8px;
  color: #8b919c; cursor: pointer; position: relative; overflow: hidden; text-align: center;
  transition: border-color .12s, background .12s;
}
.mp-items-drop:hover { border-color: var(--accent); background: rgba(76, 141, 255, .08); }
.mp-items-drop.drag { border-color: var(--accent); background: rgba(76, 141, 255, .14); }
.mp-items-drop.has-image { border-style: solid; min-height: 92px; padding: 0; }
.mp-items-drop img { width: 100%; height: 92px; object-fit: contain; background: #1a1d24; border-radius: 6px; }
.mp-items-cap { font-size: 13px; color: #cfd4dd; }
.mp-items-sub { font-size: 11px; color: #8b919c; }
.mp-items-x {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; line-height: 20px;
  border: none; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; font-size: 13px;
}
.mp-items-x:hover { background: rgba(0, 0, 0, .8); }

/* Живой предпросмотр промта */
.mp-preview-wrap { margin-bottom: 14px; }
.mp-preview-head { color: #8b919c; font-size: 11.5px; margin-bottom: 4px; }
.mp-preview {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: #1a1d24; color: #b9bfc9; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 11.5px; line-height: 1.45; font-family: ui-monospace, Consolas, monospace;
  max-height: 160px;
}

/* --- «Перенос кожи головы» --- */
.skintx { position: fixed; inset: 0; z-index: 10001; background: rgba(10,12,16,.62); display: flex; align-items: center; justify-content: center; }
.skintx.hidden { display: none; }
.stx-box { width: min(900px, 96vw); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.stx-head { display: flex; align-items: center; justify-content: space-between; color: #e6e9ee; font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.stx-sub { color: #8b919c; font-size: 12px; line-height: 1.4; margin-bottom: 12px; }
.stx-main { display: flex; gap: 14px; align-items: flex-start; }
.stx-canvas-wrap { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center; background: #14161c; border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 300px; }
.stx-canvas-wrap canvas { max-width: 100%; height: auto; border-radius: 6px; cursor: grab; }
.stx-canvas-wrap canvas:active { cursor: grabbing; }
.stx-side { flex: 0 0 250px; display: flex; flex-direction: column; gap: 8px; }
.stx-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 6px; background: rgba(255,255,255,.03); border: 1.5px dashed var(--line); border-radius: 8px; color: #cfd4dd; font-size: 12px; cursor: pointer; position: relative; overflow: hidden; text-align: center; }
.stx-drop:hover { border-color: var(--accent); }
.stx-drop.drag { border-color: var(--accent); background: rgba(76,141,255,.14); }
.stx-drop.has-image { border-style: solid; padding: 0; min-height: 70px; }
.stx-drop img { width: 100%; height: 70px; object-fit: contain; background: #1a1d24; border-radius: 6px; }
.stx-sub2 { font-size: 10.5px; color: #8b919c; }
.stx-badge { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 6px; }
.stx-ctl { display: flex; flex-direction: column; gap: 2px; color: #b9bfc9; font-size: 11.5px; }
.stx-ctl input[type=range] { width: 100%; }
.stx-ctl2 { color: #cfd4dd; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.stx-actions { margin-top: 6px; }
.stx-box.stx-compact { width: min(440px, 94vw); }
.stx-compact .stx-drop { min-height: 64px; margin-bottom: 10px; }
.stx-compact .stx-drop.has-image { min-height: 100px; }
.stx-compact .stx-drop img { height: 100px; }
.stx-sheetinfo { color: #cfd4dd; font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
/* плавающий бар сверки переноса кожи (холст остаётся виден для сравнения) */
.stx-review { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 10002;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.55); }
.stx-review.hidden { display: none; }
.stx-review-lbl { color: #e6e9ee; font-size: 13px; font-weight: 600; }

/* ---------- Автоматизация (вкладка ⚙): миссии и конвейер этапов ---------- */
#autoView { flex: 1; display: flex; min-height: 0; }
#autoView.hidden { display: none; }
.auto-side { width: 330px; min-width: 330px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.auto-side-head { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
.auto-list { overflow-y: auto; padding: 8px; flex: 1; }
.auto-project { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 42px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); overflow: hidden; }
.auto-project.active { border-color: rgba(76,141,255,.62); box-shadow: 0 0 0 1px rgba(76,141,255,.12); }
.auto-project.archived { border-color: rgba(255,176,32,.32); }
.auto-project.manual { border-style: dashed; }
.auto-project-open { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 13px 10px 13px 13px; border: 0; color: var(--text); background: rgba(255,255,255,.025); text-align: left; cursor: pointer; }
.auto-project-open:hover { background: rgba(76,141,255,.1); }
.auto-project-open-arrow { color: var(--muted); font-size: 24px; line-height: 1; }
.auto-project-delete { display: grid; place-items: center; border: 0; border-left: 1px solid var(--line); color: #d9a29e; background: rgba(255,255,255,.018); cursor: pointer; font-size: 15px; }
.auto-project-delete:hover { color: #fff; background: rgba(229,84,75,.22); }
.auto-project-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.auto-project-name { overflow: hidden; display: -webkit-box; color: #eef3fb; font-size: 15px; font-weight: 700; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; }
.auto-project-meta { overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.auto-item { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; background: var(--panel-2); }
.auto-item:hover { background: #333846; }
.auto-item.active { border-color: var(--accent); }
.ai-name { font-weight: 600; margin-bottom: 2px; }
.mission-version { display: inline-flex; align-items: center; padding: 1px 5px; margin-right: 4px; border: 1px solid #596273; border-radius: 999px; color: #c9d1df; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; line-height: 1.35; vertical-align: 1px; }
.mission-version-v3 { border-color: #477fba; background: rgba(76, 141, 255, .14); color: #bcd9ff; }
.mission-version-legacy { border-color: #77684a; background: rgba(255, 176, 32, .1); color: #f0cf91; }
.ai-meta { color: var(--muted); font-size: 11.5px; }
.auto-none { color: var(--muted); font-size: 12px; padding: 8px; line-height: 1.5; }
.auto-main { flex: 1; overflow-y: auto; padding: 14px 18px; min-width: 0; }
.auto-readonly-banner { max-width: 980px; margin: 0 0 12px; padding: 9px 12px; border: 1px solid #55708f; border-radius: 7px; background: #1d2a38; color: #cfe5ff; font-size: 13px; }
body.csm-auto-readonly #autoStages :is(button, input, select, textarea):disabled { opacity: .52; cursor: not-allowed; }
body.csm-auto-readonly #autoList :is(.ai-del, .auto-project-delete), body.csm-auto-readonly .auto-project-nav-delete { display: none; }
body.csm-readonly #workspace .item,
body.csm-readonly #library .thumb { cursor: not-allowed !important; }
.auto-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--muted); text-align: center; gap: 8px; }
.auto-empty.hidden, #autoBoard.hidden { display: none; }
.auto-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.auto-title { font-size: 17px; font-weight: 700; }
.auto-meta { color: var(--muted); font-size: 12px; }
.auto-stages { display: flex; flex-direction: column; gap: 10px; max-width: 980px; }
.auto-stage { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.auto-stage.st-run { border-left-color: var(--accent); }
.auto-stage.st-ready { border-left-color: #ffb020; }
.auto-stage.st-done { border-left-color: var(--accent-2); }
.auto-stage.st-error { border-left-color: var(--danger); }
.as-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.as-name { font-weight: 600; }
.as-chip { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.as-note { color: #ffb020; font-size: 12px; margin-top: 4px; }
.st-error .as-note { color: var(--danger); }
.as-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.as-thumb { position: relative; display: block; width: 76px; height: 100px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #14161c; }
.as-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.as-thumb.locked { outline: 2px solid var(--accent-2); }
.as-lock { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(6,40,26,.85); color: #6ee7a8; font-size: 10.5px; text-align: center; padding: 1px 0; }
.as-var { display: flex; flex-direction: column; gap: 4px; }
.as-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.as-actions .btn.sm { flex: none; }
.auto-log-head { margin: 16px 0 6px; font-weight: 600; color: var(--muted); }
.auto-log { background: #14161c; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; max-height: 180px; overflow-y: auto; font-size: 11.5px; color: #b7bfcc; max-width: 980px; }
.auto-project-nav { position: sticky; top: -14px; z-index: 12; display: flex; align-items: center; gap: 10px; margin: -14px -18px 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(29,34,45,.97); backdrop-filter: blur(10px); }
.auto-project-nav.hidden { display: none; }
.auto-project-nav-home { min-width: 180px; max-width: 300px; overflow: hidden; padding: 9px 11px; border: 0; border-radius: 8px; color: #eef3fb; background: rgba(76,141,255,.11); font: inherit; font-size: 14px; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.auto-project-nav-home:hover { background: rgba(76,141,255,.2); }
.auto-project-nav-tabs { min-width: 0; display: flex; align-items: center; gap: 5px; overflow-x: auto; }
.auto-project-nav-tab { min-height: 38px; padding: 8px 11px; border: 1px solid transparent; border-radius: 8px; color: #aebdd0; background: transparent; font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; }
.auto-project-nav-tab:hover { color: #eef3fb; background: rgba(255,255,255,.045); }
.auto-project-nav-tab.active { border-color: rgba(76,141,255,.55); color: #eef3fb; background: rgba(76,141,255,.14); }
.auto-project-nav-tab:disabled { opacity: .42; cursor: not-allowed; }
.auto-project-nav-delete { flex: 0 0 auto; min-height: 38px; margin-left: auto; padding: 8px 11px; border: 1px solid rgba(229,84,75,.38); border-radius: 8px; color: #f0b5b0; background: rgba(229,84,75,.07); font: inherit; font-size: 13px; cursor: pointer; }
.auto-project-nav-delete:hover { color: #fff; background: rgba(229,84,75,.2); }
.auto-project-workspace-open .auto-head, .auto-project-workspace-open .auto-log-head, .auto-project-workspace-open .auto-log { display: none; }
.auto-stages[data-project-workspace="true"] { width: 100%; max-width: 1480px; }
.auto-project-workspace { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.auto-project-intro, .auto-project-section-head { padding: 18px 20px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, rgba(76,141,255,.09), var(--panel)); }
.auto-project-intro h2, .auto-project-section-head h2 { margin: 0 0 6px; font-size: 21px; }
.auto-project-intro p, .auto-project-section-head p { margin: 0; color: #aebdd0; font-size: 14px; line-height: 1.5; }
.auto-project-overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.auto-project-overview-card { min-width: 0; min-height: 148px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: space-between; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--panel); font: inherit; text-align: left; cursor: pointer; }
.auto-project-overview-card:hover { border-color: #5f789b; background: linear-gradient(145deg, rgba(76,141,255,.12), var(--panel)); transform: translateY(-1px); }
.auto-project-overview-card:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.auto-project-overview-head { font-size: 15px; font-weight: 700; }
.auto-project-overview-card strong { font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.auto-project-overview-card small { grid-column: 1 / -1; color: #aebdd0; font-size: 13px; line-height: 1.4; }
.auto-project-entity-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.auto-project-entity { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--panel); font: inherit; text-align: left; cursor: pointer; }
.auto-project-entity:hover { border-color: rgba(76,141,255,.58); background: rgba(76,141,255,.075); }
.auto-project-entity strong { min-width: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.auto-project-entity > span:not(.auto-project-entity-arrow) { min-width: 0; overflow: hidden; color: #aebdd0; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.auto-project-entity-arrow { grid-column: 2; grid-row: 1 / span 2; color: #9fb1c9; font-size: 25px; }
.auto-project-section-empty { grid-column: 1 / -1; padding: 28px; border: 1px dashed var(--line); border-radius: 11px; color: var(--muted); font-size: 14px; line-height: 1.5; text-align: center; }
.al-line { padding: 1px 0; }
/* убрать файл из этапа + документ-чип (сценарий) + подсказка этапа */
.as-x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; display: none; padding: 0; }
.as-thumb:hover .as-x { display: block; }
.as-x:hover { background: var(--danger); }
.as-thumb.as-doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; }
.as-doc-ic { font-size: 26px; }
.as-doc-ext { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; }
.as-hint { color: var(--muted); font-size: 11.5px; margin-top: 6px; line-height: 1.45; }
/* конвейер-«дамба»: паспорт, подписи зон, план сценария */
.auto-side-btns { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.auto-side-btns #autoNewScenario { grid-column: 1 / -1; }
.auto-side-btns .btn.sm { width: 100%; min-width: 0; }
.auto-item.sc { border-left: 3px solid var(--accent); }
.auto-ctl { margin: 0 0 2px; }
.as-cap { color: var(--muted); font-size: 11px; margin-top: 8px; letter-spacing: .04em; }
.as-cap-res { color: #6ee7a8; }
.as-results .as-thumb { outline: 1px solid rgba(52,193,123,.5); }
.as-pass { margin-top: 6px; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5; }
.ap-row b { color: var(--muted); font-weight: 600; }
.ap-en span { color: var(--muted); font-size: 11.5px; }
.sc-looks { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sc-look { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; cursor: pointer; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.sc-look input { margin-top: 2px; }
/* удаление из списка конвейера + общий чекбокс плана */
.auto-item { position: relative; }
.ai-del { position: absolute; top: 6px; right: 6px; display: none; border: none; background: transparent; cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 5px; }
.auto-item:hover .ai-del { display: block; }
.ai-del:hover { background: rgba(229,84,75,.25); }
.sc-master { background: rgba(76,141,255,.08); border-color: rgba(76,141,255,.4); }
.sc-char { display: flex; align-items: center; gap: 8px; cursor: pointer; }
/* лайтбокс превью в полном качестве + кнопка переделки на превью */
#autoLightbox { position: fixed; inset: 0; z-index: 10005; background: rgba(10,11,14,.92); display: none; align-items: center; justify-content: center; flex-direction: column; gap: 10px; cursor: zoom-out; }
#autoLightbox.show { display: flex; }
#autoLightbox img { max-width: 96vw; max-height: 90vh; object-fit: contain; border-radius: 6px; box-shadow: 0 24px 80px rgba(0,0,0,.7); }
#autoLightbox .lb-bar { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 12.5px; }
#autoLightbox .lb-open { color: var(--accent); text-decoration: none; }
.as-redo { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; display: none; padding: 0; }
.as-thumb:hover .as-redo { display: block; }
.as-redo:hover { background: var(--accent); }
/* живые кнопки, заглушка генерации, версии, группировка персонажей */
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ''; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: asspin .7s linear infinite; }
@keyframes asspin { to { transform: rotate(360deg); } }
.auto-stage.st-run { position: relative; }
.auto-stage.st-run::before { content: ''; position: absolute; left: -4px; top: 0; bottom: 0; width: 4px;
  border-radius: 10px 0 0 10px; background: linear-gradient(180deg, var(--accent), #7fb2ff, var(--accent));
  background-size: 100% 220%; animation: asflow 1.6s linear infinite; }
@keyframes asflow { to { background-position: 0 220%; } }
.as-ghost { width: 76px; height: 100px; border-radius: 8px; border: 1px dashed rgba(76,141,255,.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: #9db9e8; font-size: 10.5px; background: linear-gradient(110deg, rgba(76,141,255,.08) 30%, rgba(127,178,255,.22) 50%, rgba(76,141,255,.08) 70%);
  background-size: 220% 100%; animation: asshimmer 1.4s linear infinite; }
.as-ghost em { font-style: normal; }
@keyframes asshimmer { to { background-position: -220% 0; } }
.as-versions { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.as-versions .as-cap { margin: 0; }
.as-ver-cur { font-size: 11px; color: #6ee7a8; border: 1px solid rgba(52,193,123,.45); border-radius: 6px; padding: 3px 8px; cursor: default; background: rgba(52,193,123,.10); }
.ai-group { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; margin: 10px 2px 6px; font-weight: 600; }
.auto-item.grouped { margin-left: 8px; }
/* вкладки луков внутри карточки персонажа + пометки образов */
.auto-looks-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.auto-item.person { border-left: 3px solid var(--accent-2); }
.as-var-label { font-size: 10.5px; color: var(--muted); text-align: center; max-width: 90px; line-height: 1.3; }

/* ===== Автоматизация v3: колоды, родители, прогоны ===== */
.automation-v3-overview { position: relative; border: 1px solid #4b6482; border-radius: 12px; padding: 10px 12px; background: #1b2633; display: flex; flex-direction: column; gap: 8px; }
.automation-v3-overview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.automation-v3-metrics, .automation-v3-statuses, .automation-v3-decisions, .automation-v3-route-group { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; }
.automation-v3-metric { border: 1px solid #48617d; border-radius: 999px; padding: 2px 7px; color: #d8e9ff; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.automation-v3-statuses { align-items: flex-start; }
.automation-v3-status-group { display: inline-flex; flex-wrap: wrap; gap: 4px 7px; color: var(--muted); font-size: 11px; }
.automation-v3-status-group b, .automation-v3-decisions > b { color: var(--text); }
.automation-v3-decisions { padding-top: 2px; }
.automation-v3-navigation { border-top: 1px solid #3c4c60; padding-top: 6px; }
.automation-v3-navigation summary { color: #bdd8f5; cursor: pointer; font-size: 12px; font-weight: 650; }
.automation-v3-route-group { margin-top: 7px; }
.automation-v3-route-group > span { min-width: 74px; color: var(--muted); font-size: 11px; }
.automation-v3-route-button.active { border-color: var(--accent); background: rgba(76,141,255,.2); color: #e6f1ff; }
.automation-v3-route-focus { outline: 2px solid rgba(76,141,255,.75); outline-offset: 3px; }
.v3-section { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; background: var(--panel); }
.v3-sec-head { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.v3-sec-head.sm { font-size: 13px; margin: 12px 0 4px; }
.v3-decks { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 4px; align-items: flex-start; }
.v3-deck { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--panel-2); width: 252px; display: flex; flex-direction: column; gap: 7px; }
.v3-deck.st-run { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(90,140,255,.18); }
.v3-deck-title { font-size: 12.5px; font-weight: 650; line-height: 1.35; }
.v3-deck-desc { color: var(--muted); font-size: 11px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.v3-deck .as-thumb.v3-card { width: 100%; height: 300px; }
.v3-deck .as-ghost.v3-card { width: 100%; height: 300px; }
.v3-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.v3-parent-switcher { position: sticky; top: 66px; z-index: 11; align-items: center; margin: 10px -2px 12px; padding: 10px 12px; border: 1px solid #4b6482; border-radius: 11px; background: rgba(27,38,51,.97); box-shadow: 0 8px 20px rgba(8,12,18,.28); backdrop-filter: blur(10px); }
.v3-parent-switcher-label { flex: 0 0 auto; margin-right: 3px; color: #dceaff; font-size: 13px; }
.v3-parent-switcher .btn { white-space: nowrap; }
.v3-run { position: relative; margin-top: 16px; padding: 12px 12px 10px 16px; border: 1px solid color-mix(in srgb, var(--v3-run-accent) 44%, var(--line)); border-left: 5px solid var(--v3-run-accent); border-radius: 12px; background: linear-gradient(100deg, color-mix(in srgb, var(--v3-run-accent) 8%, var(--panel)) 0, var(--panel) 26%); box-shadow: 0 5px 16px rgba(5,8,14,.18); }
.v3-run > .v3-sec-head { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; }
.v3-run-index { flex: 0 0 auto; padding: 4px 8px; border: 1px solid var(--v3-run-accent); border-radius: 999px; color: var(--v3-run-accent); background: rgba(12,16,23,.72); font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.v3-run-name { min-width: 0; color: #edf4ff; font-size: 14px; }
.as-thumb .as-folder { position: absolute; right: 28px; top: 2px; border: 0; background: rgba(20,22,28,.8); color: var(--text); border-radius: 6px; cursor: pointer; font-size: 12px; padding: 1px 4px; display: none; }
.as-thumb .as-download { position: absolute; right: 54px; top: 2px; border: 0; background: rgba(20,22,28,.8); color: var(--text); border-radius: 6px; cursor: pointer; font-size: 12px; padding: 1px 5px; display: none; }
.as-thumb:hover .as-folder, .as-thumb:hover .as-download,
.as-thumb :is(.as-folder, .as-download):focus-visible { display: block; }
.v3-card .as-redo2 { position: absolute; left: 2px; top: 2px; z-index: 3; border: 0; background: rgba(20,22,28,.88); color: var(--text); border-radius: 6px; cursor: pointer; font-size: 13px; padding: 2px 7px; display: block; opacity: .86; }
.v3-card:hover .as-redo2,
.v3-card .as-redo2:hover,
.v3-card .as-redo2:focus-visible { opacity: 1; }
.v3-deck-approved { position: absolute; right: 8px; top: 8px; z-index: 2; border: 1px solid rgba(52,193,123,.75); border-radius: 999px; padding: 4px 8px; background: rgba(15,47,34,.92); color: #8ce8ba; font-size: 12px; font-weight: 700; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.v3-deck.is-approved { border-color: rgba(52,193,123,.72); box-shadow: 0 0 0 1px rgba(52,193,123,.14); }
#autoLightbox .lb-reveal, #autoLightbox .lb-download { margin-left: 10px; }
#autoLightbox .lb-download { color: var(--text); text-decoration: none; }
.v3-section .auto-looks-tabs button { flex: 0 0 auto; width: auto; }
.as-thumb.as-dimmed img { opacity: .3; filter: grayscale(.9); }
.as-thumb.as-dimmed { border-style: dashed; }
.as-thumb.as-active { outline: 2px solid var(--accent-2); }
.as-active-tag { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(6,40,26,.85); color: #6ee7a8; font-size: 10px; text-align: center; padding: 1px 0; }
.as-active-toggle { width: 100%; border: 0; cursor: pointer; font: inherit; }
.as-active-toggle:hover { background: rgba(10,70,43,.95); }
.as-source-tag { position: absolute; left: 4px; bottom: 4px; border-radius: 5px; padding: 2px 5px; background: rgba(30,35,43,.88); color: var(--muted); font-size: 9px; pointer-events: none; }
.as-pick { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); border: 0; border-radius: 8px; background: var(--accent-2, #34c17b); color: #08130c; font-size: 11px; font-weight: 700; padding: 4px 8px; cursor: pointer; }
.as-pick:disabled { cursor: not-allowed; opacity: .6; }
.v3-head-selection-hint { margin-top: 7px; color: #9ee6bd; }
.v3-deck-nav { display: flex; align-items: center; justify-content: center; gap: 8px; }
.v3-nav-btn { min-width: 34px; font-weight: 700; }
.v3-deck-num { font-size: 12px; color: var(--muted); min-width: 44px; text-align: center; }
.v3-stash { border-style: dashed; opacity: .92; }
.v3-pairs { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.v3-pair { display: flex; align-items: center; gap: 6px; }
.v3-pair-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.v3-pair-col .as-cap { margin: 0; }
.v3-pair-arrow { color: var(--muted); font-size: 16px; }
.as-head-right { display: flex; align-items: center; gap: 8px; }
.as-timer { font-size: 11.5px; color: var(--accent, #7aa7e0); font-variant-numeric: tabular-nums; }
.as-timer.done { color: var(--muted); }
.v3-waitbar { border: 1px solid var(--line); border-left: 4px solid #ffb020; border-radius: 10px; padding: 8px 12px; margin: 8px 0; background: var(--panel); font-size: 12.5px; }
.v3-waitbar.idle { border-left-color: var(--accent-2, #34c17b); }
.v3-waitlist { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
#apOverlay { position: fixed; inset: 0; box-sizing: border-box; padding: 24px; background: rgba(10,12,16,.78); z-index: 340; display: flex; align-items: center; justify-content: center; }
.ap-panel { box-sizing: border-box; width: min(780px, calc(100vw - 48px)); max-height: calc(100vh - 48px); overflow: auto; display: flex; flex-direction: column; gap: 14px; padding: 22px; border: 1px solid #465268; border-radius: 16px; background: var(--panel); box-shadow: 0 22px 70px rgba(0,0,0,.46); color: var(--text); }
.ap-headline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ap-title { min-width: 0; font-weight: 750; font-size: 20px; line-height: 1.25; }
.ap-safety { flex: 0 0 auto; padding: 6px 10px; border: 1px solid #725f34; border-radius: 999px; background: rgba(255,176,32,.09); color: #e9c77f; font-size: 12px; font-weight: 700; }
.ap-safety.is-on { border-color: #d46f49; background: rgba(255,111,71,.12); color: #ffb093; }
.ap-intro { color: #b9c5d8; font-size: 14px; line-height: 1.5; }
.ap-body { display: flex; flex-direction: column; gap: 14px; }
.ap-sec { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(16,20,28,.18); }
.ap-sec-head { font-size: 16px; font-weight: 750; line-height: 1.25; }
.ap-sec-hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.ap-toggle { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 14px; line-height: 1.35; cursor: pointer; }
.ap-toggle > span { min-width: 0; }
.ap-toggle small, .ap-choice small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.35; }
.ap-toggle input { width: 42px; height: 24px; appearance: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; position: relative; cursor: pointer; transition: background .15s, border-color .15s; flex: 0 0 auto; }
.ap-toggle input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: left .15s, background .15s; }
.ap-toggle input:checked { background: var(--accent-2, #34c17b); border-color: var(--accent-2, #34c17b); }
.ap-toggle input:checked::after { left: 20px; background: #fff; }
.ap-own-card { padding: 13px 15px; border: 1px solid #4c8dff; border-radius: 12px; background: rgba(76,141,255,.08); }
.ap-paid-sec { border-color: #725f34; background: rgba(255,176,32,.055); }
.ap-paid-sec.is-on { border-color: #d46f49; background: rgba(255,111,71,.075); box-shadow: inset 3px 0 0 #e77b52; }
.ap-paid-toggle { align-items: flex-start; }
.ap-paid-toggle strong { display: block; font-size: 15px; line-height: 1.3; }
.ap-paid-warning { margin-left: 54px; padding: 10px 12px; border: 1px solid rgba(231,123,82,.32); border-radius: 9px; background: rgba(14,17,23,.24); color: #d8b6a8; font-size: 12px; line-height: 1.45; }
.ap-own { align-items: flex-start; }
.ap-disabled { opacity: .45; pointer-events: none; }
.ap-offer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ap-offer-card { min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 13px; border: 1px solid #39445a; border-radius: 11px; background: var(--panel-2); }
.ap-offer-main { align-items: flex-start; }
.ap-offer-main strong { display: block; font-size: 14px; }
.ap-offer-meta { margin-top: auto; color: #9fb1c9; font-size: 12px; font-variant-numeric: tabular-nums; }
.ap-offer-open { width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-stage-grid, .ap-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ap-settings-grid.is-single { grid-template-columns: 1fr; }
.ap-head-engine-sec { border-color: rgba(190,255,0,.32); background: linear-gradient(135deg, rgba(190,255,0,.055), rgba(16,20,28,.2) 62%); }
.ap-head-engine-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ap-head-engine-choice { min-height: 108px; border-color: #39445a; background: var(--panel-2); }
.ap-head-engine-choice b { display: block; font-size: 14px; line-height: 1.3; }
.ap-head-engine-choice:has(input:checked) { border-color: var(--accent, #bfff00); background: rgba(190,255,0,.09); box-shadow: inset 0 0 0 1px rgba(190,255,0,.15); }
.ap-enhancor-route { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; padding-top: 14px; border-top: 1px solid var(--line); }
.ap-enhancor-route > .ap-head-engine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ap-enhancor-route .ap-head-engine-choice { min-height: 88px; }
.ap-stage-group, .ap-option-group { min-width: 0; display: flex; flex-direction: column; gap: 9px; padding: 13px; border: 1px solid #39445a; border-radius: 11px; background: var(--panel-2); }
.ap-stage-group > strong, .ap-option-group > strong { margin-bottom: 2px; font-size: 13px; color: #c8d5e7; }
.ap-stage-toggle { min-height: 30px; }
.ap-choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; }
.ap-choice:hover { border-color: #4a5870; background: rgba(76,141,255,.06); }
.ap-choice input { flex: 0 0 auto; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent, #4c8dff); }
.ap-choice > span { min-width: 0; }
.ap-actions { position: sticky; bottom: -22px; z-index: 2; justify-content: flex-end; margin: 0 -22px -22px; padding: 14px 22px; border-top: 1px solid var(--line); background: rgba(29,34,45,.97); backdrop-filter: blur(8px); }
.ap-actions .btn { min-height: 40px; padding-inline: 16px; font-size: 14px; }
@media (max-width: 760px) {
  #apOverlay { padding: 10px; align-items: stretch; }
  .ap-panel { width: 100%; max-height: 100%; padding: 16px; border-radius: 12px; }
  .ap-headline { align-items: flex-start; flex-direction: column; }
  .ap-title { font-size: 18px; }
  .ap-offer-grid, .ap-stage-grid, .ap-settings-grid, .ap-head-engine-grid { grid-template-columns: 1fr; }
  .ap-actions { bottom: -16px; margin: 0 -16px -16px; padding: 12px 16px; }
  .ap-paid-warning { margin-left: 0; }
}
.v3-waitbar.paused { border-left-color: #d9534f; background: rgba(180,70,60,.10); }
.v3-waitbar.paused .btn { margin-top: 6px; }

/* очередь GPT: компактный пульт в сайдбаре; полный список живёт в отдельном окне */
.gpt-queue { margin: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 13px; color: var(--muted); line-height: 1.35; }
.gpt-queue strong { color: var(--text); font-variant-numeric: tabular-nums; }
.gpt-queue.busy { border-left: 4px solid var(--accent, #7aa7e0); }
.gpt-queue.jam { border-left: 4px solid #ffb020; }
.gpt-queue-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gpt-queue-head { min-width: 0; color: var(--text); font-size: 15px; font-weight: 750; }
.gpt-queue-capacity { flex: 0 0 auto; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg2); font-size: 12px; }
.gpt-queue-progress { height: 6px; margin-top: 11px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--line) 65%, transparent); }
.gpt-queue-progress-value { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent, #7aa7e0); transition: width .2s ease; }
.gpt-queue.jam .gpt-queue-progress-value { background: #ffb020; }
.gpt-queue-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.gpt-queue-metric { min-width: 0; display: grid; gap: 1px; padding: 7px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg2); text-align: center; font-size: 11px; }
.gpt-queue-metric strong { font-size: 14px; }
.gpt-queue-active-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.gpt-queue-group { display: inline-flex; align-items: center; gap: 5px; min-width: 0; padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--panel) 75%, var(--accent) 25%); white-space: nowrap; font-size: 11px; }
.gpt-queue-oldest { margin-top: 8px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.gpt-queue-warning { color: #ffc969; margin-top: 5px; }
.gpt-queue-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; margin-top: 10px; }
.gpt-queue-open { min-width: 0; margin: 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg2); color: var(--text); font: inherit; cursor: pointer; }
.gpt-queue-open:hover { border-color: var(--accent); }
.gpt-queue-slots { width: auto; }

.work-queue-overlay { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 24px; background: rgba(5, 8, 14, .76); backdrop-filter: blur(5px); }
.work-queue-panel { width: min(1040px, calc(100vw - 48px)); max-height: min(880px, calc(100vh - 48px)); display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 28px 80px rgba(0, 0, 0, .46); color: var(--text); }
.work-queue-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); font-size: 21px; font-weight: 750; }
.work-queue-summary { margin: 16px 20px 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); font-size: 15px; color: var(--muted); }
.work-queue-content { min-height: 0; overflow: auto; padding: 16px 20px 22px; display: grid; align-content: start; gap: 12px; }
.work-queue-batch { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--panel) 86%, var(--bg2)); }
.work-queue-batch-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.work-queue-account { flex: 0 0 auto; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 14px; font-weight: 700; }
.work-queue-batch-title { min-width: 0; flex: 1; border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.work-queue-batch-title::after { content: '  ▾'; color: var(--muted); }
.work-queue-batch-actions, .work-queue-task-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.work-queue-tasks { border-top: 1px solid var(--line); }
.work-queue-task { display: flex; align-items: center; gap: 14px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.work-queue-task:last-child { border-bottom: 0; }
.work-queue-task-main { min-width: 0; flex: 1; display: grid; gap: 5px; font-size: 14px; }
.work-queue-state { color: var(--muted); }
.work-queue-state.state-completed { color: #54d494; }
.work-queue-state.state-failed, .work-queue-state.state-unknown, .work-queue-problem { color: #ff8d8d; }
.work-queue-state.state-queued { color: #8fb9ff; }
.work-queue-admin-note { align-self: center; color: #ffc969; font-size: 13px; }
.work-queue-empty, .work-queue-loading { padding: 18px; color: var(--muted); text-align: center; font-size: 15px; }
.work-queue-load-more, .work-queue-batches-more { justify-self: center; margin: 12px; }
.v3-empty-guidance { min-width: min(520px, 100%); padding: 16px 18px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 15px; line-height: 1.5; }
@media (max-width: 720px) {
  .work-queue-overlay { padding: 0; }
  .work-queue-panel { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
  .work-queue-task, .work-queue-batch-head { align-items: stretch; flex-direction: column; }
}

/* ===== Разбор сценария V2 и пакетные миссии ассетов ===== */
.auto-stages[data-scenario-schema="v2"],
.auto-stages[data-selected-asset-mission] { max-width: 1480px; }
.auto-item.asset { border-left: 3px solid #a983ff; }
.scv2-shell, .asset-pack-shell { width: 100%; display: flex; flex-direction: column; gap: 10px; padding-bottom: 72px; }
.scv2-shell { gap: 14px; font-size: 15px; }
#autoBoard:has(.auto-stages[data-scenario-schema="v2"]) .auto-head { gap: 14px; margin-bottom: 16px; }
#autoBoard:has(.auto-stages[data-scenario-schema="v2"]) .auto-title { font-size: 21px; }
#autoBoard:has(.auto-stages[data-scenario-schema="v2"]) .auto-meta { font-size: 14px; line-height: 1.4; }
.scv2-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.scv2-metric { min-width: 0; min-height: 92px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; box-sizing: border-box; padding: 15px 17px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, rgba(76,141,255,.09), var(--panel)); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease; }
.scv2-metric:hover { border-color: #5f789b; background: linear-gradient(145deg, rgba(76,141,255,.15), var(--panel)); transform: translateY(-1px); }
.scv2-metric[aria-selected="true"] { border-color: #4c8dff; background: linear-gradient(145deg, rgba(76,141,255,.24), rgba(36,45,61,.98)); box-shadow: inset 0 0 0 1px rgba(76,141,255,.32), 0 8px 20px rgba(8,16,32,.2); }
.scv2-metric-label { color: #c3d3e7; font-size: 14px; font-weight: 700; }
.scv2-metric-value { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 29px; line-height: 1; font-variant-numeric: tabular-nums; }
.scv2-metric small { min-width: 0; color: #b8c0cc; font-size: 12.5px; line-height: 1.35; white-space: normal; }
.scv2-filters { display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(160px, .8fr)); gap: 10px; align-items: end; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.scv2-shell .btn.xs { flex: 0 0 auto; min-height: 32px; padding: 6px 10px; font-size: 12.5px; line-height: 1.25; }
.scv2-bulk-actions, .scv2-inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.scv2-bulk-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 2px; }
.scv2-control, .scv2-answer-control { min-width: 0; display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 13px; }
.scv2-control :is(input, select, textarea), .scv2-answer-control :is(input, select, textarea), .scv2-ref-form input[type=file] { min-width: 0; width: 100%; min-height: 42px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 14px; }
.scv2-answer-control textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.scv2-panel { display: flex; flex-direction: column; gap: 10px; }
.scv2-episode-overview { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(145deg, rgba(76,141,255,.055), var(--panel)); }
.scv2-episode-overview h3 { margin: 0 0 2px; font-size: 15px; }
.scv2-episode-group { display: grid; grid-template-columns: minmax(100px, max-content) minmax(0, 1fr); gap: 8px; align-items: start; }
.scv2-episode-group > strong { padding-top: 3px; color: #aebdd0; font-size: 13px; }
.scv2-episode-group .scv2-chips { justify-content: flex-start; }
.scv2-card, .asset-pack-item { overflow: clip; border: 1px solid var(--line); border-left: 4px solid #667181; border-radius: 11px; background: var(--panel); }
.scv2-card.is-ready { border-left-color: var(--accent-2, #34c17b); }
.scv2-card.is-blocked { border-left-color: #ffb020; }
.scv2-card.is-conflict { border-left-color: #df6f68; }
.scv2-card-summary, .asset-pack-item-summary { display: grid; grid-template-columns: auto minmax(140px, 1fr) auto; gap: 11px; align-items: center; padding: 13px 15px; cursor: pointer; list-style: none; }
.scv2-card-summary::-webkit-details-marker, .asset-pack-item-summary::-webkit-details-marker { display: none; }
.scv2-card-summary::after, .asset-pack-item-summary::after { content: '▾'; grid-column: 4; color: var(--muted); transition: transform .15s ease; }
.scv2-card:not([open]) > .scv2-card-summary::after,
.asset-pack-item:not([open]) > .asset-pack-item-summary::after { transform: rotate(-90deg); }
.scv2-card-summary input[type="checkbox"] { width: 18px; height: 18px; }
.scv2-card-title, .asset-pack-item-name { min-width: 0; overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.scv2-card-badges, .scv2-chips, .asset-pack-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.scv2-badge { display: inline-flex; align-items: center; min-height: 24px; box-sizing: border-box; border: 1px solid #515968; border-radius: 999px; padding: 2px 9px; color: #cbd1db; font-size: 12.5px; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.scv2-badge.is-ready { border-color: rgba(52,193,123,.55); background: rgba(52,193,123,.1); color: #88e7b8; }
.scv2-badge.is-blocked, .scv2-badge.is-missing { border-color: rgba(255,176,32,.5); background: rgba(255,176,32,.08); color: #f2c66f; }
.scv2-badge.is-conflict { border-color: rgba(223,111,104,.6); background: rgba(223,111,104,.1); color: #ffaca6; }
.scv2-badge.is-source { color: #b7c8dd; }
.scv2-badge.is-animal { border-color: rgba(169,131,255,.65); background: rgba(169,131,255,.12); color: #d9c7ff; }
.scv2-badge.is-significance { border-color: rgba(121,175,226,.45); color: #bbdaf7; }
.scv2-badge.is-episode { border-color: rgba(255,255,255,.13); color: var(--muted); }
.scv2-card-body, .asset-pack-item-body { display: flex; flex-direction: column; gap: 11px; padding: 0 15px 15px 44px; border-top: 1px solid rgba(255,255,255,.04); }
.scv2-description, .asset-pack-brief { margin: 11px 0 0; color: #cdd2da; font-size: 14px; line-height: 1.55; }
.scv2-fields { overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; }
.scv2-field { display: grid; grid-template-columns: minmax(140px, .7fr) minmax(220px, 1.5fr) minmax(145px, .7fr); gap: 10px; padding: 9px 11px; font-size: 13.5px; }
.scv2-field.is-editable { grid-template-columns: minmax(120px, .7fr) minmax(180px, 1.5fr) minmax(125px, .7fr) auto; align-items: center; }
.scv2-field-edit { justify-self: end; }
.scv2-field + .scv2-field { border-top: 1px solid rgba(255,255,255,.06); }
.scv2-field-label { color: var(--muted); }
.scv2-field-value { min-width: 0; overflow-wrap: anywhere; }
.scv2-field-source { color: #8fa5be; font-size: 12px; text-align: right; }
.scv2-muted { color: var(--muted); font-size: 13px; line-height: 1.5; }
.scv2-refbox { border: 1px dashed #50596a; border-radius: 8px; background: rgba(255,255,255,.02); }
.scv2-refbox-summary { padding: 9px 11px; color: #bcd0e8; font-size: 13px; cursor: pointer; }
.scv2-ref-form { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(130px, .8fr) minmax(180px, 1.2fr); gap: 7px; align-items: end; padding: 0 9px 9px; }
.scv2-refbox.is-question-upload { width: min(920px, 100%); box-sizing: border-box; padding: 10px; border-style: solid; border-color: rgba(76,141,255,.42); background: rgba(76,141,255,.055); }
.scv2-refbox-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: #dbe8ff; font-size: 14px; font-weight: 700; }
.scv2-refbox-hint { margin: 6px 0 11px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.scv2-refbox.is-question-upload .scv2-ref-form { width: 100%; box-sizing: border-box; padding: 0; }
.scv2-ref-files { min-width: 0; }
.scv2-ref-comment { grid-column: 1 / -1; }
.scv2-ref-comment textarea { min-height: 54px; resize: vertical; line-height: 1.4; }
.scv2-ref-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 7px; }
.scv2-ref-upload-state { grid-column: 1 / -1; min-height: 20px; padding: 8px 10px; border-radius: 7px; background: rgba(76,141,255,.08); color: #afc8ed; font-size: 12.5px; line-height: 1.45; }
.scv2-ref-upload-state.is-ready { background: rgba(52,193,123,.09); color: #a9dfc4; }
.scv2-ref-upload-state.is-processing { background: rgba(76,141,255,.14); color: #dbe8ff; }
.scv2-ref-upload-state.is-error { background: rgba(223,111,104,.1); color: #f0aaa5; }
.scv2-ref-progress { width: min(920px, 100%); box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 11px 12px; border: 1px solid rgba(76,141,255,.32); border-radius: 8px; background: rgba(76,141,255,.09); color: #dbe8ff; font-size: 13px; line-height: 1.45; }
.scv2-ref-progress span { color: var(--muted); }
.scv2-looks { display: flex; flex-direction: column; gap: 7px; }
.scv2-looks h4 { margin: 3px 0 0; font-size: 14px; }
.scv2-nested-targets { display: flex; flex-direction: column; gap: 7px; }
.scv2-nested-targets > h4 { margin: 3px 0 0; font-size: 14px; }
.scv2-nested-group { display: flex; flex-direction: column; gap: 5px; }
.scv2-nested-group-title { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; }
.scv2-nested-item { overflow: clip; border: 1px solid rgba(255,255,255,.09); border-left: 3px solid #667181; border-radius: 8px; background: var(--panel-2); }
.scv2-nested-item.is-ready { border-left-color: var(--accent-2, #34c17b); }
.scv2-nested-item.is-blocked { border-left-color: #ffb020; }
.scv2-nested-item.is-conflict { border-left-color: #df6f68; }
.scv2-nested-summary { display: grid; grid-template-columns: minmax(140px, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 10px 11px; cursor: pointer; list-style: none; }
.scv2-nested-summary::-webkit-details-marker { display: none; }
.scv2-nested-summary::after { content: '▾'; color: var(--muted); transition: transform .15s ease; }
.scv2-nested-item:not([open]) > .scv2-nested-summary::after { transform: rotate(-90deg); }
.scv2-nested-name { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.scv2-nested-body { display: flex; flex-direction: column; gap: 7px; padding: 0 8px 8px; border-top: 1px solid rgba(255,255,255,.05); }
.scv2-inline-actions { justify-content: flex-end; margin-top: -3px; }
.scv2-look { display: flex; flex-direction: column; gap: 9px; padding: 11px; border: 1px solid rgba(255,255,255,.09); border-radius: 9px; background: var(--panel-2); }
.scv2-look.is-selected { border-color: rgba(76,141,255,.48); }
.scv2-look.is-blocked { border-color: rgba(255,176,32,.58); box-shadow: inset 3px 0 0 rgba(255,176,32,.55); }
.scv2-look.is-context { background: color-mix(in srgb, var(--panel-2) 76%, transparent); border-style: dashed; }
.scv2-look-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.scv2-look-head strong { margin-right: auto; }
.scv2-zero-look, .scv2-empty { padding: 17px; border: 1px dashed #50596a; border-radius: 9px; background: rgba(255,255,255,.02); color: var(--muted); font-size: 14px; line-height: 1.5; }
.scv2-question-group { overflow: clip; border: 1px solid var(--line); border-left: 4px solid #ffb020; border-radius: 11px; background: var(--panel); }
.scv2-question-group.is-conflict { border-left-color: #df6f68; }
.scv2-question-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: linear-gradient(145deg, rgba(255,176,32,.055), rgba(255,255,255,.01)); }
.scv2-question-group.is-conflict .scv2-question-group-head { background: linear-gradient(145deg, rgba(223,111,104,.065), rgba(255,255,255,.01)); }
.scv2-question-group-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.scv2-question-group-title strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.scv2-question-group-title span { color: var(--muted); font-size: 12.5px; }
.scv2-question-group-parent { padding: 0 16px 10px; color: var(--muted); font-size: 12.5px; }
.scv2-question-group-body { border-top: 1px solid rgba(255,255,255,.055); }
.scv2-question-row { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; padding: 14px 16px 15px; }
.scv2-question-row + .scv2-question-row { border-top: 1px solid rgba(255,255,255,.07); }
.scv2-question-row.is-conflict { background: rgba(223,111,104,.025); }
.scv2-question-row.is-reference-processing > .scv2-answer-form,
.scv2-question-row.is-reference-processing > .scv2-question-or { display: none; }
.scv2-question-row-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scv2-question-row-head strong { font-size: 14px; }
.scv2-question-prompt { width: min(1040px, 100%); margin: 0; color: #cbd2dc; font-size: 14px; line-height: 1.5; }
.scv2-answer-form { width: min(920px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.scv2-answer-form .scv2-claims { grid-column: 1 / -1; }
.scv2-question-or { width: min(1040px, 100%); display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.scv2-question-or::before, .scv2-question-or::after { content: ''; height: 1px; flex: 1; background: rgba(255,255,255,.09); }
.scv2-answer-control { width: 100%; }
.scv2-claims { width: min(760px, 100%); box-sizing: border-box; display: flex; flex-direction: column; gap: 5px; margin: 0; border: 1px solid rgba(255,255,255,.09); border-radius: 8px; padding: 8px 10px; }
.scv2-claims legend { padding: 0 4px; color: var(--muted); font-size: 12px; }
.scv2-claim { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; }
.scv2-claim small { color: var(--muted); }
.scv2-footer, .asset-pack-footer { position: sticky; bottom: -14px; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid #566275; border-radius: 11px; background: rgba(32,36,45,.96); box-shadow: 0 -8px 24px rgba(8,10,14,.34); backdrop-filter: blur(8px); }
.scv2-footer-counts { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 13.5px; }
.scv2-footer-counts strong { color: var(--text); }
.scv2-footer-counts .has-blocked { color: #f2c66f; }
.scv2-materialize-feedback { min-width: 220px; flex: 1 1 320px; padding: 8px 10px; border: 1px solid #566275; border-radius: 8px; background: rgba(255,255,255,.035); color: #d8e2ef; font-size: 13px; line-height: 1.4; }
.scv2-materialize-feedback[hidden] { display: none; }
.scv2-materialize-feedback.is-working { border-color: rgba(76,141,255,.55); background: rgba(76,141,255,.1); color: #cfe1ff; }
.scv2-materialize-feedback.is-success { border-color: rgba(52,193,123,.55); background: rgba(52,193,123,.1); color: #a9e3c6; }
.scv2-materialize-feedback.is-error { border-color: rgba(223,111,104,.62); background: rgba(223,111,104,.11); color: #ffb8b2; }
.scv2-footer > .btn { min-height: 44px; padding: 10px 16px; font-size: 14px; }
.asset-pack-summary { justify-content: flex-start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.asset-pack-list { display: flex; flex-direction: column; gap: 8px; }
.asset-pack-item { border-left-color: #a983ff; }
.asset-pack-item.is-done { border-left-color: var(--accent-2, #34c17b); }
.asset-pack-decks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 340px)); gap: 14px; align-items: start; }
.asset-pack-decks > .v3-deck { width: 100%; box-sizing: border-box; }
.asset-pack-shell.is-location-pack .asset-pack-decks { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.asset-pack-shell.is-location-pack .asset-pack-decks > .v3-deck { max-width: 520px; }
.asset-pack-shell.is-location-pack .v3-deck .as-thumb.v3-card,
.asset-pack-shell.is-location-pack .v3-deck .as-ghost.v3-card { height: auto; aspect-ratio: 16 / 9; }
.asset-pack-shell.is-location-pack .v3-deck .as-thumb.v3-card img { object-fit: contain; }
.asset-pack-empty-decks, .asset-pack-generation-note { padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.018); }
.asset-pack-generation-note { border-style: solid; border-color: rgba(74,140,255,.38); color: #afc9f7; background: rgba(74,140,255,.07); }
.asset-pack-generation-note.is-error { border-color: rgba(255,92,92,.38); color: #ffb2b2; background: rgba(255,92,92,.07); }
.asset-pack-approved-note { width: min(340px, 100%); box-sizing: border-box; padding: 8px 10px; border: 1px solid rgba(52,193,123,.38); border-radius: 8px; background: rgba(52,193,123,.07); color: #a9dfc4; font-size: 12.5px; line-height: 1.4; }
.asset-pack-item-summary { grid-template-columns: auto minmax(140px, 1fr) auto auto; }
.asset-pack-item-summary::after { grid-column: 5; }
.asset-pack-brief { display: flex; flex-direction: column; gap: 8px; }
.asset-pack-brief-summary { margin: 0; color: #d7dce4; line-height: 1.5; }
.asset-pack-brief-facts { display: grid; grid-template-columns: minmax(100px, max-content) minmax(0, 1fr); gap: 1px 12px; margin: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: rgba(255,255,255,.018); }
.asset-pack-brief-facts :is(dt, dd) { margin: 0; padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.05); overflow-wrap: anywhere; }
.asset-pack-brief-facts dt { color: var(--muted); }
.asset-pack-brief-facts dd { color: var(--text); }
.asset-pack-brief-section { display: flex; flex-direction: column; gap: 5px; }
.asset-pack-brief-title { margin: 3px 0 0; color: #b9c5d5; font-size: 10.5px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; }
.asset-pack-brief-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px; }
.asset-pack-brief-entry { min-width: 0; padding: 7px 8px; border: 1px solid rgba(255,255,255,.07); border-radius: 8px; background: rgba(255,255,255,.018); }
.asset-pack-brief-entry-title { color: #e1e5ec; font-weight: 620; overflow-wrap: anywhere; }
.asset-pack-brief-entry-summary { margin-top: 2px; color: #bcc4d0; overflow-wrap: anywhere; }
.asset-pack-brief-entry-meta { margin-top: 4px; color: #8598af; font-size: 10px; overflow-wrap: anywhere; }
.asset-pack-brief-nested { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.07); }
.asset-pack-brief-nested-title { color: var(--muted); font-size: 10px; }
.asset-pack-brief-nested .asset-pack-brief-entry { background: rgba(0,0,0,.09); }
.asset-pack-candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; padding-top: 9px; }
.asset-pack-candidate { min-width: 0; overflow: hidden; display: flex; flex-direction: column; gap: 0; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #171a20; color: var(--text); cursor: pointer; }
.asset-pack-candidate:hover { border-color: #71839b; }
.asset-pack-candidate.is-approved { border-color: var(--accent-2, #34c17b); box-shadow: 0 0 0 2px rgba(52,193,123,.18); }
.asset-pack-candidate img { width: 100%; aspect-ratio: 3 / 4; display: block; object-fit: cover; background: #101217; }
.asset-pack-candidate span { overflow: hidden; padding: 5px 7px; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.asset-pack-footer-counts { color: var(--muted); font-size: 11.5px; }
.scv2-shell :is(button, input, select, textarea, summary):focus-visible,
.asset-pack-shell :is(button, input, select, textarea, summary):focus-visible { outline: 2px solid #72a9ff; outline-offset: 2px; }

/* Читаемый масштаб автоматизации: рабочие элементы не должны требовать браузерный zoom. */
#tabsBar .tab { min-height: 38px; padding: 8px 15px; font-size: 15px; }
#autoView { font-size: 15px; line-height: 1.45; }
#autoView .auto-side-head { gap: 9px; padding: 12px; }
#autoView .auto-side-head .btn.sm { min-height: 42px; padding: 9px 12px; font-size: 14.5px; }
#autoView .auto-list { padding: 10px; }
#autoView .auto-project { grid-template-columns: minmax(0, 1fr) 46px; margin-bottom: 12px; }
#autoView .auto-project-open { padding: 15px 12px 15px 15px; }
#autoView .auto-project-name { font-size: 16px; }
#autoView .auto-project-meta { font-size: 13.5px; }
#autoView .auto-project-delete { font-size: 17px; }
#autoView .gpt-queue { font-size: 14.5px; }
#autoView .gpt-queue-open { min-height: 39px; }
#autoView .auto-project-nav { gap: 12px; padding-block: 14px; }
#autoView .auto-project-nav-home,
#autoView .auto-project-nav-tab,
#autoView .auto-project-nav-delete { min-height: 44px; padding: 10px 13px; font-size: 15px; }
#autoView .auto-title { font-size: 20px; }
#autoView .auto-meta { font-size: 14px; }
#autoView .auto-main .btn.sm { min-height: 36px; padding: 8px 11px; font-size: 13.5px; }
#autoView .auto-main :is(input, select, textarea) { font-size: 14.5px; }
#autoView .auto-project-overview-head { font-size: 16px; }
#autoView .auto-project-overview-card small { font-size: 14px; }
#autoView .auto-project-entity strong { font-size: 16px; }
#autoView .auto-project-entity > span:not(.auto-project-entity-arrow) { font-size: 14px; }
#autoView .automation-v3-overview { padding: 13px 15px; gap: 10px; }
#autoView .automation-v3-metric { padding: 4px 9px; font-size: 13.5px; }
#autoView .automation-v3-status-group { font-size: 13px; }
#autoView .automation-v3-navigation summary { font-size: 14px; }
#autoView .automation-v3-route-group > span { font-size: 13px; }
#autoView .v3-sec-head { font-size: 16px; }
#autoView .v3-sec-head.sm { font-size: 14.5px; }
#autoView .v3-deck-title { font-size: 14px; }
#autoView .v3-deck-desc { font-size: 13px; }
#autoView :is(.as-chip, .as-note, .as-timer, .as-hint, .as-cap, .ap-en span) { font-size: 13px; }
#autoView .v3-waitbar { font-size: 14px; }
#autoView .scv2-card-title,
#autoView .asset-pack-item-name { font-size: 16px; }
#autoView .scv2-badge { min-height: 27px; padding-inline: 10px; font-size: 13.5px; }
#autoView .scv2-field { font-size: 14.5px; }
#autoView .scv2-field-source { font-size: 13px; }
#autoView .scv2-question-group-title strong,
#autoView .scv2-question-row-head strong { font-size: 15px; }
#autoView .scv2-question-prompt { font-size: 15px; }
#autoView .asset-pack-brief-entry-meta,
#autoView .asset-pack-brief-nested-title { font-size: 12.5px; }
#autoView .asset-pack-candidate span { font-size: 13px; }
#autoView .asset-pack-footer-counts { font-size: 13.5px; }

/* редактор профиля финального щит-листа */
#sheetOverlay { position: fixed; inset: 0; background: rgba(10,12,16,.72); z-index: 340; display: flex; align-items: center; justify-content: center; }
#sheetOverlay .ap-panel { width: 640px; }
.sheet-row { display: flex; gap: 8px; align-items: center; }
.sheet-row input[type=text] { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 6px 9px; font-size: 12.5px; }
.sheet-row select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 6px 6px; font-size: 12px; flex: 0 0 auto; }
.sheet-row .btn { flex: 0 0 auto; }
.sheet-num { flex: 0 0 auto; width: 18px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
/* карточка одежды (2-й реф) в карточке настроек финала */
.sheet-refbox { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--panel-2); }
.sheet-refbox img { width: 88px; height: 88px; object-fit: contain; background: #fff; border-radius: 8px; flex: 0 0 auto; }
.sheet-refcap { font-size: 12px; color: var(--muted); line-height: 1.4; }
/* read-only предпросмотр промта */
.sheet-prevwrap { display: flex; flex-direction: column; gap: 4px; }
.sheet-prev { width: 100%; box-sizing: border-box; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); padding: 8px 10px; font-size: 11.5px; line-height: 1.45; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; resize: vertical; }
/* плавающий бар возврата щита в миссию */
#sheetReturnBar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 350; display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--accent, #7aa7e0); border-radius: 12px; padding: 10px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
#sheetReturnBar .srb-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#sheetReturnBar .srb-text { font-size: 12.5px; color: var(--text); max-width: 460px; }
#sheetReturnBar .srb-error { max-width: 460px; color: #ffb0aa; font-size: 11.5px; line-height: 1.35; }
#sheetReturnBar .srb-error:empty { display: none; }

/* Компактный рабочий режим для типичных ноутбучных/HD-окон без потери действий. */
@media (max-width: 1400px) {
  #toolbar {
    gap: 4px 6px;
    padding: 6px 8px;
  }
  #toolbar .tb-group {
    min-width: 0;
    max-width: calc(100vw - 16px);
    gap: 4px;
    padding: 2px 5px;
  }
  #toolbar .tb-cap { margin-inline: 1px 3px; font-size: 9px; }
  #toolbar .btn { padding: 5px 8px; font-size: 12px; }
  #toolbar .btn.icon { padding: 5px 7px; }
  #toolbar .select, #toolbar .num { padding: 4px 6px; font-size: 12px; }
  #toolbar .proj-name { width: 130px; padding: 5px 7px; font-size: 12px; }
  #toolbar #layoutPreset { max-width: 160px; }
  #toolbar #boardPreset { max-width: 170px; }
  #toolbar #exportSize { max-width: 160px; }

  #tabsBar { padding-inline: 8px; }
  #tabsBar .tab { padding-inline: 12px; }
  #tabsBar #userBox { max-width: 38%; }

  #sidebar { width: 210px; min-width: 210px; padding: 8px; }
  #inspector { width: 220px; min-width: 220px; padding: 10px; }
  #resultTray { width: 280px; }
  .tryon-panel { width: 290px; min-width: 290px; padding: 12px; }
  #genView > .tr-history { width: 260px; }
  .auto-side { width: 280px; min-width: 280px; }
  .auto-side-head { gap: 6px; padding: 8px 10px; }
  .auto-main { padding: 12px 14px; }
  .auto-project-nav { top: -12px; margin: -12px -14px 14px; padding-inline: 14px; }
  .auto-project-nav-home { min-width: 180px; max-width: 240px; }
  .auto-project-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scv2-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scv2-filters { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .scv2-ref-form { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .scv2-ref-files { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
  .auto-project-nav { align-items: stretch; flex-wrap: wrap; }
  .auto-project-nav-tabs { order: 3; width: 100%; }
  .auto-project-nav-delete { margin-left: auto; }
  .auto-project-entity-list { grid-template-columns: 1fr; }
  .scv2-question-group-head { align-items: flex-start; }
  .scv2-answer-form { grid-template-columns: 1fr; }
  .scv2-answer-form > .btn { justify-self: start; }
  .scv2-card-summary, .asset-pack-item-summary { grid-template-columns: auto minmax(120px, 1fr); }
  .scv2-card-badges, .asset-pack-item-summary > .scv2-badge { grid-column: 2; justify-self: start; }
  .scv2-card-summary::after, .asset-pack-item-summary::after { grid-column: 3; grid-row: 1 / span 2; }
  .scv2-field { grid-template-columns: minmax(110px, .7fr) minmax(150px, 1.3fr); }
  .scv2-field.is-editable { grid-template-columns: minmax(110px, .7fr) minmax(150px, 1.3fr) auto; }
  .scv2-field-source { grid-column: 2; text-align: left; }
  .scv2-field.is-editable .scv2-field-edit { grid-column: 3; grid-row: 1 / span 2; }
}

@media (max-width: 760px) {
  .scv2-summary { grid-template-columns: 1fr; }
  .scv2-metric { min-height: 82px; }
  .scv2-filters, .scv2-ref-form { grid-template-columns: 1fr; }
  .scv2-ref-files, .scv2-ref-comment, .scv2-ref-actions, .scv2-ref-upload-state { grid-column: 1; }
  .scv2-card-body, .asset-pack-item-body { padding-left: 15px; }
  .scv2-footer, .asset-pack-footer { align-items: stretch; flex-direction: column; }
  .scv2-materialize-feedback { min-width: 0; flex-basis: auto; }
  .scv2-footer > .btn { width: 100%; }
}

/* всплывашка ошибок: нижний statusbar легко пропустить */
#csmToast{position:fixed;left:50%;bottom:56px;transform:translateX(-50%) translateY(12px);max-width:min(640px,90vw);padding:10px 16px;background:#3a1f24;border:1px solid rgba(229,84,75,.6);color:#ffd9d5;border-radius:10px;font-size:13px;z-index:12000;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s}
#csmToast.show{opacity:1;transform:translateX(-50%) translateY(0)}

/* сущности сценария, уже ушедшие в работу (миссия/очередь) — вычёркиваются */
.scv2-card.is-working-entity > .scv2-card-summary .scv2-card-title{text-decoration:line-through;opacity:.55}
.scv2-card.is-working-entity{opacity:.75}
.scv2-badge.is-in-work{background:rgba(64,160,90,.18);border-color:rgba(64,160,90,.55);color:#7fd89a}
.scv2-footer-counts .has-working{color:#7fd89a}

/* подсказка «что дальше» в карточке персонажа проекта */
.auto-project-entity-hint{grid-column:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:#e8c07a}
.auto-project-entity-hint.is-ready{color:#7fd89a}
