/* Новый интерфейс Судмонстра: без сборки, токены цветов + тёмная тема. */
:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --border: #e2e1dc;
  --accent: #c2410c;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #a16207;
  --warn-bg: #fef3c7;
  --down: #b91c1c;
  --down-bg: #fee2e2;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #1f1f1d;
    --text: #ecebe7;
    --muted: #9c9b95;
    --border: #34332f;
    --accent: #fb923c;
    --ok: #4ade80;
    --ok-bg: #14321f;
    --warn: #facc15;
    --warn-bg: #3a2f0b;
    --down: #f87171;
    --down-bg: #3b1515;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  padding: 0.75rem 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.top nav { display: flex; gap: 1rem; flex: 1; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.who { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); margin: 0; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin: 1rem 0;
}
.card.narrow { max-width: 380px; margin: 3rem auto; }
.card.off { opacity: 0.65; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.error { color: var(--down); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.85em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.off td { color: var(--muted); text-decoration: line-through; }

.status { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.85em; font-weight: 600; }
.status.ok { color: var(--ok); background: var(--ok-bg); }
.status.degraded { color: var(--warn); background: var(--warn-bg); }
.status.down { color: var(--down); background: var(--down-bg); }
.tag { font-size: 0.75em; font-weight: 500; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 0.35rem; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li { border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.6rem; font-size: 0.85em; }

label { display: block; margin: 0.75rem 0; }
input { display: block; width: 100%; margin-top: 0.25rem; padding: 0.45rem 0.6rem; font: inherit;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
button {
  font: inherit; cursor: pointer; padding: 0.45rem 0.9rem; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
button.secondary { background: transparent; color: var(--accent); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }
button.link.danger { color: var(--down); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1rem; }
form.inline { display: flex; gap: 0.5rem; align-items: center; }
form.inline input { margin: 0; width: 16rem; max-width: 100%; }
form.inline { flex-wrap: wrap; }
form.inline .key-scopes { flex-basis: 100%; }
form.inline .key-scopes .check { white-space: normal; }
.row > a.button { display: inline-block; }
.secret { margin-top: 1rem; padding: 0.75rem 1rem; border: 1px dashed var(--accent); border-radius: var(--radius); }
.secret pre { white-space: pre-wrap; word-break: break-all; margin: 0.5rem 0; }

/* Статистика API */
.warn-text { color: var(--warn); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem;
  display: flex; flex-direction: column; gap: 0.15rem; }
.tile-n { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile-n.small-n { font-size: 1.1rem; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 0.5rem; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; min-height: 1px; background: var(--ok); border-radius: 2px 2px 0 0; display: flex;
  flex-direction: column; justify-content: flex-start; overflow: hidden; }
.bar-bad { width: 100%; background: var(--down); }
.bars-axis { display: flex; justify-content: space-between; margin-top: 0.25rem; }
.legend { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 2px; vertical-align: -0.1em; margin-left: 0.5rem; }
.legend.ok { background: var(--ok); }
.legend.bad { background: var(--down); }

/* Вход */
.notice { color: var(--text); background: var(--warn-bg); padding: 0.5rem 0.75rem; border-radius: 6px; }
a.button { display: block; text-align: center; text-decoration: none; padding: 0.55rem 0.9rem; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.divider { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0 0.25rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Процессы */
h3 { font-size: 0.95rem; margin: 1rem 0 0.5rem; }
.spark { display: block; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
tr.stale td { background: var(--warn-bg); }

/* Прогресс и лента */
.proc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; }
@media (min-width: 1100px) { .proc-grid { grid-template-columns: minmax(0, 1fr) 340px; } main:has(.proc-grid) { max-width: 1440px; } }
.proc-feed { align-self: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.progress-block { margin-bottom: 1.25rem; }
.progress { display: flex; height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; margin: 0.4rem 0; }
.progress > div { height: 100%; transition: width 0.6s ease; }
.progress-done { background: var(--ok); }
.progress-stalled { background: var(--warn); }
.progress-running { background: var(--accent); opacity: 0.7; }
.mini-progress { height: 6px; width: 120px; max-width: 100%; border-radius: 999px; background: var(--border); overflow: hidden; margin: 0.25rem 0 0.15rem; }
.mini-progress > div { height: 100%; max-width: 100%; background: var(--accent); transition: width 0.6s ease; }
.mini-progress.over > div { background: var(--down); }
.feed { list-style: none; padding: 0; margin: 0; font-size: 0.85em; }
.feed li { padding: 0.3rem 0 0.3rem 0.6rem; border-left: 3px solid var(--border); margin-bottom: 0.2rem; }
.feed li time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 0.25rem; }
.feed-ok { border-left-color: var(--ok) !important; }
.feed-error { border-left-color: var(--down) !important; }
.feed-info { border-left-color: var(--accent) !important; }

/* ---- Дела: поиск, выдача, карточка ------------------------------------------------------------------------ */
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main:has(.search-layout), main:has(.case-grid) { max-width: 1440px; }
.nowrap { white-space: nowrap; }
.hint { color: var(--muted); font-size: 0.8em; margin: 0.25rem 0 0; }
.ok-text { color: var(--ok); }
.pad { padding: 0.5rem 0.75rem; margin: 0; }
.crumbs { margin: 0 0 0.5rem; }
.crumbs a { text-decoration: none; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.75rem 1.5rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0.25rem 0 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

select, input[type="search"], input[type="text"], input[type="date"], input[type="number"],
input[type="email"], input[type="password"] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.4rem 0.55rem; min-width: 0; margin: 0;
}
select { width: 100%; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.btn, summary.btn { display: inline-block; font: inherit; cursor: pointer; padding: 0.45rem 0.9rem; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; list-style: none; }
.btn.secondary, button.secondary, summary.btn.secondary { background: transparent; color: var(--accent); }
summary.btn::-webkit-details-marker { display: none; }
.inline-field { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; color: var(--muted); font-size: 0.9em; }
.inline-field select { width: auto; color: var(--text); }

.popover { position: relative; }
.popover-body { position: absolute; right: 0; z-index: 20; margin-top: 0.4rem; width: min(320px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); }
.stack > * + * { margin-top: 0.5rem; }
.stack label { margin: 0; }

/* раскладка: фильтры слева, выдача справа; на узком — фильтры сворачиваются над выдачей */
.search-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem 1.5rem; align-items: start; }
@media (min-width: 960px) {
  .search-layout { grid-template-columns: 320px minmax(0, 1fr); }
  .filters { position: sticky; top: 0.75rem; max-height: calc(100vh - 1.5rem); overflow-y: auto; }
}
.filters-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem 1rem; }
.filters-panel > summary { font-weight: 600; cursor: pointer; padding: 0.15rem 0; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 0.4em; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 0.75em; text-align: center; vertical-align: 0.1em; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field, .seg-group { margin: 0.9rem 0 0; }
.field > * + * { margin-top: 0.35rem; }
.field > input, .field > select { width: 100%; }
.field-label, .seg-group legend { display: block; font-size: 0.8em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--muted); margin: 0 0 0.35rem; padding: 0; }
.pair { display: flex; gap: 0.4rem; align-items: center; }
.pair > input, .pair > select { flex: 1 1 0; width: 0; }
.check { display: flex; gap: 0.4rem; align-items: center; margin: 0.35rem 0 0; font-size: 0.95em; white-space: nowrap; }
.check input { width: auto; margin: 0; }
.more { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 0.6rem; }
.more > summary { cursor: pointer; color: var(--accent); }
.filters .actions { margin-top: 1.1rem; }

.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg label { position: relative; margin: 0; flex: 1 1 auto; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 0.3rem 0.5rem; cursor: pointer; font-size: 0.9em; border-left: 1px solid var(--border); }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* выбор значений */
.pick { position: relative; }
.pick-box { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; min-height: 2.25rem; padding: 0.2rem 0.3rem;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: text; }
.pick-box > .x:last-child { margin-left: auto; }
.pick-box input { flex: 1 1 8rem; border: 0; padding: 0.2rem 0.25rem; background: transparent; }
.pick-box input:focus-visible { outline: none; }
.pick-box:focus-within { border-color: var(--accent); }
.pick-chip { display: inline-flex; align-items: center; gap: 0.2rem; max-width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 0 0.15rem 0 0.55rem; font-size: 0.85em; }
.pick-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.x, a.x { border: 0; background: none; color: var(--muted); padding: 0 0.35rem; font-size: 1.05em; line-height: 1.4; cursor: pointer; text-decoration: none; }
button.x:hover, a.x:hover { color: var(--down); }
.pick-list { position: absolute; left: 0; right: 0; z-index: 30; margin-top: 0.25rem; max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); }
.pick-item { display: flex; width: 100%; gap: 0.5rem; align-items: baseline; text-align: left; border: 0; border-radius: 0;
  background: none; color: var(--text); padding: 0.35rem 0.75rem; font-size: 0.92em; }
.pick-item:hover, .pick-item.active { background: var(--bg); }
.pick-item.nested { padding-left: 2rem; }
.pick-head { font-weight: 600; border-top: 1px solid var(--border); }
.pick-group:first-child .pick-head { border-top: 0; }
.pick-caption { padding: 0.45rem 0.75rem 0.15rem; font-size: 0.75em; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.pick-item .hint { margin: 0 0 0 auto; padding-left: 0.5rem; text-align: right; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-item .box { flex: none; width: 0.95rem; height: 0.95rem; border: 1.5px solid var(--muted); border-radius: 3px; align-self: center; }
.pick-item[data-state="all"] .box { background: var(--accent); border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--surface); }
.pick-item[data-state="some"] .box { background: linear-gradient(var(--accent), var(--accent)) center / 60% 2px no-repeat; border-color: var(--accent); }
.pick-item:not([data-state]) .box { display: none; }

/* выдача */
.results-col { min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: flex-end; margin-bottom: 0.5rem; }
.spinner { display: inline-block; vertical-align: middle; width: 1rem; height: 1rem; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
  visibility: hidden; animation: spin 0.7s linear infinite; }
.spinner.small-spin { width: 0.8rem; height: 0.8rem; visibility: visible; }
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-request .spinner, .htmx-request.spinner { visibility: visible; }
.results-col.htmx-request #results { opacity: 0.55; transition: opacity 0.15s 0.15s; }
.when-busy { display: none; }
.htmx-request .when-busy { display: inline; }
.htmx-request .when-idle { display: none; }

.active-filters { list-style: none; padding: 0; margin: 0 0 0.75rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.active-filters li { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.05rem 0.1rem 0.05rem 0.65rem; font-size: 0.85em; max-width: 100%; }
.active-filters li.plain { border: 0; background: none; padding-left: 0.4rem; }
.summary { margin: 0 0 0.5rem; min-height: 1.5em; }
.count-line strong { font-variant-numeric: tabular-nums; }

table.cases { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; }
table.cases th { position: sticky; top: 0; background: var(--surface); }
table.cases td { padding: 0.55rem 0.6rem; }
table.cases tbody tr:hover td { background: var(--bg); }
table.cases tbody tr:last-child td { border-bottom: 0; }
.case-link { font-weight: 600; text-decoration: none; }
.case-link:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: 0.8em; }
.articles { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.2rem; }
.art { display: inline-block; font-size: 0.78em; padding: 0 0.4rem; border-radius: 4px; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; white-space: nowrap; margin: 0 0.2rem 0.2rem 0; }
.penalty { margin-top: 0.2rem; font-weight: 600; }
.fav-col { width: 2rem; padding-right: 0 !important; }
.links-col { white-space: nowrap; text-align: right; }
.icon-link { display: block; font-size: 0.85em; text-decoration: none; }
button.fav { border: 0; background: none; color: var(--muted); padding: 0 0.2rem; font-size: 1.15rem; line-height: 1; }
button.fav.on { color: #e0a100; }
button.fav.with-text { font-size: 1em; border: 1px solid var(--border); padding: 0.45rem 0.8rem; color: var(--text); }
button.fav.with-text.on span { color: #e0a100; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1.25rem; margin: 1rem 0; }
.pager a { text-decoration: none; font-weight: 600; }
.empty { text-align: center; padding: 2.5rem 1rem; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty p { margin: 0.25rem 0; }

/* выдача на телефоне — карточками */
@media (max-width: 720px) {
  table.cases, table.cases tbody, table.cases tr, table.cases td { display: block; }
  table.cases thead { display: none; }
  table.cases { border: 0; background: none; }
  table.cases tr { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 0.6rem; padding: 0.4rem 0.2rem; }
  table.cases td { border: 0; padding: 0.15rem 0.6rem; }
  table.cases td[data-label]::before { content: attr(data-label); display: block; font-size: 0.72em; color: var(--muted); text-transform: uppercase; }
  table.cases td.fav-col { position: absolute; right: 0.4rem; top: 0.4rem; width: auto; }
  table.cases td.links-col { text-align: left; }
  .icon-link { display: inline; margin-right: 0.75rem; }
}

/* карточка дела */
.case-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; }
@media (min-width: 900px) { .case-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.case-grid .card { margin: 0 0 1rem; }
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.35rem 0.9rem; margin: 0; }
dl.facts dt { color: var(--muted); font-size: 0.88em; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
dl.facts.compact { font-size: 0.92em; }
.defendant + .defendant { border-top: 1px solid var(--border); margin-top: 0.75rem; padding-top: 0.5rem; }
.defendant p { margin: 0 0 0.4rem; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 0.92em; }
.timeline li { position: relative; padding: 0 0 0.6rem 1.1rem; border-left: 2px solid var(--border); margin-left: 0.3rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 0.4em; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); }
.timeline time { display: block; color: var(--muted); font-size: 0.85em; font-variant-numeric: tabular-nums; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { margin: 0.25rem 0; }
h2.inline { display: inline; margin: 0; }
.text-block > summary { cursor: pointer; }
.result-text, .reading { font-size: 1.02rem; line-height: 1.7; max-width: 75ch; }
.reading { margin-left: auto; margin-right: auto; padding: 1.5rem 2rem; }
.result-text p { margin: 0 0 0.8em; }

/* ---- Статистика по результату поиска ------------------------------------------------------------------------- */
:root {
  /* палитра статистики проверена validate_palette.js (--pairs all, обе темы) */
  --viz-neutral: #d3c8b2; --viz-strong: #a3302c; --viz-ochre: #b98a2e; --viz-blue: #2a64ad;
  --viz-wash: rgb(211 200 178 / 0.35); --grid: #ecebe6;
}
@media (prefers-color-scheme: dark) {
  :root { --viz-neutral: #6b6352; --viz-strong: #b8423b; --viz-ochre: #b68b25; --viz-blue: #4a86d6;
    --viz-wash: rgb(107 99 82 / 0.35); --grid: #2c2b28; }
}
.toolbar-gap { flex: 1; }
.view-switch { flex: none; }
.stats-view .list-only { display: none; }
.stats-loading { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.stats-loading p { margin: 0.25rem 0; }
.spinner.big-spin { width: 2.25rem; height: 2.25rem; border-width: 3px; margin-bottom: 0.75rem; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
.stats-narrow p { max-width: 42rem; margin-left: auto; margin-right: auto; }
.narrow-links { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; padding: 0; margin: 0.75rem 0; }
.chart h2 { margin-bottom: 0.5rem; }
.chart .row h2 { margin: 0; }
.stats .tiles { margin-top: 0; }
.tile-n { font-variant-numeric: normal; white-space: nowrap; }
.stats .tile { min-width: 0; }

.cols-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 200px auto; gap: 0.25rem 0.5rem; margin-top: 0.75rem; }
.cols-axis { display: flex; flex-direction: column; justify-content: space-between; text-align: right; font-variant-numeric: tabular-nums; }
.cols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; align-items: end; height: 100%;
  border-bottom: 1px solid var(--grid); background: linear-gradient(var(--grid), var(--grid)) top / 100% 1px no-repeat; }
.col { display: flex; align-items: flex-end; justify-content: center; height: 100%; }
.col-fill { position: relative; width: 100%; max-width: 24px; min-height: 1px; background: var(--viz-neutral); border-radius: 4px 4px 0 0; }
.col.peak .col-fill { background: var(--viz-strong); }
.col-label { position: absolute; bottom: calc(100% + 4px); right: 0; white-space: nowrap; font-size: 0.78rem; color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.col:hover .col-fill, .col:focus-visible .col-fill { filter: brightness(1.15); }
.cols-labels { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; white-space: nowrap; }
.cols-labels span { overflow: visible; }
.chart-table { margin-top: 0.5rem; max-width: 320px; }
.chart details { margin-top: 0.75rem; }

.chart-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; }
@media (min-width: 1100px) { .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chart-grid .card { margin: 0 0 1rem; }
.hbars { list-style: none; margin: 0; padding: 0; }
.hbars a { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) 7.5rem; gap: 0.6rem; align-items: center;
  padding: 0.3rem 0.25rem; border-radius: 4px; color: var(--text); text-decoration: none; }
.hbars a:hover, .hbars a:focus-visible { background: var(--bg); }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92em; }
.hbar-track { height: 14px; }
.hbar-fill { display: block; height: 100%; min-width: 2px; background: var(--viz-neutral); border-radius: 0 4px 4px 0; }
.hbars a.strict .hbar-fill { background: var(--viz-strong); }
.hbars a.strict .hbar-label { font-weight: 600; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.9em; white-space: nowrap; }
@media (max-width: 720px) { .hbars a { grid-template-columns: minmax(0, 1fr) 6.5rem; } .hbar-track { grid-column: 1 / -1; grid-row: 2; } }

.chart-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--text); color: var(--bg); padding: 0.25rem 0.5rem;
  border-radius: 4px; font-size: 0.85em; white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); }
.hbar-sub { display: block; font-size: 0.8em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart.wide .hbars a { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr) 9.5rem; }

/* ответчики */
.def-cases > summary { cursor: pointer; list-style: none; }
.def-cases > summary::-webkit-details-marker { display: none; }
.def-cases > summary .meta { display: block; }
.def-cases[open] > summary .meta { color: var(--accent); }
.def-cases ul { margin: 0.4rem 0 0; }
.def-cases li { padding: 0.15rem 0; }

/* статистика: подача по образцу Trace Origin */
.kicker { margin: 0 0 0.6rem; font: 500 0.72rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); }
.tile .kicker { margin: 0; }
.stats-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; }
@media (min-width: 1100px) { .stats-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.stats-top .card { margin: 0 0 1rem; }
.squares { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 1.25rem; align-items: end; }
.squares-svg { width: 100%; height: auto; display: block; }
.sq { stroke: var(--surface); stroke-width: 0.6; }
.sq-total { fill: var(--viz-neutral); } .sq-final { fill: var(--viz-ochre); } .sq-punished { fill: var(--viz-strong); }
.swatch.sq-total { background: var(--viz-neutral); } .swatch.sq-final { background: var(--viz-ochre); } .swatch.sq-punished { background: var(--viz-strong); }
.sq-dot { fill: var(--text); }
.squares-legend { list-style: none; margin: 0; padding: 0; }
.squares-legend li { display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 0.8rem; }
.swatch { flex: none; display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 2px; margin-top: 0.3em; }
.swatch.strict { background: var(--viz-strong); } .swatch.neutral { background: var(--viz-neutral); }

.dot-legend { list-style: none; margin: 0 0 0.75rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.88em; }
.dot-legend li { display: flex; align-items: center; gap: 0.4rem; }
.dot-legend a { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; }
.dot-legend a:hover { text-decoration: underline; }
.waffle { display: flex; flex-wrap: wrap; gap: 3px; }
.dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; }
.o-punished { background: var(--viz-neutral); }
.o-dismissed { background: var(--viz-ochre); }
.o-acquitted { background: var(--viz-blue); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--viz-blue); }
.o-returned { border: 2px solid var(--viz-strong); }
.o-pending { border: 1.5px solid var(--viz-neutral); }

.curves { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 2rem; }
.curve { margin: 0; } .curve svg { width: 100%; max-width: 360px; height: auto; overflow: visible; }
.curve .grid { stroke: var(--grid); stroke-width: 0.5; } .curve .diag { stroke: var(--muted); stroke-width: 0.4; opacity: 0.6; }
.curve-area { fill: var(--viz-wash); } .curve-line { fill: none; stroke: var(--text); stroke-width: 1.2; stroke-linejoin: round; }
.curve-dot { fill: var(--text); stroke: var(--surface); stroke-width: 1; }
.curve-note { font: 4.2px ui-monospace, SFMono-Regular, Menlo, monospace; fill: var(--text); }
.curve .axis { font: 3.6px ui-monospace, SFMono-Regular, Menlo, monospace; fill: var(--muted); }
.squares-legend .hbar-sub { white-space: normal; overflow: visible; }

/* Капча: разметка */
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; margin: 0.75rem 0; }
.label-card { display: flex; flex-direction: column; gap: 0.4rem; margin: 0; padding: 0.6rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); }
.label-card img { width: 100%; height: auto; background: #fff; border-radius: 4px; image-rendering: pixelated; }
.label-card input { margin: 0; font-size: 1.15rem; letter-spacing: 0.08em; }
.label-card.done { justify-content: center; min-height: 3rem; }
tr.total td { background: var(--bg); }

/* ---- Энциклопедия: суды и судьи ------------------------------------------------------------------------------ */
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; }
@media (min-width: 900px) { .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.article-grid .card { margin: 0 0 1rem; }
table.judges a { text-decoration: none; }
table.judges a:hover { text-decoration: underline; }
tr.muted a { color: var(--muted); }
.small-gap { margin-top: 0.75rem; }
.small-gap > summary { cursor: pointer; color: var(--accent); }
.region-index { columns: 3 260px; column-gap: 2rem; list-style: none; padding: 0; margin: 0; }
.region-index li { break-inside: avoid; padding: 0.2rem 0; }
.region-index li .muted { display: block; }
.region-index a { text-decoration: none; }
.judge-filter { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; }
.judge-filter input[type="search"] { width: 14rem; }
.judge-filter select { width: auto; max-width: 18rem; }
.letters { display: flex; flex-wrap: wrap; gap: 0.2rem; margin: 0 0 1rem; }
.letters a, .letters span { min-width: 1.9rem; text-align: center; padding: 0.15rem 0.3rem; border-radius: 4px; text-decoration: none; }
.letters a:hover { background: var(--surface); }
.letters a[aria-current] { background: var(--accent); color: #fff; }
.busiest { margin: 0.5rem 0 0; padding-left: 1.5rem; }
.busiest li { padding: 0.1rem 0; }
.how-to-read { margin-top: 1rem; }
.how-to-read > summary { cursor: pointer; color: var(--accent); }
.how-to-read p { max-width: 75ch; }
.profile-stats > .kicker { margin: 1.5rem 0 0.5rem; }

/* сравнение: переключатели */
.ratings-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.ratings-head .kicker { margin: 0; }
.ratings-switch { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.seg a { flex: 1 1 auto; color: var(--text); text-decoration: none; }
.seg a:first-child span { border-left: 0; }
.seg a[aria-current] span { background: var(--accent); color: #fff; }
.ratings.htmx-request { opacity: 0.6; transition: opacity 0.15s 0.15s; }

/* вывод о судье */
.verdict { margin: 0 0 1.25rem; }
.verdict-main { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.6rem; }
.verdict-high, .verdict-high95 { color: var(--viz-strong); }
.verdict-low, .verdict-low95 { color: var(--viz-blue); }

/* исходы «судья / суд / регион» на общей шкале */
.compare { margin: 0 0 1.5rem; }
.compare-row { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 0.75rem; align-items: center; margin: 0.4rem 0; }
.compare-label { font-weight: 600; font-size: 0.92em; }
.outcome-bar { display: flex; height: 24px; border-radius: 4px; overflow: hidden; background: var(--bg); }
.outcome-bar > span { display: flex; align-items: center; justify-content: center; min-width: 1px; overflow: hidden; white-space: nowrap;
  font: 0.72rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.outcome-bar > span + span { box-shadow: inset 1px 0 0 var(--surface); }
.seg-punished { background: var(--viz-neutral); color: var(--text); }
.seg-dismissed { background: var(--viz-ochre); color: #fff; }
.seg-acquitted { background: var(--viz-blue); color: #fff; }
.seg-returned { background: var(--viz-strong); color: #fff; }
.seg-pending { background: repeating-linear-gradient(135deg, var(--viz-wash) 0 4px, transparent 4px 8px); color: var(--muted); }
.compare-legend { margin-top: 0.6rem; }
.swatch.seg-pending { border: 1px solid var(--viz-neutral); }

/* воронка */
.funnel { margin: 0 0 1.5rem; }
.funnel svg { display: block; width: 100%; height: auto; max-height: 540px; overflow: visible; }
.funnel .grid { stroke: var(--grid); stroke-width: 0.25; }
.funnel .axis { font: 2.2px ui-monospace, SFMono-Regular, Menlo, monospace; fill: var(--muted); }
.funnel .lim95 { fill: none; stroke: var(--muted); stroke-width: 0.25; stroke-dasharray: 1 0.8; }
.funnel .lim998 { fill: none; stroke: var(--muted); stroke-width: 0.4; }
.funnel .base { stroke: var(--text); stroke-width: 0.3; }
.funnel .base-label { font: 2.2px ui-monospace, SFMono-Regular, Menlo, monospace; fill: var(--text); }
.pt { fill: var(--viz-neutral); stroke: var(--surface); stroke-width: 0.2; }
.pt.high, .pt.high95 { fill: var(--viz-strong); }
.pt.low, .pt.low95 { fill: var(--viz-blue); }
.pt.high95, .pt.low95 { fill-opacity: 0.45; }
.pt.mine { fill: var(--text); fill-opacity: 1; stroke-width: 0.4; }
.pt.mine.high { fill: var(--viz-strong); stroke: var(--text); }
.pt.mine.low { fill: var(--viz-blue); stroke: var(--text); }
.funnel a:hover .pt, .funnel a:focus-visible .pt { stroke: var(--text); stroke-width: 0.5; }
.dot.pt-high { background: var(--viz-strong); } .dot.pt-low { background: var(--viz-blue); }
.dot.pt-plain { background: var(--viz-neutral); } .dot.pt-mine { background: var(--text); }
.line-swatch { display: inline-block; width: 1.3rem; border-top: 1.5px solid var(--muted); }
.line-swatch.lim95 { border-top-style: dashed; border-top-width: 1px; }

/* точки с интервалами */
.forest-block { margin-bottom: 1rem; }
.forest .hbars a, .forest-axis { grid-template-columns: minmax(0, 16rem) minmax(0, 1fr) 8rem; }
.forest-axis { display: grid; gap: 0.6rem; padding: 0 0.25rem; }
.ftrack { position: relative; display: block; height: 18px; }
.forest-axis .ftrack { height: 1.1rem; }
.ftick { position: absolute; transform: translateX(-50%); font: 0.7rem ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.fbase { position: absolute; top: -4px; bottom: -4px; border-left: 1.5px solid var(--text); opacity: 0.55; }
.fci { position: absolute; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--viz-neutral); }
.fdot { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 2px var(--surface); }
.fdot.high, .fdot.high95 { background: var(--viz-strong); }
.fdot.low, .fdot.low95 { background: var(--viz-blue); }
.fdot.high95, .fdot.low95 { opacity: 0.6; }
@media (max-width: 720px) {
  .forest-axis { display: none; }
  .forest .hbars a { grid-template-columns: minmax(0, 1fr) 6.5rem; }
  .forest .ftrack { grid-column: 1 / -1; grid-row: 2; }
  .compare-row { grid-template-columns: 5.5rem minmax(0, 1fr); }
}
.quiet-link { color: inherit; text-decoration: none; } .quiet-link:hover { color: var(--accent); text-decoration: underline; }

/* меню: служебное — в выпадающем «Управление» */
.top nav { flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; color: var(--muted); user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: " ▾"; font-size: 0.8em; }
.menu[open] > summary, .menu > summary:hover, .top nav a:hover { color: var(--text); }
.menu > summary[aria-current="page"] { color: var(--text); font-weight: 600; }
.menu-body { position: absolute; z-index: 40; top: calc(100% + 0.5rem); left: -0.75rem; min-width: 15rem; display: flex; flex-direction: column;
  padding: 0.35rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); }
.top nav .menu-body a { padding: 0.4rem 0.6rem; border-radius: 6px; color: var(--text); }
.top nav .menu-body a:hover, .top nav .menu-body a:focus-visible { background: var(--bg); }
.top nav .menu-body a[aria-current="page"] { background: var(--bg); }
.menu-body .hbar-sub { font-weight: 400; }
@media (max-width: 720px) { .menu-body { left: auto; right: -0.75rem; } }
.tabs { display: flex; gap: 0.25rem; margin: 0 0 1rem; border-bottom: 1px solid var(--border); }
.tabs a { padding: 0.4rem 0.9rem; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }

/* «Обо что спотыкаемся» (Здоровье): этапы пайплайна, подсветка по доле в строке */
.pipeline { font-size: 0.88em; }
.pipeline th, .pipeline td { padding-left: 0.4rem; padding-right: 0.4rem; }
.pipeline th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
.pipeline td:first-child { min-width: 9rem; }
.pipe-arrow { display: block; color: var(--muted); font-weight: 400; }
.pipeline td.lvl-1 { background: var(--warn-bg); }
.pipeline td.lvl-2 { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.pipeline td.lvl-3 { background: var(--down-bg); color: var(--down); font-weight: 600; }
.pipe-reason { font-size: 0.78em; font-weight: 400; color: var(--muted); line-height: 1.2; max-width: 8.5rem; margin-left: auto; }
.trace { max-height: 22rem; overflow: auto; padding: 0.5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; white-space: pre-wrap; font-size: 0.78em; }
.copy-field { width: 100%; font-family: var(--mono, monospace); font-size: 0.85em; margin: 0.25rem 0; }

/* всплывающее окно (<dialog>): добавление пользователя, ссылка для пароля */
.modal { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 16px 48px rgb(0 0 0 / 0.2); }
.modal::backdrop { background: rgb(0 0 0 / 0.35); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal .check { white-space: normal; }
.modal p { margin: 0; }
.modal input[type="email"], .modal input[type="text"] { width: 100%; display: block; margin-top: 0.25rem; }
.modal .two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
/* заявка на доступ */
.card.narrow.wide-form { max-width: 480px; }
.wide-form input[type="email"], .wide-form input[type="text"], .wide-form input[type="password"], .wide-form textarea { width: 100%; box-sizing: border-box; display: block; margin-top: 0.25rem; }
.wide-form textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.55rem; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 480px) { .two-cols { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* фон входа и заявки: судебный монстр в мантии и летающие бумаги — только декор, под карточкой */
:root { --m-fur: #c9683f; --m-fur-dark: #8f3f22; --m-robe: #24221f; --m-paper: #fffdf7; --m-ink: #3a3631; --m-stamp: #c62828; --m-wood: #8a5a32; }
@media (prefers-color-scheme: dark) {
  :root { --m-fur: #d27a4f; --m-fur-dark: #f0a37a; --m-robe: #0d0c0b; --m-paper: #2b2925; --m-ink: #d9d3c8; --m-stamp: #ff6b5e; --m-wood: #b07a4a; }
}
.auth-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; user-select: none; }
body:has(.auth-bg) .top { position: relative; z-index: 2; }
.auth-bg ~ .card { position: relative; z-index: 1; box-shadow: 0 12px 40px rgb(0 0 0 / 0.14); }

.auth-bg .paper-sheet { fill: var(--m-paper); stroke: var(--m-ink); stroke-width: 2.5; stroke-linejoin: round; }
.auth-bg .paper-fold { fill: none; stroke: var(--m-ink); stroke-width: 2.5; stroke-linejoin: round; }
.auth-bg .paper-lines, .auth-bg .pile-lines, .auth-bg .paper-lines-solid { fill: none; stroke: var(--m-ink); stroke-width: 3; stroke-linecap: round; opacity: 0.35; }
.auth-bg .paper-title { font: 700 7.5px Georgia, "Times New Roman", serif; fill: var(--m-ink); letter-spacing: 0.04em; }
.auth-bg .paper-title.small { font-size: 9px; letter-spacing: 0.02em; }
.auth-bg .paper-stamp { fill: none; stroke: var(--m-stamp); stroke-width: 2.5; opacity: 0.85; }

.paper { position: absolute; width: clamp(64px, 7vw, 110px); height: auto; opacity: 0.55; filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.08)); }
.paper.p1 { left: 6%; top: 12%; rotate: -14deg; }
.paper.p2 { left: 20%; top: 58%; rotate: 9deg; }
.paper.p3 { left: 3%; top: 72%; rotate: 22deg; }
.paper.p4 { right: 30%; top: 8%; rotate: 12deg; }
.paper.p5 { right: 8%; top: 16%; rotate: -20deg; }
.paper.p6 { left: 28%; top: 22%; rotate: 6deg; opacity: 0.35; }
.paper.p7 { right: 42%; top: 70%; rotate: -8deg; opacity: 0.4; }
.paper.p8 { left: 12%; top: 38%; rotate: -4deg; opacity: 0.35; }

.monster { position: absolute; right: 2vw; bottom: -6px; width: min(36vw, 460px); height: auto; }
.monster .fur { fill: var(--m-fur); stroke: var(--m-fur-dark); stroke-width: 4; stroke-linejoin: round; }
.monster .horn { fill: var(--m-paper); stroke: var(--m-ink); stroke-width: 3.5; stroke-linejoin: round; }
.monster .brow { fill: none; stroke: var(--m-ink); stroke-width: 7; stroke-linecap: round; }
.monster .eye { fill: #fff; stroke: var(--m-ink); stroke-width: 3.5; }
.monster .pupil { fill: #1b1a18; }
.monster .mouth { fill: #4a1d12; stroke: var(--m-ink); stroke-width: 3.5; stroke-linejoin: round; }
.monster .tooth { fill: #fff; stroke: var(--m-ink); stroke-width: 2; stroke-linejoin: round; }
.monster .robe { fill: var(--m-robe); stroke: var(--m-ink); stroke-width: 3; stroke-linejoin: round; }
.monster .robe-fold { fill: none; stroke: #ffffff; stroke-width: 2; opacity: 0.12; }
.monster .collar { fill: #fff; stroke: var(--m-ink); stroke-width: 2.5; stroke-linejoin: round; }
.monster .arm { fill: var(--m-fur); stroke: var(--m-fur-dark); stroke-width: 4; stroke-linejoin: round; }
.monster .gavel-handle, .monster .gavel-head { fill: var(--m-wood); stroke: var(--m-ink); stroke-width: 3; }
.monster .gavel-band { stroke: #e7c58a; stroke-width: 4; }


@media (prefers-reduced-motion: no-preference) {
  .paper { animation: paper-float 14s ease-in-out infinite alternate; }
  .paper.p2, .paper.p5, .paper.p7 { animation-duration: 18s; animation-delay: -6s; }
  .paper.p3, .paper.p6 { animation-duration: 22s; animation-delay: -11s; }
  @keyframes paper-float { from { translate: 0 0; } to { translate: 14px -26px; } }
  .monster .gavel { transform-box: view-box; transform-origin: 352px 196px; animation: gavel 3.2s ease-in-out infinite; }
  @keyframes gavel { 0%, 70%, 100% { rotate: 0deg; } 80% { rotate: 32deg; } 86% { rotate: 24deg; } }
}
@media (max-width: 760px) {
  .monster { width: 62vw; right: -6vw; opacity: 0.35; }
    .paper { opacity: 0.3; }
}

/* ---- Статьи: год против прошлого года ---------------------------------------------------------------------- */
.article-controls { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 0 0 0.5rem; }
.article-controls .seg { flex: 0 1 auto; }
.article-controls .seg span { padding: 0.3rem 0.7rem; }
a.tile { color: var(--text); text-decoration: none; }
a.tile:hover { border-color: var(--accent); }
.trend-up { color: var(--viz-strong); }
.trend-down { color: var(--viz-blue); }
.trend-flat { color: var(--muted); }
.flow-total { margin: 0 0 1rem; }
.flow-total a { text-decoration: none; }
.yoy-cols { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 100%;
  border-bottom: 1px solid var(--grid); background: linear-gradient(var(--grid), var(--grid)) top / 100% 1px no-repeat; }
.yoy-col { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.yoy-col.off { opacity: 0.45; }
.yoy-col > span { width: 42%; max-width: 20px; min-height: 1px; border-radius: 3px 3px 0 0; }
.yoy-prev, .yoy-prev-swatch, .yoy-bar.prev { background: var(--viz-wash); box-shadow: inset 0 0 0 1px var(--viz-neutral); }
.yoy-cur, .yoy-cur-swatch, .yoy-bar.cur { background: var(--viz-strong); }
.yoy-cur.partial { background: repeating-linear-gradient(135deg, var(--viz-strong) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--viz-strong); }
.yoy-col:hover > span { filter: brightness(1.15); }
.yoy-labels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; text-align: center; }
.swatch.yoy-cur-swatch, .swatch.yoy-prev-swatch { vertical-align: -0.1em; margin: 0 0.15rem 0 0.5rem; }
.flow-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 2rem; margin-top: 1rem; }
@media (min-width: 900px) { .flow-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); } }
.flow-grid .chart-table { max-width: none; }
.years-table td { padding: 0.2rem 0.5rem; }
.years-table tr.current td { font-weight: 600; background: var(--bg); }
.years-table a { text-decoration: none; }
td.bar-cell { width: 40%; min-width: 80px; vertical-align: middle; }
td.bar-cell .hbar-fill { height: 10px; }
.yoy-table td, .yoy-table th { white-space: nowrap; }
.yoy-table td:first-child { white-space: normal; min-width: 12rem; }
.yoy-table th.bar-head { font-weight: 400; }
.yoy-table td.num a { text-decoration: none; }
.yoy-bar { display: block; height: 7px; min-width: 1px; border-radius: 0 3px 3px 0; }
.yoy-bar + .yoy-bar { margin-top: 2px; }
.articles-index td { vertical-align: middle; }
.articles-index th { white-space: nowrap; }
@media (max-width: 600px) { .yoy-cols, .yoy-labels { gap: 3px; } .yoy-labels { font-size: 0.62rem; } }
.metric-switch { display: inline-flex; margin: 0.25rem 0 0.25rem; }
.metric-switch span { padding: 0.35rem 0.9rem; }

/* Заявки на доступ на странице «Пользователи» */
.card.request { margin: 0 0 0.75rem; }
.request-text { margin: 0.4rem 0 0.6rem; white-space: normal; overflow-wrap: anywhere; }
.request-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; }
