/* Отчёт РОПа — стили приложения поверх общей дизайн-системы app.css. */

.chip { cursor: pointer; }
.spacer { flex: 1 1 auto; }
.rp-hint { font-size: 12px; color: var(--text-3); }
[hidden] { display: none !important; }
.input--sm { min-height: 32px; padding: 6px 10px; font-size: 12.5px; }

/* ───── панель фильтров ───── */
.rp-toolbar { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.rp-toolbar__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rp-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-dates { display: flex; align-items: center; gap: 6px; }
.rp-dates input { width: 150px; }
.rp-dash { color: var(--text-4); }
.rp-select { width: auto; min-width: 200px; max-width: 320px; }
.btn svg { margin-right: 6px; }

.seg { display: inline-flex; padding: 3px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.seg__btn {
  border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
.seg__btn:hover { color: var(--text-1); }
.seg__btn.active { background: var(--bg-1); color: var(--text-1); box-shadow: var(--shadow-1); }

/* ───── мультивыбор ───── */
.ms { position: relative; min-width: 240px; }
.ms--wide { max-width: 420px; }
.ms__btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; text-align: left; }
.ms__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms__chev { width: 14px; height: 14px; flex: none; color: var(--text-3); }
.ms__panel {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; width: 320px;
  background: var(--bg-1); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-2);
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.ms__list { max-height: 260px; overflow: auto; display: flex; flex-direction: column; }
.ms__opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-1); }
.ms__opt:hover { background: var(--bg-2); }
.ms__opt input { accent-color: var(--accent); }
.ms__opt i { font-style: normal; color: var(--text-4); font-size: 11.5px; }
.ms__empty { padding: 8px; font-size: 12px; color: var(--text-3); }
.ms__foot { display: flex; justify-content: flex-end; }

/* ───── отчёт ───── */
#rp-main { display: flex; flex-direction: column; gap: 14px; }
.rp-fresh { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 22px; padding: 0 4px; }
.rp-block { padding: 18px 18px 14px; }
.rp-block__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; margin-bottom: 12px; }
.rp-block__head .card-title { margin: 0; }

.rp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; transition: opacity .15s; }
.rp-table-wrap.is-loading { opacity: .5; }
.rp-table-wrap--scroll { max-height: 460px; overflow-y: auto; }

.rp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.rp-table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-2); color: var(--text-2); font-weight: 600; font-size: 12.5px; line-height: 1.25;
  padding: 10px 10px; text-align: left; vertical-align: bottom; border-bottom: 1px solid var(--line-strong);
}
.rp-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--text-1); vertical-align: top; }
.rp-table:not(.rp-matrix) tbody tr:nth-child(even) td { background: var(--bg-2); }
.rp-table .rp-num { text-align: right; white-space: nowrap; }
.rp-table th.rp-num { white-space: normal; }
.rp-table th.rp-num span { display: inline-block; max-width: 88px; text-align: right; }
.rp-table .rp-name {
  position: sticky; left: 0; z-index: 1; background: var(--bg-1);
  min-width: 150px; max-width: 220px; border-right: 2px solid var(--line-strong);
}
.rp-table th.rp-name { z-index: 3; background: var(--bg-2); }
.rp-table tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line-strong); background: var(--bg-1); }
.rp-sub { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 400; }

.rp-sortable { cursor: pointer; user-select: none; }
.rp-sortable:hover { color: var(--text-1); }
.rp-sort { display: inline-block; width: 7px; height: 11px; margin-left: 4px; vertical-align: -1px; opacity: .35;
  background: linear-gradient(135deg, transparent 50%, currentColor 50%) top / 7px 4px no-repeat,
              linear-gradient(45deg, currentColor 50%, transparent 50%) bottom / 7px 4px no-repeat; }
.rp-sortable.is-asc .rp-sort { opacity: 1; background-size: 7px 4px, 0 0; }
.rp-sortable.is-desc .rp-sort { opacity: 1; background-size: 0 0, 7px 4px; }

/* Тепловая заливка: --h — доля от максимума столбца (0..1), цвет смешивается с фоном темы. */
.rp-table td.rp-heat { --heat: 246 196 64; background: color-mix(in srgb, rgb(var(--heat)) calc(var(--h) * 100%), var(--bg-1)); }
.rp-table td.rp-heat--g { --heat: 72 196 140; }
.rp-table tbody tr:nth-child(even) td.rp-heat { background: color-mix(in srgb, rgb(var(--heat)) calc(var(--h) * 100%), var(--bg-1)); }
.rp-table td.rp-heat.is-strong, .rp-table td.rp-heat.is-strong .rp-drillbtn { color: #11141C; }

.rp-drillbtn {
  border: 0; background: transparent; padding: 0; font: inherit; color: inherit; cursor: pointer;
  border-bottom: 1px dashed transparent;
}
.rp-drillbtn:hover { border-bottom-color: currentColor; }
.rp-total .rp-drillbtn { font-weight: 700; }

.rp-i {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 4px;
  border-radius: 50%; border: 1px solid var(--line-strong); color: var(--text-3); font-size: 10px; font-weight: 600; cursor: help;
}

.rp-table--targets .rp-name { min-width: 200px; max-width: 320px; }
.rp-table--targets .rp-stage { width: 45%; }
.rp-barcol { position: relative; width: 26%; min-width: 160px; }
.rp-bar { position: absolute; top: 3px; bottom: 3px; left: 0; background: rgba(72, 196, 140, .35); border-radius: 2px; }
.rp-barcol .rp-drillbtn { position: relative; }

.rp-denied { max-width: 720px; }

/* ───── расшифровка ───── */
.modal-card.rp-drill { max-width: 1040px; }
.rp-table--drill .rp-name { position: static; border-right: 0; max-width: 360px; }
.rp-table--drill a { color: var(--accent); text-decoration: none; }
.rp-table--drill a:hover { text-decoration: underline; }

/* ───── настройки ───── */
.rp-auto { margin-bottom: 14px; display: flex; gap: 10px; align-items: flex-start; }
.mode-option > span { display: flex; flex-direction: column; gap: 2px; }
.rp-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.rp-settings .card--wide { grid-column: 1 / -1; }
.rp-settings .switch-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.rp-depth { margin-top: 12px; }
.rp-depth .field { max-width: 220px; }
.rp-viewers { margin-top: 10px; }
.rp-viewers .chip { cursor: default; }
.rp-info { margin: 4px 0 8px; }

.rp-steps-head { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 6px 0 12px; }
.rp-step { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--bg-2); }
.rp-step__n {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700;
}
.rp-src-fixed { font-size: 12px; color: var(--text-3); padding: 6px 2px; }

.rp-matrix-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 8px; }
.rp-matrix { font-size: 13px; }
.rp-matrix .rp-name { min-width: 240px; max-width: 360px; border-right: 1px solid var(--line); }
.rp-matrix .rp-chk { text-align: center; width: 13%; }
.rp-matrix .rp-chk input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.rp-matrix .rp-chk input:disabled { opacity: .3; cursor: not-allowed; }
.rp-matrix .rp-chk--ref input { accent-color: var(--danger); }
.rp-matrix th.rp-chk { text-align: center; }
.rp-matrix tr.rp-group td {
  background: var(--bg-3); color: var(--text-2); font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 7px 10px; position: static;
}
.rp-matrix tbody tr:not(.rp-group):hover td { background: var(--accent-soft); }
.rp-sem { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.rp-sem--p { background: var(--text-4); }
.rp-sem--s { background: var(--success); }
.rp-sem--f { background: var(--danger); }

.rp-save {
  position: sticky; bottom: 0; z-index: 5;
  margin-top: 14px; padding: 14px 0;
  background: linear-gradient(to top, var(--bg-0) 70%, transparent);
}

/* ───── адаптив ───── */
@media (max-width: 1100px) {
  .rp-steps-head { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .rp-settings { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .rp-steps-head { grid-template-columns: 1fr 1fr; }
  .rp-dates input { width: calc(50% - 14px); }
  .rp-dates { width: 100%; }
  .ms, .rp-select { width: 100%; max-width: none; }
  .seg { width: 100%; }
  .seg__btn { flex: 1; }
}
