/* Демо окна «Расхождения монолита АР и КЖ» (MonolithCheckWindow.xaml).
   Цвета, отступы, подписи и легенда повторяют реальный плагин RabinBIM для Revit. */

.ml-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1200px;
  margin: 0 auto;
}

.ml-summary {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 17px;
}

.ml-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
  margin: 7px 0 11px;
}
.ml-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text);
}
.ml-sw {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  flex: none;
}
.ml-sw.ar { background: #E62828; border: 1px solid #960000; }
.ml-sw.kr { background: #28AA46; border: 1px solid #006E1E; }
.ml-sw.fail { background: transparent; border: 2px solid #FF8C00; }
.ml-sw.ctx { background: #AAAAAA; border: 1px solid #5A5A5A; }

/* Панель фильтров и поиска */
.ml-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 10px;
}
.ml-bar .rw-sel {
  min-width: 210px;
  margin-right: 12px;
}
.ml-lbl {
  white-space: nowrap;
  color: var(--text);
  margin-right: 6px;
}
.ml-num {
  width: 50px;
  min-height: 32px;
  height: 32px;
  padding: 4px 6px;
  text-align: center;
  margin-right: 10px;
}
.ml-num.small {
  width: 58px;
  margin-right: 6px;
}
.ml-bar .ml-apply {
  margin-right: 14px;
}
.ml-search {
  flex: 1;
  min-width: 140px;
  min-height: 32px;
  height: 32px;
}

/* Таблица DataGrid */
.ml-grid-wrap {
  position: relative;
  height: 274px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--edge);
}
.ml-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 16px;
}
.ml-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 7px 7px;
  background: var(--header);
  border-bottom: 1px solid var(--edge);
  font-weight: 600;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.ml-grid thead th:first-child {
  width: 34px;
  padding: 7px 4px;
  cursor: default;
}
.ml-grid thead th:hover:not(:first-child) {
  background: #E8EEF6;
}
.ml-grid thead th.ml-n,
.ml-grid tbody td.ml-n {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ml-sort {
  display: inline-block;
  margin-left: 4px;
  font-size: 9px;
  color: var(--primary);
}
.ml-grid tbody tr.ml-row {
  cursor: pointer;
  transition: background-color 80ms;
}
.ml-grid tbody tr.ml-row:nth-of-type(4n+3) td {
  background: var(--alt);
}
.ml-grid tbody tr.ml-row:hover td {
  background: var(--tint);
}
.ml-grid tbody tr.ml-row.sel td {
  background: var(--selected);
}
.ml-grid tbody tr.ml-row td {
  padding: 6px 7px;
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
  vertical-align: middle;
}
.ml-grid tbody tr.ml-row td:first-child {
  padding: 3px 5px;
  text-align: center;
}
.ml-grid tbody tr.ml-row td.ml-type {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ml-grid tbody tr.ml-row td.ml-status {
  max-width: 185px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ml-dir {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ml-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
}
.ml-dot.ar { background: #E62828; border: 1px solid #960000; }
.ml-dot.kr { background: #28AA46; border: 1px solid #006E1E; }
.ml-dot.fail { background: transparent; border: 2px solid #FF8C00; }

.ml-exp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.ml-exp:hover {
  background: var(--hover);
  border-color: var(--primary);
}

/* Вложенная таблица кусков (RowDetailsTemplate) */
.ml-subrow td {
  padding: 4px 10px 10px 34px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--edge);
}
.ml-subgrid {
  width: auto;
  min-width: 620px;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--edge);
  font-size: 11.5px;
}
.ml-subgrid th {
  padding: 5px 8px;
  background: var(--header);
  border-bottom: 1px solid var(--edge);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.ml-subgrid td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}
.ml-subgrid tbody tr {
  cursor: pointer;
}
.ml-subgrid tbody tr:hover td {
  background: var(--hover);
}
.ml-subgrid tbody tr.sel td {
  background: var(--selected);
}
.ml-subgrid th.ml-n,
.ml-subgrid td.ml-n {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ml-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
}

/* Нижняя панель кнопок */
.ml-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.ml-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: flex-end;
}
.ml-grp {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ml-cap {
  margin-left: 2px;
  font-size: 11.5px;
  line-height: 14px;
  color: var(--muted);
}
.ml-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.ml-btns .rw-btn {
  padding: 0 13px;
}
.ml-btns .rw-btn[hidden] {
  display: none;
}
.ml-btns .rw-chk {
  margin-left: 4px;
}
.ml-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

/* Всплывающее уведомление внутри окна */
.ml-toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 20;
  padding: 7px 14px;
  border-radius: 6px;
  background: rgba(37, 42, 52, 0.94);
  color: #fff;
  font-size: 12px;
  line-height: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ml-toast.show {
  opacity: 1;
}

/* ===== Интерактивный учебный вид Revit под окном ===== */
.ml-vp {
  background: #FFFFFF;
  border: 1px solid #DDE2E8;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  font: 400 12px/16px "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #252A34;
}
.ml-vp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 9px 14px;
  background: #F4F6F9;
  border-bottom: 1px solid #DDE2E8;
}
.ml-vp-title {
  font-weight: 600;
  font-size: 12.5px;
  color: #252A34;
}
.ml-vp-mode {
  padding: 2px 9px;
  border-radius: 10px;
  background: #DDEBFF;
  color: #1559A6;
  font-size: 11px;
  font-weight: 600;
}
.ml-vp-mode.clear {
  background: #EDF0F4;
  color: #667085;
}
.ml-vp-spacer {
  flex: 1;
}
.ml-vp-tabs {
  display: inline-flex;
  background: #E8ECF2;
  padding: 2px;
  border-radius: 6px;
  gap: 2px;
}
.ml-vp-tab {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  border-radius: 4px;
  font: 500 11.5px/15px inherit;
  color: #526071;
  cursor: pointer;
}
.ml-vp-tab.on {
  background: #FFFFFF;
  color: #1559A6;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.ml-vp-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 14px;
  background: #EEF6FF;
  border-bottom: 1px solid #7EB1F5;
  color: #1559A6;
  font-weight: 600;
}
.ml-vp-pick[hidden] {
  display: none;
}
.ml-vp-pick button {
  padding: 3px 10px;
  border: 1px solid #7EB1F5;
  border-radius: 5px;
  background: #FFFFFF;
  color: #1559A6;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.ml-vp-pick button:hover {
  background: #DDEBFF;
}

.ml-vp-stage {
  position: relative;
  background: linear-gradient(180deg, #FBFDFF 0%, #F4F7FB 100%);
  padding: 8px 12px 10px;
}
.ml-vp-svg {
  display: block;
  width: 100%;
  max-height: 310px;
  height: auto;
  user-select: none;
}

/* Стили элементов SVG-модели */
.ml-vp-svg .axis {
  stroke: #D94A4E;
  stroke-width: 0.9;
  stroke-dasharray: 8 3 2 3;
  opacity: 0.65;
}
.ml-vp-svg .axis-bub {
  fill: #FFFFFF;
  stroke: #D94A4E;
  stroke-width: 1;
}
.ml-vp-svg .axis-txt {
  fill: #D94A4E;
  font: 600 9.5px "Segoe UI", system-ui, sans-serif;
  text-anchor: middle;
  dominant-baseline: central;
}
.ml-vp-svg .secbox {
  fill: rgba(22, 119, 255, 0.04);
  stroke: #1677FF;
  stroke-width: 1.4;
  stroke-dasharray: 6 4;
}
.ml-vp-svg .el-ar {
  fill: #E7ECF3;
  stroke: #7F8C9D;
  stroke-width: 1.1;
  transition: opacity 150ms, fill 150ms, stroke 150ms;
}
.ml-vp-svg .el-ar.sel-ar {
  fill: #DCEBFF;
  stroke: #1677FF;
  stroke-width: 1.8;
}
.ml-vp-svg .el-kr {
  fill: #C4C9D0;
  stroke: #666E78;
  stroke-width: 1.1;
  transition: opacity 150ms, fill 150ms, stroke 150ms;
}
.ml-vp-svg .el-kr.link-mode {
  fill: rgba(154, 168, 186, 0.38);
  stroke: #4E5E73;
  stroke-dasharray: 4 2;
}
.ml-vp-svg .el-dim {
  opacity: 0.12;
  pointer-events: none;
}
.ml-vp-svg .el-hide {
  opacity: 0;
  pointer-events: none;
}
.ml-vp-svg .pickable {
  cursor: crosshair;
}
.ml-vp-svg .pickable:hover {
  stroke: #1677FF !important;
  stroke-width: 2.4 !important;
  filter: drop-shadow(0 0 4px rgba(22, 119, 255, 0.45));
}

.ml-vp-svg .diff-vol {
  cursor: pointer;
  transition: opacity 140ms, stroke-width 140ms;
}
.ml-vp-svg .diff-ar {
  fill: rgba(230, 40, 40, 0.72);
  stroke: #960000;
  stroke-width: 1.4;
}
.ml-vp-svg .diff-kr {
  fill: rgba(40, 170, 70, 0.72);
  stroke: #006E1E;
  stroke-width: 1.4;
}
.ml-vp-svg .diff-fail {
  fill: rgba(255, 140, 0, 0.16);
  stroke: #FF8C00;
  stroke-width: 2.2;
  stroke-dasharray: 4 2;
}
.ml-vp-svg .diff-vol:hover {
  opacity: 0.95;
  stroke-width: 2.3;
}
.ml-vp-svg .diff-vol.focused {
  stroke-width: 2.6;
  filter: drop-shadow(0 0 5px rgba(22, 119, 255, 0.5));
}
.ml-vp-svg .diff-vol.muted {
  opacity: 0.16;
}

.ml-vp-svg .pin {
  cursor: pointer;
}
.ml-vp-svg .pin circle {
  fill: #252A34;
  stroke: #FFFFFF;
  stroke-width: 1.5;
}
.ml-vp-svg .pin.ar circle { fill: #C81E1E; }
.ml-vp-svg .pin.kr circle { fill: #1D8A38; }
.ml-vp-svg .pin.fail circle { fill: #D97706; }
.ml-vp-svg .pin.focused circle {
  stroke: #1677FF;
  stroke-width: 2.5;
}
.ml-vp-svg .pin text {
  fill: #FFFFFF;
  font: 700 9.5px "Segoe UI", system-ui, sans-serif;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.ml-vp-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 14px;
  background: #FAFBFD;
  border-top: 1px solid #EDF0F4;
  font-size: 11.5px;
  color: #667085;
}
.ml-vp-foot b {
  color: #252A34;
  font-weight: 600;
}

@media (max-width: 760px) {
  [data-demo="monolith"] .rw-fit,
  [data-demo="monolith"] .rw {
    width: 100% !important;
    height: auto !important;
    transform: none !important;
  }
  [data-demo="monolith"] .rw-frame {
    padding: 12px;
  }
  [data-demo="monolith"] .rw-frame .dyn {
    padding: 12px;
  }
  .ml-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .ml-bar .rw-sel,
  .ml-bar .ml-apply,
  .ml-num,
  .ml-num.small,
  .ml-lbl {
    margin-right: 0;
  }
  .ml-bar .rw-sel {
    flex: 1 1 100%;
    min-width: 0;
  }
  .ml-search {
    flex: 1 1 100%;
  }
  .ml-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .ml-right {
    justify-content: flex-end;
  }
}
