:root {
  --bg: #0f1420;
  --panel: #161d2e;
  --border: #26304a;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --accent: #4f8cff;
  --ok: #2ecc71;
  --warning: #f1c40f;
  --critical: #e74c3c;
  --high: #a855f7;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
/* ---------- Верхнее меню ---------- */
.topbar {
  --nav-h: 56px;
  display: flex; align-items: center; gap: 18px;
  height: var(--nav-h); padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
  background: rgba(19, 25, 40, 0.82);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 8px 24px -16px rgba(0, 0, 0, 0.6);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: #fff; letter-spacing: -0.5px;
  background: linear-gradient(135deg, #4f8cff 0%, #7c5cff 55%, #a855f7 100%);
  box-shadow: 0 4px 14px -4px rgba(99, 120, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; font-weight: 700; font-size: 15px; letter-spacing: 0.3px; }
.brand-text small { font-weight: 500; font-size: 10.5px; color: var(--muted); letter-spacing: 0.4px; text-transform: uppercase; }
.nav-main { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; height: 100%; }
.nav-spacer { flex: 1; }
.ico { width: 17px; height: 17px; flex: none; }
.nav-item {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 11px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font: inherit; font-size: 13.5px; font-weight: 500;
  background: transparent; border: 0; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-item:hover, .nav-group.open > .nav-item { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.nav-item.active, .nav-group.active > .nav-item {
  color: #fff; background: rgba(79, 140, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(79, 140, 255, 0.35);
}
.nav-item.active .ico, .nav-group.active > .nav-item .ico:first-child { color: #7fb0ff; }
.nav-sub { color: #9fc2ff; font-weight: 400; }
.nav-sub::before { content: "·"; margin: 0 5px 0 1px; color: var(--muted); }
.nav-toggle .ico:last-child { width: 14px; height: 14px; opacity: .6; transition: transform .2s; }
.nav-group { position: relative; }
.nav-group.open > .nav-toggle .ico:last-child { transform: rotate(180deg); }
.nav-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 310px; padding: 6px;
  background: rgba(24, 31, 49, 0.97); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.7);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.nav-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; } /* мостик для наведения */
.nav-group.align-right .nav-menu { left: auto; right: 0; }
.nav-group.open .nav-menu { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) and (min-width: 1001px) {
  .nav-group:hover .nav-menu { opacity: 1; visibility: visible; transform: none; }
  .nav-group:hover > .nav-item { color: var(--text); background: rgba(255, 255, 255, 0.06); }
}
.nav-menu-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px;
  color: var(--text); text-decoration: none;
}
.nav-menu-item:hover { background: rgba(255, 255, 255, 0.06); }
.nav-menu-item.active { background: rgba(79, 140, 255, 0.14); }
.nav-menu-ico {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, 0.05); color: #9fc2ff;
}
.nav-menu-item.active .nav-menu-ico { background: rgba(79, 140, 255, 0.25); color: #fff; }
.nav-menu-item b { display: block; font-size: 13.5px; font-weight: 600; }
.nav-menu-item small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.nav-burger { display: none; margin-left: auto; background: transparent; border: 0; color: var(--text); padding: 8px; border-radius: 8px; cursor: pointer; }
.nav-burger .ico { width: 22px; height: 22px; }
@media (max-width: 1280px) { .nav-item { padding: 0 9px; } .nav-sub { display: none; } }
@media (max-width: 1000px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--nav-h); padding: 10px 16px; }
  .nav-burger { display: block; }
  .nav-main { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; height: auto; gap: 2px; padding-bottom: 8px; }
  .topbar.nav-open .nav-main { display: flex; }
  .nav-spacer { display: none; }
  .nav-item { width: 100%; }
  .nav-menu { position: static; min-width: 0; display: none; opacity: 1; visibility: visible; transform: none; box-shadow: none; margin: 4px 0 4px 18px; }
  .nav-group.open .nav-menu, .nav-group.active .nav-menu { display: block; }
  .nav-sub { display: inline; }
}
.container { padding: 20px 24px; max-width: 1280px; margin: 0 auto; }
.container-wide { max-width: none; }

/* "Разрыв" из центрированного контейнера на всю ширину экрана — для широких
   таблиц (себестоимость и т.п.), где 1200px слишком тесно. Прокрутка появляется
   сама снизу у самой таблицы (overflow-x:auto на обёртке), если не влезает
   даже на всю ширину экрана. */
.full-bleed {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

.summary-cards { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.card {
  flex: 1; min-width: 140px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; text-align: center;
}
.card .num { font-size: 28px; font-weight: 700; }
.card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.card.ok .num { color: var(--ok); }
.card.warning .num { color: var(--warning); }
.card.critical .num { color: var(--critical); }

.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.filter-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.filter-label select {
  background: #0f1420; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 8px; font-size: 13px;
}

.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text); }
.sort-arrow { font-size: 10px; color: var(--accent); }

.data-table { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.row-warning { background: rgba(241, 196, 15, 0.08); }
.row-critical { background: rgba(231, 76, 60, 0.12); }
.row-high { background: rgba(168, 85, 247, 0.12); }

.cell-ok { color: var(--ok); font-weight: 600; }
.cell-warning { color: var(--warning); font-weight: 600; }
.cell-critical { color: var(--critical); font-weight: 700; }
.cell-high { color: var(--high); font-weight: 700; }
.cell-unknown { color: var(--muted); }

.btn {
  background: var(--accent); color: white; border: none; border-radius: 8px;
  padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.btn:hover { opacity: 0.9; }
.btn.small { padding: 5px 10px; font-size: 12px; margin-right: 6px; }
.btn.danger { background: var(--critical); }

.form-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px; display: flex; flex-direction: column; gap: 12px; max-width: 480px; margin-bottom: 18px;
}
.form-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form-card input, .form-card select {
  background: #0f1420; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 8px 10px; font-size: 14px;
}
.form-card label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { background: #0f1420; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 4px 6px; }
.thresholds-form input { width: 90px; }

.help-block, .import-result { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-top: 14px; }
.ok-text { color: var(--ok); }
.error-text { color: var(--critical); }

.centered-table th, .centered-table td { text-align: center; }
.centered-table td:nth-child(6) { text-align: left; } /* название - слева, читаемее */

.vat-actual {
  background: rgba(241, 196, 15, 0.18);
  font-weight: 700;
  color: var(--warning);
}

.pagination {
  display: flex; align-items: center; gap: 12px; margin: 16px 0; justify-content: center;
}

.toolbar input[type="text"] {
  background: #0f1420; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 10px; font-size: 13px;
}

.thumb {
  width: 36px; height: 36px; object-fit: cover; border-radius: 6px;
  cursor: pointer; border: 1px solid var(--border); vertical-align: middle;
  background: #0f1420;
}
.thumb:hover { outline: 2px solid var(--accent); }
.thumb-placeholder {
  display: inline-block; width: 36px; height: 36px; border-radius: 6px;
  background: #0f1420; border: 1px dashed var(--border);
}
.thumb-row { display: flex; gap: 4px; }
.thumb-row .thumb { width: 30px; height: 30px; }

.mp-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 18px; padding: 0 3px; border-radius: 4px;
  font-size: 9px; font-weight: 700; color: #fff; margin-right: 5px;
  vertical-align: middle; letter-spacing: 0.2px; flex-shrink: 0;
}
.mp-ozon { background: #005bff; }
.mp-wildberries { background: #cb11ab; }
.mp-yandex { background: #ffcc00; color: #1a1a1a; }
.mp-unknown { background: #555; }

.image-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  z-index: 1000; align-items: center; justify-content: center; cursor: zoom-out;
}
.image-modal.open { display: flex; }
.image-modal img {
  max-width: 90vw; max-height: 90vh; border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.image-modal-close {
  position: absolute; top: 18px; right: 28px; font-size: 32px; color: #fff;
  cursor: pointer; line-height: 1;
}

/* П и У — разбивка по магазинам */
.pnl-sub { font-size: 11px; }
.pnl-shops td { white-space: nowrap; vertical-align: top; }
.pnl-cell-bad { background: rgba(231, 76, 60, 0.18); }
.pnl-month { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.pnl-month > summary { cursor: pointer; padding: 4px 0; }
.pnl-month .data-table td { vertical-align: top; }
.pnl-items { border-collapse: collapse; margin-top: 4px; }
.pnl-items td { padding: 2px 6px; border: none; font-size: 11px; }
.pnl-row-bad { background: rgba(231, 76, 60, 0.08); }
.pnl-detail td { white-space: nowrap; }
.pnl-detail td:first-child { white-space: normal; min-width: 140px; }
.pnl-notes td { color: var(--critical); font-size: 12px; white-space: normal; padding-top: 0; }


/* ===================== Общая система (25.09.2026) ===================== */
:root { --panel-2: #1b2438; --input-bg: #0c111c; }
h2 { font-size: 22px; margin: 4px 0 14px; }
h3 { font-size: 17px; margin: 18px 0 10px; }
a { color: var(--accent); }

/* Поля ввода — везде в тёмной теме (раньше в таблицах были белые) */
input[type="text"], input[type="number"], input[type="month"], input[type="date"], input[type="file"], select, textarea {
  background: var(--input-bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; font-size: 13px; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79,140,255,.25); }
input::placeholder { color: #5d6680; }
.toolbar input[type="text"] { min-width: 280px; }

.btn-ghost { background: transparent !important; border: 1px solid var(--border) !important; color: var(--text) !important; }
.btn-ok { background: #2e7d32 !important; }
a.btn { text-decoration: none; display: inline-block; }
summary.btn { list-style: none; display: inline-block; }
summary.btn::-webkit-details-marker { display: none; }

/* Заголовок страницы с действиями справа */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h2 { margin: 4px 0; }
.head-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.panel-toggle { position: relative; }
.panel-toggle > .panel, .panel-toggle > form.form-inline {
  position: absolute; right: 0; top: 36px; z-index: 40; width: 440px; max-width: 90vw;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); display: flex; flex-direction: column; gap: 10px; font-size: 13px;
}
.page-head > .panel-toggle > form.form-inline { left: 0; right: auto; }
.panel label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.panel p { margin: 0; line-height: 1.45; }

.hint { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 13px; }
.hint summary { cursor: pointer; color: var(--muted); }
.hint p { margin: 8px 0 0; line-height: 1.45; }
.hint-error summary { color: var(--critical); }

/* Таблицы данных */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap > .data-table { border: none; border-radius: 0; }
.sticky-head { max-height: calc(100vh - 190px); overflow: auto; }
.sticky-head thead th { position: sticky; top: 0; z-index: 5; background: var(--panel-2); }
.data-table.compact th, .data-table.compact td { padding: 7px 10px; font-size: 13px; vertical-align: top; }
.data-table.compact th { font-size: 11px; letter-spacing: .02em; vertical-align: bottom; }
.data-table tbody tr:hover { background: rgba(79,140,255,.05); }
.data-table .num, .num-table td, .num-table th { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num-table .left, .data-table .left { text-align: left; }
.data-table tfoot td { border-top: 2px solid var(--border); background: var(--panel-2); }
.nowrap { white-space: nowrap; }
.sub { font-size: 11px; color: var(--muted); font-weight: normal; margin-top: 2px; line-height: 1.3; }
th .sub { text-transform: none; }
.warn-text { color: var(--warning); }
.warn-chip { color: var(--warning); border: 1px solid rgba(241,196,15,.4); border-radius: 999px; padding: 3px 10px; font-size: 12px; text-decoration: none; }
.row-missing td { opacity: .6; }

/* Себестоимость */
.costs-table .col-product { min-width: 300px; max-width: 460px; text-align: left; }
.product-cell { display: flex; gap: 10px; align-items: flex-start; }
.product-text { min-width: 0; }
.product-name { font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-meta { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.product-meta .mp-badge { transform: scale(.9); margin-right: 3px; }
.in-num { width: 84px; text-align: right; padding: 4px 6px !important; }
.in-sm { width: 70px; margin-top: 4px; }
.in-missing { border-color: rgba(231,76,60,.7) !important; }
.row-nocost > td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
.dims summary { cursor: pointer; list-style: none; white-space: nowrap; }
.dims summary::-webkit-details-marker { display: none; }
.dims-edit { display: grid; grid-template-columns: repeat(2, 72px); gap: 6px; margin-top: 6px; }
.dims-edit label { display: flex; flex-direction: column; font-size: 10px; color: var(--muted); gap: 2px; }
.dims-edit input { width: 72px; padding: 3px 5px; }

/* Финотчёты */
.month-block { margin-bottom: 22px; }
.month-block h3 { margin: 14px 0 8px; }
.raw summary { cursor: pointer; font-size: 11px; color: var(--muted); }
.raw pre { max-width: 520px; max-height: 300px; overflow: auto; white-space: pre-wrap; font-size: 11px; background: var(--input-bg); padding: 8px; border-radius: 6px; }

/* ТН ВЭД */
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.stat-chip { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px; color: var(--text); text-decoration: none; display: flex; gap: 6px; align-items: center; }
.stat-chip.active { border-color: var(--accent); }
.pnl-main .pnl-strong td { background: var(--panel-2); }
.pnl-main .pnl-muted td { color: var(--muted); font-style: italic; }
.pnl-main .pnl-profit td { border-top: 2px solid var(--border); }
.shop-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.shop-check { display: inline-flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px 3px 6px; font-size: 12px; cursor: pointer; }
.shop-check input { margin: 0 2px 0 0; }
.fin-table td, .fin-table th { padding: 6px 8px !important; }
.breakdown { border-collapse: collapse; margin-top: 4px; min-width: 320px; }
.breakdown td { padding: 2px 6px; font-size: 11px; border-bottom: 1px solid var(--border); }

/* Реклама */
.ads-cards .card .num { font-size: 22px; }
.ads-grid { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.3fr); gap: 16px; margin: 12px 0 18px; }
@media (max-width: 1100px) { .ads-grid { grid-template-columns: 1fr; } }
.panel-box { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.panel-box h3 { margin: 0 0 10px; font-size: 15px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 18px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 18px; }
.bar { width: 100%; max-width: 38px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-col:hover .bar { background: #7aa7ff; }
.bar-val { font-size: 10px; color: var(--muted); margin-bottom: 3px; }
.bar-label { font-size: 10px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.ads-table .col-product { min-width: 280px; max-width: 380px; }

/* Логистика на дашборде: источник значения */
.logi-cell { white-space: nowrap; }
.logi-tag { font-size: 10px; border-radius: 4px; padding: 1px 5px; font-weight: 600; }
.logi-fact { background: rgba(46, 204, 113, .18); color: var(--ok); }
.logi-prelim { background: rgba(79, 140, 255, .2); color: var(--accent); }
.logi-manual { background: rgba(241, 196, 15, .2); color: var(--warning); }
.logi-alt { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Методология */
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin: 10px 0 18px; font-size: 13px; }
.toc a { color: var(--accent); text-decoration: none; }
section.md { margin-bottom: 22px; line-height: 1.55; font-size: 14px; }
section.md h3 { border-bottom: 1px solid var(--border); padding-bottom: 6px; scroll-margin-top: 70px; }
section.md code { background: var(--input-bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 12px; }
section.md li { margin: 4px 0; }
section.md .data-table td { vertical-align: top; }

/* Оперативная прибыль */
.rnp-table .sticky-col { position: sticky; left: 0; background: var(--panel); z-index: 2; min-width: 210px; }
.rnp-table tr.pnl-strong .sticky-col { background: var(--panel-2); }
.rnp-table th.weekend { color: #b58cff; }
.data-table .col-product { min-width: 260px; max-width: 380px; width: 380px; }
.rnp-table tr.pnl-strong td { background: var(--panel-2); }

/* Тумблеры */
.toggles { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.toggle-form { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #3a4560; border-radius: 22px; transition: .2s; }
.slider:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider:before { transform: translateX(18px); }
.methodology-block { margin-top: 26px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.methodology-block > summary { cursor: pointer; font-size: 15px; }
.methodology-block[open] > summary { margin-bottom: 12px; }
.panel form { margin: 0; }

/* Дашборд: всплывающая подсказка с расчётом */
.has-tip { cursor: help; }
.has-tip:hover { background: rgba(79, 140, 255, .08); }
.tip-box { position: fixed; z-index: 1000; max-width: 560px; background: #0b1020; border: 1px solid var(--accent);
  border-radius: 8px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.6); font-size: 12px; line-height: 1.5; pointer-events: none; text-align: left; }
.tip-title { font-weight: 700; margin-bottom: 6px; color: var(--accent); }
.tip-line { white-space: normal; }
.tip-sub { padding-left: 14px; color: #c9d1e3; }
.dash-table .col-product { max-width: 420px; }

/* =====================================================================
   Современный дизайн v2 (26.09.2026) — единый стиль со верхним меню:
   мягкие поверхности, скругления 12px, тонкие границы, акцентный
   градиент, аккуратные таблицы, поля и кнопки. Слой поверх старых
   правил — разметку страниц менять не нужно.
   ===================================================================== */
:root {
  --bg: #0b1020;
  --panel: #121a2c;
  --panel-2: #172036;
  --panel-3: #1d2740;
  --border: rgba(148, 163, 199, 0.13);
  --border-strong: rgba(148, 163, 199, 0.22);
  --text: #e8ecf5;
  --muted: #8d97ad;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --ok: #34d399;
  --warning: #fbbf24;
  --critical: #f87171;
  --high: #c084fc;
  --input-bg: #0d1424;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -18px rgba(0, 0, 0, 0.8);
  --grad: linear-gradient(135deg, #4f8cff 0%, #6a6dff 55%, #8b5cf6 100%);
}
html { background: var(--bg); }
body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(79, 140, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(139, 92, 246, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  font-feature-settings: "cv11", "ss01", "tnum" 0;
}
::selection { background: rgba(79, 140, 255, 0.35); }
* { scrollbar-width: thin; scrollbar-color: #2b3652 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2b3652; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a4868; background-clip: padding-box; border: 2px solid transparent; }

.container { padding: 26px 28px 40px; max-width: 1360px; }
a { color: #7fb0ff; text-decoration: none; }
a:hover { color: #a9c9ff; }

/* Заголовки */
h2, .page-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0 16px; }
.page-head { align-items: center; margin-bottom: 14px; }
.page-head h2 { margin: 0; }
h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.muted { color: var(--muted); }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--grad); color: #fff; border: 0; font: inherit; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(79, 140, 255, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer; transition: transform .12s, box-shadow .15s, filter .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { opacity: 1; filter: brightness(1.08); transform: translateY(-1px); color: #fff; }
.btn:active { transform: none; filter: brightness(.95); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.4); }
.btn.small { height: 30px; padding: 0 12px; font-size: 12.5px; margin-right: 0; border-radius: 8px; }
.btn.danger { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 6px 16px -8px rgba(239, 68, 68, .8); }
.btn-ok { background: linear-gradient(135deg, #22c55e, #16a34a) !important; box-shadow: 0 6px 16px -8px rgba(34, 197, 94, .7) !important; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.03) !important; border: 1px solid var(--border-strong) !important;
  color: var(--text) !important; box-shadow: none !important;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07) !important; filter: none; }
button:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
summary.btn { display: inline-flex; }
.toolbar > .btn, .head-actions .btn, .inline-form .btn { margin: 0; }

/* Поля ввода */
input[type="text"], input[type="number"], input[type="month"], input[type="date"], input[type="password"],
input[type="email"], input[type="url"], select, textarea,
.form-card input, .form-card select, .filter-label select, .toolbar input[type="text"], .inline-form input {
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  height: 34px; padding: 0 11px; font: inherit; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { height: auto; padding: 8px 11px; }
input[type="file"] { height: auto; padding: 7px 10px; }
input[type="file"]::file-selector-button {
  background: var(--panel-3); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 4px 10px; margin-right: 10px; cursor: pointer; font: inherit; font-size: 12.5px;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d97ad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input:hover, select:hover, textarea:hover { border-color: rgba(148, 163, 199, 0.35); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); background-color: #0f1830;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.22);
}
input::placeholder, textarea::placeholder { color: #5f6a84; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; }
.in-num, .in-sm { height: 30px; }
.inline-form input { height: 30px; }
.toolbar { gap: 10px; margin-bottom: 14px; }
.toolbar input[type="text"] { min-width: 300px; padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238d97ad' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px center; }
.filter-label { color: var(--muted); font-size: 13px; }

/* Панели и карточки */
.card, .form-card, .panel-box, .help-block, .import-result, .hint, .pnl-month, .methodology-block, .toc, .stat-chip {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)) , var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.form-card { padding: 20px; gap: 14px; }
.form-card label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.panel-box { padding: 16px 18px; }

/* KPI-карточки */
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card { position: relative; overflow: hidden; text-align: left; padding: 16px 18px 15px; min-width: 0; }
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); opacity: .9; }
.card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 140, 255, 0.16), transparent 70%); }
.card.ok::before { background: var(--ok); } .card.ok::after { background: radial-gradient(circle, rgba(52, 211, 153, .16), transparent 70%); }
.card.warning::before { background: var(--warning); } .card.warning::after { background: radial-gradient(circle, rgba(251, 191, 36, .16), transparent 70%); }
.card.critical::before { background: var(--critical); } .card.critical::after { background: radial-gradient(circle, rgba(248, 113, 113, .18), transparent 70%); }
.card.unknown::before { background: #64748b; } .card.unknown::after { background: radial-gradient(circle, rgba(100, 116, 139, .16), transparent 70%); }
.card .num { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.card .label { font-size: 12.5px; color: var(--muted); margin-top: 6px; font-weight: 500; }
.card.unknown .num { color: #cbd5e1; }

/* Таблицы */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.data-table { background: transparent; border: 1px solid var(--border); border-radius: var(--radius); }
.table-wrap > .data-table { border: 0; }
.data-table th, .data-table td { border-bottom: 1px solid rgba(148, 163, 199, 0.08); }
.data-table thead th {
  background: var(--panel-2); color: #9aa5bd; font-size: 11px; font-weight: 650;
  letter-spacing: .05em; text-transform: uppercase; border-bottom: 1px solid var(--border-strong);
}
.sticky-head thead th { background: #161f35; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: rgba(79, 140, 255, 0.06); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tfoot td { background: var(--panel-2); border-top: 1px solid var(--border-strong); font-weight: 600; }
.row-warning { background: rgba(251, 191, 36, 0.06); }
.row-critical { background: rgba(248, 113, 113, 0.08); }
.row-high { background: rgba(192, 132, 252, 0.08); }
.row-warning > td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.row-critical > td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
.row-high > td:first-child { box-shadow: inset 3px 0 0 var(--high); }
.pnl-row-bad { background: rgba(248, 113, 113, 0.07); }
.pnl-row-bad > td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
.row-untracked td { opacity: .55; }
.row-untracked td:last-child { opacity: 1; }
.data-table .center, th.center { text-align: center !important; }
.thumb, .thumb-placeholder { border-radius: 8px; border-color: var(--border-strong); }
.product-name { font-weight: 550; }

/* Метки, чипы, значки */
.mp-badge { border-radius: 5px; height: 18px; font-size: 9px; letter-spacing: .3px; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15); }
.mp-ozon { background: linear-gradient(135deg, #1a6dff, #005bff); }
.mp-wildberries { background: linear-gradient(135deg, #d61bb5, #a10c8a); }
.shop-check {
  height: 30px; padding: 0 12px 0 8px; gap: 6px; border-radius: 999px; font-size: 12.5px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-strong); transition: background .15s, border-color .15s;
}
.shop-check:hover { background: rgba(255, 255, 255, 0.06); }
.shop-check:has(input:checked) { background: var(--accent-soft); border-color: rgba(79, 140, 255, 0.45); color: #fff; }
.stat-chip { border-radius: 999px; padding: 5px 12px; font-size: 12.5px; box-shadow: none; }
.stat-chip:hover { border-color: var(--border-strong); color: var(--text); }
.stat-chip.active { border-color: var(--accent); background: var(--accent-soft); }
.warn-chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.35); color: var(--warning); font-weight: 550; }
.logi-tag { border-radius: 5px; padding: 1px 6px; letter-spacing: .02em; }
.cell-ok { color: var(--ok); } .cell-warning { color: var(--warning); } .cell-critical { color: var(--critical); } .cell-high { color: var(--high); }

/* Раскрывающиеся блоки */
.hint { padding: 10px 14px; margin: 10px 0 14px; box-shadow: none; }
.hint summary, .methodology-block > summary, .pnl-month > summary, .raw summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; color: #b7c1d6; font-weight: 550;
}
.hint summary::-webkit-details-marker, .methodology-block > summary::-webkit-details-marker, .pnl-month > summary::-webkit-details-marker { display: none; }
.hint summary::before, .methodology-block > summary::before, .pnl-month > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s; flex: none; margin: 0 3px;
}
.hint[open] > summary::before, .methodology-block[open] > summary::before, .pnl-month[open] > summary::before { transform: rotate(45deg); }
.hint p, .hint li { color: #c3cbdc; }
.methodology-block { padding: 14px 18px; }

/* Выпадающие панели (импорт и т.п.) */
.panel-toggle > .panel, .panel-toggle > form.form-inline {
  background: rgba(23, 32, 54, 0.98); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.75); padding: 16px; top: 40px;
}

/* Пагинация */
.pagination { gap: 10px; margin: 14px 0; }
.pagination .muted { background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; font-size: 12.5px; }

/* Тумблеры */
.switch { width: 38px; height: 22px; }
.slider { background: #334060; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
.slider:before { width: 16px; height: 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.switch input:checked + .slider { background: linear-gradient(135deg, #22c55e, #16a34a); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(79, 140, 255, .35); }
.switch input:checked + .slider:before { transform: translateX(16px); }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }

/* Методология */
.toc { padding: 12px 16px; gap: 6px; box-shadow: none; }
.toc a { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); font-size: 12.5px; color: #b7c8e8; }
.toc a:hover { border-color: rgba(79, 140, 255, 0.5); color: #fff; }
section.md h3 { border-bottom-color: var(--border); }
section.md code, .raw pre { background: var(--input-bg); border-color: var(--border); }

/* Графики рекламы */
.bar { background: linear-gradient(180deg, #6ea2ff, #4f6dff); border-radius: 6px 6px 2px 2px; }
.bar-col:hover .bar { background: linear-gradient(180deg, #9cc0ff, #6a82ff); }

/* Подсказки на дашборде */
.tip-box { background: rgba(10, 15, 30, 0.96); border: 1px solid rgba(79, 140, 255, 0.45); border-radius: 12px;
  box-shadow: 0 24px 50px -12px rgba(0, 0, 0, 0.8); padding: 12px 14px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

/* Окно фото */
.image-modal { background: rgba(5, 8, 16, 0.82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.image-modal img { border-radius: 14px; }

@media (max-width: 700px) {
  .container { padding: 18px 14px 32px; }
  .toolbar input[type="text"] { min-width: 0; width: 100%; }
  h2, .page-head h2 { font-size: 20px; }
}
a.btn, summary.btn, label.btn { display: inline-flex; vertical-align: middle; }
select, .filter-label select, .form-card select, .toolbar select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d97ad' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}
/* Кнопки внутри таблиц — спокойные, чтобы не спорили с данными */
.data-table .btn:not(.btn-ok) {
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-strong); color: #d6deee; box-shadow: none;
}
.data-table .btn:not(.btn-ok):hover { background: var(--accent-soft); border-color: rgba(79, 140, 255, 0.5); color: #fff; transform: none; }
.data-table .btn.danger { color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.06); }
.data-table .btn.danger:hover { background: rgba(248, 113, 113, 0.16); border-color: rgba(248, 113, 113, 0.6); color: #fff; }
.data-table .btn-ok { box-shadow: none !important; }
.data-table td form { display: inline-flex; margin: 2px 0; }
.data-table td .btn { margin: 2px 4px 2px 0; }
.th-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.th-sort:hover { color: var(--text); }
.archive-tag { display: inline-block; margin-top: 4px; font-size: 11px; color: #cbd5e1; background: rgba(148, 163, 199, 0.12);
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 1px 7px; }
.onec-meta { font-size: 11px; color: #9fb3d6; margin-top: 2px; }
.onec-meta b { color: #cfe0ff; font-weight: 600; }
.kit-tag { display: inline-block; font-size: 10px; font-weight: 600; padding: 0 6px; border-radius: 5px; margin-left: 4px;
  background: rgba(192, 132, 252, .16); color: #d8b4fe; border: 1px solid rgba(192, 132, 252, .35); cursor: help; }
/* Вход и пользователи */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 28px; margin: 0; }
.login-card .brand { margin-bottom: 8px; }
.error-text { color: var(--critical); font-size: 13px; }
.nav-logout { margin: 0; }
.users-section { margin-bottom: 26px; }
.flash { border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: rgba(52, 211, 153, .08); border-color: rgba(52, 211, 153, .35); }
.flash.error { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .4); }
.pill-role { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: rgba(148, 163, 199, .12); color: #cbd5e1; }
.pill-role.admin { background: rgba(79, 140, 255, .16); color: #9fc2ff; }
