/* K.O.R.A. — gold #CFA550 on dark #1F2420 (brand kit); dark theme on navy #111729. Green/red/yellow mean growth/problem/warning only. */
:root {
  --bg: #F2F1EC;
  --surface: #FFFFFF;
  --ink: #1F2420;
  --muted: #6B6F69;
  --line: #DCDAD2;
  --accent: #CFA550;
  --accent-ink: #8A6B22;
  --accent-soft: #F6EEDA;
  --side: #1F2420;
  --side-text: #C9C6BB;
  --side-muted: #86877E;
  --ok: #2F8F5B;
  --ok-soft: #DFF0E5;
  --warn: #D9A21B;
  --warn-soft: #FBF1D3;
  --bad: #C7432B;
  --bad-soft: #F8E1DC;
  --warn-ink: #9A6B00;      /* warning numbers as text: the yellow itself is too light on white */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(.2,.8,.2,1);
  --ease: ease;
  --t-fast: 120ms;
  --t: 200ms;
  --t-slow: 320ms;
  --t-chart: 450ms;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] { --bg: #111729; --surface: #182038; --ink: #E3E8EF; --muted: #9AA3B8;
    --line: #2A3350; --accent: #CFA550; --accent-ink: #E2BE6E; --accent-soft: #2E2D33;
    --side: #0C1120; --side-text: #B9C0D0; --side-muted: #7C869C;
    --ok: #4FB37A; --ok-soft: #1B3328; --warn: #E0B030; --warn-soft: #3A3318; --warn-ink: #E0B030;
    --bad: #E06A52; --bad-soft: #3B2024; }
}
html[data-theme="dark"] { --bg: #111729; --surface: #182038; --ink: #E3E8EF; --muted: #9AA3B8;
  --line: #2A3350; --accent: #CFA550; --accent-ink: #E2BE6E; --accent-soft: #2E2D33;
  --side: #0C1120; --side-text: #B9C0D0; --side-muted: #7C869C;
  --ok: #4FB37A; --ok-soft: #1B3328; --warn: #E0B030; --warn-soft: #3A3318; --warn-ink: #E0B030;
  --bad: #E06A52; --bad-soft: #3B2024; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); font-size: 15px; line-height: 1.45; color: var(--ink);
  background: var(--bg); display: grid; grid-template-columns: 224px minmax(0, 1fr);
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: var(--accent-ink); }
h1 { font: 600 26px/1.15 var(--sans); margin: 0 0 18px; letter-spacing: -0.015em; }
h2 { font: 600 17px/1.2 var(--sans); margin: 34px 0 10px; }
p { margin: 0 0 12px; max-width: 72ch; }
.lead { color: var(--muted); }
.muted, tr.muted td { color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin-top: 14px; max-width: 80ch; }
.small { font-size: 12px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: var(--accent-soft); padding: 1px 5px; border-radius: 3px; }



/* status line */
.pulse-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px;
  padding: 12px 16px; background: var(--surface); border-left: 4px solid var(--ok); border-radius: 4px; margin-bottom: 28px;
}
.pulse-line:has(.dot.bad) { border-left-color: var(--bad); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.ok { animation: pulse 2.4s ease-in-out infinite; }
.dot.bad { background: var(--bad); }
.pulse-line a.warn { color: var(--bad); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(47,143,91,.55); } 60% { box-shadow: 0 0 0 7px rgba(47,143,91,0); } }
@media (prefers-reduced-motion: reduce) { .dot.ok { animation: none; } }

/* hero */
.hero .big { margin-bottom: 22px; }
.hero .label { display: block; color: var(--muted); font-size: 14px; }
.hero .value { display: block; font: 700 56px/1.05 var(--sans); letter-spacing: -0.03em; margin: 6px 0 8px; color: var(--ink); }
table.bars { border-collapse: collapse; width: 100%; max-width: 860px; }
table.bars th { text-align: left; font-weight: 500; padding: 7px 14px 7px 0; white-space: nowrap; width: 1%; }
table.bars td { padding: 7px 0; }
table.bars td.bar { width: 100%; }
table.bars td.bar div { height: 18px; background: var(--accent); border-radius: 2px; min-width: 2px; }
table.bars td.n { text-align: right; padding-left: 16px; white-space: nowrap; }

/* data tables */
table.data { border-collapse: collapse; width: 100%; background: var(--surface); font-size: 14px; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th.n, table.data td.n { text-align: right; white-space: nowrap; }
table.data tr.bad td { background: var(--bad-soft); }
table.data.compact td, table.data.compact th { padding: 6px 10px; }
.scroll { overflow-x: auto; max-width: 100%; }
details { margin-top: 18px; }
summary { cursor: pointer; color: var(--accent-ink); margin-bottom: 10px; }

/* forms and buttons */
button, .btn { font: 500 14px var(--sans); background: var(--accent); color: #1F2420; border: 0; border-radius: 6px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.25; }
button:hover, .btn:hover { background: #B88F3E; color: #1F2420; }
button.secondary, .btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); padding: 8px 15px; }
button.secondary:hover, .btn.secondary:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
button.danger { background: var(--surface); color: var(--bad); border: 1px solid var(--bad); padding: 8px 15px; }
button.danger:hover { background: var(--bad-soft); color: var(--bad); }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.actions form { margin: 0; }
form.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-width: 380px; background: var(--surface); padding: 20px; border-radius: 6px; border: 1px solid var(--line); }
form.stack.wide { max-width: 520px; }
form.stack label, form.login label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; font-size: 13px; color: var(--muted); }
form.stack .person-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
form.stack .location-fields { display: none; }
form.stack.is-location .person-fields { display: none; }
form.stack.is-location .location-fields { display: grid; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
input, select, textarea { font: 400 15px var(--sans); color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
input[type=file] { padding: 6px; }
textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; resize: vertical; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0 8px 4px 0; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.flash { padding: 10px 14px; border-radius: 5px; margin-bottom: 18px; }
.flash.ok { background: var(--ok-soft); color: var(--ink); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.empty { background: var(--surface); padding: 28px; border-radius: 6px; max-width: 600px; border: 1px solid var(--line); }
.empty h2 { margin-top: 0; }
.crumbs { font-size: 13px; margin-bottom: 6px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; margin-left: 4px; }
.sqlform { margin-bottom: 16px; }

/* users management */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { width: 300px; max-width: 100%; }
.toolbar .spacer { flex: 1; }
.tabs { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.tab { background: none; color: var(--muted); padding: 6px 11px; border-radius: 4px; }
.tab span { opacity: .7; margin-left: 4px; font-weight: 400; }
.tab:hover { background: var(--accent-soft); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--accent-soft); padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; }
.bulkbar span { font-weight: 500; margin-right: 6px; }
table.data.users td.chk, table.data.users th.chk { width: 28px; padding-right: 0; }
table.data.users input[type=checkbox] { accent-color: var(--accent); }

/* login */
body.login-body { display: flex; align-items: center; justify-content: center; }
form.login { background: var(--surface); border-radius: 10px; width: 380px; display: grid; gap: 14px; padding: 0 34px 32px; overflow: hidden; border: 1px solid var(--line); }
form.login .logo { background: #1F2420; margin: 0 -34px 6px; padding: 28px 34px 22px; }
form.login .logo img { height: 56px; display: block; }
form.login .sub { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
form.login button { margin-top: 6px; }


/* dashboard */
.pagehead { margin-bottom: 18px; }
.pagehead h1 { margin-bottom: 10px; }
.filters { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 3px; }
.chip { padding: 6px 12px; border-radius: 4px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.chip:hover { background: var(--accent-soft); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); }
.chip.custom { display: inline-flex; gap: 6px; align-items: center; }
.chip.custom input { padding: 3px 6px; font-size: 13px; background: var(--surface); color: var(--ink); }
.chip.custom.on { background: var(--accent-soft); color: var(--ink); }
.alerts { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 6px; }
.alerts li { padding: 9px 14px; border-radius: 5px; border-left: 4px solid var(--warn); background: var(--warn-soft); }
.alerts li.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.kpi-line { font-size: 13px; margin-bottom: 26px; }
.chart-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px 10px; margin-bottom: 10px; }
.chart-wrap h2 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 500; }
table.data.rank td.bar { width: 22%; padding: 12px 8px 0; }
table.data.rank td.bar div { height: 10px; background: var(--accent); border-radius: 2px; min-width: 2px; }
.side li.group { color: var(--side-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 16px 10px 4px; }
pre.log { background: var(--side); color: #D6DBD3; font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace; padding: 14px 16px; border-radius: 6px; overflow-x: auto; max-height: 420px; white-space: pre-wrap; }

/* data coverage calendar */
:root { --info: #4A8FE7; --info-soft: #DCE8FA; }
html[data-theme="dark"], html[data-theme="auto"] { --info: #5B9BF0; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.ok, .cal-cell.ok, .ybar .ok { background: var(--ok); }
.sw.work, .cal-cell.work, .ybar .work { background: var(--info); }
.sw.wait, .cal-cell.wait, .ybar .wait { background: var(--warn); }
.sw.none, .cal-cell.none, .ybar .none { background: var(--line); }
.year { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; margin-bottom: 16px; }
.year header { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.year h2 { margin: 0 0 6px; font-size: 22px; }
.ytitle { flex: 1; min-width: 0; }
.ybar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); max-width: 560px; }
.ybar i { display: block; height: 100%; }
.donut { --p-ok: 0; --p-work: 0; --p-wait: 0; --p-none: 0; width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--ok) 0 calc(var(--p-ok) * 1%), var(--info) 0 calc((var(--p-ok) + var(--p-work)) * 1%), var(--warn) 0 calc((var(--p-ok) + var(--p-work) + var(--p-wait)) * 1%), var(--bad) 0 100%); }
.donut::before { content: ""; position: absolute; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); }
.donut { position: relative; }
.donut span { position: relative; font-size: 13px; font-weight: 600; }
.months { display: grid; gap: 6px; }
.month { display: grid; grid-template-columns: 36px 1fr 60px; align-items: center; gap: 10px; }
.mname { color: var(--muted); font-size: 13px; }
.mcount { font-size: 13px; color: var(--muted); text-align: right; }
.mcount.full { color: var(--ok); }
.cells { display: grid; grid-template-columns: repeat(31, 1fr); gap: 3px; max-width: 760px; }
.cal-cell { display: block; aspect-ratio: 1; border-radius: 3px; opacity: .9; transition: transform var(--t-fast) var(--ease-out); }
.cal-cell:hover { opacity: 1; transform: scale(1.35); z-index: 2; outline: 2px solid var(--ink); }
.tip { position: absolute; z-index: 20; background: var(--ink); color: var(--bg); padding: 8px 11px; border-radius: 6px; font-size: 13px; line-height: 1.4; max-width: 300px; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.tip .why { color: var(--warn); }

/* tasks */
.now { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 6px; padding: 14px 16px; margin-bottom: 24px; }
.now:has(.dot.bad) { border-left-color: var(--bad); }
.now .grow { flex: 1; min-width: 0; }
.pbar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 8px 0 4px; max-width: 520px; }
.pbar i { display: block; height: 100%; background: var(--accent); transition: width var(--t-chart) var(--ease-out); }
.taskgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.taskcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.taskcard p { font-size: 13px; color: var(--muted); flex: 1; margin: 0; }
.taskcard .tt { display: flex; align-items: center; gap: 8px; }
.tag.лёгкая { color: var(--ok); border-color: var(--ok); }
.tag.средняя { color: var(--warn); border-color: var(--warn); }
.tag.тяжёлая { color: var(--bad); border-color: var(--bad); }
form.sched { grid-template-columns: 1fr 1fr; }
form.sched .row, form.sched .note { grid-column: 1 / -1; }
form.sched input[type=number] { width: 120px; }

/* switches, report layout */
.switch { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.switch a { padding: 5px 11px; border-radius: 4px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; white-space: nowrap; }
.switch a.on { background: var(--ink); color: var(--bg); }
.switch.small a { padding: 3px 9px; font-size: 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-head h2 { margin: 0; }
.filters.sub { margin: 4px 0 14px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.two h2 { margin-top: 10px; }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.warn-text { color: var(--bad); }
table.data tr.total td { font-weight: 600; border-top: 2px solid var(--line); }
table.data tr.weekend td:nth-child(2) { color: var(--accent-ink); }
table.data tr.today td { background: var(--accent-soft); }
th.sort { cursor: pointer; user-select: none; }
th.sort[data-dir="asc"]::after { content: " ↑"; } th.sort[data-dir="desc"]::after { content: " ↓"; }
.taskcard.link { text-decoration: none; color: var(--ink); }
.taskcard.link:hover { border-color: var(--accent); }

/* catalog */
.headrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.headrow h1 { margin: 0; }
.catalog { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.catalog.editing { grid-template-columns: 240px minmax(0, 1fr); }
.catalog-main { min-width: 0; }
.groups-tree { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow: auto; }
.groups-tree h2 { margin: 0 0 8px; font-size: 14px; }
.groups-tree input { width: 100%; margin-bottom: 8px; font-size: 13px; padding: 5px 8px; }
.groups-tree ul { list-style: none; margin: 0; padding: 0; }
.groups-tree li.lvl2 { padding-left: 12px; } .groups-tree li.lvl3 { padding-left: 24px; } .groups-tree li.lvl4 { padding-left: 36px; }
.groups-tree .node { display: block; padding: 4px 6px; border-radius: 4px; font-size: 13px; cursor: default; }
.groups-tree .node.over { background: var(--accent); color: #1F2420; }
.catalog-table tr.has-draft td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.catalog-table tr[draggable] { cursor: grab; }
.bulk-op { display: inline-block; }
.bulk-op summary { cursor: pointer; font-weight: 500; padding: 4px 8px; border-radius: 4px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; list-style: none; }
.bulk-op[open] summary { border-color: var(--accent); }
.bulk-op .op { position: absolute; z-index: 15; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-top: 4px; display: grid; gap: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15); min-width: 240px; }
.bulk-op .op input, .bulk-op .op select { font-size: 13px; padding: 5px 8px; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
table.kv th { width: 40%; text-align: left; font-weight: 500; color: var(--muted); }
ul.plain { list-style: none; padding: 0; margin: 0; }

/* ---------- layout: sidebar, topbar (mobile), main ---------- */
main { min-width: 0; padding: 30px 40px 60px; max-width: 1240px; }
.topbar { display: none; }
.backdrop { display: none; }
.side { background: var(--side); color: var(--side-text); padding: 22px 14px 16px; display: flex; flex-direction: column; min-height: 100vh; position: sticky; top: 0; }
.side .brand { display: block; padding: 4px 10px 22px; }
.side .brand img { height: 44px; width: auto; display: block; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--side-text); text-decoration: none; font-weight: 500; }
.side li a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side li a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side li a[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 600; }
.side li a[aria-current="page"] svg { stroke: var(--accent); }
.side ul.sub { margin: 2px 0 6px; }
.side ul.sub li a { min-height: 38px; padding-left: 44px; font-size: 14px; font-weight: 400; color: var(--side-muted); }
.side ul.sub li a[aria-current="page"] { color: #fff; background: none; font-weight: 600; }
.side li.group { color: var(--side-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 18px 12px 6px; }
.side .me { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 8px; }
.side .me .avatar, .me-mini { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 600; flex: none; text-decoration: none; }
.side .me .who { flex: 1; min-width: 0; color: #fff; text-decoration: none; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.side .me .who small { display: block; color: var(--side-muted); font-size: 12px; font-weight: 400; }
.side .me form { margin: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; background: transparent; border: 0; color: var(--side-text); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
:root { --side-active: #2F3A2F; }
html[data-theme="dark"] { --side-active: #1C2440; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] { --side-active: #1C2440; } }
/* the menu column is exactly one screen tall and scrolls on its own: on a page shorter than the menu it never spills
   below its dark background, on a long page it stays in place (the phone drawer below is not touched) */
@media (min-width: 761px) {
  body { height: auto; min-height: 100vh; }
  .side { height: 100vh; min-height: 0; overflow-y: auto; align-self: start; }
}

/* ---------- filters: pill groups ---------- */
.headrow { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.headrow h1 { margin: 0; flex: 1 1 auto; }
.fresh { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.pill-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.pill-group .lbl { color: var(--muted); font-size: 14px; padding: 0 6px 0 8px; }
.pill { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.pill:hover { color: var(--ink); background: var(--accent-soft); }
.pill.on { background: var(--accent); color: #1F2420; font-weight: 600; }
.pill.disabled { color: var(--line); cursor: not-allowed; }
.pill-group[aria-label="НДС"] .pill.on, .pill-group[aria-label="Сравнение"] .pill.on { background: var(--ink); color: var(--bg); }
.pill-group.select { padding: 0 10px; min-height: 46px; align-items: center; }
.pill-group.select select { background: transparent; border: 0; color: var(--ink); font: inherit; font-weight: 600; padding: 8px 4px; max-width: 260px; }
.pill-dates { position: relative; }
.pill-dates summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 36px; }
.pill-dates summary::-webkit-details-marker { display: none; }
.pill-dates.on summary { background: var(--accent-soft); color: var(--ink); }
.dates-form { position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; gap: 8px; align-items: end; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.dates-form { flex-wrap: wrap; }
.dates-form .chosen { flex: 1 0 100%; font-weight: 600; font-size: 14px; }
.dates-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.btn.csv { margin-left: auto; }

/* ---------- KPI cards, facts ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 12px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: grid; gap: 8px; min-width: 0; }
.kpi .label { color: var(--muted); font-size: 13px; letter-spacing: .02em; text-transform: uppercase; font-weight: 600; }
.kpi .hint { display: block; color: var(--muted); font-size: 12px; margin: 2px 0 0; text-transform: none; font-weight: 400; letter-spacing: 0; }
.kpi .value { font-size: clamp(22px, 2.4vw, 32px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; white-space: nowrap; }
.kpi .sub { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kpi .sub .was { white-space: nowrap; }
.delta { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px; font-weight: 600; font-size: 14px; white-space: nowrap; background: var(--line); color: var(--ink); }
.delta.up { background: var(--ok-soft); color: var(--ok); }
.delta.down { background: var(--bad-soft); color: var(--bad); }
.delta.flat { background: var(--line); color: var(--muted); }
.delta.none { background: none; color: var(--muted); font-weight: 400; padding: 0; }
table .delta { padding: 1px 6px; font-size: 13px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 24px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: grid; gap: 2px; min-width: 0; }
.fact .l { color: var(--muted); font-size: 13px; }
.fact b { font-size: 17px; white-space: nowrap; }
.fact .m { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.tag { white-space: nowrap; }
.closed-note summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 8px; }
table.data.nowrap-first td:first-child { white-space: nowrap; }
table.data tr.wh td { color: var(--muted); }
.flash.warn { background: var(--warn-soft); color: var(--ink); }
.muted.small.wrap { white-space: normal; }

/* ---------- mobile & tablet ---------- */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.three { grid-template-columns: minmax(0, 1fr); }
  main { padding: 24px 24px 50px; }
}
@media (max-width: 760px) {
  body { grid-template-columns: minmax(0, 1fr); font-size: 14px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; height: 60px; align-items: center; gap: 8px; padding: 0 8px 0 4px; background: var(--side); border-bottom: 1px solid rgba(255,255,255,.08); }
  .topbar .brand img { height: 30px; width: auto; display: block; }
  .topbar .spacer { flex: 1; }
  .menu-btn { width: 44px; height: 44px; border: 0; background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; padding: 0; }
  .menu-btn:hover { background: rgba(255,255,255,.08); }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(5,8,18,.6); opacity: 0; pointer-events: none; transition: opacity 220ms var(--ease); z-index: 40; }
  .backdrop.show { opacity: 1; pointer-events: auto; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); z-index: 50; transform: translateX(-104%); overflow-y: auto; padding: 16px 12px; visibility: hidden;
    transition: transform 240ms var(--ease-out), visibility 0s linear 240ms; }
  .side.open { transform: none; visibility: visible; transition-delay: 0s; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .side.open li { animation: slide-in var(--t) var(--ease-out) both; animation-delay: calc(60ms + var(--n, 0) * 18ms); }
  .side li:nth-child(1) { --n: 0 } .side li:nth-child(2) { --n: 1 } .side li:nth-child(3) { --n: 2 } .side li:nth-child(4) { --n: 3 } .side li:nth-child(5) { --n: 4 } .side li:nth-child(6) { --n: 5 }
  .side li:nth-child(7) { --n: 6 } .side li:nth-child(8) { --n: 7 } .side li:nth-child(9) { --n: 8 } .side li:nth-child(10) { --n: 9 } .side li:nth-child(11) { --n: 10 } .side li:nth-child(12) { --n: 11 }
  .side .rail-btn { display: none; }
  .side .brand img { height: 30px; }
  .side li a { min-height: 50px; font-size: 16px; }
  .side ul.sub li a { min-height: 44px; }
  body.menu-open { overflow: hidden; }
  main { padding: 16px 14px 40px; }
  h1 { font-size: 22px; } h2 { font-size: 16px; }
  .kpis, .kpis.three, .kpis.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px 12px; } .kpi .value { font-size: 22px; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .filters { gap: 8px; }
  .pill-group { max-width: 100%; }
  .pill-group[aria-label="Период"] { flex-wrap: nowrap; overflow-x: auto; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .pill-group.select { width: 100%; }
  .pill-group.select .lbl { display: inline-flex; align-items: center; min-height: 44px; }
  .pill, .pill-group.select select, .pill-group .lbl { min-height: 44px; }
  .pill { padding: 0 14px; }
  .btn.csv { margin-left: 0; }
  .btn, button, .chip, .switch a { min-height: 44px; }
  button.small, .btn.small { min-height: 44px; }
  .scroll { margin: 0 -14px; padding: 0 14px; }
  table.data { font-size: 13px; min-width: 100%; }
  table.data th, table.data td { padding: 8px 8px; white-space: nowrap; }
  table.data.rank td.bar { display: none; }
  .hero .value { font-size: 36px; }
  .toolbar input[type=search] { width: 100%; } .tabs { overflow-x: auto; max-width: 100%; }
  .row-actions { white-space: normal; }
  form.inline { flex-wrap: wrap; }
  form.stack, form.stack.wide { max-width: none; }
  form.stack .person-fields { grid-template-columns: 1fr; }
  form.sched { grid-template-columns: 1fr; }
  .taskgrid { grid-template-columns: 1fr; }
  .cells { max-width: none; } .month { grid-template-columns: 28px 1fr 42px; gap: 6px; }
  .year { padding: 12px; } .donut { width: 52px; height: 52px; } .donut::before { width: 36px; height: 36px; }
  pre.log { font-size: 11px; }
  .chart-wrap canvas { max-height: 220px; }
  .catalog.editing { grid-template-columns: minmax(0, 1fr); } .groups-tree { position: static; max-height: 240px; }
  .dates-form { flex-wrap: wrap; }
  input, select { min-height: 44px; }
}

form.stack label.check { display: flex; align-items: center; gap: 10px; }
.filters.sub { flex-wrap: nowrap; overflow-x: auto; }
.filters.sub .switch { flex: none; flex-wrap: nowrap; }
@media (max-width: 1100px) { table.data.rank td.bar, table.data.rank th:nth-child(3):empty { display: none; } }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; margin-left: -4px; }
.crumbs { margin-bottom: 0; }
.closed-note summary { display: inline-flex; align-items: center; min-height: 44px; }


/* ---------- motion (items 32-48) ---------- */
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { width: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes ring { from { --p-ok: 0; --p-work: 0; --p-wait: 0; --p-none: 0; } }
@property --p-ok { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --p-work { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --p-wait { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --p-none { syntax: '<number>'; inherits: false; initial-value: 0; }

/* page transitions (item 33) */
@view-transition { navigation: auto; }
.side { view-transition-name: sidebar; }
.topbar { view-transition-name: topbar; }
::view-transition-old(root) { animation: var(--t-fast) var(--ease) both fade-out; }
::view-transition-new(root) { animation: var(--t) var(--ease-out) both fade-in-up; }

/* loading bar (item 34) */
.loadbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); box-shadow: 0 0 8px var(--accent); z-index: 100; opacity: 0; transition: width var(--t-slow) var(--ease-out), opacity var(--t) var(--ease); pointer-events: none; }
.loadbar.show { opacity: 1; }
.loadbar.done { opacity: 0; transition: width var(--t-fast) var(--ease-out), opacity var(--t) var(--ease); }

/* sliding thumb under the active pill (item 36) */
.pill-group, .switch { position: relative; }
.pill-group .pill, .switch a { position: relative; z-index: 1; transition: color var(--t) var(--ease); }
.pill-thumb { position: absolute; z-index: 0; border-radius: 8px; background: var(--accent); opacity: 0; transition: left var(--t-slow) var(--ease-out), width var(--t-slow) var(--ease-out), top var(--t-slow) var(--ease-out), height var(--t-slow) var(--ease-out), opacity var(--t) var(--ease); }
.pill-thumb.no-anim { transition: none; }
.switch .pill-thumb { border-radius: 4px; background: var(--ink); }
.pill-group[aria-label="НДС"] .pill-thumb, .pill-group[aria-label="Сравнение"] .pill-thumb { background: var(--ink); }
.has-thumb .pill.on, .has-thumb a.on { background: transparent !important; }

/* soft navigation (item 37) */
main.swapping .kpi .value, main.swapping .fact b { opacity: .35; transform: translateY(4px); transition: opacity 180ms var(--ease), transform 180ms var(--ease); }
.kpi .value, .fact b { transition: opacity 180ms var(--ease), transform 180ms var(--ease); }

/* hint bubble (item 38) */
.bubble { position: absolute; z-index: 60; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; font-size: 13px; max-width: 300px; opacity: 0; transform: translateY(-4px); transition: opacity 250ms var(--ease), transform 250ms var(--ease-out); pointer-events: none; }
.bubble.show { opacity: 1; transform: none; }

/* first paint (items 39, 41) */
body:not(.soft) .kpi, body:not(.soft) .fact, body:not(.soft) .chart-wrap, body:not(.soft) table.data, body:not(.soft) .year, body:not(.soft) .taskcard { animation: rise var(--t-slow) var(--ease-out) both; }
body:not(.soft) .kpi:nth-child(2), body:not(.soft) .fact:nth-child(2), body:not(.soft) .taskcard:nth-child(2) { animation-delay: 40ms; }
body:not(.soft) .kpi:nth-child(3), body:not(.soft) .fact:nth-child(3), body:not(.soft) .taskcard:nth-child(3) { animation-delay: 80ms; }
body:not(.soft) .kpi:nth-child(4), body:not(.soft) .fact:nth-child(4), body:not(.soft) .taskcard:nth-child(4) { animation-delay: 120ms; }
body:not(.soft) .chart-wrap { animation-delay: 120ms; }
body:not(.soft) table.data { animation-delay: 160ms; }
body:not(.soft) td.bar div, body:not(.soft) table.bars td.bar div { animation: grow var(--t-chart) var(--ease-out) both; animation-delay: calc(160ms + var(--i, 0) * 20ms); }
body:not(.soft) .ybar i, body:not(.soft) .pbar i { animation: grow var(--t-chart) var(--ease-out) both; }
body:not(.soft) .donut { animation: ring 600ms var(--ease-out) both; }
body:not(.soft) .month { animation: fade var(--t) var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }

/* hover, active, focus (items 42, 43) */
@media (hover: hover) {
  .side li a, button, .btn, .pill, table.data tr, .taskcard, .kpi, .fact, .chart-wrap { transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t) var(--ease); }
  table.data tbody tr:hover td, table.data tr:hover td { background: var(--accent-soft); }
  table.data tr.total:hover td, table.data tr:first-child:hover th { background: transparent; }
  .kpi:hover, .fact:hover, .taskcard:hover { border-color: var(--accent); }
}
button:active, .btn:active, .pill:active, .switch a:active { transform: scale(.96); transition: transform 100ms var(--ease); }
button, .btn, .pill, .switch a { transition: transform 100ms var(--ease); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; transition: outline-color var(--t-fast) var(--ease); }

/* popovers, disclosures (item 44) */
details[open] > .dates-form, details[open] > .op { animation: pop var(--t) var(--ease-out) both; }
.closed-note[open] > :not(summary) { animation: fade var(--t-slow) var(--ease-out) both; }
.tip { transition: opacity var(--t-fast) var(--ease); }

/* sort feedback (item 46) */
th.sort::after { display: inline-block; transition: transform var(--t) var(--ease); }
th.sort[data-dir="asc"]::after { content: " ↑"; } th.sort[data-dir="desc"]::after { content: " ↑"; transform: rotate(180deg); }
table.sorting { opacity: .55; transition: opacity 150ms var(--ease); }
table.data { transition: opacity 150ms var(--ease); }

/* csv (item 47), fresh text (item 48) */
a.csv.ok { color: var(--ok); border-color: var(--ok); }
[data-ts] { transition: opacity var(--t) var(--ease); } [data-ts].fade { opacity: 0; }

/* reduce motion (item 32) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}

/* ---------- 49-51: dates pill, popover width, user block ---------- */
.pill-dates { display: inline-flex; align-items: center; }
.pill-dates summary.pill { min-height: 36px; }
.dates-form { min-width: 260px; }
.side .me { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px 6px; }
.side .me .who { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; min-width: 0; }
.side .me .who .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .me .icon-btn { width: 36px; height: 36px; }
.side .me form { grid-column: 3; }
.side .me > a.icon-btn { grid-column: 2; }
.side .me .who + .icon-btn { justify-self: end; }
.side .brand .mark { display: none; height: 32px; }
.side .rail-btn { display: none; }

/* ---------- 52: icon rail between 761 and 1100 ---------- */
@media (min-width: 761px) and (max-width: 1100px) {
  body:not(.rail-open) { grid-template-columns: 72px minmax(0, 1fr); }
  body:not(.rail-open) .side { padding: 16px 10px; }
  body:not(.rail-open) .side .brand { padding: 0 0 14px; display: flex; justify-content: center; }
  body:not(.rail-open) .side .brand .word { display: none; } body:not(.rail-open) .side .brand .mark { display: block; }
  body:not(.rail-open) .side li a { justify-content: center; padding: 0; }
  body:not(.rail-open) .side li a .lbl, body:not(.rail-open) .side ul.sub, body:not(.rail-open) .side li.group, body:not(.rail-open) .side .me .lbl, body:not(.rail-open) .side .me .icon-btn, body:not(.rail-open) .side .me form { display: none; }
  body:not(.rail-open) .side .me { grid-template-columns: 1fr; justify-items: center; }
  .side .rail-btn { display: inline-flex; margin: -6px auto 10px; width: 36px; height: 36px; }
  body.rail-open .side .rail-btn svg { transform: rotate(180deg); }
  body.rail-open { grid-template-columns: 224px minmax(0, 1fr); }
  main { padding: 24px 24px 50px; }
}

/* ---------- 53: mobile filter sheet ---------- */
.filters-summary, .sheet-backdrop, .sheet-head, .csv-top { display: none; }
@media (max-width: 760px) {
  .filters-summary { display: block; width: 100%; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 400; min-height: 44px; margin-bottom: 10px; }
  .filters-summary .change { float: right; color: var(--accent-ink); font-weight: 600; }
  .filters-wrap .filters { position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; background: var(--surface); border-radius: 16px 16px 0 0; padding: 14px 16px 24px; box-shadow: 0 -8px 30px rgba(0,0,0,.3); flex-direction: column; align-items: stretch; gap: 10px; transform: translateY(104%); visibility: hidden; transition: transform 240ms var(--ease-out), visibility 0s linear 240ms; max-height: 85vh; overflow-y: auto; margin: 0; }
  .filters-wrap .filters.sheet-open { transform: none; visibility: visible; transition-delay: 0s; }
  .sheet-backdrop { display: block; position: fixed; inset: 0; background: rgba(5,8,18,.6); z-index: 54; opacity: 0; pointer-events: none; transition: opacity 220ms var(--ease); }
  body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
  body.sheet-open { overflow: hidden; }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; }
  .sheet-head .icon-btn { color: var(--ink); }
  .filters .btn.csv { display: none; }
  .csv-top { display: inline-flex; margin-left: auto; }
  .filters-wrap .filters .pill-group { width: 100%; }
  /* 54: forecast card full width */
  .kpis.three.forecast .kpi:nth-child(3) { grid-column: 1 / -1; }
  .kpi .sub { white-space: normal; }
}

/* ---------- 55: catalog table ---------- */
.catalog-table td.name { min-width: 280px; max-width: 460px; white-space: normal; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.catalog-table .cell[contenteditable] { outline: 1px dashed transparent; cursor: text; }
.catalog-table .cell[contenteditable]:hover { outline-color: var(--line); }
.catalog-table .cell[contenteditable]:focus { outline: 2px solid var(--accent); background: var(--surface); -webkit-line-clamp: unset; }
.catalog-table .changed { background: var(--accent-soft); font-weight: 600; }

/* footer / version */
.foot { margin-top: 48px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.foot a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.foot a:hover { color: var(--accent-ink); }
form.login .ver { margin: 4px 0 0; text-align: center; font-size: 12px; }
table.data tr.current td { background: var(--accent-soft); }
.alerts li.info { border-left-color: var(--info); background: var(--info-soft); }
html[data-theme="dark"] .alerts li.info { background: #1a2338; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .alerts li.info { background: #1a2338; } }

/* ---------- dropouts ---------- */
.sig { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sig.bad { background: var(--bad-soft); color: var(--bad); }
.sig.warn { background: var(--warn-soft); color: var(--ink); }
.sig.info { background: var(--info-soft, #DCE8FA); color: var(--info); }
.sig.ok { background: var(--ok-soft); color: var(--ok); }
.block { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.block.strong { color: #fff; background: var(--bad); border-color: var(--bad); }
.dsum { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); gap: 12px; margin-bottom: 14px; }
.dtypes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.dtype { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); min-height: 44px; }
.dtype b { font-size: 20px; line-height: 1; }
.dtype span { font-size: 12px; color: var(--muted); }
.dtype.bad b { color: var(--bad); } .dtype.warn b { color: var(--warn-ink); } .dtype.info b { color: var(--info); } .dtype.ok b { color: var(--ok); }
.dtype.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.alerts li.ok-alert { border-left-color: var(--ok); background: var(--ok-soft); }
.rating { margin-bottom: 14px; } .rating summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.dlist { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; transition: opacity 150ms var(--ease); }
.dlist.sorting { opacity: .55; }
.dhead, .dgrid { display: grid; grid-template-columns: minmax(200px, 2.2fr) minmax(110px, 1fr) minmax(130px, 1.1fr) 90px 80px 90px 100px minmax(160px, 1.6fr); gap: 10px; align-items: start; padding: 9px 14px; }
.dlist:has(.dhead > :nth-child(8):last-child) .dhead, .dlist:has(.dhead > :nth-child(8):last-child) .dgrid { grid-template-columns: minmax(200px, 2.2fr) minmax(130px, 1.1fr) 90px 80px 90px 100px minmax(160px, 1.6fr); }
.dhead { border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.dhead button, .dhead span { background: none; border: 0; color: inherit; font: inherit; padding: 0; text-align: left; cursor: pointer; min-height: 0; }
.dhead .n { text-align: right; }
.dhead .sorted::after { content: " ↓"; } .dhead .sorted[data-dir="asc"]::after { content: " ↑"; }
.drow { border-bottom: 1px solid var(--line); }
.drow:last-child { border-bottom: 0; }
.drow > summary { list-style: none; cursor: pointer; }
.drow > summary::-webkit-details-marker { display: none; }
.drow.checked > summary { opacity: .6; }
.drow[open] > summary { background: var(--accent-soft); }
@media (hover: hover) { .drow > summary:hover { background: var(--accent-soft); } }
.c-n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-com { grid-column: 1 / -1; color: var(--muted); margin-top: -2px; }
.cmt { color: var(--ink); white-space: nowrap; }
.dbody { padding: 12px 14px 16px; border-top: 1px dashed var(--line); animation: fade var(--t) var(--ease) both; }
.dgrid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; }
.dfull { font-size: 15px; margin-bottom: 6px; }
.dcomments h3 { margin: 0 0 8px; font-size: 14px; }
.cm { padding: 8px 10px; border-radius: 8px; background: var(--bg); margin-bottom: 6px; font-size: 14px; }
form.dcomment { display: grid; gap: 8px; margin-top: 8px; }
form.dcomment textarea { font-family: var(--sans); font-size: 14px; min-height: 64px; }
.groups-form tr.sugg td { background: var(--warn-soft); }
.groups-form .row { margin-bottom: 10px; }
.dropcard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; text-decoration: none; color: var(--ink); }
.dropcard > div:first-child { display: grid; gap: 2px; }
.dropcard .label { color: var(--muted); font-size: 13px; text-transform: uppercase; font-weight: 600; letter-spacing: .02em; }
.dropcard b { font-size: 18px; }
.dropcard .top3 { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.dropcard .top3 b { font-size: 14px; color: var(--ink); }
.dropcard .go { color: var(--accent-ink); font-weight: 600; white-space: nowrap; }
@media (hover: hover) { .dropcard:hover { border-color: var(--accent); } }
@media (max-width: 1100px) {
  .dsum { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dtypes { grid-column: 1 / -1; }
  .dhead { display: none; }
  .dgrid, .dlist:has(.dhead > :nth-child(8):last-child) .dgrid { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name lost" "sig sig" "shop shop" "src src" "com com"; gap: 6px 10px; padding: 12px 14px; }
  .c-name { grid-area: name; } .c-lost { grid-area: lost; font-size: 16px; } .c-sig { grid-area: sig; } .c-shop { grid-area: shop; font-size: 13px; }
  .c-src { grid-area: src; } .c-com { grid-area: com; margin: 0; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .drow[open] .c-com { -webkit-line-clamp: unset; }
  .c-stock, .c-rate, .c-silent { display: none; }
  .dgrid2 { grid-template-columns: minmax(0, 1fr); }
  .dropcard { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 760px) { .dtypes { grid-template-columns: repeat(2, minmax(0, 1fr)); } form.dcomment textarea { min-height: 88px; } }
/* dropouts v2.210: network stock under the recommendation */
.netline { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.netline .sus, table.dnet tr.sus td { color: var(--muted); opacity: .7; }
.netline .sus { text-decoration: underline dotted; cursor: help; }
.netnote { display: block; font-style: italic; }
.dnet-h { margin: 14px 0 6px; font-size: 14px; }
table.dnet { max-width: 520px; }
/* dropouts v2.220: action tabs, groups, buyer block */
.dtabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 10px; }
.dtab { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "t t" "n u" "d d"; align-items: baseline; gap: 2px 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; min-height: 44px; transition: border-color var(--t-fast) var(--ease); }
.dtab .t { grid-area: t; font-weight: 600; font-size: 14px; }
.dtab b { grid-area: n; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dtab .u { grid-area: u; color: var(--muted); font-size: 13px; }
.dtab .d { grid-area: d; color: var(--muted); font-size: 13px; }
.dtab.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
@media (hover: hover) { .dtab:hover { border-color: var(--accent); } }
.dmeta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; margin: 0 0 4px; max-width: none; }
.dmeta b { color: var(--ink); }
.dintro { margin-top: 6px; }
.dgroups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.dgroup { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.dgroup > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 10px 14px; min-height: 48px; }
.dgroup > summary::-webkit-details-marker { display: none; }
.dgroup > summary::before { content: "›"; font-size: 20px; line-height: 1; color: var(--muted); transition: transform var(--t) var(--ease); }
.dgroup[open] > summary::before { transform: rotate(90deg); }
.dgroup .gt { font-size: 16px; }
.dgroup .gs { color: var(--muted); font-size: 14px; flex: 1 1 200px; }
.dgroup .csv { margin-left: auto; }
@media (hover: hover) { .dgroup > summary:hover { background: var(--accent-soft); } }
.gbody { border-top: 1px solid var(--line); animation: fade var(--t) var(--ease) both; }
.gbody > p { padding: 10px 14px; margin: 0; }
.gsub { margin: 14px 14px 6px; font-size: 14px; }
.ghead, .grow { display: grid; gap: 10px; align-items: start; padding: 9px 14px; }
.g-wh .ghead, .g-wh .grow, .g-move .ghead, .g-move .grow { grid-template-columns: minmax(0, 2.4fr) 70px minmax(110px, 1.3fr) 110px 110px; }
.g-fix .ghead, .g-fix .grow { grid-template-columns: minmax(0, 1.6fr) 90px 150px minmax(0, 2fr) minmax(0, 1.3fr); }
.ghead { color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.ghead .n { text-align: right; }
.glist .drow > summary.grow { list-style: none; cursor: pointer; }
.grow .c-name .sig { margin-left: 4px; }
.grow .c-todo b { font-weight: 600; }
.ml { display: none; }
.buyer { margin: 18px 0 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 0 14px; }
.buyer > summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.buyer[open] { padding-bottom: 14px; }
.buyer .alerts { margin-top: 4px; }
@media (max-width: 760px) {
  .dtabs { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .dtab { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "t n u" "d d d"; padding: 10px 12px; gap: 0 6px; }
  .dtab b { font-size: 22px; }
  .ghead { display: none; }
  .grow { gap: 4px 12px; padding: 12px 14px; }
  .g-wh .grow, .g-move .grow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .g-wh .grow .c-name, .g-move .grow .c-name { grid-column: 1 / -1; }
  .g-fix .grow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .g-fix .grow .c-name, .g-fix .grow .c-why, .g-fix .grow .c-todo { grid-column: 1 / -1; }
  .grow .c-n { text-align: left; white-space: normal; }
  .ml { display: inline; color: var(--muted); font-weight: 400; }
  .dgroup .csv { margin-left: 0; }
}
.dgroup > summary, .buyer > summary, .grow { margin-bottom: 0; }
.grow { color: var(--ink); }
.grow .c-name > b, .dgroup .gt b { color: var(--accent-ink); }
.grow > * { grid-area: auto; }
.grow .c-stock { display: block; }
.grow .c-com { grid-column: auto; margin: 0; }
/* dropouts v2.220: exclusion tree */
.gtools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.gtools input[type=search] { flex: 1 1 220px; min-width: 0; }
.gtools #gsave { margin-left: auto; }
.gcount { min-height: 1em; margin: 0 0 6px; }
.gtree { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ghd, .gnode { display: grid; grid-template-columns: auto 36px 40px minmax(0, 1fr) 80px 110px; align-items: center; column-gap: 4px; padding: 0 12px 0 8px; }
.ghd { color: var(--muted); font-size: 13px; padding-top: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); grid-template-columns: minmax(0, 1fr) 80px 110px; padding-left: 92px; }
.ghd .n, .gnode .n { text-align: right; }
.gnode { min-height: 44px; border-bottom: 1px solid var(--line); }
.gnode:last-child { border-bottom: 0; }
.gnode[hidden] { display: none; }
.gnode.sugg { background: var(--warn-soft); }
.gind { align-self: stretch; background-image: repeating-linear-gradient(to right, transparent 0 10px, var(--line) 10px 11px, transparent 11px 22px); }
.garrow { width: 36px; height: 40px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 0; }
.garrow::before { content: "›"; font-size: 22px; line-height: 1; transition: transform var(--t) var(--ease); }
.gnode[aria-expanded="true"] .garrow::before { transform: rotate(90deg); }
.garrow.none::before { content: ""; }
.gchk { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin: 0; cursor: pointer; }
.gchk input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.gnode.partial .gtitle { font-style: italic; }
.gname { padding: 8px 0; line-height: 1.35; }
.gname mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 2px; }
.greason { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.selfcheck { margin: 0 0 8px; padding-left: 18px; }
@media (max-width: 760px) {
  .ghd { display: none; }
  .gnode { grid-template-columns: auto 44px 44px minmax(0, 1fr); padding: 0 10px 0 4px; }
  .gnode > .n { display: none; }
  .gind { background-size: auto; }
  .garrow { width: 44px; height: 48px; }
  .gchk { width: 44px; height: 48px; }
  .gchk input { width: 22px; height: 22px; }
  .gtools #gsave { width: 100%; margin-left: 0; }
}
.gind { width: calc(var(--d, 0) * 22px); }
.gstat { display: none; font-size: 12px; color: var(--muted); }
@media (max-width: 760px) { .gind { width: calc(var(--d, 0) * 14px); } .gstat { display: block; } }
/* read-only account (Claude): forms are visible but cannot be pressed */
button:disabled { opacity: .5; pointer-events: none; }
/* update page: «В GitHub» card */
.bad-text { color: var(--bad); }
.fact form { justify-self: start; margin-top: 6px; }

/* «Сервер»: disk meter */
.meter { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; max-width: 860px; margin: -12px 0 24px; }
.meter div { height: 100%; background: var(--accent); border-radius: 5px; }
.meter.bad div { background: var(--bad); }
.break { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  table.data.fit td:first-child { white-space: normal; }
  table.data.fit .wide-only { display: none; }
}

/* ---------- Дубли (v2.300) ---------- */
/* section pages (web/duplicates.py) */
.dlv, .dst, .dflag { display: inline-flex; align-items: center; padding: 1px 8px; margin: 1px 4px 1px 0; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.dlv.red { background: var(--bad-soft); color: var(--bad); }
.dlv.orange { background: var(--warn-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--warn); }
.dlv.yellow { background: var(--warn-soft); color: var(--muted); }
.dst { border: 1px solid var(--line); color: var(--muted); }
.dst.new { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.dst.work { border-color: var(--ink); color: var(--ink); }
.dst.fixed { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.dflag { background: var(--bad); color: #fff; font-size: 11px; padding: 1px 7px; }
.dflag.twins { background: var(--warn-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--warn); }
/* invisible characters made visible (filter showws) */
.ws { display: inline-block; min-width: .7em; padding: 0 2px; margin: 0 1px; border-radius: 3px; background: var(--warn-soft); box-shadow: inset 0 0 0 1px var(--bad); color: var(--bad); font-weight: 700; text-align: center; line-height: 1.25; cursor: help; }
.ws.cyr { background: var(--bad-soft); text-decoration: underline wavy var(--bad); text-underline-offset: 2px; }
/* list */
.dupsum { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 8px; }
.dupsum .dtype.yellow b { color: var(--muted); }
.dupchecks { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; color: var(--muted); font-size: 13px; margin: 0 0 14px; max-width: none; }
.dupchecks form { margin: 0; }
.dupfilters { margin-bottom: 6px; }
.dupq { display: flex; gap: 6px; align-items: center; flex: 1 1 240px; min-width: 0; margin: 0; }
.dupq input[type=search] { flex: 1 1 auto; min-width: 0; }
.dupcount { margin-top: 6px; }
.dupnews { margin: -8px 0 14px; max-width: none; }
.duphead .btn, .dupacts .btn, .dupcardshead .btn, .dupcfg .btn { display: inline-flex; align-items: center; justify-content: center; }
table.data.dups-t td.dkey { min-width: 190px; max-width: 420px; white-space: normal; overflow-wrap: anywhere; }
table.data.dups-t td.drule { min-width: 140px; white-space: normal; }
.dup-cards { display: none; }
.dupm { display: grid; gap: 4px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.dupm.red { border-left-color: var(--bad); } .dupm.orange { border-left-color: var(--warn); } .dupm.yellow { border-left-color: var(--muted); }
.dupm.done { opacity: .65; }
.dupm-top { display: flex; flex-wrap: wrap; align-items: center; }
.dupm-key { font-size: 15px; overflow-wrap: anywhere; color: var(--accent-ink); }
.dupm-rule, .dupm-meta { font-size: 13px; color: var(--muted); }
@media (hover: hover) { .dupm:hover { border-color: var(--accent); } }
/* case page */
.duptags { display: flex; flex-wrap: wrap; align-items: center; margin: 0 0 6px; max-width: none; }
.dupkeyline { font-size: 16px; overflow-wrap: anywhere; margin-bottom: 4px; max-width: none; }
.dupnote { padding: 10px 14px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 14px; max-width: 900px; }
.dupnote.ok { background: var(--ok-soft); border-color: transparent; }
.dupacts { align-items: flex-start; margin: 4px 0 12px; }
.dupnot { margin: 0; }
.dupnot > summary { list-style: none; margin: 0; }
.dupnot > summary::-webkit-details-marker { display: none; }
.dupnot[open] > summary { border-color: var(--accent); background: var(--accent-soft); }
.dupnot form.stack { margin-top: 8px; max-width: 460px; }
.dupnot textarea { font-family: var(--sans); font-size: 14px; }
.dupadvice { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; max-width: 900px; overflow-wrap: anywhere; }
.dupadvice p { margin: 4px 0 0; }
.dupadvice ul { margin: 6px 0 0; padding-left: 18px; }
.dupadvice.twins { border-left-color: var(--warn); }
table.dupstock { max-width: 520px; }
.dupcardshead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 34px 0 10px; }
.dupcardshead h2 { margin: 0; flex: 1 1 auto; }
.dcmp { display: grid; grid-template-columns: 150px repeat(var(--cards, 2), minmax(220px, 1fr)); grid-template-rows: repeat(var(--rows, 18), auto); column-gap: 8px; }
.dcol { display: grid; grid-row: 1 / span var(--rows, 18); grid-template-rows: subgrid; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-width: 0; }
.dcol.dlabels { background: none; border-color: transparent; }
.dcol.main { border-color: var(--accent); }
.dcol.left { opacity: .55; }
.dc { padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.dc:last-child { border-bottom: 0; }
.dlabels .dc { color: var(--muted); font-size: 13px; padding-left: 0; }
.dch { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; background: var(--bg); }
.dcol.main .dch { background: var(--accent-soft); }
.dlabels .dch { background: none; }
.dk { display: none; }
.dc.diff, .hint .diff { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); }
.dc.hit, .hint .hit { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.hint .diff, .hint .hit { padding: 0 4px 0 7px; border-radius: 3px; color: var(--ink); }
.dc.todo { font-weight: 500; }
.drole { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.drole.main { background: var(--accent); border-color: var(--accent); color: #1F2420; }
.drole.gone { border-style: dashed; }
.dstock { list-style: none; margin: 0; padding: 0; }
table.data td.dwrap { white-space: normal; min-width: 180px; overflow-wrap: anywhere; }
.dupbottom { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dupevents { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dupevents li { padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line); font-size: 14px; }
.dupevents .t { display: block; overflow-wrap: anywhere; }
.dupevents li.dup-found, .dupevents li.dup-reopened, .dupevents li.dup-new_card { border-left-color: var(--bad); }
.dupevents li.dup-fixed { border-left-color: var(--ok); }
.dupevents li.dup-taken, .dupevents li.dup-back, .dupevents li.dup-notdup { border-left-color: var(--accent); }
.cm .txt { white-space: pre-line; overflow-wrap: anywhere; }
/* settings, self-check */
.dupruns { display: grid; gap: 8px; margin: 0 0 18px; max-width: 760px; }
.dupruns form { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0; font-size: 14px; }
.dupcfg h2 { margin: 6px 0 0; }
.dupcfg label.check { color: var(--ink); font-size: 14px; align-items: flex-start; gap: 8px; }
.dupcfg label.check input { flex: none; margin-top: 2px; }
.dupcfg label.check.sub { padding-left: 26px; }
.dupcfg .dlv { margin: 0; padding: 0 4px; }
.dupred { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--bad); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.dupred p { margin: 0 0 6px; max-width: none; overflow-wrap: anywhere; }
.dupred ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; overflow-wrap: anywhere; }
@media (max-width: 1000px) { .dupbottom { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .dupsum { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dupsum > * { grid-column: span 2; }
  .dupsum > :nth-child(n+4) { grid-column: span 3; }
  .dupq { flex: none; width: 100%; }
  .dup-table { display: none; }
  .dup-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .scroll.dcmpwrap { margin: 0; padding: 0; overflow: visible; }     /* stacked cards need no sideways scroll: full width */
  .dcmp { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 10px; }
  .dcol { display: block; grid-row: auto; }
  .dcol.dlabels { display: none; }
  .dc { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px; }
  .dc.dch { display: flex; }
  .dk { display: block; color: var(--muted); font-size: 12px; }
  .dupnot form.stack { max-width: none; }
  .dupruns form button { width: 100%; }
  .dupself table.data th, .dupself table.data td { white-space: normal; }
}
/* menu badges, red banner, home card, «⚠ дубль» marks in other sections */
.side .nbadges { margin-left: auto; display: inline-flex; gap: 4px; flex: none; }
.nbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700; line-height: 1; }
.nbadge.red { background: var(--bad); color: #fff; }
.nbadge.orange { background: var(--warn); color: #1F2420; }
.dupban { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 14px; margin-bottom: 18px; border-radius: 5px; border-left: 4px solid var(--bad); background: var(--bad-soft); color: var(--ink); }
.dupban a { color: var(--bad); font-weight: 600; }
button.dupban-hide { margin-left: auto; background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 4px 10px; font-size: 13px; }
button.dupban-hide:hover { background: var(--surface); color: var(--ink); }
.dupcard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; text-decoration: none; color: var(--ink); }
.dupcard.red { border-left-color: var(--bad); } .dupcard.orange { border-left-color: var(--warn); }
.dupcard > div { display: grid; gap: 2px; min-width: 0; }
.dupcard .label { color: var(--muted); font-size: 13px; text-transform: uppercase; font-weight: 600; letter-spacing: .02em; }
.dupcard b { font-size: 18px; }
.dupcard .go { color: var(--accent-ink); font-weight: 600; white-space: nowrap; }
@media (hover: hover) { .dupcard:hover { border-color: var(--accent); } .dupcard.red:hover { border-left-color: var(--bad); } .dupcard.orange:hover { border-left-color: var(--warn); } }
.dupmark { display: inline-block; margin: 2px 0 0 2px; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; text-decoration: none; vertical-align: middle; letter-spacing: 0; }
.dupmark.red { background: var(--bad-soft); color: var(--bad); }
.dupmark.orange { background: var(--warn-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--warn); }
h1 .dupmark { font-size: 13px; }
@media (hover: hover) { .dupmark:hover { text-decoration: underline; } }
/* icon rail (761–1100 px): the counter sits on the icon's corner; only the red one when both exist */
@media (min-width: 761px) and (max-width: 1100px) {
  body:not(.rail-open) .side li a { position: relative; }
  body:not(.rail-open) .side .nbadges { position: absolute; top: 2px; right: 1px; margin: 0; }
  body:not(.rail-open) .side .nbadge { min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
  body:not(.rail-open) .side .nbadge.red + .nbadge.orange { display: none; }
}
@media (max-width: 760px) {
  .dupban { padding: 10px 12px; gap: 6px 12px; }
  .dupcard { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 14px; }
  .dupcard b { font-size: 16px; }
}
/* print («Дубли» pages and the banner only): no buttons on paper, a card or a block is never cut between pages */
@media print {
  button.dupban-hide, .duphead .btn, .dupcardshead .btn, .dupchecks form, .dupq, .dupfilters .change, .dupacts, .dupbottom form.dcomment { display: none; }
  .dup-table { display: none; }       /* the wide table would be cut at the paper edge: the list prints as cards */
  .dup-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .dupm, .dupred, .dupadvice, .dupnote, .dupevents li, .dupbottom .cm, .dupsum .dtype, table.dupbig tr { break-inside: avoid; }
  .dupcardshead, .dupbottom h2 { break-after: avoid; }
}
/* the case comparison on paper: every card fits the page width (on screen a card column is at least 220 px and scrolls);
   a whole card is not kept on one page (it would push the cards to a new page), only a line of it and its header */
@media print and (min-width: 761px) { .dcmp { grid-template-columns: 110px repeat(var(--cards, 2), minmax(0, 1fr)); } }
@media print { .dcmp .dc { break-inside: avoid; } .dcmp .dch { break-after: avoid; } }
/* «Движение» (function 14): tabs, sub-head, settings; lists are tables on a computer and cards on a phone */
.mvhead { margin-bottom: 8px; }
.mvhead .headrow { min-height: 46px; }      /* the height of the VAT switch: the tab bar does not jump between tabs without it */
.mvtabs { display: flex; gap: 4px; padding: 4px; margin: 4px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.mvtabs::-webkit-scrollbar { display: none; }
.mvtabs a { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; flex: none; }
.mvtabs a:hover { color: var(--ink); background: var(--accent-soft); }
.mvtabs a.on { background: var(--accent); color: #1F2420; font-weight: 600; }
.mvsub { margin: 18px 0 6px; }
.mvsub h2 { margin: 0; flex: 1 1 auto; font-size: 20px; }
.mvsub .btn { display: inline-flex; align-items: center; justify-content: center; }
.mvexport { display: inline-flex; gap: 6px; margin-left: auto; }
.mvexport .btn { display: inline-flex; align-items: center; justify-content: center; }
.ok-text { color: var(--ok); }
.mv-cards { display: none; }
.mvcfg { display: grid; gap: 14px; max-width: 900px; }
.mvcfg-sec { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px 16px 14px; margin: 0; min-width: 0; }
.mvcfg-sec legend { font-weight: 600; padding: 0 6px; }
.mvcfg-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mvcfg-row:last-of-type { border-bottom: 0; }
.mvcfg-row input[type=text], .mvcfg-row select { width: 100%; }
.mvcfg-row.check { grid-template-columns: 22px minmax(0, 1fr); }
.mvcfg-groups { margin-top: 10px; }
.mvcfg-groups .check { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.mvtree { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; max-height: 340px; overflow: auto; }
.mvg { display: flex; gap: 6px; align-items: center; padding: 3px 0 3px calc(var(--d, 0) * 16px); font-size: 13px; }
/* checkboxes of the settings stay checkbox-sized (the phone rule makes inputs 44 px tall; the row is the tap target) */
.mvcfg input[type=checkbox] { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.mvcfg-run { margin: 16px 0; }
table.mvtests td:nth-child(2) { width: 24px; }
@media (max-width: 760px) {
  .mvtabs { margin: 0 -14px; border-radius: 0; border-left: 0; border-right: 0; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
  .mvtabs a { min-height: 44px; }
  .mvsub h2 { flex-basis: 100%; }
  .mvexport { margin-left: 0; width: 100%; }
  .mvexport .btn { flex: 1; }
  .mv-table { display: none; }
  .mv-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .mvcfg-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .mvcfg-row.check { grid-template-columns: 22px minmax(0, 1fr); }
  .mvhead .headrow { min-height: calc(22px * 1.15 + 12px + 54px); align-content: flex-start; }   /* title, then the switch below it */
  .mvtree .mvg, .mvcfg-groups .check { min-height: 44px; }
  .mvcfg input[type=checkbox] { width: 20px; height: 20px; }
}
@media print { .mvtabs, .mvexport, .mvsub .btn { display: none; } .mv-table { display: none; } .mv-cards { display: grid; gap: 8px; } }
/* paper: no menu, no banners and switches, the page uses the whole width */
@media print {
  body { display: block; height: auto; }
  .side, .topbar, .backdrop, .dupban, .flash.warn, .pill-group, .filters-wrap, .filters, .filters-summary, .sheet-backdrop,
  .loadbar, .bubble { display: none !important; }
  main { max-width: none; padding: 0; }
}

/* ---------- sandbox (BARS, KORA_MODE=sandbox): a striped band and a label on top of every page ----------
   fixed, so it never takes part in the page grid; on a phone the label moves into the top bar next to the avatar */
.sandbox-flag { position: fixed; top: 0; left: 0; right: 0; height: 5px; z-index: 1000; pointer-events: none;
  background: repeating-linear-gradient(-45deg, #FFB000 0 10px, #1F2420 10px 20px); }
.sandbox-flag span { position: absolute; top: 0; left: 50%; transform: translateX(-50%); display: flex; align-items: baseline;
  gap: 8px; padding: 4px 14px 5px; border-radius: 0 0 8px 8px; background: #FFB000; color: #1F2420; white-space: nowrap;
  font: 700 12px/1.2 var(--sans); letter-spacing: .12em; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.sandbox-flag small { font-weight: 500; font-size: 11px; letter-spacing: .02em; }
.sandbox-chip { display: none; }
@media (max-width: 760px) {
  body:not(.login-body):not(.plain) .sandbox-flag span { display: none; }     /* pages without the top bar keep it */
  .topbar .sandbox-chip { display: inline-flex; align-items: center; height: 26px; padding: 0 8px; border-radius: 6px;
    background: #FFB000; color: #1F2420; font: 700 11px/1 var(--sans); letter-spacing: .08em; }
}
