:root {
  --bg: #F6F6F4; --surface: #FFFFFF; --surface-2: #FAFAF8; --muted-bg: #F1F1EE;
  --ink: #111113; --ink-2: #4A4A52; --muted: #66666E; --faint: #A1A1A8;
  --line: #E7E7E3; --line-2: #EFEFEC; --line-3: #DCDCD7;
  --accent: #5B21B6; --accent-bg: #F1ECFB; --accent-line: #5B21B6;
  --warn: #9A3412; --warn-bg: #FDF3E7; --run: #1D4ED8; --run-bg: #EAF0FE; --ok: #15803D;
  --btn: #111113; --btn-ink: #FFFFFF; --live-bg: #111113; --live-ink: #FFFFFF; --live-muted: #C9C9CF;
  --hatch-1: #E4E4E0; --hatch-2: #F6F6F4;
  --shadow: 0 1px 2px rgba(17,17,19,.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0E10; --surface: #17171A; --surface-2: #1B1B1F; --muted-bg: #232327;
    --ink: #F2F2F3; --ink-2: #C9C9CF; --muted: #A1A1A8; --faint: #6E6E76;
    --line: #26262B; --line-2: #232327; --line-3: #33333A;
    --accent: #C4B1F7; --accent-bg: #2A2140; --accent-line: #9B7FEA;
    --warn: #F5A97F; --warn-bg: #3A2416; --run: #93B4FA; --run-bg: #172440; --ok: #4ADE80;
    --btn: #F2F2F3; --btn-ink: #0E0E10; --live-bg: #1C1726; --live-ink: #F2F2F3; --live-muted: #A1A1A8;
    --hatch-1: #2A2A2F; --hatch-2: #17171A;
    --shadow: 0 1px 2px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: Onest, system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
button, input, select { font: inherit; color: inherit; }
.tn { font-variant-numeric: tabular-nums; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* шапка */
.top { height: 60px; display: flex; align-items: center; gap: 32px; padding: 0 48px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: var(--bg);
  display: flex; align-items: center; justify-content: center; }
.brand b { font-size: 16px; }
.brand small { white-space: nowrap; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.nav { display: flex; gap: 4px; }
.nav a { font-size: 14px; font-weight: 500; text-decoration: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); }
.nav a.on { background: var(--muted-bg); color: var(--ink); }
.nav a:hover { color: var(--ink); }
.grow { flex-grow: 1; }
.api-state { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--faint); flex-shrink: 0; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--warn); }
.dry { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }

.page { max-width: 1440px; margin: 0 auto; padding: 32px 48px 64px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.025em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { text-decoration: none; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 10px; border: 0; background: var(--btn); color: var(--btn-ink); font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { opacity: .88; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-3); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.big { min-height: 52px; font-size: 15px; border-radius: 12px; width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:focus-visible, .seg button:focus-visible, .tab:focus-visible, input:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--muted-bg); flex-wrap: wrap; }
.seg button { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 0; background: transparent;
  color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg label { display: flex; cursor: pointer; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span { min-height: 36px; padding: 0 14px; border-radius: 8px; display: flex; align-items: center;
  color: var(--ink-2); font-size: 13px; font-weight: 600; }
.seg label input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg label input:focus-visible + span { outline: 2px solid var(--accent-line); outline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.pad { padding: 20px 24px; }
.card h2 { font-size: 17px; font-weight: 600; }
.card h3 { font-size: 15px; font-weight: 600; }
.sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.pill { display: inline-flex; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill-run { background: var(--run-bg); color: var(--run); }
.pill-win { background: var(--accent-bg); color: var(--accent); }
.pill-low { background: var(--warn-bg); color: var(--warn); }
.pill-done, .pill-plan { background: var(--muted-bg); color: var(--ink-2); }

.badge { display: inline-flex; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; }
.badge.leader { background: var(--accent-bg); color: var(--accent); }
.badge.worse { background: var(--warn-bg); color: var(--warn); }
.badge.same, .badge.nodata { background: var(--muted-bg); color: var(--ink-2); }


/* ===== Принты ===== */
:root { --good: #15803D; --good-bg: #E7F5EC; --bad: #B91C1C; --bad-bg: #FDECEC; --warn-2: #A16207; --warn-2-bg: #FEF6DA; }
@media (prefers-color-scheme: dark) {
  :root { --good: #4ADE80; --good-bg: #12301E; --bad: #F87171; --bad-bg: #3A1616; --warn-2: #FACC15; --warn-2-bg: #33290C; }
}
.t-good { --c: var(--good); --cb: var(--good-bg); }
.t-bad { --c: var(--bad); --cb: var(--bad-bg); }
.t-warn { --c: var(--warn-2); --cb: var(--warn-2-bg); }
.t-neutral { --c: var(--ink-2); --cb: var(--muted-bg); }
.demo { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); }
.seg a { min-height: 36px; padding: 0 14px; border-radius: 8px; display: flex; align-items: center; color: var(--ink-2);
  font-size: 13px; font-weight: 600; text-decoration: none; }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.note { font-size: 13px; color: var(--muted); }
.note b { color: var(--ink-2); font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi .v { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.kpi .l { font-size: 13px; color: var(--muted); }

.sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: -8px; }
.sec-head h2 { font-size: 20px; font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; text-decoration: none; position: relative;
  border-left: 4px solid var(--c); }
.tile:hover { background: var(--surface-2); }
.tile .n { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--c); }
.tile .t { font-size: 15px; font-weight: 600; }
.tile .x { font-size: 13px; color: var(--muted); line-height: 1.4; }
.tile.zero .n { color: var(--faint); }
.dist { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.dist i { display: block; background: var(--c); min-width: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* список */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.input { min-height: 40px; padding: 0 12px; border: 1px solid var(--line-3); border-radius: 10px; background: var(--surface);
  font-size: 14px; }
.toolbar .input { width: auto; max-width: 100%; }
.toolbar input.input { width: 260px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 6px; white-space: nowrap;
  border-bottom: 1px solid var(--line-2); cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface); }
.tbl th.l, .tbl td.l { text-align: left; }
.tbl th.sorted { color: var(--ink); }
.tbl th.sorted::after { content: ' ↓'; }
.tbl th.sorted.asc::after { content: ' ↑'; }
.tbl td { padding: 10px 6px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.tbl tr { content-visibility: auto; contain-intrinsic-size: auto 70px; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .ph { width: 44px; padding-right: 0; }
.ph img, .ph .noimg { width: 40px; height: 53px; border-radius: 6px; object-fit: cover; display: block; background: var(--muted-bg); }
.tbl .name { min-width: 168px; max-width: 240px; white-space: normal; }
.tbl td.l .flags { margin-top: 0; min-width: 120px; max-width: 176px; }
.tbl .name > a { text-decoration: none; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tbl .name > a:hover { text-decoration: underline; }
.tbl .name .meta { margin-top: 3px; }
.tbl .sub-v { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.pill.cat { background: var(--cb); color: var(--c); }
.flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.flag { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px; background: var(--cb); color: var(--c); white-space: nowrap; }
.neg { color: var(--bad); } .pos { color: var(--good); }
.more-row td { text-align: center; padding: 16px; }

/* страница принта */
.dz-head { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
/* размеры фото заданы явно: Safari на iPhone не резервирует высоту по aspect-ratio в сетке, и текст наезжал на фото */
.dz-photo { width: 260px; height: 347px; border-radius: 16px; overflow: hidden; background: var(--muted-bg); }
.dz-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dz-info { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dz-info h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.links { display: flex; gap: 10px; flex-wrap: wrap; }
.verdict { padding: 18px 20px; border-left: 4px solid var(--c); display: flex; flex-direction: column; gap: 6px; }
.verdict .t { font-size: 18px; font-weight: 700; color: var(--c); }
.verdict .x { color: var(--ink-2); font-size: 14px; }
.verdict .why { font-size: 13px; color: var(--muted); white-space: pre-line; }
.flag-list { display: flex; flex-direction: column; gap: 8px; }
.flag-list .flag { font-size: 12px; }
.flag-list div { display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.facts div { padding: 14px 16px; }
.facts b { display: block; font-size: 20px; margin-top: 4px; }
.facts small { font-size: 12px; color: var(--muted); }
.chart { padding: 8px 20px 16px; }
.chart svg { width: 100%; height: 160px; display: block; }
.chart rect.bar { fill: var(--ink-2); opacity: .75; }
.chart rect.bar:hover { opacity: 1; fill: var(--accent-line); }
.chart .axis { font-size: 11px; fill: var(--muted); }

/* настройки */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.fset { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.frow { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 14px; }
.frow label { color: var(--ink-2); }
.frow .unit { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.frow .input { width: 96px; text-align: right; }
.ok-msg { font-size: 14px; color: var(--good); font-weight: 600; }
.jobs { display: flex; flex-direction: column; }
.job { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 20px; border-top: 1px solid var(--line-2); font-size: 14px; }
.job .e { grid-column: 1 / -1; font-size: 12px; color: var(--bad); word-break: break-word; }

/* вход */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .card { width: 360px; max-width: 100%; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.err { color: var(--bad); font-size: 14px; }

@media (max-width: 900px) {
  .top { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 8px 12px; }
  .top .nav { order: 3; width: 100%; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .toolbar input.input { width: 100%; }
  .brand small { display: none; }
  .page { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 26px; }
  .kpis, .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dz-head { display: flex; flex-direction: column; gap: 16px; }
  .dz-photo { width: 180px; height: 240px; flex: none; }
}
.meta { font-size: 12px; color: var(--muted); }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.tokrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line-2); }
.tokrow .tokinfo { flex: 1 1 320px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.tokrow .tokinfo b { color: var(--ink); font-weight: 600; }
.tokrow .input { flex: 1 1 260px; }
.tbl th.c, .tbl td.c { text-align: center; }
.adi { display: inline-flex; vertical-align: middle; }
.adi-on circle:first-child { fill: var(--good); }
.adi-money circle:first-child { fill: #D97706; }
.adi-pause circle:first-child { fill: var(--faint); }
.adi-none circle { fill: var(--bad); }
.adline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-right: 8px; }
.ph img { cursor: zoom-in; }
.zoom-pop { position: fixed; z-index: 50; width: 270px; height: 360px; border-radius: 14px; overflow: hidden; pointer-events: none;
  background: var(--muted-bg); box-shadow: 0 12px 32px rgba(17,17,19,.22), 0 0 0 1px var(--line); }
.zoom-pop img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tbl .sub-v.neg { color: var(--bad); }
.nowrap { white-space: nowrap; }
button.copy { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: 2px;
  padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--faint); cursor: pointer; vertical-align: -4px; opacity: .7; }
button.copy:hover { color: var(--ink-2); background: var(--muted-bg); opacity: 1; }
button.copy:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
button.copy.done { color: var(--good); opacity: 1; }
button.copy.done svg { display: none; }
button.copy.done::after { content: '✓'; font-size: 13px; font-weight: 700; }
.tbl th[data-n]::after { content: ' ↓' attr(data-n); }
.tbl th.asc[data-n]::after { content: ' ↑' attr(data-n); }
.tbl th { user-select: none; }
.sort-hint { font-size: 12px; color: var(--faint); }
@media (max-width: 900px) { .sort-hint { display: none; } }
.days-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: -8px; }
.chart rect.bar-orders { fill: var(--good); opacity: .8; }
.tn-note { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.empty-groups { margin-top: -8px; }
.alert { background: var(--bad-bg); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent);
  border-radius: 14px; padding: 14px 18px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.alert b { font-weight: 700; }
.alert ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.alert a { color: var(--bad); font-weight: 600; }
.print-total { display: flex; gap: 8px 16px; align-items: baseline; flex-wrap: wrap; padding: 14px 20px; margin-bottom: -8px; }
.print-total b { font-size: 18px; }
.minv { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.toolbar .minv input.input { width: 90px; }
.toolbar select.input { max-width: 210px; }
.adi-silent circle { stroke: var(--good); }
.adi-silent path { stroke: var(--good); }
.adi-nostock circle { fill: #7C6A55; }
@media (prefers-color-scheme: dark) { .adi-nostock circle { fill: #A08B72; } }
.facts small.blk { display: block; }
button.tag-btn { border: 0; font-family: inherit; line-height: inherit; cursor: pointer; }
button.tag-btn:hover { filter: brightness(.95); box-shadow: 0 0 0 1px currentColor inset; }
button.tag-btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.why-pop { position: fixed; z-index: 60; width: 380px; max-width: calc(100vw - 16px); background: var(--surface);
  border: 1px solid var(--line-3); border-top: 3px solid var(--c, var(--ink)); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(17,17,19,.18); padding: 12px 14px 14px; font-size: 13px; line-height: 1.45; }
.why-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.why-head b { color: var(--c, var(--ink)); font-size: 14px; }
.why-x { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.why-x:hover { color: var(--ink); }
.why-body p { margin: 0 0 8px; color: var(--ink-2); }
.why-body p:last-child { margin-bottom: 0; }
.why-rule { color: var(--muted) !important; font-size: 12px; }
.flag-list div > span:last-child { white-space: pre-line; }
.pw-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0 6px; }
.pw-form .field { flex: 1 1 200px; }
.float-head { position: fixed; z-index: 9; overflow: hidden; background: var(--surface);
  box-shadow: 0 3px 8px rgba(17,17,19,.08); }
.float-head .tbl th { position: static; }
/* поиск в шапке */
.hsearch .input { width: 250px; min-height: 36px; font-size: 13px; }
/* предварительная оценка по более длинному периоду — пунктирный тег */
.flag.lean { background: transparent; box-shadow: 0 0 0 1px var(--c) inset; border: 0; }
.flag.lean::before { content: '≈ '; }
/* «Фото» и «Принт» закреплены слева, когда таблица прокручивается вбок */
.tbl .ph { width: 46px; min-width: 46px; max-width: 46px; }
.tbl .stick { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.tbl .stick2 { left: 46px; }
.tbl thead th.stick { z-index: 3; }
.tbl tbody tr:hover td.stick { background: var(--surface-2); }
.tbl-wrap.scrolled .stick2 { box-shadow: 8px 0 8px -8px rgba(17,17,19,.25); }
.float-head .tbl th.stick { position: relative; left: 0; z-index: 2; }  /* в копии сдвигаем через transform */
/* остатки по дням */
.chart rect.bar-stock { fill: var(--faint); opacity: 1; }
.chart rect.bar-stock.out { fill: var(--bad); }
@media (max-width: 900px) {
  .hsearch { order: 4; width: 100%; }
  .hsearch .input { width: 100%; }
}
.chart rect.out-bg { fill: var(--bad-bg); }
/* рекомендации на главной */
.recs { display: flex; flex-direction: column; gap: 14px; }
.rec { padding: 18px 20px; border-left: 4px solid var(--c); display: flex; flex-direction: column; gap: 12px; }
.rec-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-head h3 { font-size: 17px; font-weight: 700; }
.rec-n { width: 28px; height: 28px; border-radius: 8px; background: var(--c); color: var(--surface); font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.rec-lead { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 920px; }
.rec-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--cb); }
.chip small { font-size: 11px; color: var(--muted); }
.chip b { font-size: 16px; color: var(--c); }
.rec-stack .stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.rec-stack .stack i { display: block; min-width: 3px; background: var(--c); }
.rec-stack .legend { margin-top: 8px; }
/* Строки — части одной сетки (subgrid): «что сделать» и полоски стоят ровными столбцами, как бы ни различался текст */
.rec-items { list-style: none; margin: 0; padding: 0; display: grid; column-gap: 14px;
  grid-template-columns: 40px minmax(0, 1.3fr) max-content minmax(170px, 1fr); }
.rec-items li { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line-2); }
@supports not (grid-template-columns: subgrid) {
  .rec-items li { grid-template-columns: 40px minmax(0, 1.3fr) 180px minmax(170px, 1fr); column-gap: 14px; }
}
.ri-photo { width: 40px; height: 53px; border-radius: 6px; overflow: hidden; background: var(--muted-bg); display: block; }
.ri-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ri-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ri-name { font-weight: 600; font-size: 14px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-name:hover { text-decoration: underline; }
.ri-note { font-size: 12px; color: var(--muted); }
.ri-bar { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-2); }
.rbar { position: relative; height: 8px; border-radius: 4px; background: var(--line-2); }
.rbar i { display: block; height: 100%; border-radius: 4px; background: var(--c); }
.rbar b { position: absolute; top: -3px; width: 2px; height: 14px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.ri-action { justify-self: start; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--cb); color: var(--c); white-space: nowrap; }
@media (max-width: 700px) {
  .rec { padding: 16px; }
  .rec-items { grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; }
  .rec-items li { row-gap: 6px; }
  .ri-bar, .ri-action { grid-column: 2; }
  .ri-action { justify-self: start; }
}
/* оттенки внутри одного цвета: звёзды светлее лидеров, «мало данных» и новинки — бледнее */
.rec-stack .stack i.k-star, .rec-stack .legend .k-star::before { opacity: .6; }
.rec-stack .stack i.k-few, .rec-stack .legend .k-few::before, .rec-stack .stack i.k-new, .rec-stack .legend .k-new::before { opacity: .45; }
@media (max-width: 700px) {
  .rec-head .btn { white-space: normal; text-align: left; justify-content: flex-start; width: 100%; }
}

/* Галочки статусов над таблицей: снятая убирает принты с этим статусом; снятая — без заливки, серым */
.st-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 20px 0; }
.st-opt { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px 0 8px; border-radius: 999px;
  background: var(--cb); color: var(--c); font-size: 12px; font-weight: 600; cursor: pointer; user-select: none; }
.st-opt input { accent-color: var(--c); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.st-opt .tn { font-weight: 500; opacity: .7; }
.st-opt.off { background: transparent; box-shadow: 0 0 0 1px var(--line-3) inset; color: var(--muted); }
.st-opt:has(input:focus-visible) { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.st-all { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
/* На телефоне — одной строкой с прокруткой вбок, чтобы таблица не уезжала вниз; «Вернуть все» — в начале строки */
@media (max-width: 720px) {
  .st-filter { flex-wrap: nowrap; overflow-x: auto; padding: 12px 16px 2px; scrollbar-width: none; }
  .st-filter::-webkit-scrollbar { display: none; }
  .st-filter > * { flex: none; }
  .st-filter .note { order: -2; }
  .st-all { order: -1; }
}
@supports not (grid-template-columns: subgrid) {
  @media (max-width: 700px) { .rec-items li { grid-template-columns: 40px minmax(0, 1fr); gap: 6px 12px; } }
}
/* Название на странице принта — ссылка на его кампании в кабинете продвижения WB */
.cmp-link { color: inherit; text-decoration: none; }
.cmp-link:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.cmp-link .ext { margin-left: 8px; vertical-align: 0.1em; color: var(--faint); }
.cmp-link:hover .ext { color: var(--accent); }
.rec-more-wrap { display: flex; justify-content: center; padding-top: 12px; border-top: 1px solid var(--line-2); }
/* Значок WB рядом с артикулом — ссылка на кампании в кабинете продвижения. Серый и полупрозрачный, как иконка
   копирования, — в цветах WB только при наведении. Градиент фоном, не в SVG: градиент внутри SVG пропадает
   у всех значков, если первая строка таблицы скрыта фильтром */
.wb-link { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 3px;
  border-radius: 4px; vertical-align: -3px; text-decoration: none; background: var(--faint); opacity: .55; }
.wb-link:hover, .wb-link:focus-visible { opacity: 1;
  background: radial-gradient(circle at 15% 110%, #FF7A3D 0%, rgba(255, 122, 61, 0) 55%), linear-gradient(135deg, #7B2CFF 0%, #A92BF0 60%, #D63AB4 100%); }
.wb-link:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
/* Плашки-фильтры в рекомендациях: нажатая — с рамкой, остальные бледнее */
.chip-f { border: 0; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.chip-f:hover { box-shadow: 0 0 0 1px var(--c) inset; }
.chip-f[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--c) inset; }
.rec-chips.filtering .chip-f[aria-pressed="false"] { opacity: .55; }
.chip-f:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
/* Плавающий переключатель периода у правого края — когда верхний ушёл за экран */
.period-float { position: fixed; right: 12px; top: 50%; transform: translateY(-50%); z-index: 40; display: flex; flex-direction: column;
  gap: 2px; padding: 4px; border-radius: 12px; background: var(--muted-bg); box-shadow: 0 2px 12px rgba(17, 17, 19, .12); }
.period-float a { padding: 7px 8px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; text-align: center; white-space: nowrap; }
.period-float a:hover { color: var(--ink); }
.period-float a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
@media (max-width: 700px) {
  .period-float { top: auto; bottom: 12px; right: 50%; transform: translateX(50%); flex-direction: row; }
  .period-float a { padding: 8px; }
}
.period-float.loading { opacity: .55; pointer-events: none; }
/* Чужие кампании на странице принта — свёрнуты, чтобы не заслонять свои */
.foreign-camps { border-top: 1px solid var(--line-2); }
.foreign-camps > summary { padding: 14px 20px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.foreign-camps > summary:hover { color: var(--ink); }
.foreign-camps > .note { margin: 0 20px 12px; }
/* Место под плавающий переключатель периода справа: на экранах, где у страницы нет свободного поля по бокам */
@media (min-width: 701px) and (max-width: 1639px) {
  body:has(.page-head .seg) .page { padding-right: 96px; }
}
/* Абзацы прямо в колонке страницы: расстояние задаёт колонка, свои отступы только добавляли пустоту */
.page > p:not(.empty-groups) { margin-top: 0; margin-bottom: 0; }
.page > p.empty-groups { margin-bottom: 0; }
/* Настройки: пороги под замком, список изменений перед сохранением, история */
.set-form { display: flex; flex-direction: column; gap: 16px; }
.set-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.set-bar > span { display: inline-flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.set-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.set-fields:disabled .input { background: var(--surface-2); color: var(--ink-2); cursor: not-allowed; }
.frow { flex-wrap: wrap; }
.frow.bad .input { border-color: var(--bad); }
.frow-err { flex-basis: 100%; text-align: right; font-size: 12px; }
.set-confirm ul { margin: 10px 0 14px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.set-confirm h3 { margin: 0; }
.set-log { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.set-log li { display: flex; gap: 6px 12px; align-items: baseline; flex-wrap: wrap; }
.set-log li > span:nth-child(2) { flex: 1 1 320px; }
.set-undo { display: inline; }
/* Заполненный фильтр списка — с заметной рамкой: он сохраняется при смене периода */
.toolbar .input.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
/* Значок WB в начале строки с артикулами на странице принта */
.dz-ids .dz-line { display: block; }
.dz-ids .dz-line > .wb-link:first-child { margin: 0 8px 0 0; vertical-align: -2px; }
/* Фильтры «от — до» над столбцами списка */
.tbl thead tr.rng-row th { padding: 8px 4px 2px; cursor: default; border-bottom: 0; vertical-align: top; }
.tbl thead tr.rng-row th.rng-c { min-width: 64px; }
.rng-i { display: block; width: 100%; min-width: 0; min-height: 26px; height: 26px; padding: 0 6px; font-size: 12px; border-radius: 7px; text-align: left; }
.rng-i + .rng-i { margin-top: 4px; }
.rng-i.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
/* Поиск — в строке фильтров над столбцами «Принт» и «Статус» */
.tbl thead tr.rng-row th.q-cell { vertical-align: bottom; padding-right: 12px; }
.q-cell .input { width: 100%; max-width: 360px; }
/* Счётчик принтов вместо номера — у карточек групп на главной */
.rec-n.cnt { width: auto; min-width: 28px; padding: 0 8px; }
