/* =============================================================================
   Части интерфейса: кнопки, карточки, плитки, таблицы, фильтры, шторки, формы.
   Всё, что рисует ui.js и page.js, оформляется здесь — в разметке разделов
   стилей нет вообще.
   ========================================================================== */

/* --- Кнопки -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs);
  font-weight: 550;
  white-space: nowrap;
  transition: background .13s, border-color .13s, color .13s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:active { transform: translateY(.5px); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.btn--acc { background: var(--acc); border-color: var(--acc); color: var(--text-on-acc); }
.btn--acc:hover { background: var(--acc-hover); border-color: var(--acc-hover); }
.btn--prod { background: var(--prod); border-color: var(--prod); color: #fff; }
.btn--prod:hover { filter: brightness(1.06); }
.btn--bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--bad:hover { filter: brightness(1.06); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn--sm { height: 28px; padding: 0 9px; font-size: var(--fs-sm); }
.btn--lg { height: 42px; padding: 0 20px; font-size: var(--fs-md); }
.btn--icon { width: 34px; padding: 0; }
.btn--icon.btn--sm { width: 28px; }
.btn--block { width: 100%; }

/* Кнопка «Ждём»: показывает, что запрос ушёл, и не даёт нажать второй раз. */
.btn.is-busy { pointer-events: none; opacity: .7; position: relative; }
.btn.is-busy::after {
  content: '';
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Карточки ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.card__title { font-size: var(--fs-md); font-weight: 650; }
.card__sub { font-size: var(--fs-sm); color: var(--text-3); }
.card__acts { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card__body { padding: 14px; }
.card__body--flush { padding: 0; }
.card__body--tight { padding: 9px 12px; }
.card__foot {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* --- Плитки с числами ---------------------------------------------------- */

.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.kpi--act { cursor: pointer; transition: border-color .13s, box-shadow .13s; }
.kpi--act:hover { border-color: var(--acc); box-shadow: var(--shadow-2); }

.kpi__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  display: flex; align-items: center; gap: 5px;
}
.kpi__value {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
  line-height: 1.15;
  word-break: break-word;
}
.kpi__sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.kpi__delta { font-size: var(--fs-sm); font-weight: 650; }
.kpi__delta.up { color: var(--ok-text); }
.kpi__delta.down { color: var(--bad-text); }

.kpi.tone-acc    .kpi__value { color: var(--acc-text); }
.kpi.tone-prod   .kpi__value { color: var(--prod-text); }
.kpi.tone-ok     .kpi__value { color: var(--ok-text); }
.kpi.tone-warn   .kpi__value { color: var(--warn-text); }
.kpi.tone-bad    .kpi__value { color: var(--bad-text); }
.kpi.tone-purple .kpi__value { color: var(--purple); }
.kpi.tone-teal   .kpi__value { color: var(--teal); }

/* Несколько валют в одной плитке — по строке на валюту, никогда одной суммой. */
.kpi__cur { display: grid; gap: 1px; margin-top: 3px; }
.kpi__cur b {
  font-size: var(--fs-md);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.kpi__cur span { font-size: var(--fs-xs); color: var(--text-3); }

/* --- Чипы и метки -------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.chip.acc    { background: var(--acc-soft);    color: var(--acc-text); }
.chip.prod   { background: var(--prod-soft);   color: var(--prod-text); }
.chip.ok     { background: var(--ok-soft);     color: var(--ok-text); }
.chip.warn   { background: var(--warn-soft);   color: var(--warn-text); }
.chip.bad    { background: var(--bad-soft);    color: var(--bad-text); }
.chip.purple { background: var(--purple-soft); color: var(--purple); }
.chip.teal   { background: var(--teal-soft);   color: var(--teal); }
.chip.pink   { background: var(--pink-soft);   color: var(--pink); }
.chip.dim    { background: var(--surface-3);   color: var(--text-3); }
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* --- Пары «название — значение» ------------------------------------------ */

.pairs { display: grid; gap: 0; }
.pair {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.pair:last-child { border-bottom: 0; }
.pair__k { flex: 0 0 42%; color: var(--text-3); font-size: var(--fs-sm); }
.pair__v { flex: 1 1 auto; font-weight: 550; min-width: 0; word-break: break-word; }
.pair__v.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Строки-списки ------------------------------------------------------- */

.lrow {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.lrow:last-child { border-bottom: 0; }
.lrow--act { cursor: pointer; }
.lrow--act:hover { background: var(--surface-2); }
.lrow__ic {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-2);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.lrow__main { flex: 1 1 auto; min-width: 0; }
.lrow__title { font-weight: 600; }
.lrow__sub { font-size: var(--fs-sm); color: var(--text-3); }
.lrow__val { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.lrow__val small { display: block; font-weight: 500; font-size: var(--fs-xs); color: var(--text-3); }

/* --- Таблица ------------------------------------------------------------- */

.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs);
}
.tbl th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: left;
  padding: 9px 11px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .sort { opacity: .35; margin-left: 3px; }
.tbl th.is-sorted .sort { opacity: 1; color: var(--acc); }

.tbl td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.is-act { cursor: pointer; }
.tbl tbody tr.is-act:hover { background: var(--surface-2); }
.tbl tbody tr.is-dim td { color: var(--text-3); }
.tbl tbody tr.is-bad { background: var(--bad-soft); }
.tbl tbody tr.is-warn { background: var(--warn-soft); }
.tbl tfoot td {
  padding: 10px 11px;
  background: var(--surface-2);
  font-weight: 700;
  border-top: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
}
.tbl .cell-main { font-weight: 600; }
.tbl .cell-sub { font-size: var(--fs-xs); color: var(--text-3); }

@media (max-width: 900px) {
  .tbl .hide-sm { display: none; }
}
@media (max-width: 1200px) {
  .tbl .hide-md { display: none; }
}

/* --- Фильтры ------------------------------------------------------------- */

.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  margin-bottom: 12px;
}
.fld { display: grid; gap: 3px; min-width: 0; }
.fld__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fld--grow { flex: 1 1 190px; }

.inp, select.inp, textarea.inp {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs);
  width: 100%;
  min-width: 0;
  appearance: none;
}
textarea.inp { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.inp:focus { border-color: var(--acc); outline: none; box-shadow: 0 0 0 3px var(--acc-soft); }
.inp::placeholder { color: var(--text-3); }
.inp[readonly] { background: var(--surface-2); color: var(--text-2); }

select.inp {
  padding-right: 26px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b849c' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.inp--search { padding-left: 31px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237b849c' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center; }

.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--acc); margin: 0; }

/* Сегменты: короткий выбор из двух-четырёх значений. */
.seg {
  display: inline-flex;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  height: 28px;
  padding: 0 11px;
  border-radius: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
}
.seg button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* --- Пустое, загрузка, ошибка -------------------------------------------- */

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty svg { opacity: .35; margin-bottom: 10px; }
.empty__title { font-weight: 600; color: var(--text-2); font-size: var(--fs-md); }
.empty__text { font-size: var(--fs-sm); margin-top: 3px; }

.skel { display: grid; gap: 8px; padding: 14px; }
.skel i {
  display: block;
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.notice {
  display: flex;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  line-height: 1.5;
  border: 1px solid transparent;
}
.notice svg { flex: 0 0 auto; margin-top: 1px; }
.notice.info { background: var(--acc-soft);  color: var(--acc-text); }
.notice.warn { background: var(--warn-soft); color: var(--warn-text); }
.notice.bad  { background: var(--bad-soft);  color: var(--bad-text); }
.notice.ok   { background: var(--ok-soft);   color: var(--ok-text); }

/* --- Полосы над содержимым ----------------------------------------------- */

/* Тонкая полоса под шапкой: «в данных работает поддержка» и «срок доступа
   кончается». Специально не всплывающая подсказка: подсказка исчезает, а эти
   два сообщения должны быть видны всё время, пока верны. */
.band {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  font-size: var(--fs-sm);
  font-weight: 550;
  border-bottom: 1px solid var(--line);
}
.band svg { flex: 0 0 auto; }
.band a { margin-left: auto; text-decoration: underline; color: inherit; }
.band--admin { background: var(--purple-soft); color: var(--purple-text); }
.band--warn  { background: var(--warn-soft); color: var(--warn-text); }

@media (max-width: 900px) {
  .band { padding: 7px 12px; }
}

/* --- Полоса выполнения --------------------------------------------------- */

.bar {
  height: 6px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--acc); }
.bar i.prod { background: var(--prod); }
.bar i.ok { background: var(--ok); }
.bar i.bad { background: var(--bad); }

/* --- Шторка и модальное окно --------------------------------------------- */

.ovl {
  position: fixed; inset: 0; z-index: 80;
  background: var(--overlay);
  display: flex;
  opacity: 0;
  transition: opacity .18s ease;
}
.ovl.is-open { opacity: 1; }
.ovl--right { justify-content: flex-end; }
.ovl--center { align-items: center; justify-content: center; padding: 18px; }

.sheet {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-3);
  max-height: 100%;
}
.ovl--right .sheet {
  width: min(560px, 100%);
  height: 100%;
  transform: translateX(18px);
  transition: transform .2s ease;
}
.ovl--right.is-wide .sheet { width: min(880px, 100%); }
.ovl--right.is-open .sheet { transform: none; }

.ovl--center .sheet {
  width: min(520px, 100%);
  border-radius: var(--radius-lg);
  transform: scale(.97);
  transition: transform .18s ease;
}
.ovl--center.is-wide .sheet { width: min(880px, 100%); }
.ovl--center.is-open .sheet { transform: none; }

.sheet__head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}
.sheet__title { font-size: var(--fs-md); font-weight: 650; }
.sheet__sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: 1px; }
.sheet__x { margin-left: auto; }
.sheet__body { flex: 1 1 auto; overflow-y: auto; padding: 16px; }
.sheet__body--flush { padding: 0; }
.sheet__foot {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
}

@media (max-width: 620px) {
  /* На телефоне шторка приезжает снизу: так до неё дотягивается большой палец. */
  .ovl--right { align-items: flex-end; justify-content: stretch; }
  .ovl--right .sheet {
    width: 100%;
    height: auto;
    max-height: 92%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(22px);
  }
  .ovl--center { padding: 0; align-items: flex-end; }
  .ovl--center .sheet { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92%; }
}

/* --- Форма в шторке ------------------------------------------------------ */

.form { display: grid; gap: 12px; }
.form__row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form__sep { height: 1px; background: var(--line); margin: 3px 0; }
.form__cap {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-top: 5px;
}
.form__hint { font-size: var(--fs-xs); color: var(--text-3); }
.form__err { font-size: var(--fs-xs); color: var(--bad-text); font-weight: 600; }
.inp.is-err { border-color: var(--bad); }

@media (max-width: 620px) { .form__row { grid-template-columns: minmax(0, 1fr); } }

/* --- Строки документа (редактор позиций) -------------------------------- */

.lines { display: grid; gap: 6px; }
.lines__head, .lines__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 92px 104px 30px;
  gap: 6px;
  align-items: center;
}
.lines__head {
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 2px;
}
.lines__row .inp { height: 32px; }
.lines__sum {
  text-align: right;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
}
.lines--noprice .lines__head, .lines--noprice .lines__row {
  grid-template-columns: minmax(0, 1fr) 104px 104px 30px;
}

@media (max-width: 620px) {
  .lines__head { display: none; }
  .lines__row {
    grid-template-columns: minmax(0, 1fr) 30px;
    grid-template-areas: "name del" "nums nums";
    padding: 8px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
  }
  .lines__row > :nth-child(1) { grid-area: name; }
  .lines__row > :nth-child(5), .lines--noprice .lines__row > :nth-child(4) { grid-area: del; }
  .lines__nums { grid-area: nums; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
}

/* --- Всплывающие подсказки ---------------------------------------------- */

.toasts {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 120;
  display: grid;
  gap: 8px;
  padding: 14px;
  justify-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(520px, 100%);
  padding: 11px 15px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: var(--fs);
  font-weight: 550;
  box-shadow: var(--shadow-3);
  animation: toast-in .2s ease;
  pointer-events: auto;
}
.toast.ok  { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.is-out { animation: toast-out .2s ease forwards; }
@keyframes toast-in  { from { transform: translateY(14px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(14px); opacity: 0; } }

@media (min-width: 900px) {
  .toasts { inset: auto 0 0 auto; justify-items: end; padding: 18px 22px; }
}

/* --- Меню действий ------------------------------------------------------- */

.menu {
  position: fixed;
  z-index: 130;
  min-width: 194px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
}
.menu button, .menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--fs);
  text-align: left;
  text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu .danger { color: var(--bad-text); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .cap {
  padding: 7px 10px 3px;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
}

/* --- Графики (только столбцы) ------------------------------------------- */

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart__grid line { stroke: var(--line); stroke-width: 1; }
.chart__ax { fill: var(--text-3); font-size: 10px; }
.chart__bar { transition: opacity .12s; }
.chart__bar:hover { opacity: .8; }
.chart__nums {
  position: absolute; inset: 0;
  pointer-events: none;
}
.chart__num {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chart__num.is-rot { transform: translate(-50%, -100%) rotate(-90deg); transform-origin: bottom center; }
.chart__legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 2px 0; }
.chart__legend span { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-2); }
.chart__legend i { width: 9px; height: 9px; border-radius: 3px; }

.rank { display: grid; gap: 7px; }
.rank__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.rank__label { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank__val { font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums; }
.rank__track { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.rank__fill { height: 100%; border-radius: 3px; }

/* --- Постраничность ----------------------------------------------------- */

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--fs-sm);
  color: var(--text-2);
  flex-wrap: wrap;
}
.pager__spacer { flex: 1 1 auto; }

/* --- Вход и регистрация ------------------------------------------------- */

.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(900px 500px at 12% -8%, var(--acc-soft), transparent 62%),
    radial-gradient(760px 460px at 96% 104%, var(--prod-soft), transparent 60%),
    var(--bg);
}
.auth__box {
  width: min(430px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 26px 24px;
}
.auth__brand { display: flex; align-items: center; gap: 11px; margin-bottom: 20px; }
.auth__brand .nav__logo { width: 38px; height: 38px; font-size: 17px; border-radius: 11px; }
.auth__tabs { display: flex; gap: 4px; margin-bottom: 18px; }
.auth__tabs button {
  flex: 1 1 auto;
  height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 600;
  font-size: var(--fs-sm);
}
.auth__tabs button.is-active { background: var(--acc); color: var(--text-on-acc); }
.auth__foot { margin-top: 16px; text-align: center; font-size: var(--fs-sm); color: var(--text-3); }
.auth__langs { display: flex; gap: 5px; justify-content: center; margin-top: 14px; }
.auth__langs button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 7px;
  height: 26px; padding: 0 9px;
  font-size: var(--fs-xs); font-weight: 650;
  color: var(--text-2);
}
.auth__langs button.is-active { border-color: var(--acc); color: var(--acc-text); background: var(--acc-soft); }

/* --- Кто вошёл, в подвале тёмной навигации ------------------------------ */

.who {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--nav-line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .04);
  color: var(--nav-text);
  text-align: left;
}
.who:hover { background: rgba(255, 255, 255, .08); }
.who__av {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--acc);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: var(--fs-sm);
  flex: 0 0 auto;
}
.who__main { flex: 1 1 auto; min-width: 0; }
.who__name { font-weight: 600; font-size: var(--fs-sm); color: #fff;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__role { font-size: var(--fs-xs); color: var(--nav-text-2); }

/* --- Части, которые есть только в админке ------------------------------- */

/* Полосы-предупреждения над содержимым: включён режим обслуживания, закрыта
   регистрация, не настроена почта. Всё это состояния, о которых администратор
   обязан помнить, пока они длятся, — поэтому не подсказка, а полоса.
   Живут отдельным узлом между шапкой и разделом (см. app.js: paintBands). */
.bands {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 12px 18px 0;
}

.band {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 550;
}
.band svg { flex: 0 0 auto; }
.band button { margin-left: auto; }
.band--warn { background: var(--warn-soft); color: var(--warn-text); }
.band--bad  { background: var(--bad-soft);  color: var(--bad-text); }
.band--ok   { background: var(--ok-soft);   color: var(--ok-text); }

/* Воронка: зарегистрировался → начал работать → оплатил. */
.funnel { display: grid; gap: 10px; }
.funnel__row { display: grid; grid-template-columns: 150px 1fr 92px; gap: 10px; align-items: center; }
.funnel__label { font-size: var(--fs-sm); color: var(--text-2); }
.funnel__track { height: 26px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.funnel__fill { height: 100%; border-radius: 6px; background: var(--acc); }
.funnel__fill.is-2 { background: var(--teal); }
.funnel__fill.is-3 { background: var(--ok); }
.funnel__num { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.funnel__num small { display: block; font-weight: 500; font-size: var(--fs-xs); color: var(--text-3); }

/* Живая лента событий в компаниях. */
.feed { display: grid; gap: 1px; }
.feed__row { display: grid; grid-template-columns: 1fr auto; gap: 10px;
             padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.feed__row:last-child { border-bottom: 0; }
.feed__who { color: var(--text-3); font-size: var(--fs-xs); }
.feed__time { color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Пароль, показанный один раз: временный пароль пользователя, ссылка входа
   в компанию. Моноширинный и с крупным межбуквенным просветом — такое
   диктуют по телефону. */
.secret {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin: 4px 0;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  font-family: var(--mono); font-size: var(--fs-md); font-weight: 650;
  letter-spacing: .06em;
  word-break: break-all;
}
.secret button { margin-left: auto; flex: 0 0 auto; }

/* Строка «до/после» в журнале правок. */
.diff { display: grid; gap: 4px; font-size: var(--fs-sm); }
.diff__row { display: grid; grid-template-columns: 160px 1fr 1fr; gap: 8px; align-items: start; }
.diff__key { color: var(--text-3); }
.diff__old { color: var(--bad-text); text-decoration: line-through; }
.diff__new { color: var(--ok-text); font-weight: 600; }

@media (max-width: 760px) {
  .funnel__row { grid-template-columns: 110px 1fr 78px; }
  .diff__row { grid-template-columns: 1fr; gap: 2px; }
}
