/* WB FBS — светлая тема в духе MPpulse.

   Голубовато-серая подложка, белые карточки со скруглением и мягкой
   тенью вместо рамок, левое меню на белом, синий акцент #3f6be8,
   Roboto Flex. Цвет несёт смысл только в статусах и дельтах —
   в остальном интерфейс намеренно тихий. */

:root {
  --gray-10:  #f7f9fd;
  --gray-50:  #f1f4fa;
  --gray-100: #e4e9f2;
  --gray-200: #c8d0e0;

  --ink:       #1c2434;
  --ink-soft:  #454f63;
  --muted:     #8a93a6;

  --paper:  #f4f6fb;
  --card:   #ffffff;
  --rule:   #e8ecf4;
  --rule-soft: #f0f3f9;

  --accent:      #3f6be8;
  --accent-dark: #2f55c4;
  --accent-bg:   #ebf0fe;

  --go:      #17a06b;
  --go-bg:   #e8f7f1;
  --hold:    #c07806;
  --hold-bg: #fdf3e3;
  --stop:    #e0483f;
  --stop-bg: #fdeeed;

  --sans: "IBM Plex Sans", "Roboto Flex", system-ui, -apple-system, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(20, 32, 60, .04), 0 6px 18px rgba(20, 32, 60, .05);
  --shadow-sm: 0 1px 2px rgba(20, 32, 60, .05);
  --ring: 0 0 0 3px rgba(63, 107, 232, .18);
  --sidebar: 232px;
  --shell: 1440px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.perf { display: none; }

/* --- Каркас: левое меню + контент --- */
.layout { display: flex; min-height: 100vh; }

.side {
  flex: 0 0 var(--sidebar);
  background: var(--card);
  border-right: 1px solid var(--rule);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
}
.side__brand:hover { text-decoration: none; }
.side__mark {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 4px 10px rgba(63, 107, 232, .28);
}
.side a.nav__i {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 120ms linear, color 120ms linear;
}
.side a.nav__i:hover { background: var(--gray-50); color: var(--ink); text-decoration: none; }
.side a.nav__i[aria-current="page"] {
  background: var(--accent-bg);
  color: var(--accent-dark);
  font-weight: 600;
}
.side__foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--rule-soft); }
.side__who { font-size: 12px; color: var(--muted); margin-bottom: 8px; word-break: break-word; }

.main { flex: 1 1 auto; min-width: 0; }
.shell { max-width: var(--shell); margin: 0 auto; padding: 24px 28px 64px; }
.shell--narrow { max-width: 460px; }

/* --- Заголовок страницы --- */
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* --- Карточка --- */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card > h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-soft);
}
.card__note { color: var(--muted); font-size: 13px; margin: -4px 0 14px; }

/* --- Формы --- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field__hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="file"], select, textarea {
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  transition: border-color 120ms linear, box-shadow 120ms linear;
}
input:hover, select:hover, textarea:hover { border-color: var(--gray-200); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input[readonly] { background: var(--gray-10); color: var(--muted); }
textarea { resize: vertical; }
input.mono, .mono, textarea.mono { font-family: var(--mono); font-size: 13px; }

.field--inline { display: flex; align-items: center; gap: 8px; }
.field--inline > label { margin: 0; font-weight: 400; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 150px; }

/* --- Кнопки --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(63, 107, 232, .18);
  transition: background-color 120ms linear, border-color 120ms linear, box-shadow 120ms linear;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; text-decoration: none; }
.btn--ghost { background: var(--card); color: var(--ink-soft); border-color: var(--gray-100); box-shadow: var(--shadow-sm); }
.btn--ghost:hover { background: var(--gray-50); color: var(--ink); border-color: var(--gray-200); }
.btn--danger { background: var(--card); color: var(--stop); border-color: var(--gray-100); box-shadow: var(--shadow-sm); }
.btn--danger:hover { background: var(--stop); border-color: var(--stop); color: #fff; }
.btn--go { background: var(--go); border-color: var(--go); box-shadow: 0 1px 2px rgba(23, 160, 107, .2); }
.btn--go:hover { background: #128257; border-color: #128257; }
.btn--sm { padding: 5px 12px; font-size: 13px; }
.btn--wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; }

/* --- Сообщения --- */
.msg {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.msg--ok   { background: var(--go-bg);   border-color: #bce6d4; color: #0e7a50; }
.msg--warn { background: var(--hold-bg); border-color: #f0d6a2; color: #97600a; }
.msg--err  { background: var(--stop-bg); border-color: #f5c2bd; color: #b7352c; }

/* --- Сводка --- */
.stat { display: flex; gap: 28px; flex-wrap: wrap; }
.stat__item { min-width: 96px; }
.stat__k {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 3px;
}
.stat__v { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot--on { background: var(--go); }
.dot--off { background: var(--gray-200); }

/* --- Таблицы --- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 14px 9px 0;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.tbl td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl tbody tr:hover { background: var(--gray-10); }
.tbl--tight td { padding: 6px 14px 6px 0; font-size: 13px; }

/* --- Метки статуса --- */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: var(--gray-50);
  white-space: nowrap;
}
.tag--hold        { color: var(--hold); background: var(--hold-bg); }
.tag--packed      { color: var(--go);   background: var(--go-bg); }
.tag--waiting_cis { color: var(--hold); background: var(--hold-bg); }
.tag--skipped     { color: var(--stop); background: var(--stop-bg); }
.tag--cancelled   { color: var(--muted); text-decoration: line-through; }
.tag--delivered   { color: var(--muted); }

/* --- Пустой раздел --- */
.empty {
  border: 1px dashed var(--gray-100);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--gray-10);
}
.empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 15px; font-weight: 600; }
.empty p { margin: 0 auto; max-width: 46ch; font-size: 13px; }

/* --- Вход --- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.auth__card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth__body { padding: 30px 28px 28px; }
.auth__brand {
  font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 16px;
}
.auth__title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 18px; }
.auth__qr { display: block; margin: 0 auto 14px; width: 190px; height: 190px; image-rendering: pixelated; }
.auth__secret {
  font-family: var(--mono); font-size: 13px; text-align: center;
  background: var(--gray-10); border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm); padding: 10px; word-break: break-all; margin-bottom: 16px;
}

/* --- Каталог --- */
.prod {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.prod[open] { border-color: var(--gray-100); box-shadow: var(--shadow); }
.prod--muted { opacity: .55; }
.prod--muted[open], .prod--muted:hover { opacity: 1; }
.prod__row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px; cursor: pointer; list-style: none; font-size: 13.5px;
}
.prod__row::-webkit-details-marker { display: none; }
.prod__row::before { content: "›"; color: var(--muted); font-size: 15px; flex: 0 0 auto; }
.prod[open] > .prod__row::before { content: "⌄"; }
.prod__row:hover { background: var(--gray-10); }
.prod__art { flex: 0 0 120px; font-weight: 600; }
.prod__name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod__nm { flex: 0 0 100px; color: var(--muted); font-size: 12.5px; text-align: right; }
.prod__meta { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; min-width: 150px; justify-content: flex-end; }
.prod__count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.prod__body { padding: 0; border-top: 1px solid var(--rule-soft); background: var(--gray-10); }
.prod__grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: 1px; background: var(--rule-soft); }
.prod__tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; }
.prod__ops { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; background: var(--card); border-top: 1px solid var(--rule-soft); }

.pane { background: var(--card); padding: 16px 18px; }
.pane--wide { border-top: 1px solid var(--rule-soft); }
.pane__h { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.pane__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule-soft); }
.pane__chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.chk input { margin: 0; }

.bc-table { margin-bottom: 12px; }
.bc-add { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--rule-soft); }
.bc-add input { padding: 6px 10px; font-size: 13px; }
.bc-add input[name="value"] { flex: 0 0 180px; }
.bc-add input[name="note"] { flex: 1 1 220px; }

/* --- Метки --- */
.tag-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-pill);
  background: var(--card); color: var(--ink-soft);
  font-size: 13px; text-decoration: none; cursor: pointer;
  transition: background-color 120ms linear, border-color 120ms linear, color 120ms linear;
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip--on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip--sm { font-size: 11px; padding: 2px 9px; }
.chip--del { color: var(--stop); border-color: var(--gray-100); }
.chip--del:hover { background: var(--stop); border-color: var(--stop); color: #fff; }
.chip--pick input { margin: 0; width: 13px; height: 13px; }
.chip--pick.chip--on input { accent-color: #fff; }

/* --- Общие мелочи --- */
.sku__add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.sku__add input { padding: 8px 12px; font-size: 13.5px; }
.cell-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.cell-actions form { margin: 0; }
.cell-actions .btn { flex: 0 0 auto; }
.inv-form { display: flex; gap: 6px; justify-content: flex-end; margin: 0; }
.inv-form input { width: 82px; padding: 5px 9px; text-align: right; }
.search-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.search-row input[type="text"] { flex: 0 1 360px; }

.new-prod { padding: 0; }
.new-prod__toggle { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; align-items: center; gap: 10px; }
.new-prod__toggle::-webkit-details-marker { display: none; }
.new-prod__toggle::after { content: "раскроется форма"; font-size: 12.5px; color: var(--muted); }
.new-prod[open] .new-prod__toggle::after { content: "свернуть"; }
.new-prod__body { padding: 6px 20px 20px; }

.imp { margin-top: 12px; border-top: 1px solid var(--rule-soft); padding-top: 12px; }
.imp__toggle {
  cursor: pointer; font-size: 13px; color: var(--accent);
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
.imp__toggle::-webkit-details-marker { display: none; }
.imp__toggle::before { content: "›"; font-size: 14px; }
.imp[open] .imp__toggle::before { content: "⌄"; }
.imp__body { padding-top: 12px; max-width: 700px; }

.staff-table td { vertical-align: middle; }
.staff-table .inv-form { flex-wrap: nowrap; justify-content: flex-start; }
.staff-table .inv-form select { flex: 1 1 auto; min-width: 0; }
.staff-gap { margin-top: 20px; }

/* --- Таблица остатков --- */
#stock-table { table-layout: fixed; }
#stock-table th, #stock-table td { padding-right: 16px; }
#stock-table th:last-child, #stock-table td:last-child { padding-right: 0; }
.col-art { width: 110px; }
.col-name { width: auto; }
.col-qty { width: 88px; }
.col-wh  { width: 92px; }
.col-inv { width: 180px; }
#stock-table td.col-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-fbo { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; width: 100%; }
.wh-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-left: 4px;
  font-family: var(--mono); font-size: 12px; line-height: 1;
  border: 1px solid var(--gray-100); border-radius: 6px;
  background: var(--card); color: var(--ink); cursor: pointer; vertical-align: middle;
}
.wh-toggle:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
th.wh-col, td.wh-col { background: var(--gray-10); font-size: 12.5px; color: var(--muted); }
th.wh-col { font-size: 10px; white-space: normal; line-height: 1.25; vertical-align: bottom; }

/* --- Аналитика --- */
.days { display: flex; align-items: flex-end; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.day { flex: 0 0 44px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.day__bar { width: 100%; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.day:hover .day__bar { background: var(--accent-dark); }
.day__n { font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums; }
.day__d { font-size: 10px; color: var(--muted); white-space: nowrap; }

@media (max-width: 1000px) {
  .layout { flex-direction: column; }
  .side { flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: none; border-bottom: 1px solid var(--rule); padding: 10px 12px; }
  .side__brand { padding: 4px 10px; }
  .side__foot { margin: 0 0 0 auto; border: none; padding: 0 10px; display: flex; align-items: center; gap: 10px; }
  .side__who { margin: 0; }
  .shell { padding: 18px 16px 48px; }
  .prod__grid { grid-template-columns: 1fr; }
  .search-row { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* --- Приёмка возвратов --- */
.ret {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 30px 24px;
  text-align: center;
  background: var(--card);
  box-shadow: var(--shadow);
}
.ret[data-state="ask"]  { background: var(--hold-bg); border-color: #f0d6a2; }
.ret[data-state="warn"] { background: var(--hold-bg); border-color: #f0d6a2; }
.ret[data-state="stop"] { background: var(--stop-bg); border-color: #f5c2bd; }
.ret__title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.ret[data-state="stop"] .ret__title { color: var(--stop); }
.ret[data-state="ask"] .ret__title { color: var(--hold); }
.ret__detail { color: var(--ink-soft); font-size: 14px; }
.ret__item {
  margin-top: 12px; font-size: 14px;
  background: var(--card); border: 1px solid var(--rule-soft);
  border-radius: var(--radius-sm); padding: 10px 14px; display: inline-block;
}
.ret__item:empty { display: none; }
.ret__ops { display: flex; gap: 10px; justify-content: center; margin-top: 18px; min-height: 34px; }
.ret__input { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* --- Вкладки отчёта --- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}
.tabs__i {
  padding: 8px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 120ms linear, color 120ms linear;
}
.tabs__i:hover { color: var(--ink); }
.tabs__i--on {
  color: var(--accent-dark);
  font-weight: 600;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

/* --- Журнал решений --- */
.note {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  margin-bottom: 8px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.note--done { opacity: .55; }
.note--done:hover { opacity: 1; }
.note__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 8px;
  font-size: 12.5px;
  min-width: 0;
}
.note__date { color: var(--muted); white-space: nowrap; }
.note__who { color: var(--muted); white-space: nowrap; }

/* Кнопки прижаты вправо и не переносятся: без nowrap строка
   рассыпается в столбик, как только шапке становится тесно. */
.note__ops {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.note__ops form { margin: 0; }

.note__text {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 14px;
}
.note--done .note__text { text-decoration: line-through; text-decoration-color: var(--gray-200); }

.notes__bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-soft);
}
.notes__bar h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
  white-space: nowrap;
}

/* --- Юнит-экономика --- */
.ec-head{display:flex;justify-content:space-between;align-items:center;
  margin-bottom:14px;gap:12px;flex-wrap:wrap}
.ec-schemes{display:flex;gap:4px;padding:4px;border-radius:var(--radius-sm);
  background:var(--gray-50)}
.ec-scheme{padding:6px 14px;border-radius:6px;font-size:13px;font-weight:500;
  text-decoration:none;color:var(--ink-soft);background:transparent;
  border:1px solid transparent}
.ec-scheme:hover{background:var(--gray-100);text-decoration:none}
.ec-scheme--on{background:var(--card);border-color:transparent;
  color:var(--accent-dark);font-weight:600;box-shadow:var(--shadow-sm)}
.ec-period{font-size:12px;color:var(--muted)}

.ec-warn{padding:10px 14px;margin-bottom:8px;border-radius:var(--radius-sm);
  font-size:13px;background:var(--hold-bg);color:var(--hold);
  border:1px solid #f0d6a2}
.ec-empty{padding:16px;border-radius:var(--radius-sm);font-size:13px;
  color:var(--ink-soft);background:var(--gray-10);line-height:1.5;
  border:1px dashed var(--gray-100);margin-bottom:16px}

.ec-hero{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.ec-hero__i{flex:1 1 240px;padding:18px 20px;background:var(--card);
  border:1px solid var(--rule);border-radius:var(--radius);box-shadow:var(--shadow)}
.ec-hero__t{font-size:12px;color:var(--muted);margin-bottom:8px}
.ec-hero__v{font-size:30px;font-weight:700;color:var(--ink);letter-spacing:-.03em;
  line-height:1.1;font-variant-numeric:tabular-nums}

.ec-flow{margin-bottom:20px;padding:16px 18px;background:var(--card);
  border:1px solid var(--rule);border-radius:var(--radius);box-shadow:var(--shadow)}
.ec-flow__t{font-size:14px;font-weight:600;letter-spacing:-.01em;
  color:var(--ink);margin-bottom:12px}
.ec-bar{display:flex;height:28px;border-radius:var(--radius-pill);overflow:hidden;
  background:var(--gray-50)}
.ec-bar__s{height:100%}
.ec-bar__s--fee{background:var(--accent)}
.ec-bar__s--ship{background:#f5a524}
.ec-bar__s--cost{background:var(--gray-200)}
.ec-bar__s--ads{background:#8b5cf6}
.ec-bar__s--tax{background:var(--stop)}
.ec-bar__s--profit{background:var(--go)}
.ec-legend{display:grid;gap:2px 18px;margin-top:14px;
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr))}
.ec-legend__i{display:flex;align-items:center;gap:8px;font-size:12px;
  padding:4px 0;border-bottom:1px solid var(--rule-soft)}
.ec-legend__l{color:var(--ink-soft);flex:1;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis}
.ec-legend__p{color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums}
.ec-legend__v{color:var(--muted);font-variant-numeric:tabular-nums;
  min-width:88px;text-align:right}
.ec-dot{width:9px;height:9px;border-radius:3px;flex:none}
.ec-dot--fee{background:var(--accent)}
.ec-dot--ship{background:#f5a524}
.ec-dot--cost{background:var(--gray-200)}
.ec-dot--ads{background:#8b5cf6}
.ec-dot--tax{background:var(--stop)}
.ec-dot--profit{background:var(--go)}

.ec-sec{margin-bottom:18px}
.ec-sec__t{font-size:12px;font-weight:600;text-transform:uppercase;
  letter-spacing:.04em;color:var(--muted);margin-bottom:10px;
  padding-bottom:6px;border-bottom:1px solid var(--rule)}
.ec-grid{display:grid;gap:10px;grid-template-columns:repeat(auto-fill,minmax(200px,1fr))}
.ec-card{padding:14px 16px;border-radius:var(--radius);background:var(--card);
  border:1px solid var(--rule);box-shadow:var(--shadow-sm)}
.ec-card__t{font-size:12px;color:var(--muted);margin-bottom:6px;line-height:1.3;
  min-height:2.6em}
.ec-card__v{font-size:20px;font-weight:700;color:var(--ink);letter-spacing:-.02em;
  font-variant-numeric:tabular-nums}
.ec-card__s{font-size:12px;color:var(--muted);margin-top:2px}
.ec-mini{height:4px;background:var(--gray-50);border-radius:var(--radius-pill);margin-top:10px}
.ec-mini > i{display:block;height:100%;background:var(--accent);border-radius:var(--radius-pill)}
.ec-d{display:inline-block;margin-top:8px;padding:3px 8px;
  border-radius:var(--radius-pill);font-size:11px;font-weight:600;
  font-variant-numeric:tabular-nums}
.ec-d--up{background:var(--go-bg);color:var(--go)}
.ec-d--down{background:var(--stop-bg);color:var(--stop)}

@media (max-width:640px){
  .ec-hero__v{font-size:24px}
  .ec-grid{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
}

.ec-dates{display:flex;gap:10px;align-items:center;flex-wrap:wrap;
  margin-bottom:14px;padding:12px 14px;background:var(--card);
  border:1px solid var(--rule);border-radius:var(--radius);box-shadow:var(--shadow-sm)}
.ec-dates label{font-size:13px;color:var(--muted);display:flex;gap:6px;align-items:center}
.ec-dates input[type=date]{padding:6px 10px;border:1px solid var(--gray-100);
  border-radius:var(--radius-sm);font:inherit;font-size:13px}
.ec-quick{display:flex;gap:10px;margin-left:auto}
.ec-quick a{font-size:12px;color:var(--accent);text-decoration:none}
.ec-quick a:hover{text-decoration:underline}
.ec-q{display:inline-flex;align-items:center;justify-content:center;
  width:15px;height:15px;margin-left:5px;border-radius:50%;
  background:var(--gray-100);color:var(--muted);font-size:10px;
  font-weight:700;cursor:help;position:relative;vertical-align:middle}
.ec-q > i{display:none;position:absolute;bottom:20px;left:-8px;z-index:20;
  width:270px;padding:10px 12px;border-radius:var(--radius-sm);font-style:normal;
  font-size:12px;font-weight:400;line-height:1.45;text-align:left;
  color:#fff;background:var(--ink);box-shadow:0 8px 24px rgba(20,32,60,.22)}
.ec-q:hover > i, .ec-q:focus > i{display:block}
.ec-card:nth-child(-n+4) .ec-q > i{bottom:auto;top:20px}

.ec-weeks{display:flex;gap:6px;align-items:center;font-size:12px;
  color:var(--muted);flex-wrap:wrap;margin-left:auto}
.ec-weeks a{color:var(--accent);text-decoration:none;padding:1px 5px;
  border-radius:var(--radius-sm);font-variant-numeric:tabular-nums}
.ec-weeks a:hover{background:var(--accent-bg)}
.ec-weeks .ec-week--on{background:var(--accent);color:#fff;border-color:var(--accent)}

.ec-note{font-size:12px;color:var(--muted);line-height:1.5;margin:0 0 10px}
.ec-tbl-wrap{overflow-x:auto}
.ec-tbl{font-size:12px;white-space:nowrap}
.ec-tbl .r{text-align:right;font-variant-numeric:tabular-nums}
.ec-tbl__n{max-width:220px;overflow:hidden;text-overflow:ellipsis}
.ec-loss td{background:var(--stop-bg)}
.ec-warn-i{color:var(--hold);cursor:help;border-bottom:1px dotted var(--hold)}

.ec-weeks{margin-left:0}
.ec-weeks__t{color:var(--ink);font-weight:600}
.ec-weeks a{padding:4px 9px;border:1px solid var(--gray-100);background:var(--card)}
.ec-dates__t{font-size:12px;color:var(--muted)}

.cost-sum{text-align:right;color:var(--muted);font-weight:600}

.ec-fc{margin-bottom:16px;padding:14px 18px;background:var(--accent-bg);
  border:1px solid #c9d8fb;border-radius:var(--radius)}
.ec-fc__t{font-size:12px;font-weight:600;text-transform:uppercase;
  letter-spacing:.04em;color:var(--accent-dark);margin-bottom:10px}
.ec-fc__row{display:flex;gap:28px;flex-wrap:wrap}
.ec-fc__row > div{display:flex;flex-direction:column;gap:2px}
.ec-fc__row span{font-size:12px;color:var(--muted)}
.ec-fc__row b{font-size:22px;font-weight:700;letter-spacing:-.02em;color:var(--ink);
  font-variant-numeric:tabular-nums}
.ec-fc--go{color:var(--go)}
.ec-fc--stop{color:var(--stop)}

.ec-spp--down{color:var(--stop);font-weight:700}
.ec-spp--up{color:var(--go);font-weight:700}

/* Форма выбора дней на вкладке СПП: подпись «сравнить с» переносилась
   на две строки и сжимала поле даты до нечитаемого размера. */
.ec-dates label{white-space:nowrap;flex:none}
.ec-dates input[type=date]{min-width:165px;padding:8px 12px;font-size:14px}
.ec-dates .btn{flex:none}

.spp-notes{margin:12px 0;padding:12px 16px;background:var(--gray-10);
  border:1px solid var(--rule);border-radius:var(--radius-sm);font-size:13px}
.spp-notes__d{margin-bottom:6px;display:flex;gap:10px;flex-wrap:wrap;align-items:baseline}
.spp-notes__d:last-child{margin-bottom:0}
.spp-note{color:var(--ink-soft)}

.spp-range{color:var(--muted);font-size:11px;white-space:nowrap}
.spp-cnt{display:block;font-size:10px;opacity:.75}

/* В заголовке таблицы места сверху нет — подсказка уходит за границу
   прокрутки и остаётся невидимой. Разворачиваем её вниз. */
.ec-tbl th .ec-q > i{bottom:auto;top:20px;left:auto;right:-8px}

/* Подсказка в заголовке таблицы наследовала верхний регистр и не
   переносилась по строкам — текст обрезался на первой строке. */
.ec-tbl th .ec-q > i{
  bottom:auto; top:20px; left:auto; right:-8px;
  width:320px; font-size:11px; line-height:1.5;
  text-transform:none; letter-spacing:normal; font-weight:400;
  white-space:normal; word-break:normal;
}

.fn-warn td{background:var(--hold-bg)}
.fn-bad{color:var(--stop);font-weight:700}
.fn-issues{font-size:11px;color:var(--hold);white-space:normal;max-width:280px}
.hyp{padding:14px 16px;margin-bottom:10px;border-radius:var(--radius-sm);
  background:var(--card);border:1px solid var(--rule);
  border-left:3px solid var(--gray-100);box-shadow:var(--shadow-sm)}
.hyp--ready{border-left-color:var(--accent)}
.hyp__t{font-weight:600;font-size:14px;margin-bottom:2px}
.hyp__q{font-size:12px;color:var(--muted);margin-bottom:6px}
.hyp__v{font-size:13px;color:var(--ink)}
.hyp__d{font-size:11px;color:var(--muted);margin-top:6px;line-height:1.5}

.ec-fc__p{font-weight:400;text-transform:none;letter-spacing:normal;
  color:var(--accent-dark);opacity:.8;margin-left:6px}

.fn-d{font-size:11px;font-variant-numeric:tabular-nums}
.fn-up{color:var(--go)}
.fn-dn{color:var(--stop)}

/* --- План продаж --- */
.plan-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.plan-bar__m{font-size:17px;font-weight:700;letter-spacing:-.01em;min-width:150px;
  text-align:center;text-transform:capitalize}
.plan-bar__t{font-size:12px;color:var(--muted)}
.plan-bar__setup{margin-left:auto}
.plan-copy{display:flex;align-items:center;gap:8px;margin:0 0 0 18px;flex-wrap:wrap}

.plan-sum{display:flex;gap:26px;flex-wrap:wrap;margin-top:14px;padding-top:14px;
  border-top:1px solid var(--rule-soft);font-size:13px;color:var(--muted)}
.plan-sum b{display:inline-block;margin-left:6px;font-size:17px;color:var(--ink);
  font-weight:700;font-variant-numeric:tabular-nums}

.plan-wrap{overflow-x:auto;margin:-4px -4px 0}
.plan-tbl{font-size:12.5px;white-space:nowrap;border-collapse:separate;border-spacing:0}
.plan-tbl th,.plan-tbl td{padding:6px 8px;border-bottom:1px solid var(--rule-soft);
  background:var(--card)}
.plan-tbl th{position:sticky;top:0;z-index:3;padding-bottom:8px;
  border-bottom:1px solid var(--rule)}
.plan-tbl td.num,.plan-tbl th.num{text-align:right;font-variant-numeric:tabular-nums}

/* Первые колонки не уезжают при прокрутке дней. */
.plan-c1{position:sticky;left:0;z-index:2;min-width:86px}
.plan-c2{position:sticky;left:86px;z-index:2;min-width:210px;max-width:210px;
  overflow:hidden;text-overflow:ellipsis}
.plan-c3{position:sticky;left:296px;z-index:2;min-width:78px}
.plan-c4{position:sticky;left:374px;z-index:2;min-width:78px;
  box-shadow:1px 0 0 var(--rule)}
.plan-tbl thead .plan-c1,.plan-tbl thead .plan-c2,
.plan-tbl thead .plan-c3,.plan-tbl thead .plan-c4{z-index:4}

.plan-d{min-width:30px}
.plan-we{background:var(--gray-50)}
.plan-today{color:var(--accent);font-weight:700}

.plan-in{width:64px;padding:3px 6px;font-size:12.5px;text-align:right;
  border-radius:6px;border:1px solid var(--gray-100)}
.plan-in:focus{border-color:var(--accent);box-shadow:var(--ring)}

.plan-g td{background:var(--gray-10);font-weight:600;color:var(--ink)}
.plan-g .plan-we{background:var(--gray-50)}
.plan-total td{background:var(--accent-bg);font-weight:700;color:var(--ink);
  border-bottom:none}
.plan-over{color:var(--go);font-weight:600}

.plan-p{display:inline-block;padding:1px 8px;border-radius:var(--radius-pill);
  font-weight:600;font-size:11.5px}
.plan-p--go{background:var(--go-bg);color:var(--go)}
.plan-p--hold{background:var(--hold-bg);color:var(--hold)}
.plan-p--stop{background:var(--stop-bg);color:var(--stop)}

/* Панель месяца: поля не должны растягиваться на всю карточку. */
.plan-copy{margin-left:18px}
.plan-copy select{width:auto;min-width:210px;flex:0 0 auto}
.plan-copy input[type=text]{width:72px;flex:0 0 auto;text-align:right}
.plan-bar__t{flex:0 0 auto;margin-left:-2px}

/* --- План продаж: вкладки месяцев, группы, выходные --- */

/* Фон ячеек таблицы задан по .plan-tbl td и перебивал .plan-we —
   выходные оставались белыми. */
.plan-tbl td.plan-we, .plan-tbl th.plan-we { background: #eef1f7; }
.plan-tbl tr.plan-g td.plan-we { background: #e7ebf4; }

.plan-head { padding-bottom: 12px; }
.plan-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--rule-soft) }
.plan-tab { padding: 5px 11px; border-radius: var(--radius-sm); font-size: 13px;
  font-weight: 500; color: var(--ink-soft); background: var(--gray-50);
  text-decoration: none; white-space: nowrap }
.plan-tab:hover { background: var(--gray-100); text-decoration: none }
/* Прошлые годы приглушены, будущие месяцы — пунктиром: год виден сразу. */
.plan-tab--old { color: var(--muted); background: transparent;
  border: 1px solid var(--rule) }
.plan-tab--next { color: var(--muted); background: transparent;
  border: 1px dashed var(--gray-200) }
.plan-tab--on, .plan-tab--on.plan-tab--old, .plan-tab--on.plan-tab--next {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 600 }

.plan-bar__help { width: 17px; height: 17px; margin-left: auto; flex: 0 0 auto }
.plan-bar__help > i { left: auto; right: -8px; width: 320px }

/* Пустая строка между группами — как разделитель листа в Excel. */
.plan-sp td { height: 10px; padding: 0; background: var(--paper);
  border-bottom: none }

.plan-tog { width: 18px; height: 18px; line-height: 1; padding: 0;
  border: 1px solid var(--gray-100); border-radius: 5px; background: var(--card);
  color: var(--ink-soft); font: inherit; font-size: 13px; cursor: pointer }
.plan-tog:hover { background: var(--accent); border-color: var(--accent);
  color: #fff }
.plan-hide { display: none }

.plan-g td { cursor: default }

/* --- Сворачивание левого меню --- */
.side__collapse { margin-left: auto; }
.side-btn { width: 28px; height: 28px; padding: 0; line-height: 1;
  border: 1px solid var(--gray-100); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink-soft); font-size: 15px;
  cursor: pointer }
.side-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff }
.side-show { display: none; position: fixed; left: 12px; top: 12px; z-index: 50;
  box-shadow: var(--shadow) }
html.side-off .side { display: none }
html.side-off .side-show { display: inline-flex; align-items: center;
  justify-content: center }
html.side-off .shell { max-width: none; padding-left: 56px }
@media (max-width: 1000px) {
  html.side-off .shell { padding-left: 56px }
}

/* --- План продаж: тумблер канала, границы дней, итоги групп --- */
.plan-ch { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm);
  background: var(--gray-50); margin-left: 18px }
.plan-ch__i { padding: 5px 14px; border-radius: 6px; font-size: 13px;
  font-weight: 500; color: var(--ink-soft); text-decoration: none }
.plan-ch__i:hover { background: var(--gray-100); text-decoration: none }
.plan-ch__i--on { background: var(--card); color: var(--accent-dark);
  font-weight: 600; box-shadow: var(--shadow-sm) }

/* Вкладки месяцев ушли под строку с месяцем. */
.plan-tabs { margin: 14px 0 0; padding: 12px 0 0;
  border-top: 1px solid var(--rule-soft); border-bottom: none }

/* Вертикальные линии между днями: без них глаз теряет столбец. */
.plan-tbl th.plan-d, .plan-tbl td.plan-d,
.plan-tbl tbody td:nth-child(n+5), .plan-tbl thead th:nth-child(n+5) {
  border-left: 1px solid var(--rule-soft) }
.plan-tbl td.plan-c4, .plan-tbl th.plan-c4 { border-right: 1px solid var(--rule) }

/* Разрыв между группами — белый и заметный. */
.plan-sp td { height: 18px; padding: 0; background: var(--card);
  border-bottom: none; border-left: none }

/* Шапка группы — только название, цифры ушли в итог внизу. */
.plan-g td { background: var(--gray-10); font-weight: 600; color: var(--ink) }
.plan-gf td { background: var(--gray-10); font-weight: 700; color: var(--ink);
  border-top: 1px solid var(--rule) }
.plan-gf td.plan-we, .plan-g td.plan-we { background: #e7ebf4 }

/* Прогноз: светло-серым, чтобы не путать с фактом. */
.plan-fc { color: #aab2c4 }

/* --- Пометки на ячейках плана --- */
.plan-cell { cursor: cell }
.plan-nt { position: relative }
/* Уголок, как в Excel: видно, что в ячейке есть комментарий. */
.plan-nt::after { content: ""; position: absolute; top: 0; right: 0;
  border: 4px solid transparent; border-top-color: #7c869c;
  border-right-color: #7c869c }
.plan-nt--blue { background: #dbe6fd !important }
.plan-nt--blue::after { border-top-color: #3f6be8; border-right-color: #3f6be8 }
.plan-nt--orange { background: #fdeacd !important }
.plan-nt--orange::after { border-top-color: #c07806; border-right-color: #c07806 }
.plan-nt--red { background: #fbd9d7 !important }
.plan-nt--red::after { border-top-color: #e0483f; border-right-color: #e0483f }
.plan-nt--green { background: #d6f2e6 !important }
.plan-nt--green::after { border-top-color: #17a06b; border-right-color: #17a06b }
.plan-nt--yellow { background: #fbf3c6 !important }
.plan-nt--yellow::after { border-top-color: #b59a0a; border-right-color: #b59a0a }

.plan-pop { position: absolute; z-index: 80; width: 280px; padding: 12px;
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20,32,60,.18) }
.plan-pop__t { width: 100%; font-size: 13px; resize: vertical }
.plan-pop__c { display: flex; gap: 6px; margin: 10px 0 }
.plan-sw { width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--gray-200); padding: 0 }
.plan-sw--on { outline: 2px solid var(--accent); outline-offset: 1px }
.plan-sw--none { background: var(--card) }
.plan-sw--blue { background: #3f6be8; border-color: #3f6be8 }
.plan-sw--orange { background: #f0a020; border-color: #f0a020 }
.plan-sw--red { background: #e0483f; border-color: #e0483f }
.plan-sw--green { background: #17a06b; border-color: #17a06b }
.plan-sw--yellow { background: #edd534; border-color: #edd534 }
.plan-pop__b { display: flex; gap: 8px }

.plan-cell { cursor: default }

/* --- План продаж: квадратные ячейки, дневной план, остатки --- */
.plan-c0 { position: sticky; left: 296px; z-index: 2; min-width: 72px }
.plan-c3 { left: 368px; min-width: 70px }
.plan-c4 { left: 438px; min-width: 84px }

/* Поле плана без рамки: таблица читается как таблица, а не как форма. */
.plan-in { width: 60px; padding: 1px 4px; border: 1px solid transparent;
  background: transparent; border-radius: 4px; font-size: 12.5px;
  text-align: right }
.plan-in:hover { border-color: var(--gray-100); background: var(--card) }
.plan-in:focus { border-color: var(--accent); background: var(--card);
  box-shadow: var(--ring) }

/* Ячейка дня — квадрат: две строки, факт и план. */
.plan-tbl td, .plan-tbl th { padding: 2px 5px }
.plan-tbl td.plan-c1, .plan-tbl td.plan-c2 { padding: 2px 8px }
.plan-d, .plan-cell { min-width: 34px; width: 34px }
.plan-f { display: block; line-height: 1.15; font-variant-numeric: tabular-nums }
.plan-f--go { color: var(--go) }
.plan-f--low { color: var(--stop) }
.plan-dp { display: block; font-size: 9.5px; line-height: 1.1; color: #aab2c4;
  font-variant-numeric: tabular-nums }

.plan-tip { position: absolute; z-index: 90; max-width: 280px; padding: 8px 10px;
  font-size: 12px; line-height: 1.45; color: #fff; background: var(--ink);
  border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(20,32,60,.22);
  pointer-events: none; white-space: pre-wrap }

.plan-tog { margin-right: 4px }

/* Колонки плана уже и одинаковой ширины: цифры короткие, место нужнее дням. */
.plan-c3 { left: 368px; min-width: 62px; width: 62px }
.plan-c4 { left: 430px; min-width: 62px; width: 62px }
.plan-in { width: 52px }
.plan-f--go, .plan-f--low { color: inherit }

/* Четырёхзначный план не помещался в поле. */
.plan-c3 { min-width: 76px; width: 76px }
.plan-c4 { left: 444px; min-width: 76px; width: 76px }
.plan-in { width: 68px }

/* Поле плана без рамки даже при наведении: столбец читается как обычный. */
.plan-in:hover { border-color: transparent; background: transparent }
.plan-in:focus { border-color: var(--accent); background: var(--card) }

/* Общее правило для полей ввода сильнее класса, поэтому селектор с тегом. */
input.plan-in,
input.plan-in:hover { border-color: transparent; background: transparent;
  box-shadow: none }
input.plan-in:focus { border-color: var(--accent); background: var(--card);
  box-shadow: var(--ring) }
