/**
 * Тёмная тема ERP склада в духе аналитической панели.
 * Крупные кнопки и контраст для планшета, спокойные шрифты без декора.
 */

:root {
  --bg: #121826;
  --surface: #1b2438;
  --surface-soft: #222c44;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2ff;
  --text-soft: #9aa6c2;
  --text-muted: #6f7a94;
  --accent: #5b8cff;
  --accent-dark: #8aacff;
  --accent-soft: rgba(91, 140, 255, 0.16);
  --ok: #3dcf8e;
  --ok-soft: rgba(61, 207, 142, 0.16);
  --warn: #f5c15c;
  --warn-soft: rgba(245, 193, 92, 0.16);
  --danger: #ff6b7a;
  --danger-soft: rgba(255, 107, 122, 0.16);
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --control-height: 48px;
  --control-height-lg: 60px;
  --nav: #0e141f;
  --hover: rgba(255, 255, 255, 0.06);
  --nav-on-text: #fff;
}

html[data-theme="light"] {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #e2e6ea;
  --line-strong: #cbd3da;
  --text: #1c2430;
  --text-soft: #5b6673;
  --text-muted: #8a94a0;
  --accent: #2f6feb;
  --accent-dark: #1f57c3;
  --accent-soft: #eaf1fe;
  --ok: #1f8a52;
  --ok-soft: #e6f5ec;
  --warn: #b26a00;
  --warn-soft: #fdf2e0;
  --danger: #c1341f;
  --danger-soft: #fdecea;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px rgba(16, 24, 40, 0.06);
  --nav: #ffffff;
  --hover: rgba(16, 24, 40, 0.05);
  --nav-on-text: #1f57c3;
}

* { box-sizing: border-box; }

/* Собственные display у блоков перебивают атрибут hidden — возвращаем ему силу. */
[hidden] { display: none !important; }

body.e-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--accent); }

/* ── Каркас ──────────────────────────────────────────────────────────── */

.e-top {
  position: sticky; top: 0; z-index: 40;
  background: var(--nav);
  border-bottom: 1px solid var(--line);
  padding: 10px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.e-logo { font-size: 1.05rem; font-weight: 700; white-space: nowrap; letter-spacing: -0.02em; }
.e-logo span { color: var(--accent); }
.e-top-spacer { flex: 1 1 auto; }
.e-user { display: flex; align-items: center; gap: 10px; }
.e-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-dark);
  font-weight: 800; font-size: 0.85rem; flex: none;
}
.e-user-name { font-size: 0.95rem; font-weight: 600; }
.e-user-role {
  font-size: 0.8rem; color: var(--text-soft);
  background: var(--surface-soft); border: 1px solid var(--line);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}

.e-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - 57px);
}
.e-nav {
  position: sticky; top: 57px; z-index: 20;
  align-self: stretch;
  min-height: calc(100vh - 57px);
  max-height: calc(100vh - 57px);
  overflow-y: auto;
  background: var(--nav);
  border-right: 1px solid var(--line);
  padding: 14px 10px 28px;
}
.e-nav-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 16px 10px 6px;
}
.e-nav-label:first-child { margin-top: 2px; }
.e-nav-item {
  appearance: none; border: 0; background: transparent;
  color: var(--text-soft); font: inherit; font-weight: 500;
  width: 100%; min-height: 42px; padding: 0 10px; border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  text-align: left;
}
.e-nav-item:hover { background: var(--hover); color: var(--text); }
.e-nav-item.active {
  background: var(--accent-soft); color: var(--nav-on-text); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent);
}
.e-nav-ico {
  flex: none; width: 22px; text-align: center;
  font-size: 0.95rem; line-height: 1; opacity: 0.85;
}
.e-nav-item.active .e-nav-ico { opacity: 1; }
.e-nav-item .e-count {
  margin-left: auto;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 0.72rem; padding: 1px 7px; font-weight: 600;
}
.e-nav-item.active .e-count { background: var(--accent); }

.e-brand-bar {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px; max-width: 100%;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; box-shadow: var(--shadow);
}
.e-brand-bar::-webkit-scrollbar { display: none; }
.e-brand-seg {
  appearance: none; border: 0; background: transparent;
  color: var(--text-soft); font: inherit; font-weight: 600;
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
}
.e-brand-seg:hover { color: var(--text); background: var(--hover); }
.e-brand-seg.active { background: var(--accent); color: #fff; }
#brandFilter:empty { display: none; margin: 0; }

.e-theme-btn {
  appearance: none; font: inherit; font-weight: 600; cursor: pointer;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.e-theme-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.e-theme-login { position: absolute; top: 14px; right: 14px; min-height: 34px; font-size: 0.82rem; }

.e-shell { max-width: 1560px; margin: 0; padding: 18px 24px 60px; }
.e-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.e-toolbar-right { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.e-stock-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 12px 14px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.e-stock-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.e-stock-main .e-brand-bar { flex: none; }
.e-stock-main .e-search { flex: 0 1 180px; max-width: 200px; min-width: 140px; }
.e-stock-main .e-search .e-input { min-height: 40px; }
.e-sort-bar {
  display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px;
}
.e-sort-seg {
  appearance: none; border: 0; background: transparent;
  color: var(--text-soft); font: inherit; font-weight: 600;
  min-height: 32px; padding: 0 12px; border-radius: 999px;
  cursor: pointer; white-space: nowrap; font-size: 0.84rem;
}
.e-sort-seg:hover { color: var(--text); background: var(--hover); }
.e-sort-seg.active { background: var(--surface-soft); color: var(--text); }
.e-stock-filters { align-items: center; gap: 10px; }
.e-stock-chips { margin: 0; flex: 1 1 240px; }
.e-stock-count { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; margin-left: auto; }
.e-stock-cap {
  color: var(--text-soft); font-size: 0.85rem; white-space: nowrap;
}
.e-stock-cap b { color: var(--text); font-weight: 700; }
.e-stock-ops { gap: 8px; }
.e-act-group {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg);
}
.e-act-group .e-btn {
  min-height: 36px; padding: 0 12px; font-size: 0.88rem;
  border: 0; border-radius: 9px; background: transparent;
}
.e-act-group .e-btn:hover { background: var(--hover); }
.e-act-group .e-btn.ok { background: var(--ok); color: #fff; }
.e-act-group .e-btn.ok:hover { filter: brightness(1.05); background: var(--ok); }
.e-act-group .e-btn.danger { background: var(--danger); color: #fff; }
.e-act-group .e-btn.danger:hover { filter: brightness(1.05); background: var(--danger); }

/* ── Карточки и блоки ────────────────────────────────────────────────── */

.e-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 18px;
}
.e-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.e-card-title { font-size: 1.05rem; font-weight: 600; }
.e-note { color: var(--text-soft); font-size: 0.875rem; line-height: 1.5; }
.e-usd {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.e-cost-usd { font-variant-numeric: tabular-nums; }
.e-kpi-value .e-usd { display: block; margin-top: 2px; font-size: 0.55em; font-weight: 500; letter-spacing: 0; }
.e-muted { color: var(--text-muted); }
.e-grid { display: grid; gap: 16px; }
.e-grid.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.e-grid.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.e-grid.cols4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.e-kpi-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 18px; }
.e-kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.e-kpi-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.e-kpi-value { font-size: 1.75rem; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; }
.e-kpi-hint { font-size: 0.85rem; color: var(--text-soft); margin-top: 4px; }
.e-kpi.accent { background: var(--accent-soft); border-color: transparent; }
.e-kpi.danger { background: var(--danger-soft); border-color: transparent; }
.e-kpi.warn { background: var(--warn-soft); border-color: transparent; }
.e-kpi.clickable {
  appearance: none; font: inherit; color: inherit; text-align: left; width: 100%;
  cursor: pointer;
}
.e-kpi.clickable:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.e-kpi-more {
  margin-top: 8px; font-size: 0.78rem; color: var(--accent); font-weight: 500;
}

/* ── Кнопки и поля ───────────────────────────────────────────────────── */

.e-btn {
  appearance: none; font: inherit; font-weight: 500; cursor: pointer;
  min-height: var(--control-height); padding: 0 20px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.e-btn:hover { background: var(--surface-soft); }
.e-btn:active { transform: translateY(1px); }
.e-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.e-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.e-btn.primary:hover { background: var(--accent-dark); }
.e-btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.e-btn.ok:hover { filter: brightness(0.94); }
.e-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.e-btn.danger:hover { filter: brightness(0.94); }
.e-btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.e-btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.e-btn.lg { min-height: var(--control-height-lg); font-size: 1.05rem; padding: 0 26px; }
.e-btn.sm { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }
.e-btn.block { width: 100%; }
.e-btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

.e-field { display: flex; flex-direction: column; gap: 6px; }
.e-field[hidden] { display: none !important; }
.e-field.wide { grid-column: 1 / -1; }
.e-field label { font-size: 0.85rem; font-weight: 500; color: var(--text-soft); }
.e-input, .e-select, .e-textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  min-height: var(--control-height); padding: 0 14px; width: 100%;
}
.e-textarea { min-height: 90px; padding: 12px 14px; resize: vertical; }
.e-input:focus, .e-select:focus, .e-textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.e-input:disabled, .e-select:disabled { background: var(--surface-soft); color: var(--text-muted); }
.e-input.lg { min-height: var(--control-height-lg); font-size: 1.2rem; }
.e-form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.e-form-grid.cols1 { grid-template-columns: 1fr; }
.e-form-grid.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.e-money-field { display: flex; flex-direction: column; gap: 6px; }
.e-money-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.e-money-head label { margin: 0; }
.e-cur-toggle {
  display: inline-flex; flex: none;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.e-cur-btn {
  appearance: none; font: inherit; cursor: pointer; border: 0;
  background: var(--surface); color: var(--text-soft);
  min-height: 32px; padding: 0 12px; font-size: 0.88rem; font-weight: 600;
}
.e-cur-btn:hover { color: var(--text); }
.e-cur-btn.on { background: var(--accent); color: #fff; }
.e-inline-input {
  font: inherit; border: 1px solid var(--line-strong); border-radius: 8px;
  min-height: 40px; padding: 0 10px; width: 96px; text-align: right;
}

.e-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.e-search .e-input { padding-left: 42px; }
.e-search::before {
  content: '⌕'; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1.3rem; line-height: 1;
}

/* ── Таблицы ─────────────────────────────────────────────────────────── */

.e-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.e-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.95rem; }
.e-table th {
  text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600; padding: 12px 14px;
  background: var(--surface-soft); border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0;
}
.e-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.e-table tbody tr:last-child td { border-bottom: none; }
.e-table tbody tr.clickable { cursor: pointer; }
.e-table tbody tr.clickable:hover { background: var(--accent-soft); }
.e-debt-sum { font-weight: 700; font-variant-numeric: tabular-nums; }
.e-debt-sum.danger { color: var(--danger); }
.e-debt-sum.ok { color: var(--ok); }

.e-subtabs {
  display: flex; gap: 4px; flex-wrap: nowrap;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--line);
  margin: 0 0 16px; padding: 0 2px;
  scrollbar-width: none;
}
.e-subtabs::-webkit-scrollbar { display: none; }
.e-subtab {
  appearance: none; font: inherit; font-weight: 500; cursor: pointer;
  border: 0; background: transparent; color: var(--text-soft);
  min-height: 42px; padding: 0 14px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  white-space: nowrap; border-radius: 8px 8px 0 0;
}
.e-subtab:hover { color: var(--text); background: var(--surface-soft); }
.e-subtab.on { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
.e-table td.num, .e-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.e-table td.name { font-weight: 500; min-width: 220px; }
.e-table tr.total td { font-weight: 600; background: var(--surface-soft); }

.e-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--text-muted); }
.e-dot.ok { background: var(--ok); }
.e-dot.warning { background: #e0a125; }
.e-dot.critical, .e-dot.empty { background: var(--danger); }
.e-dot.excess { background: #7a5cd0; }
.e-dot.no_demand { background: var(--line-strong); }

.e-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 500;
  background: var(--surface-soft); border: 1px solid var(--line); color: var(--text-soft);
}
.e-badge.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.e-badge.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.e-badge.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.e-badge.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-dark); }

.e-empty {
  padding: 40px 20px; text-align: center; color: var(--text-soft);
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius);
}

.e-alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border-radius: var(--radius); margin-bottom: 16px; font-size: 0.92rem;
  background: var(--danger-soft); border: 1px solid transparent; color: var(--danger);
}
.e-alert.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.e-alert.info { background: var(--accent-soft); border-color: transparent; color: var(--accent-dark); }
.e-alert.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

.e-pulse { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.e-pulse-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); padding: 16px 18px; font: inherit; color: inherit;
  box-shadow: var(--shadow);
}
.e-pulse-card:hover { border-color: var(--line-strong); }
.e-pulse-card.need { background: var(--warn-soft); border-color: transparent; }
.e-pulse-card.need.hot { background: var(--danger-soft); border-color: transparent; }
.e-pulse-card.wait { background: var(--accent-soft); border-color: transparent; }
.e-pulse-card.accept { background: var(--ok-soft); border-color: transparent; }
.e-pulse-card.add { background: var(--surface); border-style: dashed; }
.e-pulse-card.add .e-pulse-title { color: var(--accent-dark); }
.e-pulse-kicker { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 4px; }
.e-pulse-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.e-pulse-card.need .e-pulse-title { color: var(--warn); }
.e-pulse-card.need.hot .e-pulse-title { color: var(--danger); }
.e-pulse-card.wait .e-pulse-title { color: var(--accent-dark); }
.e-pulse-card.accept .e-pulse-title { color: var(--ok); }
.e-pulse-meta { font-size: 0.9rem; color: var(--text-soft); }
.e-pulse-go { margin-top: 10px; font-size: 0.85rem; font-weight: 600; color: inherit; }
.e-pulse-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); overflow: hidden; margin-top: 12px; }
.e-pulse-bar span { display: block; height: 100%; background: var(--accent); }

.e-po-group { margin-bottom: 16px; }
.e-po-supplier { font-weight: 600; margin-bottom: 6px; }
.e-po-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px;
  align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.e-po-row.skip { opacity: 0.45; }
.e-po-name { min-width: 0; }
.e-po-name b { display: block; font-weight: 600; }
.e-po-sub { font-size: 0.82rem; color: var(--text-soft); }
.e-stepper { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.e-stepper button {
  width: 44px; min-height: 44px; border: 0; background: var(--surface-soft);
  font: inherit; font-size: 1.2rem; cursor: pointer; color: var(--text);
}
.e-stepper button:hover { background: var(--accent-soft); }
.e-stepper input {
  width: 72px; min-height: 44px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  text-align: center; font: inherit; font-variant-numeric: tabular-nums; font-weight: 600;
}
.e-po-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 0 0; font-weight: 600;
}
.e-track-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px;
  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.e-track-mark {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; border: 2px solid var(--line); color: var(--text-soft);
}
.e-track-mark.waiting { background: var(--surface-soft); }
.e-track-mark.bought { background: var(--warn-soft); border-color: #f3ddb4; color: #7a4a02; }
.e-track-mark.partial { background: var(--accent-soft); border-color: transparent; color: var(--accent-dark); }
.e-track-mark.received { background: var(--ok-soft); border-color: #c6e6d4; color: #15633a; }
.e-hist-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px;
}
.e-hist-bar .e-subtabs { margin: 0; }
.e-hist-sum { font-size: 0.84rem; color: var(--text-soft); margin: 0 0 10px; }
.e-hist-order {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  margin-bottom: 10px; overflow: hidden; background: var(--surface);
}
.e-hist-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--surface-soft); border-bottom: 1px solid var(--line);
}
.e-hist-doc { display: flex; align-items: center; gap: 8px; }
.e-hist-doc b { font-size: 0.95rem; }
.e-hist-meta { font-size: 0.8rem; color: var(--text-soft); }
.e-hist-row {
  display: grid; grid-template-columns: minmax(140px, 1.4fr) repeat(3, minmax(90px, 0.9fr)) auto;
  gap: 8px 12px; align-items: center;
  padding: 8px 12px; border-top: 1px solid var(--line); font-size: 0.88rem;
}
.e-hist-head + .e-hist-row { border-top: 0; }
.e-track-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px; align-items: center;
  padding: 8px 12px; border-top: 1px solid var(--line);
}
.e-hist-head + .e-track-item { border-top: 0; }
.e-track-item .e-stepper button { width: 36px; min-height: 36px; }
.e-track-item .e-stepper input { width: 64px; min-height: 36px; }
.e-track-unit { font-size: 0.82rem; color: var(--text-soft); white-space: nowrap; }
.e-hist-name { min-width: 0; }
.e-hist-name b { display: block; font-size: 0.92rem; font-weight: 650; }
.e-hist-name span { display: block; font-size: 0.76rem; color: var(--text-soft); }
.e-hist-cell { font-variant-numeric: tabular-nums; line-height: 1.25; }
.e-hist-cell small { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.e-hist-cell span { display: block; font-size: 0.75rem; color: var(--text-soft); }
.e-hist-cell.muted { color: var(--text-muted); }
.e-hist-state {
  flex: none; font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; justify-self: end;
}
.e-hist-state.wait { background: var(--surface-soft); color: var(--text-soft); }
.e-hist-state.buy { background: var(--warn-soft); color: #7a4a02; }
.e-hist-state.ok { background: var(--ok-soft); color: #15633a; }

body.e-supply-mode { background: var(--bg); }
body.e-supply-mode .e-layout { display: block; min-height: 0; }
body.e-supply-mode .e-nav,
body.e-supply-mode #periodSelect,
body.e-supply-mode #brandFilter { display: none !important; }
body.e-supply-mode .e-top { padding: 6px 16px; }
body.e-supply-mode .e-shell { max-width: 760px; margin: 0 auto; padding: 6px 16px 32px; }

.e-buy { padding-bottom: 24px; }
.e-buy-top {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px; flex-wrap: wrap;
}
.e-buy-top h1 { margin: 0; font-size: 1.05rem; letter-spacing: -0.02em; font-weight: 700; flex: none; }
.e-buy-top .e-search { flex: 1 1 200px; max-width: none; margin: 0; }
.e-buy-top .e-input { min-height: 36px; }
.e-buy-top .e-btn { flex: none; min-height: 36px; padding: 0 12px; }
.e-buy-hero { margin: 8px 0 18px; }
.e-buy-kicker {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent-dark); margin-bottom: 6px;
}
.e-buy-hero h1 { margin: 0 0 8px; font-size: 1.85rem; letter-spacing: -0.03em; }
.e-buy-hero p { margin: 0; color: var(--text-soft); font-size: 1.05rem; line-height: 1.45; }
.e-buy-finder {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px; margin-bottom: 8px;
}
.e-buy-finder .e-search { max-width: none; flex: none; }
.e-buy-finder .e-input { min-height: 40px; }
.e-buy-hits {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin: 0 0 6px; overflow: hidden;
}
.e-buy-hits[hidden] { display: none; }
.e-buy-tools { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.e-buy-item.hit {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 56px; padding: 8px;
}
.e-buy-item.hit:first-of-type { border-top: 0; }
.e-buy-brands { margin: 0 0 8px; }
.e-buy-brands .e-subtab { min-height: 34px; padding: 0 10px; font-size: 0.88rem; }
.e-buy-brands .e-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark);
  font-size: 0.72rem; font-weight: 700;
}
.e-buy-brands .e-subtab.on .e-count { background: var(--accent); color: #fff; }
.e-buy-mini {
  font-style: normal; font-size: 0.72rem; font-weight: 650;
  color: var(--accent-dark); margin-left: 6px; vertical-align: 1px;
}
.e-buy-section { margin-bottom: 12px; }
.e-buy-section.dim { opacity: 0.72; }
.e-buy-section-title {
  font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 6px;
}
.e-buy-list {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
}
.e-buy-brand {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; min-height: 32px;
  font-size: 0.88rem; font-weight: 750;
  color: var(--accent-dark); background: var(--accent-soft);
  border-top: 1px solid var(--line);
}
.e-buy-brand:first-child { border-top: 0; }
.e-buy-brand span {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--bg); color: var(--accent-dark);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem;
}
.e-buy-group {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden;
}
.e-buy-supplier {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.e-buy-supplier span {
  min-width: 28px; height: 28px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem;
}
.e-buy-item {
  width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px; align-items: center; text-align: left;
  min-height: 48px; padding: 6px 10px; border: 0; border-top: 1px solid var(--line);
  background: transparent; font: inherit; color: inherit;
}
.e-buy-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.e-buy-item:first-of-type { border-top: 0; }
.e-buy-brand + .e-buy-item { border-top: 0; }
.e-buy-item:hover { background: var(--accent-soft); }
.e-buy-item.done { background: var(--ok-soft); }
.e-buy-item.done:hover { background: #d9f0e2; }
.e-buy-item.locked {
  cursor: default; opacity: 0.78; min-height: 32px; padding: 3px 10px;
}
.e-buy-item.locked:hover { background: var(--ok-soft); }
.e-buy-item.locked .e-buy-check { width: 16px; height: 16px; border-radius: 5px; font-size: 0.65rem; }
.e-buy-item.locked .e-buy-body { flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.e-buy-item.locked .e-buy-body b { font-size: 0.88rem; font-weight: 600; }
.e-buy-item.locked .e-buy-body span { font-size: 0.75rem; }
.e-buy-item.locked .e-buy-qty { font-size: 0.82rem; font-weight: 650; color: var(--text-soft); }
.e-buy-check {
  width: 22px; height: 22px; border-radius: 7px;
  border: 2px solid var(--line-strong); display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 0.75rem;
  background: #fff;
}
.e-buy-item.done .e-buy-check,
.e-buy-item.locked .e-buy-check { background: var(--ok); border-color: var(--ok); }
.e-buy-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.e-buy-body b { font-size: 0.98rem; font-weight: 650; }
.e-buy-body span { font-size: 0.82rem; color: var(--text-soft); }
.e-buy-qty { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.e-buy-empty {
  background: var(--surface); border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg); padding: 48px 24px; text-align: center;
}
.e-buy-empty.slim { padding: 20px; }
.e-buy-empty-ico {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 800;
}
.e-buy-empty h2 { margin: 0 0 8px; }
.e-buy-empty p { margin: 0; color: var(--text-soft); }

/* ── Экран сканера ───────────────────────────────────────────────────── */

.e-scan-modes { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.e-scan-mode {
  flex: 1 1 180px; min-height: 64px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--surface); cursor: pointer;
  font: inherit; font-weight: 600; font-size: 1.05rem; color: var(--text-soft);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.e-scan-mode.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.e-scan-mode.on.issue { border-color: var(--danger); background: var(--danger-soft); color: #8e2716; }
.e-scan-mode.on.receipt { border-color: var(--ok); background: var(--ok-soft); color: #15633a; }

.e-scan-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.e-scan-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.e-scan-row .e-field { flex: 1 1 260px; }
.e-scan-row .e-field.qty { flex: 0 0 150px; }
.e-scan-input {
  font-size: 1.35rem; letter-spacing: 0.04em; min-height: var(--control-height-lg);
  font-variant-numeric: tabular-nums;
}
.e-scan-hint { margin-top: 12px; font-size: 0.88rem; color: var(--text-soft); }
.e-scan-result { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.e-scan-product { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.e-scan-product .sku { font-size: 1.1rem; font-weight: 600; }
.e-scan-stock { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; }

.e-log { display: flex; flex-direction: column; gap: 8px; }
.e-log-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.e-log-item.ok { border-left: 4px solid var(--ok); }
.e-log-item.err { border-left: 4px solid var(--danger); }
.e-log-time { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.e-log-text { flex: 1 1 auto; }

#cameraBox { margin-top: 16px; }
#cameraVideo {
  width: 100%; max-width: 460px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: #000;
}

/* ── Матрица прав ────────────────────────────────────────────────────── */

.e-matrix { display: grid; gap: 18px; }
.e-matrix-section { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.e-matrix-section h3 {
  padding: 12px 16px; background: var(--surface-soft);
  border-bottom: 1px solid var(--line); font-size: 0.95rem;
}
.e-perm {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.e-perm:last-child { border-bottom: none; }
.e-perm-text { flex: 1 1 auto; }
.e-perm-hint { font-size: 0.8rem; color: var(--text-muted); }

.e-switch { position: relative; display: inline-block; width: 54px; height: 30px; flex: none; }
.e-switch input { opacity: 0; width: 0; height: 0; }
.e-switch .slider {
  position: absolute; inset: 0; cursor: pointer; border-radius: 999px;
  background: var(--line-strong); transition: background 0.15s;
}
.e-switch .slider::before {
  content: ''; position: absolute; height: 24px; width: 24px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.e-switch input:checked + .slider { background: var(--ok); }
.e-switch input:checked + .slider::before { transform: translateX(24px); }
.e-switch input:disabled + .slider { opacity: 0.5; cursor: not-allowed; }

/* ── Графики ─────────────────────────────────────────────────────────── */

.e-chart { width: 100%; height: auto; }
.e-chart .grid { stroke: var(--line); stroke-width: 1; }
.e-chart .axis { fill: var(--text-muted); font-size: 10px; }
.e-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 0.85rem; color: var(--text-soft); }
.e-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }

.e-bars { display: flex; flex-direction: column; gap: 12px; }
.e-bar-row { display: grid; grid-template-columns: 150px 1fr 110px; gap: 12px; align-items: center; font-size: 0.9rem; }
.e-bar-track { height: 12px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--line); overflow: hidden; }
.e-bar-fill { height: 100%; background: var(--accent); }
.e-bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

/* ── Дашборд ─────────────────────────────────────────────────────────── */

.e-dash { display: flex; flex-direction: column; gap: 16px; }
.e-dash-hello {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding: 4px 2px 2px;
}
.e-dash-hello h1 {
  font-size: 1.85rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.15;
}
.e-dash-sub { color: var(--text-soft); margin-top: 6px; font-size: 0.95rem; }
.e-dash-stats {
  display: grid; gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.e-stat {
  appearance: none; font: inherit; color: inherit; text-align: left; width: 100%;
  display: grid; grid-template-columns: 6px minmax(0, 1fr); gap: 12px; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 14px 14px 14px 0;
  box-shadow: var(--shadow); cursor: default; min-height: 108px;
}
.e-stat.clickable { cursor: pointer; }
.e-stat.clickable:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.e-stat-mark {
  width: 6px; border-radius: 8px 0 0 8px;
  background: var(--accent);
}
.e-stat.tone-ok .e-stat-mark { background: var(--ok); }
.e-stat.tone-danger .e-stat-mark { background: var(--danger); }
.e-stat.tone-warn .e-stat-mark { background: var(--warn); }
.e-stat-body { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.e-stat-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.e-stat-label {
  font-size: 0.78rem; color: var(--text-muted);
  font-weight: 650; letter-spacing: 0.01em;
}
.e-stat-go { color: var(--text-muted); font-size: 1.05rem; line-height: 1; }
.e-stat-value {
  font-size: 1.45rem; font-weight: 800; letter-spacing: -0.03em;
  margin: 4px 0 2px; line-height: 1.15;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
}
.e-stat-value .e-usd { font-size: 0.55em; font-weight: 500; margin-left: 0; }
.e-stat-hint {
  font-size: 0.78rem; color: var(--text-soft); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.e-stat-hint.up { color: var(--ok); font-weight: 700; }
.e-stat-hint.down { color: var(--danger); font-weight: 700; }
.e-stat-hint.warn { color: var(--warn); font-weight: 700; }
.e-dash-charts {
  display: grid; gap: 14px;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.4fr);
}
.e-dash-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}
.e-dash-panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.e-dash-panel-title { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.02em; }
.e-pie {
  display: grid; grid-template-columns: 180px minmax(0, 1fr);
  gap: 8px 16px; align-items: center;
}
.e-pie svg { width: 180px; height: 180px; }
.e-pie-legend { display: flex; flex-direction: column; gap: 10px; }
.e-pie-item {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px; align-items: center; font-size: 0.88rem;
}
.e-pie-item i { width: 10px; height: 10px; border-radius: 50%; }
.e-pie-item span { color: var(--text-soft); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-pie-item b { font-variant-numeric: tabular-nums; font-weight: 700; }
.e-dash .e-pulse { margin-bottom: 0; }
.e-dash .e-card { margin-bottom: 0; }
.e-dash .e-table-wrap { border-color: var(--line); }
.e-dash .e-empty { background: transparent; }

@media (max-width: 1100px) {
  .e-dash-charts { grid-template-columns: 1fr; }
  .e-pie { grid-template-columns: 160px minmax(0, 1fr); }
}

/* ── Модальное окно ──────────────────────────────────────────────────── */

.e-modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(20, 28, 38, 0.45);
  display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto;
}
.e-modal[hidden] { display: none; }
.e-modal-box {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 940px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.22); padding: 24px;
}
.e-modal-box.print-dlg { max-width: 860px; }
.e-print-dlg { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; align-items: start; }
.e-print-section-title { font-weight: 600; margin: 4px 0 8px; }
.e-paper-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.e-paper-card {
  position: relative;
  display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center;
  min-height: 72px; padding: 10px 6px; text-align: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 0.78rem;
}
.e-paper-card input { position: absolute; opacity: 0; pointer-events: none; }
.e-paper-card b { font-size: 0.82rem; }
.e-paper-card span { color: var(--text-muted); font-size: 0.7rem; line-height: 1.2; }
.e-paper-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.e-print-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 8px 0 14px; }
.e-opt { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.e-opt input { width: 16px; height: 16px; }
.e-print-preview {
  width: 100%; height: 340px; border: 1px solid var(--line); border-radius: 10px; background: #ececec;
}
.e-print-dlg-side .e-note { margin-top: 8px; }
.e-icon-btn { min-width: 44px; width: 44px; padding: 0; font-size: 1.15rem; }
.e-sales-recent {
  margin-top: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 12px 14px 8px; box-shadow: var(--shadow);
}
.e-sales-recent .e-table td, .e-sales-recent .e-table th { padding: 7px 10px; font-size: 0.84rem; }
.e-sales-recent .e-table-wrap { max-height: 230px; }
.e-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.e-modal-title { font-size: 1.15rem; font-weight: 600; }
.e-x {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text-soft);
  width: 40px; height: 40px; border-radius: 10px; font-size: 1.3rem; cursor: pointer; line-height: 1;
}
.e-x:hover { background: var(--surface-soft); color: var(--text); }

/* ── Вход ────────────────────────────────────────────────────────────── */

.e-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.e-login {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 420px;
}
.e-login h1 { margin-bottom: 6px; padding-right: 96px; }
.e-login .e-note { margin-bottom: 22px; }
.e-login .e-field { margin-bottom: 14px; }

/* ── Тосты ───────────────────────────────────────────────────────────── */

.e-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #1c2430; color: #fff; padding: 14px 22px; border-radius: var(--radius);
  font-size: 0.95rem; max-width: 90vw; opacity: 0; pointer-events: none;
  transition: opacity 0.18s, transform 0.18s; z-index: 80; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.e-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.e-toast.err { background: var(--danger); }
.e-toast.ok { background: var(--ok); }

/* ── Списки строк ────────────────────────────────────────────────────── */

.e-row-list { display: flex; flex-direction: column; }
.e-row {
  display: flex; gap: 14px; align-items: center; padding: 12px 0;
  border-bottom: 1px solid var(--line); font-size: 0.93rem;
}
.e-row:last-child { border-bottom: none; }
.e-row-name { flex: 1 1 auto; }
.e-row-value { font-variant-numeric: tabular-nums; font-weight: 500; }

/* ── Документ продажи ────────────────────────────────────────────────── */

.e-steps {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
}
.e-step {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text-muted); font-weight: 500;
}
.e-step span {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-soft); font-weight: 600;
}
.e-step.on { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }
.e-step.on span { background: var(--accent); color: #fff; }
.e-step.done { border-color: #c6e6d4; color: var(--ok); background: var(--ok-soft); }
.e-step.done span { background: var(--ok); color: #fff; }

.e-pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.e-pick-item {
  appearance: none; width: 100%; text-align: left; font: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.e-pick-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.e-pick-item.on { border-color: var(--ok); background: var(--ok-soft); }

.e-qty { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.e-qty .e-inline-input { width: 72px; text-align: center; }
/* ── Экран продажи: таблица каталога слева, плотный чек справа ───────── */

.e-pos { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr); gap: 14px; align-items: start; }
.e-pos-catalog { margin-bottom: 0; padding: 12px 14px 10px; display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 280px); position: relative; }
.e-pos-check { position: sticky; top: 72px; align-self: start; }
.e-pos-check .e-check { max-height: calc(100vh - 280px); }

.e-search-wide { max-width: none; flex: none; margin-bottom: 8px; }
.e-search-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.e-search-row .e-search { flex: 1 1 auto; margin-bottom: 0; max-width: none; }
.e-cam-btn { flex: none; min-width: 76px; padding: 0 14px; font-weight: 600; }
.e-cam-box {
  position: relative; margin: 0 0 10px; border-radius: 12px; overflow: hidden;
  background: #111; border: 1px solid var(--line-strong);
}
.e-cam-box video { width: 100%; max-height: 280px; object-fit: cover; display: block; background: #000; }
.e-cam-hint {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 12px 8px; color: #fff; font-size: 0.82rem;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
}
.e-scan-catcher {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 24px;
  height: 24px;
  opacity: 0.02;
  color: transparent;
  caret-color: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  z-index: 0;
}
.e-scan-tip { display: none; }

.e-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.e-chip {
  appearance: none; font: inherit; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-soft);
  border-radius: 999px; padding: 4px 10px; font-size: 0.78rem;
}
.e-chip:hover { border-color: var(--line-strong); color: var(--text); }
.e-chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-dark); font-weight: 500; }

.e-prod-grid {
  display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  flex: 1 1 auto; max-height: calc(100vh - 240px); overflow-y: auto; padding-right: 4px;
}
.e-prod {
  position: relative; appearance: none; font: inherit; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 10px 12px; min-height: 92px;
  display: flex; flex-direction: column; gap: 4px;
}
.e-prod:hover { border-color: var(--accent); background: var(--accent-soft); }
.e-prod:active { transform: translateY(1px); }
.e-prod.in-cart { border-color: var(--ok); background: var(--ok-soft); }
.e-prod.out { opacity: 0.55; }
.e-prod-name {
  font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.e-prod-meta { font-size: 0.76rem; color: var(--text-muted); }
.e-prod-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.e-prod-price { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.e-prod-count {
  position: absolute; top: -7px; right: -7px; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 999px; background: var(--ok); color: #fff;
  font-size: 0.78rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}

.e-pos-table-wrap {
  flex: 1 1 auto; min-height: 0; max-height: calc(100vh - 360px);
  overflow: auto; border: 1px solid var(--line); border-radius: 10px;
}
table.e-pos-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.e-pos-table th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-soft); color: var(--text-muted);
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.e-pos-table th.num, .e-pos-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.e-pos-table td { padding: 5px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.e-pos-table tbody tr { cursor: pointer; }
.e-pos-table tbody tr:hover { background: var(--accent-soft); }
.e-pos-table tbody tr.in-cart { background: var(--ok-soft); }
.e-pos-table tbody tr.out { opacity: 0.5; }
.e-pos-name {
  font-weight: 500; line-height: 1.25;
  display: inline-block; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom;
}
.e-pos-sku { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }
.e-pos-stock { font-size: 0.8rem; color: var(--text-soft); white-space: nowrap; }
.e-pos-stock.warn { color: var(--warn); }
.e-pos-stock.danger { color: var(--danger); }
.e-pos-table .e-pos-price { font-weight: 600; }
.e-prod-inline-count {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px;
  background: var(--ok); color: #fff; font-size: 0.72rem; font-weight: 600; vertical-align: middle;
}

.e-check {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px;
  max-height: calc(100vh - 88px);
}
.e-check-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.e-check-client {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  border-radius: 10px; background: var(--accent-soft); border: 1px solid transparent;
}
.e-check-pick { display: flex; flex-direction: column; gap: 8px; }
.e-pick-list.compact { max-height: 140px; }
.e-pick-list.compact .e-pick-item { padding: 8px 10px; }

.e-check-lines {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 80px;
  overflow-y: auto; border: 1px solid var(--line); border-radius: 10px;
}
.e-check-cols,
.e-check-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 108px 28px;
  align-items: center;
  column-gap: 8px;
  padding: 6px 10px;
}
.e-check-cols {
  position: sticky; top: 0; z-index: 1;
  padding: 6px 10px 4px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-muted);
  background: var(--surface-soft); border-bottom: 1px solid var(--line);
}
.e-check-cols span:nth-child(2) { text-align: center; }
.e-check-cols span:nth-child(3) { text-align: right; }
.e-check-line { border-bottom: 1px solid var(--line); }
.e-check-line:last-child { border-bottom: none; }
.e-check-line.is-warn { background: var(--warn-soft); }
.e-check-line-main { min-width: 0; }
.e-check-line-name {
  font-weight: 600; font-size: 0.84rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.e-check-line-flag {
  font-size: 0.68rem; color: var(--warn); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.e-check-line-sum {
  width: 108px; justify-self: stretch;
  font-weight: 700; font-size: 0.84rem;
  font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap;
}
.e-check-line .e-qty {
  width: 120px; justify-content: center; gap: 4px;
}
.e-check-line .e-qty .e-inline-input { width: 44px; min-height: 28px; font-size: 0.82rem; padding: 0 4px; }
.e-check-line .e-qty .e-btn.sm { min-height: 28px; min-width: 28px; padding: 0 6px; font-size: 0.85rem; }
.e-check-empty { padding: 16px 10px; text-align: center; color: var(--text-soft); font-size: 0.82rem; }
.e-check-foot { display: flex; flex-direction: column; gap: 8px; flex: none; }
.e-check-total {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding-top: 4px; border-top: 1px dashed var(--line-strong);
}
.e-check-total span { color: var(--text-soft); font-size: 0.88rem; }
.e-check-total-sum { text-align: right; }
.e-check-total b { font-size: 1.28rem; font-variant-numeric: tabular-nums; }
.e-check-total .e-usd { display: block; margin-top: 2px; }
.e-check-print-row { display: grid; grid-template-columns: 1fr 44px; gap: 8px; align-items: stretch; }
.e-check-print-row .e-select { min-height: 40px; }
.e-check-print { min-height: 44px; width: 100%; font-weight: 600; }
.e-check-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.e-check-actions.one { grid-template-columns: 1fr; }
.e-check-actions .e-btn { min-height: 44px; font-size: 0.95rem; font-weight: 600; }
.e-check .e-alert { margin-bottom: 0; }
.e-check .e-input { min-height: 38px; }

.e-split-preview {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
}
.e-split-title { font-weight: 600; margin-bottom: 8px; }
.e-split-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; font-size: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.e-split-row:last-child { border-bottom: none; }
.e-split-row b { font-variant-numeric: tabular-nums; }

.e-warn-text { color: var(--warn); }
.e-danger-text { color: var(--danger); }
.e-x.sm { width: 26px; height: 26px; font-size: 1rem; }
.e-set-input { display: flex; align-items: center; gap: 8px; width: 240px; flex: none; }
.e-set-input .e-input { text-align: right; }

.e-labels-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.e-label-preview-card { position: sticky; top: 72px; }
.e-lp-stage {
  display: flex; justify-content: center; align-items: center;
  min-height: 180px; padding: 16px 8px; overflow: hidden;
  background: #ececec; border-radius: 10px;
}
.e-lp {
  background: #fff; color: #111; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px 7px; display: flex; flex-direction: column; gap: 3px;
  transform-origin: center center; font-size: 9px; line-height: 1.2;
}
.e-lp-company { font-size: 7px; color: #666; }
.e-lp-name { font-weight: 700; font-size: 9px; }
.e-lp-bars {
  flex: 1 1 auto; min-height: 22px;
  background: repeating-linear-gradient(90deg, #111 0 1px, #fff 1px 2.2px, #111 2.2px 3px, #fff 3px 5px);
}
.e-lp-qr {
  width: 42px; height: 42px; flex: none;
  background: repeating-conic-gradient(#111 0 25%, #fff 0 50%);
  background-size: 8px 8px;
}
.e-lp-code { text-align: center; font-size: 7px; letter-spacing: 0.04em; }
.e-lp-foot { display: flex; justify-content: space-between; gap: 6px; align-items: flex-end; font-size: 7px; color: #555; }
.e-lp-foot b { color: #111; font-size: 10px; }

@media (max-width: 960px) {
  .e-pos { grid-template-columns: 1fr; }
  .e-pos-check { position: static; }
  .e-pos-catalog, .e-pos-check .e-check { min-height: 0; max-height: none; }
  .e-prod-grid, .e-pos-table-wrap { max-height: 42vh; }
  .e-check { max-height: none; }
  .e-check-lines { max-height: 36vh; }
  .e-labels-layout { grid-template-columns: 1fr; }
  .e-label-preview-card { position: static; }
  .e-print-dlg { grid-template-columns: 1fr; }
  .e-paper-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── Адаптивность ────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .e-grid.cols4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .e-grid.cols3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  body.e-body { font-size: 16px; overflow-x: hidden; }
  .e-grid.cols2, .e-grid.cols3, .e-grid.cols4 { grid-template-columns: 1fr; }
  .e-form-grid, .e-form-grid.cols3 { grid-template-columns: 1fr; }
  .e-po-row { grid-template-columns: 1fr; }
  .e-track-row { grid-template-columns: 36px minmax(0, 1fr); }
  .e-hist-row { grid-template-columns: minmax(0, 1fr) auto; }
  .e-hist-cell { grid-column: 1; }
  .e-buy-item { grid-template-columns: 28px minmax(0, 1fr); }
  .e-buy-item.hit { grid-template-columns: minmax(0, 1fr); }
  .e-buy-qty, .e-buy-actions { grid-column: 2; justify-self: start; }
  .e-buy-item.hit .e-buy-actions { grid-column: 1; }
  .e-layout { grid-template-columns: 1fr; min-height: 0; }
  .e-stock-main .e-search { max-width: 180px; flex: 1 1 140px; }
  .e-stock-sort { min-width: 0; flex: 1 1 160px; }
  .e-stock-ops { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .e-act-group { flex: none; }
  .e-dash-hello h1 { font-size: 1.35rem; }
  .e-pie { grid-template-columns: 1fr; justify-items: center; }
  .e-stat-value { font-size: 1.25rem; }
  .e-dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .e-theme-btn { min-height: 34px; padding: 0 10px; font-size: 0.82rem; }
  .e-shell { padding: 10px 10px 28px; }
  .e-nav {
    position: static;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
  }
  .e-nav::-webkit-scrollbar { display: none; }
  .e-nav-label { display: none; }
  .e-nav-item {
    width: auto;
    flex: none;
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.86rem;
    white-space: nowrap;
  }
  .e-top {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "logo user" "period period";
    align-items: center;
    padding: 8px 10px;
    gap: 8px;
  }
  .e-logo { grid-area: logo; font-size: 0.95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .e-top-spacer { display: none; }
  #periodSelect {
    grid-area: period;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 36px;
    font-size: 0.86rem;
    padding: 0 10px;
  }
  .e-user { grid-area: user; gap: 6px; flex-wrap: nowrap; }
  .e-user-role, .e-user-name { display: none; }
  .e-top-pass { display: none; }
  .e-top-out { min-height: 34px; padding: 0 12px; font-size: 0.82rem; border-radius: 8px; }
  .e-bar-row { grid-template-columns: 88px 1fr 72px; }
  .e-btn { min-height: 44px; }
  .e-btn.sm { min-height: 36px; padding: 0 10px; font-size: 0.82rem; }
  .e-btn.lg { min-height: 48px; }
  .e-icon-btn { min-width: 40px; width: 40px; }
  .e-input, .e-select { min-height: 44px; }
  .e-print-toggles { grid-template-columns: 1fr; }
  .e-paper-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .e-pos-intro .e-note { display: none; }
  .e-pos-intro { margin-bottom: 10px; }
  .e-pos-intro h2 { font-size: 1.05rem; }
  .e-pos-catalog { padding: 10px 10px 8px; }
  .e-cam-box video { max-height: 200px; }
  .e-cam-btn {
    min-width: 72px;
    min-height: 44px;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    font-size: 0.92rem;
  }
  .e-search-row { gap: 8px; }
  .e-search-row .e-input { min-height: 44px; font-size: 0.92rem; }
  .e-scan-tip {
    display: block;
    margin: -2px 0 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
  }
  .e-chip { min-height: 32px; padding: 0 12px; display: inline-flex; align-items: center; }
  .e-check-head .e-btn.sm { min-height: 34px; }
  .e-check-print-row { grid-template-columns: 1fr 44px; gap: 8px; }
  .e-check { padding: 10px; }
  .e-check-cols,
  .e-check-line { grid-template-columns: minmax(0, 1fr) 96px 72px 28px; column-gap: 6px; padding: 6px 8px; }
  .e-check-line-sum { width: auto; font-size: 0.8rem; }
  .e-check-line .e-qty { width: auto; }
  .e-check-line .e-qty .e-btn.sm { min-height: 32px; min-width: 32px; }
  .e-check-line .e-qty .e-inline-input { width: 40px; min-height: 32px; }
  .e-check-actions .e-btn,
  .e-check-print { min-height: 44px; }
  .e-pos-table td { padding: 8px 8px; }
  .e-pos-table th { padding: 6px 8px; }
  .e-kpi-value { font-size: 1.35rem; }
  .e-sales-recent { overflow-x: auto; }
  .e-subtab { min-height: 40px; padding: 0 12px; font-size: 0.9rem; }
}

@media (max-width: 560px) {
  .e-dash-stats { grid-template-columns: 1fr; }
  .e-pos-sku { display: none; }
  .e-check-cols { display: none; }
  .e-check-line {
    grid-template-columns: minmax(0, 1fr) auto 28px;
    grid-template-areas:
      "name name x"
      "qty sum x";
    row-gap: 4px;
    padding: 8px;
  }
  .e-check-line-main { grid-area: name; }
  .e-check-line .e-qty { grid-area: qty; justify-content: flex-start; }
  .e-check-line-sum { grid-area: sum; width: auto; justify-self: end; }
  .e-check-line .e-x { grid-area: x; }
  .e-prod-grid, .e-pos-table-wrap { max-height: 38vh; }
  .e-check-lines { max-height: 30vh; }
  .e-top .e-btn.sm { padding: 0 8px; }
  .e-pick-item { padding: 10px; }
}
