/* ==========================================================================
   GB CRM — визуальная система нового сайта GB Marketing (светлый bento)
   Onest (заголовки) · Golos Text (интерфейс) · IBM Plex Mono (цифры)
   Токены синхронизированы с gbmarketing.ru: #f7f7f5 / #fff / #111318 / #1d4ed8
   ========================================================================== */

@font-face {
  font-family: 'Onest';
  src: url('/fonts/onest-cyrillic.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  src: url('/fonts/onest-latin.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Golos';
  src: url('/fonts/golos-cyrillic.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos';
  src: url('/fonts/golos-latin.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face { font-family: 'Plex'; src: url('/fonts/plex-cyr-400.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Plex'; src: url('/fonts/plex-lat-400.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2191, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex'; src: url('/fonts/plex-cyr-500.woff2') format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Plex'; src: url('/fonts/plex-lat-500.woff2') format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2191, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex'; src: url('/fonts/plex-cyr-600.woff2') format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Plex'; src: url('/fonts/plex-lat-600.woff2') format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2191, U+2212, U+FEFF, U+FFFD; }

:root {
  --canvas: #f7f7f5;
  --surface: #ffffff;
  --surface-subtle: #efefec;
  --obsidian: #111318;
  --obsidian-soft: #1a1d24;
  --line: rgba(17, 19, 24, .10);
  --line-soft: rgba(17, 19, 24, .07);
  --line-strong: rgba(17, 19, 24, .16);
  --tp: #111318;
  --ts: #525866;
  --tm: #596070;
  --accent: #1d4ed8;
  --accent-h: #1e40af;
  --accent-dim: rgba(29, 78, 216, .10);
  --pos: #0f766e;
  --pos-soft: #e6f4f1;
  --gold: #b45309;
  --gold-dim: rgba(180, 83, 9, .10);
  --alert: #c2410c;
  --alert-dim: rgba(194, 65, 12, .10);
  --fd: 'Onest', 'Golos', system-ui, -apple-system, sans-serif;
  --fb: 'Golos', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fm: 'Plex', ui-monospace, 'SF Mono', Menlo, monospace;
  --e: cubic-bezier(.23, 1, .32, 1);
  --r-card: 20px;
  --r-card-sm: 16px;
  --r-btn: 12px;
  --shadow-card: 0 0 0 1px rgba(17, 19, 24, .075), 0 1px 2px rgba(17, 19, 24, .04), 0 8px 24px -8px rgba(17, 19, 24, .05);
  --shadow-lift: 0 0 0 1px rgba(17, 19, 24, .14), 0 4px 12px rgba(17, 19, 24, .06), 0 18px 36px -12px rgba(17, 19, 24, .09);
  --rail: 236px;
  --top-h: 92px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--canvas); }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--fb);
  font-size: 15px;
  line-height: 1.55;
  color: var(--tp);
  background: var(--canvas);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* --- типографика --- */
.eyebrow {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before { content: ''; width: 26px; height: 1px; background: currentColor; flex: none; }
.page-title, .modal__title, .login__card-title, .doc h1 {
  font-family: var(--fd); font-weight: 600; letter-spacing: -.02em; text-wrap: balance;
}
.page-title { font-size: clamp(28px, 2.2vw, 38px); line-height: 1.05; margin: 0; }
.mark {
  font-family: var(--fd); font-size: 26px; line-height: 1; letter-spacing: -.03em; font-weight: 700;
  color: var(--tp);
}
.mark__dot { color: var(--accent); }
.mono { font-family: var(--fm); font-variant-numeric: tabular-nums; }

/* --- кнопки --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  background: var(--surface); color: var(--tp);
  border: 0;
  border-radius: var(--r-btn);
  box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(17, 19, 24, .04);
  font-size: 14px; font-weight: 500; letter-spacing: -.01em;
  transition: box-shadow .16s var(--e), background-color .16s var(--e), color .16s var(--e), transform .14s var(--e);
}
.btn:hover { background: #f3f4f6; box-shadow: 0 0 0 1px rgba(17, 19, 24, .2), 0 3px 10px -2px rgba(17, 19, 24, .07); }
.btn:active { transform: scale(.97); }
.btn--primary {
  background: var(--obsidian); color: #fff;
  box-shadow: 0 1px 1px rgba(17, 19, 24, .12), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn--primary:hover { background: var(--accent); box-shadow: 0 6px 18px -4px rgba(17, 19, 24, .26), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn--ghost { background: transparent; box-shadow: none; color: var(--ts); }
.btn--ghost:hover { background: var(--surface-subtle); box-shadow: none; color: var(--tp); }
.btn--small { min-height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn--block { width: 100%; }
.btn--danger { color: var(--alert); box-shadow: 0 0 0 1px rgba(194, 65, 12, .3); background: var(--surface); }
.btn--danger:hover { background: var(--alert-dim); box-shadow: 0 0 0 1px var(--alert); }
.btn--icon { padding: 0 12px; gap: 6px; }
.btn:disabled { opacity: .55; cursor: progress; }

/* --- поля --- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--tm);
}
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-btn);
  padding: 10px 12px;
  color: var(--tp); font-size: 14px;
  transition: border-color .16s var(--e), box-shadow .16s var(--e);
}
.field textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.input:hover, .field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(17, 19, 24, .26); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
select.input, .field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 49%, var(--tm) 50%), linear-gradient(135deg, var(--tm) 50%, transparent 51%);
  background-position: calc(100% - 16px) 19px, calc(100% - 11px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
.form-error { color: var(--alert); font-size: 13px; min-height: 18px; }
.check {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 0 4px;
  font-size: 13px; color: var(--ts); cursor: pointer; user-select: none;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ============================ ВХОД ============================ */
.login {
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-columns: 1.05fr .95fr;
  background: var(--canvas);
}
.login__aside {
  position: relative;
  padding: clamp(28px, 5vw, 64px);
  display: flex; flex-direction: column; justify-content: center; gap: 22px;
  border-right: 1px solid var(--line-soft);
  background:
    radial-gradient(620px 380px at 15% 8%, rgba(29, 78, 216, .07), transparent 65%),
    linear-gradient(180deg, #ffffff, #f7f7f5);
  overflow: hidden;
}
.login__aside::after {
  content: ''; position: absolute; inset: auto -120px -140px auto;
  width: 420px; height: 420px; border: 1px solid rgba(29, 78, 216, .14);
  border-radius: 50%; pointer-events: none;
}
.login__brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.login__brand-sub { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--tm); }
.login__head {
  font-family: var(--fd); font-weight: 600; font-size: clamp(38px, 4.4vw, 64px); line-height: 1.02;
  margin: 0; letter-spacing: -.03em;
}
.login__head em { color: var(--accent); font-style: normal; }
.login__lead { max-width: 46ch; color: var(--ts); font-size: 15px; margin: 0; }
.login__stats { display: flex; gap: 28px; margin: 14px 0 0; flex-wrap: wrap; }
.login__stats div { display: flex; flex-direction: column; gap: 2px; }
.login__stats dt { font-family: var(--fm); font-size: 30px; color: var(--accent); line-height: 1; font-weight: 500; }
.login__stats dd { margin: 0; font-size: 12px; color: var(--tm); max-width: 18ch; }
.login__card {
  align-self: center; justify-self: center;
  width: min(420px, 100%);
  margin: 24px; padding: 32px;
  background: var(--surface);
  border-radius: var(--r-card);
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 0 0 1px rgba(17, 19, 24, .075), 0 2px 4px rgba(17, 19, 24, .04), 0 24px 48px -24px rgba(17, 19, 24, .12);
}
.login__card-title { font-size: 26px; margin: 0 0 4px; }
.login__hint { margin: 0; font-size: 11.5px; color: var(--tm); line-height: 1.5; }

/* ============================ КАРКАС ============================ */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 26px;
  padding: 20px 14px;
  border-right: 1px solid var(--line-soft);
  background: var(--surface);
}
.rail__brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.rail__name { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.rail__sub { font-family: var(--fm); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--tm); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex; align-items: center; gap: 11px;
  min-height: 42px; padding: 0 11px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--ts);
  font-size: 13.5px; font-weight: 500; text-align: left;
  transition: color .16s var(--e), background-color .16s var(--e);
}
.nav__item:hover { color: var(--tp); background: var(--surface-subtle); }
.nav__item.is-active { color: var(--tp); background: var(--surface-subtle); font-weight: 600; }
.nav__item.is-active svg { stroke: var(--accent); }
.rail__foot { margin-top: auto; }
.userchip {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 8px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--canvas);
  text-align: left; transition: border-color .16s var(--e), background-color .16s var(--e);
}
.userchip:hover { border-color: var(--line); background: var(--surface-subtle); }
.userchip__avatar {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center; border-radius: 9px;
  background: var(--accent-dim); color: var(--accent);
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
.userchip__text { display: flex; flex-direction: column; min-width: 0; }
.userchip__name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userchip__role { font-size: 11px; color: var(--tm); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto; gap: 14px 20px;
  padding: 18px 24px 12px;
  background: rgba(247, 247, 245, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.top__left { min-width: 0; }
.top__tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.search {
  display: flex; align-items: center; gap: 8px;
  min-width: 240px; padding: 0 12px; min-height: 44px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-btn);
  transition: border-color .16s var(--e), box-shadow .16s var(--e);
}
.search svg { stroke: var(--tm); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--tp);
  font-size: 13.5px; padding: 10px 0;
}
.search input::placeholder { color: var(--tm); }
.search input:focus { outline: none; }
.filters {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--line-soft);
}
.filters .input { width: auto; min-width: 150px; font-size: 13px; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 0; padding: 11px 24px;
  background: var(--gold-dim);
  border-bottom: 1px solid rgba(180, 83, 9, .22);
  font-size: 13px; color: #7c3d0a;
}
.banner__action {
  border: 1px solid rgba(180, 83, 9, .45); border-radius: 9px; background: var(--surface); color: #7c3d0a;
  padding: 7px 14px; font-size: 12.5px; font-weight: 600;
  transition: background-color .16s var(--e);
}
.banner__action:hover { background: rgba(180, 83, 9, .1); }

/* --- стадии (мобильные и десктопные подписи) --- */
.stagebar {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 12px 24px 0;
  scrollbar-width: none;
}
.stagebar::-webkit-scrollbar { display: none; }
.stagechip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; padding: 0 13px; flex: none;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ts); font-size: 12.5px; font-weight: 500; white-space: nowrap;
  transition: color .16s var(--e), border-color .16s var(--e), background-color .16s var(--e);
}
.stagechip:hover { color: var(--tp); border-color: var(--line-strong); }
.stagechip.is-active { color: #fff; background: var(--obsidian); border-color: var(--obsidian); }
.stagechip__n { font-family: var(--fm); font-size: 11px; opacity: .75; }
@media (min-width: 861px) { .stagebar { display: none; } }

/* ============================ КАНБАН ============================ */
.board {
  flex: 1;
  display: flex; gap: 14px;
  padding: 16px 24px 20px;
  overflow-x: auto; align-items: flex-start;
  scrollbar-color: var(--line) transparent;
  scroll-snap-type: x proximity;
}
.board::-webkit-scrollbar { height: 8px; }
.board::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.board::-webkit-scrollbar-track { background: transparent; }

.col {
  flex: 1 0 252px; max-width: 292px;
  display: flex; flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card-sm);
  background: var(--surface-subtle);
  scroll-snap-align: start;
  transition: border-color .16s var(--e), background-color .16s var(--e);
}
.col--drag { border-color: var(--accent); background: var(--accent-dim); }
.col__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 12px 13px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.col__name {
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--tp);
}
.col__name::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex: none; }
.col--lead .col__name::before { background: #9aa0aa; }
.col--touch .col__name::before { background: #7f8ea8; }
.col--dialog .col__name::before { background: #6b7fa3; }
.col--qualified .col__name::before { background: #b45309; }
.col--meeting .col__name::before { background: var(--accent); }
.col--offer .col__name::before { background: #0e7490; }
.col--contract .col__name::before { background: var(--pos); }
.col--project .col__name::before { background: #15803d; }
.col--lost .col__name::before { background: var(--alert); }
.col__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.col__count { font-family: var(--fm); font-size: 12px; color: var(--ts); }
.col__sum { font-family: var(--fm); font-size: 10.5px; color: var(--tm); letter-spacing: .02em; }
.col__body { display: flex; flex-direction: column; gap: 9px; padding: 10px; min-height: 84px; }
.col__empty {
  border: 1px dashed var(--line-strong); border-radius: 10px;
  padding: 18px 10px; text-align: center;
  font-size: 11.5px; color: var(--tm); letter-spacing: .04em;
}

.card {
  position: relative;
  padding: 12px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(17, 19, 24, .04);
  cursor: pointer;
  transition: box-shadow .16s var(--e), transform .16s var(--e), background-color .16s var(--e);
  animation: cardIn .22s var(--e) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card:hover {
  box-shadow: 0 0 0 1px rgba(17, 19, 24, .16), 0 4px 12px rgba(17, 19, 24, .07), 0 16px 32px -16px rgba(17, 19, 24, .12);
  transform: translateY(-1px);
}
.card--overdue { box-shadow: inset 3px 0 0 var(--alert), 0 0 0 1px var(--line), 0 1px 2px rgba(17, 19, 24, .04); }
.card--dragging { opacity: .4; }
.card__company {
  font-size: 14px; font-weight: 650; line-height: 1.35; letter-spacing: -.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__sum { font-family: var(--fm); font-size: 11.5px; color: var(--accent); white-space: nowrap; }
.card__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card__meta { margin-top: 4px; font-size: 11.5px; color: var(--tm); }
.card__contact { margin-top: 6px; font-size: 12px; color: var(--ts); }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.card__next { display: inline-flex; align-items: center; gap: 5px; font-family: var(--fm); font-size: 11px; color: var(--ts); }
.card__next--overdue { color: var(--alert); }
.card__next--none { color: var(--tm); }
.card__avatar {
  width: 22px; height: 22px; flex: 0 0 22px;
  display: grid; place-items: center; border-radius: 7px;
  border: 1px solid rgba(15, 118, 110, .28);
  background: var(--pos-soft); color: var(--pos);
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em;
}
.statusbar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 24px;
  background: rgba(247, 247, 245, .92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line-soft);
  font-family: var(--fm); font-size: 11px; color: var(--tm); letter-spacing: .02em;
}

/* --- мобильная навигация --- */
.tabbar { display: none; }
@media (max-width: 860px) {
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(3, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(18px);
    border-top: 1px solid var(--line-soft);
  }
  .tabbar__item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 48px; border: 0; background: transparent; color: var(--tm);
    font-size: 10.5px; font-weight: 600; letter-spacing: .03em;
  }
  .tabbar__item.is-active { color: var(--accent); }
  .tabbar__item svg { width: 20px; height: 20px; }
}

/* ============================ МОДАЛКИ ============================ */
.modal-root {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17, 19, 24, .45);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 24px;
  animation: fadeIn .18s var(--e) both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 780px; max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: 0 0 0 1px rgba(17, 19, 24, .08), 0 40px 80px -32px rgba(17, 19, 24, .35);
  animation: modalIn .24s var(--e) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.995); } to { opacity: 1; transform: none; } }
.modal--narrow { max-width: 480px; }
.modal__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.modal__title { font-size: 24px; margin: 0; line-height: 1.15; }
.modal__sub { margin-top: 3px; font-size: 11.5px; color: var(--tm); font-family: var(--fm); letter-spacing: .02em; }
.modal__x {
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ts);
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center; font-size: 18px; line-height: 1;
  transition: color .16s var(--e), border-color .16s var(--e), background-color .16s var(--e);
}
.modal__x:hover { color: var(--tp); border-color: var(--line-strong); background: var(--surface-subtle); }
.modal__body { padding: 18px 22px; overflow-y: auto; }
.modal__foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 22px 18px; border-top: 1px solid var(--line-soft);
  background: var(--surface);
  border-radius: 0 0 var(--r-card) var(--r-card);
}
.modal__foot-right { display: flex; gap: 10px; margin-left: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field--wide { grid-column: 1 / -1; }
.section-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--tm); margin: 20px 0 10px;
}
.section-label:first-child { margin-top: 0; }
.history { display: flex; flex-direction: column; gap: 9px; max-height: 220px; overflow-y: auto; padding-right: 6px; }
.history__item { padding-left: 10px; border-left: 1px solid var(--accent-dim); font-size: 12.5px; color: var(--ts); }
.history__meta { font-family: var(--fm); font-size: 10.5px; color: var(--tm); margin-bottom: 2px; letter-spacing: .02em; }
.comment-row { display: flex; gap: 8px; margin-top: 12px; }
.comment-row input { flex: 1; }
.temp-pass {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-dim); border: 1px solid rgba(29, 78, 216, .22);
  font-size: 13px; color: var(--tp);
}
.temp-pass code { font-family: var(--fm); font-size: 14.5px; font-weight: 600; letter-spacing: .06em; color: var(--accent); }
.user-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.user-row__name { font-size: 13.5px; font-weight: 650; }
.user-row__meta { margin-top: 2px; font-size: 11.5px; color: var(--tm); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--fm); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--ts);
}
.chip--gold { border-color: rgba(180, 83, 9, .35); color: var(--gold); background: var(--gold-dim); }
.chip--red { border-color: rgba(194, 65, 12, .3); color: var(--alert); background: var(--alert-dim); }
.muted { color: var(--tm); font-size: 12px; }
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 200; padding: 11px 18px; border-radius: 12px;
  background: var(--obsidian); color: #fff;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 24px 48px -20px rgba(17, 19, 24, .5);
  animation: toastIn .2s var(--e) both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast--error { background: var(--alert); }

/* ============================ МОБИЛЬНАЯ ВЕРСИЯ ============================ */
@media (max-width: 860px) {
  :root { --rail: 0px; }
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .rail { display: none; }

  .top {
    position: sticky; top: 0; z-index: 30;
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
    background: rgba(247, 247, 245, .94);
  }
  .top__left { flex: 1 1 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
  .top .eyebrow { font-size: 10px; margin-bottom: 3px; }
  .page-title { font-size: 30px; line-height: 1; }
  .top__tools { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .search { min-width: 0; min-height: 46px; }
  .search input { font-size: 16px; }
  .top__tools .btn--primary span { display: none; }
  .top__tools .btn--primary { min-width: 46px; min-height: 46px; padding: 0; }
  .btn--icon span { display: none; }
  .btn--icon { min-height: 46px; min-width: 46px; padding: 0; }
  .filters { flex: 1 1 100%; padding-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters .input { min-width: 0; width: 100%; }
  .filters .check { grid-column: 1 / -1; min-height: 38px; }

  .banner { padding: 10px 16px; font-size: 12.5px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .banner__action { width: 100%; min-height: 40px; }

  .stagebar { padding: 10px 16px 0; }
  .stagechip { min-height: 40px; }

  /* одна колонка на телефоне */
  .board { display: block; padding: 12px 16px 16px; overflow: visible; }
  .col { max-width: none; width: 100%; border: 0; background: none; }
  .col__head { padding: 0 0 10px; border-bottom: 1px solid var(--line-soft); }
  .col__body { padding: 10px 0 0; gap: 10px; }
  .col:not(.is-active) { display: none; }
  .card { padding: 14px; }
  .card__company { font-size: 15px; }
  .card__next { font-size: 11.5px; }
  .statusbar { position: static; padding: 10px 16px; border-top: 1px solid var(--line-soft); }

  /* модалки превращаются в нижние листы */
  .modal-root { padding: 0; align-items: flex-end; }
  .modal, .modal--narrow {
    max-width: none; max-height: 93vh;
    border-radius: var(--r-card) var(--r-card) 0 0;
    animation: sheetIn .26s var(--e) both;
  }
  @keyframes sheetIn { from { transform: translateY(24px); opacity: .9; } to { transform: none; opacity: 1; } }
  .modal__head { padding: 16px 16px 12px; position: relative; }
  .modal__head::before {
    content: ''; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 3px; background: var(--line-strong); border-radius: 2px;
  }
  .modal__title { font-size: 21px; }
  .modal__body { padding: 14px 16px; }
  .modal__foot {
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    position: sticky; bottom: 0;
  }
  .modal__foot-right { width: 100%; }
  .modal__foot-right .btn { flex: 1; min-height: 46px; }
  .modal__foot > .btn--danger { order: 3; width: 100%; }
  .grid2 { grid-template-columns: 1fr; gap: 12px; }
  .field input, .field select, .field textarea { font-size: 16px; min-height: 46px; }
  .history { max-height: 180px; }
  .user-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .user-row .btn { min-height: 38px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; }
}

/* --- планшет --- */
@media (min-width: 861px) and (max-width: 1180px) {
  .col { flex: 1 0 236px; }
  .top { grid-template-columns: 1fr; }
  .top__tools { justify-content: flex-start; }
}

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

/* ============================ МАТЕРИАЛЫ (/guide) ============================ */
.doc-wrap { min-height: 100vh; display: flex; flex-direction: column; background: var(--canvas); }
.doc-head {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  background: rgba(247, 247, 245, .94); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.doc-head__back { display: inline-flex; align-items: center; gap: 8px; color: var(--ts); font-size: 13px; font-weight: 600; }
.doc-head__back:hover { color: var(--tp); }
.doc-main { width: min(920px, 100%); margin: 0 auto; padding: 32px 24px 96px; }
.doc h1 { font-size: clamp(32px, 3.4vw, 46px); margin: 0 0 10px; line-height: 1.05; }
.doc__lead { color: var(--ts); font-size: 15px; max-width: 62ch; margin: 0 0 28px; }
.doc-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 34px; }
.doc-toc a {
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ts);
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.doc-toc a:hover { color: var(--accent); border-color: rgba(29, 78, 216, .4); }
.doc section { padding: 26px 0; border-top: 1px solid var(--line-soft); }
.doc h2 { font-family: var(--fd); font-weight: 600; font-size: clamp(24px, 2.4vw, 32px); margin: 0 0 6px; letter-spacing: -.02em; }
.doc h3 { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 22px 0 8px; }
.doc p { color: var(--ts); margin: 0 0 12px; }
.doc strong { color: var(--tp); font-weight: 650; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 20px; color: var(--ts); }
.doc li { margin-bottom: 6px; }
.doc li::marker { color: var(--accent); font-family: var(--fm); }
.doc blockquote {
  margin: 0 0 14px; padding: 12px 16px; border-radius: 0 12px 12px 0;
  border-left: 2px solid var(--accent); background: var(--accent-dim);
  color: var(--tp); font-size: 14px;
}
.quote-card {
  position: relative; margin: 0 0 16px; padding: 14px 16px 14px 18px;
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(17, 19, 24, .04);
}
.quote-card__label { font-family: var(--fm); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--tm); margin-bottom: 6px; }
.quote-card p { margin: 0; color: var(--tp); font-size: 14px; line-height: 1.6; }
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  min-height: 32px; padding: 0 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ts);
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
}
.copy-btn:hover { color: var(--accent); border-color: rgba(29, 78, 216, .4); background: var(--accent-dim); }
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 13px; }
.doc th, .doc td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.doc th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--tm); }
.doc td { color: var(--ts); }
.doc td strong { color: var(--tp); }
.doc details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 10px; }
.doc summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 15px; cursor: pointer; font-size: 14px; font-weight: 650; color: var(--tp);
  list-style: none;
}
.doc summary::-webkit-details-marker { display: none; }
.doc summary::after { content: '+'; font-family: var(--fm); color: var(--accent); font-size: 16px; }
.doc details[open] summary::after { content: '−'; }
.doc details > div { padding: 0 15px 14px; }
.doc__foot { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--tm); }
@media (max-width: 640px) {
  .doc-main { padding: 24px 16px 80px; }
  .doc-head { padding: 12px 16px; }
  .doc table { display: block; overflow-x: auto; white-space: nowrap; }
  .quote-card { padding: 12px 14px; }
  .copy-btn { position: static; margin-top: 8px; }
}
/* --- утилиты (CSP запрещает inline-style) --- */
.mt-12 { margin-top: 12px; }
.row-end { display: flex; justify-content: flex-end; margin-top: 12px; }
.link-inline { color: var(--accent); font-size: 12px; }
.doc-head__tag { font-family: var(--fm); font-size: 11px; color: var(--tm); letter-spacing: .14em; }
.mb-26 { margin-bottom: 26px; }
.mb-10 { margin-bottom: 10px; }
.btn--inline { display: inline-flex; }
