/* ── АВАНТ CRM. Фирстиль тот же, что на сайте ───────────────────────── */
:root {
  --bg: #131212;
  --bg-2: #1b1919;
  --bg-3: #232020;
  --bg-4: #2c2828;
  --black: #0b0a0a;
  --ink: #fff;
  --ink-2: rgba(255,255,255,.88);
  --mute: rgba(255,255,255,.62);
  --mute-2: rgba(255,255,255,.40);
  --line: rgba(255,255,255,.12);
  --line-2: rgba(255,255,255,.07);
  --brand: #db4040;
  --brand-d: #c22f2f;
  --brand-l: rgba(219,64,64,.14);
  --brand-t: #ff8080;
  --accent: #ffe100;
  --ok: #3fbf6a;
  --r: 12px;
  --r-sm: 8px;
  --font: "Roboto", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box }
* { margin: 0 }
html { background: var(--bg); -webkit-text-size-adjust: 100% }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none }
img, svg { display: block; max-width: 100% }
button, input, select, textarea { font: inherit; color: inherit }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em }
h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em }
h3 { font-size: .95rem; font-weight: 500 }
::selection { background: var(--brand); color: #fff }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px }
::-webkit-scrollbar { width: 9px; height: 9px }
::-webkit-scrollbar-track { background: var(--bg-2) }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 9px }

/* ── шапка ──────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11,10,10,.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top__bar {
  display: flex; align-items: center; gap: 1rem;
  max-width: 1560px; margin-inline: auto; padding: .6rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: .55rem; flex: none }
.brand img { width: 34px; height: 34px }
.brand b { font-size: 1.05rem; font-weight: 700; letter-spacing: .04em }
.brand i { font-style: normal; font-size: .62rem; color: var(--mute-2); letter-spacing: .1em; text-transform: uppercase }

.menu { display: flex; align-items: center; gap: .15rem; margin-right: auto; flex-wrap: wrap }
.menu a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .8rem; border-radius: var(--r-sm); font-size: .9rem; color: var(--ink-2);
  transition: background-color .12s ease, color .12s ease;
}
.menu a:hover { background: var(--bg-3) }
.menu a.on { background: var(--brand); color: #fff }
.menu .pill {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: .7rem; font-weight: 700;
  display: inline-grid; place-items: center;
}
.menu a.on .pill { background: rgba(0,0,0,.35) }

.top__search { display: flex; align-items: center; gap: .4rem;
  background: var(--bg-3); border: 1px solid transparent; border-radius: 100px; padding: .35rem .8rem }
.top__search:focus-within { border-color: var(--brand); background: var(--bg-4) }
.top__search input { border: 0; background: none; outline: none; width: 190px; font-size: .86rem }
.top__search input::placeholder { color: var(--mute-2) }
.me { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--mute); flex: none }
.me b { color: var(--ink); font-weight: 500 }

/* ── каркас ─────────────────────────────────────────────────────────── */
.wrap { max-width: 1560px; margin-inline: auto; padding: 1.25rem }
.head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem }
.grid { display: grid; gap: .85rem }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%,320px), 1fr)) }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%,200px), 1fr)) }
.split { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 1rem; align-items: start }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap }
.stack { display: flex; flex-direction: column; gap: .8rem }
.muted { color: var(--mute) }
.small { font-size: .82rem }
.right { margin-left: auto }

/* ── карточки ───────────────────────────────────────────────────────── */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.15rem }
.card--pad0 { padding: 0; overflow: hidden }
.card h2 { margin-bottom: .75rem }
.card__t { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); margin-bottom: .6rem }

.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1.05rem }
.stat b { display: block; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em }
.stat span { font-size: .78rem; color: var(--mute) }
.stat i { font-style: normal; font-size: .78rem; color: var(--brand-t) }

/* ── кнопки ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: 100px; border: 1px solid transparent;
  font-size: .88rem; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.btn--p { background: var(--brand); color: #fff; font-weight: 500 }
.btn--p:hover { background: var(--brand-d) }
.btn--g { background: transparent; border-color: var(--line); color: var(--ink) }
.btn--g:hover { border-color: rgba(255,255,255,.4); background: var(--bg-3) }
.btn--s { padding: .3rem .7rem; font-size: .8rem }
.btn--w { width: 100% }
.btn--ok { background: var(--ok); color: #06210f }

/* ── формы ──────────────────────────────────────────────────────────── */
.f { display: flex; flex-direction: column; gap: .3rem }
.f > label { font-size: .76rem; color: var(--mute) }
.in, select.in, textarea.in {
  width: 100%; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg-3); color: var(--ink); outline: none;
  transition: border-color .12s ease, background-color .12s ease;
}
.in::placeholder { color: var(--mute-2) }
.in:focus { border-color: var(--brand); background: var(--bg-4) }
textarea.in { min-height: 76px; resize: vertical }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%,180px), 1fr)); gap: .6rem }
.fgrid--wide { grid-column: 1 / -1 }

/* ── таблицы ────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem }
.tbl th {
  text-align: left; padding: .6rem .9rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--mute);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-2);
}
.tbl td { padding: .65rem .9rem; border-bottom: 1px solid var(--line-2); vertical-align: top }
.tbl tr:last-child td { border-bottom: 0 }
.tbl tbody tr:hover { background: var(--bg-3) }
.tbl a { color: var(--ink) }
.tbl a:hover { color: var(--brand-t) }

/* ── бейджи этапов ──────────────────────────────────────────────────── */
.st {
  display: inline-block; padding: .18rem .55rem; border-radius: 5px;
  font-size: .7rem; font-weight: 500; white-space: nowrap;
  background: var(--bg-4); color: var(--ink-2);
}
.st--new { background: rgba(255,225,0,.16); color: #ffe100 }
.st--working, .st--selection { background: rgba(255,255,255,.1) }
.st--quote, .st--financing { background: rgba(90,160,255,.16); color: #8fbcff }
.st--invoice, .st--paid { background: rgba(219,64,64,.18); color: var(--brand-t) }
.st--shipped { background: rgba(63,191,106,.18); color: #6fe09a }
.st--lost { background: rgba(255,255,255,.07); color: var(--mute-2) }
.tag { display: inline-block; padding: .15rem .5rem; border-radius: 5px; background: var(--bg-3);
  font-size: .72rem; color: var(--mute) }
.warn { color: #ffb020 }

/* ── доска ──────────────────────────────────────────────────────────── */
.board { display: flex; gap: .7rem; overflow-x: auto; padding-bottom: .75rem; align-items: flex-start }
.col { flex: 0 0 268px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r) }
.col__h { display: flex; align-items: baseline; gap: .5rem; padding: .7rem .85rem; border-bottom: 1px solid var(--line) }
.col__h b { font-size: .82rem; font-weight: 500 }
.col__h span { font-size: .72rem; color: var(--mute-2); margin-left: auto }
.col__sum { padding: 0 .85rem .5rem; font-size: .74rem; color: var(--brand-t) }
.col__body { display: flex; flex-direction: column; gap: .45rem; padding: .55rem; max-height: 72vh; overflow-y: auto }
.dcard {
  display: block; background: var(--bg-3); border: 1px solid transparent;
  border-radius: var(--r-sm); padding: .6rem .7rem;
  transition: border-color .12s ease, background-color .12s ease;
}
.dcard:hover { border-color: rgba(255,255,255,.25); background: var(--bg-4) }
.dcard b { display: block; font-size: .86rem; font-weight: 500; line-height: 1.3; margin-bottom: .2rem }
.dcard .c { font-size: .76rem; color: var(--mute); display: block; margin-bottom: .35rem }
.dcard .m { display: flex; align-items: center; gap: .5rem; font-size: .72rem; color: var(--mute-2) }
.dcard .m b { font-size: .78rem; color: var(--brand-t); display: inline; margin: 0 }

/* ── лента событий ──────────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; gap: .1rem }
.ev { display: grid; grid-template-columns: 88px 1fr; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line-2); font-size: .86rem }
.ev:last-child { border-bottom: 0 }
.ev time { color: var(--mute-2); font-size: .76rem; padding-top: .1rem }
.ev .who { color: var(--mute); font-size: .76rem }
.ev--stage .txt { color: var(--brand-t) }
.ev--system .txt { color: var(--mute) }

/* ── прочее ─────────────────────────────────────────────────────────── */
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--mute-2); font-size: .9rem }
.center { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem }
.login { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: .8rem }
.err { color: var(--brand-t); font-size: .85rem }
details.add > summary { cursor: pointer; color: var(--brand-t); font-size: .85rem; padding: .3rem 0; list-style: none }
details.add > summary::-webkit-details-marker { display: none }
details.add > summary::before { content: "+ " }
details.add[open] > summary::before { content: "− " }
.chips { display: flex; gap: .35rem; flex-wrap: wrap }
.chips a { padding: .3rem .7rem; border-radius: 100px; background: var(--bg-3); font-size: .8rem; color: var(--ink-2) }
.chips a.on { background: var(--brand); color: #fff }

@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr }
  .top__search { display: none }
  .top__bar { flex-wrap: wrap; gap: .5rem }
  .menu { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap }
  .me span { display: none }
}

/* ── перетаскивание карточек на доске ───────────────────────────────── */
.dcard { cursor: grab }
.dcard:active { cursor: grabbing }
.col__body { min-height: 46px; transition: background-color .12s ease }
.col__body.over { background: rgba(219,64,64,.12); outline: 1px dashed var(--brand); outline-offset: -3px }

/* ── подсказка по каталогу ──────────────────────────────────────────── */
.ac {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  margin-top: .25rem; max-height: 320px; overflow-y: auto;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: 0 20px 40px -18px #000;
}
.ac__i {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .45rem .6rem; background: none; border: 0; cursor: pointer; text-align: left;
}
.ac__i:hover, .ac__i.on { background: var(--bg-4) }
.ac__i img, .ac__i i {
  width: 40px; height: 32px; flex: none; object-fit: contain;
  background: #fff; border-radius: 4px;
}
.ac__i span { display: flex; flex-direction: column; min-width: 0 }
.ac__i b { font-size: .84rem; font-weight: 400; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.ac__i em { font-style: normal; font-size: .72rem; color: var(--mute-2) }
