/* Визуальный язык основного дашборда WB Miteg (оболочка UX v2): меню слева по группам,
   шапка с периодами, белые карточки на светло-сером фоне, красный акцент, Montserrat. */
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('fonts/montserrat-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('fonts/montserrat-var-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  --side-w: 248px;
  --workspace: #f7f8fa;
  --card: #ffffff;
  --soft: #f4f5f9;
  --ink: #08194a;
  --ink-2: #57617e;
  --muted: #8c93a8;
  --line: #e6e8ef;
  --hover: rgba(8, 25, 74, .05);
  --hover-2: rgba(8, 25, 74, .09);
  --accent: #e8452e;
  --accent-soft: #fce9e3;
  --accent-on: rgba(232, 69, 46, .16);
  --series-1: #e8452e;
  --series-2: #2e86de;
  --series-3: #b8bfd0;
  --good: #17858e;
  --gain: #17858e;
  --bad: #c21b36;
  --warn: #ee7a24;
  --ads: #176e8f;
  --font: 'Montserrat', 'Segoe UI', Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-family: var(--font); color: var(--ink); background: var(--workspace); }
body { margin: 0; min-height: 100vh; background: var(--workspace); padding-left: var(--side-w); }
button, input, select { font-family: var(--font); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- меню слева ---------- */
.side { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--line); z-index: 60; overflow: hidden auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.side-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.brand { display: block; }
.brand img { display: block; width: 110px; height: auto; }
.side-tag { display: block; margin-top: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); }
.side-nav { flex: 1; padding: 8px 8px 12px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.nav-group-l { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2); padding: 6px 10px 4px; }
.side-nav a, .side-foot button { display: flex; align-items: center; gap: 10px; width: 100%; position: relative;
  padding: 8px 10px; border-radius: 9px; border: 0; background: transparent; color: var(--ink);
  font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; text-align: left; white-space: nowrap; }
.side-nav a::before, .side-foot button::before { content: attr(data-ico); display: inline-flex; align-items: center;
  justify-content: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px; background: var(--hover);
  color: var(--ink-2); font-size: 14px; }
.side-nav a:hover, .side-foot button:hover { background: var(--hover); }
.side-nav a[aria-current="page"] { background: var(--accent-on); }
.side-nav a[aria-current="page"]::before { background: var(--accent); color: #fff; }
.side-nav a[aria-current="page"]::after { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); }
.side-stamp { display: flex; gap: 6px; padding: 10px 16px 6px; border-top: 1px solid var(--line);
  font-size: 11px; line-height: 1.35; color: var(--ink-2); }
.dot { flex: none; width: 8px; height: 8px; margin-top: 3px; border-radius: 50%; background: var(--gain); }
.side-foot { padding: 4px 8px 12px; }
.side-foot button { font-size: 12.5px; }

/* ---------- шапка раздела ---------- */
.top { position: sticky; top: 0; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 8px 24px; min-height: 56px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
h1 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; margin: 0 8px 0 0; white-space: nowrap; }
h2 { font-size: 14px; font-weight: 700; letter-spacing: .01em; margin: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.filters select, .search input, .search select { border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); font-size: 12.5px; font-weight: 600; padding: 9px 12px; min-height: 40px; }
.filters select { max-width: 190px; }
.periods { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px;
  flex-wrap: wrap; }
.periods a { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 6px 12px; border-radius: 7px;
  text-decoration: none; white-space: nowrap; }
.periods a:hover { color: var(--ink); }
.periods a[aria-current="true"] { background: var(--ink); color: #fff; }
.range { display: flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 3px 4px 3px 8px; color: var(--ink-2); }
.range input { border: 0; background: transparent; color: var(--ink); font-size: 12.5px; font-weight: 600;
  padding: 5px 2px; width: 128px; }
.range .go, .btn { border: 0; border-radius: 7px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; min-width: 30px; min-height: 30px; }
.range .go:hover, .btn:hover { background: var(--accent); }
.btn { font-size: 13px; padding: 9px 14px; min-height: 40px; border-radius: 10px; }

main { min-width: 0; padding: 16px 24px 48px; }
.subtitle, .panel-sub { color: var(--ink-2); font-size: 12px; margin: 0 0 14px; line-height: 1.5; }
.notice { padding: 12px 16px; background: var(--accent-soft); border: 1px solid #f3c2b6; border-radius: 10px;
  color: #9a2c1b; margin-bottom: 14px; font-size: 13px; line-height: 1.5; }

/* ---------- показатели ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 15px;
  box-shadow: 0 1px 2px rgba(8, 25, 74, .04); display: flex; flex-direction: column; gap: 4px; min-width: 0;
  transition: box-shadow .13s, transform .13s; }
.kpi:hover { box-shadow: 0 5px 16px rgba(8, 25, 74, .08); }
.kpi.accent { outline: 2px solid var(--accent); outline-offset: -1px; }
.kpi .label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
  min-height: 2.6em; display: flex; align-items: flex-end; }
.kpi .value { font-size: clamp(19px, 1.7vw, 25px); font-weight: 700; letter-spacing: -.01em; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .note { font-size: 12px; color: var(--ink-2); line-height: 1.4; margin-top: auto; }
.chg { font-weight: 700; }
.chg.up { color: var(--gain); }
.chg.down { color: var(--bad); }
.chg.up.inverse { color: var(--bad); }
.chg.down.inverse { color: var(--gain); }

/* ---------- карточки ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px;
  margin-bottom: 14px; align-items: start; }
.grid.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0;
  margin-bottom: 14px; box-shadow: 0 1px 2px rgba(8, 25, 74, .025); }
.grid > .panel { margin-bottom: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-sub { margin: 6px 0 14px; }
.badge { border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink-2);
  padding: 5px 11px; font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none; }
a.badge:hover { color: var(--ink); border-color: var(--ink-2); }
.empty { padding: 26px 0; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- графики ---------- */
.chart { position: relative; min-height: 220px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #eef0f5; }
.chart .axis-label { fill: var(--ink-2); font-size: 10.5px; font-family: var(--font); }
.chart .bar:hover { opacity: .8; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 10px; font-size: 11.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(8, 25, 74, .14); padding: 8px 11px; font-size: 12px; white-space: nowrap; z-index: 5;
  line-height: 1.5; }
.tip b { display: block; color: var(--ink-2); font-weight: 600; margin-bottom: 2px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-size: 12px;
  font-weight: 600; color: var(--ink-2); padding: 5px 11px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- полосы ---------- */
.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 1.1fr) minmax(90px, 2fr) auto;
  gap: 10px; align-items: center; font-size: 12px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .sub { display: block; color: var(--muted); font-size: 11px; }
.bar-track { height: 10px; border-radius: 5px; background: var(--soft); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 5px; background: var(--series-1); }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.st-bought { background: var(--gain); }
.st-way { background: var(--series-3); }
.st-cancel { background: var(--warn); }
.st-notbought { background: var(--bad); }
.st-return { background: #7b4bb3; }

/* ---------- таблицы ---------- */
.table-wrap { overflow: auto; max-height: 640px; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: right; color: var(--ink-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 700; position: sticky; top: 0; background: var(--soft); z-index: 1; white-space: nowrap; }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--accent); }
th[aria-sort="ascending"] button::after { content: " ▲"; }
th[aria-sort="descending"] button::after { content: " ▼"; }
td, th { padding: 10px; border-bottom: 1px solid var(--line); }
td { text-align: right; font-variant-numeric: tabular-nums; }
th.l, td.l { text-align: left; }
tr:hover td { background: #fafbfd; }
td .sub { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
td.product { min-width: 220px; max-width: 360px; white-space: normal; }
.pill { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 700;
  color: #fff; white-space: nowrap; }
.inbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--series-1);
  vertical-align: middle; margin-right: 6px; }
.low { color: var(--bad); font-weight: 700; }
.search { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.search input { min-width: 220px; flex: 1 1 220px; }
footer { color: var(--muted); font-size: 11px; margin-top: 18px; line-height: 1.6; }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) { .grid.wide-left { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  body { padding-left: 0; }
  .side { position: static; width: auto; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border: 0; }
  .brand img { width: 84px; }
  .side-tag { margin: 0; }
  .side-nav { display: flex; overflow-x: auto; padding: 0 8px 8px; gap: 2px; }
  .nav-group { flex-direction: row; margin: 0; }
  .nav-group-l, .side-stamp, .side-foot { display: none; }
  .side-nav a { flex: 0 0 auto; width: auto; }
  .top { position: static; padding: 10px 16px; }
  main { padding: 14px 16px 32px; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 13px; }
  .kpi .value { font-size: 18px; }
  .opt { display: none; }
  .range input { width: 112px; }
  .bar-row { grid-template-columns: minmax(80px, 1fr) minmax(70px, 1.3fr) auto; }
}
