/* Shared control-panel UX. Desktop tables stay tables; phones get cards and larger taps. */

.dropdown-backdrop {
  display: none !important;
  pointer-events: none !important;
}

.hl-menu-portal {
  display: block !important;
  position: fixed !important;
  background: #fff;
  border: 1px solid #e7e7ec;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 4000;
  direction: rtl;
  text-align: right;
  pointer-events: auto;
}

.hl-menu-portal:before,
.hl-menu-portal:after {
  display: none !important;
}

.hl-menu-portal > li > a {
  display: block;
  white-space: nowrap;
  touch-action: manipulation;
}

table .dropdown-toggle {
  touch-action: manipulation;
}

.hl-details-btn {
  display: none;
}

.hl-m-badges {
  display: none;
}

.hl-quick {
  display: none;
}

.hl-emp-hint {
  margin: 0 0 12px;
  color: #5c6570;
  font-size: 15px;
}

.select2-container {
  max-width: 100%;
}

.select2-dropdown,
.select2-container--open {
  z-index: 4500;
}

@media (max-width: 768px) {
  .navbar-header > .hl-m-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    clear: both;
    width: 100%;
    padding: 0 8px 8px;
    background: #fcc100;
  }

  .hl-m-badge {
    position: relative;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #222;
    font-size: 18px;
    text-decoration: none;
    touch-action: manipulation;
  }

  .hl-m-badge .badge {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 11px;
  }

  .hl-quick {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin: 8px 0 16px;
    text-align: center;
  }

  .hl-quick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 88px;
    padding: 12px 8px;
    background: #fff;
    border: 1px solid #e6e6ee;
    border-radius: 10px;
    color: #24324a;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    touch-action: manipulation;
  }

  .hl-quick-card i {
    font-size: 22px;
    color: #f1595d;
  }

  .hl-quick-card:hover,
  .hl-quick-card:focus {
    text-decoration: none;
    color: #f1595d;
  }

  .hl-x:has(table.hl-cards),
  .dataTables_wrapper:has(table.hl-cards),
  .card-body:has(table.hl-cards),
  [data-toggle="match-height"]:has(table.hl-cards) {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }

  table.hl-cards thead {
    display: none;
  }

  table.hl-cards,
  table.hl-cards tbody,
  table.hl-cards tr,
  table.hl-cards td {
    display: block;
    width: 100% !important;
    max-width: 100%;
    white-space: normal !important;
    box-sizing: border-box;
  }

  table.hl-cards tr {
    border: 1px solid #e6e6ee;
    border-radius: 8px;
    margin: 0 0 12px;
    padding: 6px 8px 8px;
    background: #fff;
  }

  table.hl-cards td {
    border: 0 !important;
    text-align: right !important;
    padding: 6px 4px !important;
    float: none !important;
  }

  table.hl-cards td.hl-card-main:before,
  table.hl-cards td.hl-card-extra:before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    color: #888;
    font-weight: 700;
    margin-bottom: 2px;
  }

  table.hl-cards td.hl-card-extra {
    display: none;
  }

  table.hl-cards tr.hl-open td.hl-card-extra {
    display: block;
  }

  table.hl-cards .hl-details-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    margin-top: 6px;
    padding: 8px 16px;
    border: 1px solid #f1595d;
    border-radius: 6px;
    background: #fff;
    color: #f1595d;
    font-size: 16px;
    font-weight: 700;
    touch-action: manipulation;
  }

  table .dropdown-toggle,
  table .btn-xs,
  table .btn-sm,
  .hl-menu-portal > li > a,
  .dropdown-menu > li > a {
    min-height: 44px;
    font-size: 16px;
    touch-action: manipulation;
  }

  table .dropdown-toggle,
  table .btn-xs,
  table .btn-sm {
    min-width: 44px;
    padding: 10px 14px;
    line-height: 22px;
  }

  .hl-menu-portal > li > a,
  .dropdown-menu > li > a {
    padding: 12px 16px !important;
    line-height: 22px;
  }

  .dataTables_paginate .paginate_button,
  .pagination > li > a,
  .pagination > li > span {
    min-width: 44px !important;
    min-height: 44px !important;
    line-height: 28px !important;
    padding: 6px 12px !important;
    margin: 2px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    touch-action: manipulation;
  }

  .hl-emp-pick [class*="col-"] {
    float: none !important;
    width: 100% !important;
    max-width: 100%;
    display: block;
    padding-bottom: 8px;
  }

  .hl-emp-pick .select2-container,
  .hl-emp-pick .select2-container .select2-selection--single {
    display: block !important;
    width: 100% !important;
    min-height: 44px !important;
    height: 44px !important;
  }

  .hl-emp-pick .select2-container .select2-selection__rendered {
    line-height: 42px !important;
  }

  .hl-emp-pick .btn {
    min-height: 44px;
    font-size: 16px;
  }

  .select2-container {
    width: 100% !important;
  }

  .select2-results__option {
    min-height: 44px;
    line-height: 28px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

@media print {
  .hl-m-badges,
  .hl-quick,
  .hl-details-btn {
    display: none !important;
  }

  table.hl-cards thead {
    display: table-header-group !important;
  }

  table.hl-cards {
    display: table !important;
  }

  table.hl-cards tbody {
    display: table-row-group !important;
  }

  table.hl-cards tr {
    display: table-row !important;
    border: 0;
    margin: 0;
    padding: 0;
  }

  table.hl-cards td {
    display: table-cell !important;
    width: auto !important;
  }

  table.hl-cards td.hl-card-extra {
    display: table-cell !important;
  }

  table.hl-cards td:before {
    content: none !important;
  }
}
