/* Палитра и кнопки — как в интерфейсе Битрикс24 (взято из b24-focus); компоновка — карточки, плитки, таблицы в рамке */
:root {
  --ground: #eef2f4;
  --surface: #fff;
  --ink: #333;
  --ink-2: #525c69;
  --muted: #6f7882;
  --line: #e4e8eb;
  --line-strong: #cfd5da;
  --chip-bg: #f5f7f8;
  --accent: #2fc6f6;
  --accent-dark: #11a9d9;
  --link: #2067b0;
  --cta: #bbed21;
  --cta-hover: #d2f95f;
  --danger: #ff5752;
  --ok-bg: #f1fbd0; --ok-ink: #4f7d00; --ok-mark: #7bb300;
  --err-bg: #ffe8e8; --err-ink: #d0312b; --err-mark: #ff5752;
  --info-bg: #e5f9ff; --info-ink: #0b8eb6;
  --warn-bg: #fff4d6; --warn-ink: #8a5a00; --warn-mark: #f5b400;
  --shadow: 0 1px 2px rgba(20, 24, 30, .06), 0 4px 14px rgba(20, 24, 30, .05);
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.45 "Golos Text", "Open Sans", "Helvetica Neue", Arial, sans-serif;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.error { color: var(--err-ink); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.pad { padding: 24px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }

/* ---------- каркас ---------- */
.app { max-width: 1240px; margin: 0 auto; padding: 16px clamp(12px, 3vw, 28px) 40px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; color: var(--ink-2); padding: 7px 14px; border-radius: 8px; white-space: nowrap; font-size: 14px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.page-head { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.15; font-weight: 600; text-wrap: balance; }
h2 { margin: 0; font-size: 18px; font-weight: 600; }
.thesis { margin: 0; max-width: 78ch; color: var(--ink-2); }
.back { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--link); font-size: 14px; }
.back:hover { text-decoration: underline; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.section { display: flex; flex-direction: column; gap: 14px; }

/* ---------- кнопки и поля (ui-btn Битрикс24) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 18px; border-radius: 18px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap;
}
.btn:hover { border-color: #a8adb4; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-cta { background: var(--cta); border-color: var(--cta); color: var(--ink-2); }
.btn-cta:hover:not(:disabled) { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-danger { color: var(--err-ink); border-color: #f3b7b5; }
.btn-l { height: 46px; border-radius: 23px; font-size: 13px; padding: 0 28px; }
.btn-s { height: 30px; padding: 0 12px; border-radius: 15px; font-size: 11px; }

.input {
  width: 100%; min-height: 38px; padding: 7px 10px; font: inherit; font-size: 14px; color: inherit;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
}
.input:focus { outline: none; border-color: var(--accent); }
.input-s { min-height: 32px; padding: 5px 8px; }
select.input { width: auto; max-width: 100%; }
.num-input { width: 96px; }
.search { max-width: 320px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 13px; color: var(--ink-2); }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check-line input { accent-color: var(--accent); margin-top: 3px; flex: none; }

/* метки */
.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 6px; white-space: nowrap; background: var(--chip-bg); color: var(--ink-2); }
.pill.info { background: var(--info-bg); color: var(--info-ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.err { background: var(--err-bg); color: var(--err-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }

.dashed { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 16px 18px; color: var(--ink-2); background: var(--surface); }
.dashed b { color: var(--ink); font-weight: 600; }
.note { border-radius: 10px; padding: 12px 14px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note.ok { background: var(--ok-bg); color: var(--ok-ink); }
.note.err { background: var(--err-bg); color: var(--err-ink); }
.note.info { background: var(--info-bg); color: var(--info-ink); }

/* ---------- обзор ---------- */
.hero { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; }
.score-card { display: flex; flex-direction: column; gap: 12px; }
.score-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.score { font-size: 64px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.score-of { font-size: 18px; color: var(--muted); }
.delta { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok-ink); }
.delta.down { color: var(--err-ink); }
.ai { font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 10px; margin: 0; }

.progress { height: 10px; background: var(--chip-bg); border-radius: 5px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .4s; }

.checks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; flex-direction: column; gap: 8px; text-align: left; border: 1px solid transparent; }
.check.click { cursor: pointer; }
.check.click:hover { border-color: var(--accent); }
.check-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.check-name { font-weight: 600; font-size: 16px; }
.check-count { font-size: 34px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.check-base { font-size: 13px; color: var(--muted); }
.check-go { margin-top: auto; padding-top: 4px; font-size: 13px; font-weight: 500; color: var(--link); }

/* полоска балла: отметка статуса + число рядом, цвет никогда не единственный признак */
.meter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meter-track { flex: 1; height: 6px; background: var(--chip-bg); border-radius: 3px; overflow: hidden; }
.meter-track i { display: block; height: 100%; border-radius: 3px; }
.s-ok { background: var(--ok-mark); }
.s-warn { background: var(--warn-mark); }
.s-err { background: var(--err-mark); }

/* график истории */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 180px; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .series { fill: none; stroke: var(--link); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--link); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hover-line { stroke: var(--line-strong); stroke-width: 1; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.tip b { font-size: 14px; }

/* ---------- мастер исправления ---------- */
.toolbar { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; }
.toolbar .right { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: #fff; border-radius: 14px; padding: 4px 11px; font-size: 13px; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { opacity: .75; margin-left: 4px; font-variant-numeric: tabular-nums; }

.tablewrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; border: 1px solid var(--line-strong); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 13px; font-weight: 600; background: var(--chip-bg); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
td.cb, th.cb { width: 36px; padding-right: 0; }
td.cb input, th.cb input { accent-color: var(--accent); width: 16px; height: 16px; margin: 2px 0 0; }
td.title a { font-weight: 500; text-decoration: none; }
td.title a:hover { text-decoration: underline; }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
tr.done td { background: var(--ok-bg); }
tr.failed td { background: var(--err-bg); }
.wide { min-width: 720px; }
.recs { display: flex; flex-direction: column; gap: 3px; }
.recs a { text-decoration: none; font-weight: 500; }
.recs a:hover { text-decoration: underline; }
.recs .first::after { content: " · основная"; color: var(--muted); font-weight: 400; font-size: 12px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }

.actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line-strong); }
.action-tabs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.action-body { display: flex; flex-direction: column; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.tp-chip { border: 1px solid var(--line-strong); background: #fff; border-radius: 14px; padding: 4px 10px; font-size: 13px; }
.tp-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- настройки, справка, отчёты ---------- */
.settings { display: flex; flex-direction: column; gap: 14px; max-width: 820px; }
.settings .card { display: flex; flex-direction: column; gap: 10px; }
.settings .card-head { margin-bottom: 0; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.req-group > summary { cursor: pointer; font-weight: 500; padding: 4px 0; }
.req-group[open] > summary { margin-bottom: 8px; }
.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.notes ul { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; color: var(--ink-2); }
.notes b { color: var(--ink); }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .checks, .notes { grid-template-columns: minmax(0, 1fr); }
  .toolbar .right { margin-left: 0; }
  .score { font-size: 52px; }
  .card { padding: 16px; }
}

/* ---------- печать: отчёт для клиента или руководителя ---------- */
@media print {
  body { background: #fff; }
  .topbar, .no-print, .btn { display: none !important; }
  .card, .tablewrap { box-shadow: none; border: 1px solid var(--line-strong); break-inside: avoid; }
  .app { padding: 0; }
}
