:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6;
  --s2: #eb6834;
  --fact: #0b0b0b;
  --accent: #2a78d6;
  --good: #006300;
  --critical: #d03b3b;
  --warn-bg: #fff6e0;
  --warn-border: #f0d48a;
  --wash: rgba(42, 120, 214, 0.10);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
    --s1: #3987e5; --s2: #d95926; --fact: #f0efec; --accent: #3987e5; --good: #0ca30c; --critical: #e66767;
    --warn-bg: #2a2410; --warn-border: #5c4b16; --wash: rgba(57, 135, 229, 0.12);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
  --s1: #3987e5; --s2: #d95926; --fact: #f0efec; --accent: #3987e5; --good: #0ca30c; --critical: #e66767;
  --warn-bg: #2a2410; --warn-border: #5c4b16; --wash: rgba(57, 135, 229, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.top { padding: 40px 0 8px; }
.eyebrow { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; }
h1 { margin: 0; font-size: clamp(28px, 5vw, 40px); line-height: 1.15; letter-spacing: -0.01em; }
.lede { margin: 10px 0 18px; font-size: 18px; color: var(--ink-2); max-width: 720px; }
.banner {
  background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; max-width: 860px;
}
.toc { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 18px 0 0; font-size: 15px; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.section { padding: 28px 0 8px; scroll-margin-top: 12px; }
h2 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.005em; }
h3 { font-size: 17px; margin: 0; }
.section-lede { margin: 0 0 14px; color: var(--ink-2); max-width: 760px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin: 0 0 16px; min-width: 0;
}
.card-head { margin-bottom: 10px; }
.sub { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.label { margin: 0; color: var(--ink-2); font-size: 14px; }
.note { color: var(--ink-2); font-size: 14px; max-width: 820px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > .card, .stack > .card { margin: 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 24px; align-items: center; }
.hero-value { margin: 2px 0 0; font-size: clamp(48px, 9vw, 64px); font-weight: 650; line-height: 1.05; letter-spacing: -0.02em; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { border-left: 1px solid var(--grid); padding-left: 14px; min-width: 0; }
.tile-value { margin: 2px 0 0; font-size: 28px; font-weight: 600; line-height: 1.15; }
.select-label select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; max-width: 100%; margin-top: 4px;
}
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .tile { border-left: 0; border-top: 1px solid var(--grid); padding: 10px 0 0; }
}

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--ink-2); margin: 0 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key-line { width: 16px; height: 2px; border-radius: 1px; display: inline-block; }
.key-rect { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { width: 100%; position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart .val { fill: var(--ink-2); }
.chart .bar:hover, .chart .bar:focus { opacity: 0.8; outline: none; }

.tooltip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); min-width: 140px;
}
.tooltip .tt-title { color: var(--ink-2); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; }
.tooltip .tt-row span:last-child { color: var(--ink-2); }

.table-view { margin-top: 8px; font-size: 14px; }
.table-view summary { cursor: pointer; color: var(--ink-2); }
.scroll { overflow-x: auto; }
.scroll.tall { max-height: 520px; overflow-y: auto; }
/* Лист координатора на телефоне: каждая точка — карточка, без прокрутки вбок и внутри прокрутки */
@media (max-width: 600px) {
  #city-table.scroll.tall { max-height: none; overflow: visible; }
  #city-table table, #city-table tbody, #city-table td { display: block; width: 100%; }
  #city-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #city-table tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
  #city-table tr.day-break { border-top: 2px solid var(--border); }
  #city-table td { border: 0; padding: 2px 0; text-align: left; white-space: normal; }
  #city-table td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
  #city-table td[data-label="Магазин"] { grid-column: 1 / -1; order: -1; font-weight: 600; }
  #city-table td[data-label="Магазин"]::before, #city-table td[data-label="День"]::before, #city-table td[data-label="Часы"]::before { display: none; }
  #city-table td[data-label="День"], #city-table td[data-label="Часы"] { order: -1; color: var(--ink-2); }
  #city-table td[data-label="День"] + td[data-label="Часы"] { grid-column: span 2; }
  #city-table td[data-label^="Людей"]::before { content: "Людей"; }
  #city-table td[data-label^="Людей"] { font-weight: 600; }
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
th { color: var(--ink-2); font-weight: 500; position: sticky; top: 0; background: var(--surface); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .muted { color: var(--muted); }
.up { color: var(--good); }
.down { color: var(--critical); }
.inline-bar { display: inline-block; height: 8px; border-radius: 4px; background: var(--s1); vertical-align: middle; margin-right: 6px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap; }

.download { display: inline-block; margin-top: 10px; font-size: 14px; }

.ab { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; }
@media (max-width: 860px) { .ab { grid-template-columns: minmax(0, 1fr); } }
.ab-form { display: grid; gap: 14px; }
.ab-form label { display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.ab-form output { color: var(--ink); font-weight: 600; }
.ab-form input[type="range"] { width: 100%; accent-color: var(--accent); }
.ab-form select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.ab-src { margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 8px; font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.btn-sm { padding: 4px 10px; font-size: 14px; border-radius: 8px; }
.ab-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ab-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .ab-compare { grid-template-columns: 1fr; } }
.verdict { margin: 14px 0 4px; font-size: 15px; }

.prose ul { padding-left: 18px; margin: 8px 0 14px; }
.prose li { margin-bottom: 6px; font-size: 15px; }
.prose h3 + ul { margin-top: 6px; }
.foot { padding: 24px 16px 40px; color: var(--muted); font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.upload-controls { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 860px) { .upload-controls { grid-template-columns: minmax(0, 1fr); } }
.drop {
  display: grid; gap: 6px; align-content: center; min-height: 120px; padding: 18px; cursor: pointer;
  border: 1.5px dashed var(--axis); border-radius: 12px; background: var(--page); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: var(--wash); }
.drop-title { font-weight: 600; }
.upload-side { display: grid; gap: 10px; align-content: start; }
.date-label { display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.date-label input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.btn { font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: progress; }
.status { margin: 12px 0 0; color: var(--ink-2); font-size: 14px; min-height: 1.5em; }
.status.err { color: var(--critical); }
.check { font-size: 14px; color: var(--ink-2); margin: 6px 0 14px; }
.check ul { margin: 6px 0 0; padding-left: 18px; }
.up-tiles { margin: 8px 0 18px; }
.up-h { margin: 6px 0 8px; }

.chart .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .stem { stroke: var(--s1); stroke-width: 2; }
.chart .dot { fill: var(--s1); stroke: var(--surface); stroke-width: 2; }
.chart .dot.anchor { fill: var(--muted); }
.chart .stem.anchor { stroke: var(--muted); }
.prereg { border-left: 3px solid var(--accent); }

.coord-controls { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.coord-controls .coord-actions { grid-column: 1 / -1; }
@media (max-width: 700px) { .coord-controls { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.field input, .field select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.coord-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.goal-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 12px; align-items: end; max-width: 640px; }
@media (max-width: 700px) { .goal-controls { grid-template-columns: minmax(0, 1fr); } }
.goal-verdict { margin: 16px 0 18px; max-width: 820px; }
.goal-where { margin-top: 18px; }
.btn-2 { background: transparent; color: var(--accent); border: 1px solid var(--accent); text-decoration: none; display: inline-block; }
.coord .tiles { margin: 6px 0 16px; }
.print-title { margin: 8px 0 12px; }
.move { font-weight: 600; }
.move.up { color: var(--accent); }
.move.down { color: var(--ink-2); }
tr.day-break td { border-top: 2px solid var(--axis); }
@media print {
  body.print-city header.top, body.print-city footer, body.print-city .tooltip,
  body.print-city main > section:not(#city), body.print-city .no-print, body.print-city #city > h2,
  body.print-city #city > .section-lede { display: none !important; }
  body.print-city {
    --ink: #111; --ink-2: #333; --muted: #555; --surface: #fff; --page: #fff; --grid: #ccc; --axis: #999;
    --accent: #1a5fb4; --border: #ccc; background: #fff; color: #111;
  }
  body.print-city th { background: #fff !important; color: #111; }
  body.print-city .card { border: 0; box-shadow: none; padding: 0; background: #fff; }
  body.print-city .scroll { overflow: visible; max-height: none; }
  body.print-city th, body.print-city td { color: #000; padding: 4px 6px; }
  body.print-city tr { break-inside: avoid; }
}

.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 6px; }
@media (max-width: 760px) { .roles { grid-template-columns: minmax(0, 1fr); } }
.role { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-decoration: none; color: var(--ink); }
.role span { color: var(--ink-2); font-size: 14px; }
.role:hover, .role:focus-visible { border-color: var(--accent); }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; max-width: 760px; }

.msg { margin-top: 12px; }
.msg textarea { width: 100%; box-sizing: border-box; font: 14px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink);
  background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 10px; resize: vertical; }

.hero-gain { margin: 12px 0 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--wash); border-radius: 0 8px 8px 0; font-size: 15px; max-width: 46ch; }
.hero-gain .muted { color: var(--ink-2); }

/* ?shot=раздел — только один раздел (скриншоты) */
body.shot main > section:not(.shot-target), body.shot footer, body.shot .tour-start { display: none !important; }
body.shot:not(:has(#next.shot-target)) header.top { display: none; }
body.shot main > section.shot-target { margin-top: 24px; }

.tour-start { margin: 16px 0 0; font-size: 16px; padding: 11px 18px; }
.tour {
  position: fixed; z-index: 20; right: 20px; bottom: 20px; width: min(420px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .22); padding: 14px 16px 16px;
}
.tour[hidden] { display: none; }
.tour-head { display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); font-size: 13px; }
.tour-x { font: inherit; font-size: 22px; line-height: 1; background: none; border: 0; color: var(--ink-2); cursor: pointer; padding: 0 4px; }
.tour-title { margin: 4px 0 6px; font-size: 19px; }
.tour-text { margin: 0 0 12px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.tour-nav { display: flex; gap: 8px; justify-content: flex-end; }
.tour-nav .btn:disabled { opacity: .4; cursor: default; }
.tour-focus { outline: 3px solid var(--accent); outline-offset: 6px; border-radius: 12px; transition: outline-color .2s; }
@media (max-width: 600px) {
  .tour { left: 16px; right: 16px; bottom: 12px; width: auto; }
  .tour-text { font-size: 14px; }
  body.touring { padding-bottom: 260px; }
}
@media print { .tour, .tour-start { display: none !important; } }
