/* This file may be used for providing additional customizations to the Trestle
 * admin. It will be automatically included within all admin pages.
 *
 * For organizational purposes, you may wish to define your customizations
 * within individual partials in this folder and they'll be required below.
 *

*/

.auth-header {
    margin-bottom: -50px;
}


/* Image zoom effect on hover (magnifying glass effect) */
.image-zoom-container {
    overflow: hidden;
    border-radius: 4px;
    cursor: zoom-in;
    position: relative;
    display: block;
    height: fit-content;
}

.zoom-image {
    display: block;
    width: 100%;
    height: auto;
    transform-origin: center center;
    will-change: transform;
}

/* Avatar zoom container in sidebar - no min-height restriction */
.sidebar .image-zoom-container {
    min-height: auto;
}

/* Center title-large horizontally within app-sidebar-title */
.app-sidebar-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.app-sidebar-title .title-large {
    display: block;
    width: 100%;
    text-align: center;
}

/* Search box improvements */
.searchbox {
    position: relative;
    width: 100%;
}

.searchbox .input-group {
    border-radius: 0.375rem;
    overflow: hidden;
    align-items: stretch;
    width: 100% !important;
    display: flex !important;
    max-width: 100%;
}

.searchbox .input-group-prepend {
    flex-shrink: 0;
}

.searchbox .input-group-prepend .input-group-text {
    background-color: #f8f9fa;
    border-right: none;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
    height: auto;
    flex-shrink: 0;
}

.searchbox .input-group-prepend .input-group-text i,
.searchbox .input-group-prepend .input-group-text .fa {
    line-height: 2;
    margin: 0;
    padding: 0;
}

.searchbox .form-control {
    border-left: none;
    border-right: none;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
}

.searchbox .form-control:focus {
    border-color: #ced4da;
    box-shadow: none;
}

.searchbox .input-group-append {
    display: flex;
    align-items: stretch;
}

.searchbox .input-group-append .clear-search {
    background-color: #fff;
    border-left: none;
    color: #dc3545;
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    line-height: 2;
    height: auto;
}

.searchbox .input-group-append .clear-search i,
.searchbox .input-group-append .clear-search .fa {
    line-height: 2;
    margin: 0;
    padding: 0;
}

.searchbox .input-group-append .clear-search:hover {
    background-color: #f8f9fa;
    color: #c82333;
    transform: scale(1.1);
}

.searchbox .input-group-append .clear-search:focus {
    box-shadow: none;
    outline: none;
}

/* Avatar delete button in sidebar preview */
.avatar-preview-wrapper {
    position: relative;
}

.avatar-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #6c757d;
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.avatar-delete-btn:hover {
    background-color: #5a6268;
    color: #ffffff;
    transform: scale(1.1);
}

.avatar-delete-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}

.avatar-delete-btn .fa-times {
    font-size: 14px;
    line-height: 1;
}

/* TinyMCE height is now controlled via TinyMCE configurations in config/initializers/trestle.rb
 * Use data-tinymce-configuration-value to select a configuration:
 *   - "short" for 120px height
 *   - "medium" for 200px height
 *   - "tall" for 400px height
 * Example: editor :note, data: { tinymce_configuration_value: "short" }
 */

/* Add spacing between checkbox and label */
.has-fee-checkbox-wrapper .form-check-input {
  margin-right: 8px;
}

/* Date range filter styles */
.date-range-filter {
  margin-top: 15px;
  margin-bottom: 15px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  display: block;
}

.date-range-filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.date-range-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.date-range-filter-field label {
  margin: 0;
  white-space: nowrap;
  font-size: 0.875rem;
  color: #495057;
  font-weight: 500;
}

.date-range-filter-field input,
.date-range-filter-field select {
  width: 100%;
  min-width: 0;
}

.date-range-filter-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-end;
}

.date-range-filter-actions .btn {
  white-space: nowrap;
  min-width: 70px;
}

/* Date range clear button styling - orange text, white background, orange border */
.date-range-filter-actions [data-date-range-clear] {
  color: #FF8C42 !important;
  background-color: #ffffff !important;
  border-color: #FF8C42 !important;
  transition: all 0.2s ease-in-out;
}

.date-range-filter-actions [data-date-range-clear]:hover {
  color: #ffffff !important;
  background-color: #FF8C42 !important;
  border-color: #FF7043 !important;
}

.date-range-filter-actions [data-date-range-clear]:focus {
  box-shadow: 0 0 0 0.25rem rgba(255, 140, 66, 0.25);
  border-color: #FF8C42;
}

/* Ensure search box is on separate row below date range filter */
.main-content-header {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.main-content-header .date-range-filter {
  width: 100%;
  margin-bottom: 15px;
}

.main-content-header .searchbox {
  max-width: 100%;
  margin-top: 0;
}

/* Make search box match date range filter width */
.main-content-header .searchbox .input-group {
  width: 100%;
  max-width: 100%;
}

/* Ensure search box content area matches date range filter content area */
.main-content-header .searchbox {
  box-sizing: border-box;
}

.main-content-header .date-range-filter {
  box-sizing: border-box;
}

/* Responsive styles for mobile devices */
@media (max-width: 768px) {
  .date-range-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .date-range-filter-field {
    flex-direction: column;
    align-items: stretch;
    min-width: 100%;
  }

  .date-range-filter-field label {
    min-width: auto;
    margin-bottom: 5px;
  }

  .date-range-filter-field input {
    width: 100%;
    min-width: 100%;
  }

  .date-range-filter-actions {
    width: 100%;
    justify-content: stretch;
  }

  .date-range-filter-actions .btn {
    flex: 1;
  }
}

/* Responsive styles for small tablets */
@media (min-width: 769px) and (max-width: 992px) {
  .date-range-filter-field {
    min-width: 130px;
    flex: 0 1 calc(50% - 6px);
  }
}

/* Responsive styles for medium screens */
@media (min-width: 993px) and (max-width: 1200px) {
  .date-range-filter-field {
    min-width: 140px;
    flex: 0 1 auto;
  }
}

/* Responsive styles for large screens */
@media (min-width: 1201px) {
  .date-range-filter-field {
    min-width: 150px;
    flex: 0 1 auto;
  }
}

/* Warranties filter styles */
.warranties-filter {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 15px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

.warranties-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.warranties-filter-field label {
  margin: 0;
  white-space: nowrap;
  font-size: 0.875rem;
  color: #495057;
  font-weight: 500;
}

.warranties-filter-field input,
.warranties-filter-field select {
  width: 100%;
  min-width: 0;
}

.warranties-filter-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-end;
}

.warranties-filter-actions .btn {
  white-space: nowrap;
  min-width: 70px;
}

.warranties-filter-clear {
  color: #FF8C42 !important;
  background-color: #ffffff !important;
  border-color: #FF8C42 !important;
  transition: all 0.2s ease-in-out;
}

.warranties-filter-clear:hover {
  color: #ffffff !important;
  background-color: #FF8C42 !important;
  border-color: #FF7043 !important;
}

.warranties-filter-clear:focus {
  box-shadow: 0 0 0 0.25rem rgba(255, 140, 66, 0.25);
  border-color: #FF8C42;
}

/* Responsive styles for warranties filter - Mobile */
@media (max-width: 768px) {
  .warranties-filter {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 12px;
  }

  .warranties-filter-field {
    min-width: 100%;
    width: 100%;
  }

  .warranties-filter-actions {
    width: 100%;
    justify-content: stretch;
    align-items: stretch;
  }

  .warranties-filter-actions .btn {
    flex: 1;
  }
}

/* Responsive styles for warranties filter - Small tablets */
@media (min-width: 769px) and (max-width: 992px) {
  .warranties-filter-field {
    min-width: 130px;
    flex: 0 1 calc(50% - 6px);
  }

  .warranties-filter-actions {
    flex: 0 0 auto;
  }
}

/* Responsive styles for warranties filter - Medium screens */
@media (min-width: 993px) and (max-width: 1200px) {
  .warranties-filter-field {
    min-width: 140px;
    flex: 0 1 auto;
  }
}

/* Responsive styles for warranties filter - Large screens */
@media (min-width: 1201px) {
  .warranties-filter-field {
    min-width: 150px;
    flex: 0 1 auto;
  }
}

/* Sales Consultations Filter Styles */
.sales-consultations-filter {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 15px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

.sales-consultations-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.sales-consultations-filter-field label {
  margin: 0;
  white-space: nowrap;
  font-size: 0.875rem;
  color: #495057;
  font-weight: 500;
}

.sales-consultations-filter-field input,
.sales-consultations-filter-field select {
  width: 100%;
  min-width: 0;
}

.sales-consultations-filter-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-end;
}

.sales-consultations-filter-actions .btn {
  white-space: nowrap;
  min-width: 70px;
}

.sales-consultations-filter-clear {
  color: #FF8C42 !important;
  background-color: #ffffff !important;
  border-color: #FF8C42 !important;
  transition: all 0.2s ease-in-out;
}

.sales-consultations-filter-clear:hover {
  color: #ffffff !important;
  background-color: #FF8C42 !important;
  border-color: #FF7043 !important;
}

.sales-consultations-filter-clear:focus {
  box-shadow: 0 0 0 0.25rem rgba(255, 140, 66, 0.25);
  border-color: #FF8C42;
}

/* Responsive styles for sales consultations filter - Mobile */
@media (max-width: 768px) {
  .sales-consultations-filter {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 12px;
  }

  .sales-consultations-filter-field {
    min-width: 100%;
    width: 100%;
  }

  .sales-consultations-filter-actions {
    width: 100%;
    justify-content: stretch;
    align-items: stretch;
  }

  .sales-consultations-filter-actions .btn {
    flex: 1;
  }
}

/* Responsive styles for sales consultations filter - Small tablets */
@media (min-width: 769px) and (max-width: 992px) {
  .sales-consultations-filter-field {
    min-width: 130px;
    flex: 0 1 calc(50% - 6px);
  }

  .sales-consultations-filter-actions {
    flex: 0 0 auto;
  }
}

/* Responsive styles for sales consultations filter - Medium screens */
@media (min-width: 993px) and (max-width: 1200px) {
  .sales-consultations-filter-field {
    min-width: 140px;
    flex: 0 1 auto;
  }
}

/* Responsive styles for sales consultations filter - Large screens */
@media (min-width: 1201px) {
  .sales-consultations-filter-field {
    min-width: 150px;
    flex: 0 1 auto;
  }
}

/* Violations Filter Styles – same spacing/layout as products-filter and main-content-header */
.violations-filter {
  margin-bottom: 15px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

.violations-filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.violations-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.violations-filter-field label {
  margin: 0;
  white-space: nowrap;
  font-size: 0.875rem;
  color: #495057;
  font-weight: 500;
}

.violations-filter-field input,
.violations-filter-field select {
  width: 100%;
  min-width: 0;
}

.violations-filter-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-end;
  margin-left: auto;
}

.violations-filter-actions .btn {
  white-space: nowrap;
  min-width: 70px;
}

.violations-filter-clear {
  color: #FF8C42 !important;
  background-color: #ffffff !important;
  border-color: #FF8C42 !important;
  transition: all 0.2s ease-in-out;
}

.violations-filter-clear:hover {
  color: #ffffff !important;
  background-color: #FF8C42 !important;
  border-color: #FF7043 !important;
}

.violations-filter-clear:focus {
  box-shadow: 0 0 0 0.25rem rgba(255, 140, 66, 0.25);
  border-color: #FF8C42;
}

@media (max-width: 768px) {
  .violations-filter {
    padding: 12px;
  }

  .violations-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .violations-filter-field {
    min-width: 100%;
    width: 100%;
  }

  .violations-filter-actions {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
    align-items: stretch;
  }

  .violations-filter-actions .btn {
    flex: 1;
  }
}

@media (min-width: 769px) and (max-width: 992px) {
  .violations-filter-field {
    min-width: 130px;
    flex: 0 1 calc(50% - 6px);
  }

  .violations-filter-actions {
    flex: 0 0 auto;
  }
}

@media (min-width: 993px) and (max-width: 1200px) {
  .violations-filter-field {
    min-width: 140px;
    flex: 0 1 auto;
  }
}

@media (min-width: 1201px) {
  .violations-filter-field {
    min-width: 150px;
    flex: 0 1 auto;
  }
}

/* Products Filter Styles */
.products-filter {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 15px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

.products-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}

.products-filter-field label {
  margin: 0;
  white-space: nowrap;
  font-size: 0.875rem;
  color: #495057;
  font-weight: 500;
}

.products-filter-field input,
.products-filter-field select {
  width: 100%;
  min-width: 0;
}

.products-filter-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-end;
}

.products-filter-actions .btn {
  white-space: nowrap;
  min-width: 70px;
}

.products-filter-clear {
  color: #FF8C42 !important;
  background-color: #ffffff !important;
  border-color: #FF8C42 !important;
  transition: all 0.2s ease-in-out;
}

.products-filter-clear:hover {
  color: #ffffff !important;
  background-color: #FF8C42 !important;
  border-color: #FF7043 !important;
}

.products-filter-clear:focus {
  box-shadow: 0 0 0 0.25rem rgba(255, 140, 66, 0.25);
  border-color: #FF8C42;
}

/* Responsive styles for products filter - Mobile */
@media (max-width: 768px) {
  .products-filter {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 12px;
  }

  .products-filter-field {
    min-width: 100%;
    width: 100%;
  }

  .products-filter-actions {
    width: 100%;
    justify-content: stretch;
    align-items: stretch;
  }

  .products-filter-actions .btn {
    flex: 1;
  }
}

/* Responsive styles for products filter - Small tablets */
@media (min-width: 769px) and (max-width: 992px) {
  .products-filter-field {
    min-width: 130px;
    flex: 0 1 calc(50% - 6px);
  }

  .products-filter-actions {
    flex: 0 0 auto;
  }
}

/* Responsive styles for products filter - Medium screens */
@media (min-width: 993px) and (max-width: 1200px) {
  .products-filter-field {
    min-width: 140px;
    flex: 0 1 auto;
  }
}

/* Responsive styles for products filter - Large screens */
@media (min-width: 1201px) {
  .products-filter-field {
    min-width: 150px;
    flex: 0 1 auto;
  }
}

.col-assignee {
  width: 8%;
  min-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-code {
  width: 8%;
}

.col-warranty-period {
  width: 6%;
}

.col-employee {
  width: 10%;
  min-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-business-result {
  width: 1%;
}

.col-check-in-at {
  width: 5%;
}

.col-phone {
  width: 5%;
  min-width: 10px;
  text-align: center;
}

.col-price {
  width: 6%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-supported-at {
  width: 10%;
  min-width: 120px;
  max-width: 150px;
}

.col-work-date {
  width: 6%;
  min-width: 100px;
  max-width: 120px;
}

.col-work-processing-result {
  width: 8%;
  min-width: 100px;
  max-width: 130px;
}

/* Customer columns */
.col-customer, .col-temp-customer {
  width: 10%;
  min-width: 120px;
  max-width: 180px;
}

.col-sales-invoice-code {
  width: 10%;
  min-width: 120px;
  max-width: 150px;
}

/* Repair Work Logs Table Optimization */
/* Enhanced table container with smooth horizontal scroll */
.table-container {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #FF8C42 #f7fafc;
}

/* Custom scrollbar for table container */
.table-container::-webkit-scrollbar {
  height: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: #f7fafc;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #FF8C42;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #FF7043;
}

/* Sticky columns for important information */
.trestle-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* Actions column */
.trestle-table thead th.table-actions,
.trestle-table tbody td.table-actions {
  z-index: 10;
  background-color: #fff;
  white-space: nowrap;
}

.trestle-table thead th.table-actions {
  background-color: #f8f9fa;
  z-index: 11;
}

/* Optimize table cell padding and font size */
.trestle-table td,
.trestle-table th {
  padding: 8px 10px;
  font-size: 0.875rem;
  line-height: 1.4;
  vertical-align: middle;
}

.trestle-table th.col-assignee,
.trestle-table td.col-assignee {
  width: 7%;
  min-width: 100px;
  max-width: 130px;
}

/* Text truncation for long content */
.trestle-table td {
  max-width: 200px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Rich text content optimization */
.trestle-table td p {
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 2.0;
}

.trestle-table td p:not(:last-child) {
  margin-bottom: 4px;
}

/* Hover effect for better UX */
.trestle-table tbody tr:hover {
  background-color: #f8f9fa;
}

.trestle-table tbody tr:hover td.table-actions {
  background-color: #f8f9fa;
}

/* Visual scroll indicator */
.table-container::before,
.table-container::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.3s;
}

.table-container::before {
  left: 0;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.9), transparent);
  opacity: 0;
}

.table-container::after {
  right: 0;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.9), transparent);
  opacity: 0;
}

.table-container.scrollable-left::before {
  opacity: 1;
}

.table-container.scrollable-right::after {
  opacity: 1;
}

/* Responsive optimizations */
@media (max-width: 1200px) {
  .trestle-table td,
  .trestle-table th {
    padding: 6px 8px;
    font-size: 0.8125rem;
  }
}

@media (max-width: 768px) {
  .table-container {
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .trestle-table td,
  .trestle-table th {
    padding: 6px 6px;
    font-size: 0.75rem;
  }

  /* Reduce min-widths on mobile */
  .trestle-table th.col-assignee,
  .trestle-table td.col-assignee {
    min-width: 80px;
  }

  .col-customer, .col-temp-customer {
    min-width: 100px;
  }

  .col-temp-customer {
    min-width: 100px;
  }
}

/* Improve action buttons spacing */
.trestle-table td.table-actions .btn {
  margin: 0 2px;
  padding: 4px 8px;
}

.trestle-table td.table-actions .btn-sm {
  font-size: 0.75rem;
}

/* Better alignment for center columns */
.trestle-table td[align="center"],
.trestle-table th[align="center"] {
  text-align: center;
}

/* Status badges optimization */
.trestle-table .badge {
  font-size: 0.75rem;
  padding: 3px 6px;
  white-space: nowrap;
}

/* Optimize date columns */
.trestle-table td time,
.trestle-table td .datestamp {
  white-space: nowrap;
  font-size: 0.875rem;
}

/* Optimize phone number display */
.trestle-table td small {
  display: block;
  font-size: 0.75rem;
  line-height: 1.3;
}

/* Better spacing for action buttons */
.trestle-table td.table-actions {
  padding: 6px 8px;
}

.trestle-table td.table-actions .btn {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Improve readability for long text columns */
.trestle-table td[class*="col-"] {
  position: relative;
}

/* Add subtle border between columns for better separation */
.trestle-table th:not(:last-child),
.trestle-table td:not(:last-child) {
  border-right: 1px solid #f0f0f0;
}


/* Responsive table wrapper */
@media (max-width: 576px) {
  .table-container {
    margin: 0 -15px;
    padding: 0 15px;
  }
  
  .trestle-table {
    min-width: 1200px; /* Ensure horizontal scroll on very small screens */
  }
  
}

/* Form toolbar layout: all buttons stacked vertically, aligned to right */
/* Only apply when secondary toolbar has buttons (form pages) */
.content-header-toolbars:has(.secondary-toolbar .btn),
.content-header-toolbars:has(.secondary-toolbar a.btn) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  width: auto;
  max-width: fit-content;
  margin-left: auto;
}

.content-header-toolbars:has(.secondary-toolbar .btn) .primary-toolbar,
.content-header-toolbars:has(.secondary-toolbar a.btn) .primary-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.content-header-toolbars:has(.secondary-toolbar .btn) .primary-toolbar .btn,
.content-header-toolbars:has(.secondary-toolbar a.btn) .primary-toolbar .btn {
  width: auto;
  min-width: 200px;
  max-width: 300px;
}

.content-header-toolbars:has(.secondary-toolbar .btn) .secondary-toolbar,
.content-header-toolbars:has(.secondary-toolbar a.btn) .secondary-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.content-header-toolbars:has(.secondary-toolbar .btn) .secondary-toolbar .btn,
.content-header-toolbars:has(.secondary-toolbar .btn) .secondary-toolbar a.btn,
.content-header-toolbars:has(.secondary-toolbar a.btn) .secondary-toolbar .btn,
.content-header-toolbars:has(.secondary-toolbar a.btn) .secondary-toolbar a.btn {
  width: auto;
  min-width: 200px;
  max-width: 300px;
  white-space: normal;
  word-wrap: break-word;
}

/* Responsive: on mobile, buttons align to left */
@media (max-width: 768px) {
  .content-header-toolbars:has(.secondary-toolbar .btn),
  .content-header-toolbars:has(.secondary-toolbar a.btn) {
    margin-left: 0;
    align-items: stretch;
    width: 100%;
  }

  .content-header-toolbars:has(.secondary-toolbar .btn) .primary-toolbar,
  .content-header-toolbars:has(.secondary-toolbar a.btn) .primary-toolbar,
  .content-header-toolbars:has(.secondary-toolbar .btn) .secondary-toolbar,
  .content-header-toolbars:has(.secondary-toolbar a.btn) .secondary-toolbar {
    align-items: stretch;
  }

  .content-header-toolbars:has(.secondary-toolbar .btn) .primary-toolbar .btn,
  .content-header-toolbars:has(.secondary-toolbar a.btn) .primary-toolbar .btn,
  .content-header-toolbars:has(.secondary-toolbar .btn) .secondary-toolbar .btn,
  .content-header-toolbars:has(.secondary-toolbar .btn) .secondary-toolbar a.btn,
  .content-header-toolbars:has(.secondary-toolbar a.btn) .secondary-toolbar .btn,
  .content-header-toolbars:has(.secondary-toolbar a.btn) .secondary-toolbar a.btn {
    width: 100%;
    max-width: 100%;
  }
}

/* Table Row Conditional Styling */
/* Background colors for rows based on work_processing_result descriptions */

/* Đồng Ý - Đã Giao Máy: Light green (success - completed and delivered) */
.trestle-table tbody tr.row-delivered-machine {
  background-color: #d4edda !important;
}

.trestle-table tbody tr.row-delivered-machine:hover {
  background-color: #c3e6cb !important;
}

.trestle-table tbody tr.row-delivered-machine td.table-actions {
  background-color: #d4edda !important;
}

.trestle-table tbody tr.row-delivered-machine:hover td.table-actions {
  background-color: #c3e6cb !important;
}

/* Đã Báo Giá - Chờ KH Báo Lại: Light purple (waiting for customer response) */
.trestle-table tbody tr.row-waiting-customer-response {
  background-color: #e2d9f3 !important;
}

.trestle-table tbody tr.row-waiting-customer-response:hover {
  background-color: #d4c5e8 !important;
}

.trestle-table tbody tr.row-waiting-customer-response td.table-actions {
  background-color: #e2d9f3 !important;
}

.trestle-table tbody tr.row-waiting-customer-response:hover td.table-actions {
  background-color: #d4c5e8 !important;
}

/* Không Đồng Ý - Chưa Trả Máy: Light red (danger - not agreed, not returned) */
.trestle-table tbody tr.row-not-agreed-not-returned {
  background-color: #f8d7da !important;
}

.trestle-table tbody tr.row-not-agreed-not-returned:hover {
  background-color: #f5c6cb !important;
}

.trestle-table tbody tr.row-not-agreed-not-returned td.table-actions {
  background-color: #f8d7da !important;
}

.trestle-table tbody tr.row-not-agreed-not-returned:hover td.table-actions {
  background-color: #f5c6cb !important;
}

/* Đồng Ý - Chưa Giao Máy: Light purple-gray (agreed but not delivered yet) */
.trestle-table tbody tr.row-agreed-not-delivered {
  background-color: #d6d4e8 !important;
}

.trestle-table tbody tr.row-agreed-not-delivered:hover {
  background-color: #c8c5db !important;
}

.trestle-table tbody tr.row-agreed-not-delivered td.table-actions {
  background-color: #d6d4e8 !important;
}

.trestle-table tbody tr.row-agreed-not-delivered:hover td.table-actions {
  background-color: #c8c5db !important;
}

/* Hoàn thành: Medium green (success - completed) */
.trestle-table tbody tr.row-completed {
  background-color: #c3e6cb !important;
}

.trestle-table tbody tr.row-completed:hover {
  background-color: #b1dfbb !important;
}

.trestle-table tbody tr.row-completed td.table-actions {
  background-color: #c3e6cb !important;
}

.trestle-table tbody tr.row-completed:hover td.table-actions {
  background-color: #b1dfbb !important;
}

/* Không Đồng Ý - Đã Trả Máy: Light pink/purple (not agreed but returned) */
.trestle-table tbody tr.row-not-agreed-returned {
  background-color: #f0d6e8 !important;
}

.trestle-table tbody tr.row-not-agreed-returned:hover {
  background-color: #e8c4d9 !important;
}

.trestle-table tbody tr.row-not-agreed-returned td.table-actions {
  background-color: #f0d6e8 !important;
}

.trestle-table tbody tr.row-not-agreed-returned:hover td.table-actions {
  background-color: #e8c4d9 !important;
}

/* Không hoàn thành: Medium red (danger - failed/not completed) */
.trestle-table tbody tr.row-not-completed {
  background-color: #f5c6cb !important;
}

.trestle-table tbody tr.row-not-completed:hover {
  background-color: #f1aeb5 !important;
}

.trestle-table tbody tr.row-not-completed td.table-actions {
  background-color: #f5c6cb !important;
}

.trestle-table tbody tr.row-not-completed:hover td.table-actions {
  background-color: #f1aeb5 !important;
}

/* Đang xử lý: Medium red (warning - in progress, needs attention) */
.trestle-table tbody tr.row-in-progress {
  background-color: #f1aeb5 !important;
}

.trestle-table tbody tr.row-in-progress:hover {
  background-color: #ee9ca5 !important;
}

.trestle-table tbody tr.row-in-progress td.table-actions {
  background-color: #f1aeb5 !important;
}

.trestle-table tbody tr.row-in-progress:hover td.table-actions {
  background-color: #ee9ca5 !important;
}

/* Holidays filter: filters and actions grouped, responsive */
.holidays-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.holidays-filter-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.holidays-filter-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 576px) {
  .holidays-filter .holidays-filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .holidays-filter .holidays-filter-fields {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .holidays-filter .holidays-filter-fields select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .holidays-filter .holidays-filter-actions {
    justify-content: flex-start;
    margin-top: 4px;
  }
}
