/* ══════════════════════════════════════════════════════════════
   Tables & DataTables
   Extracted from main.css
   ══════════════════════════════════════════════════════════════ */

/* ── Base table resets ── */

tr.first_layer {
  background: #d4d4d566 !important;
  font-weight: bold !important;
}

tr.first_layer td {
  font-weight: bold !important;
}

table th [role="button"] {
  all: unset;
}

table#systemTypeTable thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.fixed-column {
  position: sticky;
  left: 0;
  background: #fff;
  /* Hintergrundfarbe, damit der Inhalt nicht durchsichtig wird */
  z-index: 2;
  /* eventuell anpassen, damit diese Zelle uber den anderen bleibt */
}

.fixed-column_th {
  position: sticky;
  left: 0;
  top: 0;
  background: #fff;
  /* Hintergrundfarbe, damit der Inhalt nicht durchsichtig wird */
  z-index: 3;
}

.contactsTableSection {
  padding: 0 !important;
  border: 0 !important;
}

table#telemetrie_betriebsdaten_table td:has(i) {
    padding-inline: 10px !important;
    text-align: center;
}

.table_container {
    max-height: 36vh;
}

.table_container thead {
    position: sticky;
    top: 0;
}

.related-meldungen-table tr:has(input[type="checkbox"]:checked) td {
    background: #4caf5021;
    color: green !important;
}

td,
th {
  padding: unset;
  border-bottom: none;
  background-color: transparent;
}

/* ── DataTables: service order list ── */

#service_order_list .dt-search label {
  display: none;
}

#service_order_list .dt-search {
  margin-bottom: 1rem;
  margin-top: 1rem;
}

/* ── Measured values table ── */

.measured_values_individually_field_descriptions th:first-child,
.measured_values_individually_field_descriptions td:first-child {
  max-width: 50px;
  overflow: hidden;
  /* Verhindert, dass der Text uberlauft */
  white-space: nowrap;
  text-overflow: ellipsis;
  /* Fugt '...' hinzu, wenn der Text zu lang ist */
}

/* ── Table button ── */

a.button_table_button {
  padding: 4px 10px;
  background: var(--pico-background-success);
  border: 1px solid var(--pico-background-success);
  color: white;
}

/* ── DataTables: border-radius on last row ── */

table.dataTable tr:last-child td:first-child {
  border-bottom-left-radius: var(--pico-border-radius) !important;
}

table.dataTable tr:last-child td:last-child {
  border-right: 1px solid rgba(34, 36, 38, 0.15);
  border-bottom-right-radius: var(--pico-border-radius) !important;
}

/* ── Aside table ── */

aside .table_aside_content .ui.table {
  border: 1px solid var(--pico-form-element-border-color) !important;
  border-radius: var(--pico-border-radius) !important;
  overflow: hidden;
}

.table_aside_content {
  padding-inline: 1rem;
}

.card .table_aside_content .ui.table>thead>tr>th {
  background: var(--pico-background-color);
}

/* ── DataTables: datetime picker ── */

div.dt-datetime table td.selectable button:hover {
  background: var(--pico-primary);
}

/* ── Card content table border-radius overrides ── */

.card_content .ui.table,
.card_content .ui.table>thead>tr:first-child>th:first-child,
.card_content table.dataTable tr:last-child td:first-child,
.card_content table.dataTable tr td:first-child {
  border-radius: 0 !important;
  border-left: 0 !important;
}

.card_content .ui.table,
.card_content table.dataTable tr:last-child td:last-child,
.card_content table.dataTable tr td:last-child,
.card_content .ui.table>thead>tr:first-child>th:last-child {
  border-radius: 0 !important;
  border-right: 0 !important;
}

/* ── Semantic UI pagination ── */

.ui.pagination.menu .active.item {
  padding-top: 0;
}

.ui.pagination.menu .item {
  padding: 0;
  justify-content: center;
}

.ui.pagination.menu .item a {
  padding: 16px;
}

/* ── SearchBuilder ── */

div.dtsb-searchBuilder {
  background: var(--pico-background-cardform);
  border-radius: var(--pico-border-radius);
  border: 1px solid var(--pico-form-element-border-color);
  margin-bottom: 0;
  margin-top: var(--pico-spacing);
  display: none;
}

/* ── DataTables: container grid ── */

div.dt-container.ui.grid>div.row .card_content {
  padding: var(--pico-spacing);
}

/* ── Table link ── */

a.table_link {
  background: #4183c412;
  padding: 2px 7px;
  border-radius: 5px;
}

/* ── DataTables: buttons ── */

.dt-buttons.ui.buttons {
  padding-left: 0;
  margin-bottom: 1rem;
}

/* ── Measured values basic table ── */

.measured_values_basic_table {
  padding: 10px;
}

/* ── Stammdaten row ── */

tr.stammdaten-row td {
  background: #2185d014;
  font-weight: bold;
}

/* ── Strong row ── */

.strong td {
  font-weight: bold;
}

/* ── DataTables: paging buttons ── */

.dt-paging-button.item:not(.disabled) a.page-link.next {
  background: #0277a51c;
  color: var(--pico-primary) !important;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  width: 100%;
}

.dt-paging-button.item:not(.disabled) a.page-link.previous {
  background: #0277a51c;
  color: var(--pico-primary) !important;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  width: 100%;
}

/* ── Semantic UI pagination (color) ── */

.ui.pagination.menu .active.item {
  color: var(--pico-color);
}

/* ── DataTables: responsive inline collapsed ── */

table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control:before,
table.dataTable.dtr-inline.collapsed>tbody>tr>th.dtr-control:before {
  border-left: 10px solid var(--pico-color);
}

/* ── Semantic UI menu item color ── */

.ui.menu .item {
  color: var(--pico-color);
}

/* ── SearchBuilder: inputs ── */

.dtsb-searchBuilder input,
.dtsb-searchBuilder select,
.dtsb-searchBuilder textarea {
  width: auto;
}

/* ── DataTables: text alignment ── */

table.dataTable.ui.table th.dt-left,
table.dataTable.ui.table td.dt-left {
  text-align: left;
}

/* ── Semantic UI pagination link color ── */

.ui.pagination.menu .item a {
  color: inherit;
}

/* ── Toggle column visibility ── */

a.toggle-vis {
  position: relative;
  padding-right: 35px !important;
}

a.toggle-vis:after {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--pico-form-element-border-color);
  display: block;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
}

a.toggle-vis.active_column:after {
  background: var(--pico-background-success);
}

/* ── Telemetry readonly input ── */

table#telemetrie_betriebsdaten_table .readonly-input {
  border-radius: 0;
  border: 0;
}

/* ── DataTables: container grid rows ── */

div.dt-container.ui.grid>div.row:first-child {
  padding-top: 0;
  padding-bottom: 0;
}

div.dt-container.ui.grid>div.row:nth-child(2) {
  padding-top: 3px;
  padding-bottom: 3px;
}

/* ── Semantic UI selection dropdown ── */

.ui.selection.dropdown {
    line-height: unset;
    border-radius: var(--pico-border-radius);
}

/* ── SearchBuilder: appearance ── */

.dtsb-searchBuilder input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"]),
.dtsb-searchBuilder select,
.dtsb-searchBuilder textarea {
  -webkit-appearance: auto;
  -moz-appearance: auto;
  appearance: auto;
}

/* ── Telemetry sorting cell ── */

#telemetrie_betriebsdaten_table_wrapper td.sorting_1 {
  padding: 0 !important;
}

/* ── Laboratory row states ── */

.laboratory_pending td {
  background-color: #fff3e0 !important;
  color: #d35400 !important;
}

.laboratory_closed td {
  background-color: #e8f5e9 !important;
  color: #2e7d32 !important;
}

/* ── Row state coloring (zero/one/two) ── */

/* Status 0 - Offen (Rot) */
tr.state-zero td {
  background-color: #ffeded !important;
  color: red !important;
}

tr.state-zero td a {
  color: red !important;
}

tr.state-zero td input,
tr.state-zero td select {
  background-color: #fff !important;
  color: red !important;
  border: 1px solid rgba(255, 0, 0, 0.3) !important;
}

/* Status 1 - In Bearbeitung (Orange) */
tr.state-one td {
  background-color: #fff3e0 !important;
  color: #d35400 !important;
}

tr.state-one td a {
  color: #d35400 !important;
}

tr.state-one td input,
tr.state-one td select {
  background-color: #fff !important;
  color: #d35400 !important;
  border: 1px solid rgba(211, 84, 0, 0.3) !important;
}

/* Status 2 - Abgeschlossen (Grun) */
tr.state-two td {
  background-color: #e8f5e9 !important;
  color: #2e7d32 !important;
}

tr.state-two td a {
  color: #2e7d32 !important;
}

tr.state-two td input,
tr.state-two td select {
  background-color: #fff !important;
  color: #2e7d32 !important;
  border: 1px solid rgba(46, 125, 50, 0.3) !important;
}

/* Responsive child rows inherit parent row color */
tr.child.state-zero > td,
tr.child.state-zero ul.dtr-details li {
  background-color: #ffeded !important;
  color: red !important;
}
tr.child.state-zero ul.dtr-details li select,
tr.child.state-zero ul.dtr-details li input {
  background-color: #fff !important;
  color: red !important;
  border: 1px solid rgba(255, 0, 0, 0.3) !important;
}
tr.child.state-one > td,
tr.child.state-one ul.dtr-details li {
  background-color: #fff3e0 !important;
  color: #d35400 !important;
}
tr.child.state-one ul.dtr-details li select,
tr.child.state-one ul.dtr-details li input {
  background-color: #fff !important;
  color: #d35400 !important;
  border: 1px solid rgba(211, 84, 0, 0.3) !important;
}
tr.child.state-two > td,
tr.child.state-two ul.dtr-details li {
  background-color: #e8f5e9 !important;
  color: #2e7d32 !important;
}
tr.child.state-two ul.dtr-details li select,
tr.child.state-two ul.dtr-details li input {
  background-color: #fff !important;
  color: #2e7d32 !important;
  border: 1px solid rgba(46, 125, 50, 0.3) !important;
}

/* Prevent inline edit selects from stretching in responsive child rows */
#telemetryDataTable ul.dtr-details select,
#telemetryDataTable ul.dtr-details input[type="date"] {
  width: auto;
  display: inline-block;
}

/* ── SearchBuilder: title row ── */

div.dtsb-searchBuilder div.dtsb-titleRow,
.date_filter_builder .date_filter_builder_title_row {
  margin-bottom: 1em;
  background: var(--pico-table-th-color);
  border-top-left-radius: var(--pico-border-radius);
  border-top-right-radius: var(--pico-border-radius);
  padding: var(--pico-spacing);
  border-bottom: 1px solid var(--pico-form-element-border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
}

div.dtsb-searchBuilder div.dtsb-group div.dtsb-logicContainer button.dtsb-logic {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

div.dtsb-searchBuilder div.dtsb-group div.dtsb-logicContainer button.dtsb-clearGroup {
  border-bottom-right-radius: 0;
}

div.dtsb-searchBuilder div.dtsb-group div.dtsb-logicContainer {
  margin-left: 14px;
}

div.dtsb-searchBuilder div.dtsb-group {
  padding-inline: var(--pico-spacing);
  margin-bottom: var(--pico-spacing);
}

div.dtsb-searchBuilder div.dtsb-titleRow div.dtsb-title {
  padding-top: 0;
}

/* ── Semantic UI table: thead ── */

.ui.table>thead>tr>th {
  background: var(--pico-table-th-color);
  color: var(--pico-color-nav);
  border: 1px solid var(--pico-form-element-border-color);
  border-top: none;
}

.ui.table>thead>tr:first-child>th:last-child {
  border-top-right-radius: var(--pico-border-radius);
}

.ui.table>thead>tr:first-child>th:first-child {
  border-top-left-radius: var(--pico-border-radius);
}

.card .ui.table>thead>tr>th {
  background: transparent;
}

/* ── Semantic UI table: tbody ── */

.ui.table>tbody>tr>td,
.ui.table>tr>td {
  border-top: 1px solid var(--pico-form-element-border-color);
}

/* ── List table styles ── */

.listform_content table.ui.table tbody tr {
  cursor: pointer;
  user-select: none;
}

.listform_content .dataTables_wrapper {
  overflow: visible;
}

/* ── DataTables: button split ── */

div.dt-button-split {
  border-left: 0;
  border-radius: var(--pico-border-radius);
  overflow: hidden;
}

.ui.buttons .button:first-child {
  border-top-left-radius: var(--pico-border-radius);
  border-bottom-left-radius: var(--pico-border-radius);
}

.ui.buttons .button:last-child {
  border-top-right-radius: var(--pico-border-radius);
  border-bottom-right-radius: var(--pico-border-radius);
}

div.dt-button-collection.ui.dropdown {
  background: white;
}

/* ── Semantic UI table: thead border-bottom ── */

.ui.table>thead>tr>th {
  border-bottom: 1px solid var(--pico-form-element-border-color);
}

/* ── DataTables: row selection ── */

table.dataTable.table>tbody>tr.selected>* {
  box-shadow: inset 0 0 0 9999px rgb(var(--dt-row-selected));
  color: rgb(var(--dt-row-selected-text));
}

/* ── Semantic UI table/menu: base ── */

.ui.table,
.ui.menu {
  border-radius: var(--pico-border-radius) !important;
  background: var(--pico-card-background-color);
}

.ui.table>thead>tr:first-child>th:last-child {
  border-radius: 0 var(--pico-border-radius) 0 0;
}

.ui.table>thead>tr:first-child>th:first-child {
  border-radius: var(--pico-border-radius) 0 0 0;
}

/* ── Semantic UI grid ── */

.ui.grid {
  grid-column-gap: 0;
  grid-row-gap: 0;
  display: inherit;
}

div.dt-container.ui.grid {
  margin-left: 0;
  margin-right: 0;
}

div.dt-container.ui.grid > div.row > div.column {
  padding-left: 0;
  padding-right: 0;
}

/* ── DataTables: search input ── */

div.dt-container.ui.grid div.dt-search span.input {
  margin-left: 0;
}

/* ── DataTables: length control ── */

.dt-length {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
}

div#service_orders_wrapper div.dt-length {
  display: block;
  margin-bottom: 1rem;
}

div#service_orders_wrapper div.dt-length label {
    display: none;
}

/* ── DataTables: responsive child rows ── */

table.dataTable>tbody>tr.child ul.dtr-details {
  width: 100%;
}

/* ── Contacts table ── */

#contactsTable td {
  white-space: nowrap;
  padding: calc(var(--pico-spacing) / 2) var(--pico-spacing) !important;
}

/* ── Service orders lines ── */

#service_orders_lines thead {
  position: sticky;
  top: 187px;
  z-index: 999;
}

#service_orders_lines #lines tr td:nth-child(5) {
  max-width: 80px;
}

#service_orders_lines #lines tr td:nth-child(6) {
  min-width: 300px;
}

/* ── SystemType table ── */

div#systemTypeTable_wrapper {
  height: 78vh;
  overflow: auto;
}

table#systemTypeTable td {
  padding-block: 4px;
}

table#systemTypeTable td {
  min-width: 150px;
}

table#systemTypeTable td:has(.input_tooltip) {
  padding: 0;
}

table#systemTypeTable label {
  margin: 0;
}

input.input_tooltip {
  border: 0;
  background: transparent;
  min-width: 300px;
  border-radius: 0;
}

table#systemTypeTable td [type="checkbox"] {
  margin-right: 0;
}

/* ── Overflow table ── */

.overflow_table {
  overflow: auto;
  height: 70vh;
}

/* ── Service orders/contracts lines toolbar ── */

.service_contracts_lines_toolbar,
.service_orders_lines_toolbar {
  padding: 1rem;
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--pico-form-element-border-color);
  position: sticky;
  top: 124px;
  background: white;
  z-index: 9999;
}

.service_contracts_lines_toolbar a,
.service_orders_lines_toolbar a {
  background: var(--pico-form-element-background-color);
  padding: 7px 15px;
  border-radius: var(--pico-border-radius);
}

/* ── Service orders/contracts lines: cell padding ── */

.service_contracts_lines td,
.service_orders_lines td {
  padding: 0 !important;
}

/* ── Table with inputs ── */

.table_with_inputs td:not(dialog td) {
  padding: 0 !important;
}

.table_with_inputs_and_tds td {
  padding-block: 0 !important;
}

.cardform_section .table_with_inputs input.readonly-input {
  border: 0 !important;
  background: transparent !important;
}

.table_with_inputs label:not(dialog label) {
  margin-bottom: 0;
}

.table_with_inputs_and_tds label {
  margin-bottom: 0;
}

table#contactCreate {
  margin-bottom: 1rem;
}

/* ── Table toolbar ── */

.table_toolbar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
}

/* ── Table with inputs: hide label decorations ── */

.table_with_inputs label:before,
.table_with_inputs label span {
  display: none;
}

.table_with_inputs_and_tds label:before,
.table_with_inputs_and_tds label span {
  display: none;
}

/* ── Table with inputs: sorting cell ── */

.table_with_inputs td.sorting_1 {
  padding: 0.78571429em 0.78571429em !important;
}

.table_with_inputs_and_tds td.sorting_1 {
  padding: 0.78571429em 0.78571429em !important;
}

/* ── DataTables: dialog container ── */

dialog .dt-container {
  height: 580px;
  overflow-y: scroll;
}

/* ── Service orders lines: borderless inputs ── */

.service_orders_lines .ui.table,
.service_orders_lines select,
.service_orders_lines input[type="text"],
.service_orders_lines input[type="number"],
.service_orders_lines input[type="date"],
.service_orders_lines textarea {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.service_contracts_lines .ui.table,
.service_contracts_lines select,
.service_contracts_lines input[type="text"],
.service_contracts_lines input[type="number"],
.service_contracts_lines input[type="date"],
.service_contracts_lines textarea {
  border: 0 !important;
  border-radius: 0 !important;
  /* background: transparent !important; */
}

/* ── Table with inputs: borderless inputs ── */

.table_with_inputs select,
.table_with_inputs input[type="text"],
.table_with_inputs input[type="number"],
.table_with_inputs textarea {
  border: 0 !important;
  border-radius: 0 !important;
  background-color: transparent !important;
}

.table_with_inputs input[type="date"] {
  border: 0 !important;
  border-radius: 0 !important;
}

#betriebsdaten_table td.sorting_1 {
  padding: 0 !important;
}

/* ── Table with inputs: dialog overrides ── */

.table_with_inputs dialog select,
.table_with_inputs dialog input[type="text"],
.table_with_inputs dialog input[type="number"],
.table_with_inputs dialog input[type="date"],
.table_with_inputs dialog textarea {
  border: 1px solid var(--pico-form-element-border-color) !important;
  border-radius: var(--pico-border-radius) !important;
  background: inherit !important;
}

/* ── Table select cells ── */

.cardform_section td.table_select label {
  margin-bottom: 0;
  width: 100%;
}

#contactsTable td.table_select {
  padding: 0 !important;
  min-width: 200px;
}

table#measured_values_basic_table {
  padding: 0;
}

.cardform_section td.table_select label:before {
  display: none;
}

td.table_select select {
  max-width: unset !important;
  border: 0;
  border-radius: 0;
  width: 100%;
}

td.table_select label span {
  display: none;
}

/* ── Table delete button ── */

a.delete_table_button {
  padding: 6px 10px;
  background: var(--pico-background-error);
  border: 1px solid var(--pico-background-error);
  font-size: var(--hb-font-size-xs);
  color: white;
}

/* ── Lines table: max-width ── */

tbody#lines input {
  max-width: unset;
}

/* ── Table with inputs and tds: borderless inputs ── */

.table_with_inputs_and_tds select,
.table_with_inputs_and_tds input[type="text"],
.table_with_inputs_and_tds input[type="number"],
.table_with_inputs_and_tds input[type="date"],
.table_with_inputs_and_tds textarea {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.table_with_inputs_and_tds td:has(select),
.table_with_inputs_and_tds td:has(input[type="text"]),
.table_with_inputs_and_tds td:has(input[type="number"]),
.table_with_inputs_and_tds td:has(input[type="date"]),
.table_with_inputs_and_tds td:has(textarea) {
  padding-inline: 0 !important;
}

.table_with_inputs_and_tds dialog textarea {
  border: 1px solid var(--pico-form-element-border-color) !important;
  border-radius: var(--pico-border-radius) !important;
}

/* ── Checkbox cells ── */

.service_orders_lines td:has(input[type="checkbox"]) {
  text-align: center;
  padding: var(--pico-form-element-spacing-vertical) var(--pico-form-element-spacing-horizontal) !important;
}

.service_contracts_lines td:has(input[type="checkbox"]) {
  text-align: center;
  padding: var(--pico-form-element-spacing-vertical) var(--pico-form-element-spacing-horizontal) !important;
}

.table_with_inputs td:has(input[type="checkbox"]) {
  text-align: center;
  padding: var(--pico-form-element-spacing-vertical) var(--pico-form-element-spacing-horizontal) !important;
}

.table_with_inputs_and_tds td:has(input[type="checkbox"]) {
  text-align: center;
  padding: var(--pico-form-element-spacing-vertical) var(--pico-form-element-spacing-horizontal) !important;
}

.service_orders_lines .ui.celled.table>tbody>tr>td:has(input[type="checkbox"]) {
  border-left: 0 !important;
}

.service_contracts_lines .ui.celled.table>tbody>tr>td:has(input[type="checkbox"]) {
  border-left: 0 !important;
}

/* ── Cardform section: lines max-width ── */

.cardform_section .service_orders_lines input,
.cardform_section .service_orders_lines select,
.cardform_section .service_orders_lines textarea {
  max-width: unset;
}

.cardform_section .service_contracts_lines input,
.cardform_section .service_contracts_lines select,
.cardform_section .service_contracts_lines textarea {
  max-width: unset;
}

.cardform_section .table_with_inputs input,
.cardform_section .table_with_inputs select,
.cardform_section .table_with_inputs textarea {
  max-width: unset;
}

.cardform_section .table_with_inputs_and_tds input,
.cardform_section .table_with_inputs_and_tds select,
.cardform_section .table_with_inputs_and_tds textarea {
  max-width: unset;
}

/* ── Line actions dropdown ── */

.line_actions summary[role="button"]:not(.outline)::after {
  display: none;
}

.line_actions summary.secondary i {
  width: 20px;
  height: 20px;
}

details.dropdown.line_actions summary {
  text-align: center;
  margin-bottom: 0 !important;
  padding: 0;
  background: transparent;
  color: black;
  border: 0;
}

details.dropdown.line_actions summary {
  text-align: center;
  margin-bottom: 0 !important;
}

details.dropdown.line_actions {
  margin-bottom: 0;
}

/* ── Table list items ── */

table ul li {
  list-style: none;
}

/* ── Table select cursor ── */

table select {
  cursor: pointer;
}

/* ── Files table ── */

table#files {
  margin-top: 0;
}

#files td embed {
  display: none;
}

/* ── Laboratory table: borderless inputs ── */

table#get_labor_werte td:has(input:not([type="checkbox"]), select, textarea) {
  padding: 0;
}

table#get_labor_werte td input:not([type="checkbox"]),
table#get_labor_werte td select,
table#get_labor_werte td textarea {
  border: 0;
  border-radius: 0;
}

/* ── Telemetry table ── */

table#telemetrie_betriebsdaten_table {
  min-height: 190px;
}

.telewartung_tabele {
  margin-bottom: 1rem;
}

/* ── Table with inputs and tds: solutions textarea ── */

.table_with_inputs_and_tds.solutions textarea {
  height: auto;
  min-height: 84px;
}

/* ── DataTables: select checkbox ── */

table.dataTable input.dt-select-checkbox:checked:after {
  display: none;
}

table.dataTable>tbody>tr.selected input.dt-select-checkbox:checked {
  border: 0;
}

table.dataTable input.dt-select-checkbox {
  font-size: inherit;
}

/* ── Table toolbar primary button ── */

.table_toolbar .primary,
.toolbar .primary {
  background: var(--pico-background-success);
  border-color: var(--pico-background-success);
}

/* ── Contacts table border ── */

#contactsTable table {
  border-right: 1px solid var(--pico) !important;
}

/* ── Table base: white-space ── */

table {
  white-space: nowrap;
}

/* ── Multiselect in table cells ── */

td.multiselect {
  padding-block: 0 !important;
}

td.multiselect>label {
  margin: 0 !important;
  cursor: pointer;
  overflow: visible;
}

td.multiselect>label:before {
  display: none;
}

td.multiselect>label span {
  background-color: transparent;
  font-weight: bold;
  text-decoration: underline;
  z-index: 2;
}

td.multiselect>label input {
  background: transparent !important;
  border: 0 !important;
  opacity: 0;
}

.multiselect i.fa-solid.fa-circle-info {
  position: relative;
  right: unset;
  transition: unset;
  top: 4px;
  color: grey;
}

/* ── Sort icon cell ── */

td.sorticon {
  text-align: center !important;
  font-size: var(--hb-font-size-sm);
  opacity: 0.7;
}

/* ── Table image ── */

img.table_image {
  width: 19px;
  height: 19px;
  object-fit: contain;
}

/* ── Intern row ── */

.intern td {
  background-color: #eaf5ff;
  color: var(--pico-primary);
}

/* ── Order state table ── */

table#order_state th a {
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: 500;
  display: inline-block;
  margin-left: 5px;
}

/* ── 3-dot action menu for table rows ── */

td > details.table-actions {
  position: relative;
  margin: 0;
  padding: 0;
  border: none;
  display: inline-block;
}

details.table-actions > summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--pico-border-radius);
  color: var(--pico-color);
  background: transparent;
  border: none;
}

details.table-actions > summary::after,
details.table-actions > summary::marker,
details.table-actions > summary::-webkit-details-marker {
  display: none;
  content: none;
}

details.table-actions > summary:hover {
  background: var(--pico-form-element-background-color);
}

details.table-actions > ul {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  min-width: 160px;
  background: var(--pico-background-color, #fff);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 6px 0;
  margin: 2px 0 0;
  z-index: 100;
  display: none;
  list-style: none;
}

details.table-actions[open] > ul {
  display: block;
}

details.table-actions > ul > li {
  padding: 0;
  margin: 0;
  list-style: none;
}

details.table-actions > ul > li > a {
  display: block;
  padding: 8px 14px;
  color: var(--pico-color, #333) !important;
  text-decoration: none !important;
  font-size: var(--hb-font-size-base);
  white-space: nowrap;
  cursor: pointer;
}

details.table-actions > ul > li > a:hover {
  background: rgba(0, 0, 0, 0.06);
}

details.table-actions > ul > li.separator {
  border-top: 1px solid var(--pico-form-element-border-color);
  margin: 4px 0;
}

/* ── Bauteiledatenbank table buttons ── */

table#bauteiledatenbank td > a[role=button] {
    padding: 1px 7px;
    font-size: var(--hb-font-size-xs);
    border-radius: 999px;
    background: var(--pico-secondary-background-button-bar);
    color: var(--pico-contrast);
    border: 0;
}

/* ── Import invoices table ── */

#import_invoices_body {
    max-height: 500px;
    overflow-y: auto;
}

#import_invoices_body table td {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 1.5rem;
}

#import_invoices_body table thead th {
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding-bottom: 0.5rem;
}

#import_invoices_body table tbody td {
    padding-top: 0.4rem;
}

/* ── Setup: drag handle ── */

.drag-handle {
  cursor: grab;
  text-align: center;
  color: var(--pico-muted-color);
}

.drag-handle:active {
  cursor: grabbing;
}

/* ── Narrow columns ── */

th.col-narrow,
td.col-narrow {
  width: 60px !important;
  max-width: 60px !important;
}

/* ── Responsive: 768px ── */

@media (max-width: 768px) {
  div.dt-container.ui.grid>div.row:first-child,
  div.dt-container.ui.grid>div.row:first-child>div {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  div.dt-container.ui.grid>div.row:nth-child(2) {
    height: 0;
  }
}
