@font-face {
  font-family: Inter;
  src: url("/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Атрибут hidden должен побеждать любые display-правила компонентов */
[hidden] {
  display: none !important;
}

:root {
  --ink: #24212e;
  --muted: #777384;
  --muted-2: #a09caa;
  --line: #e8e7ed;
  --line-strong: #dcd9e4;
  --canvas: #f6f7fb;
  --panel: #ffffff;
  --sidebar: #17161e;
  --sidebar-soft: #23212c;
  --purple: #6c5ce7;
  --purple-strong: #5a49de;
  --purple-soft: #f0edff;
  --blue: #4f7ef7;
  --blue-soft: #edf3ff;
  --mint: #21b888;
  --mint-soft: #eaf9f4;
  --coral: #f26e63;
  --coral-soft: #fff0ee;
  --amber: #eda83d;
  --amber-soft: #fff7e7;
  --shadow-sm: 0 1px 2px rgba(25, 20, 36, .04), 0 4px 12px rgba(25, 20, 36, .05);
  --shadow-md: 0 10px 35px rgba(31, 25, 50, .1), 0 2px 8px rgba(31, 25, 50, .06);
  --shadow-lg: 0 24px 70px rgba(26, 20, 46, .18), 0 8px 20px rgba(26, 20, 46, .08);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(108, 92, 231, .18);
  outline-offset: 1px;
}

.icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
}

.icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: flex;
  width: 100%;
  height: 100%;
}

.primary-sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  width: 230px;
  min-width: 230px;
  height: 100%;
  padding: 20px 14px 14px;
  flex-direction: column;
  color: #d8d6df;
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, .04);
}

.brand {
  display: flex;
  width: max-content;
  margin: 0 8px 22px;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  background: var(--purple);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 10px;
  box-shadow: 0 7px 20px rgba(108, 92, 231, .32);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.04em;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.045em;
}

.brand-name span {
  color: #a89eff;
}

.workspace-switcher {
  display: flex;
  width: 100%;
  min-height: 52px;
  padding: 8px;
  align-items: center;
  gap: 10px;
  color: #efedf3;
  background: #201f28;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
  transition: border-color .2s, background .2s;
}

.workspace-switcher:hover {
  background: #282630;
  border-color: rgba(255, 255, 255, .12);
}

.workspace-avatar {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  color: #342d66;
  background: #d8d2ff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
}

.workspace-copy {
  min-width: 0;
  flex: 1;
}

.workspace-copy b,
.workspace-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-copy b {
  font-size: 12px;
  font-weight: 650;
}

.workspace-copy small {
  margin-top: 3px;
  color: #8f8b99;
  font-size: 10px;
}

.workspace-switcher > .icon {
  width: 15px;
  color: #8f8b99;
}

.main-nav {
  display: flex;
  margin-top: 15px;
  flex-direction: column;
  gap: 3px;
}

.main-nav a {
  display: flex;
  min-height: 39px;
  padding: 0 10px;
  align-items: center;
  gap: 11px;
  color: #aaa6b3;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 530;
  text-decoration: none;
  transition: color .16s, background .16s;
}

.main-nav a:hover {
  color: #f5f4f7;
  background: rgba(255, 255, 255, .05);
}

.main-nav a.active {
  color: #fff;
  background: #2a2834;
  box-shadow: inset 3px 0 0 #8c7cff;
}

.main-nav a > .icon {
  width: 17px;
  height: 17px;
}

.main-nav a kbd {
  display: grid;
  width: 20px;
  height: 18px;
  margin-left: auto;
  place-items: center;
  color: #b8b3c1;
  background: rgba(255, 255, 255, .07);
  border: 0;
  border-radius: 5px;
  font-family: inherit;
  font-size: 9px;
}

.nav-section-label {
  margin: 24px 10px 2px;
  color: #66616f;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.secondary-nav {
  margin-top: 7px;
}

.avatar-stack {
  display: flex;
  margin-left: auto;
}

.avatar-stack i {
  display: grid;
  width: 22px;
  height: 22px;
  margin-left: -5px;
  place-items: center;
  color: #332d49;
  background: #d6d1e8;
  border: 2px solid #17161e;
  border-radius: 50%;
  font-size: 7px;
  font-style: normal;
  font-weight: 750;
}

.avatar-stack i:last-child {
  color: #bcb7c7;
  background: #393641;
}

.upgrade-card {
  margin-top: auto;
  padding: 12px;
  color: #f0eef5;
  background: #23212c;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 11px;
}

.upgrade-icon {
  display: grid;
  width: 29px;
  height: 29px;
  margin-bottom: 10px;
  place-items: center;
  color: #c9c2ff;
  background: rgba(121, 102, 255, .15);
  border-radius: 8px;
}

.upgrade-icon .icon {
  width: 15px;
  height: 15px;
}

.upgrade-card b {
  display: block;
  font-size: 11px;
  font-weight: 650;
}

.upgrade-card p {
  margin: 5px 0 9px;
  color: #928e9d;
  font-size: 9px;
}

.usage-track {
  height: 4px;
  overflow: hidden;
  background: #3a3744;
  border-radius: 10px;
}

.usage-track span {
  display: block;
  width: 72%;
  height: 100%;
  background: #8f80ff;
  border-radius: inherit;
}

.upgrade-card button {
  margin: 10px 0 0;
  padding: 0;
  color: #bcb4ff;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 9px;
  font-weight: 650;
}

.profile-row {
  display: flex;
  min-height: 51px;
  margin-top: 10px;
  padding: 8px 5px;
  align-items: center;
  gap: 9px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.profile-avatar {
  position: relative;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: #362b21;
  background: #e9b88d;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 750;
}

.online-dot {
  position: absolute;
  right: -1px;
  bottom: 1px;
  width: 8px;
  height: 8px;
  background: #35c995;
  border: 2px solid var(--sidebar);
  border-radius: 50%;
}

.profile-row > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.profile-row b,
.profile-row small {
  display: block;
}

.profile-row b {
  overflow: hidden;
  color: #e4e1e9;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-row small {
  margin-top: 3px;
  color: #777280;
  font-size: 8px;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.icon-button:hover:not(:disabled) {
  color: var(--ink);
  background: #f1f0f5;
}

.icon-button:disabled {
  cursor: default;
  opacity: .35;
}

.profile-row .icon-button {
  width: 27px;
  height: 27px;
  color: #85808e;
}

.profile-row .icon-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, .05);
}

.workspace {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.topbar {
  position: relative;
  z-index: 15;
  display: flex;
  min-height: 61px;
  padding: 0 16px 0 21px;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-actions,
.breadcrumbs {
  display: flex;
  align-items: center;
}

.breadcrumbs {
  min-width: 0;
  gap: 5px;
  font-size: 11px;
}

.breadcrumbs span:first-child {
  color: var(--muted);
}

.breadcrumbs .icon {
  width: 13px;
  height: 13px;
  color: #b2aebb;
}

.breadcrumbs b {
  overflow: hidden;
  max-width: 240px;
  font-weight: 630;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-pill {
  display: inline-flex;
  min-height: 23px;
  margin-left: 10px;
  padding: 0 8px;
  align-items: center;
  gap: 5px;
  color: #7f7888;
  background: #f4f3f7;
  border: 1px solid #eceaf0;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 600;
}

.draft-pill i {
  width: 5px;
  height: 5px;
  background: #aaa5b2;
  border-radius: 50%;
}

.topbar-actions {
  gap: 7px;
}

.topbar-actions .icon-button {
  width: 32px;
  height: 32px;
}

.has-badge {
  position: relative;
}

.has-badge i {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 5px;
  height: 5px;
  background: #f16e62;
  border: 1px solid #fff;
  border-radius: 50%;
}

.action-divider {
  width: 1px;
  height: 23px;
  margin: 0 3px;
  background: var(--line);
}

.button {
  display: inline-flex;
  min-height: 34px;
  padding: 0 13px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 630;
  box-shadow: 0 1px 2px rgba(25, 20, 36, .03);
  transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
}

.button:hover {
  border-color: #c7c2d2;
  background: #fafafd;
}

.button:active {
  transform: translateY(1px);
}

.button .icon {
  width: 14px;
  height: 14px;
}

.button.primary {
  color: #fff;
  background: var(--purple);
  border-color: var(--purple);
  box-shadow: 0 5px 14px rgba(108, 92, 231, .22);
}

.button.primary:hover {
  background: var(--purple-strong);
  border-color: var(--purple-strong);
  box-shadow: 0 7px 18px rgba(108, 92, 231, .28);
}

.mobile-menu {
  display: none;
  margin-right: 7px;
}

.studio-layout {
  display: grid;
  min-width: 0;
  min-height: 0;
  flex: 1;
  grid-template-columns: 316px minmax(500px, 1fr);
}

.builder-sidebar,
.inspector {
  min-width: 0;
  overflow: hidden auto;
  background: var(--panel);
  scrollbar-width: thin;
  scrollbar-color: #d8d5df transparent;
}

.builder-sidebar {
  position: relative;
  z-index: 6;
  display: flex;
  padding: 17px 12px 14px;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.script-meta {
  position: relative;
  display: flex;
  padding: 0 3px 14px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
}

/* меню сценариев: список, активный, создание нового */
.scenario-menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; min-width: 250px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 40px rgba(25, 20, 37, .16); }
.scenario-menu > button { display: flex; width: 100%; padding: 8px 9px; align-items: center; gap: 8px; text-align: left; background: none; border: 0; border-radius: 7px; cursor: pointer; font-size: 12px; }
.scenario-menu > button:hover { background: #f6f4fa; }
.scenario-menu > button.active { color: var(--purple, #6d5ef0); font-weight: 650; }
.scenario-menu > button .icon { width: 13px; height: 13px; flex: none; }
.scenario-menu > button > span:nth-child(2) { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scenario-menu > button small { color: var(--muted, #6d667a); font-size: 10px; }
.scenario-menu-divider { margin: 5px 0; border-top: 1px solid var(--line); }
.scenario-menu-note { margin: 0; padding: 8px 9px; color: var(--muted, #6d667a); font-size: 12px; }

.script-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--purple);
  background: var(--purple-soft);
  border-radius: 9px;
}

.script-icon .icon {
  width: 16px;
  height: 16px;
}

.script-meta > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.script-meta label {
  display: block;
  margin-bottom: 1px;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 600;
}

.script-meta input {
  display: block;
  width: 100%;
  padding: 2px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  font-size: 11px;
  font-weight: 670;
}

.script-meta input:hover,
.script-meta input:focus {
  border-bottom-color: var(--line-strong);
  outline: 0;
}

.script-meta .icon-button {
  width: 25px;
  height: 25px;
}

.completion-card {
  display: flex;
  min-height: 61px;
  margin: 12px 0 7px;
  padding: 9px 9px 9px 10px;
  align-items: center;
  gap: 9px;
  background: #faf9fd;
  border: 1px solid #eeecf3;
  border-radius: 10px;
}

.score-ring {
  --score: 0deg;
  position: relative;
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  background: conic-gradient(var(--mint) var(--score), #e6e3eb var(--score));
  border-radius: 50%;
}

.score-ring::before {
  position: absolute;
  width: 31px;
  height: 31px;
  background: #fff;
  border-radius: 50%;
  content: "";
}

.score-ring strong,
.score-ring span {
  position: relative;
  z-index: 1;
}

.score-ring strong {
  margin-left: -3px;
  font-size: 11px;
  font-weight: 760;
}

.score-ring span {
  position: absolute;
  right: 5px;
  bottom: 12px;
  color: var(--muted-2);
  font-size: 6px;
}

.completion-card > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.completion-card b,
.completion-card p {
  display: block;
  margin: 0;
}

.completion-card b {
  font-size: 10px;
  font-weight: 670;
}

.completion-card p {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.completion-card > button {
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  color: var(--muted-2);
  background: none;
  border: 0;
  cursor: pointer;
}

.completion-card > button .icon {
  width: 13px;
  height: 13px;
}

.sidebar-tabs {
  display: grid;
  margin: 8px 0 9px;
  padding: 3px;
  background: #f3f2f6;
  border-radius: 8px;
  grid-template-columns: 1fr 1fr;
}

.sidebar-tabs button {
  min-height: 28px;
  padding: 0;
  color: #898491;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 630;
}

.sidebar-tabs button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 3px rgba(30, 25, 43, .1);
}

.side-panel {
  display: none;
}

.side-panel.active {
  display: block;
}

.structure-item,
.branch-item {
  display: flex;
  width: 100%;
  min-height: 48px;
  padding: 6px 7px;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, border-color .15s;
}

.structure-item:hover,
.branch-item:hover {
  background: #f8f7fa;
}

.structure-item.active,
.branch-item.active {
  background: var(--purple-soft);
  border-color: #ddd7ff;
}

.item-icon,
.branch-index {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
}

.item-icon .icon {
  width: 14px;
  height: 14px;
}

.item-icon.violet {
  color: var(--purple);
  background: var(--purple-soft);
}

.item-icon.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.item-icon.coral {
  color: var(--coral);
  background: var(--coral-soft);
}

.item-icon.amber {
  color: #ce881c;
  background: var(--amber-soft);
}

.structure-item > span:nth-child(2),
.branch-item > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.structure-item b,
.structure-item small,
.branch-item b,
.branch-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.structure-item b,
.branch-item b {
  font-size: 9px;
  font-weight: 630;
}

.structure-item small,
.branch-item small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 8px;
}

.status-check {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: #fff;
  background: var(--mint);
  border-radius: 50%;
}

.status-check .icon {
  width: 10px;
  height: 10px;
}

.section-heading {
  display: flex;
  min-height: 34px;
  margin-top: 5px;
  padding: 0 7px;
  align-items: center;
  justify-content: space-between;
  color: #96919e;
  font-size: 8px;
  font-weight: 720;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.section-heading button {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.section-heading button:hover {
  color: var(--purple);
  background: var(--purple-soft);
}

.section-heading .icon {
  width: 13px;
  height: 13px;
}

.branch-index {
  color: var(--branch-color, var(--purple));
  background: color-mix(in srgb, var(--branch-color, var(--purple)) 11%, white);
  font-size: 9px;
  font-weight: 760;
}

.branch-item .branch-status {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--branch-color, var(--purple));
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--branch-color, var(--purple)) 12%, white);
}

.variables-panel {
  padding: 3px 2px;
}

.variable-search {
  display: flex;
  min-height: 33px;
  padding: 0 9px;
  align-items: center;
  gap: 7px;
  background: #f6f5f8;
  border: 1px solid #efedf2;
  border-radius: 8px;
}

.variable-search .icon {
  width: 13px;
  height: 13px;
  color: var(--muted-2);
}

.variable-search input {
  min-width: 0;
  padding: 0;
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 9px;
}

.panel-help {
  margin: 10px 4px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.variable-row {
  display: flex;
  min-height: 42px;
  padding: 6px 7px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f1eff4;
}

.variable-row .variable-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 7px;
}

.variable-row .variable-icon .icon {
  width: 13px;
  height: 13px;
}

.variable-row > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.variable-row b,
.variable-row small {
  display: block;
}

.variable-row b {
  font-size: 9px;
}

.variable-row small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 7px;
}

.required-dot {
  width: 6px;
  height: 6px;
  background: var(--coral);
  border-radius: 50%;
}

.add-variable {
  display: flex;
  width: 100%;
  min-height: 34px;
  margin-top: 9px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--purple);
  background: var(--purple-soft);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 630;
}

.add-variable .icon {
  width: 12px;
  height: 12px;
}

.best-practice-card {
  margin-top: auto;
  padding: 11px;
  background: #f7f4ff;
  border: 1px solid #e9e3ff;
  border-radius: 10px;
}

.best-practice-top {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5b48d5;
}

.best-practice-top .icon {
  width: 13px;
  height: 13px;
}

.best-practice-top b {
  font-size: 9px;
  font-weight: 700;
}

.new-label {
  padding: 2px 4px;
  color: #fff;
  background: var(--purple);
  border-radius: 4px;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: .07em;
}

.best-practice-card p {
  margin: 8px 0;
  color: #736b83;
  font-size: 8px;
  line-height: 1.5;
}

.best-practice-card button {
  padding: 0;
  color: #5b48d5;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 8px;
  font-weight: 670;
}

.best-practice-card button:disabled {
  color: #91899f;
  cursor: default;
}

.canvas-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--canvas);
}

.canvas-toolbar {
  position: relative;
  z-index: 5;
  display: flex;
  min-height: 49px;
  padding: 0 13px;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.view-switcher,
.canvas-tools {
  display: flex;
  align-items: center;
}

.view-switcher {
  gap: 3px;
}

.view-switcher button {
  display: flex;
  min-height: 30px;
  padding: 0 9px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 600;
}

.view-switcher button.active {
  color: var(--ink);
  background: #f0eff4;
}

.view-switcher .icon {
  width: 13px;
  height: 13px;
}

.canvas-tools {
  gap: 4px;
}

.save-state {
  display: flex;
  margin-right: 7px;
  align-items: center;
  gap: 5px;
  color: #8e8996;
  font-size: 8px;
  white-space: nowrap;
}

.save-state .icon {
  width: 13px;
  height: 13px;
  color: var(--mint);
}

.save-state.dirty .icon,
.save-state.saving .icon {
  color: var(--amber);
}

.save-state.error .icon {
  color: var(--coral);
}

.canvas-tools .icon-button {
  width: 29px;
  height: 29px;
}

.canvas-tools .icon-button .icon {
  width: 14px;
  height: 14px;
}

.flow-viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  flex: 1;
  background-color: var(--canvas);
  background-image: radial-gradient(#d9d8e0 1px, transparent 1px);
  background-size: 20px 20px;
  scrollbar-width: thin;
  scrollbar-color: #cbc8d4 transparent;
}

.flow-stage {
  display: none;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  padding: 38px 70px 110px;
  transform-origin: top center;
}

.flow-stage.ready {
  display: block;
}

.canvas-empty-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  background: var(--canvas);
}

.canvas-empty-loading b {
  margin-top: 12px;
  color: var(--ink);
  font-size: 11px;
}

.canvas-empty-loading small {
  margin-top: 4px;
  font-size: 9px;
}

.canvas-empty-loading.hidden {
  display: none;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #ddd9e7;
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.flow-root {
  display: flex;
  min-width: max-content;
  align-items: center;
  flex-direction: column;
}

.start-node {
  display: flex;
  height: 29px;
  padding: 0 13px;
  align-items: center;
  gap: 6px;
  color: #635c70;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  font-size: 8px;
  font-weight: 680;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.start-node .start-dot {
  width: 7px;
  height: 7px;
  background: var(--mint);
  border: 2px solid #d3f4e8;
  border-radius: 50%;
  box-sizing: content-box;
}

.flow-connector {
  position: relative;
  width: 1px;
  height: 28px;
  background: #c9c6d2;
}

.flow-connector::after {
  position: absolute;
  right: -3px;
  bottom: -1px;
  width: 5px;
  height: 5px;
  border-right: 1px solid #aaa6b4;
  border-bottom: 1px solid #aaa6b4;
  content: "";
  transform: rotate(45deg);
}

.flow-node {
  position: relative;
  width: 250px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dedbe6;
  border-radius: 11px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}

.flow-node:hover {
  border-color: #bdb7ce;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.flow-node.selected {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(108, 92, 231, .13), var(--shadow-md);
}

.flow-node.dragging {
  opacity: .45;
}

.flow-node.drop-before::before,
.flow-node.drop-after::after {
  position: absolute;
  right: 6px;
  left: 6px;
  z-index: 5;
  height: 2px;
  background: var(--purple);
  border-radius: 4px;
  content: "";
}

.flow-node.drop-before::before { top: -5px; }
.flow-node.drop-after::after { bottom: -5px; }

.node-accent {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--node-color, var(--purple));
}

.node-main {
  padding: 12px 13px 11px 15px;
}

.node-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.node-type-icon {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--node-color, var(--purple));
  background: color-mix(in srgb, var(--node-color, var(--purple)) 10%, white);
  border-radius: 7px;
}

.node-type-icon .icon {
  width: 13px;
  height: 13px;
}

.node-heading > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.node-label,
.node-kicker {
  display: block;
}

.node-label {
  color: #393442;
  font-size: 9px;
  font-weight: 690;
}

.node-kicker {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 7px;
  font-weight: 540;
}

.node-more {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #aaa5b1;
}

.node-more .icon {
  width: 13px;
  height: 13px;
}

.node-copy {
  display: -webkit-box;
  overflow: hidden;
  margin: 10px 0 0;
  color: #605b69;
  font-size: 9px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.node-footer {
  display: flex;
  min-height: 30px;
  padding: 0 11px 0 15px;
  align-items: center;
  gap: 6px;
  color: #918c99;
  background: #faf9fc;
  border-top: 1px solid #efedf2;
  font-size: 7px;
}

.node-footer .icon {
  width: 11px;
  height: 11px;
}

.node-footer .node-chip {
  display: inline-flex;
  height: 18px;
  padding: 0 6px;
  align-items: center;
  color: var(--node-color, var(--purple));
  background: color-mix(in srgb, var(--node-color, var(--purple)) 9%, white);
  border-radius: 5px;
  font-size: 7px;
  font-weight: 650;
}

.node-footer > span:last-child:not(:first-child) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.router-node {
  width: 270px;
  border-color: #cbc4fb;
}

.router-node .node-main {
  padding-bottom: 12px;
}

.router-tags {
  display: flex;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 5px;
}

.router-tags span {
  display: inline-flex;
  height: 20px;
  padding: 0 7px;
  align-items: center;
  gap: 4px;
  color: #6e6878;
  background: #f5f3fb;
  border: 1px solid #ece8f6;
  border-radius: 6px;
  font-size: 7px;
}

.router-tags i {
  width: 5px;
  height: 5px;
  background: var(--tag-color);
  border-radius: 50%;
}

.branches-connector {
  position: relative;
  width: calc(100% - 270px);
  min-width: 280px;
  height: 40px;
  border-top: 1px solid #c9c6d2;
}

.branches-connector::before {
  position: absolute;
  top: -28px;
  left: 50%;
  width: 1px;
  height: 28px;
  background: #c9c6d2;
  content: "";
}

.branches-grid {
  display: flex;
  align-items: flex-start;
  gap: 22px;
}

.branch-lane {
  position: relative;
  display: flex;
  width: 258px;
  align-items: center;
  flex-direction: column;
}

.branch-lane::before {
  position: absolute;
  top: -41px;
  left: 50%;
  width: 1px;
  height: 41px;
  background: #c9c6d2;
  content: "";
}

.branch-label {
  display: flex;
  max-width: 224px;
  min-height: 27px;
  margin-bottom: 8px;
  padding: 0 9px;
  align-items: center;
  gap: 6px;
  color: #625c6c;
  background: #fff;
  border: 1px solid #dedbe6;
  border-radius: 7px;
  box-shadow: 0 2px 8px rgba(28, 24, 38, .04);
  cursor: pointer;
  font-size: 8px;
  font-weight: 630;
}

.branch-label:hover,
.branch-label.active {
  border-color: var(--branch-color);
}

.branch-label i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  background: var(--branch-color);
  border-radius: 50%;
}

.branch-label span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-label .icon {
  width: 10px;
  height: 10px;
  color: var(--muted-2);
}

.branch-lane .flow-node {
  width: 258px;
}

.step-add-wrap {
  display: flex;
  height: 30px;
  align-items: center;
  flex-direction: column;
}

.step-add-line {
  width: 1px;
  height: 14px;
  background: #c9c6d2;
}

.step-add {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  color: #817a8b;
  background: #fff;
  border: 1px solid #d7d3df;
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(31, 27, 41, .08);
  cursor: pointer;
  transition: color .15s, border-color .15s, transform .15s;
}

.step-add:hover {
  color: var(--purple);
  border-color: var(--purple);
  transform: scale(1.08);
}

.step-add .icon {
  width: 11px;
  height: 11px;
}

.empty-branch {
  width: 258px;
  padding: 17px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, .75);
  border: 1px dashed #cfcbd8;
  border-radius: 10px;
  text-align: center;
  font-size: 8px;
  line-height: 1.45;
}

.conversation-board {
  width: min(680px, calc(100vw - 430px));
  min-width: 520px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

.conversation-head {
  display: flex;
  min-height: 68px;
  padding: 14px 17px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.conversation-head > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.conversation-head > div > .icon {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 8px;
  color: var(--purple);
  background: var(--purple-soft);
  border-radius: 9px;
}

.conversation-head b,
.conversation-head small {
  display: block;
}

.conversation-head b {
  font-size: 10px;
}

.conversation-head small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.live-badge {
  display: inline-flex;
  height: 23px;
  padding: 0 8px;
  align-items: center;
  gap: 5px;
  color: #7b7484;
  background: #f5f4f7;
  border-radius: 6px;
  font-size: 7px;
  font-weight: 720;
  letter-spacing: .06em;
}

.live-badge i {
  width: 6px;
  height: 6px;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(33, 184, 136, .12);
}

.conversation-tabs {
  display: flex;
  padding: 10px 13px;
  gap: 6px;
  overflow-x: auto;
  background: #faf9fc;
  border-bottom: 1px solid var(--line);
}

.conversation-tabs button {
  display: inline-flex;
  height: 28px;
  padding: 0 9px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  font-size: 8px;
  white-space: nowrap;
}

.conversation-tabs button:hover,
.conversation-tabs button.active {
  color: var(--ink);
  border-color: #cfc9e4;
  box-shadow: 0 2px 7px rgba(32, 27, 45, .06);
}

.conversation-tabs i {
  width: 6px;
  height: 6px;
  background: var(--branch-color);
  border-radius: 50%;
}

.conversation-stream {
  display: flex;
  min-height: 420px;
  padding: 22px 18px 34px;
  flex-direction: column;
  gap: 13px;
  background: #f7f8fb;
}

.conversation-message,
.caller-message {
  display: flex;
  width: min(82%, 460px);
  padding: 10px 12px;
  align-items: flex-start;
  gap: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px 12px 12px 12px;
  box-shadow: 0 2px 8px rgba(28, 24, 39, .04);
  text-align: left;
}

.conversation-message {
  align-self: flex-end;
  border: 1px solid #ded8ff;
  border-radius: 12px 5px 12px 12px;
  cursor: pointer;
}

.conversation-message:hover,
.conversation-message.selected {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(108, 92, 231, .09);
}

.conversation-message.system {
  background: #f0f4ff;
  border-color: #dce5ff;
}

.message-avatar {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--purple);
  border-radius: 7px;
  font-size: 7px;
  font-weight: 750;
}

.caller-message .message-avatar {
  color: #4e4858;
  background: #e5e2ea;
}

.conversation-message > span:last-child,
.caller-message > span:last-child {
  min-width: 0;
  flex: 1;
}

.conversation-message small,
.conversation-message b,
.conversation-message em,
.caller-message small,
.caller-message b {
  display: block;
}

.conversation-message small,
.caller-message small {
  margin-bottom: 5px;
  color: var(--muted-2);
  font-size: 7px;
}

.conversation-message b,
.caller-message b {
  color: #514c59;
  font-size: 9px;
  font-weight: 520;
  line-height: 1.5;
}

.conversation-message em {
  width: max-content;
  margin-top: 7px;
  padding: 3px 5px;
  color: var(--purple);
  background: var(--purple-soft);
  border-radius: 4px;
  font-size: 7px;
  font-style: normal;
}

.conversation-action {
  display: inline-flex;
  min-height: 30px;
  margin: 1px auto;
  padding: 0 10px;
  align-items: center;
  gap: 6px;
  color: #188762;
  background: var(--mint-soft);
  border: 1px solid #d1f1e6;
  border-radius: 7px;
  font-size: 8px;
  font-weight: 650;
}

.conversation-action .icon {
  width: 12px;
  height: 12px;
}

.conversation-empty {
  margin: auto;
  color: var(--muted);
  font-size: 9px;
}

.add-branch-lane {
  display: flex;
  width: 160px;
  min-height: 76px;
  margin-top: 35px;
  padding: 0 14px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--purple);
  background: rgba(255, 255, 255, .72);
  border: 1px dashed #bcb5ec;
  border-radius: 10px;
  cursor: pointer;
  font-size: 8px;
  font-weight: 650;
}

.add-branch-lane:hover {
  background: #fff;
  border-style: solid;
}

.add-branch-lane .icon {
  width: 13px;
  height: 13px;
}

.canvas-help {
  position: fixed;
  bottom: 20px;
  left: calc(230px + 248px + 20px);
  z-index: 4;
  display: flex;
  min-height: 29px;
  padding: 0 10px;
  align-items: center;
  gap: 6px;
  color: #817c88;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  font-size: 8px;
  backdrop-filter: blur(7px);
}

.canvas-help .icon {
  width: 12px;
  height: 12px;
}

.zoom-controls {
  position: fixed;
  right: 326px;
  bottom: 20px;
  z-index: 4;
  display: flex;
  height: 31px;
  align-items: center;
  overflow: hidden;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(7px);
}

.zoom-controls button {
  display: grid;
  width: 30px;
  height: 100%;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.zoom-controls button:hover {
  color: var(--purple);
  background: var(--purple-soft);
}

.zoom-controls button:last-child {
  border-left: 1px solid var(--line);
}

.zoom-controls .icon {
  width: 12px;
  height: 12px;
}

.zoom-controls span {
  width: 40px;
  color: #77717f;
  font-size: 8px;
  text-align: center;
}

.minimap {
  position: fixed;
  right: 326px;
  bottom: 61px;
  z-index: 3;
  display: none;
  width: 104px;
  height: 66px;
  padding: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.minimap-content {
  display: grid;
  gap: 3px;
}

.minimap span {
  position: absolute;
  inset: 9px 10px;
  border: 1px solid rgba(108, 92, 231, .55);
  border-radius: 3px;
}

.inspector {
  position: relative;
  z-index: 7;
  display: flex;
  margin: 6px 0 10px;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.inspector[hidden] { display: none; }

.inspector-head {
  display: none;
  min-height: 70px;
  padding: 15px 17px 12px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.inspector-head span {
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.inspector-head h2 {
  margin: 5px 0 0;
  font-size: 13px;
  font-weight: 720;
  letter-spacing: -.015em;
}

.inspector-close {
  display: none;
}

.inspector-content {
  min-height: 0;
  padding: 13px;
  overflow-y: auto;
  flex: 1;
  max-height: 62vh;      /* длинный блок скроллится внутри аккордеона */
}

.inspector-content textarea.text-field { min-height: 120px; }
.inspector-content textarea.text-field.tall { min-height: 200px; }

.inspector-loading {
  display: grid;
  min-height: 160px;
  place-items: center;
}

.inspector-footer {
  padding: 11px 17px;
  border-top: 1px solid var(--line);
}

.inspector-footer:empty {
  display: none;
}

.field-group {
  margin-bottom: 16px;
}

.field-label,
.field-group > label:first-child {
  display: flex;
  margin-bottom: 7px;
  align-items: center;
  justify-content: space-between;
  color: #514c5a;
  font-size: 9px;
  font-weight: 650;
}

.field-label small,
.field-group > label:first-child small {
  color: var(--muted-2);
  font-size: 7px;
  font-weight: 500;
}

.field-help {
  margin: 7px 1px 0;
  color: var(--muted-2);
  font-size: 7px;
  line-height: 1.5;
}

.text-field,
.select-field {
  display: block;
  width: 100%;
  min-height: 37px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 9px;
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}

textarea.text-field {
  min-height: 89px;
  resize: vertical;
}

.text-field:hover,
.select-field:hover {
  border-color: #c7c2d1;
}

.text-field:focus,
.select-field:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, .1);
  outline: 0;
}

.field-with-token {
  position: relative;
}

.field-with-token .text-field {
  padding-bottom: 37px;
}

.token-row {
  position: absolute;
  right: 7px;
  bottom: 7px;
  left: 7px;
  display: flex;
  gap: 5px;
}

.token-chip {
  display: inline-flex;
  height: 21px;
  padding: 0 7px;
  align-items: center;
  gap: 4px;
  color: #6857d7;
  background: var(--purple-soft);
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 7px;
}

.token-chip:hover {
  background: #e4deff;
}

.toggle-row,
.check-row {
  display: flex;
  min-height: 47px;
  align-items: flex-start;
  gap: 9px;
}

.toggle-row {
  justify-content: space-between;
}

.toggle-row > span:first-child,
.check-row > span {
  min-width: 0;
  flex: 1;
}

.toggle-row b,
.toggle-row small,
.check-row b,
.check-row small {
  display: block;
}

.toggle-row b,
.check-row b {
  color: #4f4a58;
  font-size: 9px;
  font-weight: 640;
}

.toggle-row small,
.check-row small {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 7px;
  line-height: 1.45;
}

.switch {
  position: relative;
  display: inline-block;
  width: 31px;
  height: 18px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #d5d2dc;
  border-radius: 20px;
  cursor: pointer;
  transition: background .18s;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(20, 16, 30, .2);
  content: "";
  transition: transform .18s;
}

.switch input:checked + span {
  background: var(--purple);
}

.switch input:checked + span::after {
  transform: translateX(13px);
}

.check-row {
  cursor: pointer;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--purple);
}

.section-divider {
  height: 1px;
  margin: 15px 0;
  background: var(--line);
}

.inspector-badge {
  display: flex;
  min-height: 44px;
  margin-bottom: 15px;
  padding: 8px 9px;
  align-items: center;
  gap: 8px;
  color: #665c78;
  background: #f7f5fb;
  border: 1px solid #ebe7f3;
  border-radius: 8px;
  font-size: 8px;
  line-height: 1.45;
}

.inspector-badge > .icon {
  width: 15px;
  height: 15px;
  color: var(--purple);
}

.type-selector {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, 1fr);
}

.type-selector button {
  display: flex;
  min-height: 56px;
  padding: 7px 4px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  font-size: 7px;
  font-weight: 620;
}

.type-selector button:hover,
.type-selector button.active {
  color: var(--purple);
  background: var(--purple-soft);
  border-color: #d9d2ff;
}

.type-selector .icon {
  width: 15px;
  height: 15px;
}

.danger-button,
.plain-action {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 8px;
  font-weight: 630;
}

.plain-action {
  color: var(--purple);
}

.danger-button {
  color: var(--coral);
}

.danger-button:hover {
  background: var(--coral-soft);
  border-color: #ffd2cd;
}

.danger-button .icon,
.plain-action .icon {
  width: 13px;
  height: 13px;
}

.quality-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quality-row {
  display: flex;
  min-height: 42px;
  padding: 8px;
  align-items: center;
  gap: 8px;
  background: #faf9fc;
  border: 1px solid #efedf2;
  border-radius: 8px;
}

.quality-row > .icon {
  display: grid;
  width: 20px;
  height: 20px;
  padding: 4px;
  color: #fff;
  background: var(--mint);
  border-radius: 50%;
}

.quality-row.warning > .icon {
  color: #9a6511;
  background: #ffe5ac;
}

.quality-row b,
.quality-row small {
  display: block;
}

.quality-row b {
  font-size: 8px;
}

.quality-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 7px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  width: min(330px, calc(100vw - 36px));
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  min-height: 49px;
  padding: 10px 12px;
  align-items: center;
  gap: 9px;
  color: #eeeaf4;
  background: #24212e;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 9px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(8px);
  animation: toast-in .22s forwards;
}

.toast.success > .icon { color: #62d7ad; }
.toast.error > .icon { color: #ff8e85; }

@keyframes toast-in {
  to { opacity: 1; transform: translateY(0); }
}

.app-dialog {
  width: calc(100% - 30px);
  max-width: 390px;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
}

.app-dialog::backdrop {
  background: rgba(21, 18, 29, .54);
  backdrop-filter: blur(4px);
}

.dialog-card {
  position: relative;
  padding: 28px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.dialog-card.compact {
  padding-bottom: 24px;
}

.dialog-close {
  position: absolute;
  top: 13px;
  right: 13px;
}

.dialog-hero {
  display: grid;
  width: 43px;
  height: 43px;
  margin-bottom: 16px;
  place-items: center;
  color: var(--purple);
  background: var(--purple-soft);
  border-radius: 12px;
}

.dialog-hero.lilac {
  color: #6754da;
  background: #f1edff;
}

.dialog-hero.mint {
  color: #159d73;
  background: var(--mint-soft);
}

.dialog-hero .icon {
  width: 20px;
  height: 20px;
}

.dialog-card h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -.025em;
}

.dialog-card > p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.dialog-card .field-label {
  margin-top: 13px;
}

.phone-input {
  display: flex;
  height: 43px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}

.phone-input:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, .1);
}

.phone-input span {
  display: flex;
  height: 23px;
  padding: 0 11px;
  align-items: center;
  color: #696373;
  border-right: 1px solid var(--line);
  font-size: 10px;
}

.phone-input input {
  min-width: 0;
  padding: 0 11px;
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 11px;
}

.test-note {
  display: flex;
  margin: 13px 0 17px;
  padding: 10px;
  align-items: flex-start;
  gap: 7px;
  color: #777180;
  background: #f8f7fa;
  border-radius: 8px;
  font-size: 8px;
  line-height: 1.5;
}

.test-note .icon {
  width: 14px;
  height: 14px;
  color: var(--blue);
}

.dialog-submit {
  width: 100%;
  min-height: 41px;
  margin-top: 17px;
}

/* ---------- вкладка «Промпт» в канвасе ---------- */

.prompt-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  flex: 1;
  background: var(--canvas);
  scrollbar-width: thin;
  scrollbar-color: #cbc8d4 transparent;
}

.prompt-panel-scroll {
  display: flex;
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 22px 24px 46px;
  flex-direction: column;
}

.prompt-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.prompt-panel-head > div:first-child {
  min-width: 0;
}

.prompt-panel-head h2 {
  margin: 8px 0 0;
  font-size: 19px;
  letter-spacing: -.025em;
}

.prompt-panel-head p {
  margin: 5px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.prompt-mode-switch {
  display: flex;
  flex: 0 0 auto;
  padding: 3px;
  gap: 3px;
  background: #efeef4;
  border-radius: 10px;
}

.prompt-mode-switch button {
  display: flex;
  min-height: 29px;
  padding: 0 11px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 620;
  white-space: nowrap;
}

.prompt-mode-switch button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.prompt-mode-switch .icon {
  width: 13px;
  height: 13px;
}

/* Строка состояния публикации: черновик карты или то, что реально на линии */
.prompt-live {
  display: flex;
  margin-top: 16px;
  padding: 9px 12px;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.prompt-live-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
}

.prompt-live-state::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--muted);
  border-radius: 50%;
}

.prompt-live.ok .prompt-live-state::before { background: #2f9e5f; }
.prompt-live.ok .prompt-live-state { color: #24734a; }
.prompt-live.pending { background: var(--amber-soft); border-color: #f4e2bd; }
.prompt-live.pending .prompt-live-state { color: #8a5b12; }
.prompt-live.pending .prompt-live-state::before { background: #ce881c; }

.prompt-source-switch {
  display: flex;
  flex: 0 0 auto;
  padding: 3px;
  gap: 3px;
  background: #efeef4;
  border-radius: 10px;
}

.prompt-source-switch button {
  min-height: 26px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 620;
  white-space: nowrap;
}

.prompt-source-switch button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.prompt-warning {
  display: flex;
  margin-top: 16px;
  padding: 12px 14px;
  align-items: flex-start;
  gap: 10px;
  color: #8a5b12;
  background: var(--amber-soft);
  border: 1px solid #f4e2bd;
  border-radius: 12px;
}

.prompt-warning > .icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: #ce881c;
}

.prompt-warning-copy b {
  display: block;
  font-size: 12px;
  font-weight: 680;
}

.prompt-warning-copy small {
  display: block;
  margin-top: 3px;
  color: #90682c;
  font-size: 11px;
  line-height: 1.5;
}

.prompt-note {
  margin-top: 8px;
  max-width: 62ch;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.prompt-warning.conflict {
  color: #3d3a49;
  background: var(--panel);
  border-color: #d9d3f5;
}

.prompt-warning.conflict > .icon {
  color: var(--purple);
}

.prompt-warning.conflict .prompt-warning-copy small {
  color: var(--muted);
}

.prompt-conflict-actions {
  display: flex;
  margin-top: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.prompt-fidelity {
  display: flex;
  margin-top: 12px;
  padding: 11px 12px;
  align-items: flex-start;
  gap: 9px;
  border-radius: 11px;
  font-size: 11px;
  line-height: 1.5;
}

.prompt-fidelity > .icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.prompt-fidelity b {
  display: block;
  font-size: 11.5px;
  font-weight: 680;
}

.prompt-fidelity small {
  display: block;
  margin-top: 4px;
}

.prompt-fidelity ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

.prompt-fidelity li + li {
  margin-top: 3px;
}

.prompt-fidelity.warn {
  color: #8a5b12;
  background: var(--amber-soft);
  border: 1px solid #f4e2bd;
}

.prompt-fidelity.warn > .icon {
  color: #ce881c;
}

.prompt-fidelity.ok {
  color: #1c6b4e;
  background: rgba(33, 184, 136, .1);
  border: 1px solid rgba(33, 184, 136, .3);
}

.prompt-fidelity.ok > .icon {
  color: #21b888;
}

/* Расхождения round-trip: строка владельца и то, что получится вместо неё. */
.prompt-fidelity ul.prompt-fidelity-diff {
  margin-top: 8px;
  padding-left: 0;
  list-style: none;
}

.prompt-fidelity-diff li {
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid #f0dfba;
}

.prompt-fidelity-diff li + li {
  margin-top: 6px;
}

.prompt-fidelity-diff i {
  display: block;
  color: #a3762c;
  font-size: 10px;
  font-style: normal;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.prompt-fidelity-diff b {
  margin-top: 2px;
  font-weight: 620;
  word-break: break-word;
}

.prompt-fidelity-diff em {
  display: block;
  margin-top: 5px;
  color: #a3762c;
  font-size: 10.5px;
  font-style: normal;
}

.prompt-fidelity-diff span {
  display: block;
  margin-top: 2px;
  color: #6d5a33;
  word-break: break-word;
}

.prompt-note.strict {
  color: #7a5c17;
}

.prompt-editor {
  display: block;
  width: 100%;
  height: clamp(260px, 42vh, 520px);
  margin-top: 12px;
  padding: 14px 16px;
  resize: vertical;
  color: #e4e1ec;
  background: #1e1c25;
  border: 1px solid #2e2b39;
  border-radius: 12px;
  outline: 0;
  color-scheme: dark;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  tab-size: 2;
}

.prompt-editor:focus {
  border-color: #6c5ce7;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, .18);
}

.prompt-panel .prompt-document {
  height: clamp(260px, 42vh, 520px);
  margin: 12px 0 0;
  flex: none;
}

.prompt-editor-actions {
  display: flex;
  margin-top: 12px;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.prompt-primary,
.prompt-ghost {
  display: inline-flex;
  min-height: 34px;
  padding: 0 13px;
  align-items: center;
  gap: 7px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.prompt-primary {
  color: #fff;
  background: var(--purple);
  border: 1px solid var(--purple);
  box-shadow: 0 6px 16px rgba(108, 92, 231, .2);
}

.prompt-primary:hover {
  background: var(--purple-strong);
}

.prompt-ghost {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
}

.prompt-ghost:hover {
  border-color: #c8c2dd;
}

.prompt-primary:disabled,
.prompt-ghost:disabled {
  cursor: wait;
  opacity: .6;
}

.prompt-primary .icon,
.prompt-ghost .icon {
  width: 14px;
  height: 14px;
}

.prompt-primary.loading .icon {
  animation: generator-spin 1s linear infinite;
}

.prompt-status {
  min-width: 0;
  flex: 1 1 220px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.prompt-status.warn {
  color: #a3701f;
}

.prompt-status.error {
  color: #bd4b44;
}

.prompt-changes {
  margin-top: 16px;
  padding: 14px 15px;
  background: var(--panel);
  border: 1px solid #d9d3f5;
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
}

.prompt-changes-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
}

.prompt-changes-head .icon {
  width: 15px;
  height: 15px;
  color: var(--purple);
}

/* Правка переносится не дословно (или переносить нечего) — панель не «успех». */
.prompt-changes.warn {
  border-color: #f0dfba;
  background: linear-gradient(180deg, var(--amber-soft), var(--panel) 60%);
}

.prompt-changes.warn .prompt-changes-head .icon {
  color: #ce881c;
}

.prompt-changes ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #4c4756;
  font-size: 11px;
  line-height: 1.6;
}

.prompt-changes li + li {
  margin-top: 4px;
}

.prompt-changes-actions {
  display: flex;
  margin-top: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.prompt-ask {
  margin-top: 18px;
  padding: 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
}

.prompt-ask-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.prompt-ask-head > span:last-child {
  min-width: 0;
  flex: 1;
}

.prompt-ask-head b {
  display: block;
  font-size: 12px;
}

.prompt-ask-head small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.prompt-ask-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--purple);
  background: var(--purple-soft);
  border-radius: 9px;
}

.prompt-ask-icon .icon {
  width: 16px;
  height: 16px;
}

.prompt-ask textarea {
  display: block;
  width: 100%;
  min-height: 74px;
  margin-top: 12px;
  padding: 11px 12px;
  resize: vertical;
  color: var(--ink);
  background: #fbfafd;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: 0;
  color-scheme: light;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
}

.prompt-ask textarea:focus {
  background: #fff;
  border-color: #9e91ef;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, .1);
}

.prompt-ask-tips {
  display: flex;
  margin-top: 9px;
  flex-wrap: wrap;
  gap: 6px;
}

.prompt-ask-tips button {
  min-height: 25px;
  padding: 0 9px;
  color: #665c88;
  background: #f7f6fb;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.prompt-ask-tips button:hover {
  color: var(--purple);
  background: #fff;
  border-color: #bdb4ee;
}

.prompt-ask-actions {
  display: flex;
  margin-top: 11px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.prompt-ask-actions > span {
  min-width: 0;
  flex: 1 1 200px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.prompt-ask-actions > span.error {
  color: #bd4b44;
}

.prompt-ask-actions button {
  display: inline-flex;
  min-height: 34px;
  padding: 0 13px;
  align-items: center;
  gap: 7px;
  color: #fff;
  background: var(--purple);
  border: 0;
  border-radius: 9px;
  box-shadow: 0 6px 16px rgba(108, 92, 231, .2);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.prompt-ask-actions button:disabled {
  cursor: wait;
  opacity: .6;
}

.prompt-ask-actions .icon {
  width: 14px;
  height: 14px;
}

.prompt-ask-actions button.loading .icon {
  animation: generator-spin 1s linear infinite;
}

.prompt-answer {
  margin-top: 12px;
  padding: 12px 13px;
  color: #3c3849;
  background: #f7f6fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--purple);
  font-size: 8px;
  font-weight: 760;
  letter-spacing: .12em;
}

.eyebrow .icon {
  width: 12px;
  height: 12px;
}

.prompt-actions {
  display: flex;
  min-height: 40px;
  margin-top: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.prompt-actions button {
  display: flex;
  padding: 0;
  align-items: center;
  gap: 6px;
  color: var(--purple);
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 9px;
  font-weight: 650;
}

.prompt-actions .icon {
  width: 13px;
  height: 13px;
}

.prompt-actions > span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-generator {
  margin-top: 18px;
  padding: 15px;
  background: linear-gradient(145deg, #f7f5ff, #f3f6ff);
  border: 1px solid #ded9ff;
  border-radius: 13px;
}

.scenario-generator-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.scenario-generator-head > span:last-child {
  min-width: 0;
  flex: 1;
}

.scenario-generator-head b,
.scenario-generator-head small {
  display: block;
}

.scenario-generator-head b {
  font-size: 12px;
}

.scenario-generator-head small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.scenario-generator-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #7868ef, #5b49d9);
  border-radius: 9px;
  box-shadow: 0 7px 18px rgba(108, 92, 231, .24);
}

.scenario-generator-icon .icon {
  width: 16px;
  height: 16px;
}

.scenario-generator textarea {
  display: block;
  width: 100%;
  min-height: 112px;
  margin-top: 12px;
  padding: 11px 12px;
  resize: vertical;
  color: var(--ink);
  background: rgba(255, 255, 255, .9);
  border: 1px solid #d8d3ef;
  border-radius: 9px;
  outline: 0;
  font-size: 12px;
  line-height: 1.5;
}

.scenario-generator textarea:focus {
  background: #fff;
  border-color: #9e91ef;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, .1);
}

.scenario-generator-tips {
  display: flex;
  margin-top: 9px;
  flex-wrap: wrap;
  gap: 6px;
}

.scenario-generator-tips button {
  min-height: 25px;
  padding: 0 8px;
  color: #665c88;
  background: rgba(255, 255, 255, .8);
  border: 1px solid #dfdbef;
  border-radius: 7px;
  cursor: pointer;
  font-size: 9px;
}

.scenario-generator-tips button:hover {
  color: var(--purple);
  background: #fff;
  border-color: #bdb4ee;
}

.scenario-generator-actions {
  display: flex;
  margin-top: 11px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scenario-generator-actions > span {
  color: var(--muted);
  font-size: 9px;
}

.scenario-generator-actions > span.error {
  color: #bd4b44;
}

.scenario-generator-actions button {
  display: inline-flex;
  min-height: 35px;
  padding: 0 12px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #fff;
  background: var(--purple);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(108, 92, 231, .2);
  cursor: pointer;
  font-size: 10px;
  font-weight: 680;
}

.scenario-generator-actions button:disabled {
  cursor: wait;
  opacity: .7;
}

.scenario-generator-actions button.loading .icon {
  animation: generator-spin 1s linear infinite;
}

@keyframes generator-spin {
  to { transform: rotate(360deg); }
}

.prompt-document {
  min-height: 0;
  margin: 15px 0 0;
  padding: 10px;
  overflow: auto;
  flex: 1;
  color: #d5d1df;
  background: #1e1c25;
  border-radius: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.55;
}

.prompt-document-loading {
  padding: 12px;
  color: #aaa4b7;
}

.prompt-section + .prompt-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.prompt-section-title {
  display: block;
  padding: 5px 9px 4px;
  color: #8578f0;
  font-family: Inter, sans-serif;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.prompt-line {
  display: grid;
  width: 100%;
  padding: 7px 9px;
  grid-template-columns: 24px minmax(0, 1fr) 16px;
  align-items: start;
  gap: 7px;
  color: #d5d1df;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.55;
  text-align: left;
  transition: color .15s, background .15s;
}

.prompt-line:hover,
.prompt-line:focus-visible {
  color: #fff;
  background: rgba(108, 92, 231, .16);
}

/* Строка без своего блока на карте (служебный хвост промпта) — не кликается. */
.prompt-line-plain,
.prompt-line-plain:hover {
  color: #a8a2b8;
  background: transparent;
  cursor: default;
}

.prompt-line-number {
  color: #686273;
  text-align: right;
  user-select: none;
}

.prompt-line .icon {
  width: 13px;
  height: 13px;
  margin-top: 2px;
  color: #7568df;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity .15s, transform .15s;
}

.prompt-line:hover .icon,
.prompt-line:focus-visible .icon {
  opacity: 1;
  transform: translateX(0);
}

.flow-node.prompt-focus,
.branch-label.prompt-focus,
.structure-item.prompt-focus {
  animation: prompt-focus-pulse 1.5s ease;
}

@keyframes prompt-focus-pulse {
  0%, 100% { box-shadow: inherit; }
  35% { box-shadow: 0 0 0 5px rgba(108, 92, 231, .2), 0 12px 30px rgba(73, 58, 168, .2); }
}

@media (max-width: 1320px) {
  .primary-sidebar {
    width: 205px;
    min-width: 205px;
  }

  .studio-layout {
    grid-template-columns: 288px minmax(460px, 1fr);
  }

  .canvas-help {
    left: calc(205px + 232px + 18px);
  }

  .zoom-controls,
  .minimap {
    right: 310px;
  }
}

@media (max-width: 1120px) {
  .primary-sidebar {
    width: 72px;
    min-width: 72px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .brand {
    margin-right: auto;
    margin-left: auto;
  }

  .brand-name,
  .workspace-copy,
  .workspace-switcher > .icon,
  .main-nav a span:not(.icon):not(.avatar-stack),
  .main-nav a kbd,
  .nav-section-label,
  .avatar-stack,
  .upgrade-card,
  .profile-row > span:nth-child(2),
  .profile-row .icon-button {
    display: none;
  }

  .workspace-switcher {
    justify-content: center;
  }

  .main-nav a {
    padding: 0;
    justify-content: center;
  }

  .main-nav a.active {
    box-shadow: inset 0 -3px 0 #8c7cff;
  }

  .profile-row {
    justify-content: center;
  }

  .canvas-help {
    left: calc(72px + 232px + 18px);
  }
}

@media (max-width: 960px) {
  .studio-layout {
    grid-template-columns: 225px minmax(0, 1fr);
  }

  .canvas-help {
    left: calc(72px + 225px + 18px);
  }

  .zoom-controls,
  .minimap {
    right: 20px;
  }
}

@media (max-width: 720px) {
  .primary-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: 230px;
    padding: 20px 14px 14px;
    box-shadow: 20px 0 50px rgba(20, 16, 29, .25);
    transform: translateX(-103%);
    transition: transform .22s;
  }

  .primary-sidebar.open {
    transform: translateX(0);
  }

  .primary-sidebar.open .brand-name,
  .primary-sidebar.open .workspace-copy,
  .primary-sidebar.open .workspace-switcher > .icon,
  .primary-sidebar.open .main-nav a span:not(.icon):not(.avatar-stack),
  .primary-sidebar.open .main-nav a kbd,
  .primary-sidebar.open .nav-section-label,
  .primary-sidebar.open .avatar-stack,
  .primary-sidebar.open .upgrade-card,
  .primary-sidebar.open .profile-row > span:nth-child(2),
  .primary-sidebar.open .profile-row .icon-button {
    display: initial;
  }

  .primary-sidebar.open .brand {
    margin: 0 8px 22px;
  }

  .primary-sidebar.open .workspace-switcher {
    justify-content: flex-start;
  }

  .primary-sidebar.open .main-nav a {
    padding: 0 10px;
    justify-content: flex-start;
  }

  .primary-sidebar.open .main-nav a.active {
    box-shadow: inset 3px 0 0 #8c7cff;
  }

  .primary-sidebar.open .profile-row {
    justify-content: flex-start;
  }

  .mobile-menu {
    display: grid;
  }

  .studio-layout {
    grid-template-columns: 1fr;
  }

  .builder-sidebar {
    display: none;
  }

  .topbar {
    padding-left: 10px;
  }

  .draft-pill,
  .hide-mobile,
  .topbar-actions .secondary:first-of-type,
  .save-state,
  .canvas-help {
    display: none;
  }

  .topbar-actions .button span:not(.icon) {
    display: none;
  }

  .topbar-actions .button {
    width: 35px;
    padding: 0;
  }

  .breadcrumbs b {
    max-width: 130px;
  }

  .canvas-toolbar {
    padding: 0 8px;
  }

  .flow-stage {
    padding-right: 38px;
    padding-left: 38px;
  }

  .conversation-board {
    width: calc(100vw - 76px);
    min-width: 480px;
  }
}

@media (max-width: 430px) {
  .breadcrumbs span:first-child,
  .breadcrumbs .icon {
    display: none;
  }

  .topbar-actions .action-divider {
    display: none;
  }

  .inspector {
    width: 100%;
  }

  .view-switcher button {
    padding: 0 7px;
  }

  .zoom-controls {
    right: 12px;
    bottom: 12px;
  }

  .dialog-card {
    padding: 24px 20px;
  }
}

/* ---------- База знаний в структуре и высокие текстовые поля ---------- */

.item-icon.mint {
  color: #159d73;
  background: var(--mint-soft);
}

/* Факты компании — это 1500+ символов: обычная textarea на 3 строки не читается */
textarea.text-field.tall {
  min-height: 260px;
}

/* Заблокированная кнопка должна читаться как заблокированная (публикация с problems) */
.button:disabled {
  box-shadow: none;
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

.button:disabled:hover {
  background: #fff;
  border-color: var(--line-strong);
}

.button.primary:disabled:hover {
  background: var(--purple);
  border-color: var(--purple);
}

/* ---------- Связь с боевым роботом: чип в шапке ---------- */

.engine-chip {
  display: inline-flex;
  max-width: 250px;
  min-height: 35px;
  padding: 0 12px 0 10px;
  align-items: center;
  gap: 9px;
  background: #f8f7fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, border-color .15s;
}

.engine-chip:hover {
  background: var(--purple-soft);
  border-color: #ddd7ff;
}

.engine-chip-dot {
  position: relative;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--mint);
  border-radius: 50%;
}

.engine-chip-dot::after {
  position: absolute;
  inset: -4px;
  border: 1px solid var(--mint);
  border-radius: 50%;
  content: "";
  opacity: .4;
}

.engine-chip.pending .engine-chip-dot {
  background: var(--amber);
}

.engine-chip.pending .engine-chip-dot::after {
  border-color: var(--amber);
}

.engine-chip-copy {
  min-width: 0;
}

.engine-chip-copy b,
.engine-chip-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.engine-chip-copy b {
  font-size: 11px;
  font-weight: 640;
}

.engine-chip-copy small {
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 10px;
}

.engine-chip.pending .engine-chip-copy small {
  color: #b8801c;
}

/* ---------- Связь с боевым роботом: диалог публикации ---------- */

.app-dialog.engine-dialog {
  max-width: 620px;
}

.engine-dialog .dialog-card {
  max-height: calc(100vh - 56px);
  overflow: auto;
}

.engine-alert {
  display: flex;
  margin-bottom: 9px;
  padding: 10px 11px;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid;
  border-radius: 10px;
}

.engine-alert b {
  display: block;
  font-size: 11px;
  font-weight: 650;
}

.engine-alert small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.5;
}

.engine-alert ul {
  margin: 5px 0 0;
  padding-left: 16px;
  font-size: 10px;
  line-height: 1.55;
}

.engine-alert > .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.engine-alert.live {
  color: #514a60;
  background: var(--purple-soft);
  border-color: #ddd7ff;
}

.engine-alert.live > .icon {
  color: var(--purple);
}

.engine-alert.warn {
  color: #7b5613;
  background: var(--amber-soft);
  border-color: #f4e2bd;
}

.engine-alert.warn > .icon {
  color: #ce881c;
}

.engine-alert.stop {
  color: #8c3d35;
  background: var(--coral-soft);
  border-color: #f9d5d1;
}

.engine-alert.stop > .icon {
  color: var(--coral);
}

.engine-tabs {
  display: flex;
  margin: 15px 0 11px;
  padding: 3px;
  gap: 3px;
  background: #f4f3f7;
  border-radius: 10px;
}

.engine-tabs button {
  min-height: 30px;
  flex: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 620;
  transition: background .15s, color .15s;
}

.engine-tabs button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.engine-pane-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.engine-meta-item {
  min-width: 0;
  padding: 9px 11px;
  flex: 1 1 200px;
  background: #f8f7fa;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.engine-meta-item b {
  display: block;
  font-size: 10px;
  font-weight: 650;
}

.engine-meta-item small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.engine-meta-item.changed {
  color: #17805e;
  background: var(--mint-soft);
  border-color: #cdeee2;
}

.engine-meta-item.changed small {
  color: #4c9a80;
}

.engine-text {
  max-height: 250px;
  margin: 10px 0 0;
  padding: 12px 10px;
  overflow: auto;
  color: #4c4756;
  background: #fbfafd;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.engine-line {
  display: block;
  padding: 0 5px;
  border-radius: 4px;
}

.engine-line.added {
  background: #eafaf3;
  box-shadow: inset 2px 0 0 var(--mint);
}

.engine-legend {
  display: flex;
  margin: 8px 2px 0;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-size: 10px;
}

.engine-legend i {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  background: #eafaf3;
  border-left: 2px solid var(--mint);
  border-radius: 3px;
}

.engine-empty {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 720px) {
  .engine-chip {
    display: none;
  }

  .engine-text {
    max-height: 200px;
  }
}

/* ---------- вкладка «Промпт» на узких экранах ---------- */

@media (max-width: 960px) {
  .prompt-panel-scroll {
    padding: 16px 14px 40px;
  }

  .prompt-panel-head {
    flex-direction: column;
    gap: 12px;
  }

  .prompt-mode-switch {
    align-self: flex-start;
  }

  .prompt-editor,
  .prompt-panel .prompt-document {
    height: clamp(220px, 38vh, 420px);
  }
}

@media (max-width: 560px) {
  .view-switcher button {
    padding: 0 7px;
    gap: 4px;
  }

  .prompt-editor-actions .prompt-primary,
  .prompt-editor-actions .prompt-ghost {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* вопросы-ответы в инспекторе базы знаний */
.inspector-faq { display: flex; margin-bottom: 8px; flex-direction: column; gap: 5px; }
.inspector-faq-row { display: flex; padding: 7px 9px; align-items: center; gap: 8px; background: #faf9fc; border: 1px solid var(--line); border-radius: 8px; }
.inspector-faq-row span { min-width: 0; flex: 1; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.inspector-faq-row button { display: grid; width: 22px; height: 22px; padding: 0; place-items: center; color: var(--coral, #e5484d); background: transparent; border: 0; cursor: pointer; }
.inspector-faq-row button .icon { width: 12px; height: 12px; }
.inspector-faq-empty { margin: 0 0 8px; color: var(--muted, #6d667a); font-size: 12px; }
.inspector-faq-add { display: grid; padding: 8px; gap: 6px; background: #faf9fc; border: 1px dashed var(--line); border-radius: 8px; }
.inspector-faq-add input, .inspector-faq-add textarea { width: 100%; padding: 7px 9px; background: #fff; border: 1px solid var(--line); border-radius: 7px; box-sizing: border-box; font-family: inherit; font-size: 12px; }
.inspector-faq-add button { display: flex; justify-self: start; min-height: 28px; padding: 0 11px; align-items: center; gap: 5px; color: #fff; background: var(--purple, #6d5ef0); border: 0; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 650; }
.inspector-faq-add button .icon { width: 11px; height: 11px; }

/* карта — визуализация промпта: read-only инспектор */
.inspector-readonly-note { display: flex; margin-bottom: 10px; padding: 7px 9px; align-items: center; gap: 7px; flex-wrap: wrap; color: #665d77; background: var(--purple-soft, #efecfd); border-radius: 8px; font-size: 11px; line-height: 1.4; }
.inspector-readonly-note .icon { width: 12px; height: 12px; color: var(--purple, #6d5ef0); flex: none; }
.inspector-readonly-note > span:not(.icon) { flex: 1; min-width: 140px; }
.inspector-readonly-note button { padding: 4px 9px; color: var(--purple, #6d5ef0); background: #fff; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 650; white-space: nowrap; }
.inspector-content.readonly [data-bind]:disabled,
.inspector-content.readonly select:disabled,
.inspector-content.readonly textarea:disabled,
.inspector-content.readonly input:disabled { color: #6d667a; background: #f3f1f6; cursor: default; opacity: 1; }
.inspector-content.readonly .danger-button,
.inspector-content.readonly [data-delete-step],
.inspector-content.readonly [data-delete-branch],
.inspector-content.readonly [data-add-inspector-step],
.inspector-content.readonly #inspectorAddBranch,
.inspector-content.readonly [data-insert-token],
.inspector-content.readonly .type-selector { display: none; }
