:root {
  color-scheme: dark;
  --bg: #07090c;
  --surface-0: #0a0d11;
  --surface: #0e1218;
  --surface-2: #121820;
  --surface-3: #171e28;
  --line: #1b2430;
  --line-2: #243040;
  --line-3: #2e3d52;
  --text: #eef2f6;
  --muted: #8d98a6;
  --accent: #5b9bd5;
  --accent-rgb: 91, 155, 213;
  --accent-soft: #b8d6f2;
  --accent-text: #8fc0ee;
  --accent-hover: #78b0e3;
  --accent-deep: #2c4f73;
  --on-accent: #07121c;
  --ok: #5fae7e;
  --warn: #e0a84a;
  --danger: #e2606d;
  --font-display: 'Unbounded', 'Segoe UI', sans-serif;
  --font-body: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(var(--accent-rgb), 0.38); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 44px; padding: 0 22px; border: 0; border-radius: 11px;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 14px; letter-spacing: 0.01em;
  cursor: pointer; transition: background 160ms ease, transform 120ms ease, box-shadow 200ms ease, opacity 160ms ease;
}
.btn:hover { background: var(--accent-hover); box-shadow: 0 10px 26px -10px rgba(var(--accent-rgb), 0.7); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn-ghost { background: transparent; border: 1px solid var(--line-3); color: var(--text); }
.btn-ghost:hover { background: rgba(var(--accent-rgb), 0.08); border-color: var(--accent); box-shadow: none; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: 9px; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 15px; border-radius: 13px; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(7, 18, 28, 0.35); border-top-color: var(--on-accent);
  border-radius: 50%; animation: spin 700ms linear infinite;
}
.btn-ghost.is-busy::after { border-color: rgba(255, 255, 255, 0.25); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 7px; align-content: start; }
.field > span { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.field > small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.input, .area, .select {
  width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 11px;
  background: var(--surface-0); color: var(--text); font-size: 14.5px; outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.area { padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 38px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238d98a6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; }
.select option { background: var(--surface-2); }
.input:focus, .area:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16); }
.input::placeholder, .area::placeholder { color: #5d6877; }
.count { justify-self: end; color: var(--muted); font-size: 12px; }
.count.over { color: var(--danger); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line-3); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.new { color: var(--accent-text); border-color: rgba(var(--accent-rgb), 0.45); background: rgba(var(--accent-rgb), 0.1); }
.chip.work { color: var(--warn); border-color: rgba(224, 168, 74, 0.45); background: rgba(224, 168, 74, 0.1); }
.chip.good { color: var(--ok); border-color: rgba(95, 174, 126, 0.45); background: rgba(95, 174, 126, 0.1); }
.chip.bad { color: var(--danger); border-color: rgba(226, 96, 109, 0.45); background: rgba(226, 96, 109, 0.1); }

.msg { min-height: 20px; font-size: 13.5px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 9000; display: grid; gap: 10px; }
.toast { padding: 12px 16px; max-width: 340px; border: 1px solid var(--line-3); border-radius: 12px; background: var(--surface-2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); font-size: 14px; animation: toastIn 260ms var(--ease) both; }
.toast.err { border-color: rgba(226, 96, 109, 0.5); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.vid-wait { position: fixed; inset: 0; z-index: 8000; display: grid; place-items: center; padding: 20px; background: rgba(5, 7, 10, 0.82); backdrop-filter: blur(10px); opacity: 0; transition: opacity 220ms ease; }
.vid-wait.show { opacity: 1; }
.vid-box { display: grid; justify-items: center; gap: 14px; width: min(100%, 400px); padding: 32px 28px; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); transform: translateY(8px) scale(0.98); transition: transform 260ms var(--ease); }
.vid-wait.show .vid-box { transform: none; }
.vid-logo { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.vid-logo img { width: 44px; height: 44px; border-radius: 12px; }
.vid-logo::before { content: ''; position: absolute; inset: 0; border: 2px solid rgba(var(--accent-rgb), 0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.vid-box h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.vid-box p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.vid-box .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

.user-chip { display: inline-flex; align-items: center; gap: 10px; min-height: 42px; padding: 4px 14px 4px 5px; border: 1px solid var(--line-3); border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 700; transition: border-color 160ms ease, background 160ms ease; }
.user-chip:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.08); }
.user-chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }

/* ===== Плавность и глубина (общие для всех страниц) ===== */
html { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-3); border: 3px solid transparent; border-radius: 99px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3d5069; background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
body { animation: pageIn 520ms var(--ease) both; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

/* блик по основной кнопке при наведении */
.btn { position: relative; overflow: hidden; }
.btn:not(.btn-ghost)::before { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%); transform: translateX(-120%); transition: transform 650ms var(--ease); pointer-events: none; }
.btn:not(.btn-ghost):hover::before { transform: translateX(120%); }

/* живые статусы: точка у «новая» и «на рассмотрении» мягко пульсирует */
.chip.new::before, .chip.work::before { animation: dotPulse 1.9s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.55; } }

/* подпись поля подсвечивается, пока в нём печатают */
.field > span { transition: color 160ms ease; }
.field:focus-within > span { color: var(--accent-text); }

.user-chip { transition: border-color 160ms ease, background 160ms ease, transform 180ms var(--ease); }
.user-chip:hover { translate: 0 -1px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

.vid-logo.still::before { animation: none; border-color: rgba(var(--accent-rgb), 0.35); }
.vid-box [hidden] { display: none !important; }
