/* ============================================================
   1С ⇄ Lamoda FBS — стили демонстрационного дашборда.
   Светлая тема в духе обычной CRM: белый фон, синий акцент,
   без декоративных эффектов. Без внешних зависимостей.
   ============================================================ */

/* ---------------- токены ---------------- */

:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --border: #e4e9f1;
  --border-strong: #d3dbe7;

  --text: #1f2a37;
  --text-2: #5f6f81;
  --text-3: #94a1b2;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --ring: #2563eb;

  --c-1c: #f59e0b;      /* сторона 1С */
  --c-lm: #2563eb;      /* сторона Lamoda */
  --c-err: #dc2626;

  --ok: #16a34a;
  --ok-bg: #e5f6eb;
  --ok-border: #bfe6cd;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);

  --font: Inter, "SF Pro Display", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---------------- база ---------------- */

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

html { scroll-behavior: smooth; }

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

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 21px; letter-spacing: -.01em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--primary); }

.ic {
  width: 16px; height: 16px;
  flex: none;
  vertical-align: -3px;
}

.mono { font-family: var(--mono); font-size: .93em; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dim { color: var(--text-2); }
.num, .kpi-v, .ktile-v, .lg-val, .flow-freq { font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.c-lm { color: var(--primary); }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }

::selection { background: #cfe0fc; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd8e4; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

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

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  padding: 8px 14px; border-radius: 10px;
  background: var(--primary); color: #fff; text-decoration: none;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

.noscript { padding: 24px; text-align: center; color: var(--c-err); }

/* ---------------- шапка ---------------- */

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

.topbar-inner {
  max-width: none; padding: 12px 28px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
}
.brand-mark .ic { width: 19px; height: 19px; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand-name em { font-style: normal; color: var(--text-3); padding: 0 2px; }
.brand-sub { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

/* вкладки */

.tabs {
  padding: 0 28px;
  display: flex; gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none; border: 0; background: transparent;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px 11px;
  color: var(--text-2);
  font: inherit; font-weight: 500; font-size: 13.5px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color .15s ease, background-color .15s ease;
}
.tab:hover { color: var(--text); background: #f1f4f9; }
.tab-on { color: var(--primary); font-weight: 600; }
.tab-on::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0;
  height: 2px; border-radius: 2px;
  background: var(--primary);
}

.tab-hint {
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 3px 5px; border-radius: 6px;
  background: #fef3e2; color: #b45309;
  border: 1px solid #f5d9a8;
}

/* ---------------- layout ---------------- */

.container {
  padding: 24px 28px 40px;
  display: flex; flex-direction: column; gap: 18px;
}

.page { display: flex; flex-direction: column; gap: 18px; }

.page-head { display: flex; flex-direction: column; gap: 5px; }
.sub { color: var(--text-2); font-size: 13.5px; max-width: 72ch; }
.sub b { color: var(--text); font-weight: 600; }

.grid { display: grid; gap: 18px; min-width: 0; }
.grid-pipe { grid-template-columns: 1.55fr 1fr; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-orders { grid-template-columns: 370px minmax(0, 1fr); align-items: start; }

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

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  margin-bottom: 14px;
}
.card-head-row { flex-wrap: wrap; align-items: center; }
.card-sub { color: var(--text-2); font-size: 12.5px; margin-top: 3px; }

.link { font-size: 12.5px; text-decoration: none; border-bottom: 1px dashed rgba(37, 99, 235, .5); white-space: nowrap; }
.link:hover { color: var(--primary-hover); }

/* ---------------- KPI ---------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
}

.kpi { padding: 13px 16px; display: flex; flex-direction: column; gap: 5px; }
.kpi-label { font-size: 12px; color: var(--text-2); }
.kpi-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi-v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.kpi-delta { font-size: 11.5px; font-weight: 600; }
.kpi-delta.up { color: #15803d; }
.kpi-delta.down { color: var(--c-err); }
.kpi-accent-danger .kpi-v { color: var(--c-err); }
.kpi-accent-ok .kpi-v { color: #15803d; }

.kpi-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.ktile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.ktile-v { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.ktile-l { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

/* ---------------- пилюли, точки, бейджи ---------------- */

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  background: var(--panel);
}
.pill .ic { width: 13px; height: 13px; }
.pill-ok { color: #15803d; border-color: var(--ok-border); background: var(--ok-bg); }
.pill-good { color: #15803d; border-color: var(--ok-border); background: var(--ok-bg); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.dot-pulse { animation: pulse 2.2s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .35); }
  70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.st-new   { color: #1d4ed8; background: #e8f0fe; border-color: #c6dbfc; }
.st-assm  { color: #b45309; background: #fef3e2; border-color: #f5d9a8; }
.st-asmbl { color: #6d28d9; background: #f1ecfe; border-color: #ddd2f8; }
.st-ready { color: #0f766e; background: #e0f5f2; border-color: #b5e5de; }
.st-ship  { color: #15803d; background: var(--ok-bg); border-color: var(--ok-border); }
.st-ret   { color: #b91c1c; background: #fdecec; border-color: #f5c6c6; }

.ev-stock  { color: #1d4ed8; background: #e8f0fe; border-color: #c6dbfc; }
.ev-order  { color: #6d28d9; background: #f1ecfe; border-color: #ddd2f8; }
.ev-asm    { color: #b45309; background: #fef3e2; border-color: #f5d9a8; }
.ev-label  { color: #a21caf; background: #fbeffc; border-color: #eecdf5; }
.ev-ship   { color: #0f766e; background: #e0f5f2; border-color: #b5e5de; }
.ev-ret    { color: #b91c1c; background: #fdecec; border-color: #f5c6c6; }
.ev-err    { color: #b91c1c; background: #fdecec; border-color: #f5c6c6; }

/* ---------------- кнопки и поля ---------------- */

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { background: #1e40af; }
.btn:disabled { opacity: .55; cursor: default; }

.btn-ghost {
  background: var(--panel);
  border-color: var(--border-strong);
  color: var(--text-2);
}
.btn-ghost:hover { color: var(--text); border-color: #b9c4d4; background: var(--panel); }

.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn-sm .ic { width: 13px; height: 13px; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-violet { background: #7c3aed; }
.btn-violet:hover { background: #6d28d9; }
.btn-violet:active { background: #5b21b6; }
.btn-teal { background: #0d9488; }
.btn-teal:hover { background: #0f766e; }
.btn-teal:active { background: #115e59; }

.icon-btn {
  appearance: none; border: 1px solid var(--border); background: var(--panel);
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-2); cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

.btn.spinning .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { position: relative; display: inline-flex; align-items: center; }
.field-ic {
  position: absolute; left: 10px; width: 14px; height: 14px;
  color: var(--text-3); pointer-events: none;
}
.field input, .field select {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font: inherit; font-size: 12.5px;
  padding: 7px 12px;
}
.field input { padding-left: 30px; width: 210px; }
.field input::placeholder { color: var(--text-3); }
.field select { padding-right: 28px; cursor: pointer; }
.field select option { background: var(--panel); color: var(--text); }
.field input:hover, .field select:hover { border-color: #b9c4d4; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ползунок страхового остатка */
input[type="range"] {
  appearance: none; -webkit-appearance: none;
  width: 190px; height: 5px;
  border-radius: 6px;
  background: #e2e8f0;
  outline-offset: 6px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--primary);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .25);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--primary);
}

/* ---------------- панель управления остатками ---------------- */

.controls {
  display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap;
}
.ctrl-group { display: flex; flex-direction: column; gap: 8px; min-width: 170px; }
.ctrl-wide { flex: 1 1 320px; }
.ctrl-group > label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.range-row { display: flex; align-items: center; gap: 14px; }
.range-row output { font-weight: 700; font-size: 15px; color: var(--primary); min-width: 58px; }
.ctrl-actions { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; }

.hint { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.hint b { color: var(--text); font-weight: 600; }

/* ---------------- таблицы ---------------- */

.table-card { padding-bottom: 8px; }
.table-scroll { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3);
  padding: 8px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background-color .15s ease; }
.table tbody tr:hover { background: #f7f9fc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table th.num { text-align: right; }
.table td:first-child { white-space: nowrap; }
.table td:nth-child(2) { white-space: nowrap; }
.td-name { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-actions { white-space: nowrap; text-align: right; }

/* колонка «Действия» остаётся видимой при горизонтальном скролле */
.table-card .table th:last-child { text-align: right; }
.table-card .table th:last-child,
.table-card .table td.td-actions {
  position: sticky; right: 0;
  background: var(--panel);
}
.table-card .table td.td-actions { box-shadow: -12px 0 12px -12px rgba(16, 24, 40, .18); }
.table-card .table tbody tr:hover td.td-actions { background: #f7f9fc; }

.row-error { background: #fdf3f3; box-shadow: inset 3px 0 0 var(--c-err); }
.row-empty td { padding: 26px 10px; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-2); font-size: 13px;
  padding: 10px;
  text-align: center;
}
.empty .ic { width: 30px; height: 30px; color: var(--ok); }
.empty b { color: var(--text); }
.empty-tall { padding: 34px 10px; }

/* ---------------- поток данных (pipeline) ---------------- */

.pipeline {
  display: grid;
  grid-template-columns: minmax(150px, 180px) minmax(0, 1fr) minmax(150px, 180px);
  gap: 16px;
  align-items: center;
}

.pipe-entity {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.entity-badge {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 6px;
}
.entity-badge .ic { width: 18px; height: 18px; }
.e-1c { background: #fef3e2; color: #b45309; border: 1px solid #f5d9a8; }
.e-lm { background: #e8f0fe; color: var(--primary); border: 1px solid #c6dbfc; }
.entity-name { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.entity-sub { font-size: 11.5px; color: var(--text-2); }
.entity-stats { display: flex; gap: 16px; margin: 10px 0 0; }
.entity-stats div { display: flex; flex-direction: column; }
.entity-stats dt { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.entity-stats dd { margin: 0; font-weight: 700; font-size: 16px; }

.pipe-flows { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.flow {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 64px auto;
  align-items: center; gap: 10px;
  padding: 6.5px 10px;
  border-radius: 8px;
  transition: background-color .15s ease;
}
.flow:hover { background: #f7f9fc; }
.flow-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
}
.flow-name .ic { width: 14px; height: 14px; color: var(--text-3); }
.flow-name small { display: block; font-weight: 400; font-size: 10.5px; color: var(--text-3); }
.flow-freq { font-size: 11px; color: var(--text-2); white-space: nowrap; }

.flow-arrow { position: relative; height: 14px; }
.flow-arrow i {
  position: absolute; left: 0; right: 8px; top: 50%;
  height: 0; border-top: 2px dashed #b9c4d4;
}
.flow-arrow::after {
  content: "";
  position: absolute; top: 50%; right: 0;
  width: 7px; height: 7px;
  border-top: 2px solid #8fa0b5;
  border-right: 2px solid #8fa0b5;
  transform: translateY(-50%) rotate(45deg);
}
.flow-arrow.to-1c { transform: scaleX(-1); }
.flow.to-lm .flow-arrow i { border-color: #9dbcf5; }
.flow.to-lm .flow-arrow::after { border-color: var(--primary); }
.flow.to-1c .flow-arrow i { border-color: #f2ca85; }
.flow.to-1c .flow-arrow::after { border-color: #d97706; }

/* ---------------- донат и легенда ---------------- */

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-box { width: 190px; flex: none; }
.donut-seg { transition: opacity .18s ease, stroke-width .18s ease; cursor: pointer; }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.legend li {
  display: flex; align-items: center; gap: 9px;
  padding: 5.5px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: default;
  transition: background-color .15s ease;
}
.legend li:hover, .legend li.active { background: #f1f4f9; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lg-name { color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-val { font-weight: 700; }

.donut-big { font-size: 24px; font-weight: 700; fill: var(--text); }
.donut-sub { font-size: 11px; fill: var(--text-3); }
.pop-in { animation: pop .5s cubic-bezier(.3, .8, .3, 1); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

/* ---------------- графики ---------------- */

.chart { position: relative; height: 240px; }
.chart:focus-visible { outline-offset: 4px; }

.grid-line { stroke: #e9edf5; stroke-width: 1; }
.axis-txt { font-size: 10.5px; fill: var(--text-3); font-family: var(--font); font-variant-numeric: tabular-nums; }
.axis-r { text-anchor: end; }
.axis-label { font-weight: 600; fill: var(--text-2); }
.axis-val { fill: var(--text-2); }
.bar { transition: opacity .15s ease; }
.bar.dimmed { opacity: .3; }
.crosshair { stroke: #cbd5e1; stroke-width: 1; }
.hover-dot { stroke: #ffffff; stroke-width: 2; }
.area-fill { animation: fadein .8s ease; }
@keyframes fadein { from { opacity: 0; } }

.chart-tip {
  position: absolute; z-index: 5;
  pointer-events: none;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 8px 20px rgba(16, 24, 40, .12);
  max-width: 260px;
}
.chart-tip b { display: block; color: var(--text-2); font-weight: 500; font-size: 11px; margin-bottom: 2px; }
.tip-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.tip-row i { width: 8px; height: 8px; border-radius: 2px; }

.swatch {
  display: inline-block; width: 9px; height: 9px; border-radius: 3px;
  margin: 0 5px 0 8px; vertical-align: -1px;
}
.sw-1c { background: var(--c-1c); }
.sw-lm { background: var(--c-lm); }

/* ---------------- лента событий ---------------- */

.feed-card { display: flex; flex-direction: column; }
.feed {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto;
  max-height: 268px;
  display: flex; flex-direction: column;
}
.feed-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline; gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.feed-item:last-child { border-bottom: 0; }
.feed-type {
  font-size: 10.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.feed-text { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.feed-time { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.feed-err .feed-text { color: #b91c1c; }

/* ---------------- план внедрения ---------------- */

.roadmap {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.stage {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.stage h3 { font-size: 14.5px; }
.stage-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stage-num {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--primary);
}
.stage-badge {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: var(--ok-bg); color: #15803d;
  border: 1px solid var(--ok-border);
}
.stage-badge-next { background: #f1f4f9; color: var(--text-2); border-color: var(--border-strong); }

.stage-list { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.stage-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.li-ic { width: 15px; height: 15px; color: var(--ok); margin-top: 1px; }
.li-num {
  width: 18px; height: 18px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: 10.5px; font-weight: 700; color: var(--text-2);
  background: var(--panel);
}

.stage-goal { background: #f2f7ff; border-color: #c6dbfc; }
.stage-goal blockquote {
  margin: 0;
  font-size: 13px; line-height: 1.55;
  color: var(--text);
  padding-left: 12px;
  border-left: 3px solid var(--primary);
}
.stage-goal p { font-size: 12px; color: var(--text-2); }

/* ---------------- окно кладовщика ---------------- */

.queue-card { position: sticky; top: 112px; }
.queue { display: flex; flex-direction: column; gap: 12px; max-height: 560px; overflow-y: auto; padding-right: 4px; }

.qcard {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  background: #f8fafc;
  animation: cardin .35s ease;
}
@keyframes cardin { from { opacity: 0; transform: translateY(6px); } }
.qcard-done { border-color: #ddd2f8; background: #f9f6ff; }

.qcard-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.qcard-id { font-weight: 700; }
.qcard-wh { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qcard-sku { margin-top: 6px; font-size: 15px; font-weight: 700; color: var(--primary); }
.qcard-name { font-size: 12px; color: var(--text-2); }
.qcard-props { display: flex; gap: 18px; margin: 10px 0 0; flex-wrap: wrap; }
.qcard-props div { display: flex; flex-direction: column; gap: 1px; }
.qcard-props dt { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.qcard-props dd { margin: 0; font-weight: 600; font-size: 13px; }

/* спиннер внутри бейджа */
.spinner {
  width: 10px; height: 10px; flex: none;
  border: 2px solid #f5d9a8;
  border-top-color: #d97706;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ---------------- журнал событий ---------------- */

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text-2);
  font: inherit; font-size: 12px; font-weight: 500;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.chip i { font-style: normal; font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip:hover { color: var(--text); border-color: #b9c4d4; }
.chip-on { color: var(--primary); background: #e8f0fe; border-color: #9dbcf5; }
.chip-on i { color: var(--primary); }

.dir { white-space: nowrap; font-size: 12px; color: var(--text-2); }
.dir-arrow { display: inline-block; width: 18px; font-weight: 700; }
.dir-arrow.to-lm { color: var(--primary); }
.dir-arrow.to-1c { color: #d97706; }

/* ---------------- модальное окно ---------------- */

.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .45);
  animation: fadein .25s ease;
}
.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(16, 24, 40, .18);
  animation: modalin .3s cubic-bezier(.3, .8, .3, 1);
}
@keyframes modalin { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.modal-head, .modal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px;
}
.modal-head h2 { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.modal-head .ic { color: var(--primary); }
.modal-body { padding: 0 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { justify-content: flex-end; padding-top: 8px; }

.label-paper {
  position: relative;
  background: #fff;
  color: #111;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 16px 18px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.lp-head { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; align-items: baseline; flex-wrap: wrap; }
.lp-brand { font-weight: 800; letter-spacing: .12em; }
.lp-slot { color: #555; }
.lp-order { margin-top: 10px; font-size: 13px; }
.lp-order b { font-family: var(--mono); }
.lp-barcode { width: 100%; height: 58px; margin-top: 12px; }
.lp-ean { font-family: var(--mono); font-size: 12px; text-align: center; letter-spacing: .35em; color: #333; }
.lp-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 10px 14px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed #bbb;
}
.lp-grid div { display: flex; flex-direction: column; gap: 1px; }
.lp-grid dt { font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; color: #777; }
.lp-grid dd { margin: 0; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-watermark {
  position: absolute; right: -14px; bottom: 6px;
  font-size: 64px; font-weight: 800; letter-spacing: .1em;
  color: rgba(17, 17, 17, .05);
  transform: rotate(-14deg);
  pointer-events: none;
  user-select: none;
}

/* ---------------- тосты ---------------- */

.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
  width: min(340px, calc(100vw - 40px));
}
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 26px rgba(16, 24, 40, .16);
  font-size: 12.5px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast .ic { width: 17px; height: 17px; margin-top: 1px; }
.toast b { display: block; font-size: 13px; }
.toast span { color: var(--text-2); }
.toast-success .ic { color: var(--ok); }
.toast-info .ic { color: var(--primary); }
.toast-error .ic { color: var(--c-err); }

/* ---------------- футер ---------------- */

.foot { border-top: 1px solid var(--border); margin-top: 8px; background: var(--panel); }
.foot-inner {
  max-width: none; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: var(--text-3); font-size: 12px;
  flex-wrap: wrap;
}

/* ---------------- адаптив ---------------- */

@media (max-width: 1150px) {
  .grid-pipe { grid-template-columns: 1fr; }
  .grid-orders { grid-template-columns: 1fr; }
  .queue-card { position: static; }
  .queue { max-height: none; }
  .roadmap { grid-template-columns: 1fr 1fr; }
  .stage-goal { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .topbar-inner { padding: 12px 16px 8px; }
  .container { padding: 20px 16px 32px; }
  .roadmap { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: 1fr; }
  .pipe-entity { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
  .entity-badge { margin-bottom: 0; }
  .entity-stats { margin: 0 0 0 auto; }
  .flow { grid-template-columns: 1fr 56px auto; }
  .brand-sub { display: none; }
  .kpi-v { font-size: 22px; }
  .donut-wrap { flex-direction: column; }
}

/* ---------------- доступность: меньше движения ---------------- */

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

/* ---------------- статичный режим (?static=1) ---------------- */

.static *, .static *::before, .static *::after {
  animation: none !important;
  transition: none !important;
}
