/* Витрина сравнения источников. Оформление — системные шрифты, сеть выключена. */

:root {
  --bg: #f6f8f8;
  --surface: #ffffff;
  --surface-alt: #eef2f2;
  --surface-sunk: #e6ecec;
  --ink: #17211f;
  --muted: #5c6a68;
  --faint: #8b9795;
  --line: #dbe3e2;
  --line-strong: #c3cfcd;
  --accent: #0d7c74;
  --accent-ink: #04524c;
  --accent-soft: #d9efec;
  --warn: #a2691a;
  --warn-soft: #fdf0d8;
  --danger: #a63c37;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 40, 38, .05), 0 8px 24px rgba(16, 40, 38, .05);
  /* Приподнятая накладка (бегунок переключателя) и вдавленная кнопка сегмента:
     на тёмном фоне тень из светлой темы не видна, поэтому она тоже токен. */
  --shadow-raise: 0 1px 3px rgba(16, 40, 38, .16);
  --shadow-press: 0 1px 2px rgba(16, 40, 38, .12);
  /* Текст на заливке акцентом: в тёмной теме акцент светлеет и белым по нему
     уже не написать. */
  --on-accent: #ffffff;
  --focus: #6cc4bc;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  /* Нативные select, чекбоксы и полосы прокрутки красит браузер, а не мы. */
  color-scheme: light;
}

/* Тёмная тема. Переопределяются только значения токенов: состав объявлен выше
   и остаётся единственным источником истины. Токен, забытый здесь, останется
   светлым пятном на тёмной странице — это видно сразу и чинится в одном месте.
   Роли --accent / --accent-ink меняются местами по светлоте: на тёмном фоне
   ссылка обязана быть светлее фона, а не темнее. */
:root[data-theme="dark"] {
  --bg: #0f1615;
  --surface: #172120;
  --surface-alt: #1f2a29;
  --surface-sunk: #26312f;
  --ink: #e9efed;
  --muted: #a3b2af;
  --faint: #7f8f8c;
  --line: #2b3634;
  --line-strong: #3a4644;
  --accent: #45bdaf;
  --accent-ink: #7fd8cc;
  --accent-soft: #16332f;
  --warn: #d8a54a;
  --warn-soft: #2e2413;
  --danger: #e57f74;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .34);
  --shadow-raise: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-press: 0 1px 2px rgba(0, 0, 0, .45);
  --on-accent: #06211e;
  --focus: #6cc4bc;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  font-feature-settings: "tnum" 0;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent-ink); }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -10000px; top: 8px; z-index: 99;
  background: var(--surface); color: var(--ink); padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.skip-link:focus { left: 12px; }

/* ---------- загрузка ---------- */

.boot {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: var(--bg); transition: opacity .25s ease;
}
.boot.is-gone { opacity: 0; pointer-events: none; }
.boot-card { display: grid; gap: 14px; justify-items: center; color: var(--muted); }
.boot-card.is-error { color: var(--danger); max-width: 560px; text-align: center; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--surface-sunk); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.boot-card.is-error .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- шапка ---------- */

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
  gap: 32px; align-items: end; padding-top: 30px; padding-bottom: 24px;
}
.eyebrow {
  color: var(--accent); font-size: 11.5px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
}
.top h1 { font-size: clamp(26px, 3vw, 38px); line-height: 1.12; margin: 8px 0 8px; }
.subtitle { color: var(--muted); max-width: 62ch; }
.top-side { display: grid; gap: 10px; justify-items: stretch; }

.axis-switch {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 4px; background: var(--surface-sunk); border-radius: 999px;
}
.axis-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  background: var(--surface); border-radius: 999px;
  box-shadow: var(--shadow-raise);
  transition: transform .28s cubic-bezier(.22, .8, .3, 1), width .28s cubic-bezier(.22, .8, .3, 1);
  will-change: transform;
}
.axis-option {
  position: relative; z-index: 1; appearance: none; border: 0; background: transparent;
  /* Осей три, а шапка узкая: подпись мельче и с меньшими полями, иначе
     переключатель распирает колонку и год-фильтр под ним. */
  font: inherit; font-weight: 600; font-size: 13px; color: var(--muted);
  padding: 9px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  transition: color .2s ease;
}
.axis-option[aria-selected="true"] { color: var(--accent-ink); }
.axis-option:hover { color: var(--ink); }
.year-filter { display: grid; gap: 6px; }
.year-title { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.year-controls { display: flex; align-items: center; gap: 8px; }
.year-field { flex: 1 1 0; min-width: 0; }
.year-field select {
  width: 100%; font: inherit; font-size: 14px; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 7px 9px; height: 36px;
}
.year-dash { color: var(--faint); }
.year-reset {
  appearance: none; border: 0; background: transparent; font: inherit; font-size: 12.5px;
  color: var(--accent-ink); cursor: pointer; padding: 6px 4px; white-space: nowrap;
  text-decoration: underline; text-underline-offset: 3px;
}
.year-reset:hover { color: var(--ink); }

/* Тумблер темы. Стоит первой строкой боковой колонки шапки и прижат вправо —
   это верхний правый угол страницы. Иконка сидит В бегунке, а не по краям
   дорожки: так значок всегда показывает включённую тему, а не ту, в которую
   переключишься, — обратное читается неоднозначно. */
.theme-row { display: flex; justify-content: flex-end; }
.theme-toggle {
  appearance: none; border: 0; background: transparent; padding: 2px;
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted);
  border-radius: 999px; transition: color .15s ease;
}
.theme-toggle:hover { color: var(--ink); }
.theme-track {
  position: relative; flex: 0 0 auto; width: 46px; height: 26px; border-radius: 999px;
  background: var(--surface-sunk); border: 1px solid var(--line-strong);
  transition: background .22s ease, border-color .22s ease;
}
.theme-toggle[aria-checked="true"] .theme-track {
  background: var(--accent-soft); border-color: var(--accent);
}
.theme-knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-raise);
  display: grid; place-items: center;
  transition: transform .26s cubic-bezier(.22, .8, .3, 1);
}
.theme-toggle[aria-checked="true"] .theme-knob { transform: translateX(20px); }
.theme-ico {
  grid-area: 1 / 1; width: 13px; height: 13px; display: block;
  transition: opacity .18s ease, transform .26s cubic-bezier(.22, .8, .3, 1);
}
.theme-ico-sun { color: var(--warn); }
.theme-ico-moon { color: var(--accent-ink); }
.theme-toggle[aria-checked="false"] .theme-ico-moon,
.theme-toggle[aria-checked="true"] .theme-ico-sun { opacity: 0; transform: scale(.5); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- вкладки ---------- */

.tabs { display: flex; gap: 4px; margin: 18px 0 4px; flex-wrap: wrap; }
.tab {
  appearance: none; border: 0; background: transparent; font: inherit; font-weight: 600;
  color: var(--muted); padding: 9px 15px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { background: var(--surface-alt); color: var(--ink); }
.tab.is-active { background: var(--accent-soft); color: var(--accent-ink); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- карточки ---------- */

.panel { padding: 14px 0 40px; display: grid; gap: 16px; }
/* display:grid перебивает штатное поведение атрибута hidden — возвращаем его. */
.panel[hidden] { display: none !important; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card-head {
  display: flex; gap: 20px; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; padding: 18px 20px 12px;
}
.card-head h2 { font-size: 17px; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 4px; max-width: 78ch; }
.card-foot {
  padding: 10px 20px 18px; color: var(--faint); font-size: 12.5px; line-height: 1.5;
}
.card-foot p + p { margin-top: 8px; }
.card-foot b { color: var(--muted); }
.card-foot .formula {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  background: var(--surface-alt); border-radius: var(--radius-sm);
  padding: 9px 11px; line-height: 1.6;
}
.card-foot .muted-note { color: var(--faint); }
.focus-name { font-weight: 600; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart { width: 100%; }

.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.sides { padding: 2px 20px 12px; display: grid; gap: 7px; }
.sides-row { display: flex; align-items: flex-start; gap: 10px; }
.sides-label {
  flex: 0 0 58px; padding-top: 5px; color: var(--faint);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.sides-zone {
  flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 5px;
  min-height: 30px; align-content: flex-start;
  border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 4px 6px;
}
.sides-zone:empty::after {
  content: "пусто"; color: var(--faint); font-size: 12px; padding: 3px 4px;
}
.side-chip {
  appearance: none; font: inherit; font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); border-radius: 999px; padding: 3px 9px 3px 7px;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.side-chip:hover { background: var(--surface-alt); border-color: var(--accent); }
.side-chip:active { transform: scale(.97); }
.side-chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.side-chip .arrow { color: var(--faint); font-size: 11px; }
.side-chip:hover .arrow { color: var(--accent-ink); }
.sides-all {
  appearance: none; border: 0; background: transparent; font: inherit; font-size: 11.5px;
  color: var(--accent-ink); cursor: pointer; padding: 5px 2px; white-space: nowrap;
  text-decoration: underline; text-underline-offset: 3px; align-self: flex-start;
}
.sides-all:hover { color: var(--ink); }
.sides-hint { color: var(--faint); font-size: 11.5px; padding-left: 68px; }

@media (max-width: 720px) {
  .sides-row { flex-wrap: wrap; }
  .sides-hint { padding-left: 0; }
}

.threshold { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.threshold input {
  font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 4px 6px; height: 30px; width: 72px; text-align: right;
}
.threshold-unit { white-space: nowrap; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.switch:hover { color: var(--ink); }

.seg { display: flex; background: var(--surface-sunk); border-radius: 999px; padding: 3px; }
.seg-btn {
  appearance: none; border: 0; background: transparent; font: inherit; font-size: 13px;
  color: var(--muted); padding: 6px 13px; border-radius: 999px; cursor: pointer;
}
.seg-btn.is-on { background: var(--surface); color: var(--accent-ink); font-weight: 600; box-shadow: var(--shadow-press); }

.btn {
  appearance: none; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; background: var(--accent); color: var(--on-accent);
  border-radius: var(--radius-sm); padding: 9px 15px;
}
.btn:hover { background: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--muted); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--ink); }

/* ---------- KPI ---------- */

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 4px; align-content: start;
  border-top: 3px solid var(--kpi, var(--accent));
}
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-value { font-size: clamp(22px, 2vw, 30px); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.kpi-note { color: var(--faint); font-size: 12px; line-height: 1.45; }
.kpi-total { color: var(--faint); font-size: 12.5px; line-height: 1.5; margin-top: -4px; }
.kpi-total b { color: var(--muted); font-weight: 600; }

/* ---------- таблицы ---------- */

.table-wrap { overflow: auto; max-height: 640px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-alt); color: var(--muted);
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase; text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.data-table th[data-sort]:hover { color: var(--ink); background: var(--surface-sunk); }
.data-table th[data-sort]::after {
  content: "↕"; margin-left: 6px; opacity: .35; font-size: 10px;
}
.data-table th.is-sorted { color: var(--accent-ink); }
.data-table th.is-sorted::after { content: "↓"; opacity: 1; }
.data-table th.is-sorted.is-asc::after { content: "↑"; }
.data-table tbody tr.is-clickable { cursor: pointer; }
.data-table tbody tr.is-clickable:hover { background: var(--surface-alt); }
.data-table tbody tr.is-service td:first-child { color: var(--muted); }
.node-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: baseline; }
.idx-strong { font-weight: 700; color: var(--accent-ink); }
.idx-weak { color: var(--muted); }

/* ---------- фильтры ---------- */

.filters-card { padding: 16px 20px 6px; }
/* Поля выбора растут вниз фишками, поэтому строка выравнивается по верху:
   при выравнивании по низу высокое поле поднимало соседние короткие и рвало
   строку подписей. */
.filters { display: flex; gap: 12px 12px; flex-wrap: wrap; align-items: flex-start; }
.field { display: grid; gap: 5px; min-width: 165px; }
.field, .field > * { min-width: 0; }
.field-grow { flex: 1 1 260px; }
.field-narrow { min-width: 130px; }
.field > span { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.field input, .field select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 8px 10px; height: 38px; width: 100%;
}
.filters-actions { display: flex; gap: 8px; margin-left: auto; align-self: flex-end; }

/* ---------- выбор организаций ---------- */

/* Поля выбора обязаны уметь ужиматься: без min-width:0 грид-элемент держит
   ширину своего содержимого, длинная фишка распирает колонку и заезжает на
   соседнюю. Та же причина — у .org-chips и .oc-name ниже. */
.org-field { position: relative; min-width: 0; }
.org-picker { position: relative; min-width: 0; }
.org-suggest {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0;
  margin: 0; padding: 4px; list-style: none; max-height: 300px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
.org-suggest li {
  padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13px;
  color: var(--ink); display: flex; gap: 10px; align-items: baseline;
}
.org-suggest li:hover, .org-suggest li.is-active { background: var(--accent-soft); }
.org-suggest .os-name { flex: 1 1 auto; min-width: 0; line-height: 1.35; overflow-wrap: anywhere; }
.org-suggest .os-count { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.org-suggest .os-empty { color: var(--muted); cursor: default; }
.org-suggest .os-empty:hover { background: transparent; }
.org-suggest mark { background: transparent; color: var(--accent-ink); font-weight: 700; }

.org-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.org-chips:not(:empty) { margin-top: 6px; }
.org-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; min-width: 0;
  padding: 4px 6px 4px 9px; font: inherit; font-size: 12.5px; cursor: pointer;
  color: var(--accent-ink); background: var(--accent-soft);
  border: 1px solid transparent; border-radius: 999px;
}
.org-chip:hover { border-color: var(--accent); }
.org-chip .oc-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.org-chip .oc-x { flex: none; }
.org-chip .oc-x { color: var(--accent); font-size: 14px; line-height: 1; }

/* ---------- легенда служебных классов (академическая подача) ---------- */

.legend-card { padding: 20px 24px 22px; }
.legend-title { font-size: 15px; letter-spacing: .01em; }
.legend-lead, .legend-note { color: var(--muted); font-size: 12.5px; max-width: 78ch; }
.legend-lead { margin-top: 6px; }
.legend-dl { margin: 14px 0 0; display: grid; gap: 12px; }
.legend-dl dt {
  font-size: 13px; font-weight: 700; color: var(--ink);
  font-variant-caps: all-small-caps; letter-spacing: .06em;
}
.legend-dl dd {
  margin: 3px 0 0; padding-left: 14px; border-left: 2px solid var(--line);
  color: var(--muted); font-size: 13px; line-height: 1.55; max-width: 82ch;
}
.legend-dl .lg-count { color: var(--faint); font-weight: 600; letter-spacing: 0; }
.legend-note { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- ВНТ из карточки ЕГИСУ ---------- */

.v-cardvnt { margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.v-cardvnt b { color: var(--warn); font-weight: 700; }
.v-cardvnt.is-absent { color: var(--faint); font-style: italic; }
.selection-meta { color: var(--muted); font-size: 12.5px; padding: 12px 0 10px; }

/* ---------- виртуальная таблица работ ---------- */

.vtable { --cols: minmax(280px, 2.4fr) minmax(150px, 1.2fr) 130px minmax(190px, 1.3fr) minmax(220px, 1.6fr); }
.vtable-head, .vrow {
  display: grid; grid-template-columns: var(--cols); gap: 16px; padding: 0 20px;
}
.vtable-head {
  position: sticky; top: 0; z-index: 2; background: var(--surface-alt); color: var(--muted);
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.vtable-viewport { position: relative; height: 640px; overflow: auto; contain: strict; }
.vtable-sizer { position: absolute; top: 0; left: 0; width: 1px; }
.vtable-rows { position: absolute; top: 0; left: 0; right: 0; }
.vrow {
  height: 92px; align-items: start; padding-top: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line); font-size: 13px; overflow: hidden;
}
.vrow:hover { background: var(--surface-alt); }
.vrow > div { min-width: 0; overflow: hidden; }
/* Обрезка по двум строкам живёт на отдельном элементе: -webkit-box съедает
   вложенные блоки целиком, поэтому подпись под названием обязана быть снаружи. */
.v-clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v-title { font-weight: 600; }
.v-sub { color: var(--faint); font-size: 11.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.v-sub a { color: var(--accent-ink); }
.reg-number { font-variant-numeric: tabular-nums; user-select: all; }
.v-org { color: var(--muted); font-size: 12.5px; }
.v-money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.v-money.is-absent { color: var(--faint); font-weight: 500; font-size: 12px; }
.v-quote { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pill {
  display: inline-block; border-radius: 999px; padding: 3px 9px; margin: 0 4px 4px 0;
  font-size: 11.5px; line-height: 1.35; background: var(--accent-soft); color: var(--accent-ink);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top;
}
.pill.is-service { background: var(--surface-sunk); color: var(--muted); }
.pill.is-review { background: var(--warn-soft); color: var(--warn); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.foot { padding: 22px 24px 40px; color: var(--faint); font-size: 12px; display: grid; gap: 6px; }
.foot code { font-family: var(--mono); }

@media (max-width: 1080px) {
  .top-inner { grid-template-columns: 1fr; align-items: start; }
  .grid-2 { grid-template-columns: 1fr; }
  .vtable { --cols: minmax(240px, 2.2fr) minmax(130px, 1fr) 110px minmax(160px, 1.2fr); }
  .vtable-head .c-quote, .vrow .v-quote { display: none; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .vtable { --cols: minmax(180px, 2fr) 100px; }
  .vtable-head .c-org, .vrow .v-org, .vtable-head .c-label, .vrow .v-label { display: none; }
  .filters-actions { margin-left: 0; }
}

/* Измерение боковой колонки санкея. Подпись слева от переключателя, чтобы
   «Слева» и «Справа» не путались между собой в плотном ряду настроек. */
.sidedim { display: inline-flex; align-items: center; gap: 7px; }
.sidedim-label {
  color: var(--faint); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}

/* Стороны с разными измерениями делить нечего: строки выбора убираем,
   подсказку оставляем — она объясняет, почему их нет. */
.sides.is-fixed .sides-row { display: none; }
.sides.is-fixed .sides-hint { padding-left: 0; }

/* Вкладка «Инструменты» переиспользует стили фишек и зон вкладки
   «Организации» — механика у них общая, различаются только справочники. */

/* ---------- вкладки «Инструменты» и «Организации» ---------- */

.orgzones { padding: 2px 20px 4px; display: grid; gap: 8px; }
.orgzone { display: flex; align-items: flex-start; gap: 10px; }
.orgzone-label {
  flex: 0 0 58px; padding-top: 6px; color: var(--faint);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.orgzone-box {
  flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 36px; align-content: flex-start;
  border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 5px 6px;
}
.orgzone-box:empty::after {
  content: "пусто — добавьте организацию полем выше"; color: var(--faint); font-size: 12px; padding: 4px;
}
.orgzone-foot {
  padding: 6px 20px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.orgzone-foot .sides-hint { padding-left: 0; flex: 1 1 260px; }

/* Фишка организации или портфеля. Действий три и они разные по смыслу,
   поэтому у каждого своя кнопка: щелчок по телу фишки не должен делать
   что-то одно из трёх «на удачу». */
.ochip {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; min-width: 0;
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 999px; padding: 2px 3px 2px 4px; font-size: 12px;
}
.ochip.is-marked { border-color: var(--accent); background: var(--accent-soft); }
.ochip.is-portfolio { border-style: solid; border-color: var(--accent); }
.ochip .oc-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; margin: 0 4px 0 3px; }
.ochip .oc-label {
  min-width: 0; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 2px 2px; color: var(--ink);
}
.ochip .oc-count { color: var(--faint); font-size: 11px; white-space: nowrap; }
.ochip .pf-name {
  font: inherit; font-size: 12px; color: var(--accent-ink); font-weight: 600;
  border: 0; border-bottom: 1px dashed var(--line-strong); background: transparent;
  padding: 1px 2px; min-width: 60px; max-width: 22ch; border-radius: 0;
}
.ochip .pf-name:focus { outline: none; border-bottom-color: var(--accent); }
.ochip button {
  appearance: none; border: 0; background: transparent; font: inherit; cursor: pointer;
  color: var(--faint); padding: 2px 4px; line-height: 1; border-radius: 999px;
}
.ochip button:hover { color: var(--accent-ink); background: var(--surface-alt); }
.ochip .oc-mark.is-on { color: var(--accent); }
.ochip .oc-drop:hover { color: var(--danger); }

.org-table td.og-name { font-weight: 600; }
.org-table tr.og-total td { background: var(--surface-alt); }
.org-table tr.og-src td { color: var(--muted); }
.org-table tr.og-src td:first-child, .org-table tr.og-src td:nth-child(2) { border-bottom-color: transparent; }
.org-anom { color: var(--warn); }

/* Пометка аномальной суммы в таблице работ. Работа остаётся в выборке —
   это предупреждение, а не исключение. */
.v-anom {
  display: inline-block; margin-top: 3px; padding: 1px 6px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn); font-size: 10.5px; font-weight: 600;
  letter-spacing: .01em;
}

@media (max-width: 720px) {
  .orgzone { flex-wrap: wrap; }
  .orgzone-label { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
