/* ==========================================================================
   PRICER — app shell & primitives
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
::selection { background: rgba(0, 91, 255, .18); }

.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.soft { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-radius: 4px;
}

/* scrollbars ------------------------------------------------------------- */
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: padding-box;
}
.scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
  background-clip: padding-box;
  border: 3px solid transparent;
}
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   Shell
   ========================================================================== */

.shell {
  display: grid;
  grid-template-columns: var(--w-side) minmax(0, 1fr);
  min-height: 100vh;
}

/* ------- sidebar ------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 10px 10px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 6px 0;
  min-height: 28px;
}
.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, #005bff 0%, #6a3bff 55%, #cb11ab 100%);
  box-shadow: 0 4px 12px -4px rgba(0, 91, 255, .6);
  flex: 0 0 auto;
}
.brand__name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1;
}
.brand__beta {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-3);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 1px 3px;
  line-height: 1.1;
}

.nav { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 31px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: var(--fs);
  font-weight: 500;
  transition: background .12s, color .12s;
}
.nav__item svg { flex: 0 0 auto; opacity: .85; }
.nav__item:hover { background: var(--surface-3); color: var(--text); }
.nav__item.is-active {
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-weight: 600;
}
.nav__item.is-active svg { opacity: 1; }
.nav__label { flex: 1 1 auto; }
.nav__badge {
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  font-size: var(--fs-micro);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--red-soft);
  color: var(--red-ink);
}

.side-block { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.side-block__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.side-list { display: flex; flex-direction: column; gap: 1px; min-height: 0; }
.side-item {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 27px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.side-item:hover { background: var(--surface-3); color: var(--text); }
.side-item.is-active { color: var(--primary-ink); background: var(--primary-soft); }
.side-item__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: hsl(var(--h, 220) 70% 55%);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px hsl(var(--h, 220) 80% 92% / .9);
}
.side-item__name { flex: 1 1 auto; }
.side-item__count {
  font-size: var(--fs-micro);
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.side-more {
  padding: 4px 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--primary-ink);
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
}
.side-more:hover { background: var(--primary-soft); }

.sidebar__spacer { flex: 1 1 auto; }

.scanners {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 8px 9px 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}
.scanners__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.scan-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.4;
}
/* подпись источника: сжимается и обрезается, чтобы ничего не переносилось */
.scan-row__name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* состояние: всегда одной строкой и прижато вправо */
.scan-row__state {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.scan-row__state.is-on { color: var(--green-ink); font-weight: 600; }
.scan-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
  flex: 0 0 auto;
}
.scan-dot--busy { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 18%, transparent); animation: pulse 1.6s infinite; }
.scan-dot--idle { background: var(--text-3); box-shadow: none; }
.scan-row--link {
  color: var(--primary-ink);
  font-size: var(--fs-micro);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scan-row--link:hover { text-decoration: underline; }
.scan-row--link > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
.scan-bar { height: 3px; border-radius: 3px; background: var(--surface-4); overflow: hidden; }
.scan-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--violet)); }

.userchip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  width: 100%;
  background: none;
  text-align: left;
}
.userchip:hover { background: var(--surface-3); border-color: var(--line); }
.userchip__meta { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; line-height: 1.25; }
.userchip__name { font-size: var(--fs); font-weight: 600; }
.userchip__role { font-size: var(--fs-micro); color: var(--text-3); }

/* ------- topbar ------- */

.workspace { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--h-topbar);
  flex: 0 0 var(--h-topbar);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--pad-x);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.gsearch {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  max-width: 620px;
  height: 34px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-2);
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.gsearch:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--ring);
}
.gsearch svg { color: var(--text-3); flex: 0 0 auto; }
.gsearch__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  font-size: var(--fs);
}
.gsearch__input::placeholder { color: var(--text-3); }
.gsearch__kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--text-3);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  white-space: nowrap;
}

.topbar__right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.syncp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
}
.syncp i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2.4s infinite;
}

/* ==========================================================================
   Controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs);
  font-weight: 600;
  white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s, color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:active { transform: translateY(.5px); }
.btn svg { flex: 0 0 auto; }

.btn--primary {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 91, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn--primary:hover { background: var(--primary-2); border-color: transparent; }
.btn--soft {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary-ink);
}
.btn--soft:hover { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); border-color: transparent; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn--danger { color: var(--red-ink); }
.btn--danger:hover { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.btn--sm { height: 26px; padding: 0 8px; font-size: var(--fs-sm); border-radius: 7px; }
.btn--icon { width: 30px; padding: 0; }
.btn--icon.btn--sm { width: 26px; }
.btn--block { width: 100%; }

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  transition: background .12s, color .12s;
  position: relative;
  flex: 0 0 auto;
}
.iconbtn:hover { background: var(--surface-3); color: var(--text); }
.iconbtn.is-on { color: var(--primary-ink); background: var(--primary-soft); }
.iconbtn--sm { width: 26px; height: 26px; border-radius: 7px; }
.iconbtn__dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--surface);
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--surface-3);
  border: 1px solid var(--line);
}
.seg__btn {
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.seg__btn:hover { color: var(--text); }
.seg__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
[data-theme="dark"] .seg__btn.is-active { background: var(--surface-4); }

.input,
.select {
  height: 30px;
  width: 100%;
  padding: 0 9px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs);
  outline: 0;
  transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: var(--ring); }
.select { appearance: none; padding-right: 26px; background-image: none; cursor: pointer; }
.select-wrap { position: relative; }
.select-wrap > svg { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 4px; }
.label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.hint { font-size: var(--fs-sm); color: var(--text-3); }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 28px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-micro);
  font-weight: 600;
  white-space: nowrap;
}
.chip--line { background: transparent; border: 1px solid var(--line-2); }
.chip--primary { background: var(--primary-soft); color: var(--primary-ink); }
.chip--green { background: var(--green-soft); color: var(--green-ink); }
.chip--red { background: var(--red-soft); color: var(--red-ink); }
.chip--amber { background: var(--amber-soft); color: var(--amber-ink); }
.chip--violet { background: var(--violet-soft); color: var(--violet-ink); }
.chip--wb { background: var(--wb-soft); color: var(--wb); }
.chip__x {
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  margin-right: -2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  opacity: .6;
}
.chip__x:hover { opacity: 1; background: rgba(0, 0, 0, .1); }

/* platform badge */
.pf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
  flex: 0 0 auto;
}
.pf--wb { background: linear-gradient(135deg, #e119b8, var(--wb-2)); color: #fff; }
.pf--ozon { background: linear-gradient(135deg, #2e6bff, var(--ozon-2)); color: #fff; }

/* delta pill */
.delta {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  font-size: var(--fs-sm);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.delta--down { background: var(--green-soft); color: var(--green-ink); }
.delta--up { background: var(--red-soft); color: var(--red-ink); }
.delta--flat { background: var(--surface-3); color: var(--text-3); }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-micro);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.badge--primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge--green { background: var(--green-soft); color: var(--green-ink); }
.badge--red { background: var(--red-soft); color: var(--red-ink); }

/* switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--surface-4);
  border: 1px solid var(--line-2);
  flex: 0 0 auto;
  position: relative;
  transition: background .16s, border-color .16s;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform .16s;
}
.switch input:checked + .switch__track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }
.switch__label { font-size: var(--fs); color: var(--text-2); }

/* checkbox */
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--fs);
  color: var(--text-2);
}
.check input {
  appearance: none;
  width: 15px;
  height: 15px;
  margin: 0;
  border: 1.5px solid var(--line-2);
  border-radius: 4px;
  background: var(--surface);
  flex: 0 0 auto;
  position: relative;
  cursor: pointer;
}
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(42deg);
}
.check input:focus-visible { box-shadow: var(--ring); }

/* avatar */
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #005bff, #6a3bff);
  flex: 0 0 auto;
  letter-spacing: .02em;
}
.avatar--sm { width: 22px; height: 22px; font-size: 9px; }
.avatar--lg { width: 56px; height: 56px; font-size: 18px; border-radius: 18px; }

/* product thumb (monogram) */
.thumb {
  --h: 220;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(145deg, hsl(var(--h) 88% 94%), hsl(calc(var(--h) + 26) 74% 85%));
  color: hsl(var(--h) 48% 32%);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .02em;
  border: 1px solid hsl(var(--h) 60% 88%);
  text-transform: uppercase;
  overflow: hidden;
}
.thumb--sm { width: 24px; height: 24px; border-radius: 6px; font-size: 8.5px; }
.thumb--lg { width: 44px; height: 44px; border-radius: 11px; font-size: 12px; }
.thumb--md { width: 38px; height: 38px; border-radius: 9px; font-size: 11px; }
.thumb--xl { width: 100%; height: 100%; border-radius: 0; font-size: 38px; border: 0; letter-spacing: .04em; }
[data-theme="dark"] .thumb { filter: saturate(.92) brightness(.92); border-color: hsl(var(--h) 40% 26%); }

/* фото товара: картинка внутри той же рамки, с мягким фоном и внутренним отступом */
.thumb--photo {
  padding: 2px;
  background: linear-gradient(145deg, hsl(var(--h) 70% 97%), hsl(calc(var(--h) + 26) 55% 93%));
}
.thumb--photo img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
  background: var(--surface);
}
[data-theme="dark"] .thumb--photo { background: hsl(var(--h) 22% 18%); }
[data-theme="dark"] .thumb--photo img { filter: none; background: hsl(var(--h) 18% 24%); }


/* range bar */
.range { position: relative; height: 4px; border-radius: 3px; background: var(--surface-4); width: 100%; }
.range__fill { position: absolute; top: 0; height: 4px; border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 45%, #fff), var(--primary)); }
.range__dot {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--primary);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px var(--surface);
}
.range-legend { display: flex; justify-content: space-between; font-size: var(--fs-micro); color: var(--text-3); margin-top: 3px; font-variant-numeric: tabular-nums; }

/* dot */
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex: 0 0 auto; }
.dot--green { background: var(--green); }
.dot--red { background: var(--red); }
.dot--amber { background: var(--amber); }
.dot--primary { background: var(--primary); }

/* ==========================================================================
   Overlays
   ========================================================================== */

.popover {
  position: fixed;
  z-index: 80;
  min-width: 220px;
  max-width: 340px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px) } to { opacity: 1; transform: none } }
.popover__title {
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 2px 4px 6px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 14, 24, .48);
  backdrop-filter: blur(2px);
  animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: min(460px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  animation: modal .16s cubic-bezier(.2, .8, .3, 1);
}
@keyframes modal { from { opacity: 0; transform: translateY(8px) scale(.985) } to { opacity: 1; transform: none } }
.modal--wide { width: min(620px, 100%); }
.modal__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 10px;
}
.modal__title { font-size: 15px; font-weight: 700; line-height: 1.25; }
.modal__sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.modal__close { margin-left: auto; margin-top: -4px; margin-right: -6px; }
.modal__body {
  padding: 4px 16px 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--fs);
  color: var(--text-2);
}
.modal__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.modal__foot .btn--primary { margin-left: auto; }

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 260px;
  max-width: 400px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  font-size: var(--fs);
  animation: toastin .18s ease-out;
}
@keyframes toastin { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: .16s; }
.toast__icon { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; background: var(--green); flex: 0 0 auto; }
.toast--error .toast__icon { background: var(--red); }
.toast--info .toast__icon { background: var(--primary); }
.toast__text { flex: 1 1 auto; }
.toast__action { border: 0; background: none; color: var(--primary-ink); font-size: var(--fs-sm); font-weight: 700; padding: 2px 4px; border-radius: 5px; }
.toast__action:hover { background: var(--primary-soft); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty__icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-2);
  margin-bottom: 2px;
}
.empty__title { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.empty__text { font-size: var(--fs); max-width: 380px; }

.divider { height: 1px; background: var(--line); border: 0; margin: 2px 0; }
.spacer { flex: 1 1 auto; }

kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  color: var(--text-2);
  background: var(--surface-2);
}

.tag-kind { color: var(--text-2); }

/* ==========================================================================
   Page layout
   ========================================================================== */

.page {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px var(--pad-x) 16px;
}
.page--fixed {
  height: calc(100vh - var(--h-topbar));
  overflow: hidden;
  padding-bottom: 12px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 38px;
}
.page-head__main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.page-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -.015em;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.page-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.page-sub b { color: var(--text-2); font-weight: 600; }
.page-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-bottom: 1px;
}
.crumbs a:hover { color: var(--primary-ink); }
.crumbs svg { opacity: .6; }

/* panels */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.panel--flush { box-shadow: none; }
.panel__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.panel__head--tabs { padding: 0 8px 0 12px; }
.panel__title { font-size: var(--fs-md); font-weight: 700; display: flex; align-items: center; gap: 7px; }
.panel__count { font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); }
.panel__tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.panel__body { flex: 1 1 auto; min-height: 0; }
.panel__foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 12px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--text-3);
  background: var(--surface-2);
}
.panel__foot a { color: var(--primary-ink); font-weight: 600; }
.panel__foot a:hover { text-decoration: underline; }

.tabs { display: flex; align-items: center; gap: 2px; }
.tabs__btn {
  position: relative;
  height: 37px;
  padding: 0 10px;
  border: 0;
  background: none;
  font-size: var(--fs);
  font-weight: 600;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tabs__btn::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
}
.tabs__btn:hover { color: var(--text); }
.tabs__btn.is-active { color: var(--text); }
.tabs__btn.is-active::after { background: var(--primary); }
.tabs__btn .badge { height: 16px; min-width: 16px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  flex-wrap: wrap;
  background: var(--surface);
}
.toolbar .input { height: 28px; }
.toolbar__search { width: 250px; min-width: 190px; flex: 1 1 250px; max-width: 380px; }
.toolbar .seg { background: var(--surface-2); }
.toolbar__right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.filterbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 12px 8px;
  flex: 0 0 auto;
}
.filterbar:empty { display: none; }
.filterbar__label { font-size: var(--fs-sm); color: var(--text-3); }
.filterbar__reset { border: 0; background: none; color: var(--text-3); font-size: var(--fs-sm); font-weight: 600; padding: 2px 4px; border-radius: 4px; }
.filterbar__reset:hover { color: var(--red-ink); background: var(--red-soft); }

/* ==========================================================================
   Tables
   ========================================================================== */

.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs);
}
.tbl th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 6px 10px;
  text-align: left;
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  user-select: none;
}
.tbl th.is-sortable { cursor: pointer; }
.tbl th.is-sortable:hover { color: var(--text); }
.tbl th .sort-ind { display: inline-block; margin-left: 3px; opacity: .55; font-size: 9px; }
.tbl td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  height: 44px;
}
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.is-clickable { cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl .cell-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tbl .cell-stack { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.tbl .cell-title { font-weight: 600; font-size: var(--fs); color: var(--text); }
.tbl .cell-meta { font-size: var(--fs-micro); color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.tbl .cell-right { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.tbl .t-actions { width: 1%; white-space: nowrap; text-align: right; }

.price { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.price--sm { font-size: var(--fs); }
.price--lg { font-size: 22px; letter-spacing: -.02em; }
.oldprice { font-size: var(--fs-micro); color: var(--text-3); text-decoration: line-through; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-row { display: flex; align-items: baseline; gap: 6px; }

.row-action { opacity: 0; transition: opacity .1s; }
tr:hover .row-action, .row-action:focus-visible { opacity: 1; }
@media (hover: none) { .row-action { opacity: 1; } }

/* ==========================================================================
   KPI & sysbar
   ========================================================================== */

.kpi-row {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
  min-width: 0;
  overflow: hidden;
}
.kpi__top { display: flex; align-items: center; gap: 6px; }
.kpi__icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-ink);
  flex: 0 0 auto;
}
.kpi__icon--green { background: var(--green-soft); color: var(--green-ink); }
.kpi__icon--red { background: var(--red-soft); color: var(--red-ink); }
.kpi__icon--amber { background: var(--amber-soft); color: var(--amber-ink); }
.kpi__icon--violet { background: var(--violet-soft); color: var(--violet-ink); }
.kpi__label {
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi__value {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.kpi__value small { font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.kpi__foot {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-micro);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 14px;
}
.kpi__foot b { color: var(--text-2); font-weight: 600; }
.kpi__spark { position: absolute; right: 8px; bottom: 7px; opacity: .85; pointer-events: none; }
.kpi--opportunity {
  border-color: color-mix(in srgb, var(--amber) 35%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--amber-soft) 55%, var(--surface)), var(--surface) 72%);
}

.sysbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 22px;
  padding: 0 2px;
  font-size: var(--fs-micro);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}
.sysbar__item { display: inline-flex; align-items: center; gap: 5px; }
.sysbar__item b { font-weight: 600; color: var(--text-2); }
.sysbar__sep { width: 1px; height: 10px; background: var(--line-2); }

.split {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1420px) {
  .kpi-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpi__spark { display: none; }
}

@media (max-width: 1240px) {
  :root { --w-side: 64px; --pad-x: 12px; }
  .brand { justify-content: center; padding: 2px 0 0; }
  .brand__name, .brand__beta,
  .nav__label, .nav__badge,
  .side-block, .scanners, .userchip__meta, .userchip > svg { display: none; }
  .nav__item { justify-content: center; padding: 0; }
  .userchip { justify-content: center; padding: 4px; }
  .page-sub { display: none; }
}

@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(240px, 1fr); }
  .page--fixed { height: auto; overflow: visible; }
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .syncp { display: none; }
}

@media (max-width: 760px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gsearch__kbd { display: none; }
  .page-actions .btn span { display: none; }
  .toolbar__search { width: 100%; }
}



