:root {
  --bg: #f1f5f7;
  --panel: #ffffff;
  --ink: #10222e;
  --petrol: #003050;
  --petrol2: #0c4a69;
  --green: #00a050;
  --lime: #8dc63f;
  --muted: #5e7480;
  --line: #dbe4ea;
  --card: #eef4f7;
  --accent: #003050;
  --ok: #1f8a54;
  --ok-bg: #e7f5ec;
  --warn: #9a6b00;
  --warn-bg: #fbf1d8;
  --err: #b4231f;
  --err-bg: #fbe7e6;
  --track: #e4ebf0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1a22; --panel: #14232d; --ink: #e6eef2; --petrol: #6fb6d6;
    --petrol2: #1a5b7d; --green: #3cc27f; --lime: #a6d95a; --muted: #93a6b1;
    --line: #263a45; --card: #182a35; --accent: #6fb6d6;
    --ok: #57c98a; --ok-bg: #14311f; --warn: #e0b451; --warn-bg: #33290f;
    --err: #f0837f; --err-bg: #3a1a19; --track: #223541;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1a22; --panel: #14232d; --ink: #e6eef2; --petrol: #6fb6d6;
  --petrol2: #1a5b7d; --green: #3cc27f; --lime: #a6d95a; --muted: #93a6b1;
  --line: #263a45; --card: #182a35; --accent: #6fb6d6;
  --ok: #57c98a; --ok-bg: #14311f; --warn: #e0b451; --warn-bg: #33290f;
  --err: #f0837f; --err-bg: #3a1a19; --track: #223541;
}
:root[data-theme="light"] {
  --bg: #f1f5f7; --panel: #ffffff; --ink: #10222e; --petrol: #003050;
  --petrol2: #0c4a69; --green: #00a050; --lime: #8dc63f; --muted: #5e7480;
  --line: #dbe4ea; --card: #eef4f7; --accent: #003050;
  --ok: #1f8a54; --ok-bg: #e7f5ec; --warn: #9a6b00; --warn-bg: #fbf1d8;
  --err: #b4231f; --err-bg: #fbe7e6; --track: #e4ebf0;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 18px; }

.topbar { background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.topbar img { height: 46px; width: auto; }
.topbar .ttl h1 { margin: 0; font-size: 20px; color: var(--ink); }
.topbar .ttl p { margin: 1px 0 0; color: var(--muted); font-size: 13px; }
.report-btn { margin-left: auto; background: var(--green); color: #fff; border: 0;
  border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: filter .15s; }
.report-btn:hover { filter: brightness(1.08); }
.report-btn:disabled { opacity: .6; cursor: default; }
@media (max-width: 560px) { .report-btn { padding: 8px 10px; font-size: 12.5px; } }

.tabs { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.tab {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 9px 14px; border-radius: 9px 9px 0 0; cursor: pointer; font-size: 14px;
}
.tab.active { background: var(--panel); color: var(--petrol); border-bottom-color: var(--panel); font-weight: 600; }

.panel { display: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: 0 12px 12px 12px; padding: 22px; margin-bottom: 26px; }
.panel.active { display: block; }
h2 { margin: 0 0 6px; font-size: 19px; color: var(--ink); }
.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.warn-inline { color: var(--warn); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.field.checkbox { display: flex; align-items: center; gap: 8px; }
.field.checkbox > span { margin: 0; font-weight: 400; }
select, textarea, input[type=number], input[type=text] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--bg); color: var(--ink);
  font: inherit; resize: vertical;
}
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); }

button.primary {
  background: var(--petrol); color: #fff; border: none;
  padding: 11px 20px; border-radius: 9px; font-size: 15px; font-weight: 600; cursor: pointer;
}
button.primary:disabled { opacity: .55; cursor: progress; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
button.secondary {
  background: transparent; color: var(--petrol); border: 1px solid var(--petrol);
  padding: 11px 18px; border-radius: 9px; font-size: 15px; font-weight: 600; cursor: pointer;
}
button.secondary:disabled { opacity: .55; cursor: progress; }
.doi { display: flex; gap: 9px; align-items: flex-start; padding: 9px 12px; margin: 8px 0;
  border-radius: 9px; background: var(--card); border: 1px solid var(--line); font-size: 13px; }
.doi.ok .ico { color: var(--ok); } .doi.bad .ico { color: var(--err); }
.doi code { font-size: 12px; color: var(--muted); }
.claim-how { font-size: 12.5px; color: var(--petrol2); margin-top: 3px; }
.upload { border: 1.5px dashed var(--petrol2); border-radius: 12px; padding: 16px;
  margin-bottom: 18px; background: linear-gradient(135deg, rgba(0,160,80,.05), rgba(141,198,63,.06)); }
.upload-head { font-weight: 700; color: var(--petrol); font-size: 15px; }
.upload input[type=file] { flex: 1; min-width: 200px; padding: 9px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--panel); font: inherit; }

.result { margin-top: 20px; }
.result:empty { margin: 0; }

.card { border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  margin-bottom: 14px; background: var(--panel);
  box-shadow: 0 1px 3px rgba(0,48,80,.05); }
.card h3 { margin: 0 0 12px; font-size: 15px; color: var(--ink); }

/* иконки */
.ico { width: 18px; height: 18px; vertical-align: middle; }
.ico svg, svg.ico { display: block; }
.shead { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; }
.shead .ico { color: var(--green); width: 20px; height: 20px; }
.shead h3 { margin: 0; }
.ico-circle { width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--green), var(--lime)); color: #fff; flex: none; }
.ico-circle .ico { width: 18px; height: 18px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }

/* плитки-статистика */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; position: relative; }
.tile-ico { position: absolute; top: 12px; right: 12px; color: var(--petrol2); opacity: .5; }
.tile-ico .ico { width: 20px; height: 20px; }
.tile-val { font-size: 26px; font-weight: 800; color: var(--petrol); line-height: 1.1; }
.tile-lbl { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tile-sub { font-size: 11.5px; margin-top: 5px; font-weight: 600; }
.tile.up .tile-val { color: var(--ok); }
.tile.down .tile-val { color: var(--err); }
.tile-sub.up { color: var(--ok); } .tile-sub.down { color: var(--err); }
.tile-sub.neutral { color: var(--muted); }

/* дашборд-разметка */
.dash { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
@media (max-width: 620px) { .dash { grid-template-columns: 1fr; } }

/* gauge */
.gauge-svg { width: 200px; height: 118px; }
.gauge-num { font-size: 40px; font-weight: 800; fill: var(--ink); }
.gauge-sub { font-size: 12px; fill: var(--muted); }

/* donut */
.donut-svg { width: 150px; height: 150px; }
.donut-num { font-size: 26px; font-weight: 800; fill: var(--ink); }
.donut-lbl { font-size: 11px; fill: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.legend .lg { display: flex; align-items: center; gap: 8px; }
.legend .lg i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .lg b { margin-left: auto; color: var(--ink); }

/* radar */
.radar-svg { width: 100%; max-width: 360px; height: auto; }
.radar-lbl { font-size: 10.5px; fill: var(--muted); }

/* сравнительные бары */
.cmpchart { }
.cmp-legend { display: flex; gap: 16px; margin-bottom: 12px; font-size: 12.5px; color: var(--muted); }
.cmp-legend .lg { display: flex; align-items: center; gap: 6px; }
.cmp-legend .lg i { width: 11px; height: 11px; border-radius: 3px; }
.cmp-row { margin-bottom: 12px; }
.cmp-lbl { font-size: 12.5px; color: var(--ink); margin-bottom: 4px; }
.cmp-bars { display: flex; flex-direction: column; gap: 5px; }
.cmp-bar { position: relative; background: var(--track); border-radius: 6px; height: 20px; }
.cmp-bar .fill { height: 100%; border-radius: 6px; min-width: 3px; transition: width .5s ease; }
.cmp-bar b { position: absolute; right: 8px; top: 0; line-height: 20px; font-size: 11.5px; color: var(--ink); }

/* score-бары (критерии) */
.score-row { margin-bottom: 14px; }
.score-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.score-head b { font-size: 14px; }
.score-chip { margin-left: auto; font-weight: 700; font-size: 13px; padding: 1px 9px; border-radius: 20px; }
.bar { height: 9px; background: var(--track); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; transition: width .5s ease; }

/* issue-строки */
.issue { display: flex; gap: 9px; align-items: flex-start; padding: 9px 12px; margin: 8px 0;
  border-radius: 9px; background: var(--card); border: 1px solid var(--line); }
.issue .ico { flex: none; margin-top: 1px; width: 17px; height: 17px; }
.issue.error { background: var(--err-bg); border-color: transparent; }
.issue.error .ico { color: var(--err); }
.issue.warning { background: var(--warn-bg); border-color: transparent; }
.issue.warning .ico { color: var(--warn); }
.issue.okrow { background: var(--ok-bg); border-color: transparent; }
.issue.okrow .ico { color: var(--ok); }
.issue .sec { font-weight: 600; }
.issue .body { font-size: 13.5px; }

/* ближайшие заявки */
.nearest { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin: 8px 0; background: var(--panel); }
.nearest .ring { flex: none; }
.nearest .t { font-weight: 600; font-size: 14px; }
.nearest .m { font-size: 12px; color: var(--muted); }
.nearest details summary { cursor: pointer; color: var(--petrol2); font-size: 12.5px; margin-top: 4px; }
.nearest p.ab { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.ring { width: 52px; height: 52px; }
.ring-txt { font-size: 11px; font-weight: 700; fill: var(--ink); }

/* чипы лексики */
.chip { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 13px;
  margin: 3px 3px; border: 1px solid var(--line); }
.chip.won { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.rej { background: var(--err-bg); color: var(--err); border-color: transparent; }

/* формы (вкладки 3,5) */
.sections-grid { display: grid; gap: 12px; margin-top: 12px; }
.sections-grid .field { margin: 0; }
.sections-grid textarea { min-height: 60px; }
.docs-list label { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: 14px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-top: 12px; }
details { margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
details > summary { cursor: pointer; font-weight: 600; }

.rewrite { display: flex; gap: 10px; background: linear-gradient(135deg, rgba(0,160,80,.08), rgba(141,198,63,.10));
  border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 13.5px; }
.rewrite .ico { color: var(--green); flex: none; width: 20px; height: 20px; }
.verdict-txt { font-size: 14.5px; }
.small { font-size: 12.5px; color: var(--muted); }
.foot { color: var(--muted); font-size: 12.5px; padding-bottom: 30px; }
.spinner { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 9px; }
.spinner::before { content: ""; width: 15px; height: 15px; border: 2px solid var(--line);
  border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { background: var(--err-bg); color: var(--err); border-radius: 9px; padding: 12px 14px; font-size: 14px; }
.subgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .subgrid { grid-template-columns: 1fr; } }

/* ---- Модуль 1: панель рецензентов, 100-балльная шкала, круги доработки ---- */
.rounds { margin: 6px 0 0; }
.rounds-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.rounds-lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.round-chip { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1;
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; position: relative; }
.round-chip b { font-size: 18px; font-variant-numeric: tabular-nums; }
.round-chip small { font-size: 10.5px; color: var(--muted); }
.round-arrow { color: var(--muted); font-size: 16px; }
.round-delta { font-size: 11px; font-weight: 700; margin-top: 2px; }
.round-delta.up { color: var(--ok); } .round-delta.down { color: var(--err); }

.panel-score { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.panel-score-num { font-family: Georgia, serif; font-size: 46px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.panel-score-num span { font-size: 20px; color: var(--muted); font-family: inherit; }

.scale100-track { position: relative; height: 26px; background: var(--track); border-radius: 7px; overflow: visible; }
.scale100-fill { height: 100%; border-radius: 7px; transition: width .4s; }
.scale100-mark { position: absolute; top: -4px; bottom: -4px; transform: translateX(-50%); }
.scale100-mark i { display: block; width: 2px; height: 34px; background: var(--ink); opacity: .5; margin: 0 auto; }
.scale100-mark b { position: absolute; top: 36px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-weight: 700; }
.scale100-mark.strong i { background: var(--ok); opacity: .8; }
.scale100-legend { display: flex; justify-content: space-between; margin-top: 26px; font-size: 11.5px; color: var(--muted); }

.reviewers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.reviewer { border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; background: var(--panel); }
.rv-score { font-family: Georgia, serif; font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.rv-name { font-weight: 600; font-size: 13.5px; margin: 4px 0 6px; }
.rv-verdict { font-size: 12px; color: var(--muted); line-height: 1.35; }

.crit-row { padding: 9px 0; border-top: 1px solid var(--line); }
.crit-row:first-of-type { border-top: none; }
.crit-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.crit-head b { font-size: 13.5px; }
.crit-weight { font-size: 11px; color: var(--muted); }
.crit-points { margin-left: auto; font-weight: 700; font-family: Georgia, serif; font-size: 16px; font-variant-numeric: tabular-nums; }
.crit-points small { font-size: 11px; color: var(--muted); font-family: inherit; }
.crit-comments { margin-top: 7px; }
.crit-comments summary { font-size: 12.5px; color: var(--muted); cursor: pointer; }
.crit-cm { margin: 8px 0 0 4px; font-size: 12.5px; line-height: 1.4; }
.crit-cm b { color: var(--ink); }
.score-chip.small { font-size: 10.5px; padding: 1px 6px; border-radius: 6px; }
@media (max-width: 560px) { .reviewers { grid-template-columns: 1fr; } }

/* ---- Библиограф: список публикаций ---- */
.pubs { display: flex; flex-direction: column; gap: 8px; }
.pub { border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; background: var(--panel); }
.pub-t { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.pub-m { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.pub-m .badge { font-size: 11px; padding: 1px 8px; }

/* ---- Редактор: улучшенный текст ---- */
.ed-out { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; padding: 12px 14px; font-size: 14px; line-height: 1.55; }

/* ---- М2: рейтинг волны заявок ---- */
.rank-row { display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line); }
.rank-row:first-of-type { border-top: none; padding-top: 2px; }
.rank-pos { font-size: 22px; font-weight: 800; color: var(--muted); text-align: center; line-height: 1; }
.rank-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.rank-title { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.rank-score { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; flex: none; }
.bar-track { position: relative; height: 24px; background: var(--track); border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 7px 0 0 7px; display: flex; align-items: center;
  padding-left: 10px; color: #fff; font-size: 11.5px; font-weight: 600; white-space: nowrap; transition: width .4s; }
.thr-mark { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--ink); opacity: .45; }
.rank-why { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }

/* ---- М3: воронка скаута и карточки кандидатов ---- */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.fstep-row { display: flex; align-items: center; gap: 12px; }
.fstep { border: 1.5px solid var(--green); background: var(--ok-bg); border-radius: 10px;
  padding: 10px 14px; font-size: 13.5px; transition: width .4s; }
.fstep b { font-size: 17px; margin-right: 6px; }
.fstep.fin { border-color: var(--petrol); background: var(--card); }
.fnote { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.cand { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  margin-bottom: 10px; background: var(--panel); }
.cand-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cand-sim { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; flex: none; }
.cand-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.cand-dir { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--petrol); }
.cand details { margin-top: 8px; }
.cand summary { font-size: 12.5px; color: var(--muted); cursor: pointer; }
@media (max-width: 560px) { .fnote { display: none; } }

/* ======================= АУТЕНТИФИКАЦИЯ И РОЛИ ======================= */
.auth-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px 28px; width: 100%; max-width: 400px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}
.auth-logo { height: 40px; display: block; margin: 0 auto 14px; }
.auth-title { font-size: 18px; text-align: center; margin: 0 0 4px; color: var(--petrol); }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.auth-card .field { display: block; margin-bottom: 14px; }
.auth-card .field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.auth-card .field input, .auth-card .field select {
  width: 100%; box-sizing: border-box; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); font-size: 14px;
}
.auth-btn { width: 100%; margin-top: 4px; padding: 11px; font-size: 15px; }
.auth-msg { margin-top: 12px; font-size: 13px; min-height: 18px; text-align: center; }
.auth-msg.err { color: var(--err); }
.auth-msg.ok { color: var(--ok); }
.auth-switch { text-align: center; font-size: 13px; color: var(--muted); margin: 16px 0 0; }
.auth-switch a { color: var(--petrol); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.consent-row { display: flex; gap: 9px; align-items: flex-start; margin: 4px 0 14px;
  font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.consent-row input { margin-top: 2px; flex-shrink: 0; }
.consent-row a { color: var(--petrol); }

.user-badge { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-role {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  background: var(--petrol); color: #fff; padding: 3px 8px; border-radius: 5px;
}
.user-name { font-size: 13px; color: var(--ink); font-weight: 600; }
.logout-btn {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.logout-btn:hover { border-color: var(--err); color: var(--err); }

.adm-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px; }
.adm-table th, .adm-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.adm-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.adm-role { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font-size: 13px; }
.adm-table .ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px; margin-left: 6px; }
.adm-table .ghost:hover { border-color: var(--err); color: var(--err); }
