/* зона: measures — меры по причинам и проверка результата (docs/brief_safety.md).
   Состояние меры — форма метки + подпись: контур (назначена), синяя точка (в работе), кольцо с точкой (ждёт проверки),
   галочка (результат подтверждён), янтарный треугольник (не помогла). Просрочка — красный текст, как «ждёт» на пульте. */
.ms-sub { margin: 4px 0 0; }
.ms-late { color: #f0837f; font-weight: 600; }
.ms-shell { overflow: hidden; }
.ms-shell > .tabs { padding: 0 8px; overflow-y: hidden; }
.ms-count { margin-left: 6px; color: var(--text-3); font-size: 12.5px; }
.tabs button[aria-selected="true"] .ms-count { color: var(--text-2); }
.ms-foot { display: flex; gap: 8px; align-items: center; margin: 12px 2px 0; font-size: 12.5px; }

.ms-st { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; color: var(--text-2); }
.ms-st::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; box-sizing: border-box; }
.ms-st.assigned { color: var(--text); font-weight: 600; }
.ms-st.assigned::before { border: 2px solid currentColor; }
.ms-st.in_progress { color: var(--text); }
.ms-st.in_progress::before { background: var(--select); }
.ms-st.done { color: var(--text); }
.ms-st.done::before { width: 11px; height: 11px; border: 2px solid var(--text-2); background: radial-gradient(circle, var(--text) 0 2px, transparent 2.5px); }
.ms-st.verified::before { width: 10px; height: 6px; border-radius: 0; border: 2px solid var(--ok); border-top: 0; border-right: 0; transform: translateY(-2px) rotate(-45deg); }
.ms-st.failed { color: #e6c282; }
.ms-st.failed::before { width: 11px; height: 10px; border-radius: 0; background: var(--p2); clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* список: группы по тому, что с мерой делать */
.ms-layout { padding: 0; gap: 0; }
.ms-layout.with-detail { grid-template-columns: minmax(0, 1fr) 460px; }
.ms-list { min-width: 0; }
.ms-table { width: 100%; }
.ms-table th:first-child, .ms-table td:first-child { width: 168px; }
.ms-table th:nth-child(4), .ms-table td:nth-child(4) { width: 168px; }
.ms-table td:nth-child(5) { width: 72px; }
.ms-table.narrow .ms-owner { display: none; }
.ms-table .cell-main { overflow-wrap: anywhere; }
.ms-gh th { position: static; background: var(--panel-2); color: var(--text-2); font-size: 12.5px; font-weight: 600; padding: 7px 12px; }
.ms-gh th span { color: var(--text-3); font-weight: 500; margin-left: 4px; }
.ms-group.overdue .ms-gh th { color: #f0837f; }
.ms-due small { display: block; color: var(--text-3); font-size: 12.5px; }
.ms-due .ms-late + small { color: var(--text-3); }
.ms-demo { height: 18px; padding: 0 5px; font-size: 11px; margin-left: 6px; vertical-align: 1px; }
.ms-table tbody tr.clickable:focus-visible { outline: 2px solid var(--select); outline-offset: -2px; }

/* повторяющиеся места */
.ms-rep { width: 100%; }
.ms-what { display: flex; gap: 10px; align-items: flex-start; }
.ms-what .prio { margin-top: 1px; }
.ms-rep td.num b { font-size: 16px; }
.ms-link { display: grid; gap: 2px; text-decoration: none; color: inherit; }
.ms-link:hover .ms-st { color: #fff; }
.ms-none { color: var(--text-3); }

/* карточка меры */
.ms-detail { border-width: 0 0 0 1px; border-radius: 0; max-height: calc(100vh - 52px - 160px); }
.ms-dhead { align-items: flex-start; height: auto; padding-block: 12px; flex: none; }
.ms-dtitle { display: grid; gap: 6px; min-width: 0; flex: 1; }
.ms-dtitle h2 { font-size: 15px; overflow-wrap: anywhere; }
.ms-dtitle .ms-late { font-size: 12.5px; }
.ms-sec { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.ms-sec h3 { font-size: 13px; color: var(--text-2); font-weight: 600; }
.ms-sec p { margin: 0; max-width: 62ch; }
.ms-p { margin: 0; font-size: 13px; }
.ms-cmp { display: grid; grid-template-columns: auto auto auto 1fr; gap: 4px 14px; align-items: end; justify-content: start; }
.ms-cmp > div:not(.arrow):not(.ms-verdict) { display: grid; gap: 1px; }
.ms-cmp span { font-size: 12.5px; color: var(--text-3); }
.ms-cmp b { font-size: 24px; font-weight: 600; line-height: 1.1; }
.ms-cmp small { font-size: 12px; color: var(--text-3); }
.ms-cmp .arrow { color: var(--text-3); font-size: 18px; padding-bottom: 20px; }
.ms-verdict { display: grid; gap: 2px; padding-bottom: 2px; }
.ms-verdict b { font-size: 13px; font-weight: 600; line-height: 1.3; }
.ms-verdict.ok b { color: #b4d6bd; }
.ms-verdict.bad b { color: #e6c282; }
.ms-chart { margin-top: 4px; }
.ms-chart .ms-bar { fill: #8a929a; }
.ms-chart .hit:hover { fill: rgba(255, 255, 255, .05); }
.ms-chart .ms-mean { stroke: var(--text); stroke-width: 1.5; opacity: .75; }
.ms-chart .ms-done { stroke: var(--select); stroke-width: 1.5; }
.ms-chart .lbl { fill: var(--text-2); font-size: 11.5px; }
.ms-cap { margin: 0; font-size: 12px; color: var(--text-3); max-width: 62ch; }
.ms-snap { margin: 0; font-size: 12.5px; color: var(--text-2); }
.ms-photo img { display: block; max-width: 100%; max-height: 220px; border-radius: 4px; border: 1px solid var(--line); object-fit: cover; }
/* действия по мере — внизу карточки, всегда на виду: решение не прячется под прокруткой */
.ms-actbar { flex: none; border-top: 1px solid var(--line); background: var(--panel-2); padding: 12px; max-height: 50%; overflow: auto; }
.ms-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ms-hint { font-size: 12.5px; color: var(--text-3); }
.ms-cmp-t { margin: 0; font-size: 12.5px; color: var(--text-2); }
.ms-form { display: grid; gap: 10px; }
.ms-form .textarea { min-height: 60px; }
.ms-file { height: auto; padding: 6px 8px; }
.ms-file::file-selector-button { margin-right: 10px; height: 24px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--panel-2); color: var(--text); cursor: pointer; }
.ms-evs { list-style: none; margin: 0; padding: 0; display: grid; }
.ms-evs a { display: flex; align-items: center; gap: 10px; padding: 6px 4px; color: inherit; text-decoration: none; border-radius: 3px; min-width: 0; }
.ms-evs a:hover { background: var(--panel-2); }
.ms-evs a > span { display: grid; min-width: 0; font-size: 13px; }
.ms-evs small { color: var(--text-3); font-size: 12px; }
.ms-log li.assigned::before { background: transparent; border: 2px solid var(--text-2); box-sizing: border-box; }
.ms-log li.in_progress::before { background: var(--select); }
.ms-log li.done::before { background: var(--text); }
.ms-log li.verified::before { background: var(--ok); }
.ms-log li.failed::before { background: var(--p2); border-radius: 1px; transform: rotate(45deg); }

/* новая мера */
.ms-new { gap: 14px; }
.ms-types { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.ms-types legend { font-size: 12.5px; color: var(--text-2); padding: 0; margin-bottom: 6px; }
.ms-types .chip { display: inline-flex; align-items: center; gap: 6px; }
.ms-types .chip input { position: absolute; opacity: 0; pointer-events: none; }
.ms-types .chip:has(input:checked) { background: var(--select-bg); border-color: var(--select); }
.ms-types .chip:has(input:focus-visible) { outline: 2px solid var(--select); outline-offset: 2px; }
.ms-new .textarea { min-height: 64px; }

@media (max-width: 1280px) { .ms-layout.with-detail { grid-template-columns: minmax(0, 1fr) 400px; } }
@media (max-width: 1080px) {
  .ms-layout.with-detail { grid-template-columns: 1fr; }
  .ms-detail { max-height: none; border-width: 0; }
}
@media (max-width: 760px) {
  .ms-table th:first-child, .ms-table td:first-child { width: 126px; }
  .ms-table th:nth-child(4), .ms-table td:nth-child(4) { width: 112px; }
  .ms-table td, .ms-table th { padding-left: 10px; padding-right: 8px; }
  .ms-st { white-space: normal; align-items: flex-start; }
  .ms-st::before { margin-top: 4px; }
  .ms-cmp { grid-template-columns: auto auto auto; }
  .ms-verdict { grid-column: 1 / -1; }
  .ms-rep thead { display: none; }
  .ms-rep tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .ms-rep td { padding: 0; border: 0; }
  .ms-rep td:nth-child(1) { grid-column: 1 / -1; }
  .ms-rep td.num { text-align: right; }
  .ms-rep td:last-child { grid-column: 1 / -1; }
  .ms-shell > .filters .seg { margin-left: 0 !important; }
}

/* аналитика: ведущие показатели и меры (dashboard.js — зона «Меры и показатели») */
.dash a.btn, .ms-page a.btn { text-decoration: none; }
.dash-note { margin: -4px 2px 0; font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dash-link { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.dash-link:hover { border-bottom-color: var(--select); }
.dash-h-sub { font-size: 12.5px; }
.dash-places { width: 100%; }
.dash-places td.num b { font-size: 15px; }
.dash-places .cell-main { white-space: nowrap; }
.dash-what { display: flex; gap: 10px; align-items: flex-start; }
.dash-what .prio { margin-top: 1px; }
.dash-ms { text-decoration: none; }
.dash-ms:hover .ms-st { color: #fff; }
.dash-pipe { list-style: none; margin: 0; padding: 0; display: grid; }
.dash-pipe a { display: grid; grid-template-columns: 16px 1fr auto; gap: 10px; align-items: center; padding: 8px 6px; color: var(--text); text-decoration: none; border-radius: 3px; }
.dash-pipe li + li a { border-top: 1px solid #30353b; }
.dash-pipe a:hover { background: var(--panel-2); }
.dash-pipe b { font-size: 16px; font-weight: 600; }
.dash-pipe .ms-st { gap: 0; }
.dash-pipe .ms-late { display: inline-grid; place-items: center; width: 12px; height: 12px; background: var(--p1); color: #111; font-size: 10px; font-weight: 800; border-radius: 2px; }
.dash-pipe li.zero a { color: var(--text-3); }
.dash-pipe li.zero b { font-weight: 500; }
.hbar-v { display: inline-flex; gap: 10px; align-items: baseline; white-space: nowrap; }
.hbar-v .faint { font-size: 12px; }
@media (max-width: 760px) {
  .dash-places .dash-what .cell-sub { display: none; }
  .hbar-v { white-space: normal; flex-wrap: wrap; justify-content: flex-end; }
}
/* карточка меры: колонка блоков без сжатия — в прокручиваемой колонке строки сетки сплющивались */
.ms-detail .detail-body { display: flex; flex-direction: column; gap: 12px; }
.ms-detail .detail-body > * { flex: none; }
.dash-pipe li.sub a { padding-left: 32px; grid-template-columns: 1fr auto; }
.dash-pipe li.sub a > .ms-late { display: none; }
.dash-pipe li.sub span { color: #f0837f; }
.dash-pipe li.sub.zero span { color: var(--text-3); }
