/* mobile_accordion_cards.css v5 - селекторы по реальным ID портала */
@media (max-width: 950px) {

  /* Скрываем thead */
  #dealsBody ~ * thead, table:has(#dealsBody) thead,
  table:has(#assignedSalesBody) thead,
  table:has(#calculationsBody) thead,
  table:has(#measurementsBody) thead,
  table:has(#adminAssignedSalesBody) thead { display: none !important; }

  /* tbody → колонка карточек */
  #dealsBody, #assignedSalesBody, #calculationsBody,
  #measurementsBody, #adminAssignedSalesBody {
    display: flex !important; flex-direction: column !important;
    gap: 8px !important; width: 100% !important;
  }

  /* tr → карточка */
  #dealsBody tr, #assignedSalesBody tr, #calculationsBody tr,
  #measurementsBody tr, #adminAssignedSalesBody tr {
    display: block !important;
    background: #fff !important;
    border: 1.5px solid #e5e7eb !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Первый td — компактная шапка карточки */
  #dealsBody tr td:first-child, #assignedSalesBody tr td:first-child,
  #calculationsBody tr td:first-child, #measurementsBody tr td:first-child,
  #adminAssignedSalesBody tr td:first-child {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 14px !important;
    font-size: 14px !important; font-weight: 700 !important;
    color: #111 !important; cursor: pointer !important;
    min-height: 54px !important; background: transparent !important;
    border-bottom: none !important; width: 100% !important;
  }

  #dealsBody tr td:first-child::before,
  #assignedSalesBody tr td:first-child::before,
  #calculationsBody tr td:first-child::before,
  #measurementsBody tr td:first-child::before,
  #adminAssignedSalesBody tr td:first-child::before { display: none !important; }

  /* Стрелка */
  #dealsBody tr td:first-child::after,
  #assignedSalesBody tr td:first-child::after,
  #calculationsBody tr td:first-child::after,
  #measurementsBody tr td:first-child::after,
  #adminAssignedSalesBody tr td:first-child::after {
    content: "›" !important; font-size: 22px !important;
    color: #9ca3af !important; flex-shrink: 0 !important;
    margin-left: 8px !important; line-height: 1 !important;
  }

  /* Остальные td — скрыты */
  #dealsBody tr td:not(:first-child),
  #assignedSalesBody tr td:not(:first-child),
  #calculationsBody tr td:not(:first-child),
  #measurementsBody tr td:not(:first-child),
  #adminAssignedSalesBody tr td:not(:first-child) {
    display: none !important;
    padding: 8px 14px !important; font-size: 12px !important;
    color: #374151 !important; border-bottom: 0.5px solid #f0f0f0 !important;
    background: #fafafa !important; width: 100% !important; box-sizing: border-box !important;
  }

  #dealsBody tr td:not(:first-child)::before,
  #assignedSalesBody tr td:not(:first-child)::before,
  #calculationsBody tr td:not(:first-child)::before,
  #measurementsBody tr td:not(:first-child)::before,
  #adminAssignedSalesBody tr td:not(:first-child)::before {
    content: attr(data-label) !important;
    display: block !important; font-size: 10px !important;
    font-weight: 700 !important; color: #9ca3af !important;
    text-transform: uppercase !important; letter-spacing: .04em !important;
    margin-bottom: 2px !important;
  }

  /* ОТКРЫТАЯ карточка */
  #dealsBody tr.kr-open, #assignedSalesBody tr.kr-open,
  #calculationsBody tr.kr-open, #measurementsBody tr.kr-open,
  #adminAssignedSalesBody tr.kr-open {
    border-color: #d71920 !important;
    box-shadow: 0 2px 14px rgba(215,25,32,.12) !important;
  }

  #dealsBody tr.kr-open td:not(:first-child),
  #assignedSalesBody tr.kr-open td:not(:first-child),
  #calculationsBody tr.kr-open td:not(:first-child),
  #measurementsBody tr.kr-open td:not(:first-child),
  #adminAssignedSalesBody tr.kr-open td:not(:first-child) {
    display: block !important;
  }

  #dealsBody tr.kr-open td:first-child,
  #assignedSalesBody tr.kr-open td:first-child,
  #calculationsBody tr.kr-open td:first-child,
  #measurementsBody tr.kr-open td:first-child,
  #adminAssignedSalesBody tr.kr-open td:first-child {
    background: #fff5f5 !important;
    border-bottom: 1px solid #f3f4f6 !important;
  }

  #dealsBody tr.kr-open td:first-child::after,
  #assignedSalesBody tr.kr-open td:first-child::after,
  #calculationsBody tr.kr-open td:first-child::after,
  #measurementsBody tr.kr-open td:first-child::after,
  #adminAssignedSalesBody tr.kr-open td:first-child::after {
    content: "‹" !important; color: #d71920 !important;
  }

  #dealsBody tr.kr-open td:last-child,
  #assignedSalesBody tr.kr-open td:last-child,
  #calculationsBody tr.kr-open td:last-child,
  #measurementsBody tr.kr-open td:last-child,
  #adminAssignedSalesBody tr.kr-open td:last-child {
    border-bottom: none !important; padding-bottom: 14px !important;
  }

  /* Деньги зелёные */
  #dealsBody .money, #assignedSalesBody .money,
  #calculationsBody .money, #measurementsBody .money { color: #15803d !important; font-weight: 700 !important; }

  /* Приоритет — полоска */
  #dealsBody tr[class*="hot"], #calculationsBody tr[class*="hot"],
  #assignedSalesBody tr[class*="hot"] { border-left: 3px solid #d71920 !important; }
  #dealsBody tr[class*="warm"], #calculationsBody tr[class*="warm"],
  #assignedSalesBody tr[class*="warm"] { border-left: 3px solid #ef6c00 !important; }

  /* Кнопки внутри */
  #dealsBody tr.kr-open button, #assignedSalesBody tr.kr-open button,
  #calculationsBody tr.kr-open button, #measurementsBody tr.kr-open button {
    min-height: 38px !important; font-size: 12px !important;
    border-radius: 8px !important; margin: 2px 0 !important;
  }
}
