/* Списки-таблицы карточками на узких экранах (NIPI-051). Разметку data-label ставит tables.js.
   Планшет (≤ 900px): название на всю ширину, ниже пары «подпись: значение» в две колонки; телефон (≤ 600px) — в одну. */
@media (max-width: 900px) {
  table.rt-cards { min-width: 0 !important; border-collapse: separate; border-spacing: 0; }
  table.rt-cards > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.rt-cards > tbody { display: block; }
  table.rt-cards > tbody > tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; align-items: start;
    background: var(--surface, #fff); border: 1px solid var(--border, #dce2ea); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
  table.rt-cards > tbody > tr:last-child { margin-bottom: 0; }
  table.rt-cards > tbody > tr > td { display: block; min-width: 0; padding: 0; border: none; background: transparent; text-align: left;
    white-space: normal; overflow-wrap: anywhere; max-width: none; }
  table.rt-cards > tbody > tr > td.num, table.rt-cards > tbody > tr > td.actions { text-align: left; white-space: normal; }
  table.rt-cards > tbody > tr > td[data-label]::before { content: attr(data-label) ": "; color: var(--muted, #6b7280); font-size: 12.5px; font-weight: 600; }
  table.rt-cards > tbody > tr > td:empty { display: none; }
  /* Название — первым, полностью, с переносом строк */
  table.rt-cards > tbody > tr > td.rt-title { grid-column: 1 / -1; order: -1; font-size: 15px; line-height: 1.4; }
  table.rt-cards > tbody > tr > td.rt-title::before { content: none; }
  table.rt-cards > tbody > tr > td.rt-title * { white-space: normal; overflow: visible; text-overflow: clip; max-width: none; }
  table.rt-cards > tbody > tr > td.rt-title strong, table.rt-cards > tbody > tr > td.rt-title a { overflow-wrap: anywhere; }
  /* Кнопки и ячейки без подписи — отдельной строкой карточки */
  table.rt-cards > tbody > tr > td:not([data-label]):not(.rt-title), table.rt-cards > tbody > tr > td.actions { grid-column: 1 / -1; }
  table.rt-cards > tbody > tr > td.actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; white-space: normal; }
  table.rt-cards > tbody > tr > td.actions::before { flex-basis: 100%; }
  table.rt-cards > tbody > tr > td.actions .btn + .btn { margin-left: 0; }
  /* Строка «записей нет» */
  table.rt-cards > tbody > tr.rt-full { display: block; }
  table.rt-cards > tbody > tr.rt-full > td { text-align: center; }
  table.rt-cards > tbody > tr:hover > td { background: transparent; }
  table.rt-cards > tbody > tr.row-alert { background: #fff5f5; }
  table.rt-cards > tbody > tr.row-warn { background: #fffbeb; }
  /* Итоги */
  table.rt-cards > tfoot { display: block; margin-top: 10px; }
  table.rt-cards > tfoot > tr { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 14px; border-radius: 12px; background: #f1f4f8; }
  table.rt-cards > tfoot > tr > th, table.rt-cards > tfoot > tr > td { display: block; padding: 0; border: none; background: transparent; text-align: left; }
  table.rt-cards > tfoot > tr > th:empty, table.rt-cards > tfoot > tr > td:empty { display: none; }
}
@media (max-width: 600px) {
  table.rt-cards > tbody > tr { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 12px; }
}
