:root {
  --bg: #f3f5f8;
  --card: #fff;
  --ink: #1a2332;
  --muted: #667085;
  --line: #e4e8ee;
  --navy: #1f4e79;
  --navy-2: #163a5a;
  --green: #12805c;
  --green-bg: #e8f7f0;
  --red: #b42318;
  --red-bg: #fde8e6;
  --amber: #b54708;
  --amber-bg: #fff4e5;
  --blue: #175cd3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 40;
  overflow: visible;
}
.brand { font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; overflow: auto; }
.nav a {
  color: #d6e4f5;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,0.12); color: #fff; text-decoration: none; }
.nav-lock {
  color: rgba(214, 228, 245, 0.45);
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
  cursor: not-allowed;
}
.who { display: flex; align-items: center; gap: 8px; color: #d6e4f5; flex-shrink: 0; }
.who-session { font-size: 13px; white-space: nowrap; }
.who-menu { position: relative; }
.who-avatar {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  list-style: none;
}
.who-avatar::-webkit-details-marker,
.who-avatar::marker { display: none; }
.who-avatar svg { pointer-events: none; display: block; }
.who-avatar:hover,
.who-menu[open] .who-avatar,
.who-menu.is-open .who-avatar {
  background: rgba(255,255,255,0.12);
}
.who-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.16);
  padding: 12px;
  z-index: 50;
}
.who-profile-drop {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}
.who-name {
  font-weight: 600;
  margin-bottom: 8px;
  word-break: break-word;
}
.who-drop .btn { width: 100%; margin-top: 8px; }
.who-profile-drop a,
.who-profile-drop .who-drop-lock {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.who-profile-drop a:hover,
.who-profile-drop a.is-on {
  background: #eef2f6;
  text-decoration: none;
  color: var(--ink);
}
.who-drop-lock {
  color: #9aa3af;
  cursor: not-allowed;
}
.btn {
  border: 0;
  background: var(--navy-2);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.btn:hover { filter: brightness(1.08); }
.btn.is-disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
}
.btn-primary { background: var(--green); }
.btn-danger { background: var(--red); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost.light { border-color: rgba(255,255,255,0.3); color: #fff; }
.btn-amber { background: var(--amber); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px; }
.wrap-wide { max-width: 1680px; }
.panel-scroll { overflow-x: auto; }
td.match-ok { background: var(--green-bg); color: var(--green); }
td.match-diff { background: var(--red-bg); color: var(--red); }
td.match-na, td.match-empty { color: var(--muted); }
.mismatch-list {
  margin: 0;
  padding-left: 16px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.35;
  max-width: 280px;
}
table.data tr.row-mismatch td.thumb-cell {
  box-shadow: inset 3px 0 0 var(--red);
}
table.data tr.row-missing-base td { background: #fff7ed; }
table.data tr.row-missing-base:hover td { background: #ffedd5; }
table.data tr.row-missing-base td.thumb-cell {
  box-shadow: inset 3px 0 0 #ea580c;
}
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: 10px;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  font-size: 14px;
  line-height: 1.35;
  animation: toast-in 0.2s ease-out;
}
.toast.is-error { background: #b42318; }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.catalog-excel-progress {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.catalog-excel-progress[hidden] { display: none; }
.catalog-excel-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}
.catalog-excel-progress-fill {
  height: 100%;
  width: 0%;
  background: #0f766e;
  transition: width 0.25s ease;
}
.catalog-excel-progress-text { margin: 8px 0 0; }
.bg-job-progress {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 10000;
  max-width: 480px;
  margin: 0 auto;
  pointer-events: none;
}
.bg-job-progress[hidden] { display: none; }
.bg-job-progress-inner {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
}
.bg-job-progress-title {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}
.bg-job-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.18);
  overflow: hidden;
}
.bg-job-progress-fill {
  height: 100%;
  width: 0%;
  background: #2dd4bf;
  transition: width 0.25s ease;
}
.bg-job-progress-text {
  margin: 8px 0 0;
  font-size: 12px;
  color: #cbd5e1;
}
table.data.catalog-cmp th.g-own { background: #1f4e79; color: #fff; }
table.data.catalog-cmp th.g-wb { background: #6b2d8b; color: #fff; }
table.data.catalog-cmp th.g-ozon { background: #005bff; color: #fff; }
table.data.catalog-cmp th.g-diff { background: #b42318; color: #fff; }
table.data.catalog-cmp td.g-own-start { box-shadow: inset 3px 0 0 #1f4e79; }
table.data.catalog-cmp td.g-wb-start { box-shadow: inset 3px 0 0 #6b2d8b; }
table.data.catalog-cmp td.g-ozon-start { box-shadow: inset 3px 0 0 #005bff; }
table.data.catalog-cmp td.g-diff-cell { background: #fff8f7; }
table.data.catalog-cmp thead th { vertical-align: middle; text-align: center; }
table.data.diffs-only td.match-ok,
table.data.diffs-only td.match-empty {
  background: transparent;
  color: inherit;
}
table.data.diffs-only td.match-na {
  background: transparent;
  color: var(--muted);
}
table.data.diffs-only tr:hover td.match-ok,
table.data.diffs-only tr:hover td.match-empty,
table.data.diffs-only tr:hover td.match-na {
  background: #fafbfd;
}
table.data.diffs-only td.match-diff { background: var(--red-bg); color: var(--red); }
.kind-cell { font-weight: 600; white-space: nowrap; }
.flash, .error {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.flash { background: var(--green-bg); color: var(--green); }
.error { background: var(--red-bg); color: var(--red); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.card .value { font-size: 32px; font-weight: 700; line-height: 1.1; }
.card .label { color: var(--muted); margin-top: 6px; font-size: 13px; }
.card-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.card-sub strong {
  color: var(--ink);
  font-weight: 700;
}
.card.new .value { color: var(--navy); }
.card.pick .value { color: var(--amber); }
.card.ship .value { color: var(--blue); }
.card.cancel .value { color: var(--red); }
.card.ok .value { color: var(--green); }
a.card { color: inherit; text-decoration: none; display: block; }
a.card:hover { text-decoration: none; border-color: #c9d3de; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.panel h1, .panel h2 { margin: 0 0 12px; font-size: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); font-size: 13px; }
.banner {
  background: #eef5fb;
  border: 1px solid #cddcea;
  color: var(--navy);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.banner-warn {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}
table.data tr.row-shortage td { background: #fef2f2; }
table.data tr.row-shortage:hover td { background: #fee2e2; }
table.data tr.row-unplaced td { background: #fff7ed; }
table.data tr.row-unplaced:hover td { background: #ffedd5; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.data tr:hover td { background: #fafbfd; }
table.data tr:hover td.match-ok { background: var(--green-bg); }
table.data tr:hover td.match-diff { background: var(--red-bg); }
input[type=text], input[type=password], input[type=number], input[type=date], select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.qty { width: 72px; text-align: right; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2f6;
}
.badge.yes { background: var(--green-bg); color: var(--green); }
.badge.no { background: var(--red-bg); color: var(--red); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.login-box {
  max-width: 380px;
  margin: 12vh auto;
  background: var(--card);
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--line);
}
.login-box h1 { margin-top: 0; }
.login-box form { display: flex; flex-direction: column; gap: 10px; }
.login-box label { font-size: 13px; color: var(--muted); }
.login-box button { margin-top: 8px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar-split { justify-content: space-between; }
.toolbar-split .search { flex: 1; min-width: 220px; max-width: 420px; }
.excel-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.btn-excel-down { background: var(--blue); }
.btn-excel-up { background: var(--green); color: #fff; }
label.btn-excel-up { margin: 0; cursor: pointer; }
.search { min-width: 220px; flex: 1; }
.slow { color: var(--red); font-weight: 600; }
.oktime { color: var(--green); }
form.inline { display: inline; }
.help { font-size: 13px; color: var(--muted); line-height: 1.45; }
code { background: #eef2f6; padding: 1px 6px; border-radius: 4px; }

.thumb {
  width: 40px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  background: #eef2f6;
  display: block;
  flex-shrink: 0;
}
.thumb-empty { display: inline-block; }
.thumb-cell { width: 52px; padding-right: 4px; }
.pager {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  margin: 14px 0;
}
.pager-page, .pager-nav {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}
a.pager-page:hover, a.pager-nav:hover {
  background: #eef2f6;
  text-decoration: none;
}
.pager-page.is-current {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 600;
}
.pager-nav { font-size: 20px; line-height: 1; }
.pager-nav.is-disabled { color: #c5cdd6; background: #f6f7f9; }
.pager-gap { color: var(--muted); padding: 0 6px; }
.mp { display: inline-flex; gap: 6px; align-items: center; }
.mp-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: block;
}
.mp-icon.is-muted { opacity: 0.28; filter: grayscale(1); }
.mp-flag { font-size: 13px; color: var(--ink); white-space: nowrap; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
  align-items: start;
}
.chart-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  min-width: 0;
}
.chart-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.donut {
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
}
.donut svg { width: min(100%, 260px); height: auto; }
.donut-legend { display: grid; gap: 8px; margin-top: 8px; }
.donut-legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.donut-legend-row .dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}
.donut-legend-row .val { font-weight: 600; }
.donut-legend-row .pct { color: var(--muted); min-width: 42px; text-align: right; }
.supply-pick { width: 100%; margin: 6px 0 10px; }
.range-bar { margin: 14px 0 8px; position: relative; }
.range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.range-presets a {
  background: #f3f5f8;
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  text-decoration: none;
}
.range-presets a:hover, .range-presets a.is-on {
  background: var(--green-bg);
  color: var(--green);
}
.subnav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0 14px;
  align-items: center;
}
.subnav a {
  padding: 8px 12px;
  border-radius: 8px;
  background: #eef2f6;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.subnav a:hover { text-decoration: none; filter: brightness(0.97); }
.subnav a.is-on {
  background: var(--navy);
  color: #fff;
}
.subnav .subnav-end {
  margin-left: auto;
}
.stock-pile-col {
  vertical-align: top;
  white-space: nowrap;
}
.stock-pile-line {
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.subnav .tab-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.subnav a.is-on .tab-count {
  background: #fff;
  color: var(--navy);
}
.range-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.dt-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.dt-field .search { min-width: 200px; }
.cal-pop {
  position: absolute;
  z-index: 20;
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(22, 58, 90, 0.12);
  padding: 12px;
  width: min(340px, 100%);
}
.cal-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  margin-bottom: 8px;
}
.cal-head strong { text-align: center; }
.cal-nav {
  border: 0;
  background: #f3f5f8;
  border-radius: 8px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
}
.cal-week, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.cal-week { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.cal-day {
  border: 0;
  background: transparent;
  border-radius: 8px;
  height: 32px;
  cursor: pointer;
  font: inherit;
}
.cal-day:hover { background: var(--green-bg); }
.cal-day.is-picked { background: var(--green); color: #fff; }
.cal-hint { margin: 8px 0 0; font-size: 12px; }
.hour-bars {
  display: grid;
  grid-template-columns: repeat(24, minmax(18px, 1fr));
  gap: 4px;
  align-items: end;
  height: 120px;
  margin: 16px 0 18px;
}
.hour-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  gap: 4px;
}
.hour-bar-fill {
  width: 100%;
  min-height: 2px;
  background: var(--green);
  border-radius: 4px 4px 0 0;
}
.hour-bar span { font-size: 10px; color: var(--muted); }
.heat-scroll { overflow-x: auto; }
.heat {
  border-collapse: collapse;
  font-size: 11px;
  --heat-max: 1;
}
.heat th, .heat td {
  border: 1px solid var(--line);
  text-align: center;
  padding: 3px 4px;
  min-width: 28px;
}
.heat th { background: #f3f5f8; position: sticky; left: 0; z-index: 1; }
.heat thead th { position: sticky; top: 0; z-index: 2; }
.heat-cell { color: #14532d; font-variant-numeric: tabular-nums; }
.heat-cell.is-zero { background: #f4f7f5; color: #c5ccd6; }
.heat-cell.g1 { background: #e8f7ef; }
.heat-cell.g2 { background: #c6ead8; }
.heat-cell.g3 { background: #98d9b8; }
.heat-cell.g4 { background: #5fc496; }
.heat-cell.g5 { background: #2ea86e; color: #fff; }
.heat-cell.g6 { background: #1b8a57; color: #fff; }
.heat-cell.g7 { background: #147048; color: #fff; }
.heat-cell.g8 { background: #0e5a3a; color: #fff; }
.heat-cell.g9 { background: #08442b; color: #fff; }
.heat-sum th, .heat-sum td { font-weight: 700; border-top: 2px solid var(--navy); }
#hours { scroll-margin-top: 68px; }
table.data tr.is-on td { background: #e8f0fa; }
table.data tr.needs-audit td { background: var(--amber-bg); }
table.data tr:hover.needs-audit td { background: #ffe8c8; }
.needs-audit-block { border-color: #f5c07a; background: #fffaf3; }
.rules-table { max-width: 640px; }
.rules-cells-table { margin-top: 4px; }
.inline-form { display: inline; margin: 0; }
.badge-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}
.badge-toggle.is-on {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}
.badge-toggle.is-off {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}
.badge-toggle:hover { filter: brightness(0.97); }
.user-form { display: flex; flex-direction: column; gap: 12px; }
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 10px;
}
.rights { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.rights label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.rights input { margin: 0; }
.cell-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.cell-actions form { display: inline; margin: 0; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  text-decoration: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}
.icon-btn:hover { background: #eef2f6; text-decoration: none; }
.icon-btn.is-danger { color: var(--red); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.dl-menu {
  position: relative;
  display: inline-block;
}
.dl-menu > summary {
  list-style: none;
}
.dl-menu > summary::-webkit-details-marker { display: none; }
.dl-menu-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 190px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(26, 35, 50, 0.12);
}
.dl-menu-drop a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}
.dl-menu-drop a:hover {
  background: #eef2f6;
  text-decoration: none;
}
.shipments-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.shipments-table .th-check,
.shipments-table .td-check {
  width: 36px;
  text-align: center;
}
.shipments-table .td-check input,
.shipments-table .th-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}
.storage-block {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  align-items: start;
}
.storage-name { font-weight: 700; font-size: 18px; }
.storage-head { padding-top: 6px; }
.storage-body { min-width: 0; }
.storage-body .data { margin: 0; }
.toolbar-split .muted { margin-right: auto; }
@media (max-width: 860px) {
  .charts-grid { grid-template-columns: 1fr; }
  .storage-block { grid-template-columns: 1fr; }
}
.mp-progress {
  position: fixed;
  inset: 0;
  background: rgba(26, 35, 50, 0.45);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}
.mp-progress[hidden] { display: none; }
.mp-progress-card {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.mp-progress-card h2 { margin: 0 0 14px; font-size: 18px; }
.mp-progress-job { margin-bottom: 16px; }
.mp-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 13px;
}
.mp-progress-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.mp-progress-track {
  height: 10px;
  background: #eef2f6;
  border-radius: 999px;
  overflow: hidden;
}
.mp-progress-fill {
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: 999px;
}
.mp-progress-text {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--navy);
  line-height: 1.4;
}
.mp-progress-error {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 13px;
}
.mp-progress-close { margin-top: 4px; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(26, 35, 50, 0.45);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(400px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}
.modal-card-wide { width: min(1120px, 96vw); }
.modal-card h2 { margin: 0 0 16px; font-size: 20px; }
.modal-form { display: flex; flex-direction: column; gap: 10px; }
.modal-form > label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.modal-form input[type=text],
.modal-form input[type=password],
.modal-form input[type=number],
.modal-form input[type=datetime-local] { width: 100%; min-width: 0; }
.op-lines { display: flex; flex-direction: column; gap: 8px; }
.op-line.range-fields {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) minmax(150px, 1.5fr) 88px 36px;
  gap: 8px;
  align-items: end;
  flex-wrap: nowrap;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.op-lines[data-kind="in"] .op-line.range-fields,
.op-lines[data-kind="out"] .op-line.range-fields {
  grid-template-columns: minmax(160px, 1.5fr) minmax(120px, 1fr) 88px 36px;
}
.op-line .dt-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
.op-line .dt-field .search {
  min-width: 0;
  width: 100%;
}
.op-line .js-op-line-remove {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  align-self: end;
}
.op-line input[type=hidden] { display: none; }
tr.is-clickable { cursor: pointer; }
tr.is-clickable:hover { background: rgba(47, 111, 237, 0.06); }
.warn-text { color: #b45309; }
.rights-col { display: flex; flex-direction: column; gap: 8px; }
.rights-col .check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.rights-col .check input { margin: 0; }

.stock-flow {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.55fr) minmax(260px, 0.55fr);
  gap: 14px;
  align-items: stretch;
  margin-top: 12px;
}
.stock-window {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: calc(100vh - 220px);
  overflow: hidden;
}
.stock-window-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.stock-window-head h3 { margin: 0; font-size: 16px; }
.stock-window.is-new { border-top: 3px solid var(--green); }
.stock-window.is-assembly { border-top: 3px solid var(--amber); }
.stock-mp-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.stock-mp-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
}
.stock-mp-pane:last-child { border-right: 0; }
.stock-mp-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  font-size: 13px;
}
.stock-mp-pane .stock-window-body {
  overflow: auto;
  padding: 10px 12px 14px;
  flex: 1;
}
.stock-window-body {
  overflow: auto;
  padding: 10px 12px 14px;
  flex: 1;
}
.stock-window-products .stock-window-body { padding: 0; }
.stock-window-products table.data { margin: 0; }
.stock-board {
  border-collapse: separate;
  border-spacing: 0;
}
.stock-board thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  box-shadow: inset 0 -1px 0 var(--line);
}
.stock-board th.th-num,
.stock-board td.td-num {
  text-align: right;
  white-space: nowrap;
  width: 1%;
  min-width: 72px;
}
.stock-board .th-hint {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
  white-space: normal;
  max-width: 8em;
  margin-left: auto;
}
.stock-board td { vertical-align: middle; }
.stock-board td.td-num .stock-qty,
.stock-board td.td-num .mp-side-qty {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.stock-product {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 200px;
}
.stock-thumb { width: 56px; height: 72px; }
.stock-meta { min-width: 0; }
.stock-title {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  max-width: 280px;
}
.stock-mps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.stock-mp-name {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.stock-qty {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stock-qty.is-short, .mp-remain .is-short { color: var(--red); }
.stock-n { margin-top: 6px; font-size: 12px; }
.order-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.order-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.3;
}
.stock-window.is-new .order-chip { background: var(--green-bg); }
.stock-window.is-assembly .order-chip { background: var(--amber-bg); }
.order-chip .oid {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.order-chip .oart { color: var(--muted); }
.order-chip .odate {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.supply-pack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.supply-pack:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.supply-pack-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.supply-pack-head .btn { padding: 6px 10px; font-size: 12px; }
.mp-remain {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  min-width: 110px;
}
.mp-remain-row {
  flex-direction: row;
  align-items: baseline;
  gap: 18px;
  min-width: 96px;
}
.mp-side-qty {
  min-width: 40px;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.mp-side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 52px;
}
.mp-side-empty { opacity: 0.55; }
.mp-remain-name {
  display: inline-block;
  min-width: 40px;
  color: var(--muted);
  font-size: 12px;
}
.mp-remain strong { font-variant-numeric: tabular-nums; }
.stock-gap {
  margin-top: 6px;
  font-size: 12px;
  color: #b54708;
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.mp-side-qty.is-gap {
  color: #b54708;
  outline: 1px solid #f7b27a;
  outline-offset: 2px;
  border-radius: 4px;
  padding: 0 4px;
}
.row-mp-gap td {
  background: #fff7ed;
}
.row-mp-gap.row-mismatch td {
  background: #fef3f2;
}
.limits-row-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.limits-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}
.row.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mp-sync-bar {
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.mp-sync-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.mp-sync-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 12px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.switch:hover {
  border-color: #c5d0de;
  box-shadow: 0 1px 2px rgba(26, 35, 50, 0.06);
}
.switch:focus-within {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.15);
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #d0d5dd;
  transition: background 0.2s ease;
}
.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.28);
  transition: transform 0.2s ease;
}
.switch input:checked + .switch-track {
  background: var(--green);
}
.switch input:checked + .switch-track .switch-knob {
  transform: translateX(18px);
}
.switch:has(input:checked) {
  border-color: #9bd7c0;
  background: var(--green-bg);
}
.switch-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
  min-width: 3.2em;
}
.switch-text strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.switch-state {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: lowercase;
}
.switch-state::before {
  content: attr(data-off);
}
.switch input:checked ~ .switch-text .switch-state {
  color: var(--green);
}
.switch input:checked ~ .switch-text .switch-state::before {
  content: attr(data-on);
}
.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  background: #e8f1fb;
  color: #175cd3;
  white-space: nowrap;
}
.status-pill.status-open { background: #e8f1fb; color: #175cd3; }
.status-pill.status-closed { background: #f2f4f7; color: #475467; }
.status-pill.status-done { background: #e6f4ef; color: #12805c; }
.status-pill.status-order { background: #f2f4f7; color: #344054; }
.status-pill.status-order.is-cancel { background: #fef3f2; color: #b42318; }

.shipments-filter-form .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.status-ms {
  position: relative;
  display: inline-block;
  max-width: 280px;
  min-width: 180px;
}
.status-ms-btn {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  user-select: none;
}
.status-ms-btn::-webkit-details-marker { display: none; }
.status-ms-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-ms-caret {
  color: var(--muted, #667085);
  font-size: 12px;
  flex-shrink: 0;
}
.status-ms[open] .status-ms-caret { transform: rotate(180deg); }
.status-ms.is-active .status-ms-btn {
  border-color: #175cd3;
  box-shadow: 0 0 0 1px rgba(23, 92, 211, 0.2);
}
.status-ms-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  min-width: 320px;
  max-width: min(420px, 92vw);
  background: #fff;
  border: 1px solid var(--border, #d0d5dd);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
  padding: 8px;
}
.status-ms-list {
  max-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.status-ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
}
.status-ms-option:hover { background: #f2f4f7; }
.status-ms-option input {
  margin: 0;
  flex-shrink: 0;
  accent-color: #175cd3;
}
.status-ms-option-text { flex: 1; min-width: 0; }
.status-ms-option-n { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.status-ms-actions {
  display: flex;
  gap: 8px;
  padding: 8px 4px 4px;
  border-top: 1px solid var(--border, #eaecf0);
  margin-top: 6px;
}
table.data tr.row-cancelled td { background: #fff8f7; }
table.data tr.row-cancelled:hover td { background: #ffefed; }
.shipments-table code {
  font-size: 12px;
  background: #f2f4f7;
  padding: 2px 6px;
  border-radius: 4px;
}
@media (max-width: 1100px) {
  .stock-flow { grid-template-columns: 1fr; }
  .stock-window { max-height: 70vh; }
}

/* Админ-консоль базы (бэкапы) — плитки как у панели 1С */
.wrap-admin { max-width: 1100px; }
.admin-console { display: flex; flex-direction: column; gap: 18px; }
.admin-head {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px 14px;
}
.admin-head-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 18px;
  margin-bottom: 14px;
}
.admin-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}
.admin-head-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-size: 14px;
}
.admin-ok { color: var(--green); font-size: 13px; }
.admin-warn { color: var(--amber); font-size: 13px; }
.admin-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px 20px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.admin-meta dt {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.admin-meta dd {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.admin-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.admin-tile-form { display: contents; }
.admin-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 108px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.admin-tile:hover {
  text-decoration: none;
  border-color: #c5d0dc;
  box-shadow: 0 2px 10px rgba(26, 35, 50, 0.06);
}
.admin-tile:disabled,
.admin-tile.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}
.admin-tile-icon {
  color: #7b8794;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.admin-tile-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}
.admin-tile-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.admin-list h2 { margin-bottom: 10px; }
.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.admin-restore-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.admin-restore-form input[type=text] {
  width: 11rem;
  max-width: 100%;
}
.admin-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: 0 16px 48px rgba(26, 35, 50, 0.22);
}
.admin-dialog::backdrop {
  background: rgba(26, 35, 50, 0.45);
}
.admin-dialog-card {
  margin: 0;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-dialog-card h3 {
  margin: 0;
  font-size: 18px;
}
.admin-dialog-warn {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 14px;
  line-height: 1.45;
}
.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
@media (max-width: 720px) {
  .admin-tiles { grid-template-columns: 1fr; }
  .admin-head h1 { font-size: 18px; }
}

