/* deals_overview.css — раздел «Сделки» (Фаза 3).
   Реюз: ms-* (my_surveys.css), mp-* (measurement_payout.css), fm-* (foreman.css),
   cash-* (cash.css). Здесь — только своё: цветовая группировка столбцов
   (шапка в одну строку, решение Максима 03.08.2026) и пометки. */

/* Обязательный фикс: базовый .ms-filterbar липкий — «страж» StickyThead никогда
   не уходит за верх и шапка таблицы не закрепляется (баг от 26.07.2026,
   образец — measurement_payout.css). */
.do-root > .ms-filterbar { position: relative; top: auto; }

.do-root .ms-list { padding-bottom: 80px; }

/* Деньги */
.do-table td.do-money { text-align: right; white-space: nowrap; }

/* ─── Цвета групп столбцов ─────────────────────────────────────────────────
   Приглушённые тона поверх темы; для тёмной темы полупрозрачные цвета работают
   одинаково. Первая колонка группы получает разделитель do-gfirst. */
.do-table th.do-g-deal,    .do-table td.do-g-deal    { background: rgba(1, 105, 111, 0.05); }
.do-table th.do-g-survey,  .do-table td.do-g-survey  { background: rgba(29, 95, 168, 0.05); }
.do-table th.do-g-montage, .do-table td.do-g-montage { background: rgba(67, 122, 34, 0.06); }
.do-table th.do-g-mat,     .do-table td.do-g-mat     { background: rgba(196, 92, 38, 0.06); }
.do-table th.do-g-log,     .do-table td.do-g-log     { background: rgba(46, 125, 140, 0.07); }
.do-table th.do-g-cash,    .do-table td.do-g-cash    { background: rgba(123, 58, 158, 0.05); }
.do-table th.do-g-total,   .do-table td.do-g-total   { background: rgba(90, 90, 138, 0.08); }

.do-table th.do-gfirst, .do-table td.do-gfirst { border-left: 2px solid var(--border, #d5d9de); }

/* Заголовки: показать принадлежность к группе жирнее обычного */
.do-table thead th { font-weight: 600; }

/* Клон шапки StickyThead живёт вне таблицы — продублировать групповые фоны */
.fm-thead-pin-table.do-table th.do-g-deal    { background: rgba(1, 105, 111, 0.08); }
.fm-thead-pin-table.do-table th.do-g-survey  { background: rgba(29, 95, 168, 0.08); }
.fm-thead-pin-table.do-table th.do-g-montage { background: rgba(67, 122, 34, 0.09); }
.fm-thead-pin-table.do-table th.do-g-mat     { background: rgba(196, 92, 38, 0.09); }
.fm-thead-pin-table.do-table th.do-g-log     { background: rgba(46, 125, 140, 0.10); }
.fm-thead-pin-table.do-table th.do-g-cash    { background: rgba(123, 58, 158, 0.08); }
.fm-thead-pin-table.do-table th.do-g-total   { background: rgba(90, 90, 138, 0.11); }
.fm-thead-pin-table.do-table th.do-gfirst    { border-left: 2px solid var(--border, #d5d9de); }

/* ─── Пометки ────────────────────────────────────────────────────────────── */

/* Связь с замером «низкой уверенности» (fallback по контакту) */
.do-table td.do-low-conf { box-shadow: inset 2px 0 0 #e6a700; }

/* Приглушённое значение: маржа без материалов, «→ #сделка» */
.do-table .do-nomat { color: var(--muted, #8a919a); }

/* Ячейка с комментарием (доп. расходы) — пунктирное подчёркивание суммы */
.do-table td.do-has-note { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }

/* Ссылка на замерную сделку рядом с датой замера */
.do-survey-link { font-size: 11px; opacity: 0.75; }

/* Легенда под таблицей */
.do-legend { padding: 8px 12px 0; font-size: 12px; color: var(--muted, #8a919a); }

/* ─── Модалка «Материалы по смете» ─────────────────────────────────────────── */
.do-table td.do-mat-link { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.do-table td.do-mat-link:hover { background: rgba(196, 92, 38, 0.14); }
/* Окно растягивается по содержимому таблицы вплоть до ширины экрана;
   горизонтальный скролл внутри — только если таблица шире дисплея */
.do-mat-modal {
  width: fit-content;
  min-width: min(720px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.do-mat-src { padding: 6px 2px; font-size: 12px; }
/* Своя таблица со своим скроллом (обе оси) — без fm-table и его sticky-колонок */
.do-mat-wrap {
  max-height: calc(100vh - 330px);
  overflow: auto;
  border: 1px solid var(--border, #d5d9de);
  border-radius: 8px;
  margin-top: 6px;
}
.do-mat-table { border-collapse: collapse; min-width: 100%; }
.do-mat-table th, .do-mat-table td {
  padding: 5px 10px;
  font-size: 13px;
  white-space: nowrap;
  text-align: left;
  border-bottom: 1px solid var(--border, #e2e6ea);
  background: var(--card-bg, #fff);
}
.do-mat-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
  box-shadow: 0 1px 0 var(--border, #d5d9de);
}
.do-mat-table td:nth-child(2) { white-space: normal; min-width: 240px; max-width: 440px; }
.do-mat-table .do-mat-cat td { background: rgba(1, 105, 111, 0.08); font-weight: 600; }
.do-mat-table .do-money { text-align: right; }
.do-mat-totals { padding: 10px 2px 4px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.do-mat-mismatch { font-weight: 700; }
.do-mat-hint { font-size: 12px; max-width: 640px; }
.do-mat-table tr.do-mat-excluded td { opacity: 0.55; }

/* ─── Вкладка «Финансы»: плитки ────────────────────────────────────────────── */
.do-fin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px 12px 4px;
  max-width: 900px;
}
@media (max-width: 720px) {
  .do-fin-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
.do-fin-tile {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #d5d9de);
  border-radius: 10px;
  padding: 12px 14px;
}
.do-fin-label { font-size: 12px; color: var(--muted, #8a919a); margin-bottom: 4px; }
.do-fin-value { font-size: 22px; font-weight: 700; white-space: nowrap; }
.do-fin-note { font-size: 11px; color: var(--muted, #8a919a); margin-top: 4px; }
.do-fin-period { padding: 8px 12px 80px; font-size: 12px; color: var(--muted, #8a919a); }
