:root {
  --bg: #eef0f4;
  --panel: #fff;
  --line: #cfd3dc;
  --text: #1a1d23;
  --muted: #5c6470;
  --accent: #1f6b45;
  --ok: #1f6b45;
  --bad: #a33b3b;
  --input: #fff;
  --head: #e7eaef;
  --wb: #f3e8ff;
  --ozon: #e8f1ff;
  --yandex: #fff6d6;
  --avito: #e7f6ec;
  --warn: #8a4b12;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: #1558c0; text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
  display: flex;
  gap: 12px 24px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand { font-weight: 650; color: var(--text); }
nav { display: flex; gap: 16px; flex: 1; }
nav a.active { font-weight: 650; color: var(--accent); }
.flags { display: flex; gap: 8px; font-size: 12px; }
.flags span {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  cursor: help;
}
.flags .on { color: var(--ok); border-color: var(--ok); }
main { padding: 20px; }
h1 { font-size: 22px; font-weight: 650; margin: 0 0 8px; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
.howto {
  max-width: 1100px;
  margin: 0 0 16px;
  color: var(--muted);
}
.banner {
  max-width: 1100px;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: #fff6d6;
  border: 1px solid #e6d089;
  border-radius: 6px;
}
.pick-list { padding-left: 0; list-style: none; }
.pick-list li { margin: 8px 0; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
input, select, button {
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 8px;
  font: inherit;
}
button, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  cursor: pointer;
}
.btn.ghost, button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.toolbar button.active {
  box-shadow: inset 0 0 0 2px #0d3d24;
}
button:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sheet-wrap {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
}
table.sheet {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}
.sheet th, .sheet td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
}
.sheet th {
  background: var(--head);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  position: sticky;
  z-index: 4;
}
.sheet thead tr:first-child th { top: 0; }
.sheet thead tr:nth-child(2) th { top: 42px; }
.sheet th.mp-h {
  text-align: center;
  white-space: nowrap;
}
.mp-title { font-weight: 600; }
.coef-head {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  font-weight: 400;
  font-size: 12px;
  white-space: nowrap;
  color: var(--muted);
  vertical-align: middle;
}
.num.coef { width: 56px; text-align: right; }
.sale-view { font-weight: 600; }
.sheet td.sticky-name, .sheet th.sticky-name {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 220px;
  max-width: 280px;
  background: var(--panel);
}
.sheet th.sticky-name { z-index: 6; background: var(--head); }
.sheet tbody tr:hover td { filter: brightness(0.98); }
.sheet tbody tr:hover td.sticky-name { background: #f3f4f7; filter: none; }
.mp-wb { background: var(--wb); }
.mp-ozon { background: var(--ozon); }
.mp-yandex { background: var(--yandex); }
.mp-avito { background: var(--avito); }
.sheet th.mp-wb, .sheet td.mp-wb { background: var(--wb); }
.sheet th.mp-ozon, .sheet td.mp-ozon { background: var(--ozon); }
.sheet th.mp-yandex, .sheet td.mp-yandex { background: var(--yandex); }
.sheet th.mp-avito, .sheet td.mp-avito { background: var(--avito); }
.col-money { white-space: nowrap; }
.col-stock { min-width: 140px; }
.pname { font-weight: 600; }
.sku { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.tiny { font-size: 12px; color: var(--muted); }
.note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.current { font-size: 12px; margin-top: 6px; color: var(--text); }
.current.diff { color: var(--warn); font-weight: 600; }
.warn-inline { color: var(--warn); }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 108px; min-height: 96px; margin-bottom: 8px; }
.stack:last-child { margin-bottom: 0; }
.card-link { font-size: 12px; }
.inline, .bind { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bind { margin-top: 8px; }
.bind input { min-width: 168px; width: 100%; max-width: 280px; }
.empty-mp .bind { max-width: 480px; }
.empty-mp { color: var(--muted); min-width: 220px; }
.empty-title { margin-bottom: 6px; }
.num { width: 84px; }
input.is-off { border-color: var(--warn); color: var(--warn); }
.with-suffix { display: flex; align-items: center; gap: 4px; }
.pager { margin-top: 12px; display: flex; gap: 8px; align-items: center; }
details.journal-block {
  padding: 0;
}
details.journal-block > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px;
  user-select: none;
}
details.journal-block > summary::-webkit-details-marker {
  display: none;
}
details.journal-block > summary::before {
  content: "▸";
  color: var(--muted);
  font-weight: 400;
  width: 1em;
  flex: 0 0 auto;
}
details.journal-block[open] > summary::before {
  content: "▾";
}
details.journal-block .journal-title {
  font-size: 16px;
  font-weight: 650;
}
details.journal-block .count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
details.journal-block .journal-body {
  padding: 0 16px 16px;
}
details.journal-block table.sheet {
  width: 100%;
  min-width: 0;
}
details.journal-block .sheet td.tiny {
  max-width: 420px;
  overflow-wrap: anywhere;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 16px;
  max-width: 720px;
}
.card.wide { max-width: none; }
.card.add-card { max-width: none; }
.add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}
.add-form label { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.add-form input { min-width: 140px; }
.toolbar input[type="file"] { max-width: 220px; }
.log-ok { color: var(--ok); font-weight: 600; }
.log-bad { color: var(--bad); font-weight: 600; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
}
.tip:hover, .tip:focus {
  color: var(--text);
  border-color: var(--text);
  outline: none;
}
.tip:hover::after, .tip:focus::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-30%);
  z-index: 20;
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  background: #1a1d23;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  border-radius: 6px;
  white-space: normal;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  pointer-events: none;
}
label { display: inline-block; margin-bottom: 6px; }
.keys-form label { display: block; margin: 10px 0 4px; }
.keys-form input[type="password"],
.keys-form input[type="text"],
.keys-form select {
  width: 100%;
  max-width: 480px;
}
.keys-form .row { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.checks { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 0; }
.checks label { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-weight: 400; }
.checks input[type="checkbox"] { margin-top: 3px; }
.interval-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin: 4px 0 8px;
}
.interval-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
  max-width: 320px;
}
.interval-field label { font-weight: 650; }
.interval-field input[type="number"] { width: 96px; }
.mp-interval {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px 10px;
  margin: 8px 0;
  background: #fff;
}
.mp-interval h3 { margin: 0 0 8px; font-size: 16px; }
.mp-interval .interval-field label {
  display: block;
  font-weight: 650;
}
.limit-title { font-weight: 650; margin: 10px 0 4px; }
.limit-list { margin: 0 0 6px; padding-left: 18px; }
.limit-list li { margin: 0 0 4px; }
.limit-source { margin: 0; font-size: 13px; }
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}
.who form { margin: 0; }
.logout {
  margin-left: auto;
}
.logout button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 650;
}
.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tab {
  padding: 8px 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active {
  color: var(--text);
  font-weight: 650;
  border-bottom-color: var(--accent);
}
.bind-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
button.danger, .btn.danger {
  background: var(--bad);
  color: #fff;
}
a.btn {
  display: inline-block;
  text-decoration: none;
}
a.btn:hover { text-decoration: none; }
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.login-card h1 { margin-bottom: 8px; }
.login-card .keys-form input {
  width: 100%;
  max-width: none;
}
