/* ==========================================================================
   Аналитика OZON — дизайн-система по ТЗ:
   светлая тема  — SalesView Analytics UI Spec
   тёмная тема   — SalesHub Dashboard UI Spec
   ========================================================================== */

:root{
  color-scheme: light;

  /* Фоны и поверхности */
  --app-bg:#F3F5F8;
  --surface:#FFFFFF;
  --surface-subtle:#F8FAFC;
  --surface-hover:#F1F5F9;
  --surface-selected:#EAF2FC;
  --nav-bg:#10111F;
  --nav-hover:#1B1D2D;
  --nav-active:#17192A;

  /* Границы */
  --border:#E0E4E9;
  --border-strong:#C9D0D8;
  --divider:#E8EBEF;
  --focus:#368DD2;

  /* Текст */
  --text-primary:#171923;
  --text-secondary:#454B57;
  --text-muted:#7C838D;
  --text-disabled:#A6ACB4;
  --text-on-dark:#F6F7FA;
  --text-on-dark-muted:#A7AAB5;

  /* Акценты */
  --blue:#388FD1;
  --blue-strong:#247CC1;
  --blue-pale:#E8F3FC;
  --green:#42AD7A;
  --green-strong:#258D61;
  --green-pale:#E3F6EC;
  --teal:#24A2AD;
  --teal-pale:#E0F4F5;
  --orange:#F29432;
  --orange-pale:#FFF0DD;
  --purple:#8B56C7;
  --purple-pale:#F0E7FA;
  --pink:#D85B91;
  --pink-pale:#FBE9F1;
  --red:#DF4D4D;
  --red-pale:#FCE8E8;

  /* Служебные */
  --tint-blue:var(--blue-pale);
  --tint-green:var(--green-pale);
  --tint-teal:var(--teal-pale);
  --tint-purple:var(--purple-pale);
  --chart-line:var(--blue);
  --grid:#E1E4E8;
  --shadow-card:0 2px 7px rgba(20,28,40,.07),0 1px 2px rgba(20,28,40,.04);
  --shadow-popover:0 10px 28px rgba(17,24,39,.16);
  --radius-card:13px;
  --radius-ctl:8px;
  --ease:cubic-bezier(.2,.75,.25,1);
}

[data-theme="dark"]{
  color-scheme: dark;

  --app-bg:#101827;
  --surface:#1B2638;
  --surface-subtle:#222F43;
  --surface-hover:#29374C;
  --surface-selected:#173F70;
  --nav-bg:#182438;
  --nav-hover:#29374C;
  --nav-active:#222F43;

  --border:#344258;
  --border-strong:#45556D;
  --divider:rgba(190,205,225,.12);
  --focus:#73BFFF;

  --text-primary:#F4F7FB;
  --text-secondary:#B4C0D0;
  --text-muted:#8795A9;
  --text-disabled:#647286;
  --text-on-dark:#F6F7FA;
  --text-on-dark-muted:#A7AAB5;

  --blue:#238AF4;
  --blue-strong:#35A9FF;
  --blue-pale:#173F70;
  --green:#16C98A;
  --green-strong:#32E0A5;
  --green-pale:#124B43;
  --teal:#16B9BE;
  --teal-pale:#124B55;
  --orange:#F3B74F;
  --orange-pale:rgba(243,183,79,.16);
  --purple:#9B55E8;
  --purple-pale:#442766;
  --red:#F05262;
  --red-pale:#552A3B;

  --tint-blue:rgba(35,138,244,.16);
  --tint-green:rgba(22,201,138,.14);
  --tint-teal:rgba(22,185,190,.14);
  --tint-purple:rgba(155,85,232,.15);
  --chart-line:var(--blue);
  --grid:rgba(190,205,225,.12);
  --shadow-card:0 10px 28px rgba(0,0,0,.20);
  --shadow-popover:0 16px 36px rgba(0,0,0,.45);
  --radius-card:15px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;background:var(--app-bg);color:var(--text-primary);
  font:14px/1.45 "Inter","Manrope",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  transition:background-color .22s var(--ease),color .22s var(--ease);
}
:focus-visible{outline:2px solid var(--focus);outline-offset:2px}

.app{display:flex;min-height:100vh}

/* ======================= навигация (тёмная в обеих темах) ======================= */
.side{
  width:92px;flex:0 0 92px;background:var(--nav-bg);
  border-right:1px solid var(--divider);
  display:flex;flex-direction:column;align-items:center;padding:14px 0;gap:6px;
  position:sticky;top:0;height:100vh;transition:background-color .22s var(--ease);
}
.logo{
  width:38px;height:38px;border-radius:11px;margin-bottom:12px;overflow:hidden;
  display:block;background:#0A0E09;transition:box-shadow .22s var(--ease);
}
.logo img{width:100%;height:100%;display:block}
[data-theme="dark"] .logo{box-shadow:0 0 12px rgba(169,245,44,.22)}
.nav-item{
  width:46px;height:46px;border:1px solid transparent;background:transparent;border-radius:10px;
  cursor:pointer;color:var(--text-on-dark-muted);
  display:flex;align-items:center;justify-content:center;
  transition:background-color 160ms var(--ease),color 160ms var(--ease),border-color 160ms var(--ease);
}
.nav-item:hover{background:var(--nav-hover);color:var(--text-on-dark)}
.nav-item.active{
  background:var(--nav-active);color:#fff;border-color:rgba(242,215,204,.55);
}
[data-theme="dark"] .nav-item.active{
  background:var(--blue);border-color:transparent;color:#fff;
  box-shadow:0 0 0 4px rgba(35,138,244,.18);
}
.side-bottom{margin-top:auto;color:var(--text-on-dark-muted);font-size:18px}

/* ======================= каркас ======================= */
.main{flex:1;min-width:0;padding:18px 22px 28px;display:flex;flex-direction:column;gap:14px}
.topbar{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap}
.titles h1{margin:0;font-size:25px;font-weight:750;letter-spacing:-.4px;color:var(--text-primary)}
.titles .sub{color:var(--text-secondary);font-size:12.5px;margin-top:3px}
.tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-left:auto}
.filterbar{display:flex;align-items:center;gap:8px}
.select{
  appearance:none;-webkit-appearance:none;
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-ctl);
  padding:9px 34px 9px 12px;font-size:13px;color:var(--text-primary);cursor:pointer;
  background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237C838D' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 10px center;
  transition:border-color 160ms var(--ease),background-color 160ms var(--ease),box-shadow 160ms var(--ease);
}
.select:hover{border-color:var(--border-strong);background-color:var(--surface-hover)}
.select:focus-visible{outline:2px solid var(--focus);outline-offset:2px;box-shadow:0 0 0 3px rgba(56,143,209,.16)}
[data-theme="dark"] .select{background-color:var(--surface-subtle);border-color:var(--border)}
[data-theme="dark"] .select:hover{background-color:var(--surface-hover)}

.tools input[type=date]{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-ctl);
  padding:8px 10px;font-size:12px;color:var(--text-primary);transition:all 160ms var(--ease);
}
.tools input[type=date]:hover{border-color:var(--border-strong);background:var(--surface-hover)}
.tools input[type=date]:focus-visible{outline:2px solid var(--focus);outline-offset:2px;box-shadow:0 0 0 3px rgba(56,143,209,.16)}

.btn{
  border:1px solid var(--border);background:var(--surface);color:var(--text-primary);
  border-radius:var(--radius-ctl);padding:9px 14px;font-size:13px;font-weight:500;cursor:pointer;
  transition:color 160ms ease,background-color 160ms ease,border-color 160ms ease,box-shadow 180ms ease,transform 180ms var(--ease);
}
.btn:hover{background:var(--surface-hover);border-color:var(--border-strong);box-shadow:0 2px 8px rgba(20,28,40,.08)}
.btn:active{transform:scale(.985)}
.btn.primary{background:var(--blue-strong);border-color:var(--blue-strong);color:#fff;font-weight:600}
.btn.primary:hover{background:var(--blue);border-color:var(--blue);box-shadow:0 4px 14px rgba(56,143,209,.28)}
.ghost{border-color:transparent;background:transparent;box-shadow:none}
.ghost:hover{background:var(--surface-hover);box-shadow:none}
.label-file{display:inline-flex;align-items:center}

[data-theme="dark"] .btn{background:var(--surface-subtle);border-color:var(--border)}
[data-theme="dark"] .btn:hover{background:var(--surface-hover);border-color:var(--border-strong);box-shadow:0 4px 14px rgba(0,0,0,.3)}
[data-theme="dark"] .btn.primary{background:var(--blue);border-color:var(--blue);box-shadow:0 6px 18px rgba(35,138,244,.28)}
[data-theme="dark"] .btn.primary:hover{background:var(--blue-strong)}
[data-theme="dark"] .ghost{background:transparent}

/* ======================= KPI ======================= */
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.kpi{
  position:relative;display:flex;flex-direction:column;gap:8px;padding:15px 16px;
  background:var(--surface);border:1px solid rgba(30,41,59,.07);border-radius:var(--radius-card);
  box-shadow:var(--shadow-card);overflow:hidden;
  transition:box-shadow 200ms var(--ease),border-color 200ms var(--ease),transform 200ms var(--ease);
  animation:fadeIn 300ms var(--ease) both;
}
.kpi:hover{box-shadow:0 4px 14px rgba(20,28,40,.10);border-color:var(--border)}
.kpi[data-tone="blue"]{--accent:var(--blue);--tint:var(--tint-blue)}
.kpi[data-tone="green"]{--accent:var(--green);--tint:var(--tint-green)}
.kpi[data-tone="teal"]{--accent:var(--teal);--tint:var(--tint-teal)}
.kpi[data-tone="purple"]{--accent:var(--purple);--tint:var(--tint-purple)}

.kpi .khead{display:flex;align-items:center;gap:9px}
.kpi .kico{
  width:30px;height:30px;border-radius:9px;display:flex;align-items:center;justify-content:center;
  color:var(--text-muted);background:var(--surface-hover);
  transition:color 200ms var(--ease),background-color 200ms var(--ease);
}
.kpi .k{font-size:10.5px;text-transform:uppercase;letter-spacing:.07em;color:var(--text-muted);font-weight:600}
.kpi .vrow{display:flex;align-items:baseline;gap:9px;flex-wrap:wrap}
.kpi .v{font-size:24px;font-weight:750;letter-spacing:-.6px;color:var(--text-primary);font-variant-numeric:tabular-nums}
.kpi .d{
  display:inline-flex;align-items:center;gap:.3rem;font-size:11.5px;font-weight:600;
  border-radius:7px;padding:.2rem .45rem;font-variant-numeric:tabular-nums;
  animation:badgeIn 200ms var(--ease) both;
}
.kpi .d.up{color:var(--green-strong);background:var(--green-pale)}
.kpi .d.down{color:#B73838;background:var(--red-pale)}
.kpi .d.neutral{color:var(--text-secondary);background:#EEF1F4}
.kpi .spark{height:38px;margin-top:2px;--spark:var(--blue)}
.kpi .spark svg{width:100%;height:100%;display:block;overflow:visible}

[data-theme="dark"] .kpi{
  background:linear-gradient(140deg,var(--tint),rgba(27,38,56,.96) 78%);
  border-color:color-mix(in srgb,var(--accent) 42%,var(--border));
  box-shadow:var(--shadow-card);
}
[data-theme="dark"] .kpi:hover{transform:translateY(-2px);border-color:color-mix(in srgb,var(--accent) 65%,var(--border))}
[data-theme="dark"] .kpi .kico{color:var(--accent);background:color-mix(in srgb,var(--accent) 20%,transparent)}
[data-theme="dark"] .kpi .v{color:var(--text-primary)}
[data-theme="dark"] .kpi .d.up{color:var(--green-strong);background:rgba(22,201,138,.14)}
[data-theme="dark"] .kpi .d.down{color:#F07A8B;background:rgba(240,82,98,.14)}
[data-theme="dark"] .kpi[data-tone="blue"] .spark{--spark:var(--blue)}
[data-theme="dark"] .kpi[data-tone="green"] .spark{--spark:var(--green)}
[data-theme="dark"] .kpi[data-tone="teal"] .spark{--spark:var(--teal)}
[data-theme="dark"] .kpi[data-tone="purple"] .spark{--spark:var(--purple)}

/* ======================= карточки ======================= */
section.row{display:grid;gap:14px}
section.row.charts{grid-template-columns:1.9fr 1fr}
section.row.tables{grid-template-columns:1fr 1.25fr 1.2fr}
section.row.partner-table{grid-template-columns:1fr}
.partner-table .table-wrap{max-height:calc(100vh - 210px)}
.partner-table .card{padding-bottom:44px}
.fin-foot{margin-bottom:6px}
.tbl.wide{min-width:1560px}
.tbl.wide th,.tbl.wide td{padding:8px 10px;font-size:12px}

/* таблица «Партнёрство» — как в листе */
.tbl.fin{width:max-content;min-width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}
.tbl.fin th{
  font-size:9px;line-height:1.15;padding:4px 4px;white-space:normal;word-break:break-word;
  hyphens:auto;-webkit-hyphens:auto;overflow-wrap:anywhere;
  vertical-align:bottom;border-right:1px solid var(--divider);border-bottom:1px solid var(--border);
  background:var(--surface-subtle);color:var(--text-muted);font-weight:600;letter-spacing:.01em;text-transform:none;
}
.tbl.fin td{
  font-size:11px;padding:4px 4px;border-right:1px solid var(--divider);border-bottom:1px solid var(--divider);
  white-space:nowrap;
}
.tbl.fin th.sticky,.tbl.fin td.sticky{position:sticky;left:0;z-index:2;background:var(--surface);
  box-shadow:1px 0 0 var(--divider)}
.tbl.fin th.sticky{z-index:3;background:var(--surface-subtle);white-space:normal}
.tbl.fin td.sticky{white-space:normal;line-height:1.15}
.tbl.fin tr.grp{cursor:pointer}
.tbl.fin tr.grp td{background:var(--surface-subtle);font-weight:700;font-size:12.5px;
  text-transform:uppercase;letter-spacing:.04em;border-top:2px solid var(--border)}
.tbl.fin tr.grp td.grp-name{white-space:normal;text-transform:none;font-size:13px}
.tbl.fin .chev{display:inline-block;margin-right:6px;transition:transform .15s;opacity:.65}
.tbl.fin tr.grp.collapsed .chev{transform:rotate(-90deg)}
.tbl.fin tr.hidden{display:none}
.tbl.fin tr.tot td{background:color-mix(in srgb,var(--blue) 7%,var(--surface));font-weight:700}
.tbl.fin tr.tot.grand td{background:color-mix(in srgb,var(--blue) 13%,var(--surface))}
.tbl.fin th.totcol{background:color-mix(in srgb,var(--blue) 6%,var(--surface))}
.tbl.fin td.totcol{background:color-mix(in srgb,var(--blue) 6%,transparent)}
.tbl.fin tr.tot td.totcol{background:color-mix(in srgb,var(--blue) 14%,var(--surface))}
.fin-foot{display:flex;flex-wrap:wrap;gap:18px;align-items:center;padding:10px 4px 2px;
  border-top:2px solid var(--border);margin-top:8px;font-size:13px}
.fin-foot b{font-weight:700}
.fin-foot .lbl{color:var(--text-muted);font-size:12px;margin-right:4px}

/* страница «Партнёрство» */
.part-tbl td,.part-tbl th{padding:10px 12px}
.part-tbl tr.tot td{background:color-mix(in srgb,var(--blue) 8%,var(--surface));font-weight:700}
.part-tbl td.neg{color:#C0261B;font-weight:600}
.part-tbl td.pos{color:#14532D;font-weight:600}
.part-warn{margin:12px 0;padding:10px 12px;border-radius:10px;background:#FFF4E5;color:#8A4B00;font-size:13px}
[data-theme="dark"] .part-warn{background:rgba(255,180,0,.12);color:#FFD08A}
.part-details{margin-top:16px;display:grid;gap:8px}
.part-details details{border:1px solid var(--divider);border-radius:10px;padding:8px 12px;background:var(--surface-subtle)}
.part-details summary{cursor:pointer;font-weight:600;font-size:13px}
.part-details details details{margin-top:8px;background:transparent;border-color:transparent;padding-left:0}
.pd-tbl{margin-top:8px;width:100%}
.pd-tbl th,.pd-tbl td{padding:6px 10px;font-size:12px;border-bottom:1px solid var(--divider)}

/* вкладки и образец отчёта «Партнёрство» */
.part-tools{display:flex;align-items:center;gap:10px;margin-left:auto;margin-right:14px}
.part-tabs{display:flex;background:var(--surface-subtle);border-radius:10px;padding:3px;gap:3px}
.part-tab{border:0;background:transparent;padding:6px 12px;border-radius:8px;font-size:12.5px;
  cursor:pointer;color:var(--text-muted)}
.part-tab.active{background:var(--surface);color:var(--text-primary);font-weight:600;
  box-shadow:0 1px 3px rgba(9,12,20,.10)}
.btn-ghost{background:transparent;border:1px solid var(--divider);color:var(--text-primary);
  padding:7px 12px;border-radius:9px;font-size:12.5px;cursor:pointer}
.btn-ghost:hover{background:var(--surface-subtle)}
.part-template{width:100%;table-layout:fixed;border-collapse:separate;border-spacing:0}
.part-template th,.part-template td{border-right:1px solid var(--divider);
  border-bottom:1px solid var(--divider);padding:9px 10px;font-size:13px}
.part-template thead tr.pt-head th{background:var(--surface-subtle);text-align:center;font-size:12px;
  text-transform:none;letter-spacing:0;vertical-align:top}
.part-template thead tr.pt-head th span{display:block;font-weight:400;font-size:11px;
  color:var(--text-muted);margin-top:3px}
.part-template thead tr.pt-sub th{background:var(--surface-subtle);font-size:11px;color:var(--text-muted)}
.part-template td.pt-lbl{color:var(--text-secondary);font-size:12.5px;width:26%}
.part-template tr.pt-profit td{font-weight:700;background:color-mix(in srgb,#2E7D32 7%,transparent)}
.part-template tr.pt-exp td{font-weight:600}
.part-template td.neg{color:#C0261B}
.part-template td.pos{color:#14532D}
.pt-det-title{margin:18px 0 6px;font-size:13px;font-weight:700}
.pt-year{margin-bottom:6px}
.part-dialog{border:0;border-radius:14px;padding:0;max-width:620px;width:calc(100% - 40px);
  box-shadow:0 24px 60px rgba(9,12,20,.28)}
.part-dialog::backdrop{background:rgba(9,12,20,.45)}
.part-dialog h3{margin:0;padding:18px 22px 8px;font-size:17px}
.part-dialog p{margin:0 0 10px;padding:0 22px;font-size:13.5px;line-height:1.5;color:var(--text-secondary)}
.part-dialog ul{margin:0 0 12px 22px;padding:0 22px 0 18px;font-size:13.5px;line-height:1.55;
  color:var(--text-secondary)}
.part-dialog-actions{display:flex;justify-content:flex-end;padding:10px 22px 18px}

/* три блока отчёта «как в образце» */
#partPage .card{overflow:visible}
.pt-blocks{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin-top:8px}
.pt-block{display:flex;flex-direction:column;gap:10px;min-width:0}
.pt-sticky{position:sticky;top:8px;z-index:6;background:var(--surface);
  border:2px solid color-mix(in srgb,var(--blue) 22%,var(--divider));border-radius:14px;
  overflow:hidden;box-shadow:0 6px 18px rgba(9,12,20,.07)}
.pt-block-head{padding:12px 14px;min-height:70px;display:flex;flex-direction:column;justify-content:center;
  background:color-mix(in srgb,var(--blue) 16%,var(--surface));
  border-bottom:2px solid color-mix(in srgb,var(--blue) 32%,var(--surface))}
.pt-block-head b{display:block;font-size:13.5px;font-weight:800;color:var(--text-primary);
  letter-spacing:.01em}
.pt-block-head span{display:block;margin-top:4px;font-size:11.5px;color:var(--text-secondary);font-weight:500}
.pt-block table{width:100%;border-collapse:collapse}
.pt-block thead th{padding:8px 12px;font-size:11px;font-weight:800;text-transform:uppercase;
  letter-spacing:.05em;color:var(--text-secondary);background:var(--surface-subtle);
  text-align:right;border-bottom:2px solid var(--divider)}
.pt-block thead th:first-child{text-align:left}
.pt-block tbody td{padding:9px 12px;font-size:12.5px;text-align:right;border-bottom:1px solid var(--divider)}
.pt-block tbody td:first-child{text-align:left}
.pt-block tr.pt-profit td{font-weight:800;background:color-mix(in srgb,#2E7D32 9%,transparent)}
.pt-block tr.pt-exp td{font-weight:700}
.pt-block tr.pt-sub td{font-style:italic;font-weight:400;color:var(--text-secondary);
  font-size:11.5px;border-bottom:1px dashed var(--divider);padding-top:6px;padding-bottom:6px}
.inv-mark{color:#14532D;font-weight:700}
[data-theme="dark"] .inv-mark{color:#7FE39A}

/* заказы: сетка SKU × месяцы/дни */
.ord-wrap{max-height:calc(100vh - 520px)}
.tbl.ord th,.tbl.ord td{padding:5px 7px;font-size:12px;text-align:right;
  border-right:1px solid var(--divider);white-space:nowrap}
.tbl.ord th{text-transform:none;letter-spacing:0}
.tbl.ord thead tr:nth-child(1) th{top:0}
.tbl.ord thead tr:nth-child(2) th{top:31px}
.tbl.ord th.ord-sku,.tbl.ord td.ord-sku{position:sticky;left:0;z-index:4;background:var(--surface);
  text-align:left;min-width:220px;max-width:280px;white-space:normal}
.tbl.ord th.ord-sku{background:var(--surface-subtle);z-index:5}
.tbl.ord th.ord-m{cursor:pointer;text-align:center;background:var(--surface-subtle);
  font-size:11px;font-weight:700}
.tbl.ord th.ord-m:hover{background:var(--surface-hover)}
.tbl.ord th.ord-m.open{background:color-mix(in srgb,var(--blue) 14%,var(--surface))}
.tbl.ord th.ord-d{text-align:center;font-size:10px;color:var(--text-muted);background:var(--surface-subtle)}
.tbl.ord tr.ord-grp{cursor:pointer}
.tbl.ord tr.ord-grp td{font-weight:700;background:var(--surface-subtle)}
.tbl.ord tr.ord-total td{font-weight:800;background:color-mix(in srgb,var(--blue) 9%,var(--surface))}
.tbl.ord .chev{display:inline-block;margin-right:6px;opacity:.6}
.tbl.ord tbody tr:hover td{background:var(--surface-hover)}
.tbl.ord tbody tr:hover td.ord-sku{background:var(--surface-hover)}
.tbl.ord th.ord-sum,.tbl.ord td.ord-sum{position:sticky;right:0;z-index:4;
  background:var(--surface);font-weight:700;border-left:1px solid var(--divider)}
.tbl.ord th.ord-sum{background:var(--surface-subtle);z-index:5}
.tbl.ord tr.ord-grp td.ord-sum{background:var(--surface-subtle)}
.tbl.ord tr.ord-total td.ord-sum{background:color-mix(in srgb,var(--blue) 9%,var(--surface))}
.tbl.ord tbody tr:hover td.ord-sum{background:var(--surface-hover)}
.tbl.ord td.ord-sku[data-sku]{cursor:help}
.tbl.ord tr.ord-row.focused td{background:color-mix(in srgb,var(--blue) 13%,var(--surface))}
.tbl.ord tr.ord-row.focused td.ord-sku{background:color-mix(in srgb,var(--blue) 13%,var(--surface))}
.tbl.ord tr.ord-row.focused td.ord-sum{background:color-mix(in srgb,var(--blue) 13%,var(--surface))}

/* график заказов */
.ord-chart{padding:4px 16px 14px}
.ord-chart-head{display:flex;align-items:baseline;gap:10px;margin:10px 0 4px}
.ord-chart-head b{font-size:13.5px;color:var(--text-primary)}
.ord-chart-head span{font-size:11.5px;color:var(--text-muted)}
.ord-svg{width:100%;height:300px;display:block}
.ord-ax{font-size:10px;fill:var(--text-muted)}
.ord-legend{display:flex;flex-wrap:wrap;gap:14px;margin-top:6px;font-size:11.5px;color:var(--text-secondary)}
.ord-lg{display:inline-flex;align-items:center;gap:6px}
.ord-lg i{width:10px;height:10px;border-radius:3px;display:inline-block}
.ord-chips{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 8px}
.ord-chip{padding:3px 11px;border:1px solid var(--divider);border-radius:999px;background:var(--surface);
  font-size:11.5px;color:var(--text-secondary);cursor:pointer;line-height:1.5}
.ord-chip:hover{background:var(--surface-hover)}
.ord-chip.active{background:var(--blue);border-color:var(--blue);color:#fff}
.ord-tabs{margin-left:14px}
.ord-ctl{display:flex;flex-wrap:wrap;align-items:center;gap:14px;padding:10px 16px 4px;
  font-size:12px;color:var(--text-secondary)}
.ord-ctl select{max-width:230px;padding:4px 8px;border:1px solid var(--divider);border-radius:8px;background:var(--surface);color:var(--text-primary);font-size:12px}
.ord-ctl input[type=date]{padding:4px 8px;border:1px solid var(--divider);border-radius:8px;background:var(--surface);color:var(--text-primary);font-size:12px}
.ord-ctl input[type=number]{width:74px;padding:4px 8px;border:1px solid var(--divider);
  border-radius:8px;background:var(--surface);color:var(--text-primary);font-size:12px}
.tbl.ord th.ord-fbo,.tbl.ord td.ord-fbo{text-align:right;font-weight:600}
.tbl.ord th.ord-avg,.tbl.ord td.ord-avg{text-align:right;color:var(--text-secondary)}
#antiClusters{padding:0 16px 14px}
#antiClusters .table-wrap{max-height:320px}
.tbl.ord th.clu-th{white-space:normal;min-width:84px;max-width:112px;font-size:10.5px;font-weight:600;
  text-align:left;line-height:1.25;vertical-align:bottom}
.tbl.ord td.clu-td{text-align:right}
.tbl.ord td.clu-hl{background:color-mix(in srgb,var(--blue) 8%,var(--surface))}
.tbl.ord th.clu-hl{background:color-mix(in srgb,var(--blue) 14%,var(--surface))}
.tbl.ord td.clu-cell-hl{background:color-mix(in srgb,var(--blue) 22%,var(--surface))!important;font-weight:800}
.tbl.ord th.ord-share,.tbl.ord td.ord-share{text-align:right;color:var(--text-secondary);font-size:11.5px}
/* остатки по кластерам */
#tblStock{table-layout:fixed;width:max-content;min-width:100%}
#tblStock th.ord-sku{width:190px}
#tblStock thead tr:first-child th.ord-sum{width:176px}
#tblStock .ord-sum{min-width:44px;width:44px;padding:4px 2px;font-size:10.5px}
#tblStock tbody td:nth-last-child(1){position:sticky;right:0;z-index:4;background:var(--surface)}
#tblStock tbody td:nth-last-child(2){position:sticky;right:44px;z-index:4;background:var(--surface)}
#tblStock tbody td:nth-last-child(3){position:sticky;right:88px;z-index:4;background:var(--surface)}
#tblStock tbody td:nth-last-child(4){position:sticky;right:132px;z-index:4;background:var(--surface)}
#tblStock thead tr:nth-child(2) th:nth-last-child(1){position:sticky;right:0;z-index:6;background:var(--surface-subtle)}
#tblStock thead tr:nth-child(2) th:nth-last-child(2){position:sticky;right:44px;z-index:6;background:var(--surface-subtle)}
#tblStock thead tr:nth-child(2) th:nth-last-child(3){position:sticky;right:88px;z-index:6;background:var(--surface-subtle)}
#tblStock thead tr:nth-child(2) th:nth-last-child(4){position:sticky;right:132px;z-index:6;background:var(--surface-subtle)}
.tbl.ord th.st-fact,.tbl.ord td.st-fact{background:color-mix(in srgb,#22C55E 10%,var(--surface))}
#tblStock thead th.st-fact{background:color-mix(in srgb,#22C55E 18%,var(--surface))}
#tblStock tr.ord-total td.st-fact{background:color-mix(in srgb,#22C55E 18%,var(--surface))}
.tbl.ord th.st-sku{white-space:normal;width:120px;font-size:9.5px;
  text-align:center;line-height:1.2;border-left:1px solid var(--divider);vertical-align:bottom;
  hyphens:auto;-webkit-hyphens:auto;overflow-wrap:anywhere;word-break:break-word;padding:5px 3px}
.tbl.ord th.st-sub,.tbl.ord td.st-td{padding:4px 2px;min-width:30px;width:30px;font-size:10.5px}
.tbl.ord th.st-sub{text-align:center;font-size:10px;color:var(--text-secondary);cursor:help;font-weight:600}
.tbl.ord td.st-td{text-align:right}
.tbl.ord .st-hl{background:color-mix(in srgb,var(--blue) 8%,var(--surface))!important}
.tbl.ord td.st-cell-hl{background:color-mix(in srgb,var(--blue) 20%,var(--surface))!important;font-weight:800}
.tbl.ord th.st-sku{cursor:pointer}
.tbl.ord th.st-sku:hover{background:var(--surface-hover)}
.tbl.ord th.st-sku.st-sel{background:color-mix(in srgb,var(--blue) 18%,var(--surface));color:var(--text-primary)}
.sku-ctl{margin-top:4px}
#stockSku{padding:0 16px 16px}
.sku-card{border:1px solid var(--divider);border-radius:14px;background:var(--surface);padding:12px 14px}
.sku-head{display:flex;flex-direction:column;gap:3px;margin-bottom:8px}
.sku-head b{font-size:13.5px;color:var(--text-primary)}
.sku-head span{font-size:11.5px;color:var(--text-secondary)}
.sku-chips{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:8px}
.sku-chips .chip{font-size:11px;padding:2px 9px;border-radius:999px;font-weight:600}
.sku-chips .chip.low{background:rgba(220,38,38,.12);color:#B91C1C}
.sku-chips .chip.edge{background:rgba(245,158,11,.16);color:#B45309}
.sku-chips .chip.over{background:rgba(99,102,241,.14);color:#4F46E5}
.sku-legend{margin-left:auto;display:flex;gap:10px;font-size:11px;color:var(--text-muted)}
.sku-legend i{display:inline-block;width:11px;height:11px;border-radius:3px;margin-right:4px;vertical-align:-1px}
.sku-legend i.a{background:#2F9E52}
.sku-legend i.t{background:#3B82F6}
.sku-legend i.z{background:repeating-linear-gradient(45deg,#F59E0B,#F59E0B 3px,#FDE68A 3px,#FDE68A 6px)}
.sku-row{display:grid;grid-template-columns:210px minmax(140px,1fr) 190px 84px 76px 92px;
  gap:10px;align-items:center;padding:7px 6px;border-bottom:1px solid var(--divider);font-size:12px}
.sku-row:last-child{border-bottom:none}
.sku-row-head{font-size:10.5px;text-transform:uppercase;letter-spacing:.04em;color:var(--text-muted);
  border-bottom:2px solid var(--divider);font-weight:600}
.sku-cl{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-left:3px solid transparent;padding-left:7px}
.sku-bar{display:flex;height:16px;border-radius:6px;overflow:hidden;background:var(--surface-subtle)}
.sku-bar span{display:block;height:100%}
.sku-bar .b-a{background:#2F9E52}
.sku-bar .b-t{background:#3B82F6}
.sku-bar .b-z{background:repeating-linear-gradient(45deg,#F59E0B,#F59E0B 3px,#FDE68A 3px,#FDE68A 6px)}
.sku-nums{color:var(--text-secondary);font-size:11.5px}
.sku-ord{text-align:right}
.sku-left{text-align:right;color:var(--text-secondary)}
.sku-state{text-align:right;font-size:11px;font-weight:700}
.sku-row.st-low .sku-cl{border-left-color:#DC2626}
.sku-row.st-low .sku-state{color:#B91C1C}
.sku-row.st-edge .sku-cl{border-left-color:#F59E0B}
.sku-row.st-edge .sku-state{color:#B45309}
.sku-row.st-ok .sku-cl{border-left-color:#16A34A}
.sku-row.st-ok .sku-state{color:#15803D}
.sku-row.st-over .sku-cl{border-left-color:#6366F1}
.sku-row.st-over .sku-state{color:#4F46E5}
.sku-row.st-none .sku-cl{border-left-color:var(--divider)}
.sku-row.st-none .sku-state{color:var(--text-muted)}
@media (max-width:1200px){.sku-row{grid-template-columns:150px 1fr 150px 70px 64px 80px}}
#tblClu th.ord-sum,#tblClu td.ord-sum{right:82px}
#tblClu th.ord-share,#tblClu td.ord-share{position:sticky;right:0;z-index:4;
  min-width:82px;background:var(--surface);border-left:1px solid var(--divider)}
#tblClu th.ord-share{background:var(--surface-subtle);z-index:5}
#tblClu tr.ord-total td.ord-share{background:color-mix(in srgb,var(--blue) 9%,var(--surface))}
.instr-page .instr-card{max-width:920px}
.instr{padding:2px 18px 18px;font-size:13.5px;line-height:1.6;color:var(--text-secondary)}
.instr h3{margin:18px 0 6px;font-size:14px;color:var(--text-primary)}
.instr h3:first-child{margin-top:4px}
.instr ul,.instr ol{margin:0 0 8px 22px;padding:0}
.instr li{margin-bottom:5px}
.instr b{color:var(--text-primary);font-weight:600}

/* прогресс загрузки — кошелёк */
.loader{position:fixed;inset:0;z-index:120;display:flex;align-items:center;justify-content:center;
  background:rgba(10,14,22,.55)}
.loader.hidden{display:none}
.loader-box{background:var(--surface);border-radius:18px;padding:26px 34px 20px;text-align:center;
  box-shadow:0 24px 60px rgba(9,12,20,.35);min-width:300px}
.wallet-svg{width:220px;height:190px;display:block;margin:0 auto 4px}
.loader-caption{font-size:15px;font-weight:650;color:var(--text-primary)}
.loader-pct{margin-top:6px;font-size:12.5px;color:var(--text-muted)}
.pt-block td.neg{color:#C0261B}
.pt-block td.pos{color:#14532D}
.pt-expand{border:1px solid var(--divider);border-radius:12px;overflow:hidden;background:var(--surface)}
.pt-expand>summary{padding:10px 12px;font-size:12px;font-weight:700;cursor:pointer;
  color:var(--text-secondary);background:var(--surface-subtle)}
.pt-year{margin:8px 10px;border:1px solid var(--divider);border-radius:9px;overflow:hidden}
.pt-year>summary{padding:7px 10px;font-size:12px;font-weight:700;cursor:pointer;
  background:var(--surface-subtle)}
.pt-year tbody td{padding:6px 10px;font-size:11.5px;border-bottom:1px solid var(--divider);text-align:right}
.pt-year tbody td:first-child{text-align:left}
[data-theme="dark"] .pt-block{box-shadow:none}
[data-theme="dark"] .pt-block tr.pt-profit td{background:rgba(46,125,50,.18)}
@media (max-width:1200px){.pt-blocks{grid-template-columns:1fr}}

/* группа «Затраты ОЗОН» и «Оборот магазина» */
.tbl.fin th.th-group-oz{background:#F6D5D5;color:#7A1616;text-align:center;text-transform:uppercase;
  letter-spacing:.06em;font-weight:700;font-size:10px;border-right:1px solid #E7B4B4}
.tbl.fin th.th-oz{background:#FBEAEA;color:#8A2A22;border-right:1px solid #EFD2D2}
.tbl.fin td.exp{color:#C0261B}
.tbl.fin th.th-ob{background:#DDF1DF;color:#14532D;border-right:1px solid #BFE0C3}
.tbl.fin td.ob{color:#14532D;font-weight:700;background:color-mix(in srgb,#2E7D32 6%,transparent)}
.tbl.fin th.th-inc{background:#E6EEF8;color:#1E3A5F}
.tbl.fin th.th-ozsum{background:#F6D5D5;color:#B3261E;font-weight:700;border-right:1px solid #E7B4B4}
.tbl.fin td.ozsum{color:#C0261B;font-weight:700;background:color-mix(in srgb,#C0261B 7%,transparent)}
.tbl.fin th.th-cost{background:#FBE4E8;color:#8A2A3A;border-right:1px solid #F0CDD4}
.tbl.fin td.cost{background:color-mix(in srgb,#D6336C 6%,transparent)}
.tbl.fin th.th-pb{background:#E2F3E4;color:#14532D;border-right:1px solid #C6E4C9}
.tbl.fin td.pb{background:color-mix(in srgb,#2E7D32 6%,transparent)}
.tbl.fin th.th-profit{background:#B7F7C6;color:#0B3D1E;font-weight:700;border-right:1px solid #8FE0A6}
.tbl.fin td.profit{background:#BFF8CC;color:#0B3D1E;font-weight:700;font-size:12.5px}
.tbl.fin td.profit.neg{color:#8A1F1F}
.tbl.fin th.th-net{background:#DDF1DF;color:#14532D;font-weight:700;border-right:1px solid #BFE0C3}
.tbl.fin td.net{color:#14532D;font-weight:700;background:color-mix(in srgb,#2E7D32 8%,transparent)}
/* столбец SKU — непрозрачный фон */
.tbl.fin td.sticky,.tbl.fin th.sticky{background:var(--surface)}
.tbl.fin tr.grp td.sticky{background:var(--surface-subtle)}
.tbl.fin tr.tot td.sticky{background:color-mix(in srgb,var(--blue) 7%,var(--surface))}
[data-theme="dark"] .tbl.fin th.th-group-oz{background:rgba(192,38,27,.28);color:#FFB4AB;border-right-color:rgba(192,38,27,.45)}
[data-theme="dark"] .tbl.fin th.th-oz{background:rgba(192,38,27,.16);color:#FFB4AB;border-right-color:rgba(192,38,27,.3)}
[data-theme="dark"] .tbl.fin td.exp{color:#FF8A80}
[data-theme="dark"] .tbl.fin th.th-ob{background:rgba(46,125,50,.24);color:#A5D6A7;border-right-color:rgba(46,125,50,.4)}
[data-theme="dark"] .tbl.fin td.ob{color:#A5D6A7;background:rgba(46,125,50,.12)}
[data-theme="dark"] .tbl.fin th.th-inc{background:rgba(35,138,244,.16);color:#9CC7F5}
[data-theme="dark"] .tbl.fin th.th-ozsum{background:rgba(192,38,27,.24);color:#FFB4AB;border-right-color:rgba(192,38,27,.4)}
[data-theme="dark"] .tbl.fin td.ozsum{color:#FF8A80;background:rgba(192,38,27,.14)}
[data-theme="dark"] .tbl.fin th.th-cost{background:rgba(214,51,108,.24);color:#FFB3C8;border-right-color:rgba(214,51,108,.4)}
[data-theme="dark"] .tbl.fin td.cost{background:rgba(214,51,108,.12)}
[data-theme="dark"] .tbl.fin th.th-pb{background:rgba(46,125,50,.24);color:#A5D6A7;border-right-color:rgba(46,125,50,.4)}
[data-theme="dark"] .tbl.fin td.pb{background:rgba(46,125,50,.12)}
[data-theme="dark"] .tbl.fin th.th-profit{background:rgba(46,180,80,.3);color:#D7FFE2;border-right-color:rgba(46,180,80,.45)}
[data-theme="dark"] .tbl.fin td.profit{background:rgba(46,180,80,.2);color:#D7FFE2}
[data-theme="dark"] .tbl.fin td.profit.neg{color:#FFB4AB}
[data-theme="dark"] .tbl.fin th.th-net{background:rgba(46,125,50,.24);color:#A5D6A7;border-right-color:rgba(46,125,50,.4)}
[data-theme="dark"] .tbl.fin td.net{color:#A5D6A7;background:rgba(46,125,50,.14)}

.card{
  background:var(--surface);border:1px solid rgba(30,41,59,.07);border-radius:var(--radius-card);
  box-shadow:var(--shadow-card);display:flex;flex-direction:column;min-height:0;overflow:hidden;
  transition:box-shadow 200ms var(--ease),border-color 200ms var(--ease);
  animation:fadeIn 320ms var(--ease) both;
}
.card:hover{box-shadow:0 4px 14px rgba(20,28,40,.10)}
[data-theme="dark"] .card{
  background:linear-gradient(145deg,rgba(35,48,68,.96),rgba(27,38,56,.98));
  border-color:var(--border);
}
[data-theme="dark"] .card:hover{transform:translateY(-2px);box-shadow:0 14px 34px rgba(0,0,0,.35)}

.card-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;padding:15px 16px 10px}
.card-head h2{margin:0;font-size:14px;font-weight:650;letter-spacing:-.1px;color:var(--text-primary)}
.muted{color:var(--text-muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chart-legend{display:flex;align-items:center;gap:14px;font-size:12px;color:var(--text-secondary);margin-left:auto}
.chart-legend span{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.chart-legend i{width:10px;height:10px;border-radius:3px;display:inline-block}
.chart-legend i.line{height:3px;border-radius:2px}

/* ======================= график ======================= */
.chart{position:relative;height:260px;padding:4px 10px 8px}
.chart svg{width:100%;height:100%;display:block;overflow:visible}
.chart .tip{
  position:absolute;pointer-events:none;background:var(--surface);border:1px solid var(--border);
  border-radius:10px;box-shadow:var(--shadow-popover);padding:8px 10px;font-size:12px;
  color:var(--text-primary);opacity:0;transform:translate(-50%,-118%) translateY(4px);
  transition:opacity 140ms var(--ease),transform 140ms var(--ease);white-space:nowrap;z-index:5;
}
.chart .tip.show{opacity:1;transform:translate(-50%,-118%)}
.chart .tip .t-muted{color:var(--text-muted);font-size:11px}
.chart .tip b{font-size:13px;font-variant-numeric:tabular-nums}
.chart .hoverline{opacity:0;transition:opacity 140ms var(--ease)}
.chart .hoverline.show{opacity:1}
[data-theme="dark"] .chart .tip{background:var(--surface-subtle);border-color:var(--border-strong);color:var(--text-primary)}

/* ======================= донат ======================= */
.donut{display:flex;align-items:center;gap:14px;padding:2px 16px 8px}
.donut svg{width:156px;height:156px;flex:0 0 156px}
.donut circle.seg{transition:stroke-width 180ms var(--ease),opacity 180ms var(--ease)}
.donut svg:hover circle.seg:not(:hover){opacity:.55}
.donut circle.seg:hover{stroke-width:24}
.legend{display:flex;flex-direction:column;gap:7px;font-size:12px;min-width:0}
.legend .row-l{display:flex;align-items:center;gap:8px;white-space:nowrap}
.dot{width:9px;height:9px;border-radius:50%;flex:0 0 9px}

.toplist{padding:2px 16px 16px;display:flex;flex-direction:column;gap:9px}
.toplist .item{display:grid;grid-template-columns:1fr auto;gap:4px 10px;font-size:12px;align-items:center;color:var(--text-secondary)}
.toplist .item .num{color:var(--text-primary)}
.toplist .bar{grid-column:1/3;height:7px;border-radius:999px;background:#E5E7EB;overflow:hidden}
[data-theme="dark"] .toplist .bar{background:#344258}
.toplist .bar i{display:block;height:100%;border-radius:999px;background:var(--blue);width:0;transition:width 420ms var(--ease)}
[data-theme="dark"] .toplist .bar i{background:var(--blue)}

/* ======================= таблицы ======================= */
.table-wrap{flex:1;overflow:auto;min-height:0;max-height:348px}
.tbl{width:100%;border-collapse:separate;border-spacing:0;font-size:13px}
.tbl th{
  position:sticky;top:0;z-index:1;background:var(--surface-subtle);text-align:left;
  font-weight:600;color:var(--text-muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;
  padding:10px 14px;border-bottom:1px solid var(--divider);
}
.tbl td{padding:10px 14px;border-bottom:1px solid var(--divider);vertical-align:middle;color:var(--text-primary)}
.tbl tr.row{cursor:pointer;transition:background-color 160ms var(--ease)}
.tbl tr.row:hover td{background:var(--surface-hover)}
.tbl tr.row.sel td{background:var(--surface-selected)}
.tbl tr.row.sel td:first-child{box-shadow:inset 3px 0 0 var(--blue)}
.num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.pos{color:var(--green-strong)}
.neg{color:var(--red)}
[data-theme="dark"] .neg{color:#F07A8B}
.empty{color:var(--text-muted);text-align:center;padding:32px 10px;font-size:13px}

/* экран «Экономика» — плотнее таблицы */
.view-economy .tbl th{padding:8px 10px;font-size:10px}
.view-economy .tbl td{padding:9px 10px;font-size:12.5px}
.view-economy section.row.tables{grid-template-columns:1.05fr 1.25fr 1.05fr}

/* ======================= иконка SKU / превью ======================= */
.ico{
  display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:7px;
  background:var(--surface-hover);margin-right:10px;vertical-align:-9px;cursor:zoom-in;overflow:hidden;
  transition:transform 160ms var(--ease),box-shadow 160ms var(--ease);
}
.ico img{width:100%;height:100%;object-fit:contain;display:block;background:#fff}
.ico:hover{transform:scale(1.1);box-shadow:0 4px 12px rgba(20,28,40,.18)}
.float-tip{
  position:fixed;z-index:70;max-width:300px;background:var(--surface);border:1px solid var(--border);
  border-radius:10px;box-shadow:var(--shadow-popover);padding:8px 10px;font-size:12px;line-height:1.4;
  color:var(--text-primary);opacity:0;transform:translateY(4px);pointer-events:none;
  transition:opacity 140ms var(--ease),transform 140ms var(--ease);
}
.float-tip.show{opacity:1;transform:none}
.badge{display:inline-block;padding:2px 7px;border-radius:6px;font-size:11px;font-weight:600;
  background:var(--blue-pale);color:var(--blue-strong)}
[data-theme="dark"] .badge{background:rgba(35,138,244,.16);color:var(--blue-strong)}
[data-theme="dark"] .float-tip{background:var(--surface-subtle);border-color:var(--border-strong)}
.img-preview{
  position:fixed;z-index:60;width:230px;height:230px;background:var(--surface);
  border:1px solid var(--border);border-radius:var(--radius-card);box-shadow:var(--shadow-popover);
  display:flex;align-items:center;justify-content:center;overflow:hidden;pointer-events:none;
  opacity:0;transform:scale(.97);transition:opacity 140ms var(--ease),transform 140ms var(--ease);
}
.img-preview.show{opacity:1;transform:none}
.img-preview img{width:100%;height:100%;object-fit:contain}
.img-preview .no-img{position:absolute;font-size:12px;color:var(--text-muted)}
.hidden{display:none!important}

/* ======================= карточка SKU ======================= */
.detail{flex:1;overflow:auto;padding:6px 16px 16px;min-height:0}
.dtitle{font-size:15px;font-weight:700;margin:4px 0 3px;letter-spacing:-.2px;color:var(--text-primary)}
.dsub{font-size:12px;color:var(--text-muted);margin-bottom:14px;word-break:break-word}
.kpis2{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-bottom:13px}
.kpi2{
  border:1px solid var(--divider);border-radius:10px;padding:10px 12px;background:var(--surface-subtle);
  transition:border-color 160ms var(--ease),background-color 160ms var(--ease);
}
.kpi2:hover{border-color:var(--border)}
.kpi2 .k{font-size:10px;color:var(--text-muted);text-transform:uppercase;letter-spacing:.06em;font-weight:600}
.kpi2 .v{font-size:17px;font-weight:750;margin-top:3px;font-variant-numeric:tabular-nums;color:var(--text-primary)}
.stock{font-size:12px;color:var(--text-secondary)}

/* ======================= скелетоны ======================= */
.skel{position:relative;overflow:hidden;background:var(--surface-hover);border-radius:9px}
.skel::after{
  content:"";position:absolute;inset:0;transform:translateX(-100%);
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);
  animation:shimmer 1.4s infinite;
}
[data-theme="dark"] .skel{background:#202D40}
[data-theme="dark"] .skel::after{background:linear-gradient(90deg,transparent,rgba(190,205,225,.08),transparent)}
.skel-kpi{height:104px;border-radius:var(--radius-card)}
.skel-chart{height:260px;border-radius:var(--radius-card)}
.skel-row{height:36px;margin:6px 12px}

/* ======================= анимации ======================= */
@keyframes fadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes badgeIn{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}
@keyframes shimmer{to{transform:translateX(100%)}}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    scroll-behavior:auto!important;
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition-duration:.01ms!important;
  }
}

@media (max-width:1100px){
  .kpis{grid-template-columns:repeat(2,1fr)}
  section.row.charts,section.row.tables{grid-template-columns:1fr}
  .side{display:none}
}

/* приветствие с мотивацией */
.welcome{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;
  background:rgba(8,12,20,.55);opacity:0;transition:opacity .18s}
.welcome.hidden{display:none}
.welcome.show{opacity:1}
.welcome-card{position:relative;max-width:560px;width:calc(100% - 40px);padding:34px 36px 28px;
  border-radius:20px;background:var(--surface);box-shadow:0 30px 80px rgba(9,12,20,.45);
  transform:translateY(10px);transition:transform .18s;border-top:4px solid #FED900}
.welcome.show .welcome-card{transform:none}
.welcome-x{position:absolute;top:12px;right:14px;width:32px;height:32px;border-radius:50%;
  border:none;background:var(--surface-hover);color:var(--text-secondary);font-size:20px;
  line-height:1;cursor:pointer;transition:background .15s}
.welcome-x:hover{background:var(--divider);color:var(--text-primary)}
.welcome-brand{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--text-muted);margin-bottom:14px}
.welcome-quote{margin:0;font-size:19px;line-height:1.45;font-weight:650;color:var(--text-primary)}
.welcome-author{margin-top:12px;font-size:13px;color:var(--text-secondary);font-weight:600}
.welcome-ok{margin-top:22px}
/* сводка за последний день и более яркие KPI */
.kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.kpi{padding:12px 14px;border-color:color-mix(in srgb,var(--accent,var(--blue)) 22%,var(--border));
  background:linear-gradient(150deg,color-mix(in srgb,var(--accent,var(--blue)) 16%,var(--surface)),var(--surface) 72%)}
.kpi .spark{--spark:var(--accent,var(--blue))}
.kpi .v{font-size:22px}
#sumRow{display:flex}
.sum-card{width:100%}
.sum-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;padding:4px 16px 18px}
.sum-item{border:1px solid var(--divider);border-radius:12px;padding:12px;background:var(--surface)}
.sum-item .k{font-size:11px;line-height:1.3;color:var(--text-muted);margin-bottom:8px;min-height:29px}
.sum-item .v{font-size:18px;font-weight:750;letter-spacing:-.3px;color:var(--text-primary);font-variant-numeric:tabular-nums}
.sum-item.sum-profit{border-color:color-mix(in srgb,#16A34A 38%,var(--divider));
  background:color-mix(in srgb,#16A34A 8%,var(--surface))}
@media (max-width:1500px){.sum-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:900px){.sum-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
/* блок ЗАКАЗЫ на главной */
.sum-row{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);gap:14px}
@media (max-width:1250px){.sum-row{grid-template-columns:1fr}}
.ord-sum-body{padding:2px 16px 16px;display:flex;flex-direction:column;gap:12px}
.ord-line{display:grid;grid-template-columns:96px 1fr 44px 44px;align-items:center;gap:8px;margin-bottom:6px;font-size:12px}
.ord-line-name{color:var(--text-secondary)}
.ord-line-bar{height:9px;border-radius:6px;background:var(--surface-subtle);overflow:hidden}
.ord-line-bar span{display:block;height:100%;background:var(--blue);border-radius:6px}
.ord-line-val{text-align:right;font-weight:700}
.ord-line-share{text-align:right;color:var(--text-muted);font-size:11px}
.ord-lab{display:block;font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-muted);margin-bottom:4px}
.ord-lead b{font-size:13px;color:var(--text-primary)}
.ord-lead-qty{margin-left:8px;font-weight:700;color:var(--blue-strong)}
.ord-dead{border-top:1px solid var(--divider);padding-top:10px}
.ord-dead-num{font-size:20px;font-weight:750;color:var(--text-primary)}
.ord-dead-sub{font-size:11px;color:var(--text-muted);margin-top:2px}
/* продажи по SKU в блоке ЭКОНОМИКА */
.sum-skus{padding:2px 16px 16px}
.ord-line-sku{grid-template-columns:minmax(140px,260px) 1fr 44px}
.ord-line-sku .ord-line-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ord-line-sku .ord-line-bar span{background:var(--green-strong, #2F9E52)}
/* отгрузки вне кластера */
.mm-where{white-space:normal;line-height:2;max-width:980px}
.mm-chip{display:inline-block;margin:2px 6px 2px 0;padding:1px 8px;border-radius:999px;
  background:var(--surface-subtle);font-size:11px;color:var(--text-secondary)}
.mm-chip b{color:var(--text-primary)}
/* цвета в отчёте вне кластера */
.mm-badge{display:inline-block;padding:1px 8px;border-radius:999px;font-weight:700;font-size:11.5px}
.mm-badge.mm-hi{background:rgba(220,38,38,.14);color:#B91C1C}
.mm-badge.mm-mid{background:rgba(245,158,11,.16);color:#B45309}
.mm-badge.mm-lo{background:rgba(22,163,74,.14);color:#15803D}
.mm-out{color:#B91C1C;font-weight:700}
.mm-chip{border:1px solid var(--divider);color:var(--text-secondary)}
.mm-chip b{color:var(--text-primary)}
.tbl.ord tr.mm-row:hover td{background:var(--surface-hover)}
/* откуда → куда */
.mm-top{padding:0 16px 10px;display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.mm-top-lab{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted)}
.mm-pair{display:inline-block;padding:2px 10px;border-radius:999px;font-size:11px;
  background:var(--surface-subtle);border:1px solid var(--divider);color:var(--text-secondary)}
.mm-pair b{color:var(--text-primary)}
.mm-arr{color:var(--text-muted)}
.mm-from{color:var(--text-muted)}
/* заметные переключатели отчётов и фильтры */
.part-tabs{display:inline-flex;gap:4px;padding:4px;background:var(--surface-subtle);
  border:1px solid var(--divider);border-radius:12px}
.part-tab{border:1px solid transparent;background:transparent;padding:6px 14px;border-radius:9px;
  font-size:12.5px;font-weight:600;color:var(--text-secondary);cursor:pointer;transition:all .15s}
.part-tab:hover{background:var(--surface-hover);color:var(--text-primary)}
.part-tab.active{background:var(--blue,#2563EB);color:#fff;font-weight:700;
  box-shadow:0 3px 10px rgba(37,99,235,.32)}

.ord-ctl label{font-weight:650;color:var(--text-secondary)}
.ord-ctl select,.ord-ctl input[type=date],.ord-ctl input[type=number],
#groupFilter,.topbar input[type=date],.filterbar select{
  border:1.5px solid color-mix(in srgb,var(--blue,#2563EB) 32%,var(--divider));
  background:var(--surface);color:var(--text-primary);font-weight:650;
  box-shadow:0 1px 3px rgba(16,24,40,.07);transition:border-color .15s, box-shadow .15s}
.ord-ctl select:hover,.ord-ctl input[type=date]:hover,.ord-ctl input[type=number]:hover,
#groupFilter:hover,.topbar input[type=date]:hover{
  border-color:color-mix(in srgb,var(--blue,#2563EB) 55%,var(--divider))}
.ord-ctl select:focus,.ord-ctl input[type=date]:focus,.ord-ctl input[type=number]:focus,
#groupFilter:focus,.topbar input[type=date]:focus{
  outline:none;border-color:var(--blue,#2563EB);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--blue,#2563EB) 22%,transparent)}
/* КОПАЕМ */
.tbl.ord th.dig-date,.tbl.ord td.dig-date{width:96px;text-align:left;color:var(--text-secondary);font-size:11.5px}
.tbl.ord tr.dig-order td{background:color-mix(in srgb,var(--blue) 10%,var(--surface));font-weight:700}
.tbl.ord tr.dig-order td.dig-sum{color:var(--text-primary)}
.tbl.ord tr.dig-row td.dig-type{padding-left:22px;color:var(--text-secondary)}
.tbl.ord tr.dig-res td{font-style:italic;color:var(--text-secondary);font-size:11.5px}
.tbl.ord tr.dig-profit td{font-style:normal;font-weight:700;color:var(--text-primary)}
.tbl.ord tr.dig-grand td{font-weight:800}
#tblDig{table-layout:auto;width:max-content;margin:0 auto;white-space:nowrap}
#tblDig th,#tblDig td{padding:4px 9px}
#tblDig th:nth-child(3),#tblDig td:nth-child(3){text-align:left}
/* подытоги в КОПАЕМ */
.tbl.ord tr.dig-price td{background:color-mix(in srgb,#22C55E 14%,var(--surface));font-weight:700}
.tbl.ord tr.dig-res td{background:color-mix(in srgb,var(--blue) 8%,var(--surface))}
.tbl.ord tr.dig-profit td{background:color-mix(in srgb,#16A34A 18%,var(--surface));font-weight:800;font-style:normal}
/* КОПАЕМ: таблица на всю высоту экрана, горизонталь как была */
#digPage{flex:1 1 auto;min-height:0;display:flex}
#digPage .card{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
#digPage .table-wrap{flex:1 1 auto;min-height:0;max-height:none;overflow:auto}
/* КОПАЕМ: закреплённая шапка и итоговый блок другим цветом */
#tblDig thead th{position:sticky;top:0;z-index:8;background:var(--surface-subtle);
  box-shadow:inset 0 -2px 0 var(--divider)}
.tbl.ord tr.dig-grand td,.tbl.ord tr.dig-grand td.ord-sku,.tbl.ord tr.dig-grand td.dig-sum,.tbl.ord tr.dig-grand td.ord-sum{background:#4A5058!important;color:#FFFFFF!important;font-weight:800}
.tbl.ord tr.dig-g td{background:color-mix(in srgb,#FFD84D 30%,var(--surface));color:var(--text-primary)}
.tbl.ord tr.dig-g.dig-profit td{background:color-mix(in srgb,#FFC400 42%,var(--surface));font-weight:800}
/* КОПАЕМ: страница не прокручивается, прокручивается таблица */



#digWrap{overflow:auto;max-height:none;height:calc(100vh - 250px)}


/* КОПАЕМ: полное имя SKU и широкий селект */
#digSku{max-width:560px}
.dig-title{padding:2px 16px 6px;font-size:15px;font-weight:750;color:var(--text-primary);letter-spacing:-.2px}
/* КОПАЕМ: кластер отгрузки → доставки */
.tbl.ord th.dig-clu,.tbl.ord td.dig-clu{text-align:left;font-size:11.5px;color:var(--text-secondary);white-space:nowrap;padding-left:10px}
/* разделы меню */
.nav-group{font-size:9.5px;text-transform:uppercase;letter-spacing:.08em;color:var(--text-muted);
  padding:10px 8px 4px;text-align:center;opacity:.85}

/* Пульс продаж */
.pulse-wrap{padding:4px 16px 18px;display:flex;flex-direction:column;gap:14px}
.pulse-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
@media (max-width:1100px){.pulse-grid{grid-template-columns:1fr}}
.pulse-block{border:1px solid var(--divider);border-radius:14px;padding:12px 14px;background:var(--surface)}
.pulse-block h3{margin:0 0 10px;font-size:12.5px;font-weight:750;color:var(--text-primary)}
.pulse-row{display:grid;grid-template-columns:96px 1fr 52px 40px;align-items:center;gap:8px;margin-bottom:6px;font-size:12px}
.pulse-lab{color:var(--text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pulse-bar{height:12px;border-radius:6px;background:var(--surface-subtle);overflow:hidden}
.pulse-bar span{display:block;height:100%;border-radius:6px;background:linear-gradient(90deg,#2563EB,#5B8DEF)}
.tone-amber .pulse-bar span{background:linear-gradient(90deg,#D97706,#FBBF24)}
.tone-green .pulse-bar span{background:linear-gradient(90deg,#059669,#34D399)}
.tone-violet .pulse-bar span{background:linear-gradient(90deg,#7C3AED,#A78BFA)}
.tone-blue h3{color:#1D4ED8}
.tone-amber h3{color:#B45309}
.tone-green h3{color:#047857}
.tone-violet h3{color:#6D28D9}
.tone-blue{border-left:3px solid #2563EB}
.tone-amber{border-left:3px solid #D97706}
.tone-green{border-left:3px solid #059669}
.tone-violet{border-left:3px solid #7C3AED}
.ph-share{display:block;font-size:9.5px;font-weight:500;opacity:.85;margin-top:1px}
.pulse-val{text-align:right;font-weight:700}
.pulse-share{text-align:right;color:var(--text-muted);font-size:11px}
.pulse-heat-tbl{width:100%;border-collapse:separate;border-spacing:2px;font-size:11.5px}
.pulse-heat-tbl th{font-weight:600;color:var(--text-muted);font-size:10.5px;text-align:center;padding:4px}
.pulse-heat-tbl th:first-child{text-align:left}
.pulse-heat-tbl td{text-align:center;padding:6px 4px;border-radius:6px;font-weight:600}
.pulse-insights ul{margin:0;padding-left:18px;color:var(--text-secondary);font-size:12.5px;line-height:1.65}
.pulse-insights li{margin-bottom:4px}
.pulse-insights b{color:var(--text-primary)}
/* выводы под блоками пульса */
.pulse-note{margin-top:10px;padding-top:8px;border-top:1px dashed var(--divider);
  font-size:11.5px;line-height:1.5;color:var(--text-secondary)}
.pulse-note b{color:var(--text-primary)}
/* карта доставки */
.map-box{padding:6px 16px 16px;overflow:auto}
.map-box svg{width:100%;height:auto;max-height:calc(100vh - 280px);display:block}
/* карта: непрозрачная подсказка */
.fm__tip{background:#FFFFFF!important;color:#0F172A!important;
  border:1px solid #D5DCE5;box-shadow:0 8px 22px rgba(15,23,42,.18)!important;
  border-radius:8px}
.fm__tip b{color:#0F172A!important}
.fm__tip i{color:#475569!important}
/* карта: топ-5 направлений */
.map-top5{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;padding:0 16px 10px}
@media (max-width:1250px){.map-top5{grid-template-columns:repeat(2,minmax(0,1fr))}}
.map-top-card{border:1px solid var(--divider);border-radius:12px;padding:10px 12px;background:var(--surface);
  display:flex;flex-direction:column;gap:4px}
.map-top-num{font-size:10px;font-weight:800;color:#B45309;background:#FEF3C7;border-radius:6px;
  width:18px;height:18px;display:flex;align-items:center;justify-content:center}
.map-top-dir{font-size:11.5px;color:var(--text-secondary);line-height:1.35}
.map-top-dir b{color:var(--text-primary)}
.map-top-arr{color:var(--text-muted);margin:0 4px}
.map-top-val{font-size:12px;font-weight:700;color:var(--blue-strong,#1D4ED8)}
.map-top-src{font-size:10.5px;color:var(--text-muted);line-height:1.3}
/* карта: таблица потерь */
.loss-wrap{padding:6px 16px 18px}
.loss-head{display:flex;align-items:baseline;gap:12px;justify-content:space-between;margin-bottom:8px}
.loss-head h3{margin:0;font-size:13px;font-weight:750}
.loss-tbl{width:100%}
.loss-tbl th,.loss-tbl td{padding:7px 10px;font-size:12px}
.loss-tbl tfoot th{border-top:2px solid var(--divider);font-weight:800}
.loss-tbl td.neg{color:#B91C1C;font-weight:700}
/* карта: шапка таблицы потерь закреплена при прокрутке */
#mapPage .card{overflow:visible}
.loss-tbl thead th{position:sticky;top:0;z-index:9;background:var(--surface-subtle);
  box-shadow:inset 0 -2px 0 var(--divider)}
/* остатки: заметный выбор дней и заголовок плана поставок */
.sku-title{font-size:12.5px;font-weight:800;letter-spacing:.1em;color:#B45309;
  text-transform:uppercase;margin-bottom:4px}
label:has(#skuDays){font-weight:750;color:var(--text-primary)}
#skuDays{width:72px;font-size:15px;font-weight:800;padding:7px 8px;text-align:center;
  border:2px solid #FED900;border-radius:10px;background:#FFFDF0;color:#111418;
  box-shadow:0 2px 8px rgba(254,216,0,.35);transition:box-shadow .15s,border-color .15s}
#skuDays:focus{outline:none;border-color:#E5B800;box-shadow:0 0 0 4px rgba(254,216,0,.35)}
[data-theme="dark"] #skuDays{background:#2A2A12;color:#FFF7C2;border-color:#FED900}
.sku-ord{white-space:nowrap}
/* остатки: поле дней внутри карточки плана поставок */
.sku-head{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:nowrap;margin-bottom:8px}
.sku-head-actions{display:flex;align-items:center;gap:14px;flex:0 0 auto}
.sku-head-main{display:flex;flex-direction:column;gap:2px;flex:1 1 auto;min-width:0}
.sku-days{display:inline-flex;align-items:center;gap:8px;white-space:nowrap;
  font-size:12px;font-weight:750;color:var(--text-primary);padding-top:2px}
.sku-empty{padding:14px 16px;font-size:12.5px}
/* план поставок */
.sku-row{grid-template-columns:210px minmax(140px,1fr) 190px 84px 76px 92px 160px}
@media (max-width:1200px){.sku-row{grid-template-columns:150px 1fr 150px 70px 64px 80px 130px}}
.sku-plan{display:flex;justify-content:flex-end}
.sku-plan input{width:100%;max-width:130px;text-align:right;font-size:13px;font-weight:700;
  padding:6px 8px;border:1.5px solid var(--divider);border-radius:9px;background:var(--surface);
  color:var(--text-primary)}
.sku-plan input:focus{outline:none;border-color:#2563EB;box-shadow:0 0 0 3px rgba(37,99,235,.18)}
.sku-plan input::-webkit-outer-spin-button,.sku-plan input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.btn.plan-save{background:#E5E7EB;color:#7A828C;border:1px solid #D1D5DB;cursor:not-allowed;font-weight:700}
.btn.plan-save:not(:disabled){background:#16A34A;color:#fff;border-color:#15803D;cursor:pointer;
  box-shadow:0 3px 10px rgba(22,163,74,.32)}
.btn.plan-save:not(:disabled):hover{background:#15803D}
.plan-tools{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:10px 0 6px}
.plan-buffer{display:flex;flex-direction:column;gap:6px;margin-bottom:10px}
.plan-buf-cl{display:grid;grid-template-columns:200px 70px 1fr;gap:10px;align-items:center;
  font-size:11.5px;padding:6px 10px;border-radius:10px;background:var(--surface-subtle)}
.plan-buf-cl>span{color:var(--text-muted);text-align:right}
.plan-buf-items{display:flex;flex-wrap:wrap;gap:6px 12px;color:var(--text-secondary)}
.plan-buf-item b{color:var(--text-primary)}
.plan-list-row{display:flex;justify-content:space-between;align-items:center;gap:12px;
  padding:10px 0;border-bottom:1px solid var(--divider);flex-wrap:wrap}
.plan-list-act{display:flex;gap:8px;flex-wrap:wrap}
.btn.danger{color:#B91C1C;border-color:#F3C0C0}
.plan-dlg .part-dialog-body{max-height:60vh;overflow:auto}
/* глобальный список буфера плана поставок */
.plan-global{border:1px solid var(--divider);border-radius:14px;background:var(--surface);
  padding:10px 14px;display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.plan-global:empty{display:none}
.plan-global-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;font-size:12px}
.plan-global-empty{font-size:12px}
/* партнёрство: блок остатков на р/с */
.cash-block{margin-top:18px}
.cash-head{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap;margin-bottom:10px}
.cash-big-label{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:#B91C1C}
.cash-big{font-size:30px;font-weight:800;color:#B91C1C;line-height:1.1}
.cash-big.neg{color:#B91C1C}
.cash-sub{font-size:11.5px}
.cash-table-wrap{max-height:420px;overflow:auto;border:1px solid var(--divider);border-radius:12px}
.cash-tbl{width:100%}
.cash-tbl th,.cash-tbl td{padding:7px 12px;font-size:12px}
.cash-tbl thead th{position:sticky;top:0;z-index:4;background:var(--surface-subtle)}
.cash-tbl tr.cash-year td{background:var(--surface-subtle);font-weight:800;font-size:11.5px;color:var(--text-secondary)}
.cash-tbl tfoot th{border-top:2px solid var(--divider);background:var(--surface);font-weight:800}
.cash-tbl td.cash-bal{font-weight:800}
/* ГИЛЬДИЯ — RPG-схема денег */
.guild-wrap{padding:6px 16px 22px}
.guild-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:12px}
.guild-title{font-size:17px;font-weight:800;letter-spacing:-.2px}
.guild-grid{display:flex;flex-direction:column;align-items:center;gap:6px}
.g-block{display:flex;flex-direction:column;align-items:center;text-align:center;gap:2px}
.g-block img{width:170px;height:auto;filter:drop-shadow(0 10px 18px rgba(15,23,42,.18))}
.g-dungeon img{width:200px}
.g-cap{font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:var(--text-secondary)}
.g-sum{font-size:22px;font-weight:800;color:var(--text-primary);line-height:1.15}
.g-sum-big{font-size:30px;color:#B91C1C}
.g-sub{font-size:11.5px;color:var(--text-muted)}
.g-lanes{display:grid;grid-template-columns:1fr 1fr;gap:26px;width:100%;max-width:950px;margin:4px 0}
.g-lane{position:relative;display:flex;flex-direction:column;align-items:center;text-align:center;gap:3px;
  border:1px dashed var(--divider);border-radius:18px;padding:10px 12px 14px;background:var(--surface)}
.g-lane .g-hero{width:140px;filter:drop-shadow(0 12px 20px rgba(15,23,42,.2))}
.g-lane[data-side="v"] .g-hero{transform:scaleX(-1)}
.g-icon{width:64px;height:auto;margin-top:6px;filter:drop-shadow(0 6px 10px rgba(15,23,42,.15))}
.g-icon-sm{width:54px}
.g-hp{width:100%;max-width:230px;height:14px;border-radius:8px;background:var(--surface-subtle);
  overflow:hidden;margin-top:6px;border:1px solid var(--divider)}
.g-hp span{display:block;height:100%;width:0;background:linear-gradient(90deg,#16A34A,#4ADE80);transition:width .6s ease}
.g-hp.neg span{background:linear-gradient(90deg,#B91C1C,#F87171)}
.g-hp-label{font-size:11.5px;color:var(--text-muted)}
.g-hp-label b{color:var(--text-primary);font-size:12.5px}
.neg-text{color:#B91C1C}
.g-chest-block{margin-top:10px;display:flex;flex-direction:column;align-items:center;gap:2px}
.g-chest-block img{width:185px;filter:drop-shadow(0 14px 22px rgba(15,23,42,.22))}
@media (max-width:900px){
  .g-lanes{grid-template-columns:1fr}
  .g-lane .g-hero{width:120px}
}
/* гильдия: монеты-связки и стрелки */
.g-coin-row{display:flex;gap:10px;align-items:center;justify-content:center;margin:2px 0 4px}
.g-coin-row img{width:22px;height:22px;animation:gcoin 2.4s ease-in-out infinite}
.g-coin-row img:nth-child(2){animation-delay:.4s}
.g-coin-row img:nth-child(3){animation-delay:.8s}
@keyframes gcoin{0%,100%{transform:translateY(-3px);opacity:.65}50%{transform:translateY(3px);opacity:1}}
.g-arrow{width:22px;height:22px;border-right:3px solid #C9CED6;border-bottom:3px solid #C9CED6;
  transform:rotate(45deg);margin:2px 0 6px}
/* ДОРОГА ДЕНЕГ */
.road-wrap{padding:6px 16px 24px;position:relative}
.road-start{display:flex;flex-direction:column;align-items:center;gap:2px;margin:6px 0 14px}
.rs-art{width:120px;filter:drop-shadow(0 10px 18px rgba(15,23,42,.18))}
.rs-label{font-size:10.5px;font-weight:800;letter-spacing:.12em;color:#B45309}
.rs-sum{font-size:24px;font-weight:800}
.rs-sub{font-size:11.5px;color:var(--text-muted)}
.world{border:1px solid var(--divider);border-radius:18px;padding:12px 14px 16px;background:var(--surface);margin-bottom:6px}
.world-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;margin-bottom:10px}
.world-head b{font-size:13px;letter-spacing:.04em}
.world-head span{font-size:11.5px;color:var(--text-muted)}
.road-track{display:flex;gap:26px;overflow-x:auto;padding:10px 6px 4px;scrollbar-width:thin}
.road-node{position:relative;flex:0 0 auto;min-width:132px;display:flex;flex-direction:column;align-items:center;
  gap:3px;padding:10px 10px 8px;border-radius:14px;background:var(--surface-subtle);
  border:1px solid var(--divider);cursor:pointer;transition:transform .15s ease,box-shadow .15s ease}
.road-node:hover{transform:translateY(-3px);box-shadow:0 10px 22px rgba(15,23,42,.14);border-color:#FED900}
.road-node::before{content:"";position:absolute;left:-26px;top:50%;width:26px;height:3px;
  background:repeating-linear-gradient(90deg,#D9DCE1 0 6px,transparent 6px 12px)}
.road-node:first-child::before{display:none}
.rn-month{font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;color:var(--text-secondary)}
.rn-bal{font-size:16px;font-weight:800}
.rn-flows{display:flex;flex-direction:column;gap:1px;font-size:11px;font-weight:600}
.rn-up{color:#15803D}
.rn-down{color:#B91C1C}
.rn-icons{display:flex;align-items:center;gap:8px;margin-top:4px;font-size:10.5px;color:var(--text-muted)}
.rn-ic{display:inline-flex;align-items:center;gap:3px}
.rn-ic img{width:20px;height:20px}
.world-divider{display:flex;align-items:center;gap:12px;margin:12px 0}
.wd-line{flex:1;height:2px;background:repeating-linear-gradient(90deg,#D9DCE1 0 8px,transparent 8px 16px)}
.wd-badge{font-size:11.5px;font-weight:800;color:#1D4ED8;background:#E8EEFF;border-radius:999px;padding:6px 14px;
  border:1px solid #C7D6FF;white-space:nowrap}
.road-final{display:flex;align-items:center;gap:18px;justify-content:center;margin-top:16px;
  padding:14px 18px;border-radius:18px;background:linear-gradient(180deg,#FFF9E3,#FFF3C4);border:1px solid #F5DF8A}
.road-final img{width:120px;filter:drop-shadow(0 10px 18px rgba(15,23,42,.2))}
.rf-label{font-size:10.5px;font-weight:800;letter-spacing:.12em;color:#B45309}
.rf-sum{font-size:28px;font-weight:800;color:#B91C1C;line-height:1.1}
.rf-heroes{display:flex;gap:16px;flex-wrap:wrap;font-size:12px;color:var(--text-secondary);margin-top:4px}
.rf-heroes b{color:var(--text-primary)}
.road-tip{position:absolute;z-index:20;pointer-events:none;opacity:0;transform:translateY(4px);
  background:#FFFFFF;color:#0F172A;border:1px solid #D5DCE5;border-radius:10px;padding:9px 12px;
  font-size:12px;line-height:1.5;white-space:pre-line;box-shadow:0 12px 30px rgba(15,23,42,.18);
  transition:opacity .12s ease;max-width:280px}
.road-tip.on{opacity:1}
/* СХЕМА ДЕНЕГ */
.sch-wrap{padding:6px 16px 26px;position:relative}
.sch-stage{display:flex;flex-direction:column;align-items:center;gap:2px}
.sch-source{display:flex;flex-direction:column;align-items:center;gap:2px}
.sch-source img{width:170px;filter:drop-shadow(0 10px 18px rgba(15,23,42,.18))}
.sch-cap{font-size:11px;font-weight:800;letter-spacing:.1em;color:var(--text-secondary)}
.sch-big{font-size:26px;font-weight:800;line-height:1.1}
.sch-big-red{color:#B91C1C}
.sch-sub{font-size:11.5px;color:var(--text-muted)}
.sch-fork{position:relative;width:min(760px,100%);height:46px;margin:2px 0 4px}
.sch-fork-line{position:absolute;left:50%;top:0;width:2px;height:16px;background:repeating-linear-gradient(#C9CED6 0 5px,transparent 5px 10px)}
.sch-fork-line.sch-fork-right{height:16px}
.sch-fork-line::after{content:"";position:absolute;left:-1px;top:16px;width:2px;height:26px;background:#E3E7EC}
.sch-fork-coin{position:absolute;left:50%;top:2px;transform:translateX(-50%);animation:gcoin 2.4s ease-in-out infinite}
.sch-fork-coin img{width:22px;height:22px}
.sch-lanes{display:grid;grid-template-columns:1fr 1fr;gap:22px;width:100%;max-width:980px}
@media (max-width:900px){.sch-lanes{grid-template-columns:1fr}}
.sch-lane{border:1px solid var(--divider);border-radius:18px;padding:12px 16px 14px;background:var(--surface);
  display:flex;flex-direction:column;align-items:center;gap:4px}
.sch-hero{width:132px;filter:drop-shadow(0 12px 20px rgba(15,23,42,.2))}
.sch-hero.flip{transform:scaleX(-1)}
.sch-name{font-size:11.5px;font-weight:800;letter-spacing:.08em;color:var(--text-secondary)}
.sch-row{display:flex;justify-content:space-between;align-items:center;gap:12px;width:100%;
  font-size:12px;color:var(--text-secondary);padding:3px 0;border-bottom:1px dashed transparent}
.sch-row b{color:var(--text-primary);font-size:13.5px;white-space:nowrap}
.sch-row.minus b{color:#B91C1C}
.sch-row.out b{color:#B45309}
.sch-row span{display:inline-flex;align-items:center;gap:6px}
.sch-ic{width:20px;height:20px}
.sch-eq{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:4px;
  padding:6px 10px;border-radius:10px;background:var(--surface-subtle);font-weight:800;font-size:12px}
.sch-eq b{font-size:15px}
.sch-hp{width:100%;height:12px;border-radius:7px;background:var(--surface-subtle);overflow:hidden;
  border:1px solid var(--divider);margin:2px 0 6px}
.sch-hp span{display:block;height:100%;width:0;background:linear-gradient(90deg,#16A34A,#4ADE80);transition:width .6s ease}
.sch-hp.neg span{background:linear-gradient(90deg,#B91C1C,#F87171)}
.sch-formula{margin:20px 0 8px;padding:16px 18px;border-radius:16px;background:var(--surface);
  border:1px solid var(--divider)}
.sch-formula-head{font-size:11px;font-weight:800;letter-spacing:.1em;color:var(--text-secondary);margin-bottom:10px}
.sch-chips{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.sch-chips .op{font-size:20px;font-weight:800;color:var(--text-muted)}
.sch-chips span.chip-plus,.sch-chips span.chip-minus,.sch-chips span.chip-result{
  display:flex;flex-direction:column;gap:1px;padding:8px 12px;border-radius:12px;min-width:130px}
.sch-chips i{font-style:normal;font-size:10.5px;text-transform:uppercase;letter-spacing:.04em;color:var(--text-muted)}
.sch-chips b{font-size:15px;font-weight:800}
.chip-plus{background:#EEF7EF;border:1px solid #CFE8D3}
.chip-plus b{color:#15803D}
.chip-minus{background:#FDF0EF;border:1px solid #F3CFCB}
.chip-minus b{color:#B91C1C}
.chip-result{background:#FFF6D6;border:1px solid #F1DC94}
.chip-result b{color:#8A5A00;font-size:18px}
.sch-note{font-size:11px;color:var(--text-muted);margin-top:8px}
.sch-treasure{display:flex;align-items:center;gap:16px;justify-content:center;margin:10px 0 4px}
.sch-treasure img{width:120px;filter:drop-shadow(0 12px 20px rgba(15,23,42,.2))}
.sch-final{margin-top:12px}
.sch-chron{margin-top:18px}
.sch-chron-head{font-size:11px;font-weight:800;letter-spacing:.1em;color:var(--text-secondary);margin-bottom:6px}
/* подсказка дороги: фиксированное позиционирование, без наложений */
.road-tip.fixed-tip{position:fixed;left:0;top:0;z-index:9999;white-space:normal;min-width:200px;max-width:300px}
.road-tip .rt-month{font-weight:800;font-size:12.5px;margin-bottom:6px;text-transform:uppercase;letter-spacing:.05em;color:#B45309}
.road-tip .rt-row{display:flex;justify-content:space-between;gap:14px;font-size:11.5px;line-height:1.45;color:#334155}
.road-tip .rt-row b{color:#0F172A;white-space:nowrap}
/* КОНКУРЕНТЫ */
.comp-bookmark{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:10px 16px 6px}
.cb-text{display:flex;flex-direction:column;gap:2px;font-size:12px}
.comp-ctl{padding:8px 16px 4px}
.comp-kpi{display:flex;gap:18px;flex-wrap:wrap;padding:8px 16px;font-size:12px;color:var(--text-secondary)}
.comp-kpi-item b{color:var(--text-primary);font-size:13px}
.comp-tbl{width:100%}
.comp-tbl th,.comp-tbl td{padding:6px 10px;font-size:12px}
.comp-tbl tr.comp-mine td{background:color-mix(in srgb,#FED900 18%,var(--surface));font-weight:700}
.comp-tbl a{color:var(--blue-strong,#1D4ED8);text-decoration:none}
.comp-tbl a:hover{text-decoration:underline}
.comp-paste{display:flex;gap:10px;align-items:flex-start;padding:6px 16px 10px}
.comp-paste textarea{flex:1;min-height:64px;max-height:160px;padding:9px 12px;border-radius:10px;
  border:1.5px solid var(--divider);background:var(--surface);color:var(--text-primary);font-size:12px;resize:vertical}
.comp-paste textarea:focus{outline:none;border-color:#2563EB;box-shadow:0 0 0 3px rgba(37,99,235,.15)}
/* заказы: диаграмма по кластерам */
.ord-chart-head{display:flex;align-items:baseline;gap:10px;padding:4px 12px 0;font-size:12px}
.clu-legend{display:flex;flex-wrap:wrap;gap:6px 14px;padding:6px 12px 10px;font-size:11px;color:var(--text-secondary)}
.clu-leg{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}
.clu-leg i{width:10px;height:10px;border-radius:3px;display:inline-block}
/* ВЫКУПЫ */
.vyk-title{font-size:26px;letter-spacing:.06em;color:#047857;font-weight:800;margin:0}
.vyk-page .card-head{border-left:5px solid #10B981;padding-left:14px}
.tbl.vyk thead th{background:#ECFDF5;color:#065F46}
.tbl.vyk tbody tr.vyk-grp td{background:#D1FAE5;color:#064E3B;font-weight:700}
.tbl.vyk tbody tr.vyk-row{cursor:pointer}
.tbl.vyk tbody tr.vyk-row:hover td{background:#F0FDF4}
.tbl.vyk .vyk-art{font-weight:600;color:#065F46}
/* ВЫКУПЫ: табы и заголовок */
.vyk-title{font-size:24px;letter-spacing:.08em;color:#047857;font-weight:800;margin:0 6px 0 0;white-space:nowrap}
.vyk-page .card-head{border-top:4px solid #10B981}
.vyk-tabs .part-tab.active{background:#10B981;color:#fff;border-color:#10B981}
.tbl.vyk thead th{background:#ECFDF5;color:#064E3B}
.tbl.vyk tbody tr.ord-grp td{background:#D1FAE5;color:#064E3B}
/* «Выкупы»: зелёная гамма в тёмной теме */
[data-theme="dark"] .tbl.vyk thead th.ord-m{background:color-mix(in srgb,#10B981 18%,var(--surface));color:#A7F3D0}
[data-theme="dark"] .tbl.vyk thead th.ord-m.open{background:color-mix(in srgb,#10B981 30%,var(--surface));color:#ECFDF5}
[data-theme="dark"] .tbl.vyk thead th.ord-d{background:color-mix(in srgb,#10B981 10%,var(--surface));color:#6EE7B7}
[data-theme="dark"] .tbl.vyk thead th.ord-sku{background:color-mix(in srgb,#10B981 18%,var(--surface));color:#D1FAE5}
[data-theme="dark"] .tbl.vyk thead th.ord-sum{background:color-mix(in srgb,#10B981 18%,var(--surface));color:#D1FAE5}
[data-theme="dark"] .tbl.vyk tbody tr.ord-grp td{background:color-mix(in srgb,#10B981 16%,var(--surface));color:#ECFDF5}
[data-theme="dark"] .tbl.vyk tbody tr.ord-total td{background:color-mix(in srgb,#10B981 12%,var(--surface));color:#F0FDF4}
[data-theme="dark"] .tbl.vyk tbody tr.ord-row:hover td{background:color-mix(in srgb,#10B981 9%,var(--surface))}
[data-theme="dark"] .vyk-title{color:#34D399}
/* «Конкуренты»: список снимков и кнопки удаления */
.comp-snaps{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:10px 0 2px;font-size:12px}
.snap-chip{display:inline-flex;align-items:center;gap:6px;padding:3px 8px 3px 10px;border:1px solid var(--divider);
  border-radius:999px;background:var(--surface-subtle);color:var(--text-secondary);font-size:11.5px}
.snap-del,.comp-del{border:0;background:transparent;color:var(--text-muted);cursor:pointer;font-size:12px;
  line-height:1;padding:2px 4px;border-radius:6px}
.snap-del:hover,.comp-del:hover{background:color-mix(in srgb,#EF4444 16%,transparent);color:#DC2626}
.comp-del{font-size:13px}
.tbl.comp-tbl td:last-child{width:28px}
/* «Конкуренты»: позиционирование и динамика цен */
.comp-scatter{padding:2px 8px 0}
.comp-scat-svg,.comp-dyn-svg{width:100%;height:auto;display:block}
.comp-pt{cursor:pointer}
.comp-pt:hover{stroke-width:1.8}
.comp-pt-mine{filter:drop-shadow(0 1px 3px rgba(249,115,22,.5))}
.comp-scat-legend,.comp-legend{display:flex;flex-wrap:wrap;gap:6px 16px;padding:8px 14px 12px;
  font-size:11.5px;color:var(--text-secondary)}
.comp-scat-legend span,.comp-lg{display:inline-flex;align-items:center;gap:6px}
.comp-scat-legend i{width:10px;height:10px;border-radius:50%;display:inline-block;background:#3B82F6;opacity:.6}
.comp-scat-legend i.star{width:12px;height:12px;background:#F97316;opacity:1;border-radius:0;
  clip-path:polygon(50% 0,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%)}
.comp-scat-legend i.big{width:15px;height:15px}
.comp-lg i{width:10px;height:3px;border-radius:2px;display:inline-block}
.comp-movers{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:18px;padding:4px 14px 16px}
.comp-movers h3{font-size:12.5px;margin:6px 0 8px;color:var(--text-primary)}
@media (max-width:1100px){.comp-movers{grid-template-columns:1fr}}
/* «Управление ассортиментом» */
.assort-top{display:flex;flex-direction:column;gap:10px;margin:10px 0 12px}
.assort-add{display:flex;gap:8px}
.assort-add input{flex:1;min-width:240px;padding:9px 12px;border-radius:10px;border:1px solid var(--border);
  background:var(--surface);color:var(--text-primary);font-size:13px}
.assort-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:12px}
.assort-tools .btn{font-size:12px}
.tbl.assort-tbl td{padding:6px 8px;font-size:12px;vertical-align:middle;text-align:left}
.tbl.assort-tbl th{text-align:left}
.tbl.assort-tbl tr.archived td{opacity:.55}
.assort-photo{position:relative;display:inline-flex;width:38px;height:38px;border-radius:8px;overflow:hidden;
  background:var(--surface-subtle);border:1px solid var(--divider);align-items:center;justify-content:center;
  cursor:pointer;font-size:10px;color:var(--text-muted)}
.assort-photo img{width:100%;height:100%;object-fit:cover}
.assort-photo:hover{border-color:var(--blue)}
.assort-inline-edit{background:transparent;border:1px dashed transparent;border-radius:6px;padding:3px 5px;
  font:inherit;color:inherit;width:100%;min-width:110px}
.assort-inline-edit:hover{border-color:var(--divider)}
.assort-inline-edit:focus{border-color:var(--blue);outline:none;background:var(--surface)}
.assort-tag{display:inline-block;padding:2px 7px;border-radius:999px;font-size:11px;background:var(--surface-subtle);
  border:1px solid var(--divider);color:var(--text-secondary)}
.assort-tag.yes{background:color-mix(in srgb,#22C55E 16%,var(--surface));border-color:transparent;color:#166534}
.assort-tag.no{background:color-mix(in srgb,#EF4444 12%,var(--surface));border-color:transparent;color:#991B1B}
[data-theme="dark"] .assort-tag.yes{color:#86EFAC}
[data-theme="dark"] .assort-tag.no{color:#FCA5A5}
/* Заголовки диалогов отчётов */
.part-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.part-dialog-head h3{margin:0;font-size:16px;color:var(--text-primary)}
.part-dialog-x{border:0;background:transparent;font-size:20px;line-height:1;color:var(--text-muted);
  cursor:pointer;padding:2px 7px;border-radius:8px}
.part-dialog-x:hover{background:var(--surface-hover);color:var(--text-primary)}
/* настройки налога и история себестоимости */
.assort-settings{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:8px 0 10px;font-size:12px;
  color:var(--text-secondary)}
.assort-settings select,.assort-settings input{padding:6px 8px;border-radius:8px;border:1px solid var(--border);
  background:var(--surface);color:var(--text-primary);font-size:12px}
.assort-settings input[type=number]{width:78px}
.assort-settings label{display:inline-flex;align-items:center;gap:4px}
.assort-hist{margin-left:4px;border:1px solid var(--divider);background:transparent;border-radius:6px;
  font-size:11px;color:var(--text-muted);cursor:pointer;padding:2px 6px}
.assort-hist:hover{color:var(--blue);border-color:var(--blue)}
.tbl.assort-tbl .assort-inline-edit.num{text-align:right;min-width:70px}
.assort-cost-cell{display:inline-flex;align-items:center;gap:5px;width:100%}
.assort-cost-cell .assort-inline-edit{width:80px;flex:0 0 80px}

/* предупреждение: нет себестоимости */
.cost-warn{display:flex;align-items:center;gap:10px;margin:0 0 10px;padding:10px 12px;border-radius:10px;
  background:color-mix(in srgb,#F59E0B 14%,var(--surface));border:1px solid color-mix(in srgb,#F59E0B 40%,transparent);
  color:var(--text-primary);font-size:13px}
.cost-warn b{color:#B45309}
.cost-warn a{color:var(--blue-strong);font-weight:600}
[data-theme="dark"] .cost-warn b{color:#FCD34D}
.tag-no-cost{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:999px;font-size:10px;
  background:color-mix(in srgb,#F59E0B 20%,var(--surface));color:#92400E}
[data-theme="dark"] .tag-no-cost{color:#FCD34D}

.cost-warn.group-warn{background:color-mix(in srgb,#3B82F6 12%,var(--surface));
  border-color:color-mix(in srgb,#3B82F6 38%,transparent)}

/* лист «Данные» */
.data-drop{display:flex;flex-direction:column;align-items:center;gap:8px;padding:26px 16px;margin:10px 0 14px;
  border:2px dashed var(--border);border-radius:14px;background:var(--surface-subtle);text-align:center}
.data-drop.over{border-color:var(--blue);background:color-mix(in srgb,#3B82F6 8%,var(--surface))}
.data-drop b{font-size:14px}
.data-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px;margin-bottom:18px}
.data-card{border:1px solid var(--divider);border-radius:12px;padding:12px;background:var(--surface)}
.dc-title{font-weight:700;text-transform:capitalize;margin-bottom:4px}
.dc-period{font-size:12px;color:var(--text-secondary);margin-bottom:2px}
.dc-rows{font-size:12px;color:var(--text-muted);margin-bottom:10px}
.data-log-wrap h3{font-size:14px;margin:6px 0 8px}

.data-pending{margin:0 0 14px;padding:12px 14px;border-radius:12px;border:1px solid color-mix(in srgb,#3B82F6 40%,transparent);
  background:color-mix(in srgb,#3B82F6 8%,var(--surface))}
.dp-head{font-size:13px;margin-bottom:4px}
.dp-body{font-size:13px;color:var(--text-secondary);margin-bottom:10px;line-height:1.5}
.dp-actions{display:flex;align-items:center;gap:10px}

.data-card.has-gap{border-color:color-mix(in srgb,#F59E0B 45%,transparent)}
.dc-gap{font-size:11px;color:#B45309;margin-bottom:8px}
[data-theme="dark"] .dc-gap{color:#FCD34D}
.dp-gap{margin:-2px 0 10px;padding:8px 10px;border-radius:8px;font-size:12px;
  background:color-mix(in srgb,#F59E0B 16%,var(--surface));color:var(--text-primary)}

.cost-warn.gaps-warn{background:color-mix(in srgb,#6366F1 12%,var(--surface));
  border-color:color-mix(in srgb,#6366F1 38%,transparent)}
