/* ============================================================================
   MSQ BOOST — общая дизайн-система
   Серая «стеклянная» тема (graphite glass), мягкие скругления, аккуратные
   рамки, плавные анимации. Переменные общие для кабинета и панели управления.
   ========================================================================== */

:root {
  /* --- База: графитовый серый --- */
  --bg: #0c0d10;
  --bg-2: #0f1115;
  --bg-3: #131620;

  /* Поверхности (плотное «стекло» без дорогого blur) */
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.065);
  --glass-3: rgba(255, 255, 255, 0.09);
  --surface: rgba(23, 26, 32, 0.92);
  --surface-2: rgba(31, 35, 43, 0.94);
  --surface-3: rgba(44, 49, 60, 0.95);

  /* Рамки */
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.13);
  --border-3: rgba(255, 255, 255, 0.2);
  --stroke-hi: rgba(255, 255, 255, 0.28);

  /* Текст */
  --text: #f3f5f8;
  --text-2: #c2c9d4;
  --muted: #8b95a3;
  --dim: #5c6572;

  /* Акцент: холодный стальной синий на графите */
  --accent: #6ea2ff;
  --accent-2: #8fbcff;
  --accent-hi: #c9def9;
  --accent-rgb: 110, 162, 255;
  --accent-soft: rgba(110, 162, 255, 0.14);
  --accent-line: rgba(110, 162, 255, 0.4);

  /* Статусы */
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.14);
  --info: #7cb0ff;
  --info-soft: rgba(124, 176, 255, 0.14);

  /* Скругления — заметно круглее */
  --r-2xl: 26px;
  --r-xl: 22px;
  --r-lg: 18px;
  --r: 14px;
  --r-sm: 11px;
  --r-xs: 9px;

  /* Тени и подсветки */
  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh: 0 16px 40px rgba(0, 0, 0, 0.45);
  --sh-lg: 0 30px 80px rgba(0, 0, 0, 0.55);
  --sh-glow: 0 0 0 1px var(--accent-line), 0 18px 50px rgba(var(--accent-rgb), 0.18);
  --ring: 0 0 0 4px var(--accent-soft);
  --hairline: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --blur: 18px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 82% -8%, rgba(var(--accent-rgb), 0.12), transparent 62%),
    radial-gradient(900px 520px at 6% 2%, rgba(150, 120, 255, 0.07), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 46%);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* тонкая «звёздная пыль» поверх фона */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(110, 162, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 162, 255, 0.08) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: .8;
}

.container { width: min(1200px, calc(100vw - 34px)); margin: 0 auto; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-feature-settings: 'tnum'; }

/* --- Поверхность-«стекло» (без backdrop-filter ради плавности) --- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh), var(--hairline);
}

/* --- Кнопки --- */
.btn {
  --py: 11px;
  --px: 17px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: var(--py) var(--px);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--glass-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--hairline);
  transition: background .2s var(--ease), border-color .2s var(--ease),
              transform .12s var(--ease), box-shadow .2s var(--ease), opacity .2s;
}
.btn:hover { background: var(--glass-3); border-color: var(--border-3); }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-color: transparent;
  color: #07182f;
  box-shadow: 0 10px 26px rgba(var(--accent-rgb), 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn.primary:hover { filter: brightness(1.05); box-shadow: 0 12px 30px rgba(var(--accent-rgb), 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--glass); }
.btn.danger { color: #fecaca; background: var(--red-soft); border-color: rgba(248, 113, 113, 0.36); }
.btn.sm { --py: 8px; --px: 13px; min-height: 34px; font-size: 13px; border-radius: var(--r-xs); }
.btn.lg { --py: 15px; --px: 24px; min-height: 52px; font-size: 15px; border-radius: var(--r); }
.btn.wide { width: 100%; }

/* --- Поля --- */
label.field { display: block; margin-bottom: 15px; }
label.field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 650;
}
input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  outline: none;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
  background: rgba(0, 0, 0, 0.4);
}
input::placeholder, textarea::placeholder { color: var(--dim); }
textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%238b95a3' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
select option { background: #1a1e26; color: var(--text); }

/* --- Значки статусов --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .2px;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.badge.ok { color: #86efac; background: var(--green-soft); border-color: rgba(74, 222, 128, 0.3); }
.badge.warn { color: #fde68a; background: var(--amber-soft); border-color: rgba(251, 191, 36, 0.3); }
.badge.err { color: #fecaca; background: var(--red-soft); border-color: rgba(248, 113, 113, 0.3); }
.badge.info { color: #bfdbfe; background: var(--info-soft); border-color: rgba(124, 176, 255, 0.3); }
.badge.muted { color: var(--muted); background: var(--glass-2); border-color: var(--border); }
.badge.accent { color: var(--accent-hi); background: var(--accent-soft); border-color: var(--accent-line); }
.badge.live::before { animation: pulseDot 1.4s ease-in-out infinite; }
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }

/* --- Переключатель языка --- */
.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}
.lang-switch button {
  min-width: 40px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .4px;
  cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.lang-switch button.active { color: #07182f; background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.lang-switch button:not(.active):hover { color: var(--text); }

/* --- Тосты --- */
#toasts {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(390px, calc(100vw - 36px));
}
.toast {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  background: var(--surface-2);
  box-shadow: var(--sh);
  animation: toastIn .34s var(--ease) both;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast .ico { width: 9px; height: 9px; flex: 0 0 auto; margin-top: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.toast.ok .ico { background: var(--green); box-shadow: 0 0 10px var(--green); }
.toast.err .ico { background: var(--red); box-shadow: 0 0 10px var(--red); }
.toast .t-title { font-size: 13.5px; font-weight: 750; }
.toast .t-msg { margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.toast.out { animation: toastOut .24s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px) scale(.96); } }

/* --- Спиннер --- */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .22);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Прогресс-бар --- */
.progress {
  position: relative;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.5);
  transition: width .6s var(--ease);
  position: relative;
  overflow: hidden;
}
/* бегущий блик по заполнению */
.progress > i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.8s var(--ease) infinite;
}
.progress.done > i { background: linear-gradient(90deg, var(--green), #86efac); box-shadow: 0 0 14px rgba(74, 222, 128, 0.5); }
.progress.done > i::after { animation: none; }
.progress.err > i { background: linear-gradient(90deg, var(--red), #fca5a5); box-shadow: none; }
.progress.err > i::after { animation: none; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* --- Появление контента --- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.anim-in { animation: fadeInUp .5s var(--ease) both; }
.stagger > * { animation: fadeInUp .5s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .18s; }
.stagger > *:nth-child(5) { animation-delay: .24s; }
.stagger > *:nth-child(6) { animation-delay: .3s; }

/* --- Скроллбары / выделение --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
::selection { color: #061626; background: rgba(var(--accent-rgb), .8); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
