/* ==========================================================================
   УПД-робот · внутренний сервис
   style.css — дизайн-переменные и общие компоненты.
   Без внешних шрифтов, иконок и запросов: всё работает в закрытой сети.
   ========================================================================== */

/* ---------- 1. Дизайн-переменные ---------------------------------------- */

:root {
  /* Поверхности и текст: тёплые нейтрали, чтобы сервис не выглядел «стерильным» */
  --bg: #f7f7f3;
  --surface: #ffffff;
  --surface-soft: #fafaf6;
  --surface-muted: #f0f1ec;
  --ink: #1b211e;
  --ink-2: #39423d;
  --muted: #67706a;
  --line: #e6e6df;
  --line-2: #d5d8cf;

  /* Бренд: глубокий петроль. Используется только для действий и активных состояний */
  --primary: #0f5f54;
  --primary-hover: #0b4c43;
  --primary-ink: #0b4c43;
  --primary-soft: #e7f1ee;
  --primary-soft-2: #d3e7e1;
  --ring: rgba(15, 95, 84, 0.18);

  /* Статусы: смысл зафиксирован в ТЗ */
  --ok-ink: #14663a;
  --ok-soft: #e8f4ed;
  --ok-line: #c7e3d4;
  --ok-dot: #2f8f5b;

  --danger-ink: #9e2b1e;
  --danger-soft: #fbeae7;
  --danger-line: #f0cbc3;
  --danger-dot: #c74a37;

  --warn-ink: #7a5200;
  --warn-soft: #fcf2da;
  --warn-line: #eeddb4;
  --warn-dot: #c48f1f;

  /* Жёлтый = подобрал робот (уверенно или сомневается) — проверить */
  --auto-ink: #7a5b00;
  --auto-soft: #fff4c2;
  --auto-line: #efdc94;
  --auto-dot: #d9a619;

  /* Оранжевый = пустая ячейка, нужно заполнить */
  --ask-ink: #9a3f00;
  --ask-soft: #fde6cc;
  --ask-line: #f2c590;
  --ask-dot: #e07b1f;

  --neutral-ink: #545c56;
  --neutral-soft: #eef0eb;
  --neutral-line: #dde0d7;

  /* Типографика */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono",
    Menlo, monospace;

  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-24: 24px;
  --fs-30: 30px;

  /* Шаг 4 / 8 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  --shadow-1: 0 1px 2px rgba(27, 33, 30, 0.06);
  --shadow-2: 0 8px 24px -10px rgba(27, 33, 30, 0.18);
  --shadow-3: 0 28px 64px -20px rgba(20, 29, 26, 0.38);

  --t-fast: 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --t: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);

  --appbar-h: 64px;
  --content-max: 1440px;
  --gutter: 32px;
}

/* ---------- 2. База ------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: var(--fs-24);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.015em;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

svg {
  display: block;
  flex: none;
}

::selection {
  background: var(--primary-soft-2);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 3. Каркас страницы ------------------------------------------ */

.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.appbar__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  width: 100%;
  max-width: var(--content-max);
  height: var(--appbar-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  flex: none;
}

.brand:hover {
  text-decoration: none;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.brand__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand__name span {
  color: var(--muted);
  font-weight: 500;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-13);
  font-weight: 500;
  white-space: nowrap;
}

.nav__link:hover {
  background: var(--surface-soft);
  color: var(--ink);
  text-decoration: none;
}

.nav__link.is-active {
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-weight: 600;
}

.appbar__right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

/* Меню пользователя */
.user-menu {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 8px 0 6px;
  border-radius: var(--r-md);
  text-align: left;
}

.user-btn:hover {
  background: var(--surface-soft);
}

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: none;
}

.user-btn__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-btn__name {
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--ink);
}

.user-btn__role {
  font-size: 12px;
  color: var(--muted);
}

.user-btn__chevron {
  color: var(--muted);
  margin-left: 2px;
  transition: transform var(--t-fast);
}

.user-menu.is-open .user-btn__chevron {
  transform: rotate(180deg);
}

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 248px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  display: none;
  z-index: 60;
}

.user-menu.is-open .menu {
  display: block;
  animation: pop 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.menu__head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
  font-size: var(--fs-13);
  font-weight: 600;
}

.menu__head span {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-12);
  font-weight: 400;
  color: var(--muted);
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-13);
  color: var(--ink-2);
  text-align: left;
}

.menu__item:hover {
  background: var(--surface-soft);
  color: var(--ink);
  text-decoration: none;
}

.menu__item svg {
  color: var(--muted);
}

.menu__item--danger {
  color: var(--danger-ink);
}

.menu__item--danger svg {
  color: var(--danger-ink);
}

/* Контейнер страницы */
.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-8) var(--gutter) var(--sp-12);
}

.page--narrow {
  max-width: 1180px;
}

/* ---------- 4. Заголовок страницы --------------------------------------- */

.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  font-size: var(--fs-12);
  color: var(--muted);
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--muted);
}

.crumbs a:hover {
  color: var(--primary);
  text-decoration: none;
}

.crumbs__sep {
  color: var(--muted);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
}

.page-head__title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-head__sub {
  margin-top: 5px;
  font-size: var(--fs-13);
  color: var(--muted);
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-head__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast),
    color var(--t-fast), box-shadow var(--t-fast);
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(0.5px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), var(--shadow-1);
}

.btn--primary:hover {
  background: var(--primary-hover);
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.btn--secondary:hover {
  background: var(--surface-soft);
  border-color: #c3c8bc;
}

.btn--ghost {
  color: var(--ink-2);
}

.btn--ghost:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.btn--danger {
  background: var(--danger-ink);
  color: #fff;
}

.btn--danger:hover {
  background: #862319;
}

.btn--danger-ghost {
  color: var(--danger-ink);
}

.btn--danger-ghost:hover {
  background: var(--danger-soft);
}

.btn--sm {
  height: 32px;
  padding: 0 10px;
  font-size: var(--fs-12);
}

.btn--lg {
  height: 42px;
  padding: 0 18px;
  font-size: var(--fs-14);
}

.btn--block {
  width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:disabled:hover {
  background: var(--primary);
}

.btn--secondary:disabled:hover {
  background: var(--surface);
  border-color: var(--line-2);
}

/* Неактивное главное действие остаётся читаемым, но не спорит с рабочим столом */
.btn--primary:disabled {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--muted);
  opacity: 1;
  box-shadow: none;
}

.btn--primary:disabled:hover {
  background: var(--surface);
  border-color: var(--line-2);
}

.btn--primary:disabled .badge--on-primary {
  background: var(--surface-muted);
  color: var(--muted);
}

.btn--ghost:disabled:hover {
  background: none;
}

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
}

.iconbtn:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.iconbtn--danger:hover {
  background: var(--danger-soft);
  color: var(--danger-ink);
}

.iconbtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.link-quiet {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--muted);
  font-size: var(--fs-13);
}

.link-quiet:hover {
  color: var(--ink);
  text-decoration: none;
}

/* ---------- 6. Формы ----------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-4);
}

.field:last-child {
  margin-bottom: 0;
}

.field__label {
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--ink-2);
}

.input,
.select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-14);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2367706a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 34px;
}

.input::placeholder {
  color: #78817b;
}

.input:hover,
.select:hover {
  border-color: #c3c8bc;
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.input--error {
  border-color: var(--danger-line);
  background: #fffafa;
}

.input--error:focus {
  border-color: var(--danger-ink);
  box-shadow: 0 0 0 3px rgba(158, 43, 30, 0.14);
}

.field__hint {
  font-size: var(--fs-12);
  color: var(--muted);
  line-height: 1.45;
}

.field__error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
  color: var(--danger-ink);
}

.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-right: 44px;
}

.input-wrap__btn {
  position: absolute;
  top: 50%;
  right: 3px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--muted);
}

.input-wrap__btn:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

/* Сообщения */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--danger-line);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger-ink);
  font-size: var(--fs-13);
  line-height: 1.45;
}

.alert svg {
  margin-top: 1px;
  flex: none;
}

.alert--warn {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn-ink);
}

.alert--info {
  border-color: var(--auto-line);
  background: var(--auto-soft);
  color: var(--auto-ink);
}

.alert--ok {
  border-color: var(--ok-line);
  background: var(--ok-soft);
  color: var(--ok-ink);
}

/* ---------- 7. Карточки, история, заметки -------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.card + .card {
  margin-top: var(--sp-6);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
}

.card__head--plain {
  border-bottom: 0;
  padding-bottom: 0;
}

.card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card__sub {
  margin-top: 2px;
  font-size: var(--fs-12);
  color: var(--muted);
}

.card__body {
  padding: var(--sp-5);
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-size: var(--fs-12);
  color: var(--muted);
}

/* ---------- 8. Таблицы --------------------------------------------------- */

.table-wrap {
  width: 100%;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-13);
}

.table th,
.table td {
  padding: 11px 16px;
  text-align: left;
  vertical-align: middle;
}

.table th {
  height: 40px;
  padding-top: 8px;
  padding-bottom: 8px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table thead th:first-child {
  border-top-left-radius: var(--r-lg);
}

.table thead th:last-child {
  border-top-right-radius: var(--r-lg);
}

.table td {
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover td {
  background: #fbfbf7;
}

.table td.strong,
.table td .strong {
  color: var(--ink);
  font-weight: 600;
}

.table .muted {
  color: var(--muted);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table__doc-start td {
  border-top: 1px solid var(--line-2);
}

.table__doc-start:first-child td {
  border-top: 0;
}

.table--sticky thead th {
  position: sticky;
  top: var(--appbar-h);
  z-index: 4;
}

.table--fixed {
  table-layout: fixed;
}

.cell-actions {
  text-align: right;
  white-space: nowrap;
}

.cell-actions > * {
  vertical-align: middle;
}

.cell-actions > * + * {
  margin-left: 4px;
}

.cell-actions a,
.cell-actions button {
  font-size: var(--fs-12);
}

.row-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-12);
  white-space: nowrap;
}

.row-action:hover {
  background: var(--surface-muted);
  color: var(--ink);
  text-decoration: none;
}

.row-action--primary {
  color: var(--primary-ink);
}

.table-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  max-width: 44ch;
}

.empty-row td {
  padding: 0 !important;
  background: var(--surface) !important;
}

.empty-row:hover td {
  background: var(--surface) !important;
}

/* ---------- 9. Статусы и счётчики --------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 9px;
  border-radius: var(--r-full);
  font-size: var(--fs-12);
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill--ok {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok-ink);
}

.pill--danger {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger-ink);
}

.pill--warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}

.pill--neutral {
  background: var(--neutral-soft);
  border-color: var(--neutral-line);
  color: var(--neutral-ink);
}

.pill--info {
  background: var(--auto-soft);
  border-color: var(--auto-line);
  color: var(--auto-ink);
}

.pill--plain {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink-2);
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--surface-muted);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.badge--on-primary {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.badge--primary {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.badge--danger {
  background: var(--danger-soft);
  color: var(--danger-ink);
}

.tip {
  position: relative;
}

.tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  z-index: 90;
  width: max-content;
  max-width: 260px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  background: #1c2420;
  color: #eef4f1;
  font-size: var(--fs-12);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
}

.tip:hover::after,
.tip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 10. Загрузка файлов ----------------------------------------- */

.upload-card {
  padding: var(--sp-5);
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: 20px 22px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}

.dropzone:hover {
  border-color: #b6c4bd;
  background: #f7f9f4;
}

.dropzone.is-drag {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.dropzone__main {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-width: 0;
}

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-1);
  flex: none;
}

.dropzone__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dropzone__hint {
  margin-top: 3px;
  font-size: var(--fs-12);
  color: var(--muted);
}

.dropzone__hint b {
  font-weight: 600;
  color: var(--ink-2);
}

.filelist {
  display: flex;
  flex-direction: column;
  margin-top: var(--sp-2);
}

.fileitem {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
}

.fileitem:last-child {
  border-bottom: 0;
}

.fileicon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--ok-soft);
  color: var(--ok-ink);
  flex: none;
}

.fileitem[data-ok="false"] .fileicon {
  background: var(--danger-soft);
  color: var(--danger-ink);
}

.fileitem__body {
  min-width: 0;
  flex: 1;
}

.fileitem__name {
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.fileitem__meta {
  margin-top: 2px;
  font-size: var(--fs-12);
  color: var(--muted);
}

.fileitem__error {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: var(--fs-12);
  color: var(--danger-ink);
}

.fileitem__state {
  font-size: var(--fs-12);
  color: var(--muted);
  white-space: nowrap;
}

.fileitem__state--ok {
  color: var(--ok-ink);
}

.fileitem__state--error {
  color: var(--danger-ink);
}

.fileitem .iconbtn {
  margin-left: var(--sp-1);
  flex: none;
}

.files-empty {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: var(--fs-13);
}

.files-empty svg {
  color: var(--muted);
}

.upload-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}

.upload-foot__hint {
  font-size: var(--fs-12);
  color: var(--muted);
  max-width: 52ch;
  line-height: 1.45;
}

.upload-foot__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.upload-foot--plain {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* ---------- 11. Сводка партии ------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat {
  padding: 18px var(--sp-5) 16px;
  border-right: 1px solid var(--line);
  min-width: 0;
}

.stat:last-child {
  border-right: 0;
}

.stat__label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-12);
  color: var(--muted);
  white-space: nowrap;
}

.stat__value {
  margin-top: 6px;
  font-size: var(--fs-24);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat__value--ok {
  color: var(--ok-ink);
}

.stat__value--danger {
  color: var(--danger-ink);
}

.stat__value--muted {
  color: var(--muted);
}

.stat__note {
  margin-top: 3px;
  font-size: var(--fs-12);
  color: var(--muted);
}

.stat__note--danger {
  color: var(--danger-ink);
}

/* ---------- 12. Вкладки, тулбар, легенда -------------------------------- */

.tabs {
  display: flex;
  gap: var(--sp-6);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 2px;
  color: var(--muted);
  font-size: var(--fs-13);
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab__code {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tab.is-active {
  color: var(--ink);
}

.tab.is-active .tab__code {
  color: var(--primary-ink);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.tab__name {
  font-size: var(--fs-12);
  color: var(--muted);
}

.tab__count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--surface-muted);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tab.is-active .tab__count {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.toolbar__spacer {
  flex: 1;
}

.search {
  position: relative;
  width: 272px;
  max-width: 100%;
}

.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search .input {
  height: 36px;
  padding-left: 34px;
  font-size: var(--fs-13);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-13);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.switch:hover {
  background: var(--surface-soft);
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch__track {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: var(--r-full);
  background: #d7dbd2;
  transition: background var(--t-fast);
  flex: none;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 29, 26, 0.28);
  transition: transform var(--t-fast);
}

.switch input:checked + .switch__track {
  background: var(--primary);
}

.switch input:checked + .switch__track::after {
  transform: translateX(12px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.switch__count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--ask-soft);
  color: var(--ask-ink);
  font-size: 12px;
  font-weight: 600;
}

.legend-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 9px var(--sp-5);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.legend {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
  color: var(--ink-2);
  white-space: nowrap;
}

.legend__sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  flex: none;
}

.legend__sw--auto {
  background: var(--auto-soft);
  border-color: var(--auto-line);
}

.legend__sw--ask {
  background: var(--ask-soft);
  border-color: var(--ask-line);
}

.legend__sw--ref {
  background: var(--surface);
  border-color: var(--line-2);
}

.legend__count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.legend__hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-12);
  color: var(--muted);
}

.kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  color: var(--ink-2);
}

/* ---------- 13. Названия товаров (главный экран) ------------------------ */

.name-cell {
  padding-top: 7px !important;
  padding-bottom: 7px !important;
}

.name-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.name-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: var(--fs-13);
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  color: var(--ink);
  cursor: text;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}

.name-chip__text {
  overflow-wrap: anywhere;
}

.name-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  flex: none;
}

.name-chip--auto {
  background: var(--auto-soft);
  border-color: var(--auto-line);
  color: var(--auto-ink);
}

.name-chip--auto::before {
  background: var(--auto-dot);
}

.name-chip--auto:hover {
  background: #f8e9a0;
}

.name-chip--ask {
  background: var(--ask-soft);
  border-color: var(--ask-line);
  color: var(--ask-ink);
}

.name-chip--ask::before {
  background: var(--ask-dot);
}

.name-chip--ask:hover {
  background: #fbd4a8;
}

.name-chip--ref {
  background: transparent;
  color: var(--ink);
}

.name-chip--ref::before {
  display: none;
}

.name-chip--ref:hover {
  background: var(--surface-muted);
}

.name-chip.is-empty {
  font-weight: 400;
  color: var(--ask-ink);
}

.name-chip.is-empty .name-chip__text {
  font-style: normal;
  opacity: 0.9;
}

.name-cell.is-editing .name-chip {
  display: none;
}

.name-input {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--primary);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-13);
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}

.accept-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--auto-ink);
  opacity: 0.62;
  flex: none;
  transition: background var(--t-fast), opacity var(--t-fast), color var(--t-fast);
}

.accept-btn:hover {
  opacity: 1;
  background: var(--auto-soft);
}

.name-cell .name-wrap .accept-btn {
  margin-left: auto;
}

/* Конфликт названий */
.conflict-row td {
  padding: 0 16px 10px !important;
  background: var(--surface) !important;
  border-bottom: 1px solid var(--line) !important;
}

.conflict {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--warn-line);
  border-left: 3px solid var(--warn-dot);
  border-radius: var(--r-md);
  background: var(--warn-soft);
  color: var(--warn-ink);
  font-size: var(--fs-12);
  line-height: 1.5;
}

.conflict__body {
  flex: 1;
  min-width: 0;
}

.conflict__title {
  font-weight: 600;
  font-size: var(--fs-13);
  margin-bottom: 2px;
}

.conflict__text strong {
  font-weight: 600;
}

.conflict__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-top: 8px;
}

.conflict__actions .btn--secondary {
  background: #fff;
}

.conflict__x {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  color: var(--warn-ink);
  flex: none;
}

.conflict__x:hover {
  background: rgba(122, 82, 0, 0.1);
}

/* ---------- 14. Модальные окна, меню, тосты ------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}

.modal.is-open {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 29, 26, 0.45);
  animation: fade 160ms ease-out;
}

.modal__box {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: pop 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal__box--wide {
  max-width: 560px;
}

.modal__head {
  padding: var(--sp-5) var(--sp-6) 0;
}

.modal__title {
  font-size: var(--fs-16);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal__sub {
  margin-top: 4px;
  font-size: var(--fs-13);
  color: var(--muted);
}

.modal__body {
  padding: var(--sp-4) var(--sp-6) var(--sp-5);
  font-size: var(--fs-13);
  color: var(--ink-2);
  line-height: 1.55;
}

.modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.modal__x {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--muted);
}

.modal__x:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.modal__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: var(--sp-3);
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger-ink);
}

.modal__icon--warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
}

.modal__icon--primary {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.change-list {
  margin-top: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.change-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-12);
}

.change-item:last-child {
  border-bottom: 0;
}

.change-item .mono {
  flex: none;
}

.change-item span:last-child {
  color: var(--ink);
}

.toasts {
  position: fixed;
  right: var(--sp-6);
  bottom: var(--sp-6);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 420px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: #1c2420;
  color: #eef4f1;
  font-size: var(--fs-13);
  line-height: 1.45;
  box-shadow: var(--shadow-2);
  pointer-events: auto;
  animation: toast-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast svg {
  margin-top: 1px;
  flex: none;
  color: #7fd6c4;
}

.toast--danger svg {
  color: #f0a99c;
}

.toast--warn svg {
  color: #eccd8a;
}

.toast.is-leaving {
  animation: toast-out 180ms ease-in forwards;
}

/* Тултип-подсказка для иконок — поверх таблицы */
.icon-with-tip {
  display: inline-flex;
  align-items: center;
}

/* ---------- 15. Пустые состояния, загрузка ------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 44px var(--sp-6);
  text-align: center;
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
}

.empty__title {
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--ink);
}

.empty__text {
  max-width: 42ch;
  font-size: var(--fs-13);
  color: var(--muted);
  line-height: 1.5;
}

.empty__action {
  margin-top: var(--sp-2);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  flex: none;
}

.spinner--dark {
  border-color: var(--line-2);
  border-top-color: var(--primary);
}

/* ---------- 16. Вспомогательные ----------------------------------------- */

.muted {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

.stack-4 > * + * {
  margin-top: var(--sp-4);
}

.stack-6 > * + * {
  margin-top: var(--sp-6);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: var(--sp-3);
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: var(--r-md);
  background: var(--warn-soft);
  color: var(--warn-ink);
  font-size: var(--fs-13);
  line-height: 1.45;
}

.notice svg {
  margin-top: 1px;
}

.notice strong {
  font-weight: 600;
}

.section-gap {
  margin-top: var(--sp-6);
}

.divider {
  width: 1px;
  height: 20px;
  background: var(--line);
  flex: none;
}

/* ---------- 17. Вход ----------------------------------------------------- */

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 46%) minmax(0, 1fr);
  background: var(--bg);
}

.login__aside {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 40px 48px 32px;
  background-color: #0b3d36;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 40px 40px;
  color: #eef4f1;
  overflow: hidden;
}

.login__aside::after {
  content: "";
  position: absolute;
  right: -160px;
  bottom: -180px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(127, 214, 196, 0.12), transparent 65%);
  pointer-events: none;
}

.login__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.login__brand:hover {
  text-decoration: none;
}

.login__brand .brand__mark {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.login__content {
  position: relative;
  z-index: 1;
  max-width: 470px;
  margin-top: 9vh;
}

.login__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.05);
  color: #a9c6be;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login__eyebrow svg {
  color: #7fd6c4;
}

.login__title {
  font-size: var(--fs-30);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: #f4f8f6;
  text-wrap: balance;
}

.login__text {
  margin-top: 14px;
  max-width: 40ch;
  font-size: var(--fs-14);
  line-height: 1.65;
  color: #a9c0b9;
}

.login__list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.login__list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: var(--fs-13);
  line-height: 1.5;
  color: #c2d5cf;
}

.login__list svg {
  margin-top: 2px;
  color: #7fd6c4;
}

.login__foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding-top: var(--sp-6);
  font-size: var(--fs-12);
  color: #7e9a92;
}

.login__foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Схема «УПД → две таблицы» */
.flow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.04);
  max-width: 450px;
}

.flow__file {
  width: 88px;
  flex: none;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.07);
}

.flow__file svg {
  color: #cfe3dd;
}

.flow__file-name {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #d8e8e3;
}

.flow__bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 7px;
}

.flow__bars i {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
}

.flow__bars i:nth-child(1) {
  width: 88%;
}

.flow__bars i:nth-child(2) {
  width: 66%;
}

.flow__bars i:nth-child(3) {
  width: 78%;
}

.flow__arrow {
  color: #7fd6c4;
  flex: none;
}

.flow__out {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.flow__table {
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.06);
}

.flow__cap {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a9c6be;
}

.flow__row {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.flow__row:last-child {
  margin-bottom: 0;
}

.flow__row i {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
}

.flow__row i.is-accent {
  background: #7fd6c4;
}

.flow__row i.is-warm {
  background: #e3b163;
}

.login__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login__form {
  width: 100%;
  max-width: 356px;
}

.login__mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--sp-8);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.login__form-title {
  font-size: var(--fs-24);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login__form-sub {
  margin-top: 6px;
  font-size: var(--fs-13);
  color: var(--muted);
}

.login__form .alert {
  margin-top: var(--sp-5);
  margin-bottom: 0;
}

.login__fields {
  margin-top: var(--sp-5);
}

.login__submit {
  margin-top: var(--sp-2);
}

.login__forgot {
  margin-top: var(--sp-4);
  text-align: center;
  font-size: var(--fs-13);
}

.login__forgot button {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--line-2);
}

.login__forgot button:hover {
  color: var(--primary);
}

.login__note {
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--fs-12);
  line-height: 1.5;
  color: var(--muted);
}

.login__note svg {
  margin-top: 1px;
  flex: none;
}

/* ---------- 18. Анимации ------------------------------------------------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

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

/* ---------- 19. Адаптивность (сервис desktop-first) --------------------- */

@media (max-width: 1180px) {
  :root {
    --gutter: 24px;
  }

  .legend__hint {
    display: none;
  }

  .stat {
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }
}

@media (max-width: 960px) {
  .nav {
    display: none;
  }

  .login {
    grid-template-columns: 1fr;
  }

  .login__aside {
    display: none;
  }

  .login__panel {
    min-height: 100vh;
    padding: 32px 24px;
  }

  .login__mobile-brand {
    display: flex;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-head__actions {
    justify-content: flex-start;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat {
    border-bottom: 1px solid var(--line);
  }

  .stat:nth-child(2n) {
    border-right: 0;
  }

  .stat:last-child {
    border-bottom: 0;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .table--wide {
    min-width: 980px;
  }
}

@media (max-width: 720px) {
  .appbar__inner {
    padding: 0 var(--sp-4);
    gap: var(--sp-4);
  }

  .user-btn__text {
    display: none;
  }

  .page {
    padding: var(--sp-5) var(--sp-4) var(--sp-8);
  }

  .dropzone {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
  }

  .upload-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .upload-foot__actions {
    width: 100%;
  }

  .toolbar {
    align-items: stretch;
  }

  .search {
    width: 100%;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .stat {
    border-right: 0;
  }

  .modal {
    padding: var(--sp-3);
  }
}

/* ---------- 20. Дополнения под конкретные экраны ------------------------ */

.filelist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  padding: var(--sp-4) 2px var(--sp-1);
  border-top: 1px solid var(--line);
}

.filelist-head__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.filelist-head__count {
  font-size: var(--fs-12);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stats-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px var(--sp-5);
  border-top: 1px solid var(--warn-line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: var(--warn-soft);
  color: var(--warn-ink);
  font-size: var(--fs-12);
  line-height: 1.5;
}

.stats-note svg {
  margin-top: 1px;
}

.stats-note strong {
  font-weight: 600;
}

.stat__value--warn {
  color: var(--warn-ink);
}

.sverka {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sverka--ok {
  color: var(--ok-ink);
}

.sverka--bad {
  color: var(--danger-ink);
}

.select--compact {
  width: auto;
  min-width: 190px;
  height: 36px;
  font-size: var(--fs-13);
}

.textarea {
  height: auto;
  min-height: 84px;
  padding: 9px 12px;
  line-height: 1.5;
  resize: vertical;
}

.password-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.password-row .input {
  flex: 1;
  min-width: 0;
}

.password-row .btn {
  flex: none;
}

.role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-13);
  color: var(--ink-2);
}

.role svg {
  color: var(--muted);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-cell__name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--ink);
}

.user-cell__login {
  margin-top: 1px;
  font-size: var(--fs-12);
  color: var(--muted);
}

.name-cell.is-editing .accept-btn {
  display: none;
}

.table td .badge {
  vertical-align: middle;
}

@media (max-width: 1180px) {
  .select--compact {
    min-width: 160px;
  }
}

@media (max-width: 720px) {
  .select--compact {
    width: 100%;
  }

  .filelist-head {
    margin-top: var(--sp-4);
  }
}
