/* =====================================================================
   ПЕРВАЯ МКП — базовая дизайн-система
   Палитра Сбера + инженерный визуальный язык
   ===================================================================== */

:root {
  /* — Бренд (Сбер) — */
  --sber-green: #21A038;
  --sber-black: #1A1A18;
  --sber-lime: #C6E832;
  --grey-800: #2E2E2D;
  --grey-500: #75787A;
  --grey-100: #F5F5F4;
  --white: #FFFFFF;

  /* — Расширенные оттенки — */
  --green-050: #F0FAF3;
  --green-100: #E3F5E8;
  --green-200: #BDE8C8;
  --green-400: #35B84C;
  --green-500: #21A038;
  --green-600: #1B8A30;
  --green-700: #167A2C;
  --green-900: #0E3D18;

  --lime-050: #FAFCE8;
  --lime-100: #F4F9DC;
  --lime-500: #C6E832;
  --lime-700: #6B7A12;

  --red-050: #FEF2F2;
  --red-100: #FDE8E8;
  --red-500: #E5484D;
  --red-700: #B42323;

  --amber-100: #FDF1D8;
  --amber-500: #E8A317;
  --amber-700: #8A5B05;

  --black-900: #0F0F0E;
  --black-800: #151513;
  --black-700: #1A1A18;
  --black-600: #202020;
  --black-500: #2E2E2D;
  --black-400: #3A3A38;
  --grey-700: #4A4B4A;
  --grey-600: #5F6163;
  --grey-400: #9A9C9E;
  --grey-300: #B9BBBC;
  --grey-200: #D9D9D6;
  --grey-150: #E6E6E3;
  --grey-050: #FAFAF9;

  /* — Типографика — */
  --font-display: 'Unbounded', 'Onest', 'Inter', system-ui, sans-serif;
  --font-body: 'Onest', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  /* — Геометрия — */
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  --container: 1440px;
  --gutter: clamp(20px, 4vw, 64px);

  --header-h: 80px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'cv05', 'tnum' 0;
}
h1, h2, h3, h4, h5, h6, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--sber-lime); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--sber-green); color: #fff; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Типографические утилиты ---------- */
.mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 500;
}
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Логотип ---------- */
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--logo-fg, #fff);
  white-space: nowrap;
  user-select: none;
}
.logo-word {
  display: flex; flex-direction: column; line-height: 1;
  font-family: var(--font-display);
}
.logo-word > span:first-child { font-size: 9.5px; font-weight: 500; letter-spacing: .22em; opacity: .85; margin-bottom: 4px; }
.logo-word > span:last-child { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.logo-mark { width: 31px; height: 36px; flex: none; overflow: visible; fill: currentColor; transition: transform .6s var(--ease-out); }
.logo:hover .logo-mark { transform: translateX(3px); }
.logo--lg .logo-word > span:first-child { font-size: 13px; }
.logo--lg .logo-word > span:last-child { font-size: 30px; }
.logo--lg .logo-mark { width: 49px; height: 56px; }

/* ---------- Кнопки ---------- */
.btn {
  --btn-h: 52px;
  --btn-px: 24px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--btn-h); padding: 0 var(--btn-px);
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 600; font-size: 15px; letter-spacing: -.005em;
  white-space: nowrap; cursor: pointer; border: 1px solid transparent;
  transition: transform .35s var(--ease-out), background .25s, border-color .25s, color .25s, box-shadow .25s;
  overflow: hidden; isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
.btn > * { position: relative; z-index: 1; }
.btn .btn-ico { width: 18px; height: 18px; flex: none; transition: transform .35s var(--ease-out); }
.btn:hover .btn-ico { transform: translateX(3px); }
.btn:active { transform: scale(.98); }
.btn--md { --btn-h: 44px; --btn-px: 20px; font-size: 14px; }
.btn--sm { --btn-h: 36px; --btn-px: 14px; font-size: 13px; gap: 8px; }
.btn--sm .btn-ico { width: 15px; height: 15px; }
.btn--xs { --btn-h: 30px; --btn-px: 10px; font-size: 12px; gap: 6px; border-radius: var(--radius-xs); }
.btn--xs .btn-ico { width: 13px; height: 13px; }
.btn--block { width: 100%; }
.btn--icon { --btn-px: 0; width: var(--btn-h); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

.btn-primary { background: var(--sber-green); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.08) inset; }
.btn-primary::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.18) 50%, transparent 80%);
  transform: translateX(-120%); transition: transform .7s var(--ease-out);
}
.btn-primary:hover { background: var(--green-400); box-shadow: 0 8px 28px -8px rgba(33,160,56,.6); }
.btn-primary:hover::before { transform: translateX(120%); }

.btn-lime { background: var(--sber-lime); color: var(--sber-black); }
.btn-lime:hover { background: #D6F252; box-shadow: 0 8px 28px -8px rgba(198,232,50,.55); }

.btn-ghost { background: transparent; color: var(--btn-ghost-fg, #fff); border-color: var(--btn-ghost-border, rgba(255,255,255,.18)); }
.btn-ghost:hover { border-color: var(--btn-ghost-border-hover, rgba(255,255,255,.6)); background: var(--btn-ghost-bg-hover, rgba(255,255,255,.04)); }

.btn-white { background: #fff; color: var(--sber-black); }
.btn-white:hover { background: var(--grey-100); }

.btn-secondary { background: var(--btn-sec-bg, #fff); color: var(--btn-sec-fg, var(--sber-black)); border-color: var(--btn-sec-border, var(--grey-150)); }
.btn-secondary:hover { border-color: var(--grey-300); background: var(--btn-sec-bg-hover, var(--grey-050)); }

.btn-danger { background: var(--red-500); color: #fff; }
.btn-danger:hover { background: #d43a3f; }

.btn-text { background: transparent; color: var(--sber-green); padding: 0; height: auto; gap: 6px; }
.btn-text:hover { color: var(--green-600); }

.btn-chev { display: inline-flex; gap: 2px; }
.btn-chev i { width: 6px; height: 6px; border-right: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); opacity: .35; transition: opacity .25s, transform .35s var(--ease-out); }
.btn-chev i:nth-child(2) { transition-delay: .05s; }
.btn-chev i:nth-child(3) { transition-delay: .1s; }
.btn:hover .btn-chev i { opacity: 1; transform: rotate(45deg) translate(1px,-1px); }

/* ---------- Иконки ---------- */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico--sm { width: 16px; height: 16px; }
.ico--xs { width: 14px; height: 14px; }

/* ---------- Кастомный курсор ---------- */
.cursor, .cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 99999;
  border-radius: 50%; will-change: transform;
}
.cursor { width: 6px; height: 6px; background: var(--sber-lime); margin: -3px 0 0 -3px; }
.cursor-ring {
  width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 1px solid rgba(198,232,50,.7);
  transition: width .35s var(--ease-out), height .35s var(--ease-out), margin .35s var(--ease-out), background .3s, border-color .3s, opacity .3s;
  display: flex; align-items: center; justify-content: center;
}
.cursor-ring span {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600;
  color: var(--sber-black); opacity: 0; transform: scale(.6); transition: opacity .25s, transform .35s var(--ease-out);
}
.cursor-ring.is-link { width: 56px; height: 56px; margin: -28px 0 0 -28px; border-color: rgba(198,232,50,.9); background: rgba(198,232,50,.06); }
.cursor-ring.is-label { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: var(--sber-lime); border-color: var(--sber-lime); }
.cursor-ring.is-label span { opacity: 1; transform: scale(1); }
.cursor-ring.is-hidden, .cursor.is-hidden { opacity: 0; }
body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }
@media (hover: none), (pointer: coarse) { .cursor, .cursor-ring { display: none !important; } }

/* ---------- Плёнка/зерно ---------- */
.grain {
  position: fixed; inset: -50%; width: 200%; height: 200%; pointer-events: none; z-index: 9990; opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0,0); } 10% { transform: translate(-5%,-10%); } 20% { transform: translate(-15%,5%); }
  30% { transform: translate(7%,-25%); } 40% { transform: translate(-5%,25%); } 50% { transform: translate(-15%,10%); }
  60% { transform: translate(15%,0); } 70% { transform: translate(0,15%); } 80% { transform: translate(3%,35%); } 90% { transform: translate(-10%,10%); }
}

/* ---------- Бейджи статусов (общие для лендинга и ЛК) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  height: 24px; padding: 0 10px 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  background: var(--badge-bg, var(--grey-100)); color: var(--badge-fg, var(--grey-600));
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--badge-dot, currentColor); flex: none; }
.badge--approved, .badge--done, .badge--active { --badge-bg: var(--green-100); --badge-fg: var(--green-700); --badge-dot: var(--sber-green); }
.badge--review, .badge--progress { --badge-bg: var(--lime-100); --badge-fg: var(--lime-700); --badge-dot: var(--sber-lime); }
.badge--draft, .badge--paused { --badge-bg: var(--grey-100); --badge-fg: var(--grey-600); --badge-dot: var(--grey-400); }
.badge--rejected, .badge--overdue { --badge-bg: var(--red-100); --badge-fg: var(--red-700); --badge-dot: var(--red-500); }
.badge--planned { --badge-bg: var(--amber-100); --badge-fg: var(--amber-700); --badge-dot: var(--amber-500); }
.badge--live::before { box-shadow: 0 0 0 0 var(--badge-dot); animation: livePulse 1.8s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--badge-dot) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
.badge--sm { height: 20px; font-size: 11px; padding: 0 8px 0 7px; }
.badge--dark { --badge-bg: rgba(255,255,255,.08); --badge-fg: #fff; }
.badge--dark.badge--approved { --badge-bg: rgba(33,160,56,.18); --badge-fg: #8CE29B; }
.badge--dark.badge--review, .badge--dark.badge--progress { --badge-bg: rgba(198,232,50,.14); --badge-fg: var(--sber-lime); }
.badge--dark.badge--draft { --badge-bg: rgba(255,255,255,.08); --badge-fg: var(--grey-300); }

/* ---------- Тосты ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 5000; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 12px; background: var(--black-600); border: 1px solid rgba(255,255,255,.12); color: #fff; box-shadow: 0 20px 50px -20px rgba(0,0,0,.7); opacity: 0; transform: translateY(12px) scale(.97); transition: opacity .4s var(--ease-out), transform .5s var(--ease-out); }
.toast.is-in { opacity: 1; transform: none; }
.toast.is-out { opacity: 0; transform: translateX(20px); }
.toast__ico { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; background: rgba(255,255,255,.08); }
.toast__ico .ico { width: 16px; height: 16px; }
.toast--success .toast__ico { background: rgba(33,160,56,.22); color: #8CE29B; }
.toast--error .toast__ico { background: rgba(229,72,77,.2); color: #FF8A8E; }
.toast--warning .toast__ico { background: rgba(198,232,50,.16); color: var(--sber-lime); }
.toast--info .toast__ico { background: rgba(255,255,255,.08); color: #fff; }
.toast__body { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; line-height: 1.4; flex: 1; }
.toast__body b { font-weight: 600; }
.toast__body span { color: var(--grey-300); }
.toast__close { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--grey-400); flex: none; }
.toast__close:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- Прочее ---------- */
.dot-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--sber-lime); box-shadow: 0 0 0 0 rgba(198,232,50,.7); animation: livePulse 1.8s infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .grain { animation: none; }
}
