/* =====================================================================
   ГлавПак — фирменные стили интерфейса.
   Дизайн-система по фирменному стилю ГЛАВПАК: базовый графит #2E3238,
   единственный акцент — охра #C8873A, тёплый бежевый фон #F4F1EC,
   шрифт Manrope (500/600/700/800). Знак — квадрат, рассечённый крестом.
   Шрифты подключаются локально (static/fonts/fonts.css) — без CDN,
   приложение полностью офлайн (требование для депонирования РИД).

   Токены сохраняют прежние имена (--blue/--orange), но несут фирменные
   значения: --blue* = графит/нейтраль (сайдбар, подтверждающие кнопки,
   заголовки), --orange* = охра (единственный акцент — главные действия,
   активные пункты, ссылки). Так вся вёрстка перекрашивается согласованно.
   ===================================================================== */

/* ---------- Палитра и базовые токены ---------- */
:root {
  /* Графит / нейтраль (бывший «синий») — сайдбар, тёмные поверхности,
     заголовки, вторичные кнопки. */
  --blue:        #2E3238;   /* графит (базовый) */
  --blue-dark:   #1C2025;   /* подвал (тёмный графит) */
  --blue-mid:    #3A4048;
  --blue-light:  #ECEAE4;   /* тёплый серо-бежевый тинт */
  --blue-xlight: #F7F5F1;
  /* Охра — единственный фирменный акцент (немного ярче для живости). */
  --orange:      #D98A2B;   /* охра, насыщённее */
  --orange-dark: #A0641C;   /* охра тёмная — ховеры, ссылки, заголовки разделов */
  --orange-light:#FBEAD0;   /* охряной тинт (подложки) */
  --bg:          #F4F1EC;   /* тёплый бежевый фон страницы */
  --surface:     #FFFFFF;
  --surface2:    #FAF8F3;
  --border:      #E1DCD1;   /* мягкий хайрлайн */
  --border2:     #C9C5BE;   /* хайрлайн (бренд) */
  --text:        #23272C;   /* текст основной */
  --text2:       #3B4048;
  --muted:       #5C6169;   /* текст вторичный */
  --ok:          #5E7D52;   /* приглушённый зелёный (семантика) */
  --warn:        #B5791F;   /* охристо-янтарный (предупреждение) */
  --danger:      #B0473A;   /* сдержанный красный (ошибка/срыв срока) */
  --info:        #55606E;   /* графит-сланец (нейтральная семантика) */
  --sidebar-w:   252px;
  --font:        'Manrope', 'Segoe UI', sans-serif; /* заголовки, кнопки, акценты */
  --font-b:      'Manrope', 'Segoe UI', sans-serif; /* основной текст */
  --sh:          0 2px 14px rgba(46,50,56,0.07);
  --sh-lg:       0 10px 34px rgba(28,32,37,0.14);
  --r:           12px;
  --bumaga:      #FFFFFF;   /* лист печатной формы — белый в любой теме */
  --chernila:    #000000;   /* текст печатной формы */

  /* Фирменные роли (для явных обращений) */
  --graphite:    #2E3238;
  --ochre:       #D98A2B;
  --ochre-dark:  #A0641C;
  --hairline:    #C9C5BE;

  /* Совместимость со старыми именами переменных */
  --logo-bordo:  #2E3238;
  --bordo:       var(--blue);
  --bordo-dark:  var(--blue-dark);
  --orange-soft: #EAD6BB;
  --cream:       var(--surface2);
  --cream-card:  var(--surface2);
  --rule:        var(--border);
  --ink:         var(--text);
  --white:       #FFFFFF;
  --shadow:      var(--sh);
  --radius:      var(--r);

  /* Текст заголовков и цифр (в тёмной теме — светлый) */
  --heading:     var(--blue);
  /* Подложки состояний */
  --danger-bg:   #fee2e2;
  --danger-bg2:  #fecaca;
  --ok-bg:       #dcfce7;
  --ok-border:   #bbf7d0;
  --ok-text:     #15803d;
  --warn-bg:     #fef9c3;
  --warn-border: #fde68a;
  --warn-text:   #854d0e;
  color-scheme: light;
}

/* ---------- Базовый сброс и типографика ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  min-height: 100vh;
}
a { color: var(--orange-dark); text-decoration: none; }
a:hover { color: var(--orange); }
h1, h2, h3, h4 { font-family: var(--font); }
button { font-family: var(--font); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   ТЁМНАЯ ТЕМА
   Включается переключателем в шапке (атрибут data-theme="dark" у <html>)
   или по настройке системы, если пользователь тему не выбирал.
   Меняются только токены палитры; фирменная охра остаётся акцентом.
   ===================================================================== */
:root[data-theme="dark"] {
  --blue:        #3A414B;   /* графит кнопок и активных вкладок */
  --blue-dark:   #0E1012;
  --blue-mid:    #4A525E;
  --blue-light:  #2A2E34;
  --blue-xlight: #202327;
  --orange:      #D98A2B;
  --orange-dark: #E0A257;   /* охра для текста и ссылок — светлее на тёмном */
  --orange-light:#3A2C1A;
  --orange-soft: #4A3920;
  --bg:          #141619;
  --surface:     #1C1F23;
  --surface2:    #23272C;
  --border:      #33373E;
  --border2:     #4A4F57;
  --text:        #E7E3DB;
  --text2:       #D2CDC4;
  --muted:       #9C9FA5;
  --ok:          #8DB37E;
  --warn:        #D9A04A;
  --danger:      #E58373;
  --info:        #9AA6B5;
  --sh:          0 2px 14px rgba(0,0,0,0.35);
  --sh-lg:       0 10px 34px rgba(0,0,0,0.5);
  --heading:     #F1EDE5;
  --danger-bg:   #3B2421;
  --danger-bg2:  #4A2B27;
  --ok-bg:       #213021;
  --ok-border:   #2F4A2F;
  --ok-text:     #9CCB8C;
  --warn-bg:     #3A3219;
  --warn-border: #5A4A1F;
  --warn-text:   #E4C47A;
  color-scheme: dark;
}
:root[data-theme="dark"] .sidebar { background: linear-gradient(168deg, #0E1012 0%, #1A1D21 100%); box-shadow: 4px 0 28px rgba(0,0,0,0.4); }
:root[data-theme="dark"] .modal__backdrop { background: rgba(0,0,0,0.6); }
:root[data-theme="dark"] .vhod__brand rect { fill: #3A414B; }
:root[data-theme="dark"] img, :root[data-theme="dark"] video { filter: brightness(0.92); }
/* Пастельные подложки статусов и приоритетов — приглушённые на тёмном */
:root[data-theme="dark"] .badge--ok                 { background: #243022; color: #A6C496; }
:root[data-theme="dark"] .status-badge.st-accepted  { background: #3A311C; color: #E2BF72; }
:root[data-theme="dark"] .status-badge.st-payment   { background: #2E2938; color: #BFB0D8; }
:root[data-theme="dark"] .status-badge.st-packing   { background: #263021; color: #A9C68C; }
:root[data-theme="dark"] .status-badge.st-ready     { background: #1F3022; color: #8FC79A; }
:root[data-theme="dark"] .status-badge.st-shipped   { background: #252B33; color: #A7B6C8; }
:root[data-theme="dark"] .stage-count               { --num-c: var(--heading); }
:root[data-theme="dark"] .prio-1, :root[data-theme="dark"] .prio-2, :root[data-theme="dark"] .prio-3 { background: #3B2421; color: #EE9A8C; }
:root[data-theme="dark"] .prio-4, :root[data-theme="dark"] .prio-5, :root[data-theme="dark"] .prio-6 { background: #3A2A18; color: #EBAE6A; }
:root[data-theme="dark"] .prio-7, :root[data-theme="dark"] .prio-8, :root[data-theme="dark"] .prio-9 { background: #35301A; color: #DCC377; }
:root[data-theme="dark"] .prio-10, :root[data-theme="dark"] .prio-11, :root[data-theme="dark"] .prio-12 { background: #23301E; color: #A3C98E; }
:root[data-theme="dark"] .prio-13, :root[data-theme="dark"] .prio-14, :root[data-theme="dark"] .prio-15, :root[data-theme="dark"] .prio-0 { background: #2A2D31; color: #A9ADB4; }
:root[data-theme="dark"] .plan-card.is-late { border-color: #6B3A33; background: #2E201E; }

/* Переключатель темы в шапке */
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  background: var(--surface); color: var(--text2);
  border: 1.5px solid var(--border2);
}
.theme-btn:hover { border-color: var(--orange); color: var(--orange-dark); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .ic-sun { display: none; }
:root[data-theme="dark"] .theme-btn .ic-sun { display: block; }
:root[data-theme="dark"] .theme-btn .ic-moon { display: none; }
.vhod-theme { position: fixed; top: 16px; right: 16px; }

/* =====================================================================
   КАРКАС: сайдбар + рабочая область
   ===================================================================== */
.layout { display: flex; height: 100vh; overflow: hidden; }
.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

/* ---------- Левый сайдбар: синий градиент ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(168deg, var(--blue-dark) 0%, var(--blue) 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 28px rgba(15,50,120,0.22);
}

/* Шапка сайдбара: логотип (бордовый знак — фирменный) + подзаголовки */
.brand { padding: 22px 22px 16px; border-bottom: 1px solid rgba(255,255,255,0.10); }
.brand__row { display: flex; align-items: center; gap: 11px; }
.brand__mark { flex: none; border-radius: 8px; }
.brand__name {
  font-family: var(--font);
  font-weight: 900;
  font-size: 19px;
  letter-spacing: 0.5px;
  color: #fff;
}
.brand__sub {
  margin-top: 8px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}
.brand__desc { font-size: 9.5px; color: rgba(255,255,255,0.32); margin-top: 6px; line-height: 1.5; letter-spacing: 0.3px; }

/* ---------- Навигация ---------- */
.nav { padding: 12px 0; flex: 1; overflow-y: auto; }
.nav__group-title {
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.28);
  font-family: var(--font);
  font-weight: 700;
  padding: 14px 22px 5px;
  text-transform: uppercase;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  transition: all 0.15s;
  border-left: 3px solid transparent;
  font-family: var(--font);
}
.nav__item:hover { color: rgba(255,255,255,0.92); background: rgba(255,255,255,0.07); }
.nav__item.is-active { color: #fff; border-left-color: var(--orange); background: rgba(255,255,255,0.10); }
.nav__item svg { flex: none; }
.nav-ico { width: 20px; text-align: center; font-size: 15px; flex: none; }
.nav-badge {
  margin-left: auto;
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font);
  padding: 1px 8px;
  border-radius: 10px;
}
.nav__chevron { margin-left: auto; transition: transform 0.2s; opacity: 0.5; width: 12px; height: 12px; }
.nav__item.is-open .nav__chevron { transform: rotate(90deg); }

/* Подпункты (месяцы реестра заявок) */
.nav__sub { overflow: hidden; max-height: 0; transition: max-height 0.25s ease; }
.nav__sub.is-open,
.nav__item.is-open + .nav__sub { max-height: 280px; }
.nav__subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 22px 7px 44px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  transition: all 0.15s;
  border-left: 3px solid transparent;
  font-family: var(--font);
}
.nav__subitem:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.06); }
.nav__subitem.is-active { color: #fff; border-left-color: var(--orange); background: rgba(255,255,255,0.10); }
.nav__subitem .dot,
.month-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: rgba(255,255,255,0.35); }
.dot-curr { background: var(--orange); }
.dot-next { background: #4ade80; }
.sub-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
}

/* ---------- Низ сайдбара: экспорт/импорт + контакты ---------- */
.sidebar__footer { padding: 14px 22px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.io-buttons { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.io-buttons button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 0;
  cursor: pointer;
  transition: all 0.15s;
}
.io-buttons button:hover { background: rgba(255,255,255,0.16); color: #fff; }
.io-buttons button svg { width: 15px; height: 15px; }
.contacts { font-size: 10px; color: rgba(255,255,255,0.30); line-height: 1.85; }
.contacts a { color: rgba(255,255,255,0.48); }
.contacts a:hover { color: var(--orange); }
.contacts__phone { font-weight: 700; color: rgba(255,255,255,0.48); }

/* ---------- Верхняя панель страницы ---------- */
.topbar {
  padding: 0 0 0 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
  flex-shrink: 0;
  min-height: 68px;
}
.topbar__left { display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 14px 0; }
.topbar__title { font-family: var(--font); font-weight: 800; font-size: 20px; color: var(--heading); }
.topbar__title .accent { color: var(--orange); }
.topbar__subtitle { font-size: 12px; color: var(--muted); }
.topbar__right { display: flex; align-items: center; gap: 8px; padding: 0 20px; }

/* ---------- Рабочая область ---------- */
.content { padding: 22px 28px; flex: 1; animation: fadeIn 0.2s ease; }

/* =====================================================================
   КОМПОНЕНТЫ: карточки, кнопки, бейджи, формы
   ===================================================================== */

/* Сетка карточек (Рецептуры — 3 в ряд) */
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1100px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .cards-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 18px;
}
.card__title { font-family: var(--font); font-weight: 800; font-size: 16px; color: var(--heading); }

/* Кнопки */
.btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
/* Оранжевая — главное действие страницы («＋ Новая заявка») */
.btn--primary { background: var(--orange); color: #fff; box-shadow: 0 2px 10px rgba(242,101,34,0.28); }
.btn--primary:hover { background: var(--orange-dark); transform: translateY(-1px); }
/* Синяя — подтверждающие действия в формах */
.btn--bordo { background: var(--blue); color: #fff; box-shadow: 0 2px 10px rgba(27,79,163,0.28); }
.btn--bordo:hover { background: var(--blue-mid); box-shadow: 0 4px 14px rgba(27,79,163,0.36); transform: translateY(-1px); }
/* Контурная */
.btn--ghost { background: var(--surface); border: 1.5px solid var(--border2); color: var(--text2); font-weight: 600; }
.btn--ghost:hover { border-color: var(--blue); color: var(--heading); }
.btn--danger-ghost { background: var(--danger-bg); color: var(--danger); border: none; font-weight: 600; }
.btn--danger-ghost:hover { background: var(--danger-bg2); }
.btn--sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }

/* Бейджи статусов и категорий */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge--orange { background: var(--orange-light); color: var(--orange-dark); }
.badge--bordo  { background: var(--blue-light); color: var(--heading); }
.badge--ok     { background: #E4EADD; color: #4C6A40; }
.badge--warn   { background: var(--danger-bg); color: var(--danger); }

/* Точка-индикатор внутри бейджа (как в референсе) */
.bdot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: currentColor; opacity: 0.7; }

/* Полоска-индикатор доли компонента */
.share-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.share-bar__fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--orange)); }

/* Заглушка «Раздел в разработке» */
.stub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.stub__icon { width: 64px; height: 64px; margin-bottom: 18px; opacity: 0.5; }
.stub__title { font-family: var(--font); font-size: 20px; font-weight: 800; color: var(--heading); margin-bottom: 6px; }
.stub__text { max-width: 420px; }

/* Дашборд главной страницы */
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.dash-card:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }
.dash-card__mark {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--blue), var(--blue-mid));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.dash-card__title { font-family: var(--font); font-size: 17px; font-weight: 800; color: var(--heading); }
.dash-card__text { color: var(--muted); font-size: 13px; }
.dash-card__link { margin-top: auto; color: var(--orange); font-weight: 700; font-size: 13px; font-family: var(--font); }

/* Информационная плашка-приветствие */
.welcome {
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
  color: #fff;
  border-radius: 16px;
  padding: 26px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.welcome h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.welcome p { color: rgba(255,255,255,0.8); max-width: 560px; font-size: 14px; }
.welcome__since {
  position: absolute; top: 20px; right: 24px;
  background: var(--orange); color: #fff;
  font-family: var(--font);
  font-weight: 800; font-size: 12px;
  padding: 4px 12px; border-radius: 20px;
}
.welcome__watermark { position: absolute; right: -20px; bottom: -40px; opacity: 0.08; pointer-events: none; }

/* Сноска про пример-данные */
.demo-note { margin-top: 22px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }

/* =====================================================================
   ПАНЕЛЬ УПРАВЛЕНИЯ РАЗДЕЛОВ: поиск, фильтры, переключатели
   ===================================================================== */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  flex: 1 1 240px;
  min-width: 200px;
  color: var(--muted);
  transition: border 0.15s;
}
.toolbar__search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27,79,163,0.09); }
.toolbar__search input {
  border: none;
  outline: none;
  font-family: var(--font-b);
  font-size: 13px;
  padding: 9px 0;
  width: 100%;
  background: transparent;
  color: var(--text);
}

.select {
  font-family: var(--font-b);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
}
.select:focus { border-color: var(--blue); }

/* Переключатели вида и сортировки */
.view-switch, .sort-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.view-switch button, .sort-toggle button {
  border: none;
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
}
.view-switch button + button, .sort-toggle button + button { border-left: 1px solid var(--border); }
.view-switch button.is-active, .sort-toggle button.is-active { background: var(--blue); color: #fff; }

/* =====================================================================
   РАЗДЕЛ «РЕЦЕПТУРЫ»: карточки, таблица, модальная форма
   ===================================================================== */
.recipe-card { display: flex; flex-direction: column; gap: 12px; position: relative; }
.recipe-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.recipe-card__code { font-family: var(--font); font-weight: 800; font-size: 18px; color: var(--heading); }
.recipe-card__meta {
  font-size: 10px; color: var(--muted); margin-top: 3px;
  font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
}

/* Строка компонента с полоской доли */
.comp-row { display: flex; flex-direction: column; gap: 4px; }
.comp-row__top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text2); }
.comp-row__share { font-weight: 800; color: var(--heading); }

.recipe-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.recipe-card__sum { font-size: 12px; color: var(--muted); }
.recipe-card__actions { display: flex; gap: 6px; }
.icon-btn {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 7px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.12s;
}
.icon-btn:hover { color: var(--heading); border-color: var(--blue); }
.icon-btn--danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

.example-tag {
  position: absolute;
  top: -8px; right: -8px;
  background: var(--orange-light);
  color: var(--orange-dark);
  font-family: var(--font);
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}

/* ---- Таблица ---- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh);
  overflow: hidden;
  overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  font-size: 10px;
  font-family: var(--font);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  background: var(--surface2);
  white-space: nowrap;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover td { background: var(--blue-xlight); }
.data-table .t-code { font-family: var(--font); font-weight: 800; color: var(--heading); }
.data-table .t-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); font-family: var(--font); font-size: 13px; }

/* ---- Модальное окно ---- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(10,28,80,0.55); backdrop-filter: blur(5px); }
.modal__box {
  position: relative;
  margin: auto;
  background: var(--surface);
  width: 600px;
  max-width: calc(100vw - 32px);
  max-height: 92vh;
  border-radius: 16px;
  box-shadow: var(--sh-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal__box--wide { width: 760px; }
.modal__box--narrow { width: 420px; }
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--blue-xlight), var(--surface2));
}
.modal__head h3 { font-family: var(--font); font-size: 17px; font-weight: 800; color: var(--heading); }
.modal__close {
  border: none; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: background 0.1s;
}
.modal__close:hover { background: var(--border); color: var(--text); }
.modal__body { padding: 20px 24px; overflow-y: auto; }
.modal__foot {
  display: flex; align-items: center; gap: 8px;
  justify-content: flex-end;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.modal__hint { font-size: 12px; color: var(--warn); margin-right: auto; }

/* ---- Поля формы ---- */
.form-row { display: flex; gap: 14px; }
.form-row .form-field { flex: 1; }
.form-row--3 .form-field { flex: 1; }
.form-field { margin-bottom: 14px; }
.form-field label {
  display: block;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text2);
  margin-bottom: 6px;
}
.form-field input[type=text],
.form-field input[type=number],
.form-field input[type=date],
.form-field input[type=password],
.form-field textarea,
.form-field select {
  width: 100%;
  font-family: var(--font-b);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
  transition: border 0.15s;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27,79,163,0.08); }
.form-field textarea { resize: vertical; min-height: 60px; }
.form-field--checkbox label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); cursor: pointer;
  font-family: var(--font-b); font-weight: 500; text-transform: none; letter-spacing: 0;
}
.form-field--checkbox input { width: auto; }

/* Строки состава в форме */
.item-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.item-row select { flex: 1; }
.item-row .item-share { width: 90px; flex: 0 0 90px; }
.item-row .item-del {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 7px;
  width: 34px; height: 34px;
  cursor: pointer; color: var(--muted);
  flex: 0 0 34px;
}
.item-row .item-del:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

/* Контроль суммы долей */
.share-total {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.share-total.is-ok  { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.share-total.is-bad { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bg2); }
.share-total strong { font-size: 15px; font-family: var(--font); }

/* =====================================================================
   РАЗДЕЛ «ПОДБОР»: две колонки (параметры | рекомендация)
   ===================================================================== */
.podbor { display: grid; grid-template-columns: 380px 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px) { .podbor { grid-template-columns: 1fr; } }

.podbor__form .card__title { margin-bottom: 16px; }
.podbor__run { width: 100%; justify-content: center; margin-top: 6px; }

.result-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--muted);
  padding: 60px 30px;
  gap: 14px;
}
.result-empty__icon { color: var(--border2); }

.result-doc__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.result-doc__actions { display: flex; gap: 8px; }

/* Сводка входных параметров */
.result-params {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.result-params .chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text);
}
.result-params .chip b { color: var(--heading); font-weight: 700; }

/* Поля рекомендации */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
@media (max-width: 560px) { .result-grid { grid-template-columns: 1fr; } }
.result-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.result-item--wide { grid-column: 1 / -1; }
.result-item__label {
  font-size: 10px;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 5px;
}
.result-item__value { font-size: 13.5px; color: var(--text); font-weight: 500; }
.result-item__value .badge { margin: 2px 4px 2px 0; }
.comp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.comp-chip {
  background: var(--blue-light);
  color: var(--heading);
  font-weight: 600;
  font-size: 12.5px;
  padding: 4px 11px;
  border-radius: 20px;
}
.comp-chip--removed { background: var(--danger-bg); color: var(--danger); text-decoration: line-through; }

/* Секции результата */
.result-section { margin-top: 22px; }
.result-section__title {
  font-size: 11px;
  font-family: var(--font);
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.rules-list { list-style: none; counter-reset: rule; }
.rules-list li {
  position: relative;
  padding: 11px 14px 11px 44px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
.rules-list li::before {
  counter-increment: rule;
  content: counter(rule);
  position: absolute;
  left: 12px; top: 11px;
  width: 22px; height: 22px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  font-family: var(--font);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rules-list .rule-name { font-weight: 700; color: var(--text); font-size: 13.5px; }
.rules-list .rule-stage {
  font-size: 11px; font-weight: 700; color: var(--orange);
  font-family: var(--font);
  text-transform: uppercase; margin-left: 8px;
}
.rules-list .rule-expl { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.rules-empty { color: var(--muted); font-size: 13px; }

/* Похожие рецептуры */
.similar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
.similar-item .s-code { font-family: var(--font); font-weight: 800; color: var(--heading); }
.similar-item .s-comp { font-size: 12.5px; color: var(--muted); }

/* ---- Подбор: галочки, обязательность, поля тары ---- */
.check-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.check input { width: auto; accent-color: var(--blue); }
.req-mark { color: var(--danger); font-weight: 700; font-size: 11px; }
.tare-fields { margin-bottom: 4px; }

/* ---- Подбор: рекомендованные рецептуры ---- */
.rec-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.rec-card__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.rec-card__code { font-family: var(--font); font-weight: 800; font-size: 17px; color: var(--heading); margin-right: 4px; }
.rec-warn {
  margin-top: 8px; font-size: 12px; color: #9a3412;
  background: var(--orange-light); border-radius: 7px; padding: 6px 9px;
}

/* ---- Подбор: предупреждения общим блоком ---- */
.warn-box {
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 18px;
}
.warn-box__item { font-size: 12.5px; color: var(--warn-text); padding: 2px 0; }

/* ---- Подбор: геометрия заготовки ---- */
.geom-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
@media (max-width: 560px) { .geom-grid { grid-template-columns: 1fr; } }
.geom-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.geom-item__label {
  font-size: 10px; font-family: var(--font); text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 700; margin-bottom: 5px;
}
.geom-item__val { font-family: var(--font); font-size: 19px; font-weight: 800; color: var(--heading); }
.geom-label {
  font-size: 13px; color: var(--orange-dark); font-weight: 600;
  background: var(--orange-light); border-radius: 8px; padding: 9px 12px;
}
.geom-note { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

/* ---- Подбор: пояснения и рекомендательная пометка ---- */
.notes-list { list-style: none; margin-bottom: 12px; }
.notes-list li { position: relative; padding: 6px 0 6px 18px; font-size: 13px; color: var(--text2); }
.notes-list li::before {
  content: ''; position: absolute; left: 2px; top: 13px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--orange);
}
.reco-note {
  margin-top: 18px; padding: 12px 14px;
  background: var(--surface2); border: 1px dashed var(--border2);
  border-radius: 10px; font-size: 12px; color: var(--muted); line-height: 1.5;
}

.podbor-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }

/* =====================================================================
   РЕДАКТОР ПРАВИЛ ПОДБОРА
   ===================================================================== */
.rules-info {
  font-size: 12.5px; color: var(--text2); margin-bottom: 18px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 14px;
}
.rule-item { margin-bottom: 14px; }
.rule-item__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rule-item__name { font-family: var(--font); font-weight: 800; font-size: 15px; color: var(--heading); }
.rule-item__meta { font-size: 12px; color: var(--muted); margin-left: 10px; }
.rule-line { font-size: 13px; color: var(--text); margin-bottom: 6px; }
.rule-line b { color: var(--text2); font-weight: 700; }
.rule-note {
  margin-top: 8px; font-size: 12px; color: var(--muted);
  background: var(--surface2); border-radius: 8px; padding: 8px 11px;
}

.rule-block {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; margin-bottom: 14px; background: var(--surface2);
}
.rule-block__title {
  font-size: 11px; font-family: var(--font); font-weight: 800; color: var(--heading);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 12px;
}
.mini-label { display: block; font-size: 11px; font-family: var(--font); font-weight: 700; color: var(--text2); margin-bottom: 8px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.check-grid .check { background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; }

/* ---- Журнал подборов ---- */
.zh-section-title {
  font-size: 11px; font-family: var(--font); font-weight: 800; color: var(--heading);
  text-transform: uppercase; letter-spacing: 0.4px; margin: 16px 0 10px;
}
.zh-recipe { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.zh-recipe:last-child { border-bottom: none; }
.zh-recipe__code { font-family: var(--font); font-weight: 800; color: var(--heading); min-width: 48px; }
.zh-recipe__comp { font-size: 12.5px; color: var(--muted); }

/* =====================================================================
   РАЗДЕЛ «КАЛЬКУЛЯТОР»: блоки результата и формула
   ===================================================================== */
.calc-result .card__title { margin-bottom: 18px; }
.calc-numbers { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.calc-num {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  text-align: center;
  box-shadow: var(--sh);
}
.calc-num--accent { background: linear-gradient(135deg, var(--blue), var(--blue-mid)); border: none; }
.calc-num--accent .calc-num__label { color: rgba(255,255,255,0.75); }
.calc-num--accent .calc-num__value { color: #fff; }
.calc-num--accent .calc-num__value small { color: rgba(255,255,255,0.7); }
.calc-num__label {
  font-size: 10px;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}
.calc-num__value { font-family: var(--font); font-size: 28px; font-weight: 900; color: var(--heading); line-height: 1; }
.calc-num--accent .calc-num__value { color: #fff; }
.calc-num__value small { font-size: 14px; font-weight: 700; color: var(--muted); }

.calc-formula {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
}
.calc-formula__title {
  font-size: 10px; font-family: var(--font); text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 700; margin-bottom: 8px;
}
.calc-formula__base { font-family: var(--font); font-size: 16px; font-weight: 800; color: var(--heading); margin-bottom: 10px; }
.calc-formula__filled {
  font-size: 13px; color: var(--text);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
  font-variant-numeric: tabular-nums;
}
.calc-formula__note { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.7; }

/* =====================================================================
   РАЗДЕЛ «РЕЕСТР ЗАЯВОК»: счётчики этапов, таблица, статусы, списание
   ===================================================================== */

/* Счётчики по этапам производства — стат-карточки с цветной полоской */
.stage-counts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
@media (max-width: 900px) { .stage-counts { grid-template-columns: repeat(2, 1fr); } }
.stage-count {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 16px 18px 16px 22px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stage-count:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }
/* Цветная полоска слева */
.stage-count::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--stripe-c, var(--blue));
}
.stage-count__num { font-family: var(--font); font-size: 34px; font-weight: 900; color: var(--num-c, var(--blue)); line-height: 1; }
.stage-count__label {
  font-size: 10px; font-family: var(--font); font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
/* Цвета этапов (полоска + число) */
.stage-count.st-accepted  { --stripe-c: #C99A4A; --num-c: #9A7220; }
.stage-count.st-extrusion { --stripe-c: #DB8A27; --num-c: #B0661A; }
.stage-count.st-packing   { --stripe-c: #86A066; --num-c: #5C7A40; }
.stage-count.st-ready     { --stripe-c: #5E9E6A; --num-c: #3F8248; }
.stage-count.st-shipped   { --stripe-c: #5C6E82; --num-c: #435568; }

/* Таблица заявок */
.orders-table { font-size: 12.5px; white-space: nowrap; }
.orders-table th, .orders-table td { padding: 9px 12px; }
.orders-table .o-name { white-space: normal; min-width: 200px; font-weight: 500; font-size: 12px; }
.orders-table tbody tr { cursor: pointer; }
.prio-normal { color: var(--muted); font-size: 12px; }

/* Номер заявки */
.rpill {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 700;
}

/* Статусные бейджи (цвета этапов как в референсе) */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.status-badge .bdot { opacity: 1; }
.status-badge[data-status-for] { cursor: pointer; user-select: none; }
.status-badge.st-accepted  { background: #F7EBCF; color: #9A7220; }
.status-badge.st-accepted .bdot { background: #C99A4A; }
.status-badge.st-payment   { background: #ECE7F2; color: #5B4C78; }
.status-badge.st-payment .bdot { background: #7A6A92; }
.status-badge.st-extrusion { background: var(--orange-light); color: var(--orange-dark); }
.status-badge.st-extrusion .bdot { background: #DB8A27; }
.status-badge.st-packing   { background: #E6EFDB; color: #5C7A40; }
.status-badge.st-packing .bdot { background: #86A066; }
.status-badge.st-ready     { background: #DFEEDD; color: #3F8248; }
.status-badge.st-ready .bdot { background: #5E9E6A; }
.status-badge.st-shipped   { background: #E6EAEF; color: #435568; }
.status-badge.st-shipped .bdot { background: #5C6E82; }

/* Выпадающий список смены статуса (по клику на бейдж) */
.status-dropdown {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  border: 1px solid var(--border);
  padding: 6px;
  min-width: 170px;
  animation: fadeIn 0.1s ease;
}
.status-dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 600;
  transition: background 0.1s;
}
.status-dropdown__item:hover, .status-dropdown__item.is-active { background: var(--blue-xlight); }
.status-dropdown__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Цветной селектор приоритета в таблице (1 — высший) */
.prio-select {
  border: none;
  border-radius: 6px;
  padding: 3px 18px 3px 7px;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 800;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  transition: box-shadow 0.15s;
  min-width: 48px;
  text-align: center;
}
.prio-select:focus { box-shadow: 0 0 0 2px var(--orange); }
.prio-1, .prio-2, .prio-3    { background: #F6E1DC; color: #B83E30; }
.prio-4, .prio-5, .prio-6    { background: #F9E8CE; color: #BE6E1A; }
.prio-7, .prio-8, .prio-9    { background: #F4EDCE; color: #96741A; }
.prio-10, .prio-11, .prio-12 { background: #E4EED9; color: #4F7A3E; }
.prio-13, .prio-14, .prio-15, .prio-0 { background: #EDECE9; color: #767C86; }

/* Блок текущего остатка в окне прихода/расхода */
.move-current {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text);
}
.move-current b { color: var(--heading); }

/* Блок списания сырья в форме заявки */
.material-usage {
  margin-top: 8px;
  background: var(--blue-xlight);
  border: 1.5px solid var(--border2);
  border-radius: 10px;
  padding: 14px 16px;
}
.material-usage__title {
  font-size: 10px; font-family: var(--font); text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 700; margin-bottom: 10px;
}
.material-usage__body { font-size: 12.5px; color: var(--muted); }
.mu-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(27,79,163,0.10); }
.mu-row:last-child { border-bottom: none; }
.mu-row span:first-child { flex: 1; color: var(--text); }
.mu-row .mu-share { color: var(--heading); font-weight: 700; font-size: 12px; }
.mu-row strong { color: var(--text); min-width: 90px; text-align: right; }

/* =====================================================================
   РАЗДЕЛ «КЛИЕНТЫ»: таблица номенклатуры продукции в форме клиента
   ===================================================================== */
.cp-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.cp-head, .cp-row {
  display: grid;
  grid-template-columns: 0.8fr 1.4fr 1fr 0.9fr 0.7fr 0.8fr 1fr 32px;
  gap: 6px;
  align-items: center;
}
.cp-head {
  background: var(--surface2);
  padding: 8px 10px;
  font-size: 10px;
  font-family: var(--font);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.cp-row { padding: 6px 10px; border-top: 1px solid var(--border); }
.cp-row:first-of-type { border-top: none; }
.cp-row input, .cp-row select {
  width: 100%;
  font-family: var(--font-b);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 7px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
.cp-row input:focus, .cp-row select:focus { border-color: var(--blue); }
.cp-row .cp-del {
  width: 28px; height: 28px; flex: none;
  border: none; border-radius: 6px;
  background: none; color: var(--muted); cursor: pointer;
}
.cp-row .cp-del:hover { background: var(--danger-bg); color: var(--danger); }
/* Подразделения клиента: название и адрес доставки */
.cp-head.pd-head, .cp-row.pd-row { grid-template-columns: 1fr 2fr 32px; }

/* =====================================================================
   РАЗДЕЛ «СКЛАД СЫРЬЯ»: карточки остатков (как в референс-макете)
   ===================================================================== */
.stock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .stock-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .stock-grid { grid-template-columns: 1fr; } }
.stock-card {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--sh);
  border: 1px solid var(--border);
  padding: 18px;
  transition: transform 0.15s;
}
.stock-card:hover { transform: translateY(-2px); }
.stock-card.low  { border-top: 3px solid var(--danger); }
.stock-card.ok-s { border-top: 3px solid var(--ok); }
.stk-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.stk-name { font-family: var(--font); font-weight: 700; font-size: 13px; }
.stk-sup { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stk-ico {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.stk-amt { font-family: var(--font); font-weight: 900; font-size: 30px; color: var(--heading); line-height: 1; }
.stk-unit { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pct-bar { height: 5px; background: var(--border); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.pct-fill { height: 100%; border-radius: 3px; }
.stk-btns { display: flex; gap: 6px; margin-top: 12px; }
.sbtn {
  flex: 1; padding: 5px 0;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.12s;
}
.sbtn:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.sbtn.minus:hover { background: var(--danger); border-color: var(--danger); }

/* =====================================================================
   РАЗДЕЛ «КЛИЕНТЫ»: сводка, список слева, карточка клиента справа
   ===================================================================== */
.cl-itogi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.cl-plitka { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 16px; min-width: 0; }
.cl-plitka span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); font-weight: 700; }
.cl-plitka b { font-family: var(--font); font-size: 22px; color: var(--heading); font-variant-numeric: tabular-nums; }
.cl-plitka--late b { color: var(--danger); }
.cl-plitka--pora b { color: var(--orange-dark); }
button.cl-plitka { text-align: left; cursor: pointer; font: inherit; }
button.cl-plitka:hover { border-color: var(--orange); }

.cl-split { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; align-items: start; }
.cl-spisok {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  overflow-y: auto; max-height: calc(100vh - 290px); min-height: 240px;
}
.cl-punkt {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.cl-punkt:last-child { border-bottom: 0; }
.cl-punkt:hover { background: var(--blue-xlight); }
.cl-punkt--akt { background: var(--orange-light); box-shadow: inset 3px 0 0 var(--orange); }
.cl-punkt__t { flex: 1; min-width: 0; }
.cl-punkt__imya { font-weight: 600; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-punkt__pod { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-punkt__summa { font-size: 13px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cl-punkt__summa small { display: block; font-size: 11px; color: var(--danger); font-weight: 600; }
.cl-tochka { width: 9px; height: 9px; border-radius: 50%; background: var(--border2); flex: none; }
.cl-tochka--ok { background: var(--ok); }
.cl-tochka--pora { background: var(--orange); }
.cl-tochka--dolg { background: var(--danger); }

.cl-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 22px 24px; min-width: 0; }
.cl-panel__pusto { color: var(--muted); text-align: center; padding: 60px 0; }
.cl-panel__nazad { display: none; margin-bottom: 12px; }
.cl-panel h2 { margin: 0 0 4px; font-size: 22px; color: var(--heading); font-family: var(--font); }
.cl-panel__pod { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.cl-panel__cifry { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 18px; }
.cl-zagol { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.cl-grafik { display: flex; align-items: flex-end; gap: 6px; height: 120px; border-bottom: 1px solid var(--border); }
.cl-grafik div { flex: 1; background: var(--orange-soft); border-radius: 4px 4px 0 0; min-height: 3px; }
.cl-grafik div.cl-grafik--posl { background: var(--orange); }
.cl-grafik__podp { display: flex; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.cl-grafik__podp span { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; }
.cl-rekv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 14px; font-size: 14px; margin-top: 18px; }
.cl-rekv > span { color: var(--muted); }
.cl-rekv > div { min-width: 0; overflow-wrap: anywhere; }
.cl-deistviya { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

@media (max-width: 1100px) { .cl-itogi { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .cl-split { grid-template-columns: 1fr; }
  .cl-spisok { max-height: none; }
  .cl-split .cl-panel { display: none; }
  .cl-split--detal .cl-spisok { display: none; }
  .cl-split--detal .cl-panel { display: block; }
  .cl-panel__nazad { display: inline-flex; }
  .cl-panel { padding: 16px; }
  .cl-panel__cifry { gap: 8px; }
  .cl-panel__cifry .cl-plitka { padding: 10px; }
  .cl-panel__cifry .cl-plitka b { font-size: 15px; }
  .cl-panel__cifry .cl-plitka span { font-size: 10px; }
  .cl-rekv { grid-template-columns: 1fr; gap: 2px; }
  .cl-rekv > div { margin-bottom: 8px; }
  .cl-plitka b { font-size: 18px; }
}

/* =====================================================================
   РАЗДЕЛ «ПЛАНИРОВАНИЕ ПРОИЗВОДСТВА»: колонки линий, карточки заявок,
   метки переналадок, эффект оптимизации, настройки модуля
   ===================================================================== */

.plan-toolbar { align-items: center; }
.plan-run-info { font-size: 12px; color: var(--muted); margin-left: auto; }

/* Верхний блок: предупреждения + эффект */
.plan-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.plan-notes {
  flex: 1; font-size: 12px; line-height: 1.6; color: var(--warn-text);
  background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--r);
  padding: 12px 16px;
}
.effect-card {
  margin-left: auto; min-width: 480px;
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  border-radius: var(--r); padding: 14px 18px; color: #fff;
  box-shadow: var(--sh-lg);
}
.effect-card__title {
  font-family: var(--font);
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 10px; color: var(--orange);
}
.effect-card__title span { color: rgba(255,255,255,0.65); font-weight: 600; text-transform: none; letter-spacing: 0; }
.effect-card__grid { display: flex; gap: 18px; }
.eff { min-width: 90px; }
.eff__num { font-family: var(--font); font-size: 17px; font-weight: 800; white-space: nowrap; }
.eff__label { font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.eff--main .eff__num { color: var(--orange); font-size: 19px; }

/* Доска: три колонки-линии */
.plan-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.plan-board .empty-state { grid-column: 1 / -1; }
.plan-col {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; box-shadow: var(--sh);
}
.plan-col__head {
  padding: 12px 14px 10px; border-top: 4px solid var(--blue);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.plan-col__title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font);
  font-size: 15px; font-weight: 800; color: var(--text);
}
.plan-col__name { font-size: 12px; font-weight: 600; color: var(--muted); }
.line-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.plan-col__stats { font-size: 11px; color: var(--muted); margin-top: 4px; }
.plan-col__body { padding: 10px 10px 14px; min-height: 80px; }

/* Карточка заявки в очереди */
.plan-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 11px; margin-top: 8px;
  cursor: grab;
  transition: box-shadow 0.12s;
}
.plan-card:hover { box-shadow: var(--sh); }
.plan-card:active { cursor: grabbing; }
.plan-card.is-dragging { opacity: 0.45; }
.plan-card.is-late { border-color: #D8A79E; background: #FBF1EF; }
.plan-card.is-changed { box-shadow: 0 0 0 2px rgba(200,135,58,0.55); }
.plan-card__top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plan-card__num { font-family: var(--font); font-weight: 800; color: var(--heading); font-size: 13px; }
.plan-card__color { font-size: 11px; color: var(--muted); }
.plan-card__name {
  font-size: 12px; color: var(--text2); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.plan-card__meta {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 11px; color: var(--muted); margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.plan-card__time { margin-left: auto; font-weight: 700; color: var(--heading); }

/* Бейджи семейств и пометок */
.badge.fam-pnd { background: var(--blue); color: #fff; }
.badge.fam-psd { background: var(--info); color: #fff; }
.badge.fam-pvd { background: var(--orange-dark); color: #fff; }
.badge--prio { background: var(--orange); color: #fff; }
.badge--split { background: #6E6478; color: #fff; }
.badge--manual { background: var(--blue-light); color: var(--heading); }
.badge--changed { background: var(--orange-light); color: var(--orange-dark); }

/* Метка переналадки между карточками */
.co-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted); margin: 8px 4px 0;
  padding-left: 8px; border-left: 2px dashed var(--border2);
}
.co-chip--heavy { color: var(--orange-dark); font-weight: 700; border-left-color: var(--orange); }

/* Настройки модуля */
.ps-section {
  font-size: 11px; font-family: var(--font); font-weight: 800; color: var(--heading);
  text-transform: uppercase; letter-spacing: 0.4px; margin: 16px 0 10px;
}

/* Печать плана производства */
@media print {
  .plan-toolbar, .plan-notes { display: none !important; }
  .plan-top, .plan-board { display: block; }
  .effect-card { min-width: 0; margin: 0 0 14px; border-radius: 8px;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .plan-col { break-inside: avoid; margin-bottom: 14px; border: 1px solid #ccc; }
  .plan-card { cursor: default; break-inside: avoid; }
  .co-chip { color: #555; }
}

/* =====================================================================
   РЕЕСТР: маркировка линий плана производства (сквозная по приложению)
   ===================================================================== */
.line-stripe { box-shadow: inset 3px 0 0 var(--stripe, transparent); }
.badge--line { color: #fff; font-weight: 800; }
.queue-pos { font-size: 11px; color: var(--muted); font-weight: 700; }

/* =====================================================================
   ПЕЧАТЬ В PDF (через браузер). На экране печатные блоки скрыты.
   ===================================================================== */
.print-only { display: none; }

@media print {
  /* Скрываем всё, кроме документа */
  .sidebar, .topbar, .no-print, .podbor__form { display: none !important; }
  .layout, .main, .content, .podbor, .podbor__result { display: block; margin: 0; padding: 0; }
  /* Сбрасываем экранные ограничения каркаса — иначе печать обрежется одной страницей */
  .layout, .main { height: auto !important; overflow: visible !important; }
  body { background: #fff; font-size: 12px; }
  .card, .result-doc { box-shadow: none !important; border: none !important; padding: 0 !important; }
  .print-only { display: block; }

  .print-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--blue);
    padding-bottom: 12px;
    margin-bottom: 6px;
  }
  .print-head__brand { display: flex; align-items: center; gap: 10px; }
  .print-head__name { font-weight: 800; font-size: 20px; color: var(--heading); }
  .print-head__sub { font-size: 11px; color: #555; }
  .print-head__req { font-size: 10.5px; color: #555; text-align: right; line-height: 1.5; }
  .print-title { font-size: 17px; color: var(--heading); margin: 14px 0 16px; }

  .result-item, .rules-list li, .similar-item, .result-params .chip {
    background: #fff !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }
  .result-section { break-inside: avoid; }

  .print-sign {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding-top: 16px;
  }
}

/* =====================================================================
   Вход в систему и пользователь в верхней панели
   ===================================================================== */
/* =====================================================================
   ТЕЛЕФОН: меню выезжает по кнопке, шапка переносится
   ===================================================================== */
.menu-btn { display: none; }
@media (max-width: 900px) {
  .layout { display: block; height: auto; overflow: visible; }
  .main { overflow: visible; min-height: 100vh; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 90;
    transform: translateX(-100%); transition: transform 0.2s ease; overflow-y: auto;
  }
  body.menu-open .sidebar { transform: none; }
  body.menu-open::after {
    content: ''; position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0.45);
  }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; margin: 14px 10px 0 0; flex: none; border-radius: 8px; cursor: pointer;
    background: var(--surface); color: var(--text2); border: 1.5px solid var(--border2);
  }
  .topbar { flex-wrap: wrap; padding: 0 12px; min-height: 0; }
  .topbar__left { flex: 1 1 calc(100% - 60px); padding: 12px 0 8px; }
  .topbar__title { font-size: 18px; }
  .topbar__right { flex-wrap: wrap; gap: 8px; padding: 0 0 12px; width: 100%; height: auto; }
  .user-chip { margin-left: 0; }
  .content { padding: 16px 12px; }
  .modal__box, .modal__box--wide, .modal__box--narrow { width: calc(100vw - 24px); max-height: calc(100vh - 24px); overflow-y: auto; }
  .form-row { flex-wrap: wrap; }
  .form-row > .form-field { flex: 1 1 140px; }
  .table-wrap { overflow-x: auto; }
  .stage-count__num { font-size: 26px; overflow-wrap: anywhere; }
}

.user-chip { display: flex; align-items: center; gap: 10px; margin-left: 8px; }
.user-chip__name { font-family: var(--font); font-weight: 700; font-size: 13px; color: var(--text2); }

.vhod-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 16px;
}
.vhod { width: 360px; max-width: 100%; padding: 28px; }
.vhod__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.vhod__name { font-family: var(--font); font-weight: 800; font-size: 18px; letter-spacing: 0.08em; color: var(--heading); }
.vhod__title { font-family: var(--font); font-weight: 800; font-size: 20px; color: var(--heading); margin-bottom: 16px; }
.vhod__oshibka { background: #fee2e2; color: var(--danger); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 14px; }
.vhod__btn { width: 100%; justify-content: center; padding: 10px 18px; }

.users-hint { margin-top: 14px; font-size: 13px; color: var(--muted); max-width: 640px; }

/* ---- Раздел «Отгрузки и ОПП» ---- */
.sh-tabs { margin-bottom: 18px; }
.stage-counts.sh-counts { grid-template-columns: repeat(4, 1fr); }
.sh-sub { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.stage-count .sh-sub { font-size: 13px; margin-top: 6px; }
.sh-table .num, .data-table th.num, .data-table td.num { text-align: right; white-space: nowrap; }
.sh-row { cursor: pointer; }
.sh-z { font-size: 12px; color: var(--text2); white-space: nowrap; }
.sh-itog td { font-weight: 800; background: var(--surface2); }
.sh-h3 { font-family: var(--font); font-size: 15px; font-weight: 800; color: var(--heading); margin: 26px 0 10px; }
.sh-note { font-size: 13px; color: var(--muted); margin: 8px 0; }
.sh-warn { background: var(--orange-light); color: var(--orange-dark); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; }
.sh-narrow { max-width: 560px; }
.kl-new, .kl-new1c { width: 200px; padding: 6px 8px; border: 1.5px solid var(--border2); border-radius: 6px; font: inherit; background: var(--surface); color: inherit; }
.kl-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0; }
.kl-x, .kl-plus { border: 0; background: none; cursor: pointer; color: var(--muted); font: inherit; padding: 0 2px; }
.kl-x:hover, .kl-plus:hover { color: var(--heading); }
.sh-price { width: 120px; text-align: right; padding: 6px 8px; border: 1.5px solid var(--border2); border-radius: 6px; font: inherit; }
.rz-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 6px; font-size: 13px; font-weight: 700; }
.rz-all { font-size: 13px; font-weight: 500; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.rz-list { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.rz-item { display: grid; grid-template-columns: 20px 1fr auto 96px; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.rz-item:last-child { border-bottom: none; }
.rz-item:hover { background: var(--blue-xlight); }
.rz-meta { text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }
.rz-qty { width: 96px; padding: 5px 6px; border: 1.5px solid var(--border2); border-radius: 6px; font: inherit; text-align: right; }
.rz-total { font-size: 13px; color: var(--text2); margin-top: 6px; min-height: 18px; }
@media (max-width: 900px) {
  .stage-counts.sh-counts { grid-template-columns: repeat(2, 1fr); }
  .rz-item { grid-template-columns: 20px 1fr; }
  .rz-meta, .rz-qty { grid-column: 2; text-align: left; }
}

/* ---------- Склад ТМЦ ---------- */
.t-komp-list { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.sh-minus td { color: var(--danger); }

/* ---------- Финансы: ОПиУ ---------- */
.f-wrap { overflow-x: auto; }
.f-table { font-size: 13px; }
.f-table td:first-child { white-space: nowrap; min-width: 260px; }
.f-table td.num, .f-table th.num { white-space: nowrap; min-width: 92px; }
.f-table tr.f-statya td:first-child { padding-left: 26px; color: var(--muted); }
.f-table tr.f-gruppa td, .f-table tr.f-dohod td { font-weight: 700; }
.f-table tr.f-itog td { font-weight: 800; background: var(--blue-light); }
.f-table tr.f-procent td { font-size: 12px; color: var(--muted); font-style: italic; }
.f-table td.f-cell { cursor: pointer; }
.f-table td.f-cell:hover { outline: 1px dashed var(--orange); }
.f-table td.f-opp, .f-opp-mark { color: var(--orange-dark); }
.f-table td.f-neg { color: var(--danger); }
.f-table td.f-itogo { font-weight: 700; }
.f-input { width: 100%; min-width: 80px; text-align: right; font: inherit; padding: 2px 4px; }

/* ---------- Раздел «Персонал» ---------- */
.p-table td { vertical-align: top; }
.p-table tr.p-gruppa td { font-weight: 800; color: var(--orange-dark); background: var(--surface2); }
.p-table td.p-dolg { color: var(--orange-dark); font-weight: 700; }
.p-minus { color: var(--danger); }
.p-tabel-bar { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.p-grafik { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.p-grafik input { padding: 6px 8px; border: 1.5px solid var(--border2); border-radius: 6px; font: inherit; }
.p-tabel { font-size: 12px; }
.p-tabel th, .p-tabel td { padding: 4px 3px; text-align: center; }
.p-tabel .p-tabel__fio { text-align: left; white-space: nowrap; min-width: 150px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.p-tabel th.p-den { min-width: 26px; font-weight: 700; }
.p-tabel th.p-den div { font-weight: 400; color: var(--muted); font-size: 10px; }
.p-tabel th.p-den--vyh { color: var(--orange-dark); }
.p-tabel td.p-kl { cursor: pointer; font-weight: 700; border: 1px solid var(--border); min-width: 26px; height: 28px; }
.p-tabel td.p-kl:hover { outline: 2px solid var(--orange); }
/* Цвет кода — через --kod-bg, чтобы подсветка строки при наведении его не перекрывала. */
.p-kod--Д { --kod-bg: var(--orange-light); background: var(--kod-bg); color: var(--orange-dark); }
.p-kod--Н { --kod-bg: var(--blue); background: var(--kod-bg); color: #fff; }
.p-kod--О { --kod-bg: var(--blue-light); background: var(--kod-bg); color: var(--ok); }
.p-kod--Б { --kod-bg: var(--blue-light); background: var(--kod-bg); color: var(--info); }
.p-kod--П { --kod-bg: var(--surface2); background: var(--kod-bg); color: var(--danger); }
.p-tabel tbody tr:hover td.p-kl[class*="p-kod--"]:not(.p-kod--pusto) { background: var(--kod-bg); }
.p-tabel--prosmotr td.p-kl { cursor: default; }
.p-tabel--prosmotr td.p-kl:hover { outline: none; }

/* Печать табеля: альбомный А4, одна таблица */
@media print {
  .p-tabel-zagol { font-size: 15px; margin: 0 0 6px; color: #000; }
  .p-tabel-bar { margin: 0 0 6px; }
  #tab-tabel .table-wrap { overflow: visible; border: none; }
  .p-tabel { font-size: 9px; width: 100% !important; min-width: 0 !important; table-layout: fixed; box-shadow: none; }
  .p-tabel th, .p-tabel td { padding: 1px 1px; }
  .p-tabel .p-tabel__fio { position: static; min-width: 0; width: 34mm; white-space: normal; }
  .p-tabel th:last-child, .p-tabel td:last-child { width: 11mm; text-align: right; }
  .p-tabel .sh-sub { font-size: 8px; }
  .p-tabel th.p-den { min-width: 0; }
  .p-tabel td.p-kl { min-width: 0; height: 18px; border: 1px solid #999; }
  .p-tabel td, .p-tabel th, .p-kod { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .p-tabel tr { break-inside: avoid; }
}
b.p-kod { display: inline-block; min-width: 18px; text-align: center; border-radius: 4px; padding: 0 3px; }
.p-uvolen td { color: var(--muted); }
.p-klienty { columns: 2; column-gap: 24px; max-height: 50vh; overflow-y: auto; }
.p-klienty label { display: block; break-inside: avoid; margin-bottom: 4px; font-size: 13px; }
.p-raschet { background: var(--surface2); border-radius: 8px; padding: 10px 14px; font-size: 13px; line-height: 1.6; }
.p-raschet__itog { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.p-knopka { display: flex; align-items: flex-end; }
@media (max-width: 760px) {
  .p-klienty { columns: 1; }
}

/* ---------- Доска задач (канбан) ---------- */
.nav__count { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--orange); color: #fff; font-size: 11px; text-align: center; }
.kb { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; align-items: start; }
.kb-col { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r); padding: 10px; min-height: 200px; }
.kb-col.is-over { border-color: var(--orange); background: var(--orange-light); }
.kb-col__head { font-family: var(--font); font-weight: 800; font-size: 13px; color: var(--heading); padding: 4px 4px 10px; display: flex; gap: 8px; }
.kb-col__n { color: var(--muted); font-weight: 600; }
.kb-col__list { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kb-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 0; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border2); border-radius: 8px; padding: 10px 12px; cursor: pointer; box-shadow: var(--sh); }
.kb-card:hover { border-color: var(--orange); }
.kb-card.is-drag { opacity: 0.4; }
.kb-card--vazh { border-left-color: var(--danger); }
.kb-card--proverka { border-color: var(--orange); border-left-color: var(--orange); }
.kb-card__metka { font-size: 11px; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; }
.kb-card__title { font-weight: 700; font-size: 13px; color: var(--text); line-height: 1.35; }
.kb-card__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.kb-card__ot { font-size: 11px; color: var(--muted); margin-top: 2px; }
.kb-late { color: var(--danger); font-weight: 700; }
.kb-card__move { display: none; justify-content: space-between; margin-top: 6px; }
.kb-card__deistvie { margin-top: 8px; width: 100%; border: 1px solid var(--orange); background: none; color: var(--orange); border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.kb-card__deistvie:hover { background: var(--orange); color: #fff; }
.kb-card__smezh { font-size: 11px; color: var(--muted); margin-top: 2px; }
.kb-deistviya { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.kb-deistviya:empty { display: none; }
.kb-isp { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.kb-isp label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.kb-card__move button { border: 1px solid var(--border2); background: var(--surface2); color: var(--text2); border-radius: 6px; width: 34px; height: 28px; font-size: 16px; cursor: pointer; }
.kb-kom { max-height: 240px; overflow-y: auto; margin-bottom: 10px; }
.kb-kom__item { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
@media (max-width: 900px) {
  .kb { grid-template-columns: 1fr; }
  .kb-col { min-height: 0; }
  .kb-card__move { display: flex; }
}

/* ---------- Дебиторка ---------- */
.d-gruppy { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: -8px 0 18px; }
.d-gruppa { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--border2); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.d-gruppa b { font-size: 14px; color: var(--text); }
.d-gruppa--0 { border-top-color: var(--ok); }
.d-gruppa--1 { border-top-color: var(--orange); }
.d-gruppa--2, .d-gruppa--3, .d-gruppa--4 { border-top-color: var(--danger); }
.d-gruppa--4 b { color: var(--danger); }
.d-table tbody tr { cursor: pointer; }
.d-table .d-imya { white-space: normal; min-width: 220px; font-weight: 600; }
.d-net { color: var(--muted); font-size: 12px; }
.d-nedeli { max-width: 420px; }
@media (max-width: 900px) {
  .d-gruppy { grid-template-columns: repeat(2, 1fr); }
  #d-plitki .stage-count__num { font-size: 24px; }
}

/* ---------- Карточка клиента (CRM) ---------- */
.badge--red { background: var(--danger-bg); color: var(--danger); }
.badge--grey { background: var(--surface2); color: var(--muted); }

/* ---------- Касса ---------- */
.k-split { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.k-table td { font-size: 13px; }
.k-table .k-row { cursor: pointer; }
.k-plus { color: var(--ok); }
.k-statyi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; }
.k-statyi .data-table td { font-size: 13px; padding: 6px 8px; }
.k-nazv { color: var(--muted); font-size: 12px; }
.cl-red { color: var(--danger); font-weight: 600; }
.cl-muted { color: var(--muted); }
@media (max-width: 1100px) { .k-split { grid-template-columns: 1fr; } }

/* ---------- Печатные формы (этикетка, паспорт качества, палетный лист) ---------- */
.pechat-body { background: var(--bg); margin: 0; }
.p-panel { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--sh); }
.p-formy { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.p-forma { padding: 6px 12px; border-radius: 6px; font: 600 13px var(--font); color: var(--text2); text-decoration: none; }
.p-forma:hover { color: var(--heading); }
.p-forma.is-active { background: var(--surface); color: var(--heading); box-shadow: var(--sh); outline: 1px solid var(--border2); }
.p-nastr { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }
.p-nastr label { display: flex; gap: 6px; align-items: center; }
.p-kopii { width: 72px; }
.p-podskazka { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.p-vlozheniya { flex-basis: 100%; font-size: 13px; }
.p-vlozheniya summary { cursor: pointer; font-weight: 600; color: var(--text2); }
.p-vlozheniya__spisok { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 4px 16px; margin: 8px 0; max-height: 180px; overflow-y: auto; }
.p-vlozheniya__spisok label { display: flex; gap: 6px; align-items: baseline; }
.p-listy { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 24px 16px; overflow-x: auto; }
.list { background: var(--bumaga); color: var(--chernila); box-shadow: var(--sh-lg); box-sizing: border-box; overflow: hidden; font-family: var(--font-b); line-height: 1.25; flex-shrink: 0; }
.list h1 { font-family: inherit; color: var(--chernila); }
.list [contenteditable]:hover, .list [contenteditable]:focus { outline: 1px dashed var(--muted); outline-offset: 1px; }
.list--a4 { width: 210mm; height: 297mm; }

/* Этикетка: размеры в em, чтобы одна разметка годилась и для листа А4, и для термопринтера. */
.et { height: 100%; box-sizing: border-box; padding: 0.9em 1.2em; display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: space-between; }
.et-verh { width: 100%; display: flex; align-items: center; gap: 0.8em; }
.et-znak { height: 2.6em; }
.et-logo { height: 2.6em; margin-left: auto; }
.et-zagolovok { font-size: 1.45em; font-weight: 700; margin-top: 0.3em; }
.et-razmer { font-size: 1.45em; font-weight: 700; }
.et-kolvo { font-size: 1.25em; font-weight: 600; }
.et-melko { font-size: 0.95em; }
.et-adres { font-size: 0.85em; }
.piktogrammy { display: flex; align-items: center; gap: 0.4em; margin: 0.25em 0; }
.piktogrammy img { height: 2.5em; }
.znak-pererabotki { height: 2.7em; width: auto; }
.list--etiketki { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, 1fr); font-size: 2.75mm; }
.et-yacheika { overflow: hidden; }
.list--termo { display: flex; }

/* Горизонтальная термоэтикетка C (дизайн 120×75 мм; под другой размер масштабируется через zoom). */
.list--termo-c { background: #fff; color: #000; }
.etc { width: 120mm; height: 75mm; flex-shrink: 0; box-sizing: border-box; overflow: hidden; background: #fff; color: #000; font-family: 'Manrope', sans-serif;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.etc svg { display: block; }
.etc-left { padding: 4mm; display: flex; flex-direction: column; border-right: .3mm solid #000; min-height: 0; }
.etc-logo { display: flex; align-items: center; gap: 2mm; }
.etc-mk { width: 8.5mm; height: 8.5mm; flex-shrink: 0; }
.etc-wm { font-weight: 800; font-size: 12pt; line-height: 1; letter-spacing: .014em; }
.etc-tg { white-space: nowrap; font-weight: 600; font-size: 4.3pt; letter-spacing: .02em; margin-top: .8mm; }
.etc-kind { margin-top: auto; font-size: 6pt; font-weight: 800; letter-spacing: .32em; text-transform: uppercase; }
.etc-size { font-weight: 800; line-height: .95; letter-spacing: -.02em; margin-top: 1mm; white-space: nowrap; }
.etc-size .x { font-weight: 600; margin: 0 .6mm; vertical-align: .25em; font-size: .62em; }
.etc-size--l { font-size: 26pt; }
.etc-size--m { font-size: 20pt; }
.etc-size--s { font-size: 16pt; }
.etc-size--xs { font-size: 13pt; white-space: normal; }
.etc-mm { font-size: 7pt; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; margin-top: .8mm; }
.etc-sub { display: flex; flex-wrap: wrap; gap: 1.2mm 1.6mm; margin-top: 2mm; font-size: 8.5pt; font-weight: 800; }
.etc-sub span { border: .3mm solid #000; padding: .2mm 1.6mm; border-radius: .6mm; }
.etc-sub span.inv { background: #000; color: #fff; }
.etc-gost { font-size: 6pt; font-weight: 600; margin-top: 1.6mm; }
.etc-niz { display: flex; align-items: flex-end; gap: 2mm; }
.etc-niz__tekst { flex: 1; min-width: 0; }
.etc-qr { width: 16mm; flex-shrink: 0; text-align: center; }
.etc-qr svg { width: 16mm; height: 16mm; }
.etc-qr__podpis { font-size: 3.6pt; font-weight: 700; letter-spacing: .04em; margin-top: .6mm; white-space: nowrap; }
.etc-right { display: flex; flex-direction: column; min-height: 0; }
.etc-right > div { padding: 1.6mm 4.5mm 1.6mm 3.5mm; border-bottom: .2mm solid #000; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.etc-right > .etc-posl { border-bottom: none; }
.etc-right > .etc-q { background: #000; color: #fff; flex: 1.5; }
.etc-lbl { font-size: 4.8pt; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.etc-val { font-size: 8.5pt; font-weight: 700; line-height: 1.15; margin-top: .3mm; }
.etc-q .etc-val { font-size: 16pt; font-weight: 800; line-height: 1; }
.etc-strip { grid-column: 1 / 3; border-top: .3mm solid #000; display: flex; align-items: center; gap: 1.6mm; padding: 1.8mm 5mm 1.8mm 4mm; }
.etc-strip svg { width: 6.4mm; height: 6.4mm; flex-shrink: 0; }
.etc-strip svg.etc-eac { width: 8mm; }
.etc-sep { width: .2mm; align-self: stretch; background: #000; margin: 0 1mm; }
.etc-addr { margin-left: auto; text-align: right; font-size: 5.2pt; font-weight: 600; line-height: 1.4; max-width: 52mm; }
.etc-addr b { font-weight: 800; }

/* Паспорт качества — по образцам «Дукат» и «Пензамолинвест». */
.list--pasport { padding: 8mm 12mm 8mm 18mm; font-size: 8.5pt; line-height: 1.2; }
.ps-logo { display: block; height: 17mm; margin: 0 auto 2mm; }
.ps-zagolovok { text-align: center; font-size: 12pt; font-weight: 800; text-transform: uppercase; margin: 0 0 3mm; }
.ps-polya { display: flex; align-items: flex-end; justify-content: space-between; gap: 6mm; margin-bottom: 2.5mm; font-size: 10pt; line-height: 1.3; }
.ps-polya .piktogrammy { font-size: 3.4mm; }
.ps-tab { width: 100%; border-collapse: collapse; }
.ps-tab th, .ps-tab td { border: 0.25mm solid var(--chernila); padding: 0.5mm 1.5mm; text-align: left; vertical-align: top; }
.ps-tab th { font-weight: 700; text-align: center; }
.ps-tab td + td { width: 31%; }
.list--pasport .ps-tab td:nth-child(n+2) { text-align: center; }
.list--pasport .ps-tab tr:nth-child(-n+6) td:nth-child(n+2) { text-align: left; }
.ps-vyvod { margin: 2mm 0; }
.ps-deklaraciya { margin: 2mm 0 6mm; }
/* Подпись лежит на линии, печать — поверх, как при ручном оформлении. */
.rekv-otk__prevyu { height: 70px; display: flex; align-items: center; margin-bottom: 6px; }
.rekv-otk__prevyu img { max-height: 70px; max-width: 100%; }
.ps-otk { display: flex; align-items: flex-end; gap: 1mm; margin-top: 14mm; }
.ps-otk__mesto { position: relative; display: inline-block; }
.ps-otk__podpis { position: absolute; left: 50%; bottom: -1mm; transform: translateX(-50%); height: 15mm; max-width: 50mm; object-fit: contain; }
.ps-otk__pechat { position: absolute; left: 22mm; bottom: -20mm; width: 38mm; height: 38mm; object-fit: contain; opacity: .92; mix-blend-mode: multiply; }
.ps-liniya { display: inline-block; width: 45mm; border-bottom: 0.25mm solid var(--chernila); margin: 0 2mm; }

/* Фирменный бланк: логотип слева, реквизиты справа (как в письмах). */
.blank-shapka { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; padding-bottom: 4mm; border-bottom: 0.3mm solid var(--chernila); margin-bottom: 10mm; }
.blank-logo { height: 14mm; margin-top: 2mm; flex-shrink: 0; }
.blank-rekv { font-size: 7.5pt; line-height: 1.45; text-align: right; }

/* Палетный лист — по образцу «Дубки». */
.list--paletnyi { padding: 14mm 16mm 14mm 22mm; font-size: 11pt; }
.pl-zagolovok { text-align: center; font-size: 15pt; font-weight: 800; text-transform: uppercase; margin: 0 0 7mm; }
.pl-stroka { margin-bottom: 3mm; }
.pl-tab { margin: 2mm 0 10mm; }
.pl-tab td, .pl-tab th { padding: 2mm; text-align: left; }
.pl-tab td + td { width: auto; }
.pl-tab td:first-child { width: 36%; }
.pl-smena { margin-left: 8mm; }

@media print {
  .p-panel, .modal { display: none !important; }
  .pechat-body { background: none; }
  .p-listy { display: block; padding: 0; overflow: visible; }
  .list { box-shadow: none; page-break-after: always; break-after: page; }
  .list:last-child { page-break-after: auto; break-after: auto; }
  .list [contenteditable]:hover, .list [contenteditable]:focus { outline: none; }
}

/* ---------- Письма ---------- */
.ps-nowrap { white-space: nowrap; }
.ps-knopki { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 6px; }
#ps-forma textarea { width: 100%; box-sizing: border-box; resize: vertical; }

/* Номенклатура в карточке клиента */
.cl-nomenklatura { margin: 0 0 18px; font-size: 13px; }
.cl-zagol + .cl-nomenklatura, .cl-rekv + .cl-zagol { margin-top: 18px; }
/* Ручной разбор клиентов реестра */
.rk-hint { margin: 0 0 10px; font-size: 13px; color: var(--muted, #666); }
.rk-hint:first-child { color: inherit; font-weight: 600; }
.rk-tablica td { padding: 6px 10px; }
.rk-tablica select { width: 100%; }
#rk-modal .modal__body { max-height: 70vh; overflow-y: auto; }
.rk-tablica td.num { text-align: right; }
