:root {
  --text: #050038;
  --text-2: #595e75;
  --text-3: #8f92a4;
  --primary: #4262ff;
  --primary-hover: #314cd9;
  --primary-press: #2a3fb8;
  --primary-soft: #e6eaff;
  --primary-soft-2: #f0f2ff;
  --danger: #e22d2d;
  --line: #e0e2e8;
  --line-2: #c7cad5;
  --hover: #f1f2f5;
  --panel: #ffffff;
  --canvas: #f2f2f2;
  --yellow: #ffd02f;
  --shadow-panel: 0 0 0 1px rgba(5, 0, 56, 0.05), 0 2px 4px rgba(5, 0, 56, 0.06), 0 6px 18px rgba(5, 0, 56, 0.08);
  --shadow-pop: 0 0 0 1px rgba(5, 0, 56, 0.06), 0 8px 32px rgba(5, 0, 56, 0.16);
  --radius: 8px;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-board: 'Open Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background: #fff;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 18px; height: 18px; }
svg.i.xs { width: 16px; height: 16px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px;
  border: 0; background: var(--hover); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .12s, box-shadow .12s, color .12s;
}
.btn:hover { background: #e7e8ee; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:active { background: var(--primary-press); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.outline { background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.outline:hover { box-shadow: inset 0 0 0 1px var(--text-3); background: #fff; }
.btn.danger { background: #fff0f0; color: var(--danger); }
.btn.danger:hover { background: #ffe1e1; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 6px; border: 0;
  background: transparent; color: var(--text); padding: 0;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn.active { background: var(--primary-soft); color: var(--primary); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }

/* ---------- поля ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input {
  height: 40px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: #fff; outline: none;
  transition: border-color .12s, box-shadow .12s; width: 100%;
}
.input:hover { border-color: var(--text-3); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(66, 98, 255, .18); }
textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; line-height: 1.45; }

.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 20px; transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ---------- логотип ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; color: var(--text); }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--yellow);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.logo-mark svg { width: 20px; height: 20px; }

/* ---------- модалки ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 0, 56, .32); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .15s ease;
}
.modal {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-pop);
  width: 100%; max-width: 480px; max-height: calc(100vh - 48px); overflow: auto;
  padding: 24px; animation: pop .16s ease;
}
.modal h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.01em; }
.modal .sub { color: var(--text-2); margin: 0 0 20px; line-height: 1.45; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head .icon-btn { margin: -8px -8px 0 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ---------- выпадающее меню ---------- */
.menu {
  position: fixed; z-index: 1100; min-width: 200px; background: #fff;
  border-radius: 8px; box-shadow: var(--shadow-pop); padding: 6px;
  animation: pop .12s ease;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 0 10px; height: 36px; border: 0; background: transparent;
  border-radius: 6px; text-align: left; font-size: 14px;
}
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .hint { margin-left: auto; color: var(--text-3); font-size: 12px; }

/* ---------- тосты ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #1d1d3a; color: #fff; padding: 10px 16px; border-radius: 8px;
  box-shadow: var(--shadow-pop); font-size: 14px; animation: pop .15s ease;
  max-width: 480px;
}
.toast.error { background: #c62828; }

.muted { color: var(--text-2); }
.code-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em;
  background: var(--hover); padding: 2px 8px; border-radius: 6px; font-size: 13px; font-weight: 600;
}
.empty { text-align: center; color: var(--text-2); padding: 48px 16px; }
