/* CRM CWS — интерфейс */

:root {
  --bg:      #0e1016;
  --panel:   #151822;
  --panel-2: #1a1e2b;
  --line:    #232735;
  --line-2:  #323849;
  --tx:      #e8ebf2;
  --tx-2:    #949cb0;
  --tx-3:    #656d82;
  --acc:     #7c8cff;
  --acc-2:   #6ee7f9;
  --ok:      #57d9a3;
  --warn:    #f5b544;
  --err:     #ff7676;
  --r:       10px;
  --side:    228px;
}

* { box-sizing: border-box; }

body {
  margin: 0; min-height: 100vh; display: flex;
  background: var(--bg); color: var(--tx);
  font: 400 15px/1.55 -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
input, select, textarea, button { font: inherit; }

/* ---------- боковое меню ---------- */

.side {
  width: var(--side); flex: 0 0 var(--side); height: 100vh; position: sticky; top: 0;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 3px; z-index: 30;
}
.side__logo { display: flex; align-items: center; gap: 11px; padding: 0 10px 20px; }
.side__mark { display: grid; place-items: center; transition: transform .5s cubic-bezier(.16,1,.3,1); }
.side__logo:hover .side__mark { transform: rotate(120deg); }
.side__logo b { font-weight: 800; font-size: 19px; letter-spacing: .08em; line-height: 1; }
.side__logo em {
  display: block; font: 400 10px/1 ui-monospace, monospace; letter-spacing: .17em;
  color: var(--tx-3); margin-top: 6px; text-transform: uppercase; font-style: normal;
}
.side__nav { display: grid; gap: 2px; }
.side__i {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border-radius: var(--r); border: 0; background: none;
  color: var(--tx-2); font-size: 14.5px; text-align: left; cursor: pointer;
  transition: background .18s, color .18s;
}
.side__i:hover { background: rgba(255,255,255,.05); color: var(--tx); }
.side__i.is-on { background: rgba(124,140,255,.16); color: #cdd4ff; }
.side__btm { margin-top: auto; display: grid; gap: 2px; padding-top: 16px; border-top: 1px solid var(--line); }
.badge {
  margin-left: auto; background: var(--acc); color: #0b0d14;
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
}

/* ---------- каркас ---------- */

.main { flex: 1; min-width: 0; }
.topbar {
  height: 62px; display: flex; align-items: center; gap: 16px;
  padding: 0 26px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: rgba(14,16,22,.92); backdrop-filter: blur(10px);
}
.topbar h1 { font-size: 18px; font-weight: 700; margin-right: auto; }
.topbar__right { display: flex; align-items: center; gap: 10px; }
.wrap { padding: 22px 26px 70px; width: 100%; }

.burger { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.burger span { display: block; width: 20px; height: 2px; background: var(--tx); border-radius: 2px; }
.burger span + span { margin-top: 5px; }

/* ---------- плитки и колонки ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.tile b { display: block; font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.tile span { display: block; color: var(--tx-3); font-size: 13px; margin-top: 4px; }

.cols { display: grid; gap: 16px; margin-bottom: 16px; align-items: start; }
.cols--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Сетка панелей: колонки подстраиваются под ширину, панели в ряду
   тянутся до одной высоты — между блоками не остаётся пустот. */
.deck {
  display: grid; gap: 16px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  align-items: stretch;
}
.deck--wide { grid-template-columns: repeat(auto-fit, minmax(560px, 1fr)); }
.deck > .panel { margin: 0; height: 100%; display: flex; flex-direction: column; }
.deck > .panel > .panel__head { flex: none; }
.deck > .panel > .tbl,
.deck > .panel > .funnel,
.deck > .panel > .bars,
.deck > .panel > .kpis { flex: 1; }
.deck > .panel > .empty { flex: 1; display: flex; align-items: center; }
.deck .span2 { grid-column: span 2; }

@media (max-width: 1000px) {
  .deck .span2 { grid-column: auto; }
}

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; margin-bottom: 16px; overflow: hidden;
}
.panel--accent { border-color: rgba(124,140,255,.4); }
.panel--flush { padding: 0; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.panel__head h2 { font-size: 15px; font-weight: 600; }
.pad { padding: 18px; }
.empty { color: var(--tx-3); padding: 20px 18px; margin: 0; }
.muted { color: var(--tx-3); }
.small { font-size: 12.5px; }
.warn { color: var(--warn); }
.ok { color: var(--ok); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.w1 { width: 1%; }
.cut { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Компактные строки для узких блоков сводки: всё помещается без прокрутки */
.rows { list-style: none; margin: 0; padding: 0; }
.rowl {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px;
  padding: 11px 18px; border-bottom: 1px solid var(--line); align-items: center;
}
.rowl:last-child { border-bottom: 0; }
.rowl:hover { background: rgba(255,255,255,.022); }
.rowl__t { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.rowl__r { white-space: nowrap; font-size: 13.5px; text-align: right; }
.rowl__m {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--tx-3); font-size: 12.5px; min-width: 0;
}
.rowl__m .clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.inline { display: inline-block; }
.sub { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--tx-3); margin: 22px 0 12px; }
.sub:first-child { margin-top: 0; }

/* ---------- таблицы ---------- */

.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th {
  text-align: left; padding: 11px 18px; font-size: 11.5px; font-weight: 600;
  color: var(--tx-3); text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 11px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl--rows tr:hover td { background: rgba(255,255,255,.022); }
.tbl .is-done td { opacity: .45; text-decoration: line-through; }
.tbl .is-demo td { background: rgba(245,181,68,.035); }
.tbl form { display: inline; }

.lnk { color: var(--acc-2); background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; }
.lnk:hover { text-decoration: underline; }
.lnk--b { font-weight: 600; color: var(--tx); }
.lnk--b:hover { color: var(--acc-2); }
.lnk--del { color: var(--err); }
.acts { display: flex; gap: 12px; justify-content: flex-end; }

/* ---------- метки ---------- */

.chip {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  background: rgba(255,255,255,.07); color: var(--tx-2);
  font-size: 11.5px; white-space: nowrap; vertical-align: middle;
}
.chip--demo { background: rgba(245,181,68,.18); color: var(--warn); }

.score {
  display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 8px;
  border-radius: 8px; font-weight: 700; font-size: 14px; color: #0b0d14;
}
.score--hot  { background: #57d9a3; }
.score--warm { background: #7c8cff; }
.score--mid  { background: #6b7490; color: #e8ebf2; }
.score--cold { background: #2c3143; color: var(--tx-3); }

/* цвета статусов */
.st--new       { background: #6b7490; }
.st--selected  { background: #7c8cff; }
.st--materials { background: #a78bfa; }
.st--sent      { background: #6ee7f9; }
.st--replied   { background: #57d9a3; }
.st--qualified { background: #3ec9c0; }
.st--talks     { background: #f5b544; }
.st--deal      { background: #34c77b; }
.st--refused   { background: #ff7676; }
.st--silence   { background: #4a5064; }
.chip.st--new, .chip.st--selected, .chip.st--materials, .chip.st--sent, .chip.st--replied,
.chip.st--qualified, .chip.st--talks, .chip.st--deal, .chip.st--refused, .chip.st--silence {
  color: #0b0d14; font-weight: 600;
}
.chip.st--new, .chip.st--silence { color: #e8ebf2; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- фильтры ---------- */

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.filters--inline { margin: 0; }
.filters input[type=search], .filters select, .rowform input, .rowform select {
  padding: 9px 12px; border-radius: var(--r); background: #0b0d14;
  border: 1px solid var(--line-2); color: var(--tx); font-size: 14px;
}
.filters__q { min-width: 260px; flex: 1; max-width: 380px; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--acc); }

.views { display: inline-flex; gap: 3px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; margin-bottom: 14px; }
.views__i { padding: 7px 15px; border-radius: 99px; color: var(--tx-2); font-size: 14px; }
.views__i:hover { color: var(--tx); }
.views__i.is-on { background: rgba(124,140,255,.18); color: #cdd4ff; }

.listhead { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.bulk { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.bulk select { padding: 7px 11px; border-radius: var(--r); background: #0b0d14; border: 1px solid var(--line-2); color: var(--tx); }

/* ---------- формы ---------- */

.frm { display: grid; gap: 14px; }
.frm--page { max-width: 900px; }
.fld { display: grid; gap: 6px; }
.fld > span { font-size: 13px; color: var(--tx-2); }
.fld input[type=text], .fld input[type=password], .fld input[type=number],
.fld input[type=date], .fld input[type=file], .fld textarea, .fld select, .lgn input {
  width: 100%; padding: 10px 13px; border-radius: var(--r);
  background: #0b0d14; border: 1px solid var(--line-2); color: var(--tx); font-size: 15px;
}
.fld textarea { resize: vertical; line-height: 1.6; }
.fld .mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.fld input:focus, .fld textarea:focus, .fld select:focus, .lgn input:focus { outline: none; border-color: var(--acc); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }

.chk { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.chk--inline { font-size: 14px; color: var(--tx-2); }
.chk input { width: 16px; height: 16px; accent-color: var(--acc); }

.rowform { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rowform input[type=text], .rowform input[type=date] { flex: 1; min-width: 130px; }

.frm__btm { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger { padding: 18px 0 0; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; border-radius: var(--r); border: 1px solid transparent;
  background: var(--acc); color: #0b0d14; font-weight: 600; font-size: 14.5px;
  cursor: pointer; transition: filter .18s, transform .12s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: transparent; border-color: var(--line-2); color: var(--tx); }
.btn--ghost:hover { background: rgba(255,255,255,.05); }
.btn--sm { padding: 8px 14px; font-size: 13.5px; }

/* ---------- сообщения ---------- */

.alert {
  padding: 12px 16px; border-radius: var(--r); margin-bottom: 16px;
  border: 1px solid var(--line-2); background: rgba(255,255,255,.03);
  color: var(--tx-2); font-size: 14.5px;
}
.alert a { color: var(--acc-2); text-decoration: underline; }
.alert--ok   { border-color: rgba(87,217,163,.4);  background: rgba(87,217,163,.09);  color: var(--ok); }
.alert--err  { border-color: rgba(255,118,118,.4); background: rgba(255,118,118,.09); color: var(--err); }

/* ---------- воронка и диаграммы ---------- */

.funnel { padding: 6px 18px 18px; display: grid; gap: 5px; }
.funnel__i { display: grid; grid-template-columns: 150px 1fr 34px; align-items: center; gap: 12px; padding: 5px 0; }
.funnel__t { font-size: 14px; color: var(--tx-2); }
.funnel__bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; }
.funnel__bar i { display: block; height: 100%; border-radius: 99px; }
.funnel__i b { text-align: right; font-size: 14px; }
.funnel__i:hover .funnel__t { color: var(--tx); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); }
.kpi { background: var(--panel); padding: 16px 18px; }
.kpi b { display: block; font-size: 22px; font-weight: 700; }
.kpi span { display: block; color: var(--tx-3); font-size: 12.5px; margin-top: 3px; }

.bars { display: grid; gap: 8px; }
.bars__i { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 12px; }
.bars__l { font-size: 13.5px; color: var(--tx-2); }
.bars__t { height: 8px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; }
.bars__t i { display: block; height: 100%; background: var(--acc); border-radius: 99px; }
.bars__i b { font-size: 13.5px; white-space: nowrap; }

/* ---------- канбан ---------- */

/* Доска на всю ширину и всю высоту экрана: колонки делят место поровну,
   каждая прокручивается внутри себя. Горизонтальная прокрутка появляется
   только на узких экранах, где колонки уже не сжать. */
.page-board .main { display: flex; flex-direction: column; height: 100vh; }
.page-board .wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 0; }

.kanban {
  display: grid;
  /* колонки делят ширину поровну, но не уже 168 px:
     на широком экране влезают все, на ноутбуке появляется прокрутка */
  grid-template-columns: repeat(var(--kcols, 6), minmax(168px, 1fr));
  gap: 10px; align-items: stretch;
  flex: 1; min-height: 320px;
  margin-inline: -26px; padding: 0 26px 12px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.kanban::-webkit-scrollbar { height: 10px; }
.kanban::-webkit-scrollbar-track { background: rgba(255,255,255,.05); border-radius: 99px; }
.kanban::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; }
.kanban::-webkit-scrollbar-thumb:hover { background: #454c63; }
/* Дорожка: без своей заливки, отделена пунктиром и идёт до низа экрана */
.kcol {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  padding-right: 10px; border-right: 1px dashed var(--line);
}
.kcol:last-child { border-right: 0; padding-right: 0; }
.kcol--closed { opacity: .75; }

/* Цветная шапка статуса */
.kcol__head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 8px; margin-bottom: 8px;
  color: #0b0d14; font-weight: 700; flex: none;
}
.kcol__head b {
  font-size: 13px; font-weight: 700; letter-spacing: .01em;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kcol__n { color: rgba(11,13,20,.6); font-size: 13px; font-weight: 600; flex: none; }
.kcol__add {
  margin-left: auto; width: 22px; height: 22px; flex: none;
  display: grid; place-items: center; border-radius: 6px;
  background: rgba(11,13,20,.14); color: #0b0d14; font-size: 16px; line-height: 1;
  transition: background .18s;
}
.kcol__add:hover { background: rgba(11,13,20,.28); }

/* на тёмных заливках подписи делаем светлыми */
.kcol__head.st--new, .kcol__head.st--silence { color: var(--tx); }
.kcol__head.st--new .kcol__n, .kcol__head.st--silence .kcol__n { color: rgba(232,235,242,.65); }
.kcol__head.st--new .kcol__add, .kcol__head.st--silence .kcol__add {
  background: rgba(255,255,255,.16); color: var(--tx);
}
.kcol__head.st--new .kcol__add:hover, .kcol__head.st--silence .kcol__add:hover {
  background: rgba(255,255,255,.3);
}

.kcol__body {
  display: grid; gap: 8px; align-content: start;
  flex: 1; min-height: 70px; overflow-y: auto; overscroll-behavior: contain;
  padding: 2px 2px 12px; border-radius: 8px; scrollbar-width: thin;
  transition: background .18s, box-shadow .18s;
}
.kcol__body::-webkit-scrollbar { width: 7px; }
.kcol__body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; }
.kcol__body.is-over {
  background: rgba(124,140,255,.10);
  box-shadow: inset 0 0 0 1px rgba(124,140,255,.4);
}

.kcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; cursor: grab; display: grid; gap: 6px; min-width: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.kcard:hover { border-color: var(--line-2); transform: translateY(-1px); box-shadow: 0 4px 14px -6px rgba(0,0,0,.7); }
.kcard.is-drag { opacity: .4; }
.kcard__t { font-weight: 600; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.kcard__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kcard__price { font-size: 13px; color: var(--acc-2); font-weight: 600; }
.kcard__empty {
  border: 1px dashed var(--line); border-radius: 10px; padding: 14px 12px;
  color: var(--tx-3); font-size: 12.5px; text-align: center;
}

/* ---------- карточки списка ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.ccard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 9px; align-content: start; }
.ccard:hover { border-color: var(--line-2); }
.ccard__top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ccard h3 { font-size: 16px; font-weight: 600; }
.ccard h3 a:hover { color: var(--acc-2); }
.ccard__note { margin: 0; font-size: 13.5px; color: var(--tx-2); }
.ccard__facts { display: grid; gap: 5px; margin: 4px 0 0; font-size: 13.5px; }
.ccard__facts > div { display: flex; justify-content: space-between; gap: 10px; }
.ccard__facts dt { color: var(--tx-3); margin: 0; }
.ccard__facts dd { margin: 0; }

/* ---------- шапка карточки компании ---------- */

.chead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 18px; flex-wrap: wrap;
}
.chead__main { display: grid; gap: 12px; min-width: 0; }
.chead__top { display: flex; align-items: center; gap: 14px; }
.chead__name { font-size: 25px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.chead__sub { color: var(--tx-3); font-size: 14px; margin-top: 5px; }
.chead__sub .sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%;
  background: var(--line-2); margin: 0 8px 3px; vertical-align: middle; }
.chead__chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chead__acts { display: flex; align-items: center; gap: 10px; }
.chead__acts select { padding: 9px 12px; border-radius: var(--r); background: #0b0d14; border: 1px solid var(--line-2); color: var(--tx); }

.score--lg { min-width: 46px; height: 46px; font-size: 20px; border-radius: 12px; flex: none; }
.chip--money { background: rgba(110,231,249,.14); color: var(--acc-2); font-weight: 600; }
.chip--warn { background: rgba(245,181,68,.18); color: var(--warn); }
.chip--v-work { background: rgba(87,217,163,.16); color: var(--ok); }
.chip--v-skip { background: rgba(255,118,118,.15); color: var(--err); }
.chip--v-later { background: rgba(245,181,68,.15); color: var(--warn); }

/* ---------- вкладки ---------- */

.tabs__bar {
  display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px;
  padding-bottom: 2px; border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.tabs__bar::-webkit-scrollbar { display: none; }
.tabs__b {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px 13px; border: 0; background: none; cursor: pointer;
  color: var(--tx-3); font-size: 14.5px; font-weight: 500; white-space: nowrap;
  border-radius: var(--r) var(--r) 0 0; transition: color .18s, background .18s;
}
.tabs__b:hover { color: var(--tx); background: rgba(255,255,255,.035); }
.tabs__b::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  border-radius: 2px; background: transparent; transition: background .2s;
}
.tabs__b.is-on { color: var(--tx); font-weight: 600; }
.tabs__b.is-on::after { background: linear-gradient(90deg, var(--acc-2), var(--acc)); }
.tabs__n {
  font-style: normal; font-size: 11.5px; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: 99px; background: rgba(255,255,255,.08); color: var(--tx-3);
}
.tabs__b.is-on .tabs__n { background: rgba(124,140,255,.22); color: #cdd4ff; }
/* до инициализации показываем первую вкладку — без вспышки всего содержимого */
.tabs__p { display: none; }
.tabs__p:first-of-type { display: block; }
.tabs[data-ready] .tabs__p { display: none; }
.tabs[data-ready] .tabs__p.is-on { display: block; animation: tabin .22s cubic-bezier(.16,1,.3,1); }
@keyframes tabin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- карточка-блок внутри вкладки ---------- */

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; margin-bottom: 16px; overflow: hidden;
}
.card--accent { border-color: rgba(124,140,255,.42); }
.card__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card__head h3 { font-size: 16px; font-weight: 600; }
.card__head p { margin: 5px 0 0; color: var(--tx-3); font-size: 13.5px; }
.card__btm {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-top: 1px solid var(--line); background: rgba(255,255,255,.015);
}

/* ---------- поля ---------- */

.fields { padding: 20px; display: grid; gap: 20px; }

/* группа полей с подписью и своим фоном — поля больше не сливаются */
.fs {
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,.018); padding: 16px 18px 18px; display: grid; gap: 14px;
}
.fs--score { border-color: rgba(124,140,255,.3); background: rgba(124,140,255,.05); }
.fs__t {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--tx-3);
}

.f { display: grid; gap: 14px; }
.f--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.f--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.f--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.fields .fld > span { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--tx-2); }
.fields .hint { font-style: normal; color: var(--tx-3); font-size: 11.5px; }
.fields .fld > .hint { margin-top: 5px; }

.fields input[type=text], .fields input[type=number], .fields input[type=date],
.fields input[type=file], .fields textarea, .fields select {
  background: #0b0d14; border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--tx); font-size: 15px; padding: 10px 13px; width: 100%;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.fields input::placeholder, .fields textarea::placeholder { color: #4d5468; }
.fields input:hover, .fields textarea:hover, .fields select:hover { border-color: #3d4459; }
.fields input:focus, .fields textarea:focus, .fields select:focus {
  outline: none; border-color: var(--acc); background: #0d0f18;
  box-shadow: 0 0 0 3px rgba(124,140,255,.14);
}

/* поле с единицей измерения */
.input-unit { position: relative; display: block; }
.input-unit input { padding-right: 34px; }
.input-unit em {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  font-style: normal; color: var(--tx-3); font-size: 14px; pointer-events: none;
}

/* строка быстрого добавления */
.addrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 16px 20px; border-top: 1px solid var(--line); background: rgba(255,255,255,.015);
}
.addrow input[type=text], .addrow input[type=date], .addrow select {
  flex: 1; min-width: 130px; padding: 9px 12px; border-radius: var(--r);
  background: #0b0d14; border: 1px solid var(--line-2); color: var(--tx); font-size: 14px;
}
.addrow input:focus, .addrow select:focus { outline: none; border-color: var(--acc); }

/* ---------- списки внутри карточки ---------- */

.ctlist { list-style: none; margin: 0; padding: 0; }
.ct {
  display: grid; grid-template-columns: 110px minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line);
}
.ct:last-child { border-bottom: 0; }
.ct:hover { background: rgba(255,255,255,.02); }
.ct.is-done { opacity: .45; }
.ct.is-done .ct__val { text-decoration: line-through; }
.ct__kind { font-size: 12.5px; color: var(--tx-3); }
.ct__val { font-size: 15px; word-break: break-word; }
.ct__who { font-size: 13.5px; }
.ct__who em { display: block; font-style: normal; }

.mats { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 18px 20px; }
.mat { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--panel-2); display: grid; gap: 8px; align-content: start; }
.mat__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mat__kind { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--acc-2); }
.mat h4 { font-size: 15px; font-weight: 600; }
.mat__del { margin-top: 2px; }

.tline { list-style: none; margin: 0; padding: 6px 20px 18px; display: grid; gap: 2px; }
.tline li { display: grid; grid-template-columns: 10px auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 0; }
.tline__n { font-size: 13.5px; }
.tline__t { white-space: nowrap; }

.letter {
  margin: 8px 0 0; padding: 12px 14px; border-radius: 8px; background: #0b0d14;
  border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word;
  font: 13.5px/1.6 ui-monospace, Consolas, monospace; color: var(--tx-2); max-height: 340px; overflow: auto;
}

.steps { margin: 0; padding-left: 20px; display: grid; gap: 7px; color: var(--tx-2); font-size: 14px; }
.steps code { background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- всплывающие сообщения ---------- */

.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: grid; gap: 8px; max-width: min(360px, calc(100vw - 36px));
}
.toast {
  background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--acc);
  border-radius: var(--r); padding: 12px 15px; font-size: 14px; color: var(--tx);
  box-shadow: 0 12px 34px -12px rgba(0,0,0,.85);
  animation: toastin .28s cubic-bezier(.16,1,.3,1);
}
.toast--ok { border-left-color: var(--ok); }
.toast--warn { border-left-color: var(--warn); }
.toast.is-out { opacity: 0; transform: translateX(14px); transition: opacity .45s, transform .45s; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.stale {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 200;
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--acc); border-radius: 99px;
  padding: 9px 10px 9px 20px; font-size: 14px;
  box-shadow: 0 12px 34px -12px rgba(0,0,0,.85);
}

/* ---------- вход ---------- */

.login-page { display: grid; place-items: center; padding: 24px; }
.lgn {
  width: 100%; max-width: 380px; display: grid; gap: 15px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px;
}
.lgn__logo { display: flex; align-items: center; gap: 12px; }
.lgn__logo b { font-weight: 800; font-size: 22px; letter-spacing: .08em; line-height: 1; }
.lgn__logo em {
  display: block; font: 400 10px/1 ui-monospace, monospace; letter-spacing: .18em;
  color: var(--tx-3); margin-top: 5px; text-transform: uppercase; font-style: normal;
}
.lgn h1 { font-size: 18px; font-weight: 600; }
.lgn .fld span { font-size: 13px; color: var(--tx-2); }
.lgn .btn { margin-top: 4px; }

/* ---------- адаптив ---------- */

@media (max-width: 1200px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cols--2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .28s cubic-bezier(.16,1,.3,1);
    box-shadow: 0 0 60px rgba(0,0,0,.6);
  }
  .side.is-open { transform: none; }
  .burger { display: block; }
  .main { width: 100%; }
  .topbar, .wrap { padding-inline: 14px; }
  .page-board .main { height: auto; min-height: 100vh; }
  .kanban {
    margin-inline: -14px; padding-inline: 14px; min-height: 60vh;
    grid-template-columns: repeat(var(--kcols, 6), 84vw);
  }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding: 10px 12px; }
  .funnel__i { grid-template-columns: 110px 1fr 30px; }
  .bars__i { grid-template-columns: 90px 1fr auto; }
  .chead__acts { width: 100%; }
  .cut { max-width: 180px; }
  .f--2, .f--3, .f--4 { grid-template-columns: 1fr; }
  .fields { padding: 14px; }
  .fs { padding: 14px; }
  .ct { grid-template-columns: 1fr; gap: 6px; }
  .ct__kind { order: -1; }
  .card__head, .card__btm, .addrow { padding-inline: 14px; }
  .mats { padding: 14px; grid-template-columns: 1fr; }
  .tline li { grid-template-columns: 10px auto 1fr; }
  .tline__t { grid-column: 2 / -1; }
  .chead__name { font-size: 21px; }

  .panel > .tbl { min-width: 520px; }
  .panel .frm, .panel .rowform { min-width: 0; }
}
