/* Шрифты, фон и меню панели. Меню и движение - по стандарту дашборда BloomDeals
   (кривая cubic-bezier(.2,0,0,1), уход .16s, приход .24s/.36s). */
@font-face{font-family:'Fixel Text';src:url('/static/fonts/FixelText-Regular.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap;}
@font-face{font-family:'Fixel Text';src:url('/static/fonts/FixelText-Medium.woff2') format('woff2');font-weight:500;font-style:normal;font-display:swap;}
@font-face{font-family:'Fixel Text';src:url('/static/fonts/FixelText-SemiBold.woff2') format('woff2');font-weight:600;font-style:normal;font-display:swap;}
/* Цифры из Inter: у Fixel перечёркнутые ноль и семёрка. */
@font-face{font-family:'Fixel Text';src:url('/static/fonts/Inter-Regular.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap;unicode-range:U+0030-0039;}
@font-face{font-family:'Fixel Text';src:url('/static/fonts/Inter-Medium.woff2') format('woff2');font-weight:500;font-style:normal;font-display:swap;unicode-range:U+0030-0039;}
@font-face{font-family:'Fixel Text';src:url('/static/fonts/Inter-SemiBold.woff2') format('woff2');font-weight:600;font-style:normal;font-display:swap;unicode-range:U+0030-0039;}

:root { --ease: cubic-bezier(.2,0,0,1); }
html, body { background-color: rgb(var(--c-page)); color: rgb(var(--c-ink-900)); }
html { overscroll-behavior-y: none; }
body { font-family: 'Fixel Text', system-ui, sans-serif; -webkit-font-smoothing: antialiased;
    font-synthesis-weight: none; }
[x-cloak] { display: none !important; }
code, kbd, samp, pre { font-family: inherit; }
/* То, что браузер рисует внутри полей сам, не показываем. */
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
* { scrollbar-width: none; }
*::-webkit-scrollbar { width: 0; height: 0; }

/* Новый экран входит снизу на 16px за .36s, как вид в дашборде. */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .36s var(--ease) .06s both; }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }

/* ===== Меню =====
   Одна поверхность с фоном страницы. Залит только раздел, где ты сейчас: белая карточка. */
.sb { --sb-full: 280px; --sb-w: var(--sb-full); width: var(--sb-w); }
.sb-panel { display: flex; flex-direction: column; height: 100%; background: rgb(var(--c-page)); }
/* Шапка меню есть только в выдвижном меню телефона: в ней кнопка «закрыть». */
.sb-top { flex: 0 0 auto; position: relative; height: 64px; border-bottom: 1px solid rgb(var(--c-line)); }
@media (min-width: 1024px) { .sb-top { display: none; } }
.sb-nav { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 14px 11px;
    overflow-y: auto; overflow-x: hidden; }
.sb-row { display: flex; align-items: center; gap: 13px; height: 50px; padding: 0 14px; border-radius: 12px;
    color: rgb(var(--c-ink-900)); text-decoration: none; font-size: 16px; font-weight: 500; line-height: 1.1;
    white-space: nowrap; user-select: none;
    transition: background .13s, box-shadow .2s ease, gap .3s var(--ease); }
.sb-row:hover { background: rgb(var(--c-ink-900) / .06); }
.sb-row:focus-visible { outline: 2px solid rgb(var(--c-ink-900) / .35); outline-offset: -2px; }
.sb-row:active { background: rgb(var(--c-ink-900) / .11); transform: scale(.985); }
.sb-ico { width: 22px; height: 22px; flex: 0 0 22px; display: block; }
.sb-lbl { flex: 1 1 auto; min-width: 0; transition: opacity .26s ease .12s; }
.sb-row--on, .sb-row--on:hover { background: rgb(var(--c-surface));
    box-shadow: var(--shadow-card), 0 0 0 1px rgb(var(--c-line)); font-weight: 600; }
.dark .sb-row--on, .dark .sb-row--on:hover { background: rgb(var(--c-surface-sunken));
    box-shadow: 0 0 0 1px rgb(var(--c-line-strong)); }
/* Низ: язык и тема слева, выход справа. */
.sb-foot { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px 12px; border-top: 1px solid rgb(var(--c-line)); transition: padding .3s var(--ease); }
.sb-tools { display: flex; align-items: center; gap: 4px;
    transition: opacity .26s ease .12s, width .3s var(--ease); }
.sb-tool { width: 42px; height: 42px; flex: 0 0 42px; display: flex; align-items: center; justify-content: center;
    padding: 0; border: none; border-radius: 10px; background: transparent; color: rgb(var(--c-ink-900));
    cursor: pointer; transition: background .13s; }
.sb-tool:hover { background: rgb(var(--c-ink-900) / .06); }
.sb-tool:focus-visible { outline: 2px solid rgb(var(--c-ink-900) / .35); outline-offset: -2px; }
.sb-tool svg { width: 21px; height: 21px; flex: 0 0 21px; }
.sb-lang { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 10px;
    background: rgb(var(--c-ink-900) / .06); }
.sb-lang-opt { padding: 6px 11px; border-radius: 8px; color: rgb(var(--c-ink-900)); text-decoration: none;
    font: 600 14px/1 'Fixel Text', system-ui, sans-serif; letter-spacing: .02em; transition: background .13s; }
@media (pointer: coarse) { .sb-lang-opt { display: flex; align-items: center; height: 44px; padding: 0 14px; }
  .sb-tool { width: 44px; height: 44px; flex-basis: 44px; }
  .btn-quiet { height: 44px; } }
.sb-lang-opt--on { background: rgb(var(--c-surface)); box-shadow: 0 1px 2px rgb(var(--c-ink-900) / .12); }
.sb-lang-opt:focus-visible { outline: 2px solid rgb(var(--c-ink-900) / .35); outline-offset: -2px; }
.sb-ico-sun { display: none; }
.dark .sb-ico-sun { display: block; }
.dark .sb-ico-moon { display: none; }
.sb-close { position: absolute; top: 12px; right: 10px; width: 40px; height: 40px; display: flex;
    align-items: center; justify-content: center; border: none; background: transparent; border-radius: 10px;
    cursor: pointer; color: rgb(var(--c-ink-900)); }
.sb-close:hover { background: rgb(var(--c-ink-900) / .06); }
@media (min-width: 1024px) { .sb-close { display: none; } }

/* ===== Переход между страницами =====
   Старый кадр держится, пока не готов новый, и плавно сменяется. Меню названо отдельно,
   поэтому стоит на месте, меняется только содержимое. */
@view-transition { navigation: auto; }
.sb { view-transition-name: sb; }
::view-transition-old(root), ::view-transition-new(root),
::view-transition-old(sb), ::view-transition-new(sb) { animation-duration: .16s; animation-timing-function: var(--ease); }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ===== Рейка иконок (мышь) =====
   С мышью меню - полоса иконок, под курсором раскрывается поверх страницы, страница не сдвигается.
   Класс html.sb-rail ставится до первой отрисовки (base.html). */
@media (min-width: 1024px) {
  .sb-rail .sb { --sb-w: 72px; }
  .sb-panel { position: absolute; inset: 0 auto 0 0; width: var(--sb-w); overflow: hidden;
      transition: width .3s var(--ease), border-radius .3s ease, box-shadow .3s ease; }
  /* Закрыта, пока её ничто не держит: курсор (:hover), фокус с клавиатуры (.sb-kbd) или переход
     между страницами под курсором (.sb-peek). Клик мышью фокусирует строку, поэтому не :focus-within. */
  .sb-rail:not(.sb-peek) .sb:not(:hover):not(.sb-kbd) .sb-lbl { opacity: 0; transition: opacity .14s ease; }
  .sb-rail:not(.sb-peek) .sb:not(:hover):not(.sb-kbd) .sb-row { gap: 0; }
  .sb-rail:not(.sb-peek) .sb:not(:hover):not(.sb-kbd) .sb-tools { opacity: 0; width: 0; overflow: hidden;
      pointer-events: none; transition: opacity .14s ease, width .3s var(--ease); }
  .sb-rail:not(.sb-peek) .sb:not(:hover):not(.sb-kbd) .sb-foot { padding-left: 15px; padding-right: 15px; }
  .sb-rail.sb-peek .sb-panel, .sb-rail .sb:hover .sb-panel, .sb-rail .sb.sb-kbd .sb-panel { width: var(--sb-full);
      border-radius: 0 18px 18px 0; box-shadow: 0 18px 44px rgb(var(--c-ink-900) / .16); }
}
@media (prefers-reduced-motion: reduce) {
  .sb, .sb-panel, .sb-row, .sb-lbl, .sb-foot, .sb-tools { transition: none !important; }
}

/* ===== Содержимое разделов ===== */
.card { background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 14px;
    box-shadow: var(--shadow-card); }
/* Пилюля: сплошная заливка, текст чёрный или белый. */
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px;
    font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; flex: 0 0 auto; }
.pill-ink { background: rgb(var(--c-ink-900)); color: rgb(var(--c-surface)); }
.pill-warn { background: rgb(var(--c-ink-900)); color: rgb(var(--c-surface)); }
/* Рабочий файл: единственный зелёный в панели, в обеих темах тёмно-зелёный с белым текстом. */
.pill-ok { background: rgb(var(--c-ok-700)); color: #fff; }
.dark .pill-ok { background: rgb(21 128 61); color: #fff; }  /* значение --c-ok-700 светлой темы */

/* Список справочников: выбранный - белая карточка, как раздел в меню, но строки с линиями. */
.ref-list { display: flex; flex-direction: column; gap: 4px; }
.ref-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; border-radius: 12px;
    color: rgb(var(--c-ink-900)); text-decoration: none; transition: background .13s, box-shadow .2s ease; }
.ref-row:hover { background: rgb(var(--c-ink-900) / .06); }
.ref-row:active { background: rgb(var(--c-ink-900) / .11); transform: scale(.985); }
.ref-row:focus-visible { outline: 2px solid rgb(var(--c-ink-900) / .35); outline-offset: -2px; }
@media (min-width: 1024px) {
  .ref-row--on, .ref-row--on:hover { background: rgb(var(--c-surface));
      box-shadow: var(--shadow-card), 0 0 0 1px rgb(var(--c-line)); }
  .dark .ref-row--on, .dark .ref-row--on:hover { background: rgb(var(--c-surface-sunken));
      box-shadow: 0 0 0 1px rgb(var(--c-line-strong)); }
}
@media (max-width: 1023.98px) {
  .ref-list { background: rgb(var(--c-surface)); border: 1px solid rgb(var(--c-line)); border-radius: 14px; gap: 0; }
  .ref-row { border-radius: 0; }
  .ref-row + .ref-row { border-top: 1px solid rgb(var(--c-line)); }
}

/* Факты о рабочей версии и цифры отчёта: подпись над значением, колонки по ширине. */
.ref-stats { display: grid; gap: 16px 32px; grid-template-columns: repeat(auto-fit, minmax(160px, max-content)); }
.ref-stats dt { font-size: 14px; color: rgb(var(--c-ink-500)); }
.ref-stats dd { font-size: 24px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
@media (max-width: 639.98px) {
  .ref-stats { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
}

.ref-line { display: flex; gap: 12px; padding: 6px 0; font-size: 15px; line-height: 1.4; }
.ref-line-no { flex: 0 0 96px; color: rgb(var(--c-ink-500)); white-space: nowrap; }

/* Таблица: как ux-table дашборда, без зебры. */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
.tbl th { height: 44px; padding: 0 12px; text-align: left; font-size: 14px; font-weight: 600;
    color: rgb(var(--c-ink-500)); background: rgb(var(--c-surface-alt)); border-bottom: 1px solid rgb(var(--c-line)); }
.tbl td { height: 48px; padding: 6px 12px; border-bottom: 1px solid rgb(var(--c-line)); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: 24px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 24px; }
.tbl tbody tr:hover td { background: rgb(var(--c-surface-alt)); }
.tbl-flush th:first-child, .tbl-flush td:first-child { padding-left: 0; }
.tbl-flush th:last-child, .tbl-flush td:last-child { padding-right: 0; }
.tbl-flush th { background: transparent; }
@media (max-width: 767.98px) {
  .tbl-flush th:first-child, .tbl-flush td:first-child { padding-left: 20px; }
  .tbl-flush th:last-child, .tbl-flush td:last-child { padding-right: 20px; }
}
.tbl th.text-right { text-align: right; }

/* Прокрутка списка файлов внутри карточки: полосы не видно, шапка таблицы прилипает к верху,
   внизу затухание, пока есть что прокручивать. */
.ref-scroll { scrollbar-width: none; }
.ref-scroll::-webkit-scrollbar { display: none; }
.ref-scroll .tbl th { position: sticky; top: 0; z-index: 1; }
.ref-scroll.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }

/* Строка ответа на действие: место под одну строку (на телефоне под две) есть всегда,
   сообщения лежат друг на друге, поэтому появление и исчезновение ничего не двигает. */
.ref-status { position: relative; height: 22px; margin-top: 8px; font-size: 15px; line-height: 22px; font-weight: 500; }
.ref-status > p { position: absolute; inset: 0; overflow: hidden; }
@media (max-width: 639px) { .ref-status { height: 44px; } }

@media (pointer: coarse) { .sb-close { width: 44px; height: 44px; top: 10px; right: 8px; } }

/* ===== Прецеденты ===== */
/* Переключатель как выбор языка в меню: выбранное - белая плашка. Толщина шрифта одна, ширина не меняется. */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 10px;
    background: rgb(var(--c-ink-900) / .06); }
.seg-opt { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 14px;
    border-radius: 8px; font-size: 15px; font-weight: 500; white-space: nowrap; color: rgb(var(--c-ink-700));
    cursor: pointer; user-select: none; transition: background .13s, color .13s; }
.seg-opt:hover { color: rgb(var(--c-ink-900)); }
.seg-opt:has(input:checked) { background: rgb(var(--c-surface)); color: rgb(var(--c-ink-900));
    box-shadow: 0 1px 2px rgb(var(--c-ink-900) / .12); }
.dark .seg-opt:has(input:checked) { background: rgb(var(--c-surface-sunken)); }
.seg-opt:has(input:focus-visible) { outline: 2px solid rgb(var(--c-ink-900)); outline-offset: -2px; }
.seg-opt:active { transform: scale(.97); }
.seg-n { color: rgb(var(--c-ink-500)); font-variant-numeric: tabular-nums; }
/* Вкладки статуса забирают свободную ширину строки до кнопок: без пустоты между ними. */
/* Телефон: переключатель на всю ширину, по два варианта в ряд. */
@media (max-width: 639.98px) { .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; } }
@media (pointer: coarse) { .seg-opt { height: 44px; } }

.pc-row { cursor: pointer; }

/* Панель прецедента: выезжает справа поверх страницы, приход .36s, уход .2s. */
/* Рамка размером с окно: спрятанная за правым краем панель не растягивает страницу вбок. */
.sheet-wrap { position: fixed; inset: 0; z-index: 45; overflow: hidden; pointer-events: none; }
.sheet-back { position: absolute; inset: 0; background: rgb(0 0 0 / .4); opacity: 0; pointer-events: none;
    transition: opacity .2s var(--ease); }
.sheet-back--on { opacity: 1; pointer-events: auto; transition-duration: .36s; }
.sheet { position: absolute; top: 0; right: 0; bottom: 0; pointer-events: auto; width: min(560px, 100vw); display: flex;
    flex-direction: column; background: rgb(var(--c-surface)); border-left: 1px solid rgb(var(--c-line));
    box-shadow: var(--shadow-soft); transform: translateX(100%); visibility: hidden;
    transition: transform .2s var(--ease), visibility 0s .2s; }
.sheet--on { transform: none; visibility: visible; transition: transform .36s var(--ease), visibility 0s; }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet--on, .sheet-back { transition: none; } }
.sheet-head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 12px 0 24px;
    border-bottom: 1px solid rgb(var(--c-line)); }
.sheet-head h2:focus { outline: none; }
.sheet-x { margin-left: auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    border-radius: 10px; color: rgb(var(--c-ink-900)); }
.sheet-x:hover { background: rgb(var(--c-ink-900) / .06); }
.sheet-x:focus-visible { outline: 2px solid rgb(var(--c-ink-900)); outline-offset: -2px; }
.sheet-form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 24px 24px; }
.sheet-foot { flex: 0 0 auto; padding: 8px 24px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid rgb(var(--c-line)); }
.sheet-facts { display: grid; gap: 12px; }
.sheet-facts dt { font-size: 14px; color: rgb(var(--c-ink-500)); }
.sheet-facts dd { font-size: 15px; line-height: 1.4; margin-top: 2px; }
@media (max-width: 639.98px) {
  .sheet-head { padding-left: 20px; }
  .sheet-body { padding: 16px 20px 20px; }
  .sheet-foot { padding-left: 20px; padding-right: 20px; }
}
/* Многострочное поле: растёт по тексту. */
.inp-area { height: auto; min-height: 44px; padding: 10px 14px; line-height: 1.4; resize: none; field-sizing: content; }
/* Под полем «Код» название кода из дерева номенклатуры или ошибка; поле последнее, рост сдвигает только текст ниже. */
.pc-code { min-height: 20px; margin-top: 6px; font-size: 14px; line-height: 20px; color: rgb(var(--c-ink-500)); }

/* Заголовок таблиці, що сортує: стрілка займає місце завжди; у неактивного стовпця її видно тільки під курсором або фокусом. */
.th-sort { display: inline-flex; align-items: center; gap: 6px; height: 44px; margin: 0 -4px; padding: 0 4px;
    font: inherit; color: inherit; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.th-sort-ico { width: 16px; height: 16px; flex: none; opacity: 0; transition: opacity .15s; }
.th-sort:hover { color: rgb(var(--c-ink-900)); }
.th-sort:hover .th-sort-ico, .th-sort:focus-visible .th-sort-ico { opacity: .6; }
.th-sort--on { color: rgb(var(--c-ink-900)); }
.th-sort--on .th-sort-ico { opacity: 1; }
.th-sort:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }

/* Таблиця прецедентів: кожна колонка за вмістом, лишня ширина ділиться між колонками порівну,
   тому проміжки однакові. Довгий товар і обґрунтування переносяться після 65 знаків. */
@media (min-width: 768px) {
    .pc-tbl { display: grid; grid-template-columns: repeat(var(--pc-cols), auto); }
    .pc-tbl thead, .pc-tbl tbody, .pc-tbl tr { display: contents; }
    .pc-tbl th { display: flex; align-items: center; }
    .pc-tbl td { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; height: auto; min-height: 48px; }
    .pc-tbl td > * { max-width: 65ch; }
}

/* Правила: строка списка целиком кнопка; выбор вида правила в панели в две строки, подписи длинные. */
.rl-row { display: block; width: 100%; text-align: left; padding: 14px 20px; cursor: pointer; }
.rl-row:hover { background: rgb(var(--c-surface-alt)); }
.rl-row:focus-visible { outline: 2px solid rgb(var(--c-ink-900) / .35); outline-offset: -2px; }
@media (min-width: 1024px) { .rl-row { padding: 14px 24px; } }
.seg.seg-col { display: grid; grid-template-columns: 1fr; width: 100%; }
.seg.seg-col .seg-opt { justify-content: flex-start; }
