/* K.O.R.A. — gold #CFA550 on the navy menu #0C1120 (brand kit v3); 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: #0C1120;          /* the menu and the phone top bar are navy in every theme (UX-paket-1, item 63) */
  --side-text: #B9C0D0;
  --side-muted: #7C869C;
  --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;
  --t-peek: 1240ms;         /* Пунктик: только «кора» (п. 118), исключение утверждено владельцем 16.10.2026 */
  /* Пунктик — цвета кота (docs/brand/punktik/BRAND-punktik.md): светлая тема */
  --pk-line: #8A6B22; --pk-fill: #FFFDF8; --pk-tint: #F0E2BF; --pk-eye: #CFA550; --pk-pupil: #1F2420; --pk-hi: #FFFFFF;
  --pk-bg: var(--bg);
}
@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;
    --pk-line: #CFA550; --pk-fill: #1C2644; --pk-tint: #5E5130; --pk-eye: #CFA550; --pk-pupil: #111729; --pk-hi: #F6F3EC; }
}
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;
  --pk-line: #CFA550; --pk-fill: #1C2644; --pk-tint: #5E5130; --pk-eye: #CFA550; --pk-pupil: #111729; --pk-hi: #F6F3EC; }

* { 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; }
.bulkbar[hidden] { display: none; }   /* display: flex above would beat the hidden attribute: «0 выбрано» showed with nothing ticked */
table.data.users td.chk, table.data.users th.chk { width: 28px; padding-right: 0; }
table.data.users label.hit { display: flex; align-items: center; justify-content: center; cursor: pointer; }
table.data.users input[type=checkbox] { accent-color: var(--accent); }

/* login */
/* on a phone: 16 px of air on each side (the card keeps its frame and corners), the page grows instead of cutting the
   top of the form when the keyboard takes half the screen, fields of 16 px — smaller ones make the iPhone zoom the page */
body.login-body { display: flex; align-items: center; justify-content: center; height: auto; min-height: 100%; padding: 16px; box-sizing: border-box; }
form.login { background: var(--surface); border-radius: 10px; width: 380px; max-width: 100%; box-sizing: border-box; display: grid; gap: 14px; padding: 0 34px 32px; overflow: hidden; border: 1px solid var(--line); }
/* the plate of the full logo (bark and leaves): the menu colour in the dark theme; in the light one no plate, the dark gold
   kora_logo_full_light.svg on the card */
form.login .logo { background: transparent; margin: 0 -34px 6px; padding: 28px 34px 22px; }
html[data-theme="dark"] form.login .logo { background: var(--side); }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] form.login .logo { background: var(--side); } }
form.login .logo img { height: 56px; width: auto; }
/* a logo on a light background: dark gold *_light.svg (#8A6B22) in the light theme, gold on dark; the theme changes without
   a reload, so both files are in the page and the theme shows one (the hidden one is out of the accessibility tree) */
.logo-swap img { display: block; }
.logo-swap .on-dark { display: none; }
html[data-theme="dark"] .logo-swap .on-light { display: none; }
html[data-theme="dark"] .logo-swap .on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .logo-swap .on-light { display: none; }
  html[data-theme="auto"] .logo-swap .on-dark { display: block; }
}
form.login .sub { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
form.login button { margin-top: 6px; }
@media (max-width: 760px) { form.login input { font-size: 16px; } }


/* 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; }
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); }
.month-ph { display: none; }
@media (max-width: 760px) {    /* «Календарь покрытия» на телефоне: месяц — одна ссылка под палец (клетки по 5 px не нажать) */
  .month:not(.month-ph) { display: none; }
  .month-ph { display: grid; min-height: var(--k-tap, 44px); color: inherit; text-decoration: none; border-radius: 6px; }
  .month-ph .cal-cell { pointer-events: none; }
  .month-ph .cal-cell:hover { transform: none; outline: 0; }
}
.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; }
/* the chart fills its box: on a PC the box keeps the old proportions of the canvas (--ar), on a phone it is taller */
.chart-box { position: relative; width: 100%; aspect-ratio: var(--ar, 300 / 110); }
.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; }
.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: #1C2440; }
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; }
/* «Магазины и склады», edit mode (item 72): the table scrolls in its own frame, names and the form stay on one line */
table.data.shops.editing td.name, table.data.shops.editing form.inline { white-space: nowrap; }
table.data.shops.editing form.inline { flex-wrap: nowrap; }
table.data.shops.editing td { vertical-align: middle; }
table.data.shops.editing form.inline { margin: 0; }
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 { display: inline-flex; align-items: center; min-height: 44px; padding: 7px 4px; }   /* tap target 44 px, the word stays 30 px */
  .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); }
  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; justify-content: center; min-height: 44px; min-width: var(--k-tap, 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) {
  .k-nav__a, .k-nav__s, 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; }
.icon-btn.bell { position: relative; text-decoration: none; }
.bell-n { position: absolute; top: 2px; right: 0; min-width: var(--k-s4, 16px); height: var(--k-s4, 16px); padding: 0 4px;
  border-radius: var(--k-r-pill, 999px); background: var(--k-st-bad, var(--bad)); color: #fff; font-size: var(--k-fs-xs, 11px); font-weight: 600;
  line-height: var(--k-s4, 16px); text-align: center; box-sizing: border-box; }

/* ---------- 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 */
.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; }
.dupban-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--bad); vertical-align: 1px; }   /* был эмодзи 🔴 — на сайте эмодзи нет (шаг 0.10, по касанию) */
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; } }
@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; }
}

/* ---------- UX-paket-1: phone, items 68–70 ---------- */
@media (max-width: 760px) {
  /* 68: fields of 16 px — a smaller font makes the iPhone zoom the whole page in when a field is tapped. !important:
     section styles (mv-*.css, pult.css, «mass actions» of the catalog) set 12–15 px with more specific selectors */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select, textarea { font-size: 16px !important; }
  /* 69: /users — the whole 44×44 cell is the tap target, the box itself 20 px */
  table.data.users td.chk, table.data.users th.chk { width: 44px; padding: 0; }
  table.data.users label.hit { width: 44px; min-height: 44px; }
  table.data.users label.hit input { width: 20px; height: 20px; min-height: 0; margin: 0; }
  /* 70: the «by days» chart: 240 px tall, the switch in a row of its own, scrolls sideways instead of wrapping */
  .chart-box { aspect-ratio: auto; height: 240px; }
  .chart-wrap .chart-box canvas { max-height: none; }
  .chart-head h2 { flex: 1 1 100%; }
  .chart-head .switch { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .chart-head .switch::-webkit-scrollbar { display: none; }
  .chart-head .switch a, .headrow .switch a { display: inline-flex; align-items: center; }   /* 44 px tall: the label in the middle */
}

/* Главная, «Категории»: строка «Остальные (N категорий)» — кнопка, раскрывает полный список (акт сверки А-03) */
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); cursor: pointer; text-align: left; min-height: var(--k-tap, 44px); }
.linkbtn:hover { text-decoration: underline; }
.linkbtn:focus-visible { outline: none; box-shadow: var(--k-focus, 0 0 0 2px var(--accent)); border-radius: var(--k-r-sm, 4px); }
table.data tr.cat-rest td { border-top: 1px solid var(--line); }

/* ---------- Пунктик (docs/specs/ZADACHA-punktik.md, выпуск 1): раскладка; движение — только web/static/punktik.css ---------- */
.pk-wrap { max-width: 100%; }
/* экран-заглушка: 403, 404, выход, пустой период, пустой поиск, закрытый раздел, «выпадений нет» */
.pk-screen { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 14px; text-align: center;
  max-width: 560px; margin: 24px auto; padding: 8px 0; }
.pk-screen__txt :is(h1, h2) { margin: 0 0 6px; font-size: 20px; color: var(--ink); }
.pk-screen__txt p { margin: 0 0 10px; color: var(--ink); }
.pk-screen__txt .pk-reason, .pk-screen__txt .errcode { font-size: 13px; color: var(--muted); }
/* вход (п. 95, 96, 112–114): кот сидит на верхней кромке карточки — низ лап (y = 207 рисунка) на кромке, хвост справа */
.pk-login { --pk-s: 140px; position: relative; width: 380px; max-width: 100%; padding-top: calc(var(--pk-s) * 231 / 220); }
.pk-login form.login { width: 100%; position: relative; }
.pk-login > .pk-wrap { position: absolute; top: 0; right: calc(var(--pk-s) * -0.25); z-index: 2; }
.pk-login > .pk-wrap[data-pk^="edge"] { width: var(--pk-s) !important; }   /* 140 px от 1024, 118 px уже */
.pk-login.is-night { padding-top: calc(69px + 100px); }
.pk-login.is-night > .pk-wrap[data-pk="moon"] { right: 0; }
.pk-login.is-night > .pk-wrap[data-pk="loaf"] { top: 69px; right: 16px; }
.pk-login .pk-note { color: var(--muted); font-size: 13px; margin: 0; text-align: center; }
@media (max-width: 1023px) { .pk-login { --pk-s: 118px; } .pk-login form.login :is(input, button) { min-height: 44px; } }
@media (max-width: 440px) { .pk-login > .pk-wrap { right: -10px; } }
/* меню: ПК > 1100 px — на кромке блока профиля справа (п. 97); телефон — над «Выйти» в выезжающей панели (п. 98) */
.side .me { position: relative; }
.side .pk-menu { position: absolute; right: 4px; bottom: 100%; margin-bottom: calc(84px * -79 / 220); display: none; }
.side .pk-loaf { display: none; justify-content: center; padding: 12px 0 4px; }
@media (min-width: 1101px) {
  .side .pk-menu { display: block; }
  .side > ul { padding-bottom: 92px; }           /* кот выше кромки на 88 px — не наезжает на последний пункт меню */
  .side .side__me { padding-right: 40px; }       /* хвост свисает справа — имя до него не доходит; .side — сильнее padding из nav.css (навигация, фаза 0) */
}
@media (max-width: 760px) { .side .pk-loaf { display: flex; } }
/* «Мой кабинет» (п. 99): кот справа от приветствия, на телефоне — над ним */
.pk-greet { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.pk-greet h1 { margin: 0; }
@media (max-width: 760px) { .pk-greet { flex-direction: column-reverse; align-items: flex-start; } }
/* полоса «успешно» (п. 104): жетон с галочкой слева */
.flash.ok.pk-flash { display: flex; align-items: center; gap: 10px; }
.flash.ok.pk-flash > .pk-wrap { flex: none; }
/* «История версий» (п. 105): обложка последней версии */
.pk-release { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; align-items: center;
  border: 1px solid var(--accent); border-radius: 14px; padding: 20px; margin: 0 0 24px; background: var(--surface); }
.pk-release h2 { margin: 0 0 8px; font-size: 18px; }
.pk-release p { margin: 0 0 6px; }
@media (max-width: 760px) { .pk-release { grid-template-columns: minmax(0, 1fr); justify-items: start; } }
/* нет связи (п. 107) — поверх содержимого; долгая загрузка (п. 111) — под золотой полосой; оба убираются сразу при ответе */
.pk-overlay { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 16px; overflow-y: auto; }
.pk-wait { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 95; display: grid; justify-items: center;
  gap: 6px; padding: 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  max-width: calc(100vw - 32px); pointer-events: none; }
.pk-wait p { margin: 0; font-size: 13px; color: var(--ink); text-align: center; }
/* «кора» (п. 118): выглядывает снизу по центру; вне .pk-peek-go скрыт */
.pk-peekbox { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 96; pointer-events: none; display: none; }
.pk-peekbox.pk-peek-go { display: block; }
/* экран выхода (п. 116) */
.pk-bye { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; width: 380px; max-width: 100%;
  padding: 24px 24px 12px; }
.pk-bye .pk-screen { margin: 0 auto; }
.pk-greet .pk-hello { margin: 0 0 4px; font-size: 18px; font-weight: 600; color: var(--ink); }
.pk-after { text-align: center; margin-top: -8px; }
/* Главная без тревог (п. 110) */
.pk-approve { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 18px; margin: 0 0 18px; }
.pk-approve h2 { margin: 0 0 2px; font-size: 16px; }
.pk-approve p { margin: 0; color: var(--ink); }
.pk-approve .pk-wrap { flex: none; }
/* окна Пунктика: первый вход (п. 115), титры (п. 120) — вид как у окна DS (k-dialog) */
.pk-dlg { width: min(420px, calc(100vw - 32px)); max-width: 420px; padding: 24px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; text-align: center; }
.pk-dlg::backdrop { background: color-mix(in srgb, var(--side) 55%, transparent); }
.pk-dlg h2 { margin: 12px 0 10px; font-size: 18px; color: var(--ink); }
.pk-dlg ul { margin: 0 0 18px; padding-left: 20px; text-align: left; }
.pk-dlg li { margin: 0 0 6px; }
.pk-dlg form { margin: 0; }
.pk-dlg form button { min-height: 44px; min-width: 140px; }
.pk-credits { position: relative; }
.pk-credits dl { margin: 0; display: grid; gap: 6px; text-align: left; }
.pk-credits dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.pk-credits dt { color: var(--muted); }
.pk-credits dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.pk-dlg__x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; background: transparent; color: var(--muted); border-radius: 10px; }
.pk-dlg__x:hover { background: var(--accent-soft); color: var(--ink); }
.pk-dlg__x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
