/* oktava-site — формуляр разбора закупок.
   Мир: холодная бумага + чернила + одна калибровочная рейка; статусы — штампы,
   состояние читается формой штриха, а не только цветом. Системные шрифты,
   табличные цифры, светлая/тёмная тема через prefers-color-scheme. Без внешних запросов. */

:root {
  --bg: #f4f4f1;
  --paper: #ffffff;
  --ink: #191c22;
  --mut: #565d6b;
  --line: #d9dbe2;
  --line2: #b9bdc9;
  --acc: #1f4e8c;
  --acc-ink: #ffffff;
  --ok: #1f6b47;
  --warn: #8a5800;
  --cut: #a02c2c;
  --sel: #b7cde8;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PT Sans", Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --shadow: 0 1px 2px rgba(25, 28, 34, .06), 0 8px 24px -12px rgba(25, 28, 34, .18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1116;
    --paper: #171a21;
    --ink: #e7eaf0;
    --mut: #98a0b0;
    --line: #2a2f3b;
    --line2: #3a4150;
    --acc: #8fb4e8;
    --acc-ink: #0f1116;
    --ok: #6fc492;
    --warn: #d9a441;
    --cut: #e08585;
    --sel: #2b3a52;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 28px -14px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  font-feature-settings: "tnum" 0;
  caret-color: var(--acc);
}

::selection { background: var(--sel); }

a { color: var(--acc); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: 2px;
}

/* скроллбары в тон системе */
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; border: 2px solid var(--paper); }
*::-webkit-scrollbar-track { background: transparent; }

.shell { max-width: 1360px; margin-inline: auto; padding-inline: clamp(14px, 4vw, 32px); }

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.skip {
  position: absolute; left: -999px; top: 8px;
  z-index: 10; padding: 8px 14px;
  background: var(--paper); color: var(--acc);
  border: 1px solid var(--line2); border-radius: 6px;
}
.skip:focus { left: 8px; }

/* ── Шапка ─────────────────────────────────────────────────────────── */

.top {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}

.toprow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 24px; flex-wrap: wrap;
  padding-block: 12px;
}

.brand {
  display: inline-flex; align-items: baseline; gap: 10px;
  color: var(--ink); text-decoration: none; font-weight: 700;
  letter-spacing: -0.01em; font-size: 19px;
}
.brand-mark { align-self: center; color: var(--acc); display: inline-flex; }
.brand-name em { font-style: normal; font-weight: 400; color: var(--mut); font-size: 15px; }

.nav { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-inline: -6px; }
.nav a {
  padding: 7px 12px; border-radius: 6px;
  color: var(--mut); text-decoration: none; font-size: 15px;
  border: 1px solid transparent;
}
.nav a:hover { color: var(--ink); border-color: var(--line); }
.nav a.active { color: var(--ink); border-color: var(--line2); background: var(--bg); font-weight: 600; }

/* ── Заголовки страниц ─────────────────────────────────────────────── */

main { padding-block: clamp(20px, 4vw, 44px) 56px; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
h1 { font-size: clamp(24px, 4.2vw, 38px); margin: 0 0 12px; max-width: 22ch; }
h2 { font-size: clamp(19px, 2.6vw, 24px); margin: 44px 0 14px; }
h3 { font-size: 16px; margin: 0 0 4px; }

section { margin-top: 8px; }

.lead { font-size: clamp(16px, 2vw, 18px); color: var(--mut); max-width: 74ch; margin: 0; }
.lead a { color: inherit; }
.note { color: var(--mut); font-size: 14px; max-width: 78ch; margin: 10px 0 0; }

.money-big {
  font-size: clamp(24px, 4vw, 34px);
  color: var(--ink); font-weight: 600;
  white-space: nowrap;
}

.stamp-anim { display: inline-block; animation: stamp-in .34s cubic-bezier(.2, .85, .3, 1.05) both .1s; }
@keyframes stamp-in {
  from { transform: scale(1.5) rotate(-3deg); opacity: 0; }
  70% { transform: scale(.97); opacity: 1; }
  to { transform: none; opacity: 1; }
}

/* ── Рейка итогов ──────────────────────────────────────────────────── */

.rail { border-left: 2px solid var(--line2); display: grid; gap: 0; margin-top: 6px; }

.rail-row {
  display: grid;
  grid-template-columns: minmax(130px, 210px) 1fr;
  gap: 4px 20px;
  padding: 13px 0 13px 20px;
  border-bottom: 1px solid var(--line);
}
.rail-row:last-child { border-bottom: 0; }

.rail-k { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--mut); padding-top: 5px; }
.rail-v {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(21px, 3.2vw, 30px);
  font-weight: 600;
}
.rail-n { grid-column: 2; color: var(--mut); font-size: 13.5px; }

/* ── Штампы статусов (форма штриха + цвет) ─────────────────────────── */

.stamp {
  display: inline-block;
  font-size: 12px; line-height: 1;
  padding: 4px 7px 3px;
  border: 1px solid currentColor;
  border-radius: 2px;
  white-space: nowrap;
  max-width: 150px;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
.st-ok   { color: var(--ok);   border-style: solid; }
.st-warn { color: var(--warn); border-style: solid; }
.st-cut  { color: var(--cut);  border-style: double; border-width: 3px; padding: 2px 5px 1px; }
.st-mute { color: var(--mut);  border-style: dashed; }

/* ── Таблицы ───────────────────────────────────────────────────────── */

.tbl-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: auto;
  max-height: 78vh;
  margin-top: 10px;
}

.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--paper);
  border-bottom: 2px solid var(--line2);
  font-size: 12.5px; letter-spacing: .03em; text-transform: uppercase;
  color: var(--mut);
  white-space: nowrap;
}
.tbl tbody tr:hover { background: color-mix(in oklab, var(--acc) 5%, var(--paper)); }
.tbl tfoot td, .tbl tfoot th { border-top: 2px solid var(--line2); border-bottom: 0; font-weight: 600; }
.tbl tbody tr:last-child td { border-bottom: 0; }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  text-align: right;
  font-family: var(--mono);
  font-size: 13.5px;
}
.tbl thead .num, .rail-v, .rail-n { font-family: inherit; }
.thead-num { text-align: right; }

strong { font-weight: 600; }
.dash { color: var(--mut); }
.sub { color: var(--mut); font-size: 12.5px; margin-top: 3px; line-height: 1.4; }
.sub-strong { font-weight: 600; margin-top: 2px; }
.sub-money { color: var(--mut); font-size: 12.5px; }
.c-verdict .sub { max-width: 220px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bd { color: var(--mut); font-size: 13px; }
.gap-sub th { font-weight: 400; color: var(--mut); padding-left: 28px; font-size: 13px; }
.cust { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np { color: var(--mut); }
.fnm { font-size: 10px; color: var(--acc); margin-left: 2px; }
.fnbox { margin-top: 14px; border: 1px dashed var(--line2); border-radius: 8px; background: var(--paper); padding: 12px 16px; }
.fnbox summary { cursor: pointer; font-weight: 600; color: var(--mut); }
.fnbox summary:hover { color: var(--acc); }
.fnbox[open] summary { margin-bottom: 8px; }
.fnlist { margin: 8px 0 0; padding-left: 22px; }
.fnlist li { color: var(--mut); font-size: 13px; margin: 4px 0; }

.tenders { min-width: 1080px; }
.customers { min-width: 880px; }
.season { min-width: 920px; }

.c-date { white-space: nowrap; }
.c-money { white-space: nowrap; }
.c-model .model-name { font-weight: 600; white-space: nowrap; }
.c-spec { max-width: 210px; }
.c-best { min-width: 170px; }
.c-bar { width: 130px; }

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.5px;
  color: var(--mut);
  max-width: 220px;
}

.eis {
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
}
.eis svg { opacity: .6; }

.stamps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }

/* ── Полоса-шкала (сезонность): состояние — высота штриха ──────────── */

.bar {
  display: block;
  height: 12px;
  min-width: 2px;
  background: var(--acc);
  border-radius: 1px;
}
.bar.b0 { background: none; border-bottom: 2px dotted var(--line2); height: 10px; }

/* ── Фильтры ───────────────────────────────────────────────────────── */

.filters { margin: 22px 0 0; }
.filters fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px 16px;
}

.f { display: grid; gap: 5px; }
.f-k { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); }
.f select, .f input {
  font: inherit; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line2);
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
}
.f select:hover, .f input:hover { border-color: var(--acc); }
.f-q { grid-column: 1 / -1; }

.f-actions {
  grid-column: 1 / -1;
  display: flex; gap: 10px; align-items: center;
}

.btn {
  display: inline-block;
  font: inherit; font-weight: 600;
  padding: 9px 18px;
  border-radius: 6px;
  border: 1px solid var(--acc);
  background: var(--acc); color: var(--acc-ink);
  cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: transparent; color: var(--acc);
  border-color: var(--line2); font-weight: 500;
}
.btn.ghost:hover { border-color: var(--acc); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px dashed var(--line2);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px; color: var(--ink);
  text-decoration: none;
  background: var(--paper);
}
.chip span { color: var(--mut); font-size: 15px; line-height: 1; }
.chip:hover { border-color: var(--cut); border-style: solid; color: var(--cut); }

.sort { color: inherit; text-decoration: none; }
.sort:hover { color: var(--acc); text-decoration: underline; }
.sort.active { color: var(--acc); }

/* ── Пагинация, пусто ──────────────────────────────────────────────── */

.pager { display: flex; gap: 6px; margin: 18px 0 0; flex-wrap: wrap; }
.pg {
  min-width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line2); border-radius: 6px;
  text-decoration: none; color: var(--ink);
  font-variant-numeric: tabular-nums;
  padding-inline: 10px;
}
.pg:hover { border-color: var(--acc); color: var(--acc); }
.pg.cur { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 600; }
.pg.off { opacity: .35; }

.empty {
  border: 1px dashed var(--line2);
  border-radius: 8px;
  margin-top: 16px; padding: 26px;
  text-align: center;
  background: var(--paper);
}
.empty p { margin: 0 0 14px; color: var(--mut); }

/* ── Документы (нумерованная колонка полей) ────────────────────────── */

.docs { margin-top: 10px; }
.doclist { list-style: none; margin: 16px 0 0; padding: 0; counter-reset: doc; }

.doc {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  padding: 14px 0 14px 14px;
  border-left: 2px solid var(--line2);
  border-bottom: 1px solid var(--line);
}
.doc:last-child { border-bottom: 0; }

.doc-n {
  font-family: var(--mono);
  font-size: 18px; color: var(--mut);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.doc-t { margin: 0; font-weight: 600; }
.doc-d { margin: 2px 0 0; color: var(--mut); font-size: 14px; }

.inline-list { margin: 10px 0 0; padding-left: 20px; color: var(--ink); }
.inline-list li { margin: 3px 0; }

/* ── Шаги метода ───────────────────────────────────────────────────── */

.steps { list-style: none; margin: 16px 0 0; padding: 0; counter-reset: st; }

.step {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  padding: 16px 0 16px 16px;
  border-left: 2px solid var(--line2);
  border-bottom: 1px solid var(--line);
}
.step:last-child { border-bottom: 0; }
.step-n { font-family: var(--mono); font-size: 22px; color: var(--mut); font-variant-numeric: tabular-nums; }
.step-sub { margin: 0 0 6px; color: var(--mut); font-size: 14px; }
.step-b > p:last-child { margin: 0; }

.limits li { margin: 6px 0; }
.limits { padding-left: 20px; max-width: 80ch; }

code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  word-break: break-all;
}

/* ── Разделы на обзоре ─────────────────────────────────────────────── */

.secs { display: grid; gap: 0; border-top: 1px solid var(--line); margin-top: 10px; }
.sec {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 4px 24px;
  padding: 15px 0 15px 18px;
  border-left: 2px solid var(--line2);
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.sec:hover { border-left-color: var(--acc); background: color-mix(in oklab, var(--acc) 4%, transparent); }
.sec-t { font-weight: 600; color: var(--acc); }
.sec-d { color: var(--mut); font-size: 14px; }

/* ── Подвал ────────────────────────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding-block: 20px 28px;
  font-size: 13.5px; color: var(--mut);
}
.foot p { margin: 4px 0; max-width: 90ch; }
.foot a { color: var(--acc); }

/* ── Адаптив ───────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .toprow { padding-block: 10px; }
  .nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .nav a { white-space: nowrap; padding: 6px 10px; font-size: 14px; }
  .brand { font-size: 17px; }
  .brand-name em { font-size: 13px; }
  h1 { max-width: none; }
  .rail-row { grid-template-columns: 1fr; }
  .rail-n { grid-column: 1; }
  .sec { grid-template-columns: 1fr; gap: 2px; }
  .doc, .step { grid-template-columns: 28px 1fr; gap: 10px; padding-left: 10px; }
  .filters fieldset { grid-template-columns: 1fr 1fr; }
  .tbl { font-size: 13.5px; }
  .tbl th, .tbl td { padding: 8px 10px; }
  .lead { font-size: 15.5px; }
}

@media (max-width: 420px) {
  .filters fieldset { grid-template-columns: 1fr; }
}

/* ── Печать ────────────────────────────────────────────────────────── */

@media print {
  .top, .foot, .filters, .pager, .chips, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .tbl-wrap { overflow: visible; max-height: none; border-color: #999; }
  .tbl thead th { position: static; }
  .tbl.tenders, .tbl.models, .tbl.customers, .tbl.season { min-width: 0; }
  .rail-row, .sec, .doc, .step { break-inside: avoid; }
}

/* ── Меньше движения ───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
