/* Общая раскладка колонок: ширина перетаскиванием границы, порядок — перетаскиванием заголовка.
   Opt-in: table[data-sd-cols] или SuperDashTableLayout.attach(table, options). */

.sd-table-scroll {
  overflow: auto;
  max-height: min(70vh, 52rem);
}

.sd-table-scroll-x {
  overflow-x: auto;
}

.sd-data-table-resize-only {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
}

.sd-data-table-resize-only > colgroup col,
.sd-resize-nested > colgroup col {
  min-width: 0;
}

/* Заголовки можно переносить; значения в tbody — только в одну строку. */
.sd-data-table-resize-only thead th,
.sd-data-table-resize-only thead th.sd-th,
.sd-resize-nested thead th {
  min-width: 0;
  max-width: none;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
  box-sizing: border-box;
}

.sd-data-table-resize-only > tbody > tr > td:not([colspan]),
.sd-data-table-resize-only > tfoot > tr > td:not([colspan]),
.sd-resize-nested > tbody > tr > td:not([colspan]),
.sd-resize-nested > tfoot > tr > td:not([colspan]) {
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  overflow-wrap: normal;
  word-wrap: normal;
  word-break: normal;
}

.sd-col-clip {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
}

.sd-col-clip > .sd-col-text {
  display: block;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  text-align: center;
}

/* Стрелка сортировки — справа от текста, не под блоком .sd-col-clip */
.sd-th.ruslan-sort-th > .sd-col-clip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
  text-align: center;
}

.ruslan-report-card {
  max-width: 100%;
}

.ruslan-report-card > .table-responsive {
  max-width: 100%;
}

.sd-th.ruslan-sort-th.ruslan-sort-active.asc::after,
.sd-th.ruslan-sort-th.ruslan-sort-active.desc::after {
  content: none;
}

.sd-th.ruslan-sort-th.ruslan-sort-active.asc > .sd-col-clip::after {
  content: "\25B2";
  flex: 0 0 auto;
  font-size: 0.65em;
  opacity: 0.9;
}

.sd-th.ruslan-sort-th.ruslan-sort-active.desc > .sd-col-clip::after {
  content: "\25BC";
  flex: 0 0 auto;
  font-size: 0.65em;
  opacity: 0.9;
}

.sd-table-scroll .sd-data-table,
table.sd-data-table {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
  margin-bottom: 0;
}

.sd-data-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: var(--bs-table-bg, var(--bs-body-bg, #fff));
  box-shadow: 0 1px 0 var(--bs-border-color);
  vertical-align: middle;
}

.sd-data-table td {
  vertical-align: top;
}

.sd-th {
  position: relative;
  padding-right: 0.55rem !important;
  overflow: visible;
}

.sd-col-head {
  display: flex;
  align-items: center;
  min-height: 1.75rem;
  user-select: none;
  position: relative;
  gap: 0.2rem;
}

.sd-col-label {
  flex: 1 1 auto;
  min-width: 0;
}

.sd-col-drag {
  cursor: grab;
  flex: 0 0 auto;
  touch-action: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  min-width: 0.85rem;
  height: 1.1rem;
  color: var(--bs-secondary);
  opacity: 0.45;
  line-height: 1;
}

.sd-col-drag-grip {
  display: block;
  width: 0.45rem;
  height: 0.7rem;
  background-image: radial-gradient(circle, currentColor 1.1px, transparent 1.1px);
  background-size: 0.45rem 0.23rem;
  background-repeat: repeat;
}

.sd-col-drag:hover {
  opacity: 0.95;
  color: var(--bs-primary);
}

.sd-col-drag:active {
  cursor: grabbing;
}

.sd-th.sd-th-dragging {
  opacity: 0.55;
  background: rgba(var(--bs-primary-rgb), 0.12);
}

.sd-th.sd-th-drop-target {
  box-shadow: inset 0 -3px 0 var(--bs-primary);
}

.sd-col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 3;
}

.sd-col-resizer:hover,
.sd-table-resizing .sd-col-resizer:hover {
  background: rgba(var(--bs-primary-rgb), 0.25);
}

.sd-table-resizing {
  cursor: col-resize;
  user-select: none;
}

.sd-table-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.sd-cell-url,
.sd-url,
.sd-data-table-resize-only td.sd-cell-url,
.sd-data-table-resize-only td.sd-url,
.sd-resize-nested td.sd-cell-url,
.sd-resize-nested td.sd-url {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sd-cell-num {
  white-space: nowrap;
  text-align: center;
}

.sd-col-select {
  text-align: center;
  vertical-align: middle;
}

.sd-hops {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
}

.sd-hops li {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  margin-top: 0.2rem;
}

.sd-hops .badge {
  flex: 0 0 auto;
  margin-top: 0.1rem;
}
