/* ================================================================
   DEVCHECK — «Акт приёмки»: бумага, линовка, акцидентный гротеск
   ================================================================ */

:root {
  --paper: #f2efe7;
  --paper-dim: #e9e5d9;
  --ink: #171512;
  --ink-soft: #55514a;
  --ink-faint: #8b867c;
  --line: #171512;
  --accent: #ff4b00;

  --ok: #1c6e3a;
  --warn: #a86a00;
  --fail: #c22617;
  --info: #55514a;

  --display: 'Unbounded', sans-serif;
  --body: 'Golos Text', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper-dim);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ================= лист ================= */
.sheet {
  max-width: 1060px;
  margin: 28px auto 60px;
  background: var(--paper);
  border: 2px solid var(--line);
  box-shadow: 8px 8px 0 rgba(23, 21, 18, 0.9);
  position: relative;
}
@media (max-width: 1100px) { .sheet { margin: 0; border-width: 0 0 2px; box-shadow: none; } }

/* угловые метки реза */
.sheet::before, .sheet::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 0 solid var(--ink);
  pointer-events: none;
}
.sheet::before { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.sheet::after { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }

/* ================= мастхед ================= */
.masthead {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 2px solid var(--line);
}
.masthead__brand {
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.02em;
  padding: 18px 28px;
  border-right: 2px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.12s;
}
a.masthead__brand:hover { color: var(--accent); }
.masthead__brand span { color: var(--accent); }
.masthead__info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
@media (max-width: 640px) {
  .masthead__info span:first-child { display: none; }
  .masthead__brand { padding: 14px 18px; font-size: 18px; }
  .masthead__info { padding: 0 18px; }
}

/* ================= экраны ================= */
#screen-form, #screen-progress, #screen-report { padding: 0 0 40px; }

/* ================= hero ================= */
.hero {
  display: grid;
  grid-template-columns: 120px 1fr 300px;
  border-bottom: 2px solid var(--line);
}
.hero__index {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  padding: 26px 0 0 28px;
  border-right: 1px solid rgba(23,21,18,0.25);
}
.hero__title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(42px, 6.6vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  padding: 22px 28px 30px;
}
.hero__title em {
  display: block;
  font-style: normal;
  font-weight: 500;
  font-size: 0.36em;
  letter-spacing: 0.06em;
  margin-top: 16px;
  color: var(--accent);
}
.hero__note {
  border-left: 1px solid rgba(23,21,18,0.25);
  padding: 26px 28px;
  font-size: 13.5px;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: flex-end;
}
.hero__note-strong { color: var(--ink); font-weight: 600; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero__index { border: 0; padding-bottom: 0; }
  .hero__note { border-left: 0; border-top: 1px solid rgba(23,21,18,0.25); }
}

.rule { border-bottom: 1px solid var(--line); }
.rule--thick { border-bottom-width: 2px; }

/* ================= форма ================= */
.frow {
  display: grid;
  grid-template-columns: 120px 1fr 130px;
  border-bottom: 1px solid rgba(23,21,18,0.35);
}
.frow--sub { background: rgba(23,21,18,0.03); }
.frow__num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-faint);
  padding: 24px 0 0 28px;
  border-right: 1px solid rgba(23,21,18,0.25);
}
.frow__main { padding: 20px 28px 22px; min-width: 0; }
.frow__side {
  border-left: 1px solid rgba(23,21,18,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 860px) {
  .frow { grid-template-columns: 64px 1fr; }
  .frow__num { padding-left: 18px; }
  .frow__main { padding: 16px 18px 18px; }
  .frow__side { display: none; }
}

.frow__label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.frow__label span {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.frow__input {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--ink);
  padding: 6px 2px 8px;
  outline: none;
  border-radius: 0;
}
.frow__input:focus { border-bottom-color: var(--accent); }
.frow__input.is-invalid { border-bottom-color: var(--fail); }
.frow__input::placeholder { color: var(--ink-faint); }
.frow__error {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fail);
  min-height: 15px;
  margin-top: 6px;
}
.frow__hint {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 8px;
  max-width: 560px;
}
.frow__ext {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
}
.frow__ext:hover { color: var(--accent); border-color: var(--accent); }

/* объём проверки */
.scope { display: flex; gap: 26px; flex-wrap: wrap; }
.scope__opt {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 14.5px;
  user-select: none;
}
.scope__opt input { position: absolute; opacity: 0; }
.scope__box {
  width: 18px; height: 18px;
  border: 2px solid var(--ink);
  display: inline-grid;
  place-items: center;
  flex: none;
}
.scope__box::after {
  content: '';
  width: 8px; height: 8px;
  background: var(--accent);
  transform: scale(0);
  transition: transform 0.1s;
}
.scope__opt input:checked + .scope__box::after { transform: scale(1); }
.scope__opt input:focus-visible + .scope__box { outline: 2px solid var(--accent); outline-offset: 2px; }

/* кнопка */
.go {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 56px);
  margin: 30px 28px 0;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(17px, 2.4vw, 24px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 20px 26px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.go:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.go:active { transform: translate(2px, 2px); }
.go:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.go__arr { font-family: var(--body); font-weight: 400; font-size: 1.3em; line-height: 1; }
.go:disabled { opacity: 0.4; cursor: not-allowed; }
.go:disabled:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
@media (max-width: 860px) { .go { width: calc(100% - 36px); margin: 24px 18px 0; } }

/* кнопка запуска ИИ-оценки внутри акта (блок живой вёрстки) */
.ai-run-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 2px 0 14px;
}
.ai-run {
  flex: none;
  display: inline-flex;
  align-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  padding: 11px 18px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.ai-run:hover { background: var(--accent); border-color: var(--accent); }
.ai-run:active { transform: translate(1px, 1px); }
.ai-run:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.ai-run-hint { font-size: 12px; color: var(--ink-soft); max-width: 480px; }

.ai-note {
  font-size: 12.5px;
  color: var(--ink-soft);
  padding: 14px 28px 0;
  max-width: 720px;
}
@media (max-width: 860px) { .ai-note { padding: 12px 18px 0; } }

.foot-note {
  font-size: 12.5px;
  color: var(--ink-soft);
  padding: 22px 28px 0;
  max-width: 640px;
}

/* ================= прогресс ================= */
.prog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 34px 28px 20px;
  border-bottom: 2px solid var(--line);
}
.prog__title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(26px, 4vw, 44px);
  text-transform: uppercase;
}
.prog__spin {
  width: 26px; height: 26px;
  border: 3px solid var(--ink);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.prog__log {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 2.1;
  padding: 24px 28px 10px;
  min-height: 300px;
  color: var(--ink-soft);
}
.prog__log .ln { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px dotted rgba(23,21,18,0.25); }
.prog__log .ln b { font-weight: 500; color: var(--ink); }
.prog__log .ln .st { color: var(--ink-faint); }
.prog__log .ln.done .st { color: var(--ok); }
.prog__log .ln.err .st { color: var(--fail); }

/* ================= отчёт ================= */
.report { padding: 0; }

.rep-head {
  display: grid;
  grid-template-columns: 1fr 230px;
  border-bottom: 2px solid var(--line);
}
.rep-head__main { padding: 30px 28px 26px; }
.rep-head__title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(30px, 4.6vw, 54px);
  line-height: 1;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.rep-head__meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.9;
  word-break: break-all;
}
.rep-head__meta b { color: var(--ink); font-weight: 500; }

.rep-head__stampbox {
  border-left: 2px solid var(--line);
  display: grid;
  place-items: center;
  padding: 20px;
}
@media (max-width: 720px) {
  .rep-head { grid-template-columns: 1fr; }
  .rep-head__stampbox { border-left: 0; border-top: 2px solid var(--line); }
}

/* штамп */
.stamp {
  --stamp-color: var(--warn);
  border: 3px double var(--stamp-color);
  color: var(--stamp-color);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  padding: 14px 18px;
  transform: rotate(-6deg);
  max-width: 190px;
  line-height: 1.5;
}
.stamp--ok { --stamp-color: var(--ok); }
.stamp--fail { --stamp-color: var(--fail); }

/* сводка */
.rep-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 2px solid var(--line);
}
.rep-summary__cell {
  padding: 18px 28px 20px;
  border-right: 1px solid rgba(23,21,18,0.3);
}
.rep-summary__cell:last-child { border-right: 0; }
.rep-summary__num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.1;
}
.rep-summary__lbl {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.rep-summary__cell.c-ok .rep-summary__num { color: var(--ok); }
.rep-summary__cell.c-warn .rep-summary__num { color: var(--warn); }
.rep-summary__cell.c-fail .rep-summary__num { color: var(--fail); }
@media (max-width: 720px) {
  .rep-summary { grid-template-columns: repeat(2, 1fr); }
  .rep-summary__cell { border-bottom: 1px solid rgba(23,21,18,0.3); }
}

/* секции I / II */
.rep-part { border-bottom: 2px solid var(--line); }
.rep-part__head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding: 26px 28px 14px;
}
.rep-part__num {
  font-family: var(--display);
  font-weight: 900;
  font-size: 42px;
  line-height: 1;
  color: var(--accent);
}
.rep-part__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(18px, 2.6vw, 26px);
  text-transform: uppercase;
}
.rep-part__sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-left: auto;
  text-align: right;
}
@media (max-width: 720px) { .rep-part__sub { display: none; } }

.rep-part__error {
  margin: 0 28px 26px;
  border: 2px solid var(--fail);
  color: var(--fail);
  font-family: var(--mono);
  font-size: 13px;
  padding: 16px 18px;
}
.rep-part__error a { color: inherit; }

/* группа находок */
.grp { border-top: 1px solid var(--line); }
.grp__name {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 12px 28px 10px;
}

/* находка */
.item {
  display: grid;
  grid-template-columns: 54px 84px 1fr;
  border-top: 1px dotted rgba(23,21,18,0.3);
  padding: 10px 28px 12px 0;
}
.item__mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  padding-top: 2px;
}
.item--pass .item__mark { color: var(--ok); }
.item--warn .item__mark { color: var(--warn); }
.item--fail .item__mark { color: var(--fail); }
.item--info .item__mark { color: var(--info); }
.item__code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  padding-top: 4px;
}
.item__title { font-weight: 600; font-size: 14.5px; }
.item__details { font-size: 13px; color: var(--ink-soft); margin-top: 3px; word-break: break-word; }
.item__fix { font-size: 13px; margin-top: 5px; padding-left: 14px; position: relative; }
.item__fix::before { content: '→'; position: absolute; left: 0; color: var(--accent); }
@media (max-width: 640px) {
  .item { grid-template-columns: 40px 1fr; }
  .item__code { display: none; }
}

/* лист ручной сверки */
.manual { padding: 4px 28px 24px; }
.manual__title {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding: 14px 0 10px;
}
.manual__item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 5px 0;
}
.manual__box {
  flex: none;
  width: 14px; height: 14px;
  border: 1.5px solid var(--ink);
  margin-top: 3px;
}

/* заключение */
.rep-verdict { padding: 26px 28px 8px; }
.rep-verdict__title {
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.rep-verdict__text { max-width: 720px; font-size: 15px; }
.rep-verdict__text b.v-ok { color: var(--ok); }
.rep-verdict__text b.v-warn { color: var(--warn); }
.rep-verdict__text b.v-fail { color: var(--fail); }

/* действия */
.report-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 10px 0 0;
}
.go--print { width: auto; flex: 1; gap: 40px; }
.again {
  font-family: var(--mono);
  font-size: 13px;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--ink);
  padding: 2px 0;
  margin-right: 28px;
}
.again:hover { color: var(--accent); border-color: var(--accent); }

/* ================= подвал ================= */
.colophon {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 2px solid var(--line);
  padding: 14px 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ================= печать / PDF ================= */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; }
  .sheet { max-width: none; margin: 0; border: none; box-shadow: none; }
  .sheet::before, .sheet::after { display: none; }
  /* интерактивные контролы в PDF не нужны */
  .report-actions, .prog__spin, .ai-run-wrap { display: none !important; }
  #screen-form, #screen-progress { display: none !important; }
  #screen-report { display: block !important; padding: 0; }
  .rep-part, .rep-summary, .rep-head { break-inside: avoid-page; }
  .grp, .item, .manual__item { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
