:root {
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.79rem + 0.15vw, 0.875rem);
  --text-base: clamp(0.9375rem, 0.92rem + 0.1vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f9fafb; --border: #e3e6ea; --divider: #eceef1;
  --text: #17202b; --muted: #5d6875; --faint: #98a1ab;
  --primary: #1d4e89; --primary-h: #163d6c; --primary-soft: #e8eef7;
  --red: #b42318; --red-bg: #fde8e6; --yellow: #8a5a00; --yellow-bg: #fff3d6;
  --green: #1f7a3d; --green-bg: #e3f4e8; --grey-bg: #eef0f2;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: var(--text-base); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.n, th.n { font-variant-numeric: tabular-nums lining-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: var(--text-xs); } .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dates { position: relative; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 100; background: #fff; padding: 8px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* вход */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--s6); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: var(--s8); display: grid; gap: var(--s4); box-shadow: var(--shadow); }
.login-card h1 { font-size: var(--text-xl); margin: var(--s2) 0 0; }
.login-card label { display: grid; gap: var(--s1); font-size: var(--text-sm); color: var(--muted); }
input, select, textarea { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; background: #fff; min-height: 40px; min-width: 0; }
input:focus, select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.err { color: var(--red); min-height: 1.2em; margin: 0; font-size: var(--text-sm); }

.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 600; white-space: nowrap; }
.brand b { color: var(--muted); font-weight: 500; }
.mark { width: 28px; height: 28px; border-radius: 7px; background: var(--primary); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; }

/* каркас */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s6);
  height: 56px; background: var(--surface); border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--muted); cursor: pointer;
  font-size: var(--text-sm); font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.top-right { display: flex; gap: var(--s2); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s6); background: var(--surface); border-bottom: 1px solid var(--border); }
.period { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: var(--text-sm);
  cursor: pointer; min-height: 34px; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.dates input { min-height: 34px; padding: 4px 8px; font-size: var(--text-sm); }
main { padding: var(--s6); max-width: 1600px; margin: 0 auto; outline: none; }

.btn { border: 1px solid var(--border); background: #fff; border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer;
  font-size: var(--text-sm); font-weight: 500; min-height: 36px; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-h); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { border-color: var(--border); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: var(--text-xs); }
.btn:disabled { opacity: .5; cursor: default; }

h2 { font-size: var(--text-lg); margin: 0; font-weight: 600; }
h3 { font-size: var(--text-base); margin: 0 0 var(--s3); font-weight: 600; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin: 0 0 var(--s4); flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s5); box-shadow: var(--shadow); min-width: 0; }
.grid { display: grid; gap: var(--s4); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: var(--s4); }
.kpi .label { font-size: var(--text-xs); color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.kpi .value { font-size: var(--text-xl); font-weight: 650; margin-top: var(--s1); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .sub { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }
.pos { color: var(--green); } .neg { color: var(--red); }
.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .two { grid-template-columns: 1fr; } }
.chart-box { position: relative; height: 300px; }

/* таблицы */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: 70vh; overscroll-behavior: contain; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--text-sm); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--divider); text-align: left; vertical-align: top; }
thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 600; font-size: var(--text-xs); color: var(--muted);
  cursor: pointer; user-select: none; white-space: nowrap; }
thead th.sorted::after { content: ' ▾'; } thead th.sorted.asc::after { content: ' ▴'; }
tbody tr:hover td { background: #fafbfc; }
tfoot td { font-weight: 600; background: var(--surface-2); position: sticky; bottom: 0; }
td.name { min-width: 220px; max-width: 360px; }
td.name .t { font-weight: 500; overflow-wrap: anywhere; } td.name .s { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
td.hint { min-width: 380px; max-width: 480px; color: var(--muted); font-size: var(--text-xs); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.b-red { color: var(--red); background: var(--red-bg); } .b-yellow { color: var(--yellow); background: var(--yellow-bg); }
.b-green { color: var(--green); background: var(--green-bg); } .b-grey { color: var(--muted); background: var(--grey-bg); }
.abc { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; font-weight: 700; font-size: var(--text-xs); }
.abc-A { background: var(--green-bg); color: var(--green); } .abc-B { background: var(--yellow-bg); color: var(--yellow); } .abc-C { background: var(--grey-bg); color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s3); }
.filters input[type=search] { width: min(320px, 100%); }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-size: var(--text-sm); border-right: 1px solid var(--border); min-height: 34px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.light-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.light-sum button { text-align: left; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: var(--s3) var(--s4); cursor: pointer; }
.light-sum .cnt { font-size: var(--text-xl); font-weight: 650; font-variant-numeric: tabular-nums; }
.list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s3); }
.list li { display: grid; gap: 2px; padding-bottom: var(--s3); border-bottom: 1px solid var(--divider); }
.list li:last-child { border-bottom: 0; padding-bottom: 0; }

.note { background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius); padding: var(--s3) var(--s4); font-size: var(--text-sm); color: var(--muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); align-items: end; margin-bottom: var(--s4); }
.form-row label { display: grid; gap: 4px; font-size: var(--text-xs); color: var(--muted); font-weight: 500; }
.subtabs { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); display: grid; place-items: center; z-index: 50; padding: var(--s4); }
.modal-card { background: #fff; border-radius: 14px; padding: var(--s6); width: min(520px, 100%); max-height: 90dvh; overflow: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; font-size: var(--text-sm); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.skel { background: linear-gradient(90deg, #eef0f2, #f6f7f8, #eef0f2); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.empty { padding: var(--s8); text-align: center; color: var(--muted); }

@media (max-width: 720px) {
  .top { padding: 0 var(--s3); gap: var(--s2); height: auto; min-height: 52px; flex-wrap: wrap; padding-top: 8px; }
  .top .brand { order: 1; } .top-right { order: 2; margin-left: auto; } .tabs { order: 3; flex-basis: 100%; padding-bottom: 6px; }
  .bar { padding: var(--s3); } main { padding: var(--s3); }
  .role { display: none; } .top-right .btn { padding: 6px 8px; }
  td.hint { min-width: 220px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: var(--text-lg); }
  .card { padding: var(--s4); }
  .chart-box { height: 240px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.dl-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}.dl-list .btn{align-self:flex-start}.dl-list p{margin:0 0 8px;font-size:13px}

.grid.three{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.grid.two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
@media (max-width:900px){.grid.three,.grid.two{grid-template-columns:1fr}}
.kv{display:flex;align-items:baseline;gap:8px;padding:6px 0;border-bottom:1px solid var(--border,#e5e9f0);font-size:14px}
.kv span:first-child{flex:1;color:var(--muted,#5b6b7f)}.kv:last-child{border-bottom:0}
.xyz-X{background:#dbeafe;color:#1d4e89}.xyz-Y{background:#fef3c7;color:#92400e}.xyz-Z{background:#fee2e2;color:#991b1b}
.pbar{display:inline-block;width:120px;height:8px;background:#e5e9f0;border-radius:4px;vertical-align:middle;margin-right:8px;overflow:hidden}
.pbar i{display:block;height:100%}.pbar i.ok{background:#2e7d32}.pbar i.mid{background:#d69e2e}.pbar i.low{background:#c53030}
td.pf{white-space:nowrap}

@media (max-width: 1919px) and (min-width: 721px) {
  .top { height: auto; flex-wrap: wrap; padding-top: 8px; row-gap: 2px; }
  .top .brand { order: 1; } .top-right { order: 2; margin-left: auto; } .tabs { order: 3; flex-basis: 100%; padding-bottom: 6px; margin-left: -12px; }
}
/* реклама: товар → кампании */
.ad-table td { vertical-align: middle; }
.ad-prod { cursor: pointer; font-weight: 600; background: var(--surface-2); }
.ad-prod:hover { background: color-mix(in oklab, var(--surface-2) 80%, var(--primary, #2E5A8A) 8%); }
.ad-prod.ad-unb { background: color-mix(in oklab, var(--surface-2) 85%, #999 10%); }
.ad-prod .ad-pn { display: grid; grid-template-columns: 22px 1fr; column-gap: 4px; }
.ad-prod .ad-pn .ad-tog { grid-row: span 2; background: none; border: 0; padding: 0; min-height: auto; cursor: pointer; font-size: 14px; color: var(--muted); }
.ad-camp { font-weight: 400; }
.ad-camp td.name { padding-left: 34px; }
.ad-camp td { font-size: 0.95em; }
.drr-legend { margin: 6px 0 10px; display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; }
/* таблица рекламы помещается целиком на 1440px; при узком экране — прокрутка внутри контейнера */
.ad-table { font-size: 13px; width: 100%; }
.ad-table th, .ad-table td { padding: 6px 6px; }
.ad-table thead th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.ad-table thead th.n { min-width: 64px; }
.ad-table td.name { min-width: 230px; max-width: 270px; width: 270px; }
.ad-table td.name .t, .ad-table td.name .s.ad-full { white-space: normal; overflow: hidden; text-overflow: clip; max-width: none;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.ad-table td.ad-pname { max-width: 520px; width: auto; }
.ad-camp td:nth-child(2) { min-width: 120px; max-width: 150px; }
.ad-camp td:nth-child(3) { min-width: 64px; }
.ad-camp td.name { padding-left: 28px; }
.ad-camp td:nth-child(4) { color: var(--muted); }
.ad-table td.ad-pname .s.ad-full { -webkit-line-clamp: 4; }

.ad-prod.ad-zg { background: color-mix(in oklab, var(--surface-2) 80%, #999 14%); color: var(--muted); }
.ad-prod.ad-idle { font-weight: 500; color: var(--muted); background: var(--surface); }

/* мультимагазинность: переключатель магазина, выбор магазинов пользователя, регистрация */
.shop-sel select { min-height: 32px; padding: 4px 28px 4px 10px; font-weight: 500; max-width: 260px; }
.shop-pick { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s3) var(--s4); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; }
.shop-pick legend { font-size: var(--text-xs); color: var(--muted); font-weight: 500; padding: 0 4px; }
.shop-pick .chk { display: inline-flex; gap: 6px; align-items: center; font-size: var(--text-sm); }
.shop-pick .chk input { min-height: auto; width: auto; }
.login-card a { color: var(--primary, #1d4e89); }
#registerForm { width: min(440px, 100%); }
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
@media (max-width: 640px) { .shop-sel select { max-width: 100%; width: 100%; } .shop-sel { min-width: 0; flex: 1 1 auto; } .brand { min-width: 0; flex: 1 1 auto; } .brand:has(#shopSel:not([hidden])) #brandName { display: none; } .top-right { flex: none; } }
.hint-card{border-left:3px solid var(--primary)}
.hint-steps{margin:8px 0 8px 18px;padding:0;display:grid;gap:6px;font-size:13px;line-height:1.45}
.hint-steps a{color:var(--primary)}

/* ---------- редизайн кабинета: 5 разделов, сводка ---------- */
.tabs { gap: 4px; }
.tab { font-size: var(--text-sm); padding: 8px 14px; }
.upd { white-space: nowrap; align-self: center; }
.btn.icon { font-size: 16px; padding: 4px 8px; }
.top-right { align-items: center; }
.cmp { display: inline-flex; align-items: center; gap: 6px; margin-left: var(--s2); white-space: nowrap; }
.cmp input { min-height: auto; width: 16px; height: 16px; }
.dates-box { display: inline-flex; align-items: center; gap: var(--s2); }
.subnav { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; padding: var(--s3) var(--s6) 0; max-width: 1600px; margin: 0 auto; }
.subnav-t { font-weight: 600; margin-right: var(--s2); }
.subnav + main { padding-top: var(--s4); }
.bnav { display: none; }

.kpis8 { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.kpis8.no-bal { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.tile { text-align: left; cursor: pointer; padding: var(--s3) var(--s4); font: inherit; color: inherit; display: flex; flex-direction: column; gap: 2px; transition: border-color .15s, box-shadow .15s; }
.tile:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tile .label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value { font-size: clamp(1.15rem, .9rem + .6vw, 1.5rem); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.tile .dl { min-height: 18px; }
.delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.delta.pos { color: var(--green); } .delta.neg { color: var(--red); }
.tile .sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.sum-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s4); margin-bottom: var(--s4); align-items: stretch; }
.sum-row.b { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.sum-row .col { display: grid; gap: var(--s4); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.card-h h3 { margin: 0; }
.card-f { display: flex; justify-content: flex-end; margin-top: var(--s3); }
.card-f a, .card-h a { color: var(--primary); text-decoration: none; font-weight: 500; font-size: var(--text-sm); }
.cnt { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--grey-bg); font-size: 12px; margin-left: 4px; }
.chart-card { display: flex; flex-direction: column; }
.chart-card .chart-box { flex: 1; min-height: 260px; height: auto; }
.seg.sm button { padding: 4px 10px; min-height: 30px; font-size: var(--text-xs); }

.att { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.att-i { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: 8px 10px; border: 1px solid var(--divider); border-radius: var(--radius-sm); }
.att-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.lv-crit .att-ic { background: var(--red-bg); color: var(--red); }
.lv-warn .att-ic { background: var(--yellow-bg); color: var(--yellow); }
.att-t { font-size: var(--text-sm); line-height: 1.3; min-width: 0; }
.att-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.att-more { margin-top: 6px; color: var(--primary); }
.att-ok { padding: var(--s6); text-align: center; color: var(--green); font-weight: 600; background: var(--green-bg); border-radius: var(--radius-sm); }
.att-group + .att-group { margin-top: var(--s4); }
.att-gh { font-weight: 600; font-size: var(--text-sm); margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--divider); }

.pl tr.b td { font-weight: 600; }
/* «Отчёт о прибыли» на главной: строки «Заказано…» — справочные, обычный шрифт, под ними тонкий разделитель */
.pl tr.ord td { font-weight: 400; cursor: default; }
.pl tr.ord-last td { border-bottom: 1px solid #c3c9d1; }
.ch-note { margin: 8px 0 0; line-height: 1.45; }
tr.lnk { cursor: pointer; }
tr.lnk:hover td { background: var(--primary-soft); }
.top5 td.name { min-width: 160px; max-width: 280px; }
.top5 td.name .s { max-width: 260px; }
.heat { display: inline-block; padding: 1px 6px; border-radius: 4px; }
.back { color: var(--primary); text-decoration: none; }
.pick-list { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: center; margin-top: var(--s3); }
.shops-all td { vertical-align: middle; }
.shops-all tr.shop-row td { border-bottom: 2px solid var(--border); }
.chip.flag { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }

.arch-head { cursor: pointer; background: var(--surface-2); }
.arch-head td { color: var(--muted); font-weight: 600; }
.arch-head .ad-tog { background: none; border: 0; padding: 0 4px 0 0; min-height: auto; cursor: pointer; color: var(--muted); }
.arch-row td { color: var(--muted); }

.menu-sec { border-top: 1px solid var(--divider); padding: var(--s3) 0; }
.menu-t { font-size: var(--text-xs); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; cursor: pointer; }
.menu-i { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); }
.menu-i:hover { background: var(--surface-2); }

@media (max-width: 1360px) and (min-width: 721px) {
  .kpis8, .kpis8.no-bal { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1000px) { .sum-row, .sum-row.b { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .tabs { display: none; }
  .upd { display: none; }
  #btnExcel { display: none; }
  .top { flex-wrap: nowrap; padding: 8px var(--s3); }
  .top-right { order: 2; }
  .bar { padding: var(--s2) var(--s3); }
  .period { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; width: 100%; min-width: 0; position: relative; padding-bottom: 2px; }
  .period::-webkit-scrollbar { display: none; }
  .period .chip, .period .dates-box, .period .cmp { flex: none; }
  html, body { overflow-x: hidden; }
  .status { display: none; }
  .subnav { padding: var(--s2) var(--s3) 0; flex-wrap: nowrap; overflow-x: auto; }
  .subnav .chip { flex: none; }
  main { padding-bottom: 84px; }
  .kpis8, .kpis8.no-bal { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .tile.t-profit, .tile.t-stock { grid-column: span 2; }
  .tile .value { font-size: 1.2rem; }
  .att-i { grid-template-columns: 26px minmax(0, 1fr) auto; gap: var(--s2); padding: 8px; }
  .att-ic { width: 26px; height: 26px; }
  .bnav { display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bn { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); font-size: 11px; cursor: pointer; border-radius: 8px; min-width: 0; }
  .bn svg { width: 22px; height: 22px; fill: currentColor; }
  .bn[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
  .bn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .toast { bottom: 84px; }
}

/* плитка «Запас товара», подписи выплат */
.tile .value.warn { color: #E67E00; }
.tile.t-stock .value { font-size: clamp(1.05rem, .8rem + .55vw, 1.4rem); }
.qmark { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--border); font-size: 10px; color: var(--muted); text-transform: none; cursor: help; vertical-align: 1px; margin-left: 2px; }
.tile .label { display: flex; align-items: center; gap: 2px; }
.pay-l { display: block; margin-top: 2px; font-size: 11px; line-height: 1.3; }
.pay-l:first-child { margin-top: 4px; }
.pay-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s4); margin: var(--s2) 0 var(--s3); }
.pay-top .label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; display: flex; gap: 6px; align-items: center; }
.pay-top .value { font-size: 1.4rem; font-weight: 650; }
.pay-fc { border-left: 3px dashed #C9A100; padding-left: var(--s3); }
@media (max-width: 720px) { .pay-top { grid-template-columns: 1fr; } }
#btnRefresh.busy { display: inline-flex; gap: 6px; align-items: center; opacity: 1; color: var(--primary); border-color: var(--primary-soft); background: var(--primary-soft); white-space: nowrap; }
#btnRefresh .spin { display: inline-block; animation: rfspin 1s linear infinite; }
@keyframes rfspin { to { transform: rotate(360deg); } }
@media (max-width: 720px) { #btnRefresh .rf-t { font-size: 11px; } }
@media (max-width: 420px) { #btnRefresh .rf-t { display: none; } }
/* сводный режим: группа магазина */
.gtable tbody.g-shop tr.g-head td { background: var(--primary-soft); color: var(--primary); font-size: 13px; padding-top: 10px; padding-bottom: 8px; border-top: 2px solid var(--primary); position: static; }
.gtable tbody.g-shop tr.g-tot td, table tr.g-tot td { font-weight: 650; background: #f6f7f9; border-bottom: 1px solid var(--line, #dfe3e8); white-space: nowrap; }
.gtable tfoot td { white-space: nowrap; }
/* фирменный логотип: десктоп — горизонтальный, ≤640px — только знак; поле вокруг ≥ половины высоты кольца */
.logo-link { display: inline-flex; align-items: center; flex: none; padding: 2px 4px 2px 0; }
.logo-h { height: 36px; width: auto; display: block; }
.logo-m { height: 30px; width: 30px; display: none; }
@media (max-width: 640px) { .logo-h { display: none; } .logo-m { display: block; } }
.login-logo { display: flex; justify-content: center; padding: 8px 0 16px; }
.login-logo img { height: 150px; width: auto; }
@media (max-width: 420px) { .login-logo img { height: 120px; } }
.tile.t-stock .dl { line-height: 1.3; min-height: 0; } .tile.t-stock .dl .delta { white-space: normal; display: block; line-height: 1.3; }

/* ---------------- раздел «Отчёт» */
.v-report .bar { display: none !important; }
.rp-grid { align-items: start; }
.rp-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 8px 0 16px; }
.rp-dl dt { color: var(--muted); }
.rp-dl dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.rp-dl .rp-fn { font-weight: 400; font-size: 13px; }
.rp-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.rp-list { margin: 8px 0 16px; padding-left: 18px; display: grid; gap: 8px; }
.rp-prog { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.rp-prog .spin { display: inline-block; animation: rfspin 1s linear infinite; }
.rp-alert { margin-top: 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid #E8B4B4; background: #FDF1F1; color: #8A1F1F; font-size: 14px; line-height: 1.4; }
@media (max-width: 720px) { .rp-act .btn { flex: 1 1 auto; } #rpRun { width: 100%; } }
/* 6 разделов в шапке на 1280–1560 px: компактнее вкладки, выбор магазина и кнопка профиля (роль — в меню профиля) */
@media (max-width: 1560px) and (min-width: 1181px) {
  .tab { padding: 8px 10px; }
  .shop-sel select { max-width: 224px; }
  .top { gap: var(--s3); }
  .role { display: none; }
}
.rp-hist { list-style: none; margin: 0; padding: 0; }
.rp-hist li { display: grid; grid-template-columns: 150px 170px 110px minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.rp-hist li:last-child { border-bottom: 0; }
.rp-hist .h-msg { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.rp-hist .h-head { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: none; }
@media (max-width: 720px) {
  .rp-hist li { grid-template-columns: auto minmax(0, 1fr) auto; }
  .rp-hist li .h-msg { grid-column: 1 / -1; }
  .rp-hist li > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
  .rp-hist li .badge { white-space: nowrap; }
  .rp-hist .h-head { display: none !important; }
}
.rp-shops { list-style: none; margin: 0; padding: 0; }
.rp-shops li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.rp-shops li:last-child { border-bottom: 0; }
.rs-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 320px; }
.rs-act { display: flex; gap: 8px; flex: none; }
/* рассылка отчёта на e-mail */
.rp-mail { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 12px 0 4px; padding: 10px 12px; border-radius: 8px; background: var(--primary-soft); color: var(--text); font-size: 14px; line-height: 1.4; border: 1px solid #cddbee; }
.rp-mail.rp-alert { background: var(--yellow-bg); color: var(--yellow); border-color: #f0d9a0; }
.mail-form { display: flex; flex-direction: column; gap: 8px; }
.mail-form label:not(.chk) { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.mail-form .rp-alert { margin: 0; background: var(--yellow-bg); color: var(--yellow); border-color: #f0d9a0; }
@media (min-width: 900px) { .rp-hist.mc-log li { grid-template-columns: 110px minmax(0, 1fr) 100px minmax(0, 1.3fr); } }
.mail-form > label.chk { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; }
.mail-form > label.chk input { min-height: auto; width: auto; margin: 0; }
.mc-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }

/* ---------------- Поддержка: чат клиента, входящие владельца, кнопка «Помощь» */
:root { --brand: #005BFF; --brand-soft: #e6efff; --brand-green: #22C55E; }
.v-support .bar { display: none !important; }
.b-blue { color: var(--brand); background: var(--brand-soft); }
[data-sup-cnt] { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px;
  background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; vertical-align: 1px; }
.menu-i [data-sup-cnt] { margin-left: 8px; }
.sp-wrap { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.sp-list { padding: var(--s3); display: flex; flex-direction: column; gap: 6px; max-height: calc(100dvh - 190px); overflow-y: auto; }
.btn.primary.sp-newbtn { width: 100%; margin-bottom: 6px; background: var(--brand); border-color: var(--brand); }
.btn.primary.sp-newbtn:hover { background: #004ad1; }
.sp-item { display: grid; gap: 3px; text-align: left; width: 100%; border: 1px solid var(--divider); background: #fff; border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; min-width: 0; }
.sp-item:hover { border-color: #c7d3e6; background: var(--surface-2); }
.sp-item.on { border-color: var(--brand); background: var(--brand-soft); }
.sp-item.unr .sp-last { color: var(--text); font-weight: 600; }
.sp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.sp-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sp-sub, .sp-time { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-time { flex: none; }
.sp-last { font-size: var(--text-sm); color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.sp-meta { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--faint); }
.sp-cnt { margin-left: auto; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; }
.sp-none { margin: 8px 4px; }
.sp-filt { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.sp-filt .chip.on { background: var(--brand); border-color: var(--brand); }
.sp-filt .chip.on .muted { color: #dbe6ff; }
.sp-pane { padding: 0; display: flex; flex-direction: column; min-height: 420px; overflow: hidden; }
.sp-pane:has(.sp-msgs) { height: calc(100dvh - 190px); min-height: 520px; }
.sp-empty { margin: auto; padding: var(--s6); text-align: center; }
.sp-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--divider); }
.sp-head h3 { margin: 0; font-size: var(--text-lg); }
.sp-ht { flex: 1 1 260px; min-width: 0; }
.sp-ht h3 { overflow-wrap: anywhere; }
.sp-tools { display: flex; gap: 8px; align-items: center; }
.sp-tools select { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.sp-done { background: var(--brand-green); border-color: var(--brand-green); color: #fff; font-weight: 600; }
.sp-done:hover { background: #16a34a; }
.sp-back { display: none; }
.sp-form { padding: var(--s4); display: grid; gap: var(--s3); overflow-y: auto; }
.sp-form label { display: grid; gap: 4px; font-size: var(--text-sm); font-weight: 500; }
.sp-form select, .sp-form textarea, .sp-comp textarea, .sp-cfg input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; font-weight: 400; }
.sp-form textarea, .sp-comp textarea { resize: vertical; min-height: 44px; }
.sp-files { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; min-width: 0; }
.sp-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--grey-bg); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-chip button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 6px; color: var(--muted); }
.sp-send { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.sp-send .btn.primary, .sp-comp .btn.primary { background: var(--brand); border-color: var(--brand); }
.sp-attach { cursor: pointer; }
.sp-msgs { flex: 1 1 auto; overflow-y: auto; padding: var(--s4); display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.sp-msg { display: flex; flex-direction: column; max-width: min(78%, 640px); }
.sp-msg.me { align-self: flex-end; align-items: flex-end; }
.sp-msg.them { align-self: flex-start; align-items: flex-start; }
.sp-b { padding: 10px 14px; border-radius: 16px; box-shadow: var(--shadow); min-width: 0; max-width: 100%; }
.sp-msg.me .sp-b { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.sp-msg.them .sp-b { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.sp-txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sp-imgs:first-child { margin-top: 0; }
.sp-img img { display: block; max-width: 220px; max-height: 160px; border-radius: 8px; object-fit: cover; background: #fff; }
.sp-flink { color: inherit; text-decoration: underline; font-size: var(--text-sm); overflow-wrap: anywhere; }
.sp-t { font-size: 11px; color: var(--faint); margin-top: 3px; padding: 0 4px; }
.sp-solved { padding: 8px var(--s4); background: var(--green-bg); color: var(--green); border-top: 1px solid var(--divider); }
.sp-comp { border-top: 1px solid var(--divider); padding: var(--s3) var(--s4); display: grid; gap: 8px; background: #fff; }
.sp-comp-row { display: flex; align-items: center; gap: 8px; }
.sp-comp-row .btn.primary { margin-left: auto; flex: none; }
.sp-note { margin-top: -2px; }
.sp-cfg { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.sp-cfg label { display: grid; gap: 4px; flex: 1 1 240px; font-size: var(--text-sm); }
.section-head #spNotif { margin-left: auto; }
.fab-help { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border: 0; border-radius: 999px;
  background: var(--brand); color: #fff; font-weight: 600; font-size: var(--text-sm); cursor: pointer; box-shadow: 0 6px 18px rgba(0, 91, 255, .35); }
.fab-help:hover { background: #004ad1; }
.fab-help svg { width: 20px; height: 20px; }
.fab-help [data-sup-cnt] { background: #fff; color: var(--brand); margin-left: 0; }
@media (max-width: 720px) {
  .sp-wrap { grid-template-columns: 1fr; }
  .sp-wrap.has-pane .sp-list { display: none; }
  .sp-wrap:not(.has-pane) .sp-pane { display: none; }
  .sp-back { display: inline-flex; }
  .sp-list { max-height: none; }
  main:has(.sp-wrap.has-pane) > .section-head { display: none; }
  .sp-pane:has(.sp-msgs) { height: calc(100dvh - 150px); min-height: 400px; }
  .sp-head { gap: 6px 10px; }
  .sp-head .sp-back { order: 1; padding-left: 0; }
  .sp-head #spSt { order: 2; margin-left: auto; }
  .sp-head .sp-tools { order: 3; margin-left: auto; }
  .sp-head .sp-ht, .sp-head > h3 { order: 4; flex-basis: 100%; }
  .sp-head h3 { font-size: var(--text-base); }
  .sp-msg { max-width: 88%; }
  .sp-img img { max-width: 160px; max-height: 130px; }
  .sp-head { padding: var(--s2) var(--s3); }
  .sp-msgs, .sp-comp, .sp-form { padding: var(--s3); }
  .fab-help { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 48px; height: 48px; padding: 0; justify-content: center; opacity: .92; }
  .fab-help > span:not(.cnt) { display: none; }
  .fab-help [data-sup-cnt] { position: absolute; top: -4px; right: -4px; background: #E55353; color: #fff; }
  body.has-fab #main { padding-bottom: 150px !important; }
  body.no-bnav .fab-help { bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  .top5 th:nth-child(n+3), .top5 td:nth-child(n+3) { display: none; }
  .top5 td.name { min-width: 0; max-width: none; }
  .top5 td.name .s { max-width: 56vw; }
  .top5 td.n { white-space: nowrap; }
}

/* ---- UI2: Excel-загрузка справочников, справка, тест-метки */
.refio { margin-bottom: 16px; }
.refio-h { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.refio-h h3 { margin: 0; }
.refio label.btn { cursor: pointer; }
.refio-hist summary { cursor: pointer; color: var(--muted); margin-top: 6px; }
.refio-hist ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.refio-hist li { display: grid; grid-template-columns: 130px 110px 1fr 150px 100px; gap: 8px; align-items: center; font-size: var(--text-sm); border-top: 1px solid var(--border); padding-top: 6px; }
.refio-hist li > span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 720px) { .refio-hist li { grid-template-columns: 1fr 1fr; } }
.io-prev h4 { margin: 14px 0 6px; font-size: var(--text-sm); }
.io-cnt { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.io-cnt > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; display: grid; }
.io-cnt b { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.io-cnt span { font-size: var(--text-xs); color: var(--muted); }
.io-cnt .neg b { color: var(--red); }
@media (max-width: 520px) { .io-cnt { grid-template-columns: repeat(2, 1fr); } }
.io-err, .io-ops { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow: auto; display: grid; gap: 4px; font-size: var(--text-sm); }
.io-err li { display: grid; grid-template-columns: 80px 1fr; gap: 8px; }
.io-err li span:first-child { color: var(--muted); }
.io-ops li { display: grid; grid-template-columns: auto 60px 1fr; gap: 8px; align-items: start; border-top: 1px solid var(--border); padding-top: 4px; }
.io-d { overflow-wrap: anywhere; }
.io-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.form-row label.chk { display: flex; align-items: center; gap: 8px; min-height: 38px; }
.form-row label.chk input { width: 18px; height: 18px; }
.form-row label[hidden] { display: none; }
.inline-in { display: flex; gap: 6px; }
.inline-in input { flex: 1; min-width: 0; }
.test-badge { vertical-align: middle; margin-left: 6px; display: inline-block; padding: 1px 8px; border-radius: 10px; background: #fff4d6; color: #7a5200; font-size: 11px; font-weight: 600; line-height: 18px; }
h2 .help-btn { margin-left: 6px; vertical-align: middle; }
.help-btn { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 700; cursor: pointer; flex: 0 0 auto; line-height: 1; padding: 0; }
.help-btn:hover { color: var(--text); border-color: var(--muted); }
.help-box p, .help-box li { font-size: var(--text-sm); line-height: 1.5; }
.help-box ul { padding-left: 18px; margin: 6px 0; }
.form-row label.wide { grid-column: span 2; }
@media (max-width: 520px) { .form-row label.wide { grid-column: 1 / -1; } }
/* список отчётов */
.rl { margin-bottom: 16px; }
.rl-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.rl-list > li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); align-items: start; }
.rl-list > li.off .rl-main { opacity: .6; }
.rl-main { min-width: 0; display: grid; gap: 4px; }
.rl-t { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rl-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); }
.rl-meta b { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.rl-warn { color: var(--yellow); background: var(--yellow-bg); border-radius: 6px; padding: 4px 8px; justify-self: start; }
.rl-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rl-act .spin, .rl-meta .spin { display: inline-block; animation: rfspin 1s linear infinite; }
@media (max-width: 720px) { .rl-list > li { grid-template-columns: 1fr; } .rl-act { justify-content: flex-start; } .rl-act .btn { flex: 1 1 auto; } }
.rl-form { display: grid; gap: 10px; }
.rl-form label { display: grid; gap: 4px; font-size: var(--text-sm); }
.rl-form label.chk { display: flex; align-items: center; gap: 8px; }
.rl-form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px 12px; display: grid; gap: 8px; margin: 0; }
.rl-form legend { font-size: var(--text-xs); color: var(--muted); padding: 0 4px; }
.rl-days { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.rl-form textarea { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-sizing: border-box; }
/* карточка магазина (Тест) */
.shop-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px;margin-bottom:16px}
.shop-card .sc-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.shop-card h3{margin:0;overflow-wrap:anywhere}
.sc-dl{display:grid;grid-template-columns:auto 1fr;gap:6px 12px;margin:10px 0 0;font-size:13px}
.sc-dl dt{color:var(--muted,#667)}.sc-dl dd{margin:0;overflow-wrap:anywhere}
/* главная (Тест): сегодня по часам, ТОП-5 дня, структура маржи */
.sum-row.tst { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.td-kpi { display: flex; gap: 24px; flex-wrap: wrap; margin: 8px 0; }
.td-kpi > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.td-kpi b { font-size: 20px; }
.td-top { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.td-top li { min-width: 0; }
.td-top .t { font-weight: 600; overflow-wrap: anywhere; }
.td-top .s { font-size: 12px; color: var(--muted, #667); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-top .n { font-size: 13px; font-variant-numeric: tabular-nums; }
#mmCard { margin-bottom: var(--s4); }
table.mm td, table.mm th { white-space: nowrap; }
@media (max-width: 900px) { .sum-row.tst { grid-template-columns: 1fr; } }
/* полное название товара переносится, без многоточия */
td.name.wrap { max-width: 560px; }
td.name.wrap .s { white-space: normal; overflow: visible; text-overflow: clip; max-width: none; overflow-wrap: anywhere; }
.td-top .s { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.top5 td.name .s { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
/* справочники: группа → справочник; Excel ▾ в шапке */
.ref-nav { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin-bottom: var(--s4); }
.ref-nav .subtabs { margin-bottom: 0; flex: 1 1 auto; }
.ref-tools { margin-left: auto; }
.refio.dd { position: relative; margin: 0; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 340px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; }
.dd-it { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 8px 10px; cursor: pointer; font: inherit; font-weight: 500; color: inherit; }
.dd-it:hover, .dd-it:focus-visible { background: var(--primary-soft); }
.dd-st { border-top: 1px solid var(--border); margin-top: 4px; padding: 8px 10px 4px; overflow-wrap: anywhere; }
.dd-menu .refio-hist { padding: 0 10px 6px; }
.dd-menu .refio-hist li { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .ref-nav .seg { width: 100%; } .ref-nav .seg button { flex: 1; } .ref-tools { margin-left: 0; } .dd-menu { left: 0; right: auto; } }
/* По месяцам: на телефоне — карточка на месяц вместо широкой таблицы */
.mm-m { display: none; }
.mm-c { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 8px; background: #fff; }
.mm-c.fc { border-style: dashed; }
.mm-ch { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.mm-c .kv { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: var(--text-sm); }
@media (max-width: 720px) {
  #mmCard .table-wrap { display: none; }
  .mm-m { display: block; }
  .subnav { flex-wrap: wrap; overflow-x: visible; }
  /* справочники: строки таблиц — карточками, подписи колонок слева */
  #refBody .table-wrap { max-height: none; overflow: visible; border: 0; background: none; }
  #refBody table, #refBody tbody, #refBody tr, #refBody td { display: block; width: 100%; }
  #refBody thead { display: none; }
  #refBody tr { border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; padding: 8px 12px; margin-bottom: 8px; }
  #refBody td { border: 0; padding: 3px 0; text-align: right; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 0; overflow-wrap: anywhere; }
  #refBody td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; flex: none; max-width: 45%; }
  #refBody td[data-l=""]::before, #refBody td.empty::before { content: none; }
  #refBody td[data-l=""] { justify-content: flex-end; }
  #refBody td.name { display: block; max-width: none; min-width: 0; text-align: left; }
  #refBody td.name::before { content: none; }
  #refBody td.empty { justify-content: center; }
}
/* По месяцам: ₽ и доля от выручки в одной ячейке */
table.mm .mm-p { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
table.mm tr.mm-top td, table.mm tr.mm-tot td { background: #f6f7f9; }
table.mm th.mm-fc, table.mm td:last-child { border-left: 1px dashed var(--border); }
table.mm td:first-child { white-space: normal; min-width: 180px; }
.mm-c .mm-p { color: var(--muted); font-size: 11px; }
.sm-h { margin: 14px 0 4px; font-size: var(--text-sm); }
#smForm .form-row { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }

.check-warn{margin:8px 16px 0;padding:10px 14px;border-radius:8px;background:var(--yellow-bg);color:var(--text,inherit);border-left:3px solid var(--yellow);font-size:13px;line-height:1.45}
.check-warn .cw-row+.cw-row{margin-top:4px}
.check-warn .cw-err{color:var(--red)}

/* «Настройки → Кабинеты» (только владелец) */
.v-cabinets .bar { display: none !important; }
.cab-desk table td { vertical-align: top; }
.cab-desk { max-height: none; }
.cab-adm { display: flex; flex-direction: column; line-height: 1.35; margin-bottom: 4px; }
.cab-adm span { font-size: var(--text-xs); color: var(--muted); overflow-wrap: anywhere; }
.cab-shop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.cab-off { margin-top: var(--s4); }
.cab-off > summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 8px 0; }
.cab-off > .cab-desk, .cab-off > .cab-mob { margin-top: 8px; }
.cab-ih { margin-top: 28px; align-items: center; }
.cab-note { margin: 0 0 12px; }
.cab-mob { display: none; }
.cab-card { margin-bottom: 12px; }
.cab-ch { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.cab-dl { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 6px 10px; margin: 0; font-size: var(--text-sm); }
.cab-dl dt { color: var(--muted); }
.cab-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.cab-cf { display: flex; justify-content: flex-end; margin-top: 10px; }
.cab-lbl { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.inv-code { font: 600 22px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; text-align: center; padding: 14px; margin: 12px 0;
  border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2); user-select: all; overflow-wrap: anywhere; }
@media (max-width: 720px) { .cab-desk { display: none; } .cab-mob { display: block; } .cab-cf .btn { width: 100%; } }
/* шапка: кнопка «Настройки» рядом с именем */
.btn-set { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.btn-set svg { width: 18px; height: 18px; flex: none; }
.btn-set:hover, .btn-set[aria-current="page"] { color: var(--primary); }
.btn-set[aria-current="page"] { background: var(--primary-soft); }
@media (max-width: 1180px) { .btn-set .set-t, .role { display: none; } .top-right .btn-set { padding: 6px; } }
/* кнопки «Скачать (…)»: на телефоне текст переносится, а не обрезается */
@media (max-width: 720px) { .rp-act .btn, .rl-act .btn, .rs-act .btn { white-space: normal; text-align: center; } .dd-it { white-space: normal; } .rs-act { flex: 1 1 auto; flex-wrap: wrap; } }
@media (max-width: 960px) and (min-width: 721px) { .upd { display: none; } .shop-sel select { max-width: 140px; } .top { padding-left: var(--s3); padding-right: var(--s3); } }
/* жёлтый баннер уведомлений над разделами: весь текст и ссылки — тёмно-красные и жирные, фон прежний; строка ошибки .cw-err — без изменений */
.check-warn { color: #B00020; font-weight: 600; }
.check-warn b { font-weight: 700; }
.check-warn a { color: #B00020; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.check-warn .cw-err { font-weight: 400; }

/* партии закупки в «Товарах»: значок «N партии», ▸ и строки партий */
.bt-pill { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px; background: #e8f0fb; color: #1f4e8c; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.bt-pn { display: flex; align-items: flex-start; gap: 6px; }
.bt-pn .bt-tog { background: none; border: 0; padding: 0; min-height: auto; cursor: pointer; font-size: 14px; color: var(--muted); line-height: 1.4; }
.bt-row td { background: #f8fafc; font-size: 0.95em; }
.bt-row td.name { padding-left: 34px; }
.bt-row .t { font-weight: 400; white-space: nowrap; }
.bt-tag { font-size: var(--text-xs); color: var(--muted); font-weight: 400; }
.bt-row .bt-tag { display: block; white-space: normal; }

/* восстановление доступа (v37) */
.lg-forgot { margin: calc(-1 * var(--s2)) 0 0; text-align: right; }
.ok-msg { margin: 0; padding: 10px 12px; border-radius: 8px; background: #e7f6ec; color: #1f6b3a; font-size: var(--text-sm); line-height: 1.4; }
.login-card .ok-msg[hidden] { display: none; }
/* сноска к «Заказано по цене реализации*» внизу главной */
.fnote { margin: var(--s2) 2px var(--s4); color: var(--muted); font-size: var(--text-xs); line-height: 1.5; }

/* юридические ссылки: форма регистрации и подвал */
.login-card label.chk { display: flex; align-items: flex-start; gap: 8px; color: var(--text); font-size: var(--text-sm); line-height: 1.4; }
.login-card label.chk input { min-height: 0; width: 16px; height: 16px; margin: 2px 0 0; flex: none; }
.legal-links { margin: 0; line-height: 1.5; }
.legal-foot { max-width: 1600px; margin: 0 auto; padding: var(--s4) var(--s6) var(--s6); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); color: var(--muted); font-size: var(--text-xs); }
.legal-foot a { color: var(--muted); }
.legal-foot a:hover { color: var(--primary); }
